| | |
| | | package com.zy.asrs.wms.asrs.entity.template; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonAnyGetter; |
| | | import com.zy.asrs.common.utils.Synchro; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.lang.reflect.Field; |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.Map; |
| | | |
| | | @Data |
| | | public class OrderTemplate { |
| | | |
| | | //订单编号 |
| | | @ApiModelProperty(value= "订单编号") |
| | | private String orderNo; |
| | | |
| | | //单据类型 |
| | | @ApiModelProperty(value= "单据类型") |
| | | private String orderType; |
| | | |
| | | //商品编号 |
| | | @ApiModelProperty(value= "商品编号") |
| | | private String matnr; |
| | | |
| | | //批号 |
| | | @ApiModelProperty(value= "批号") |
| | | private String batch; |
| | | |
| | | //数量 |
| | | @ApiModelProperty(value= "数量") |
| | | private Double anfme; |
| | | |
| | | //备注 |
| | | @ApiModelProperty(value= "备注") |
| | | private String memo; |
| | | |
| | | public void sync(Object source) { |
| | | Synchro.Copy(source, this); |
| | | } |
| | | |
| | | //动态扩展字段 |
| | | public transient Map<String, Object> dynamicFields = new HashMap<>(); |
| | | |
| | | @JsonAnyGetter |
| | | public Map<String,Object> getDynamicFields() { |
| | | return dynamicFields; |
| | | } |
| | | |
| | | public void syncFieldMap(Map<String, Object> map) { |
| | | ArrayList<String> keys = new ArrayList<>(); |
| | | Field[] fields = this.getClass().getDeclaredFields(); |
| | | for (Field field : fields) { |
| | | keys.add(field.getName()); |
| | | } |
| | | keys.add("detlId"); |
| | | |
| | | Map<String, Object> dynamicFields = new HashMap<>(); |
| | | for (Map.Entry<String, Object> entry : map.entrySet()) { |
| | | if (keys.contains(entry.getKey())) { |
| | | continue; |
| | | } |
| | | dynamicFields.put(entry.getKey(), entry.getValue()); |
| | | } |
| | | |
| | | this.dynamicFields = dynamicFields; |
| | | } |
| | | |
| | | public String getFieldString(String key) { |
| | | return dynamicFields.get(key).toString(); |
| | | } |
| | | |
| | | public void setField(String key, Object value) { |
| | | dynamicFields.put(key, value); |
| | | } |
| | | |
| | | } |
| | | package com.zy.asrs.wms.asrs.entity.template;
|
| | |
|
| | | import com.fasterxml.jackson.annotation.JsonAnyGetter;
|
| | | import com.zy.asrs.common.utils.Synchro;
|
| | | import io.swagger.annotations.ApiModelProperty;
|
| | | import lombok.Data;
|
| | |
|
| | | import java.lang.reflect.Field;
|
| | | import java.util.ArrayList;
|
| | | import java.util.HashMap;
|
| | | import java.util.Map;
|
| | |
|
| | | @Data
|
| | | public class OrderTemplate {
|
| | |
|
| | | //订单编号
|
| | | @ApiModelProperty(value= "订单编号")
|
| | | private String orderNo;
|
| | |
|
| | | //单据类型
|
| | | @ApiModelProperty(value= "单据类型")
|
| | | private String orderType;
|
| | |
|
| | | //商品编号
|
| | | @ApiModelProperty(value= "商品编号")
|
| | | private String matnr;
|
| | |
|
| | | //批号
|
| | | @ApiModelProperty(value= "批号")
|
| | | private String batch;
|
| | |
|
| | | //数量
|
| | | @ApiModelProperty(value= "数量")
|
| | | private Double anfme;
|
| | |
|
| | | //备注
|
| | | @ApiModelProperty(value= "备注")
|
| | | private String memo;
|
| | |
|
| | | public void sync(Object source) {
|
| | | Synchro.Copy(source, this);
|
| | | }
|
| | |
|
| | | //动态扩展字段
|
| | | public transient Map<String, Object> dynamicFields = new HashMap<>();
|
| | |
|
| | | @JsonAnyGetter
|
| | | public Map<String,Object> getDynamicFields() {
|
| | | return dynamicFields;
|
| | | }
|
| | |
|
| | | public void syncFieldMap(Map<String, Object> map) {
|
| | | ArrayList<String> keys = new ArrayList<>();
|
| | | Field[] fields = this.getClass().getDeclaredFields();
|
| | | for (Field field : fields) {
|
| | | keys.add(field.getName());
|
| | | }
|
| | | keys.add("detlId");
|
| | |
|
| | | Map<String, Object> dynamicFields = new HashMap<>();
|
| | | for (Map.Entry<String, Object> entry : map.entrySet()) {
|
| | | if (keys.contains(entry.getKey())) {
|
| | | continue;
|
| | | }
|
| | | dynamicFields.put(entry.getKey(), entry.getValue());
|
| | | }
|
| | |
|
| | | this.dynamicFields = dynamicFields;
|
| | | }
|
| | |
|
| | | public String getFieldString(String key) {
|
| | | return dynamicFields.get(key).toString();
|
| | | }
|
| | |
|
| | | public void setField(String key, Object value) {
|
| | | dynamicFields.put(key, value);
|
| | | }
|
| | |
|
| | | }
|