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", indexes = {
        @Index(columnList = "WORK_ORDER_NO,WORK_TIME,SHIFT_CODE,WORK_CELL_CODE"),
        @Index(columnList = "WORK_TIME,WORK_CENTER_CODE,PART_NO"),
        @Index(columnList = "WORK_TIME,WORK_CENTER_CODE"),
        @Index(columnList = "WORK_TIME,PART_NO"),
        @Index(columnList = "WORK_TIME"),
})
@Api("MES_工位不良主表")
public class MesBadCell extends BaseBean implements Serializable {

    private static final long serialVersionUID = 7689475809123434963L;

    @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 = "PART_NO")
    @ApiParam("物料号")
    private String partNo;

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

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

    @Column(name = "EQP_CODE")
    @ApiParam("设备号")
    private String eqpCode;

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

    @Column(name = "PROCESS_NAME_RDD")
    @ApiParam("工序名称")
    private String processNameRdd;

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

}
