package com.jjt.biz.vo;

import com.jjt.calc.domain.TwinCalcDay;
import com.jjt.common.utils.DateUtils;
import com.jjt.common.utils.bean.BeanUtils;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.math.BigDecimal;

/**
 * 周曲线
 *
 * @author wukai
 * @date 2024/5/8 15:50
 */
@ApiModel(value = "WeekData", description = "首页-周稼动率")
@Data
public class WeekData {
    @ApiModelProperty("时间")
    private String time;
    @ApiModelProperty("总稼动率")
    private BigDecimal efficiency;
    @ApiModelProperty("A班稼动率")
    private BigDecimal aEfficiency;
    @ApiModelProperty("B班稼动率")
    private BigDecimal bEfficiency;
    @ApiModelProperty("总重量")
    private BigDecimal weight;
    @ApiModelProperty("A班重量")
    private BigDecimal aWeight;
    @ApiModelProperty("B班重量")
    private BigDecimal bWeight;
    @ApiModelProperty("总电量")
    private BigDecimal kwh;
    @ApiModelProperty("A班电量")
    private BigDecimal aKwh;
    @ApiModelProperty("B班电量")
    private BigDecimal bKwh;
    @ApiModelProperty("总米长")
    private BigDecimal length;
    @ApiModelProperty("A班米长")
    private BigDecimal lengthA;
    @ApiModelProperty("B班米长")
    private BigDecimal lengthB;

    @ApiModelProperty("A班停经片停机")
    private Long stop1A;
    @ApiModelProperty("A班CCD停机")
    private Long stop2A;
    @ApiModelProperty("A班人工停机")
    private Long stop3A;
    @ApiModelProperty("B班停经片停机")
    private Long stop1B;
    @ApiModelProperty("B班CCD停机")
    private Long stop2B;
    @ApiModelProperty("B班人工停机")
    private Long stop3B;
    @ApiModelProperty("告警数量")
    private Long alarm;


    /**
     * 从calcDay 转换为当前对象
     *
     * @param day 2小时统计的对象
     */
    public void convert(TwinCalcDay day) {
        BeanUtils.copyProperties(day, this);
        this.setTime(DateUtils.parseDateToStr(day.getTime()));

        this.aEfficiency = day.getEfficiencyA();
        this.bEfficiency = day.getEfficiencyB();

        this.aWeight = day.getWeightA();
        this.bWeight = day.getWeightB();

        this.aKwh = day.getKwhA();
        this.bKwh = day.getKwhB();

        this.lengthA = day.getLengthA();
        this.lengthB = day.getLengthB();
    }

}
