package com.cf.imes.module.executor.util.fileConversion.admin.files.excel;

import com.alibaba.excel.annotation.ExcelIgnore;
import com.alibaba.excel.annotation.ExcelProperty;
import com.cf.imes.framework.excel.core.annotations.DictFormat;
import com.cf.imes.framework.excel.core.convert.DictConvert;
import com.cf.imes.module.system.enums.DictTypeConstants;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.databind.ObjectMapper;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;

import javax.validation.constraints.NotNull;
import java.math.BigDecimal;

/**
 * 生产单 Excel 导入 VO
 */
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
@Accessors(chain = false) // 设置 chain = false，避免生产单导入有问
public class OrderPlateImportExcelVO {

    @ExcelProperty(value = "序号")
    @JsonIgnore
    private String ordinal;

    @ExcelProperty(value = "类型")
    @JsonIgnore
    private String goodType;

    @ExcelProperty(value = "物料编码")
    @JsonIgnore
    private String goodsId;

    private Long goodId;//商品id

    @ExcelProperty(value = "商品名称")
    @JsonIgnore
    private String goodsName;

    @ExcelProperty(value = "材质")
    @JsonIgnore
    private String material;

    @ExcelProperty(value = "颜色")
    @JsonIgnore
    private String color;

    @ExcelProperty(value = "厂家")
    @JsonIgnore
    private String factory;

    @ExcelProperty(value = "品牌")
    @JsonIgnore
    private String brand;

    @ExcelProperty(value = "型号")
    @JsonIgnore
    private String model;

    @ExcelProperty(value = "规格")
    @JsonIgnore
    private String spec;

    @ExcelProperty(value = "单位")
    @JsonIgnore
    private String unit;

    @ExcelProperty(value = "数量")
    @JsonIgnore
    @NotNull
    private String goodsNumber;

    @ExcelProperty(value = "房间")
    @JsonIgnore
    private String roomsName;

    @ExcelProperty(value = "柜体")
    @JsonIgnore
    private String cabinetsName;

    @ExcelProperty(value = "加工组类型")
    @JsonIgnore
    private String synthesis;

    @JsonIgnore
    @ExcelIgnore
    private String synthesisTypeName;//加工组类型的名称

    @ExcelProperty(value = "加工组名称")
    @JsonIgnore
    private String combinationName;

    @ExcelProperty(value = "板名称")
    @JsonIgnore
    private String name;

    @ExcelProperty(value = "自定义板编号")
    @JsonIgnore
    private String plateNo;

    @ExcelProperty(value = "成品长")
    @JsonIgnore
    private String height;

    @ExcelProperty(value = "成品宽")
    @JsonIgnore
    private String width;

    @ExcelProperty(value = "拆单长")
    @JsonIgnore
    private String splitHeight;

    @ExcelProperty(value = "拆单宽")
    @JsonIgnore
    private String splitWidth;

    @ExcelProperty(value = "厚")
    @JsonIgnore
    private String thickness;

    @ExcelProperty(value = "左封边")
    @JsonIgnore
    private String sealLeft;

    @ExcelProperty(value = "右封边")
    @JsonIgnore
    private String sealRight;

    @ExcelProperty(value = "上封边")
    @JsonIgnore
    private String sealUp;

    @ExcelProperty(value = "下封边")
    @JsonIgnore
    private String sealDown;

    @ExcelProperty(value = "排版面")
    @JsonIgnore
    private String typographicFace;

    @ExcelProperty(value = "纹路")
    @JsonIgnore
    private String texture;

    @ExcelProperty(value = "开门方向")
    @JsonIgnore
    private String openDoorType;

    @ExcelProperty(value = "上传结果")
    @JsonIgnore
    private String result;

    @ExcelProperty(value = "备注1")
    private String remark1;

    @ExcelProperty(value = "备注2")
    private String remark2;

    @ExcelProperty(value = "备注3")
    private String remark3;

    @ExcelProperty(value = "备注4")
    private String remark4;

    @ExcelProperty(value = "备注5")
    private String remark5;

    @ExcelProperty(value = "备注6")
    private String remark6;

    @ExcelProperty(value = "备注7")
    private String remark7;

    @ExcelProperty(value = "备注8")
    private String remark8;

    @ExcelProperty(value = "备注9")
    private String remark9;

    @ExcelProperty(value = "备注10")
    private String remark10;

    @JsonIgnore
    @ExcelIgnore
    private String remark;

    //备注转json数据
    public String remarkJSON() {
        ObjectMapper objectMapper = new ObjectMapper();
        // 设置实体类字段的值
        try {
            String json = objectMapper.writeValueAsString(this);
            return json;
        } catch (Exception e) {
            e.printStackTrace();
            return "{}";
        }
    }
}

