/**
 * There are <a href="https://github.com/ketayao/keta-custom">keta-custom</a> code generation
 */
package com.sw.mes.yb.pad.entity;

import lombok.Data;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;

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

/**
 * @Author
 * @Description：圆棒反切记录表
 * @Date: Create in
 * @Modified By:
 */
@Data
@Entity
@Table(name = "production_back_cutting_record")
@DynamicUpdate
@DynamicInsert
public class ProductionBackCuttingRecord {
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long id;

    /**
     * 晶段编号
     */
    @Column(length = 100)
    private String segmentNo;

    /**
     * 晶段编号（拼棒组合)
     */
    @Column
    private String sectionCompose;

    /**
     * 晶段长度
     */
    @Column(length = 19)
    private BigDecimal barLength;

    /**
     * 画线开始时间
     */
    @Column(length = 19)
    @Temporal(TemporalType.TIMESTAMP)
    private Date lineStartTime;

    /**
     * 画线结束时间
     */
    @Column(length = 19)
    @Temporal(TemporalType.TIMESTAMP)
    private Date lineEndTime;

    /**
     * 反切后长度
     */
    @Column(length = 19)
    private BigDecimal backLength;

    /**
     * 操作人员
     */
    @Column(length = 50)
    private String userName;

    /**
     * 班次
     */
    @Column(length = 50)
    private String classNo;

    /**
     * 班组
     */
    @Column(length = 50)
    private String teamGroup;

    /**
     * 返切长度
     */
    @Column(length = 19)
    private BigDecimal cutLength;

    /**
     * 返切原因
     */
    @Column(length = 256)
    private String cause;

    /**
     * 是否取样片
     */
    @Column(length = 19)
    private Long isTakeSample;

    /**
     * 反切刀数
     */
    @Column(length = 10)
    private Integer knifeNum;

    /**
     * 备注
     */
    @Column(length = 256)
    private String remark;

    /**
     * 截断状态 0：未截断，1：已截断
     */
    @Column
    private Boolean status;

    /**
     * 0：不合格反切，1：分段反切，2：拼棒中，未反切的晶段，直接过站，3：全部为回收料，晶段直接报废 4.截断反切 5.圆棒反切
     */
    @Column
    private Integer backCutType;

    /**
     * 不合格反切时，记录反切前的晶段信息
     */
    @Column
    private String sectionNoDetailJson;


    /**
     * 须切开的拼缝，逗号分割
     */
    @Column
    private String positions;

    /**
     * 划线记录标识，拼棒的划线一样
     */
    @Column
    private String uuid;

    @Column
    private Boolean isInheritSample;

    @Column
    private String logType;

    /**
     * 氧碳依赖标识：0：中间段；1：头段依赖；2：尾段依赖
     */
    @Column(length = 50)
    private Integer oxygenCarbonMark;

    /**
     * 是否反切不复测
     */
    @Column(length = 0)
    private Boolean isNotReTest;

    /**
     * 检验标志: 0 : 圆棒已检验；1：圆棒未检验
     */
    @Column(length = 1)
    private Integer inspectionMark;

    /**
     *性能返切次数
     */
    @Column(length = 2)
    private Integer behaviorFrequency;

    /**
     *外观返切次数
     */
    @Column(length = 2)
    private Integer facadeFrequency;

    public Boolean getIsNotReTest() {
        if (this.cause != null && this.cause.contains("返切不复测")) {
            return true;
        }else {
            return false;
        }
    }

    public ProductionBackCuttingRecord() {
    }

    public ProductionBackCuttingRecord(Long id) {
        this.id = id;
    }
}
