#
lsh
2024-09-13 0e0bf533a7f0274ae6d32c2ef574686ff5fbc8da
src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
@@ -60,7 +60,7 @@
    private static final int[][] execute = new int[][]{{1,4},{2,4},{3,4},{4,4},{5,6},{6,6},{7,4},{8,4},{9,3},{10,4},{11,4}};
    private static final Integer jarMaxLoc = 7;
    private static final Float jarTemperature = 80F;
    private static final Float jarTemperature = 50F;
    @Autowired
    private CommonService commonService;
    @Autowired
@@ -192,7 +192,10 @@
                    // led 异常显示
                    LedThread ledThread = (LedThread) SlaveConnection.get(SlaveType.Led, inSta.getLed());
                    if (ledThread != null) {
                        MessageQueue.offer(SlaveType.Led, inSta.getLed(), new Task(5, errMsg));
                        ErrMsg errMsg1 = new ErrMsg();
                        errMsg1.setErrMsg(errMsg);
                        errMsg1.setArea("1");
                        MessageQueue.offer(SlaveType.Led, inSta.getLed(), new Task(5, errMsg1));
                    }
                    continue;
                }
@@ -227,7 +230,7 @@
                    // 判断重复工作档
                    WrkMast wrkMast = wrkMastMapper.selectPakInStep1(inSta.getStaNo(), barcode);
                    if (wrkMast != null) {
                        LedThread ledThread = (LedThread) SlaveConnection.get(SlaveType.Led, inSta.getLed());
//                        LedThread ledThread = (LedThread) SlaveConnection.get(SlaveType.Led, inSta.getLed());
                        barcodeThread.setBarcode("");
                        staProtocol.setWorkNo(wrkMast.getWrkNo());
                        staProtocol.setStaNo(wrkMast.getStaNo());
@@ -265,7 +268,7 @@
                        if (jsonObject.getInteger("code").equals(200)) {
                            StartupDto dto = jsonObject.getObject("data", StartupDto.class);
                            LedThread ledThread = (LedThread) SlaveConnection.get(SlaveType.Led, inSta.getLed());
//                            LedThread ledThread = (LedThread) SlaveConnection.get(SlaveType.Led, inSta.getLed());
                            barcodeThread.setBarcode("");
@@ -283,6 +286,224 @@
                                throw new CoolException("更新plc站点信息失败");
                            }
                        } else {
                            // led 异常显示
                            LedThread ledThread = (LedThread) SlaveConnection.get(SlaveType.Led, inSta.getLed());
                            if (ledThread != null) {
                                ErrMsg errMsg1 = new ErrMsg();
                                errMsg1.setErrMsg("入库请求失败"+jsonObject.getInteger("code"));
                                errMsg1.setArea("1");
                                MessageQueue.offer(SlaveType.Led, inSta.getLed(), new Task(5, errMsg1));
                            }
                            log.error("请求接口失败!!!url:{};request:{};response:{}", wmsUrl + "/rpc/pakin/loc/v1", JSON.toJSONString(param), response);
                        }
                    } catch (Exception e) {
                        e.printStackTrace();
                        TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
                    }
                }
            }
        }
    }
    public synchronized void generateStoreWrkFile464() {
        // 根据输送线plc遍历
        for (DevpSlave devp : slaveProperties.getDevp()) {
            // 遍历入库口
            for (DevpSlave.Sta inSta : devp.getInSta464()) {
                // 获取条码扫描仪信息
                BarcodeThread barcodeThread = (BarcodeThread) SlaveConnection.get(SlaveType.Barcode, inSta.getBarcode());
                if (barcodeThread == null) {
                    continue;
                }
                String barcode = barcodeThread.getBarcode();
                if (!Cools.isEmpty(barcode)) {
//                    log.info("{}号条码扫描器检测条码信息:{}", inSta.getBarcode(), barcode);
                    if ("NG".endsWith(barcode) || "NoRead".equals(barcode) || !CodeDetectionUtil.barcodeDetection(barcode)) {
                        continue;
                    }
                } else {
                    continue;
                }
                // 获取入库站信息
//                SiemensDevpThread devpThread = (SiemensDevpThread) SlaveConnection.get(SlaveType.Devp, devp.getId());
                SiemensDevpThread devpThread = (SiemensDevpThread) SlaveConnection.get(SlaveType.Devp, devp.getId());
                StaProtocol staProtocol = devpThread.getStation().get(inSta.getStaNo());
                if (staProtocol == null) {
                    continue;
                } else {
                    staProtocol = staProtocol.clone();
                }
                // 尺寸检测异常
                boolean back = false;
                String errMsg = "异常:";
                if (staProtocol.isFrontErr()) {
                    errMsg = errMsg+"前超限;";
                    back = true;
                }
                if (staProtocol.isBackErr()) {
                    errMsg = errMsg+"后超限";
                    back = true;
                }
                if (staProtocol.isHighErr()) {
                    errMsg = errMsg+"高超限";
                    back = true;
                }
                if (staProtocol.isLeftErr()) {
                    errMsg = errMsg+"左超限";
                    back = true;
                }
                if (staProtocol.isRightErr()) {
                    errMsg = errMsg+"右超限";
                    back = true;
                }
                if (staProtocol.isWeightErr()) {
                    errMsg = errMsg+"超重";
                    back = true;
                }
                if (staProtocol.isBarcodeErr()) {
                    errMsg = errMsg+"扫码失败";
                    back = true;
                }
                // 退回
                if (back) {
                    // led 异常显示
                    LedThread ledThread = (LedThread) SlaveConnection.get(SlaveType.Led, inSta.getLed());
                    if (ledThread != null) {
                        ErrMsg errMsg1 = new ErrMsg();
                        errMsg1.setErrMsg(errMsg);
                        errMsg1.setArea("1");
                        MessageQueue.offer(SlaveType.Led, inSta.getLed(), new Task(5, errMsg1));
                    }
                    continue;
                }
                // 入出库模式判断
//                if ( inSta.getStaNo()==203 && devpThread.ioModeOf2F != IoModeType.PAKIN_MODE) { continue; }
//                if (inSta.getStaNo() == 203 && devpThread.ioModeOf2F == IoModeType.PAKOUT_MODE) {
//                    continue;
//                }
                // 判断是否满足入库条件
                if (staProtocol.isAutoing()
                        && staProtocol.isLoading()
                        && staProtocol.isInEnable()
                        && !staProtocol.isEmptyMk()
                        && staProtocol.getWorkNo() == 0
                        && staProtocol.isPakMk()) {// && !Cools.isEmpty(barcode)) {
//                    if(Cools.isEmpty(barcode) || "NG".endsWith(barcode) || "NoRead".equals(barcode)) {
//                        log.info("{}号条码扫描器检测条码信息:{}", inSta.getBarcode(), barcode);
//                        //条码为空或者不符合,退库到172站点
//                        staProtocol.setWorkNo((short)32222);
//                        staProtocol.setStaNo((short)172);
//                        devpThread.setPakMk(staProtocol.getSiteId(), false);
//                        boolean result = MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol));
//                        if (!result) {
//                            throw new CoolException("更新plc站点信息失败");
//                        }
//                        continue;
//                    }
                    // 判断重复工作档
                    WrkMast wrkMast = wrkMastMapper.selectPakInStep1(inSta.getStaNo(), barcode);
                    if (wrkMast != null) {
//                        LedThread ledThread = (LedThread) SlaveConnection.get(SlaveType.Led, inSta.getLed());
                        barcodeThread.setBarcode("");
                        staProtocol.setWorkNo(wrkMast.getWrkNo());
                        staProtocol.setStaNo(wrkMast.getStaNo());
                        devpThread.setPakMk(staProtocol.getSiteId(), false);
                        boolean result = MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol));
                        if (!result) {
                            throw new CoolException("更新plc站点信息失败");
                        }
                        return;
                    }
//                    // 获取入库通知档
//                    List<WaitPakin> waitPakins = waitPakinMapper.selectList(new EntityWrapper<WaitPakin>().eq("zpallet", barcode).eq("io_status", "N"));
//                    if (waitPakins.isEmpty()) {
//                        log.error("无此入库条码数据。条码号={}", barcode);
//                        continue;
//                    }
                    try {
                        LocTypeDto locTypeDto = new LocTypeDto(staProtocol);
                        SearchLocParam param = new SearchLocParam();
                        param.setBarcode(barcode);
                        param.setIoType(1);
                        param.setSourceStaNo(inSta.getStaNo());
                        param.setLocType1(locTypeDto.getLocType1());
                        String response = new HttpHandler.Builder()
                                .setUri(wmsUrl)
                                .setPath("/rpc/pakin/loc/v1")
                                .setJson(JSON.toJSONString(param))
                                .build()
                                .doPost();
                        JSONObject jsonObject = JSON.parseObject(response);
                        if (jsonObject.getInteger("code").equals(200)) {
                            StartupDto dto = jsonObject.getObject("data", StartupDto.class);
//                            LedThread ledThread = (LedThread) SlaveConnection.get(SlaveType.Led, inSta.getLed());
                            barcodeThread.setBarcode("");
                            staProtocol.setWorkNo(dto.getWorkNo());
                            if(Cools.isEmpty(dto.getRgvNo()) || dto.getRgvNo() <= 0) {
                                staProtocol.setStaNo(607);//607
                            } else {//如果存在RGV编号,说明需要RGV接驳,先下发任务到RGV源站
                                staProtocol.setStaNo(dto.getRgvSstaNo());
                            }
                            devpThread.setPakMk(staProtocol.getSiteId(), false);
                            boolean result = MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol));
                            if (!result) {
                                throw new CoolException("更新plc站点信息失败");
                            }
                        } else  if (jsonObject.getInteger("code").equals(700)){
                            SearchLocParam param2 = new SearchLocParam();
                            param2.setBarcode(barcode);
                            param2.setSourceStaNo(inSta.getStaNo());
                            param2.setLocType1(locTypeDto.getLocType1());
                            String response2 = new HttpHandler.Builder()
                                    .setUri(wmsUrl)
                                    .setPath("/rpc/pakin/yx/loc/v464")
                                    .setJson(JSON.toJSONString(param2))
                                    .build()
                                    .doPost();
                            JSONObject jsonObject2 = JSON.parseObject(response2);
                            if (jsonObject2.getInteger("code").equals(200)) {
                                log.info("464紧急站点自动组托成功!!");
                            } else {
                                log.error("请求接口失败!!!url:{};request:{};response:{}", wmsUrl + "/rpc/pakin/yx/loc/v464", JSON.toJSONString(param), response);
                                LedThread ledThread = (LedThread) SlaveConnection.get(SlaveType.Led, inSta.getLed());
                                if (ledThread != null) {
                                    ErrMsg errMsg1 = new ErrMsg();
                                    errMsg1.setErrMsg("入库失败!站点号:"+inSta.getStaNo());
                                    errMsg1.setArea("1");
                                    MessageQueue.offer(SlaveType.Led, inSta.getLed(), new Task(5, errMsg1));
                                }
                            }
                        } else {
                            // led 异常显示
                            LedThread ledThread = (LedThread) SlaveConnection.get(SlaveType.Led, inSta.getLed());
                            if (ledThread != null) {
                                ErrMsg errMsg1 = new ErrMsg();
                                errMsg1.setErrMsg("入库请求失败"+jsonObject.getInteger("code"));
                                errMsg1.setArea("1");
                                MessageQueue.offer(SlaveType.Led, inSta.getLed(), new Task(5, errMsg1));
                            }
                            log.error("请求接口失败!!!url:{};request:{};response:{}", wmsUrl + "/rpc/pakin/loc/v1", JSON.toJSONString(param), response);
                        }
@@ -370,7 +591,10 @@
                    // led 异常显示
                    LedThread ledThread = (LedThread) SlaveConnection.get(SlaveType.Led, inSta.getLed());
                    if (ledThread != null) {
                        MessageQueue.offer(SlaveType.Led, inSta.getLed(), new Task(5, errMsg));
                        ErrMsg errMsg1 = new ErrMsg();
                        errMsg1.setErrMsg(errMsg);
                        errMsg1.setArea("1");
                        MessageQueue.offer(SlaveType.Led, inSta.getLed(), new Task(5, errMsg1));
                    }
                    continue;
                }
@@ -413,6 +637,12 @@
                        devpThread.setPakMk(staProtocol.getSiteId(), false);
                        boolean result = MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol));
                        if (!result) {
                            if (ledThread != null) {
                                ErrMsg errMsg1 = new ErrMsg();
                                errMsg1.setErrMsg("更新plc站点信息失败!站点好:"+inSta.getStaNo());
                                errMsg1.setArea("1");
                                MessageQueue.offer(SlaveType.Led, inSta.getLed(), new Task(5, errMsg1));
                            }
                            throw new CoolException("更新plc站点信息失败");
                        }
                        return;
@@ -465,6 +695,12 @@
                            devpThread.setPakMk(staProtocol.getSiteId(), false);
                            boolean result = MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol));
                            if (!result) {
                                if (ledThread != null) {
                                    ErrMsg errMsg1 = new ErrMsg();
                                    errMsg1.setErrMsg("更新plc站点信息失败!站点好:"+inSta.getStaNo());
                                    errMsg1.setArea("1");
                                    MessageQueue.offer(SlaveType.Led, inSta.getLed(), new Task(5, errMsg1));
                                }
                                throw new CoolException("更新plc站点信息失败");
                            }
                        } else {
@@ -508,10 +744,13 @@
                    if ("00000000".equals(barcode)){
                        log.error(inSta+"站点,扫码失败,barcode:"+barcode);
                        // led 异常显示
//                        LedThread ledThread = (LedThread) SlaveConnection.get(SlaveType.Led, inSta.getLed());
//                        if (ledThread != null) {
//                            MessageQueue.offer(SlaveType.Led, inSta.getLed(), new Task(5, inSta+"站点,扫码失败,barcode:"+barcode));
//                        }
                        LedThread ledThread = (LedThread) SlaveConnection.get(SlaveType.Led, inSta.getLed());
                        if (ledThread != null) {
                            ErrMsg errMsg1 = new ErrMsg();
                            errMsg1.setErrMsg(inSta+"站点,扫码失败,barcode:"+barcode);
                            errMsg1.setArea("1");
                            MessageQueue.offer(SlaveType.Led, inSta.getLed(), new Task(5, errMsg1));
                        }
                        continue;
                    }
                } else {
@@ -564,7 +803,10 @@
                    // led 异常显示
                    LedThread ledThread = (LedThread) SlaveConnection.get(SlaveType.Led, inSta.getLed());
                    if (ledThread != null) {
                        MessageQueue.offer(SlaveType.Led, inSta.getLed(), new Task(5, errMsg));
                        ErrMsg errMsg1 = new ErrMsg();
                        errMsg1.setErrMsg(errMsg);
                        errMsg1.setArea("1");
                        MessageQueue.offer(SlaveType.Led, inSta.getLed(), new Task(5, errMsg1));
                    }
                    continue;
                }
@@ -613,6 +855,12 @@
                        devpThread.setPakMk(staProtocol.getSiteId(), false);
                        boolean result = MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol));
                        if (!result) {
                            if (ledThread != null) {
                                ErrMsg errMsg1 = new ErrMsg();
                                errMsg1.setErrMsg("更新plc站点信息失败!站点好:"+inSta.getStaNo());
                                errMsg1.setArea("1");
                                MessageQueue.offer(SlaveType.Led, inSta.getLed(), new Task(5, errMsg1));
                            }
                            throw new CoolException("更新plc站点信息失败");
                        }
                        return;
@@ -657,7 +905,7 @@
                            if (!result) {
                                throw new CoolException("更新plc站点信息失败");
                            }
                        } else {
                        } else  if (jsonObject.getInteger("code").equals(700)){
                            SearchLocParam param2 = new SearchLocParam();
                            param2.setBarcode(barcode);
                            param2.setSourceStaNo(inSta.getStaNo());
@@ -677,8 +925,22 @@
                                LedThread ledThread = (LedThread) SlaveConnection.get(SlaveType.Led, inSta.getLed());
                                if (ledThread != null) {
                                    MessageQueue.offer(SlaveType.Led, inSta.getLed(), new Task(5, "入库失败!"));
                                    ErrMsg errMsg1 = new ErrMsg();
                                    errMsg1.setErrMsg("入库失败!站点号:"+inSta.getStaNo());
                                    errMsg1.setArea("1");
                                    MessageQueue.offer(SlaveType.Led, inSta.getLed(), new Task(5, errMsg1));
                                }
                            }
                        } else {
                            log.error("请求接口失败!!!url:{};request:{};response:{}", wmsUrl + "/rpc/pakin/loc/v1", JSON.toJSONString(param), response);
                            LedThread ledThread = (LedThread) SlaveConnection.get(SlaveType.Led, inSta.getLed());
                            if (ledThread != null) {
                                ErrMsg errMsg1 = new ErrMsg();
                                errMsg1.setErrMsg("入库失败!站点号:"+inSta.getStaNo());
                                errMsg1.setArea("1");
                                MessageQueue.offer(SlaveType.Led, inSta.getLed(), new Task(5, errMsg1));
                            }
                        }
@@ -2534,6 +2796,11 @@
    public synchronized void locToCrnStn1(CrnSlave slave, CrnProtocol crnProtocol, Integer crnStation) {
        List<WrkMast> wrkMasts = wrkMastMapper.selectPakOutStep12(slave.getId());
        for (WrkMast wrkMast : wrkMasts) {
            // 已经存在吊车执行任务时,则过滤
            if (wrkMastMapper.selectWorking(slave.getId()) != null) {
                break;
//                        return;
            }
            if (wrkMast == null) {
                continue;
            }
@@ -3748,16 +4015,31 @@
                } else {
                    staProtocol = staProtocol.clone();
                }
                if (emptyInSta.getStaNo()==607 && staProtocol.getStaNo()==607 && staProtocol.getWorkNo()>20000 && staProtocol.isLoading() && staProtocol.isAutoing()){
                String barcode = staProtocol.getBarcode();
                if (!Cools.isEmpty(barcode)) {
//                    log.info("{}号条码扫描器检测条码信息:{}", inSta.getBarcode(), barcode);
                    if ("NG".endsWith(barcode) || "NoRead".equals(barcode) || !CodeDetectionUtil.barcodeDetection(barcode)) {
                        continue;
                    }
                } else {
                    continue;
                }
                if (emptyInSta.getStaNo()==607 && staProtocol.getStaNo()==607 && staProtocol.getWorkNo()==0
                        && staProtocol.isLoading() && staProtocol.isAutoing() && staProtocol.isInEnable()){
                    try {
                        BasDevp basDevp = basDevpService.selectById(staProtocol.getStaNo());
                        if (basDevp.getReportSign()==0){
                            WrkMast wrkMast = wrkMastMapper.selectByBarcodeTwo(barcode);
                            if (!Cools.isEmpty(wrkMast)){
                                continue;
                            }
                            LocTypeDto locTypeDto = new LocTypeDto(staProtocol);
                            SearchLocParam param = new SearchLocParam();
                            param.setIoType(10);
                            param.setSourceStaNo(emptyInSta.getStaNo());
                            param.setLocType1(locTypeDto.getLocType1());
                            param.setBarcode(barcode);
                            String response = new HttpHandler.Builder()
                                    .setUri(wmsUrl)
                                    .setPath("/rpc/pakin/loc/v1")
@@ -3768,16 +4050,16 @@
                            if (jsonObject.getInteger("code").equals(200)) {
                                basDevp.setReportSign(1);
                                basDevpService.updateById(basDevp);
                                StartupDto dto = jsonObject.getObject("data", StartupDto.class);
                                // 更新站点信息 且 下发plc命令
                                staProtocol.setWorkNo(dto.getWorkNo());
                                staProtocol.setStaNo(607);
                                devpThread.setPakMk(staProtocol.getSiteId(), false);
                                boolean result = MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(5, staProtocol));
                                if (!result) {
                                    throw new CoolException("更新plc站点信息失败");
                                }
//                                StartupDto dto = jsonObject.getObject("data", StartupDto.class);
//
//                                // 更新站点信息 且 下发plc命令
//                                staProtocol.setWorkNo(dto.getWorkNo());
//                                staProtocol.setStaNo(607);
//                                devpThread.setPakMk(staProtocol.getSiteId(), false);
//                                boolean result = MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(5, staProtocol));
//                                if (!result) {
//                                    throw new CoolException("更新plc站点信息失败");
//                                }
                            } else {
                                log.error("请求接口失败!!!url:{};request:{};response:{}", wmsUrl + "/rpc/pakin/loc/v1", JSON.toJSONString(param), response);
                            }
@@ -4835,8 +5117,28 @@
                            if (basJarMastService.selectJarMastOperation(jarSlave.getId(),2)!=0){
                                break;
                            }
                            if (basJarMastService.selectJarMastOperation(jarSlave.getJarOtherId(),3)!=0){
                            BasJar basJar = basJarMapper.selectById(jarSlave.getId());
                            int count = basJarMastService.selectCount(new EntityWrapper<BasJarMast>().eq("jar_regin", basJar.getRegion()).lt("status", 17).gt("status", 11));
                            if (count>0){
                                break;
                            }
                            if (basJarMastService.selectJarMastOperation(jarSlave.getJarOtherId(),3)!=0){
                                if (basJarMastService.selectJarMastOperation(jarSlave.getJarOtherId(),3)==7){
                                    JarThread jarOtherThread = (JarThread) SlaveConnection.get(SlaveType.Jar, jarSlave.getJarOtherId());
                                    JarProtocol jarOtherProtocol = jarOtherThread.getJarProtocol();
                                    if (jarOtherProtocol == null) {
                                        break;
                                    }
                                    if (jarOtherProtocol.getJarTemperature()>jarTemperature){
                                        log.info("{}号硫化罐查询设备温度过高,等待降温....先执行入罐任务!!!",jarOtherProtocol.getJarNo());
                                    } else {
                                        if (basJarMastService.getJarMastByJarIdCount(jarSlave.getId())>0){
                                            log.info("{}号硫化罐查询设备温度过高,先执行了入罐任务,执行完毕再进行冷却!!!",jarOtherProtocol.getJarNo());
                                        } else {
                                            break;
                                        }
                                    }
                                }
                            }
                            if (basJarMastService.getJarMastByJarIdCount(jarSlave.getId())>=jarMaxLoc*2){
                                break;
@@ -5310,6 +5612,11 @@
                            return false;
                        }
                        int count = basJarMastService.selectCount(new EntityWrapper<BasJarMast>().eq("jar_regin", basJar.getRegion()).lt("status", 17).gt("status", 11));
                        if (count>0){
                            return false;
                        }
                        //门作业  无
                        //自动、空闲、右门关闭、   Other左门关闭
                        if (jarProtocol.isAutoing() && jarProtocol.jarErr==0
@@ -5441,9 +5748,11 @@
            if (basJarMastList.size() != jarMaxLoc){
                return false;
            }
            if (basJarMastService.selectJarMastOperation(jarSlave.getJarOtherId(),5)!=0&&(basJarMastService.selectJarMastOperation(jarSlave.getJarOtherId(),5)!=7)){
                return false;
            }
//            if (basJarMastService.selectJarMastOperation(jarSlave.getJarOtherId(),5)!=0
//                    && basJarMastService.selectJarMastOperation(jarSlave.getJarOtherId(),5)!=7
//                    && basJarMastService.selectJarMastOperation(jarSlave.getJarOtherId(),5)!=14){
//                return false;
//            }
            BasJarMast basJarMastSign = basJarMastList.get(0);
            if (Cools.isEmpty(basJarMastSign)){
@@ -5528,7 +5837,7 @@
            if (basJarMastList10.size()==jarMaxLoc){
                return false;
            }
            if (basJarMastService.selectJarMastOperation(jarSlave.getJarOtherId(),4)!=0){
            if (basJarMastService.selectJarMastOperation(jarSlave.getJarOtherId(),4)!=0 && basJarMastService.selectJarMastOperation(jarSlave.getJarOtherId(),4)!=7){
                return false;
            }
@@ -5573,6 +5882,22 @@
                    log.error("{}号硫化罐查询设备档案无信息!!!",jarProtocol.getJarNo());
                    return false;
                }
//                //临时
//                if (basJar.getJarCode()==1){
//                    JarThread jarOtherThread = (JarThread) SlaveConnection.get(SlaveType.Jar, jarSlave.getJarOtherId());
//                    JarProtocol jarOtherProtocol = jarOtherThread.getJarProtocol();
//                    if (jarOtherProtocol == null) {
//                        return false;
//                    }
//
//                    if (!jarOtherProtocol.isAutoing() || jarOtherProtocol.jarErr!=0
//                            || !jarOtherProtocol.isLeftDoor() || !jarOtherProtocol.isRightDoor()
//                            || jarOtherProtocol.leftDoorOpen==1  || jarOtherProtocol.leftDoorClose==1 || jarOtherProtocol.rightDoorOpen==1  || jarOtherProtocol.rightDoorClose==1){
//                        log.error("{}号硫化罐查询设备不满足前往冷却池条件,代号2硫化罐门没开!!!",jarOtherProtocol.getJarNo());
//                        return false;
//                    }
//                }
                //门作业  无
//                if (jarProtocol.isAutoing() && jarProtocol.statusType == JarStatusType.WAITING4 && jarProtocol.jarErr==0
@@ -7670,10 +7995,10 @@
                        && jarProtocol.leftDoorOpen!=1 && jarProtocol.leftDoorOpen!=3
                        && jarProtocol.rightDoorOpen!=1 && jarProtocol.rightDoorOpen!=3
                        && (jarProtocol.leftDoorOpen==2  || jarProtocol.rightDoorOpen==2)){
                    if (jarProtocol.getJarTemperature()>jarTemperature){
                        log.error("{}号硫化罐查询设备温度过高,等待降温....!!!",jarProtocol.getJarNo());
                        return false;
                    }
//                    if (jarProtocol.getJarTemperature()>jarTemperature){
//                        log.error("{}号硫化罐查询设备温度过高,等待降温....!!!",jarProtocol.getJarNo());
//                        return false;
//                    }
                    WrkMastExecute wrkMastExecuteSou = new WrkMastExecute();
                    wrkMastExecuteSou.setWrkSts(3);
                    List<WrkMastExecute> wrkMastExecuteList = wrkMastExecuteService.selectWrkMastExecuteByWrk(wrkMastExecuteSou);
@@ -8144,7 +8469,38 @@
                    if(basJarMastList.isEmpty()){
                        if (wrkMastExecuteService.selectNoStartCharge(steSlave.getId())==0){
                            if (wrkMastExecuteService.selectMoveStart(steSlave.getId())==0){
                                continue;
                                boolean sign = true;
                                for (SteSlave.InStn inStn : steSlave.getSteInStn()){
                                    //检测站点状态
                                    DevpThread devpThread = (DevpThread) SlaveConnection.get(SlaveType.Devp, inStn.getDevpPlcId());
                                    StaProtocol staProtocol = devpThread.getStation().get(inStn.getStaNo());
                                    if (staProtocol == null) {
                                        continue;
                                    } else {
                                        staProtocol = staProtocol.clone();
                                    }
                                    if (staProtocol.isAutoing() && staProtocol.isLoading() && staProtocol.getWorkNo() > 0) {
                                        // 获取硫化罐信息
                                        JarThread jarThread = (JarThread) SlaveConnection.get(SlaveType.Jar, inStn.getJarNo());
                                        JarProtocol jarProtocol = jarThread.getJarProtocol();
                                        if (jarProtocol == null) {
                                            continue;
                                        }
                                        if (jarProtocol.modeType != JarModeType.AUTO){
                                            continue;
                                        }
                                        if (jarProtocol.statusType .equals(JarStatusType.SOS)){
                                            continue;
                                        }
                                        if (jarProtocol.getJarTemperature()>jarTemperature){
                                            continue;
                                        }
                                        sign = false;
                                    }
                                }
                                if(sign){
                                    continue;
                                }
                            }
                        }
                    }
@@ -8202,11 +8558,41 @@
        if (staNo1!=0){
            SiemensDevpThread devpThread = (SiemensDevpThread) SlaveConnection.get(SlaveType.Devp, 2);
            StaProtocol staProtocol607 = devpThread.getStation().get(607);
            if (staProtocol607.getWorkNo()<9001 && staProtocol607.getWorkNo()!=0 && staProtocol607.isLoading() && staProtocol607.isAutoing() && staProtocol607.getStaNo() == 607){
                staProtocol607.setStaNo(staNo1);
                boolean result2 = MessageQueue.offer(SlaveType.Devp, 2, new Task(5, staProtocol607));
            String barcode = staProtocol607.getBarcode();
            if (!Cools.isEmpty(barcode)) {
//                    log.info("{}号条码扫描器检测条码信息:{}", inSta.getBarcode(), barcode);
                if ("NG".endsWith(barcode) || "NoRead".equals(barcode) || !CodeDetectionUtil.barcodeDetection(barcode)) {
                    return;
                }
            } else {
                return;
            }
            if (staProtocol607.getWorkNo()==0 && staProtocol607.isLoading() && staProtocol607.isAutoing()
                    && staProtocol607.getStaNo() == 607 && staProtocol607.isInEnable()){
                WrkMast wrkMast = wrkMastMapper.selectByBarcodeTwo(barcode);
                if (!Cools.isEmpty(wrkMast)){
                    staProtocol607.setWorkNo(wrkMast.getWrkNo());
                    staProtocol607.setStaNo(staNo1);
                    boolean result2 = MessageQueue.offer(SlaveType.Devp, 2, new Task(2, staProtocol607));
                }
            }
        } else {
            LedThread ledThread = (LedThread) SlaveConnection.get(SlaveType.Led, 1);
            if (ledThread != null) {
                ErrMsg errMsg1 = new ErrMsg();
                errMsg1.setErrMsg("分配硫化罐===>目标站点号:"+staNo1);
                errMsg1.setArea("1");
                MessageQueue.offer(SlaveType.Led, 1, new Task(5, errMsg1));
            } try {
                Thread.sleep(500);
            } catch (Exception e){
            }
        }
    }
    public synchronized Integer jarGetStartStaNo(Integer staNo) {
        try {