From 9de40a82d1ebc4fc50e758449da4619a12c455bb Mon Sep 17 00:00:00 2001 From: luxiaotao1123 <t1341870251@163.com> Date: 星期四, 08 九月 2022 12:48:50 +0800 Subject: [PATCH] # --- src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java | 82 ++++++++++++++++++++++++++++------------- 1 files changed, 56 insertions(+), 26 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 4f4aedc..9c430f5 100644 --- a/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java +++ b/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java @@ -220,20 +220,6 @@ for (DevpSlave devp : slaveProperties.getDevp()) { // 閬嶅巻鎷f枡鍏ュ簱鍙� for (DevpSlave.Sta pickSta : devp.getPickSta()) { - // 鑾峰彇鏉$爜鎵弿浠俊鎭� - BarcodeThread barcodeThread = (BarcodeThread) SlaveConnection.get(SlaveType.Barcode, pickSta.getBarcode()); - if (barcodeThread == null) { - continue; - } - String barcode = barcodeThread.getBarcode(); - if(!Cools.isEmpty(barcode)) { - log.info("{}鍙锋潯鐮佹壂鎻忓櫒妫�娴嬫潯鐮佷俊鎭細{}", pickSta.getBarcode(), barcode); - if("NG".endsWith(barcode) || "NoRead".equals(barcode)) { - continue; - } - } else { - continue; - } // 鑾峰彇鎷f枡鍏ュ簱绔欎俊鎭� DevpThread devpThread = (DevpThread) SlaveConnection.get(SlaveType.Devp, devp.getId()); @@ -244,6 +230,22 @@ staProtocol = staProtocol.clone(); } if (staProtocol.isAutoing() && staProtocol.isLoading() && staProtocol.isInEnable() && staProtocol.isPakMk()){ + + // 鑾峰彇鏉$爜鎵弿浠俊鎭� + BarcodeThread barcodeThread = (BarcodeThread) SlaveConnection.get(SlaveType.Barcode, pickSta.getBarcode()); + if (barcodeThread == null) { + continue; + } + String barcode = barcodeThread.getBarcode(); + if(!Cools.isEmpty(barcode)) { + log.info("{}鍙锋潯鐮佹壂鎻忓櫒妫�娴嬫潯鐮佷俊鎭細{}", pickSta.getBarcode(), barcode); + if("NG".endsWith(barcode) || "NoRead".equals(barcode)) { + continue; + } + } else { + continue; + } + WrkMast wrkMast = wrkMastMapper.selectPickStep(barcode); if (wrkMast == null) { // 鏃犳嫞鏂欐暟鎹� @@ -545,7 +547,7 @@ SteThread steThread = (SteThread) SlaveConnection.get(SlaveType.Ste, steNo); SteProtocol steProtocol = steThread.getSteProtocol(); if (steProtocol == null) { continue; } - if (steProtocol.getStatusType().equals(SteStatusType.IDLE)) { + if (steProtocol.isIdle()) { // 宸茬粡瀛樺湪鍚婅溅鎵ц浠诲姟鏃讹紝鍒欒繃婊� if (wrkMastMapper.selectWorking(slave.getId()) != null) { @@ -688,13 +690,17 @@ SteThread steThread = (SteThread) SlaveConnection.get(SlaveType.Ste, steNo); SteProtocol steProtocol = steThread.getSteProtocol(); if (steProtocol == null) { continue; } - if (steProtocol.getStatusType().equals(SteStatusType.IDLE)) { + if (steProtocol.isIdle()) { // 鍛戒护涓嬪彂鍖� -------------------------------------------------------------------------- SteCommand steCommand = new SteCommand(); steCommand.setSteNo(steNo); // 绌挎杞︾紪鍙� steCommand.setTaskNo(wrkMast.getWrkNo()); // 宸ヤ綔鍙� steCommand.setTaskMode(SteTaskModeType.TO_B); // 浠诲姟妯″紡: 鍘昏繎鐐� 绛夊緟鍫嗗灈鏈哄弶鍙� + + SteABType ab = Utils.selectAB(steProtocol.getRow().intValue()); + + // todo:luxiaotao if (!MessageQueue.offer(SlaveType.Ste, steNo, new Task(2, steCommand))) { log.error("绌挎杞﹀懡浠や笅鍙戝け璐ワ紝绌挎杞﹀彿={}锛屼换鍔℃暟鎹�={}", steNo, JSON.toJSON(steCommand)); @@ -775,7 +781,7 @@ SteThread steThread = (SteThread) SlaveConnection.get(SlaveType.Ste, ste.getId()); SteProtocol steProtocol = steThread.getSteProtocol(); if (steProtocol == null) { continue; } - if (steProtocol.getStatusType().equals(SteStatusType.IDLE)) { + if (steProtocol.isIdle()) { if (Utils.getGroupRow(locNo).equals(Utils.getGroupRow(steProtocol.getRow().intValue())) && steProtocol.getBay() == Utils.getBay(locNo) && steProtocol.getLev() == Utils.getLev(locNo)) { return steProtocol.getSteNo().intValue(); } @@ -794,7 +800,7 @@ SteThread steThread = (SteThread) SlaveConnection.get(SlaveType.Ste, basSte.getSteNo()); SteProtocol steProtocol = steThread.getSteProtocol(); if (steProtocol != null) { - if (steProtocol.getStatusType().equals(SteStatusType.IDLE)) { + if (steProtocol.isIdle()) { return steThread; } } @@ -810,13 +816,18 @@ SteThread steThread = (SteThread) SlaveConnection.get(SlaveType.Ste, steNo); SteProtocol steProtocol = steThread.getSteProtocol(); if (steProtocol == null) { return; } - if (steProtocol.getStatusType().equals(SteStatusType.IDLE)) { + if (steProtocol.isIdle()) { // 鍛戒护涓嬪彂鍖� -------------------------------------------------------------------------- SteCommand steCommand = new SteCommand(); steCommand.setSteNo(steNo); // 绌挎杞︾紪鍙� steCommand.setTaskNo(wrkMast.getWrkNo()); // 宸ヤ綔鍙� steCommand.setTaskMode(SteTaskModeType.TO_B); // 浠诲姟妯″紡: 鍘昏繎鐐� 绛夊緟鍫嗗灈鏈哄弶鍙� + + steCommand.setRow(Utils.getGroupRow(steProtocol.getRow().intValue()).shortValue()); + steCommand.setBay(steProtocol.getBay()); + steCommand.setLev(steProtocol.getLev()); + if (!MessageQueue.offer(SlaveType.Ste, steNo, new Task(2, steCommand))) { log.error("绌挎杞﹀懡浠や笅鍙戝け璐ワ紝绌挎杞﹀彿={}锛屼换鍔℃暟鎹�={}", steNo, JSON.toJSON(steCommand)); } else { @@ -838,7 +849,7 @@ SteThread steThread = (SteThread) SlaveConnection.get(SlaveType.Ste, steNo); SteProtocol steProtocol = steThread.getSteProtocol(); if (steProtocol == null) { return; } - if (steProtocol.getStatusType().equals(SteStatusType.IDLE)) { + if (steProtocol.isIdle()) { // 鍫嗗灈鏈虹┖闂� if (crnProtocol.getStatusType().equals(CrnStatusType.IDLE) || crnProtocol.getTaskNo() == 0) { LocMast locMast; @@ -860,6 +871,8 @@ if (!MessageQueue.offer(SlaveType.Crn, wrkMast.getCrnNo(), new Task(2, crnCommand))) { log.error("鍫嗗灈鏈哄懡浠や笅鍙戝け璐ワ紝鍫嗗灈鏈哄彿={}锛屼换鍔℃暟鎹�={}", wrkMast.getCrnNo(), JSON.toJSON(crnCommand)); } else { + // 淇敼绌挎杞﹁繍琛屼腑鎺掑垪灞� + steThread.modifyPos(Utils.getGroupRow(locMast.getLocNo()), locMast.getBay1(), locMast.getLev1()); // 淇敼宸ヤ綔妗g姸鎬� 3.灏忚溅寰呮惉 => 4.杩佸叆灏忚溅 Date now = new Date(); wrkMast.setWrkSts(4L); @@ -887,6 +900,8 @@ if (!MessageQueue.offer(SlaveType.Crn, wrkMast.getCrnNo(), new Task(2, crnCommand))) { log.error("鍫嗗灈鏈哄懡浠や笅鍙戝け璐ワ紝鍫嗗灈鏈哄彿={}锛屼换鍔℃暟鎹�={}", wrkMast.getCrnNo(), JSON.toJSON(crnCommand)); } else { + // 淇敼绌挎杞﹁繍琛屼腑鎺掑垪灞� + steThread.modifyPos(Utils.getGroupRow(locMast.getLocNo()), locMast.getBay1(), locMast.getLev1()); // 淇敼宸ヤ綔妗g姸鎬� 12.灏忚溅寰呮惉 => 13.杩佸叆灏忚溅 Date now = new Date(); wrkMast.setWrkSts(13L); @@ -911,7 +926,7 @@ SteProtocol steProtocol = steThread.getSteProtocol(); if (steProtocol == null) { return; } // 绌挎杞︾┖闂� - if (steProtocol.getStatusType().equals(SteStatusType.IDLE)) { + if (steProtocol.isIdle()) { // 鍫嗗灈鏈虹┖闂� if (crnProtocol.getStatusType().equals(CrnStatusType.IDLE) || crnProtocol.getTaskNo() == 0) { @@ -937,7 +952,8 @@ if (!MessageQueue.offer(SlaveType.Crn, wrkMast.getCrnNo(), new Task(2, crnCommand))) { log.error("鍫嗗灈鏈哄懡浠や笅鍙戝け璐ワ紝鍫嗗灈鏈哄彿={}锛屼换鍔℃暟鎹�={}", wrkMast.getCrnNo(), JSON.toJSON(crnCommand)); } else { - + // 淇敼绌挎杞﹁繍琛屼腑鎺掑垪灞� + steThread.modifyPos(Utils.getGroupRow(idleLocNo), Utils.getBay(idleLocNo), Utils.getLev(idleLocNo)); // 淇敼宸ヤ綔妗g姸鎬� 3.灏忚溅寰呮惉 => 5.杩佸嚭灏忚溅 Date now = new Date(); wrkMast.setWrkSts(5L); @@ -993,7 +1009,7 @@ SteThread steThread = (SteThread) SlaveConnection.get(SlaveType.Ste, steNo); SteProtocol steProtocol = steThread.getSteProtocol(); if (steProtocol == null) { continue; } - if (steProtocol.getStatusType().equals(SteStatusType.IDLE)) { + if (steProtocol.isIdle()) { // 鍛戒护涓嬪彂鍖� -------------------------------------------------------------------------- SteCommand steCommand = new SteCommand(); steCommand.setSteNo(steNo); // 绌挎杞︾紪鍙� @@ -1028,6 +1044,11 @@ if (wrkMastMapper.updateById(wrkMast) > 0) { // 鍫嗗灈鏈哄浣� crnThread.setResetFlag(true); + // 绌挎杞﹂噸鏂板畾浣嶆帓鍒楀眰 + SteThread steThread = (SteThread) SlaveConnection.get(SlaveType.Ste, wrkMast.getSteNo()); + if (!steThread.confirmPos()) { + log.error("{}鍙风┛姊溅閲嶆柊瀹氫綅澶辫触锛佷綔涓氬伐浣滄。浠诲姟鍙凤細{}", wrkMast.getSteNo(), wrkMast.getWrkNo()); + } } else { log.error("淇敼宸ヤ綔妗g姸鎬� 4.杩佸叆灏忚溅 => 6.灏忚溅寰呭叆 澶辫触锛侊紒锛屽伐浣滃彿={}", wrkMast.getWrkNo()); } @@ -1042,6 +1063,11 @@ if (wrkMastMapper.updateById(wrkMast) > 0) { // 鍫嗗灈鏈哄浣� crnThread.setResetFlag(true); + // 绌挎杞﹂噸鏂板畾浣嶆帓鍒楀眰 + SteThread steThread = (SteThread) SlaveConnection.get(SlaveType.Ste, wrkMast.getSteNo()); + if (!steThread.confirmPos()) { + log.error("{}鍙风┛姊溅閲嶆柊瀹氫綅澶辫触锛佷綔涓氬伐浣滄。浠诲姟鍙凤細{}", wrkMast.getSteNo(), wrkMast.getWrkNo()); + } } else { log.error("淇敼宸ヤ綔妗g姸鎬� 5.杩佸嚭灏忚溅 => 6.灏忚溅寰呭叆 澶辫触锛侊紒锛屽伐浣滃彿={}", wrkMast.getWrkNo()); } @@ -1052,7 +1078,11 @@ SteThread steThread = (SteThread) SlaveConnection.get(SlaveType.Ste, steNo); SteProtocol steProtocol = steThread.getSteProtocol(); if (steProtocol == null) { continue; } - if (steProtocol.getStatusType().equals(SteStatusType.IDLE)) { + if (steProtocol.isIdle()) { + // 绌挎杞﹂噸鏂板畾浣嶆帓鍒楀眰 + if (!steThread.confirmPos()) { + log.error("{}鍙风┛姊溅閲嶆柊瀹氫綅澶辫触锛佷綔涓氬伐浣滄。浠诲姟鍙凤細{}", wrkMast.getSteNo(), wrkMast.getWrkNo()); + } // 鍛戒护涓嬪彂鍖� -------------------------------------------------------------------------- SteCommand steCommand = new SteCommand(); steCommand.setSteNo(steNo); // 绌挎杞︾紪鍙� @@ -1091,7 +1121,7 @@ SteThread steThread = (SteThread) SlaveConnection.get(SlaveType.Ste, ste.getId()); SteProtocol steProtocol = steThread.getSteProtocol(); if (steProtocol == null) { continue; } - if (steProtocol.getStatusType().equals(SteStatusType.WAITING) && steProtocol.getTaskNo() != 0) { + if (steProtocol.getWaiting() && steProtocol.getTaskNo() != 0) { // 鏌ヨ鏄惁鏈夊緟鍏ュ簱鐨勪换鍔� WrkMast wrkMast = wrkMastMapper.selectCarWaiting(steProtocol.getTaskNo()); if (wrkMast == null) { continue; } @@ -1379,7 +1409,7 @@ ledCommand.setStaNo(wrkMast.getStaNo()); if (wrkMast.getIoType() != 110) { List<WrkDetl> wrkDetls = wrkDetlService.findByWorkNo(wrkMast.getWrkNo()); - wrkDetls.forEach(wrkDetl -> ledCommand.getMatDtos().add(new MatDto(wrkDetl.getMatNo(), wrkDetl.getMatName(), wrkDetl.getQty()))); + wrkDetls.forEach(wrkDetl -> ledCommand.getMatDtos().add(new MatDto(wrkDetl.getMatnr(), wrkDetl.getMaktx(), wrkDetl.getAnfme()))); } commands.add(ledCommand); } -- Gitblit v1.9.1