using System.Collections.Generic;
using SqlSugar;
using WmsLite.Api.Enums;
namespace WmsLite.Api.Models;
[SugarTable("inventory")]
public class Inventory : BaseEntity
{
/// 1=物料库存,2=空容器库存。
[SugarColumn(ColumnName = "inventory_kind", IsNullable = false)]
public InventoryKind InventoryKind { get; set; } = InventoryKind.Material;
[SugarColumn(ColumnName = "material_code", Length = 64, IsNullable = true)]
public string? MaterialCode { get; set; }
[SugarColumn(ColumnName = "container_code", Length = 64, IsNullable = true)]
public string? ContainerCode { get; set; }
/// 与 location 表一致,便于按仓库-库区-分区-储位查询。
[SugarColumn(ColumnName = "warehouse_code", Length = 64, IsNullable = false)]
public string WarehouseCode { get; set; } = string.Empty;
[SugarColumn(ColumnName = "area_code", Length = 64, IsNullable = false)]
public string AreaCode { get; set; } = string.Empty;
/// 分区编码。
[SugarColumn(ColumnName = "zone_code", Length = 64, IsNullable = false)]
public string ZoneCode { get; set; } = string.Empty;
/// 储位编码,对应 location.code。
[SugarColumn(ColumnName = "location_code", Length = 64, IsNullable = false)]
public string LocationCode { get; set; } = string.Empty;
[SugarColumn(ColumnName = "qty", IsNullable = false)]
public decimal Qty { get; set; }
[SugarColumn(ColumnName = "pending_inbound_qty", IsNullable = false)]
public decimal PendingInboundQty { get; set; }
[SugarColumn(ColumnName = "pending_outbound_qty", IsNullable = false)]
public decimal PendingOutboundQty { get; set; }
[SugarColumn(ColumnName = "frozen_qty", IsNullable = false)]
public decimal FrozenQty { get; set; }
[SugarColumn(ColumnName = "inventory_status", IsNullable = false)]
public InventoryStatus InventoryStatus { get; set; } = InventoryStatus.Available;
[SugarColumn(ColumnName = "unit", Length = 32, IsNullable = false)]
public string Unit { get; set; } = string.Empty;
[SugarColumn(ColumnName = "attrs", IsJson = true, ColumnDataType = "jsonb", IsNullable = true)]
public Dictionary? Attrs { get; set; }
}