Updated warning message and added update has_work_flow_id on request approval creation
Some checks failed
Gemini PR Review / Gemini PR Review (pull_request) Waiting to run
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Waiting to run
Laravel Larastan / larastan (pull_request) Waiting to run
Laravel Pint / pint (pull_request) Waiting to run
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Has been cancelled
Some checks failed
Gemini PR Review / Gemini PR Review (pull_request) Waiting to run
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Waiting to run
Laravel Larastan / larastan (pull_request) Waiting to run
Laravel Pint / pint (pull_request) Waiting to run
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Has been cancelled
This commit is contained in:
@@ -14,6 +14,7 @@ use App\Models\RequestCharacteristic;
|
||||
use App\Models\StickerMaster;
|
||||
use App\Models\User;
|
||||
use App\Models\WorkGroupMaster;
|
||||
use Filament\Facades\Filament;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Illuminate\Support\Facades\Response;
|
||||
@@ -1921,12 +1922,12 @@ class CharacteristicsController extends Controller
|
||||
if (! $user) {
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => 'User Name not found!',
|
||||
'status_description' => 'User name not found!',
|
||||
], 403);
|
||||
} elseif (! $userPlant && ! $user->hasRole('Super Admin')) {
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => 'User Name not found for the plant!',
|
||||
'status_description' => 'User name not found for the plant!',
|
||||
], 403);
|
||||
} elseif (! $user->hasRole(['Super Admin', 'Design Manager', 'Design Supervisor', 'Design Employee'])) {
|
||||
return response()->json([
|
||||
@@ -1940,7 +1941,7 @@ class CharacteristicsController extends Controller
|
||||
if (! $work) {
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => "Work Center '{$workCenter}' not found!",
|
||||
'status_description' => "Work center '{$workCenter}' not found!",
|
||||
], 404);
|
||||
}
|
||||
|
||||
@@ -1951,7 +1952,7 @@ class CharacteristicsController extends Controller
|
||||
if (! $machine) {
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => "Work Center '{$workCenter}' not found for the plant code '{$plantCode}'!",
|
||||
'status_description' => "Work center '{$workCenter}' not found for the plant code '{$plantCode}'!",
|
||||
], 404);
|
||||
}
|
||||
|
||||
@@ -3488,8 +3489,6 @@ class CharacteristicsController extends Controller
|
||||
|
||||
$ItemId = $item->id;
|
||||
|
||||
// ..Initial Logic
|
||||
|
||||
$pCode = CharacteristicApproverMaster::where('plant_id', $plantId)->first();
|
||||
if (! $pCode) {
|
||||
return response()->json([
|
||||
@@ -3596,6 +3595,29 @@ class CharacteristicsController extends Controller
|
||||
|
||||
// ..Both Has Pending and Completed Logic
|
||||
|
||||
foreach ($characteristics as $char) {
|
||||
$charNameUpp = strtoupper($char['characteristic_name']) ?? null;
|
||||
$charNameLow = strtolower($char['characteristic_name']) ?? null;
|
||||
$pendingExists = RequestCharacteristic::where('plant_id', $plantId)->where('aufnr', $jobNo)->where('characteristic_name', $charNameUpp)->latest()->first();
|
||||
|
||||
$columns = Schema::getColumnListing('class_characteristics');
|
||||
|
||||
if (! in_array($charNameLow, $columns, true)) {
|
||||
$unknownCharacteristics[] = strtoupper($charNameUpp);
|
||||
}
|
||||
|
||||
if ($pendingExists) {
|
||||
|
||||
$app1 = $pendingExists->approver_status1 ?? null;
|
||||
$app2 = $pendingExists->approver_status2 ?? null;
|
||||
$app3 = $pendingExists->approver_status3 ?? null;
|
||||
|
||||
if ($app1 != 'Approved' && $app2 != 'Approved' && $app3 != 'Approved' && $app1 != 'Rejected' && $app2 != 'Rejected' && $app3 != 'Rejected') {
|
||||
$pendingCharacteristics[] = strtoupper($charNameUpp);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$pendingCharacteristics = [];
|
||||
$unknownCharacteristics = [];
|
||||
$appTypExist = null;
|
||||
@@ -3754,7 +3776,51 @@ class CharacteristicsController extends Controller
|
||||
}
|
||||
}
|
||||
|
||||
// ..Has Pending Scenario
|
||||
// ..
|
||||
|
||||
$classChar = ClassCharacteristic::where('plant_id', $plantId)->where('machine_id', $MachineId)->where('aufnr', $jobNo)->first();
|
||||
|
||||
$hasWorkFlowId = $classChar->has_work_flow_id ?? null;
|
||||
|
||||
$updatedWorkId = null;
|
||||
|
||||
if ($hasWorkFlowId != '' || $hasWorkFlowId != null) {
|
||||
|
||||
if ($hasWorkFlowId == '0') {
|
||||
if ($requestType == 'Characteristic') {
|
||||
$updatedWorkId = '1';
|
||||
} elseif ($requestType == 'Quality') {
|
||||
$updatedWorkId = '2';
|
||||
}
|
||||
} elseif ($hasWorkFlowId == '1') {
|
||||
if ($requestType == 'Characteristic') {
|
||||
$updatedWorkId = '1';
|
||||
} elseif ($requestType == 'Quality') {
|
||||
$updatedWorkId = '3';
|
||||
}
|
||||
} elseif ($hasWorkFlowId == '2') {
|
||||
if ($requestType == 'Characteristic') {
|
||||
$updatedWorkId = '3';
|
||||
} elseif ($requestType == 'Quality') {
|
||||
$updatedWorkId = '2';
|
||||
}
|
||||
} elseif ($hasWorkFlowId == '3') {
|
||||
if ($requestType == 'Characteristic') {
|
||||
$updatedWorkId = '3';
|
||||
} elseif ($requestType == 'Quality') {
|
||||
$updatedWorkId = '3';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ClassCharacteristic::where('plant_id', $plantId)
|
||||
->where('machine_id', $MachineId)
|
||||
->where('aufnr', $jobNo)
|
||||
->update([
|
||||
'has_work_flow_id' => $updatedWorkId,
|
||||
'updated_at' => now(),
|
||||
'updated_by' => Filament::auth()->user->name(),
|
||||
]);
|
||||
|
||||
return response()->json([
|
||||
'work_flow_ids' => [$workFlowIds],
|
||||
|
||||
Reference in New Issue
Block a user