package cn.estsh.i3plus.pojo.mes.model;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiParam;
import lombok.Data;

import java.util.List;

/**
 * @Description : 用于产线运行情况数据
 * @Reference :
 * @Author : jack.jia
 * @CreateDate : 2019-10-22
 * @Modify:
 **/
@Data
public class ProductBiModel {
    @ApiParam("工作中心代码")
    private String workCenterCode;

    @ApiParam("工作中心名称")
    private String workCenterName;

    @ApiParam("生产区域代码")
    private String areaCode;

    @ApiParam("运行状态")
    private Integer runningStatus;

    @ApiParam(value = "物料号")
    private String partNo;

    @ApiParam(value = "物料名称")
    private String partName;

    @ApiParam(value = "计划数量")
    private double planQty;

    @ApiParam(value = "产量")
    private double outputQty;

    @ApiParam(value = "完成率")
    private double CompleteRate;

    @ApiParam(value = "合格数量")
    private double passQty;

    @ApiParam(value = "不良数量")
    private double ngQty;

    @ApiParam(value = "合格率")
    private double passRate;

    @ApiParam(value = "不良率")
    private double ngRate;

    @ApiParam("客户代码")
    private String customerCode;

    @ApiParam("客户名称")
    private String customerName;

    @ApiParam("x坐标内容")
    private List<String> xAxis;

    @ApiParam("图表显示的数据")
    private List<ProductBiSeriesModel> series;

    public double getCompleteRate() {
        if(this.planQty != 0) {
            this.CompleteRate = outputQty / planQty;
        } else {
            this.CompleteRate = 0;
        }
        return this.CompleteRate;
    }
}
