RobotDomain.java
2.24 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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
package com.huaheng.api.acs.domain;
import com.huaheng.common.exception.service.ServiceException;
import com.huaheng.common.utils.StringUtils;
import lombok.Data;
import java.math.BigDecimal;
/***
* 商片二楼机械人码垛入参
*
*/
@Data
public class RobotDomain {
/**
* 容器
*/
private String containerCode;
/**
* 位置
*/
private Integer position;
/**
* 垛型
*/
//
private Integer stackType;
/**
* 子托盘高度
*/
private Integer height;
/**
* 结束标志
*/
private Integer finish;
/**
* 条码
*/
private String allCode;
public Integer getBoxType(){
return stackType == null ? null :stackType / 100;
}
/***
* 垛型数量
* @return
*/
public Integer getStackTypeTotal(){
return stackType == null ? null :stackType % 100;
}
public String getMaterialCode(){
String materialCode = null;
if(StringUtils.isNotEmpty(allCode) && !allCode.contains("NoRead")){
String[] materialInfo = allCode.split(" ");
if(materialInfo.length < 3){
throw new ServiceException("条码格式不对:"+allCode);
}
materialCode = materialInfo[0];
}else{
throw new ServiceException("条码为空或未读取到数据:"+allCode);
}
return materialCode;
}
public BigDecimal getQty(){
BigDecimal qty = BigDecimal.ZERO;
if(StringUtils.isNotEmpty(allCode) && !allCode.contains("NoRead")){
String[] materialInfo = allCode.split(" ");
if(materialInfo.length < 3){
throw new ServiceException("条码格式不对:"+allCode);
}
qty.add(BigDecimal.valueOf(Integer.valueOf(materialInfo[1])));
}
return qty;
}
public String getLot(){
String lot = null;
if(StringUtils.isNotEmpty(allCode) && !allCode.contains("NoRead")){
String[] materialInfo = allCode.split(" ");
if(materialInfo.length < 3){
throw new ServiceException("条码格式不对:"+allCode);
}
lot = materialInfo[2];
}
return lot;
}
}