AdoInventoryTransaction.cs 3.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. using SqlSugar;
  2. namespace Admin.NET.Plugin.AiDOP.MaterialWarehouse.InventoryPosting.Entity;
  3. /// <summary>
  4. /// DOP-L3 库存事务流水(影子, append-only)。**非旧 InvTransHist**。
  5. /// 旧 InvTransHist 为纯 append-only(pr_SFM_InventoryTransactionProcessing2 L373 仅 INSERT,零 UPDATE、无自然唯一键)。
  6. /// L3 用代理主键 id;结构层防重键 = (tenant_id, transaction_group_id, seq):同一次过账(group)内的流水行 seq 唯一,
  7. /// 防止同一 Posting 重复写同一流水。**此为结构层防重,不替代 Phase 4 的 Posting 幂等。**
  8. /// transaction_group_id 由 Phase 5 每次过账用雪花赋值;seq 为组内 1..N。
  9. /// </summary>
  10. [SugarTable("ado_inventory_transaction", "DOP-L3库存事务流水(影子,append-only,非旧InvTransHist)")]
  11. [SugarIndex("uk_ado_inv_trans_group_seq", nameof(TenantId), OrderByType.Asc, nameof(TransactionGroupId), OrderByType.Asc, nameof(Seq), OrderByType.Asc, IsUnique = true)]
  12. [SugarIndex("idx_ado_inv_trans_posting", nameof(TenantId), OrderByType.Asc, nameof(PostingId), OrderByType.Asc)]
  13. public class AdoInventoryTransaction : AdoInvEntityBase
  14. {
  15. [SugarColumn(ColumnName = "item_num", ColumnDescription = "物料号", Length = 50, IsNullable = false, DefaultValue = "")]
  16. public string ItemNum { get; set; }
  17. [SugarColumn(ColumnName = "location", ColumnDescription = "库位", Length = 30, IsNullable = false, DefaultValue = "")]
  18. public string Location { get; set; }
  19. [SugarColumn(ColumnName = "lot_serial", ColumnDescription = "批次/序列号(空落空串)", Length = 50, IsNullable = false, DefaultValue = "")]
  20. public string LotSerial { get; set; }
  21. [SugarColumn(ColumnName = "trans_type", ColumnDescription = "事务类型", Length = 50, IsNullable = false, DefaultValue = "")]
  22. public string TransType { get; set; }
  23. [SugarColumn(ColumnName = "qty_change", ColumnDescription = "变动数量(带方向)", Length = 18, DecimalDigits = 5, DefaultValue = "0")]
  24. public decimal QtyChange { get; set; }
  25. [SugarColumn(ColumnName = "begin_balance", ColumnDescription = "变动前余额", Length = 18, DecimalDigits = 5, IsNullable = true)]
  26. public decimal? BeginBalance { get; set; }
  27. [SugarColumn(ColumnName = "work_ord", ColumnDescription = "工单号", Length = 60, IsNullable = true)]
  28. public string WorkOrd { get; set; }
  29. [SugarColumn(ColumnName = "shipper_num", ColumnDescription = "送货/发运号", Length = 60, IsNullable = true)]
  30. public string ShipperNum { get; set; }
  31. [SugarColumn(ColumnName = "remark", ColumnDescription = "备注", Length = 500, IsNullable = true)]
  32. public string Remark { get; set; }
  33. // ── IQC 过账追溯 ──
  34. [SugarColumn(ColumnName = "fbillno", ColumnDescription = "来源来料检验单号FBILLNO", Length = 50, IsNullable = true)]
  35. public string FbillNo { get; set; }
  36. [SugarColumn(ColumnName = "receiver", ColumnDescription = "收货单号Receiver", Length = 50, IsNullable = true)]
  37. public string Receiver { get; set; }
  38. [SugarColumn(ColumnName = "rct_qc_nbr", ColumnDescription = "检验单号RctQCNbr", Length = 100, IsNullable = true)]
  39. public string RctQcNbr { get; set; }
  40. [SugarColumn(ColumnName = "posting_id", ColumnDescription = "关联过账头 ado_iqc_inventory_posting.id", IsNullable = true)]
  41. public long? PostingId { get; set; }
  42. [SugarColumn(ColumnName = "transaction_group_id", ColumnDescription = "过账事务组Id(每次过账雪花)", DefaultValue = "0")]
  43. public long TransactionGroupId { get; set; }
  44. [SugarColumn(ColumnName = "seq", ColumnDescription = "组内序号1..N", DefaultValue = "0")]
  45. public int Seq { get; set; }
  46. }