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.Index;
import javax.persistence.Table;
import javax.persistence.Transient;

/**
 * @Description : 检测结果明细表
 * @Reference :
 * @Author : jimmy.zeng
 * @CreateDate : 2020-04-23 11:03
 * @Modify:
 **/
@Data
@Entity
@Table(name = "WMS_TEST_RESULT_DETAILS", indexes = {
        @Index(columnList = "BH_CODE"),
        @Index(columnList = "PART_NO"),
        @Index(columnList = "WORK_CENTER_CODE")
})
@DynamicInsert
@DynamicUpdate
@EqualsAndHashCode(callSuper = true)
@Api("检测结果明细表")
public class WmsTestResultDetails extends BaseBean {

    private static final long serialVersionUID = -3295112411840494690L;
    @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 = "CHECK_TYPE_CODE")
    @ApiParam("检测大类")
    public String checkTypeCode;

    @Column(name = "QR_CODE")
    @ApiParam("二维码")
    public String qrCode;

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

    @Column(name = "IS_FINISH")
    @ApiParam("是否完成")
    @AnnoOutputColumn(refClass = WmsEnumUtil.TRUE_OR_FALSE.class, refForeignKey = "value", value = "description")
    public Integer isFinish;

    @Column(name = "CHECK_VALUE")
    @ApiParam("检测值")
    public String checkValue;

    @Column(name = "IS_SYNC")
    @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("已检测数")
    private Long checkSize;

    @Transient
    @ApiParam("移动单单号")
    private String moveNo;

    public WmsTestResultDetails() {
    }

    public WmsTestResultDetails(String partNo, String checkTypeCode, String bhCode, Long checkSize) {
        this.partNo = partNo;
        this.checkTypeCode = checkTypeCode;
        this.bhCode = bhCode;
        this.checkSize = checkSize;
    }
}
