From 20d89f3b98d287f1d1fce06357317462903ac04c Mon Sep 17 00:00:00 2001 From: Junjie <xjj@123> Date: 星期四, 25 九月 2025 16:40:33 +0800 Subject: [PATCH] # --- src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java | 83 ++++++++++++++++++++++++++++++++++++----- 1 files changed, 72 insertions(+), 11 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 94dfa94..dda1f5e 100644 --- a/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java +++ b/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java @@ -617,18 +617,13 @@ //1.鐢熸垚鍏ュ簱浠诲姟 ==> 3.鎻愬崌鏈烘惉杩愪腑 if (wrkMast.getWrkSts() == WrkStsType.NEW_INBOUND.sts) { //鑾峰彇鐩爣杈撻�佺珯 - ForkLiftStaProtocol liftSta = ForkLiftUtils.getLiftStaByStaNo(wrkMast.getStaNo()); + LiftStaProtocol liftSta = LiftUtils.getLiftStaByStaNo(wrkMast.getStaNo()); if (liftSta == null) { return false;//鎵句笉鍒扮珯鐐� } if (liftSta.getHasTray()) { News.taskInfo(wrkMast.getWrkNo(), "{}浠诲姟锛岀洰鏍囩珯瀛樺湪鎵樼洏", wrkMast.getWrkNo()); - return false; - } - - if (liftSta.getHasCar()) { - News.taskInfo(wrkMast.getWrkNo(), "{}浠诲姟锛岀洰鏍囩珯瀛樺湪灏忚溅", wrkMast.getWrkNo()); return false; } @@ -771,11 +766,6 @@ wrkMastService.updateById(wrkMast); return false; } - return false; - } - - if (liftSta.getHasCar()) { - News.taskInfo(wrkMast.getWrkNo(), "{}浠诲姟锛寋}绔欑偣瀛樺湪灏忚溅锛岀姝㈡淳鍙�", wrkMast.getWrkNo(), liftSta.getSiteId()); return false; } @@ -1955,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); + } + } + } + } + } -- Gitblit v1.9.1