自动化立体仓库 - WMS系统
#
zwl
2025-10-13 67d48a7ccdd121272db3680eac1f36f4d7ba519c
src/main/java/com/zy/asrs/controller/MobileController.java
@@ -15,6 +15,7 @@
import com.zy.asrs.entity.result.MobileAdjustResult;
import com.zy.asrs.mapper.ManLocDetlMapper;
import com.zy.asrs.service.*;
import com.zy.asrs.service.impl.MatServiceImpl;
import com.zy.common.model.WrkDto;
import com.zy.common.utils.HttpHandler;
import com.zy.common.web.BaseController;
@@ -81,6 +82,8 @@
    @Autowired
    private ExdMaterialMapper exdMaterialMapper;
    @Autowired
    private MatServiceImpl matService;
    // 商品上架
    @RequestMapping("/mat/onSale/auth")
@@ -129,6 +132,7 @@
    @RequestMapping("/comb/auth")
    @ManagerAuth(memo = "组托")
    public R comb(@RequestBody CombParam combParam) {
        log.info("组托数据:{}", combParam.toString());
        mobileService.comb(combParam, getUserId(), getUser().getEmail());
        return R.ok("组托成功");
    }
@@ -464,120 +468,118 @@
        //空托盘缓冲区 小:E8  大:E9
        String rStaNo = "E8";
        if (barcode.substring(0, 1).equals("9")) {
        String rStaNo ="E8";
        String type ="ZONE"; //区域
        if(barcode.substring(0,1).equals("9")){
            rStaNo = "E9";
        }
        String type = "ZONE"; //区域
        Config config = configService.selectOne(new EntityWrapper<Config>().eq("code", "autoE").eq("status", "1"));
        if (config != null) {
            type = "STACK"; //巷道
            if (Cools.isEmpty(config.getValue())) {
                rStaNo = rStaNo + "01";
                config.setValue("2");
            } else if (config.getValue().equals("1")) {
                rStaNo = rStaNo + "01";
                config.setValue("2");
            } else if (config.getValue().equals("2")) {
                rStaNo = rStaNo + "02";
                config.setValue("3");
            } else if (config.getValue().equals("3")) {
                rStaNo = rStaNo + "03";
                config.setValue("1");
            String type = "ZONE"; //区域
            if (barcode.substring(0, 1).equals("9")) {
                rStaNo = "E9";
            }
            configService.updateById(config);
        }else{
            Config config = configService.selectOne(new EntityWrapper<Config>().eq("code", "autoE").eq("status", "1"));
            if (config != null) {
                type ="STACK"; //巷道
                type = "STACK"; //巷道
                if (Cools.isEmpty(config.getValue())) {
                    rStaNo = rStaNo + "01";
                    config.setValue("2");
                }else if (config.getValue().equals("1")) {
                } else if (config.getValue().equals("1")) {
                    rStaNo = rStaNo + "01";
                    config.setValue("2");
                }else if (config.getValue().equals("2")) {
                } else if (config.getValue().equals("2")) {
                    rStaNo = rStaNo + "02";
                    config.setValue("3");
                }else if (config.getValue().equals("3")) {
                } else if (config.getValue().equals("3")) {
                    rStaNo = rStaNo + "03";
                    config.setValue("1");
                }
                configService.updateById(config);
            }
        }
        LinkedHashMap<String, Object> rcsParam = new LinkedHashMap<>();
        rcsParam.put("taskType", "PF-FMR-COMMON");
        List<LinkedHashMap<String, Object>> targetRoutes = new ArrayList<>();
        LinkedHashMap<String, Object> t1 = new LinkedHashMap<>();
        LinkedHashMap<String, Object> t2 = new LinkedHashMap<>();
        t1.put("seq", 0);
        t1.put("type", "SITE");
        t1.put("code", sourceStaNo);
        t1.put("autoStart", 0);
        t1.put("operation", "COLLECT");
        t2.put("seq", 0);
        t2.put("type", type);
        t2.put("code", rStaNo);
        t2.put("autoStart", 0);
        t2.put("operation", "DELIVERY");
        targetRoutes.add(t1);
        targetRoutes.add(t2);
        rcsParam.put("targetRoute", targetRoutes);
        rcsParam.put("initPriority", 100);
        String response = "";
        Boolean bool = false;
        String msg = "";
        HashMap<String, Object> map = new HashMap<>();
        Date date = new Date();
        String time = date.getTime() + "";
        map.put("X-LR-REQUEST-ID", time);
        try {
            log.info("wms派发搬运任务给AGV搬运={}", rcsParam);
            response = new HttpHandler.Builder()
                    .setHeaders(map)
                    .setUri(url)
                    .setHttps(true)
                    .setPath(attrcs)
                    .setJson(JSON.toJSONString(rcsParam))
                    .build()
                    .doPostCloseSSL();
            JSONObject jsonObject = JSON.parseObject(response);
            if (jsonObject.getString("code").equals("SUCCESS")) {
                bool = true;
            } else {
                msg = jsonObject.getString("message");
                config = configService.selectOne(new EntityWrapper<Config>().eq("code", "autoE").eq("status", "1"));
                if (config != null) {
                    type = "STACK"; //巷道
                    if (Cools.isEmpty(config.getValue())) {
                        rStaNo = rStaNo + "01";
                        config.setValue("2");
                    } else if (config.getValue().equals("1")) {
                        rStaNo = rStaNo + "01";
                        config.setValue("2");
                    } else if (config.getValue().equals("2")) {
                        rStaNo = rStaNo + "02";
                        config.setValue("3");
                    } else if (config.getValue().equals("3")) {
                        rStaNo = rStaNo + "03";
                        config.setValue("1");
                    }
                    configService.updateById(config);
                }
            }
        } catch (Exception e) {
            e.printStackTrace();
            log.error("wms派发搬运任务给AGV搬运失败返回值={}", response);
        } finally {
            apiLogService.save("wms派发搬运任务给AGV搬运"
                    , url + attrcs
                    , null
                    , "127.0.0.1"
                    , JSON.toJSONString(rcsParam)
                    , response
                    , bool
            );
        }
        if (bool) {
            return R.ok();
        } else {
            return R.error(msg);
        }
            LinkedHashMap<String, Object> rcsParam = new LinkedHashMap<>();
            rcsParam.put("taskType", "PF-FMR-COMMON");
            List<LinkedHashMap<String, Object>> targetRoutes = new ArrayList<>();
            LinkedHashMap<String, Object> t1 = new LinkedHashMap<>();
            LinkedHashMap<String, Object> t2 = new LinkedHashMap<>();
            t1.put("seq", 0);
            t1.put("type", "SITE");
            t1.put("code", sourceStaNo);
            t1.put("autoStart", 0);
            t1.put("operation", "COLLECT");
            t2.put("seq", 0);
            t2.put("type", type);
            t2.put("code", rStaNo);
            t2.put("autoStart", 0);
            t2.put("operation", "DELIVERY");
            targetRoutes.add(t1);
            targetRoutes.add(t2);
            rcsParam.put("targetRoute", targetRoutes);
            rcsParam.put("initPriority", 100);
            String response = "";
            Boolean bool = false;
            String msg = "";
            HashMap<String, Object> map = new HashMap<>();
            Date date = new Date();
            String time = date.getTime() + "";
            map.put("X-LR-REQUEST-ID", time);
            try {
                log.info("wms派发搬运任务给AGV搬运={}", rcsParam);
                response = new HttpHandler.Builder()
                        .setHeaders(map)
                        .setUri(url)
                        .setHttps(true)
                        .setPath(attrcs)
                        .setJson(JSON.toJSONString(rcsParam))
                        .build()
                        .doPostCloseSSL();
                JSONObject jsonObject = JSON.parseObject(response);
                if (jsonObject.getString("code").equals("SUCCESS")) {
                    bool = true;
                } else {
                    msg = jsonObject.getString("message");
                }
            } catch (Exception e) {
                e.printStackTrace();
                log.error("wms派发搬运任务给AGV搬运失败返回值={}", response);
            } finally {
                apiLogService.save("wms派发搬运任务给AGV搬运"
                        , url + attrcs
                        , null
                        , "127.0.0.1"
                        , JSON.toJSONString(rcsParam)
                        , response
                        , bool
                );
            }
            if (bool) {
                return R.ok();
            } else {
                return R.error();
            }
        }
        return R.error();
    }
    /**
     * 执行移库任务--点到点
@@ -1003,7 +1005,10 @@
        if (barcode1 == null) {
            return R.error("批次对应的验布数据不存在");
        }
        return R.ok(barcode1);
        Mat mat = matService.selectByMatnr(barcode1.getItemnumber());
        mat.setAnfme(barcode1.getQty());
        mat.setBc(barcode);
        return R.ok(mat);
    }
    @RequestMapping(value = "/getOrderNo/auth")