ErpBill.java
1.62 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
package com.huaheng.api.general.domain;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.annotation.JSONField;
import lombok.Data;
import org.apache.commons.lang.StringEscapeUtils;
import java.util.List;
/**
* ERP接口单据实体
*/
@Data
public class ErpBill {
/**
* ERP单据类型值
* "ERP单据类型名称及值的对照表:
* 生产入库 = 1,采购入库 = 2,其他入库 = 3,调拨入库 = 4,销售退货 = 5,盘盈单 = 6,
* 销售出库 = 21,其他出库 = 22,调拨出库 = 23,采购退货 = 24,盘亏单 = 25"
*/
@JSONField(name = "ErpBillType")
public String ErpBillType;
/**
* 单据类型
*/
@JSONField(name = "BillType")
public String BillType;
/**
* 单据单号
*/
@JSONField(name = "BillCode")
public String BillCode;
/**
* 出入类型,入库=1, 出库=0
*/
@JSONField(name = "InOrOut")
public String InOrOut;
@JSONField(name = "BillDetails")
public List<ErpBillDetails> BillDetails;
public boolean isReceipt(){
return "1".equalsIgnoreCase(InOrOut);
}
public boolean isShipment(){
return "2".equalsIgnoreCase(InOrOut);
}
public static ErpBill parse(String msg){
String json = StringEscapeUtils.unescapeJava(msg);
ErpBill obj = JSON.parseObject(json, ErpBill.class);
return obj;
}
public String toRawJsonStr(){
String s = JSON.toJSONString(this);
// System.out.println(StringEscapeUtils.escapeJava(s));
return s;
}
public String getReferCode(){
return BillType + "-" + BillCode;
}
}