Bläddra i källkod

update putaway

master
CANCERYS\kw093 3 dagar sedan
förälder
incheckning
8d29727a2b
2 ändrade filer med 34 tillägg och 10 borttagningar
  1. +6
    -2
      src/main/java/com/ffii/fpsms/modules/jobOrder/service/JobOrderService.kt
  2. +28
    -8
      src/main/java/com/ffii/fpsms/modules/stock/service/StockInLineService.kt

+ 6
- 2
src/main/java/com/ffii/fpsms/modules/jobOrder/service/JobOrderService.kt Visa fil

@@ -419,8 +419,12 @@ open class JobOrderService(
}
jobOrderRepository.save(jo)
val pols = jo.jobms.filter { it.item?.type != "CMB"&& it.item?.type != "consumables" && it.item?.type != "NM"}.
map {
val pols = jo.jobms.filter {
it.item?.type != "CMB" &&
it.item?.type != "consumables" &&
it.item?.type != "NM" &&
it.item?.isFee != true // 添加:跳过 isFee 为 true 的物料
}.map {
SavePickOrderLineRequest(
itemId = it.item?.id,
qty = it.reqQty ?: BigDecimal.ZERO,


+ 28
- 8
src/main/java/com/ffii/fpsms/modules/stock/service/StockInLineService.kt Visa fil

@@ -226,7 +226,6 @@ open class StockInLineService(
val response = request.inventoryLotLines?.let { lines ->
val saveLines = mutableListOf<InventoryLotLine>();
lines.forEach { line ->
val inventoryLotLine = InventoryLotLine()
val warehouse = warehouseRepository.findById(line.warehouseId!!).orElseThrow()
val stockItemUom = itemUomRepository.findBaseUnitByItemIdAndStockUnitIsTrueAndDeletedIsFalse(
itemId = request.itemId
@@ -237,17 +236,38 @@ open class StockInLineService(
} else {
(line.qty)
}
inventoryLotLine.apply {
this.inventoryLot = stockInLine.inventoryLot
this.warehouse = warehouse
this.inQty = convertedBaseQty
this.status = InventoryLotLineStatus.AVAILABLE
this.stockUom = stockItemUom
// ✅ Find existing inventory lot line for same warehouse and inventory lot
val existingLotLine = stockInLine.inventoryLot?.id?.let { inventoryLotId ->
inventoryLotLineRepository.findByInventoryLotStockInLineIdAndWarehouseId(
inventoryLotStockInLineId = stockInLine.id!!,
warehouseId = warehouse.id!!
)
}
if (existingLotLine != null) {
// ✅ Update existing inventory lot line (add to existing qty)
existingLotLine.apply {
this.inQty = (this.inQty ?: BigDecimal.ZERO) + convertedBaseQty
this.status = InventoryLotLineStatus.AVAILABLE
}
saveLines.add(existingLotLine)
} else {
// ✅ Create new inventory lot line (first put away for this warehouse)
val inventoryLotLine = InventoryLotLine()
inventoryLotLine.apply {
this.inventoryLot = stockInLine.inventoryLot
this.warehouse = warehouse
this.inQty = convertedBaseQty
this.status = InventoryLotLineStatus.AVAILABLE
this.stockUom = stockItemUom
}
saveLines.add(inventoryLotLine)
}
saveLines.add(inventoryLotLine)
}
inventoryLotLineRepository.saveAll(saveLines)
}

return response ?: emptyList();
// val inventoryLotLine = InventoryLotLine()


Laddar…
Avbryt
Spara