自动化立体仓库 - WMS系统
#
lty
3 天以前 3aab99bed6dd2b808645ee2e4744226f4c687168
src/main/java/com/zy/asrs/task/handler/WorkLogHandler.java
@@ -46,6 +46,8 @@
    private ErpTokenService erpTokenService;
    @Autowired
    private LocDetlService locDetlService;
    @Autowired
    private ApiLogService apiLogService;
    @Transactional
    public ReturnT<String> start(WrkMast wrkMast) {
@@ -74,21 +76,27 @@
                if (wrkMast.getIoType() == 1) {
                    // 入库通知单
                    if (!Cools.isEmpty(wrkMast.getBarcode())) {
//                        JSONObject res = erpTokenService.stockIn(wrkMast.getBarcode());
//                        if (res != null && Boolean.TRUE.equals(res.getBoolean("success"))) {
//                            JSONObject data = res.getJSONObject("data");
//                            String tlocation = data == null ? null : data.getString("tlocation");
//                            if (!Cools.isEmpty(tlocation) && !Cools.isEmpty(wrkMast.getLocNo())) {
//                                List<LocDetl> detls = locDetlService.selectList(new EntityWrapper<LocDetl>()
//                                        .eq("loc_no", wrkMast.getLocNo()));
//                                if (!Cools.isEmpty(detls)) {
//                                    for (LocDetl detl : detls) {
//                                        detl.setStandby1(tlocation);
//                                        locDetlService.updateById(detl);
//                                    }
//                                }
//                            }
//                        }
                        String request = "{\"barcode\":\"" + wrkMast.getBarcode() + "\"}";
                        log.info("ERP入库上报请求: workNo={}, request={}", wrkMast.getWrkNo(), request);
                        JSONObject res = erpTokenService.stockIn(wrkMast.getBarcode());
                        log.info("ERP入库上报响应: workNo={}, response={}", wrkMast.getWrkNo(), res == null ? null : res.toJSONString());
                        apiLogService.save("erp.stockIn", "erpTokenService.stockIn", null, null, request,
                                res == null ? null : res.toJSONString(),
                                res != null && Boolean.TRUE.equals(res.getBoolean("success")));
                        if (res != null && Boolean.TRUE.equals(res.getBoolean("success"))) {
                            JSONObject data = res.getJSONObject("data");
                            String tlocation = data == null ? null : data.getString("tlocation");
                            if (!Cools.isEmpty(tlocation) && !Cools.isEmpty(wrkMast.getLocNo())) {
                                List<LocDetl> detls = locDetlService.selectList(new EntityWrapper<LocDetl>()
                                        .eq("loc_no", wrkMast.getLocNo()));
                                if (!Cools.isEmpty(detls)) {
                                    for (LocDetl detl : detls) {
                                        detl.setStandby1(tlocation);
                                        locDetlService.updateById(detl);
                                    }
                                }
                            }
                        }
                        // 保存入库通知档历史档
@@ -117,15 +125,27 @@
            // 出库 --------------------------------------------------------------------------------
            } else if (wrkMast.getWrkSts() == 15) {
                if(wrkMast.getIsSuplus()!=null && wrkMast.getIsSuplus()==1 && !Objects.isNull(wrkMast.getExitMk())){
                    List<WrkDetl> wrkDetls1 = wrkDetlService.selectByWrkNo(wrkMast.getWrkNo());
                if(wrkMast.getIsSuplus()!=null && wrkMast.getIsSuplus()==1 && wrkMast.getExitMk().equals("Y")){
                    List<WrkDetl> wrkDetls1 = wrkDetlService.selectList(new EntityWrapper<WrkDetl>().eq("wrk_no",wrkMast.getWrkNo()));
                    WrkDetl wrkDetl = wrkDetls1.get(0);
                    String request = "{\"barcode\":\"" + wrkMast.getBarcode() + "\",\"anfme\":" + wrkDetl.getAnfme() + "}";
                    log.info("ERP退料上报请求: workNo={}, request={}", wrkMast.getWrkNo(), request);
                    JSONObject res = erpTokenService.stockBack(wrkMast.getBarcode(),wrkDetl.getAnfme(),null);
                    log.info("ERP退料上报响应: workNo={}, response={}", wrkMast.getWrkNo(), res == null ? null : res.toJSONString());
                    apiLogService.save("erp.stockBack", "erpTokenService.stockBack", null, null, request,
                            res == null ? null : res.toJSONString(),
                            res != null && Boolean.TRUE.equals(res.getBoolean("success")));
                    if (res != null && Boolean.TRUE.equals(res.getBoolean("success"))) {
                    }
                }else if(Objects.isNull(wrkMast.getLocNo())){
                    String request = "{\"barcode\":\"" + wrkMast.getBarcode() + "\"}";
                    log.info("ERP出库上报请求: workNo={}, request={}", wrkMast.getWrkNo(), request);
                    JSONObject res = erpTokenService.stockOut(wrkMast.getBarcode(),null);
                    log.info("ERP出库上报响应: workNo={}, response={}", wrkMast.getWrkNo(), res == null ? null : res.toJSONString());
                    apiLogService.save("erp.stockOut", "erpTokenService.stockOut", null, null, request,
                            res == null ? null : res.toJSONString(),
                            res != null && Boolean.TRUE.equals(res.getBoolean("success")));
                    if (res != null && Boolean.TRUE.equals(res.getBoolean("success"))) {
                    }