package com.zy.acs.manager.common.utils; import com.zy.acs.framework.common.Cools; /** * Created by vincent on 5/17/2024 */ public class LocUtils { public static String getZone(String locNo) { if (!Cools.isEmpty(locNo)) { return locNo.substring(0, 2); } throw new RuntimeException("库位解析异常:" + locNo); } public static int getRow(String locNo) { if (!Cools.isEmpty(locNo)) { return Integer.parseInt(locNo.substring(2, 5)); } throw new RuntimeException("库位解析异常:" + locNo); } public static int getBay(String locNo) { if (!Cools.isEmpty(locNo)) { return Integer.parseInt(locNo.substring(5, 8)); } throw new RuntimeException("库位解析异常:" + locNo); } public static int getLev(String locNo) { if (!Cools.isEmpty(locNo)) { return Integer.parseInt(locNo.substring(8, 10)); } throw new RuntimeException("库位解析异常:" + locNo); } public static void main(String[] args) { String locNo = "A100100101"; System.out.println(getZone(locNo)); System.out.println(getRow(locNo)); System.out.println(getBay(locNo)); System.out.println(getLev(locNo)); } }