|
@@ -137,13 +137,13 @@ open class PickOrderService( |
|
|
val uom = pol.uom |
|
|
val uom = pol.uom |
|
|
|
|
|
|
|
|
// Check If already have suggestion |
|
|
// Check If already have suggestion |
|
|
val suggestion = pol.suggestedPickLots |
|
|
|
|
|
// if (suggestion.isEmpty()) { |
|
|
|
|
|
// suggestion = suggestedList.filter { it.pickOrderLine?.id == pol.id }.toMutableList() |
|
|
|
|
|
|
|
|
val suggestedPickLots = pol.suggestedPickLots |
|
|
|
|
|
// if (suggestedPickLots.isEmpty()) { |
|
|
|
|
|
// suggestedPickLots = suggestedList.filter { it.pickOrderLine?.id == pol.id }.toMutableList() |
|
|
// } |
|
|
// } |
|
|
|
|
|
|
|
|
// Mapping: SuggestedPickLot -> SuggestPickLotInConso |
|
|
// Mapping: SuggestedPickLot -> SuggestPickLotInConso |
|
|
val finalSuggestion = suggestion.map { |
|
|
|
|
|
|
|
|
val finalSuggestedPickLots = suggestedPickLots.map { |
|
|
val inventoryLotLine = it.suggestedLotLine |
|
|
val inventoryLotLine = it.suggestedLotLine |
|
|
val remainingQty = (inventoryLotLine?.inQty ?: zero) |
|
|
val remainingQty = (inventoryLotLine?.inQty ?: zero) |
|
|
.minus(inventoryLotLine?.outQty ?: zero) |
|
|
.minus(inventoryLotLine?.outQty ?: zero) |
|
@@ -164,7 +164,7 @@ open class PickOrderService( |
|
|
) |
|
|
) |
|
|
|
|
|
|
|
|
// Return |
|
|
// Return |
|
|
SuggestPickLotInConso( |
|
|
|
|
|
|
|
|
SuggestedPickLotInConso( |
|
|
id = it.id, |
|
|
id = it.id, |
|
|
type = it.type?.value, |
|
|
type = it.type?.value, |
|
|
qty = it.qty, |
|
|
qty = it.qty, |
|
@@ -173,13 +173,17 @@ open class PickOrderService( |
|
|
) |
|
|
) |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Actual Pick Lots |
|
|
|
|
|
// val actualPickLots = pol.stockOutLines |
|
|
|
|
|
// val finalActu |
|
|
|
|
|
|
|
|
// Return |
|
|
// Return |
|
|
PickOrderLineInConso( |
|
|
PickOrderLineInConso( |
|
|
id = pol.id, |
|
|
id = pol.id, |
|
|
item = IdCodeName(item?.id, item?.code, item?.name), |
|
|
item = IdCodeName(item?.id, item?.code, item?.name), |
|
|
qty = pol.qty, |
|
|
qty = pol.qty, |
|
|
uom = IdCodeDesc(uom?.id, uom?.code, uom?.udfudesc), |
|
|
uom = IdCodeDesc(uom?.id, uom?.code, uom?.udfudesc), |
|
|
suggestPickLots = finalSuggestion, |
|
|
|
|
|
|
|
|
suggestedPickLots = finalSuggestedPickLots, |
|
|
status = pol.status?.value, |
|
|
status = pol.status?.value, |
|
|
actualPickLots = mutableListOf() |
|
|
actualPickLots = mutableListOf() |
|
|
) |
|
|
) |
|
@@ -209,10 +213,10 @@ open class PickOrderService( |
|
|
.groupBy { it.item.id } |
|
|
.groupBy { it.item.id } |
|
|
.map { (_itemId, _line) -> |
|
|
.map { (_itemId, _line) -> |
|
|
val itemSuggestions = _line |
|
|
val itemSuggestions = _line |
|
|
.flatMap { it.suggestPickLots } |
|
|
|
|
|
|
|
|
.flatMap { it.suggestedPickLots } |
|
|
.groupBy { it.inventoryLotLine.id to it.pickSuggested } |
|
|
.groupBy { it.inventoryLotLine.id to it.pickSuggested } |
|
|
.map { (_key, _lot) -> |
|
|
.map { (_key, _lot) -> |
|
|
SuggestPickLotInConso( |
|
|
|
|
|
|
|
|
SuggestedPickLotInConso( |
|
|
id = _key.first, |
|
|
id = _key.first, |
|
|
type = _lot.first().type, |
|
|
type = _lot.first().type, |
|
|
inventoryLotLine = _lot.first().inventoryLotLine, |
|
|
inventoryLotLine = _lot.first().inventoryLotLine, |
|
|