#
luxiaotao1123
2021-04-03 c9686962d78c018a89c5be7023b4ef74960e5d5b
src/main/java/zy/cloud/wms/manager/service/impl/WorkServiceImpl.java
@@ -20,10 +20,7 @@
import zy.cloud.wms.manager.entity.result.StoPrintVo;
import zy.cloud.wms.manager.service.*;
import java.util.ArrayList;
import java.util.Date;
import java.util.Iterator;
import java.util.List;
import java.util.*;
/**
 * Created by vincent on 2021/2/25
@@ -58,6 +55,9 @@
    @Transactional
    public R stockPakin(PakinParam param, Long userId) {
        Node node = nodeService.selectByUuid(param.getNodeId());
        if (node == null) {
            node = nodeService.selectById(param.getNodeId());
        }
        if (node == null) {
            return R.error("货位不存在");
        }
@@ -96,6 +96,30 @@
                }
            }
        }
        // 上报给erp
        List<BillDto> dtos = new ArrayList<>();
        for (MatnrDto dto : param.getMats()) {
            BillDto billDto = new BillDto();
            billDto.setMatnr(dto.getMatnr());
            billDto.setQty(dto.getCount());
            dtos.add(billDto);
        }
        Integer docId = Optional.ofNullable(param.getDocType()).orElse(34);
        String docNum = String.valueOf(snowflakeIdWorker.nextId());
        switch (docId) {
            case 34:    // 采购单
                docNum = "PU-" + String.valueOf(snowflakeIdWorker.nextId()).substring(0, 15);
                break;
            case 45:    // 销售退货单
                docNum = "SR-" + String.valueOf(snowflakeIdWorker.nextId()).substring(0, 15);
                break;
            default:
                break;
        }
        if (!erpService.uploadBill(dtos, docId, docNum)) {
            throw new CoolException("无法上报至erp");
        }
        return R.ok("入库成功");
    }