CodeBox.java
2.0 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
package com.myproject.bean;
import com.myproject.util.StorageConstants;
/**
* 用于展示到界面
* Created by sunke on 2017/10/13.
*/
public class CodeBox {
//显示的位置
private int location = 0;
private String msg = "";
private boolean valid = false;
private String codeType;
public CodeBox(int location, String msg, boolean valid, String codeType) {
this.location = location;
this.msg = msg;
this.valid = valid;
this.codeType = codeType;
}
public CodeBox(CodeBean codeBean) {
this.valid = codeBean.isValid();
if(valid){
msg = codeBean.getBarcode().getBarcode();
}else{
msg = codeBean.getError();
}
StorageConstants.CODE_TYPE type = codeBean.getCodeType();
if(type == null){
type = StorageConstants.CODE_TYPE.FIXTURE;
}
codeType = type.name();
int cameraIndex = codeBean.getCameraIndex();
float locationX = codeBean.getLocationX();
float locationY = codeBean.getLocationY();
if(locationX != 0 && locationY != 0){
if(cameraIndex == 1){
if(locationX < 1400){
location = 1;
}else {
location = 2;
}
}else {
if(locationX < 1000){
location = 4;
}else {
location = 3;
}
}
}
}
public int getLocation() {
return location;
}
public void setLocation(int location) {
this.location = location;
}
public String getMsg() {
return msg;
}
public void setMsg(String msg) {
this.msg = msg;
}
public String getCodeType() {
return codeType;
}
public void setCodeType(String codeType) {
this.codeType = codeType;
}
public boolean isValid() {
return valid;
}
public void setValid(boolean valid) {
this.valid = valid;
}
}