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;

/**
 * @author wangjie
 * @version 1.0
 * @date 2021/1/12 15:58
 **/
@Data
@Entity
@DynamicInsert
@DynamicUpdate
@EqualsAndHashCode(callSuper = true)
@Table(name = "MES_UNBIND_PRODUCE_SN", indexes = {
        @Index(columnList = "SERIAL_NUMBER"),
        @Index(columnList = "PART_NO"),
        @Index(columnList = "PART_NO,START_TIME"),
        @Index(columnList = "BIND_STATUS")
})
@Api("解绑产品条码表")
public class MesUnbindProduceSn extends BaseBean implements Serializable {

    private static final long serialVersionUID = 6242884964995452701L;

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

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

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

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

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

    @Column(name = "START_TIME")
    @ApiParam("计划生产时间")
    private String startTime;

    /** 绑定状态 10表示绑定 20表示未绑定*/
    @Column(name = "BIND_STATUS")
    @ApiParam("绑定状态")
    @AnnoOutputColumn(refClass = MesPcnExtEnumUtil.BIND_STATUS.class, refForeignKey = "value", value = "description")
    private Integer bindStatus;

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

    @Transient
    @ApiParam("计划开始时间起始")
    private String startTimeStart;

    @Transient
    @ApiParam("计划开始时间截至")
    private String startTimeEnd;
}
