package com.czg.product.vo;

import cn.hutool.core.util.NumberUtil;
import com.alibaba.fastjson2.annotation.JSONField;
import lombok.Data;

import java.io.Serial;
import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDateTime;

/**
 * 库存盘点记录
 *
 * @author tankaikai
 * @since 2025-02-24 13:40
 */
@Data
public class ConsCheckStockRecordVo implements Serializable {

    @Serial
    private static final long serialVersionUID = 1L;
    /**
     * 耗材id
     */
    private Long conId;
    /**
     * 耗材名称
     */
    private String conName;
    /**
     * 单价
     */
    private BigDecimal purchasePrice;
    /**
     * 账存数量
     */
    private BigDecimal beforeNumber;
    /**
     * 盈亏数量
     */
    private BigDecimal inOutNumber;
    /**
     * 盘点后的数量
     */
    @JSONField(serialize = false)
    private BigDecimal afterNumber;
    /**
     * 盈亏金额
     */
    private BigDecimal winLossAmount;
    /**
     * 实际库存
     */
    private BigDecimal actualNumber;
    /**
     * 盘点时间
     */
    @JSONField(format = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime createTime;
    /**
     * 备注
     */
    private String remark;

    public BigDecimal getWinLossAmount() {
        return NumberUtil.mul(purchasePrice, purchasePrice);
    }

    public BigDecimal getActualNumber() {
        return afterNumber;
    }
}
