removed machine name logic in get api of process order
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 14s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 13s
Gemini PR Review / Gemini PR Review (pull_request) Failing after 20s
Laravel Pint / pint (pull_request) Successful in 6m44s
Laravel Larastan / larastan (pull_request) Failing after 6m50s

This commit is contained in:
dhanabalan
2026-09-18 17:33:06 +05:30
parent 5134470f4b
commit 3559c4c4ee

View File

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