|
|
@@ -43,20 +43,12 @@ class ProcessManagementController extends Controller
|
|
|
}
|
|
|
|
|
|
try {
|
|
|
- Log::info('entrando a process');
|
|
|
$arrWorkflows = DB::Table('v_workflows_modulos_simple')->get();
|
|
|
- Log::info($arrWorkflows);
|
|
|
$arrWorkflows = json_decode(json_encode($arrWorkflows), true);
|
|
|
} catch (\Throwable $th) {
|
|
|
return $this->responseController->makeResponse(true, "Ocurrió un error al obtener los flujos de trabajo.", $th->getMessage(), 500);
|
|
|
}
|
|
|
|
|
|
- $responseCheckLatestUpdate = $this->resourcesController->checkLatestUpdate($arrWorkflows, $line);
|
|
|
- if ($responseCheckLatestUpdate['error']) {
|
|
|
- return $this->responseController->makeResponse(true, $responseCheckLatestUpdate['msg'], [], 500);
|
|
|
- }
|
|
|
- $arrWorkflows = $responseCheckLatestUpdate['response'];
|
|
|
- Log::info($arrWorkflows);
|
|
|
return $this->responseController->makeResponse(false, "ÉXITO: Consulta Exitosa", $arrWorkflows);
|
|
|
}
|
|
|
|
|
|
@@ -66,30 +58,45 @@ class ProcessManagementController extends Controller
|
|
|
return $this->responseController->makeResponse(true, $arrResponseCheckUser['msg'], [], 401);
|
|
|
}
|
|
|
|
|
|
+ /*
|
|
|
try {
|
|
|
$idWorkflow = $this->encController->decrypt($idWorkflow);
|
|
|
} catch (\Throwable $th) {
|
|
|
return $this->responseController->makeResponse(true, 'ERR_AREA_GETBY000: Ocurrió un error al desencriptar el ID del almacen', $th->getMessage(), 406);
|
|
|
- }
|
|
|
+ }*/
|
|
|
|
|
|
try {
|
|
|
- $arrWorkflow = (array) DB::table('S002V01TWORK')
|
|
|
- ->where('WORK_IDWO', '=', $idWorkflow)
|
|
|
- ->where('WORK_NULI', '=', $line)
|
|
|
- ->where('WORK_ESTA', '=', 'Activo')
|
|
|
- ->first([
|
|
|
- 'WORK_NOWO',
|
|
|
- 'WORK_DESC',
|
|
|
- 'WORK_PRED',
|
|
|
- 'WORK_HICA',
|
|
|
- 'WORK_VERS',
|
|
|
- 'WORK_INEX'
|
|
|
- ]);
|
|
|
+ $result = DB::select("SELECT fn_get_workflow_by_id(?) as workflow_data", [$idWorkflow]);
|
|
|
+ $workflowData = json_decode($result[0]->workflow_data, true);
|
|
|
+
|
|
|
+ $workflow = $workflowData['workflow'];
|
|
|
+
|
|
|
+ $formattedWorkflow = [
|
|
|
+ 'ID_WORKFLOW' => $workflow['ID_WORKFLOW'],
|
|
|
+ 'NOMBRE_WORKFLOW' => $workflow['NOMBRE_WORKFLOW'],
|
|
|
+ 'DESCRIPCION' => $workflow['DESCRIPCION'],
|
|
|
+ 'PREDETERMINADO' => $workflow['PREDETERMINADO'],
|
|
|
+ 'ESTADO' => $workflow['ESTADO'],
|
|
|
+ 'VERSION' => $workflow['VERSION'],
|
|
|
+ 'INFORMACION_EXTRA' => json_encode($workflow['INFORMACION_EXTRA']),
|
|
|
+ 'MODULOS' => $workflowData['MODULOS'],
|
|
|
+ 'USUARIO_REGISTRO' => $workflow['USUARIO_REGISTRO'],
|
|
|
+ 'FECHA_REGISTRO' => $workflow['FECHA_REGISTRO'],
|
|
|
+ 'USUARIO_MODIFICA' => $workflow['USUARIO_MODIFICA'],
|
|
|
+ 'FECHA_MODIFICA' => $workflow['FECHA_MODIFICA']
|
|
|
+ ];
|
|
|
+
|
|
|
+ $responseCheckLatestUpdate = $this->resourcesController->checkLatestUpdate([$formattedWorkflow], $line);
|
|
|
+ if ($responseCheckLatestUpdate['error']) {
|
|
|
+ return $this->responseController->makeResponse(true, $responseCheckLatestUpdate['msg'], [], 500);
|
|
|
+ }
|
|
|
+ $formattedWorkflow = $responseCheckLatestUpdate['response'][0];
|
|
|
+
|
|
|
} catch (\Throwable $th) {
|
|
|
return $this->responseController->makeResponse(true, "Ocurrió un error al obtener los flujos de trabajo.", $th->getMessage(), 500);
|
|
|
}
|
|
|
|
|
|
- return $this->responseController->makeResponse(false, "ÉXITO: Consulta Exitosa", $arrWorkflow);
|
|
|
+ return $this->responseController->makeResponse(false, "ÉXITO: Consulta Exitosa", $formattedWorkflow);
|
|
|
}
|
|
|
|
|
|
public function updateWorkflow(Request $request, $idWorkflow) {
|