From b4e0f827567f8d5ad4a1ff5caa22675cbc165b88 Mon Sep 17 00:00:00 2001
From: lsh <lsh123456>
Date: 星期三, 11 六月 2025 10:27:31 +0800
Subject: [PATCH] #

---
 src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java |   87 +++++++++++++++++++++++++++----------------
 1 files changed, 54 insertions(+), 33 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 eb6c246..4b83d4a 100644
--- a/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
+++ b/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
@@ -1561,7 +1561,15 @@
      */
     public synchronized void locToCrnStn1(CrnSlave slave, CrnProtocol crnProtocol) {
         List<WrkMast> wrkMasts = wrkMastMapper.selectPakOutStep12(slave.getId());
+        Double pri = 0.0;
         for (WrkMast wrkMast : wrkMasts) {
+            if (wrkMast.getIoType() != 110){
+                if (wrkMast.getIoPri()>=pri){
+                    pri = wrkMast.getIoPri();
+                } else {
+                    continue;
+                }
+            }
             if (wrkMast == null) {
                 continue;
             }
@@ -1640,7 +1648,11 @@
                             log.error("{}搴撲綅寮傚父锛屾湭妫�绱㈠埌鐩稿簲宸ヤ綔妗o紒", shallowLocNo);
                         } else {
                             if (waitWrkMast.getWrkSts() == 11) {
-                                waitWrkMast.setIoPri(15D);
+                                if (waitWrkMast.getIoPri() + 100000D < 99999999) {
+                                    waitWrkMast.setIoPri(waitWrkMast.getIoPri()+100000D);
+                                } else {
+                                    waitWrkMast.setIoPri(99999999D);
+                                }
                                 waitWrkMast.setModiTime(new Date());
                                 if (wrkMastMapper.updateById(waitWrkMast) == 0) {
                                     log.error("璋冩暣宸ヤ綔妗d紭鍏堢骇澶辫触锛佸伐浣滃彿={}", waitWrkMast.getWrkNo());
@@ -1676,6 +1688,9 @@
                         if (null != waitWrkMast && waitWrkMast.getWrkSts() == 4) {
                             continue;
                         }
+                    } else if (!shallowLoc.getLocSts().equals("O") ){
+                        log.error("{}浠诲姟鍑哄簱澶辫触锛屾祬搴撲綅鍫靛锛佹祬搴撲綅鍙�:{},娴呭簱浣嶇姸鎬�:{}", wrkMast.getWrkNo(), shallowLocNo,shallowLoc.getLocSts());
+                        continue;
                     }
                 }
 
@@ -2467,9 +2482,10 @@
                         continue;
                     }
                     Integer count1 = wrkDetlService.count1();
+                    Integer count11 = wrkDetlService.count11();
                     Integer count2 = wrkDetlService.count2(wrkDetls.get(0).getOrderNo());
                     Integer count3 = wrkDetlService.count3();
-                    wrkDetls.forEach(wrkDetl -> ledCommand.getMatDtos().add(new MatDto(wrkDetl,count1,count2,count3)));
+                    wrkDetls.forEach(wrkDetl -> ledCommand.getMatDtos().add(new MatDto(wrkDetl,count1+count11,count2,count3)));
                 }
                 commands.add(ledCommand);
             }
@@ -3144,9 +3160,9 @@
                 if (Cools.isEmpty(basDevp) || basDevp.getReportSign()!=1){
                     continue;
                 }
-                if (basDevp.getWrkNo()!=0 && (basDevp.getWrkNo()<9900 || basDevp.getWrkNo()>9999)){
-                    continue;
-                }
+//                if (basDevp.getWrkNo()!=0 && (basDevp.getWrkNo()<9900 || basDevp.getWrkNo()>9999)){
+//                    continue;
+//                }
                 WrkMast wrkMast = wrkMastMapper.selectWrkMastUnstackingOne202(staNo);
                 if (Cools.isEmpty(wrkMast)){
                     continue;
@@ -3165,35 +3181,36 @@
 //                if (inSta.getStaNo() == 203 && devpThread.ioModeOf2F == IoModeType.PAKOUT_MODE) {
 //                    continue;
 //                }
-
+                if (staProtocol.isEmptyMk()){
+                    log.info("{}绔欑偣鏃犵墿锛屽紓甯革紒",staNo);
+                    continue;
+                }
                 if (!staProtocol.isLoading()){
                     log.info("{}绔欑偣鏃犵墿锛屽紓甯革紒",staNo);
                     continue;
                 }
                 // 鍒ゆ柇鏄惁婊¤冻鍏ュ簱鏉′欢
-                if (staProtocol.isAutoing()
-                        && staProtocol.isLoading()
-                        && staProtocol.isInEnable()
-                        && (staProtocol.getWorkNo() == 0 || (staProtocol.getWorkNo()>9899 && staProtocol.getWorkNo()<10000))
-                ) {//&& staProtocol.isPakMk() && !Cools.isEmpty(barcode)) {
-
+                if (staProtocol.isAutoing() && staProtocol.getWorkNo() == 0) {//&& staProtocol.isPakMk() && !Cools.isEmpty(barcode)) {
+//                        && staProtocol.isInEnable()
                     //浠诲姟瀹屾垚
-                    boolean result1 = MessageQueue.offer(SlaveType.Devp, devpThread.getSlave().getId(), new Task(3, staProtocol));
-                    Thread.sleep(100);
-
-                    staProtocol.setWorkNo(wrkMast.getWrkNo());
-                    staProtocol.setStaNo(144);
-                    devpThread.setPakMk(staProtocol.getSiteId(), false);
-                    boolean result = MessageQueue.offer(SlaveType.Devp, devpThread.getSlave().getId(), new Task(2, staProtocol));
+//                    boolean result1 = MessageQueue.offer(SlaveType.Devp, devpThread.getSlave().getId(), new Task(3, staProtocol));
+//                    Thread.sleep(100);
+                    StaProtocol staProtocolnew = new StaProtocol();
+                    staProtocolnew.setSiteId(staProtocol.getSiteId());
+                    staProtocolnew.setWorkNo(wrkMast.getWrkNo());
+                    staProtocolnew.setStaNo(144);
+                    devpThread.setPakMk(staProtocolnew.getSiteId(), false);
+                    devpThread.setReportSign(staProtocolnew.getSiteId(), true);
+                    boolean result = MessageQueue.offer(SlaveType.Devp, devpThread.getSlave().getId(), new Task(2, staProtocolnew));
                     if (!result) {
                         throw new CoolException("鏇存柊plc绔欑偣淇℃伅澶辫触==>椹卞姩鐮佸灈浣嶆墭鐩樺墠杩涘け璐ワ紒");
                     }
                     wrkMast.setWrkSts(52L);
                     wrkMastMapper.updateById(wrkMast);
-                    Thread.sleep(100);
+//                    Thread.sleep(100);
 
                     //浠诲姟瀹屾垚
-                    boolean result2 = MessageQueue.offer(SlaveType.Devp, devpThread.getSlave().getId(), new Task(4, staProtocol));
+//                    boolean result2 = MessageQueue.offer(SlaveType.Devp, devpThread.getSlave().getId(), new Task(4, staProtocol));
 
                 }
             }
@@ -3400,7 +3417,7 @@
             for (int staNo : staNos){
                 BasDevp basDevp = basDevpService.selectById(staNo);
                 BasDevp basDevp135 = basDevpService.selectById(135);
-                if (basDevp.getWrkNo()==0 || (basDevp.getWrkNo()<10000 && basDevp.getWrkNo()>9899) ){
+                if (basDevp.getWrkNo()==0){
                     continue;
                 }
                 if (basDevp135.getReportSign()!=0){
@@ -3426,8 +3443,8 @@
                 } else {
                     staProtocol135 = staProtocol135.clone();
                 }
-                if (staProtocol135.getWorkNo()<9900 || staProtocol135.getWorkNo()>9999 || staProtocol135.getWorkNo()==0
-                        || !staProtocol135.isLoading() || !staProtocol135.isAutoing()){
+                if ( staProtocol135.getWorkNo()!=0
+                        || !staProtocol135.isLoading() || !staProtocol135.isAutoing() || !staProtocol135.isEmptyMk()){
                     continue;
                 }
                 StaProtocol staProtocol = devpThread.getStation().get(staNo);
@@ -3473,21 +3490,25 @@
 //                    }
 
                     //浠诲姟瀹屾垚
-                    boolean result1 = MessageQueue.offer(SlaveType.Devp, devpThread.getSlave().getId(), new Task(3, staProtocol135));
-                    try{
-                        Thread.sleep(100);
-                    }catch (Exception e){ }
+//                    boolean result1 = MessageQueue.offer(SlaveType.Devp, devpThread.getSlave().getId(), new Task(3, staProtocol135));
+//                    try{
+//                        Thread.sleep(100);
+//                    }catch (Exception e){ }
                     basDevp135.setReportSign(2);
                     basDevpService.updateById(basDevp135);
                     int workNo = commonService.getWorkNo(5);
-                    staProtocol135.setWorkNo(workNo);
-                    staProtocol135.setStaNo(144);
-                    devpThread.setPakMk(staProtocol135.getSiteId(), false);
-                    boolean result = MessageQueue.offer(SlaveType.Devp, devpThread.getSlave().getId(), new Task(2, staProtocol135));
+
+                    StaProtocol staProtocolnew = new StaProtocol();
+                    staProtocolnew.setSiteId(staProtocol135.getSiteId());
+                    staProtocolnew.setWorkNo(workNo);
+                    staProtocolnew.setStaNo(144);
+
+                    devpThread.setPakMk(staProtocolnew.getSiteId(), false);
+                    boolean result = MessageQueue.offer(SlaveType.Devp, devpThread.getSlave().getId(), new Task(2, staProtocolnew));
                     if (!result) {
                         throw new CoolException("鏇存柊plc绔欑偣淇℃伅澶辫触==>椹卞姩鐮佸灈浣嶆墭鐩樺墠杩涘け璐ワ紒");
                     }
-                    boolean result2 = MessageQueue.offer(SlaveType.Devp, devpThread.getSlave().getId(), new Task(4, staProtocol135));
+//                    boolean result2 = MessageQueue.offer(SlaveType.Devp, devpThread.getSlave().getId(), new Task(4, staProtocol135));
 
                 }
             }

--
Gitblit v1.9.1