#
yxFwq
2024-07-14 041accc8c0477d687d6ce9beddcadcaab26a2bb3
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.*;
@@ -56,7 +57,7 @@
    public static final long COMMAND_TIMEOUT = 5 * 1000;
//    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},{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}};
    @Autowired
    private CommonService commonService;
@@ -224,8 +225,17 @@
                    // 判断重复工作档
                    WrkMast wrkMast = wrkMastMapper.selectPakInStep1(inSta.getStaNo(), barcode);
                    if (wrkMast != null) {
                        log.error("工作档中已存在该站状态为( 2.设备上走 )的数据,工作号={}", wrkMast.getWrkNo());
                        continue;
                        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"));
@@ -388,6 +398,22 @@
//                            throw new CoolException("更新plc站点信息失败");
//                        }
                        continue;
                    }
                    // 判断重复工作档
                    WrkMast wrkMast111 = wrkMastMapper.selectPakInStep111(inSta.getStaNo(), barcode);
                    if (wrkMast111 != null) {
                        LedThread ledThread = (LedThread) SlaveConnection.get(SlaveType.Led, inSta.getLed());
                        barcodeThread.setBarcode("");
                        staProtocol.setWorkNo(wrkMast111.getWrkNo());
                        staProtocol.setStaNo(wrkMast111.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;
                    }
                    // 判断重复工作档
@@ -558,12 +584,27 @@
//                        }
                        continue;
                    }
//
//                    // 判断重复工作档
//                    WrkMast wrkMast = wrkMastMapper.selectPakInStep1(inSta.getStaNo(), barcode);
//                    if (wrkMast != null) {
//                        log.error("工作档中已存在该站状态为( 2.设备上走 )的数据,工作号={}", wrkMast.getWrkNo());
//                        continue;
//                    }
                    // 判断重复工作档
                    WrkMast wrkMast = wrkMastMapper.selectPakInStep1(inSta.getStaNo(), barcode);
                    if (wrkMast != null) {
                        log.error("工作档中已存在该站状态为( 2.设备上走 )的数据,工作号={}", wrkMast.getWrkNo());
                        continue;
                        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"));
@@ -606,12 +647,27 @@
                                throw new CoolException("更新plc站点信息失败");
                            }
                        } else {
                            log.error("请求接口失败!!!url:{};request:{};response:{}", wmsUrl + "/rpc/pakin/loc/v1", JSON.toJSONString(param), response);
                            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/v33")
                                    .setJson(JSON.toJSONString(param2))
                                    .build()
                                    .doPost();
                            JSONObject jsonObject2 = JSON.parseObject(response2);
                            if (jsonObject2.getInteger("code").equals(200)) {
                                log.info("大料箱自动组托成功!!");
                            } else {
                                log.error("请求接口失败!!!url:{};request:{};response:{}", wmsUrl + "/rpc/pakin/loc/v1", JSON.toJSONString(param), response);
                            LedThread ledThread = (LedThread) SlaveConnection.get(SlaveType.Led, inSta.getLed());
                                LedThread ledThread = (LedThread) SlaveConnection.get(SlaveType.Led, inSta.getLed());
                            if (ledThread != null) {
                                MessageQueue.offer(SlaveType.Led, inSta.getLed(), new Task(5, "入库失败!"));
                                if (ledThread != null) {
                                    MessageQueue.offer(SlaveType.Led, inSta.getLed(), new Task(5, "入库失败!"));
                                }
                            }
                        }
@@ -1033,7 +1089,7 @@
                    case 3:
                    case 4:
                    case 5:
                        crnStnToOutStnTwo(crnStn,1);
                        crnStnToOutStnTwo(crnSlave.getId(),crnStn,1);
                        continue;
                    case 6:
                    case 7:
@@ -1166,7 +1222,7 @@
        return false;
    }
    public synchronized boolean crnStnToOutStnTwo(CrnSlave.CrnStn crnStn ,Integer conStation) {
    public synchronized boolean crnStnToOutStnTwo(Integer crnNo,CrnSlave.CrnStn crnStn ,Integer conStation) {
        try{
            Date now = new Date();
            // 获取堆垛机出库站信息
@@ -1178,19 +1234,21 @@
                staProtocol = staProtocol.clone();
            }
            if (staProtocol.isAutoing() && staProtocol.isLoading() && (staProtocol.getWorkNo() == 0 || staProtocol.getStaNo() == null)) {
                // 查询工作档
                WrkMast wrkMast = wrkMastMapper.selectPakOutStep2(staProtocol.getSiteId());
                if (wrkMast == null) {
                    return false;
                }
                // 判断工作档条件
                if (wrkMast.getIoType() < 100 || wrkMast.getStaNo() == null || wrkMast.getSourceStaNo() == null) {
                    return false;
                }
                // 判断吊车是否实际已完成,且电脑状态在move中,以备电脑进行更新工作档
                CrnThread crnThread = (CrnThread) SlaveConnection.get(SlaveType.Crn, wrkMast.getCrnNo());
                CrnThread crnThread = (CrnThread) SlaveConnection.get(SlaveType.Crn,crnNo);
                CrnProtocol crnProtocol = crnThread.getCrnProtocol();
                if (conStation==1){
                    // 查询工作档
                    WrkMast wrkMast = wrkMastMapper.selectPakOutStep2345(staProtocol.getSiteId(),crnProtocol.getTaskNo().intValue());
                    if (wrkMast == null) {
                        return false;
                    }
                    // 判断工作档条件
                    if (wrkMast.getIoType() < 100 || wrkMast.getStaNo() == null || wrkMast.getSourceStaNo() == null) {
                        return false;
                    }
                    if (crnProtocol.statusType == CrnStatusType.FETCHING || crnProtocol.statusType == CrnStatusType.PUTTING) {
                        // 移动中
                        return false;
@@ -1236,6 +1294,15 @@
                        }
                    }
                }else if (conStation==2){
                    // 查询工作档
                    WrkMast wrkMast = wrkMastMapper.selectPakOutStep2345(staProtocol.getSiteId(),crnProtocol.getTaskNoTwo().intValue());
                    if (wrkMast == null) {
                        return false;
                    }
                    // 判断工作档条件
                    if (wrkMast.getIoType() < 100 || wrkMast.getStaNo() == null || wrkMast.getSourceStaNo() == null) {
                        return false;
                    }
                    if (crnProtocol.statusTypeTwo == CrnStatusType.FETCHING || crnProtocol.statusTypeTwo == CrnStatusType.PUTTING) {
                        // 移动中
                        return false;
@@ -1356,7 +1423,7 @@
                    case 3:
                    case 4:
                    case 5:
                        crnStnToOutStnTwo(crnStn,2);
                        crnStnToOutStnTwo(crnSlave.getId(),crnStn,2);
                        continue;
                    default:
                        break;
@@ -4421,6 +4488,9 @@
     */
    public synchronized void jarMastGenerate() {
        for (JarSlave jarSlave : slaveProperties.getJar()) {
            if (jarSlave.getId()>4){
                continue;
            }
            try{
                if (wrkMastExecuteService.getWrkMastExecuteByJarIdCount(jarSlave.getId())!=0){
                    continue;
@@ -4511,6 +4581,14 @@
            if (jarProtocol.modeType != JarModeType.AUTO){
                return false;
            }
            if (jarProtocol.statusType .equals(JarStatusType.SOS)){
                log.error("{}号硫化罐查询设备正在硫化中,任务异常!!!",jarProtocol.getJarNo());
                return false;
            }
            if (jarProtocol.getJarTemperature()>50){
                log.error("{}号硫化罐查询设备温度过高,等待降温....!!!",jarProtocol.getJarNo());
                return false;
            }
            JarThread jarOtherThread = (JarThread) SlaveConnection.get(SlaveType.Jar, jarSlave.getJarOtherId());
            JarProtocol jarOtherProtocol = jarOtherThread.getJarProtocol();
@@ -4533,7 +4611,7 @@
            //自动、空闲、右门关闭、   Other左门关闭
            if (jarProtocol.isAutoing() && jarProtocol.jarErr==0
                    && jarProtocol.leftDoorOpen==0  && jarProtocol.leftDoorClose==0 && jarProtocol.rightDoorOpen==0  && jarProtocol.rightDoorClose==0){
                if (jarProtocol.statusType == JarStatusType.IDLE || jarProtocol.statusType == JarStatusType.MOVING){
                if (jarProtocol.statusType != JarStatusType.SOS){
                    log.error("Jar任务创建===》执行===>行={}",4537);
                    BasJarMast basJarMast = new BasJarMast(basJar, wrkMast, jarLocDigit);
                    basJarMast.setJarEnterStaNo(staNo);//入硫化罐站点
@@ -4626,6 +4704,10 @@
                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();
@@ -4701,6 +4783,10 @@
                    signExecute[jarSlave.getId()-5] = true;
                    continue;
                }
                if (jarProtocol.getJarTemperature()>50){
                    log.error("{}号硫化罐查询设备温度过高,等待降温....!!!",jarProtocol.getJarNo());
                    continue;
                }
                BasJar basJar = basJarMapper.selectById(jarProtocol.getJarNo());
                if (Cools.isEmpty(basJar)){
@@ -4710,13 +4796,11 @@
                //门作业  无
                //自动、空闲、右门关闭、   Other左门关闭
                if (jarProtocol.isAutoing() && jarProtocol.jarErr==0){
                    switch (sign){
                        case 5:
                            if (jarWrkMastExecuteGenerate5(jarSlave,sign)){
                                signExecute[jarSlave.getId()-5] = true;
                                break;//出硫化罐 ===》 入冷却槽
                            }
                    if (jarWrkMastExecuteGenerate5(jarSlave,sign)){
                        signExecute[jarSlave.getId()-5] = true;
                        //出硫化罐 ===》 入冷却槽
                    }
                    return signExecute;
                }
            } catch (Exception e){
                log.error("{}号硫化罐JarWrkMastExecute任务创建异常,异常原因={}",jarSlave.getId(),e.getMessage());
@@ -4745,6 +4829,10 @@
                    continue;
                }
                if (jarProtocol.modeType != JarModeType.AUTO){
                    continue;
                }
                if (jarProtocol.getJarTemperature()>50){
                    log.error("{}号硫化罐查询设备温度过高,等待降温....!!!",jarProtocol.getJarNo());
                    continue;
                }
@@ -4838,7 +4926,13 @@
                        if (jarProtocol.modeType != JarModeType.AUTO){
                            return false;
                        }
                        if (jarProtocol.statusType .equals(JarStatusType.WAITING2) || jarProtocol.statusType .equals(JarStatusType.SOS)){
                            return false;
                        }
                        if (jarProtocol.getJarTemperature()>50){
                            log.error("{}号硫化罐查询设备温度过高,等待降温....!!!",jarProtocol.getJarNo());
                            continue;
                        }
                        JarThread jarOtherThread = (JarThread) SlaveConnection.get(SlaveType.Jar, jarSlave.getJarOtherId());
                        JarProtocol jarOtherProtocol = jarOtherThread.getJarProtocol();
                        if (jarOtherProtocol == null) {
@@ -4864,15 +4958,16 @@
                                    log.error("JarWrkMastExecute任务创建===>执行异常===》异常数据:BasJar:"+ JSON.toJSONString(basJar)+";BasJarMast:"+JSON.toJSONString(basJarMast));
                                }
                                return true;
                            } else if ((jarProtocol.statusType == JarStatusType.WAITING3 || jarProtocol.statusType == JarStatusType.MOVING) && jarProtocol.isLeftDoor()){
                            } else if (jarProtocol.isLeftDoor()){
                                //生成入硫化罐任务
                                if (!jarWrkMastExecuteGenerateExecute(basJar,basJarMast,basJar.getJarNo(),new int[]{basJar.getEnterSteNo(),basJar.getEnterRgvNo(),5,1})){
                                    log.error("JarWrkMastExecute任务创建===>执行异常===》异常数据:BasJar:"+ JSON.toJSONString(basJar)+";BasJarMast:"+JSON.toJSONString(basJarMast));
                                }
                                return true;
                            } else if (jarProtocol.statusType == JarStatusType.IDLE && jarProtocol.isLeftDoor()){
                                log.error("JarWrkMastExecute任务创建===>执行异常===》硫化罐空闲但是门未关===》异常数据:BasJar:"+ JSON.toJSONString(basJar)+";BasJarMast:"+JSON.toJSONString(basJarMast));
                            }
//                            else if (jarProtocol.statusType == JarStatusType.IDLE && jarProtocol.isLeftDoor()){
//                                log.error("JarWrkMastExecute任务创建===>执行异常===》硫化罐空闲但是门未关===》异常数据:BasJar:"+ JSON.toJSONString(basJar)+";BasJarMast:"+JSON.toJSONString(basJarMast));
//                            }
                        }
                        return false;
                    } else {
@@ -4926,6 +5021,14 @@
                    return false;
                }
                if (jarProtocol.statusType .equals(JarStatusType.WAITING2) || jarProtocol.statusType .equals(JarStatusType.SOS)){
                    log.error("{}号硫化罐查询设备正在硫化中,任务异常!!!",jarProtocol.getJarNo());
                    return false;
                }
                if (jarProtocol.getJarTemperature()>50){
                    log.error("{}号硫化罐查询设备温度过高,等待降温....!!!",jarProtocol.getJarNo());
                    return false;
                }
                BasJar basJar = basJarMapper.selectById(jarProtocol.getJarNo());
                if (Cools.isEmpty(basJar)){
                    log.error("{}号硫化罐查询设备档案无信息!!!",jarProtocol.getJarNo());
@@ -4999,6 +5102,14 @@
                    return false;
                }
                if (jarProtocol.statusType .equals(JarStatusType.SOS)){
                    log.error("{}号硫化罐查询设备正在硫化中,任务异常!!!",jarProtocol.getJarNo());
                    return false;
                }
                if (jarProtocol.getJarTemperature()>50){
                    log.error("{}号硫化罐查询设备温度过高,等待降温....!!!",jarProtocol.getJarNo());
                    return false;
                }
                BasJar basJar = basJarMapper.selectById(jarProtocol.getJarNo());
                if (Cools.isEmpty(basJar)){
                    log.error("{}号硫化罐查询设备档案无信息!!!",jarProtocol.getJarNo());
@@ -5069,6 +5180,11 @@
                    return false;
                }
                if (jarProtocol.statusType .equals(JarStatusType.SOS)){
                    log.error("{}号硫化罐查询设备正在硫化中,任务异常!!!",jarProtocol.getJarNo());
                    return false;
                }
                BasJar basJar = basJarMapper.selectById(jarProtocol.getJarNo());
                if (Cools.isEmpty(basJar)){
                    log.error("{}号硫化罐查询设备档案无信息!!!",jarProtocol.getJarNo());
@@ -5111,26 +5227,26 @@
            if (wrkMastExecuteService.getWrkMastExecuteByJarIdCount(jarSlave.getId())!=0){
                return false;
            }
            List<BasJarMast> basJarMastList = basJarMastService.getJarMastByJarIdAndStatusList(jarSlave.getId(), new ArrayList<Integer>() {{
                add(14);//冷却完成
            List<BasJarMast> basJarMastList = basJarMastService.getJarMastByJarIdAndStatusListB(jarSlave.getId(), new ArrayList<Integer>() {{
                add(12);//冷却完成
            }});
            if (basJarMastList.isEmpty()){
                return false;
            }
            if (basJarMastService.selectJarMastOperation(jarSlave.getJarOtherId(),7)!=0){
            if (basJarMastService.selectJarMastOperation(jarSlave.getJarOtherId(),6)!=0){
                return false;
            }
            BasJarMast jarMastByJarIdMin = basJarMastService.getJarMastByJarIdMin(jarSlave.getId(),14,14);
            BasJarMast jarMastByJarIdMin = basJarMastService.getJarMastByJarIdMinB(jarSlave.getId(),12,12);
            if (Cools.isEmpty(jarMastByJarIdMin)){
                return false;
            }
            //判断小车状态
            if (!jarWrkMastExecuteGenerateSteStatus(jarSlave.getJarOutSte().get(0).getSteNo(),2,SteStatusType.IDLE)){
                return false;
            }
//
//            //判断小车状态
//            if (!jarWrkMastExecuteGenerateSteStatus(jarSlave.getJarOutSte().get(0).getSteNo(),3,SteStatusType.IDLE)){
//                return false;
//            }
            //判断RGV状态
            JarSlave.RgvStn rgvStn = jarSlave.getJarOutRgv().get(0);
@@ -5145,7 +5261,10 @@
                if (jarProtocol.modeType != JarModeType.AUTO){
                    return false;
                }
                if (jarProtocol.getJarTemperature()>50){
                    log.error("{}号硫化罐查询设备温度过高,等待降温....!!!",jarProtocol.getJarNo());
                    return false;
                }
                BasJar basJar = basJarMapper.selectById(jarProtocol.getJarNo());
                if (Cools.isEmpty(basJar)){
                    log.error("{}号硫化罐查询设备档案无信息!!!",jarProtocol.getJarNo());
@@ -5154,8 +5273,8 @@
                //门作业  无
                if (jarProtocol.isAutoing() && jarProtocol.jarErr==0){
                    //关进料门
                    if (!jarWrkMastExecuteGenerateExecute(basJar,jarMastByJarIdMin,basJar.getBurial(),new int[]{basJar.getOutSteNo(),basJar.getOutRgvNo(),3,1})){
                    //冷却完成上输送线
                    if (!jarWrkMastExecuteGenerateExecute(basJar,jarMastByJarIdMin,basJar.getBurial(),new int[]{basJar.getOutSteNo(),basJar.getOutRgvNo(),9,1})){
                        log.error("JarWrkMastExecute任务创建===>执行异常===》异常数据:BasJar:"+ JSON.toJSONString(basJar)+";BasJarMast:"+JSON.toJSONString(jarMastByJarIdMin));
                    }
                    return true;
@@ -5177,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);
@@ -5194,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)) {
@@ -5269,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) {
@@ -5325,6 +5499,7 @@
                * 7: 穿梭车进冷却槽  8: 穿梭车离开冷却槽
                * 9: 出冷却槽
                * 10:A=>B 11:B=>A
                * 100:充电任务
                * */
                log.error("JarWrkMastExecute任务创建==>下发===>行={}",5326);
                switch (wrkMastExecute.getIoType()){
@@ -5364,6 +5539,11 @@
                    case 10:
                    case 11:
                        if (jarWrkMastExecuteActionExecute10(wrkMastExecute,sign)){
                            break;
                        }
                        continue;
                    case 100:
                        if (jarWrkMastExecuteActionExecute100(wrkMastExecute,sign)){
                            break;
                        }
                        continue;
@@ -5500,7 +5680,14 @@
            if (jarProtocol.modeType != JarModeType.AUTO){
                return false;
            }
            if (jarProtocol.statusType .equals(JarStatusType.SOS)){
                log.error("{}号硫化罐查询设备正在硫化中,任务异常!!!",jarProtocol.getJarNo());
                return false;
            }
            if (jarProtocol.getJarTemperature()>50){
                log.error("{}号硫化罐查询设备温度过高,等待降温....!!!",jarProtocol.getJarNo());
                return false;
            }
            BasJar basJar = basJarMapper.selectById(jarProtocol.getJarNo());
            if (Cools.isEmpty(basJar)){
                log.error("{}号硫化罐查询设备档案无信息!!!",jarProtocol.getJarNo());
@@ -5621,7 +5808,14 @@
            if (jarProtocol.modeType != JarModeType.AUTO){
                return false;
            }
            if (jarProtocol.statusType .equals(JarStatusType.WAITING2) || jarProtocol.statusType .equals(JarStatusType.SOS)){
                log.error("{}号硫化罐查询设备正在硫化中,任务异常!!!",jarProtocol.getJarNo());
                return false;
            }
            if (jarProtocol.getJarTemperature()>50){
                log.error("{}号硫化罐查询设备温度过高,等待降温....!!!",jarProtocol.getJarNo());
                return false;
            }
            BasJar basJar = basJarMapper.selectById(jarProtocol.getJarNo());
            if (Cools.isEmpty(basJar)){
                log.error("{}号硫化罐查询设备档案无信息!!!",jarProtocol.getJarNo());
@@ -5742,7 +5936,14 @@
            if (jarProtocol.modeType != JarModeType.AUTO){
                return false;
            }
            if (jarProtocol.statusType .equals(JarStatusType.WAITING2) || jarProtocol.statusType .equals(JarStatusType.SOS)){
                log.error("{}号硫化罐查询设备正在硫化中,任务异常!!!",jarProtocol.getJarNo());
                return false;
            }
            if (jarProtocol.getJarTemperature()>50){
                log.error("{}号硫化罐查询设备温度过高,等待降温....!!!",jarProtocol.getJarNo());
                return false;
            }
            BasJar basJar = basJarMapper.selectById(jarProtocol.getJarNo());
            if (Cools.isEmpty(basJar)){
                log.error("{}号硫化罐查询设备档案无信息!!!",jarProtocol.getJarNo());
@@ -5784,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())){
@@ -5851,7 +6052,14 @@
            if (jarProtocol.modeType != JarModeType.AUTO){
                return false;
            }
            if (jarProtocol.statusType .equals(JarStatusType.WAITING2) || jarProtocol.statusType .equals(JarStatusType.SOS)){
                log.error("{}号硫化罐查询设备正在硫化中,任务异常!!!",jarProtocol.getJarNo());
                return false;
            }
            if (jarProtocol.getJarTemperature()>50){
                log.error("{}号硫化罐查询设备温度过高,等待降温....!!!",jarProtocol.getJarNo());
                return false;
            }
            BasJar basJar = basJarMapper.selectById(jarProtocol.getJarNo());
            if (Cools.isEmpty(basJar)){
                log.error("{}号硫化罐查询设备档案无信息!!!",jarProtocol.getJarNo());
@@ -5902,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;
                        }
                        //调车  == > 取货
@@ -5960,7 +6168,14 @@
            if (jarProtocol.modeType != JarModeType.AUTO){
                return false;
            }
            if (jarProtocol.statusType .equals(JarStatusType.SOS)){
                log.error("{}号硫化罐查询设备正在硫化中,任务异常!!!",jarProtocol.getJarNo());
                return false;
            }
            if (jarProtocol.getJarTemperature()>50){
                log.error("{}号硫化罐查询设备温度过高,等待降温....!!!",jarProtocol.getJarNo());
                return false;
            }
            BasJar basJar = basJarMapper.selectById(jarProtocol.getJarNo());
            if (Cools.isEmpty(basJar)){
                log.error("{}号硫化罐查询设备档案无信息!!!",jarProtocol.getJarNo());
@@ -6004,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;
                    }
@@ -6069,6 +6284,14 @@
                return false;
            }
            if (jarProtocol.statusType .equals(JarStatusType.SOS)){
                log.error("{}号硫化罐查询设备正在硫化中,任务异常!!!",jarProtocol.getJarNo());
                return false;
            }
            if (jarProtocol.getJarTemperature()>50){
                log.error("{}号硫化罐查询设备温度过高,等待降温....!!!",jarProtocol.getJarNo());
                return false;
            }
            BasJar basJar = basJarMapper.selectById(jarProtocol.getJarNo());
            if (Cools.isEmpty(basJar)){
                log.error("{}号硫化罐查询设备档案无信息!!!",jarProtocol.getJarNo());
@@ -6119,7 +6342,7 @@
                    if (SteAndJarUtil.steAndJarNowRow(staProtocolRGV.getNowRow() , jarProtocol.getJarNo())){
                        //判断小车状态
                        if (!jarWrkMastExecuteGenerateSteStatus(basJar.getEnterSteNo(),2,SteStatusType.IDLE)){
                        if (!jarWrkMastExecuteGenerateSteStatus(basJar.getEnterSteNo(),2,SteStatusType.WAITING2,false)){
                            return false;
                        }
                        //调车  == > 取货
@@ -6181,7 +6404,10 @@
            if (jarProtocol.modeType != JarModeType.AUTO){
                return false;
            }
            if (jarProtocol.getJarTemperature()>50){
                log.error("{}号硫化罐查询设备温度过高,等待降温....!!!",jarProtocol.getJarNo());
                return false;
            }
            BasJar basJar = basJarMapper.selectById(jarProtocol.getJarNo());
            if (Cools.isEmpty(basJar)){
                log.error("{}号硫化罐查询设备档案无信息!!!",jarProtocol.getJarNo());
@@ -6249,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={}",
@@ -6261,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)){
@@ -6270,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={}",
@@ -6282,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)){
@@ -6342,7 +6568,10 @@
//            if (jarProtocol.modeType != JarModeType.AUTO){
//                return false;
//            }
//            if (jarProtocol.getJarTemperature()>50){
//                log.error("{}号硫化罐查询设备温度过高,等待降温....!!!",jarProtocol.getJarNo());
//                return false;
//            }
            BasJar basJar = basJarMapper.selectById(wrkMastExecute.getJarId());
            if (Cools.isEmpty(basJar)){
                log.error("{}号冷却槽查询设备档案无信息!!!",wrkMastExecute.getJarId());
@@ -6409,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);
                        //调车  == > 取货
@@ -6467,11 +6696,11 @@
            }
            //判断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());
                staProtocol.setStaNo(staProtocol.getStaNo());
                staProtocol.setStaNo(wrkMastExecute.getOutStaNo());
                if (!MessageQueue.offer(SlaveType.Devp, 2, new Task(2, staProtocol))) {
                    return false;
                }
@@ -6511,6 +6740,14 @@
                return false;
            }
            if (jarProtocol.statusType .equals(JarStatusType.SOS)){
                log.error("{}号硫化罐查询设备正在硫化中,任务异常!!!",jarProtocol.getJarNo());
                return false;
            }
            if (jarProtocol.getJarTemperature()>50){
                log.error("{}号硫化罐查询设备温度过高,等待降温....!!!",jarProtocol.getJarNo());
                return false;
            }
            BasJar basJar = basJarMapper.selectById(jarProtocol.getJarNo());
            if (Cools.isEmpty(basJar)){
                log.error("{}号硫化罐查询设备档案无信息!!!",jarProtocol.getJarNo());
@@ -6549,7 +6786,7 @@
                    //移走  == > 2
                    if (!jarRgvMoveTake(wrkMastExecute,2)){
                        log.error("平衡车RGV命令下发失败,rgv号={},任务数据={},硫化罐数据={},sign={}",
                                wrkMastExecute.getJarId(), JSON.toJSON(wrkMastExecute), JSON.toJSON(jarProtocol),sign);
                                wrkMastExecute.getJarId(), JSON.toJSONString(wrkMastExecute), JSON.toJSONString(jarProtocol),sign);
                    }
                    return true;
                }
@@ -6562,45 +6799,45 @@
                    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={}",
                                            wrkMastExecute.getSteId(), JSON.toJSON(wrkMastExecute), JSON.toJSON(jarProtocol),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.toJSON(wrkMastExecute), JSON.toJSON(jarProtocol),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)){
                                    log.error("穿梭板Ste命令下发失败===>更新wrkMastExecute失败,jar号={},任务数据={},硫化罐数据={},sign={}",
                                            wrkMastExecute.getSteId(), JSON.toJSON(wrkMastExecute), JSON.toJSON(jarProtocol),sign);
                                            wrkMastExecute.getSteId(), JSON.toJSONString(wrkMastExecute), JSON.toJSONString(jarProtocol),sign);
                                }
                            }
                        } 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={}",
                                            wrkMastExecute.getSteId(), JSON.toJSON(wrkMastExecute), JSON.toJSON(jarProtocol),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.toJSON(wrkMastExecute), JSON.toJSON(jarProtocol),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)){
                                    log.error("穿梭板Ste命令下发失败===>更新wrkMastExecute失败,jar号={},任务数据={},硫化罐数据={},sign={}",
                                            wrkMastExecute.getSteId(), JSON.toJSON(wrkMastExecute), JSON.toJSON(jarProtocol),sign);
                                            wrkMastExecute.getSteId(), JSON.toJSONString(wrkMastExecute), JSON.toJSONString(jarProtocol),sign);
                                }
                            }
                        }
@@ -6609,13 +6846,13 @@
                        //调车  == > endRow
                        if (!jarRgvMoveTake(wrkMastExecute,SteAndJarUtil.getRgvJarNowRow(wrkMastExecute.getJarId()))){
                            log.error("平衡车RGV命令下发失败,rgv号={},任务数据={},硫化罐数据={},sign={}",
                                    wrkMastExecute.getJarId(), JSON.toJSON(wrkMastExecute), JSON.toJSON(jarProtocol),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.toJSON(wrkMastExecute), JSON.toJSON(jarProtocol),sign);
                                    wrkMastExecute.getJarId(), JSON.toJSONString(wrkMastExecute), JSON.toJSONString(jarProtocol),sign);
                        }
                    }
                    return true;
@@ -6627,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;
    }
@@ -6802,7 +7092,7 @@
                                    if (wrkMastExecute.getWrkSts()==3){//==>4
                                        //1:RGV小车移动、2:RGV小车到位、3:Ste穿梭版取货、4:取货完成等待下一步、5:Ste穿梭版放货至冷却池、6:放货完成、7:更新完成   //io_type = 6
                                        //ste任务等待完成
                                        if (steProtocol.statusType.equals(SteStatusType.WAITING2)){
                                        if (steProtocol.statusType.equals(SteStatusType.WAITING)){
                                            //ste任务完成
                                            if (jarSteTake(wrkMastExecute,null,null,null,true,SteAndJarUtil.getBJarNo(wrkMastExecute.getJarId()))){
                                                wrkMastExecute.setWrkSts(4);
@@ -6911,6 +7201,10 @@
                }
                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)){
@@ -7129,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);
@@ -7150,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());
@@ -7185,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, 9, null);
                            List<WrkMastExecute> wrkMastExecutesA = wrkMastExecuteService.selectWrkMastExecuteByTypeAndIoTyperAndWrkType(null, 6, null);
                            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());
@@ -7219,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;
    }
}