package com.jjt.calc.domain;

import com.jjt.biz.domain.TwinDevice;
import com.jjt.common.annotation.Excel;
import com.jjt.common.core.domain.BaseEntity;
import com.jjt.order.utils.CalcUtil;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.math.BigDecimal;
import java.util.Map;

/**
 * 设备配方信息对象 TWIN_FORMULA_INFO
 *
 * @author wukai
 * @date 2025-01-18
 */
@ApiModel(value = "TwinFormulaInfo", description = "设备配方信息")
@Data
@NoArgsConstructor
public class TwinFormulaInfo extends BaseEntity {
    private static final long serialVersionUID = 1L;

    public TwinFormulaInfo(Map<String, Object> map) {
        TwinDevice twinDevice = (TwinDevice) map.get("device");
        //使用deviceId做主键
        this.specInfoId = twinDevice.getDeviceId();
        this.deviceId = twinDevice.getDeviceId();
        this.fd1 = (int) map.get("Formula_data_1");
        this.fd2 = (int) map.get("Formula_data_2");
        this.fd3 = (int) map.get("Formula_data_3");
        this.fd4 = (int) map.get("Formula_data_4");
        this.fd5 = (int) map.get("Formula_data_5");
        this.fd6 = (int) map.get("Formula_data_6");
        this.fd7 = (int) map.get("Formula_data_7");
        this.fd8 = (int) map.get("Formula_data_8");
        this.fd9 = (int) map.get("Formula_data_9");
        this.fd10 = (int) map.get("Formula_data_10");
        this.fd11 = (int) map.get("Formula_data_11");
        this.fd12 = (int) map.get("Formula_data_12");
        this.fd13 = (float) map.get("Formula_data_13");
        this.fd14 = (float) map.get("Formula_data_14");
        this.fd15 = (float) map.get("Formula_data_15");
        this.fd16 = (float) map.get("Formula_data_16");
        this.fd17 = (float) map.get("Formula_data_17");
        this.fd18 = (float) map.get("Formula_data_18");
        this.fd19 = (int) map.get("Formula_data_19");
        this.fd20 = (int) map.get("Formula_data_20");
        this.fd21 = (int) map.get("Formula_data_21");
        this.fd22 = (int) map.get("Formula_data_22");
        this.fd23 = (int) map.get("Formula_data_23");
        this.fd24 = (float) map.get("Formula_data_24");
        this.fd25 = (float) map.get("Formula_data_25");

        this.cd10 = (float) map.get("Capacity_data_10");
        this.cd11 = (float) map.get("Capacity_data_11");
        this.cd12 = (float) map.get("Capacity_data_12");
        this.cd13 = (float) map.get("Capacity_data_13");
        this.cd14 = (float) map.get("Capacity_data_14");
        this.cd15 = (int) map.get("Capacity_data_15");
        this.cd16 = (int) map.get("Capacity_data_16");
        this.cd17 = (int) map.get("Capacity_data_17");
        this.cd18 = (int) map.get("Capacity_data_18");
        this.cd19 = (int) map.get("Capacity_data_19");
    }

    /**
     * 信息ID
     */
    private Long specInfoId;

    @ApiModelProperty("平方米克重")
    private BigDecimal gsm;
    /**
     * 设备ID
     */
    @Excel(name = "设备ID")
    @ApiModelProperty("设备ID")
    private Long deviceId;

    /**
     * 配方号
     */
    @Excel(name = "配方号")
    @ApiModelProperty("配方号")
    private Integer fd1;

    /**
     * 机台号
     */
    @Excel(name = "机台号")
    @ApiModelProperty("机台号")
    private Integer fd2;

    /**
     * 米克重
     */
    @Excel(name = "米克重")
    @ApiModelProperty("米克重")
    private Integer fd3;

    /**
     * L1、L5纱线规格D
     */
    @Excel(name = "L1、L5纱线规格D")
    @ApiModelProperty("L1、L5纱线规格D")
    private Integer fd4;

    /**
     * L2、L4纱线规格D
     */
    @Excel(name = "L2、L4纱线规格D")
    @ApiModelProperty("L2、L4纱线规格D")
    private Integer fd5;

    /**
     * L3纱线规格D
     */
    @Excel(name = "L3纱线规格D")
    @ApiModelProperty("L3纱线规格D")
    private Integer fd6;

    /**
     * L1、L5纱线规格F
     */
    @Excel(name = "L1、L5纱线规格F")
    @ApiModelProperty("L1、L5纱线规格F")
    private Integer fd7;

    /**
     * L2、L4纱线规格F
     */
    @Excel(name = "L2、L4纱线规格F")
    @ApiModelProperty("L2、L4纱线规格F")
    private Integer fd8;

    /**
     * L3纱线规格F
     */
    @Excel(name = "L3纱线规格F")
    @ApiModelProperty("L3纱线规格F")
    private Integer fd9;

    /**
     * L1、L5盘头根数
     */
    @Excel(name = "L1、L5盘头根数")
    @ApiModelProperty("L1、L5盘头根数")
    private Integer fd10;

    /**
     * L2、L4盘头根数
     */
    @Excel(name = "L2、L4盘头根数")
    @ApiModelProperty("L2、L4盘头根数")
    private Integer fd11;

    /**
     * L3盘头根数
     */
    @Excel(name = "L3盘头根数")
    @ApiModelProperty("L3盘头根数")
    private Integer fd12;

    /**
     * 卷曲幅宽
     */
    @Excel(name = "卷曲幅宽")
    @ApiModelProperty("卷曲幅宽")
    private Float fd13;

    /**
     * 下布长度
     */
    @Excel(name = "下布长度")
    @ApiModelProperty("下布长度")
    private Float fd14;

    /**
     * 毛高
     */
    @Excel(name = "毛高")
    @ApiModelProperty("毛高")
    private Float fd15;

    /**
     * 成品长
     */
    @Excel(name = "成品长")
    @ApiModelProperty("成品长")
    private Float fd16;

    /**
     * 成品宽
     */
    @Excel(name = "成品宽")
    @ApiModelProperty("成品宽")
    private Float fd17;

    /**
     * 成品重
     */
    @Excel(name = "成品重")
    @ApiModelProperty("成品重")
    private Float fd18;

    /**
     * GB1送经量
     */
    @Excel(name = "GB1送经量")
    @ApiModelProperty("GB1送经量")
    private Integer fd19;

    /**
     * GB2送经量
     */
    @Excel(name = "GB2送经量")
    @ApiModelProperty("GB2送经量")
    private Integer fd20;

    /**
     * GB3送经量
     */
    @Excel(name = "GB3送经量")
    @ApiModelProperty("GB3送经量")
    private Integer fd21;

    /**
     * GB4送经量
     */
    @Excel(name = "GB4送经量")
    @ApiModelProperty("GB4送经量")
    private Integer fd22;

    /**
     * GB5送经量
     */
    @Excel(name = "GB5送经量")
    @ApiModelProperty("GB5送经量")
    private Integer fd23;

    /**
     * 牵拉密度
     */
    @Excel(name = "牵拉密度")
    @ApiModelProperty("牵拉密度")
    private Float fd24;

    /**
     * 卷曲张力系数
     */
    @Excel(name = "卷曲张力系数")
    @ApiModelProperty("卷曲张力系数")
    private Float fd25;

    /**
     * GB1盘头剩余周长
     */
    @Excel(name = "GB1盘头剩余周长")
    @ApiModelProperty("GB1盘头剩余周长")
    private Float cd10;

    /**
     * GB2盘头剩余周长
     */
    @Excel(name = "GB2盘头剩余周长")
    @ApiModelProperty("GB2盘头剩余周长")
    private Float cd11;

    /**
     * GB3盘头剩余周长
     */
    @Excel(name = "GB3盘头剩余周长")
    @ApiModelProperty("GB3盘头剩余周长")
    private Float cd12;

    /**
     * GB4盘头剩余周长
     */
    @Excel(name = "GB4盘头剩余周长")
    @ApiModelProperty("GB4盘头剩余周长")
    private Float cd13;

    /**
     * GB5盘头剩余周长
     */
    @Excel(name = "GB5盘头剩余周长")
    @ApiModelProperty("GB5盘头剩余周长")
    private Float cd14;

    /**
     * GB1盘头剩余圈数
     */
    @Excel(name = "GB1盘头剩余圈数")
    @ApiModelProperty("GB1盘头剩余圈数")
    private Integer cd15;

    /**
     * GB2盘头剩余圈数
     */
    @Excel(name = "GB2盘头剩余圈数")
    @ApiModelProperty("GB2盘头剩余圈数")
    private Integer cd16;

    /**
     * GB3盘头剩余圈数
     */
    @Excel(name = "GB3盘头剩余圈数")
    @ApiModelProperty("GB3盘头剩余圈数")
    private Integer cd17;

    /**
     * GB4盘头剩余圈数
     */
    @Excel(name = "GB4盘头剩余圈数")
    @ApiModelProperty("GB4盘头剩余圈数")
    private Integer cd18;

    /**
     * GB5盘头剩余圈数
     */
    @Excel(name = "GB5盘头剩余圈数")
    @ApiModelProperty("GB5盘头剩余圈数")
    private Integer cd19;


    public void setGsm() {
        int weight = (int) (this.fd18 * 1000);
        this.gsm = CalcUtil.calcGsm(this.fd16, this.fd17, weight);
    }
}
