ICSShipmentDetailServiceImpl.java
6.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
package com.huaheng.pc.u8.service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.huaheng.common.utils.DateUtils;
import com.huaheng.pc.config.company.domain.CompanyU8;
import com.huaheng.pc.config.company.service.CompanyU8Service;
import com.huaheng.pc.shipment.shipmentDetail.domain.ShipmentDetail;
import com.huaheng.pc.u8.domain.ICSShipmentDetail;
import com.huaheng.pc.u8.domain.ICSShipmentHeader;
import com.huaheng.pc.u8.mapper.ICSShipmentDetailMapper;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
/**
* 出库下发或回传单子 服务层实现
*
* @author huaheng
* @date 2018-12-17
*/
@Service
public class ICSShipmentDetailServiceImpl extends ServiceImpl<ICSShipmentDetailMapper, ICSShipmentDetail> implements ICSShipmentDetailService {
@Resource
private CompanyU8Service companyU8Service;
@Override
public List<ICSShipmentDetail> getDetailsByMO(List<ShipmentDetail> detailList, ICSShipmentHeader header, Map<Integer, BigDecimal> detailsQtyMap) {
List<ICSShipmentDetail> details = new ArrayList<>();
for (ShipmentDetail detail : detailList) {
BigDecimal totalQty = detailsQtyMap.get(detail.getId());
if(totalQty==null){
continue;
}
ICSShipmentDetail detail1 = new ICSShipmentDetail();
detail1.setAutoID(detail.getReferId());
detail1.setCCode(header.getReferCode());
detail1.setCComUnitName(detail.getMaterialUnit());
detail1.setCInvCode(detail.getMaterialCode());
detail1.setCInvName(detail.getMaterialName());
detail1.setCInvStd(detail.getMaterialSpec());
CompanyU8 companyU8 = companyU8Service.getCompanyU8ByCode(detail.getCompanyCode(), detail.getWarehouseCode());
detail1.setCompanyCode(companyU8.getUCompanyCode());
detail1.setID(header.getReferId());
detail1.setIMaIDs(0);
detail1.setCModifyDate(DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS,DateUtils.getNowDate()));
detail1.setIQuantity(totalQty);
detail1.setMoCode(detail.getMoCode());
details.add(detail1);
}
header.setCMemo(detailList.get(0).getMoCode());
header.setReferId(null);
header.setReferCode(null);
return details;
}
@Override
public List<ICSShipmentDetail> getDetailsByOO(List<ShipmentDetail> detailList, ICSShipmentHeader header, Map<Integer, BigDecimal> detailsQtyMap) {
return null;
}
@Override
public List<ICSShipmentDetail> getDetailsBySO(List<ShipmentDetail> detailList, ICSShipmentHeader header, Map<Integer, BigDecimal> detailsQtyMap) {
List<ICSShipmentDetail> details = new ArrayList<>();
for (ShipmentDetail detail : detailList) {
BigDecimal totalQty = detailsQtyMap.get(detail.getId());
if(totalQty==null){
continue;
}
ICSShipmentDetail detail1 = new ICSShipmentDetail();
detail1.setAutoID(detail.getAutoId());
detail1.setCCode(header.getReferCode());
detail1.setCComUnitName(detail.getMaterialUnit());
detail1.setCInvCode(detail.getMaterialCode());
detail1.setCInvName(detail.getMaterialName());
detail1.setCInvStd(detail.getMaterialSpec());
CompanyU8 companyU8 = companyU8Service.getCompanyU8ByCode(detail.getCompanyCode(), detail.getWarehouseCode());
detail1.setCSOAutoID(detail.getSoAutoId());
detail1.setCSOCode(detail.getSoCode());
detail1.setCSOID(detail.getSoId());
detail1.setCWHCode(detail.getUWarehouseCode());
detail1.setDLID(header.getReferId());
detail1.setCompanyCode(companyU8.getUCompanyCode());
detail1.setID(header.getReferId());
detail1.setCModifyDate(DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS,DateUtils.getNowDate()));
detail1.setIQuantity(totalQty);
details.add(detail1);
header.setReferId(null);
header.setReferCode(null);
}
return details;
}
@Override
public List<ICSShipmentDetail> getDetailsByPRO(List<ShipmentDetail> detailList, ICSShipmentHeader header, Map<Integer, BigDecimal> detailsQtyMap) {
List<ICSShipmentDetail> details = new ArrayList<>();
for (ShipmentDetail detail : detailList) {
BigDecimal totalQty = detailsQtyMap.get(detail.getId());
if(totalQty==null){
continue;
}
totalQty = totalQty.negate();
ICSShipmentDetail detail1 = new ICSShipmentDetail();
detail1.setAutoID(detail.getAutoId());
detail1.setCCode(header.getReferCode());
detail1.setCComUnitName(detail.getMaterialUnit());
detail1.setCInvCode(detail.getMaterialCode());
detail1.setCInvName(detail.getMaterialName());
detail1.setCInvStd(detail.getMaterialSpec());
CompanyU8 companyU8 = companyU8Service.getCompanyU8ByCode(detail.getCompanyCode(), detail.getWarehouseCode());
detail1.setCModifyDate(DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS,DateUtils.getNowDate()));
detail1.setCWHCode(detail.getUWarehouseCode());
detail1.setCompanyCode(companyU8.getUCompanyCode());
detail1.setIArrsId(detail.getAutoId());
detail1.setID(header.getReferId());
detail1.setIPOsID(detail.getPodId());
detail1.setPODID(detail.getPodId());
detail1.setPOID(detail.getPoId());
detail1.setPOCode(detail.getPoCode());
detail1.setIrowno(Integer.valueOf(detail.getReferLineNum()));
detail1.setCWHCode(detail.getUWarehouseCode());
detail1.setIQuantity(totalQty);
details.add(detail1);
}
header.setReferId(null);
header.setReferCode(null);
return details;
}
}