From c41d362fa2e9bedcdd0a68c2e9ef12ed616512bc Mon Sep 17 00:00:00 2001
From: luxiaotao1123 <t1341870251@63.com>
Date: 星期五, 14 一月 2022 09:11:08 +0800
Subject: [PATCH] #

---
 src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java |  103 ++++++---------------------------------------------
 1 files changed, 13 insertions(+), 90 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 e387719..aa13b7e 100644
--- a/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
+++ b/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
@@ -395,7 +395,7 @@
                     }
                     //  鍒ゆ柇鍫嗗灈鏈虹姸鎬佺瓑寰呯‘璁�
                     if (crnProtocol.modeType == CrnModeType.AUTO && crnProtocol.getTaskNo().equals(wrkMast.getWrkNo().shortValue())
-                            && crnProtocol.getTaskFinish() == 1  // todo:luxiaotao 绛夊緟纭
+                            && crnProtocol.statusType == CrnStatusType.WAITING
                             && crnProtocol.forkPosType == CrnForkPosType.HOME) {
 
                         // 鍛戒护涓嬪彂鍖� --------------------------------------------------------------------------
@@ -746,8 +746,7 @@
             CrnProtocol crnProtocol = crnThread.getCrnProtocol();
             if (crnProtocol == null) { continue; }
             //  鐘舵�侊細绛夊緟纭 骞朵笖  浠诲姟瀹屾垚浣� = 1
-            if (crnProtocol.getTaskFinish() == 1    // todo:luxiaotao 绛夊緟纭
-                    && crnProtocol.getTaskNo() != 0) {
+            if (crnProtocol.statusType == CrnStatusType.WAITING && crnProtocol.getTaskNo() != 0) {
                 // 鑾峰彇鍏ュ簱寰呯‘璁ゅ伐浣滄。
                 WrkMast wrkMast = wrkMastMapper.selectPakInStep3(crnProtocol.getTaskNo().intValue());
                 if (wrkMast == null) {
@@ -793,13 +792,13 @@
                     BasErrLog latest = basErrLogService.findLatestByTaskNo(crn.getId(), crnProtocol.getTaskNo().intValue());
                     // 鏈夊紓甯�
                     if (latest == null) {
-                        if (crnProtocol.getAlarm1() != null && crnProtocol.getAlarm1() > 0) {
+                        if (crnProtocol.getAlarm() != null && crnProtocol.getAlarm() > 0) {
                             WrkMast wrkMast = wrkMastMapper.selectById(crnProtocol.getTaskNo());
                             if (wrkMast == null) {
                                 continue;
                             }
-                            BasCrnError crnError = basCrnErrorMapper.selectById(crnProtocol.getAlarm1());
-                            String errName = crnError==null? String.valueOf(crnProtocol.getAlarm1()):crnError.getErrName();
+                            BasCrnError crnError = basCrnErrorMapper.selectById(crnProtocol.getAlarm());
+                            String errName = crnError==null? String.valueOf(crnProtocol.getAlarm()):crnError.getErrName();
                             BasErrLog basErrLog = new BasErrLog(
                                     null,    // 缂栧彿
                                     wrkMast.getWrkNo(),    // 宸ヤ綔鍙�
@@ -814,7 +813,7 @@
                                     wrkMast.getSourceStaNo(),    // 婧愮珯
                                     wrkMast.getSourceLocNo(),    // 婧愬簱浣�
                                     wrkMast.getBarcode(),    // 鏉$爜
-                                    crnProtocol.getAlarm1(),    // 寮傚父鐮�
+                                    (int) crnProtocol.getAlarm(),    // 寮傚父鐮�
                                     errName,    // 寮傚父
                                     1,    // 寮傚父鎯呭喌
                                     now,    // 娣诲姞鏃堕棿
@@ -829,7 +828,7 @@
                         }
                     } else {
                         // 寮傚父淇
-                        if (crnProtocol.getAlarm1() == null || crnProtocol.getAlarm1() == 0) {
+                        if (crnProtocol.getAlarm() == null || crnProtocol.getAlarm() == 0) {
                             latest.setEndTime(now);
                             latest.setUpdateTime(now);
                             latest.setStatus(2);
@@ -842,11 +841,11 @@
                 } else {
                     BasErrLog latest = basErrLogService.findLatest(crn.getId());
                     // 鏈夊紓甯�
-                    if (crnProtocol.getAlarm1() != null && crnProtocol.getAlarm1() > 0) {
+                    if (crnProtocol.getAlarm() != null && crnProtocol.getAlarm() > 0) {
                         // 璁板綍鏂板紓甯�
-                        if (latest == null || (latest.getErrCode() != crnProtocol.getAlarm1().intValue())) {
-                            BasCrnError crnError = basCrnErrorMapper.selectById(crnProtocol.getAlarm1());
-                            String errName = crnError==null? String.valueOf(crnProtocol.getAlarm1()):crnError.getErrName();
+                        if (latest == null || (latest.getErrCode() != crnProtocol.getAlarm().intValue())) {
+                            BasCrnError crnError = basCrnErrorMapper.selectById(crnProtocol.getAlarm());
+                            String errName = crnError==null? String.valueOf(crnProtocol.getAlarm()):crnError.getErrName();
                             BasErrLog basErrLog = new BasErrLog(
                                     null,    // 缂栧彿
                                     null,    // 宸ヤ綔鍙�
@@ -861,7 +860,7 @@
                                     null,    // 婧愮珯
                                     null,    // 婧愬簱浣�
                                     null,    // 鏉$爜
-                                    crnProtocol.getAlarm1(),    // 寮傚父鐮�
+                                    (int)crnProtocol.getAlarm(),    // 寮傚父鐮�
                                     errName,    // 寮傚父
                                     1,    // 寮傚父鎯呭喌
                                     now,    // 娣诲姞鏃堕棿
@@ -913,7 +912,7 @@
                 }
                 // 绔欑偣鏉′欢鍒ゆ柇
                 if (staProtocol.isAutoing() && staProtocol.isLoading() && staProtocol.isInEnable()
-                        && staProtocol.isEmptyMk() && (staProtocol.getWorkNo() == 0 || staProtocol.getWorkNo() == 9999 || staProtocol.getWorkNo() == 9990) && staProtocol.isPakMk()) {
+                        && staProtocol.isEmptyMk() && (staProtocol.getWorkNo() == 0 || staProtocol.getWorkNo() == 9999 || staProtocol.getWorkNo() == 9990 || staProtocol.getWorkNo() == 9997) && staProtocol.isPakMk()) {
                     // 妫�绱㈠簱浣�
                     LocTypeDto locTypeDto = new LocTypeDto(staProtocol);
                     StartupDto startupDto = commonService.getLocNo(1, 10, emptyInSta.getStaNo(), null, locTypeDto, 0);
@@ -1187,82 +1186,6 @@
             throw new CoolException("绉昏浆澶辫触");
         }
 
-    }
-
-    /**
-     * 鍫嗗灈鏈烘紨绀�  ===>> 搴撲綅绉昏浆
-     */
-    @Async
-    public void crnDemoOfLocMove(Integer crn){
-        for (int i = 0; i < 5; i++) {
-
-            LocMast sourceLoc = locMastService.queryDemoSourceLoc(crn);
-            LocMast loc = locMastService.queryDemoLoc(crn);
-            if (null == sourceLoc || null == loc) {
-                break;
-            }
-            String sourceLocNo = sourceLoc.getLocNo();
-            String locNo = loc.getLocNo();
-
-            // 鑾峰彇宸ヤ綔鍙�
-            int workNo = commonService.getWorkNo(WorkNoType.PICK.type);
-            // 淇濆瓨宸ヤ綔妗�
-            WrkMast wrkMast = new WrkMast();
-            wrkMast.setWrkNo(workNo);
-            wrkMast.setIoTime(new Date());
-            wrkMast.setWrkSts(11L); // 宸ヤ綔鐘舵�侊細11.鐢熸垚鍑哄簱ID
-            wrkMast.setIoType(11); // 鍏ュ嚭搴撶姸鎬侊細 11.搴撴牸绉昏浇
-            wrkMast.setIoPri(13D);
-            wrkMast.setCrnNo(crn);
-            wrkMast.setSourceLocNo(sourceLocNo); // 婧愬簱浣�
-            wrkMast.setLocNo(locNo); // 鐩爣搴撲綅
-            wrkMast.setFullPlt("N"); // 婊℃澘锛歒
-            wrkMast.setPicking("N"); // 鎷f枡
-            wrkMast.setExitMk("N"); // 閫�鍑�
-            wrkMast.setEmptyMk(sourceLoc.getLocSts().equals("D")?"Y":"N"); // 绌烘澘
-            wrkMast.setBarcode(sourceLoc.getBarcode()); // 鎵樼洏鐮�
-            wrkMast.setLinkMis("N");
-            wrkMast.setAppeTime(new Date());
-            wrkMast.setModiTime(new Date());
-            int res = wrkMastMapper.insert(wrkMast);
-            if (res == 0) {
-                throw new CoolException("淇濆瓨宸ヤ綔妗eけ璐�");
-            }
-            // 宸ヤ綔妗f槑缁嗕繚瀛�
-            List<LocDetl> locDetls = locDetlService.selectList(new EntityWrapper<LocDetl>().eq("loc_no", sourceLocNo));
-            for (LocDetl locDetl : locDetls) {
-                WrkDetl wrkDetl = new WrkDetl();
-                wrkDetl.setWrkNo(workNo);
-                wrkDetl.setIoTime(new Date());
-                wrkDetl.setAnfme(locDetl.getAnfme());
-                VersionUtils.setWrkDetl(wrkDetl, locDetl); // 鐗堟湰鎺у埗
-                wrkDetl.setAppeTime(new Date());
-                wrkDetl.setModiTime(new Date());
-                if (!wrkDetlService.insert(wrkDetl)) {
-                    throw new CoolException("淇濆瓨宸ヤ綔妗f槑缁嗗け璐�");
-                }
-            }
-            // 淇敼婧愬簱浣嶇姸鎬�
-            if (sourceLoc.getLocSts().equals("D") || sourceLoc.getLocSts().equals("F")) {
-                sourceLoc.setLocSts("R"); // R.鍑哄簱棰勭害
-                sourceLoc.setModiTime(new Date());
-                if (!locMastService.updateById(sourceLoc)){
-                    throw new CoolException("鏇存柊婧愬簱浣嶇姸鎬佸け璐�");
-                }
-            } else {
-                throw new CoolException("婧愬簱浣嶅嚭搴撳け璐�");
-            }
-            // 淇敼鐩爣搴撲綅鐘舵��
-            if (loc.getLocSts().equals("O")) {
-                loc.setLocSts("S"); // S.鍏ュ簱棰勭害
-                loc.setModiTime(new Date());
-                if (!locMastService.updateById(loc)) {
-                    throw new CoolException("鏇存柊鐩爣搴撲綅鐘舵�佸け璐�");
-                }
-            } else {
-                throw new CoolException("绉昏浆澶辫触");
-            }
-        }
     }
 
     /**

--
Gitblit v1.9.1