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/entity/param/CreateSuggestLocRuleParam.java |    6 +++
 zy-asrs-admin/src/views/strategy/suggestLocRule/index.vue                                  |    9 ++++
 zy-asrs-admin/src/views/strategy/suggestLocRule/edit.vue                                   |   12 +++++-
 zy-asrs-wms/src/main/java/com/zy/asrs/wms/asrs/entity/SuggestLocRule.java                  |   18 +++++++++
 zy-asrs-wms/src/main/java/com/zy/asrs/wms/asrs/entity/enums/LocRuleType.java               |   18 +++++++++
 zy-asrs-wms/src/main/java/com/zy/asrs/wms/asrs/controller/SuggestLocRuleController.java    |   26 +++++++++----
 6 files changed, 78 insertions(+), 11 deletions(-)

diff --git a/zy-asrs-admin/src/views/strategy/suggestLocRule/edit.vue b/zy-asrs-admin/src/views/strategy/suggestLocRule/edit.vue
index 1b78f2b..a06fb59 100644
--- a/zy-asrs-admin/src/views/strategy/suggestLocRule/edit.vue
+++ b/zy-asrs-admin/src/views/strategy/suggestLocRule/edit.vue
@@ -110,14 +110,22 @@
             <a-form :model="formData" ref="formTable" name="formTable" :label-col="{ span: 8 }"
                 :wrapper-col="{ span: 16 }" style="display: flex;justify-content: space-between;flex-wrap: wrap;"
                 autocomplete="off" @finish="onFinish" @finishFailed="onFinishFailed">
-                <a-form-item :label="formatMessage('db.strategy_suggest_loc_rule.mat_id', '鍟嗗搧')" name="matId"
+                <a-form-item :label="formatMessage('db.strategy_suggest_loc_rule.locType$', '搴撲綅绫诲瀷')" name="locType$"
+                    style="width: 250px;">
+                    <a-select v-model:value="formData.locType" :options="[
+                        { label: '婊℃墭', value: 1 },
+                        { label: '绌烘墭', value: 0 },
+                    ]">
+                    </a-select>
+                </a-form-item>
+                <a-form-item v-if="formData.locType != 0" :label="formatMessage('db.strategy_suggest_loc_rule.mat_id', '鍟嗗搧')" name="matId"
                     style="width: 250px;" :rules="[{ required: true }]">
                     <a-select v-model:value="formData.matId" mode="multiple" :placeholder="formatMessage('common.select', '璇烽�夋嫨')"
                         style="width: 100%" show-search :options="matQueryList" optionFilterProp="label"
                         optionLabelProp="label" @click="handleSelectMatClick" :open="false">
                     </a-select>
                 </a-form-item>
-                <a-form-item :label="formatMessage('db.strategy_suggest_loc_rule.batch', '鎵瑰彿')" name="batch"
+                <a-form-item v-if="formData.locType != 0" :label="formatMessage('db.strategy_suggest_loc_rule.batch', '鎵瑰彿')" name="batch"
                     style="width: 250px;">
                     <a-input v-model:value="formData.batch" />
                 </a-form-item>
diff --git a/zy-asrs-admin/src/views/strategy/suggestLocRule/index.vue b/zy-asrs-admin/src/views/strategy/suggestLocRule/index.vue
index fff97e8..028ff05 100644
--- a/zy-asrs-admin/src/views/strategy/suggestLocRule/index.vue
+++ b/zy-asrs-admin/src/views/strategy/suggestLocRule/index.vue
@@ -27,8 +27,15 @@
 
 const columns = [
   {
+    title: formatMessage('db.strategy_suggest_loc_rule.locType$', '搴撲綅绫诲瀷'),
+    dataIndex: 'locType$',
+    width: 140,
+    ellipsis: true,
+    ...getColumnSearchProps('locType$'),
+  },
+  {
     title: formatMessage('db.strategy_suggest_loc_rule.mat_id', '鍟嗗搧'),
-    dataIndex: ['mat$','matnr'],
+    dataIndex: ['mat$', 'matnr'],
     width: 140,
     ellipsis: true,
     ...getColumnSearchProps('matId$'),
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("娣诲姞鎴愬姛");
     }
 
diff --git a/zy-asrs-wms/src/main/java/com/zy/asrs/wms/asrs/entity/SuggestLocRule.java b/zy-asrs-wms/src/main/java/com/zy/asrs/wms/asrs/entity/SuggestLocRule.java
index 0da2db1..3b59135 100644
--- a/zy-asrs-wms/src/main/java/com/zy/asrs/wms/asrs/entity/SuggestLocRule.java
+++ b/zy-asrs-wms/src/main/java/com/zy/asrs/wms/asrs/entity/SuggestLocRule.java
@@ -95,6 +95,12 @@
     private Long hostId;
 
     /**
+     * 搴撲綅绫诲瀷 1: 婊℃墭  0: 绌烘墭
+     */
+    @ApiModelProperty(value= "搴撲綅绫诲瀷 1: 婊℃墭  0: 绌烘墭  ")
+    private Integer locType;
+
+    /**
      * 鐘舵�� 1: 姝e父  0: 绂佺敤  
      */
     @ApiModelProperty(value= "鐘舵�� 1: 姝e父  0: 绂佺敤  ")
@@ -206,6 +212,18 @@
         return null;
     }
 
+    public String getLocType$(){
+        if (null == this.locType){ return null; }
+        switch (this.locType){
+            case 1:
+                return "婊℃墭";
+            case 0:
+                return "绌烘墭";
+            default:
+                return String.valueOf(this.locType);
+        }
+    }
+
     public String getStatus$(){
         if (null == this.status){ return null; }
         switch (this.status){
diff --git a/zy-asrs-wms/src/main/java/com/zy/asrs/wms/asrs/entity/enums/LocRuleType.java b/zy-asrs-wms/src/main/java/com/zy/asrs/wms/asrs/entity/enums/LocRuleType.java
new file mode 100644
index 0000000..1a5bde9
--- /dev/null
+++ b/zy-asrs-wms/src/main/java/com/zy/asrs/wms/asrs/entity/enums/LocRuleType.java
@@ -0,0 +1,18 @@
+package com.zy.asrs.wms.asrs.entity.enums;
+
+public enum LocRuleType {
+
+    D(0, "绌烘墭鐩�"),
+    F(1, "婊℃墭鐩�"),
+    ;
+
+
+    public Integer id;
+    public String desc;
+
+    LocRuleType(Integer id, String desc) {
+        this.id = id;
+        this.desc = desc;
+    }
+
+}
diff --git a/zy-asrs-wms/src/main/java/com/zy/asrs/wms/asrs/entity/param/CreateSuggestLocRuleParam.java b/zy-asrs-wms/src/main/java/com/zy/asrs/wms/asrs/entity/param/CreateSuggestLocRuleParam.java
index 2def511..409897e 100644
--- a/zy-asrs-wms/src/main/java/com/zy/asrs/wms/asrs/entity/param/CreateSuggestLocRuleParam.java
+++ b/zy-asrs-wms/src/main/java/com/zy/asrs/wms/asrs/entity/param/CreateSuggestLocRuleParam.java
@@ -21,6 +21,12 @@
     private String batch;
 
     /**
+     * 搴撲綅绫诲瀷
+     */
+    @ApiModelProperty(value= "搴撲綅绫诲瀷")
+    private Integer locType;
+
+    /**
      * 璧峰鎺�
      */
     @ApiModelProperty(value= "璧峰鎺�")

--
Gitblit v1.9.1