#
Junjie
2 天以前 05b57adb20382ff1ceb99cea676fe3dce7908514
#
4个文件已修改
103 ■■■■ 已修改文件
src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java 71 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/core/MainProcess.java 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/core/thread/LiftThread.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/core/thread/impl/NyLiftThread.java 27 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
@@ -1945,4 +1945,75 @@
        return true;
    }
    //自动切换出入库模式
    public void autoSwitchLiftIOMode() {
        List<DeviceConfig> liftList = deviceConfigService.selectList(new EntityWrapper<DeviceConfig>()
                .eq("device_type", String.valueOf(SlaveType.Lift)));
        for (DeviceConfig device : liftList) {
            Integer liftNo = device.getDeviceNo();
            LiftThread liftThread = (LiftThread) SlaveConnection.get(SlaveType.Lift, liftNo);
            if (liftThread == null) {
                continue;
            }
            LiftProtocol liftProtocol = liftThread.getStatus();
            if (liftProtocol == null) {
                continue;
            }
            List<Integer> liftAllStaNo = LiftUtils.getLiftAllStaNo(liftNo);
            if (liftAllStaNo.isEmpty()) {
                continue;
            }
            List<Integer> conveyorBindLiftAllStaNo = LiftUtils.getConveyorBindLiftAllStaNo(liftNo);
            if (conveyorBindLiftAllStaNo.isEmpty()) {
                continue;
            }
            //获取入库任务
            List<WrkMast> inWrkMasts = wrkMastService.selectList(new EntityWrapper<WrkMast>()
                    .in("sta_no", liftAllStaNo)
                    .in("wrk_sts"
                            , WrkStsType.NEW_INBOUND.sts
                            , WrkStsType.INBOUND_DEVICE_RUN.sts
                            , WrkStsType.INBOUND_LIFT_RUN.sts
                            , WrkStsType.INBOUND_LIFT_RUN_COMPLETE.sts
                            , WrkStsType.INBOUND_SHUTTLE_RUN.sts
                            , WrkStsType.INBOUND_SHUTTLE_RUN_COMPLETE.sts
                    ));
            //获取出库任务
            List<WrkMast> outWrkMasts = wrkMastService.selectList(new EntityWrapper<WrkMast>()
                    .in("sta_no", conveyorBindLiftAllStaNo)
                    .in("wrk_sts"
                            , WrkStsType.NEW_OUTBOUND.sts
                            , WrkStsType.OUTBOUND_SHUTTLE_RUN.sts
                            , WrkStsType.OUTBOUND_SHUTTLE_RUN_COMPLETE.sts
                            , WrkStsType.OUTBOUND_LIFT_RUN.sts
                            , WrkStsType.OUTBOUND_LIFT_RUN_COMPLETE.sts
                    ));
            if (liftProtocol.getIOModeType().equals(LiftIoModeType.NONE)) {
                //未知模式
                if (!inWrkMasts.isEmpty()) {
                    liftThread.switchIOMode(LiftIoModeType.IN);
                } else if (!outWrkMasts.isEmpty()) {
                    liftThread.switchIOMode(LiftIoModeType.OUT);
                }else {
                    liftThread.switchIOMode(LiftIoModeType.IN);
                }
            } else if (liftProtocol.getIOModeType().equals(LiftIoModeType.IN)) {
                //入库模式
                if (inWrkMasts.isEmpty() && !outWrkMasts.isEmpty()) {
                    liftThread.switchIOMode(LiftIoModeType.OUT);
                }
            } else if (liftProtocol.getIOModeType().equals(LiftIoModeType.OUT)) {
                //出库模式
                if (outWrkMasts.isEmpty() && !inWrkMasts.isEmpty()) {
                    liftThread.switchIOMode(LiftIoModeType.IN);
                }
            }
        }
    }
}
src/main/java/com/zy/core/MainProcess.java
@@ -78,6 +78,9 @@
                    mainService.loopShuttleCharge();
                    mainService.executeShuttleCharge();
                    //自动切换出入库模式
                    mainService.autoSwitchLiftIOMode();
                    // 间隔
                    Thread.sleep(200);
                } catch (Exception e) {
src/main/java/com/zy/core/thread/LiftThread.java
@@ -24,7 +24,7 @@
    CommandResponse move(LiftCommand command);//小车移动
    CommandResponse switchIOMode(LiftCommand command);//切换出入库模式
    CommandResponse switchIOMode(LiftIoModeType type);//切换出入库模式
    CommandResponse reset();//复位
src/main/java/com/zy/core/thread/impl/NyLiftThread.java
@@ -353,29 +353,10 @@
    }
    @Override
    public CommandResponse switchIOMode(LiftCommand command) {
        CommandResponse response = new CommandResponse(false);
        try {
            //发出请求
            String resultKey = requestCommand(command);
            //查询请求结果
            JSONObject result = queryCommandStatus(resultKey);
            if (result == null) {
                return response;//请求失败
            }
            if(!result.getString("result").equals("success")) {
                return response;//请求失败
            }
            this.liftProtocol.setSendTime(System.currentTimeMillis());//指令下发时间
            response.setMessage(JSON.toJSONString(result));
            response.setResult(true);
            return response;
        } catch (Exception e) {
            e.printStackTrace();
            response.setMessage(e.getMessage());
            return response;
        }
    public CommandResponse switchIOMode(LiftIoModeType type) {
        CommandResponse response = new CommandResponse(true);
        liftProtocol.setIOModeType(type);
        return response;
    }
    @Override