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

import cn.estsh.i3plus.ext.mes.pojo.util.MesExtEnumUtil;
import cn.estsh.i3plus.pojo.base.annotation.AnnoOutputColumn;
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.*;
import java.io.Serializable;

/**
 * @Author: wangjie
 * @CreateDate: 2019/12/4 1:28 下午
 * @Description:
 **/
@Data
@Entity
@DynamicInsert
@DynamicUpdate
@EqualsAndHashCode(callSuper = true)
@Inheritance(strategy = InheritanceType.JOINED)
@Table(name = "MES_OQC_RULE_NOTE_DETAIL", indexes = {
        @Index(columnList = "PART_NO"),
        @Index(columnList = "OQC_NO_TYPE, PART_NO"),
        @Index(columnList = "OQC_NO_TYPE, CATEGORY_CODE3")
})
@Api("出货检验式样书明细表")
public class MesOqcRuleNoteDetail extends BaseBean implements Serializable {

    private static final long serialVersionUID = 3593060807538687545L;

    @Column(
            name = "SEQ",
            columnDefinition = "decimal(18,8)"
    )
    @ColumnDefault("0")
    @ApiParam("检验顺序")
    private Double seq;

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

    @Column(name = "PROJECT_CODE")
    @ApiParam("项目分类")
    private String projectCode;

    @Column(name = "CHECK_CONTENT")
    @ApiParam("检查内容")
    private String checkContent;

    @Lob
    @Column(name = "CHECK_ITEM")
    @ApiParam("检查项目")
    private String checkItem;

    @Lob
    @Column(name = "STANDARD")
    @ApiParam("判定基准")
    private String standard;

    @Column(name = "CHECK_TYPE")
    @ApiParam("判断方式")
    private Integer checkType;

    @Column(name = "STANDARD_VALUE")
    @ApiParam("标准值")
    private String standardValue;

    @Column(name = "UP_LIMIT")
    @ApiParam("上限值")
    private String upLimit;

    @Column(name = "DOWN_LIMT")
    @ApiParam("下限值")
    private String downLimit;

    @Column(name = "CHECK_TOOL")
    @ApiParam("检查器具")
    private String checkTool;

    @Column(name = "IS_NECESSARY")
    @ApiParam("是否必检")
    private Integer isNecessary;

    //--------BU-----------------
    @Column(name = "CATEGORY_CODE3")
    @ApiParam("产品类别")
    private String categoryCode3;

    @Column(name = "OQC_NO_TYPE")
    @ApiParam("检验单据类型")
    @AnnoOutputColumn(refClass = MesExtEnumUtil.OQC_CHECK_TYPE.class, refForeignKey = "value", value = "description", hidden = true)
    private Integer oqcNoType;

    @Column(name = "BASE_TYPE")
    @ApiParam("进制类型")
    @ColumnDefault("10")
    @AnnoOutputColumn(refClass = MesExtEnumUtil.OQC_BASE_TYPE.class, refForeignKey = "value", value = "description", hidden = true)
    private Integer baseType;

    @Column(name = "MODIFY_REMARK")
    @ApiParam("修改备注")
    private String modifyRemark;

    @Column(name = "SYSTEM_SYNC_STATUS")
    @ColumnDefault("2")
    @ApiParam("系统同步标志")
    public Integer systemSyncStatus = 2;


}
