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 java.io.Serializable;
import java.math.BigDecimal;

/**
 * @Description: MES质量标准-明细表（主表：控制计划MES_CONTROL_PLAN）
 * @CreateDate: 2020/9/27
 * @Author: simon.song
 */
@Data
@Entity
@DynamicInsert
@DynamicUpdate
@EqualsAndHashCode(callSuper = true)
@Table(name = "MES_QUALITY_STANDARD")
@Api("中航质量标准明细表")
public class MesQualityStandard extends BaseBean implements Serializable {

    private static final long serialVersionUID = 1454433409471781390L;

    @Column(name = "CONTROL_PLAN_ID")
    @ApiParam("控制计划表主键ID")
    private Long controlPlanId;

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

    @Column(name = "VERSION")
    @ApiParam("版本")
    private Integer version;

    //检测类型：10=首检，20=巡检，30=终检，40=发运检
    @Column(name = "CHECK_TYPE")
    @ApiParam("检测类型")
    private Integer checkType;

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

    @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 = "IS_CONCESSION")
    @ApiParam("是否允许让步")
    private Integer isConcession;

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

    //个数标识：标记那几个数量需要进行检验。使用逗号间隔。如：1,2
    @Column(name = "NUMBER_FLAG")
    @ApiParam("个数标识")
    private String numberFlag;

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

    //任务单类型,动态枚举
    @Column(name = "CHECK_ORDER_TYPE")
    @ApiParam("任务单类型")
    private String checkOrderType;

    //数据来源：10=手工录入，20=PLC，30=DB
    @Column(name = "DATA_SOURCE")
    @ApiParam("数据来源")
    private String dataSource;

    //检验值类型：10=字符串，20=数值
    @Column(name = "CHECK_VALUE_TYPE")
    @ApiParam("检验值类型")
    private String checkValueType;

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

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

}
