Merge pull request 'ranjith-dev' (#1325) from ranjith-dev into master
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 14s

Reviewed-on: #1325
This commit was merged in pull request #1325.
This commit is contained in:
2026-10-28 06:55:05 +00:00
2 changed files with 74 additions and 0 deletions

View File

@@ -314,6 +314,78 @@ class PdfController extends Controller
}
public function getCoilDetails(Request $request){
$expectedUser = env('API_AUTH_USER');
$expectedPw = env('API_AUTH_PW');
$header_auth = $request->header('Authorization');
$expectedToken = $expectedUser.':'.$expectedPw;
if ('Bearer '.$expectedToken != $header_auth) {
return response()->json([
'status_code' => 'ERROR',
'status_description' => 'Invalid authorization token!',
], 404);
}
$plantCode = $request->header('plant-code');
$processOrder = $request->header('process-order');
if (! $plantCode) {
return response()->json([
'status_code' => 'ERROR',
'status_description' => "Plant Code value can't be empty",
], 404);
} elseif (! $processOrder) {
return response()->json([
'status_code' => 'ERROR',
'status_description' => 'Process Order cannot be empty!',
], 404);
}
if (!str_contains($processOrder, '-')) {
return response()->json([
'status_code' => 'ERROR',
'status_description' => "Invalid Process Order",
], 404);
}
$plant = Plant::where('code', $plantCode)->first();
$plantId = $plant->id;
if (! $plant) {
return response()->json([
'status_code' => 'ERROR',
'status_description' => "Plant Code '{$plantCode}' not found!",
], 404);
}
$parts = explode('-', $processOrder);
$processOrder = $parts[0]; // 261010002154
$coilNo = $parts[1]; // 001
$processOrderExist = ProcessOrder::where('process_order', $processOrder)->where('plant_id', $plantId)->where('coil_number', $coilNo)->first();
if ($processOrderExist) {
$itemId = $processOrderExist->item_id;
$item = Item::where('id', $itemId)->first();
$itemCode = $item->code;
return response()->json([
'status_code' => 'ERROR',
'status_description' => "Process order '$processOrder' with coil number '$coilNo' found against item '$itemCode'",
], 404);
}
else{
return response()->json([
'status_code' => 'ERROR',
'status_description' => "Process order '$processOrder' with coil number '$coilNo' not found'",
], 404);
}
}
/**
* Store a newly created resource in storage.
*/

View File

@@ -292,3 +292,5 @@ Route::get('item-code', [PlantController::class, 'getItemCode']);
// ..Coil Packing
Route::get('/download-coil-qr-pdf/{palletNo}', [PalletController::class, 'downloadCoilQrPdf'])->name('download-coil-qr-pdf');
Route::get('coil-details', [PdfController::class, 'getCoilDetails']);