|
|
|
@@ -475,6 +475,7 @@ open class DoWorkbenchMainService( |
|
|
|
val solSnapshot = infos.joinToString("; ") { info -> |
|
|
|
"sol${info.id} st=${info.status} qty=${info.qty} picked=${WorkbenchStockOutLinePickProgress.isCountedAsPicked(info)}" |
|
|
|
} |
|
|
|
/* |
|
|
|
log.info( |
|
|
|
"WORKBENCH_SCAN_TRACE polId={} solId={} scanLotNo={} scanIllId={} polRequired={} [{}] endedSumOthers={} currentSolQty={} remainingPol={} splMatchQty={} chunkTarget={} stillNeedOnThisSol={} requestedCap={} availScanLot={} plannedDelta={} lotSplit={}", |
|
|
|
polId, |
|
|
|
@@ -494,7 +495,7 @@ log.info( |
|
|
|
plannedDelta, |
|
|
|
isLotExhaustedSplit, // initial trace only |
|
|
|
) |
|
|
|
|
|
|
|
*/ |
|
|
|
val prepMs = lapMs() |
|
|
|
|
|
|
|
// retry-related state |
|
|
|
@@ -533,26 +534,16 @@ while (attempt <= maxRetries) { |
|
|
|
"SELECT id, inQty, outQty, status, version FROM inventory_lot_line WHERE id = ?", |
|
|
|
illId |
|
|
|
) |
|
|
|
log.info( |
|
|
|
"WB_SQL_TRACE phase=before traceId={} connId={} illId={} inQty={} outQty={} status={} ver={} delta={} expVer={} retryAttempt={}", |
|
|
|
traceId, connIdBefore, illId, |
|
|
|
beforeRow["inQty"], beforeRow["outQty"], beforeRow["status"], beforeRow["version"], |
|
|
|
effectiveDelta, expectedVersion, attempt |
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
updated = inventoryLotLineRepository.incrementOutQtyIfAvailable(illId, effectiveDelta, expectedVersion) |
|
|
|
println("updated: $updated") |
|
|
|
// println("updated: $updated") |
|
|
|
|
|
|
|
val connIdAfter = jdbcTemplate.queryForObject("SELECT CONNECTION_ID()", Long::class.java) |
|
|
|
val afterRow = jdbcTemplate.queryForMap( |
|
|
|
"SELECT id, inQty, outQty, status, version FROM inventory_lot_line WHERE id = ?", |
|
|
|
illId |
|
|
|
) |
|
|
|
log.info( |
|
|
|
"WB_SQL_TRACE phase=after traceId={} connId={} illId={} updated={} inQty={} outQty={} status={} ver={} retryAttempt={}", |
|
|
|
traceId, connIdAfter, illId, updated, |
|
|
|
afterRow["inQty"], afterRow["outQty"], afterRow["status"], afterRow["version"], attempt |
|
|
|
) |
|
|
|
|
|
|
|
if (updated > 0) break |
|
|
|
|
|
|
|
@@ -695,6 +686,7 @@ val mapped = stockOutLIneRepository.findStockOutLineInfoById(sol.id!!) |
|
|
|
val mapFetchMs = (System.nanoTime() - mapFetchT0) / 1_000_000 |
|
|
|
|
|
|
|
val totalMs = (System.nanoTime() - wall0) / 1_000_000 |
|
|
|
/* |
|
|
|
log.info( |
|
|
|
"workbench scanPick timing (ms): total={} prep={} outbound={} saveSol={} rebuildSpl={} ensureSol={} polPartial={} postEffects={} mapFetch={} lotSplit={} solId={} polId={} poId={}", |
|
|
|
totalMs, |
|
|
|
@@ -711,7 +703,7 @@ log.info( |
|
|
|
polId, |
|
|
|
pickOrderId ?: 0L, |
|
|
|
) |
|
|
|
|
|
|
|
*/ |
|
|
|
return MessageResponse( |
|
|
|
id = sol.id, |
|
|
|
name = scannedIll.inventoryLot?.lotNo ?: lotNo, |
|
|
|
@@ -1699,8 +1691,8 @@ return MessageResponse( |
|
|
|
"pickOrders" to emptyList<Any>(), |
|
|
|
) |
|
|
|
} |
|
|
|
println(" Found delivery_order_pick_order ID: $doPickOrderId") |
|
|
|
println(" delivery_order_pick_order ticketStatus: $doTicketStatus") |
|
|
|
//println(" Found delivery_order_pick_order ID: $doPickOrderId") |
|
|
|
//println(" delivery_order_pick_order ticketStatus: $doTicketStatus") |
|
|
|
|
|
|
|
if (doTicketStatus == "completed") { |
|
|
|
return mapOf( |
|
|
|
@@ -1736,7 +1728,7 @@ return MessageResponse( |
|
|
|
) |
|
|
|
} |
|
|
|
mark("query.pickOrdersMs", pickOrdersQueryMs) |
|
|
|
println(" Found ${pickOrdersInfo.size} pick orders (workbench)") |
|
|
|
// println(" Found ${pickOrdersInfo.size} pick orders (workbench)") |
|
|
|
|
|
|
|
var payload: Map<String, Any?> = emptyMap() |
|
|
|
val assembleMs = measureTimeMillis { |
|
|
|
@@ -1889,7 +1881,7 @@ return MessageResponse( |
|
|
|
return emptyList() |
|
|
|
} |
|
|
|
|
|
|
|
println(" Found ${results.size} active FG workbench pick orders for user: $userId") |
|
|
|
// println(" Found ${results.size} active FG workbench pick orders for user: $userId") |
|
|
|
|
|
|
|
return results.map { row -> |
|
|
|
val pickOrderIdsStr = row["pickOrderIds"] as? String ?: "" |
|
|
|
|