From 4a0cfe4d2800769f1cbf34418397160a0aaac0b8 Mon Sep 17 00:00:00 2001
From: Junjie <fallin.jie@qq.com>
Date: 星期一, 05 六月 2023 09:04:45 +0800
Subject: [PATCH] 库位规则

---
 src/main/webapp/views/locRule/locRule.html                     |    8 ++++----
 src/main/java/com/zy/asrs/service/impl/LocMastServiceImpl.java |    5 +++++
 src/main/webapp/static/js/locRule/locRule.js                   |    2 +-
 src/main/java/com/zy/asrs/controller/LocRuleController.java    |   13 ++++++++++++-
 src/main/resources/mapper/LocMastMapper.xml                    |    7 +++++++
 src/main/java/com/zy/asrs/mapper/LocMastMapper.java            |    2 ++
 src/main/java/com/zy/asrs/service/LocMastService.java          |    2 ++
 7 files changed, 33 insertions(+), 6 deletions(-)

diff --git a/src/main/java/com/zy/asrs/controller/LocRuleController.java b/src/main/java/com/zy/asrs/controller/LocRuleController.java
index 93cc9fc..017f75b 100644
--- a/src/main/java/com/zy/asrs/controller/LocRuleController.java
+++ b/src/main/java/com/zy/asrs/controller/LocRuleController.java
@@ -10,6 +10,7 @@
 import com.core.common.DateUtils;
 import com.core.common.R;
 import com.zy.asrs.entity.LocRule;
+import com.zy.asrs.service.LocMastService;
 import com.zy.asrs.service.LocRuleService;
 import com.zy.common.web.BaseController;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -22,6 +23,8 @@
 
     @Autowired
     private LocRuleService locRuleService;
+    @Autowired
+    private LocMastService locMastService;
 
     @RequestMapping(value = "/locRule/{id}/auth")
     @ManagerAuth
@@ -76,11 +79,14 @@
         locRule.setCreateTime(now);
         locRule.setUpdateBy(getUserId());
         locRule.setUpdateTime(now);
+        Integer locType2 = 1;//鍗曞搧鍖哄煙
         if (locRule.getMixed() == 1) {
             //娣疯浇
             locRule.setMatnr("00000000");
+            locType2 = 2;//娣锋斁鍖哄煙
         }
         locRuleService.insert(locRule);
+        locMastService.updateLocType2ByRBL(locType2, locRule.getRowBeg(), locRule.getRowEnd(), locRule.getBayBeg(), locRule.getBayEnd(), locRule.getLevBeg(), locRule.getLevEnd());
         return R.ok();
     }
 
@@ -102,11 +108,14 @@
         locRule.setUpdateBy(getUserId());
         locRule.setUpdateTime(new Date());
         locRuleService.updateById(locRule);
+        Integer locType2 = 1;//鍗曞搧鍖哄煙
         if (locRule.getMixed() == 0) {
             locRuleService.updateKeepGoByMatnr(locRule.getMatnr(), locRule.getKeepGo());
         }else {//娣疯浇
             locRuleService.updateKeepGoByMixed(locRule.getKeepGo());
+            locType2 = 2;//娣锋斁鍖哄煙
         }
+        locMastService.updateLocType2ByRBL(locType2, locRule.getRowBeg(), locRule.getRowEnd(), locRule.getBayBeg(), locRule.getBayEnd(), locRule.getLevBeg(), locRule.getLevEnd());
         return R.ok();
     }
 
@@ -114,7 +123,9 @@
     @ManagerAuth
     public R delete(@RequestParam(value="ids[]") Long[] ids){
          for (Long id : ids){
-            locRuleService.deleteById(id);
+             LocRule locRule = locRuleService.selectById(id);
+             locMastService.updateLocType2ByRBL(1, locRule.getRowBeg(), locRule.getRowEnd(), locRule.getBayBeg(), locRule.getBayEnd(), locRule.getLevBeg(), locRule.getLevEnd());
+             locRuleService.deleteById(id);
         }
         return R.ok();
     }
diff --git a/src/main/java/com/zy/asrs/mapper/LocMastMapper.java b/src/main/java/com/zy/asrs/mapper/LocMastMapper.java
index 2a59f36..d153b29 100644
--- a/src/main/java/com/zy/asrs/mapper/LocMastMapper.java
+++ b/src/main/java/com/zy/asrs/mapper/LocMastMapper.java
@@ -37,4 +37,6 @@
 
     List<LocMast> selectEmptyByLocNos(@Param("locNos") List<String> locNos);
 
+    Integer updateLocType2ByRBL(Integer locType2, Integer startRow, Integer endRow, Integer startBay, Integer endBay, Integer startLev, Integer endLev);
+
 }
diff --git a/src/main/java/com/zy/asrs/service/LocMastService.java b/src/main/java/com/zy/asrs/service/LocMastService.java
index 8d27adf..346571f 100644
--- a/src/main/java/com/zy/asrs/service/LocMastService.java
+++ b/src/main/java/com/zy/asrs/service/LocMastService.java
@@ -65,4 +65,6 @@
 
     List<LocMast> selectEmptyByLocNos(List<String> locNos);
 
+    Integer updateLocType2ByRBL(Integer locType2, Integer startRow, Integer endRow, Integer startBay, Integer endBay, Integer startLev, Integer endLev);
+
 }
diff --git a/src/main/java/com/zy/asrs/service/impl/LocMastServiceImpl.java b/src/main/java/com/zy/asrs/service/impl/LocMastServiceImpl.java
index b63a392..8c4fc7e 100644
--- a/src/main/java/com/zy/asrs/service/impl/LocMastServiceImpl.java
+++ b/src/main/java/com/zy/asrs/service/impl/LocMastServiceImpl.java
@@ -189,4 +189,9 @@
     public List<LocMast> selectEmptyByLocNos(List<String> locNos) {
         return this.baseMapper.selectEmptyByLocNos(locNos);
     }
+
+    @Override
+    public Integer updateLocType2ByRBL(Integer locType2, Integer startRow, Integer endRow, Integer startBay, Integer endBay, Integer startLev, Integer endLev) {
+        return this.baseMapper.updateLocType2ByRBL(locType2, startRow, endRow, startBay, endBay, startLev, endLev);
+    }
 }
diff --git a/src/main/resources/mapper/LocMastMapper.xml b/src/main/resources/mapper/LocMastMapper.xml
index 03f0729..552b136 100644
--- a/src/main/resources/mapper/LocMastMapper.xml
+++ b/src/main/resources/mapper/LocMastMapper.xml
@@ -197,4 +197,11 @@
         ORDER BY
         row1 ASC
     </select>
+
+    <select id="updateLocType2ByRBL" resultMap="BaseResultMap">
+        update asr_loc_mast set loc_type2 = #{locType2}
+        where (row1 &gt;= #{startRow} and row1 &lt;= #{endRow})
+        and (bay1 &gt;= #{startBay} and bay1 &lt;= #{endBay})
+        and (lev1 &gt;= #{startLev} and lev1 &lt;= #{endLev})
+    </select>
 </mapper>
diff --git a/src/main/webapp/static/js/locRule/locRule.js b/src/main/webapp/static/js/locRule/locRule.js
index 9f720b3..62df390 100644
--- a/src/main/webapp/static/js/locRule/locRule.js
+++ b/src/main/webapp/static/js/locRule/locRule.js
@@ -43,7 +43,7 @@
             ,{field: 'updateTime$', align: 'center',title: '淇敼鏃堕棿', hide: true}
             ,{field: 'memo', align: 'center',title: '澶囨敞', hide: true}
             ,{field: 'mixed$', align: 'center',title: '娣疯浇'}
-            ,{field: 'keepGo$', align: 'center',title: '缁х画鎼滅储'}
+            // ,{field: 'keepGo$', align: 'center',title: '缁х画鎼滅储'}
 
             ,{fixed: 'right', title:'鎿嶄綔', align: 'center', toolbar: '#operate', width:120}
         ]],
diff --git a/src/main/webapp/views/locRule/locRule.html b/src/main/webapp/views/locRule/locRule.html
index 40ed422..326cb19 100644
--- a/src/main/webapp/views/locRule/locRule.html
+++ b/src/main/webapp/views/locRule/locRule.html
@@ -118,12 +118,12 @@
                     <label class="layui-form-label">娣疯浇: </label>
                     <div class="layui-input-block">
                         <select name="mixed">
-                            <option value="1">鏄�</option>
-                            <option value="0" selected>鍚�</option>
+                            <option value="1" selected>鏄�</option>
+                            <option value="0">鍚�</option>
                         </select>
                     </div>
                 </div>
-                <div class="layui-form-item">
+<!--                <div class="layui-form-item">
                     <label class="layui-form-label">娣疯浇鏈壘鍒板簱浣嶇户缁悳绱�: </label>
                     <div class="layui-input-block">
                         <select name="keepGo">
@@ -131,7 +131,7 @@
                             <option value="0" selected>鍚�</option>
                         </select>
                     </div>
-                </div>
+                </div>-->
 
              </div>
 

--
Gitblit v1.9.1