自动化立体仓库 - WMS系统
#
18516761980
2023-03-05 93a5853a6956d39b2f6fa940c3b9a5701f9498d8
#
4个文件已修改
119 ■■■■■ 已修改文件
src/main/java/com/zy/asrs/service/impl/OpenServiceImpl.java 113 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/common/web/WcsController.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/webapp/static/js/common.js 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/webapp/static/js/wrkMast/wrkMast.js 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/service/impl/OpenServiceImpl.java
@@ -55,9 +55,7 @@
    @Autowired
    private WaitPakinService waitPakinService;
    @Autowired
    private WrkMastService wrkMastService;
    @Autowired
    private WorkLogHandler workLogHandler;
    private WrkDetlService wrkDetlService;
    @Override
    @Transactional
@@ -488,6 +486,11 @@
        matSyncParam.setMats(matParams);
        return matSyncParam;
    }
    public void callApiLogSave(MatSyncParam.Mats matParam, String tableName, String response, Boolean bool) {
        apiLogService.save("ERP下发商品信息", tableName, "null", "10.10.10.1",
                "物料编码:" + matParam.getMatnr() + "、物料名称:" + matParam.getMaktx() + "、规格:" + matParam.getSpecs() + "、备注:" + matParam.getMemo(),
                response, bool);
    }
    @Override
@@ -495,28 +498,32 @@
    public void combMes(CombParam param) {
        Long userId=9999l;
        if (Cools.isEmpty(param.getBarcode(), param.getCombMats())) {
            callApiLogSaveMES(null, null, BaseRes.PARAM, false);
            throw new CoolException(BaseRes.PARAM);
        }
        if(param.getBarcode().length()!=8){
            callApiLogSaveMES(param, null, param.getBarcode() + ":条码长度不是8位", false);
            throw new CoolException("条码长度不是8位===>>" + param.getBarcode());
        }
        // 判断是否有相同条码的数据
        if (waitPakinService.selectCount(new EntityWrapper<WaitPakin>().
                eq("zpallet", param.getBarcode()).eq("io_status", "N")) > 0) {
            callApiLogSaveMES(param, null, param.getBarcode() + "数据正在进行入库", false);
            throw new CoolException(param.getBarcode() + "数据正在进行入库");
        }
        // todo: 不下线重新入库
        WrkMast wrkMast = wrkMastService.selectByBarcode(param.getBarcode());
        if (wrkMast != null && wrkMast.getWrkSts() == 18) {
            ReturnT<String> start = workLogHandler.start(wrkMast);
            if (!start.isSuccess()) {
                log.error("工作档[workNo={}]历史档处理失败", wrkMast.getWrkNo());
            }
        int countLoc = locDetlService.selectCount(new EntityWrapper<LocDetl>().eq("zpallet",param.getBarcode()));
        int countWrk = wrkDetlService.selectCount(new EntityWrapper<WrkDetl>().eq("zpallet",param.getBarcode()));
        if (countLoc > 0) {
            callApiLogSaveMES(param, null, param.getBarcode() + ":库存条码数据已存在", false);
            throw new CoolException("库存条码数据已存在===>>" + param.getBarcode());
        }else if (countWrk > 0){
            callApiLogSaveMES(param, null, param.getBarcode() + ":工作明细档已存在此数据", false);
            throw new CoolException("工作明细档已存在此数据===>>" + param.getBarcode());
        }
        Date now = new Date();
        // 无单组托
        if (Cools.isEmpty(param.getOrderNo())) {
        try{
            // 生成入库通知档
            List<DetlDto> detlDtos = new ArrayList<>();
            param.getCombMats().forEach(elem -> {
@@ -530,10 +537,10 @@
                }
            });
            for (DetlDto detlDto : detlDtos) {
                Mat mat = matService.selectByMatnr(detlDto.getMatnr());
                if (Cools.isEmpty(mat)) {
                    callApiLogSaveMES(param, null,mat.getMatnr()+"商品档案不存在", false);
                    throw new CoolException(detlDto.getMatnr() + "商品档案不存在");
                }
                WaitPakin waitPakin = new WaitPakin();
@@ -548,69 +555,29 @@
                waitPakin.setModiUser(userId);
                waitPakin.setModiTime(now);
                if (!waitPakinService.insert(waitPakin)) {
                    callApiLogSaveMES(param, null,mat.getMatnr()+"保存入库通知档失败", false);
                    throw new CoolException("保存入库通知档失败");
                }
            }
            // 关联组托
        } else {
            Order order = orderService.selectByNo(param.getOrderNo());
            if (Cools.isEmpty(order)){
                throw new CoolException("单据不存在:"+param.getOrderNo());
            }
            if (order.getSettle() > 2) {
                throw new CoolException("单据编号已过期");
            }
            // 生成入库通知档
            List<DetlDto> detlDtos = new ArrayList<>();
            param.getCombMats().forEach(elem -> {
                // 订单明细数量校验
                OrderDetl orderDetl = orderDetlService.selectItem(order.getId(), elem.getMatnr(), elem.getBatch());
                if (elem.getAnfme() > orderDetl.getEnableQty()) {
                    throw new CoolException(orderDetl.getMatnr() + "入库数量不合法");
                }
                // 修改订单明细数量
                if (!orderDetlService.increase(order.getId(), elem.getMatnr(), elem.getBatch(), elem.getAnfme())) {
                    throw new CoolException("修改单据明细数量失败");
                }
                DetlDto detlDto = new DetlDto(elem.getMatnr(), elem.getBatch(), elem.getAnfme());
                if (DetlDto.has(detlDtos, detlDto)) {
                    DetlDto one = DetlDto.find(detlDtos, detlDto.getMatnr(), detlDto.getBatch());
                    assert one != null;
                    one.setAnfme(one.getAnfme() + detlDto.getAnfme());
                } else {
                    detlDtos.add(detlDto);
                }
            });
            for (DetlDto detlDto : detlDtos) {
                Mat mat = matService.selectByMatnr(detlDto.getMatnr());
                if (Cools.isEmpty(mat)) {
                    throw new CoolException(detlDto.getMatnr() + "商品档案不存在");
                }
                WaitPakin waitPakin = new WaitPakin();
                waitPakin.sync(mat);
                waitPakin.setOrderNo(order.getOrderNo());   // 单据编号
                waitPakin.setBatch(detlDto.getBatch());     // 序列码
                waitPakin.setZpallet(param.getBarcode());   // 托盘码
                waitPakin.setIoStatus("N");     // 入出状态
                waitPakin.setAnfme(detlDto.getAnfme());  // 数量
                waitPakin.setStatus("Y");    // 状态
                waitPakin.setAppeUser(userId);
                waitPakin.setAppeTime(now);
                waitPakin.setModiUser(userId);
                waitPakin.setModiTime(now);
                if (!waitPakinService.insert(waitPakin)) {
                    throw new CoolException("保存入库通知档失败");
                }
            }
            orderService.updateSettle(order.getId(), 2L, userId);
        }catch (Exception e){
            callApiLogSaveMES(null, null,""+e, false);
        }
        callApiLogSaveMES(param, param.getCombMats().get(0),"组托成功", true);
    }
    public void callApiLogSave(MatSyncParam.Mats matParam, String tableName, String response, Boolean bool) {
        apiLogService.save("ERP下发商品信息", tableName, "null", "10.10.10.1",
                "物料编码:" + matParam.getMatnr() + "、物料名称:" + matParam.getMaktx() + "、规格:" + matParam.getSpecs() + "、备注:" + matParam.getMemo(),
                response, bool);
    public void callApiLogSaveMES(CombParam combParam,CombParam.CombMat combMat, String response, Boolean bool) {
        if (Cools.isEmpty(combParam)){
            apiLogService.save("MES下发入库通知单", "/open/asrs/comb/v1", "null", "10.10.10.1",
                    "",
                    response, bool);
        }else if (Cools.isEmpty(combMat)){
            apiLogService.save("MES下发入库通知单", "/open/asrs/comb/v1", "null", "10.10.10.1",
                    "托盘码:" + combParam.getBarcode(),
                    response, bool);
        }else {
            apiLogService.save("MES下发入库通知单", "/open/asrs/comb/v1", "null", "10.10.10.1",
                    "托盘码:" + combParam.getBarcode() + "、物料编号:" + combMat.getMatnr() + "、数量:" + combMat.getAnfme(),
                    response, bool);
        }
    }
}
src/main/java/com/zy/common/web/WcsController.java
@@ -166,7 +166,7 @@
        WrkDetl wrkDetl = new WrkDetl();
        wrkDetl.sync(mat);
        wrkDetl.setAnfme(mat.getWeight());
        wrkDetl.setBatch(barcode);
        wrkDetl.setZpallet(barcode);
//        wrkDetl.setAnfme(1.0D);
        wrkDetl.setWrkNo(wrkMast.getWrkNo());
        wrkDetl.setIoTime(wrkMast.getIoTime());
src/main/webapp/static/js/common.js
@@ -196,7 +196,7 @@
    ,{field: 'unit', align: 'center',title: '单位', hide: true}
    ,{field: 'price', align: 'center',title: '单价', hide: true}
    ,{field: 'sku', align: 'center',title: 'sku', hide: true}
    ,{field: 'barcode', align: 'center',title: '条码', hide: true}
    ,{field: 'barcode', align: 'center',title: '条码', hide: false}
    ,{field: 'manu', align: 'center',title: '厂家', hide: true}
    ,{field: 'itemNum', align: 'center',title: '品项数', hide: true}
    ,{field: 'safeQty', align: 'center',title: '安全库存量', hide: true}
src/main/webapp/static/js/wrkMast/wrkMast.js
@@ -31,7 +31,7 @@
            ,{field: 'sourceLocNo$', align: 'center',title: '源库位'}
            ,{field: 'locNo$', align: 'center',title: '目标库位'}
            ,{field: 'steNo', align: 'center',title: '小车', width: 70}
            ,{field: 'barcode', align: 'center',title: '条码'}
            ,{field: 'barcode', align: 'center',title: '条码', hide: false}
            ,{field: 'preHave', align: 'center',title: '先入品', hide: true}
            ,{field: 'takeNone', align: 'center',title: '空操作', hide: true}
            // ,{field: 'picking', align: 'center',title: '拣料', templet:function(row){