|
1
2
|
package com.huaheng.pc.u8.service;
|
|
3
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
4
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
5
6
|
import com.huaheng.common.utils.DateUtils;
import com.huaheng.common.utils.StringUtils;
|
|
7
|
import com.huaheng.common.utils.Wrappers;
|
|
8
9
|
import com.huaheng.pc.config.company.domain.CompanyU8;
import com.huaheng.pc.config.company.service.CompanyU8Service;
|
|
10
|
import com.huaheng.pc.receipt.receiptDetail.domain.ReceiptDetail;
|
|
11
|
import com.huaheng.pc.u8.domain.ICSReceiptDetail;
|
|
12
|
import com.huaheng.pc.u8.domain.ICSReceiptHeader;
|
|
13
14
15
|
import com.huaheng.pc.u8.mapper.ICSReceiptDetailMapper;
import org.springframework.stereotype.Service;
|
|
16
|
import javax.annotation.Resource;
|
|
17
|
import java.math.BigDecimal;
|
|
18
|
import java.util.ArrayList;
|
|
19
|
import java.util.List;
|
|
20
|
import java.util.Map;
|
|
21
22
|
import java.util.stream.Collectors;
|
|
23
24
25
26
27
28
29
30
31
|
/**
* 入库下发或回传子单 实现层
*
* @author huaheng
* @date 2019-1-2
*/
@Service
public class ICSReceiptDetailServiceImpl extends ServiceImpl<ICSReceiptDetailMapper,ICSReceiptDetail> implements ICSReceiptDetailService{
|
|
32
33
34
35
|
@Resource
private CompanyU8Service companyU8Service;
|
|
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
/**
* 根据入库单头rId删除
* @param headerId ICSReceiptHeader rId
* @return
*/
@Override
public boolean removeByHeaderId(Integer headerId) {
List<ICSReceiptDetail> receiptDetails = this.list(new LambdaQueryWrapper<ICSReceiptDetail>()
.eq(ICSReceiptDetail::getHeaderId, headerId));
List<Integer> ids = receiptDetails.stream().map(ICSReceiptDetail::getRid).collect(Collectors.toList());
return this.removeByIds(ids);
}
@Override
|
|
50
|
public List<ICSReceiptDetail> getDetailsByPI(List<ReceiptDetail> detailList, ICSReceiptHeader header, Map<Integer, BigDecimal> detailsQtyMap) {
|
|
51
52
|
List<ICSReceiptDetail> details = new ArrayList<>();
for (ReceiptDetail receiptDetail : detailList) {
|
|
53
54
55
56
|
BigDecimal totalQty = detailsQtyMap.get(receiptDetail.getId());
if(totalQty==null){
continue;
}
|
|
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
|
ICSReceiptDetail detail = new ICSReceiptDetail();
detail.setAutoID(receiptDetail.getAutoId());
detail.setCCode(header.getReferCode());
if(!StringUtils.isEmpty(receiptDetail.getBatch())){
detail.setCDefine22(receiptDetail.getBatch());
}
if(!StringUtils.isEmpty(receiptDetail.getMoCode())){
detail.setCDefine22(receiptDetail.getMoCode());
}
detail.setCDefine23(receiptDetail.getLot());
detail.setCComUnitName(receiptDetail.getMaterialUnit());
detail.setCInvCode(receiptDetail.getMaterialCode());
detail.setCInvName(receiptDetail.getMaterialName());
detail.setCInvStd(receiptDetail.getMaterialSpec());
detail.setCWHCode(receiptDetail.getUWarehouseCode());
CompanyU8 companyU8 = companyU8Service.getCompanyU8ByCode(receiptDetail.getCompanyCode(), receiptDetail.getWarehouseCode());
detail.setCompanyCode(companyU8.getUCompanyCode());
detail.setIArrsId(receiptDetail.getAutoId());
detail.setCModifyDate(DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS,DateUtils.getNowDate()));
detail.setID(receiptDetail.getId());
|
|
77
|
// detail.setIrowno(Integer.parseInt(receiptDetail.getReferLineNum()));
|
|
78
|
detail.setIPOsID(receiptDetail.getReferId());
|
|
79
|
detail.setIQuantity(totalQty);
|
|
80
81
82
83
84
85
86
87
|
detail.setPOCode(receiptDetail.getReferCode());
detail.setPOID(header.getReferId());
detail.setPODID(receiptDetail.getReferId());
detail.setCComUnitName(receiptDetail.getMaterialUnit());
details.add(detail);
}
return details;
|
|
88
89
90
|
}
@Override
|
|
91
|
public List<ICSReceiptDetail> getDetailsByPCI(List<ReceiptDetail> detailList, ICSReceiptHeader header,Map<Integer,BigDecimal> detailsQtyMap) {
|
|
92
93
94
95
|
return null;
}
@Override
|
|
96
|
public List<ICSReceiptDetail> getDetailsByCI(List<ReceiptDetail> detailList, ICSReceiptHeader header,Map<Integer,BigDecimal> detailsQtyMap) {
|
|
97
98
|
List<ICSReceiptDetail> details = new ArrayList<>();
for (ReceiptDetail receiptDetail : detailList) {
|
|
99
100
101
102
|
BigDecimal totalQty = detailsQtyMap.get(receiptDetail.getId());
if(totalQty==null){
continue;
}
|
|
103
104
105
106
107
108
109
|
ICSReceiptDetail detail = new ICSReceiptDetail();
detail.setAutoID(receiptDetail.getAutoId());
detail.setCCode(header.getCCode());
detail.setCComUnitName(receiptDetail.getMaterialUnit());
detail.setCInvCode(receiptDetail.getMaterialCode());
detail.setCInvName(receiptDetail.getMaterialName());
detail.setCInvStd(receiptDetail.getMaterialSpec());
|
|
110
|
CompanyU8 companyU8 = companyU8Service.getCompanyU8ByCode(receiptDetail.getCompanyCode(), receiptDetail.getWarehouseCode());
|
|
111
112
|
detail.setCompanyCode(companyU8.getUCompanyCode());
detail.setCModifyDate(DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS,DateUtils.getNowDate()));
|
|
113
|
detail.setID(header.getReferId());
|
|
114
|
detail.setIQuantity(totalQty.negate());
|
|
115
116
117
|
detail.setMoCode(receiptDetail.getMoCode());
details.add(detail);
}
|
|
118
119
|
header.setReferId(null);
header.setReferCode(null);
|
|
120
|
return details;
|
|
121
|
}
|
|
122
|
|
|
123
|
@Override
|
|
124
|
public List<ICSReceiptDetail> getDetailsBySRI(List<ReceiptDetail> detailList, ICSReceiptHeader header,Map<Integer,BigDecimal> detailsQtyMap) {
|
|
125
126
|
List<ICSReceiptDetail> details = new ArrayList<>();
for (ReceiptDetail receiptDetail : detailList) {
|
|
127
128
129
130
|
BigDecimal totalQty = detailsQtyMap.get(receiptDetail.getId());
if(totalQty==null){
continue;
}
|
|
131
132
|
ICSReceiptDetail detail = new ICSReceiptDetail();
detail.setAutoID(receiptDetail.getReferId());
|
|
133
|
detail.setCCode(header.getReferCode());
|
|
134
135
136
137
|
detail.setCComUnitName(receiptDetail.getMaterialUnit());
detail.setCInvCode(receiptDetail.getMaterialCode());
detail.setCInvName(receiptDetail.getMaterialName());
detail.setCInvStd(receiptDetail.getMaterialUnit());
|
|
138
|
CompanyU8 companyU8 = companyU8Service.getCompanyU8ByCode(receiptDetail.getCompanyCode(), receiptDetail.getWarehouseCode());
|
|
139
140
141
|
detail.setCompanyCode(companyU8.getUCompanyCode());
detail.setCModifyDate(DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS,DateUtils.getNowDate()));
detail.setID(receiptDetail.getId());
|
|
142
|
detail.setIQuantity(totalQty.negate());
|
|
143
|
detail.setCSOAutoID(receiptDetail.getReferId());
|
|
144
|
detail.setCSOCode(receiptDetail.getReferCode());
|
|
145
146
147
148
149
150
|
detail.setCSOID(receiptDetail.getSoId());
detail.setCWHCode(receiptDetail.getUWarehouseCode());
detail.setDLID(header.getReferId());
detail.setID(header.getReferId());
details.add(detail);
}
|
|
151
152
|
header.setReferId(null);
header.setReferCode(null);
|
|
153
|
return details;
|
|
154
|
}
|
|
155
156
157
158
159
160
161
162
163
164
165
166
|
@Override
public ICSReceiptDetail selectModel(ICSReceiptDetail model){
LambdaQueryWrapper<ICSReceiptDetail> lamb = Wrappers.lambdaQuery();
lamb.eq(StringUtils.isNotEmpty(model.getCCode()),ICSReceiptDetail::getCCode,model.getCCode());
lamb.eq(StringUtils.isNotEmpty(model.getCompanyCode()),ICSReceiptDetail::getCompanyCode,model.getCompanyCode());
lamb.eq(StringUtils.isNotEmpty(model.getCInvCode()),ICSReceiptDetail::getCInvCode,model.getCInvCode());
lamb.eq(StringUtils.isNotNull(model.getITrIds()),ICSReceiptDetail::getITrIds,model.getITrIds());
lamb.eq(StringUtils.isNotNull(model.getAutoID()),ICSReceiptDetail::getAutoID,model.getAutoID());
lamb.last("limit 1");
return this.getOne(lamb);
}
|
|
167
168
169
170
171
172
173
174
175
176
177
178
179
|
@Override
public List<ICSReceiptDetail> selectModelList(ICSReceiptDetail model){
LambdaQueryWrapper<ICSReceiptDetail> lamb = Wrappers.lambdaQuery();
lamb.eq(StringUtils.isNotEmpty(model.getCCode()),ICSReceiptDetail::getCCode,model.getCCode());
lamb.eq(StringUtils.isNotNull(model.getID()),ICSReceiptDetail::getID,model.getID());
lamb.eq(StringUtils.isNotEmpty(model.getCompanyCode()),ICSReceiptDetail::getCompanyCode,model.getCompanyCode());
lamb.eq(StringUtils.isNotEmpty(model.getCInvCode()),ICSReceiptDetail::getCInvCode,model.getCInvCode());
lamb.eq(StringUtils.isNotNull(model.getITrIds()),ICSReceiptDetail::getITrIds,model.getITrIds());
lamb.eq(StringUtils.isNotNull(model.getAutoID()),ICSReceiptDetail::getAutoID,model.getAutoID());
return this.list(lamb);
}
|
|
180
|
}
|