Added process order report in production mail #1119

Merged
jothi merged 1 commits from ranjith-dev into master 2026-09-29 05:51:59 +00:00

View File

@@ -235,7 +235,14 @@ class SendProductionReport extends Command
->whereBetween('created_at', [$startDate, $endDate])
->count();
} else {
}
if(strtolower($line->type) == 'process fg line'){
$productionQuantity = \App\Models\ProcessOrder::where('plant_id', $plant->id)
->where('line_id', $line->id)
->whereBetween('created_at', [$startDate, $endDate])
->count();
}
else {
$productionQuantity = ProductionQuantity::where('plant_id', $plant->id)
->where('line_id', $line->id)
@@ -272,6 +279,25 @@ class SendProductionReport extends Command
->count();
}
if (strtolower($line->type) == 'process fg line') {
$dayproductionQuantity = \App\Models\ProcessOrder::where('plant_id', $plant->id)
->where('line_id', $line->id)
->whereBetween('created_at', [
$startDate->copy()->setTime(8, 0, 0),
$startDate->copy()->setTime(19, 30, 0),
])
->sum('received_quantity');
$nightproductionQuantity = \App\Models\ProcessOrder::where('plant_id', $plant->id)
->where('line_id', $line->id)
->whereBetween('created_at', [
$startDate->copy()->setTime(19, 30, 0),
$endDate->copy()->setTime(8, 0, 0),
])
->sum('received_quantity');
}
$dayShiftEfficiency = $dayShiftPlanQuan > 0 ? ($dayproductionQuantity / $dayShiftPlanQuan) * 100 : 0;
$nightShiftEfficiency = $nightShiftPlanQuan > 0 ? ($nightproductionQuantity / $nightShiftPlanQuan) * 100 : 0;