package cn.estsh.i3plus.ext.mes.pojo.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.Index;
import javax.persistence.Table;
import java.io.Serializable;

/**
 * @Description:
 * @Author: xiangming.liao
 * @Date: 2021/01/14 20:03
 * @Modify:
 */
@Data
@Entity
@DynamicInsert
@DynamicUpdate
@EqualsAndHashCode(callSuper = true)
@Table(name = "MES_BAD_CELL_DETAIL", indexes = {
        @Index(columnList = "WORK_ORDER_NO"),
        @Index(columnList = "WORK_ORDER_NO,SERIAL_NUMBER"),
        @Index(columnList = "PART_NO"),
        @Index(columnList = "ITEM_PART_NO"),
        @Index(columnList = "WORK_CELL_CODE"),
        @Index(columnList = "DEFECT_TYPE"),
        @Index(columnList = "DEFECT_CODE"),
        @Index(columnList = "HAPPEN_STATION"),
        @Index(columnList = "IS_UNFREEZE"),
        @Index(columnList = "PRODUCT_SN"),
        @Index(columnList = "THIRD_PARTY_PID")
})
@Api("MES_工位不良明细表")
public class MesBadCellDetail extends BaseBean implements Serializable {

    private static final long serialVersionUID = 7689454363123434963L;

    @Column(name = "WORK_CENTER_CODE")
    @ApiParam(value = "产线代码")
    private String workCenterCode;

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

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

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

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

    @Column(name = "PART_NO")
    @ApiParam(value = "物料号")
    private String partNo;

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

    @Column(name = "DEFECT_ACTION_TIME")
    @ApiParam("不良时间")
    private String defectActionTime;

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

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

    @Column(name = "DEFECT_CODE")
    @ApiParam("不良标识代码")
    private String defectCode;

    @Column(name = "DEFECT_NAME")
    @ApiParam("不良标识描述")
    private String defectName;

    //MesEnumUtil.MES_REPAIR_STATUS
    @Column(name = "REPAIR_STATUS")
    @ApiParam("维修状态")
    private Integer repairStatus = 20;

    @Column(name = "APPROVAL_STATUS")
    @ApiParam("审批状态: 未审批=30, 通过=10, 驳回=20")
    @ColumnDefault("30")
    private Integer approvalStatus;

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

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

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

    //---EP---
    @Column(name = "ITEM_PART_NO")
    @ApiParam("原材料物料编码")
    private String itemPartNo;

    @Column(name = "ITEM_PART_NAME")
    @ApiParam("原材料物料名称")
    private String itemPartName;

    @Column(name = "HAPPEN_STATION")
    @ApiParam("发生岗位")
    private String happenStation;
    //---EP---

}
