From 56b1b873191d6e7022ed225cf81c3eda774f210e Mon Sep 17 00:00:00 2001
From: skyouc <958836976@qq.com>
Date: 星期六, 11 四月 2026 18:02:42 +0800
Subject: [PATCH] WMS2.0与WCS3.0对接完整版

---
 src/main/java/com/zy/asrs/utils/Utils.java |   50 ++++++++++++++++++++++++++++++++++++--------------
 1 files changed, 36 insertions(+), 14 deletions(-)

diff --git a/src/main/java/com/zy/asrs/utils/Utils.java b/src/main/java/com/zy/asrs/utils/Utils.java
index ad1411a..27b9426 100644
--- a/src/main/java/com/zy/asrs/utils/Utils.java
+++ b/src/main/java/com/zy/asrs/utils/Utils.java
@@ -8,17 +8,17 @@
 import com.zy.asrs.entity.LocMast;
 import com.zy.asrs.entity.RowLastno;
 import com.zy.asrs.service.RowLastnoService;
-import com.zy.common.CodeBuilder;
-import com.zy.common.model.LocDetlDto;
 import com.zy.common.properties.SlaveProperties;
-import com.zy.common.service.CommonService;
-import com.zy.system.service.UserService;
-
 
 import java.text.DecimalFormat;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.time.Instant;
+import java.time.LocalDateTime;
+import java.time.ZoneId;
+import java.time.format.DateTimeFormatter;
 import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
+import java.util.Date;
 import java.util.List;
 
 /**
@@ -48,6 +48,27 @@
             return msgBuilder.toString();
         }
     }
+
+    public static boolean isValidFormat(String dateStr, String format) {
+        SimpleDateFormat sdf = new SimpleDateFormat(format);
+        sdf.setLenient(false); // 涓ユ牸妯″紡锛屽繀椤诲畬鍏ㄥ尮閰嶆牸寮�
+        try {
+            sdf.parse(dateStr);
+            return true;
+        } catch (ParseException e) {
+            return false;
+        }
+    }
+
+    public static Date getFormateDate(String datestr) {
+        //瀛楃涓茶浆鏃ユ湡
+        DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
+        LocalDateTime parse = LocalDateTime.parse(datestr, dateTimeFormatter);
+        Instant instant = parse.atZone(ZoneId.systemDefault()).toInstant();
+        Date date = Date.from(instant);
+        return date;
+    }
+
 
     /**
      * 鍒ゆ柇鏄惁涓烘繁搴撲綅
@@ -476,7 +497,7 @@
             }
             if ((curRow - sRow) % 4 == 0) {
                 necessaryParameters[1] = curRow;    //curRow   鏈�娣卞簱浣嶆帓
-                necessaryParameters[2] = (curRow - sRow + 2) / 4 + sCrnNo - 1;     //crnNo     鍫嗗灈鏈哄彿
+                necessaryParameters[2] = (curRow - sRow + 2) / 4 + sCrnNo;     //crnNo     鍫嗗灈鏈哄彿
                 necessaryParameters[3] = curRow + 1;    //nearRow  鏈�娴呭簱浣嶆帓
             } else if ((curRow - sRow + 1) % 4 == 0) {
                 necessaryParameters[1] = curRow;    //curRow   鏈�娣卞簱浣嶆帓
@@ -489,6 +510,7 @@
 
         return necessaryParameters;
     }
+
     //鍥涘悜搴擄紙鐗涚溂\鍏夋嘲锛�
     public static int[] LocNecessaryParametersDoubleExtension6(RowLastno rowLastno, Integer curRow, Integer crnNumber) {
         int[] necessaryParameters = new int[]{0, 0, 0, 0};
@@ -498,7 +520,7 @@
         necessaryParameters[0] = crnNumber; // 杞娆℃暟
         curRow = curRow - offset;
         //婊℃澘姝e父鍏ュ簱
-        switch (curRow){
+        switch (curRow) {
             case 1:
                 necessaryParameters[1] = 4;    //curRow   鏈�娣卞簱浣嶆帓
                 necessaryParameters[2] = sCrnNo;     //crnNo     鍫嗗灈鏈哄彿
@@ -544,7 +566,7 @@
         Integer sCrnNo = rowLastno.getsCrnNo();//璧峰鍫嗗灈鏈哄彿
         necessaryParameters[0] = crnNumber; // 杞娆℃暟
         //婊℃澘姝e父鍏ュ簱
-        if (curRow.equals(rowLastno.geteRow())){
+        if (curRow.equals(rowLastno.geteRow())) {
             necessaryParameters[1] = sRow;    //curRow   鏈�娣卞簱浣嶆帓
             necessaryParameters[2] = sCrnNo;     //crnNo     鍫嗗灈鏈哄彿
             necessaryParameters[3] = sRow;    //nearRow  鏈�娴呭簱浣嶆帓
@@ -619,12 +641,12 @@
     // 澶栦晶鏂瑰悜鐨勮揣浣�  浼樺厛鍏ュ簱鏂瑰悜 ===>> 鍙嶄箣
     public static List<String> getGroupOutLocCrn(Integer curRow, Integer nearRow, String locNo, boolean pakin) {
         List<String> result = new ArrayList<>();
-        if (pakin){
-            for (int row = curRow;row>=nearRow;row--){
+        if (pakin) {
+            for (int row = curRow; row >= nearRow; row--) {
                 result.add(zerofill(String.valueOf(row), 2) + locNo.substring(2));
             }
-        }else {
-            for (int row = curRow;row<=nearRow;row++){
+        } else {
+            for (int row = curRow; row <= nearRow; row++) {
                 result.add(zerofill(String.valueOf(row), 2) + locNo.substring(2));
             }
         }

--
Gitblit v1.9.1