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

import cn.estsh.i3plus.pojo.base.bean.BaseBean;
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;
import java.io.Serializable;
import java.util.List;

/**
 * @Description:
 * @Reference:
 * @Author: joke.wang
 * @CreateDate: 2019\10\12 14:46
 * @Modify:
 **/
@Data
@Entity
@DynamicInsert
@DynamicUpdate
@EqualsAndHashCode(callSuper = true)
@Table(name = "MES_QC_CHECK_STANDARD")
@Api("质量检测标准")
public class MesQcCheckStandard extends BaseBean implements Serializable {
    private static final long serialVersionUID = 3977375527789854590L;

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

    @Column(name = "WORK_CENTER_CODE")
    @ApiParam("工作中心代码")
    private String workCenterCode;

    @Column(name = "WORK_CELL_CODE")
    @ApiParam("工作单元代码")
    private String workCellCode;

    @Column(name = "CHECK_TYPE")
    @ApiParam("检测类型")
    private Integer checkType;

    @Column(name = "CHECK_ITEM")
    @ApiParam("检测项")
    private String checkItem;

    @Column(name = "CHECK_STANDARD")
    @ApiParam("检测标准")
    private String checkStandard;

    @Column(name = "CHECK_GUIDE")
    @ApiParam("检测指导")
    private String checkGuide;

    @Column(name = "CHECK_FREQUENCY")
    @ApiParam("频率")
    private String checkFrequency;

    @Column(name = "CHECK_ITEM_TYPE")
    @ApiParam("检测项类型")
    private String checkItemType;

    @Column(name = "CHECK_INTERVAL")
    @ApiParam("间隔时间")
    private Integer checkInterval = 0;

    @Column(name = "IS_CONCESSION")
    @ApiParam("是否允许让步")
    private Integer isConcession;

    @Column(name = "NUMBER_FLAG")
    @ApiParam("数量标识")
    private String numberFlag;

    @Column(name = "QTY")
    @ApiParam("检测数量")
    private Integer qty;

    @Column(name = "CUST_CODE")
    @ApiParam("客户代码")
    private String custCode;

    @Column(name = "CHECK_ORDER_TYPE")
    @ApiParam("任务单类型")
    private String checkOrderType;

    @Column(name = "DATA_SOURCE")
    @ApiParam("数据来源")
    private String dataSource;

    @Column(name = "CHECK_VALUE_TYPE")
    @ApiParam("检测值类型")
    private String checkValueType;

    @Column(name = "CHECK_CFG_NO")
    @ApiParam("检测值配置编号")
    private String checkCfgNo;

    @Column(name = "MAXIMUM", columnDefinition = "decimal(18,8)")
    @ColumnDefault("0")
    @ApiParam("最大数")
    private Double maximum = 0d;

    @Column(name = "MINIMUM", columnDefinition = "decimal(18,8)")
    @ColumnDefault("0")
    @ApiParam("最小数")
    private Double minimum = 0d;

    @Column(name = "IS_KEY_CHECK_ITEM")
    @ApiParam("是否关键检测项")
    private Integer isKeyCheckItem;

    @Transient
    @ApiParam("物料名称")
    private String partName;

    @Transient
    @ApiParam("检测结果")
    private String checkResult;

    @Transient
    @ApiParam("检测值")
    private String checkValue;

    @Transient
    @ApiParam("检测类型名称")
    private String checkTypeName;

    @Transient
    @ApiParam("检测项类型名称")
    private String checkItemTypeName;

    @Transient
    private List<MesQcCheckStandard> childQcList;

    @Transient
    @ApiParam("备注")
    private String memo;

    public MesQcCheckStandard() {
    }

    public MesQcCheckStandard(Long id, String partNo, String workCenterCode, String workCellCode, Integer checkType, String checkItem, String checkStandard
            , String checkGuide, String checkFrequency, String partName, String checkItemType, String checkItemTypeName) {
        this.id = id;
        this.partNo = partNo;
        this.workCenterCode = workCenterCode;
        this.workCellCode = workCellCode;
        this.checkType = checkType;
        this.checkItem = checkItem;
        this.checkStandard = checkStandard;
        this.checkGuide = checkGuide;
        this.checkFrequency = checkFrequency;
        this.partName = partName;
        this.checkItemType = checkItemType;
        this.checkItemTypeName = checkItemTypeName;
    }
}
