#
lsh
2024-07-14 451a5520586cad0b7b69505c3b15189328743f78
src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
@@ -8,6 +8,7 @@
import com.core.common.DateUtils;
import com.core.common.R;
import com.core.exception.CoolException;
import com.zy.asrs.domain.enums.WorkNoType;
import com.zy.asrs.entity.*;
import com.zy.asrs.mapper.*;
import com.zy.asrs.service.*;
@@ -5295,7 +5296,7 @@
     *  2:B面 出料面
     *  3:冷却槽B面 上输送线
     */
    public synchronized boolean jarWrkMastExecuteGenerateSteStatus(Integer steNo,Integer type,SteStatusType steStatusType) {
    public synchronized boolean jarWrkMastExecuteGenerateSteStatus(Integer steNo,Integer type,SteStatusType steStatusType,boolean chargeSign) {
        try{
            //判断小车状态
            SteThread steThread = (SteThread) SlaveConnection.get(SlaveType.Ste, steNo);
@@ -5312,6 +5313,61 @@
            }
            if (steProtocol.getChargeStatus()!=0){
                log.error(steNo + "号小车在充电,等待....");
                return false;
            }
            if (steProtocol.getCharge()<31.0F && chargeSign){
                log.error(steNo + "号小车当前电量过低,准备充电...当前电量"+steProtocol.getCharge().toString());
                return false;
            }
            if (!steProtocol.getStatusType().equals(steStatusType)) {
                log.error(steNo + "号小车状态不是"+JSON.toJSONString(steStatusType)+",等待....");
                return false;
            }
            switch (type){
                case 1:
                    if (!steProtocol.getLocaType().equals(SteLocaType.POINT20)) {
                        log.error(steNo + "号小车不在A面平移车,无法操作");
                        return false;
                    }
                    break;
                case 2:
                    if (!steProtocol.getLocaType().equals(SteLocaType.POINT23)) {
                        log.error(steNo + "号小车不在B面平移车,无法操作");
                        return false;
                    }
                    break;
                case 3:
                    if (!steProtocol.getLocaType().equals(SteLocaType.POINT26) && !steProtocol.getLocaType().equals(SteLocaType.POINT25)) {
                        log.error(steNo + "号小车不在水槽B端,无法操作");
                        return false;
                    }
                    break;
                default: return false;
            }
            return true;
        } catch (Exception e){
            log.error("{}号小车状态判断状态异常,异常原因={}",steNo,e.getMessage());
        }
        return false;
    }
    public synchronized boolean jarWrkMastExecuteGenerateSteStatusCharge(Integer steNo,Integer type,SteStatusType steStatusType,boolean chargeSign) {
        try{
            //判断小车状态
            SteThread steThread = (SteThread) SlaveConnection.get(SlaveType.Ste, steNo);
            if (steThread == null) {
                return false;
            }
            SteProtocol steProtocol = steThread.getSteProtocol();
            if (steProtocol == null) {
                return false;
            }
            if (steProtocol.getMode() != (short)1) {
                log.error(steNo + "号小车离线,无法操作");
                return false;
            }
            if (steProtocol.getCharge()<31.0F && chargeSign){
                log.error(steNo + "号小车当前电量过低,准备充电...当前电量"+steProtocol.getCharge().toString());
                return false;
            }
            if (!steProtocol.getStatusType().equals(steStatusType)) {
@@ -5387,7 +5443,7 @@
            wrkMastExecute.setSteId(digit[0]);//穿梭板ID
            wrkMastExecute.setRgvId(basJar.getEnterRgvNo());//RGV ID  enter
            wrkMastExecute.setRgvEndId(basJar.getOutRgvNo());//RGV ID  out
            wrkMastExecute.setIoType(digit[2]);//任务类型 0: 未知  1: 开进料门  2: 关进料门  3: 开出料门  4: 关出料门  5: 入硫化罐  6: 入冷却槽  7: 穿梭车进冷却槽  8: 穿梭车离开冷却槽  9: 出冷却槽 10:A=>B 11:B=>A
            wrkMastExecute.setIoType(digit[2]);//任务类型 0: 未知  1: 开进料门  2: 关进料门  3: 开出料门  4: 关出料门  5: 入硫化罐  6: 入冷却槽  7: 穿梭车进冷却槽  8: 穿梭车离开冷却槽  9: 出冷却槽 10:A=>B 11:B=>A  100:小车充电任务
            wrkMastExecute.setType(digit[3]);//设备  0: 未知  1: 硫化罐  2: 冷却槽  3: 硫化罐==>冷却槽
            return wrkMastExecuteService.insert(wrkMastExecute);
        } catch (Exception e) {
@@ -5443,6 +5499,7 @@
                * 7: 穿梭车进冷却槽  8: 穿梭车离开冷却槽
                * 9: 出冷却槽
                * 10:A=>B 11:B=>A
                * 100:充电任务
                * */
                log.error("JarWrkMastExecute任务创建==>下发===>行={}",5326);
                switch (wrkMastExecute.getIoType()){
@@ -5482,6 +5539,11 @@
                    case 10:
                    case 11:
                        if (jarWrkMastExecuteActionExecute10(wrkMastExecute,sign)){
                            break;
                        }
                        continue;
                    case 100:
                        if (jarWrkMastExecuteActionExecute100(wrkMastExecute,sign)){
                            break;
                        }
                        continue;
@@ -5923,7 +5985,7 @@
                        && jarProtocol.leftDoorOpen==0  && jarProtocol.leftDoorClose==0 && jarProtocol.rightDoorOpen==0  && jarProtocol.rightDoorClose==0){
                    log.error("5:入硫化罐==>任务下发===>行={}",5667);
                    //判断小车状态  //入硫化罐小车可临时屏蔽
                    if (!jarWrkMastExecuteGenerateSteStatus(basJar.getEnterSteNo(),1,SteStatusType.IDLE)){
                    if (!jarWrkMastExecuteGenerateSteStatus(basJar.getEnterSteNo(),1,SteStatusType.IDLE,true)){
                        return false;
                    }
                    if (SteAndJarUtil.steAndJarNowRow(staProtocolRGV.getNowRow() , jarProtocol.getJarNo())){
@@ -6048,7 +6110,7 @@
                    if (SteAndJarUtil.steAndJarNowRow(staProtocolRGV.getNowRow() , jarProtocol.getJarNo())){
                        //判断小车状态
                        if (!jarWrkMastExecuteGenerateSteStatus(basJar.getEnterSteNo(),1,SteStatusType.IDLE)){
                        if (!jarWrkMastExecuteGenerateSteStatus(basJar.getEnterSteNo(),1,SteStatusType.IDLE,true)){
                            return false;
                        }
                        //调车  == > 取货
@@ -6157,7 +6219,7 @@
                        && jarProtocol.leftDoorOpen==0  && jarProtocol.leftDoorClose==0 && jarProtocol.rightDoorOpen==0  && jarProtocol.rightDoorClose==0){
                    log.error("6:入冷却槽==>任务下发===>行={}",6002);
                    //判断小车状态
                    if (!jarWrkMastExecuteGenerateSteStatus(basJar.getEnterSteNo(),2,SteStatusType.IDLE)){
                    if (!jarWrkMastExecuteGenerateSteStatus(basJar.getEnterSteNo(),2,SteStatusType.IDLE,true)){
                        return false;
                    }
@@ -6280,7 +6342,7 @@
                    if (SteAndJarUtil.steAndJarNowRow(staProtocolRGV.getNowRow() , jarProtocol.getJarNo())){
                        //判断小车状态
                        if (!jarWrkMastExecuteGenerateSteStatus(basJar.getEnterSteNo(),2,SteStatusType.WAITING2)){
                        if (!jarWrkMastExecuteGenerateSteStatus(basJar.getEnterSteNo(),2,SteStatusType.WAITING2,false)){
                            return false;
                        }
                        //调车  == > 取货
@@ -6413,7 +6475,7 @@
                    if (SteAndJarUtil.steAndJarNowRow(staProtocolRGV.getNowRow() , jarProtocolOther.getJarNo())){
                        //判断小车状态
                        if (wrkMastExecute.getIoType()==7){  //7  B=>C
                            if (jarWrkMastExecuteGenerateSteStatus(basJar.getEnterSteNo(),2,SteStatusType.IDLE)){
                            if (jarWrkMastExecuteGenerateSteStatus(basJar.getEnterSteNo(),2,SteStatusType.IDLE,true)){
                                //调车  == > 移动
                                if (jarSteTake(wrkMastExecute,SteLocaType.POINT23.id,SteLocaType.POINT26.id,SteTaskModeType.STE_MOVE_14,false,SteAndJarUtil.getBJarNo(wrkMastExecute.getJarId()))){
                                    log.error("穿梭板Ste命令下发失败,ste号={},任务数据={},硫化罐数据={},sign={}",
@@ -6425,7 +6487,7 @@
                                    log.error("穿梭板Ste命令下发失败===>更新wrkMastExecute失败,jar号={},任务数据={},硫化罐数据={},sign={}",
                                            wrkMastExecute.getSteId(), JSON.toJSONString(wrkMastExecute), JSON.toJSONString(jarProtocol),sign);
                                }
                            } else if (jarWrkMastExecuteGenerateSteStatus(basJar.getEnterSteNo(),3,SteStatusType.IDLE)){
                            } else if (jarWrkMastExecuteGenerateSteStatus(basJar.getEnterSteNo(),3,SteStatusType.IDLE,false)){
                                wrkMastExecute.setWrkType(1);
                                wrkMastExecute.setWrkSts(4);
                                if (!wrkMastExecuteService.updateById(wrkMastExecute)){
@@ -6434,7 +6496,7 @@
                                }
                            }
                        } else { //8 C=>B
                            if (jarWrkMastExecuteGenerateSteStatus(basJar.getEnterSteNo(),3,SteStatusType.IDLE)){
                            if (jarWrkMastExecuteGenerateSteStatus(basJar.getEnterSteNo(),3,SteStatusType.IDLE,false)){
                                //调车  == > 移动
                                if (!jarSteTake(wrkMastExecute,SteLocaType.POINT26.id,SteLocaType.POINT23.id,SteTaskModeType.STE_MOVE_14,false,SteAndJarUtil.getBJarNo(wrkMastExecute.getJarId()))){
                                    log.error("穿梭板Ste命令下发失败,ste号={},任务数据={},硫化罐数据={},sign={}",
@@ -6446,7 +6508,7 @@
                                    log.error("穿梭板Ste命令下发失败===>更新wrkMastExecute失败,jar号={},任务数据={},硫化罐数据={},sign={}",
                                            wrkMastExecute.getSteId(), JSON.toJSONString(wrkMastExecute), JSON.toJSONString(jarProtocol),sign);
                                }
                            } else if (jarWrkMastExecuteGenerateSteStatus(basJar.getEnterSteNo(),2,SteStatusType.IDLE)){
                            } else if (jarWrkMastExecuteGenerateSteStatus(basJar.getEnterSteNo(),2,SteStatusType.IDLE,false)){
                                wrkMastExecute.setWrkType(1);
                                wrkMastExecute.setWrkSts(4);
                                if (!wrkMastExecuteService.updateById(wrkMastExecute)){
@@ -6576,7 +6638,7 @@
//                        && jarProtocol.leftDoorOpen==0  && jarProtocol.leftDoorClose==0 && jarProtocol.rightDoorOpen==0  && jarProtocol.rightDoorClose==0
//                ){
                    //判断小车状态
                    if (jarWrkMastExecuteGenerateSteStatus(basJar.getEnterSteNo(),3,SteStatusType.IDLE)){
                    if (jarWrkMastExecuteGenerateSteStatus(basJar.getEnterSteNo(),3,SteStatusType.IDLE,true)){
                        log.error("9:出冷却槽==>任务下发===>行={}",6410);
                        //调车  == > 取货
@@ -6634,7 +6696,7 @@
            }
            //判断STE小车状态
            if (jarWrkMastExecuteGenerateSteStatus(wrkMastExecute.getSteId(),3,SteStatusType.IDLE)){
            if (jarWrkMastExecuteGenerateSteStatus(wrkMastExecute.getSteId(),3,SteStatusType.IDLE,false)){
                log.error("9:出冷却槽Two==>任务下发===>行={}",6468);
                // 下发站点信息
                staProtocol.setWorkNo(wrkMastExecute.getWrkNo().intValue());
@@ -6737,7 +6799,7 @@
                    if (SteAndJarUtil.steAndJarNowRow(staProtocolRGV.getNowRow() , jarProtocol.getJarNo())){
                        //判断小车状态
                        if (wrkMastExecute.getIoType()==10){//10:A=>B
                            if (jarWrkMastExecuteGenerateSteStatus(basJar.getEnterSteNo(),1,SteStatusType.IDLE)){
                            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={}",
@@ -6749,7 +6811,7 @@
                                    log.error("穿梭板Ste命令下发失败===>更新wrkMastExecute失败,jar号={},任务数据={},硫化罐数据={},sign={}",
                                            wrkMastExecute.getSteId(), JSON.toJSONString(wrkMastExecute), JSON.toJSONString(jarProtocol),sign);
                                }
                            } else if (jarWrkMastExecuteGenerateSteStatus(basJar.getEnterSteNo(),2,SteStatusType.IDLE)){
                            } else if (jarWrkMastExecuteGenerateSteStatus(basJar.getEnterSteNo(),2,SteStatusType.IDLE,false)){
                                wrkMastExecute.setWrkType(1);
                                wrkMastExecute.setWrkSts(4);
                                if (!wrkMastExecuteService.updateById(wrkMastExecute)){
@@ -6758,7 +6820,7 @@
                                }
                            }
                        } else {//11:B=>A
                            if (jarWrkMastExecuteGenerateSteStatus(basJar.getEnterSteNo(),2,SteStatusType.IDLE)){
                            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={}",
@@ -6770,7 +6832,7 @@
                                    log.error("穿梭板Ste命令下发失败===>更新wrkMastExecute失败,jar号={},任务数据={},硫化罐数据={},sign={}",
                                            wrkMastExecute.getSteId(), JSON.toJSONString(wrkMastExecute), JSON.toJSONString(jarProtocol),sign);
                                }
                            } else if (jarWrkMastExecuteGenerateSteStatus(basJar.getEnterSteNo(),1,SteStatusType.IDLE)){
                            } else if (jarWrkMastExecuteGenerateSteStatus(basJar.getEnterSteNo(),1,SteStatusType.IDLE,false)){
                                wrkMastExecute.setWrkType(1);
                                wrkMastExecute.setWrkSts(4);
                                if (!wrkMastExecuteService.updateById(wrkMastExecute)){
@@ -6802,6 +6864,59 @@
            }
        } catch (Exception e){
            log.error("jarWrkMastExecuteActionExecute1任务执行下发异常==》wrkMastExecute={},异常原因={}",wrkMastExecute,e.getMessage());
        }
        return false;
    }
    /**
     *  JarWrkMastExecute任务==>下发 //完成
     *  100:充电任务
     *  任务下发
     */
    public synchronized boolean jarWrkMastExecuteActionExecute100(WrkMastExecute wrkMastExecute,Integer sign) {
        try{
            // 获取硫化罐信息
            BasJar basJar = basJarMapper.selectById(wrkMastExecute.getJarId());
            if (Cools.isEmpty(basJar)){
                log.error("{}号硫化罐查询设备档案无信息!!!",wrkMastExecute.getJarId());
                return false;
            }
            DevpThread devpThread = (DevpThread) SlaveConnection.get(SlaveType.Devp, 2);
            StaProtocol staProtocolRGV = devpThread.getStation().get(basJar.getEnterRgvNo());
            if (staProtocolRGV == null) {
                return false;
            } else {
                staProtocolRGV = staProtocolRGV.clone();
            }
            if (staProtocolRGV == null) {
                return false;
            }
            if (staProtocolRGV.rgvBoolean(1) || staProtocolRGV.rgvBoolean(2)){
                //门作业  无
                //自动、空闲、
                    log.error("100:充电任务==>任务下发===>行={}",6899);
                    //判断小车状态
                    if (!jarWrkMastExecuteGenerateSteStatusCharge(basJar.getEnterSteNo(),1,SteStatusType.IDLE,false)){
                        return false;
                    }
                    //调车  == > 取货
                    if (!jarSteTake(wrkMastExecute,SteLocaType.POINT20.id,SteLocaType.POINT20.id,SteTaskModeType.START_CHARGE,false,wrkMastExecute.getJarId())){
                        log.error("穿梭板Ste充电命令下发失败,ste号={},任务数据={}",
                                wrkMastExecute.getSteId(), JSON.toJSONString(wrkMastExecute));
                    }
                    wrkMastExecute.setWrkType(1);
                    wrkMastExecute.setWrkSts(99);
                    if (!wrkMastExecuteService.updateById(wrkMastExecute)){
                        log.error("穿梭板Ste充电命令下发失败===>更新wrkMastExecute失败,ste号={},任务数据={}",
                                wrkMastExecute.getSteId(), JSON.toJSONString(wrkMastExecute));
                    }
                    return true;
                }
                return false;
        } catch (Exception e){
            log.error("穿梭板Ste充电命令下发失败,异常==》wrkMastExecute={},异常原因={}",wrkMastExecute,e.getMessage());
        }
        return false;
    }
@@ -7308,7 +7423,7 @@
                }
                try{
                    if (jarWrkMastExecuteGenerateSteStatus(steSlave.getId(),1,SteStatusType.IDLE)){
                    if (jarWrkMastExecuteGenerateSteStatus(steSlave.getId(),1,SteStatusType.IDLE,false)){
                        List<WrkMastExecute> wrkMastExecutes = wrkMastExecuteService.selectWrkMastExecuteByTypeAndIoTyperAndWrkType(null, 5, null);
                        if (wrkMastExecutes.isEmpty()){
                            List<WrkMastExecute> wrkMastExecutesB = wrkMastExecuteService.selectWrkMastExecuteByTypeAndIoTyperAndWrkType(null, 6, null);
@@ -7329,11 +7444,28 @@
                                continue;
                            }
                        }
                    } else if (jarWrkMastExecuteGenerateSteStatus(steSlave.getId(),2,SteStatusType.IDLE)){
                    } else if (jarWrkMastExecuteGenerateSteStatus(steSlave.getId(),2,SteStatusType.IDLE,false)){
                        List<WrkMastExecute> wrkMastExecutes = wrkMastExecuteService.selectWrkMastExecuteByTypeAndIoTyperAndWrkType(null, 6, null);
                        if (wrkMastExecutes.isEmpty()){
                            List<WrkMastExecute> wrkMastExecutesA = wrkMastExecuteService.selectWrkMastExecuteByTypeAndIoTyperAndWrkType(null, 5, null);
                            List<WrkMastExecute> wrkMastExecutesC = wrkMastExecuteService.selectWrkMastExecuteByTypeAndIoTyperAndWrkType(null, 9, null);
                            List<WrkMastExecute> wrkMastExecutes100 = wrkMastExecuteService.selectWrkMastExecuteByTypeAndIoTyperAndWrkType(null, 100, null);
                            if (!wrkMastExecutes100.isEmpty()){
                                WrkMastExecute wrkMastExecute = wrkMastExecutes100.get(0);
                                BasJar basJar = basJarMapper.selectById(wrkMastExecute.getJarId());
                                if (Cools.isEmpty(basJar)){
                                    log.error("{}号硫化罐查询设备档案无信息!!!",wrkMastExecute.getJarId());
                                    return false;
                                }
                                BasJarMast jarMastByWrkNo = new BasJarMast(basJar);
                                jarMastByWrkNo.setWrkNo(Integer.toUnsignedLong(wrkMastExecute.getWrkNo().intValue()));//工作号
                                //B==>A
                                if (!jarWrkMastExecuteGenerateExecute(basJar,jarMastByWrkNo,basJar.getJarNo(),new int[]{basJar.getOutSteNo(),basJar.getOutRgvNo(),11,1})){
                                    log.error("JarWrkMastExecute任务创建===>执行异常===》异常数据:BasJar:"+ JSON.toJSONString(basJar)+";BasJarMast:"+JSON.toJSONString(jarMastByWrkNo));
                                }
                                continue;
                            }
                            if (!wrkMastExecutesA.isEmpty()){
                                WrkMastExecute wrkMastExecute = wrkMastExecutesA.get(0);
                                BasJar basJar = basJarMapper.selectById(wrkMastExecute.getJarId());
@@ -7364,11 +7496,28 @@
                                continue;
                            }
                        }
                    } else if (jarWrkMastExecuteGenerateSteStatus(steSlave.getId(),3,SteStatusType.IDLE)){
                    } else if (jarWrkMastExecuteGenerateSteStatus(steSlave.getId(),3,SteStatusType.IDLE,false)){
                        List<WrkMastExecute> wrkMastExecutes = wrkMastExecuteService.selectWrkMastExecuteByTypeAndIoTyperAndWrkType(null, 9, null);
                        if (wrkMastExecutes.isEmpty()){
                            List<WrkMastExecute> wrkMastExecutesB = wrkMastExecuteService.selectWrkMastExecuteByTypeAndIoTyperAndWrkType(null, 6, null);
                            List<WrkMastExecute> wrkMastExecutesA = wrkMastExecuteService.selectWrkMastExecuteByTypeAndIoTyperAndWrkType(null, 5, null);
                            List<WrkMastExecute> wrkMastExecutes100 = wrkMastExecuteService.selectWrkMastExecuteByTypeAndIoTyperAndWrkType(null, 100, null);
                            if (!wrkMastExecutes100.isEmpty()){
                                WrkMastExecute wrkMastExecute = wrkMastExecutes100.get(0);
                                BasJar basJar = basJarMapper.selectById(wrkMastExecute.getJarId());
                                if (Cools.isEmpty(basJar)){
                                    log.error("{}号硫化罐查询设备档案无信息!!!",wrkMastExecute.getJarId());
                                    return false;
                                }
                                BasJarMast jarMastByWrkNo = new BasJarMast(basJar);
                                jarMastByWrkNo.setWrkNo(Integer.toUnsignedLong(wrkMastExecute.getWrkNo().intValue()));//工作号
                                //C==>B
                                if (!jarWrkMastExecuteGenerateExecute(basJar,jarMastByWrkNo,basJar.getJarNo(),new int[]{basJar.getOutSteNo(),basJar.getOutRgvNo(),8,1})){
                                    log.error("JarWrkMastExecute任务创建===>执行异常===》异常数据:BasJar:"+ JSON.toJSONString(basJar)+";BasJarMast:"+JSON.toJSONString(jarMastByWrkNo));
                                }
                                continue;
                            }
                            if (!wrkMastExecutesB.isEmpty() || !wrkMastExecutesA.isEmpty()){
                                WrkMastExecute wrkMastExecute = !wrkMastExecutesB.isEmpty() ? wrkMastExecutesB.get(0) : wrkMastExecutesA.get(0);
                                BasJar basJar = basJarMapper.selectById(wrkMastExecute.getJarId());
@@ -7398,5 +7547,159 @@
        }
        return false;
    }
    /**
     *  ste充电任务创建   //完成
     */
    public synchronized boolean jarChargeGenerate() {
        try{
            //80%电量 无任务  充电  >50电量  有任务  断电
            //30%电量  不接取任务  无进行中任务  充电     >50电量  有任务  断电
            for (SteSlave steSlave : slaveProperties.getSte()){
                SteThread steThread = (SteThread) SlaveConnection.get(SlaveType.Ste, steSlave.getId());
                if (steThread == null) {
                    continue;
                }
                SteProtocol steProtocol = steThread.getSteProtocol();
                if (steProtocol == null || steProtocol.getChargeStatus()!=0) {
                    continue;
                }
                WrkMastExecute wrkMastExecuteByCharge = wrkMastExecuteService.getWrkMastExecuteByCharge(steSlave.getId());
                if (!Cools.isEmpty(wrkMastExecuteByCharge)){
                    continue;
                }
                if (steProtocol.getCharge()<30.0F){
                    if (wrkMastExecuteService.selectMoveStartCharge(steSlave.getId())!=0){
                        continue;
                    }
                } else if (steProtocol.getCharge()<80.0F){
                    if (wrkMastExecuteService.selectNoStart(steSlave.getId())!=0){
                        continue;
                    }
                    if (wrkMastExecuteService.selectMoveStart(steSlave.getId())!=0){
                        continue;
                    }
                }
                try{
                    boolean jarIDLESign = false;
                    if (jarWrkMastExecuteGenerateSteStatus(steSlave.getId(),1,SteStatusType.IDLE,false)){
                        //生成充电任务
                        //A
                        BasJar basJar = basJarMapper.selectById(steSlave.getId()==1? 1:3);
                        int workNo = commonService.getWorkNo(WorkNoType.getWorkNoType(7));//充电工作号
                        BasJarMast basJarMast = new BasJarMast(basJar);
                        basJarMast.setWrkNo(Integer.toUnsignedLong(workNo));//工作号
                        if (!jarWrkMastExecuteGenerateExecute(basJar,basJarMast,basJar.getJarNo(),new int[]{basJar.getOutSteNo(),basJar.getOutRgvNo(),100,1})){
                            log.error("JarWrkMastExecute充电任务创建===>执行异常===》异常数据:BasJar:"+ JSON.toJSONString(basJar)+";BasJarMast:"+JSON.toJSONString(basJarMast));
                        }
                        continue;
                    } else if (jarWrkMastExecuteGenerateSteStatus(steSlave.getId(),2,SteStatusType.IDLE,false)){
                        jarIDLESign =true;
                    } else if (jarWrkMastExecuteGenerateSteStatus(steSlave.getId(),3,SteStatusType.IDLE,false)){
                        jarIDLESign =true;
                    }
                    if (jarIDLESign){
                        //生成充电任务
                        //C==>A
                        BasJar basJar = null;
                        List<BasJar> basJarList = basJarMapper.selectList(new EntityWrapper<BasJar>().eq("region", steSlave.getId()));
                        for (BasJar basJarNow : basJarList){
                            // 获取硫化罐信息0.0
                            JarThread jarThread = (JarThread) SlaveConnection.get(SlaveType.Jar, basJarNow.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()>50){
                                continue;
                            }
                            if (jarProtocol.leftDoorOpen != 0 || jarProtocol.rightDoorOpen != 0){
                                continue;
                            }
                            basJar = basJarNow;
                            break;
                        }
                        if (basJar == null){
                            continue;
                        }
                        int workNo = commonService.getWorkNo(WorkNoType.getWorkNoType(7));//充电工作号
                        BasJarMast basJarMast = new BasJarMast(basJar);
                        basJarMast.setWrkNo(Integer.toUnsignedLong(workNo));//工作号
                        if (!jarWrkMastExecuteGenerateExecute(basJar,basJarMast,basJar.getJarNo(),new int[]{basJar.getOutSteNo(),basJar.getOutRgvNo(),100,1})){
                            log.error("JarWrkMastExecute充电任务创建===>执行异常===》异常数据:BasJar:"+ JSON.toJSONString(basJar)+";BasJarMast:"+JSON.toJSONString(basJarMast));
                        }
                    }
                }catch (Exception e){
                    log.error("充电任务创建异常,steProtocol={},异常信息={}",JSON.toJSONString(steProtocol),e.getMessage());
                }
            }
        } catch (Exception e){
            log.error("硫化区域分段任务完成异常,异常信息={}",e.getMessage());
        }
        return false;
    }
    /**
     *  Ste充电任务完成   //完成
     */
    public synchronized boolean jarChargeComplete() {
        try{
            //80%电量 无任务  充电  >50电量  有任务  断电
            //30%电量  不接取任务  无进行中任务  充电     >50电量  有任务  断电
            for (SteSlave steSlave : slaveProperties.getSte()){
                SteThread steThread = (SteThread) SlaveConnection.get(SlaveType.Ste, steSlave.getId());
                if (steThread == null) {
                    continue;
                }
                SteProtocol steProtocol = steThread.getSteProtocol();
                if (steProtocol == null || steProtocol.getChargeStatus()!=1) {
                    continue;
                }
                WrkMastExecute wrkMastExecuteByCharge = wrkMastExecuteService.getWrkMastExecuteByCharge(steSlave.getId());
                if (!Cools.isEmpty(wrkMastExecuteByCharge)){
                    continue;
                }
                if (steProtocol.getCharge()>50.0F){
                    if (wrkMastExecuteService.selectNoStart(steSlave.getId())==0){
                        if (wrkMastExecuteService.selectMoveStart(steSlave.getId())==0){
                            continue;
                        }
                    }
                } else if (steProtocol.getCharge()>95.0F || steProtocol.getFullCharge()){
                } else {
                    continue;
                }
                try{
                    if (jarWrkMastExecuteGenerateSteStatusCharge(steSlave.getId(),1,SteStatusType.MOVING,true)){
                        //完成充电任务
                        //调车  == > 断开充电
                        if (!jarSteTake(wrkMastExecuteByCharge,SteLocaType.POINT20.id,SteLocaType.POINT20.id,SteTaskModeType.CLOSE_CHARGE,false,wrkMastExecuteByCharge.getJarId())){
                            log.error("穿梭板Ste命令下发失败,ste号={},任务数据={}",
                                    wrkMastExecuteByCharge.getSteId(), JSON.toJSONString(wrkMastExecuteByCharge));
                        }
                        wrkMastExecuteByCharge.setWrkType(2);
                        wrkMastExecuteByCharge.setWrkSts(100);
                        if (!wrkMastExecuteService.updateById(wrkMastExecuteByCharge)){
                            log.error("充电任务完成命令下发失败===>更新wrkMastExecute失败,ste号={},任务数据={}",
                                    wrkMastExecuteByCharge.getSteId(), JSON.toJSONString(wrkMastExecuteByCharge));
                        }
                    }
                }catch (Exception e){
                    log.error("充电任务完成异常,steProtocol={},异常信息={}",JSON.toJSONString(steProtocol),e.getMessage());
                }
            }
        } catch (Exception e){
            log.error("硫化区域分段任务完成异常,异常信息={}",e.getMessage());
        }
        return false;
    }
}