package com.zt.plat.module.qms.resource.material.controller.vo;

import com.zt.plat.module.qms.core.aspect.annotation.Dict;
import com.zt.plat.module.qms.resource.material.controller.vo.assist.QrCodeContent;
import com.zt.plat.module.qms.core.util.qrcode.QrCodeJsonUtil;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;

import java.math.BigDecimal;
import java.time.LocalDate;
import java.time.LocalDateTime;
import com.alibaba.excel.annotation.*;

@Schema(description = "管理后台 - 物料实例 Response VO")
@Data
@ExcelIgnoreUnannotated
public class MaterialInfomationRespVO {

    @Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "13447")
    @ExcelProperty("主键")
    private Long id;

    @Schema(description = "物料大类id", example = "2691")
    @ExcelProperty("物料大类id")
    private Long productId;

    @Schema(description = "批次id", example = "2703")
    @ExcelProperty("批次id")
    private Long batchId;

    @Schema(description = "批次编号")
    @ExcelProperty("批次编号")
    private String batchNo;

    @Schema(description = "工段id")
    @ExcelProperty("工段id")
    private Long gongduanId;

    @Schema(description = "工段部门id")
    @ExcelProperty("工段部门id")
    private Long assignDepartmentId;

    @Schema(description = "工段分配部门名称")
    @ExcelProperty("工段分配部门名称")
    private String assignDepartmentName;

    @Schema(description = "存放位置", example = "13603")
    @ExcelProperty("存放位置")
    private String locationId;

    @Schema(description = "存放位置编码")
    @ExcelProperty("存放位置编码")
    private String locationCode;

    @Schema(description = "编码")
    @ExcelProperty("编码")
    private String code;

    @Schema(description = "二维码内容")
    private QrCodeContent qrCode;

    @Schema(description = "来源,批次入库，标液配置、危化品配置等")
    @ExcelProperty("来源,批次入库，标液配置、危化品配置等")
    @Dict(dicCode = "material_infomation_origin")
    private String origin;

    @Schema(description = "名称")
    @ExcelProperty("名称")
    private String name;

    @Schema(description = "额定容量")
    @ExcelProperty("额定容量")
    private BigDecimal standardCapacity;

    @Schema(description = "型号")
    @ExcelProperty("型号")
    private String modelNo;

    @Schema(description = "规格")
    @ExcelProperty("规格")
    private String specification;

    @Schema(description = "技术参数")
    @ExcelProperty("技术参数")
    private String parameter;

    @Schema(description = "制造商")
    @ExcelProperty("制造商")
    private String manufacturer;

    @Schema(description = "单位")
    @ExcelProperty("单位")
    private String unit;

    @Schema(description = "保质期（天）")
    @ExcelProperty("保质期（天）")
    private Integer due;

    @Schema(description = "上架状态,0-未上架，1-已上架", example = "2")
    @ExcelProperty("上架状态,0-未上架，1-已上架")
    private Integer publishStatus;

    @Schema(description = "领用状态,0-未领用，1-已领用", example = "1")
    @ExcelProperty("领用状态,0-未领用，1-已领用")
    private Integer usageStatus;

    @Schema(description = "所属部门ID", example = "16158")
    @ExcelProperty("所属部门ID")
    private Integer managerDepartmentId;

    @Schema(description = "领用人部门", example = "王五")
    @ExcelProperty("领用人部门")
    private String managerDepartmentName;

    @Schema(description = "负责人id", example = "7209")
    @ExcelProperty("负责人id")
    private Long managerUserId;

    @Schema(description = "负责人", example = "张三")
    @ExcelProperty("负责人")
    private String managerUserName;

    @Schema(description = "是否危险品,1-是，0-否")
    @ExcelProperty("是否危险品,1-是，0-否")
    @Dict(dicCode = "yes_or_no")
    private Integer hazardous;

    @Schema(description = "是否存在危化品配置信息")
    @ExcelProperty("是否存在危化品配置信息")
    private Boolean existHazardousMake;

    @Schema(description = "是否标准溶液,1-是，0-否")
    @ExcelProperty("是否标准溶液,1-是，0-否")
    @Dict(dicCode = "yes_or_no")
    private Integer standardSolutionFlag;

    @Schema(description = "是否标准物质,1-是，0-否")
    @ExcelProperty("是否标准物质,1-是，0-否")
    @Dict(dicCode = "yes_or_no")
    private Integer standardMaterialFlag;

    @Schema(description = "配置人")
    @ExcelProperty("配置人")
    private String makeUser;

    @Schema(description = "配置人id", example = "5428")
    @ExcelProperty("配置人id")
    private Long makeUserId;

    @Schema(description = "配置日期")
    @ExcelProperty("配置日期")
    private LocalDateTime makeDate;

    @Schema(description = "浓度")
    @ExcelProperty("浓度")
    private String concentration;

    @Schema(description = "滴定度")
    @ExcelProperty("滴定度")
    private String titer;

    @Schema(description = "开封状态,0-未开封，1-已开封", example = "2")
    @ExcelProperty("开封状态,0-未开封，1-已开封")
    private Integer openStatus;

    @Schema(description = "开封人id", example = "8280")
    @ExcelProperty("开封人id")
    private Long openUserId;

    @Schema(description = "开封人", example = "王五")
    @ExcelProperty("开封人")
    private String openUserName;

    @Schema(description = "开封日期")
    @ExcelProperty("开封日期")
    private LocalDateTime openDate;

    @Schema(description = "生产日期")
    @ExcelProperty("生产日期")
    private LocalDate manufacturerDate;

    @Schema(description = "到期日期")
    @ExcelProperty("到期日期")
    private LocalDate expirationDate;

    @Schema(description = "过期状态")
    @ExcelProperty("过期状态")
    private String expirationFlag;

    @Schema(description = "剩余量")
    @ExcelProperty("剩余量")
    private BigDecimal remainingVolume;

    @Schema(description = "盘点数量")
    private BigDecimal checkQuantity;

    @Schema(description = "盘点明细id")
    private Long checkDetailId;

    @Schema(description = "是否在库")
    private Integer present;

    @Schema(description = "初始总量")
    @ExcelProperty("初始总量")
    private BigDecimal initialVolume;

    @Schema(description = "用完标记,0-未标记，1-已用完标记")
    @ExcelProperty("用完标记,0-未标记，1-已用完标记")
    private Integer useEndFlag;

    @Schema(description = "所属部门")
    @ExcelProperty("所属部门")
    private String systemDepartmentCode;

    @Schema(description = "备注")
    @ExcelProperty("备注")
    private String remark;

    @Schema(description = "创建时间")
    @ExcelProperty("创建时间")
    private LocalDateTime createTime;

    // 设置二维码内容
    public String getQrCode() {
        QrCodeContent qrCode = new QrCodeContent();
        qrCode.setCode(this.code);
        qrCode.setName(this.name);
        return QrCodeJsonUtil.getQrCode(qrCode, QrCodeContent::getCode);
    }

    // 用于标签
    public String getInfomationName() {
        return this.name;
    }

    public String getInfomationCode() {
        return this.code;
    }
}