自动化立体仓库 - WCS系统
#
luxiaotao1123
2021-01-27 934c0ddfba7543b59927b2ac0cc44827898198b3
src/main/java/com/zy/common/model/Shelves.java
@@ -1,5 +1,8 @@
package com.zy.common.model;
import com.alibaba.fastjson.JSON;
import com.core.exception.CoolException;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
@@ -11,13 +14,13 @@
public class Shelves {
    // 货架排数量
    private final int size;
    public final int size;
    // 货架组数量
    private final int group;
    public final int group;
    // 偏移量[default:0]
    private final int offset;
    public final int offset;
    // 货架实例节点集合
    public List<List<Integer>> nodes;
@@ -97,6 +100,14 @@
        return -1;
    }
    public Integer get(Integer curRow) {
        for (List<Integer> node : nodes){
            if (node.contains(curRow)) {
                return nodes.indexOf(node) + 1;
            }
        }
        throw new CoolException("货排检索系统报错, node:" + JSON.toJSONString(nodes) + ", curRow:" + curRow);
    }
    public static void main(String[] args) throws InterruptedException {
        Shelves shelves = new Shelves(8,2);