From 22fc6125f32ecb4d05c7a2e9397a4eabd6a5d7ad Mon Sep 17 00:00:00 2001
From: LSH
Date: 星期三, 20 九月 2023 14:41:33 +0800
Subject: [PATCH] #入库逻辑2.0 简单方便易理解
---
src/main/java/com/zy/asrs/utils/Utils.java | 140 +++++++++++++++++++++++++++++++++++++++++++---
1 files changed, 131 insertions(+), 9 deletions(-)
diff --git a/src/main/java/com/zy/asrs/utils/Utils.java b/src/main/java/com/zy/asrs/utils/Utils.java
index 99e4a80..90c58c9 100644
--- a/src/main/java/com/zy/asrs/utils/Utils.java
+++ b/src/main/java/com/zy/asrs/utils/Utils.java
@@ -2,10 +2,14 @@
import com.core.common.Arith;
import com.core.common.Cools;
+import com.core.exception.CoolException;
import com.zy.common.properties.SlaveProperties;
+import com.zy.common.service.CommonService;
import java.text.DecimalFormat;
import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
import java.util.List;
/**
@@ -167,6 +171,26 @@
}
/**
+ * 閫氳繃搴撲綅鍙疯幏鍙� 鍒�
+ */
+ public static int getBay(String locNo) {
+ if (!Cools.isEmpty(locNo)) {
+ return Integer.parseInt(locNo.substring(2, 5));
+ }
+ throw new RuntimeException("搴撲綅瑙f瀽寮傚父");
+ }
+
+ /**
+ * 閫氳繃搴撲綅鍙疯幏鍙� 灞�
+ */
+ public static int getLev(String locNo) {
+ if (!Cools.isEmpty(locNo)) {
+ return Integer.parseInt(locNo.substring(5, 7));
+ }
+ throw new RuntimeException("搴撲綅瑙f瀽寮傚父");
+ }
+
+ /**
* 褰撴绱㈠埌鍙屾繁搴撲綅鐨勬祬搴撲綅鏃讹紝濡傛灉娣卞簱浣嶆棤璐э紝鍒欐斁鍏ュ搴旂殑娣卞簱浣�
*/
public static void toDeepIfEmptyByShallow(String shallowLoc) {
@@ -184,15 +208,113 @@
}
- public static void main(String[] args) {
- SlaveProperties slaveProperties = new SlaveProperties();
- slaveProperties.setDoubleDeep(true);
- List<Integer> list = new ArrayList<>();
- list.add(1);list.add(4);list.add(5);list.add(8);list.add(9);list.add(12);
- slaveProperties.setDoubleLocs(list);
- slaveProperties.setGroupCount(4);
- Integer deepRow = getDeepRow(slaveProperties, 6);
- System.out.println(deepRow);
+// public static void main(String[] args) {
+// SlaveProperties slaveProperties = new SlaveProperties();
+// slaveProperties.setDoubleDeep(true);
+// List<Integer> list = new ArrayList<>();
+// list.add(1);list.add(4);list.add(5);list.add(8);list.add(9);list.add(12);
+// slaveProperties.setDoubleLocs(list);
+// slaveProperties.setGroupCount(4);
+// Integer deepRow = getDeepRow(slaveProperties, 6);
+// System.out.println(deepRow);
+//
+// }
+ // 澶栦晶鏂瑰悜鐨勮揣浣� 浼樺厛鍏ュ簱鏂瑰悜/浼樺厛鍑哄簱鏂瑰悜 ===>> 鍙嶄箣
+ public static List<String> getGroupOutsideLocCrn(String locNo,boolean pakin){
+ int row = getRow(locNo);
+ List<String> result = new ArrayList<>();
+ result.add(locNo);
+
+// result.add(zerofill(String.valueOf(32), 2) + locNo.substring(2));
+
+ return result;
+ }
+
+ public static boolean BooleanWhsTypeSta(Integer whsType){
+ if (whsType==1){
+ return true;
+ }
+ return false;
+ }
+
+ public static int RowCount(Integer whsType,Integer curRow){
+ return LocNecessaryParameters(whsType, curRow)[0];
+ }
+ public static int getCurRow(Integer whsType,Integer curRow){
+ return LocNecessaryParameters(whsType, curRow)[1];
+ }
+ public static int getCrnNo(Integer whsType,Integer curRow){
+ return LocNecessaryParameters(whsType, curRow)[2];
+ }
+ public static int getNearRow(Integer whsType,Integer curRow){
+ return LocNecessaryParameters(whsType, curRow)[3];
+ }
+
+ //搴撲綅鎺掑彿鍒嗛厤
+ public static int[] LocNecessaryParameters(Integer whsType,Integer curRow){
+ int[] necessaryParameters=new int[]{0,0,0,0};
+ if (BooleanWhsTypeSta(whsType)){
+ necessaryParameters[0] = 6;
+ switch (curRow){ //婊℃澘姝e父鍏ュ簱
+ case 24:
+ necessaryParameters[1] = 1; //curRow 鏈�娣卞簱浣嶆帓
+ necessaryParameters[2] = 1; //crnNo 鍫嗗灈鏈哄彿
+ necessaryParameters[3] = 2; //nearRow 鏈�娴呭簱浣嶆帓
+ break;
+ case 21:
+ necessaryParameters[1] = 4; //curRow 鏈�娣卞簱浣嶆帓
+ necessaryParameters[2] = 1; //crnNo 鍫嗗灈鏈哄彿
+ necessaryParameters[3] = 3; //nearRow 鏈�娴呭簱浣嶆帓
+ break;
+ default:
+ curRow=curRow+4;
+ if (curRow<1 || curRow>24){
+ throw new CoolException("搴撲綅鎺掑彿寮傚父锛氭帓鍙凤細"+curRow);
+ }
+ if ((curRow-1)%4==0){
+ necessaryParameters[1] = curRow; //curRow 鏈�娣卞簱浣嶆帓
+ necessaryParameters[2] = (curRow+3)/4; //crnNo 鍫嗗灈鏈哄彿
+ necessaryParameters[3] = curRow+1; //nearRow 鏈�娴呭簱浣嶆帓
+ }else if (curRow%4==0){
+ necessaryParameters[1] = curRow; //curRow 鏈�娣卞簱浣嶆帓
+ necessaryParameters[2] = curRow/4; //crnNo 鍫嗗灈鏈哄彿
+ necessaryParameters[3] = curRow-1; //nearRow 鏈�娴呭簱浣嶆帓
+ }else {
+ throw new CoolException("搴撲綅鎺掑彿寮傚父锛氭帓鍙凤細"+curRow);
+ }
+ }
+ }else {//绌烘澘涓嶅叆1鍙�
+ necessaryParameters[0] = 5;
+ switch (curRow){
+ case 24:
+ necessaryParameters[1] = 5; //curRow 鏈�娣卞簱浣嶆帓
+ necessaryParameters[2] = 2; //crnNo 鍫嗗灈鏈哄彿
+ necessaryParameters[3] = 6; //nearRow 鏈�娴呭簱浣嶆帓
+ break;
+ case 21:
+ necessaryParameters[1] = 8; //curRow 鏈�娣卞簱浣嶆帓
+ necessaryParameters[2] = 2; //crnNo 鍫嗗灈鏈哄彿
+ necessaryParameters[3] = 7; //nearRow 鏈�娴呭簱浣嶆帓
+ break;
+ default:
+ curRow=curRow+4;
+ if (curRow<5 || curRow>24){
+ throw new CoolException("搴撲綅鎺掑彿寮傚父锛氭帓鍙凤細"+curRow);
+ }
+ if ((curRow-1)%4==0){
+ necessaryParameters[1] = curRow; //curRow 鏈�娣卞簱浣嶆帓
+ necessaryParameters[2] = (curRow+3)/4; //crnNo 鍫嗗灈鏈哄彿
+ necessaryParameters[3] = curRow+1; //nearRow 鏈�娴呭簱浣嶆帓
+ }else if (curRow%4==0){
+ necessaryParameters[1] = curRow; //curRow 鏈�娣卞簱浣嶆帓
+ necessaryParameters[2] = curRow/4; //crnNo 鍫嗗灈鏈哄彿
+ necessaryParameters[3] = curRow-1; //nearRow 鏈�娴呭簱浣嶆帓
+ }else {
+ throw new CoolException("搴撲綅鎺掑彿寮傚父锛氭帓鍙凤細"+curRow);
+ }
+ }
+ }
+ return necessaryParameters;
}
}
--
Gitblit v1.9.1