/**
 * 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 javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

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

import lombok.Data;

/**
* @Author
* @Description：
* @Date: Create in
* @Modified By:
*/
@Data
@Entity
@Table(name="production_again_task")
@DynamicUpdate
@DynamicInsert
public class AgainTask{
	@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:默认;1-初始复投;2-取段复投;】
	 */
    @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;
    
	/**
	 * 复投总重量
	 */
    @Column(length=19)
    private BigDecimal againWeigth;
    
    
    /**
     * 载具数
     */
    @Column(length=10)
    private Integer carrierNum;
	/**
	 * 复投总桶数
	 */
    @Column(length=10)
    private Integer againPailNum;
    
	/**
	 * 已灌料桶数
	 */
    @Column(length=10)
    private Integer alreadyPailNum;
    
	/**
	 * 当前桶数
	 */
    @Column(length=10)
    private Integer pailNum;
    
	/**
	 * 状态【0：默认；0-新建;1-生产;2-已取消;3-自动完工;4-人工完工;5-退料;6-等待】
	 */
    @Column(nullable=false, length=3)
    private Integer rawStatus;


    /**
     * 灌料取消状态
     */
    @Column(length=50)
    private String cancelStatus;
    
    /**
	 * 状态【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=50)
    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 userName;
    
	/**
	 * 复投重量确认时间
	 */
    @Column(nullable=false, length=19)
	@Temporal(TemporalType.TIMESTAMP)
    private Date operationTime;
    
    /**
	 * 操作原因
	 */
    @Column(length=255)
    private String operationCause;
    
    /**
	 * 剩料重量
	 */
    @Column(length=19)
    private BigDecimal surplusWeigth;
    
    /**
	 * 总装埚料
	 */
    @Column(length=19)
    private BigDecimal totalUseWeigth;
    
    /**
     * 复投次数
     */
    @Column(length=19)
    private Integer againNum;
    
    
    //报工类型
    @Column(length=10)
    private String reportType;
    
    //复投筒编号
    @Column(length=255)
    private String vesselNo;
    
    
    //上报时间
    @Column(nullable=false, length=19)
	@Temporal(TemporalType.TIMESTAMP)
    private Date reportTime;


    /**
     * 是否完结(0未完结，1完结复投）
     */
    @Column(length=2)
    private Integer isDone = 0;
    
    //备注
    @Column
    private String remark;

    /**
     * 合金牌号
     */
    @Column(length=50)
    private String alloyBrand;

    /**
     * 合金类型
     */
    @Column(length=50)
    private String alloyType;

    /**
     * 合金重量
     */
    @Column(length=50)
    private String alloyWeight;
    
    /**
     * 试投类型
     */
    @Column(length=50)
    private String trialType;

    /**
     * 上次投料是否产出(0:否 1:是)
     */
    @Column(length=1)
    private Boolean outputCrystal;


    /**
     * 页面录入是否完结加料（0：否，1：是）
     */
    @Column(length=4)
    private Integer isFillEnd = 0;


	public AgainTask() {
	}

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

	public AgainTask(AgainTask task, Integer rawstatus) {
        this.setSeries(task.getSeries());
        this.setArea(task.getArea());
        this.setRawType(task.getRawType());
        this.setSapNo(task.getSapNo());
        this.setFurnaceType(task.getFurnaceType());
        this.setEquipmentCode(task.getEquipmentCode());
        this.setLotNo(task.getLotNo());
        this.setProductCode(task.getProductCode());
        this.setProductGrade(task.getProductGrade());
        this.setSpecs(task.getSpecs());
        this.setDopant(task.getDopant());
        this.setProductType(task.getProductType());
        this.setGmtCreate(task.getGmtCreate());
        this.setRecipeId(task.getRecipeId());
        this.setWeigthId(task.getWeigthId());
        this.setRawStatus(rawstatus);
        this.setDelayedStartTime(new Date());
        this.setEtTime(task.getEtTime());
        this.setSurplusWeigth(task.getSurplusWeigth());
        this.setTotalUseWeigth(task.getTotalUseWeigth());
        this.setAgainNum(task.getAgainNum());
        this.setIsDone(task.getIsDone());
        this.setAlloyWeight(task.getAlloyWeight());
        this.setAlloyType(task.getAlloyType());
        this.setAlloyBrand(task.getAlloyBrand());
        this.setTrialType(task.getTrialType());
        this.setOutputCrystal(task.getOutputCrystal());
        this.setIsFillEnd(task.getIsFillEnd());
	}
}
