From 617a8c4fc0b81ec4b96db8a013a91f4e666b0b96 Mon Sep 17 00:00:00 2001
From: zhangc <zc@123>
Date: 星期三, 08 一月 2025 14:33:45 +0800
Subject: [PATCH] 出现空指针异常

---
 src/main/java/com/zy/asrs/service/impl/LocRuleServiceImpl.java |   82 +++++++++++++++++++++++++++++-----------
 1 files changed, 59 insertions(+), 23 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..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,24 +1,32 @@
 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.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 List<LocRule> find(String matnr) {
         if (Cools.isEmpty(matnr)) {
             return null;
         }
@@ -26,25 +34,53 @@
         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;
-            }
-            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 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 List<LocRule> findMixed() {
+        return this.baseMapper.selectByMixed(1);//鎼滅储娣疯浇搴撲綅瑙勫垯
+    }
+
+    //灏嗗簱浣嶈鍒欒浆鎹负搴撲綅缁�(鑳芥煡鍑烘潵鐨勯兘鏄┖搴撲綅)
+    @Override
+    public List<LocMast> locRuleToLocNos(LocRule locRule) {
+        return locMastService.queryFreeLocMast2(null, locRule.getRowBeg(), locRule.getRowEnd(), locRule.getBayBeg(), locRule.getBayEnd(), locRule.getLevBeg(), locRule.getLevEnd());
+    }
+
+    @Override
+    public int updateKeepGoByMatnr(String matnr, Integer keepGo) {
+        return this.baseMapper.updateKeepGoByMatnr(matnr, keepGo);
+    }
+
+    @Override
+    public int updateKeepGoByMixed(Integer keepGo) {
+        return this.baseMapper.updateKeepGoByMixed(keepGo);
     }
 }

--
Gitblit v1.9.1