From 3c45d4f9f3aba5bc85a9577e43c0dffc71b93a22 Mon Sep 17 00:00:00 2001 From: Junjie <fallin.jie@qq.com> Date: 星期四, 10 七月 2025 15:54:27 +0800 Subject: [PATCH] # --- src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java | 153 ++++++++++++++++++++++++++------------------------- 1 files changed, 78 insertions(+), 75 deletions(-) diff --git a/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java b/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java index 6811d6d..67ccf13 100644 --- a/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java +++ b/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java @@ -762,9 +762,9 @@ } //鑾峰彇鎻愬崌鏈哄懡浠� - List<ForkLiftCommand> liftCommands = forkLiftThread.getPickAndPutCommand(wrkMast.getWrkNo(), wrkMast.getSourceStaNo(), liftSta.getLev()); + ForkLiftCommand liftCommand = forkLiftThread.getPickAndPutCommand(wrkMast.getWrkNo(), wrkMast.getSourceStaNo(), liftSta.getLev()); ArrayList<ForkLiftCommand> commands = new ArrayList<>(); - commands.addAll(liftCommands); + commands.add(liftCommand); //鎻愪氦鍒扮嚎绋嬪幓宸ヤ綔 LiftAssignCommand assignCommand = new LiftAssignCommand(); @@ -890,9 +890,9 @@ } //鑾峰彇鎻愬崌鏈哄懡浠� - List<ForkLiftCommand> liftCommands = forkLiftThread.getPickAndPutCommand(wrkMast.getWrkNo(), liftSta.getLev(), wrkMast.getStaNo()); + ForkLiftCommand liftCommand = forkLiftThread.getPickAndPutCommand(wrkMast.getWrkNo(), liftSta.getLev(), wrkMast.getStaNo()); ArrayList<ForkLiftCommand> commands = new ArrayList<>(); - commands.addAll(liftCommands); + commands.add(liftCommand); //鎻愪氦鍒扮嚎绋嬪幓宸ヤ綔 LiftAssignCommand assignCommand = new LiftAssignCommand(); @@ -924,6 +924,9 @@ for (DeviceConfig device : forkliftList) { //鑾峰彇鎻愬崌鏈轰俊鎭� ForkLiftThread forkLiftThread = (ForkLiftThread) SlaveConnection.get(SlaveType.ForkLift, device.getDeviceNo()); + if(forkLiftThread == null) { + continue; + } ForkLiftProtocol forkLiftProtocol = forkLiftThread.getStatus(); if (forkLiftProtocol == null) { continue; @@ -1775,9 +1778,9 @@ } //鑾峰彇鎻愬崌鏈哄懡浠� - List<ForkLiftCommand> liftCommands = forkLiftThread.getShuttleSwitchCommand(wrkMast.getWrkNo(), sourceLiftSta.getLev(), liftSta.getLev()); + ForkLiftCommand liftCommand = forkLiftThread.getShuttleSwitchCommand(wrkMast.getWrkNo(), sourceLiftSta.getLev(), liftSta.getLev()); ArrayList<ForkLiftCommand> commands = new ArrayList<>(); - commands.addAll(liftCommands); + commands.add(liftCommand); //鎻愪氦鍒扮嚎绋嬪幓宸ヤ綔 LiftAssignCommand assignCommand = new LiftAssignCommand(); @@ -1919,73 +1922,73 @@ //鑷姩鍒囨崲鍑哄叆搴撴ā寮� public void autoSwitchForkLiftIOMode() { - List<DeviceConfig> forkliftList = deviceConfigService.selectList(new EntityWrapper<DeviceConfig>() - .eq("device_type", String.valueOf(SlaveType.ForkLift))); - for (DeviceConfig device : forkliftList) { - Integer liftNo = device.getDeviceNo(); - ForkLiftThread forkLiftThread = (ForkLiftThread) SlaveConnection.get(SlaveType.ForkLift, liftNo); - if (forkLiftThread == null) { - continue; - } - ForkLiftProtocol forkLiftProtocol = forkLiftThread.getStatus(); - if (forkLiftProtocol == null) { - continue; - } - - List<Integer> liftAllStaNo = ForkLiftUtils.getLiftAllStaNo(liftNo); - if (liftAllStaNo.isEmpty()) { - continue; - } - - List<Integer> conveyorBindLiftAllStaNo = ForkLiftUtils.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 (forkLiftProtocol.getIOModeType().equals(ForkLiftIoModeType.NONE)) { - //鏈煡妯″紡 - if (!inWrkMasts.isEmpty()) { - forkLiftThread.switchIOMode(ForkLiftIoModeType.IN); - } else if (!outWrkMasts.isEmpty()) { - forkLiftThread.switchIOMode(ForkLiftIoModeType.OUT); - }else { - forkLiftThread.switchIOMode(ForkLiftIoModeType.IN); - } - } else if (forkLiftProtocol.getIOModeType().equals(ForkLiftIoModeType.IN)) { - //鍏ュ簱妯″紡 - if (inWrkMasts.isEmpty() && !outWrkMasts.isEmpty()) { - forkLiftThread.switchIOMode(ForkLiftIoModeType.OUT); - } - } else if (forkLiftProtocol.getIOModeType().equals(ForkLiftIoModeType.OUT)) { - //鍑哄簱妯″紡 - if (outWrkMasts.isEmpty() && !inWrkMasts.isEmpty()) { - forkLiftThread.switchIOMode(ForkLiftIoModeType.IN); - } - } - } +// List<DeviceConfig> forkliftList = deviceConfigService.selectList(new EntityWrapper<DeviceConfig>() +// .eq("device_type", String.valueOf(SlaveType.ForkLift))); +// for (DeviceConfig device : forkliftList) { +// Integer liftNo = device.getDeviceNo(); +// ForkLiftThread forkLiftThread = (ForkLiftThread) SlaveConnection.get(SlaveType.ForkLift, liftNo); +// if (forkLiftThread == null) { +// continue; +// } +// ForkLiftProtocol forkLiftProtocol = forkLiftThread.getStatus(); +// if (forkLiftProtocol == null) { +// continue; +// } +// +// List<Integer> liftAllStaNo = ForkLiftUtils.getLiftAllStaNo(liftNo); +// if (liftAllStaNo.isEmpty()) { +// continue; +// } +// +// List<Integer> conveyorBindLiftAllStaNo = ForkLiftUtils.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 (forkLiftProtocol.getIOModeType().equals(ForkLiftIoModeType.NONE)) { +// //鏈煡妯″紡 +// if (!inWrkMasts.isEmpty()) { +// forkLiftThread.switchIOMode(ForkLiftIoModeType.IN); +// } else if (!outWrkMasts.isEmpty()) { +// forkLiftThread.switchIOMode(ForkLiftIoModeType.OUT); +// }else { +// forkLiftThread.switchIOMode(ForkLiftIoModeType.IN); +// } +// } else if (forkLiftProtocol.getIOModeType().equals(ForkLiftIoModeType.IN)) { +// //鍏ュ簱妯″紡 +// if (inWrkMasts.isEmpty() && !outWrkMasts.isEmpty()) { +// forkLiftThread.switchIOMode(ForkLiftIoModeType.OUT); +// } +// } else if (forkLiftProtocol.getIOModeType().equals(ForkLiftIoModeType.OUT)) { +// //鍑哄簱妯″紡 +// if (outWrkMasts.isEmpty() && !inWrkMasts.isEmpty()) { +// forkLiftThread.switchIOMode(ForkLiftIoModeType.IN); +// } +// } +// } } //鍑哄簱浠诲姟棰勮皟搴︽彁鍗囨満 @@ -2056,9 +2059,9 @@ int workNo = commonService.getWorkNo(WrkIoType.FORKLIFT_MOVE.id);//鑾峰彇浠诲姟鍙� //鑾峰彇鎻愬崌鏈哄懡浠� - List<ForkLiftCommand> liftCommand = forkLiftThread.getMoveCommand(workNo, forkLiftProtocol.getLev(), Utils.getLev(wrkMast.getSourceLocNo())); + ForkLiftCommand liftCommand = forkLiftThread.getMoveCommand(workNo, forkLiftProtocol.getLev(), Utils.getLev(wrkMast.getSourceLocNo())); ArrayList<ForkLiftCommand> commands = new ArrayList<>(); - commands.addAll(liftCommand); + commands.add(liftCommand); //鎻愪氦鍒扮嚎绋嬪幓宸ヤ綔 LiftAssignCommand assignCommand = new LiftAssignCommand(); -- Gitblit v1.9.1