Added ok_quantity and not_ok_quantity parameter (with functionality) in process order get response json #316
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
namespace App\Http\Controllers;
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
|
use App\Models\CharacteristicValue;
|
||||||
use App\Models\GrMaster;
|
use App\Models\GrMaster;
|
||||||
use App\Models\Item;
|
use App\Models\Item;
|
||||||
use App\Models\Line;
|
use App\Models\Line;
|
||||||
@@ -607,14 +608,20 @@ class PdfController extends Controller
|
|||||||
// ], 404);
|
// ], 404);
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
$okQty = CharacteristicValue::where('plant_id', $plant->id)->where('process_order', $processOrder)->where('status', 'Ok')->get()->count();
|
||||||
|
|
||||||
|
$notOkQty = CharacteristicValue::where('plant_id', $plant->id)->where('process_order', $processOrder)->where('status', 'NotOk')->get()->count();
|
||||||
|
|
||||||
return response()->json([
|
return response()->json([
|
||||||
'item_code' => $item?->code ?? '',
|
'item_code' => $item?->code ?? '',
|
||||||
'description' => $item?->description ?? '',
|
'description' => $item?->description ?? '',
|
||||||
// 'coil_number' => $proOrdAgPlant->coil_number ?? "",
|
// 'coil_number' => $proOrdAgPlant->coil_number ?? "",
|
||||||
// 'order_quantity' => (string)$proOrdAgPlant->order_quantity ?? "",
|
// 'order_quantity' => (string)$proOrdAgPlant->order_quantity ?? "",
|
||||||
'coil_number' => $lastRecord->coil_number ?? '',
|
'coil_number' => (string) $lastRecord->coil_number ?? '0',
|
||||||
'order_quantity' => (string) $lastRecord->order_quantity ?? '',
|
'order_quantity' => (string) $lastRecord->order_quantity ?? '0.000',
|
||||||
'received_quantity' => (string) $totalReceivedQty ?? '',
|
'ok_quantity' => (string) $okQty ?? '0',
|
||||||
|
'not_ok_quantity' => (string) $notOkQty ?? '0',
|
||||||
|
'received_quantity' => (string) (($totalReceivedQty == 0) ? '0.000' : $totalReceivedQty) ?? '0.000',
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -867,15 +874,13 @@ class PdfController extends Controller
|
|||||||
], 404);
|
], 404);
|
||||||
}
|
}
|
||||||
|
|
||||||
if($rework != 'Yes' && $rework != 'No'){
|
if ($rework != 'Yes' && $rework != 'No') {
|
||||||
return response()->json([
|
return response()->json([
|
||||||
'status_code' => 'ERROR',
|
'status_code' => 'ERROR',
|
||||||
'status_description' => "Rework value should be either 'Yes' or 'No'!",
|
'status_description' => "Rework value should be either 'Yes' or 'No'!",
|
||||||
], 404);
|
], 404);
|
||||||
}
|
} elseif ($rework == 'No') {
|
||||||
else if ($rework == 'No')
|
if ($scrapQty != 0) {
|
||||||
{
|
|
||||||
if($scrapQty != 0){
|
|
||||||
return response()->json([
|
return response()->json([
|
||||||
'status_code' => 'ERROR',
|
'status_code' => 'ERROR',
|
||||||
'status_description' => "Scrap Quanity value should be '0'!",
|
'status_description' => "Scrap Quanity value should be '0'!",
|
||||||
@@ -883,10 +888,8 @@ class PdfController extends Controller
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
try
|
try {
|
||||||
{
|
if ($rework == 'Yes') {
|
||||||
if ($rework == 'Yes')
|
|
||||||
{
|
|
||||||
$updated = ProcessOrder::where('plant_id', $plantId)
|
$updated = ProcessOrder::where('plant_id', $plantId)
|
||||||
->where('process_order', $processOrder)
|
->where('process_order', $processOrder)
|
||||||
->where('line_id', $lineNamePlantId)
|
->where('line_id', $lineNamePlantId)
|
||||||
@@ -894,12 +897,12 @@ class PdfController extends Controller
|
|||||||
->update([
|
->update([
|
||||||
// 'order_quantity' => $orderQty,
|
// 'order_quantity' => $orderQty,
|
||||||
'received_quantity' => $receivedQty,
|
'received_quantity' => $receivedQty,
|
||||||
'scrap_quantity' => $scrapQty,
|
'scrap_quantity' => $scrapQty,
|
||||||
// 'sfg_number' => $sfgNo,
|
// 'sfg_number' => $sfgNo,
|
||||||
// 'machine_name' => $machineId,
|
// 'machine_name' => $machineId,
|
||||||
'rework_status' => 1,
|
'rework_status' => 1,
|
||||||
'updated_by' => $createdBy,
|
'updated_by' => $createdBy,
|
||||||
'updated_at' => now(),
|
'updated_at' => now(),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
if ($updated == 0) {
|
if ($updated == 0) {
|
||||||
@@ -907,17 +910,13 @@ class PdfController extends Controller
|
|||||||
'status_code' => 'ERROR',
|
'status_code' => 'ERROR',
|
||||||
'status_description' => 'No matching record found for rework coil number!',
|
'status_description' => 'No matching record found for rework coil number!',
|
||||||
], 404);
|
], 404);
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
return response()->json([
|
return response()->json([
|
||||||
'status_code' => 'SUCCESS',
|
'status_code' => 'SUCCESS',
|
||||||
'status_description' => 'Record Updated Successfully (Rework)',
|
'status_description' => 'Record Updated Successfully (Rework)',
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
$existing = ProcessOrder::where('plant_id', $plantId)
|
$existing = ProcessOrder::where('plant_id', $plantId)
|
||||||
->where('process_order', $processOrder)
|
->where('process_order', $processOrder)
|
||||||
->where('coil_number', $coilNo)
|
->where('coil_number', $coilNo)
|
||||||
@@ -960,7 +959,8 @@ class PdfController extends Controller
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function storeLaserPdf(Request $request){
|
public function storeLaserPdf(Request $request)
|
||||||
|
{
|
||||||
|
|
||||||
$expectedUser = env('API_AUTH_USER');
|
$expectedUser = env('API_AUTH_USER');
|
||||||
$expectedPw = env('API_AUTH_PW');
|
$expectedPw = env('API_AUTH_PW');
|
||||||
@@ -976,7 +976,7 @@ class PdfController extends Controller
|
|||||||
|
|
||||||
$workflowId = $request->header('work_flow_id');
|
$workflowId = $request->header('work_flow_id');
|
||||||
|
|
||||||
if (!$workflowId) {
|
if (! $workflowId) {
|
||||||
return response()->json([
|
return response()->json([
|
||||||
'status_code' => 'ERROR',
|
'status_code' => 'ERROR',
|
||||||
'status_description' => "work_flow_id can't be empty!",
|
'status_description' => "work_flow_id can't be empty!",
|
||||||
@@ -999,9 +999,9 @@ class PdfController extends Controller
|
|||||||
// 'local'
|
// 'local'
|
||||||
// );
|
// );
|
||||||
|
|
||||||
$filename = $workflowId . '.pdf';
|
$filename = $workflowId.'.pdf';
|
||||||
|
|
||||||
$filePath = 'uploads/LaserDocs/' . $filename;
|
$filePath = 'uploads/LaserDocs/'.$filename;
|
||||||
|
|
||||||
if (Storage::disk('local')->exists($filePath)) {
|
if (Storage::disk('local')->exists($filePath)) {
|
||||||
Storage::disk('local')->delete($filePath);
|
Storage::disk('local')->delete($filePath);
|
||||||
|
|||||||
Reference in New Issue
Block a user