StackCaller.java
1.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
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();
}
}