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

import cn.estsh.i3plus.pojo.base.annotation.AnnoOutputColumn;
import cn.estsh.i3plus.pojo.base.annotation.DynamicField;
import cn.estsh.i3plus.pojo.base.bean.BaseBean;
import cn.estsh.i3plus.pojo.base.enumutil.CommonEnumUtil;
import cn.estsh.i3plus.pojo.base.enumutil.WmsEnumUtil;
import com.fasterxml.jackson.annotation.JsonFormat;
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;

/**
 * @Description : WMS_产品报工明细信息
 * @Reference :
 * @Author : jessica.chen
 * @CreateDate : 2019-06-26 15:58
 * @Modify:
 **/
@Data
@Entity
@DynamicInsert
@DynamicUpdate
@EqualsAndHashCode(callSuper = true)
@Table(name="WMS_DOC_FG_DETAIL")
@Api("WMS_产品报工明细信息")
public class WmsDocFgDetail extends BaseBean {

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

    @Column(name="WO_NO")
    @ApiParam("ERP工单号")
    public String woNo;

    @Column(name="LINE_NO")
    @ApiParam("生产线")
    public String lineNo;

    @Column(name="COMMIT_TIME")
    @ApiParam("提交时间")
    public String commitTime;

    @Column(name="MFG_LOG_NO")
    @ApiParam("生产批次")
    public String mfgLocNo;

    @Column(name="SN")
    @ApiParam("条码")
    public String sn;

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

    @Column(name="PART_NAME_RDD")
    @ApiParam("物料名称")
    public String partNameRdd;

    @Column(name="BOM_UPDATE")
    @ApiParam("BOM切换标识")
    public String bomUpdate;

    @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="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;

    @Column(name="SID")
    @ApiParam("SID")
    public String sid;
    /**
     * 状态: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;

    @Column(name="REMARK")
    @ApiParam("备注")
    public String remark;

    @Column(name="COMMIT_DATE")
    @ApiParam("提交日期")
    public String commitDate;

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

    @Column(name = "SHIFT_CODE")
    @ApiParam("班次代码")
    private String shiftCode;

    @Column(name = "ACTUAL_REPORT_LINE")
    @ApiParam("实际报工产线")
    private String actualReportLine;

    @Column(name = "BATCH_NO")
    @ApiParam("批号")
    private String batchNo;

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

    @Column(name = "FIX_LOT_NO", nullable = false)
    @ApiParam(value = "特殊批次")
    private String fixLotNo = "";

    @Column(name = "PACKAGE_NO")
    @ApiParam(value = "包装编号")
    private String packageNo;

    @Column(name = "SEQ_NO")
    @ApiParam(value = "父位置号")
    @DynamicField(webFieldType = CommonEnumUtil.FIELD_TYPE.TEXT, isRequire = 2)
    private String seqNo;

    @Column(name = "ITEM_SEQ_NO")
    @ApiParam(value = "子位置号")
    @DynamicField(webFieldType = CommonEnumUtil.FIELD_TYPE.TEXT, isRequire = 2)
    private String itemSeqNo;

    @Column(name = "QUEUE_GROUP_NO")
    @ApiParam(value = "jis料架号")
    private String queueGroupNo;

    @Column(name = "JIS_NO")
    @ApiParam(value = "jis编号")
    private String jisNo;

    @Column(name = "TERMINAL_NO")
    @ApiParam(value = "工位号")
    private String terminalNo;

    @Column(name = "PROCESS_TIME")
    @ApiParam(value = "离开时间")
    private String processTime;

    @Column(name = "PRODUCT_STATUS")
    @ApiParam(value = "成品条码状态")
    @AnnoOutputColumn(refClass = WmsEnumUtil.PRODUCT_STATUS.class, refForeignKey = "value", value = "description")
    private Integer productStatus;

    @Column(name = "CURRENT_SEQ")
    @ApiParam(value = "当前序号")
    private Integer currentSeq;

    @Column(name = "MAX_SEQ")
    @ApiParam(value = "最大序号")
    private Integer maxSeq;

    @Column(name = "RC_TIME")
    @ApiParam(value = "接收时间")
    private String rcTime;




    public WmsDocFgDetail(String jisNo) {
        this.jisNo = jisNo;
    }

    public WmsDocFgDetail() {
    }

    public WmsDocFgDetail(String jisNo, String queueGroupNo, String processTime, Integer temp) {
        this.jisNo = jisNo;
        this.queueGroupNo = queueGroupNo;
        this.processTime = processTime;
    }

    public WmsDocFgDetail(String jisNo, String sn) {
        this.jisNo = jisNo;
        this.sn = sn;
    }


    public WmsDocFgDetail(String sn, String mfgLocNo, String partNo) {
        this.sn = sn;
        this.mfgLocNo = mfgLocNo;
        this.partNo = partNo;
    }
}
