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

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

import java.util.List;
import java.util.Map;

/**
 * @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 workCellCode;

    @ApiParam("工作单元名称")
    private String workCellName;

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

    @ApiParam("运行状态")
    private String 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(value = "警戒值")
    private double sentinelValue;

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

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

    @ApiParam("工单号")
    private String orderNo;

    @ApiParam("总页数")
    private Integer totalPage;

    @ApiParam("开启工单标识")
    private Integer opWoFlag = 2;

    @ApiParam("工位序号")
    private Integer workCellSeq;

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

    @ApiParam("一些携带值 eg:异常类型，异常次数")
    private Map<String, Object> carryMap;

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

    @ApiParam("列名")
    private Map<String, String> colMap;

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