package com.sw.mes.yb.production.dto.weightSplit;

import com.sw.mes.yb.production.entity.ProductionFurnaceMaterialSplit;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;

@Data
@ApiModel(value = "桶重量分解")
public class BucketWeightDto {
    @ApiModelProperty(value = "桶数序号" )
    Integer bucketIndex;
    @ApiModelProperty(value = "桶重量" )
    BigDecimal bucketWeight;
    @ApiModelProperty(value = "物料重量分解" )
    List<MaterialWeightDto> materialList = new ArrayList<>();

    // 数据库桶分解 》 页面展示分解
    public void splitDetails2BucketWeightDtoList(List<ProductionFurnaceMaterialSplit> splitList){
        this.setBucketIndex(splitList.get(0).getBucketIndex());
        this.setBucketWeight(splitList.get(0).getBucketWeight());
        for (ProductionFurnaceMaterialSplit split : splitList) {
            MaterialWeightDto material = new MaterialWeightDto();
            material.setMaterialType(split.getMaterialType());
            material.setMaterialClassName(split.getMaterialClassName());
            material.setMaterialWeight(split.getMaterialWeight());

            this.materialList.add(material);
        }
    }
}
