P15GEN2\59518
2025-10-10 9f6890646993d16260d4201d613c092132856127
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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
package biz.book;
 
import java.util.List;
 
import biz.constants.MdSubject;
import foundation.dao.DataSource;
import foundation.data.entity.Entity;
import foundation.util.Util;
 
public class BookCommandMeta {
 
    private String id;
    private String code;
    private String name;
    private BookName bookName;
    private String docType;
    private OrderRight orderRight;
    private StockType stockType;
    private QtyCommand qtyCommand;
    private boolean negativeConvert;
    private FreezeCondition freezeCondition;
    private String warehouseDirection;
    private String warehouseSource;
    private String filter;
    private String bookSource;
    private String dataSource;
    
    public void load(Entity entity) {
        id = entity.getString("id");
        bookName = BookBucket.getInstance().get(entity.getString("book_name"));
        code = entity.getString("code");
        name = entity.getString("name");
        docType = entity.getString("doc_type");
        
        orderRight = OrderRight.parse(entity.getString("order_right"));
        stockType = StockType.parse(entity.getString("stock_type"));
 
        qtyCommand = new QtyCommand();
        qtyCommand.load(entity);
        
        negativeConvert = entity.getBoolean("is_negative_convert", false);
        freezeCondition = FreezeCondition.parse(entity.getString("freeze_condition"));
        warehouseDirection = entity.getString("warehouse_direction", "");
        warehouseSource = entity.getString("warehouse_source", "");
 
        bookSource = entity.getString("book_source", "document.id");
        filter = entity.getString("filter");
        dataSource = entity.getString("data_source");
    }
    
    public String getId() {
        return id;
    }
    
    public String getCode() {
        return code;
    }
    
    public String getName() {
        return name;
    }
 
    public String getDocType() {
        return docType;
    }
    
    public OrderRight getOrderRight() {
        return orderRight;
    }
 
    public StockType getStockType() {
        return stockType;
    }
 
    public QtyCommand getQtyCommand() {
        return qtyCommand;
    }
 
    public boolean isNegativeConvert() {
        return negativeConvert;
    }
 
    public String getWarehouseDirection() {
        return warehouseDirection;
    }
 
    public String getWarehouseSource() {
        return warehouseSource;
    }
 
    public FreezeCondition getFreezeCondition() {
        return freezeCondition;
    }
 
    public String getFilter() {
        if (Util.isEmpty(filter)) {
            return " 1 = 1 ";
        }
        return filter;
    }
    
    public DataSource getDataSource() {
        if ("file".equalsIgnoreCase(dataSource)) {
            return DataSource.File;
        }
        if ("request".equalsIgnoreCase(dataSource)) {
            return DataSource.Request;
        }
        
        return DataSource.DB;
    }
 
    public String getBookSource() {
        return bookSource;
    }
 
    public String getFlowTableName() {
        return bookName.getFlowTable();
    }
 
    public String getDetailTable() {
        return bookName.getDetailTable();
    }
 
    public String getValueField() {
        return bookName.getValueField();
    }
 
    public BookDimension getBookDimension() {
        return bookName.getDimension();
    }
 
    public List<MdSubject> getSubjects() {
        return bookName.getDimension().getDetails();
    }
    
}