Solved bug in production mail report #1190

Merged
jothi merged 1 commits from ranjith-dev into master 2026-10-07 02:59:30 +00:00

View File

@@ -258,13 +258,17 @@ class SendProductionReport extends Command
$productionQuantity = \App\Models\QualityValidation::where('plant_id', $plant->id) $productionQuantity = \App\Models\QualityValidation::where('plant_id', $plant->id)
->where('line_id', $line->id) ->where('line_id', $line->id)
->whereIn('item_id', $itemIds) ->whereHas('stickerMaster', function ($query) use ($itemIds) {
$query->whereIn('item_id', $itemIds);
})
->whereBetween('created_at', [$startDate, $endDate]) ->whereBetween('created_at', [$startDate, $endDate])
->count(); ->count();
$nonPlannedproductionQuantity = \App\Models\QualityValidation::where('plant_id', $plant->id) $nonPlannedproductionQuantity = \App\Models\QualityValidation::where('plant_id', $plant->id)
->where('line_id', $line->id) ->where('line_id', $line->id)
->whereNotIn('item_id', $itemIds) ->whereHas('stickerMaster', function ($query) use ($itemIds) {
$query->whereIn('item_id', $itemIds);
})
->whereBetween('created_at', [$startDate, $endDate]) ->whereBetween('created_at', [$startDate, $endDate])
->count(); ->count();
@@ -297,7 +301,9 @@ class SendProductionReport extends Command
$dayproductionQuantity = \App\Models\QualityValidation::where('plant_id', $plant->id) $dayproductionQuantity = \App\Models\QualityValidation::where('plant_id', $plant->id)
->where('line_id', $line->id) ->where('line_id', $line->id)
->whereIn('item_id', $itemIds) ->whereHas('stickerMaster', function ($query) use ($itemIds) {
$query->whereIn('item_id', $itemIds);
})
->whereBetween('created_at', [ ->whereBetween('created_at', [
$startDate->copy()->setTime(8, 0, 0), $startDate->copy()->setTime(8, 0, 0),
$startDate->copy()->setTime(19, 30, 0), $startDate->copy()->setTime(19, 30, 0),
@@ -306,7 +312,9 @@ class SendProductionReport extends Command
$nightproductionQuantity = \App\Models\QualityValidation::where('plant_id', $plant->id) $nightproductionQuantity = \App\Models\QualityValidation::where('plant_id', $plant->id)
->where('line_id', $line->id) ->where('line_id', $line->id)
->whereIn('item_id', $itemIds) ->whereHas('stickerMaster', function ($query) use ($itemIds) {
$query->whereIn('item_id', $itemIds);
})
->whereBetween('created_at', [ ->whereBetween('created_at', [
$startDate->copy()->setTime(19, 30, 0), $startDate->copy()->setTime(19, 30, 0),
$endDate->copy()->setTime(8, 0, 0), $endDate->copy()->setTime(8, 0, 0),