From 8c3714822ea0223ae42bd5c08dbbc872fffee9d5 Mon Sep 17 00:00:00 2001
From: Junjie <fallin.jie@qq.com>
Date: 星期六, 13 五月 2023 13:06:53 +0800
Subject: [PATCH] 库位规则
---
src/main/webapp/views/locRule/locRule.html | 48 ++++++------
src/main/java/com/zy/asrs/service/impl/LocMastServiceImpl.java | 2
src/main/java/com/zy/asrs/service/impl/LocRuleServiceImpl.java | 34 +++-----
src/main/webapp/static/js/locRule/locRule.js | 8 +-
src/main/java/com/zy/asrs/controller/LocRuleController.java | 9 ++
src/main/java/com/zy/asrs/mapper/LocRuleMapper.java | 8 +
src/main/java/com/zy/asrs/service/LocRuleService.java | 8 +
src/main/resources/mapper/LocRuleMapper.xml | 10 ++
src/main/java/com/zy/common/service/CommonService.java | 73 +++++++++++-------
9 files changed, 115 insertions(+), 85 deletions(-)
diff --git a/src/main/java/com/zy/asrs/controller/LocRuleController.java b/src/main/java/com/zy/asrs/controller/LocRuleController.java
index e06e445..93cc9fc 100644
--- a/src/main/java/com/zy/asrs/controller/LocRuleController.java
+++ b/src/main/java/com/zy/asrs/controller/LocRuleController.java
@@ -76,6 +76,10 @@
locRule.setCreateTime(now);
locRule.setUpdateBy(getUserId());
locRule.setUpdateTime(now);
+ if (locRule.getMixed() == 1) {
+ //娣疯浇
+ locRule.setMatnr("00000000");
+ }
locRuleService.insert(locRule);
return R.ok();
}
@@ -98,6 +102,11 @@
locRule.setUpdateBy(getUserId());
locRule.setUpdateTime(new Date());
locRuleService.updateById(locRule);
+ if (locRule.getMixed() == 0) {
+ locRuleService.updateKeepGoByMatnr(locRule.getMatnr(), locRule.getKeepGo());
+ }else {//娣疯浇
+ locRuleService.updateKeepGoByMixed(locRule.getKeepGo());
+ }
return R.ok();
}
diff --git a/src/main/java/com/zy/asrs/mapper/LocRuleMapper.java b/src/main/java/com/zy/asrs/mapper/LocRuleMapper.java
index fe8dd2a..3786ba8 100644
--- a/src/main/java/com/zy/asrs/mapper/LocRuleMapper.java
+++ b/src/main/java/com/zy/asrs/mapper/LocRuleMapper.java
@@ -11,8 +11,12 @@
@Repository
public interface LocRuleMapper extends BaseMapper<LocRule> {
- LocRule selectByMatnr(String matnr);
+ List<LocRule> selectByMatnr(String matnr);
- LocRule selectByMixed(Integer mixed);
+ List<LocRule> selectByMixed(Integer mixed);
+
+ int updateKeepGoByMatnr(String matnr, Integer keepGo);
+
+ int updateKeepGoByMixed(Integer keepGo);
}
diff --git a/src/main/java/com/zy/asrs/service/LocRuleService.java b/src/main/java/com/zy/asrs/service/LocRuleService.java
index f793151..521df50 100644
--- a/src/main/java/com/zy/asrs/service/LocRuleService.java
+++ b/src/main/java/com/zy/asrs/service/LocRuleService.java
@@ -8,12 +8,16 @@
public interface LocRuleService extends IService<LocRule> {
- LocRule find(String matnr);
+ List<LocRule> find(String matnr);
//鎵炬贩杞藉簱浣嶈鍒�
- LocRule findMixed();
+ List<LocRule> findMixed();
//灏嗗簱浣嶈鍒欑粍杞崲涓哄簱浣嶇粍
List<LocMast> locRuleToLocNos(LocRule locRule);
+ int updateKeepGoByMatnr(String matnr, Integer keepGo);
+
+ int updateKeepGoByMixed(Integer keepGo);
+
}
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 583e3b1..b63a392 100644
--- a/src/main/java/com/zy/asrs/service/impl/LocMastServiceImpl.java
+++ b/src/main/java/com/zy/asrs/service/impl/LocMastServiceImpl.java
@@ -84,7 +84,7 @@
int row = Utils.getRow(locNo);
List<String> locNos = Utils.getGroupLoc(locNo);
if (CommonService.FIRST_GROUP_ROW_LIST.contains(row)) {
- } else if (CommonService.SECOND_GROUP_ROW_LIST.contains(row)) {
+ } else if (CommonService.SECOND_GROUP_ROW_LIST.contains(row) || CommonService.THIRD_GROUP_ROW_LIST.contains(row)) {
Collections.reverse(locNos);
} else {
throw new RuntimeException("搴撲綅瑙f瀽寮傚父");
diff --git a/src/main/java/com/zy/asrs/service/impl/LocRuleServiceImpl.java b/src/main/java/com/zy/asrs/service/impl/LocRuleServiceImpl.java
index 79ab983..213c542 100644
--- a/src/main/java/com/zy/asrs/service/impl/LocRuleServiceImpl.java
+++ b/src/main/java/com/zy/asrs/service/impl/LocRuleServiceImpl.java
@@ -26,7 +26,7 @@
private LocMastService locMastService;
@Override
- public LocRule find(String matnr) {
+ public List<LocRule> find(String matnr) {
if (Cools.isEmpty(matnr)) {
return null;
}
@@ -40,33 +40,23 @@
//鎵炬贩杞藉簱浣嶈鍒�
@Override
- public LocRule findMixed() {
+ public List<LocRule> findMixed() {
return this.baseMapper.selectByMixed(1);//鎼滅储娣疯浇搴撲綅瑙勫垯
}
- //灏嗗簱浣嶈鍒欒浆鎹负搴撲綅缁�
+ //灏嗗簱浣嶈鍒欒浆鎹负搴撲綅缁�(鑳芥煡鍑烘潵鐨勯兘鏄┖搴撲綅)
@Override
public List<LocMast> locRuleToLocNos(LocRule locRule) {
- ArrayList<String> locNos = new ArrayList<>();
- //灏嗘墍鏈夌鍚堟贩杞借鍒欑殑搴撲綅鍙疯繘琛屽瓨鍌�
- Integer rowBeg = locRule.getRowBeg();
- Integer rowEnd = locRule.getRowEnd();
+ return locMastService.queryFreeLocMast2(null, locRule.getRowBeg(), locRule.getRowEnd(), locRule.getBayBeg(), locRule.getBayEnd(), locRule.getLevBeg(), locRule.getLevEnd());
+ }
- Integer bayBeg = locRule.getBayBeg();
- Integer bayEnd = locRule.getBayEnd();
+ @Override
+ public int updateKeepGoByMatnr(String matnr, Integer keepGo) {
+ return this.baseMapper.updateKeepGoByMatnr(matnr, keepGo);
+ }
- Integer levBeg = locRule.getLevBeg();
- Integer levEnd = locRule.getLevEnd();
-
- for (int i = rowBeg; i <= rowEnd; i++) {
- for (int j = bayBeg; j <= bayEnd; j++) {
- for (int k = levBeg; k <= levEnd; k++) {
- String locNo = Utils.getLocNo(i, j, k);
- locNos.add(locNo);
- }
- }
- }
-
- return locMastService.selectEmptyByLocNos(locNos);
+ @Override
+ public int updateKeepGoByMixed(Integer keepGo) {
+ return this.baseMapper.updateKeepGoByMixed(keepGo);
}
}
diff --git a/src/main/java/com/zy/common/service/CommonService.java b/src/main/java/com/zy/common/service/CommonService.java
index d62cd45..6afcffd 100644
--- a/src/main/java/com/zy/common/service/CommonService.java
+++ b/src/main/java/com/zy/common/service/CommonService.java
@@ -161,8 +161,6 @@
* 娣疯浇鎵惧簱浣�
*/
private LocMast getLocNoStep1(List<String> matNos, LocTypeDto locTypeDto) {
- LocMast locMast = null;
-
//鍒ゆ柇褰撳墠璐х墿鏄惁涓烘贩杞借揣鐗�
String firstMatNos = matNos.get(0);
boolean mixed = false;//榛樿涓嶆槸娣疯浇璐х墿
@@ -174,41 +172,44 @@
}
if (!mixed) {
- return locMast;//涓嶆槸娣疯浇璐х墿锛岀洿鎺ヨ烦鍑哄綋鍓嶄换鍔�
+ return null;//涓嶆槸娣疯浇璐х墿锛岀洿鎺ヨ烦鍑哄綋鍓嶄换鍔�
}
// 鎵炬贩杞藉簱浣嶈鍒�
- LocRule locRule = locRuleService.findMixed();
- if (locRule == null) {
- return locMast;//娌℃湁娣疯浇瑙勫垯锛岃烦鍑哄綋鍓嶄换鍔�
+ List<LocRule> locRules = locRuleService.findMixed();
+ if (locRules == null || locRules.size() == 0) {
+ return null;//娌℃湁娣疯浇瑙勫垯锛岃烦鍑哄綋鍓嶄换鍔�
}
- //灏嗗簱浣嶈鍒欑粍杞崲涓哄簱浣嶇粍
- List<LocMast> locMasts = locRuleService.locRuleToLocNos(locRule);
- if (locMasts == null || locMasts.size() == 0) {
- if (locRule.getKeepGo() == 0) {
- //鎵句笉鍒扮┖搴撲綅锛屼笖绂佹缁х画瀵绘壘鍏朵粬闈炴贩杞藉尯鍩熷簱浣�
- //鎵句笉鍒板簱浣嶏紝鎶涘嚭寮傚父
- throw new CoolException("娣疯浇鍖哄煙娌℃湁绌哄簱浣�");
+ for (LocRule locRule : locRules) {
+ if (locRule == null) {
+ continue;
}
- return locMast;//娌℃湁娣疯浇瑙勫垯锛岃烦鍑哄綋鍓嶄换鍔�
- }
- for (LocMast one : locMasts) {
- LocMast locMast0 = locMastService.findOutMost(one.getLocNo());
- if (null != locMast0) {
- // 娴呭簱浣嶇鍚堝昂瀵告娴�
- if (VersionUtils.locMoveCheckLocType(locMast0, locTypeDto)) {
- // 鍥犲簱浣嶇Щ杞�侀渶棰勭暀绌哄簱浣�
- if (locMastService.checkEmptyCount(locMast0, 10)) {
- locMast = locMast0;
- break;
+ List<LocMast> locMasts = locMastService.queryFreeLocMast2(locTypeDto.getLocType1(), locRule.getRowBeg(), locRule.getRowEnd(), locRule.getBayBeg(), locRule.getBayEnd(), locRule.getLevBeg(), locRule.getLevEnd());
+
+ for (LocMast one : locMasts) {
+ LocMast locMast0 = locMastService.findOutMost(one.getLocNo());
+ if (null != locMast0) {
+ // 娴呭簱浣嶇鍚堝昂瀵告娴�
+ if (VersionUtils.locMoveCheckLocType(locMast0, locTypeDto)) {
+ // 鍥犲簱浣嶇Щ杞�侀渶棰勭暀绌哄簱浣�
+ if (locMastService.checkEmptyCount(locMast0, 10)) {
+ return locMast0;//鎵惧埌绌轰綑鐨勬贩杞藉簱浣�
+ }
}
}
}
+
}
- return locMast;
+ if (locRules.get(0).getKeepGo() == 0) {
+ //鎵句笉鍒扮┖搴撲綅锛屼笖绂佹缁х画瀵绘壘鍏朵粬闈炴贩杞藉尯鍩熷簱浣�
+ //鎵句笉鍒板簱浣嶏紝鎶涘嚭寮傚父
+ throw new CoolException("娣疯浇鍖哄煙娌℃湁绌哄簱浣�");
+ }
+
+ return null;
}
/**
@@ -217,8 +218,16 @@
private LocMast getLocNoStep2(List<String> matNos, LocTypeDto locTypeDto) {
LocMast locMast = null;
// 搴撳尯閿佸畾
- LocRule locRule = locRuleService.find(Cools.isEmpty(matNos) ? null : matNos.get(0));
- if (!Cools.isEmpty(locRule)) {
+ List<LocRule> locRules = locRuleService.find(Cools.isEmpty(matNos) ? null : matNos.get(0));
+ if (locRules == null || locRules.size() == 0) {
+ return null;//娌℃湁搴撲綅瑙勫垯锛岃烦鍑哄綋鍓嶄换鍔�
+ }
+
+ for (LocRule locRule : locRules) {
+ if (locRule == null) {
+ continue;
+ }
+
List<LocMast> locMasts = locMastService.queryFreeLocMast2(locTypeDto.getLocType1(), locRule.getRowBeg(), locRule.getRowEnd(), locRule.getBayBeg(), locRule.getBayEnd(), locRule.getLevBeg(), locRule.getLevEnd());
for (LocMast one : locMasts) {
LocMast locMast0 = locMastService.findOutMost(one.getLocNo());
@@ -227,13 +236,19 @@
if (VersionUtils.locMoveCheckLocType(locMast0, locTypeDto)) {
// 鍥犲簱浣嶇Щ杞�侀渶棰勭暀绌哄簱浣�
if (locMastService.checkEmptyCount(locMast0, 10)) {
- locMast = locMast0;
- break;
+ return locMast0;
}
}
}
}
}
+
+ if (locRules.get(0).getKeepGo() == 0) {
+ //鎵句笉鍒扮┖搴撲綅锛屼笖绂佹缁х画瀵绘壘鍏朵粬闈炴贩杞藉尯鍩熷簱浣�
+ //鎵句笉鍒板簱浣嶏紝鎶涘嚭寮傚父
+ throw new CoolException("瑙勫垯鍖哄煙娌℃湁绌哄簱浣�");
+ }
+
return locMast;
}
diff --git a/src/main/resources/mapper/LocRuleMapper.xml b/src/main/resources/mapper/LocRuleMapper.xml
index 781ad78..5a1f5bb 100644
--- a/src/main/resources/mapper/LocRuleMapper.xml
+++ b/src/main/resources/mapper/LocRuleMapper.xml
@@ -37,9 +37,17 @@
</select>
<select id="selectByMixed" resultMap="BaseResultMap">
- select top 1 * from asr_loc_rule
+ select * from asr_loc_rule
where mixed = #{mixed}
and status = 1
</select>
+ <update id="updateKeepGoByMatnr">
+ update asr_loc_rule set keep_go = #{keepGo} where matnr = #{matnr}
+ </update>
+
+ <update id="updateKeepGoByMixed">
+ update asr_loc_rule set keep_go = #{keepGo} where mixed = 1
+ </update>
+
</mapper>
diff --git a/src/main/webapp/static/js/locRule/locRule.js b/src/main/webapp/static/js/locRule/locRule.js
index 0bc8de9..9f720b3 100644
--- a/src/main/webapp/static/js/locRule/locRule.js
+++ b/src/main/webapp/static/js/locRule/locRule.js
@@ -24,9 +24,9 @@
{type: 'checkbox'}
// ,{field: 'id', align: 'center',title: 'ID'}
,{field: 'matnr', align: 'center',title: '鍟嗗搧缂栧彿'}
- ,{field: 'specs', align: 'center',title: '瑙勬牸'}
- ,{field: 'model', align: 'center',title: '鍨嬪彿'}
- ,{field: 'cstmr', align: 'center',title: '瀹㈡埛'}
+ ,{field: 'specs', align: 'center',title: '瑙勬牸', hide: true}
+ ,{field: 'model', align: 'center',title: '鍨嬪彿', hide: true}
+ ,{field: 'cstmr', align: 'center',title: '瀹㈡埛', hide: true}
,{field: 'batch', align: 'center',title: '鎵瑰彿'}
,{field: 'other', align: 'center',title: '鍏朵粬', hide: true}
,{field: 'rowBeg', align: 'center',title: '寮�濮嬫帓'}
@@ -35,7 +35,7 @@
,{field: 'bayEnd', align: 'center',title: '缁撴潫鍒�'}
,{field: 'levBeg', align: 'center',title: '寮�濮嬪眰'}
,{field: 'levEnd', align: 'center',title: '缁撴潫灞�'}
- ,{field: 'limit', align: 'center',title: '涓婇檺'}
+ ,{field: 'limit', align: 'center',title: '涓婇檺', hide: true}
,{field: 'status$', align: 'center',title: '鐘舵��', hide: true}
,{field: 'createBy$', align: 'center',title: '娣诲姞浜哄憳', hide: true}
,{field: 'createTime$', align: 'center',title: '娣诲姞鏃堕棿', hide: true}
diff --git a/src/main/webapp/views/locRule/locRule.html b/src/main/webapp/views/locRule/locRule.html
index 4f24e2f..40ed422 100644
--- a/src/main/webapp/views/locRule/locRule.html
+++ b/src/main/webapp/views/locRule/locRule.html
@@ -78,24 +78,24 @@
<input class="layui-input" name="matnr" placeholder="璇疯緭鍏ュ晢鍝佺紪鍙�">
</div>
</div>
- <div class="layui-form-item">
- <label class="layui-form-label">瑙勬牸: </label>
- <div class="layui-input-block">
- <input class="layui-input" name="specs" placeholder="璇疯緭鍏ヨ鏍�">
- </div>
- </div>
- <div class="layui-form-item">
- <label class="layui-form-label">鍨嬪彿: </label>
- <div class="layui-input-block">
- <input class="layui-input" name="model" placeholder="璇疯緭鍏ュ瀷鍙�">
- </div>
- </div>
- <div class="layui-form-item">
- <label class="layui-form-label">瀹㈡埛: </label>
- <div class="layui-input-block">
- <input class="layui-input" name="cstmr" placeholder="璇疯緭鍏ュ鎴�">
- </div>
- </div>
+<!-- <div class="layui-form-item">-->
+<!-- <label class="layui-form-label">瑙勬牸: </label>-->
+<!-- <div class="layui-input-block">-->
+<!-- <input class="layui-input" name="specs" placeholder="璇疯緭鍏ヨ鏍�">-->
+<!-- </div>-->
+<!-- </div>-->
+<!-- <div class="layui-form-item">-->
+<!-- <label class="layui-form-label">鍨嬪彿: </label>-->
+<!-- <div class="layui-input-block">-->
+<!-- <input class="layui-input" name="model" placeholder="璇疯緭鍏ュ瀷鍙�">-->
+<!-- </div>-->
+<!-- </div>-->
+<!-- <div class="layui-form-item">-->
+<!-- <label class="layui-form-label">瀹㈡埛: </label>-->
+<!-- <div class="layui-input-block">-->
+<!-- <input class="layui-input" name="cstmr" placeholder="璇疯緭鍏ュ鎴�">-->
+<!-- </div>-->
+<!-- </div>-->
<div class="layui-form-item">
<label class="layui-form-label">鎵瑰彿: </label>
<div class="layui-input-block">
@@ -108,12 +108,12 @@
<!-- <input class="layui-input" name="other" placeholder="璇疯緭鍏ュ叾浠�">-->
<!-- </div>-->
<!-- </div>-->
- <div class="layui-form-item">
- <label class="layui-form-label">涓婇檺: </label>
- <div class="layui-input-block">
- <input class="layui-input" name="limit" placeholder="璇疯緭鍏ヤ笂闄�">
- </div>
- </div>
+<!-- <div class="layui-form-item">-->
+<!-- <label class="layui-form-label">涓婇檺: </label>-->
+<!-- <div class="layui-input-block">-->
+<!-- <input class="layui-input" name="limit" placeholder="璇疯緭鍏ヤ笂闄�">-->
+<!-- </div>-->
+<!-- </div>-->
<div class="layui-form-item">
<label class="layui-form-label">娣疯浇: </label>
<div class="layui-input-block">
--
Gitblit v1.9.1