package cn.estsh.i3plus.pojo.mes.bean;

import cn.estsh.i3plus.pojo.base.bean.BaseBean;
import cn.estsh.i3plus.pojo.mes.model.DefectTypeHandleModel;
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.util.List;

/**
 * @author FutureSoldiers
 * @create 2021-08-16 14:09
 */
@Data
@Entity
@DynamicInsert
@DynamicUpdate
@EqualsAndHashCode(callSuper = true)
@Inheritance(strategy = InheritanceType.JOINED)
@Table(name = "Mes_DEFECT_TYPE_AUDIT")
@Api("MES_不合格品审理单")
public class MesDefectTypeAudit extends BaseBean {
    private static final long serialVersionUID = 2462824203612421416L;

    @Column(name="DEPARTMENT_NAME")
    @ApiParam(value ="部门名称")
    private String departmentName;

    @Column(name="DEPARTMENT_CODE")
    @ApiParam(value ="部门代码")
    private String departmentCode;

    @Column(name = "SUPPLIER_CODE")
    @ApiParam("供应商代码")
    private String supplierCode;

    @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 = "RECEIVE_DATE")
    @ApiParam("收货日期")
    private String receiveDate;

    @Column(name = "QTY", columnDefinition = "decimal(18,8)")
    @ColumnDefault("0")
    @ApiParam("提交数量")
    private Double qty = 0D;

    @Column(name = "SAMPLE_QTY")
    @ApiParam("检验数量")
    private double sampleQty;

    @Column(name = "FAIL_QTY")
    @ApiParam("不合格数量")
    private Double failQty;

    @Column(name = "FAIL_REASON")
    @ApiParam("不合格原因")
    private String failReason;

    @Column(name = "QC_USER")
    @ApiParam("检验员")
    private String qcUser;

    @Column(name = "QC_DATE")
    @ApiParam(value = "检验日期")
    private String qcDate;

    @Column(name = "QC_TIME")
    @ApiParam(value = "检验时间")
    private String qcTime;

    @Column(name = "STO_NO")
    @ApiParam(value = "炉批号")
    private String stono;

    @Column(name = "WORK_CELL_CODE")
    @ApiParam(value = "工位")
    private String workCellCode;

    @Column(name = "SRC_LOT_NO")
    @ApiParam(value = "收货批次")
    private String srcLotNo;


    @ApiParam(value = "退回数量")
    private String returnedQty;

    @Column(name = "WORK_CENTER_CODE")
    @ApiParam(value = "产线")
    private String workCenterCode;

    @Column(name = "CUSTOMER")
    @ApiParam(value = "客户")
    private String customer;

    /**
     * 0 待审理   1 审理中 2 审理完毕
     */
    @Column(name = "AUDIT_STATUS")
    @ApiParam(value = "审理状态")
    private String auditStatus;

    /**
     *    10 供应商质量问题报告 20 原材料不合格审理单 30 自制件不合格审理单 40 客户退回不合格审理单
      */
    @Column(name = "AUDIT_ORDER_TYPE")
    @ApiParam("审理单类型")
    private Integer auditOrderType;

    @Column(name = "REPEAT_HAPPEN")
    @ApiParam(value = "是否重复发生 1 是  2 否")
    private String repeatHappen;

    @Column(name = "SUPPLIER_MEASURES")
    @ApiParam(value = "供应商遏制措施")
    private String supplierMeasures;

    @Column(name = "REASON")
    @ApiParam(value = "原因分析")
    private String reason;

    @Column(name = "CORRECT_METHOD")
    @ApiParam(value = "纠正措施")
    private String correctMethod;

    @Column(name = "COMPLATE_DATETIME")
    @ApiParam(value = "完成时间")
    private String complateDatetime;

    @Column(name = "DEFECT_TYPE_HANDLE")
    @ApiParam(value = "不合格品处理")
    private String defectTypeHandle;

    @Transient
    @ApiParam(value = "所有不合格品处理")
    private List<DefectTypeHandleModel> defectTypeHandles;

    @Transient
    @ApiParam(value = "质检员/日期")
    private String qcUserDate;


}
