package com.zy.asrs.utils; import com.core.common.Arith; import com.core.common.Cools; import com.zy.core.properties.SlaveProperties; import java.text.DecimalFormat; import java.util.ArrayList; import java.util.List; /** * Created by vincent on 2020/8/27 */ public class Utils { private static final DecimalFormat fmt = new DecimalFormat("##0.00"); public static float scale(Float f){ if (f == null || f == 0f || Float.isNaN(f)) { return 0f; } return (float) Arith.multiplys(2, f, 1); } 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> " + 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); } SlaveProperties slaveProperties = new SlaveProperties(); slaveProperties.setDoubleDeep(true); List 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 getGroupInsideLoc(String locNo){ int row = getRow(locNo); switch (row) { case 1: case 21: case 14: case 15: case 7: case 8: return new ArrayList<>(); case 2: return new ArrayList() {{ add(zerofill(String.valueOf(1), 2) + locNo.substring(2)); }}; case 3: return new ArrayList() {{ add(zerofill(String.valueOf(1), 2) + locNo.substring(2)); add(zerofill(String.valueOf(2), 2) + locNo.substring(2)); }}; case 4: return new ArrayList() {{ add(zerofill(String.valueOf(7), 2) + locNo.substring(2)); add(zerofill(String.valueOf(6), 2) + locNo.substring(2)); add(zerofill(String.valueOf(5), 2) + locNo.substring(2)); }}; case 5: return new ArrayList() {{ add(zerofill(String.valueOf(7), 2) + locNo.substring(2)); add(zerofill(String.valueOf(6), 2) + locNo.substring(2)); }}; case 6: return new ArrayList() {{ add(zerofill(String.valueOf(7), 2) + locNo.substring(2)); }}; case 9: return new ArrayList() {{ add(zerofill(String.valueOf(8), 2) + locNo.substring(2)); }}; case 10: return new ArrayList() {{ add(zerofill(String.valueOf(8), 2) + locNo.substring(2)); add(zerofill(String.valueOf(9), 2) + locNo.substring(2)); }}; case 11: return new ArrayList() {{ add(zerofill(String.valueOf(8), 2) + locNo.substring(2)); add(zerofill(String.valueOf(9), 2) + locNo.substring(2)); add(zerofill(String.valueOf(10), 2) + locNo.substring(2)); }}; case 12: return new ArrayList() {{ add(zerofill(String.valueOf(14), 2) + locNo.substring(2)); add(zerofill(String.valueOf(13), 2) + locNo.substring(2)); }}; case 13: return new ArrayList() {{ add(zerofill(String.valueOf(14), 2) + locNo.substring(2)); }}; case 16: return new ArrayList() {{ add(zerofill(String.valueOf(15), 2) + locNo.substring(2)); }}; case 17: return new ArrayList() {{ add(zerofill(String.valueOf(15), 2) + locNo.substring(2)); add(zerofill(String.valueOf(16), 2) + locNo.substring(2)); }}; case 18: return new ArrayList() {{ add(zerofill(String.valueOf(15), 2) + locNo.substring(2)); add(zerofill(String.valueOf(16), 2) + locNo.substring(2)); add(zerofill(String.valueOf(17), 2) + locNo.substring(2)); }}; case 19: return new ArrayList() {{ add(zerofill(String.valueOf(21), 2) + locNo.substring(2)); add(zerofill(String.valueOf(20), 2) + locNo.substring(2)); }}; case 20: return new ArrayList() {{ add(zerofill(String.valueOf(21), 2) + locNo.substring(2)); }}; default: throw new RuntimeException("库位解析异常"); } } }