From 08b4403ec8d6b69528d161cfcad80b5d64dea76c Mon Sep 17 00:00:00 2001
From: Administrator <876263681@qq.com>
Date: 星期三, 02 七月 2025 15:12:43 +0800
Subject: [PATCH] #优化库位检索

---
 src/main/webapp/static/js/locDetl/locDetl.js                         |    4 +-
 src/main/java/com/zy/system/entity/license/LicenseCheckListener.java |   12 +++++
 src/main/java/com/zy/system/entity/license/CustomKeyStoreParam.java  |    1 
 src/main/java/com/zy/system/entity/license/LicenseVerify.java        |    9 ++++
 src/main/java/com/zy/common/service/CommonService.java               |   87 ++++++++++++++++++++++++++-----------------
 src/main/resources/license.lic                                       |    0 
 src/main/resources/application.yml                                   |    2 
 7 files changed, 76 insertions(+), 39 deletions(-)

diff --git a/src/main/java/com/zy/common/service/CommonService.java b/src/main/java/com/zy/common/service/CommonService.java
index d63a9fc..19af71d 100644
--- a/src/main/java/com/zy/common/service/CommonService.java
+++ b/src/main/java/com/zy/common/service/CommonService.java
@@ -239,51 +239,70 @@
             //}
             if (Cools.isEmpty(locMast)) {
                 locMast = locMastService.queryFreeLocMast(curRow, locTypeDto.getLocType1());
+                List<LocMast> locMasts = locMastService.selectList(new EntityWrapper<LocMast>()
+                        .eq("row1", curRow)
+                        .eq("loc_sts", "O")
+                        .orderBy("lev1", true).orderBy("bay1", true));
+                for(LocMast locMast1 :locMasts){
+                    // 鐩爣搴撲綅 ===>> 娴呭簱浣嶏紝 鍒欐牎楠屽叾娣卞簱浣嶆槸鍚︿负 F D X
+                    if (null != locMast1 && Integer.parseInt(locMast1.getLocNo().substring(0, 2)) == 2) {
+                        LocMast deepLoc = locMastService.selectById(zerofill(String.valueOf(3), 2) + locMast1.getLocNo().substring(2));
+                        if (!deepLoc.getLocSts().equals("F") && !deepLoc.getLocSts().equals("D") && !deepLoc.getLocSts().equals("X") && !deepLoc.getLocSts().equals("P")) {
+                            locMast = null;
+                        }else {
+                            if (!Cools.isEmpty(locMast1)) {
+                                locMast = locMast1;
+                                break;
+                            }
+                        }
+                    }
+
+                    // 鐩爣搴撲綅 ===>> 娣卞簱浣嶏紝 鍒欐牎楠屽叾娴呭簱浣嶆槸鍚︿负 O
+                    if (null != locMast1 && Integer.parseInt(locMast1.getLocNo().substring(0, 2)) == 3) {
+                        LocMast shallowLoc = locMastService.selectById(zerofill(String.valueOf(2), 2) + locMast1.getLocNo().substring(2));
+                        if (!Cools.isEmpty(shallowLoc)) {
+                            if (!shallowLoc.getLocSts().equals("O")) {
+                                locMast = null;
+                            }else {
+                                if (!Cools.isEmpty(locMast1)) {
+                                    locMast = locMast1;
+                                    break;
+                                }
+                            }
+                        }
+                    }
+                }
                 // 鍥犲簱浣嶇Щ杞�侀渶棰勭暀绌哄簱浣�
                 if (!locMastService.checkEmptyCount(locMast)) {
                     locMast = null;
                 }
-                // 鐩爣搴撲綅 ===>> 娴呭簱浣嶏紝 鍒欐牎楠屽叾娣卞簱浣嶆槸鍚︿负 F D X
-                if (null != locMast && Integer.parseInt(locMast.getLocNo().substring(0, 2)) == 2) {
-                    LocMast deepLoc = locMastService.selectById(zerofill(String.valueOf(3), 2) + locMast.getLocNo().substring(2));
-                    if (!deepLoc.getLocSts().equals("F") && !deepLoc.getLocSts().equals("D") && !deepLoc.getLocSts().equals("X")) {
-                        locMast = null;
-                    }
-                }
-                //if (null != locMast && Utils.isShallowLoc(slaveProperties, locMast.getLocNo())) {
-                //    LocMast deepLoc = locMastService.selectById(Utils.getDeepLoc(slaveProperties, locMast.getLocNo()));
-                //    if (!deepLoc.getLocSts().equals("F") && !deepLoc.getLocSts().equals("D") && !deepLoc.getLocSts().equals("X")) {
-                //        locMast = null;
-                //    }
-                //}
-                // 鐩爣搴撲綅 ===>> 娣卞簱浣嶏紝 鍒欐牎楠屽叾娴呭簱浣嶆槸鍚︿负 O
-                if (null != locMast && Integer.parseInt(locMast.getLocNo().substring(0, 2)) == 3) {
-                    LocMast shallowLoc = locMastService.selectById(zerofill(String.valueOf(2), 2) + locMast.getLocNo().substring(2));
-                    if (!Cools.isEmpty(shallowLoc)) {
-                        if (!shallowLoc.getLocSts().equals("O")) {
-                            locMast = null;
-                        }
-                    }
-                }
-                //if (null != locMast && Utils.isDeepLoc(slaveProperties, locMast.getLocNo())) {
-                //    LocMast shallowLoc = locMastService.selectById(Utils.getShallowLoc(slaveProperties, locMast.getLocNo()));
-                //    if (!Cools.isEmpty(shallowLoc)) {
-                //        if (!shallowLoc.getLocSts().equals("O")) {
-                //            locMast = null;
-                //        }
-                //    }
-                //
-                //
-                //}
+//                // 鐩爣搴撲綅 ===>> 娴呭簱浣嶏紝 鍒欐牎楠屽叾娣卞簱浣嶆槸鍚︿负 F D X
+//                if (null != locMast && Integer.parseInt(locMast.getLocNo().substring(0, 2)) == 2) {
+//                    LocMast deepLoc = locMastService.selectById(zerofill(String.valueOf(3), 2) + locMast.getLocNo().substring(2));
+//                    if (!deepLoc.getLocSts().equals("F") && !deepLoc.getLocSts().equals("D") && !deepLoc.getLocSts().equals("X") && !deepLoc.getLocSts().equals("P")) {
+//                        locMast = null;
+//                    }
+//                }
+//
+//                // 鐩爣搴撲綅 ===>> 娣卞簱浣嶏紝 鍒欐牎楠屽叾娴呭簱浣嶆槸鍚︿负 O
+//                if (null != locMast && Integer.parseInt(locMast.getLocNo().substring(0, 2)) == 3) {
+//                    LocMast shallowLoc = locMastService.selectById(zerofill(String.valueOf(2), 2) + locMast.getLocNo().substring(2));
+//                    if (!Cools.isEmpty(shallowLoc)) {
+//                        if (!shallowLoc.getLocSts().equals("O")) {
+//                            locMast = null;
+//                        }
+//                    }
+//                }
+
             }
         }
 
         // 2.搴撲綅褰撳墠鎵�灞炲昂瀵告棤绌哄簱浣嶆椂锛岃皟鏁村昂瀵稿弬鏁帮紝鍚戜笂鍏煎妫�绱㈠簱浣�
         if (Cools.isEmpty(locMast)) {
             // 褰撳墠宸烽亾鏃犵┖搴撲綅鏃讹紝閫掑綊璋冩暣鑷充笅涓�宸烽亾锛屾绱㈠叏閮ㄥ贩閬撴棤鏋滃悗锛岃烦鍑洪�掑綊
-            if (times < rowCount) {
+            if (times < 4) {
                 times = times + 1;
-                if(locTypeDto.getLocType1() == 1 && times == 3){
+                if(locTypeDto.getLocType1() == 1 && times == 2){
                     locTypeDto.setLocType1((short) 2);
                 }
                 return getLocNo(1, staDescId, sourceStaNo, matNos, locTypeDto, times);
diff --git a/src/main/java/com/zy/system/entity/license/CustomKeyStoreParam.java b/src/main/java/com/zy/system/entity/license/CustomKeyStoreParam.java
index 3d4e4b9..014d534 100644
--- a/src/main/java/com/zy/system/entity/license/CustomKeyStoreParam.java
+++ b/src/main/java/com/zy/system/entity/license/CustomKeyStoreParam.java
@@ -47,6 +47,7 @@
      */
     @Override
     public InputStream getStream() throws IOException {
+//        final InputStream in = this.getClass().getClassLoader().getResourceAsStream(storePath);
         final InputStream in = new FileInputStream(new File(storePath));
         if (null == in) {
             throw new FileNotFoundException(storePath);
diff --git a/src/main/java/com/zy/system/entity/license/LicenseCheckListener.java b/src/main/java/com/zy/system/entity/license/LicenseCheckListener.java
index 1659df2..7c7077c 100644
--- a/src/main/java/com/zy/system/entity/license/LicenseCheckListener.java
+++ b/src/main/java/com/zy/system/entity/license/LicenseCheckListener.java
@@ -76,13 +76,23 @@
                 param.setStorePass(storePass);
                 param.setLicensePath(licensePathFile.getPath());
                 param.setPublicKeysStorePath(publicKeysStoreFile.getPath());
+//                param.setLicensePath(licensePath);
+//                param.setPublicKeysStorePath(publicKeysStorePath);
 
                 LicenseVerify licenseVerify = new LicenseVerify();
                 //瀹夎璇佷功
                 LicenseContent install = licenseVerify.install(param);
 
                 logger.info("++++++++ 璁稿彲璇佸姞杞界粨鏉� ++++++++");
-
+//                if(install != null){
+//                    Date start = new Date();
+//                    Date end = install.getNotAfter();
+//                    Long starTime = start.getTime();
+//                    Long endTime = end.getTime();
+//                    Long num = endTime - starTime;//鏃堕棿鎴崇浉宸殑姣鏁�
+//                    int day = (int) (num / 24 / 60 / 60 / 1000);
+//                    licenseTimer.setLicenseDays(day);
+//                }
                 return install != null;
             } catch (Exception e) {
                 return false;
diff --git a/src/main/java/com/zy/system/entity/license/LicenseVerify.java b/src/main/java/com/zy/system/entity/license/LicenseVerify.java
index 2175930..27bff9d 100644
--- a/src/main/java/com/zy/system/entity/license/LicenseVerify.java
+++ b/src/main/java/com/zy/system/entity/license/LicenseVerify.java
@@ -3,8 +3,11 @@
 import de.schlichtherle.license.*;
 import org.apache.logging.log4j.LogManager;
 import org.apache.logging.log4j.Logger;
+import sun.misc.IOUtils;
 
 import java.io.File;
+import java.io.FileOutputStream;
+import java.io.InputStream;
 import java.text.DateFormat;
 import java.text.MessageFormat;
 import java.text.SimpleDateFormat;
@@ -27,7 +30,11 @@
         try{
             LicenseManager licenseManager = LicenseManagerHolder.getInstance(initLicenseParam(param));
             licenseManager.uninstall();
-
+//            InputStream inputStream = this.getClass().getClassLoader().getResourceAsStream(param.getLicensePath());
+//            File file = new File(param.getLicensePath());
+//            try(FileOutputStream out = new FileOutputStream(file)){
+//                IOUtils.copy(inputStream, out);
+//            }
             result = licenseManager.install(new File(param.getLicensePath()));
             logger.info(MessageFormat.format("璁稿彲璇佸姞杞芥垚鍔燂紝璁稿彲璇佹湁鏁堟湡锛歿0} - {1}",format.format(result.getNotBefore()),format.format(result.getNotAfter())));
         }catch (Exception e){
diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml
index a24882a..50db3c2 100644
--- a/src/main/resources/application.yml
+++ b/src/main/resources/application.yml
@@ -60,7 +60,7 @@
 
 #License鐩稿叧閰嶇疆
 license:
-  subject: pswms
+  subject: flsbwms
   publicAlias: publicCert
   storePass: public_zhongyang_123456789
   licensePath: license.lic
diff --git a/src/main/resources/license.lic b/src/main/resources/license.lic
index 4add7f4..efe3c89 100644
--- a/src/main/resources/license.lic
+++ b/src/main/resources/license.lic
Binary files differ
diff --git a/src/main/webapp/static/js/locDetl/locDetl.js b/src/main/webapp/static/js/locDetl/locDetl.js
index 1cb7c94..9be8c61 100644
--- a/src/main/webapp/static/js/locDetl/locDetl.js
+++ b/src/main/webapp/static/js/locDetl/locDetl.js
@@ -1,13 +1,13 @@
 var pageCurr;
 function getCol() {
     var cols = [
-        {field: 'locNo$', align: 'center',title: '搴撲綅鍙�'},
+        {field: 'locNo', align: 'center',title: '搴撲綅鍙�',sort: true},
         {field: 'matnr', align: 'center',title: '鍝佸彿', sort:true}
         ,{field: 'maktx', align: 'center',title: '鍝佸悕', sort:true}
         ,{field: 'orderNo', align: 'center',title: '鍗曟嵁缂栧彿', hide: true}
         ,{field: 'batch', align: 'center',title: '鎵瑰彿', hide: true}
         ,{field: 'anfme', align: 'center',title: '鏁伴噺', sort:true}
-        ,{field: 'zpallet', align: 'center',title: '鎵樼洏鏉$爜'}
+        ,{field: 'zpallet', align: 'center',title: '鎵樼洏鏉$爜',sort:true}
         ,{field: 'specs', align: 'center',title: '瑙勬牸'}
         ,{field: 'model', align: 'center',title: '浠g爜', hide: true}
         ,{field: 'color', align: 'center',title: '棰滆壊', hide: true}

--
Gitblit v1.9.1