#
whycq
2024-10-17 f6b64c46a1a9b5c2c900ae5d5b7906537701f447
src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
@@ -2796,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;
            }
@@ -4010,19 +4015,19 @@
                } else {
                    staProtocol = staProtocol.clone();
                }
                String barcode = staProtocol.getBarcode();
                if (!Cools.isEmpty(barcode)) {
                if (emptyInSta.getStaNo()==607 && staProtocol.getStaNo()==0 && staProtocol.getWorkNo()==0
                        && staProtocol.isLoading() && staProtocol.isAutoing() && staProtocol.isInEnable()){
                    String barcode = staProtocol.getBarcode();
                    if (!Cools.isEmpty(barcode)) {
//                    log.info("{}号条码扫描器检测条码信息:{}", inSta.getBarcode(), barcode);
                    if ("NG".endsWith(barcode) || "NoRead".equals(barcode) || !CodeDetectionUtil.barcodeDetection(barcode)) {
                        if ("NG".endsWith(barcode) || "NoRead".equals(barcode) || !CodeDetectionUtil.barcodeDetection(barcode)) {
                            continue;
                        }
                    } else {
                        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());
                        BasDevp basDevp = basDevpService.selectById(emptyInSta.getStaNo());
                        if (basDevp.getReportSign()==0){
                            WrkMast wrkMast = wrkMastMapper.selectByBarcodeTwo(barcode);
                            if (!Cools.isEmpty(wrkMast)){
@@ -4064,8 +4069,7 @@
                        TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
                    }
                    return;
                }
                } else
                // 站点条件判断
                if (staProtocol.isAutoing() && staProtocol.isLoading() && staProtocol.isInEnable()
                        && staProtocol.isEmptyMk() && ((staProtocol.getWorkNo() > 32222 && staProtocol.getWorkNo() <= 63333) || staProtocol.getWorkNo()==0)  && staProtocol.isPakMk()) {
@@ -7542,89 +7546,124 @@
            if (staProtocolRGVOther == null) {
                return false;
            }
            if (staProtocolRGV.rgvBoolean(1) && staProtocolRGVOther.rgvBoolean(1)){ //临时
//            if ( staProtocolRGVOther.rgvBoolean(1)){
                if (staProtocolRGV.getNowRow() != staProtocolRGVOther.getNowRow()){
                    //移走  == > 2
                    if (!jarRgvMoveTake(wrkMastExecute,2)){
                        log.error("平衡车RGV命令下发失败,rgv号={},任务数据={},硫化罐数据={},sign={}",
                                wrkMastExecute.getJarId(), JSON.toJSONString(wrkMastExecute), JSON.toJSONString(jarProtocol),sign);
                    }
                    return true;
            Integer[] steJarNoAB = SteAndJarUtil.getSteJarNoAB(wrkMastExecute.getJarId());
            boolean signOther = false;
            for(Integer jarNoOther : steJarNoAB){
                // 获取硫化罐信息
                JarThread jarThreadOther = (JarThread) SlaveConnection.get(SlaveType.Jar, jarNoOther);
                JarProtocol jarProtocolOther = jarThreadOther.getJarProtocol();
                if (jarProtocolOther == null) {
                    continue;
                }
                //门作业  无
                //自动、空闲、
                if (jarProtocolOther.modeType != JarModeType.AUTO){
                    continue;
                }
                if (jarProtocolOther.statusType .equals(JarStatusType.SOS)){
//                    log.error("{}号硫化罐查询设备正在硫化中,任务异常!!!",jarProtocol.getJarNo());
                    continue;
                }
                if (jarProtocolOther.getJarTemperature()>jarTemperature){
//                    log.error("{}号硫化罐查询设备温度过高,等待降温....!!!",jarProtocol.getJarNo());
                    continue;
                }
                BasJar basJarOther = basJarMapper.selectById(jarProtocolOther.getJarNo());
                if (Cools.isEmpty(basJarOther)){
//                    log.error("{}号硫化罐查询设备档案无信息!!!",jarProtocol.getJarNo());
                    continue;
                }
                if (jarProtocol.isAutoing() && jarProtocol.jarErr==0 && jarProtocol.isLeftDoor() && jarProtocol.isRightDoor()
                        && jarProtocol.leftDoorOpen==0  && jarProtocol.leftDoorClose==0 && jarProtocol.rightDoorOpen==0  && jarProtocol.rightDoorClose==0
                ){
                    log.error("10:A=>B\\11:B=>A==>任务下发===>行={}",6558);
                    if (SteAndJarUtil.steAndJarNowRow(staProtocolRGV.getNowRow() , jarProtocol.getJarNo())){
                        //判断小车状态
                        if (wrkMastExecute.getIoType()==10){//10:A=>B
                            if (jarWrkMastExecuteGenerateSteStatus(basJar.getEnterSteNo(),1,SteStatusType.IDLE,true)){
                                //调车  == > 移动
                                if (!jarSteTake(wrkMastExecute,SteLocaType.POINT20.id,SteLocaType.POINT23.id,SteTaskModeType.STE_MOVE_14,false,wrkMastExecute.getJarId())){
                                    log.error("穿梭板Ste命令下发失败,ste号={},任务数据={},硫化罐数据={},sign={}",
                                            wrkMastExecute.getSteId(), JSON.toJSONString(wrkMastExecute), JSON.toJSONString(jarProtocol),sign);
                                }
                                wrkMastExecute.setWrkType(1);
                                wrkMastExecute.setWrkSts(3);
                                if (!wrkMastExecuteService.updateById(wrkMastExecute)){
                                    log.error("穿梭板Ste命令下发失败===>更新wrkMastExecute失败,jar号={},任务数据={},硫化罐数据={},sign={}",
                                            wrkMastExecute.getSteId(), JSON.toJSONString(wrkMastExecute), JSON.toJSONString(jarProtocol),sign);
                                }
                            } else if (jarWrkMastExecuteGenerateSteStatus(basJar.getEnterSteNo(),2,SteStatusType.IDLE,false)){
                                wrkMastExecute.setWrkType(1);
                                wrkMastExecute.setWrkSts(4);
                                if (!wrkMastExecuteService.updateById(wrkMastExecute)){
                                    log.error("穿梭板Ste命令下发失败===>更新wrkMastExecute失败,jar号={},任务数据={},硫化罐数据={},sign={}",
                                            wrkMastExecute.getSteId(), JSON.toJSONString(wrkMastExecute), JSON.toJSONString(jarProtocol),sign);
                                }
                            }
                        } else {//11:B=>A
                            if (jarWrkMastExecuteGenerateSteStatus(basJar.getEnterSteNo(),2,SteStatusType.IDLE,false)){
                                //调车  == > 移动
                                if (!jarSteTake(wrkMastExecute,SteLocaType.POINT23.id,SteLocaType.POINT20.id,SteTaskModeType.STE_MOVE_14,false,wrkMastExecute.getJarId())){
                                    log.error("穿梭板Ste命令下发失败,ste号={},任务数据={},硫化罐数据={},sign={}",
                                            wrkMastExecute.getSteId(), JSON.toJSONString(wrkMastExecute), JSON.toJSONString(jarProtocol),sign);
                                }
                                wrkMastExecute.setWrkType(1);
                                wrkMastExecute.setWrkSts(3);
                                if (!wrkMastExecuteService.updateById(wrkMastExecute)){
                                    log.error("穿梭板Ste命令下发失败===>更新wrkMastExecute失败,jar号={},任务数据={},硫化罐数据={},sign={}",
                                            wrkMastExecute.getSteId(), JSON.toJSONString(wrkMastExecute), JSON.toJSONString(jarProtocol),sign);
                                }
                            } else if (jarWrkMastExecuteGenerateSteStatus(basJar.getEnterSteNo(),1,SteStatusType.IDLE,false)){
                                wrkMastExecute.setWrkType(1);
                                wrkMastExecute.setWrkSts(4);
                                if (!wrkMastExecuteService.updateById(wrkMastExecute)){
                                    log.error("穿梭板Ste命令下发失败===>更新wrkMastExecute失败,jar号={},任务数据={},硫化罐数据={},sign={}",
                                            wrkMastExecute.getSteId(), JSON.toJSONString(wrkMastExecute), JSON.toJSONString(jarProtocol),sign);
                                }
                            }
                        }
                    } else {
                        //调车  == > endRow
                        if (!jarRgvMoveTake(wrkMastExecute,SteAndJarUtil.getRgvJarNowRow(wrkMastExecute.getJarId()))){
                    jarProtocol = jarProtocolOther;
                    signOther = true;
                    break;
                }
            }
            if (signOther){
                if (staProtocolRGV.rgvBoolean(1) && staProtocolRGVOther.rgvBoolean(1)){ //临时
                    if (staProtocolRGV.getNowRow() != staProtocolRGVOther.getNowRow()){
                        //移走  == > 2
                        if (!jarRgvMoveTake(wrkMastExecute,2)){
                            log.error("平衡车RGV命令下发失败,rgv号={},任务数据={},硫化罐数据={},sign={}",
                                    wrkMastExecute.getJarId(), JSON.toJSONString(wrkMastExecute), JSON.toJSONString(jarProtocol),sign);
                        }
                        wrkMastExecute.setWrkType(1);
                        wrkMastExecute.setWrkSts(2);
                        if (!wrkMastExecuteService.updateById(wrkMastExecute)){
                            log.error("硫化罐Jar命令下发失败===>更新wrkMastExecute失败,jar号={},任务数据={},硫化罐数据={},sign={}",
                                    wrkMastExecute.getJarId(), JSON.toJSONString(wrkMastExecute), JSON.toJSONString(jarProtocol),sign);
                        }
                        return true;
                    }
                    return true;
                    //门作业  无
                    //自动、空闲、
                    if (jarProtocol.isAutoing() && jarProtocol.jarErr==0 && jarProtocol.isLeftDoor() && jarProtocol.isRightDoor()
                            && jarProtocol.leftDoorOpen==0  && jarProtocol.leftDoorClose==0 && jarProtocol.rightDoorOpen==0  && jarProtocol.rightDoorClose==0
                    ){
                        log.error("10:A=>B\\11:B=>A==>任务下发===>行={}",6558);
                        if (SteAndJarUtil.steAndJarNowRow(staProtocolRGV.getNowRow() , jarProtocol.getJarNo())){
                            //判断小车状态
                            if (wrkMastExecute.getIoType()==10){//10:A=>B
                                if (jarWrkMastExecuteGenerateSteStatus(basJar.getEnterSteNo(),1,SteStatusType.IDLE,true)){
                                    //调车  == > 移动
                                    if (!jarSteTake(wrkMastExecute,SteLocaType.POINT20.id,SteLocaType.POINT23.id,SteTaskModeType.STE_MOVE_14,false,jarProtocol.getJarNo())){
                                        log.error("穿梭板Ste命令下发失败,ste号={},任务数据={},硫化罐数据={},sign={}",
                                                wrkMastExecute.getSteId(), JSON.toJSONString(wrkMastExecute), JSON.toJSONString(jarProtocol),sign);
                                    }
                                    wrkMastExecute.setWrkType(1);
                                    wrkMastExecute.setWrkSts(3);
                                    if (!wrkMastExecuteService.updateById(wrkMastExecute)){
                                        log.error("穿梭板Ste命令下发失败===>更新wrkMastExecute失败,jar号={},任务数据={},硫化罐数据={},sign={}",
                                                wrkMastExecute.getSteId(), JSON.toJSONString(wrkMastExecute), JSON.toJSONString(jarProtocol),sign);
                                    }
                                } else if (jarWrkMastExecuteGenerateSteStatus(basJar.getEnterSteNo(),2,SteStatusType.IDLE,false)){
                                    wrkMastExecute.setWrkType(1);
                                    wrkMastExecute.setWrkSts(4);
                                    if (!wrkMastExecuteService.updateById(wrkMastExecute)){
                                        log.error("穿梭板Ste命令下发失败===>更新wrkMastExecute失败,jar号={},任务数据={},硫化罐数据={},sign={}",
                                                wrkMastExecute.getSteId(), JSON.toJSONString(wrkMastExecute), JSON.toJSONString(jarProtocol),sign);
                                    }
                                }
                            } else {//11:B=>A
                                if (jarWrkMastExecuteGenerateSteStatus(basJar.getEnterSteNo(),2,SteStatusType.IDLE,false)){
                                    //调车  == > 移动
                                    if (!jarSteTake(wrkMastExecute,SteLocaType.POINT23.id,SteLocaType.POINT20.id,SteTaskModeType.STE_MOVE_14,false,jarProtocol.getJarNo())){
                                        log.error("穿梭板Ste命令下发失败,ste号={},任务数据={},硫化罐数据={},sign={}",
                                                wrkMastExecute.getSteId(), JSON.toJSONString(wrkMastExecute), JSON.toJSONString(jarProtocol),sign);
                                    }
                                    wrkMastExecute.setWrkType(1);
                                    wrkMastExecute.setWrkSts(3);
                                    if (!wrkMastExecuteService.updateById(wrkMastExecute)){
                                        log.error("穿梭板Ste命令下发失败===>更新wrkMastExecute失败,jar号={},任务数据={},硫化罐数据={},sign={}",
                                                wrkMastExecute.getSteId(), JSON.toJSONString(wrkMastExecute), JSON.toJSONString(jarProtocol),sign);
                                    }
                                } else if (jarWrkMastExecuteGenerateSteStatus(basJar.getEnterSteNo(),1,SteStatusType.IDLE,false)){
                                    wrkMastExecute.setWrkType(1);
                                    wrkMastExecute.setWrkSts(4);
                                    if (!wrkMastExecuteService.updateById(wrkMastExecute)){
                                        log.error("穿梭板Ste命令下发失败===>更新wrkMastExecute失败,jar号={},任务数据={},硫化罐数据={},sign={}",
                                                wrkMastExecute.getSteId(), JSON.toJSONString(wrkMastExecute), JSON.toJSONString(jarProtocol),sign);
                                    }
                                }
                            }
                        } else {
                            //调车  == > endRow
                            if (!jarRgvMoveTake(wrkMastExecute,SteAndJarUtil.getRgvJarNowRow(jarProtocol.getJarNo()))){
                                log.error("平衡车RGV命令下发失败,rgv号={},任务数据={},硫化罐数据={},sign={}",
                                        wrkMastExecute.getJarId(), JSON.toJSONString(wrkMastExecute), JSON.toJSONString(jarProtocol),sign);
                            }
                            wrkMastExecute.setWrkType(1);
                            wrkMastExecute.setWrkSts(2);
                            if (!wrkMastExecuteService.updateById(wrkMastExecute)){
                                log.error("硫化罐Jar命令下发失败===>更新wrkMastExecute失败,jar号={},任务数据={},硫化罐数据={},sign={}",
                                        wrkMastExecute.getJarId(), JSON.toJSONString(wrkMastExecute), JSON.toJSONString(jarProtocol),sign);
                            }
                        }
                        return true;
                    }
                    return false;
                } else {
                    log.error("jarWrkMastExecuteActionExecute1===>执行异常===》RGV不满足条件,等待===》异常数据:BasJar:"+ JSON.toJSONString(basJar.getEnterRgvNo())+";WrkMastExecute:"+JSON.toJSONString(wrkMastExecute));
                    return false;
                }
                return false;
            } else {
                log.error("jarWrkMastExecuteActionExecute1===>执行异常===》RGV不满足条件,等待===》异常数据:BasJar:"+ JSON.toJSONString(basJar.getEnterRgvNo())+";WrkMastExecute:"+JSON.toJSONString(wrkMastExecute));
                return false;
            }
        } catch (Exception e){
            log.error("jarWrkMastExecuteActionExecute1任务执行下发异常==》wrkMastExecute={},异常原因={}",wrkMastExecute,e.getMessage());
        }
@@ -8563,7 +8602,7 @@
                return;
            }
            if (staProtocol607.getWorkNo()==0 && staProtocol607.isLoading() && staProtocol607.isAutoing()
                    && staProtocol607.getStaNo() == 607 && staProtocol607.isInEnable()){
                    && staProtocol607.getStaNo() == 0 && staProtocol607.isInEnable()){
                WrkMast wrkMast = wrkMastMapper.selectByBarcodeTwo(barcode);
                if (!Cools.isEmpty(wrkMast)){
                    staProtocol607.setWorkNo(wrkMast.getWrkNo());