public static function loadTorniquete($dateEnd, $dateBegin) { $oBus = new Response_Business(); $MY =& MY_Controller::get_instance(); /* @var $mT_Analytics T_Analytics_Model */ $mT_Analytics = $MY->mT_Analytics; /* @var $mDateTime_Generate Datetime_Generate_Model */ $mDateTime_Generate =& $MY->mDateTime_Generate; /* @var $mTorniquete Torniquete_Model */ $mTorniquete = $MY->mTorniquete; $MY->db->trans_begin(); try { $eDatetimeGenerate = $mDateTime_Generate->load(Helper_Config::getFTTProcessTorniquete(), 'process_name'); if (!$eDatetimeGenerate->isEmpty()) { $dateBegin = $eDatetimeGenerate->update_datetime; } $eDatetimeGenerate->process_name = Helper_Config::getFTTProcessTorniquete(); $eDatetimeGenerate->update_datetime = $dateEnd; $mDateTime_Generate->save($eDatetimeGenerate); $result = $mT_Analytics->loadTorniquete($dateEnd, $dateBegin); $eTorniquetes = array(); if (!empty($result)) { foreach ($result as $row) { $eTorniquete = new eTorniquete(FALSE); $eTorniquete->parseRow($row, '', true); $eTorniquetes[] = $eTorniquete; } } if (!empty($eTorniquetes)) { foreach ($eTorniquetes as $eTorniquete) { $mTorniquete->save($eTorniquete); } } $oBus->isSuccess(TRUE); $oBus->message('Guardado exitosamente: Torniquetes'); $MY->db->trans_commit(); } catch (Exception $ex) { $oBus->isSuccess(FALSE); $oBus->message($ex->getMessage()); $MY->db->trans_rollback(); } return $oBus; }
public function _torniquete() { $dateBegin = NULL; $dateEnd = date('Y-m-d') . ' 00:00:00'; $arrDataProcess = array(); /* * Inicio del proceso de Grupo de Camaras (TORNIQUETE) */ $DateTime_Begin = date('Y-m-d H:i:s'); $cont_process = 0; while ($cont_process < 2) { $oRes = Business_Process_Generate::loadTorniquete($dateEnd, $dateBegin); if ($oRes->isSuccess()) { break; } $cont_process++; } if (!$oRes->isSuccess()) { Helper_Process_Log::write($oRes->message()); } $arrDataProcess[Helper_Config::getFTTProcessTorniquete()] = array('isSuccess' => $oRes->isSuccess(), 'message' => $oRes->message(), 'timestamp' => Helper_Fecha::getDiff_DateTime($DateTime_Begin)); /*-----------------------------------------------------------------*/ Helper_Log::write($arrDataProcess); //print_r($arrDataProcess); }