123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384 |
- using System;
- using System.Collections.Generic;
- using System.Linq.Expressions;
- using InABox.Core;
- namespace Comal.Classes
- {
- public enum StockMovementBatchType
- {
- Stocktake,
- Receipt,
- Issue,
- Transfer
- }
- public class StockMovementBatchDocumentCount : CoreAggregate<StockMovementBatch, StockMovementBatchDocument, Guid>
- {
- public override Expression<Func<StockMovementBatchDocument, Guid>> Aggregate => x => x.ID;
- public override AggregateCalculation Calculation => AggregateCalculation.Count;
- public override Dictionary<Expression<Func<StockMovementBatchDocument, object>>, Expression<Func<StockMovementBatch, object>>> Links =>
- new Dictionary<Expression<Func<StockMovementBatchDocument, object>>, Expression<Func<StockMovementBatch, object>>>()
- {
- { StockMovementBatchDocument => StockMovementBatchDocument.EntityLink.ID, StockMovementBatch => StockMovementBatch.ID }
- };
- }
- public interface IStockMovementBatch : IEntity
- {
- }
- [UserTracking(typeof(StockMovement))]
- public class StockMovementBatch : Entity, IRemotable, IPersistent, IStockMovementBatch, ILicense<WarehouseLicense>
- {
- [EnumLookupEditor(typeof(StockMovementBatchType))]
- [EditorSequence(1)]
- public StockMovementBatchType Type { get; set; }
- [TimestampEditor]
- [EditorSequence(2)]
- public DateTime TimeStamp { get; set; }
- [EditorSequence(3)]
- public EmployeeLink Employee { get; set; }
- [MemoEditor]
- [EditorSequence(4)]
- public string Notes { get; set; }
- [Aggregate(typeof(StockMovementBatchDocumentCount))]
- [NullEditor]
- public int Documents { get; set; }
- public RequisitionLink Requisition { get; set; }
- protected override void Init()
- {
- base.Init();
- Requisition = new RequisitionLink();
- Employee = new EmployeeLink();
- }
- }
- public class StockMovementBatchLink : EntityLink<StockMovementBatch>, IStockMovementBatch
- {
- [EnumLookupEditor(typeof(StockMovementBatchType), Visible = Visible.Optional, Editable = Editable.Hidden)]
- public StockMovementBatchType Type { get; set; }
- [MemoEditor(Visible = Visible.Optional, Editable = Editable.Hidden)]
- public string Notes { get; set; }
- [NullEditor]
- public int Documents { get; set; }
- [NullEditor]
- public override Guid ID { get; set; }
- }
- [UserTracking(typeof(StockMovement))]
- public class StockMovementBatchDocument : EntityDocument<StockMovementBatchLink>, ILicense<WarehouseLicense>, IManyToMany<StockMovementBatch,Document>
- {
- }
- }
|