From 46a47d147ca58b48b83a2df50926f5fd2bab3f0c Mon Sep 17 00:00:00 2001
From: luxiaotao1123 <t1341870251@163.com>
Date: 星期三, 17 六月 2020 14:49:06 +0800
Subject: [PATCH] #

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

diff --git a/src/main/java/com/zy/common/service/CommonService.java b/src/main/java/com/zy/common/service/CommonService.java
index 2f22fbd..2697b95 100644
--- a/src/main/java/com/zy/common/service/CommonService.java
+++ b/src/main/java/com/zy/common/service/CommonService.java
@@ -14,7 +14,7 @@
 import java.util.List;
 
 /**
- * 鍙屾繁寮忚揣鏋舵牳蹇冨姛鑳�
+ * 璐ф灦鏍稿績鍔熻兘
  * Created by vincent on 2020/6/11
  */
 @Service
@@ -63,9 +63,15 @@
                 }
             }
             if (workNo > 0){
-                // todo
                 wrkLastno.setWrkNo(workNo);
                 wrkLastnoService.updateById(wrkLastno);
+            }
+        }
+        if (workNo == 0) {
+            throw new CoolException("鐢熸垚宸ヤ綔鍙峰け璐ワ紝璇疯仈绯荤鐞嗗憳");
+        } else {
+            if (wrkMastService.selectById(workNo)!=null) {
+                throw new CoolException("鐢熸垚宸ヤ綔鍙�" + workNo + "鍦ㄥ伐浣滄。涓凡瀛樺湪");
             }
         }
         return workNo;
@@ -74,10 +80,11 @@
     /**
      * 妫�绱㈠簱浣嶅彿
      * @param whsType 绫诲瀷 1:鍙屾繁寮忚揣鏋�
+     * @param staDescId 璺緞ID
      * @param sourceStaNo 婧愮珯
      * @return locNo 妫�绱㈠埌鐨勫簱浣嶅彿
      */
-    public StartupDto getLocNo(Integer whsType, Integer sourceStaNo) {
+    public StartupDto getLocNo(Integer whsType, Integer staDescId, Integer sourceStaNo) {
         StartupDto startupDto = new StartupDto();
         RowLastno rowLastno = rowLastnoService.selectById(whsType);
         if (Cools.isEmpty(rowLastno)) {
@@ -100,18 +107,13 @@
             for (List<Integer> node : shelves.nodes){
                 if (node.contains(curRow)) {
                     crnNo = shelves.nodes.indexOf(node) + 1;
+                    break;
                 }
             }
-            BasCrnp crnp = basCrnpService.selectById(crnNo);
-            if (Cools.isEmpty(crnp)) {
-                throw new CoolException("鍫嗗灈鏈虹紪鍙烽敊璇�");
-            }
-            if (!"Y".equals(crnp.getInEnable())) {
-                throw new CoolException("褰撳墠鍫嗗灈鏈烘棤娉曞叆搴�");
-            }
+            basCrnpService.checkSiteStatus(crnNo);
             // 鑾峰彇鐩爣绔�
             Wrapper<StaDesc> wrapper = new EntityWrapper<StaDesc>()
-                    .eq("type_no", 1)
+                    .eq("type_no", staDescId)
                     .eq("stn_no", sourceStaNo)
                     .eq("crn_no", crnNo);
             StaDesc staDesc = staDescService.selectOne(wrapper);
@@ -119,7 +121,7 @@
                 throw new CoolException("鍏ュ簱璺緞涓嶅瓨鍦�");
             }
             BasDevp staNo = basDevpService.selectById(staDesc.getCrnStn());
-            int inQty = staNo.getInQty();
+            int inQty = staNo.getInQty()==null?0:staNo.getInQty();
             if (staNo.getInEnable().equals("Y") && staNo.getAutoing().equals("Y") && inQty<2) {
                 // 鏌ユ壘搴撲綅
                 LocMast locMast = locMastService.queryFreeLocMast(curRow);

--
Gitblit v1.9.1