|
|
|
|
@@ -3780,7 +3780,7 @@ class CharacteristicsController extends Controller
|
|
|
|
|
if (! $cField) {
|
|
|
|
|
return response()->json([
|
|
|
|
|
'status_code' => 'ERROR',
|
|
|
|
|
'status_description' => "Master characteristic field value '{$charField}'' not found in approver master!",
|
|
|
|
|
'status_description' => "Master characteristic field value '{$charField}' not found in approver master!",
|
|
|
|
|
], 404);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -3856,6 +3856,21 @@ class CharacteristicsController extends Controller
|
|
|
|
|
$query->where('approver_type', 'Characteristic');
|
|
|
|
|
})->where('machine_id', $machineId)->where('plant_id', $plantId)->get();
|
|
|
|
|
|
|
|
|
|
$requestQual = RequestCharacteristic::where('aufnr', $jobNo)->where('item_id', $itemId)->where('model_type', $modelType)
|
|
|
|
|
->whereHas('approver', function ($query) {
|
|
|
|
|
$query->where('approver_type', 'Quality');
|
|
|
|
|
})->where('machine_id', $machineId)->where('plant_id', $plantId)->orderBy('id')->get();
|
|
|
|
|
|
|
|
|
|
foreach ($requestQual as $row) {
|
|
|
|
|
$workFlowStatus = ($row->approver_status1 == 'Approved' || $row->approver_status2 == 'Approved' || $row->approver_status3 == 'Approved') ? '0' : '1';
|
|
|
|
|
|
|
|
|
|
TempClassCharacteristic::where('aufnr', $jobNo)->where('model_type', $modelType)->where('machine_id', $machineId)->where('plant_id', $plantId)
|
|
|
|
|
->update([
|
|
|
|
|
'has_work_flow_id' => $workFlowStatus,
|
|
|
|
|
'updated_by' => $userName,
|
|
|
|
|
]);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$tempClassChars = TempClassCharacteristic::where('aufnr', $jobNo)->where('machine_id', $machineId)->where('plant_id', $plantId)->get();
|
|
|
|
|
|
|
|
|
|
if (! $requestChars->isEmpty()) {
|
|
|
|
|
@@ -3966,6 +3981,21 @@ class CharacteristicsController extends Controller
|
|
|
|
|
$query->where('approver_type', 'Characteristic');
|
|
|
|
|
})->where('machine_id', $machineId)->where('plant_id', $plantId)->get();
|
|
|
|
|
|
|
|
|
|
$requestQual = RequestCharacteristic::where('aufnr', $jobNo)->where('item_id', $itemId)->where('model_type', $modelType)
|
|
|
|
|
->whereHas('approver', function ($query) {
|
|
|
|
|
$query->where('approver_type', 'Quality');
|
|
|
|
|
})->where('machine_id', $machineId)->where('plant_id', $plantId)->orderBy('id')->get();
|
|
|
|
|
|
|
|
|
|
foreach ($requestQual as $row) {
|
|
|
|
|
$workFlowStatus = ($row->approver_status1 == 'Approved' || $row->approver_status2 == 'Approved' || $row->approver_status3 == 'Approved') ? '0' : '1';
|
|
|
|
|
|
|
|
|
|
TempClassCharacteristic::where('aufnr', $jobNo)->where('model_type', $modelType)->where('machine_id', $machineId)->where('plant_id', $plantId)
|
|
|
|
|
->update([
|
|
|
|
|
'has_work_flow_id' => $workFlowStatus,
|
|
|
|
|
'updated_by' => $userName,
|
|
|
|
|
]);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (! $requestChars->isEmpty()) {
|
|
|
|
|
$hasCharPending = false;
|
|
|
|
|
|
|
|
|
|
@@ -4980,6 +5010,21 @@ class CharacteristicsController extends Controller
|
|
|
|
|
$query->where('approver_type', 'Characteristic');
|
|
|
|
|
})->where('machine_id', $machineId)->where('plant_id', $plantId)->get();
|
|
|
|
|
|
|
|
|
|
$requestQual = RequestCharacteristic::where('aufnr', $jobNo)->where('item_id', $itemId)->where('model_type', $modelType)
|
|
|
|
|
->whereHas('approver', function ($query) {
|
|
|
|
|
$query->where('approver_type', 'Quality');
|
|
|
|
|
})->where('machine_id', $machineId)->where('plant_id', $plantId)->orderBy('id')->get();
|
|
|
|
|
|
|
|
|
|
foreach ($requestQual as $row) {
|
|
|
|
|
$workFlowStatus = ($row->approver_status1 == 'Approved' || $row->approver_status2 == 'Approved' || $row->approver_status3 == 'Approved') ? '0' : '1';
|
|
|
|
|
|
|
|
|
|
TempClassCharacteristic::where('aufnr', $jobNo)->where('model_type', $modelType)->where('machine_id', $machineId)->where('plant_id', $plantId)
|
|
|
|
|
->update([
|
|
|
|
|
'has_work_flow_id' => $workFlowStatus,
|
|
|
|
|
'updated_by' => $userName,
|
|
|
|
|
]);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$tempClassChars = TempClassCharacteristic::where('aufnr', $jobNo)->where('machine_id', $machineId)->where('plant_id', $plantId)->get();
|
|
|
|
|
|
|
|
|
|
if (! $requestChars->isEmpty()) {
|
|
|
|
|
@@ -5084,6 +5129,21 @@ class CharacteristicsController extends Controller
|
|
|
|
|
$query->where('approver_type', 'Characteristic');
|
|
|
|
|
})->where('machine_id', $machineId)->where('plant_id', $plantId)->get();
|
|
|
|
|
|
|
|
|
|
$requestQual = RequestCharacteristic::where('aufnr', $jobNo)->where('item_id', $itemId)->where('model_type', $modelType)
|
|
|
|
|
->whereHas('approver', function ($query) {
|
|
|
|
|
$query->where('approver_type', 'Quality');
|
|
|
|
|
})->where('machine_id', $machineId)->where('plant_id', $plantId)->orderBy('id')->get();
|
|
|
|
|
|
|
|
|
|
foreach ($requestQual as $row) {
|
|
|
|
|
$workFlowStatus = ($row->approver_status1 == 'Approved' || $row->approver_status2 == 'Approved' || $row->approver_status3 == 'Approved') ? '0' : '1';
|
|
|
|
|
|
|
|
|
|
TempClassCharacteristic::where('aufnr', $jobNo)->where('model_type', $modelType)->where('machine_id', $machineId)->where('plant_id', $plantId)
|
|
|
|
|
->update([
|
|
|
|
|
'has_work_flow_id' => $workFlowStatus,
|
|
|
|
|
'updated_by' => $userName,
|
|
|
|
|
]);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (! $requestChars->isEmpty()) {
|
|
|
|
|
$hasCharPending = false;
|
|
|
|
|
|
|
|
|
|
@@ -5160,7 +5220,7 @@ class CharacteristicsController extends Controller
|
|
|
|
|
'approver_status_3' => $row->approver_status3 ?? '',
|
|
|
|
|
'approver_remark_3' => $row->approver_remark3 ?? '',
|
|
|
|
|
'approved_at_3' => $row->approved3_at ?? '', // ? $row->approved3_at->format('d-m-Y H:i:s') : '',
|
|
|
|
|
'mail_status' => ($row->mail_status == 'Sent') ? 'Sent-M1' : ($row->mail_status == 'Sent-Mail2') ? 'Sent-M2' : ($row->mail_status == 'Sent-Mail3') ? 'Sent-M2' : '-',
|
|
|
|
|
'mail_status' => ($row->mail_status == 'Sent') ? 'Sent-M1' : (($row->mail_status == 'Sent-Mail2') ? 'Sent-M2' : (($row->mail_status == 'Sent-Mail3') ? 'Sent-M3' : '-')),
|
|
|
|
|
'triggered_at' => $row->trigger_at ?? '',
|
|
|
|
|
'requested_by' => ($row->created_by == 'Admin') ? 'jothi' : $row->created_by ?? '',
|
|
|
|
|
'requested_at' => $row->created_at ? $row->created_at->format('Y-m-d H:i:s') : '',
|
|
|
|
|
@@ -5168,6 +5228,12 @@ class CharacteristicsController extends Controller
|
|
|
|
|
} else {
|
|
|
|
|
$workFlowStatus = ($row->approver_status1 == 'Approved' || $row->approver_status2 == 'Approved' || $row->approver_status3 == 'Approved') ? '0' : '1';
|
|
|
|
|
|
|
|
|
|
// / TempClassCharacteristic::where('aufnr', $jobNo)->where('model_type', $modelType)->where('machine_id', $machineId)->where('plant_id', $plantId)
|
|
|
|
|
// / ->update([
|
|
|
|
|
// / 'has_work_flow_id' => $workFlowStatus,
|
|
|
|
|
// / 'updated_by' => $userName,
|
|
|
|
|
// / ]);
|
|
|
|
|
|
|
|
|
|
if ($workFlowStatus == '1') {
|
|
|
|
|
$workFlowStatus = ($row->approver_status1 == 'Rejected' || $row->approver_status2 == 'Rejected' || $row->approver_status3 == 'Rejected') ? '2' : '1';
|
|
|
|
|
}
|
|
|
|
|
@@ -5193,7 +5259,7 @@ class CharacteristicsController extends Controller
|
|
|
|
|
'approver_status_3' => $row->approver_status3 ?? '',
|
|
|
|
|
'approver_remark_3' => $row->approver_remark3 ?? '',
|
|
|
|
|
'approved_at_3' => $row->approved3_at ?? '', // ? $row->approved3_at->format('d-m-Y H:i:s') : '',
|
|
|
|
|
'mail_status' => ($row->mail_status == 'Sent') ? 'Sent-M1' : ($row->mail_status == 'Sent-Mail2') ? 'Sent-M2' : ($row->mail_status == 'Sent-Mail3') ? 'Sent-M2' : '-',
|
|
|
|
|
'mail_status' => ($row->mail_status == 'Sent') ? 'Sent-M1' : (($row->mail_status == 'Sent-Mail2') ? 'Sent-M2' : (($row->mail_status == 'Sent-Mail3') ? 'Sent-M3' : '-')),
|
|
|
|
|
'triggered_at' => $row->trigger_at ?? '',
|
|
|
|
|
'requested_by' => ($row->created_by == 'Admin') ? 'jothi' : $row->created_by ?? '',
|
|
|
|
|
'requested_at' => $row->created_at ? $row->created_at->format('Y-m-d H:i:s') : '',
|
|
|
|
|
|