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 yumingxing
 * @version 1.0
 * @date 2021/1/29 13:58
 **/
@Data
@Entity
@DynamicInsert
@DynamicUpdate
@EqualsAndHashCode(callSuper = true)
@Table(name = "MES_OQC_CHECK_DETAIL", indexes = {
        @Index(columnList = "OQC_NO"),
        @Index(columnList = "WORK_CENTER_CODE"),
        @Index(columnList = "PART_NO"),
        @Index(columnList = "WORK_TIME"),
        @Index(columnList = "CHECK_TIME"),
        @Index(columnList = "WORK_ORDER_NO"),
        @Index(columnList = "WORK_ORDER_TYPE"),
        @Index(columnList = "CHECK_TIME,PART_NO"),
        @Index(columnList = "CHECK_TIME,WORK_CENTER_CODE"),
        @Index(columnList = "WORK_TIME,PART_NO")
})
@Api("MES_出货检验单明细表")
public class MesOqcCheckDetail extends BaseBean implements Serializable {

    private static final long serialVersionUID = -6886184990156403492L;

    @Column(name = "WORK_ORDER_NO")
    @ApiParam("生产工单号")
    private String workOrderNo;

    @Column(name = "WORK_ORDER_TYPE")
    @ApiParam("工单类型")
    private Integer workOrderType;

    @Column(name = "WORK_TIME")
    @ApiParam("生产日期")
    private String workTime;

    @Column(name = "WORK_CENTER_CODE")
    @ApiParam("生产线")
    private String workCenterCode;

    @Column(name = "SHIFT_CODE")
    @ApiParam("班次")
    private String shiftCode;

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

    @Column(name = "OQC_NO")
    @ApiParam("检验单号")
    private String oqcNo;

    @Column(name = "PACKAGE_NO")
    @ApiParam("包装条码")
    private String packageNo;

    @Column(name = "SERIAL_NUMBER")
    @ApiParam("过程条码")
    private String serialNumber;

    @Column(name = "PRODUCT_SN")
    @ApiParam("产品条码")
    private String productSn;

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

    @Column(name = "PART_NAME_RDD")
    @ApiParam("物料名称")
    private String partNameRdd;

    @Column(name = "PID")
    @ApiParam("检验项目ID")
    public Long pid;

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

    @Column(name = "REMARK")
    @ApiParam("备注")
    private String remark;

    @Column(name = "CHECK_VALUE")
    @ApiParam("实际值")
    private String checkValue;

    @Column(name = "CHECK_RESULT")
    @ApiParam("检验结果")
    private Integer checkResult;

    @Column(name = "CHECK_USER")
    @ApiParam("检验人")
    private String checkUser;

    @Column(name = "ITEM_CHECK_TIME")
    @ApiParam("项目检验时间")
    private String itemCheckTime;

    @Column(name = "CHECK_TIME")
    @ApiParam("单据检验时间")
    private String checkTime;

    @Column(name = "CONFIRM_USER")
    @ApiParam("确认人")
    private String confirmUser;

    @Column(name = "CONFIRM_TIME")
    @ApiParam("确认时间")
    private String confirmTime;

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

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


}
