diff --git a/app/Console/Commands/SendProductionReport.php b/app/Console/Commands/SendProductionReport.php index ec1b839b..1de66463 100644 --- a/app/Console/Commands/SendProductionReport.php +++ b/app/Console/Commands/SendProductionReport.php @@ -297,6 +297,11 @@ class SendProductionReport extends Command ->whereBetween('created_at', [$startDate, $endDate]) ->sum('received_quantity'); } + else if(strtolower($line->type) == 'base fg leak test line'){ + $productionQuantity = \App\Models\LeakTestReading::where('plant_id', $plant->id) + ->whereBetween('created_at', [$startDate, $endDate]) + ->count(); + } else { $productionQuantity = ProductionQuantity::where('plant_id', $plant->id) @@ -369,6 +374,23 @@ class SendProductionReport extends Command ->sum('received_quantity'); } + if (strtolower($line->type) == 'base fg leak test line') { + + $dayproductionQuantity = \App\Models\LeakTestReading::where('plant_id', $plant->id) + ->whereBetween('created_at', [ + $startDate->copy()->setTime(8, 0, 0), + $startDate->copy()->setTime(19, 30, 0), + ]) + ->count(); + + $nightproductionQuantity = \App\Models\LeakTestReading::where('plant_id', $plant->id) + ->whereBetween('created_at', [ + $startDate->copy()->setTime(19, 30, 0), + $endDate->copy()->setTime(8, 0, 0), + ]) + ->count(); + } + $dayShiftEfficiency = $dayShiftPlanQuan > 0 ? ($dayproductionQuantity / $dayShiftPlanQuan) * 100 : 0; $nightShiftEfficiency = $nightShiftPlanQuan > 0 ? ($nightproductionQuantity / $nightShiftPlanQuan) * 100 : 0;