package cn.estsh.i3plus.pojo.mes.pcn.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.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;

import javax.persistence.*;
import java.io.Serializable;

/**
 * @Description:
 * @Reference:
 * @Author: Crish
 * @CreateDate:2019-04-16-17:36
 * @Modify:
 **/
@Data
@Entity
@DynamicInsert
@DynamicUpdate
@EqualsAndHashCode(callSuper = true)
@Table(name = "MES_QUEUE_ORDER", indexes = {
        @Index(columnList = "CUST_FLAG_NO")
}, uniqueConstraints = {
        @UniqueConstraint(columnNames = {"ORGANIZE_CODE", "ORDER_NO"})
}
)
@Api("生产队列主表")
public class MesQueueOrder extends BaseBean implements Serializable {
    private static final long serialVersionUID = 6538031118299400711L;
    @Column(name = "ORDER_NO", nullable = false)
    @ApiParam("主队列编号")
    private String orderNo;

    @Column(name = "VIN_CODE")
    @ApiParam("Vin")
    private String vinCode;

    @Column(name = "CUST_FLAG_NO")
    @ApiParam("客户标识号")
    private String custFlagNo;

    @Column(name = "PROD_CFG_CODE")
    @ApiParam("产品配置代码")
    private String prodCfgCode;

    @Column(name = "PROD_CFG_NAME_RDD")
    @ApiParam("产品配置名称")
    private String prodCfgNameRdd;

    @Column(name = "SEQ")
    @ApiParam("排序")
    private Double seq;

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

    @Column(name = "STATUS")
    @ApiParam("状态")
    private Integer status;

    @Column(name = "CUST_PROD_LINE_CODE")
    @ApiParam("客户产线代码")
    private String custProdLineCode;

    @Column(name = "AREA_CODE")
    @ApiParam("区域代码")
    private String areaCode;

    @Transient
    @ApiParam("起始车号")
    private String custFlagNoStart;

    @Transient
    @ApiParam("截至车号")
    private String custFlagNoEnd;

    public int getStatusVal() {
        return this.status == null ? 0 : this.status;
    }

    public double getSeqVal() {
        return this.seq == null ? 0.0d : this.seq;
    }
}
