#
zjj
2025-04-03 0e50e2cfbb4d79e5b71b1ae5346a33f01cfeabe2
src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
@@ -122,17 +122,6 @@
                    staProtocol = staProtocol.clone();
                }
                if (barcodeThread == null) {
                    continue;
                }
                if (barcodeThreadMat == null) {
                    continue;
                }
                String barcode = barcodeThread.getBarcode();
                String barcodeMat = barcodeThreadMat.getBarcode();
                // 尺寸检测异常
                boolean back = false;
                String errMsg = "";
@@ -167,9 +156,6 @@
                }
                // 退回
                if (back) {
//                        News.warn("扫码入库失败,{}入库站因{}异常,托盘已被退回", inSta.getStaNo(), errMsg);
                    MessageQueue.offer(SlaveType.Led, inSta.getLed(), new Task(3, errMsg));
                    if (!staProtocol.isLoading()){
                        continue;
                    }
@@ -180,13 +166,6 @@
                    if (ledThread != null) {
                        MessageQueue.offer(SlaveType.Led, inSta.getLed(), new Task(3, errMsg));
                    }
                    staProtocol.setWorkNo(wrkNo);
                    News.info("{}入库回退:{},任务号:{}", inSta.getStaNo(), errMsg,wrkNo);
                    wrkNo++;
                    staProtocol.setStaNo(inSta.getBackSta().shortValue());
                    devpThread.setPakMk(staProtocol.getSiteId(), false);
                    MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol));
                    log.error("输送线下发1:"+wrkNo+","+inSta.getBackSta());
                }
                // 判断是否满足入库条件
@@ -195,6 +174,7 @@
                        && staProtocol.isInEnable()
                        && !staProtocol.isEmptyMk()
                        && staProtocol.isPakMk()) {
                    String barcode = staProtocol.getBarcode();
                    if(Cools.isEmpty(barcode) || "NG".endsWith(barcode) || "NoRead".equals(barcode) || "00000000".equals(barcode)) {
                        News.info("{}号条码扫描器检测条码信息:{}", inSta.getBarcode(), barcode);
                        // led 异常显示
@@ -202,28 +182,7 @@
                            String errorMsg = "扫码失败,请重试";
                            MessageQueue.offer(SlaveType.Led, inSta.getLed(), new Task(3, errorMsg));
                        }
                        staProtocol.setWorkNo(wrkNo);
                        News.info("{}入库回退:{},任务号:{}", inSta.getStaNo(), errMsg,wrkNo);
                        wrkNo++;
                        staProtocol.setStaNo(inSta.getBackSta().shortValue());
                        devpThread.setPakMk(staProtocol.getSiteId(), false);
                        MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol));
                        log.error("输送线下发1:"+wrkNo+","+inSta.getBackSta());
                        continue;
                    }
                    if (staProtocol.getSiteId()!= 159){
                        if( Cools.isEmpty(barcodeMat) || "NG".endsWith(barcodeMat) || "NoRead".equals(barcodeMat) || "00000000".equals(barcodeMat)) {
                            News.info("{}号条码扫描器检测条码信息:{}", inSta.getBarcodeMat(), barcodeMat);
                            staProtocol.setWorkNo(wrkNo);
                            News.info("{}入库回退:{},任务号:{}", inSta.getStaNo(), errMsg,wrkNo);
                            wrkNo++;
                            staProtocol.setStaNo(inSta.getBackSta().shortValue());
                            devpThread.setPakMk(staProtocol.getSiteId(), false);
                            MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol));
                            log.error("输送线下发1:"+wrkNo+","+inSta.getBackSta());
                            continue;
                        }
                    }
                    // 判断重复工作档
                    WrkMast wrkMast = wrkMastMapper.selectPakInStep1(inSta.getStaNo(), barcode);
@@ -279,7 +238,6 @@
                        JSONObject jsonObject = JSON.parseObject(response);
                        if (jsonObject.getInteger("code").equals(200)) {
                            StartupDto dto = jsonObject.getObject("data", StartupDto.class);
                            barcodeThread.setBarcode("");
                            staProtocol.setWorkNo(dto.getWorkNo().shortValue());
                            staProtocol.setStaNo(RouteUtils.SouStaEnd(dto.getStaNo(),dto.getSourceStaNo()));
                            devpThread.setPakMk(staProtocol.getSiteId(), false);
@@ -294,45 +252,11 @@
                                throw new CoolException("更新plc站点信息失败");
                            }
                        } else if (jsonObject.getInteger("code").equals(700)) {
                            SearchLocParam param2 = new SearchLocParam();
                            param2.setBarcode(barcode);
                            param2.setBarcodeMat(barcodeMat);
                            param2.setSourceStaNo(inSta.getStaNo());
                            param2.setLocType1(locTypeDto.getLocType1());
                            String response2 = new HttpHandler.Builder()
                                    .setUri(wmsUrl)
                                    .setPath("/rpc/pakin/yk/loc/v33")
                                    .setJson(JSON.toJSONString(param2))
                                    .build()
                                    .doPost();
                            JSONObject jsonObject2 = JSON.parseObject(response2);
                            if (jsonObject2.getInteger("code").equals(200)) {
                                log.info("自动组托成功!!");
                                MessageQueue.offer(SlaveType.Led, inSta.getLed(), new Task(3, "自动组托成功"));
                            } else {
                                MessageQueue.offer(SlaveType.Led, inSta.getLed(), new Task(3, "自动组托失败!!!barcodeMat==>"+barcodeMat));
                                News.error(methodName + "==>组托失败:请求接口失败!!!url:{};request:{};response:{}", wmsUrl + "/rpc/pakin/yk/loc/v33", JSON.toJSONString(param), response2);
                        }else {
                            String errorMsg = jsonObject.getString("msg");
                            if (!Cools.isEmpty(errorMsg)) {
                                MessageQueue.offer(SlaveType.Led, inSta.getLed(), new Task(3, errorMsg));
                            }
                            try{
                                Thread.sleep(500);
                            } catch (Exception e){
                            }
                        } else {
                            staProtocol.setWorkNo(wrkNo);
                            wrkNo++;
                            staProtocol.setStaNo(inSta.getBackSta().shortValue());
                            devpThread.setPakMk(staProtocol.getSiteId(), false);
                            MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol));
//
//                            if (ledThread != null) {
                                String errorMsg = jsonObject.getString("msg");
                                if (!Cools.isEmpty(errorMsg)) {
                                    MessageQueue.offer(SlaveType.Led, inSta.getLed(), new Task(3, errorMsg));
                                }
//                            }
//                            News.error(methodName + ":请求接口失败!!!url:{};request:{};response:{}", wmsUrl + "/rpc/pakin/loc/v1", JSON.toJSONString(param), response);
                        }
@@ -1029,7 +953,7 @@
            crnCommand.setSourcePosX(crnStn.getRow().shortValue());     // 源库位排
            crnCommand.setSourcePosY(crnStn.getBay().shortValue());     // 源库位列
            crnCommand.setSourcePosZ(crnStn.getLev().shortValue());     // 源库位层
            crnCommand.setDestinationPosX(locMast.getRow1().shortValue());     // 目标库位排
            crnCommand.setDestinationPosX((short) (locMast.getRow1().shortValue()-13));     // 目标库位排
            crnCommand.setDestinationPosY(locMast.getBay1().shortValue());     // 目标库位列
            crnCommand.setDestinationPosZ(locMast.getLev1().shortValue());     // 目标库位层
            crnCommand.setTraySize(locMast.getLocType1() == 2);
@@ -1196,7 +1120,7 @@
                    crnCommand.setTaskNo(wrkMast.getWrkNo().shortValue()); // 工作号
//                    crnCommand.setAckFinish((short) 0);  // 任务完成确认位
                    crnCommand.setTaskMode(CrnTaskModeType.LOC_MOVE); // 任务模式:  库位移转
                    crnCommand.setSourcePosX(sourceSta.getRow1().shortValue());     // 源库位排
                    crnCommand.setSourcePosX((short) (sourceSta.getRow1().shortValue()-13));     // 源库位排
                    crnCommand.setSourcePosY(sourceSta.getBay1().shortValue());     // 源库位列
                    crnCommand.setSourcePosZ(sourceSta.getLev1().shortValue());     // 源库位层
                    crnCommand.setDestinationPosX(crnStn.getRow().shortValue());     // 目标库位排
@@ -1395,10 +1319,10 @@
        crnCommand.setTaskNo(wrkMast.getWrkNo().shortValue()); // 工作号
        crnCommand.setAckFinish((short) 0);  // 任务完成确认位
        crnCommand.setTaskMode(CrnTaskModeType.LOC_MOVE); // 任务模式:  库位移转
        crnCommand.setSourcePosX(sourceSta.getRow1().shortValue());     // 源库位排
        crnCommand.setSourcePosX((short) (sourceSta.getRow1().shortValue()-13));     // 源库位排
        crnCommand.setSourcePosY(sourceSta.getBay1().shortValue());     // 源库位列
        crnCommand.setSourcePosZ(sourceSta.getLev1().shortValue());     // 源库位层
        crnCommand.setDestinationPosX(sta.getRow1().shortValue());     // 目标库位排
        crnCommand.setDestinationPosX((short) (sta.getRow1().shortValue()-13));     // 目标库位排
        crnCommand.setDestinationPosY(sta.getBay1().shortValue());     // 目标库位列
        crnCommand.setDestinationPosZ(sta.getLev1().shortValue());     // 目标库位层
        crnCommand.setTraySize(sourceSta.getLocType1() == 2);     //库位类型