Exemplo n.º 1
0
        public override void When(ShipmentCommands.ConfirmAllItemsReceived c)
        {
            var shipment = AssertShipmentStatus(c.ShipmentId, StatusItemIds.PurchShipShipped);

            var shipmentReceiptDict = shipment.ShipmentReceipts.ToDictionary(i => i.ShipmentItemSeqId);

            var shipmentItemDict = shipment.ShipmentItems.ToDictionary(i => i.ShipmentItemSeqId);

            // /////////////////////////////
            var itemIdNotFound = shipmentItemDict.Keys.Where(i => !shipmentReceiptDict.ContainsKey(i)).FirstOrDefault();

            if (itemIdNotFound != null)
            {
                throw new ArgumentException(String.Format("Shipment item NOT received. ShipmentItemSeqId.: {0}", itemIdNotFound));
            }
            // /////////////////////////////
            var receiptUnknown = shipmentReceiptDict.Values.Where(i => !shipmentItemDict.ContainsKey(i.ShipmentItemSeqId)).FirstOrDefault();

            if (receiptUnknown != null)
            {
                throw new ArgumentException(String.Format("Shipment receipt has unknown ShipmentItemSeqId.: {0}", receiptUnknown.ShipmentItemSeqId));
            }

            var inventoryItemEntries = ConfirmAllItemsReceivedCreateInventoryItemEntries(shipment, shipmentReceiptDict.Values);

            CreateOrUpdateInventoryItems(inventoryItemEntries);

            base.When(c);
        }
Exemplo n.º 2
0
        private void UpdateShipmentToPurchShipReceived(string shipmentId)
        {
            //var updateShipment = new MergePatchShipment();
            var updateShipment = new ShipmentCommands.ConfirmAllItemsReceived();

            updateShipment.ShipmentId = shipmentId;
            updateShipment.CommandId  = Guid.NewGuid().ToString();
            //updateShipment.StatusId = StatusItemIds.PurchShipShipped;
            updateShipment.Version = 4; //todo???
            shipmentApplicationService.When(updateShipment);
        }
 public void When(ShipmentCommands.ConfirmAllItemsReceived c)
 {
     throw new NotImplementedException();//todo
 }