野心家
2025-05-24 62b68627fc86bbc0705f3c14d19e18b7eacc0059
src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
@@ -121,7 +121,7 @@
                        staProtocol = staProtocol.clone();
                    }
                    Integer workNo = staProtocol.getWorkNo();
                    if (workNo!=9998){
                    if (workNo!=9998 && workNo!=9997){
                        continue;
                    }
                    Integer stano = staProtocol.getStaNo();
@@ -189,7 +189,7 @@
                    // 判断是否满足入库条件
                    if (staProtocol.isAutoing() && staProtocol.isLoading()
                            && staProtocol.isInEnable()
                            && workNo == 9998
                            && (workNo == 9998 || workNo == 9997)
                            && staProtocol.isPakMk()
                            && staProtocol.isPakMkWalk()
                    ) {
@@ -199,9 +199,10 @@
                            continue;
                        }
                        String barcode = barcodeThread.getBarcode();
                        if (!Cools.isEmpty(barcode) && !barcode.equals("99999999")) {
                        if (!Cools.isEmpty(barcode) && !barcode.equals("99999999") && !barcode.equals("000000")) {
                            // 请求wms接口,获取工作号和目标库位
                            ToWmsDTO toWmsDTO = new ToWmsDTO(staProtocol.getSiteId(),staProtocol.getGrossWt(),barcode, 0);
                            ToWmsDTO toWmsDTO = new ToWmsDTO(staProtocol.getSiteId(),staProtocol.getGrossWt(),barcode, workNo == 9998? 0 : 1);
                            TaskWrk taskWrk1 = taskWrkService.selectOne(new EntityWrapper<TaskWrk>().eq("barcode", barcode));
                            if (!Cools.isEmpty(taskWrk1)) {
                                log.info("托盘码:" + barcode + "任务档存在");
@@ -215,6 +216,7 @@
                                    } else {
                                        staProtocol.setWorkNo(taskWrk1.getWrkNo());
                                        staProtocol.setStaNo(staProtocol.getSiteId());
                                        devpThread.setPakMkWalk(staProtocol.getSiteId(), false);
                                        MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol));
                                    }
                                }
@@ -249,6 +251,7 @@
                                staProtocol.setWorkNo(9999);
                                staProtocol.setStaNo(inSta.getBackSta());
                                devpThread.setPakMk(staProtocol.getSiteId(), false);
                                devpThread.setPakMkWalk(staProtocol.getSiteId(), false);
                                MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol));
                                continue;
                            }
@@ -264,7 +267,7 @@
                            );
                            log.info("入库请求参数{}" + JSON.toJSONString(toWmsDTO));
                            log.info("入库请求返回参数{}" + JSON.toJSONString(response));
                            if (jsonObject.getInteger("code").equals(200)) {
                            if (!Cools.isEmpty(jsonObject.getInteger("code")) && jsonObject.getInteger("code").equals(200)) {
                                try {
                                    devpThread.setPakMk(staProtocol.getSiteId(), false);
                                } catch (Exception e) {
@@ -384,9 +387,21 @@
                            && staProtocol.isPakMk()
                            && staProtocol.isPakMkWalk()
                    ) {
                        // 获取条码扫描仪信息
                        BarcodeThread barcodeThread = (BarcodeThread) SlaveConnection.get(SlaveType.Barcode, inSta.getBarcode());
                        if (barcodeThread == null) {
                            continue;
                        }
                        String barcode = barcodeThread.getBarcode();
                        if (Cools.isEmpty(barcode) || barcode.equals("0")  || barcode.equals("000000")) {
                            staProtocol.setWorkNo(9999);
                            staProtocol.setStaNo(inSta.getBackSta());
                            devpThread.setPakMk(staProtocol.getSiteId(), false);
                            MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol));
                            continue;
                        }
                        // 请求wms接口,获取工作号和目标库位
                        ToWmsDTO toWmsDTO = new ToWmsDTO("", staProtocol.getSiteId(), 1);
                        ToWmsDTO toWmsDTO = new ToWmsDTO(staProtocol.getSiteId(),staProtocol.getGrossWt(),barcode, 1);
                        HashMap<String, Object> headParam = new HashMap<>();
                        headParam.put("Content-Type", "application/json");
                        String response;
@@ -431,7 +446,7 @@
                        );
                        log.info("入库请求参数{}" + JSON.toJSONString(toWmsDTO));
                        log.info("入库请求返回参数{}" + JSON.toJSONString(response));
                        if (jsonObject.getInteger("code").equals(200)) {
                        if (!Cools.isEmpty(jsonObject.getInteger("code")) && jsonObject.getInteger("code").equals(200)) {
                            try {
                                devpThread.setPakMk(staProtocol.getSiteId(), false);
                            } catch (Exception e) {
@@ -792,7 +807,7 @@
//                    //开始运行
//                    String response = CrnStartRunning(taskWrk);
//                    JSONObject jsonObject = JSON.parseObject(response);
//                    if (jsonObject.getInteger("code").equals(200)) {
//                    if (!Cools.isEmpty(jsonObject.getInteger("code")) && jsonObject.getInteger("code").equals(200)) {
//
//                    }else {
//                        log.error("入库开始运行通讯失败,"+jsonObject.get("msg"));