Пример #1
0
 /// <summary>
 ///     Get the remaining quantity for the provided InboundShipment instance.
 /// </summary>
 /// <param name="inboundShipment">The InboundShipment to get the remaining quantity for.</param>
 /// <returns>The remaining quantity.</returns>
 public async Task <decimal> GetRemainingShipmentQuantity(InboundShipment inboundShipment)
 {
     try
     {
         return(await _inboundShipmentRepository.GetRemainingShipmentQuantity(inboundShipment).ConfigureAwait(false));
     }
     catch (Exception ex)
     {
         _logService.WriteErrorLogEntry($"Failed to read remaining quantity: {ex}");
         ex.Report();
         return(int.MinValue);
     }
 }
Пример #2
0
        /// <summary>
        ///     Confirm the receipt of an inbound shipment.
        /// </summary>
        /// <param name="receivedQuantity">The quantity received.</param>
        /// <param name="lotNumber">The received lot number.</param>
        /// <returns>An asynchronous Task instance.</returns>
        public async Task CreateReceipt(
            InboundShipment inboundShipment,
            decimal receivedQuantity,
            string lotNumber
            )
        {
            if (inboundShipment == null)
            {
                return;
            }

            await AddReceiptWorkItem(CreateReceiptWorkItem(
                                         inboundShipment,
                                         receivedQuantity,
                                         lotNumber
                                         )).ConfigureAwait(false);
        }
        /// <inheritdoc />
        public async Task <decimal> GetRemainingShipmentQuantity(InboundShipment inboundShipment)
        {
            var workItemQuantity = await GetTotalWorkItemQuantity(
                inboundShipment?.DocumentNumber,
                inboundShipment?.ItemNumber,
                Convert.ToString(inboundShipment.PoLineNumber)
                ).ConfigureAwait(false);

            // Ensure we don't have an invalid quantity.
            if (workItemQuantity <= 0)
            {
                return(inboundShipment?.OpenQty ?? 0);
            }

            var remainingQty = (inboundShipment?.OpenQty ?? 0) - workItemQuantity;

            return(remainingQty <= 0
                ? 0
                : remainingQty);
        }
Пример #4
0
 /// <summary>
 ///     Create a new ReceiptWorkItem instance from a confirm shipment receipt.
 /// </summary>
 /// <param name="inboundShipment">The shipment being received.</param>
 /// <param name="receivedQuantity">The received quantity.</param>
 /// <param name="lotNumber">The lot number (if lot controlled).</param>
 /// <returns>A new ReceiptWorkItem instance.</returns>
 private ReceiptWorkItem CreateReceiptWorkItem(
     InboundShipment inboundShipment,
     decimal receivedQuantity,
     string lotNumber
     ) => new ReceiptWorkItem
 {
     VendorId         = inboundShipment.VendorId,
     PoLineNumber     = Convert.ToString(inboundShipment.PoLineNumber),
     ItemNumber       = inboundShipment.ItemNumber,
     Quantity         = receivedQuantity,
     Uom              = inboundShipment.BaseUom,
     VendorItemNumber = inboundShipment.VendorItemNumber,
     VendorName       = inboundShipment.VendorName,
     LotNumber        = lotNumber,
     RcpLineNumber    = inboundShipment.LineNum,
     PoNumber         = inboundShipment.DocumentNumber,
     BatchId          = CreateBatchId(),
     IsLotControlled  = inboundShipment.IsLotControlled,
     ItemDescription  = inboundShipment.ItemDescription,
     Date             = DateTime.UtcNow,
     UserName         = AuthService.CurrentUser.Name
 };
Пример #5
0
 /// <summary>
 ///     Get whether or not the lot entry input should be presented to the user.
 /// </summary>
 /// <param name="inboundShipment">The inbound shipment.</param>
 /// <returns>Whether or not to present the lot number input.</returns>
 public bool ShouldPresentLotNumberInput(InboundShipment inboundShipment)
 => inboundShipment?.IsLotControlled == true;
Пример #6
0
 /// <summary>
 ///     This method is used to filter inbound shipments by remaining quantities. It prevents
 ///     inbound shipments with quantities less than or equal to 0 from being displayed in the RecyclerView.
 /// </summary>
 /// <param name="inboundShipment">The InboundShipment instance to check.</param>
 /// <returns>
 ///     If the InboundShipment has remaining quantities, then the same InboundShipment instance. Else, null.
 /// </returns>
 private async Task <InboundShipment> FilterOnQuantityRemaining(
     InboundShipment inboundShipment
     ) => await _inboundShipmentRepository.GetRemainingShipmentQuantity(inboundShipment).ConfigureAwait(false) > 0
     ? inboundShipment
     : null;