From dc3ec3913c3c9c88c844e6c474350a0e16741e79 Mon Sep 17 00:00:00 2001 From: dhanabalan Date: Thu, 5 Mar 2026 15:39:10 +0530 Subject: [PATCH] Added warning message if previous coil number not found --- app/Http/Controllers/PdfController.php | 30 ++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/app/Http/Controllers/PdfController.php b/app/Http/Controllers/PdfController.php index f4d2541..ce09c59 100644 --- a/app/Http/Controllers/PdfController.php +++ b/app/Http/Controllers/PdfController.php @@ -994,6 +994,21 @@ class PdfController extends Controller ]); } } else { + if ($coilNo >= 1) { + $prevCoilNo = (string) ($coilNo - 1); + $existPrevCoil = ProcessOrder::where('plant_id', $plantId) + ->where('process_order', $processOrder) + ->where('coil_number', $prevCoilNo) + ->first(); + + if (! $existPrevCoil) { + return response()->json([ + 'status_code' => 'ERROR', + 'status_description' => "Previouse coil number '{$prevCoilNo}' not exist against plant code '{$plantCode}' and process order '{$processOrder}'!", + ], 404); + } + } + $existingCoil = ProcessOrder::where('plant_id', $plantId) ->where('process_order', $processOrder) ->where('line_id', $lineNamePlantId) @@ -1055,6 +1070,21 @@ class PdfController extends Controller ], 404); } + if ($coilNo >= 1) { + $prevCoilNo = (string) ($coilNo - 1); + $existPrevCoil = ProcessOrder::where('plant_id', $plantId) + ->where('process_order', $processOrder) + ->where('coil_number', $prevCoilNo) + ->first(); + + if (! $existPrevCoil) { + return response()->json([ + 'status_code' => 'ERROR', + 'status_description' => "Previouse coil number '{$prevCoilNo}' not exist against plant code '{$plantCode}' and process order '{$processOrder}'!", + ], 404); + } + } + ProcessOrder::Create( [ 'plant_id' => $plantId,