There are two parts to the inventory transfer calculation:
It calculates a list of parts that need a transfer and then it calculates which of those parts should go into the next transfer.
Needed Transfer Calculation
Calculating MinimumQty
First it calculates the MinimumQty of the part for the inbound warehouse. If the PartWhse.MinimumQty is greater than 0 that will be used. If not, the PartPlant.MinimumQty will be multiplied by the TransferMinMaxSafetyPrcOfPlant and that will be used.
Calculating the AvailableQty
The AvailableQty is calculated by subtracting the PartWhse.DemandQty from the PartWhse.OnHandQty.
Calculating the DesiredQty
The DesiredQty is calculated by subtracting the AvailableQty from the MinimumQty.
Calculating the QuantityPerPallet
The QuantityPerPallet is equal to the Part.PartsPerContainer
Calculating the TransferQty
The TransferQty is calculated by picking the multiple of the QuantityPerPallet that is closest to the DesiredQty without going over the Outbound warehouse's PartWhse.OnHandQty
Calculating the PalletTransferQty
The PalletTransferQty is calculated by dividing the TransferQty by the QuantityPerPallet
Calculating the PossibleTransferList
The above calculations are repeated for each configured part. Creating a list of parts that could to be transferred and their Transfer quantities.
Current Transfer Calculation
The current transfer calculation aims to fit as many of the Transfers from the PossibleTransferList into the Pallets Per Transfer.
It does this by sorting the PossibleTransferList from the highest to lowest PalletTransferQty and adding each part to the current transfer if Part's PalletTransferQty plus the running Total Pallet Qty in the transfer do not exceed the Pallets Per Transfer.