From fd1bfa1163d438ec6cabfdd6e01e632d31189c80 Mon Sep 17 00:00:00 2001
From: Junjie <fallin.jie@qq.com>
Date: 星期五, 12 五月 2023 12:34:10 +0800
Subject: [PATCH] 库位规则、混载库位
---
src/main/java/com/zy/asrs/service/impl/LocRuleServiceImpl.java | 62 +++++++++++++++++++++----------
1 files changed, 42 insertions(+), 20 deletions(-)
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 4e01f89..79ab983 100644
--- a/src/main/java/com/zy/asrs/service/impl/LocRuleServiceImpl.java
+++ b/src/main/java/com/zy/asrs/service/impl/LocRuleServiceImpl.java
@@ -2,23 +2,31 @@
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.core.common.Cools;
+import com.zy.asrs.entity.LocMast;
import com.zy.asrs.entity.Mat;
import com.zy.asrs.mapper.LocRuleMapper;
import com.zy.asrs.entity.LocRule;
+import com.zy.asrs.service.LocMastService;
import com.zy.asrs.service.LocRuleService;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.zy.asrs.service.MatService;
+import com.zy.asrs.utils.Utils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
+
+import java.util.ArrayList;
+import java.util.List;
@Service("locRuleService")
public class LocRuleServiceImpl extends ServiceImpl<LocRuleMapper, LocRule> implements LocRuleService {
@Autowired
private MatService matService;
+ @Autowired
+ private LocMastService locMastService;
@Override
- public LocRule find(String matnr, String batch, int startRow, int endRow) {
+ public LocRule find(String matnr) {
if (Cools.isEmpty(matnr)) {
return null;
}
@@ -26,25 +34,39 @@
if (Cools.isEmpty(mat)) {
return null;
}
- LocRule locRule = null;
- do {
- locRule = this.selectOne(new EntityWrapper<LocRule>().eq("matnr", matnr).ge("row_beg", startRow).le("row_end", endRow).eq("status", 1));
- if (null != locRule) {
- break;
+
+ return this.baseMapper.selectByMatnr(matnr);
+ }
+
+ //鎵炬贩杞藉簱浣嶈鍒�
+ @Override
+ public 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();
+
+ Integer bayBeg = locRule.getBayBeg();
+ Integer bayEnd = locRule.getBayEnd();
+
+ 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);
+ }
}
- locRule = this.selectOne(new EntityWrapper<LocRule>().eq("specs", mat.getSpecs()).ge("row_beg", startRow).le("row_end", endRow).eq("status", 1));
- if (null != locRule) {
- break;
- }
- locRule = this.selectOne(new EntityWrapper<LocRule>().eq("model", mat.getModel()).ge("row_beg", startRow).le("row_end", endRow).eq("status", 1));
- if (null != locRule) {
- break;
- }
- locRule = this.selectOne(new EntityWrapper<LocRule>().eq("batch", batch).ge("row_beg", startRow).le("row_end", endRow).eq("status", 1));
- if (null != locRule) {
- break;
- }
- } while (false);
- return locRule;
+ }
+
+ return locMastService.selectEmptyByLocNos(locNos);
}
}
--
Gitblit v1.9.1