From 4a129f05fb7369b7916ccd8e68e727bb182439f1 Mon Sep 17 00:00:00 2001
From: Junjie <540245094@qq.com>
Date: 星期一, 12 八月 2024 11:21:46 +0800
Subject: [PATCH] #

---
 zy-asrs-wms/src/main/java/com/zy/asrs/wms/asrs/controller/SuggestLocRuleController.java |   26 ++++++++++++++++++--------
 1 files changed, 18 insertions(+), 8 deletions(-)

diff --git a/zy-asrs-wms/src/main/java/com/zy/asrs/wms/asrs/controller/SuggestLocRuleController.java b/zy-asrs-wms/src/main/java/com/zy/asrs/wms/asrs/controller/SuggestLocRuleController.java
index cdd5f92..58b9662 100644
--- a/zy-asrs-wms/src/main/java/com/zy/asrs/wms/asrs/controller/SuggestLocRuleController.java
+++ b/zy-asrs-wms/src/main/java/com/zy/asrs/wms/asrs/controller/SuggestLocRuleController.java
@@ -5,6 +5,7 @@
 import com.zy.asrs.framework.common.Cools;
 import com.zy.asrs.framework.common.R;
 import com.zy.asrs.framework.exception.CoolException;
+import com.zy.asrs.wms.asrs.entity.enums.LocRuleType;
 import com.zy.asrs.wms.asrs.entity.param.CreateSuggestLocRuleParam;
 import com.zy.asrs.wms.common.annotation.OperationLog;
 import com.zy.asrs.wms.common.domain.BaseParam;
@@ -57,20 +58,29 @@
     @PostMapping("/suggestLocRule/save")
     @Transactional
     public R save(@RequestBody CreateSuggestLocRuleParam param) {
-        List<Long> matIdList = param.getMatIdList();
-        if (matIdList.isEmpty()) {
-            return R.error("璇烽�夋嫨鍟嗗搧淇℃伅");
-        }
-
-        for (Long mat : matIdList) {
+        if (param.getLocType().equals(LocRuleType.D.id)) {
+            //绌烘墭鐩�
             SuggestLocRule suggestLocRule = new SuggestLocRule();
             suggestLocRule.sync(param);
-            suggestLocRule.setMatId(mat);
             if (!suggestLocRuleService.save(suggestLocRule)) {
                 throw new CoolException("娣诲姞鎺ㄨ崘鍖哄煙澶辫触");
             }
-        }
+        }else {
+            //婊℃墭鐩�
+            List<Long> matIdList = param.getMatIdList();
+            if (matIdList.isEmpty()) {
+                return R.error("璇烽�夋嫨鍟嗗搧淇℃伅");
+            }
 
+            for (Long mat : matIdList) {
+                SuggestLocRule suggestLocRule = new SuggestLocRule();
+                suggestLocRule.sync(param);
+                suggestLocRule.setMatId(mat);
+                if (!suggestLocRuleService.save(suggestLocRule)) {
+                    throw new CoolException("娣诲姞鎺ㄨ崘鍖哄煙澶辫触");
+                }
+            }
+        }
         return R.ok("娣诲姞鎴愬姛");
     }
 

--
Gitblit v1.9.1