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

import cn.estsh.i3plus.pojo.base.annotation.AnnoOutputColumn;
import cn.estsh.i3plus.pojo.base.bean.BaseBean;
import cn.estsh.i3plus.pojo.base.enumutil.WmsEnumUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiParam;
import lombok.Data;
import lombok.EqualsAndHashCode;
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 :检测结果汇总表
 * @Reference :
 * @Author : jimmy.zeng
 * @CreateDate : 2020-04-23 10:50
 * @Modify:
 **/

@Data
@Entity
@DynamicInsert
@DynamicUpdate
@EqualsAndHashCode(callSuper = true)
@Table(name = "WMS_TEST_RESULT_SUMMARY")
@Api("检测结果汇总表")
public class WmsTestResultSummary extends BaseBean {

    private static final long serialVersionUID = -4600850017207281216L;

    @Column(name = "BH_CODE")
    @ApiParam("BH号")
    public String bhCode;

    @Column(name = "WORK_CENTER_CODE")
    @ApiParam("产线代码")
    public String workCenterCode;

    @Column(name = "PART_NO")
    @ApiParam("物料号")
    public String partNo;

    @Column(name = "PART_NAME")
    @ApiParam("物料名称")
    public String partName;

    @Column(name = "FLAG_NO")
    @ApiParam("客户发往地")
    public String flagNo;

    @Column(name = "IS_QUALIFIED")
    @ApiParam("是否合格")
    @AnnoOutputColumn(refClass = WmsEnumUtil.TRUE_OR_FALSE.class, refForeignKey = "value", value = "description")
    public Integer isQualified;

    @Column(name = "REWORK_STATUS")
    @ApiParam("返修状态")
    @AnnoOutputColumn(refClass = WmsEnumUtil.REWORK_STATUS.class, refForeignKey = "value", value = "description")
    public Integer reworkStatus;

    @Column(name = "REWORK_RESULT")
    @ApiParam("返修结果")
    @AnnoOutputColumn(refClass = WmsEnumUtil.TRUE_OR_FALSE.class, refForeignKey = "value", value = "description")
    public Integer reworkResult;

    @Column(name = "PICK_STATUS")
    @ApiParam("挑选状态")
    @AnnoOutputColumn(refClass = WmsEnumUtil.REWORK_STATUS.class, refForeignKey = "value", value = "description")
    public Integer pickStatus;

    @Column(name = "PICK_RESULT")
    @ApiParam("挑选结果")
    @AnnoOutputColumn(refClass = WmsEnumUtil.TRUE_OR_FALSE.class, refForeignKey = "value", value = "description")
    public Integer pickResult;

    @Column(name = "IS_SYNC", nullable = false)
    @ApiParam("是否同步")
    @AnnoOutputColumn(refClass = WmsEnumUtil.BH_SUMMARY_IS_SYNC.class, refForeignKey = "value", value = "description")
    public Integer isSync = WmsEnumUtil.BH_SUMMARY_IS_SYNC.INIT.getValue();

    @Transient
    @ApiParam("BH类型")
    @AnnoOutputColumn(refClass = WmsEnumUtil.FG_INSTOCK_SN_TYPE.class, refForeignKey = "value", value = "description")
    private Integer bhType;

    @Transient
    @ApiParam("库存条码")
    private String sn;

    @Transient
    @ApiParam("库存条码二维码")
    private String serialSn;

    public WmsTestResultSummary(String organizeCode, String bhCode,
                                String workCenterCode, String partNo,
                                String partName, String flagNo, Integer isQualified,
                                Integer reworkStatus, Integer reworkResult, Integer pickStatus, Integer pickResult) {
        this.organizeCode = organizeCode;
        this.bhCode = bhCode;
        this.workCenterCode = workCenterCode;
        this.partNo = partNo;
        this.partName = partName;
        this.flagNo = flagNo;
        this.isQualified = isQualified;
        this.reworkStatus = reworkStatus;
        this.reworkResult = reworkResult;
        this.pickStatus = pickStatus;
        this.pickResult = pickResult;
    }

    public WmsTestResultSummary(String organizeCode, String bhCode,
                                String workCenterCode, String partNo,
                                String partName, String flagNo, Integer isQualified,
                                Integer reworkStatus, Integer reworkResult, Integer pickStatus, Integer pickResult, Integer bhType) {
        this.organizeCode = organizeCode;
        this.bhCode = bhCode;
        this.workCenterCode = workCenterCode;
        this.partNo = partNo;
        this.partName = partName;
        this.flagNo = flagNo;
        this.isQualified = isQualified;
        this.reworkStatus = reworkStatus;
        this.reworkResult = reworkResult;
        this.pickStatus = pickStatus;
        this.pickResult = pickResult;
        this.bhType = bhType;
    }

    public WmsTestResultSummary() { }

}
