From df65c19219670915339b6f7c1505ff1acb1159d2 Mon Sep 17 00:00:00 2001
From: luxiaotao1123 <t1341870251@63.com>
Date: 星期日, 29 一月 2023 13:07:44 +0800
Subject: [PATCH] #

---
 src/main/java/com/zy/asrs/service/impl/LocRuleServiceImpl.java |   38 ++++++++++++++++++++++++++++++++++++++
 1 files changed, 38 insertions(+), 0 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 e762d17..0c3f3ef 100644
--- a/src/main/java/com/zy/asrs/service/impl/LocRuleServiceImpl.java
+++ b/src/main/java/com/zy/asrs/service/impl/LocRuleServiceImpl.java
@@ -1,12 +1,50 @@
 package com.zy.asrs.service.impl;
 
+import com.baomidou.mybatisplus.mapper.EntityWrapper;
+import com.core.common.Cools;
+import com.zy.asrs.entity.Mat;
 import com.zy.asrs.mapper.LocRuleMapper;
 import com.zy.asrs.entity.LocRule;
 import com.zy.asrs.service.LocRuleService;
 import com.baomidou.mybatisplus.service.impl.ServiceImpl;
+import com.zy.asrs.service.MatService;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
 @Service("locRuleService")
 public class LocRuleServiceImpl extends ServiceImpl<LocRuleMapper, LocRule> implements LocRuleService {
 
+    @Autowired
+    private MatService matService;
+
+    @Override
+    public LocRule find(String matnr, String batch) {
+        if (Cools.isEmpty(matnr)) {
+            return null;
+        }
+        Mat mat = matService.selectByMatnr(matnr);
+        if (Cools.isEmpty(mat)) {
+            return null;
+        }
+        LocRule locRule = null;
+        do {
+            locRule = this.selectOne(new EntityWrapper<LocRule>().eq("matnr", matnr).eq("status", 1));
+            if (null != locRule) {
+                break;
+            }
+            locRule = this.selectOne(new EntityWrapper<LocRule>().eq("specs", mat.getSpecs()).eq("status", 1));
+            if (null != locRule) {
+                break;
+            }
+            locRule = this.selectOne(new EntityWrapper<LocRule>().eq("model", mat.getModel()).eq("status", 1));
+            if (null != locRule) {
+                break;
+            }
+            locRule = this.selectOne(new EntityWrapper<LocRule>().eq("batch", batch).eq("status", 1));
+            if (null != locRule) {
+                break;
+            }
+        } while (false);
+        return locRule;
+    }
 }

--
Gitblit v1.9.1