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 javax.persistence.*;
import java.io.Serializable;

/**
 * @PROJECT_NAME: i3plus-mes-panasonic-bu
 * @DESCRIPTION: 字段履历配置表-作用1：修改基础表字段时根据该表判断是否记录字段修改履历
 * @USER: xinwang.yi
 * @DATE: 2022-07-07 16:06
 */
@Data
@Entity
@DynamicInsert
@DynamicUpdate
@EqualsAndHashCode(callSuper = true)
@Table(name = "SX_MES_DATA_TRAVEL",indexes = {
        @Index(columnList = "MENU_CODE"),
        @Index(columnList = "PART_NO")
})
@Api("MES_数据履历")
public class SxMesDataTravel extends BaseBean implements Serializable {

    private static final long serialVersionUID = 5858886098930455268L;

    @Column(name = "MENU_CODE")
    @ApiParam("菜单代码")
    @AnnoOutputColumn(refClass = MesExtEnumUtil.FIELD_MENU_TYPE.class, refForeignKey = "value", value = "description")
    private Integer menuCode;

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

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

    @Column(name = "FIELD_CODE")
    @ApiParam("字段代码")
    private String fieldCode;

    @Lob
    @Column(name = "BEFORE_CHANGE")
    @ApiParam("变更前")
    private String beforeChange;

    @Lob
    @Column(name = "AFTER_CHANGE")
    @ApiParam("变更后")
    private String afterChange;

    @Lob
    @Column(name = "VOUCHER")
    @ApiParam("变更原因/凭证")
    private String voucher;

    @Column(name = "INITIAL_WORKPIECE_NO")
    @ApiParam("首件编号")
    private String initialWorkpieceNo;

    @Column(name = "SKILL_IS_CONFIRM")
    @ColumnDefault("20")
    @ApiParam("工技是否确认")
    @AnnoOutputColumn(refClass = MesExtEnumUtil.CONFIRM_TYPE.class, refForeignKey = "value", value = "description")
    private Integer skillIsConfirm = 20;

    @Column(name = "SKILL_IS_CONFIRM_USER")
    @ApiParam("工技确认人")
    private String skillIsConfirmUser;

    @Column(name = "SKILL_IS_CONFIRM_TIME")
    @ApiParam("工技确认时间")
    private String skillIsConfirmTime;

    @Column(name = "MANUFACTURING_IS_CONFIRM")
    @ColumnDefault("20")
    @ApiParam("制造是否确认")
    @AnnoOutputColumn(refClass = MesExtEnumUtil.CONFIRM_TYPE.class, refForeignKey = "value", value = "description")
    private Integer manufacturingIsConfirm = 20;

    @Column(name = "MANUFACTURING_IS_CONFIRM_USER")
    @ApiParam("制造确认人")
    private String manufacturingIsConfirmUser;

    @Column(name = "MANUFACTURING_IS_CONFIRM_TIME")
    @ApiParam("制造确认时间")
    private String manufacturingIsConfirmTime;

    @Transient
    @ApiParam("字段名称")
    private String fieldName;


}
