From 04bd02d1acaa4715fc7d9b3d31d7769c04b3a31f Mon Sep 17 00:00:00 2001
From: luxiaotao1123 <t1341870251@63.com>
Date: 星期一, 24 十月 2022 10:38:42 +0800
Subject: [PATCH] #

---
 src/main/resources/mapper/LocMastMapper.xml                    |    2 
 src/main/java/com/zy/asrs/service/impl/BasDevpServiceImpl.java |    9 ++--
 src/main/java/com/zy/common/service/CommonService.java         |   68 +++++++++++++++++++--------------
 3 files changed, 45 insertions(+), 34 deletions(-)

diff --git a/src/main/java/com/zy/asrs/service/impl/BasDevpServiceImpl.java b/src/main/java/com/zy/asrs/service/impl/BasDevpServiceImpl.java
index d35a6d5..297e517 100644
--- a/src/main/java/com/zy/asrs/service/impl/BasDevpServiceImpl.java
+++ b/src/main/java/com/zy/asrs/service/impl/BasDevpServiceImpl.java
@@ -59,15 +59,16 @@
 
             if(station.getWrkNo()!=null && station.getWrkNo()>0 && station.getWrkNo() < 9990) {
                 WrkMast wrkMast = wrkMastService.selectById(station.getWrkNo());
-                if (wrkMast.getIoType() != 103 && wrkMast.getIoType() != 104 && wrkMast.getIoType() != 107) {
-                    throw new CoolException(devpNo+"绔欑偣宸叉湁宸ヤ綔鍙�");
+                if (wrkMast != null) {
+                    if (wrkMast.getIoType() != 103 && wrkMast.getIoType() != 104 && wrkMast.getIoType() != 107) {
+                        throw new CoolException(devpNo+"绔欑偣宸叉湁宸ヤ綔鍙�");
+                    }
                 }
-
             }
 //            if(!station.getInEnable().equals("Y")) {
 //                throw new CoolException(devpNo+"绔欑偣涓嶆槸鍙叆鐘舵��");
 //            }
-            if(wrkMastService.getWorkingMast(devpNo)>0){
+            if(wrkMastService.getWorkingMast(devpNo) > 0){
                 throw new CoolException(devpNo+"绔欑偣涓嶈兘鍚屾椂鐢熸垚涓ょ瑪鍏ュ簱宸ヤ綔妗�");
             }
         }
diff --git a/src/main/java/com/zy/common/service/CommonService.java b/src/main/java/com/zy/common/service/CommonService.java
index fcadb9d..b8748fb 100644
--- a/src/main/java/com/zy/common/service/CommonService.java
+++ b/src/main/java/com/zy/common/service/CommonService.java
@@ -10,7 +10,6 @@
 import com.zy.asrs.utils.Utils;
 import com.zy.asrs.utils.VersionUtils;
 import com.zy.common.model.LocTypeDto;
-import com.zy.common.model.Shelves;
 import com.zy.common.model.StartupDto;
 import com.zy.common.properties.SlaveProperties;
 import lombok.extern.slf4j.Slf4j;
@@ -115,16 +114,15 @@
         int end = 30;
         switch (sourceStaNo) {
             case 107:
-                whsType = 2;
-                end = 17;
-                break;
-            case 118:
-                whsType = 3;
-                start = 18;
-                break;
-            default:
                 whsType = 1;
                 break;
+            case 118:
+                whsType = 2;
+                start = 31;
+                end = 32;
+                break;
+            default:
+                throw new CoolException("鏁版嵁寮傚父锛岃鑱旂郴绠$悊鍛�");
         }
         // 鐢熸垚宸ヤ綔鍙�
         int workNo = getWorkNo(0);
@@ -136,7 +134,13 @@
         int sRow = rowLastno.getsRow();          // 璧峰鍒�
         int eRow = rowLastno.geteRow();          // 缁堟鍒�
         int crn_qty = rowLastno.getCrnQty();     // 鍫嗗灈鏈烘暟閲忥紙宸烽亾鏁伴噺锛�
-        int rowCount = eRow - sRow + 1;          // 搴撴帓鎬绘暟
+        int rowCount;
+        if (whsType == 1) {
+            rowCount = 2;
+        } else {
+            rowCount = 1;
+        }
+//        int rowCount = eRow - sRow + 1;          // 搴撴帓鎬绘暟
         // 鐩爣鍫嗗灈鏈哄彿
         int crnNo = 0;
         // 鐩爣搴撲綅
@@ -150,9 +154,15 @@
                 if (null != locMast0) {
                     // 娴呭簱浣嶇鍚堝昂瀵告娴�
                     if (VersionUtils.locMoveCheckLocType(locMast0, locTypeDto)) {
+                        int locCrnNo;
+                        if (whsType == 1) {
+                            locCrnNo = 2;
+                        } else {
+                            locCrnNo = 3;
+                        }
                         // 娴呭簱浣嶅搴斿爢鍨涙満蹇呴』鍙敤涓旀棤寮傚父
-                        if (basCrnpService.checkSiteError(locMast0.getCrnNo(), true)) {
-                            crnNo = locMast0.getCrnNo();
+                        if (basCrnpService.checkSiteError(locCrnNo, true)) {
+                            crnNo = locCrnNo;
                             locMast = locMast0;
                             break;
                         }
@@ -171,9 +181,15 @@
                     if (null != locMast0) {
                         // 娴呭簱浣嶇鍚堝昂瀵告娴�
                         if (VersionUtils.locMoveCheckLocType(locMast0, locTypeDto)) {
+                            int locCrnNo;
+                            if (whsType == 1) {
+                                locCrnNo = 2;
+                            } else {
+                                locCrnNo = 3;
+                            }
                             // 娴呭簱浣嶅搴斿爢鍨涙満蹇呴』鍙敤涓旀棤寮傚父
-                            if (basCrnpService.checkSiteError(locMast0.getCrnNo(), true)) {
-                                crnNo = locMast0.getCrnNo();
+                            if (basCrnpService.checkSiteError(locCrnNo, true)) {
+                                crnNo = locCrnNo;
                                 locMast = locMast0;
                                 break;
                             }
@@ -184,21 +200,15 @@
         }
 
         // 濡傛灉娌℃湁鐩歌繎鐗╂枡锛屽垯鎸夎鍒欒疆璇㈣揣鏋�
-        if (null == locMast) {
-            Shelves shelves = new Shelves(rowCount, crn_qty);
-            for (int i = 0; i < shelves.group; i ++) {
-                curRow = shelves.start(curRow);
-                if (curRow < 0) {
-                    throw new CoolException("妫�绱㈠簱浣嶅け璐ワ紝璇疯仈绯荤鐞嗗憳");
-                }
-                Integer crnNo1 = shelves.get(curRow) + 1;
-                if (whsType != 1) {
-                    crnNo1 = whsType;
-                }
-                if (basCrnpService.checkSiteError(crnNo1, true)) {
-                    crnNo = crnNo1;
-                    break;
-                }
+        if (null == locMast && whsType == 1) {
+            if (curRow == 2) {
+                curRow = 30;
+            } else if (curRow == 30) {
+                curRow = 2;
+            }
+            int crnNo1 = 2;
+            if (basCrnpService.checkSiteError(crnNo1, true)) {
+               crnNo = crnNo1;
             }
         }
 
diff --git a/src/main/resources/mapper/LocMastMapper.xml b/src/main/resources/mapper/LocMastMapper.xml
index a98b6f4..0a95f8f 100644
--- a/src/main/resources/mapper/LocMastMapper.xml
+++ b/src/main/resources/mapper/LocMastMapper.xml
@@ -66,7 +66,7 @@
                 <if test="locType1 != null">
                     and loc_type1 = #{locType1}
                 </if>
-                and loc_no not in ('0100101', '0200101', '0300101', '1200701', '1300701', '1400701', '1900401', '2000401', '2100401')
+                /*and loc_no not in ('0100101', '0200101', '0300101', '1200701', '1300701', '1400701', '1900401', '2000401', '2100401')*/
                 group by ctn_no
             ) a
             where count = #{rowsLen}

--
Gitblit v1.9.1