Added process order report in production mail #1119
@@ -235,7 +235,14 @@ class SendProductionReport extends Command
|
|||||||
->whereBetween('created_at', [$startDate, $endDate])
|
->whereBetween('created_at', [$startDate, $endDate])
|
||||||
->count();
|
->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)
|
$productionQuantity = ProductionQuantity::where('plant_id', $plant->id)
|
||||||
->where('line_id', $line->id)
|
->where('line_id', $line->id)
|
||||||
@@ -272,6 +279,25 @@ class SendProductionReport extends Command
|
|||||||
->count();
|
->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;
|
$dayShiftEfficiency = $dayShiftPlanQuan > 0 ? ($dayproductionQuantity / $dayShiftPlanQuan) * 100 : 0;
|
||||||
|
|
||||||
$nightShiftEfficiency = $nightShiftPlanQuan > 0 ? ($nightproductionQuantity / $nightShiftPlanQuan) * 100 : 0;
|
$nightShiftEfficiency = $nightShiftPlanQuan > 0 ? ($nightproductionQuantity / $nightShiftPlanQuan) * 100 : 0;
|
||||||
|
|||||||
Reference in New Issue
Block a user