|
|
|
@@ -29,6 +29,8 @@ class GoodsReceiptStatusService( |
|
|
|
|
|
|
|
val purchaseOrders = purchaseOrderRepository.findAllByEstimatedArrivalDateRange(from, to) |
|
|
|
val stockInLines = stockInLineRepository.findByReceiptDateAndDeletedFalse(date) |
|
|
|
val todaysPoIds = purchaseOrders.mapNotNull { it.id }.toSet() |
|
|
|
val extraPoIdsCounted = mutableSetOf<Long>() |
|
|
|
|
|
|
|
val stockInLineIds = stockInLines.mapNotNull { it.id } |
|
|
|
val inspectedLineIdSet = if (stockInLineIds.isEmpty()) { |
|
|
|
@@ -71,6 +73,12 @@ class GoodsReceiptStatusService( |
|
|
|
|
|
|
|
val silId = sil.id ?: return@forEach |
|
|
|
|
|
|
|
val po = sil.purchaseOrder |
|
|
|
val poIdForExpected = po?.id |
|
|
|
if (poIdForExpected != null && !todaysPoIds.contains(poIdForExpected) && extraPoIdsCounted.add(poIdForExpected)) { |
|
|
|
agg.expectedNoOfDelivery += 1 |
|
|
|
} |
|
|
|
|
|
|
|
// Orders received at dock: count orders with DN + (supplier) lot no entered |
|
|
|
val poId = sil.purchaseOrder?.id |
|
|
|
if (poId != null && !sil.dnNo.isNullOrBlank() && !sil.productLotNo.isNullOrBlank()) { |
|
|
|
|