/**
 * 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 io.swagger.annotations.ApiModelProperty;
import lombok.Data;

/**
* @Author 李儒
* @Description：
* @Date: Create in
* @Modified By:
*/
@Data
@Entity
@Table(name="production_again_task_detail")
@DynamicUpdate
@DynamicInsert
public class AgainTaskDetail{
	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long id;
    
	/**
	 * 炉台类型【0:默认；0-量产;1-在建;2-研发;】
	 */
    @Column(nullable=false, length=3)
    private Integer furnaceType;


	/**
	 * 下次复投是否完结【0：不是; 1 是;】
	 */
	@Column(nullable=false, length=3)
	private Integer isNextEnd;


    
	/**
	 * 预计复投时间
	 */
    @Column(length=19)
	@Temporal(TemporalType.TIMESTAMP)
    private Date againTime;
    
	/**
	 * 叫料时间
	 */
    @Column(length=19)
	@Temporal(TemporalType.TIMESTAMP)
    private Date rawCreate;
    
	/**
	 * 载具顺序号
	 */
    @Column(length=10)
    private Integer carrierSort;
    
    /**
     * 车上桶数
     */
    @Column(length=10)
    private Integer num;
    
    
	/**
	 * 当前桶数(载具上桶顺序号,号分割)
	 */
    @Column(length=10)
    private String pailNum;
    
	/**
	 * 状态【0：默认；0-新建;1-生产;2-已取消;3-自动完工;4-人工完工;5-退料;6-等待】
	 */
    @Column(nullable=false, length=3)
    private Integer rawStatus;
    
	/**
	 * 复投任务id
	 */
    @Column(length=19)
    private Long againTaskId;
    
	/**
	 * 前次任务id
	 */
    @Column(length=19)
    private Long preDetailId;
    
	/**
	 * 复投总桶数
	 */
    @Column(length=10)
    private Integer againPailNum;
    
	/**
	 * 复投总重量(装载总重量)
	 */
    @Column(length=19)
    private BigDecimal againWeigth;
    
    /**
	 * 任务桶重量集合
	 */
    @Column(length=80)
    private String taskWeigths;
    
	/**
	 * 设备号
	 */
    @Column(length=100)
    private String equipmentCode;
    
	/**
	 * 炉次号
	 */
    @Column(length=100)
    private String lotNo;
    
	/**
	 * 所属系列
	 */
    @Column(length=50)
    private String series;
    
	/**
	 * 所属模块
	 */
    @Column(length=50)
    private String area;
    
	/**
	 * 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;
    
	/**
	 * 叫料类型【0:默认;1-初始复投;2-取段复投;】
	 */
    @Column(length=3)
    private Integer rawType;
    
    /**
     * 延时任务开始时间
     */
    @Column(nullable=false, length=19)
    @Temporal(TemporalType.TIMESTAMP)
    private Date delayedStartTime;
    
    /**
	 * 已灌料桶数
	 */
    @Column(length=10)
    private Integer alreadyPailNum;
    
    /**
	 * 配方方案ID(production_circle_recipe.id)
	 */
    @Column(length=19)
    private Long recipeId;
    
	/**
	 * 重量方案ID(production_circle_weigth.id)
	 */
    @Column(length=19)
    private Long weigthId;
    
    
    /**
	 * 操作人
	 */
    @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=50)
	private String changeRecipeUserName;
	
	/**
     * 更换配方时间
     */
	@Column(nullable=false, length=19)
	@Temporal(TemporalType.TIMESTAMP)
	private Date changeRecipeTime;
    
    
    /**
     * 入库操作人
     */
    @Column(length=60)
    private String instoreUserName;
    
    /**
     * 入库操作时间
     */
    @Column(nullable=false, length=19)
    @Temporal(TemporalType.TIMESTAMP)
    private Date instoreOperatorTime;
    
    
    /**
     * 入库备注
     */
    @Column(length=255)
    private String instoreRemark;
    @ApiModelProperty(value = "入库编号")
    
    /**
     * 库位编码
     */
    @Column(length=80)
    private String instorePosCode;
    
    
    /**
	 * 开始灌料时间
	 */
    @Column(nullable=false, length=19)
	@Temporal(TemporalType.TIMESTAMP)
    private Date startTime;
    
	/**
	 * 结束灌料时间
	 */
    @Column(length=19)
	@Temporal(TemporalType.TIMESTAMP)
    private Date endTime;

	/**
	 * 复投次数
	 */
	@Column(length=19)
	private Integer againNum;

	/**
	 * 复投实际重量
	 */
	@Column(length=19)
	private BigDecimal againRealWeight;

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

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

	/**
	 * 载具编号
	 */
	@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;
    

	public AgainTaskDetail() {
	}

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

	public AgainTaskDetail(AgainTaskDetail task, Integer rawstatus) {
		this.setFurnaceType(task.getFurnaceType());
		this.setAgainTaskId(task.getAgainTaskId());
		this.setAgainPailNum(task.getAgainPailNum());
		this.setEquipmentCode(task.getEquipmentCode());
		this.setLotNo(task.getLotNo());
		this.setSeries(task.getSeries());
		this.setArea(task.getArea());
		this.setSapNo(task.getSapNo());
		this.setProductCode(task.getProductCode());
		this.setProductGrade(task.getProductGrade());
		this.setSpecs(task.getSpecs());
		this.setDopant(task.getDopant());
		this.setProductType(task.getProductType());
		this.setRawType(task.getRawType());
		this.setRecipeId(task.getRecipeId());
		this.setWeigthId(task.getWeigthId());
		
		this.setRawCreate(task.getRawCreate());
		this.setCarrierSort(task.getCarrierSort());
		this.setPailNum(task.getPailNum());
		this.setNum(task.getNum());
		
		this.setPreDetailId(task.getPreDetailId());
		this.setAgainWeigth(task.getAgainWeigth());
		this.setAgainTime(task.getAgainTime());//预计复投时间
		this.setRawStatus(rawstatus);
		this.setDelayedStartTime(new Date());
		this.setTaskWeigths(task.getTaskWeigths());
		this.setAgainNum(task.getAgainNum());
		this.setIsDone(task.getIsDone());
		this.setIsFillEnd(task.getIsFillEnd());
		this.setConfirm(task.getConfirm());
		this.setConfirmTime(task.getConfirmTime());
	}
}
