#
zjj
2024-01-17 c0fa9d25de6a617372da05be72d9eb821aa3dbc1
src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
@@ -106,6 +106,57 @@
                }
                String barcode = barcodeThread.getBarcode();
                // 获取入库站信息
                SiemensDevpThread devpThread = (SiemensDevpThread) SlaveConnection.get(SlaveType.Devp, devp.getId());
                StaProtocol staProtocol = devpThread.getStation().get(inSta.getStaNo());
                if (staProtocol == null) {
                    continue;
                } else {
                    staProtocol = staProtocol.clone();
                }
                // 尺寸检测异常
                boolean back = false;
                String errMsg = "异常:";
                if (staProtocol.isFrontErr()) {
                    errMsg = errMsg+"前超限;";
                    back = true;
                }
                if (staProtocol.isBackErr()) {
                    errMsg = errMsg+"后超限";
                    back = true;
                }
                if (staProtocol.isHighErr()) {
                    errMsg = errMsg+"高超限";
                    back = true;
                }
                if (staProtocol.isLeftErr()) {
                    errMsg = errMsg+"左超限";
                    back = true;
                }
                if (staProtocol.isRightErr()) {
                    errMsg = errMsg+"右超限";
                    back = true;
                }
                if (staProtocol.isWeightErr()) {
                    errMsg = errMsg+"超重";
                    back = true;
                }
                if (staProtocol.isBarcodeErr()) {
                    errMsg = errMsg+"扫码失败";
                    back = true;
                }
                // 退回
                if (back) {
                    // led 异常显示
                    LedThread ledThread = (LedThread) SlaveConnection.get(SlaveType.Led, inSta.getLed());
                    if (ledThread != null) {
                        MessageQueue.offer(SlaveType.Led, inSta.getLed(), new Task(3, errMsg));
                    }
                    continue;
                }
                if (!Cools.isEmpty(barcode)) {
                    log.info("{}号条码扫描器检测条码信息:{}", inSta.getBarcode(), barcode);
                    if ("NG".endsWith(barcode) || "NoRead".equals(barcode)) {
@@ -120,16 +171,6 @@
//                    }
                    continue;
                }
                // 获取入库站信息
                SiemensDevpThread devpThread = (SiemensDevpThread) SlaveConnection.get(SlaveType.Devp, devp.getId());
                StaProtocol staProtocol = devpThread.getStation().get(inSta.getStaNo());
                if (staProtocol == null) {
                    continue;
                } else {
                    staProtocol = staProtocol.clone();
                }
                // 判断是否满足入库条件
                if (staProtocol.isAutoing()
                        && staProtocol.isLoading()
@@ -328,7 +369,7 @@
                        && staProtocol.isLoading()
                        && staProtocol.isInEnable()
                        && staProtocol.isPakMk()
                        && staProtocol.getWorkNo() == 9991) {
                        && staProtocol.getWorkNo() == 9999) {
//                    WrkMast wrkMast = wrkMastMapper.selectPickStep(barcode);
                    LedThread ledThread = (LedThread) SlaveConnection.get(SlaveType.Led, pickSta.getLed());
                    if (barcode.equals("") || barcode.equals("99999999")) {
@@ -348,8 +389,9 @@
                        continue;
                    }
                    WrkMast wrkMast = wrkMastMapper.selectPakInStep3(staProtocol.getWorkNo().intValue());
                    ledThread.errorReset();
//                    WrkMast wrkMast = wrkMastMapper.selectPakInStep3(staProtocol.getWorkNo().intValue());
                    WrkMast wrkMast = wrkMastService.selectOne(new EntityWrapper<WrkMast>().eq("barcode", barcode));
                    if (wrkMast == null) {
                        wrkMast = wrkMastMapper.selectPickStep(barcode);
                    }
@@ -433,6 +475,8 @@
                    boolean result = MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol));
                    if (!result) {
                        log.error("发布命令至输送线队列失败!!! [plc编号:{}]", devp.getId());
                    }else {
                        ledThread.errorReset();
                    }
                }
@@ -1252,6 +1296,7 @@
                // 获取空板入库站信息
                SiemensDevpThread devpThread = (SiemensDevpThread) SlaveConnection.get(SlaveType.Devp, devp.getId());
                StaProtocol staProtocol = devpThread.getStation().get(emptyInSta.getStaNo());
                LedThread ledThread = (LedThread) SlaveConnection.get(SlaveType.Led, emptyInSta.getLed());
                if (staProtocol == null) {
                    continue;
                } else {
@@ -1262,6 +1307,13 @@
                if (staProtocol.isAutoing() && staProtocol.isLoading() && staProtocol.isInEnable()
                        && staProtocol.isEmptyMk() && (staProtocol.getWorkNo() >= 9990
                        && staProtocol.getWorkNo() <= 9999) && staProtocol.isPakMk()) {
                    List<WrkMast> wrkMasts = wrkMastService.selectList(new EntityWrapper<WrkMast>()
                            .eq("sta_no", emptyInSta.getStaNo())
                            .eq("io_type", 10)
                            .eq("wrk_sts", 2));
                    if (!Cools.isEmpty(wrkMasts)){
                        continue;
                    }
                    try {
                        LocTypeDto locTypeDto = new LocTypeDto(staProtocol);
@@ -1278,7 +1330,7 @@
                        JSONObject jsonObject = JSON.parseObject(response);
                        if (jsonObject.getInteger("code").equals(200)) {
                            StartupDto dto = jsonObject.getObject("data", StartupDto.class);
                            ledThread.errorReset();
                            // 更新站点信息 且 下发plc命令
                            staProtocol.setWorkNo(dto.getWorkNo().shortValue());
                            staProtocol.setStaNo(dto.getStaNo().shortValue());
@@ -1419,7 +1471,7 @@
                // 获取叉车站点
                StaProtocol staProtocol = devpThread.getStation().get(staNo);
                if (staProtocol == null) { continue; }
                if (staProtocol.getWorkNo() != 0) {
                if (staProtocol.getWorkNo() != 0 || staProtocol.isErr()) {
                    reset = false;
                    break;
                }