StockMovementBatch.cs 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  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. }
  46. public class StockMovementBatchLink : EntityLink<StockMovementBatch>, IStockMovementBatch
  47. {
  48. [EnumLookupEditor(typeof(StockMovementBatchType), Visible = Visible.Optional, Editable = Editable.Hidden)]
  49. public StockMovementBatchType Type { get; set; }
  50. [MemoEditor(Visible = Visible.Optional, Editable = Editable.Hidden)]
  51. public string Notes { get; set; }
  52. [NullEditor]
  53. public int Documents { get; set; }
  54. [NullEditor]
  55. public override Guid ID { get; set; }
  56. }
  57. [UserTracking(typeof(StockMovement))]
  58. public class StockMovementBatchDocument : EntityDocument<StockMovementBatchLink>, ILicense<WarehouseLicense>, IManyToMany<StockMovementBatch,Document>
  59. {
  60. }
  61. }