From c65db22f67af8018ae7105ea00d8743e42835e13 Mon Sep 17 00:00:00 2001
From: ZY <zc857179121@qq.com>
Date: 星期六, 29 三月 2025 15:52:09 +0800
Subject: [PATCH] 1

---
 src/main/java/com/zy/asrs/service/impl/LocRuleServiceImpl.java |   64 +++++++++++++++++++------------
 1 files changed, 39 insertions(+), 25 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 79ab983..48d8271 100644
--- a/src/main/java/com/zy/asrs/service/impl/LocRuleServiceImpl.java
+++ b/src/main/java/com/zy/asrs/service/impl/LocRuleServiceImpl.java
@@ -1,20 +1,20 @@
 package com.zy.asrs.service.impl;
 
 import com.baomidou.mybatisplus.mapper.EntityWrapper;
+import com.baomidou.mybatisplus.mapper.Wrapper;
+import com.baomidou.mybatisplus.service.impl.ServiceImpl;
 import com.core.common.Cools;
 import com.zy.asrs.entity.LocMast;
+import com.zy.asrs.entity.LocRule;
 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")
@@ -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;
         }
@@ -38,35 +38,49 @@
         return this.baseMapper.selectByMatnr(matnr);
     }
 
+    @Override
+    public List<LocRule> findCode(String matnr,String other) {
+        if (Cools.isEmpty(matnr)) {
+            return null;
+        }
+        Mat mat = matService.selectByMatnr(matnr);
+        if (Cools.isEmpty(mat)) {
+            return null;
+        }
+        if(Cools.isEmpty(mat.getBrand())){
+            return null;
+        }
+
+        Wrapper<LocRule> wrapper = new EntityWrapper<LocRule>()
+                .eq("matnr",mat.getBrand().substring(0,4))
+                .eq("mixed",0)
+                .eq("status",1);
+
+        Utils.wapperSetCondition(wrapper,"other",other);
+
+        return this.selectList(wrapper);
+
+    }
+
     //鎵炬贩杞藉簱浣嶈鍒�
     @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);
     }
 }

--
Gitblit v1.9.1