|  |  | 
 |  |  | import com.fasterxml.jackson.annotation.JsonAnyGetter;
 | 
 |  |  | import com.zy.asrs.common.utils.Synchro;
 | 
 |  |  | import com.zy.asrs.framework.common.Cools;
 | 
 |  |  | import com.zy.asrs.framework.common.DateUtils;
 | 
 |  |  | import com.zy.asrs.framework.common.SpringUtils;
 | 
 |  |  | import com.zy.asrs.wms.asrs.service.LocService;
 | 
 |  |  | import com.zy.asrs.wms.asrs.service.MatService;
 | 
 |  |  | import com.zy.asrs.wms.asrs.service.TagService;
 | 
 |  |  | import com.zy.asrs.wms.system.entity.Host;
 | 
 |  |  | import com.zy.asrs.wms.system.entity.User;
 | 
 |  |  | import com.zy.asrs.wms.system.service.HostService;
 | 
 |  |  | import com.zy.asrs.wms.system.service.UserService;
 | 
 |  |  | import io.swagger.annotations.ApiModelProperty;
 | 
 |  |  | import lombok.Data;
 | 
 |  |  | import lombok.experimental.Delegate;
 | 
 |  |  | import org.springframework.format.annotation.DateTimeFormat;
 | 
 |  |  | 
 | 
 |  |  | import java.io.Serializable;
 | 
 |  |  | 
 |  |  |      * ID
 | 
 |  |  |      */
 | 
 |  |  |     @ApiModelProperty(value= "ID")
 | 
 |  |  |     @TableId(value = "id", type = IdType.AUTO)
 | 
 |  |  |     private Long id;
 | 
 |  |  | 
 | 
 |  |  |     /**
 | 
 |  |  | 
 |  |  |      */
 | 
 |  |  |     @ApiModelProperty(value= "商品")
 | 
 |  |  |     private Long matId;
 | 
 |  |  | 
 | 
 |  |  |     @ApiModelProperty("仓库类型")
 | 
 |  |  |     private Integer orderType;
 | 
 |  |  | 
 | 
 |  |  |     /**
 | 
 |  |  |      * 商品编号
 | 
 |  |  | 
 |  |  |     @ApiModelProperty(value= "所属机构")
 | 
 |  |  |     private Long hostId;
 | 
 |  |  | 
 | 
 |  |  |     @ApiModelProperty("物料名称")
 | 
 |  |  |     private String maktx;
 | 
 |  |  | 
 | 
 |  |  |     @ApiModelProperty("规格")
 | 
 |  |  |     private String specs;
 | 
 |  |  | 
 | 
 |  |  |     @ApiModelProperty("型号")
 | 
 |  |  |     private String model;
 | 
 |  |  | 
 | 
 |  |  |     @ApiModelProperty("品牌")
 | 
 |  |  |     private String brand;
 | 
 |  |  | 
 | 
 |  |  |     @ApiModelProperty("颜色")
 | 
 |  |  |     private String color;
 | 
 |  |  | 
 | 
 |  |  |     @ApiModelProperty("产地")
 | 
 |  |  |     private String origin;
 | 
 |  |  | 
 | 
 |  |  |     /**
 | 
 |  |  |      * 状态 1: 正常  0: 禁用
 | 
 |  |  |      */
 | 
 |  |  |     @ApiModelProperty(value= "状态 1: 正常  0: 禁用  ")
 | 
 |  |  |     private Integer status;
 | 
 |  |  | 
 | 
 |  |  |     @ApiModelProperty("分类标识")
 | 
 |  |  |     private Long tagId;
 | 
 |  |  | 
 | 
 |  |  |     /**
 | 
 |  |  |      * 是否删除 1: 是  0: 否
 | 
 |  |  | 
 |  |  | //            null    // 备注
 | 
 |  |  | //    );
 | 
 |  |  | 
 | 
 |  |  |     public String getLocId$(){
 | 
 |  |  |         LocService service = SpringUtils.getBean(LocService.class);
 | 
 |  |  |         Loc loc = service.getById(this.locId);
 | 
 |  |  |         if (!Cools.isEmpty(loc)){
 | 
 |  |  |             return String.valueOf(loc.getLocNo());
 | 
 |  |  | //    public String getLocId$(){
 | 
 |  |  | //        LocService service = SpringUtils.getBean(LocService.class);
 | 
 |  |  | //        Loc loc = service.getById(this.locId);
 | 
 |  |  | //        if (!Cools.isEmpty(loc)){
 | 
 |  |  | //            return String.valueOf(loc.getLocNo());
 | 
 |  |  | //        }
 | 
 |  |  | //        return null;
 | 
 |  |  | //    }
 | 
 |  |  | 
 | 
 |  |  |     public String getTagId$() {
 | 
 |  |  |         TagService tagService = SpringUtils.getBean(TagService.class);
 | 
 |  |  |         Tag byId = tagService.getById(this.tagId);
 | 
 |  |  |         if (!Cools.isEmpty(byId)){
 | 
 |  |  |             return byId.getName();
 | 
 |  |  |         }
 | 
 |  |  |         return null;
 | 
 |  |  |     }
 | 
 |  |  | 
 | 
 |  |  |     public String getMatId$(){
 | 
 |  |  |         MatService service = SpringUtils.getBean(MatService.class);
 | 
 |  |  |         Mat mat = service.getById(this.matId);
 | 
 |  |  |         if (!Cools.isEmpty(mat)){
 | 
 |  |  |             return String.valueOf(mat.getId());
 | 
 |  |  |         }
 | 
 |  |  |         return null;
 | 
 |  |  |     public String getType$() {
 | 
 |  |  |        return (this.locNo.contains("B") || this.locNo.contains("C")) ? "平库" : "立库";
 | 
 |  |  |     }
 | 
 |  |  | 
 | 
 |  |  |     public String getDewell$() {
 | 
 |  |  |         return DateUtils.diff(new Date(), createTime) + "天";
 | 
 |  |  |     }
 | 
 |  |  | 
 | 
 |  |  |     public String getHostId$(){
 | 
 |  |  | 
 |  |  |     }
 | 
 |  |  | 
 | 
 |  |  |     //动态扩展字段
 | 
 |  |  |     public transient Map<String, Object> dynamicFields = new HashMap<>();
 | 
 |  |  | //    public transient Map<String, Object> dynamicFields = new HashMap<>();
 | 
 |  |  | 
 | 
 |  |  |     @JsonAnyGetter
 | 
 |  |  |     public Map<String,Object> getDynamicFields() {
 | 
 |  |  |         return dynamicFields;
 | 
 |  |  |     }
 | 
 |  |  | 
 | 
 |  |  |     public void syncField(List<LocDetlField> list) {
 | 
 |  |  |         ArrayList<String> keys = new ArrayList<>();
 | 
 |  |  |         Field[] fields = this.getClass().getFields();
 | 
 |  |  |         for (Field field : fields) {
 | 
 |  |  |             keys.add(field.getName());
 | 
 |  |  |         }
 | 
 |  |  | 
 | 
 |  |  |         Map<String, Object> dynamicFields = new HashMap<>();
 | 
 |  |  |         for (LocDetlField locDetlField : list) {
 | 
 |  |  |             if (keys.contains(locDetlField.getName())) {
 | 
 |  |  |                 continue;
 | 
 |  |  |             }
 | 
 |  |  |             dynamicFields.put(locDetlField.getName(), locDetlField.getValue());
 | 
 |  |  |         }
 | 
 |  |  | 
 | 
 |  |  |         this.dynamicFields = 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);
 | 
 |  |  |     }
 | 
 |  |  | //    @JsonAnyGetter
 | 
 |  |  | //    public Map<String,Object> getDynamicFields() {
 | 
 |  |  | //        return dynamicFields;
 | 
 |  |  | //    }
 | 
 |  |  | //
 | 
 |  |  | //    public void syncField(List<LocDetlField> list) {
 | 
 |  |  | //        ArrayList<String> keys = new ArrayList<>();
 | 
 |  |  | //        Field[] fields = this.getClass().getFields();
 | 
 |  |  | //        for (Field field : fields) {
 | 
 |  |  | //            keys.add(field.getName());
 | 
 |  |  | //        }
 | 
 |  |  | //
 | 
 |  |  | //        Map<String, Object> dynamicFields = new HashMap<>();
 | 
 |  |  | //        for (LocDetlField locDetlField : list) {
 | 
 |  |  | //            if (keys.contains(locDetlField.getName())) {
 | 
 |  |  | //                continue;
 | 
 |  |  | //            }
 | 
 |  |  | //            dynamicFields.put(locDetlField.getName(), locDetlField.getValue());
 | 
 |  |  | //        }
 | 
 |  |  | //
 | 
 |  |  | //        this.dynamicFields = 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);
 | 
 |  |  | //    }
 | 
 |  |  | 
 | 
 |  |  | }
 |