Added machine name in process order post api
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 18s
Gemini PR Review / Gemini PR Review (pull_request) Failing after 20s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 15s
Laravel Pint / pint (pull_request) Successful in 14m14s
Laravel Larastan / larastan (pull_request) Failing after 21m8s

This commit is contained in:
dhanabalan
2026-09-18 14:01:51 +05:30
parent 329af67e80
commit c0eab3e989

View File

@@ -869,6 +869,7 @@ class PdfController extends Controller
$alreadyReceived = ProcessOrder::where('plant_id', $plantId)
->where('process_order', $processOrder)
->where('machine_name', $machineId)
->where('item_id', $itemId)
->sum('received_quantity');
@@ -936,17 +937,18 @@ class PdfController extends Controller
->where('process_order', $processOrder)
->where('line_id', $lineNamePlantId)
->where('coil_number', $coilMain)
->where('machine_name', $machineId)
->first();
if (! $existingCoil) {
return response()->json([
'status_code' => 'ERROR',
'status_description' => "Coil number '{$coilMain}' not exist against plant code '{$plantCode}' and process order '{$processOrder}'!",
'status_description' => "Coil number '{$coilMain}' not exist against plant code '{$plantCode}', process order '{$processOrder}' and machine name '{$machineId}'!",
], 404);
} elseif ($existingCoil->rework_status == 0) {
return response()->json([
'status_code' => 'ERROR',
'status_description' => "Rework coil number '{$coilMain}' not exist against plant code '{$plantCode}' and process order '{$processOrder}'!",
'status_description' => "Rework coil number '{$coilMain}' not exist against plant code '{$plantCode}', process order '{$processOrder}' and machine name '{$machineId}'!",
], 404);
}
@@ -961,6 +963,7 @@ class PdfController extends Controller
->where('process_order', $processOrder)
->where('line_id', $lineNamePlantId)
->where('coil_number', $coilNo)
->where('machine_name', $machineId)
->first();
if (! $existingCoil) {
@@ -1008,12 +1011,13 @@ class PdfController extends Controller
$existPrevCoil = ProcessOrder::where('plant_id', $plantId)
->where('process_order', $processOrder)
->where('coil_number', $prevCoilNo)
->where('machine_name', $machineId)
->first();
if (! $existPrevCoil) {
return response()->json([
'status_code' => 'ERROR',
'status_description' => "Previous coil number '{$prevCoilNo}' not exist against plant code '{$plantCode}' and process order '{$processOrder}'!",
'status_description' => "Previous coil number '{$prevCoilNo}' not exist against plant code '{$plantCode}', process order '{$processOrder}' and machine name '{$machineId}'!",
], 404);
}
}
@@ -1021,13 +1025,14 @@ class PdfController extends Controller
$existingCoil = ProcessOrder::where('plant_id', $plantId)
->where('process_order', $processOrder)
->where('line_id', $lineNamePlantId)
->where('machine_name', $machineId)
->where('coil_number', $coilNo)
->first();
if (! $existingCoil) {
return response()->json([
'status_code' => 'ERROR',
'status_description' => "Coil number '{$coilNo}' not exist against plant code '{$plantCode}' and process order '{$processOrder}'!",
'status_description' => "Coil number '{$coilNo}' not exist against plant code '{$plantCode}' , process order '{$processOrder}' and machine name '{$machineId}'!",
], 404);
}
@@ -1035,6 +1040,7 @@ class PdfController extends Controller
->where('process_order', $processOrder)
->where('item_id', $itemId)
->where('coil_number', $coilNo)
->where('machine_name', $machineId)
->first();
if ($existPrevCoil->received_quantity < $receivedQty) {
@@ -1048,6 +1054,7 @@ class PdfController extends Controller
->where('process_order', $processOrder)
->where('line_id', $lineNamePlantId)
->where('coil_number', $coilNo)
->where('machine_name', $machineId)
->update([
// 'order_quantity' => $orderQty,
'received_quantity' => $receivedQty,
@@ -1082,12 +1089,13 @@ class PdfController extends Controller
$existing = ProcessOrder::where('plant_id', $plantId)
->where('process_order', $processOrder)
->where('coil_number', $coilNo)
->where('machine_name', $machineId)
->first();
if ($existing) {
return response()->json([
'status_code' => 'ERROR',
'status_description' => "Coil number '{$coilNo}' already exist against plant code '{$plantCode}' and process order '{$processOrder}'!",
'status_description' => "Coil number '{$coilNo}' already exist against plant code '{$plantCode}', process order '{$processOrder}' and machine name '{$machineId}'!",
// "Process order '{$processOrder}' with coil number '{$coilNo}' already exist for the plant code '{$plantCode}'!",
], 404);
}
@@ -1097,12 +1105,13 @@ class PdfController extends Controller
$existPrevCoil = ProcessOrder::where('plant_id', $plantId)
->where('process_order', $processOrder)
->where('coil_number', $prevCoilNo)
->where('machine_name', $machineId)
->first();
if (! $existPrevCoil) {
return response()->json([
'status_code' => 'ERROR',
'status_description' => "Previous coil number '{$prevCoilNo}' not exist against plant code '{$plantCode}' and process order '{$processOrder}'!",
'status_description' => "Previous coil number '{$prevCoilNo}' not exist against plant code '{$plantCode}', process order '{$processOrder}' and machine name '{$machineId}'!",
], 404);
}
}