Added machine name in get api logic 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 2m35s
Laravel Larastan / larastan (pull_request) Failing after 9m0s
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 2m35s
Laravel Larastan / larastan (pull_request) Failing after 9m0s
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user