kelvin.yau 3 дней назад
Родитель
Сommit
5be61f895d
1 измененных файлов: 5 добавлений и 2 удалений
  1. +5
    -2
      src/main/java/com/ffii/fpsms/modules/stock/service/StockAdjustmentService.kt

+ 5
- 2
src/main/java/com/ffii/fpsms/modules/stock/service/StockAdjustmentService.kt Просмотреть файл

@@ -66,11 +66,14 @@ open class StockAdjustmentService(
if (diff.compareTo(BigDecimal.ZERO) == 0) continue // Branch 1: no change if (diff.compareTo(BigDecimal.ZERO) == 0) continue // Branch 1: no change


if (diff.compareTo(BigDecimal.ZERO) > 0) { if (diff.compareTo(BigDecimal.ZERO) > 0) {
// Branch 2 (qty up): createStockIn
// Branch 2 (qty up): increase inQty on the same lot line; new StockIn/StockInLine for audit only
val inventoryLotLine = inventoryLotLineRepository.findById(current.id) val inventoryLotLine = inventoryLotLineRepository.findById(current.id)
.orElseThrow { IllegalArgumentException("InventoryLotLine not found: ${current.id}") } .orElseThrow { IllegalArgumentException("InventoryLotLine not found: ${current.id}") }
val stockInRequest = buildStockInRequestFromExistingLotLine(inventoryLotLine, diff) val stockInRequest = buildStockInRequestFromExistingLotLine(inventoryLotLine, diff)
val stockInLine = stockInLineService.createStockIn(stockInRequest)
val stockInLine = stockInLineService.createStockInForExistingInventoryLotLine(
stockInRequest,
inventoryLotLine
)
saveAdjustmentRecordForStockIn(stockInLine) saveAdjustmentRecordForStockIn(stockInLine)
} else { } else {
// Branch 3 (qty down): adjustment outbound only (not pick createStockOut) // Branch 3 (qty down): adjustment outbound only (not pick createStockOut)


Загрузка…
Отмена
Сохранить