自动化立体仓库 - WCS系统
Junjie
2023-11-30 f8c14df2d6ceb57d1e8a389b62d6996d90a073fd
src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
@@ -205,12 +205,12 @@
//                        devpThread.setPakMk(staProtocol.getSiteId(), false);
//                        MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol));
                        // led 异常显示
                        LedThread ledThread = (LedThread) SlaveConnection.get(SlaveType.Led, inSta.getLed());
                        if (ledThread != null) {
                            String errorMsg = "扫码失败,请重试";
                            MessageQueue.offer(SlaveType.Led, inSta.getLed(), new Task(3, errorMsg));
                        }
//                        // led 异常显示
//                        LedThread ledThread = (LedThread) SlaveConnection.get(SlaveType.Led, inSta.getLed());
//                        if (ledThread != null) {
//                            String errorMsg = "扫码失败,请重试";
//                            MessageQueue.offer(SlaveType.Led, inSta.getLed(), new Task(3, errorMsg));
//                        }
                        continue;
                    }
@@ -272,6 +272,7 @@
                                String errorMsg = jsonObject.getString("msg");
                                if (!Cools.isEmpty(errorMsg)) {
                                    MessageQueue.offer(SlaveType.Led, inSta.getLed(), new Task(3, errorMsg));
                                    ledThread.setLedMk(false);
                                }
                            }
                            News.error("请求接口失败!!!url:{};request:{};response:{}", wmsUrl + "/rpc/pakin/loc/v1", JSON.toJSONString(param), response);
@@ -285,6 +286,7 @@
                            if (ledThread != null) {
                                String errorMsg = barcode + "托盘识别异常,请先进行组托!";
                                MessageQueue.offer(SlaveType.Led, inSta.getLed(), new Task(3, errorMsg));
                                ledThread.setLedMk(false);
                            }
                        }
                    } catch (Exception e) {
@@ -414,68 +416,46 @@
                }
                if (staProtocol.isAutoing()
                        && staProtocol.isLoading()
//                        && (staProtocol.getWorkNo() > 0 && staProtocol.getWorkNo() < 9999)
//                        && staProtocol.getStaNo().equals(staProtocol.getSiteId().shortValue())
                        && staProtocol.isInEnable()
                        && (staProtocol.getWorkNo() > 0)
                        && staProtocol.isPakMk()){
                    // 获取条码扫描仪信息
                    BarcodeThread barcodeThread = (BarcodeThread) SlaveConnection.get(SlaveType.Barcode, pickSta.getBarcode());
                    if (barcodeThread == null) {
                    WrkMast wrkMast = wrkMastMapper.selectByWorkNo(staProtocol.getWorkNo().intValue());
                    if (wrkMast == null) {//找不到工作档
                        continue;
                    }
                    String barcode = barcodeThread.getBarcode();
                    WrkMast wrkMast = null;
                    wrkMast = wrkMastMapper.selectPickStepByBarcode(barcode);
                    if (wrkMast == null) {
                        continue;
                    }
//                    if (staProtocol.getWorkNo() == 9996) {
//                        String barcode = barcodeThread.getBarcode();
//                        if(!Cools.isEmpty(barcode)) {
//                            News.info("{}号条码扫描器检测条码信息:{}", pickSta.getBarcode(), barcode);
//                            if("NG".endsWith(barcode) || "NoRead".equals(barcode) || "empty".equals(barcode)) {
//                                staProtocol.setWorkNo((short) 32002);
//                                staProtocol.setStaNo(pickSta.getBackSta().shortValue());
//                                devpThread.setPakMk(staProtocol.getSiteId(), false);
//                                MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol));
//
//                                // led 异常显示
//                                LedThread ledThread = (LedThread) SlaveConnection.get(SlaveType.Led, pickSta.getLed());
//                                if (ledThread != null) {
//                                    String errorMsg = "扫码失败,请重试";
//                                    MessageQueue.offer(SlaveType.Led, pickSta.getLed(), new Task(3, errorMsg));
//                                }
//                                continue;
//                            }
//                        } else {
//                            staProtocol.setWorkNo((short) 32002);
//                            staProtocol.setStaNo(pickSta.getBackSta().shortValue());
//                            devpThread.setPakMk(staProtocol.getSiteId(), false);
//                            MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol));
//
//                            // led 异常显示
//                            LedThread ledThread = (LedThread) SlaveConnection.get(SlaveType.Led, pickSta.getLed());
//                            if (ledThread != null) {
//                                String errorMsg = "扫码失败,请重试";
//                                MessageQueue.offer(SlaveType.Led, pickSta.getLed(), new Task(3, errorMsg));
//                            }
//                            continue;
//                        }
//                        wrkMast = wrkMastMapper.selectPickStepByBarcode(barcode);
//                        if (null == wrkMast) {
//                            News.error("{}条码错误,暂无拣料任务!", barcode);
//                        }
//                    }
                    if ((wrkMast.getIoType() != 103 && wrkMast.getIoType() != 104 && wrkMast.getIoType() != 107)
                        || Cools.isEmpty(wrkMast.getStaNo()) || Cools.isEmpty(wrkMast.getSourceStaNo()) ) {
                            || Cools.isEmpty(wrkMast.getStaNo()) || Cools.isEmpty(wrkMast.getSourceStaNo()) ) {
                        continue;
                    }
                    //*********************同库位组校验*********************
                    boolean flag = false;
                    String th = "";
                    List<String> innerLoc = Utils.getGroupInnerLoc(wrkMast.getSourceLocNo());
                    for (String loc : innerLoc) {
                        LocMast locMast = locMastService.selectById(loc);
                        if (locMast == null) {
                            continue;
                        }
                        if (!locMast.getLocSts().equals("F")) {
                            flag = true;
                            th = loc + "库位存在未回库任务";
                            break;
                        }
                    }
                    if (flag) {
                        News.info(th);
                        continue;
                    }
                    //*********************同库位组校验*********************
                    // 保存工作主档历史档
                    if (wrkMastMapper.saveWrkMastLog(wrkMast.getWrkNo()) == 0) {
                        throw new CoolException(wrkMast.getWrkNo() + "保存工作主档历史档失败");
                        News.info(wrkMast.getWrkNo() + "保存工作主档历史档失败");
                        continue;
                    }
                    String sourceLocNo = wrkMast.getSourceLocNo().trim();
@@ -487,7 +467,7 @@
                    // 更新工作档数据状态
                    wrkMast.setIoType(wrkMast.getIoType() - 50); // 入出库类型: 103->53,104->54,107->57
                    wrkMast.setWrkSts(2L); // 工作状态: 2.设备上走
                    wrkMast.setSourceStaNo(pickSta.getStaNo()); // 源站
                    wrkMast.setSourceStaNo(pickSta.getBackSta()); // 源站
//                            wrkMast.setStaNo(dto.getStaNo()); // 目标站
//                            wrkMast.setCrnNo(dto.getCrnNo());
                    wrkMast.setStaNo(liftStaProtocol.getStaNo());//目标站
@@ -496,10 +476,12 @@
                    wrkMast.setLiftNo(null);// 提升机清空
                    wrkMast.setModiTime(new Date());
                    if (wrkMastMapper.updateById(wrkMast) == 0) {
                        throw new CoolException(wrkMast.getWrkNo() + "更新工作档数据状态失败");
                        News.info(wrkMast.getWrkNo() + "更新工作档数据状态失败");
                        continue;
                    }
                    if (wrkMastMapper.setSteEmpty(wrkMast.getWrkNo()) == 0) {
                        throw new CoolException(wrkMast.getWrkNo() + "更新工作档数据状态失败");
                        News.info(wrkMast.getWrkNo() + "更新工作档数据状态失败");
                        continue;
                    }
                    // 修改库位状态 Q.拣料/盘点/并板再入库
@@ -507,127 +489,252 @@
                    locMast.setLocSts("Q");
                    locMast.setModiTime(new Date());
                    if (!locMastService.updateById(locMast)) {
                        throw new CoolException("修改库位状态失败");
                        News.info("修改库位状态失败");
                        continue;
                    }
                    barcodeThread.setBarcode("");//清理条码
//                    try {
//                        // 访问 WMS 获取入库库位
//                        LocTypeDto locTypeDto = new LocTypeDto(staProtocol);
//                        SearchLocParam param = new SearchLocParam();
//                        param.setWrkNo(wrkMast.getWrkNo());
//                        param.setIoType(wrkMast.getIoType());
//                        param.setSourceStaNo(pickSta.getStaNo());
////                        param.setLocType1(locTypeDto.getLocType1());
//                        String response = new HttpHandler.Builder()
//                                .setUri(wmsUrl)
//                                .setPath("/rpc/pakin/loc/v1")
//                                .setJson(JSON.toJSONString(param))
//                                .build()
//                                .doPost();
//                        JSONObject jsonObject = JSON.parseObject(response);
//                        LedThread ledThread = (LedThread) SlaveConnection.get(SlaveType.Led, pickSta.getLed());
//                        Integer code = jsonObject.getInteger("code");
//                        if (code.equals(200)) {
//                            StartupDto dto = jsonObject.getObject("data", StartupDto.class);
//
////                            // 获取目标站
////                            Wrapper<StaDesc> wrapper = new EntityWrapper<StaDesc>()
////                                    .eq("type_no", wrkMast.getIoType() - 50)
////                                    .eq("stn_no", pickSta.getStaNo()) // 作业站点 = 拣料出库的目标站
////                                    .eq("crn_no", dto.getCrnNo()); // 堆垛机号
////                            StaDesc staDesc = staDescService.selectOne(wrapper);
////                            if (Cools.isEmpty(staDesc)) {
////                                News.error("入库路径不存在!type_no={},stn_no={},crn_no={}", wrkMast.getIoType(), pickSta.getStaNo(), wrkMast.getCrnNo());
////                                continue;
////                            }
////                            // 堆垛机站点(目标站)
////                            Integer staNo = staDesc.getCrnStn();
//
//                            // 保存工作明细档历史档
////                        if (wrkMastMapper.saveWrkDetlLog(wrkMast.getWrkNo()) == 0) {
////                            throw new CoolException("保存工作明细档历史档失败");
////                        }
//                            // 保存工作主档历史档
//                            if (wrkMastMapper.saveWrkMastLog(wrkMast.getWrkNo()) == 0) {
//                                throw new CoolException(wrkMast.getWrkNo() + "保存工作主档历史档失败");
//                            }
//
//                            String sourceLocNo = wrkMast.getSourceLocNo().trim();
//                            LiftStaProtocol liftStaProtocol = NyLiftUtils.getLiftStaByLev(pickSta.getLiftNo(), Utils.getLev(sourceLocNo));//获取回库提升机目标站
//                            if (liftStaProtocol == null) {
//                                continue;
//                            }
//
//                            // 更新工作档数据状态
//                            wrkMast.setIoType(wrkMast.getIoType() - 50); // 入出库类型: 103->53,104->54,107->57
//                            wrkMast.setWrkSts(2L); // 工作状态: 2.设备上走
//                            wrkMast.setSourceStaNo(pickSta.getStaNo()); // 源站
////                            wrkMast.setStaNo(dto.getStaNo()); // 目标站
////                            wrkMast.setCrnNo(dto.getCrnNo());
//                            wrkMast.setStaNo(liftStaProtocol.getStaNo());//目标站
//                            wrkMast.setLocNo(sourceLocNo); // 目标库位 = 出库时的源库位
//                            wrkMast.setShuttleNo(null); // 穿梭车清空
//                            wrkMast.setLiftNo(null);// 提升机清空
//                            wrkMast.setModiTime(new Date());
//                            if (wrkMastMapper.updateById(wrkMast) == 0) {
//                                throw new CoolException(wrkMast.getWrkNo() + "更新工作档数据状态失败");
//                            }
//                            if (wrkMastMapper.setSteEmpty(wrkMast.getWrkNo()) == 0) {
//                                throw new CoolException(wrkMast.getWrkNo() + "更新工作档数据状态失败");
//                            }
//
//                            // 修改库位状态 Q.拣料/盘点/并板再入库
//                            LocMast locMast = locMastService.selectById(sourceLocNo);
//                            locMast.setLocSts("Q");
//                            locMast.setModiTime(new Date());
//                            if (!locMastService.updateById(locMast)) {
//                                throw new CoolException("修改库位状态失败");
//                            }
//
////                            // 更新站点信息 且 下发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("发布命令至输送线队列失败!!! [plc编号:{}]", devp.getId());
////                            }
//
//                            barcodeThread.setBarcode("");//清理条码
//
//                        } else if (code == 500){
//                            if (ledThread != null) {
//                                String errorMsg = jsonObject.getString("msg");
//                                if (!Cools.isEmpty(errorMsg)) {
//                                    MessageQueue.offer(SlaveType.Led, pickSta.getLed(), new Task(3, errorMsg));
//                                }
//                            }
//                            News.error("请求接口失败!!!url:{};request:{};response:{}", wmsUrl + "/rpc/pakin/loc/v1", JSON.toJSONString(param), response);
//                        } else {
////                            staProtocol.setWorkNo((short) 32002);
////                            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 = jsonObject.getString("msg");
////                                String errorMsg = barcode + "托盘识别异常,请先进行组托!";
//                                MessageQueue.offer(SlaveType.Led, pickSta.getLed(), new Task(3, errorMsg));
//                            }
//                        }
//
//                    } catch (Exception e) {
//                        e.printStackTrace();
//                        TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
//                    }
                    staProtocol.setWorkNo(wrkMast.getWrkNo().shortValue());//写入工作号
                    staProtocol.setStaNo(pickSta.getBackSta().shortValue());//写入目标站
                    MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol));
                }
            }
        }
    }
//    /**
//     * 拣料、并板、盘点再入库
//     */
//    @Transactional
//    public synchronized void stnToCrnStnPick(){
//        for (DevpSlave devp : slaveProperties.getDevp()) {
//            // 遍历拣料入库口
//            for (DevpSlave.Sta pickSta : devp.getPickInSta()) {
//
//                // 获取拣料入库站信息
//                DevpThread devpThread = (DevpThread) SlaveConnection.get(SlaveType.Devp, devp.getId());
//                StaProtocol staProtocol = devpThread.getStation().get(pickSta.getStaNo());
//                if (staProtocol == null) {
//                    continue;
//                } else {
//                    staProtocol = staProtocol.clone();
//                }
//                if (staProtocol.isAutoing()
//                        && staProtocol.isLoading()
////                        && (staProtocol.getWorkNo() > 0 && staProtocol.getWorkNo() < 9999)
////                        && staProtocol.getStaNo().equals(staProtocol.getSiteId().shortValue())
//                        && staProtocol.isPakMk()){
//
//                    // 获取条码扫描仪信息
//                    BarcodeThread barcodeThread = (BarcodeThread) SlaveConnection.get(SlaveType.Barcode, pickSta.getBarcode());
//                    if (barcodeThread == null) {
//                        continue;
//                    }
//                    String barcode = barcodeThread.getBarcode();
//
//                    WrkMast wrkMast = null;
//                    wrkMast = wrkMastMapper.selectPickStepByBarcode(barcode);
//                    if (wrkMast == null) {
//                        continue;
//                    }
////                    if (staProtocol.getWorkNo() == 9996) {
////                        String barcode = barcodeThread.getBarcode();
////                        if(!Cools.isEmpty(barcode)) {
////                            News.info("{}号条码扫描器检测条码信息:{}", pickSta.getBarcode(), barcode);
////                            if("NG".endsWith(barcode) || "NoRead".equals(barcode) || "empty".equals(barcode)) {
////                                staProtocol.setWorkNo((short) 32002);
////                                staProtocol.setStaNo(pickSta.getBackSta().shortValue());
////                                devpThread.setPakMk(staProtocol.getSiteId(), false);
////                                MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol));
////
////                                // led 异常显示
////                                LedThread ledThread = (LedThread) SlaveConnection.get(SlaveType.Led, pickSta.getLed());
////                                if (ledThread != null) {
////                                    String errorMsg = "扫码失败,请重试";
////                                    MessageQueue.offer(SlaveType.Led, pickSta.getLed(), new Task(3, errorMsg));
////                                }
////                                continue;
////                            }
////                        } else {
////                            staProtocol.setWorkNo((short) 32002);
////                            staProtocol.setStaNo(pickSta.getBackSta().shortValue());
////                            devpThread.setPakMk(staProtocol.getSiteId(), false);
////                            MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol));
////
////                            // led 异常显示
////                            LedThread ledThread = (LedThread) SlaveConnection.get(SlaveType.Led, pickSta.getLed());
////                            if (ledThread != null) {
////                                String errorMsg = "扫码失败,请重试";
////                                MessageQueue.offer(SlaveType.Led, pickSta.getLed(), new Task(3, errorMsg));
////                            }
////                            continue;
////                        }
////                        wrkMast = wrkMastMapper.selectPickStepByBarcode(barcode);
////                        if (null == wrkMast) {
////                            News.error("{}条码错误,暂无拣料任务!", barcode);
////                        }
////                    }
//
//                    if ((wrkMast.getIoType() != 103 && wrkMast.getIoType() != 104 && wrkMast.getIoType() != 107)
//                        || Cools.isEmpty(wrkMast.getStaNo()) || Cools.isEmpty(wrkMast.getSourceStaNo()) ) {
//                        continue;
//                    }
//
//                    // 保存工作主档历史档
//                    if (wrkMastMapper.saveWrkMastLog(wrkMast.getWrkNo()) == 0) {
//                        throw new CoolException(wrkMast.getWrkNo() + "保存工作主档历史档失败");
//                    }
//
//                    String sourceLocNo = wrkMast.getSourceLocNo().trim();
//                    LiftStaProtocol liftStaProtocol = NyLiftUtils.getLiftStaByLev(pickSta.getLiftNo(), Utils.getLev(sourceLocNo));//获取回库提升机目标站
//                    if (liftStaProtocol == null) {
//                        continue;
//                    }
//
//                    // 更新工作档数据状态
//                    wrkMast.setIoType(wrkMast.getIoType() - 50); // 入出库类型: 103->53,104->54,107->57
//                    wrkMast.setWrkSts(2L); // 工作状态: 2.设备上走
//                    wrkMast.setSourceStaNo(pickSta.getStaNo()); // 源站
////                            wrkMast.setStaNo(dto.getStaNo()); // 目标站
////                            wrkMast.setCrnNo(dto.getCrnNo());
//                    wrkMast.setStaNo(liftStaProtocol.getStaNo());//目标站
//                    wrkMast.setLocNo(sourceLocNo); // 目标库位 = 出库时的源库位
//                    wrkMast.setShuttleNo(null); // 穿梭车清空
//                    wrkMast.setLiftNo(null);// 提升机清空
//                    wrkMast.setModiTime(new Date());
//                    if (wrkMastMapper.updateById(wrkMast) == 0) {
//                        throw new CoolException(wrkMast.getWrkNo() + "更新工作档数据状态失败");
//                    }
//                    if (wrkMastMapper.setSteEmpty(wrkMast.getWrkNo()) == 0) {
//                        throw new CoolException(wrkMast.getWrkNo() + "更新工作档数据状态失败");
//                    }
//
//                    // 修改库位状态 Q.拣料/盘点/并板再入库
//                    LocMast locMast = locMastService.selectById(sourceLocNo);
//                    locMast.setLocSts("Q");
//                    locMast.setModiTime(new Date());
//                    if (!locMastService.updateById(locMast)) {
//                        throw new CoolException("修改库位状态失败");
//                    }
//                    barcodeThread.setBarcode("");//清理条码
//
////                    try {
////                        // 访问 WMS 获取入库库位
////                        LocTypeDto locTypeDto = new LocTypeDto(staProtocol);
////                        SearchLocParam param = new SearchLocParam();
////                        param.setWrkNo(wrkMast.getWrkNo());
////                        param.setIoType(wrkMast.getIoType());
////                        param.setSourceStaNo(pickSta.getStaNo());
//////                        param.setLocType1(locTypeDto.getLocType1());
////                        String response = new HttpHandler.Builder()
////                                .setUri(wmsUrl)
////                                .setPath("/rpc/pakin/loc/v1")
////                                .setJson(JSON.toJSONString(param))
////                                .build()
////                                .doPost();
////                        JSONObject jsonObject = JSON.parseObject(response);
////                        LedThread ledThread = (LedThread) SlaveConnection.get(SlaveType.Led, pickSta.getLed());
////                        Integer code = jsonObject.getInteger("code");
////                        if (code.equals(200)) {
////                            StartupDto dto = jsonObject.getObject("data", StartupDto.class);
////
//////                            // 获取目标站
//////                            Wrapper<StaDesc> wrapper = new EntityWrapper<StaDesc>()
//////                                    .eq("type_no", wrkMast.getIoType() - 50)
//////                                    .eq("stn_no", pickSta.getStaNo()) // 作业站点 = 拣料出库的目标站
//////                                    .eq("crn_no", dto.getCrnNo()); // 堆垛机号
//////                            StaDesc staDesc = staDescService.selectOne(wrapper);
//////                            if (Cools.isEmpty(staDesc)) {
//////                                News.error("入库路径不存在!type_no={},stn_no={},crn_no={}", wrkMast.getIoType(), pickSta.getStaNo(), wrkMast.getCrnNo());
//////                                continue;
//////                            }
//////                            // 堆垛机站点(目标站)
//////                            Integer staNo = staDesc.getCrnStn();
////
////                            // 保存工作明细档历史档
//////                        if (wrkMastMapper.saveWrkDetlLog(wrkMast.getWrkNo()) == 0) {
//////                            throw new CoolException("保存工作明细档历史档失败");
//////                        }
////                            // 保存工作主档历史档
////                            if (wrkMastMapper.saveWrkMastLog(wrkMast.getWrkNo()) == 0) {
////                                throw new CoolException(wrkMast.getWrkNo() + "保存工作主档历史档失败");
////                            }
////
////                            String sourceLocNo = wrkMast.getSourceLocNo().trim();
////                            LiftStaProtocol liftStaProtocol = NyLiftUtils.getLiftStaByLev(pickSta.getLiftNo(), Utils.getLev(sourceLocNo));//获取回库提升机目标站
////                            if (liftStaProtocol == null) {
////                                continue;
////                            }
////
////                            // 更新工作档数据状态
////                            wrkMast.setIoType(wrkMast.getIoType() - 50); // 入出库类型: 103->53,104->54,107->57
////                            wrkMast.setWrkSts(2L); // 工作状态: 2.设备上走
////                            wrkMast.setSourceStaNo(pickSta.getStaNo()); // 源站
//////                            wrkMast.setStaNo(dto.getStaNo()); // 目标站
//////                            wrkMast.setCrnNo(dto.getCrnNo());
////                            wrkMast.setStaNo(liftStaProtocol.getStaNo());//目标站
////                            wrkMast.setLocNo(sourceLocNo); // 目标库位 = 出库时的源库位
////                            wrkMast.setShuttleNo(null); // 穿梭车清空
////                            wrkMast.setLiftNo(null);// 提升机清空
////                            wrkMast.setModiTime(new Date());
////                            if (wrkMastMapper.updateById(wrkMast) == 0) {
////                                throw new CoolException(wrkMast.getWrkNo() + "更新工作档数据状态失败");
////                            }
////                            if (wrkMastMapper.setSteEmpty(wrkMast.getWrkNo()) == 0) {
////                                throw new CoolException(wrkMast.getWrkNo() + "更新工作档数据状态失败");
////                            }
////
////                            // 修改库位状态 Q.拣料/盘点/并板再入库
////                            LocMast locMast = locMastService.selectById(sourceLocNo);
////                            locMast.setLocSts("Q");
////                            locMast.setModiTime(new Date());
////                            if (!locMastService.updateById(locMast)) {
////                                throw new CoolException("修改库位状态失败");
////                            }
////
//////                            // 更新站点信息 且 下发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("发布命令至输送线队列失败!!! [plc编号:{}]", devp.getId());
//////                            }
////
////                            barcodeThread.setBarcode("");//清理条码
////
////                        } else if (code == 500){
////                            if (ledThread != null) {
////                                String errorMsg = jsonObject.getString("msg");
////                                if (!Cools.isEmpty(errorMsg)) {
////                                    MessageQueue.offer(SlaveType.Led, pickSta.getLed(), new Task(3, errorMsg));
////                                }
////                            }
////                            News.error("请求接口失败!!!url:{};request:{};response:{}", wmsUrl + "/rpc/pakin/loc/v1", JSON.toJSONString(param), response);
////                        } else {
//////                            staProtocol.setWorkNo((short) 32002);
//////                            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 = jsonObject.getString("msg");
//////                                String errorMsg = barcode + "托盘识别异常,请先进行组托!";
////                                MessageQueue.offer(SlaveType.Led, pickSta.getLed(), new Task(3, errorMsg));
////                            }
////                        }
////
////                    } catch (Exception e) {
////                        e.printStackTrace();
////                        TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
////                    }
//
//                }
//            }
//
//        }
//    }
    /**
     * 初始化实时地图
@@ -1178,6 +1285,28 @@
            if (!sourceBasDevp.getInEnable().equals("Y")) {
                News.info("{}任务,{}源站,没有可入信号", wrkMast.getWrkNo(), sourceBasDevp.getDevNo());
                return false;//站点不可入
            }
            Integer barcodeId = Utils.getBarcodeIdByStaNo(wrkMast.getSourceStaNo());
            if (barcodeId == null) {
                News.info("{}任务,{}源站,找不到可用条码器ID", wrkMast.getWrkNo(), sourceBasDevp.getDevNo());
                return false;//站点不可入
            }
            BarcodeThread barcodeThread = (BarcodeThread) SlaveConnection.get(SlaveType.Barcode, barcodeId);
            if (barcodeThread == null) {
                News.info("{}任务,{}源站,条码器{}线程为空", wrkMast.getWrkNo(), sourceBasDevp.getDevNo(), barcodeId);
                return false;//站点不可入
            }
            String barcode = barcodeThread.getBarcode();
            if(!Cools.isEmpty(barcode)) {
                if(!("NG".endsWith(barcode) || "NoRead".equals(barcode) || "empty".equals(barcode))) {
                    //存在条码值,判断是否和当前工作档一致
                    if (!barcode.equals(wrkMast.getBarcode())) {
                        News.info("{}任务,条码器{}值{}与工作档条码值不一致,系统跳过执行", wrkMast.getWrkNo(), sourceBasDevp.getDevNo(), barcodeId, barcode);
                        return false;//站点不可入
                    }
                }
            }
            //判断提升机整个三楼是否都处于入库模式
@@ -2769,6 +2898,10 @@
                    continue;
                }
                if (shuttleProtocol.getVoltage() < 5630) {
                    continue;//电压不够继续充电
                }
                //小车满电,结束充电任务
                NyShuttleHttpCommand chargeCommand = NyHttpUtils.getChargeCommand(shuttle.getId(), wrkCharge.getWrkNo(), false);
                ArrayList<NyShuttleHttpCommand> commands = new ArrayList<>();