package book.stock;
|
|
import foundation.dao.DataSource;
|
import foundation.data.entity.Entity;
|
import foundation.util.Util;
|
|
public class BookCommandMeta {
|
|
private String id;
|
private String bookName;
|
private String code;
|
private String name;
|
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 dataSource;
|
|
|
public void load(Entity entity) {
|
id = entity.getString("id");
|
bookName = entity.getString("bookName");
|
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", "");
|
filter = entity.getString("filter");
|
dataSource = entity.getString("data_source");
|
}
|
|
public String getId() {
|
return id;
|
}
|
|
public String getBookName() {
|
return bookName;
|
}
|
|
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;
|
}
|
|
}
|