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 ++++++++++++++++++++++++++++++++++++++
 src/main/webapp/static/js/locRule/locRule.js                   |    2 +-
 src/main/java/com/zy/asrs/service/LocRuleService.java          |    2 ++
 src/main/java/com/zy/common/service/CommonService.java         |    2 ++
 4 files changed, 43 insertions(+), 1 deletions(-)

diff --git a/src/main/java/com/zy/asrs/service/LocRuleService.java b/src/main/java/com/zy/asrs/service/LocRuleService.java
index 57c7fb7..3b669e8 100644
--- a/src/main/java/com/zy/asrs/service/LocRuleService.java
+++ b/src/main/java/com/zy/asrs/service/LocRuleService.java
@@ -5,4 +5,6 @@
 
 public interface LocRuleService extends IService<LocRule> {
 
+    LocRule find(String matnr, String batch);
+
 }
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;
+    }
 }
diff --git a/src/main/java/com/zy/common/service/CommonService.java b/src/main/java/com/zy/common/service/CommonService.java
index 74c5e4b..fb8428b 100644
--- a/src/main/java/com/zy/common/service/CommonService.java
+++ b/src/main/java/com/zy/common/service/CommonService.java
@@ -57,6 +57,8 @@
     private SlaveProperties slaveProperties;
     @Autowired
     private MatService matService;
+    @Autowired
+    private LocRuleService locRuleService;
 
     /**
      * 鐢熸垚宸ヤ綔鍙�
diff --git a/src/main/webapp/static/js/locRule/locRule.js b/src/main/webapp/static/js/locRule/locRule.js
index 1601d01..6234b7e 100644
--- a/src/main/webapp/static/js/locRule/locRule.js
+++ b/src/main/webapp/static/js/locRule/locRule.js
@@ -28,7 +28,7 @@
             ,{field: 'model', align: 'center',title: '鍨嬪彿'}
             ,{field: 'cstmr', align: 'center',title: '瀹㈡埛'}
             ,{field: 'batch', align: 'center',title: '鎵瑰彿'}
-            ,{field: 'other', align: 'center',title: '鍏朵粬'}
+            ,{field: 'other', align: 'center',title: '鍏朵粬', hide: true}
             ,{field: 'rowBeg', align: 'center',title: '寮�濮嬫帓'}
             ,{field: 'rowEnd', align: 'center',title: '缁撴潫鎺�'}
             ,{field: 'bayBeg', align: 'center',title: '寮�濮嬪垪'}

--
Gitblit v1.9.1