From e356cb699f91ff4359ef0e835fd311436489b9d8 Mon Sep 17 00:00:00 2001 From: luxiaotao1123 <t1341870251@63.com> Date: 星期三, 26 十月 2022 12:51:22 +0800 Subject: [PATCH] # --- src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java | 46 +++++++++++++++++++++++++++++++++------------- 1 files changed, 33 insertions(+), 13 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 ebb486a..c4be203 100644 --- a/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java +++ b/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java @@ -3,6 +3,7 @@ import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.mapper.EntityWrapper; +import com.core.annotations.ManagerAuth; import com.core.common.Cools; import com.core.exception.CoolException; import com.zy.asrs.entity.*; @@ -846,7 +847,7 @@ } - // 鐩爣搴撲綅 ===>> 闈炴渶澶栧眰搴撲綅 + // 鐩爣搴撲綅 ===>> 闈炴渶澶栧眰搴撲綅 } else { // 鍒ゆ柇灏忚溅鏄惁鍦ㄥ綋鍓嶇粍搴撲綅锛屽鏋滄槸鍒欏皢绌挎杞︾Щ鑷虫渶澶栧眰锛岀瓑寰呭爢鍨涙満鏀捐揣锛涘鏋滀笉鏄紝鍒欏爢鍨涙満瀵绘壘绌挎杞︼紝骞舵斁缃綋鍓嶇粍鏈�澶栧眰 Integer steNo = this.hasCarOfIdle(wrkMast.getLocNo()); @@ -898,7 +899,7 @@ } } } - // 娌℃湁灏忚溅 + // 娌℃湁灏忚溅 } else { if (wrkMast.getWrkSts() == 2L && wrkMast.getSteNo() == null) { // 瀵绘壘褰撳墠鍫嗗灈鏈哄搴旂殑灏忚溅 @@ -1257,7 +1258,9 @@ SteThread steThread = (SteThread) SlaveConnection.get(SlaveType.Ste, ste.getId()); SteProtocol steProtocol = steThread.getSteProtocol(); if (steProtocol == null) { continue; } - if (Utils.getGroupRow(locNo).equals(Utils.getGroupRow(steProtocol.getRow().intValue())) && steProtocol.getBay() == Utils.getBay(locNo) && steProtocol.getLev() == Utils.getLev(locNo)) { + if (Utils.getGroupRow(locNo, true).equals(Utils.getGroupRow(steProtocol.getRow().intValue(), true)) + && steProtocol.getBay() == Utils.getBay(locNo) + && steProtocol.getLev() == Utils.getLev(locNo)) { return steProtocol.getSteNo().intValue(); } } @@ -1274,7 +1277,9 @@ SteProtocol steProtocol = steThread.getSteProtocol(); if (steProtocol == null) { continue; } if (steProtocol.isIdle()) { - if (Utils.getGroupRow(locNo).equals(Utils.getGroupRow(steProtocol.getRow().intValue())) && steProtocol.getBay() == Utils.getBay(locNo) && steProtocol.getLev() == Utils.getLev(locNo)) { + if (Utils.getGroupRow(locNo, true).equals(Utils.getGroupRow(steProtocol.getRow().intValue(), true)) + && steProtocol.getBay() == Utils.getBay(locNo) + && steProtocol.getLev() == Utils.getLev(locNo)) { return steProtocol.getSteNo().intValue(); } } @@ -1286,17 +1291,32 @@ * 鏌ユ壘褰撳墠搴撲綅鏈�閫傚悎鐨勭┛姊溅鏉ヤ綔涓� */ public SteThread queryIdleCar(WrkMast wrkMast) { - Integer crnNo = wrkMast.getCrnNo(); - BasSte basSte = basSteService.findByCrnNo(crnNo); - // 鑾峰彇绌挎杞︿俊鎭� - SteThread steThread = (SteThread) SlaveConnection.get(SlaveType.Ste, basSte.getSteNo()); - SteProtocol steProtocol = steThread.getSteProtocol(); - if (steProtocol != null) { - if (steProtocol.isIdle()) { - return steThread; + List<BasSte> basStes = basSteService.selectList(new EntityWrapper<>()); + int val = 0; + SteThread result = null; + for (BasSte basSte : basStes) { + // 鑾峰彇绌挎杞︿俊鎭� + SteThread steThread = (SteThread) SlaveConnection.get(SlaveType.Ste, basSte.getSteNo()); + SteProtocol steProtocol = steThread.getSteProtocol(); + if (steProtocol == null) { continue; } + if (!steProtocol.isIdle()) { continue; } + String locNo = wrkMast.getWrkSts() < 10 ? wrkMast.getLocNo() : wrkMast.getSourceLocNo(); + LocMast locMast = locMastService.selectById(locNo); + int lev = locMast.getLev1(); + int bay = locMast.getBay1(); + int levAbs = Math.abs(lev - steProtocol.getLev()); + int bayAbs = Math.abs(bay - steProtocol.getBay()); + if (val == 0) { + val = levAbs + bayAbs; + result = steThread; + } else { + if ((levAbs + bayAbs) < val) { + val = levAbs + bayAbs; + result = steThread; + } } } - return null; + return result; } /** -- Gitblit v1.9.1