internal static ICreateInventoryItemEntry[] CompleteMovementCreateInventoryItemEntryPair(IMovementState movement, IMovementLineState movementLine, Func <long> nextEntrySeqId) { ICreateInventoryItemEntry[] trxPair = new ICreateInventoryItemEntry[2]; var quantity = movementLine.MovementQuantity; /////////////////////// From: //////////////////////////// int signum = -1; trxPair[0] = CreateInventoryItemEntry(movement, movementLine, movementLine.LocatorIdFrom, quantity * signum, 0, nextEntrySeqId); /////////////////////// To: //////////////////////////// signum = 1; if (!movement.IsInTransit) { trxPair[1] = CreateInventoryItemEntry(movement, movementLine, movementLine.LocatorIdTo, quantity * signum, 1, nextEntrySeqId); } else { var locId = WarehouseUtils.GetInTransitLocatorId(movement.WarehouseIdFrom); trxPair[1] = CreateInventoryItemEntry(movement, movementLine, locId, quantity * signum, 1, nextEntrySeqId, true); } return(trxPair); }
internal static ICreateInventoryItemEntry[] ConfirmMovementCreateInventoryItemEntryPair(IMovementState movement, IMovementLineState movementLine, decimal confirmedQty, Func <long> nextEntrySeqId) { if (!movement.IsInTransit) { throw new ArgumentException("Movement is NOT In-Transit."); } ICreateInventoryItemEntry[] trxPair = new ICreateInventoryItemEntry[2]; /////////////////////// From: //////////////////////////// int signum = -1; var locIdFrom = WarehouseUtils.GetInTransitLocatorId(movement.WarehouseIdFrom); trxPair[0] = CreateInventoryItemEntry(movement, movementLine, locIdFrom, confirmedQty * signum, 2, nextEntrySeqId, true); /////////////////////// To: //////////////////////////// signum = 1; trxPair[1] = CreateInventoryItemEntry(movement, movementLine, movementLine.LocatorIdTo, confirmedQty * signum, 3, nextEntrySeqId); return(trxPair); }