package cn.estsh.i3plus.pojo.wms.bean;

import cn.estsh.i3plus.pojo.base.bean.BaseBean;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiParam;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.hibernate.annotations.ColumnDefault;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import javax.persistence.Transient;

/**
 * @Description :SAP_产品报工汇总表
 * @Reference :
 * @Author : amy
 * @CreateDate : 2019-06-27 15:40
 * @Modify:
 **/
@Data
@Entity
@DynamicInsert
@DynamicUpdate
@EqualsAndHashCode(callSuper = true)
@Table(name="SAP_DOC_FG_SUM")
@Api("SAP_产品报工汇总表")
public class SapDocFgSum extends BaseBean {

    private static final long serialVersionUID = 6550731177315159003L;
    @Column(name="ORDER_NO")
    @ApiParam("订单号")
    public String orderNo;

    @Column(name="PART_NO")
    @ApiParam(value = "物料编码")
    public String partNo;

    @Column(name="PART_NAME_RDD")
    @ApiParam("单位")
    public String partNameRdd;

    @Column(name="QTY", columnDefinition = "decimal(18,8)")
    @ColumnDefault("0")
    @ApiParam(value = "数量", example = "0")
    public Double qty;

    @Column(name="UNIT")
    @ApiParam("单位")
    public String unit;

    @Column(name="ERP_WORK_CENTER")
    @ApiParam("ERP_工作中心")
    public String erpWorkCenter;

    @Column(name="IN_AREA_NO")
    @ApiParam("入库ERP库存地")
    public String inAreaNo;

    @Column(name="ITEM_PART_NO")
    @ApiParam("子物料号")
    public String itemPartNo;

    @Column(name="ITEM_PART_NAME")
    @ApiParam("子料物料描述")
    public String itemPartName;

    @Column(name="ITEM_UNIT")
    @ApiParam("子计量单位")
    public String itemUnit;

    @Column(name="ITEM_QTY", columnDefinition = "decimal(18,8)")
    @ColumnDefault("0")
    @ApiParam(value = "子用量", example = "0")
    public Double itemQty;

    @Column(name="OUT_AREA_NO")
    @ApiParam("消耗ERP库存地")
    public String outAreaNo;

    /**
     * 状态:10=新建,20=已处理,30=处理出错
     */
    @Column(name="ORDER_STATUS")
    @ApiParam(value = "状态", example = "1")
    public Integer orderStatus;

    /**
     * 数据来源:ZMMES=知明MES,TBMES=MES接口
     */
    @Column(name="SRC")
    @ApiParam("单据来源")
    public String src;

    /**
     * 是否锁定：1=锁定 2=未锁定
     */
    @Column(name="IS_LOCK")
    @ApiParam(value = "是否锁定", example = "2")
    public Integer isLock;

    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @ApiParam(value = "BOM生效日期")
    @Column(name = "EFF_START_TIME")
    private String effStartTime;

    @Transient
    @ApiParam(value = "备注")
    private String errorMsg;

    @Transient
    @ApiParam(value = "生产线")
    private String lineNo;

    @JsonSerialize(using = ToStringSerializer.class)
    @Transient
    public Long wdfdId;

    @Column(name = "BOM_VERSION")
    @ApiParam(value = "BOM版本号")
    private String bomVersion;

    @Column(name = "FG_ORDER_NO")
    @ApiParam(value = "产品报工orderNo")
    private String fGOrderNo;

    @Column(name = "SEQ_NO")
    @ApiParam(value = "父位置号")
    private String seqNo;

    @Column(name = "ITEM_SEQ_NO")
    @ApiParam(value = "子位置号")
    private String itemSeqNo;

    public SapDocFgSum(){}

    public SapDocFgSum(Long wdfdId, Double qty, String partNo, String partNameRdd, String unit, String erpWorkCenter, String inAreaNo,
                       String itemPartNo, String itemPartName, String itemUnit, Double itemQty, String outAreaNo, String src, Integer isLock,
                       String effStartTime, String bomVersion, String fGOrderNo, String seqNo, String itemSeqNo) {
        this.wdfdId = wdfdId;
        this.partNo = partNo;
        this.partNameRdd = partNameRdd;
        this.qty = qty;
        this.unit = unit;
        this.erpWorkCenter = erpWorkCenter;
        this.inAreaNo = inAreaNo;
        this.itemPartNo = itemPartNo;
        this.itemPartName = itemPartName;
        this.itemUnit = itemUnit;
        this.outAreaNo = outAreaNo;
        this.itemQty = itemQty;
        this.src = src;
        this.isLock = isLock;
        this.effStartTime = effStartTime;
        this.bomVersion = bomVersion;
        this.fGOrderNo = fGOrderNo;
        this.seqNo = seqNo;
        this.itemSeqNo = itemSeqNo;
    }

    public SapDocFgSum(Long wdfdId, Double qty, String partNo, String partNameRdd, String unit, String erpWorkCenter, String inAreaNo,
                       String itemPartNo, String itemPartName, String itemUnit, Double itemQty, String outAreaNo, String src, Integer isLock,
                       String effStartTime, String bomVersion, String fGOrderNo, String seqNo, String itemSeqNo, String lineNo) {
        this.wdfdId = wdfdId;
        this.partNo = partNo;
        this.partNameRdd = partNameRdd;
        this.qty = qty;
        this.unit = unit;
        this.erpWorkCenter = erpWorkCenter;
        this.inAreaNo = inAreaNo;
        this.itemPartNo = itemPartNo;
        this.itemPartName = itemPartName;
        this.itemUnit = itemUnit;
        this.outAreaNo = outAreaNo;
        this.itemQty = itemQty;
        this.src = src;
        this.isLock = isLock;
        this.effStartTime = effStartTime;
        this.bomVersion = bomVersion;
        this.fGOrderNo = fGOrderNo;
        this.seqNo = seqNo;
        this.itemSeqNo = itemSeqNo;
        this.lineNo = lineNo;
    }

    public SapDocFgSum(Long wdfdId, Double qty,String partNo, String partNameRdd, String unit, String erpWorkCenter, String inAreaNo,
                       String itemPartNo, String itemPartName, String itemUnit, Double itemQty,String outAreaNo, String src, Integer isLock, String effStartTime) {
        this.wdfdId = wdfdId;
        this.partNo = partNo;
        this.partNameRdd = partNameRdd;
        this.qty = qty;
        this.unit = unit;
        this.erpWorkCenter = erpWorkCenter;
        this.inAreaNo = inAreaNo;
        this.itemPartNo = itemPartNo;
        this.itemPartName = itemPartName;
        this.itemUnit = itemUnit;
        this.outAreaNo = outAreaNo;
        this.itemQty = itemQty;
        this.src = src;
        this.isLock = isLock;
        this.effStartTime = effStartTime;
    }
}
