using System.Collections.Generic;
using SqlSugar;
using WmsLite.Api.Enums;
namespace WmsLite.Api.Models;
[SugarTable("inbound_order_line")]
public class InboundOrderLine : BaseEntity
{
[SugarColumn(ColumnName = "order_id", IsNullable = false)]
public long OrderId { get; set; }
[SugarColumn(ColumnName = "line_no", IsNullable = false)]
public int LineNo { get; set; }
[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; }
[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 = "location_code", Length = 64, IsNullable = true)]
public string? LocationCode { get; set; }
[SugarColumn(ColumnName = "qty", IsNullable = false)]
public decimal Qty { get; set; }
/// 供 CodeFirst 加列时为历史行生成默认值,避免 NOT NULL 无 DEFAULT 失败。
[SugarColumn(ColumnName = "received_qty", IsNullable = false, DefaultValue = "0")]
public decimal ReceivedQty { get; set; }
[SugarColumn(ColumnName = "line_status", IsNullable = false, DefaultValue = "1")]
public OrderLineStatus LineStatus { get; set; } = OrderLineStatus.Open;
[SugarColumn(ColumnName = "unit", Length = 32, IsNullable = true)]
public string? Unit { get; set; }
[SugarColumn(ColumnName = "attrs", IsJson = true, ColumnDataType = "jsonb", IsNullable = true)]
public Dictionary? Attrs { get; set; }
}