/**
 * 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 com.sw.mes.production.dto.FormulaSchemeData;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.persistence.*;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;

@Data
@Entity
@Table(name="production_furnace_material_split")
@DynamicUpdate
@DynamicInsert
public class ProductionFurnaceMaterialSplit{
	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long id;
    
	/**
	 * 设备号
	 */
    @Column(length=50)
    private String equipmentCode;
    
	/**
	 * 炉次号
	 */
    @Column(length=50)
    private String lotNo;
    
	/**
	 * 叫料类型(0:默认,1:初始复投,2:取段复投,3预装料)
	 */
    @Column(length=10)
    private Integer rawType;
    
	/**
	 * 复投次数
	 */
    @Column(length=10)
    private Integer againNum;
    
	/**
	 * 料号
	 */
    @Column(length=50)
    private String productCode;
    
	/**
	 * 装料复投任务id
	 */
    @Column(length=19)
    private Long taskId;
    
	/**
	 * 配方方案id
	 */
    @Column(length=19)
    private Long schemeId;
    
	/**
	 * 配方方案编号
	 */
    @Column(length=50)
    private String schemeCode;
    
	/**
	 * 配方方案版本号
	 */
    @Column(length=10)
    private Integer schemeVersion;
    
	/**
	 * 重量方案id
	 */
    @Column(length=19)
    private Long weightSchemeId;
    
	/**
	 * 重量方案名称
	 */
    @Column(length=50)
    private String weightSchemeName;
    
	/**
	 * 桶数序号
	 */
    @Column(length=10)
    private Integer bucketIndex;
    
	/**
	 * 桶重量
	 */
    @Column(length=19)
    private BigDecimal bucketWeight;
    
	/**
	 * 物料种类
	 */
    @Column(length=50)
    private String materialType;
    
	/**
	 * 物料分类
	 */
    @Column(length=50)
    private String materialClassName;
    
	/**
	 * 物料重量
	 */
    @Column(length=19)
    private BigDecimal materialWeight;

	/**
	 * 桶规格
	 */
	@Column(length=19)
	private BigDecimal barrelSpecs;


	public void setSplitInfo(FormulaSchemeData scheme, FormulaSchemeData.FormulaSchemeDataDetail bucket, FormulaSchemeData.LoadingDetail material){
		this.setSchemeId(scheme.getSchemeId());
		this.setSchemeCode(scheme.getSchemeCode());
		this.setSchemeVersion(scheme.getSchemeVersion());
		this.setWeightSchemeId(scheme.getWeightSchemeId());
		this.setWeightSchemeName(scheme.getWeightSchemeName());
		this.setBucketIndex(bucket.getIndex());
		this.setBucketWeight(bucket.getWeight());
		this.setMaterialType(material.getMaterialType());
		this.setMaterialClassName(material.getMaterialClassName());
		this.setMaterialWeight(material.getWeight());
		this.setBarrelSpecs(scheme.getBarrelSpecs());
	}
    

	public ProductionFurnaceMaterialSplit() {
	}

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