From 644efed5c41b7e6cd5e1cc67928e3d5d2373a435 Mon Sep 17 00:00:00 2001 From: dhanabalan Date: Mon, 30 Nov 2026 08:16:14 +0530 Subject: [PATCH 1/3] API position changed and commented unused APIs --- routes/api.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/routes/api.php b/routes/api.php index dcc42c7f..f3dfa938 100644 --- a/routes/api.php +++ b/routes/api.php @@ -90,6 +90,8 @@ Route::get('sticker/get-master-type-data', [StickerMasterController::class, 'get Route::get('/download-qr-pdf/{palletNo}', [PalletController::class, 'downloadQrPdf'])->name('download-qr-pdf'); +// Route::get('/download-qr-panel-pdf/{panelPalletNo}', [PalletController::class, 'downloadPanelPalletQrPdf'])->name('download-qr-panel-pdf'); + Route::get('/download-reprint-qr-pdf/{palletNo}', [PalletController::class, 'downloadReprintQrPdf'])->name('download-reprint-qr-pdf'); Route::get('/download-reprint-process-pdf/{plant}/{item}/{process_order}/{coil_number}/{name}', [PalletController::class, 'downloadReprintProcess'])->name('download-reprint-process-pdf'); @@ -190,6 +192,8 @@ Route::post('testing/leak-test/store-data', [TestingPanelController::class, 'sto Route::post('testing/leak-test/get-data', [TestingPanelController::class, 'getLeakTestStatus']); +Route::get('leak-test-item', [PlantController::class, 'getItemLine']); // + Route::post('testing/before-test/store-data', [TestingPanelController::class, 'storeBeforeTestStatus']); Route::get('get-pdf', [PdfController::class, 'getPdf']); // processorder/get-pdf @@ -294,8 +298,6 @@ Route::post('vehicle/entry', [VehicleController::class, 'storeVehicleEntry']); Route::get('item-code', [PlantController::class, 'getItemCode']); -Route::get('leak-test-item', [PlantController::class, 'getItemLine']); - // Route::post('laser-stop-report', [SapFileController::class, 'laserStopReport']); // ..Coil Packing @@ -304,6 +306,6 @@ Route::get('/download-coil-qr-pdf/{palletNo}', [PalletController::class, 'downlo Route::get('coil-details', [PdfController::class, 'getCoilDetails']); -//..Testing Panel Data +// // ..Testing Panel Data -// Route::post('testing/route/data', [CharacteristicsController::class, 'testRoute']); +// Route::post('testing/route/data', [TestingPanelController::class, 'testRoute']); From a591db6279154b786e5a3046c9a08fa3d5385317 Mon Sep 17 00:00:00 2001 From: dhanabalan Date: Mon, 30 Nov 2026 08:24:55 +0530 Subject: [PATCH 2/3] Updated get / post quality approval (for allow PNG / PDF) and get job status (for Partial Release) and post job characteristics (for Partial Release) APIs validation --- .../Controllers/CharacteristicsController.php | 68 +++++++++++++------ 1 file changed, 47 insertions(+), 21 deletions(-) diff --git a/app/Http/Controllers/CharacteristicsController.php b/app/Http/Controllers/CharacteristicsController.php index d4e64232..8e115216 100644 --- a/app/Http/Controllers/CharacteristicsController.php +++ b/app/Http/Controllers/CharacteristicsController.php @@ -2660,7 +2660,7 @@ class CharacteristicsController extends Controller } catch (\Exception $e) { return response()->json([ 'status_code' => 'ERROR', - 'status_description' => "Error occurred while inserting new master characteristics for the serial number '{$serial}', {$e->getMessage()}", + 'status_description' => "Error occurred while searching serial number '{$serial}' to inserting new master characteristics for the job number '{$jobNo}', {$e->getMessage()}", // 'char_data' => $char ], 500); } @@ -2756,7 +2756,7 @@ class CharacteristicsController extends Controller } catch (\Exception $e) { return response()->json([ 'status_code' => 'ERROR', - 'status_description' => "Error occurred while inserting new master characteristics for the serial number '{$serial}', {$e->getMessage()}", + 'status_description' => "Error occurred while inserting new master characteristics for the job number '{$jobNo}' with serial number '{$serial}', {$e->getMessage()}", // 'char_data' => $char ], 500); } @@ -3043,7 +3043,7 @@ class CharacteristicsController extends Controller } catch (\Exception $e) { return response()->json([ 'status_code' => 'ERROR', - 'status_description' => "Error occurred while inserting new master characteristics for the serial number '{$serial}', {$e->getMessage()}", + 'status_description' => "Error occurred while searching serial number '{$serial}' to inserting new master characteristics for the job number '{$jobNo}', {$e->getMessage()}", // 'char_data' => $char ], 500); } @@ -3159,11 +3159,15 @@ class CharacteristicsController extends Controller $existSnoJob = ClassCharacteristic::where('gernr', $serial)->where('aufnr', '!=', $jobNo)->where('plant_id', $plantId)->first(); - if ($existing && $existSnoJob) { // // Skip duplicate warning... - return response()->json([ - 'status_code' => 'ERROR', - 'status_description' => "Duplicate serial number '{$serial}' found while updating exist master characteristics in job number '{$existSnoJob->aufnr}'!", - ], 404); + if ($existing) { // // Skip duplicate warning... + if ($existSnoJob) { + return response()->json([ + 'status_code' => 'ERROR', + 'status_description' => "Duplicate serial number '{$serial}' found while updating exist master characteristics in job number '{$existSnoJob->aufnr}'!", + ], 404); + } else { + $isInsertOrUpdate = true; + } } else { $isInsertOrUpdate = true; $insertData['created_by'] = $userName ?? null; @@ -3172,7 +3176,7 @@ class CharacteristicsController extends Controller } catch (\Exception $e) { return response()->json([ 'status_code' => 'ERROR', - 'status_description' => "Error occurred while inserting new master characteristics for the serial number '{$serial}', {$e->getMessage()}", + 'status_description' => "Error occurred while inserting new master characteristics for the job number '{$jobNo}' with serial number '{$serial}', {$e->getMessage()}", // 'char_data' => $char ], 500); } @@ -4071,13 +4075,21 @@ class CharacteristicsController extends Controller // $itemId = $serials->first()->item_id; // $itemcode = Item::where('id', $itemId)->value('code') ?? ''; + $receivedQty = (int) ($jobWorkCenter?->gamng ?? '0'); + $releasedQty = ClassCharacteristic::where('aufnr', $jobNumber)->where('machine_id', $machineId)->where('plant_id', $plantId)->count(); + $markedSerials = ClassCharacteristic::where('aufnr', $jobNumber)->where('machine_id', $machineId)->where('plant_id', $plantId)->get(['gernr', 'mark_status']); $allMarked = $markedSerials->every(function ($serial) { return strtolower($serial->mark_status) == 'marked'; }); - if ($allMarked) { + if ($receivedQty != $releasedQty) { + return response()->json([ + 'status_code' => 'SUCCESS', + 'status_description' => 'Has some partial serial numbers to mark!', + ], 200); + } elseif ($allMarked) { return response()->json([ 'status_code' => 'ERROR', 'status_description' => 'All serial numbers are already marked!', // skip @@ -4982,7 +4994,7 @@ class CharacteristicsController extends Controller } elseif ($file && $file->getSize() > 1024 * 1024) { // 1 MB in bytes return response()->json([ 'status' => 'ERROR', - 'status_description' => 'File size must not exceed 1 MB (Megabyte).', + 'status_description' => 'PDF file size must not exceed 1 MB (Megabyte).', ], 404); } } @@ -4990,21 +5002,26 @@ class CharacteristicsController extends Controller if ($request->hasFile('file')) { $extension = strtolower($file->getClientOriginalExtension()); - if ($extension != 'png' && $extension != 'PNG') { + if ($extension != 'png' && $extension != 'PNG' && $extension != 'pdf' && $extension != 'PDF') { return response()->json([ 'status' => 'ERROR', - 'status_description' => "Only .PNG files are allowed for request type '{$requestType}'!", + 'status_description' => "Only .PNG and .PDF files are allowed for request type '{$requestType}'!", ], 404); - } elseif ($file && $file->getSize() > 50 * 1024) { + } elseif (($extension == 'png' || $extension == 'PNG') && $file && $file->getSize() > 50 * 1024) { return response()->json([ 'status' => 'ERROR', - 'status_description' => 'File size must not exceed 50 KB (Kilobyte).', + 'status_description' => 'PNG file size must not exceed 50 KB (Kilobyte).', + ], 404); + } elseif (($extension == 'pdf' || $extension == 'PDF') && $file && $file->getSize() > 1024 * 1024) { + return response()->json([ + 'status' => 'ERROR', + 'status_description' => 'PDF file size must not exceed 1 MB (Megabyte).', ], 404); } } else { return response()->json([ 'status' => 'ERROR', - 'status_description' => 'Quality approval image (.png) not found!', + 'status_description' => 'Quality approval document (.png or .pdf) not found!', ], 404); } } @@ -5572,7 +5589,6 @@ class CharacteristicsController extends Controller return response()->json([ 'work_flow_ids' => [$workFlowIds], ], 200); - } catch (\Exception $e) { return response()->json([ 'status_code' => 'ERROR', @@ -6873,7 +6889,11 @@ class CharacteristicsController extends Controller } else { $extension = ($requestType == 'Characteristic') ? 'pdf' : 'png'; $filePath = "uploads/LaserDocs/{$workFlowId}.{$extension}"; - $filename = "{$workFlowId}.{$extension}"; + $filePdfPath = "uploads/LaserDocs/{$workFlowId}.pdf"; + $filePngPath = "uploads/LaserDocs/{$workFlowId}.png"; + $fileName = "{$workFlowId}.{$extension}"; + $filePdfName = "{$workFlowId}.pdf"; + $filePngName = "{$workFlowId}.png"; $workFlowIdExist = RequestCharacteristic::where('work_flow_id', $workFlowId)->first(); @@ -6888,10 +6908,16 @@ class CharacteristicsController extends Controller // $filename .= '.pdf'; // } - if (! Storage::disk('local')->exists($filePath)) { + if ($requestType == 'Quality' && Storage::disk('local')->exists($filePngPath)) { + $fileName = $filePngName; + $filePath = $filePngPath; + } elseif (Storage::disk('local')->exists($filePdfPath)) { + $fileName = $filePdfName; + $filePath = $filePdfPath; + } elseif (! Storage::disk('local')->exists($filePath)) { return response()->json([ 'status_code' => 'ERROR', - 'status_description' => ($requestType == 'Characteristic') ? "Characteristic approval document (.PDF) not found for the Work Flow ID '{$workFlowId}'!" : "Quality approval document (.PNG) not found for the Work Flow ID '{$workFlowId}'!", + 'status_description' => ($requestType == 'Characteristic') ? "Characteristic approval document (.PDF) not found for the Work Flow ID '{$workFlowId}'!" : "Quality approval document (.PNG or .PDF) not found for the Work Flow ID '{$workFlowId}'!", ], 404); } @@ -6900,7 +6926,7 @@ class CharacteristicsController extends Controller return Response::make($file, 200, [ 'Content-Type' => $mimeType, - 'Content-Disposition' => 'inline; filename="'.$filename.'"', + 'Content-Disposition' => 'inline; filename="'.$fileName.'"', ]); } } From f0bb3a541d8cee04dc57bf880dd91e11c0dcd303 Mon Sep 17 00:00:00 2001 From: dhanabalan Date: Mon, 30 Nov 2026 08:28:21 +0530 Subject: [PATCH 3/3] Updated plant code and item code validations on get sticker masters API --- .../Controllers/StickerMasterController.php | 39 ++++++++++++------- 1 file changed, 24 insertions(+), 15 deletions(-) diff --git a/app/Http/Controllers/StickerMasterController.php b/app/Http/Controllers/StickerMasterController.php index 51cabf25..f199078b 100644 --- a/app/Http/Controllers/StickerMasterController.php +++ b/app/Http/Controllers/StickerMasterController.php @@ -175,7 +175,7 @@ class StickerMasterController extends Controller $plantCode = $request->header('plant-code'); $itemCode = $request->header('item-code'); - if ($plantCode == null || $plantCode == '') { + if ($plantCode == null || $plantCode == '' || ! $plantCode) { return response()->json([ 'status_code' => 'ERROR', 'status_description' => "Plant code can't be empty!", @@ -183,28 +183,38 @@ class StickerMasterController extends Controller } elseif (! is_numeric($plantCode)) { return response()->json([ 'status_code' => 'ERROR', - 'status_description' => 'Plant code should contain only numeric values!', + 'status_description' => "Plant code '{$plantCode}' should contain only numeric values!", ], 400); } elseif (Str::length($plantCode) < 4 || Str::length($plantCode) > 7) { return response()->json([ 'status_code' => 'ERROR', - 'status_description' => 'Plant code must be between 4 and 7 digits only!', + 'status_description' => "Plant code '{$plantCode}' must be between 4 and 7 digits only!", ], 400); } elseif (! preg_match('/^[1-9]\d{3,6}$/', $plantCode)) { return response()->json([ 'status_code' => 'ERROR', - 'status_description' => 'Invalid plant code found!', + 'status_description' => "Invalid plant code '{$plantCode}' found!", ], 400); - } elseif ($itemCode == null || $itemCode == '') { + } elseif ($itemCode == null || $itemCode == '' || ! $itemCode) { return response()->json([ 'status_code' => 'ERROR', - 'status_description' => "Item Code can't be empty!", - ], 400); - } elseif (Str::length($itemCode) < 6 || ! ctype_alnum($itemCode)) { + 'status_description' => "Item code can't be empty!", + ], 404); + } elseif (Str::length($itemCode) < 6) { return response()->json([ 'status_code' => 'ERROR', - 'status_description' => 'Invalid item code found!', - ], 400); + 'status_description' => "Item code '{$itemCode}' should contain minimum 6 digits!", + ], 404); + } elseif (! ctype_alnum($itemCode)) { + return response()->json([ + 'status_code' => 'ERROR', + 'status_description' => "Item code '{$itemCode}' should contain only alpha-numeric values!", + ], 404); + } elseif (! preg_match('/^[a-zA-Z1-9][a-zA-Z0-9]{5,}$/', $itemCode)) { + return response()->json([ + 'status_code' => 'ERROR', + 'status_description' => "Item code '{$itemCode}' should not begin with '0'!", + ], 404); } $plant = Plant::where('code', $plantCode)->first(); @@ -212,18 +222,17 @@ class StickerMasterController extends Controller if (! $plant) { return response()->json([ 'status_code' => 'ERROR', - 'status_description' => 'Plant Code not found!', + 'status_description' => "Plant code '{$plantCode}' not found in plants table!", ], 400); } $plantId = $plant->id; $item = Item::where('code', $itemCode)->first(); - if (! $item) { return response()->json([ 'status_code' => 'ERROR', - 'status_description' => 'Item Code not found in item table!', + 'status_description' => "Item code '{$itemCode}' not found in items table!", ], 404); } @@ -232,7 +241,7 @@ class StickerMasterController extends Controller if (! $item) { return response()->json([ 'status_code' => 'ERROR', - 'status_description' => "Item Code not found for the plant : '$plant->name' in item table!", + 'status_description' => "Item code '{$itemCode}' not found for the plant code '{$plantCode}' in items table!", ], 404); } @@ -249,7 +258,7 @@ class StickerMasterController extends Controller if (! $stickerMaster) { return response()->json([ 'status_code' => 'ERROR', - 'status_description' => 'Item Code not found in sticker master table!', + 'status_description' => "Item code '{$itemCode}' not found in sticker master table!", ], 404); }