package cn.estsh.i3plus.ext.mes.pojo.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;

/**
 * @author yumingxing
 * @version 1.0
 * @date 2021/2/7 14:00
 **/
@Data
@Entity
@DynamicInsert
@DynamicUpdate
@EqualsAndHashCode(callSuper = true)
@Table(name = "MES_WEIGH_MANAGER", indexes = {
        @Index(columnList = "ORDER_NO")
})
@Api("MES_称重")
public class MesWeighManager extends BaseBean implements Serializable {

    private static final long serialVersionUID = -8247790792755621165L;

    @Column(
            name = "ORDER_JOB_NO"
    )
    @ApiParam("单据编号")
    private String orderJobNo;
    @Column(
            name = "ORDER_NO"
    )
    @ApiParam("生产工单号")
    private String orderNo;
    @Column(
            name = "PART_NO"
    )
    @ApiParam("零件号")
    private String partNo;
    @Column(
            name = "PART_NAME"
    )
    @ApiParam("零件名称")
    private String partName;

    @Column(name = "FINISH_WEIGH_NUM", columnDefinition = "decimal(18,8)")
    @ColumnDefault("0")
    @ApiParam("已记录称重数量")
    private Double finishWeighNum;

    @Column(name = "STANDARD_WEIGHT", columnDefinition = "decimal(18,8)")
    @ColumnDefault("0")
    @ApiParam("参考标准重量")
    private Double standardWeight;

    @Column(name = "AVG_WEIGHT", columnDefinition = "decimal(18,8)")
    @ColumnDefault("0")
    @ApiParam("平均重量")
    private Double avgWeight;

    /**
     * 10=是，20=否
     */
    @Column(name = "CARTON_CONFIRM_CHECK")
    @ApiParam("纸箱确认")
    private Integer cartonConfirmCheck = 20;

    @Column(
            name = "CARTON_CONFIRM_PERSON"
    )
    @ApiParam("纸箱确认人员")
    private String cartonConfirmPerson;
    @Column(
            name = "CARTON_CONFIRM_TIME"
    )
    @ApiParam("纸箱确认时间")
    private String cartonConfirmTime;

    @Column(name = "TEAM_CONFIRM_USER")
    @ApiParam("班组确认人")
    private String teamConfirmUser;

    @Column(name = "TEAM_CONFIRM_TIME")
    @ApiParam("班组确认时间")
    private String teamConfirmTime;

    @Column(name = "QUALITY_CONFIRM_USER")
    @ApiParam("品质确认人")
    private String qualityConfirmUser;

    @Column(name = "QUALITY_CONFIRM_TIME")
    @ApiParam("品质确认时间")
    private String qualityConfirmTime;

    @Column(name = "IS_TEAM_CONFIRM")
    @ApiParam("是否班组确认")
    private Integer isTeamConfirm = 20;

    @Column(name = "IS_QUALITY_CONFIRM")
    @ApiParam("是否品质确认")
    private Integer isQualityConfirm = 20;

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

    @Column(name = "WEIGH_NUM", columnDefinition = "decimal(18,8)")
    @ColumnDefault("0")
    @ApiParam("称重数量")
    private Double weighNum;

    @Column(name = "UP_LIMIT", columnDefinition = "decimal(18,8)")
    @ColumnDefault("0")
    @ApiParam("偏差上限")
    private Double upLimit;

    @Column(name = "DOWN_LIMIT", columnDefinition = "decimal(18,8)")
    @ColumnDefault("0")
    @ApiParam("偏差下限")
    private Double downLimit;

    @Column(name = "REAL_UP_LIMIT", columnDefinition = "decimal(18,8)")
    @ColumnDefault("0")
    @ApiParam("上限值")
    private Double realUpLimit;

    @Column(name = "REAL_DOWN_LIMIT", columnDefinition = "decimal(18,8)")
    @ColumnDefault("0")
    @ApiParam("下限值")
    private Double realDownLimit;

    @Transient
    @ApiParam(value = "班组确认名称")
    public String shiftGroupCheckName;

    @Transient
    @ApiParam(value = "品质确认名称")
    public String qualityCheckName;

    @Transient
    @ApiParam("纸箱确认开始时间")
    private String cartonConfirmTimeStart;

    @Transient
    @ApiParam("纸箱确认截止时间")
    private String cartonConfirmTimeEnd;
}
