From 82b31d7d398d8b58e0a35a11a052b9bf6c5ead56 Mon Sep 17 00:00:00 2001 From: dhanabalan Date: Mon, 5 Oct 2026 08:49:58 +0530 Subject: [PATCH] Added logic to send report for only few line types --- app/Console/Commands/SendProductionReport.php | 22 +++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/app/Console/Commands/SendProductionReport.php b/app/Console/Commands/SendProductionReport.php index 10963bff..965ae89f 100644 --- a/app/Console/Commands/SendProductionReport.php +++ b/app/Console/Commands/SendProductionReport.php @@ -143,9 +143,27 @@ class SendProductionReport extends Command foreach ($plants as $plant) { // $lines = Line::where('plant_id', $plant->id)->get(); + // $lines = Line::where('plant_id', $plant->id) + // ->orderByRaw("CASE WHEN LOWER(type) = 'fg line' THEN 0 ELSE 1 END") + // ->get(); + $lines = Line::where('plant_id', $plant->id) - ->orderByRaw("CASE WHEN LOWER(type) = 'fg line' THEN 0 ELSE 1 END") - ->get(); + ->whereIn('type', [ + 'Base FG Line', + 'FG Line', + 'Process FG Line', + 'SFG Line', + ]) + ->orderByRaw(" + CASE + WHEN LOWER(type) = 'fg line' THEN 0 + WHEN LOWER(type) = 'base fg line' THEN 1 + WHEN LOWER(type) = 'process fg line' THEN 2 + WHEN LOWER(type) = 'sfg line' THEN 3 + ELSE 4 + END + ") + ->get(); foreach ($lines as $line) {