From bfbe2204cfb0eea3f000b145f5e3f19eca89aa68 Mon Sep 17 00:00:00 2001 From: tqs <56479841@qq.com> Date: 星期一, 31 十月 2022 17:47:42 +0800 Subject: [PATCH] # --- src/main/java/com/zy/asrs/utils/Utils.java | 55 ++++++++++++++++++++++++++++++++----------------------- 1 files changed, 32 insertions(+), 23 deletions(-) diff --git a/src/main/java/com/zy/asrs/utils/Utils.java b/src/main/java/com/zy/asrs/utils/Utils.java index e4d3d75..6c8c17f 100644 --- a/src/main/java/com/zy/asrs/utils/Utils.java +++ b/src/main/java/com/zy/asrs/utils/Utils.java @@ -225,7 +225,8 @@ /** * 鑾峰彇 娣卞簱浣嶅搴旂殑娴呭簱浣嶇粍 */ - public static String getShallowLocs(String deepLoc){ + public static String[] getShallowLocs(String deepLoc){ + String[] locsArr = null; String locs=""; int row = getRow(deepLoc); switch (row){ @@ -270,13 +271,17 @@ locs += zerofill(String.valueOf(row-1),2) + deepLoc.substring(2); break; } - return locs; + if(!Cools.isEmpty(locs)){ + locsArr = locs.split(","); + } + return locsArr; } /** * 鑾峰彇 娴呭簱浣嶅搴旂殑娣卞簱浣嶇粍 */ - public static String getDeepLocs(String shallowLoc){ + public static String[] getDeepLocs(String shallowLoc){ + String[] locsArr = null; String locs=""; int row = getRow(shallowLoc); switch (row){ @@ -288,19 +293,19 @@ case 3: case 10: case 17: - locs += zerofill(String.valueOf(row-1),2) + shallowLoc.substring(2); - locs += "," + zerofill(String.valueOf(row-2),2) + shallowLoc.substring(2); + locs += zerofill(String.valueOf(row-2),2) + shallowLoc.substring(2); + locs += "," + zerofill(String.valueOf(row-1),2) + shallowLoc.substring(2); break; case 4: - locs += zerofill(String.valueOf(row+1),2) + shallowLoc.substring(2); + locs += zerofill(String.valueOf(row+3),2) + shallowLoc.substring(2); locs += "," + zerofill(String.valueOf(row+2),2) + shallowLoc.substring(2); - locs += "," + zerofill(String.valueOf(row+3),2) + shallowLoc.substring(2); + locs += "," + zerofill(String.valueOf(row+1),2) + shallowLoc.substring(2); break; case 5: case 12: case 19: - locs += zerofill(String.valueOf(row+1),2) + shallowLoc.substring(2); - locs += "," + zerofill(String.valueOf(row+2),2) + shallowLoc.substring(2); + locs += zerofill(String.valueOf(row+2),2) + shallowLoc.substring(2); + locs += "," + zerofill(String.valueOf(row+1),2) + shallowLoc.substring(2); break; case 6: case 13: @@ -309,12 +314,15 @@ break; case 11: case 18: - locs += zerofill(String.valueOf(row-1),2) + shallowLoc.substring(2); + locs += zerofill(String.valueOf(row-3),2) + shallowLoc.substring(2); locs += "," + zerofill(String.valueOf(row-2),2) + shallowLoc.substring(2); - locs += "," + zerofill(String.valueOf(row-3),2) + shallowLoc.substring(2); + locs += "," + zerofill(String.valueOf(row-1),2) + shallowLoc.substring(2); break; } - return locs; + if(!Cools.isEmpty(locs)){ + locsArr = locs.split(","); + } + return locsArr; } /** @@ -340,17 +348,18 @@ } public static void main(String[] args) { - String shallowLocs = getShallowLocs("2100203"); - String deepLocs = getDeepLocs("2100203"); - System.out.println("shallowLocs ==>> " + shallowLocs); - System.out.println("deepLocs ==>> " + deepLocs); - String[] shallowArr = null, deepArr = null; - if (shallowLocs.indexOf(',') >= 0) { - shallowArr = shallowLocs.split(","); - } - if (deepLocs.indexOf(',') >= 0) { - deepArr = deepLocs.split(","); - } +// String shallowLocs = getShallowLocs("2100203"); +// String deepLocs = getDeepLocs("2100203"); +// System.out.println("shallowLocs ==>> " + shallowLocs); +// System.out.println("deepLocs ==>> " + deepLocs); + String[] shallowArr = getShallowLocs("1700203");; + String[] deepArr = getDeepLocs("1700203"); +// if (shallowLocs.indexOf(',') >= 0) { +// shallowArr = shallowLocs.split(","); +// } +// if (deepLocs.indexOf(',') >= 0) { +// deepArr = deepLocs.split(","); +// } for(String str : deepArr){ System.out.println(str); -- Gitblit v1.9.1