Updated plant validation logic and added bundle_quantity in get_master api #557
@@ -48,7 +48,17 @@ class StickerMasterController extends Controller
|
|||||||
'status_code' => 'ERROR',
|
'status_code' => 'ERROR',
|
||||||
'status_description' => "Plant code can't be empty!",
|
'status_description' => "Plant code can't be empty!",
|
||||||
], 400);
|
], 400);
|
||||||
} elseif (Str::length($plantCode) < 4 || ! is_numeric($plantCode) || ! preg_match('/^[1-9]\d{3,}$/', $plantCode)) {
|
} elseif (! is_numeric($plantCode)) {
|
||||||
|
return response()->json([
|
||||||
|
'status_code' => 'ERROR',
|
||||||
|
'status_description' => 'Plant code should contain only numeric values!',
|
||||||
|
], 400);
|
||||||
|
} elseif (Str::length($plantCode) < 4 || Str::length($plantCode) > 7) {
|
||||||
|
return response()->json([
|
||||||
|
'status_code' => 'ERROR',
|
||||||
|
'status_description' => 'Plant code must be between 4 and 7 digits only!',
|
||||||
|
], 400);
|
||||||
|
} elseif (! preg_match('/^[1-9]\d{6,}$/', $plantCode)) {
|
||||||
return response()->json([
|
return response()->json([
|
||||||
'status_code' => 'ERROR',
|
'status_code' => 'ERROR',
|
||||||
'status_description' => 'Invalid plant code found!',
|
'status_description' => 'Invalid plant code found!',
|
||||||
@@ -170,7 +180,17 @@ class StickerMasterController extends Controller
|
|||||||
'status_code' => 'ERROR',
|
'status_code' => 'ERROR',
|
||||||
'status_description' => "Plant code can't be empty!",
|
'status_description' => "Plant code can't be empty!",
|
||||||
], 400);
|
], 400);
|
||||||
} elseif (Str::length($plantCode) < 4 || ! is_numeric($plantCode) || ! preg_match('/^[1-9]\d{3,}$/', $plantCode)) {
|
} elseif (! is_numeric($plantCode)) {
|
||||||
|
return response()->json([
|
||||||
|
'status_code' => 'ERROR',
|
||||||
|
'status_description' => 'Plant code should contain only numeric values!',
|
||||||
|
], 400);
|
||||||
|
} elseif (Str::length($plantCode) < 4 || Str::length($plantCode) > 7) {
|
||||||
|
return response()->json([
|
||||||
|
'status_code' => 'ERROR',
|
||||||
|
'status_description' => 'Plant code must be between 4 and 7 digits only!',
|
||||||
|
], 400);
|
||||||
|
} elseif (! preg_match('/^[1-9]\d{6,}$/', $plantCode)) {
|
||||||
return response()->json([
|
return response()->json([
|
||||||
'status_code' => 'ERROR',
|
'status_code' => 'ERROR',
|
||||||
'status_description' => 'Invalid plant code found!',
|
'status_description' => 'Invalid plant code found!',
|
||||||
@@ -192,7 +212,7 @@ class StickerMasterController extends Controller
|
|||||||
if (! $plant) {
|
if (! $plant) {
|
||||||
return response()->json([
|
return response()->json([
|
||||||
'status_code' => 'ERROR',
|
'status_code' => 'ERROR',
|
||||||
'status_description' => 'Plant not found!',
|
'status_description' => 'Plant Code not found!',
|
||||||
], 400);
|
], 400);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -212,7 +232,7 @@ class StickerMasterController extends Controller
|
|||||||
if (! $item) {
|
if (! $item) {
|
||||||
return response()->json([
|
return response()->json([
|
||||||
'status_code' => 'ERROR',
|
'status_code' => 'ERROR',
|
||||||
'status_description' => "Item Code not found in item table for the plant : '$plant->name'!",
|
'status_description' => "Item Code not found for the plant : '$plant->name' in item table!",
|
||||||
], 404);
|
], 404);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -238,7 +258,7 @@ class StickerMasterController extends Controller
|
|||||||
if (! $stickerMaster) {
|
if (! $stickerMaster) {
|
||||||
return response()->json([
|
return response()->json([
|
||||||
'status_code' => 'ERROR',
|
'status_code' => 'ERROR',
|
||||||
'status_description' => "Item Code not found in sticker master table for the plant : '$plant->name'!",
|
'status_description' => "Item Code not found for the plant : '$plant->name' in sticker master table!",
|
||||||
], 404);
|
], 404);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -250,6 +270,7 @@ class StickerMasterController extends Controller
|
|||||||
'Part_Validation_3' => $stickerMaster?->laser_part_validation3 ?? '',
|
'Part_Validation_3' => $stickerMaster?->laser_part_validation3 ?? '',
|
||||||
'Part_Validation_4' => $stickerMaster?->laser_part_validation4 ?? '',
|
'Part_Validation_4' => $stickerMaster?->laser_part_validation4 ?? '',
|
||||||
'Part_Validation_5' => $stickerMaster?->laser_part_validation5 ?? '',
|
'Part_Validation_5' => $stickerMaster?->laser_part_validation5 ?? '',
|
||||||
|
'bundle_quantity' => (string) $stickerMaster?->bundle_quantity ?? '0',
|
||||||
];
|
];
|
||||||
|
|
||||||
return response()->json($output, 200);
|
return response()->json($output, 200);
|
||||||
|
|||||||
Reference in New Issue
Block a user