StackCaller.java 1.11 KB
package com.huaheng.api.acs.controller;

import com.huaheng.common.exception.service.ServiceException;
import org.springframework.stereotype.Component;

/***
 * @author tongzonghao
 *
 */
@Component
public class StackCaller {

    public String callApi(Integer boxType,Integer stackTotal,Integer palletType) {
        switch (palletType){
            //2当为1层码垛3个箱子时
            case 2:
                //当boxType为小箱子
                if(boxType == 1){
                    return getStackString(3,stackTotal);
                }
                return getStackString(boxType,stackTotal);
            //当为1层码垛4个箱子时
            case 1:
                //当boxType为大箱子
                return getStackString(boxType,stackTotal);
            default:
                throw new ServiceException("层的码垛数量不在范围内");

        }
    }

    public String getStackString(Integer boxType,Integer stackTotal){
        if(stackTotal < 10){
            return boxType.toString()+"0"+stackTotal.toString();
        }
        return boxType.toString() + stackTotal.toString();
    }

}