CANCERYS\kw093 пре 12 часа
родитељ
комит
9facf94d5b
1 измењених фајлова са 12 додато и 10 уклоњено
  1. +12
    -10
      src/main/java/com/ffii/fpsms/modules/deliveryOrder/service/DeliveryOrderService.kt

+ 12
- 10
src/main/java/com/ffii/fpsms/modules/deliveryOrder/service/DeliveryOrderService.kt Прегледај датотеку

@@ -1505,6 +1505,14 @@ open class DeliveryOrderService(
pickOrderEntity.consoCode = consoCode pickOrderEntity.consoCode = consoCode
pickOrderEntity.status = com.ffii.fpsms.modules.pickOrder.enums.PickOrderStatus.RELEASED pickOrderEntity.status = com.ffii.fpsms.modules.pickOrder.enums.PickOrderStatus.RELEASED
pickOrderRepository.saveAndFlush(pickOrderEntity) pickOrderRepository.saveAndFlush(pickOrderEntity)
// 创建 stock out
val stockOut = StockOut().apply {
this.type = "do"
this.consoPickOrderCode = consoCode
this.status = StockOutStatus.PENDING.status
this.handler = request.userId
}
val savedStockOut = stockOutRepository.saveAndFlush(stockOut)


// 创建 suggestions 和 hold inventory // 创建 suggestions 和 hold inventory
val lines = pickOrderLineRepository.findAllByPickOrderId(pickOrderEntity.id!!) val lines = pickOrderLineRepository.findAllByPickOrderId(pickOrderEntity.id!!)
@@ -1514,7 +1522,7 @@ open class DeliveryOrderService(
val saveSuggestedPickLots = suggestedPickLotService.saveAll(suggestions.suggestedList) val saveSuggestedPickLots = suggestedPickLotService.saveAll(suggestions.suggestedList)
val insufficientCount = suggestions.suggestedList.count { it.suggestedLotLine == null } val insufficientCount = suggestions.suggestedList.count { it.suggestedLotLine == null }
if (insufficientCount > 0) { if (insufficientCount > 0) {
println("⚠️ WARNING: $insufficientCount items have insufficient stock (issues auto-created)")
println(" WARNING: $insufficientCount items have insufficient stock (issues auto-created)")
} }
val inventoryLotLines = inventoryLotLineRepository.findAllByIdIn( val inventoryLotLines = inventoryLotLineRepository.findAllByIdIn(
saveSuggestedPickLots.mapNotNull { it.suggestedLotLine?.id } saveSuggestedPickLots.mapNotNull { it.suggestedLotLine?.id }
@@ -1531,16 +1539,10 @@ open class DeliveryOrderService(
} }
inventoryLotLineRepository.saveAll(inventoryLotLines) inventoryLotLineRepository.saveAll(inventoryLotLines)


// 创建 stock out
val stockOut = StockOut().apply {
this.type = "do"
this.consoPickOrderCode = consoCode
this.status = StockOutStatus.PENDING.status
this.handler = request.userId
}
val savedStockOut = stockOutRepository.saveAndFlush(stockOut)

// No-lot (insufficient stock) lines are created in suggestedPickLotService.saveAll → createStockOutLineForSuggestion; skip here to avoid duplicates.
saveSuggestedPickLots.forEach { lot -> saveSuggestedPickLots.forEach { lot ->
if (lot.suggestedLotLine == null) return@forEach
val polId = lot.pickOrderLine?.id val polId = lot.pickOrderLine?.id
val illId = lot.suggestedLotLine?.id val illId = lot.suggestedLotLine?.id
if (polId != null) { if (polId != null) {


Loading…
Откажи
Сачувај