package cn.estsh.i3plus.ext.mes.pojo.bean;

import cn.estsh.i3plus.ext.mes.pojo.util.MesExtEnumUtil;
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 org.springframework.format.annotation.DateTimeFormat;

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_BOM_PENDING_PART", indexes = {
        @Index(columnList = "SYSTEM_SYNC_STATUS"),
        @Index(columnList = "PART_NO"),
        @Index(columnList = "ITEM_PART_NO"),
        @Index(columnList = "PART_NO,IS_TOOK_EFFECT"),
        @Index(columnList = "IS_REMIND,IS_TOOK_EFFECT")
})
@Api("MES_BOM待生效成品表")
public class MesBomPendingPart extends BaseBean implements Serializable {

    private static final long serialVersionUID = 5035017176127870246L;

    @Column(name = "PART_NO")
    @ApiParam("父零件号")
    private String partNo;

    @Column(name = "PART_NAME")
    @ApiParam("父零件名称")
    private String partName;

    @Column(name = "UNIT")
    @ApiParam("单位")
    private String unit;

    @Column(name = "QTY" )
    @ColumnDefault("0")
    @ApiParam(value = "数量",example = "0")
    private Double qty;

    @Column(name = "ITEM_PART_NO")
    @ApiParam("子零件编码")
    private String itemPartNo;

    @Column(name = "ITEM_PART_NAME")
    @ApiParam("子零件名称")
    private String itemPartName;

    @Column(name = "ITEM_UNIT")
    @ApiParam("子零件单位")
    private String itemUnit;

    @Column(name = "ITEM_QTY")
    @ColumnDefault("0")
    @ApiParam(value = "子零件数量",example = "0")
    private Double itemQty;

    @Column(name = "BOM_VERSION")
    @ApiParam("BOM版本")
    private String bomVersion;

    @Column(name = "EFF_START_TIME")
    @ApiParam("生效时间")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private String effStartTime;

    @Column(name = "EFF_END_TIME")
    @ApiParam("失效时间")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private String effEndTime;

    @Column(name = "IS_REMIND")
    @ApiParam("是否已提醒")
    @ColumnDefault("2")
    @AnnoOutputColumn(refClass = MesExtEnumUtil.TRUE_OR_FALSE.class, refForeignKey = "value", value = "description")
    private Integer isReminded;

    @Column(name = "IS_TOOK_EFFECT")
    @ApiParam("是否已生效")
    @ColumnDefault("2")
    @AnnoOutputColumn(refClass = MesExtEnumUtil.TRUE_OR_FALSE.class, refForeignKey = "value", value = "description")
    private Integer isTookEffect;

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