From b60d9bacd64db68fc72e9b1a0997613cab3b4390 Mon Sep 17 00:00:00 2001
From: LSH
Date: 星期三, 07 六月 2023 08:34:45 +0800
Subject: [PATCH] #

---
 src/main/java/com/zy/common/service/CommonService.java |   56 ++++++++++++++++++++++++++------------------------------
 1 files changed, 26 insertions(+), 30 deletions(-)

diff --git a/src/main/java/com/zy/common/service/CommonService.java b/src/main/java/com/zy/common/service/CommonService.java
index cb56388..c8ff3bc 100644
--- a/src/main/java/com/zy/common/service/CommonService.java
+++ b/src/main/java/com/zy/common/service/CommonService.java
@@ -97,20 +97,7 @@
      */
     @Transactional
     public StartupDto getLocNo(Integer whsType, Integer staDescId, Integer sourceStaNo, List<String> matNos, LocTypeDto locTypeDto, int times) {
-
-        if (sourceStaNo < 200){
-            whsType = 1;
-        } else if (sourceStaNo > 199 && sourceStaNo < 300){
-            whsType = 2;
-        } else if (sourceStaNo > 299){
-            whsType = 3;
-        }
-        // 鐩爣鍫嗗灈鏈哄彿
-        int crnNo = whsType;
-        if (!basCrnpService.checkSiteError(crnNo, true)){
-            throw new CoolException("娌℃湁鍙敤鐨勫爢鍨涙満");
-        }
-
+        whsType = 1;
         StartupDto startupDto = new StartupDto();
 
         RowLastno rowLastno = rowLastnoService.selectById(whsType);
@@ -175,21 +162,6 @@
             curRow = getCurRow(curRow);
         }
 
-        // 鑾峰彇鐩爣绔�
-        Wrapper<StaDesc> wrapper = new EntityWrapper<StaDesc>()
-                .eq("type_no", staDescId)
-                .eq("stn_no", sourceStaNo)
-                .eq("crn_no", crnNo);
-        StaDesc staDesc = staDescService.selectOne(wrapper);
-        if (Cools.isEmpty(staDesc)) {
-            log.error("type_no={},stn_no={},crn_no={}", staDescId, sourceStaNo, crnNo);
-            throw new CoolException("鍏ュ簱璺緞涓嶅瓨鍦�");
-        }
-        BasDevp staNo = basDevpService.selectById(staDesc.getCrnStn());
-        if (!staNo.getAutoing().equals("Y")) {
-            throw new CoolException("鐩爣绔�"+staDesc.getCrnStn()+"涓嶅彲鐢�");
-        }
-
         // 鏇存柊搴撲綅鎺掑彿
         rowLastno.setCurrentRow(curRow);
         rowLastnoService.updateById(rowLastno);
@@ -229,9 +201,33 @@
                 }
             }
         }
+        Integer crnNo = 0;
+        BasDevp staNo =null;
+        boolean sign=false;
+        if (!Cools.isEmpty(locMast)){
+            try{
+                crnNo = locMast.getCrnNo();
+                // 鑾峰彇鐩爣绔�
+                Wrapper<StaDesc> wrapper = new EntityWrapper<StaDesc>()
+                        .eq("type_no", staDescId)
+                        .eq("stn_no", sourceStaNo)
+                        .eq("crn_no", crnNo);
+                StaDesc staDesc = staDescService.selectOne(wrapper);
+                if (Cools.isEmpty(staDesc)) {
+                    log.error("type_no={},stn_no={},crn_no={}", staDescId, sourceStaNo, crnNo);
+                    throw new CoolException("鍏ュ簱璺緞涓嶅瓨鍦�");
+                }
+                staNo = basDevpService.selectById(staDesc.getCrnStn());
+                if (!staNo.getAutoing().equals("Y")) {
+                    throw new CoolException("鐩爣绔�"+staDesc.getCrnStn()+"涓嶅彲鐢�");
+                }
+            }catch (Exception e){
+                sign=true;
+            }
+        }
 
         // 2.搴撲綅褰撳墠鎵�灞炲昂瀵告棤绌哄簱浣嶆椂锛岃皟鏁村昂瀵稿弬鏁帮紝鍚戜笂鍏煎妫�绱㈠簱浣�
-        if (Cools.isEmpty(locMast)) {
+        if (Cools.isEmpty(locMast) || sign) {
             // 褰撳墠宸烽亾鏃犵┖搴撲綅鏃讹紝閫掑綊璋冩暣鑷充笅涓�宸烽亾锛屾绱㈠叏閮ㄥ贩閬撴棤鏋滃悗锛岃烦鍑洪�掑綊
             if (times < rowCount) {
                 times = times + 1;

--
Gitblit v1.9.1