Пример #1
0
        private string TestCreateAndCompleteAndConfirmMovement_0()
        {
            var isInTransit    = true;
            var documentNumber = CreateAndCompleteTestMovement(isInTransit);

            var confirmDocNumber = "MC" + documentNumber;

            var movConfirm = movementConfirmationApplicationService.Get(confirmDocNumber);

            // //////////////////////////////////
            var updateMovConfirm = new MergePatchMovementConfirmation();

            updateMovConfirm.DocumentNumber = confirmDocNumber;
            updateMovConfirm.Version        = 1;
            updateMovConfirm.CommandId      = Guid.NewGuid().ToString();
            foreach (var line in movConfirm.MovementConfirmationLines)
            {
                var updateLine = updateMovConfirm.NewMergePatchMovementConfirmationLine();
                updateLine.LineNumber        = line.LineNumber;
                updateLine.ConfirmedQuantity = line.TargetQuantity;
                updateMovConfirm.MovementConfirmationLineCommands.Add(updateLine);
            }
            movementConfirmationApplicationService.When(updateMovConfirm);

            // //////////////////////////////////
            var actionConfirm = new MovementConfirmationCommands.DocumentAction();

            actionConfirm.Value          = DocumentAction.Confirm;
            actionConfirm.DocumentNumber = confirmDocNumber;
            actionConfirm.Version        = 2;
            actionConfirm.CommandId      = Guid.NewGuid().ToString();
            movementConfirmationApplicationService.When(actionConfirm);

            return(actionConfirm.DocumentNumber);
        }
 private void ConfirmUpdateMovement(MovementConfirmationCommands.DocumentAction c, IMovementState mov)
 {
     MovementApplicationService.ConfirmUpdateMovement(new MovementCommands.DocumentAction()
     {
         DocumentNumber = mov.DocumentNumber,
         Version        = mov.Version,
         CommandId      = c.CommandId,
         RequesterId    = c.RequesterId,
     });
 }
        public override void When(MovementConfirmationCommands.DocumentAction c)
        {
            if (c.Value == DocumentAction.Confirm)
            {
                var movConfirm   = AssertDocumentStatus(c.DocumentNumber, DocumentStatusIds.InProgress);
                var movDocNumber = movConfirm.MovementDocumentNumber;
                var mov          = AssertMovementDocumentStatusInProgress(movDocNumber);

                var quantitiesDict = GetQuantitiesDictionary(movConfirm);
                AssertAllLinesConfirmed(mov, quantitiesDict);

                var inventoryItemEntries = ConfirmMovementCreateInventoryItemEntries(mov, quantitiesDict);
                CreateOrUpdateInventoryItems(inventoryItemEntries);

                ConfirmUpdateMovement(c, mov);

                base.When(c);
            }
            else
            {
                base.When(c);
            }
        }
 public void When(MovementConfirmationCommands.DocumentAction c)
 {
     throw new NotImplementedException();//todo
 }