package com.steerinfo.ems.ifmesemsproductorder.model;

import java.math.BigDecimal;

import com.steerinfo.framework.model.IBasePO;

import io.swagger.annotations.ApiModelProperty;

import com.alibaba.fastjson.JSONObject;
import com.steerinfo.ems.Utils.DateUtils;

public class IfMesEmsProductorder implements IBasePO<String> {

    private static final long serialVersionUID = 1L;

    /**
     * ID(FID,VARCHAR,40)
     */
    @ApiModelProperty(value="ID",required=true)
    private String fid;

    /**
     * 工厂编码(WORKS,VARCHAR,40)
     */
    @ApiModelProperty(value="工厂编码",required=false)
    private String works;

    /**
     * 产线编码(PRODLINE,VARCHAR,20)
     */
    @ApiModelProperty(value="产线编码",required=false)
    private String prodline;

    /**
     * 开始日期(SPRODATE,DATE,7)
     */
    @ApiModelProperty(value="开始日期",required=false)
    private String sprodate;

    /**
     * 结束日期(EPRODATE,DATE,7)
     */
    @ApiModelProperty(value="结束日期",required=false)
    private String eprodate;

    /**
     * 订单号(ORDERNO,VARCHAR,20)
     */
    @ApiModelProperty(value="订单号",required=false)
    private String orderno;

    /**
     * 物料编码(MATERIALCODE,VARCHAR,40)
     */
    @ApiModelProperty(value="物料编码",required=false)
    private String materialcode;
    
    /**
     * 物料名称(MATERIALNAME,VARCHAR,80)
     */
    @ApiModelProperty(value="物料名称",required=false)
    private String materialname;
    
    /**
     * 单位(UNIT,VARCHAR,20)
     */
    @ApiModelProperty(value="单位",required=false)
    private String unit;
    
    /**
     * 数量(QTY,NUMBER,0)
     */
    @ApiModelProperty(value="数量",required=false)
    private BigDecimal qty;
        
    /**
     * 创建时间(CREATETIME,DATE,7)
     */
    @ApiModelProperty(value="创建时间",required=false)
    private String createtime;
        
    /**
     * 状态 0已创建 1已读取(STATUS,VARCHAR,20)
     */
    @ApiModelProperty(value="状态 0已创建 1已读取",required=false)
    private String status;
        
    /**
     * 读取时间(SENDTIME,DATE,7)
     */
    @ApiModelProperty(value="读取时间",required=false)
    private String sendtime;

    /**
     * 备注(MEMO,VARCHAR,100)
     */
    @ApiModelProperty(value="备注",required=false)
    private String memo;

    public String getFid() {
        return fid;
    }
    public void setFid(String fid) {
        this.fid = fid == null ? null : fid;
    }
    
    public String getWorks() {
        return works;
    }
    public void setWorks(String works) {
        this.works = works == null ? null : works;
    }

    public String getProdline() {
        return prodline;
    }
    public void setProdline(String prodline) {
        this.prodline = prodline == null ? null : prodline;
    }
    
    public String getSprodate() {
        return sprodate;
    }
    public void setSprodate(String sprodate) {
        this.sprodate = sprodate == null ? null : sprodate;
    }

    public String getEprodate() {
        return eprodate;
    }
    public void setEprodate(String eprodate) {
        this.eprodate = eprodate == null ? null : eprodate;
    }
    
    public String getOrderno() {
        return orderno;
    }
    public void setOrderno(String orderno) {
        this.orderno = orderno == null ? null : orderno;
    }
    
    public String getMaterialcode() {
        return materialcode;
    }
    public void setMaterialcode(String materialcode) {
        this.materialcode = materialcode == null ? null : materialcode;
    }
    
    public String getMaterialname() {
        return materialname;
    }
    public void setMaterialname(String materialname) {
        this.materialname = materialname == null ? null : materialname;
    }
    
    public String getUnit() {
        return unit;
    }
    public void setUnit(String unit) {
        this.unit = unit == null ? null : unit;
    }
    
    public BigDecimal getQty() {
        return qty;
    }
    public void setQty(BigDecimal qty) {
        this.qty = qty == null ? null : qty;
    }
    
    public String getCreatetime() {
        return createtime;
    }
    public void setCreatetime(String createtime) {
        this.createtime = createtime == null ? null : createtime;
    }
    
    public String getStatus() {
        return status;
    }
    public void setStatus(String status) {
        this.status = status == null ? null : status;
    }
    
    public String getSendtime() {
        return sendtime;
    }
    public void setSendtime(String sendtime) {
        this.sendtime = sendtime == null ? null : sendtime;
    }

    public String getMemo() {
        return memo;
    }
    public void setMemo(String memo) {
        this.memo = memo == null ? null : memo;
    }
    
    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", fid=").append(fid);
        sb.append(", works=").append(works);
        sb.append(", prodline=").append(prodline);
        sb.append(", sprodate=").append(sprodate);
        sb.append(", eprodate=").append(eprodate);
        sb.append(", orderno=").append(orderno);
        sb.append(", materialcode=").append(materialcode);
        sb.append(", materialname=").append(materialname);
        sb.append(", unit=").append(unit);
        sb.append(", qty=").append(qty);
        sb.append(", createtime=").append(createtime);
        sb.append(", status=").append(status);
        sb.append(", sendtime=").append(sendtime);
        sb.append(", memo=").append(memo);
        sb.append("]");
        return sb.toString();
    }

    /**
	 * JSONObject对象转IfMesEmsProductorder对象
	 * 
	 * @param jo   JSONObject对象
	 * @return
	 */
	public void jsonobjectToIfMesEmsProductorder(JSONObject jo){
		try {
            this.fid = jo.getString("fid");
            this.works = jo.getString("works");
            this.prodline = jo.getString("prodline");
            this.sprodate = DateUtils.stampToDate(jo.getString("sprodate"));
            this.eprodate = DateUtils.stampToDate(jo.getString("eprodate"));
            this.orderno = jo.getString("orderno");
            this.materialcode = jo.getString("materialcode");
            this.materialname = jo.getString("materialname");
            this.unit = jo.getString("unit");
            this.qty = new BigDecimal(jo.getString("qty"));
            this.createtime = DateUtils.stampToDate(jo.getString("createtime"));
            this.status = jo.getString("status");
            this.sendtime = DateUtils.stampToDate(jo.getString("sendtime"));
            this.memo = jo.getString("memo");
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

    @Override
    public String getId() {
        return fid;
    }

    @Override
    public void setId(String s) {

    }
}