自动化立体仓库 - WCS系统
#
yxFwq
2024-07-28 450a5f7db7af0e0381a3c528a9ea989d820a3fbe
src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
@@ -59,6 +59,8 @@
//    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 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 = 6;
    private static final Float jarTemperature = 50F;
    @Autowired
    private CommonService commonService;
    @Autowired
@@ -270,7 +272,7 @@
                            staProtocol.setWorkNo(dto.getWorkNo());
                            if(Cools.isEmpty(dto.getRgvNo()) || dto.getRgvNo() <= 0) {
                                staProtocol.setStaNo(dto.getStaNo());
                                staProtocol.setStaNo(607);//607
                            } else {//如果存在RGV编号,说明需要RGV接驳,先下发任务到RGV源站
                                staProtocol.setStaNo(dto.getRgvSstaNo());
                            }
@@ -3737,6 +3739,46 @@
                } else {
                    staProtocol = staProtocol.clone();
                }
                if (emptyInSta.getStaNo()==607 && staProtocol.getStaNo()==607 && staProtocol.getWorkNo()>20000 && staProtocol.isLoading() && staProtocol.isAutoing()){
                    try {
                        BasDevp basDevp = basDevpService.selectById(staProtocol.getStaNo());
                        if (basDevp.getReportSign()==0){
                            LocTypeDto locTypeDto = new LocTypeDto(staProtocol);
                            SearchLocParam param = new SearchLocParam();
                            param.setIoType(10);
                            param.setSourceStaNo(emptyInSta.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)) {
                                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站点信息失败");
                                }
                            } else {
                                log.error("请求接口失败!!!url:{};request:{};response:{}", wmsUrl + "/rpc/pakin/loc/v1", JSON.toJSONString(param), response);
                            }
                        }
                    } catch (Exception e) {
                        e.printStackTrace();
                        TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
                    }
                    return;
                }
                // 站点条件判断
                if (staProtocol.isAutoing() && staProtocol.isLoading() && staProtocol.isInEnable()
@@ -4775,10 +4817,10 @@
                            if (basJarMastService.selectJarMastOperation(jarSlave.getJarOtherId(),3)!=0){
                                break;
                            }
                            if (basJarMastService.getJarMastByJarIdCount(jarSlave.getId())>=14){
                            if (basJarMastService.getJarMastByJarIdCount(jarSlave.getId())>=jarMaxLoc*2){
                                break;
                            }
                            if (basJarMastService.selectJarMastOperation(jarSlave.getId(),0,9)>=7){
                            if (basJarMastService.selectJarMastOperation(jarSlave.getId(),0,9)>=jarMaxLoc){
                                break;
                            }
                            if (!Objects.equals
@@ -4797,7 +4839,7 @@
                                    break;
                                }
                                jarLocDigit = 1;
                            } else if (jarMastByJarIdMax.getJarLocDigit()<7){
                            } else if (jarMastByJarIdMax.getJarLocDigit()<jarMaxLoc){
                                jarLocDigit = jarMastByJarIdMax.getJarLocDigit()+1;
                            } else {
                                continue;
@@ -4848,7 +4890,7 @@
                log.error("{}号硫化罐查询设备正在硫化中,任务异常!!!",jarProtocol.getJarNo());
                return false;
            }
            if (jarProtocol.getJarTemperature()>50){
            if (jarProtocol.getJarTemperature()>jarTemperature){
                log.error("{}号硫化罐查询设备温度过高,等待降温....!!!",jarProtocol.getJarNo());
                return false;
            }
@@ -4906,8 +4948,32 @@
                        if (wrkMastExecute.getIoType()<7 || wrkMastExecute.getIoType()==9){
                            BasJarMast jarMastByWrkNo = basJarMastService.getJarMastByWrkNo(wrkMastExecute.getWrkNo());
                            jarMastByWrkNo.setStatus(jarMastByWrkNo.getStatusComplete(wrkMastExecute.getIoType()));
                            if (!basJarMastService.updateById(jarMastByWrkNo)){
                                log.error("硫化区域分段任务完成异常,BasJarMast={},异常信息={}",JSON.toJSONString(jarMastByWrkNo),"更新basJarMast失败");
                            if (wrkMastExecute.getIoType()==3 && jarMastByWrkNo.getStatus()==8){
                                List<BasJarMast> basJarMastList = basJarMastService.getJarMastByJarIdAndStatusList(jarMastByWrkNo.getJarId(), new ArrayList<Integer>() {{
                                    add(6);//硫化完成
                                }});
                                if (basJarMastList.isEmpty()){
                                    continue;
                                }
                                Integer integer = basJarMastService.updateStatus(jarMastByWrkNo.getJarId(), 6, 8);
                                if (basJarMastList.size()!=integer){
                                    log.error("{}号硫化罐硫化完成后开门完成修改硫化档案状态结果数量不一致!!!查询资料数量={},更新返回数量={}",jarMastByWrkNo.getJarId(),basJarMastList.size(),integer);
                                }
                            } else if (wrkMastExecute.getIoType()==2 && jarMastByWrkNo.getStatus()==5){
                                List<BasJarMast> basJarMastList = basJarMastService.getJarMastByJarIdAndStatusList(jarMastByWrkNo.getJarId(), new ArrayList<Integer>() {{
                                    add(4);//硫化完成
                                }});
                                if (basJarMastList.isEmpty()){
                                    continue;
                                }
                                Integer integer = basJarMastService.updateStatus(jarMastByWrkNo.getJarId(), 4, 5);
                                if (basJarMastList.size()!=integer){
                                    log.error("{}号硫化罐硫化完成后开门完成修改硫化档案状态结果数量不一致!!!查询资料数量={},更新返回数量={}",jarMastByWrkNo.getJarId(),basJarMastList.size(),integer);
                                }
                            } else {
                                if (!basJarMastService.updateById(jarMastByWrkNo)){
                                    log.error("硫化区域分段任务完成异常,BasJarMast={},异常信息={}",JSON.toJSONString(jarMastByWrkNo),"更新basJarMast失败");
                                }
                            }
                        }
                        wrkMastExecute.setWrkSts(wrkMastExecute.getWrkStsComplete());
@@ -4969,10 +5035,7 @@
                if (jarProtocol.modeType != JarModeType.AUTO){
                    continue;
                }
                if (jarProtocol.getJarTemperature()>50){
                    log.error("{}号硫化罐查询设备温度过高,等待降温....!!!",jarProtocol.getJarNo());
                    continue;
                }
                JarThread jarOtherThread = (JarThread) SlaveConnection.get(SlaveType.Jar, jarSlave.getJarOtherId());
                JarProtocol jarOtherProtocol = jarOtherThread.getJarProtocol();
@@ -5000,6 +5063,10 @@
                                break;//开门任务   生成入硫化罐任务
                            }
                        case 2:
                            if (jarProtocol.getJarTemperature()>jarTemperature){
                                log.error("{}号硫化罐查询设备温度过高,等待降温....!!!",jarProtocol.getJarNo());
                                continue;
                            }
                            if (jarWrkMastExecuteGenerate2(jarSlave,sign)){
                                signExecute[i] = true;
                                break;//关进料门
@@ -5010,6 +5077,10 @@
                                break;//开出料门
                            }
                        case 4:
                            if (jarProtocol.getJarTemperature()>jarTemperature){
                                log.error("{}号硫化罐查询设备温度过高,等待降温....!!!",jarProtocol.getJarNo());
                                continue;
                            }
                            if (jarWrkMastExecuteGenerate4(jarSlave,sign)){
                                signExecute[i] = true;
                                break;//出硫化罐 ===》 入冷却槽
@@ -5048,7 +5119,7 @@
                    signExecute[jarSlave.getId()-5] = true;
                    continue;
                }
                if (jarProtocol.getJarTemperature()>50){
                if (jarProtocol.getJarTemperature()>jarTemperature){
                    log.error("{}号硫化罐查询设备温度过高,等待降温....!!!",jarProtocol.getJarNo());
                    continue;
                }
@@ -5063,9 +5134,10 @@
                if (jarProtocol.isAutoing() && jarProtocol.jarErr==0){
                    if (jarWrkMastExecuteGenerate5(jarSlave,sign)){
                        signExecute[jarSlave.getId()-5] = true;
                        //出硫化罐 ===》 入冷却槽
                        return signExecute;
                        //冷却完成上输送线
                    }
                    return signExecute;
                    continue;
                }
            } catch (Exception e){
                log.error("{}号硫化罐JarWrkMastExecute任务创建异常,异常原因={}",jarSlave.getId(),e.getMessage());
@@ -5096,7 +5168,7 @@
                if (jarProtocol.modeType != JarModeType.AUTO){
                    continue;
                }
                if (jarProtocol.getJarTemperature()>50){
                if (jarProtocol.getJarTemperature()>jarTemperature){
                    log.error("{}号硫化罐查询设备温度过高,等待降温....!!!",jarProtocol.getJarNo());
                    continue;
                }
@@ -5194,7 +5266,7 @@
                        if (jarProtocol.statusType .equals(JarStatusType.WAITING2) || jarProtocol.statusType .equals(JarStatusType.SOS)){
                            return false;
                        }
                        if (jarProtocol.getJarTemperature()>50){
                        if (jarProtocol.getJarTemperature()>jarTemperature){
                            log.error("{}号硫化罐查询设备温度过高,等待降温....!!!",jarProtocol.getJarNo());
                            continue;
                        }
@@ -5210,6 +5282,10 @@
                        BasJar basJar = basJarMapper.selectById(jarProtocol.getJarNo());
                        if (Cools.isEmpty(basJar)){
                            log.error("{}号硫化罐查询设备档案无信息!!!",jarProtocol.getJarNo());
                            return false;
                        }
                        if (wrkMastExecuteService.getWrkMastExecuteByjarReginCount(basJar.getRegion())!=0){
                            return false;
                        }
@@ -5260,12 +5336,16 @@
            List<BasJarMast> basJarMastList = basJarMastService.getJarMastByJarIdAndStatusList(jarSlave.getId(), new ArrayList<Integer>() {{
                add(4);
            }});
            if (basJarMastList.size() != 7){
            if (basJarMastList.size() != jarMaxLoc){
                return false;
            }
            BasJarMast basJarMastSign = basJarMastList.get(0);
            if (Cools.isEmpty(basJarMastSign)){
                return false;
            }
            if (wrkMastExecuteService.getWrkMastExecuteByjarReginCount(basJarMastSign.getJarRegin())!=0){
                return false;
            }
//            //判断小车状态
@@ -5290,7 +5370,7 @@
                    log.error("{}号硫化罐查询设备正在硫化中,任务异常!!!",jarProtocol.getJarNo());
                    return false;
                }
                if (jarProtocol.getJarTemperature()>50){
                if (jarProtocol.getJarTemperature()>jarTemperature){
                    log.error("{}号硫化罐查询设备温度过高,等待降温....!!!",jarProtocol.getJarNo());
                    return false;
                }
@@ -5299,7 +5379,7 @@
                    log.error("{}号硫化罐查询设备档案无信息!!!",jarProtocol.getJarNo());
                    return false;
                }
                if (basJar.getJarCount()!=7){
                if (!basJar.getJarCount().equals(jarMaxLoc)){
                    log.error("{}号硫化罐查询设备库存数异常!!!库存待入数:{}",jarProtocol.getJarNo(),basJar.getJarCount());
                    return false;
                }
@@ -5337,7 +5417,7 @@
            List<BasJarMast> basJarMastList = basJarMastService.getJarMastByJarIdAndStatusList(jarSlave.getId(), new ArrayList<Integer>() {{
                add(6);
            }});
            if (basJarMastList.size() != 7){
            if (basJarMastList.size() != jarMaxLoc){
                return false;
            }
            if (basJarMastService.selectJarMastOperation(jarSlave.getJarOtherId(),5)!=0){
@@ -5346,6 +5426,10 @@
            BasJarMast basJarMastSign = basJarMastList.get(0);
            if (Cools.isEmpty(basJarMastSign)){
                return false;
            }
            if (wrkMastExecuteService.getWrkMastExecuteByjarReginCount(basJarMastSign.getJarRegin())!=0){
                return false;
            }
//            //判断小车状态
@@ -5371,10 +5455,10 @@
                    log.error("{}号硫化罐查询设备正在硫化中,任务异常!!!",jarProtocol.getJarNo());
                    return false;
                }
                if (jarProtocol.getJarTemperature()>50){
                    log.error("{}号硫化罐查询设备温度过高,等待降温....!!!",jarProtocol.getJarNo());
                    return false;
                }
//                if (jarProtocol.getJarTemperature()>jarTemperature){
//                    log.error("{}号硫化罐查询设备温度过高,等待降温....!!!",jarProtocol.getJarNo());
//                    return false;
//                }
                BasJar basJar = basJarMapper.selectById(jarProtocol.getJarNo());
                if (Cools.isEmpty(basJar)){
                    log.error("{}号硫化罐查询设备档案无信息!!!",jarProtocol.getJarNo());
@@ -5417,13 +5501,26 @@
            if (basJarMastList.isEmpty()){
                return false;
            }
            List<BasJarMast> basJarMastList10 = basJarMastService.getJarMastByJarIdAndStatusList(jarSlave.getId(), new ArrayList<Integer>() {{
                add(10);
            }});
            if (basJarMastList10.size()==jarMaxLoc){
                return false;
            }
            if (basJarMastService.selectJarMastOperation(jarSlave.getJarOtherId(),4)!=0){
                return false;
            }
            BasJarMast jarMastByJarIdMin = basJarMastService.getJarMastByJarIdMin(jarSlave.getId(),8,8);
            if (Cools.isEmpty(jarMastByJarIdMin)){
                return false;
            }
            if (wrkMastExecuteService.getWrkMastExecuteByjarReginCount(jarMastByJarIdMin.getJarRegin())!=0){
                return false;
            }
            int count = basJarMastService.selectCount(new EntityWrapper<BasJarMast>().eq("jar_regin", jarMastByJarIdMin.getJarRegin()).lt("status", 17).gt("status", 10));
            if (count>0){
                return false;
            }
//            //判断小车状态
@@ -5507,6 +5604,10 @@
            if (Cools.isEmpty(jarMastByJarIdMin)){
                return false;
            }
            if (wrkMastExecuteService.getWrkMastExecuteByjarReginCount(jarMastByJarIdMin.getJarRegin())!=0){
                return false;
            }
//
//            //判断小车状态
//            if (!jarWrkMastExecuteGenerateSteStatus(jarSlave.getJarOutSte().get(0).getSteNo(),3,SteStatusType.IDLE)){
@@ -5526,13 +5627,33 @@
                if (jarProtocol.modeType != JarModeType.AUTO){
                    return false;
                }
                if (jarProtocol.getJarTemperature()>50){
                if (jarProtocol.getJarTemperature()>jarTemperature){
                    log.error("{}号硫化罐查询设备温度过高,等待降温....!!!",jarProtocol.getJarNo());
                    return false;
                }
                BasJar basJar = basJarMapper.selectById(jarProtocol.getJarNo());
                if (Cools.isEmpty(basJar)){
                    log.error("{}号硫化罐查询设备档案无信息!!!",jarProtocol.getJarNo());
                    return false;
                }
                // 获取硫化罐信息
                JarThread jarThreadOther = (JarThread) SlaveConnection.get(SlaveType.Jar, SteAndJarUtil.getRgvJarNo(jarProtocol.getJarNo()));
                JarProtocol jarProtocolOther = jarThreadOther.getJarProtocol();
                if (jarProtocolOther == null) {
                    return false;
                }
                if (jarProtocolOther.modeType != JarModeType.AUTO){
                    return false;
                }
                BasJar basJarOther = basJarMapper.selectById(jarProtocolOther.getJarNo());
                if (Cools.isEmpty(basJarOther)){
                    log.error("{}号硫化罐查询设备档案无信息!!!",jarProtocolOther.getJarNo());
                    return false;
                }
                if (!jarProtocolOther.isRightDoor()){
                    return false;
                }
@@ -5949,10 +6070,10 @@
                log.error("{}号硫化罐查询设备正在硫化中,任务异常!!!",jarProtocol.getJarNo());
                return false;
            }
            if (jarProtocol.getJarTemperature()>50){
                log.error("{}号硫化罐查询设备温度过高,等待降温....!!!",jarProtocol.getJarNo());
                return false;
            }
//            if (jarProtocol.getJarTemperature()>jarTemperature){
//                log.error("{}号硫化罐查询设备温度过高,等待降温....!!!",jarProtocol.getJarNo());
//                return false;
//            }
            BasJar basJar = basJarMapper.selectById(jarProtocol.getJarNo());
            if (Cools.isEmpty(basJar)){
                log.error("{}号硫化罐查询设备档案无信息!!!",jarProtocol.getJarNo());
@@ -6077,7 +6198,7 @@
                log.error("{}号硫化罐查询设备正在硫化中,任务异常!!!",jarProtocol.getJarNo());
                return false;
            }
            if (jarProtocol.getJarTemperature()>50){
            if (jarProtocol.getJarTemperature()>jarTemperature){
                log.error("{}号硫化罐查询设备温度过高,等待降温....!!!",jarProtocol.getJarNo());
                return false;
            }
@@ -6205,7 +6326,7 @@
                log.error("{}号硫化罐查询设备正在硫化中,任务异常!!!",jarProtocol.getJarNo());
                return false;
            }
            if (jarProtocol.getJarTemperature()>50){
            if (jarProtocol.getJarTemperature()>jarTemperature){
                log.error("{}号硫化罐查询设备温度过高,等待降温....!!!",jarProtocol.getJarNo());
                return false;
            }
@@ -6321,7 +6442,7 @@
                log.error("{}号硫化罐查询设备正在硫化中,任务异常!!!",jarProtocol.getJarNo());
                return false;
            }
            if (jarProtocol.getJarTemperature()>50){
            if (jarProtocol.getJarTemperature()>jarTemperature){
                log.error("{}号硫化罐查询设备温度过高,等待降温....!!!",jarProtocol.getJarNo());
                return false;
            }
@@ -6437,13 +6558,33 @@
                log.error("{}号硫化罐查询设备正在硫化中,任务异常!!!",jarProtocol.getJarNo());
                return false;
            }
            if (jarProtocol.getJarTemperature()>50){
            if (jarProtocol.getJarTemperature()>jarTemperature){
                log.error("{}号硫化罐查询设备温度过高,等待降温....!!!",jarProtocol.getJarNo());
                return false;
            }
            BasJar basJar = basJarMapper.selectById(jarProtocol.getJarNo());
            if (Cools.isEmpty(basJar)){
                log.error("{}号硫化罐查询设备档案无信息!!!",jarProtocol.getJarNo());
                return false;
            }
            // 获取硫化罐信息
            JarThread jarThreadOther = (JarThread) SlaveConnection.get(SlaveType.Jar, SteAndJarUtil.getRgvJarNo(wrkMastExecute.getJarId()));
            JarProtocol jarProtocolOther = jarThreadOther.getJarProtocol();
            if (jarProtocolOther == null) {
                return false;
            }
            if (jarProtocolOther.modeType != JarModeType.AUTO){
                return false;
            }
            BasJar basJarOther = basJarMapper.selectById(jarProtocolOther.getJarNo());
            if (Cools.isEmpty(basJarOther)){
                log.error("{}号硫化罐查询设备档案无信息!!!",jarProtocolOther.getJarNo());
                return false;
            }
            if (!jarProtocolOther.isRightDoor()){
                return false;
            }
@@ -6553,13 +6694,29 @@
                log.error("{}号硫化罐查询设备正在硫化中,任务异常!!!",jarProtocol.getJarNo());
                return false;
            }
            if (jarProtocol.getJarTemperature()>50){
            if (jarProtocol.getJarTemperature()>jarTemperature){
                log.error("{}号硫化罐查询设备温度过高,等待降温....!!!",jarProtocol.getJarNo());
                return false;
            }
            BasJar basJar = basJarMapper.selectById(jarProtocol.getJarNo());
            if (Cools.isEmpty(basJar)){
                log.error("{}号硫化罐查询设备档案无信息!!!",jarProtocol.getJarNo());
                return false;
            }
            // 获取硫化罐信息
            JarThread jarThreadOther = (JarThread) SlaveConnection.get(SlaveType.Jar, SteAndJarUtil.getRgvJarNo(wrkMastExecute.getJarId()));
            JarProtocol jarProtocolOther = jarThreadOther.getJarProtocol();
            if (jarProtocolOther == null) {
                return false;
            }
            if (jarProtocolOther.modeType != JarModeType.AUTO){
                return false;
            }
            BasJar basJarOther = basJarMapper.selectById(jarProtocolOther.getJarNo());
            if (Cools.isEmpty(basJarOther)){
                log.error("{}号硫化罐查询设备档案无信息!!!",jarProtocolOther.getJarNo());
                return false;
            }
@@ -6605,7 +6762,7 @@
                        && jarProtocol.leftDoorOpen==0  && jarProtocol.leftDoorClose==0 && jarProtocol.rightDoorOpen==0  && jarProtocol.rightDoorClose==0){
                    log.error("6:入冷却槽 Three==>任务下发===>行={}",6115);
                    if (SteAndJarUtil.steAndJarNowRow(staProtocolRGV.getNowRow() , jarProtocol.getJarNo())){
                    if (SteAndJarUtil.steAndJarNowRow(staProtocolRGV.getNowRow() , jarProtocolOther.getJarNo())){
                        //判断小车状态
                        if (!jarWrkMastExecuteGenerateSteStatus(basJar.getEnterSteNo(),2,SteStatusType.WAITING2,false)){
                            return false;
@@ -6623,7 +6780,7 @@
                        }
                    } else {
                        //调车  == > endRow
                        if (!jarRgvMoveTake(wrkMastExecute,1)){
                        if (!jarRgvMoveTake(wrkMastExecute,SteAndJarUtil.getJarNoEndRow(basJar.getBurial()))){
                            log.error("平衡车RGV命令下发失败,rgv号={},任务数据={},硫化罐数据={},sign={}",
                                    wrkMastExecute.getJarId(), JSON.toJSONString(wrkMastExecute), JSON.toJSONString(jarProtocol),sign);
                        }
@@ -6669,7 +6826,7 @@
            if (jarProtocol.modeType != JarModeType.AUTO){
                return false;
            }
            if (jarProtocol.getJarTemperature()>50){
            if (jarProtocol.getJarTemperature()>jarTemperature){
                log.error("{}号硫化罐查询设备温度过高,等待降温....!!!",jarProtocol.getJarNo());
                return false;
            }
@@ -6785,7 +6942,7 @@
                    } else {
                        //调车  == > endRow
                        if (!jarRgvMoveTake(wrkMastExecute,SteAndJarUtil.getRgvJarNowRow(wrkMastExecute.getJarId()))){
                        if (!jarRgvMoveTake(wrkMastExecute,SteAndJarUtil.getRgvJarNowRow(jarProtocolOther.getJarNo()))){
                            log.error("平衡车RGV命令下发失败,rgv号={},任务数据={},硫化罐数据={},sign={}",
                                    wrkMastExecute.getJarId(), JSON.toJSONString(wrkMastExecute), JSON.toJSONString(jarProtocol),sign);
                        }
@@ -6833,7 +6990,7 @@
//            if (jarProtocol.modeType != JarModeType.AUTO){
//                return false;
//            }
//            if (jarProtocol.getJarTemperature()>50){
//            if (jarProtocol.getJarTemperature()>jarTemperature){
//                log.error("{}号硫化罐查询设备温度过高,等待降温....!!!",jarProtocol.getJarNo());
//                return false;
//            }
@@ -7009,7 +7166,7 @@
                log.error("{}号硫化罐查询设备正在硫化中,任务异常!!!",jarProtocol.getJarNo());
                return false;
            }
            if (jarProtocol.getJarTemperature()>50){
            if (jarProtocol.getJarTemperature()>jarTemperature){
                log.error("{}号硫化罐查询设备温度过高,等待降温....!!!",jarProtocol.getJarNo());
                return false;
            }
@@ -7467,10 +7624,6 @@
                if (jarProtocol.modeType != JarModeType.AUTO){
                    continue;
                }
                if (jarProtocol.getJarTemperature()>50){
                    log.error("{}号硫化罐查询设备温度过高,等待降温....!!!",jarProtocol.getJarNo());
                    return false;
                }
                BasJar basJar = basJarMapper.selectById(jarProtocol.getJarNo());
                if (Cools.isEmpty(basJar)){
                    log.error("{}号硫化罐查询设备档案无信息!!!",jarProtocol.getJarNo());
@@ -7496,6 +7649,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;
                    }
                    WrkMastExecute wrkMastExecuteSou = new WrkMastExecute();
                    wrkMastExecuteSou.setWrkSts(3);
                    List<WrkMastExecute> wrkMastExecuteList = wrkMastExecuteService.selectWrkMastExecuteByWrk(wrkMastExecuteSou);
@@ -7530,6 +7687,10 @@
                        && jarProtocol.leftDoorClose!=1 && jarProtocol.leftDoorClose!=3
                        && jarProtocol.rightDoorClose!=1 && jarProtocol.rightDoorClose!=3
                        && (jarProtocol.leftDoorClose==2  || jarProtocol.rightDoorClose==2)){
                    if (jarProtocol.getJarTemperature()>jarTemperature){
                        log.error("{}号硫化罐查询设备温度过高,等待降温....!!!",jarProtocol.getJarNo());
                        return false;
                    }
                    WrkMastExecute wrkMastExecuteSou = new WrkMastExecute();
                    wrkMastExecuteSou.setWrkSts(3);
                    List<WrkMastExecute> wrkMastExecuteList = wrkMastExecuteService.selectWrkMastExecuteByWrk(wrkMastExecuteSou);
@@ -7655,6 +7816,8 @@
                        return true;
                    }
                    return true;
                } else {
                    log.error("{}号平衡车当前状态不满足入硫化罐条件,当前任务,平衡车从取货");
                }
            }
            return true;
@@ -7848,7 +8011,7 @@
                    List<BasJarMast> basJarMastList = basJarMastService.getJarMastByJarIdAndStatusListCharge(steSlave.getId(), new ArrayList<Integer>() {{
                        add(5);
                        add(11);
                        add(16);
                        add(17);
                    }});
                    if(!basJarMastList.isEmpty()){
                        continue;
@@ -7902,7 +8065,7 @@
                            if (jarProtocol.statusType .equals(JarStatusType.SOS)){
                                continue;
                            }
                            if (jarProtocol.getJarTemperature()>50){
                            if (jarProtocol.getJarTemperature()>jarTemperature){
                                continue;
                            }
                            if (jarProtocol.leftDoorOpen != 0 || jarProtocol.rightDoorOpen != 0){
@@ -7952,9 +8115,16 @@
                if (steProtocol.getCharge()>95.0F || steProtocol.getFullCharge()){
                } else if (steProtocol.getCharge()>50.0F){
                    if (wrkMastExecuteService.selectNoStartCharge(steSlave.getId())==0){
                        if (wrkMastExecuteService.selectMoveStart(steSlave.getId())==0){
                            continue;
                    List<BasJarMast> basJarMastList = basJarMastService.getJarMastByJarIdAndStatusListCharge(steSlave.getId(), new ArrayList<Integer>() {{
                        add(5);
                        add(11);
                        add(17);
                    }});
                    if(basJarMastList.isEmpty()){
                        if (wrkMastExecuteService.selectNoStartCharge(steSlave.getId())==0){
                            if (wrkMastExecuteService.selectMoveStart(steSlave.getId())==0){
                                continue;
                            }
                        }
                    }
                } else {
@@ -8003,5 +8173,134 @@
        }
        return false;
    }
    /**
     * 其他  ===>> 607分配硫化罐
     */
    public synchronized void stackingCompletionDriveTray() {
        Integer staNo1 = jarGetStartStaNo(607);
        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));
            }
        }
    }
    public synchronized Integer jarGetStartStaNo(Integer staNo) {
        try {
            int[] jarNos=new int[]{3,1,4,2};//(607分配硫化罐)
            ArrayList<Integer> staNos = new ArrayList<Integer>() {{
                add(607);add(608);add(609);add(610);add(611);add(612);
                add(613);add(614);add(615);add(616);add(617);add(618);
                add(619);add(620);add(621);add(622);
            }};
            ArrayList<Integer> jarNoList = new ArrayList<>();
            ArrayList<Integer> jarNoList1 = new ArrayList<>();
            ArrayList<Integer> jarNoListNow = new ArrayList<>();
            for (int jarNo : jarNos) {
                List<BasJarMast> basJarMastList = basJarMastService.getJarMastByJarIdAndStatusList(jarNo, new ArrayList<Integer>() {{
                    add(0);
                    add(1);
                    add(2);
                    add(3);
                    add(4);
                }});
                if (basJarMastList.isEmpty()){
                    continue;
                }
                if (basJarMastList.size()>0 && basJarMastList.size()<jarMaxLoc){
                    jarNoList.add(jarNo);
                }
            }
            for (int jarNo : jarNos) {
                if (!jarNoList.contains(jarNo)){
                    jarNoList1.add(jarNo);
                }
            }
            for (int jarNo : jarNoList1) {
                List<BasJarMast> jarMastByJarIdAndStatusList = basJarMastService.getJarMastByJarIdAndStatusList(8, jarNo);
                if (jarMastByJarIdAndStatusList.isEmpty()){
                    jarNoList.add(jarNo);
                }
            }
            jarNoList1 = new ArrayList<Integer>();
            for (int jarNo : jarNos) {
                if (!jarNoList.contains(jarNo)){
                    jarNoList1.add(jarNo);
                }
            }
            for (int jarNo : jarNoList1) {
                List<BasJarMast> basJarMastList = basJarMastService.getJarMastByJarIdAndStatusList(jarNo, new ArrayList<Integer>() {{
                    add(5);
                    add(6);
                    add(7);
                    add(8);
                    add(9);
                    add(13);
                    add(14);
                    add(15);
                }});
                if (basJarMastList.isEmpty()){
                    jarNoList.add(jarNo);
                }
            }
            for (int jarNo : jarNoList) {
                if (jarNoListNow.contains(jarNo)){
                    continue;
                }
                // 获取硫化罐信息
                JarThread jarThread = (JarThread) SlaveConnection.get(SlaveType.Jar, jarNo);
                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){
                    log.error("{}号硫化罐查询设备温度过高,等待降温....!!!",jarProtocol.getJarNo());
                    continue;
                }
                BasJar basJar = basJarMapper.selectById(jarProtocol.getJarNo());
                if (Cools.isEmpty(basJar)){
                    log.error("{}号硫化罐查询设备档案无信息!!!",jarProtocol.getJarNo());
                    continue;
                }
                List<BasJarMast> basJarMastList = basJarMastService.getJarMastByJarIdAndStatusList(jarNo, new ArrayList<Integer>() {{
                    add(0);
                    add(1);
                    add(2);
                    add(3);
                    add(4);
                }});
                DevpThread devpThread = (DevpThread) SlaveConnection.get(SlaveType.Devp, 2);
                Integer count = basJarMastList.size();
                ArrayList<Integer> wrkNoList = new ArrayList<>();
                for (Integer staNoEnt : staNos){
                    StaProtocol staProtocolEnt = devpThread.getStation().get(staNoEnt);
                    if (staProtocolEnt != null && staProtocolEnt.getWorkNo()!=0 && !wrkNoList.contains(staProtocolEnt.getWorkNo())){
                        if (staProtocolEnt.getStaNo().equals(basJar.getEntStaNo$())){
                            count++;
                            wrkNoList.add(staProtocolEnt.getWorkNo());
                        }
                    }
                }
                if (count<jarMaxLoc){
                    return basJar.getEntStaNo$();
                }
            }
        }catch (Exception e){
//            e.printStackTrace();
//            TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
            log.error("其他  ===>> 分配硫化罐进入下一步"+e);
        }
        return 0;
    }
}