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.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import javax.persistence.Transient;
import java.io.Serializable;
import java.util.List;

/**
 * @Description:
 * @Author: jokelin
 * @Date: 2020/4/28 4:19 下午
 * @Modify:
 */
@Data
@Entity
@DynamicInsert
@DynamicUpdate
@EqualsAndHashCode(callSuper = true)
@Table(name = "MES_OEE")
@Api("MES_OEE数据")
public class MesOee extends BaseBean implements Serializable {

    private static final long serialVersionUID = -9163026983140909748L;

    @Column(name = "OBJECT_CODE")
    @ApiParam("运算对象代码")
    private String objectCode;

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

    @Column(name = "WORK_CENTER_CODE")
    @ApiParam("工作中心代码")
    private String workCenterCode;

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

    @Column(name = "EQU_CODE")
    @ApiParam("设备代码")
    private String equCode;

    @Column(name = "OEE_DATE")
    @ApiParam("日期")
    private String oeeDate;

    @Column(name = "SHIFT_CODE")
    @ApiParam("班次代码")
    private String shiftCode;

    @Column(name = "START_TIME")
    @ApiParam("开始时段")
    private String startTime;

    @Column(name = "END_TIME")
    @ApiParam("结束时段")
    private String endTime;

    @Column(name = "TOTAL_RUN_TIME", columnDefinition = "decimal(18,8)")
    @ColumnDefault("0")
    @ApiParam("总生产时间")
    private Double totalRunTime;

    @Column(name = "TOTAL_STOP_TIME", columnDefinition = "decimal(18,8)")
    @ColumnDefault("0")
    @ApiParam("总停机时间")
    private Double totalStopTime;

    @Column(name = "TOTAL_QTY")
    @ApiParam("总生产数")
    private Integer totalQty;

    @Column(name = "QUALIFIED_QTY")
    @ApiParam("一次合格数")
    private Integer qualifiedQty;

    @Column(name = "PLAN_TAKT")
    @ApiParam("计划节拍")
    private Integer planTakt;

    @Column(name = "ACTUAL_TAKT")
    @ApiParam("实际节拍")
    private Integer actualTakt;

    @Column(name = "TIME_RATE", columnDefinition = "decimal(18,8)")
    @ColumnDefault("0")
    @ApiParam("时间开动率")
    private Double timeRate;

    @Column(name = "TAKT_RATE", columnDefinition = "decimal(18,8)")
    @ColumnDefault("0")
    @ApiParam("性能开动率")
    private Double taktRate;

    @Column(name = "QUALIFIED_RATE", columnDefinition = "decimal(18,8)")
    @ColumnDefault("0")
    @ApiParam("良品率")
    private Double qualifiedRate;

    @Column(name = "OEE", columnDefinition = "decimal(18,8)")
    @ColumnDefault("0")
    @ApiParam("OEE")
    private Double oee;

    @Column(name = "TARGET_OEE", columnDefinition = "decimal(18,8)")
    @ColumnDefault("0")
    @ApiParam("OEE目标值")
    private Double targetOee;

    @Column(name = "MIN_OEE", columnDefinition = "decimal(18,8)")
    @ColumnDefault("0")
    @ApiParam("OEE警戒值")
    private Double minOee;

    @Column(name = "BUSI_DATA")
    @ApiParam("自定义数据")
    private String busiData;

    @Transient
    @ApiParam("开始日期")
    private String oeeDateStart;

    @Transient
    @ApiParam("结束日期")
    private String oeeDateEnd;

    @Transient
    @ApiParam("自定义数据map")
    private List<MesOperateObjectAttribute> operateObjectAttributes;

    @Transient
    @ApiParam("手工录入集合")
    private List<String> attributes;
}
