From 7096b34d983aaf5c1a863a903a7ebd09a217f687 Mon Sep 17 00:00:00 2001 From: lsh <1> Date: 星期三, 11 十月 2023 13:07:34 +0800 Subject: [PATCH] # --- src/main/java/com/zy/asrs/utils/Utils.java | 163 +++++++++++++++++++++++++++++++++++++++++++++++++++--- 1 files changed, 154 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 e80f7e5..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; /** @@ -54,6 +58,29 @@ public static boolean isDeepLoc(SlaveProperties slaveProperties, Integer row){ if (slaveProperties.isDoubleDeep()) { return slaveProperties.getDoubleLocs().contains(row); + } else { + return false; + } + } + + /** + * 鍒ゆ柇鏄惁涓哄乏娣卞簱浣� + */ + public static boolean isDeepLocLeft(SlaveProperties slaveProperties, Integer row){ + if (slaveProperties.isDoubleDeep()) { + return slaveProperties.getDoubleLocsLeft().contains(row); + } else { + return false; + } + } + + + /** + * 鍒ゆ柇鏄惁涓哄彸娣卞簱浣� + */ + public static boolean isDeepLocRight(SlaveProperties slaveProperties, Integer row){ + if (slaveProperties.isDoubleDeep()) { + return slaveProperties.getDoubleLocsRight().contains(row); } else { return false; } @@ -144,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) { @@ -161,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