From 4cb014bccf1964942cdf8e885f946989d5cb8daa Mon Sep 17 00:00:00 2001 From: Junjie <540245094@qq.com> Date: 星期四, 17 七月 2025 09:54:13 +0800 Subject: [PATCH] # --- src/main/java/com/zy/core/dispatcher/ShuttleDispatchUtils.java | 62 +++++++++++++++++++++++-------- 1 files changed, 46 insertions(+), 16 deletions(-) diff --git a/src/main/java/com/zy/core/dispatcher/ShuttleDispatchUtils.java b/src/main/java/com/zy/core/dispatcher/ShuttleDispatchUtils.java index 5e0d93c..9062069 100644 --- a/src/main/java/com/zy/core/dispatcher/ShuttleDispatchUtils.java +++ b/src/main/java/com/zy/core/dispatcher/ShuttleDispatchUtils.java @@ -5,10 +5,13 @@ import com.core.common.Cools; import com.core.exception.CoolException; import com.zy.asrs.domain.ShuttleGatherResult; +import com.zy.asrs.domain.param.ShuttleDemoParam; import com.zy.asrs.domain.param.ShuttleGatherParam; import com.zy.asrs.entity.BasShuttle; +import com.zy.asrs.entity.DeviceConfig; import com.zy.asrs.entity.WrkMast; import com.zy.asrs.service.BasShuttleService; +import com.zy.asrs.service.DeviceConfigService; import com.zy.asrs.service.WrkMastService; import com.zy.asrs.utils.Utils; import com.zy.common.model.NavigateNode; @@ -24,7 +27,6 @@ import com.zy.core.model.ForkLiftSlave; import com.zy.core.model.ShuttleSlave; import com.zy.core.model.protocol.*; -import com.zy.core.properties.SlaveProperties; import com.zy.core.thread.ForkLiftThread; import com.zy.core.thread.ShuttleThread; import com.zy.system.entity.Config; @@ -42,8 +44,6 @@ public class ShuttleDispatchUtils { @Autowired - private SlaveProperties slaveProperties; - @Autowired private WrkMastService wrkMastService; @Autowired private CommonService commonService; @@ -53,6 +53,8 @@ private ConfigService configService; @Autowired private BasShuttleService basShuttleService; + @Autowired + private DeviceConfigService deviceConfigService; /** * 璋冨害杞﹁締-璋冨害鎸囧畾绌挎杞� @@ -68,15 +70,17 @@ ArrayList<ShuttleThread> sameLev = new ArrayList<>();//鐩稿悓妤煎眰鐨勭┛姊溅 ArrayList<ShuttleThread> diffLev = new ArrayList<>();//涓嶅悓妤煎眰鐨勭┛姊溅 - for (ShuttleSlave shuttle : slaveProperties.getShuttle()) { + List<DeviceConfig> shuttleList = deviceConfigService.selectList(new EntityWrapper<DeviceConfig>() + .eq("device_type", String.valueOf(SlaveType.Shuttle))); + for (DeviceConfig device : shuttleList) { //鑾峰彇鍥涘悜绌挎杞︾嚎绋� - ShuttleThread shuttleThread = (ShuttleThread) SlaveConnection.get(SlaveType.Shuttle, shuttle.getId()); + ShuttleThread shuttleThread = (ShuttleThread) SlaveConnection.get(SlaveType.Shuttle, device.getDeviceNo()); ShuttleProtocol shuttleProtocol = shuttleThread.getStatus(); if (shuttleProtocol == null || shuttleProtocol.getShuttleNo() == null) { continue; } - if (checkChargeWrk(shuttle.getId())) { + if (checkChargeWrk(device.getDeviceNo())) { continue;//瀛樺湪鍏呯數浠诲姟锛岃繃婊ゅ皬杞� } @@ -84,7 +88,7 @@ continue;//灏忚溅蹇欑涓� } - BasShuttle basShuttle = basShuttleService.selectOne(new EntityWrapper<BasShuttle>().eq("shuttle_no", shuttle.getId())); + BasShuttle basShuttle = basShuttleService.selectOne(new EntityWrapper<BasShuttle>().eq("shuttle_no", device.getDeviceNo())); if (basShuttle != null) { if (basShuttle.getStatus() == 0) { continue;//灏忚溅琚鐢� @@ -330,6 +334,25 @@ } /** + * 灏忚溅婕旂ず + */ + public void shuttleDemo(ShuttleDemoParam param) { + List<DeviceConfig> shuttleList = deviceConfigService.selectList(new EntityWrapper<DeviceConfig>() + .eq("device_type", String.valueOf(SlaveType.Shuttle)) + .in("device_no", param.getShuttleNos()) + ); + + for (DeviceConfig device : shuttleList) { + ShuttleThread shuttleThread = (ShuttleThread) SlaveConnection.get(SlaveType.Shuttle, device.getDeviceNo()); + if (shuttleThread == null) { + continue; + } + + shuttleThread.enableDemo(param.getStatus() == 1); + } + } + + /** * 妫�娴嬬洰鏍囨ゼ灞傝溅鏁伴噺鏄惁灏忎簬鍏佽鐨勬渶澶ф暟閲� * true: 灏忎簬鏈�澶ф暟閲� false: 澶т簬鎴栫瓑浜庢渶澶ф暟閲� */ @@ -341,10 +364,12 @@ return false; } + List<DeviceConfig> shuttleList = deviceConfigService.selectList(new EntityWrapper<DeviceConfig>() + .eq("device_type", String.valueOf(SlaveType.Shuttle))); int levCount = 0;//鐩爣妤煎眰杞﹁締鏁伴噺 - for (ShuttleSlave shuttle : slaveProperties.getShuttle()) { + for (DeviceConfig device : shuttleList) { //鑾峰彇鍥涘悜绌挎杞︾嚎绋� - ShuttleThread shuttleThread = (ShuttleThread) SlaveConnection.get(SlaveType.Shuttle, shuttle.getId()); + ShuttleThread shuttleThread = (ShuttleThread) SlaveConnection.get(SlaveType.Shuttle, device.getDeviceNo()); ShuttleProtocol shuttleProtocol = shuttleThread.getStatus(); if (shuttleProtocol == null || shuttleProtocol.getShuttleNo() == null) { continue; @@ -410,11 +435,14 @@ return null; } + List<DeviceConfig> forkliftList = deviceConfigService.selectList(new EntityWrapper<DeviceConfig>() + .eq("device_type", String.valueOf(SlaveType.ForkLift))); + //鑾峰彇灏忚溅鍚屼竴妤煎眰鐨勭珯鐐� ArrayList<ForkLiftStaProtocol> list = new ArrayList<>(); int lev = Utils.getLev(shuttleProtocol.getCurrentLocNo());//灏忚溅妤煎眰 - for (ForkLiftSlave slave : slaveProperties.getForkLift()) { - ForkLiftThread forkLiftThread = (ForkLiftThread) SlaveConnection.get(SlaveType.ForkLift, slave.getId()); + for (DeviceConfig device : forkliftList) { + ForkLiftThread forkLiftThread = (ForkLiftThread) SlaveConnection.get(SlaveType.ForkLift, device.getDeviceNo()); if (forkLiftThread == null) { continue; } @@ -426,7 +454,7 @@ continue; } - ForkLiftStaProtocol forkLiftStaProtocol = ForkLiftUtils.getLiftStaByLev(slave.getId(), lev); + ForkLiftStaProtocol forkLiftStaProtocol = ForkLiftUtils.getLiftStaByLev(device.getDeviceNo(), lev); if (forkLiftStaProtocol == null) { continue; } @@ -441,7 +469,7 @@ } //鍒ゆ柇鐩爣妤煎眰绔欑偣鏄惁鏃犳墭鐩� - ForkLiftStaProtocol targetLiftStaProtocol = ForkLiftUtils.getLiftStaByLev(slave.getId(), targetLev); + ForkLiftStaProtocol targetLiftStaProtocol = ForkLiftUtils.getLiftStaByLev(device.getDeviceNo(), targetLev); if (targetLiftStaProtocol == null) { continue; } @@ -501,10 +529,12 @@ * 鑾峰彇妤煎眰鍙敤灏忚溅鏁伴噺 */ public int getShuttleCountByLev(int lev) { + List<DeviceConfig> shuttleList = deviceConfigService.selectList(new EntityWrapper<DeviceConfig>() + .eq("device_type", String.valueOf(SlaveType.Shuttle))); int count = 0; - for (ShuttleSlave slave : slaveProperties.getShuttle()) { + for (DeviceConfig device : shuttleList) { //鑾峰彇鍥涘悜绌挎杞︾嚎绋� - ShuttleThread shuttleThread = (ShuttleThread) SlaveConnection.get(SlaveType.Shuttle, slave.getId()); + ShuttleThread shuttleThread = (ShuttleThread) SlaveConnection.get(SlaveType.Shuttle, device.getDeviceNo()); if (shuttleThread == null) { continue; } @@ -514,7 +544,7 @@ continue; } - if (checkChargeWrk(slave.getId())) { + if (checkChargeWrk(device.getDeviceNo())) { continue;//瀛樺湪鍏呯數浠诲姟锛岃繃婊ゅ皬杞� } -- Gitblit v1.9.1