#
whycq
2025-05-28 78489da7e2185f53faaec9356fa1a8997cedab70
src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
@@ -19,6 +19,7 @@
import com.zy.common.model.SearchLocParam;
import com.zy.common.model.StartupDto;
import com.zy.common.service.CommonService;
import com.zy.common.utils.CollectionUtils;
import com.zy.common.utils.HttpHandler;
import com.zy.common.utils.News;
import com.zy.core.CrnThread;
@@ -39,14 +40,17 @@
import com.zy.core.thread.LedThread;
import com.zy.core.thread.SiemensDevpThread;
import lombok.extern.slf4j.Slf4j;
import net.bytebuddy.asm.Advice;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.transaction.interceptor.TransactionAspectSupport;
import java.util.*;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Set;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
/**
@@ -90,7 +94,7 @@
    @Value("${wms.url}")
    private String wmsUrl;
    public short wrkNo = 10000;
    public short wrkNo = 11000;
    /**
     * 组托
@@ -117,6 +121,7 @@
                if (barcodeThread == null) {
                    continue;
                }
                String barcode = barcodeThread.getBarcode();
                // 尺寸检测异常
                boolean back = false;
@@ -149,9 +154,16 @@
                    errMsg = "扫码失败";
                    back = true;
                }
                // 退回
                if (back) {
//                        News.warn("扫码入库失败,{}入库站因{}异常,托盘已被退回", inSta.getStaNo(), errMsg);
                    if(!staProtocol.isOutEnable()){
                        continue;
                    }
                    if (!staProtocol.isLoading()){
                        continue;
                    }
@@ -159,33 +171,48 @@
                        continue;
                    }
                    staProtocol.setWorkNo(wrkNo);
                    News.info("{}入库回退:{},任务号:{}", inSta.getStaNo(), errMsg,wrkNo);
                    wrkNo++;
                    staProtocol.setStaNo(inSta.getBackSta().shortValue());
                    devpThread.setPakMk(staProtocol.getSiteId(), false);
                    MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol));
                    MessageQueue.offer(SlaveType.Led, inSta.getLed(), new Task(3, errMsg));
                }
                //拣料、盘点任务,不进入新板入库方法,直接跳出
                if(staProtocol.getWorkNo()>=3001 && staProtocol.getWorkNo()<=6000){
                    continue;
                }
                // 判断是否满足入库条件
                if (staProtocol.isAutoing()
                        && staProtocol.isLoading()
                        && staProtocol.isInEnable()
                        && !staProtocol.isEmptyMk()
                        && (staProtocol.getWorkNo() == 9999 || staProtocol.getWorkNo() == 9997 || staProtocol.getWorkNo() == 9995)
                        && staProtocol.isPakMk()) {// && !Cools.isEmpty(barcode)) {
                        && staProtocol.isPakMk() && !back) {// && !Cools.isEmpty(barcode)) {
//                    if(Cools.isEmpty(barcode) || "NG".endsWith(barcode) || "NoRead".equals(barcode)) {
//                        News.info("{}号条码扫描器检测条码信息:{}", inSta.getBarcode(), barcode);
//                        //条码为空或者不符合,退库到172站点
//                        staProtocol.setWorkNo((short)9999);
//                        staProtocol.setStaNo((short)172);
//                        devpThread.setPakMk(staProtocol.getSiteId(), false);
//                        boolean result = MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol));
//                        if (!result) {
//                            throw new CoolException("更新plc站点信息失败");
                    if(Cools.isEmpty(barcode) || "NG".endsWith(barcode) || "NoRead".equals(barcode) || "00000000".equals(barcode)) {
                        News.info("{}号条码扫描器检测条码信息:{}", inSta.getBarcode(), barcode);
                        //条码为空或者不符合,退库到172站点
                        staProtocol.setWorkNo(wrkNo);
                        staProtocol.setStaNo(inSta.getBackSta().shortValue());
                        wrkNo++;
                        devpThread.setPakMk(staProtocol.getSiteId(), false);
                        boolean result = MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol));
                        if (!result) {
                            throw new CoolException("更新plc站点信息失败");
                        }
                        continue;
                    }
//                    //判断101和104是否是拣料、并板、盘点再入库   设备暂不支持101、104站盘点/拣料入库
//                    WrkMast wrkMast1=wrkMastMapper.selectpj(inSta.getStaNo(),barcode);
//                    if(!Cools.isEmpty(wrkMast1)){
//                        if (wrkMast1.getIoType()!=1){
//                            continue;
//                        }
//                    }
//                    if( !Cools.isEmpty(barcode)&&!Cools.isEmpty(wrkMast1)){
//                        log.error("101或104拣料、并板、盘点再入库", wrkMast1.getWrkNo());
//                        continue;
//                    }
                    // 判断重复工作档
                    WrkMast wrkMast = wrkMastMapper.selectPakInStep1(inSta.getStaNo(), barcode);
                    if (wrkMast != null) {
@@ -199,10 +226,18 @@
                    WrkMast checkPick = wrkMastService.selectOne(new EntityWrapper<WrkMast>()
                            .eq("barcode", barcode)
                            .eq("io_type", 103));
                            .in("io_type", 107,103,104,57,53));
                    if (!Cools.isEmpty(checkPick)) {
                        continue;
                    } else {
                        News.info("新板入库条码===>>" + barcode);
                    }
//                    WrkMast checkPick2 = wrkMastService.selectOne(new EntityWrapper<WrkMast>()
//                            .eq("barcode", barcode)
//                            .in("io_type", 57,53));
//                    if (!Cools.isEmpty(checkPick2)) {
//                        continue;
//                    }
                    try {
@@ -215,6 +250,7 @@
                        param.setLocType1(locTypeDto.getLocType1());
                        String response = new HttpHandler.Builder()
                                .setUri(wmsUrl)
                                .setTimeout(30, TimeUnit.SECONDS)
                                .setPath("/rpc/pakin/loc/v1")
                                .setJson(JSON.toJSONString(param))
                                .build()
@@ -232,12 +268,15 @@
                                News.error(methodName + ":更新plc站点信息失败");
                                throw new CoolException("更新plc站点信息失败");
                            }else {
                                ledThread.errorReset();
                            }
                        } else {
                            staProtocol.setWorkNo((short) 9998);
                            staProtocol.setStaNo((short) 14);
                            staProtocol.setWorkNo(wrkNo);
                            wrkNo++;
                            staProtocol.setStaNo(inSta.getBackSta().shortValue());
                            devpThread.setPakMk(staProtocol.getSiteId(), false);
                            MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol));
@@ -409,23 +448,46 @@
                }
                String barcode = barcodeThread.getBarcode();
                if (!Cools.isEmpty(barcode) && (staProtocol.getWorkNo() != 9998 || staProtocol.getWorkNo() != 9996)) {
                WrkMast wrkMast1 = wrkMastMapper.selectPickStep1(staProtocol.getWorkNo().intValue());
                //任务号如果在工作档中存在,就不用去判断条码
                if(Cools.isEmpty(wrkMast1)) {
//                    WrkMast mast = wrkMastMapper.selectPickStep(barcode);
//                    if (Cools.isEmpty(mast)) {
//                        break;
//                    }
                    if (!Cools.isEmpty(barcode)) {
//                    log.info("{}号条码扫描器检测条码信息:{}", pickSta.getBarcode(), barcode);
                    if ("NG".endsWith(barcode) || "NoRead".equals(barcode)) {
                        staProtocol.setWorkNo((short) 9998);
                        staProtocol.setStaNo((short) 14);
                        devpThread.setPakMk(staProtocol.getSiteId(), false);
                        MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol));
                        // led 异常显示
                        if (ledThread != null) {
                            String errorMsg = "扫码失败,请重试";
                            News.error(methodName + ":扫码失败,请重试");
                            MessageQueue.offer(SlaveType.Led, pickSta.getLed(), new Task(3, errorMsg));
                        if ("NG".endsWith(barcode) || "NoRead".equals(barcode)  && staProtocol.isPakMk()) {
                            if (!staProtocol.isLoading()) {
                                continue;
                            }
                            if (!staProtocol.isPakMk()) {
                                continue;
                            }
                            if (staProtocol.getWorkNo() != 0) {
                                continue;
                            }
                            staProtocol.setWorkNo(wrkNo);
                            wrkNo++;
                            staProtocol.setStaNo(pickSta.getBackSta().shortValue());
                            devpThread.setPakMk(staProtocol.getSiteId(), false);
                            MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol));
                            // led 异常显示
                            if (ledThread != null) {
                                String errorMsg = "扫码失败,请重试";
                                News.error(methodName + ":扫码失败,请重试");
                                MessageQueue.offer(SlaveType.Led, pickSta.getLed(), new Task(3, errorMsg));
                            }
                            continue;
                        }
                    } else {
                        continue;
                    }
                } else {
                    continue;
                }
@@ -436,10 +498,15 @@
                        && staProtocol.isLoading()
                        && staProtocol.isInEnable()
                        && !staProtocol.isEmptyMk()
                        && (staProtocol.getWorkNo() == 9999 || staProtocol.getWorkNo() == 9997 || staProtocol.getWorkNo() == 9995)
//                        && (staProtocol.getWorkNo() == 9999 || staProtocol.getWorkNo() == 9997 || staProtocol.getWorkNo() == 9995)
                        && staProtocol.isPakMk()) {
                    WrkMast wrkMast = wrkMastMapper.selectPickStep(barcode);
                    WrkMast wrkMast = null;
                    //优先查询任务号对应的工作档有没有,如果有的话就不用查条码号
                    wrkMast = wrkMastMapper.selectPickStep1(staProtocol.getWorkNo().intValue());
                    if(Cools.isEmpty(wrkMast)) {
                        wrkMast = wrkMastMapper.selectPickStep(barcode);
                    }
//                    WrkMast wrkMast = wrkMastMapper.selectPakInStep3(staProtocol.getWorkNo().intValue());
                    if (wrkMast == null) {
                        // 无拣料数据
@@ -449,6 +516,9 @@
                            || Cools.isEmpty(wrkMast.getStaNo()) || Cools.isEmpty(wrkMast.getSourceStaNo())) {
                        continue;
                    }
                    LocMast locMast1 = locMastService.selectOne(new EntityWrapper<LocMast>().eq("loc_no", wrkMast.getSourceLocNo()));
                    // 拣、盘、并 作业站转换
//                    int stnNo = 0;
@@ -462,8 +532,7 @@
                    // 获取目标站
                    Wrapper<StaDesc> wrapper = new EntityWrapper<StaDesc>()
                            .eq("type_no", wrkMast.getIoType() - 50)
                            //速腾特有捡料, 11站是出库站, 然后手动走到15站进行再入库
                            .eq("stn_no", 15) // 作业站点 = 拣料出库的目标站
                            .eq("stn_no", pickSta.getStaNo()) // 作业站点 = 拣料出库的目标站
                            .eq("crn_no", wrkMast.getCrnNo()); // 堆垛机号
                    StaDesc staDesc = staDescService.selectOne(wrapper);
                    if (Cools.isEmpty(staDesc)) {
@@ -519,12 +588,16 @@
                        TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
                        continue;
                    }
                    if (ledThread != null) {
                        ledThread.errorReset();
                    }
                    // 更新站点信息 且 下发plc命令
                    staProtocol.setWorkNo(wrkMast.getWrkNo().shortValue());
                    staProtocol.setStaNo(wrkMast.getStaNo().shortValue());
                    devpThread.setPakMk(staProtocol.getSiteId(), false);
                    boolean result = MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol));
                    if (!result) {
                        News.error(methodName + ":发布命令至输送线队列失败!!! [plc编号:{}]", devp.getId());
@@ -591,6 +664,7 @@
                        wrkMast.setCrnEndTime(new Date());
                        if (wrkMastMapper.updateById(wrkMast) != 0) {
                            // 复位堆垛机
                            News.info("crnStnToOutStn堆垛机复位时工作号===>>" + crnProtocol.getTaskNo());
                            crnThread.setResetFlag(true);
                        } else {
                            News.error(methodName + ":更新工作档的工作状态为14失败!!! [工作号:{}]", wrkMast.getWrkNo());
@@ -767,6 +841,12 @@
            // 堆垛机控制过滤
            if (!crnProtocolNow.getStatusType().equals(CrnStatusType.IDLE) || crnProtocolNow.getTaskNo() != 0) {
                continue;
            }
            // 已经存在吊车执行任务时,则过滤
            if (wrkMastMapper.selectWorking(slave.getId()) != null) {
                break;
//                        return;
            }
            // 命令下发区 --------------------------------------------------------------------------
@@ -1085,7 +1165,7 @@
            for (WrkMast wrkMast : wrkMasts) {
                CrnSlave.CrnStn crnStn = null;
                for (CrnSlave.CrnStn crnStn1 : slave.getCrnOutStn()) {
                    if (crnStn1.getStaNo() == wrkMast.getSourceStaNo()) {
                    if (wrkMast.getSourceStaNo().equals(crnStn1.getStaNo())) {
                        crnStn = crnStn1;
                        break;
                    } else {
@@ -1131,6 +1211,7 @@
//                    continue;
                }
                // 判断堆垛机出库站状态
                if (staProtocol.isAutoing() && !staProtocol.isLoading() && staDetl.getCanouting() != null && staDetl.getCanouting().equals("Y")
                        && staProtocol.getWorkNo() == 0 && staProtocol.isOutEnable()) {
                    // 命令下发区 --------------------------------------------------------------------------
@@ -1480,6 +1561,7 @@
                    }
                    // 入库 + 库位转移  ==> 4.入库完成
                    if (wrkMast.getWrkSts() == 3 || (wrkMast.getWrkSts() == 12 && wrkMast.getIoType() == 11)) {
                        log.error("入库完成堆垛机任务=========》"+JSON.toJSONString(wrkMast));
                        wrkMast.setWrkSts(4L);
                    } else {
                        continue;
@@ -1490,6 +1572,7 @@
                    // 修改成功后复位堆垛机
                    if (wrkMastMapper.updateById(wrkMast) > 0) {
                        // 堆垛机复位
                        News.info("storeFinished堆垛机复位时工作号===>>" + crnProtocol.getTaskNo());
                        crnThread.setResetFlag(true);
                    }
                }
@@ -1655,6 +1738,7 @@
                        param.setLocType1(locTypeDto.getLocType1());
                        String response = new HttpHandler.Builder()
                                .setUri(wmsUrl)
                                .setTimeout(30, TimeUnit.SECONDS)
                                .setPath("/rpc/pakin/loc/v1")
                                .setJson(JSON.toJSONString(param))
                                .build()
@@ -1746,144 +1830,111 @@
     * 出库  ===>> 工作档信息写入led显示器
     */
    public synchronized void ledExecute() {
//        String methodName = Thread.currentThread().getStackTrace()[1].getMethodName();
        for (LedSlave led : slaveProperties.getLed()) {
            // 获取输送线plc线程
            DevpThread devpThread = (DevpThread) SlaveConnection.get(SlaveType.Devp, led.getDevpPlcId());
//            // 命令集合
//            List<LedCommand> commands = new ArrayList<>();
//            // 工作档集合
//            List<WrkMast> wrkMasts = new ArrayList<>();
            // 命令集合
            List<LedCommand> commands = new ArrayList<>();
            // 工作档集合
            List<WrkMast> wrkMasts = new ArrayList<>();
            for (Integer staNo : led.getStaArr()) {
                // 获取叉车站点
                StaProtocol staProtocol = devpThread.getStation().get(staNo);
                if (null == staProtocol || null == staProtocol.getWorkNo() || 0 == staProtocol.getWorkNo() || !staProtocol.isLoading()) {
                    MessageQueue.offer(SlaveType.Led, led.getId(), new Task(3, ""));
                    continue;
                } else {
                    staProtocol = staProtocol.clone();
                }
                // 获取工作档数据
                WrkMast wrkMast = wrkMastMapper.selectById(staProtocol.getWorkNo());
                if (null == wrkMast) {
                    MessageQueue.offer(SlaveType.Led, led.getId(), new Task(3, ""));
                    continue;
                }
                ArrayList<MatDto> matDtos = new ArrayList<>();
                Wrapper<WrkDetl> detlWrapper = new EntityWrapper<WrkDetl>()
                        .eq("wrk_no", wrkMast.getWrkNo());
                if (null == wrkMast || wrkMast.getWrkSts() < 14 || wrkMast.getIoType() < 100) { continue; }
                wrkMasts.add(wrkMast);
                // 组装命令
                LedCommand ledCommand = new LedCommand();
                ledCommand.setWorkNo(wrkMast.getWrkNo());
                ledCommand.setStaNo(wrkMast.getStaNo());
                ledCommand.setSourceStaNo(wrkMast.getSourceStaNo());
                ledCommand.setLocNo(wrkMast.getLocNo());
                ledCommand.setSourceLocNo(wrkMast.getSourceLocNo());
                ledCommand.setIoType(wrkMast.getIoType());
                ledCommand.setTitle(wrkMast.getIoType$());
                // 出库模式
                switch (wrkMast.getIoType()) {
                    case 10:
                    case 101:
                        ledCommand.setTitle("全板出库");
                        break;
                    case 103:
                        ledCommand.setTitle("拣料出库");
                        break;
                    case 104:
                        ledCommand.setTitle("并板出库");
                        break;
                    case 107:
                        ledCommand.setTitle("盘点出库");
                        break;
                    case 110:
                        ledCommand.setTitle("空板出库");
                        ledCommand.setEmptyMk(true);
                        break;
                    default:
                        ledCommand.setBarcode(wrkMast.getBarcode());
                        List<WrkDetl> wrkDetls = wrkDetlService.selectList(detlWrapper);
                        for (WrkDetl wrkDetl : wrkDetls) {
                            MatDto matDto = new MatDto();
                            matDto.setMaknx(wrkDetl.getMaktx());
                            matDto.setMatNo(wrkDetl.getMatnr());
                            matDto.setCount(wrkDetl.getAnfme());
                            matDtos.add(matDto);
                        }
                        News.error("任务入出库类型错误!!![工作号:{}] [入出库类型:{}]", wrkMast.getWrkNo(), wrkMast.getIoType());
                        break;
                }
                ledCommand.setMatDtos(matDtos);
                MessageQueue.offer(SlaveType.Led, led.getId(), new Task(3, ledCommand.toString()));
                ledCommand.setSourceLocNo(wrkMast.getSourceLocNo());
                ledCommand.setStaNo(wrkMast.getStaNo());
                ledCommand.setBarcode(wrkMast.getBarcode());
                if (wrkMast.getIoType() != 110) {
                    List<WrkDetl> wrkDetls = wrkDetlService.findByWorkNo(wrkMast.getWrkNo());
//                wrkMasts.add(wrkMast);
//                // 组装命令
//                LedCommand ledCommand = new LedCommand();
//                ledCommand.setWorkNo(wrkMast.getWrkNo());
//                ledCommand.setIoType(wrkMast.getIoType());
//                // 出库模式
//                switch (wrkMast.getIoType()) {
//                    case -1:
//                        ledCommand.setTitle("全板入库");
//                        break;
//                    case 10:
//                        ledCommand.setTitle("空板入库");
//                        break;
//                    case 10-1:
//                        ledCommand.setTitle("全板出库");
//                        break;
//                    case 103:
//                        ledCommand.setTitle("拣料出库");
//                        break;
//                    case 104:
//                        ledCommand.setTitle("并板出库");
//                        break;
//                    case 107:
//                        ledCommand.setTitle("盘点出库");
//                        break;
//                    case 110:
//                        ledCommand.setTitle("空板出库");
//                        ledCommand.setEmptyMk(true);
//                        break;
//                    default:
//                        News.error(methodName + ":任务入出库类型错误!!![工作号:{}] [入出库类型:{}]", wrkMast.getWrkNo(), wrkMast.getIoType());
//                        break;
//                }
//                ledCommand.setSourceLocNo(wrkMast.getSourceLocNo());
//                ledCommand.setLocNo(wrkMast.getLocNo());
//                ledCommand.setStaNo(wrkMast.getStaNo());
////                ledCommand.setSourceStaNo(wrkMast.getSourceStaNo());
//                if (wrkMast.getIoType() != 110 && wrkMast.getIoType() != 10) {
//                    List<WrkDetl> wrkDetls = wrkDetlService.findByWorkNo(wrkMast.getWrkNo());
//                    wrkDetls.forEach(wrkDetl -> ledCommand.getMatDtos().add(new MatDto(wrkDetl.getMatnr(), wrkDetl.getMaktx(), wrkDetl.getAnfme())));
//                }
//                commands.add(ledCommand);
//            }
//            Set<Integer> workNos = wrkMasts.stream().map(WrkMast::getWrkNo).collect(Collectors.toSet());
//            // 获取LED线程
//            LedThread ledThread = (LedThread) SlaveConnection.get(SlaveType.Led, led.getId());
//            // 相同工作号集合则过滤
////            if (CollectionUtils.equals(ledThread.getWorkNos(), workNos)) {
////                continue;
////            }
//            // 命令下发 -------------------------------------------------------------------------------
//            if (!commands.isEmpty()) {
//                String errMsg = "";
//                if (!MessageQueue.offer(SlaveType.Led, led.getId(), new Task(3, commands))) {
//                    News.error(methodName + ":{}号LED命令下发失败!!![ip:{}] [port:{}]", led.getId(), led.getIp(), led.getPort());
//                    continue;
//                } else {
//                    ledThread.setLedMk(false);
//                }
//
//
                    wrkDetls.forEach(wrkDetl -> {
                        Double total = 0.0;
                        EntityWrapper<LocDetl> wrapper = new EntityWrapper<>();
                        LocDetl locDetl = locDetlService.selectOne(wrapper.eq("zpallet", wrkDetl.getZpallet()).eq("matnr", wrkDetl.getMatnr()));
                        if (!Cools.isEmpty(locDetl)) {
                            total = locDetl.getAnfme();
                        }
                        if (wrkMast.getIoType() == 101) {
                            ledCommand.getMatDtos().add(new MatDto(wrkDetl.getMatnr(), wrkDetl.getMaktx(), wrkDetl.getBatch(), wrkDetl.getSpecs(), wrkDetl.getManu(), wrkDetl.getMemo(), wrkDetl.getAnfme(),total));
                        }
                        if (wrkMast.getIoType() == 103 && (null == wrkDetl.getInspect() || 0 == wrkDetl.getInspect())) {
                            ledCommand.getMatDtos().add(new MatDto(wrkDetl.getMatnr(), wrkDetl.getMaktx(), wrkDetl.getBatch(), wrkDetl.getSpecs(), wrkDetl.getManu(), wrkDetl.getMemo(), wrkDetl.getAnfme(),total));
                        }
                        if (wrkMast.getIoType() == 107) {
                            ledCommand.getMatDtos().add(new MatDto(wrkDetl.getMatnr(), wrkDetl.getMaktx(), wrkDetl.getBatch(), wrkDetl.getSpecs(), wrkDetl.getManu(), wrkDetl.getMemo(), wrkDetl.getAnfme(),total));
                        }
                    });
                }
                commands.add(ledCommand);
            }
//
//            try {
//                // 修改主档led标记
//                for (WrkMast wrkMast : wrkMasts) {
//                    wrkMast.setOveMk("Y");
//                    wrkMast.setModiTime(new Date());
//                    if (wrkMastMapper.updateById(wrkMast) == 0) {
//                        throw new CoolException("更新工作档失败");
//                    }
//                }
//
//                // 更新线程当前工作号集合
//                ledThread.setWorkNos(workNos);
//
//            } catch (Exception e) {
//                e.printStackTrace();
//                TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
//            }
            Set<Integer> workNos = wrkMasts.stream().map(WrkMast::getWrkNo).collect(Collectors.toSet());
            // 获取LED线程
            LedThread ledThread = (LedThread) SlaveConnection.get(SlaveType.Led, led.getId());
            // 相同工作号集合则过滤
            if (CollectionUtils.equals(ledThread.getWorkNos(), workNos)) {
                continue;
            }
            // 命令下发 -------------------------------------------------------------------------------
            if (!commands.isEmpty()) {
                if (!MessageQueue.offer(SlaveType.Led, led.getId(), new Task(1, commands))) {
                    News.error("{}号LED命令下发失败!!![ip:{}] [port:{}]", led.getId(), led.getIp(), led.getPort());
                    continue;
                } else {
//                    News.info("{}号LED命令下发成功!!![ip:{}] [port:{}] [port:{}]", led.getId(), led.getIp(), led.getPort(),commands);
                }
            }
            try {
                // 修改主档led标记
                for (WrkMast wrkMast : wrkMasts) {
                    wrkMast.setOveMk("Y");
                    wrkMast.setModiTime(new Date());
                    if (wrkMastMapper.updateById(wrkMast) == 0) {
                        throw new CoolException("更新工作档失败");
                    }
                }
                // 更新线程当前工作号集合
                ledThread.setWorkNos(workNos);
            } catch (Exception e) {
                e.printStackTrace();
                TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
            }
        }
    }
@@ -1892,33 +1943,6 @@
     * 其他  ===>> LED显示器复位,显示默认信息
     */
    public synchronized void ledReset() {
//        for (LedSlave led : slaveProperties.getLed()) {
//            // 获取输送线plc线程
//            DevpThread devpThread = (DevpThread) SlaveConnection.get(SlaveType.Devp, led.getDevpPlcId());
//            // 命令集合
//            boolean reset = true;
//            for (Integer staNo : led.getStaArr()) {
//                // 获取叉车站点
//                StaProtocol staProtocol = devpThread.getStation().get(staNo);
//                if (staProtocol == null) {
//                    continue;
//                } else {
//                    staProtocol = staProtocol.clone();
//                }
//                if (staProtocol.getWorkNo() != 0) {
//                    reset = false;
//                    break;
//                }
//            }
//            // 获取led线程
//            LedThread ledThread = (LedThread) SlaveConnection.get(SlaveType.Led, led.getDevpPlcId());
//            // led显示默认内容
//            if (reset) {
//                if (!MessageQueue.offer(SlaveType.Led, led.getId(), new Task(2, new ArrayList<>()))) {
//                    News.error("{}号LED命令下发失败!!![ip:{}] [port:{}]", led.getId(), led.getIp(), led.getPort());
//                }
//            }
//        }
        for (LedSlave led : slaveProperties.getLed()) {
            // 获取输送线plc线程
            DevpThread devpThread = (DevpThread) SlaveConnection.get(SlaveType.Devp, led.getDevpPlcId());
@@ -1927,34 +1951,35 @@
            for (Integer staNo : led.getStaArr()) {
                // 获取叉车站点
                StaProtocol staProtocol = devpThread.getStation().get(staNo);
                if (staProtocol == null) {
                    continue;
                }
                if (staProtocol.getWorkNo() != 0 && staProtocol.isLoading()) {
                StaProtocol staProtocol1 = devpThread.getStation().get(staNo+1);
                if (staProtocol == null) { continue; }
                if (staProtocol1 == null) { continue; }
                if (staProtocol.getWorkNo() != 0 || staProtocol.isLoading()) {
                    reset = false;
                    break;
                }
                if (staProtocol1.isLoading() || staProtocol1.getWorkNo() != 0) {
                    reset = false;
                    break;
                }
                if (!staProtocol.isLoading() && staProtocol.getWorkNo() == 0 && !staProtocol1.isLoading() && staProtocol1.getWorkNo() == 0){
//                    News.error("{}号LED入库口2个站点都没有数据,准备reset复位显示器!!![ip:{}] [port:{}]", led.getId(), led.getIp(), led.getPort());
                }
            }
//            // 获取led线程
//            LedThread ledThread = (LedThread) SlaveConnection.get(SlaveType.Led, led.getId());
//            // led显示默认内容
//            if (reset && !ledThread.isLedMk()) {
//                if (led.getId() == 7) {
//                    ledThread.setLedMk(true);
//                    if (!MessageQueue.offer(SlaveType.Led, led.getId(), new Task(4, new ArrayList<>()))) {
//                        News.error("{}号LED命令下发失败!!![ip:{}] [port:{}]", led.getId(), led.getIp(), led.getPort());
//                    } else {
//
//                    }
//                } else {
//                    ledThread.setLedMk(true);
//                    if (!MessageQueue.offer(SlaveType.Led, led.getId(), new Task(2, new ArrayList<>()))) {
//                        News.error("{}号LED命令下发失败!!![ip:{}] [port:{}]", led.getId(), led.getIp(), led.getPort());
//                    } else {
//
//                    }
//                }
//            }
            // 获取led线程
//            LedThread ledThread = (LedThread) SlaveConnection.get(SlaveType.Led, led.getDevpPlcId());
            LedThread ledThread = (LedThread) SlaveConnection.get(SlaveType.Led, led.getId());
            // led显示默认内容
            if (reset) {
                //News.info("{}号LED命令重置!!![ip:{}] [port:{}]", led.getId(), led.getIp(), led.getPort());
                if (ledThread == null) {
                    continue;
                }
                ledThread.errorReset();
                if (!MessageQueue.offer(SlaveType.Led, led.getId(), new Task(2, new ArrayList<>()))) {
                    News.error("{}号LED命令下发失败!!![ip:{}] [port:{}]", led.getId(), led.getIp(), led.getPort());
                }
            }
        }
    }
@@ -2413,6 +2438,7 @@
            try {
                String response = new HttpHandler.Builder()
                        .setUri(wmsUrl)
                        .setTimeout(30, TimeUnit.SECONDS)
                        .setPath("/rpc/auto/emptyOut/v1")
                        .build()
                        .doPost();
@@ -2451,6 +2477,7 @@
                String response = new HttpHandler.Builder()
                        .setUri(wmsUrl)
                        .setTimeout(30, TimeUnit.SECONDS)
                        .setPath("/rpc/auto/emptyIn/v1")
                        .setJson(JSON.toJSONString(locTypeDto))
                        .build()