package com.aps.entity;

import com.baomidou.mybatisplus.annotation.TableField;
import lombok.Data;

import java.math.BigDecimal;
import java.time.LocalDateTime;

@Data
public class Stock {
private Long id;
private LocalDateTime creationtime;
private Long creatoruserid;
private LocalDateTime lastmodificationtime;
private Long lastmodifieruserid;
private Long isdeleted;
private LocalDateTime deletiontime;
private Long deleteruserid;
private String materialId;
private String materialCode;
private String materialName;
private String materialVersion;
private Long storeId;
private String storeCode;
private String storeName;
private double total;
private Integer measureUnit;
private double totalLock;
private BigDecimal cost;
private LocalDateTime productionDate;
private LocalDateTime expiryDate;
private LocalDateTime warehousingDate;
private BigDecimal batch;
private Short currencyId;
private String currencyName;
private Short supplierId;
private String supplierCode;
private String supplierName;
private Short warehousingUnitId;
private String warehousingUnitName;

    /*已用库存数*/
    @TableField(exist = false)
    private double usedInventory;

    /*可用库存数*/
    @TableField(exist = false)
    private double availableInventory;

    public double getAvailableInventory(){
        return total-totalLock-usedInventory;
    };
}