package cn.estsh.i3plus.pojo.mes.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.*;
import java.io.Serializable;

/**
 * @Description : 工站分组队列
 * @Reference :
 * @Author : wangjie
 * @CreateDate : 2019-05-22 17:58
 * @Modify:
 **/
@Data
@Entity
@DynamicInsert
@DynamicUpdate
@EqualsAndHashCode(callSuper = true)
@Table(name = "MES_WORK_CELL_POINT_GROUP", indexes = {
        @Index(columnList = "ORGANIZE_CODE"),
        @Index(columnList = "WORK_CENTER_CODE"),
        @Index(columnList = "WORK_CELL_CODE"),
        @Index(columnList = "QUEUE_GROUP_NO"),
        @Index(columnList = "ORDER_NO")
})
@Api("工站分组队列")
public class MesWorkCellPointGroup extends BaseBean implements Serializable {

    private static final long serialVersionUID = -7544627137183733563L;
    @Column(name = "WORK_CENTER_CODE")
    @ApiParam("工作中心")
    private String workCenterCode;

    @Column(name = "WORK_CELL_CODE")
    @ApiParam("工作单元代码")
    private String workCellCode;

    @Column(name = "QUEUE_GROUP_NO")
    @ApiParam("分组队列编号")
    private String queueGroupNo;

    @Column(name = "GROUP_NO")
    @ApiParam("组内编号")
    private Integer groupNo;

    @Column(name = "ORDER_NO")
    @ApiParam("主队列编号")
    private String orderNo;

    @Column(name = "QUEUE_SEQ", columnDefinition = "decimal(18,8)")
    @ColumnDefault("0")
    @ApiParam("队列主表序号")
    private Double queueSeq;

    @Column(name = "QUEUE_DETAIL_SEQ", columnDefinition = "decimal(18,8)")
    @ColumnDefault("0")
    @ApiParam("队列明细表序号")
    private Double queueDetailSeq;

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

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

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

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

    @Column(name = "GROUP_SIDE")
    @ApiParam("料架摆放位置")
    private String groupSide;

    @Transient
    @ApiParam("显示颜色")
    private String color;

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

    @Column(name = "PRODUCE_CATEGORY_CODE")
    @ApiParam("产品位置代码")
    private String produceCategoryCode;

    @Column(name = "JIT_SEQ")
    @ApiParam("JIT排序号")
    private String jitSeq;

    @Transient
    @ApiParam("状态")
    private String statusName;

    public double getQueueSeqVal() {
        return this.queueSeq == null ? 0 : this.queueSeq;
    }

    public double getQueueDetailSeqVal() {
        return this.queueDetailSeq == null ? 0 : this.queueDetailSeq;
    }
}
