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

import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
import com.alibaba.excel.annotation.ExcelProperty;
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.Data;

import java.time.LocalDateTime;

@Schema(description = "管理后台 - 入库明细,验收入库、盘盈入库等 Response VO")
@Data
@ExcelIgnoreUnannotated
public class MaterialInventoryInboundDetailRespVO {

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

    @Schema(description = "入库单ID", example = "30205")
    @ExcelProperty("入库单ID")
    private Long inboundId;

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

    @Schema(description = "批次工段id", example = "1454")
    @ExcelProperty("批次工段id")
    private Long batchGongduanId;

    // 工段名

    @Schema(description = "物料实例ID", example = "17457")
    @ExcelProperty("物料实例ID")
    private Long materialInfomationId;

    @Schema(description = "物料编码")
    @ExcelProperty("物料编码")
    private String infomationCode;

    @Schema(description = "物料名称")
    @ExcelProperty("物料名称")
    private String infomationName;

    @Schema(description = "业务类型,验收入库、盘盈入库等")
    @ExcelProperty("业务类型,验收入库、盘盈入库等")
    private String businessType;

    @Schema(description = "存放位置名称")
    @ExcelProperty("存放位置名称")
    private String locationName;

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

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

    @Schema(description = "标签模板")
    private String labelTemplateKey;

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

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

    @Schema(description = "有效期")
    private String expirationDate;

    @Schema(description = "入库人", example = "赵六")
    @ExcelProperty("入库人")
    private String inboundUserName;

    @Schema(description = "入库人id", example = "6313")
    @ExcelProperty("入库人id")
    private Long inboundUserId;

    @Schema(description = "入库人部门", example = "张三")
    @ExcelProperty("入库人部门")
    private String inboundDepartmentName;

    @Schema(description = "入库人部门id", example = "10963")
    @ExcelProperty("入库人部门id")
    private Long inboundDepartmentId;

    @Schema(description = "入库时间")
    @ExcelProperty("入库时间")
    private LocalDateTime inboundTime;

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

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

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

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

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

}