From e2a1dfdf96e9d81baf537ae49d5ef21208170b11 Mon Sep 17 00:00:00 2001 From: Junjie <xjj@123> Date: 星期三, 03 四月 2024 12:49:48 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/Four-Way-Rack' into Four-Way-Rack --- zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/utils/Utils.java | 56 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 56 insertions(+), 0 deletions(-) diff --git a/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/utils/Utils.java b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/utils/Utils.java index 81dae25..d8f7718 100644 --- a/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/utils/Utils.java +++ b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/utils/Utils.java @@ -1,10 +1,66 @@ package com.zy.asrs.wcs.core.utils; +import com.zy.asrs.framework.common.Cools; + import java.util.ArrayList; import java.util.List; public class Utils { + public static final String _LINK = "-"; + + /** + * 閫氳繃搴撲綅鍙疯幏鍙� 鎺� + */ + public static int getRow(String locNo) { + if (!Cools.isEmpty(locNo)) { + String[] split = locNo.split(_LINK); + return Integer.parseInt(split[0]); + } + throw new RuntimeException("搴撲綅瑙f瀽寮傚父"); + } + + /** + * 閫氳繃搴撲綅鍙疯幏鍙� 鍒� + */ + public static int getBay(String locNo) { + if (!Cools.isEmpty(locNo)) { + String[] split = locNo.split(_LINK); + return Integer.parseInt(split[1]); + } + throw new RuntimeException("搴撲綅瑙f瀽寮傚父"); + } + + /** + * 閫氳繃搴撲綅鍙疯幏鍙� 灞� + */ + public static int getLev(String locNo) { + if (!Cools.isEmpty(locNo)) { + String[] split = locNo.split(_LINK); + return Integer.parseInt(split[2]); + } + throw new RuntimeException("搴撲綅瑙f瀽寮傚父"); + } + + public static String getLocNo(Number row, Number bay, Number lev) { + return row + _LINK + bay + _LINK + lev; +// return zerofill(String.valueOf(row), 2) + zerofill(String.valueOf(bay), 3) + zerofill(String.valueOf(lev), 2); + } + + public static String zerofill(String msg, Integer count){ + if (msg.length() == count){ + return msg; + } else if (msg.length() > count){ + return msg.substring(0, 16); + } else { + StringBuilder msgBuilder = new StringBuilder(msg); + for (int i = 0; i<count-msg.length(); i++){ + msgBuilder.insert(0,"0"); + } + return msgBuilder.toString(); + } + } + //鑾峰彇闄ょ櫧鍚嶅崟澶栫殑鎸囧畾妤煎眰鍏ㄩ儴绌挎杞y鍧愭爣鐐� public static List<int[]> getShuttlePoints(Integer whiteShuttle, Integer lev) { // SlaveProperties slaveProperties = SpringUtils.getBean(SlaveProperties.class); -- Gitblit v1.9.1