package com.sw.mes.yb.production.entity;

import com.sw.mes.base.factory.init.entity.Equipment;
import lombok.Data;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import org.hibernate.annotations.NotFound;
import org.hibernate.annotations.NotFoundAction;

import javax.persistence.*;
import java.util.Date;

/**
 * @author lf
 * @description
 * @date 2024/1/12 10:21
 */
@Data
@Entity
@Table(name = "production_abnormal")
@DynamicUpdate
@DynamicInsert
public class ProductionAbnormal {
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Integer id;

    /**
     * 设备号
     */
    @Column
    private String equipmentCode;
    /**
     * 设备信息
     */
    @ManyToOne(fetch = FetchType.LAZY)
    @NotFound(action = NotFoundAction.IGNORE)
    @JoinColumn(name = "equipment_id", foreignKey = @ForeignKey(name = "none", value = ConstraintMode.NO_CONSTRAINT))
    private Equipment equipment;
    /**
     * 剩余重量
     */
    @Column
    private Integer surplusWeight;
    /**
     * 异常级别
     */
    @Column
    private String exceptionLevel;
    /**
     * 异常类型
     */
    @Column
    private String exceptionType;
    /**
     * 原因分类
     */
    @Column
    private String reasonClassification;
    /**
     * 运行时间
     */
    @Column
    private String runTime;
    /**
     * 操作人
     */
    @Column
    private String operateUser;
    /**
     * 操作时间
     */
    @Column
    @Temporal(TemporalType.TIMESTAMP)
    private Date operateDate;
    /**
     * 发生时间
     */
    @Column
    @Temporal(TemporalType.TIMESTAMP)
    private Date occurDate;
    /**
     * 发生班次
     */
    @Column
    private String occurClass;
    /**
     * 发生班组
     */
    @Column
    private String occurClassGroup;
    /**
     * 状态（0待确认，1已确认，默认0）
     */
    @Column
    private Integer status;
    /**
     * 原因分析
     */
    @Column
    private String reasonAnalysis;
    /**
     * 措施
     */
    @Column
    private String measure;
    /**
     * 分析报告
     */
    @Column
    private String analysisReport;
    /**
     * 是否误报（0是1否，默认1）
     */
    @Column
    private Integer isFalseAlarm;
    /**
     * 处理人
     */
    @Column
    private String processingUser;
    /**
     * 处理时间
     */
    @Column
    private Date processingDate;
}
