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

import cn.estsh.i3plus.ext.mes.pcn.pojo.util.MesPcnExtEnumUtil;
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;

/**
 * @Description:
 * @Author: xiangming.liao
 * @Date: 2021/01/18 15:44
 * @Modify:
 */
@Data
@Entity
@DynamicInsert
@DynamicUpdate
@EqualsAndHashCode(callSuper = true)
@Table(name = "MES_FIRST_ORDER_DETAIL", indexes = {
        @Index(columnList = "ORDER_NO")
})
@Api("MES_首检单明细（改为Q管理）")
public class MesFirstOrderDetail extends BaseBean implements Serializable {

    private static final long serialVersionUID = -111793151238704774L;

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

    @Column(name="ORDER_NO")
    @ApiParam(value ="作业单号")
    private String orderNo;

    @Column(name="PROCESS_CODE")
    @ApiParam(value ="工序代码")
    private String processCode;

    @Column(name="PROCESS_NAME")
    @ApiParam(value ="工序名称")
    private String processName;

    @Column(name="WORK_CELL_CODE")
    @ApiParam(value ="工位代码")
    private String workCellCode;

    @Column(name="WORK_CELL_NAME")
    @ApiParam(value ="工位名称")
    private String workCellName;

    @Column(name = "CHECK_MESSAGE")
    @ApiParam(value = "检测信息")
    public String checkMessage;

    @Column(name="CHECK_STAND")
    @ApiParam(value ="检测标准")
    private String checkStand;

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

    @Column(name = "CHECK_RESULT")
    @ApiParam("点检结果")
    private String checkResult;

    @Column(name = "SPOT_CHECK_USER")
    @ApiParam("点检人员")
    private String spotCheckUser;

    @Column(name = "SPOT_CHECK_TIME")
    @ApiParam("点检时间")
    private String spotCheckTime;

    @Column(name = "TEAM_CONFIRM_USER")
    @ApiParam("班组确认人")
    private String teamConfirmUser;

    @Column(name = "TEAM_CONFIRM_TIME")
    @ApiParam("班组确认时间")
    private String teamConfirmTime;

    @Column(name = "QUALITY_CONFIRM_USER")
    @ApiParam("品质确认人")
    private String qualityConfirmUser;

    @Column(name = "QUALITY_CONFIRM_TIME")
    @ApiParam("品质确认时间")
    private String qualityConfirmTime;

    @Column(name = "IS_TEAM_CONFIRM")
    @ApiParam("是否班组确认")
    private Integer isTeamConfirm = 20;

    @Column(name = "IS_QUALITY_CONFIRM")
    @ApiParam("是否品质确认")
    private Integer isQualityConfirm = 20;

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

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

    @Column(name = "RESULT_VALUE")
    @ApiParam("结果值")
    private String resultValue;

    @Column(name="PART_NO")
    @ApiParam("零件编号")
    private String partNo;

    @Column(name = "MANAGE_TYPE")
    @ApiParam("管理类型：10-比值类型；20-结果类型")
    @AnnoOutputColumn(refClass = MesPcnExtEnumUtil.Q_MANAGE_MANAGE_TYPE.class, refForeignKey = "value", value = "description")
    private String manageType;

    @Column(name = "IMPORTANCE_SAFE_PART_NO")
    @ApiParam("重要安全部品编码")
    private String importanceSafePartNo;

    @Column(name = "CHECK_FREQUENCY")
    @ApiParam("检查频度")
    private String checkFrequency;

    @Column(name = "SAMPLE_QTY")
    @ApiParam("样品数量")
    private String sampleQty;

    @Column(name = "CONFIRM_METHOD")
    @ApiParam("确认方法")
    private String confirmMethod;

    @Transient
    @ApiParam("生产工单号")
    private String workOrderNo;

    @Transient
    @ApiParam("工作中心代码")
    private String workCenterCode;

    @Transient
    @ApiParam("班次代码")
    private String shiftCode;

    @Transient
    @ApiParam("点检开始时间")
    public String spotCheckTimeStart;

    @Transient
    @ApiParam("点检结束时间")
    public String spotCheckTimeEnd;

    public MesFirstOrderDetail(){}

    public MesFirstOrderDetail(Long id, String workOrderNo, String workCenterCode, String workCellName, String shiftCode, String processCode, String processName,
                               String checkMessage, String checkStand, String checkValue, String checkResult, String spotCheckUser, String spotCheckTime,
                               String teamConfirmUser, String teamConfirmTime, String qualityConfirmUser, String qualityConfirmTime){

        this.id = id;
        this.workOrderNo = workOrderNo;
        this.workCenterCode = workCenterCode;
        this.workCellName = workCellName;
        this.shiftCode = shiftCode;
        this.processCode = processCode;
        this.processName = processName;
        this.checkMessage = checkMessage;
        this.checkStand = checkStand;
        this.checkValue = checkValue;
        this.checkResult = checkResult;
        this.spotCheckUser = spotCheckUser;
        this.spotCheckTime = spotCheckTime;
        this.teamConfirmUser = teamConfirmUser;
        this.teamConfirmTime = teamConfirmTime;
        this.qualityConfirmUser = qualityConfirmUser;
        this.qualityConfirmTime = qualityConfirmTime;
    }

}
