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

import cn.estsh.i3plus.pojo.mes.bean.MesRepairRecord;
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/4/22 11:32
 **/
@EqualsAndHashCode(callSuper = true)
@Data
@Entity
@DynamicInsert
@DynamicUpdate
@Table(name = "MES_REPAIR_RECORD_EXT", indexes = {
        @Index(columnList = "ORGANIZE_CODE_EXT"),
        @Index(columnList = "CREATE_DATE_TIME_EXT"),
        @Index(columnList = "MODIFY_DATE_TIME_EXT"),
        @Index(columnList = "IS_UNFREEZE"),
        @Index(columnList = "PRODUCT_SN"),
        @Index(columnList = "THIRD_PARTY_PID")
})
@PrimaryKeyJoinColumn(name = "PID")
@Api("维修信息记录表拓展")
public class MesRepairRecordExt extends MesRepairRecord implements Serializable {
    @ApiParam("生产工单")
    @Column(
            name = "WORK_ORDER_NO"
    )
    private String workOrderNo;

    //枚举:由维修判定类型页面维护
    @Column(name = "REPAIR_JUDGE_CODE")
    @ApiParam("维修判定代码")
    private String repairJudgeCode;

    @Column(name = "REPAIR_JUDGE_NAME")
    @ApiParam("维修判定名称")
    private String repairJudgeName;

    @Column(name = "REPAIR_DATE_TIME")
    @ApiParam("维修时间")
    private String repairDatetime;

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

    @Column(name = "WORK_TIME")
    @ApiParam("作业时间")
    private String workTime;

    @Column(
            name = "QTY",
            columnDefinition = "decimal(18,8)"
    )
    @ColumnDefault("0")
    @ApiParam("数量")
    private Double qty;

    @Column(
            name = "BAD_PART_NO"
    )
    @ApiParam("不良部品编码")
    private String badPartNo;

    @Column(
            name = "BAD_PART_NAME"
    )
    @ApiParam("不良部品名称")
    private String badPartName;

    @Column(
            name = "BAD_PART_VENDER"
    )
    @ApiParam("不良部品厂家")
    private String badPartVender;

    @Column(name="ORGANIZE_CODE_EXT")
    @ApiParam(value ="组织代码")
    public String organizeCodeExt;

    @Column(name="IS_VALID_EXT")
    @ApiParam(value = "有效性")
    public Integer isValidExt;

    @Column(name="IS_DELETED_EXT")
    @ApiParam(value = "是否已删除")
    public Integer isDeletedExt;

    @Column(name="CREATE_USER_EXT")
    @ApiParam(value = "创建用户")
    public String createUserExt;

    @Column(name="CREATE_DATE_TIME_EXT")
    @ApiParam(value = "创建日期")
    public String createDatetimeExt;

    @Column(name="MODIFY_USER_EXT")
    @ApiParam(value = "修改人")
    public String modifyUserExt;

    @Column(name="MODIFY_DATE_TIME_EXT")
    @ApiParam(value = "修改日期")
    public String modifyDatetimeExt;

    @Column(name = "DEFECT_TYPE")
    @ApiParam("不良类型代码")
    private String defectType;

    @Column(name = "DEFECT_TYPE_NAME")
    @ApiParam("不良类型描述")
    private String defectTypeName;

    @Column(name = "IS_UNFREEZE")
    @ApiParam("是否解冻")
    private Integer isUnfreeze = 20;

    @Column(name = "MANAGE_CODE")
    @ApiParam("管理码")
    private String manageCode;

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

    @Column(name = "THIRD_PARTY_PID")
    @ApiParam("关联ID")
    private String thirdPartyPid;

}
