package com.sw.mes.yb.ipc.dto;

import com.sw.mes.base.factory.init.entity.MachineCapacityInfo;
import com.sw.mes.base.factory.product.entity.ProductModel;
import com.sw.mes.yb.plan.entity.ProductionSchedule;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

@Data
@ApiModel(value = "工控机复投任务Dto")
public class ProductionTaskDto {
	
	@ApiModelProperty(value = "plan_production_schedule.id" )
	private Long productionScheduleId;
	
	@ApiModelProperty(value = "规格" )
    private String specs;
	
	@ApiModelProperty(value = "型号" )
    private String conductionType;
	
	@ApiModelProperty(value = "掺杂剂" )
    private String dopant;
    
	@ApiModelProperty(value = "产品等级" )
    private String productGrade;

	@ApiModelProperty(value = "产品类别")
	private String productType;

	@ApiModelProperty(value = "产品简称")
	private String simpleName;
    
    
    public ProductionTaskDto(ProductionSchedule schedule) {
    	if(schedule!=null) {
			this.setProductionScheduleId(schedule.getId());
			MachineCapacityInfo info = schedule.getCapacityInfo();
			if(info!=null) {
    			this.specs = info.getSpecification();
    			this.conductionType = info.getConductionType();
    			this.dopant = info.getDopant();
    			this.productType = schedule.getProductType();
				this.simpleName = info.getSimpleName();
    		}
			ProductModel model = schedule.getProductModel();
			if (model != null){
				this.setProductType(model.getProductGrade());
			}
		}
    }
}
