예제 #1
0
        /// <summary>
        ///     Transfers WorkCycle with Items to New Purchase Order
        ///     Part of Workflow: WorkCycle -> PurchaseOrder
        /// </summary>
        /// <param name="workCycleId"></param>
        /// <param name="user"></param>
        public void ConfirmWorkCycle(int workCycleId, User user)
        {
            ValidateParameters(workCycleId, user);

            _user = user;

            var fullWorkCycleFromDb = ActivateWorkCycle(workCycleId);

            InventoryTransactionsService.AddWorkCycleTransactions(fullWorkCycleFromDb);

            var purchaseOrderToDb = CreateNewPurchaseOrderForInsert(fullWorkCycleFromDb);

            _unitOfWork.PurchaseOrders.AddPurchaseOrder(purchaseOrderToDb);
        }
예제 #2
0
        /// <summary>
        ///     Updates Purchase Order Transactiosn and Work Cycle Transactionsw
        /// </summary>
        /// <param name="oldPurchaseOrder"></param>
        /// <param name="purchaseOrderTransactions"></param>
        public void ProcurePurchaseOrder(PurchaseOrder oldPurchaseOrder,
                                         IEnumerable <PurchaseOrderTransaction> purchaseOrderTransactions, User user)
        {
            ValidateParameters(oldPurchaseOrder, purchaseOrderTransactions, user);

            var newPurchaseOrderTransactions = purchaseOrderTransactions.ToList();

            _user = user;

            ConcurrencyCheckOnDatabase(oldPurchaseOrder);

            ChangePurchaseOrderStatusToInProgress(oldPurchaseOrder);

            InventoryTransactionsService.AddPurchaseOrderTransactions(newPurchaseOrderTransactions.ToList());

            InventoryTransactionsService.AddWorkCycleTransactions(oldPurchaseOrder.WorkCycleId, user);

            AssignLocationInWorkCycles(oldPurchaseOrder.WorkCycleId, newPurchaseOrderTransactions.ToList());

            AddOrUpdateItemsToStock(newPurchaseOrderTransactions);

            InventoryTransactionsService.AddInventoryTransactions(TransformToITL(newPurchaseOrderTransactions.ToList()), _user);
        }
 public RestProServiceBase(IUnitOfWork unitOfWork)
 {
     _unitOfWork = unitOfWork;
     InventoryTransactionsService = new InventoryTransactionsService(unitOfWork);
 }