| @@ -68,7 +68,7 @@ open class StockInLineService( | |||||
| private val inventoryLotLineRepository: InventoryLotLineRepository, | private val inventoryLotLineRepository: InventoryLotLineRepository, | ||||
| private val itemRepository: ItemsRepository, | private val itemRepository: ItemsRepository, | ||||
| private val warehouseRepository: WarehouseRepository, | private val warehouseRepository: WarehouseRepository, | ||||
| private val itemUomRespository: ItemUomRespository, | |||||
| private val itemUomRepository: ItemUomRespository, | |||||
| private val printerService: PrinterService, | private val printerService: PrinterService, | ||||
| private val stockTakeLineRepository: StockTakeLineRepository, | private val stockTakeLineRepository: StockTakeLineRepository, | ||||
| ): AbstractBaseEntityService<StockInLine, Long, StockInLineRepository>(jdbcDao, stockInLineRepository) { | ): AbstractBaseEntityService<StockInLine, Long, StockInLineRepository>(jdbcDao, stockInLineRepository) { | ||||
| @@ -199,10 +199,10 @@ open class StockInLineService( | |||||
| lines.forEach { line -> | lines.forEach { line -> | ||||
| val inventoryLotLine = InventoryLotLine() | val inventoryLotLine = InventoryLotLine() | ||||
| val warehouse = warehouseRepository.findById(line.warehouseId!!).orElseThrow() | val warehouse = warehouseRepository.findById(line.warehouseId!!).orElseThrow() | ||||
| val stockItemUom = itemUomRespository.findBaseUnitByItemIdAndStockUnitIsTrueAndDeletedIsFalse( | |||||
| val stockItemUom = itemUomRepository.findBaseUnitByItemIdAndStockUnitIsTrueAndDeletedIsFalse( | |||||
| itemId = request.itemId | itemId = request.itemId | ||||
| ) | ) | ||||
| val purchaseItemUom = itemUomRespository.findByItemIdAndPurchaseUnitIsTrueAndDeletedIsFalse(request.itemId) | |||||
| val purchaseItemUom = itemUomRepository.findByItemIdAndPurchaseUnitIsTrueAndDeletedIsFalse(request.itemId) | |||||
| val convertedBaseQty = if (request.stockTakeLineId == null && stockItemUom != null && purchaseItemUom != null) { | val convertedBaseQty = if (request.stockTakeLineId == null && stockItemUom != null && purchaseItemUom != null) { | ||||
| (line.qty) * (purchaseItemUom.ratioN!! / purchaseItemUom.ratioD!!) / (stockItemUom.ratioN!! / stockItemUom.ratioD!!) | (line.qty) * (purchaseItemUom.ratioN!! / purchaseItemUom.ratioD!!) / (stockItemUom.ratioN!! / stockItemUom.ratioD!!) | ||||
| } else { | } else { | ||||
| @@ -223,7 +223,7 @@ open class StockInLineService( | |||||
| return response ?: emptyList(); | return response ?: emptyList(); | ||||
| // val inventoryLotLine = InventoryLotLine() | // val inventoryLotLine = InventoryLotLine() | ||||
| // val warehouse = warehouseRepository.findById(request.warehouseId!!).orElseThrow() | // val warehouse = warehouseRepository.findById(request.warehouseId!!).orElseThrow() | ||||
| // val stockItemUom = itemUomRespository.findBaseUnitByItemIdAndStockUnitIsTrueAndDeletedIsFalse( | |||||
| // val stockItemUom = itemUomRepository.findBaseUnitByItemIdAndStockUnitIsTrueAndDeletedIsFalse( | |||||
| // itemId = request.itemId | // itemId = request.itemId | ||||
| // ) | // ) | ||||
| // val convertedBaseQty = if (stockItemUom != null) { | // val convertedBaseQty = if (stockItemUom != null) { | ||||
| @@ -401,8 +401,8 @@ open class StockInLineService( | |||||
| val savedInventoryLotLines = saveInventoryLotLineWhenStockIn(request = request, stockInLine = stockInLine) | val savedInventoryLotLines = saveInventoryLotLineWhenStockIn(request = request, stockInLine = stockInLine) | ||||
| val inventoryLotLines = stockInLine.inventoryLot?.let { it.id?.let { _id -> inventoryLotLineRepository.findAllByInventoryLotId(_id) } } ?: listOf() | val inventoryLotLines = stockInLine.inventoryLot?.let { it.id?.let { _id -> inventoryLotLineRepository.findAllByInventoryLotId(_id) } } ?: listOf() | ||||
| val purchaseItemUom = itemUomRespository.findByItemIdAndPurchaseUnitIsTrueAndDeletedIsFalse(request.itemId) | |||||
| val stockItemUom = itemUomRespository.findByItemIdAndStockUnitIsTrueAndDeletedIsFalse(request.itemId) | |||||
| val purchaseItemUom = itemUomRepository.findByItemIdAndPurchaseUnitIsTrueAndDeletedIsFalse(request.itemId) | |||||
| val stockItemUom = itemUomRepository.findByItemIdAndStockUnitIsTrueAndDeletedIsFalse(request.itemId) | |||||
| val ratio = if (request.stockTakeLineId == null && stockItemUom != null && purchaseItemUom != null) { | val ratio = if (request.stockTakeLineId == null && stockItemUom != null && purchaseItemUom != null) { | ||||
| (purchaseItemUom.ratioN!! / purchaseItemUom.ratioD!!) / (stockItemUom.ratioN!! / stockItemUom.ratioD!!) | (purchaseItemUom.ratioN!! / purchaseItemUom.ratioD!!) / (stockItemUom.ratioN!! / stockItemUom.ratioD!!) | ||||
| } else { | } else { | ||||