Merge pull request 'Added machine name in get api logic of process order' (#1053) from ranjith-dev into master
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 13s

Reviewed-on: #1053
This commit was merged in pull request #1053.
This commit is contained in:
2026-09-18 11:44:25 +00:00

View File

@@ -535,6 +535,8 @@ class PdfController extends Controller
$processOrder = $request->header('process-order');
$machineName = $request->header('machine-name');
if (! $plantCode) {
return response()->json([
'status_code' => 'ERROR',
@@ -546,6 +548,12 @@ class PdfController extends Controller
'status_description' => 'Process Order cannot be empty!',
], 404);
}
elseif (! $machineName) {
return response()->json([
'status_code' => 'ERROR',
'status_description' => 'Machine Name cannot be empty!',
], 404);
}
$plant = Plant::where('code', $plantCode)->first();
$plantId = $plant->id;
@@ -566,14 +574,26 @@ class PdfController extends Controller
], 404);
}
$proOrdAgPlan = ProcessOrder::where('plant_id', $plantId)
->where('process_order', $processOrder)
->first();
if (! $proOrdAgPlan) {
return response()->json([
'status_code' => 'ERROR',
'status_description' => 'Process order not found for this plant!',
], 404);
}
$proOrdAgPlant = ProcessOrder::where('plant_id', $plantId)
->where('process_order', $processOrder)
->where('machine_name', $machineName)
->first();
if (! $proOrdAgPlant) {
return response()->json([
'status_code' => 'ERROR',
'status_description' => 'Process order not found for this plant!',
'status_description' => 'Process order not found for this plant and machine name!',
], 404);
}
@@ -582,17 +602,20 @@ class PdfController extends Controller
$processOrderRecords = ProcessOrder::with('item')
->where('plant_id', $plant->id)
->where('process_order', $processOrder)
->where('machine_name', $machineName)
->get();
$lastRecord = ProcessOrder::with('item')
->where('plant_id', $plant->id)
->where('process_order', $processOrder)
->where('machine_name', $machineName)
->orderBy('id', 'desc')
->first();
$lastRecord1 = ProcessOrder::with('item')
->where('plant_id', $plant->id)
->where('process_order', $processOrder)
->where('machine_name', $machineName)
->where('rework_status', 0)
->orderBy('id', 'desc')
->first();
@@ -604,7 +627,7 @@ class PdfController extends Controller
if ($totalReceivedQty == $proOrdAgPlant->order_quantity) {
return response()->json([
'status_code' => 'ERROR',
'status_description' => "Process order '{$processOrder}' for plant '{$plantCode}' has already reached its order quantity.",
'status_description' => "Process order '{$processOrder}' for plant '{$plantCode}' and machine name '{$machineName}' has already reached its order quantity.",
], 404);
}