Browse Source

update

master
cyril.tsui 3 weeks ago
parent
commit
7db0bf0b43
1 changed files with 8 additions and 1 deletions
  1. +8
    -1
      src/main/java/com/ffii/fpsms/modules/stock/service/SuggestedPickLotService.kt

+ 8
- 1
src/main/java/com/ffii/fpsms/modules/stock/service/SuggestedPickLotService.kt View File

@@ -84,20 +84,26 @@ open class SuggestedPickLotService(
pols.forEach { line -> pols.forEach { line ->
val salesUnit = line.item?.id?.let { itemUomService.findSalesUnitByItemId(it) } val salesUnit = line.item?.id?.let { itemUomService.findSalesUnitByItemId(it) }
val lotLines = availableInventoryLotLines[line.item?.id].orEmpty() 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>() val updatedLotLines = mutableListOf<InventoryLotLineInfo>()


lotLines.forEachIndexed { index, lotLine -> lotLines.forEachIndexed { index, lotLine ->
if (remainingQty <= zero) return@forEachIndexed if (remainingQty <= zero) return@forEachIndexed


println("calculateRemainingQtyForInfo(lotLine) ${calculateRemainingQtyForInfo(lotLine)}")
val availableQty = calculateRemainingQtyForInfo(lotLine) val availableQty = calculateRemainingQtyForInfo(lotLine)
.multiply(ratio)
.minus(holdQtyMap[lotLine.id] ?: zero) .minus(holdQtyMap[lotLine.id] ?: zero)
println("holdQtyMap[lotLine.id] ?: zero ${holdQtyMap[lotLine.id] ?: zero}")




if (availableQty <= zero) { if (availableQty <= zero) {
updatedLotLines += lotLine updatedLotLines += lotLine
return@forEachIndexed return@forEachIndexed
} }
println("$index : ${lotLine.id}")
val inventoryLotLine = lotLine.id?.let { inventoryLotLineService.findById(it).getOrNull() } val inventoryLotLine = lotLine.id?.let { inventoryLotLineService.findById(it).getOrNull() }
val originalHoldQty = inventoryLotLine?.holdQty val originalHoldQty = inventoryLotLine?.holdQty


@@ -115,6 +121,7 @@ open class SuggestedPickLotService(
} }


// if still have remainingQty // if still have remainingQty
println("remaining2 $remainingQty")
if (remainingQty > zero) { if (remainingQty > zero) {
suggestedList += SuggestedPickLot().apply { suggestedList += SuggestedPickLot().apply {
type = SuggestedPickLotType.PICK_ORDER type = SuggestedPickLotType.PICK_ORDER


Loading…
Cancel
Save