|
|
@@ -84,20 +84,26 @@ open class SuggestedPickLotService( |
|
|
|
pols.forEach { line -> |
|
|
|
val salesUnit = line.item?.id?.let { itemUomService.findSalesUnitByItemId(it) } |
|
|
|
val lotLines = availableInventoryLotLines[line.item?.id].orEmpty() |
|
|
|
var remainingQty = (line.qty ?: zero).multiply((salesUnit?.ratioN ?: zero).divide(salesUnit?.ratioD ?: one)) |
|
|
|
val ratio = (salesUnit?.ratioN ?: zero).divide(salesUnit?.ratioD ?: one) |
|
|
|
var remainingQty = (line.qty ?: zero).multiply(ratio) |
|
|
|
println("remaining1 $remainingQty") |
|
|
|
val updatedLotLines = mutableListOf<InventoryLotLineInfo>() |
|
|
|
|
|
|
|
lotLines.forEachIndexed { index, lotLine -> |
|
|
|
if (remainingQty <= zero) return@forEachIndexed |
|
|
|
|
|
|
|
println("calculateRemainingQtyForInfo(lotLine) ${calculateRemainingQtyForInfo(lotLine)}") |
|
|
|
val availableQty = calculateRemainingQtyForInfo(lotLine) |
|
|
|
.multiply(ratio) |
|
|
|
.minus(holdQtyMap[lotLine.id] ?: zero) |
|
|
|
println("holdQtyMap[lotLine.id] ?: zero ${holdQtyMap[lotLine.id] ?: zero}") |
|
|
|
|
|
|
|
|
|
|
|
if (availableQty <= zero) { |
|
|
|
updatedLotLines += lotLine |
|
|
|
return@forEachIndexed |
|
|
|
} |
|
|
|
println("$index : ${lotLine.id}") |
|
|
|
val inventoryLotLine = lotLine.id?.let { inventoryLotLineService.findById(it).getOrNull() } |
|
|
|
val originalHoldQty = inventoryLotLine?.holdQty |
|
|
|
|
|
|
@@ -115,6 +121,7 @@ open class SuggestedPickLotService( |
|
|
|
} |
|
|
|
|
|
|
|
// if still have remainingQty |
|
|
|
println("remaining2 $remainingQty") |
|
|
|
if (remainingQty > zero) { |
|
|
|
suggestedList += SuggestedPickLot().apply { |
|
|
|
type = SuggestedPickLotType.PICK_ORDER |
|
|
|