|
|
@@ -243,13 +243,15 @@ open class InventoryService( |
|
|
|
) |
|
|
|
requestList.add(request) |
|
|
|
val item = itemsRepository.findByCodeAndDeletedFalse(request.itemCode) |
|
|
|
|
|
|
|
val salesUnit = itemUomService.findSalesUnitByItemId(itemId = item!!.id!!)!!.uom |
|
|
|
val stockUnit = itemUomService.findStockUnitByItemId(itemId = item.id!!)!!.uom |
|
|
|
// purchase order line |
|
|
|
val purchaseOrderLine = PurchaseOrderLine() |
|
|
|
.apply { |
|
|
|
this.item = item |
|
|
|
this.itemNo = item.code |
|
|
|
this.uom = salesUnit |
|
|
|
this.uom = stockUnit |
|
|
|
this.purchaseOrder = po |
|
|
|
this.price = BigDecimal.ZERO |
|
|
|
this.status = PurchaseOrderLineStatus.COMPLETED |
|
|
@@ -301,13 +303,19 @@ open class InventoryService( |
|
|
|
val inventoryLotLineEntries = requestList.mapIndexed { index, request -> |
|
|
|
val inventoryLot = savedInventoryLotEntries[index] |
|
|
|
val warehouse = warehouseRepository.findAll().find { it.code == request.warehouseCode }!! |
|
|
|
val salesUnit = itemUomService.findSalesUnitByItemId(itemId = inventoryLot.item!!.id!!) |
|
|
|
// val salesUnit = itemUomService.findSalesUnitByItemId(itemId = inventoryLot.item!!.id!!) |
|
|
|
val stockUnit = itemUomService.findStockUnitByItemId(itemId = inventoryLot.item!!.id!!) |
|
|
|
// val zero = BigDecimal.ZERO |
|
|
|
// val one = BigDecimal.ONE |
|
|
|
// val ratio = (salesUnit?.ratioN ?: zero).divide(salesUnit?.ratioD ?: one) |
|
|
|
|
|
|
|
InventoryLotLine().apply { |
|
|
|
this.inventoryLot = inventoryLot |
|
|
|
this.warehouse = warehouse |
|
|
|
this.inQty = request.qty |
|
|
|
this.status = InventoryLotLineStatus.AVAILABLE |
|
|
|
this.stockUom = salesUnit |
|
|
|
this.stockUom = stockUnit |
|
|
|
// this.stockUom = salesUnit |
|
|
|
} |
|
|
|
} |
|
|
|
val savedInventoryLotLine = inventoryLotLineRepository.saveAllAndFlush(inventoryLotLineEntries) |
|
|
|