diff --git a/app/Http/Controllers/PdfController.php b/app/Http/Controllers/PdfController.php index 423062a..2e2e373 100644 --- a/app/Http/Controllers/PdfController.php +++ b/app/Http/Controllers/PdfController.php @@ -535,7 +535,7 @@ class PdfController extends Controller $processOrder = $request->header('process-order'); - $machineName = $request->header('machine-name'); + // $machineName = $request->header('machine-name'); if (! $plantCode) { return response()->json([ @@ -548,12 +548,6 @@ 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; @@ -574,26 +568,14 @@ 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 and machine name!', + 'status_description' => 'Process order not found for this plant!', ], 404); } @@ -602,20 +584,17 @@ 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(); @@ -627,7 +606,7 @@ class PdfController extends Controller if ($totalReceivedQty == $proOrdAgPlant->order_quantity) { return response()->json([ '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); }