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

import java.math.BigDecimal;
import java.util.Date;

import lombok.Data;
import javax.persistence.*;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;

import com.fasterxml.jackson.annotation.JsonFormat;

import io.swagger.annotations.ApiModelProperty;

/**
* @Author
* @Description：
* @Date: Create in
* @Modified By:
*/
@Data
@Entity
@Table(name="production_loading_task")
@DynamicUpdate
@DynamicInsert
public class LoadingTask{
	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long id;

	/**
	 * 设备号
	 */
    @Column(length=100)
    private String equipmentCode;

	/**
	 * 炉次号
	 */
    @Column(length=100)
    private String lotNo;

	/**
	 * 所属系列
	 */
    @Column(length=50)
    private String series;

	/**
	 * 所属模块
	 */
    @Column(length=50)
    private String area;

	/**
	 * 叫料类型【0:默认，初始装料;】
	 */
    @Column(nullable=false, length=3)
    private Integer rawType;

	/**
	 * 创建时间
	 */
    @Column(nullable=false, length=19)
	@Temporal(TemporalType.TIMESTAMP)
    private Date gmtCreate;

	/**
	 * 预计装料时间
	 */
    @Column(nullable=false, length=19)
	@Temporal(TemporalType.TIMESTAMP)
    private Date etTime;

    /**
     * 延时任务开始时间
     */
    @Column(nullable=false, length=19)
    @Temporal(TemporalType.TIMESTAMP)
    private Date delayedStartTime;

	/**
	 * 状态【0：默认；0-新建;1-生产;2-已取消;3-自动完工;4-人工完工;】
	 */
    @Column(nullable=false, length=3)
    private Integer rawStatus;

    /**
	 * 状态【0：默认；正常, 1:异常任务】
	 */
    @Column(nullable=false, length=3)
    private Integer errorStatus;

	/**
	 * 炉台类型【0:默认；0-量产;1-在建;2-研发;】
	 */
    @Column(nullable=false, length=3)
    private Integer furnaceType;

	/**
	 * SAP订单号
	 */
    @Column(length=100)
    private String sapNo;

	/**
	 * 料号
	 */
    @Column(length=100)
    private String productCode;

	/**
	 * 产品等级
	 */
    @Column(length=50)
    private String productGrade;

	/**
	 * 规格
	 */
    @Column(length=50)
    private String specs;

	/**
	 * 掺杂剂
	 */
    @Column(length=10)
    private String dopant;

	/**
	 * 产品类别
	 */
    @Column(length=10)
    private String productType;

	/**
	 * 配方方案ID(production_circle_recipe.id)
	 */
    @Column(length=19)
    private Long recipeId;

	/**
	 * 重量方案ID(production_circle_weigth.id)
	 */
    @Column(length=19)
    private Long weigthId;

    /**
     * 更换配方人员
     */
	@Column(length=50)
	private String changeRecipeUserName;

	/**
     * 更换配方时间
     */
	@Column(nullable=false, length=19)
	@Temporal(TemporalType.TIMESTAMP)
	private Date changeRecipeTime;

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

    /**
	 * 操作时间
	 */
    @Column(nullable=false, length=19)
	@Temporal(TemporalType.TIMESTAMP)
    private Date operationTime;

    /**
	 * 操作原因
	 */
    @Column(length=255)
    private String operationCause;

    /**
	 * 配料总重量
	 */
    @Column(length=19)
    private BigDecimal weight;

	/**
	 * 热场尺寸
	 */
	@Column(length=10)
	private String crucibleHeight;

	/**
	 * 配料实际重量
	 */
	@Column(length=19)
	private BigDecimal realWeight;

	/**
	 * 钡粉重量
	 */
	@Column(length=19)
	private BigDecimal bariumWeight;

	@ApiModelProperty(value = "母合金牌号")
	private String alloyBrand;
	@ApiModelProperty(value = "母合金类型")
	private String alloyType;
	@ApiModelProperty(value = "母合金重量")
	private String alloyWeight;

	/**
	 * 试投类型
	 */
	@Column(length=50)
	private String trialType;

	//备注
	@Column
	private String remark;

	/**
	 * 排程ID
	 */
	@Column(length=11)
	private Long scheduleId;

	/**
	 * 产品简称
	 */
	@Column(length=50)
	private String simpleName;

	/**
	 * 载具编号
	 */
	@Column(length=50)
	private String carrierNo;

	/**
	 * 确认投料(0:未确认, 1:已确认)
	 */
	@Column(length=4)
	private Integer confirm = 0;

	/**
	 * 确认投料时间
	 */
	@Column(nullable=false, length=19)
	@Temporal(TemporalType.TIMESTAMP)
	private Date confirmTime;

	/**
	 * 热场尺寸
	 */
	@Column(length=50)
	private String dimension;

	/**
	 * 热场crucible_fixed_casting.id
	 */
	@Column(length=10)
	private Integer dimensionId;


	public LoadingTask() {
	}

	public LoadingTask(LoadingTask source,Integer rawStatus) {
		this.area = source.getArea();
		this.dopant = source.getDopant();
		this.equipmentCode = source.getEquipmentCode();
		//存在争议 先定原来的
		this.etTime = source.getEtTime();
		this.furnaceType = source.getFurnaceType();
		this.gmtCreate = source.getGmtCreate();
		this.lotNo = source.getLotNo();
		this.productType = source.getProductType();
		this.productCode = source.getProductCode();
		this.productGrade = source.getProductGrade();
		this.rawStatus = rawStatus;
		this.rawType = source.getRawType();
		this.recipeId = source.getRecipeId();
		this.sapNo = source.getSapNo();
		this.series = source.getSeries();
		this.specs = source.getSpecs();
		this.weigthId = source.getWeigthId();
		this.crucibleHeight = source.getCrucibleHeight();
		this.trialType = source.getTrialType();
		this.remark = source.getRemark();
		this.scheduleId = source.getScheduleId();
		this.dimension = source.getDimension();
		this.dimensionId = source.getDimensionId();
		this.weight = source.getWeight();
	}


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