| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103 |
- namespace Admin.NET.Plugin.AiDOP.MaterialWarehouse.InventoryPosting.Inventory;
- /// <summary>InvMaster 写(W1 首建 / W2 更新为 After)。</summary>
- public sealed class InvMasterWrite
- {
- public long TenantId { get; set; }
- public string DomainCode { get; set; }
- public string ItemNum { get; set; }
- public string Location { get; set; }
- /// <summary>聚合增量(生产实库用相对 UPDATE `set x=x+delta` 防 lost-update,与 LIVE 相对更新一致)。</summary>
- public InventoryDeltas Delta { get; set; }
- /// <summary>计算后值(供 INSERT 新行 = 0+delta,及 Shadow 对账验证)。</summary>
- public InventoryBalance After { get; set; }
- /// <summary>无 InvMaster 且组内含入库 → 首建后再置 After。</summary>
- public bool InsertIfMissing { get; set; }
- public string User { get; set; }
- }
- /// <summary>ItemMaster.Location 语义写(W3 → ado_item_location_state;仅当原默认库位为空、txn Location 非空)。</summary>
- public sealed class ItemLocationWrite
- {
- public long TenantId { get; set; }
- public string DomainCode { get; set; }
- public string ItemNum { get; set; }
- public string DefaultLocation { get; set; }
- public string User { get; set; }
- }
- /// <summary>LocationDetail 写(W4 首建 / W5 更新为 After)。</summary>
- public sealed class LocationDetailWrite
- {
- public long TenantId { get; set; }
- public string DomainCode { get; set; }
- public string ItemNum { get; set; }
- public string Location { get; set; }
- public string LotSerial { get; set; }
- public string Refs { get; set; }
- /// <summary>聚合增量(生产实库用相对 UPDATE 防 lost-update)。</summary>
- public InventoryDeltas Delta { get; set; }
- /// <summary>计算后值(供 INSERT / 对账)。</summary>
- public InventoryBalance After { get; set; }
- public bool InsertIfMissing { get; set; }
- public decimal Cost { get; set; }
- public string Curr { get; set; }
- public string User { get; set; }
- }
- /// <summary>库存流水行(W6 append,映射 ado_inventory_transaction)。</summary>
- public sealed class InventoryTransactionRow
- {
- public long TenantId { get; set; }
- public string DomainCode { get; set; }
- public long PostingId { get; set; }
- public long TransactionGroupId { get; set; }
- public int Seq { get; set; }
- public string ItemNum { get; set; }
- public string Location { get; set; }
- public string LotSerial { get; set; }
- public string TransType { get; set; }
- public decimal QtyChange { get; set; }
- public decimal BeginBalance { get; set; }
- public decimal FreezeQty { get; set; }
- public decimal Assay { get; set; }
- public decimal Amt { get; set; }
- public string WorkOrd { get; set; }
- public string ShipperNum { get; set; }
- public string Fbillno { get; set; }
- public string Receiver { get; set; }
- public string RctQcNbr { get; set; }
- public string Remark { get; set; }
- public string User { get; set; }
- }
- /// <summary>一次过账计算出的全部写(W1-W6);由 store 在单事务内落地。</summary>
- public sealed class InventoryWriteSet
- {
- public List<InvMasterWrite> InvMasterWrites { get; } = new();
- public List<ItemLocationWrite> ItemLocationWrites { get; } = new();
- public List<LocationDetailWrite> LocationDetailWrites { get; } = new();
- public List<InventoryTransactionRow> TransactionRows { get; } = new();
- public int TotalWrites => InvMasterWrites.Count + ItemLocationWrites.Count + LocationDetailWrites.Count + TransactionRows.Count;
- }
- /// <summary>C5 过账结果类别。(Duplicate/Conflict 由上游 Phase 4 幂等层在 C5 之前判定,不在 C5 内。)</summary>
- public enum InventoryPostingOutcome
- {
- Success = 1,
- ValidationFailure = 2,
- Error = 3,
- }
- /// <summary>C5 过账结果(结构化错误码 + 保留 LIVE ReturnMsg 语义供 Shadow 对账)。</summary>
- public sealed class InventoryPostingResult
- {
- public InventoryPostingOutcome Outcome { get; set; }
- public IReadOnlyList<InventoryGuardError> GuardErrors { get; set; } = System.Array.Empty<InventoryGuardError>();
- public int WrittenRows { get; set; }
- public string ErrorCode { get; set; }
- public string ErrorMessage { get; set; }
- /// <summary>LIVE ReturnMsg 语义映射("保存成功"/守卫消息/"保存失败,…")。</summary>
- public string LegacyReturnMsg { get; set; }
- }
|