Added day shift and night shift logic in production report
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 14s
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 14s
This commit is contained in:
@@ -249,6 +249,33 @@ class SendProductionReport extends Command
|
||||
$efficiency = 0;
|
||||
}
|
||||
|
||||
$dayShiftPlanQuan = ($totalTargetQuantity / 2);
|
||||
|
||||
$nightShiftPlanQuan = ($totalTargetQuantity / 2);
|
||||
|
||||
if (strtolower($line->type) == 'fg line') {
|
||||
|
||||
$dayproductionQuantity = \App\Models\QualityValidation::where('plant_id', $plant->id)
|
||||
->where('line_id', $line->id)
|
||||
->whereBetween('created_at', [
|
||||
$startDate->copy()->setTime(8, 0, 0),
|
||||
$endDate->copy()->setTime(19, 30, 0),
|
||||
])
|
||||
->count();
|
||||
|
||||
$nightproductionQuantity = \App\Models\QualityValidation::where('plant_id', $plant->id)
|
||||
->where('line_id', $line->id)
|
||||
->whereBetween('created_at', [
|
||||
$startDate->copy()->setTime(19, 30, 0),
|
||||
$endDate->copy()->addDay()->setTime(8, 0, 0),
|
||||
])
|
||||
->count();
|
||||
}
|
||||
|
||||
$dayShiftEfficiency = $dayShiftPlanQuan > 0 ? ($dayproductionQuantity / $dayShiftPlanQuan) * 100 : 0;
|
||||
|
||||
$nightShiftEfficiency = $dayShiftPlanQuan > 0 ? ($nightproductionQuantity / $nightShiftPlanQuan) * 100 : 0;
|
||||
|
||||
$efficiency = round($efficiency, 2);
|
||||
|
||||
$tableData[] = [
|
||||
@@ -257,6 +284,12 @@ class SendProductionReport extends Command
|
||||
'type' => $line->type,
|
||||
'line' => $line->name,
|
||||
'capacityQuantity' => floor($capacityQuan),
|
||||
'dayShiftPlanQuantity' => floor($dayShiftPlanQuan),
|
||||
'dayShiftActualQuantity' => floor($dayShiftPlanQuan),
|
||||
'dayShiftEfficiency' => floor($dayShiftEfficiency),
|
||||
'nightShiftPlanQuantity' => floor($nightShiftPlanQuan),
|
||||
'nightShiftActualQuantity' => floor($nightShiftPlanQuan),
|
||||
'nightShiftEfficiency' => floor($nightShiftEfficiency),
|
||||
'targetQuantity' => floor($totalTargetQuantity),
|
||||
'productionQuantity' => $productionQuantity,
|
||||
'efficiency' => $efficiency . '%',
|
||||
|
||||
Reference in New Issue
Block a user