From 2b181eaba59e3bde4ae52c1a215d468a6267f661 Mon Sep 17 00:00:00 2001
From: luxiaotao1123 <t1341870251@163.com>
Date: 星期三, 09 十一月 2022 11:29:24 +0800
Subject: [PATCH] #

---
 src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java |  119 ++++++++++++++++++++++++++++++++++++++---------------------
 1 files changed, 76 insertions(+), 43 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 6a731a5..965343f 100644
--- a/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
+++ b/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
@@ -472,12 +472,12 @@
                             }
                             LocMast locMast = null;
                             // 淇敼婧愬簱浣嶇姸鎬� O.绌哄簱浣�
-//                            locMast = locMastService.selectById(sourceLocNo);
-//                            locMast.setLocSts("O");
-//                            locMast.setModiTime(new Date());
-//                            if (!locMastService.updateById(locMast)) {
-//                                throw new CoolException(wrkMast.getWrkNo() + "淇敼婧愬簱浣嶇姸鎬� O.绌哄簱浣�");
-//                            }
+                            locMast = locMastService.selectById(sourceLocNo);
+                            locMast.setLocSts("O");
+                            locMast.setModiTime(new Date());
+                            if (!locMastService.updateById(locMast)) {
+                                throw new CoolException(wrkMast.getWrkNo() + "淇敼婧愬簱浣嶇姸鎬� O.绌哄簱浣�");
+                            }
                             // 淇敼鐩爣搴撲綅鐘舵�� Q.鎷f枡/鐩樼偣/骞舵澘鍐嶅叆搴�
                             locMast = locMastService.selectById(wrkMast.getLocNo());
                             locMast.setLocSts("Q");
@@ -541,7 +541,7 @@
     /**
      * 鐩樼偣璐х墿鎶佃揪鐩樼偣鐩爣绔� wrkMast.sourceLoc P ===>> O
      */
-    public void pickWrkCompleteStaNo() {
+    public void pickWrkCompleteStaNo0() {
         for (DevpSlave devp : slaveProperties.getDevp()) {
             // 閬嶅巻鎷f枡鍏ュ簱鍙�
             for (DevpSlave.Sta pickSta : devp.getPickOutSta()) {
@@ -554,27 +554,50 @@
                     staProtocol = staProtocol.clone();
                 }
                 if (staProtocol.getWorkNo() > 0) {
-                    WrkMast wrkMast = wrkMastMapper.selectPick17(pickSta.getStaNo(), staProtocol.getWorkNo().intValue());
-                    if (Cools.isEmpty(wrkMast)) {
-                        log.error("{}绔欐嫞鏂欍�佸苟鏉裤�佺洏鐐规绱换鍔″け璐ワ紒浠诲姟鍙凤細{}", pickSta.getStaNo(), staProtocol.getWorkNo());
-                    } else {
-                        // 淇敼婧愬簱浣嶇姸鎬� O.绌哄簱浣�
-                        LocMast locMast = locMastService.selectById(wrkMast.getSourceLocNo());
-                        if (locMast.getLocSts().equals("P")) {
-                            locMast.setLocSts("O");
-                            locMast.setModiTime(new Date());
-                            if (!locMastService.updateById(locMast)) {
-                                throw new CoolException(wrkMast.getWrkNo() + "淇敼婧愬簱浣嶇姸鎬� O.绌哄簱浣�");
-                            }
-                        }
-                        // 淇敼宸ヤ綔妗�
-                        wrkMast.setIoPri(13D);
-                        if (wrkMastMapper.updateById(wrkMast) == 0) {
-                            log.error("鏇存柊宸ヤ綔妗g殑浼樺厛绾уけ璐ワ紒锛侊紒 [宸ヤ綔鍙�:{}]", wrkMast.getWrkNo());
-                        }
-                    }
+//                    WrkMast wrkMast = wrkMastMapper.selectPick17(pickSta.getStaNo(), staProtocol.getWorkNo().intValue());
+//                    if (Cools.isEmpty(wrkMast)) {
+//                        log.error("{}绔欐嫞鏂欍�佸苟鏉裤�佺洏鐐规绱换鍔″け璐ワ紒浠诲姟鍙凤細{}", pickSta.getStaNo(), staProtocol.getWorkNo());
+//                    } else {
+//                        // 淇敼婧愬簱浣嶇姸鎬� O.绌哄簱浣�
+//                        LocMast locMast = locMastService.selectById(wrkMast.getSourceLocNo());
+//                        if (locMast.getLocSts().equals("P")) {
+//                            locMast.setLocSts("O");
+//                            locMast.setModiTime(new Date());
+//                            if (!locMastService.updateById(locMast)) {
+//                                throw new CoolException(wrkMast.getWrkNo() + "淇敼婧愬簱浣嶇姸鎬� O.绌哄簱浣�");
+//                            }
+//                        }
+//                        // 淇敼宸ヤ綔妗�
+//                        wrkMast.setIoPri(13D);
+//                        if (wrkMastMapper.updateById(wrkMast) == 0) {
+//                            log.error("鏇存柊宸ヤ綔妗g殑浼樺厛绾уけ璐ワ紒锛侊紒 [宸ヤ綔鍙�:{}]", wrkMast.getWrkNo());
+//                        }
+//                    }
                 }
 
+            }
+        }
+    }
+
+    /**
+     * 鐩樼偣璐х墿鎶佃揪鐩樼偣鐩爣绔� wrkMast.sourceLoc P ===>> O
+     */
+    public void pickWrkCompleteStaNo() {
+        List<WrkMast> wrkMasts = wrkMastMapper.selectPick17(null, null);
+        for (WrkMast wrkMast : wrkMasts) {
+            // 淇敼婧愬簱浣嶇姸鎬� O.绌哄簱浣�
+            LocMast locMast = locMastService.selectById(wrkMast.getSourceLocNo());
+            if (locMast.getLocSts().equals("P")) {
+                locMast.setLocSts("O");
+                locMast.setModiTime(new Date());
+                if (!locMastService.updateById(locMast)) {
+                    throw new CoolException(wrkMast.getWrkNo() + "淇敼婧愬簱浣嶇姸鎬� O.绌哄簱浣�");
+                }
+            }
+            // 淇敼宸ヤ綔妗�
+            wrkMast.setIoPri(13D);
+            if (wrkMastMapper.updateById(wrkMast) == 0) {
+                log.error("鏇存柊宸ヤ綔妗g殑浼樺厛绾уけ璐ワ紒锛侊紒 [宸ヤ綔鍙�:{}]", wrkMast.getWrkNo());
             }
         }
     }
@@ -1308,6 +1331,11 @@
                     SteThread steThread = queryIdleCar(wrkMast);
                     if (steThread != null) {
                         if (null == wrkMastMapper.selectPakout(slave.getId(), steNo)) {
+                            // 鏍囪绉诲簱褰撳墠娴佺▼
+                            wrkMast.setMk("O");
+                            if (wrkMastMapper.updateById(wrkMast) == 0) {
+                                log.error("鏍囪绉诲簱褰撳墠娴佺▼ I 澶辫触锛侊紒锛屽伐浣滃彿={}", wrkMast.getWrkNo());
+                            }
                             // 璁╁皬杞︾瓑寰呮惉杩愬緟缁�
                             this.letCarBeReady(wrkMast, steThread.getSlave().getId(), wrkMast.getSourceLocNo());
                         }
@@ -1480,6 +1508,11 @@
                         if (steThread != null) {
                             // 娌℃湁鍏朵粬浠诲姟
                             if (null == wrkMastMapper.selectPakin(slave.getId(), steNo)) {
+                                // 鏍囪绉诲簱褰撳墠娴佺▼
+                                wrkMast.setMk("I");
+                                if (wrkMastMapper.updateById(wrkMast) == 0) {
+                                    log.error("鏍囪绉诲簱褰撳墠娴佺▼ I 澶辫触锛侊紒锛屽伐浣滃彿={}", wrkMast.getWrkNo());
+                                }
                                 // 璁╁皬杞︾瓑寰呮惉杩愬緟缁�
                                 this.letCarBeReady(wrkMast, steThread.getSlave().getId(), wrkMast.getLocNo());
                             }
@@ -2598,23 +2631,23 @@
                                 // 淇敼宸ヤ綔妗g姸鎬� 11.鐢熸垚鍑哄簱ID => 12.灏忚溅寰呮惉
                                 wrkMast.setWrkSts(12L);
                             } else {
-//                                if (Cools.isEmpty(wrkMast.getMk())) {
-//                                    log.error("绉诲簱宸ヤ綔妗f病鏈夋祦绋嬫爣璁帮紒锛侊紝宸ヤ綔鍙�={}", wrkMast.getWrkNo());
-//                                } else {
-//                                    if (wrkMast.getMk().equals("I")) {
-//                                        String locNo = wrkMast.getLocNo();
-//                                        if (Utils.getGroupRow(locNo).equals(Utils.getGroupRow(steProtocol.getRow().intValue())) && steProtocol.getBay() == Utils.getBay(locNo) && steProtocol.getLev() == Utils.getLev(locNo)) {
-//                                            // 淇敼宸ヤ綔妗g姸鎬� 11.鐢熸垚鍑哄簱ID => 6.灏忚溅寰呭叆
-//                                            wrkMast.setWrkSts(6L);
-//                                        } else {
-//                                            // 淇敼宸ヤ綔妗g姸鎬� 11.鐢熸垚鍑哄簱ID => 3.灏忚溅寰呮惉
-//                                            wrkMast.setWrkSts(3L);
-//                                        }
-//                                    } else if (wrkMast.getMk().equals("O")) {
-//                                        // 淇敼宸ヤ綔妗g姸鎬� 11.鐢熸垚鍑哄簱ID => 12.灏忚溅寰呮惉
-//                                        wrkMast.setWrkSts(12L);
-//                                    }
-//                                }
+                                if (Cools.isEmpty(wrkMast.getMk())) {
+                                    log.error("绉诲簱宸ヤ綔妗f病鏈夋祦绋嬫爣璁帮紒锛侊紝宸ヤ綔鍙�={}", wrkMast.getWrkNo());
+                                } else {
+                                    if (wrkMast.getMk().equals("I")) {
+                                        String locNo = wrkMast.getLocNo();
+                                        if (Utils.getGroupRow(locNo).equals(Utils.getGroupRow(steProtocol.getRow().intValue())) && steProtocol.getBay() == Utils.getBay(locNo) && steProtocol.getLev() == Utils.getLev(locNo)) {
+                                            // 淇敼宸ヤ綔妗g姸鎬� 11.鐢熸垚鍑哄簱ID => 6.灏忚溅寰呭叆
+                                            wrkMast.setWrkSts(6L);
+                                        } else {
+                                            // 淇敼宸ヤ綔妗g姸鎬� 11.鐢熸垚鍑哄簱ID => 3.灏忚溅寰呮惉
+                                            wrkMast.setWrkSts(3L);
+                                        }
+                                    } else if (wrkMast.getMk().equals("O")) {
+                                        // 淇敼宸ヤ綔妗g姸鎬� 11.鐢熸垚鍑哄簱ID => 12.灏忚溅寰呮惉
+                                        wrkMast.setWrkSts(12L);
+                                    }
+                                }
                             }
                             wrkMast.setModiTime(now);
                             if (wrkMastMapper.updateById(wrkMast) == 0) {

--
Gitblit v1.9.1