package com.openhis.web.inventorymanage.dto;

import java.math.BigDecimal;
import java.util.Date;

import com.core.common.annotation.Excel;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import com.openhis.common.annotation.Dict;

import lombok.Data;
import lombok.experimental.Accessors;

/**
 * 库存商品明细分页列表 dto
 *
 * @author yuanzs
 * @date 2025-04-24
 */
@Data

@Accessors(chain = true)
public class ProductDetailPageDto {

    /** 库存项目管理ID（停供用） */
    @JsonSerialize(using = ToStringSerializer.class)
    private Long inventoryId;

    /** 生产日期 */
    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd")
    @Excel(name = "生产日期", sort = 19, dateFormat = "yyyy-MM-dd")
    private Date productionDate;

    /** 失效日期 */
    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd")
    @Excel(name = "有效期至", sort = 20, dateFormat = "yyyy-MM-dd")
    private Date expirationDate;

    /** 库存状态 */
    private Integer inventoryStatusEnum;
    private String inventoryStatusEnum_enumText;

    /** 仓库 */
    @JsonSerialize(using = ToStringSerializer.class)
    private Long locationId;

    /** 仓库名称 */
    @Excel(name = "仓库", sort = 4)
    private String locationName;

    /** 货位 */
    @JsonSerialize(using = ToStringSerializer.class)
    private Long locationStoreId;

    /** 货位名称 */
    @Excel(name = "货位", sort = 22)
    private String locationStoreName;

    /** 生产批号 */
    @Excel(name = "生产批号", sort = 7)
    private String lotNumber;

    /** 库存数量 */
    private BigDecimal quantity;
    @Excel(name = "库存（最小单位）", sort = 9)
    private String quantity_text;

    /** 包装单位数量（整数部分） */
    private BigDecimal number;
    @Excel(name = "库存（包装单位）", sort = 8)
    private String number_text;

    /** 包装单位数量（余数部分） */
    private BigDecimal remainder;

    /** 供应商 */
    @JsonSerialize(using = ToStringSerializer.class)
    private Long supplierId;

    /** 供应商名称 */
    @Excel(name = "供应商", sort = 17)
    private String supplierName;

    /** 项目名称 */
    @Excel(name = "项目名称", sort = 2)
    private String itemName;

    /** 项目名称 */
    private String itemTable;

    /** 项目编码 */
    @Excel(name = "药品编码", sort = 1)
    private String busNo;

    /** 耗材类型 */
    @Dict(dictCode = "device_category_code")
    private String devCategoryCode;
    private String devCategoryCode_dictText;
    private String devCategoryCodeDictText;

    /** 药品类型 */
    @Dict(dictCode = "med_category_code")
    private String medCategoryCode;
    private String medCategoryCode_dictText;
    private String medCategoryCodeDictText;

    /** 项目类别 */
    @Excel(name = "项目类别", sort = 3)
    private String CategoryCodeDictText;

    /** 医保等级 */
    private Integer chrgitmLv;
    @Excel(name = "医保等级", sort = 18)
    private String chrgitmLv_enumText;

    /** 厂家 */
    @Excel(name = "厂家/产地", sort = 6)
    private String manufacturerText;

    /** 医保码 */
    private String ybNo;

    /** 五笔码 */
    private String wbStr;

    /** 拼音码 */
    private String pyStr;

    /** 包装单位 */
    @Dict(dictCode = "unit_code")
    private String unitCode;
    private String unitCode_dictText;
    private String unitCodeDictText;

    /** 库存单位 */
    @Dict(dictCode = "unit_code")
    private String minUnitCode;
    private String minUnitCode_dictText;
    private String minUnitCodeDictText;

    /** 拆零比 */
    @Excel(name = "拆零比", sort = 10, scale = 0)
    private BigDecimal partPercent;

    /** 批准文号/国药准字 */
    @Excel(name = "国药准字", sort = 16)
    private String approvalNumber;

    /** 剂型 */
    @Dict(dictCode = "dose_form_code")
    private String doseFormCode;
    private String doseFormCode_dictText;
    @Excel(name = "剂型", sort = 15)
    private String doseFormCodeDictText;

    /** 规格 */
    @Excel(name = "规格", sort = 5)
    private String totalVolume;

    /** 零售价 */
    private BigDecimal salePrice;
    @Excel(name = "零售价", sort = 12)
    private String excelSalePrice = "";

    /** 定价id */
    @JsonSerialize(using = ToStringSerializer.class)
    private Long chargeItemDefId;

    /** 进价 */
    private BigDecimal purchasePrice;
    @Excel(name = "采购价格", sort = 11)
    private String excelPurchasePrice = "";

    /** 剩余过期天数 */
    @Excel(name = "剩余过期天数", sort = 21)
    private Integer remainingDays;

    /** 总零售价 */
    private BigDecimal totalSalePrice;
    @Excel(name = "零售价总额", sort = 14)
    private String excelTotalSalePrice = "";

    /** 总进价 */
    private BigDecimal totalPurchasePrice;
    @Excel(name = "进价总额", sort = 13, scale = 2)
    private String excelTotalPurchasePrice = "";

    /** 售价统计 */
    private BigDecimal salePriceStatistics;

    /** 进价统计 */
    private BigDecimal purchasePriceStatistics;

    // 设置统计金额默认值为零
    public ProductDetailPageDto() {
        this.totalSalePrice = BigDecimal.ZERO;
        this.totalPurchasePrice = BigDecimal.ZERO;
        this.salePriceStatistics = BigDecimal.ZERO;
        this.purchasePriceStatistics = BigDecimal.ZERO;
    }
}
