#
luxiaotao1123
2022-03-14 a87d3006efd604c576a39bfaff2d21379143ada5
src/main/java/com/zy/core/thread/SteThread.java
@@ -219,7 +219,7 @@
            return false;
        }
        command.setSteNo(slave.getId());
        OperateResult result;
        OperateResult result = null;
        // 开始任务
        if (!command.getWaiting()) {
            OperateResult result0 = siemensS7Net.Write("D0", command.getTaskNo());
@@ -236,7 +236,9 @@
//        array[9] = command.getCommand();
            OperateResult result1 = siemensS7Net.Write("D0", array);
            // 确认开始任务
            if (result0.IsSuccess) {
            result = siemensS7Net.Write("D0", true);
            }
        // 任务完成
        } else {
            result = siemensS7Net.Write("D0", true);
@@ -265,9 +267,14 @@
//            bean.insert(basSteOpt);
        } catch (Exception ignore) {}
        if (result.IsSuccess) {
        if (result != null && result.IsSuccess) {
            // 维护数据库排列层
//            this.modifyPos();
            if (!steProtocol.getWaiting()) {
                this.lastRow = command.getRow().intValue();
                this.lastBay = command.getBay().intValue();
                this.lastLev = command.getLev().intValue();
            }
            log.info("穿梭车命令下发[id:{}] >>>>> {}", slave.getId(), JSON.toJSON(command));
            OutputQueue.CRN.offer(MessageFormat.format("【{0}】[id:{1}] >>>>> 命令下发: {2}", DateUtils.convert(new Date()), slave.getId(), JSON.toJSON(command)));
@@ -292,12 +299,21 @@
                    BasSteService service = SpringUtils.getBean(BasSteService.class);
                    BasSte basSte = service.selectById(slave.getId());
                    if (basSte != null) {
                        // 更新plc数据块
                        short[] arr = new short[] {this.lastRow.shortValue(), this.lastBay.shortValue(), this.lastLev.shortValue()};
                        OperateResult result = siemensS7Net.Write("D0", arr);
                        if (result.IsSuccess) {
                            // 更新数据库
                        if (service.updatePos(this.lastRow, this.lastBay, this.lastLev) > 0) {
                                this.lastRow = null;
                                this.lastBay = null;
                                this.lastLev = null;
                            return true;
                        } else {
                            log.error("{}号穿梭车修改数据库定位失败!!!", slave.getId());
                        }
                    }
                    }
                }
            }