From ed66b0b468efc3f1f51c68712d82e234c7bba2bf Mon Sep 17 00:00:00 2001 From: ytfl <ytfl@qq.com> Date: 星期五, 18 七月 2025 08:29:20 +0800 Subject: [PATCH] # --- src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java | 85 ++++++++++++++++++++++++++++++++++++++++-- 1 files changed, 80 insertions(+), 5 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 f2c011c..efa0e33 100644 --- a/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java +++ b/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java @@ -462,6 +462,7 @@ wrkMast.setLocNo(wrkMast.getSourceLocNo()); // 鐩爣搴撲綅 = 鍑哄簱鏃剁殑婧愬簱浣� wrkMast.setSourceLocNo(""); // 婧愬簱浣嶆竻绌� wrkMast.setModiTime(now); + wrkMast.setUpdMk("");//鍏佽鍐嶆绉诲簱 if (wrkMastMapper.updateById(wrkMast) == 0) { throw new CoolException("鏇存柊宸ヤ綔妗f暟鎹姸鎬佸け璐�"); } @@ -675,6 +676,78 @@ List<WrkMast> wrkMasts = wrkMastService.selectList(new EntityWrapper<WrkMast>() .eq("crn_no", crn.getId()) + .eq("wrk_sts", 2) + ); + if (!wrkMasts.isEmpty()) { + continue; + } + + CrnSlave.CrnStn crnStn = crn.getCrnInStn().get(0); + + News.info("鍫嗗灈鏈烘棤浠诲姟鑷姩鍥炲叆搴撳彛寰呮満==>>" + crnProtocol.getCrnNo() + "鍙峰爢鍨涙満"); + // 鍛戒护涓嬪彂鍖� -------------------------------------------------------------------------- + CrnCommand crnCommand = new CrnCommand(); + crnCommand.setCrnNo(crnProtocol.getCrnNo()); // 鍫嗗灈鏈虹紪鍙� + crnCommand.setTaskNo((short) 9999); // 宸ヤ綔鍙� + crnCommand.setAckFinish((short) 0); // 浠诲姟瀹屾垚纭浣� + crnCommand.setTaskMode(CrnTaskModeType.CRN_MOVE); // 浠诲姟妯″紡: 鍫嗗灈鏈虹Щ鍔� + crnCommand.setSourcePosX(crnStn.getRow().shortValue()); // 婧愬簱浣嶆帓 + crnCommand.setSourcePosY((short) 1); // 婧愬簱浣嶅垪 + crnCommand.setSourcePosZ((short) 1); // 婧愬簱浣嶅眰 + crnCommand.setDestinationPosX((short) 0); // 鐩爣搴撲綅鎺� + crnCommand.setDestinationPosY((short) 0); // 鐩爣搴撲綅鍒� + crnCommand.setDestinationPosZ((short) 0); // 鐩爣搴撲綅灞� + if (!MessageQueue.offer(SlaveType.Crn, crnProtocol.getCrnNo(), new Task(2, crnCommand))) { + News.error("鍫嗗灈鏈虹Щ鍔ㄥ懡浠や笅鍙戝け璐ワ紝鍫嗗灈鏈哄彿={}锛屼换鍔℃暟鎹�={}", crnProtocol.getCrnNo(), JSON.toJSON(crnCommand)); + } + crnThread.setBackHpFlag(true); + redisUtil.set(RedisConstantType.CRN_MOVE_LOCK + crn.getId(), "lock", 60); + try { + Thread.sleep(500); + } catch (Exception e) { + e.printStackTrace(); + } + } + } + } + + /** + * 鍫嗗灈鏈烘湁鍏ュ簱浠诲姟鏃讹紝鍥炲叆搴撳彛寰呮満 + */ + public synchronized void crnMoveByInTask() { + for (CrnSlave crn : slaveProperties.getCrn()) { + if (crn.getId() == 1) { + continue; + } + + // 鑾峰彇鍫嗗灈鏈轰俊鎭� + CrnThread crnThread = (CrnThread) SlaveConnection.get(SlaveType.Crn, crn.getId()); + CrnProtocol crnProtocol = crnThread.getCrnProtocol(); + if (crnProtocol == null) { + continue; + } + BasCrnp basCrnp = basCrnpService.selectById(crn.getId()); + if (basCrnp == null) { + log.error("{}鍙峰爢鍨涙満灏氭湭鍦ㄦ暟鎹簱杩涜缁存姢锛�", crn.getId()); + continue; + } + + if (crnProtocol.getStatusType() == CrnStatusType.IDLE && crnProtocol.getTaskNo() == 0 && crnProtocol.getModeType() == CrnModeType.AUTO) { + if (crnProtocol.getBay() == 1 && crnProtocol.getLevel() == 1) { + continue; + } + + if (System.currentTimeMillis() - crnProtocol.getLastCommandTime() < 1000 * 60) { + continue; + } + + Object object = redisUtil.get(RedisConstantType.CRN_MOVE_LOCK); + if (object != null) { + continue; + } + + List<WrkMast> wrkMasts = wrkMastService.selectList(new EntityWrapper<WrkMast>() + .eq("crn_no", crn.getId()) .notIn("wrk_sts", 5, 14, 15) ); if (!wrkMasts.isEmpty()) { @@ -795,12 +868,14 @@ if (null == waitWrkMast) { News.error(""+mark+" - 1"+" - 10"+" - {}搴撲綅寮傚父锛屾湭妫�绱㈠埌鐩稿簲宸ヤ綔妗o紒", shallowLocNo); } else { - waitWrkMast.setIoPri(15D); - waitWrkMast.setModiTime(new Date()); - if (wrkMastMapper.updateById(waitWrkMast) == 0) { - News.error(""+mark+" - 1"+" - 11"+" - 璋冩暣宸ヤ綔妗d紭鍏堢骇澶辫触锛佸伐浣滃彿={}", waitWrkMast.getWrkNo()); + if (waitWrkMast.getWrkSts() != 14 && waitWrkMast.getIoType() > 100) { + waitWrkMast.setIoPri(15D); + waitWrkMast.setModiTime(new Date()); + if (wrkMastMapper.updateById(waitWrkMast) == 0) { + News.error(""+mark+" - 1"+" - 11"+" - 璋冩暣宸ヤ綔妗d紭鍏堢骇澶辫触锛佸伐浣滃彿={}", waitWrkMast.getWrkNo()); + } + continue; } - continue; } } else if (shallowLoc.getLocSts().equals("F") || shallowLoc.getLocSts().equals("D")) { -- Gitblit v1.9.1