Преглед изворни кода

物料传到公有库实体转换方法

hejq пре 8 година
родитељ
комит
92aa6c60fd

+ 27 - 0
src/main/java/com/uas/ps/product/entity/Constant.java

@@ -0,0 +1,27 @@
+package com.uas.ps.product.entity;
+
+/**
+ * 一些基本定义的常量
+ *
+ * Created by hejq on 2018-01-13.
+ */
+public class Constant {
+
+    /**
+     * 是
+     */
+    public static final short YES = 1;
+
+    /**
+     * 否
+     */
+    public static final short NO = 0;
+
+    /**
+     * 置顶
+     */
+    public static final short TOP = 9;
+
+    public Constant() {
+    }
+}

+ 348 - 2
src/main/java/com/uas/ps/product/entity/Prod.java

@@ -3,6 +3,7 @@ package com.uas.ps.product.entity;
 import com.uas.ps.entity.Product;
 
 import java.io.Serializable;
+import java.util.Date;
 
 /**
  * ERP系统的产品
@@ -14,14 +15,359 @@ public class Prod implements Serializable {
 
     private static final long serialVersionUID = 1L;
 
+    /**
+     * erp物料id
+     */
+    private Long pr_id;
+
+    /**
+     * 物料编号
+     */
+    private String pr_code;
+
+    /**
+     * 物料名称
+     */
+    private String pr_detail;
+
+    /**
+     * 物料规格
+     */
+    private String pr_spec;
+
+    /**
+     * 物料单位
+     */
+    private String pr_unit;
+
+    /**
+     * 最新包装数
+     */
+    private Double pr_zxbzs;
+
+    /**
+     * 最新订货量
+     */
+    private Double pr_zxdhl;
+
+    /**
+     * 采购提前期,天数
+     */
+    private Double pr_leadtime;
+
+    /**
+     * 备料提前期,天数
+     */
+    private Double pr_ltinstock;
+
+    /**
+     * 物料品牌
+     */
+    private String pr_brand;
+
+    /**
+     * 原厂型号
+     */
+    private String pr_orispeccode;
+
+    /**
+     * 标准料号
+     */
+    private String pr_uuid;
+
+    /**
+     * 状态: ‘已审核’->有效;‘已禁用’->失效
+     */
+    private String pr_status;
+
+    /**
+     * 销售状态
+     */
+    private Short pr_issale;
+
+    /**
+     * 采购状态
+     */
+    private Short pr_ispurchase;
+
+    /**
+     * 开放采购状态
+     */
+    private Short pr_isshow;
+
+    /**
+     * 开放销售状态
+     */
+    private Short pr_ispubsale;
+
+    /**
+     * 平台物料id(现在对应也是公共物料库的id)
+     */
+    private Long b2b_id;
+
+    /**
+     * 类目(平台)
+     */
+    private String kind;
+
+    /**
+     * 品牌(平台)
+     */
+    private String pbrand;
+
+    /**
+     * 型号(平台)
+     */
+    private String pcmpcode;
+
+    /**
+     * 类目英文
+     */
+    private String kinden;
+
+    /**
+     * 品牌英文
+     */
+    private String pbranden;
+
+    /**
+     * 是否是标准;1: 标准, 0: 非标准
+     */
+    private Short standard;
+
+    public Long getPr_id() {
+        return pr_id;
+    }
+
+    public void setPr_id(Long pr_id) {
+        this.pr_id = pr_id;
+    }
+
+    public String getPr_code() {
+        return pr_code;
+    }
+
+    public void setPr_code(String pr_code) {
+        this.pr_code = pr_code;
+    }
+
+    public String getPr_detail() {
+        return pr_detail;
+    }
+
+    public void setPr_detail(String pr_detail) {
+        this.pr_detail = pr_detail;
+    }
+
+    public String getPr_spec() {
+        return pr_spec;
+    }
+
+    public void setPr_spec(String pr_spec) {
+        this.pr_spec = pr_spec;
+    }
+
+    public String getPr_unit() {
+        return pr_unit;
+    }
+
+    public void setPr_unit(String pr_unit) {
+        this.pr_unit = pr_unit;
+    }
+
+    public Double getPr_zxbzs() {
+        return pr_zxbzs;
+    }
+
+    public void setPr_zxbzs(Double pr_zxbzs) {
+        this.pr_zxbzs = pr_zxbzs;
+    }
+
+    public Double getPr_zxdhl() {
+        return pr_zxdhl;
+    }
+
+    public void setPr_zxdhl(Double pr_zxdhl) {
+        this.pr_zxdhl = pr_zxdhl;
+    }
+
+    public Double getPr_leadtime() {
+        return pr_leadtime;
+    }
+
+    public void setPr_leadtime(Double pr_leadtime) {
+        this.pr_leadtime = pr_leadtime;
+    }
+
+    public Double getPr_ltinstock() {
+        return pr_ltinstock;
+    }
+
+    public void setPr_ltinstock(Double pr_ltinstock) {
+        this.pr_ltinstock = pr_ltinstock;
+    }
+
+    public String getPr_brand() {
+        return pr_brand;
+    }
+
+    public void setPr_brand(String pr_brand) {
+        this.pr_brand = pr_brand;
+    }
+
+    public String getPr_orispeccode() {
+        return pr_orispeccode;
+    }
+
+    public void setPr_orispeccode(String pr_orispeccode) {
+        this.pr_orispeccode = pr_orispeccode;
+    }
+
+    public String getPr_uuid() {
+        return pr_uuid;
+    }
+
+    public void setPr_uuid(String pr_uuid) {
+        this.pr_uuid = pr_uuid;
+    }
+
+    public String getPr_status() {
+        return pr_status;
+    }
+
+    public void setPr_status(String pr_status) {
+        this.pr_status = pr_status;
+    }
+
+    public Short getPr_issale() {
+        return pr_issale;
+    }
+
+    public void setPr_issale(Short pr_issale) {
+        this.pr_issale = pr_issale;
+    }
+
+    public Short getPr_ispurchase() {
+        return pr_ispurchase;
+    }
+
+    public void setPr_ispurchase(Short pr_ispurchase) {
+        this.pr_ispurchase = pr_ispurchase;
+    }
+
+    public Short getPr_isshow() {
+        return pr_isshow;
+    }
+
+    public void setPr_isshow(Short pr_isshow) {
+        this.pr_isshow = pr_isshow;
+    }
+
+    public Short getPr_ispubsale() {
+        return pr_ispubsale;
+    }
+
+    public void setPr_ispubsale(Short pr_ispubsale) {
+        this.pr_ispubsale = pr_ispubsale;
+    }
+
+    public Long getB2b_id() {
+        return b2b_id;
+    }
+
+    public void setB2b_id(Long b2b_id) {
+        this.b2b_id = b2b_id;
+    }
+
+    public String getKind() {
+        return kind;
+    }
+
+    public void setKind(String kind) {
+        this.kind = kind;
+    }
+
+    public String getPbrand() {
+        return pbrand;
+    }
+
+    public void setPbrand(String pbrand) {
+        this.pbrand = pbrand;
+    }
+
+    public String getPcmpcode() {
+        return pcmpcode;
+    }
+
+    public void setPcmpcode(String pcmpcode) {
+        this.pcmpcode = pcmpcode;
+    }
+
+    public String getKinden() {
+        return kinden;
+    }
+
+    public void setKinden(String kinden) {
+        this.kinden = kinden;
+    }
+
+    public String getPbranden() {
+        return pbranden;
+    }
+
+    public void setPbranden(String pbranden) {
+        this.pbranden = pbranden;
+    }
+
+    public Short getStandard() {
+        return standard;
+    }
+
+    public void setStandard(Short standard) {
+        this.standard = standard;
+    }
+
     /**
      * 转为平台的产品
      *
      * @return
      */
     public Product convert() {
-        // TODO
-        return null;
+        Product product = new Product();
+        // 如果传过来的信息有原厂型号数据,赋值,否则将规格赋值给原厂型号
+        if (this.pr_orispeccode != null) {
+            product.setCmpCode(this.pr_orispeccode);
+        } else {
+            product.setCmpCode(this.pr_spec);
+        }
+        product.setCmpUuid(this.pr_uuid);
+        product.setTitle(this.pr_detail);
+        product.setSpec(this.pr_spec);
+        product.setUnit(this.pr_unit);
+        product.setMinPack(this.pr_zxbzs);
+        product.setMinOrder(this.pr_zxdhl);
+        product.setLeadTime(this.pr_leadtime);
+        product.setLtinstock(this.pr_ltinstock);
+        product.setSourceId(this.pr_id);
+        product.setBrand(this.pr_brand);
+        product.setCode(this.pr_code);
+        // TODO 这里设置企业UU号
+        // 默认设置为非标准,到平台做匹配更新
+        product.setStandard(Constant.NO);
+        // 默认采购状态开启
+        product.setIsPurchase(Constant.YES);
+        // 默认销售状态开启
+        product.setIsSale(Constant.YES);
+        // erp上传的数据默认赋值给标准信息
+        product.setKind(product.getTitle());
+        product.setIsPubsale(this.pr_ispubsale);
+        product.setIsPurchase(this.pr_ispurchase);
+        product.setIsSale(this.pr_issale);
+        product.setIsShow(this.pr_isshow);
+        product.setStandard(this.standard);
+        product.setSourceApp("ERP");
+        product.setErpDate(new Date());
+        return product;
     }
 
 }