瀏覽代碼

update

master
cyril.tsui 3 週之前
父節點
當前提交
7db0bf0b43
共有 1 個檔案被更改,包括 8 行新增1 行删除
  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 查看文件

@@ -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


Loading…
取消
儲存