Blame view

src/main/java/com/huaheng/pc/u8/service/ICSShipmentDetailServiceImpl.java 6.04 KB
1
2
3
package com.huaheng.pc.u8.service;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
4
5
6
7
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;
8
import com.huaheng.pc.u8.domain.ICSShipmentDetail;
9
import com.huaheng.pc.u8.domain.ICSShipmentHeader;
10
11
12
import com.huaheng.pc.u8.mapper.ICSShipmentDetailMapper;
import org.springframework.stereotype.Service;
13
14
15
16
17
18
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
19
20
21
22
23
24
25
26
27
/**
 * 出库下发或回传单子 服务层实现
 *
 * @author huaheng
 * @date 2018-12-17
 */
@Service
public class ICSShipmentDetailServiceImpl extends ServiceImpl<ICSShipmentDetailMapper, ICSShipmentDetail> implements ICSShipmentDetailService {
28
29
30
31
32
33
34
35
36
37
38
39
    @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();
tongzhonghao authored
40
            detail1.setAutoID(detail.getReferId());
41
42
43
44
45
46
47
            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());
tongzhonghao authored
48
            detail1.setID(header.getReferId());
49
50
51
52
53
54
            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);
        }
tongzhonghao authored
55
56
57
        header.setCMemo(detailList.get(0).getMoCode());
        header.setReferId(null);
        header.setReferCode(null);
58
59
60
61
62
63
64
65
66
67
        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) {
68
69
70
71
72
73
74
        List<ICSShipmentDetail> details = new ArrayList<>();
        for (ShipmentDetail detail : detailList) {
            BigDecimal totalQty = detailsQtyMap.get(detail.getId());
            if(totalQty==null){
                continue;
            }
            ICSShipmentDetail detail1 = new ICSShipmentDetail();
tongzhonghao authored
75
            detail1.setAutoID(detail.getAutoId());
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
            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;
96
97
98
99
    }

    @Override
    public List<ICSShipmentDetail> getDetailsByPRO(List<ShipmentDetail> detailList, ICSShipmentHeader header, Map<Integer, BigDecimal> detailsQtyMap) {
100
101
102
103
104
105
106
107
        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();
tongzhonghao authored
108
            detail1.setAutoID(detail.getAutoId());
109
110
111
112
113
114
115
116
117
            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());
tongzhonghao authored
118
            detail1.setIArrsId(detail.getAutoId());
119
120
121
122
123
124
125
126
127
128
129
130
131
            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;
132
    }
133
}