From 006ca71bd84497f2ff53630a3f9257f7a6e29391 Mon Sep 17 00:00:00 2001
From: luxiaotao1123 <t1341870251@63.com>
Date: 星期四, 06 一月 2022 08:49:10 +0800
Subject: [PATCH] #

---
 src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java |  112 ++++++++-----------------------------------------------
 1 files changed, 17 insertions(+), 95 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 30b2c4c..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) {
 
                         // 鍛戒护涓嬪彂鍖� --------------------------------------------------------------------------
@@ -427,8 +427,7 @@
     /**
      * 鍏ュ嚭搴�  ===>>  鍫嗗灈鏈哄叆鍑哄簱浣滀笟涓嬪彂
      */
-    @Async
-    public void crnIoExecute(){
+    public synchronized void crnIoExecute(){
         for (CrnSlave crn : slaveProperties.getCrn()) {
             // 鑾峰彇鍫嗗灈鏈轰俊鎭�
             CrnThread crnThread = (CrnThread) SlaveConnection.get(SlaveType.Crn, crn.getId());
@@ -470,7 +469,7 @@
     /**
      * 鍏ュ簱  ===>>  鍫嗗灈鏈虹珯鍒板簱浣�
      */
-    public synchronized void crnStnToLoc(CrnSlave slave, CrnProtocol crnProtocol){
+    public void crnStnToLoc(CrnSlave slave, CrnProtocol crnProtocol){
         for (CrnSlave.CrnStn crnStn : slave.getCrnInStn()) {
             boolean flag = false;
             // 鑾峰彇鍫嗗灈鏈哄叆搴撶珯淇℃伅
@@ -564,7 +563,7 @@
     /**
      * 鍑哄簱  ===>>  搴撲綅鍒板爢鍨涙満绔�
      */
-    public synchronized void locToCrnStn(CrnSlave slave, CrnProtocol crnProtocol){
+    public void locToCrnStn(CrnSlave slave, CrnProtocol crnProtocol){
         for (CrnSlave.CrnStn crnStn : slave.getCrnOutStn()) {
             // 鑾峰彇宸ヤ綔鐘舵�佷负11锛堢敓鎴愬嚭搴揑D锛夌殑鍑哄簱宸ヤ綔妗�
             WrkMast wrkMast = wrkMastMapper.selectPakOutStep1(slave.getId(), crnStn.getStaNo());
@@ -671,7 +670,7 @@
     /**
      * 搴撲綅绉昏浆
      */
-    public synchronized void locToLoc(CrnSlave slave, CrnProtocol crnProtocol){
+    public void locToLoc(CrnSlave slave, CrnProtocol crnProtocol){
         // 鑾峰彇宸ヤ綔妗d俊鎭�
         WrkMast wrkMast = wrkMastMapper.selectLocMove(slave.getId());
         if (null == wrkMast) {
@@ -747,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) {
@@ -794,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(),    // 宸ヤ綔鍙�
@@ -815,7 +813,7 @@
                                     wrkMast.getSourceStaNo(),    // 婧愮珯
                                     wrkMast.getSourceLocNo(),    // 婧愬簱浣�
                                     wrkMast.getBarcode(),    // 鏉$爜
-                                    crnProtocol.getAlarm1(),    // 寮傚父鐮�
+                                    (int) crnProtocol.getAlarm(),    // 寮傚父鐮�
                                     errName,    // 寮傚父
                                     1,    // 寮傚父鎯呭喌
                                     now,    // 娣诲姞鏃堕棿
@@ -830,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);
@@ -843,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,    // 宸ヤ綔鍙�
@@ -862,7 +860,7 @@
                                     null,    // 婧愮珯
                                     null,    // 婧愬簱浣�
                                     null,    // 鏉$爜
-                                    crnProtocol.getAlarm1(),    // 寮傚父鐮�
+                                    (int)crnProtocol.getAlarm(),    // 寮傚父鐮�
                                     errName,    // 寮傚父
                                     1,    // 寮傚父鎯呭喌
                                     now,    // 娣诲姞鏃堕棿
@@ -914,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);
@@ -1188,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