namespace Admin.NET.Plugin.AiDOP.MaterialWarehouse.InventoryPosting.Inventory; /// 库存事务类型(复刻 pr_SFM_InventoryTransactionProcessing2 的 TransType 常量)。 public static class InventoryTransType { /// 冻结(可用→冻结)。 public const string InvFrz = "inv-frz"; /// 解冻。 public const string InvUnFrz = "inv-unfrz"; /// 采购收货入库(→质检库存 Assay;ChangeQty>0)。IQC 合格入库主路径。 public const string RctPoIns = "rct-po-ins"; /// 质检转序/发出(从质检库存出;ChangeQty<0 走 Assay 掩码)。 public const string IssTrIns = "iss-tr-ins"; /// 销售出库(影响 QtyOnOrd)。 public const string IssSo = "iss-so"; /// IQC 合格收货(@IQCNbr≠'',Phase 6A 实核)。**C5 一般分支**:QtyOnHand+/Avail+/Assay=0。 public const string RctPo = "rct-po"; /// IQC 留样(Reason='iqc',ChangeQty 恒负)。**C5 一般分支**:QtyOnHand-/Avail-。 public const string IssUnp = "iss-unp"; } /// /// 标准化库存事务命令(C5 输入)。上游已完成 C1 判定 / 编排 / 取号,C5 只认此 DTO。 /// 约定:ChangeQty>0=入库,<0=出库;LotSerial/Refs 空批落空串 ''(非 NULL)。 /// public sealed class InventoryTransactionCommand { public long TenantId { get; set; } public string DomainCode { get; set; } = string.Empty; public long PostingId { get; set; } public long TransactionGroupId { get; set; } public int Seq { get; set; } public string ItemNum { get; set; } = string.Empty; public string Location { get; set; } = string.Empty; public string LotSerial { get; set; } = string.Empty; public string Refs { get; set; } = string.Empty; public string TransType { get; set; } = string.Empty; public decimal ChangeQty { get; set; } public decimal UmConversion { get; set; } = 1m; public decimal QtyPicked { get; set; } public string WorkOrd { get; set; } public string ShipperNum { get; set; } public string ShipType { get; set; } public string OrdNbr { get; set; } public string Curr { get; set; } public decimal Price { get; set; } public string Remark { get; set; } public string Reason { get; set; } public string Op { get; set; } public string Site { get; set; } public string User { get; set; } // 收货追溯(→ 流水 ado_inventory_transaction) public string Fbillno { get; set; } public string Receiver { get; set; } public string RctQcNbr { get; set; } } /// 库存量快照(前值/后值通用)。 public sealed class InventoryBalance { public decimal QtyOnHand { get; set; } public decimal AvailStatusQty { get; set; } public decimal Assay { get; set; } public decimal FreezeQty { get; set; } public decimal QtyOnOrd { get; set; } } /// 单条命令的库存量增量(带符号;无 DB 副作用计算结果)。 public sealed class InventoryDeltas { /// ChangeQty × 归一化 UMConversion。 public decimal Conv { get; set; } public decimal DeltaQtyOnHand { get; set; } public decimal DeltaAvailStatusQty { get; set; } public decimal DeltaAssay { get; set; } public decimal DeltaFreezeQty { get; set; } public decimal DeltaQtyOnOrd { get; set; } } /// 库存流水(InvTransHist 等价)字段值。 public sealed class InventoryTransHistValues { /// 变动前库位明细在手(由调用方传入 LocationDetail 变动前 QtyOnHand)。 public decimal BeginBalance { get; set; } /// 流水 QtyChange = conv(frz/unfrz 记 0)。 public decimal QtyChange { get; set; } public decimal FreezeQty { get; set; } public decimal Assay { get; set; } /// 金额 = conv × Price。 public decimal Amt { get; set; } /// 流水事务类型 = (Remark=='QcCheck' ? Reason : TransType)。 public string TransType { get; set; } }