StockMovementBatch.cs 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq.Expressions;
  4. using InABox.Core;
  5. namespace Comal.Classes
  6. {
  7. public enum StockMovementBatchType
  8. {
  9. Stocktake,
  10. Receipt,
  11. Issue,
  12. Transfer
  13. }
  14. public class StockMovementBatchDocumentCount : CoreAggregate<StockMovementBatch, StockMovementBatchDocument, Guid>
  15. {
  16. public override Expression<Func<StockMovementBatchDocument, Guid>> Aggregate => x => x.ID;
  17. public override AggregateCalculation Calculation => AggregateCalculation.Count;
  18. public override Dictionary<Expression<Func<StockMovementBatchDocument, object>>, Expression<Func<StockMovementBatch, object>>> Links =>
  19. new Dictionary<Expression<Func<StockMovementBatchDocument, object>>, Expression<Func<StockMovementBatch, object>>>()
  20. {
  21. { StockMovementBatchDocument => StockMovementBatchDocument.EntityLink.ID, StockMovementBatch => StockMovementBatch.ID }
  22. };
  23. }
  24. public interface IStockMovementBatch : IEntity
  25. {
  26. }
  27. [UserTracking(typeof(StockMovement))]
  28. public class StockMovementBatch : Entity, IRemotable, IPersistent, IStockMovementBatch, ILicense<WarehouseLicense>
  29. {
  30. [EnumLookupEditor(typeof(StockMovementBatchType))]
  31. [EditorSequence(1)]
  32. public StockMovementBatchType Type { get; set; }
  33. [TimestampEditor]
  34. [EditorSequence(2)]
  35. public DateTime TimeStamp { get; set; }
  36. [EditorSequence(3)]
  37. public EmployeeLink Employee { get; set; }
  38. [MemoEditor]
  39. [EditorSequence(4)]
  40. public string Notes { get; set; }
  41. [Aggregate(typeof(StockMovementBatchDocumentCount))]
  42. [NullEditor]
  43. public int Documents { get; set; }
  44. public RequisitionLink Requisition { get; set; }
  45. protected override void Init()
  46. {
  47. base.Init();
  48. Requisition = new RequisitionLink();
  49. Employee = new EmployeeLink();
  50. }
  51. }
  52. public class StockMovementBatchLink : EntityLink<StockMovementBatch>, IStockMovementBatch
  53. {
  54. [EnumLookupEditor(typeof(StockMovementBatchType), Visible = Visible.Optional, Editable = Editable.Hidden)]
  55. public StockMovementBatchType Type { get; set; }
  56. [MemoEditor(Visible = Visible.Optional, Editable = Editable.Hidden)]
  57. public string Notes { get; set; }
  58. [NullEditor]
  59. public int Documents { get; set; }
  60. [NullEditor]
  61. public override Guid ID { get; set; }
  62. }
  63. [UserTracking(typeof(StockMovement))]
  64. public class StockMovementBatchDocument : EntityDocument<StockMovementBatchLink>, ILicense<WarehouseLicense>, IManyToMany<StockMovementBatch,Document>
  65. {
  66. }
  67. }