CREATE DATABASE  IF NOT EXISTS `redko` /*!40100 DEFAULT CHARACTER SET utf8 */;
USE `redko`;
--
-- Host: localhost    Database: redko
-- ------------------------------------------------------


--
-- Table structure for table `agro_params`
--

CREATE TABLE `agro_params` (
  `Id` int(11) NOT NULL AUTO_INCREMENT,
  `Number` int(11) NOT NULL COMMENT 'Номер параметра',
  `Value` varchar(100) DEFAULT NULL COMMENT 'Значение',
  `Description` varchar(50) DEFAULT NULL COMMENT 'Описание',
  PRIMARY KEY (`Id`)
) ENGINE=InnoDB DEFAULT CHARSET=cp1251 COMMENT='Таблица параметров';

--
-- Dumping data for table `agro_params`
--


--
-- Table structure for table `commands`
--

CREATE TABLE `commands` (
  `ID` int(11) DEFAULT '0',
  `Name` char(50) DEFAULT NULL,
  `Descr` char(200) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=cp1251;

--
-- Dumping data for table `commands`
--

INSERT INTO `commands` VALUES (10,'DRIVER_MESSAGE_SET_D',NULL),(11,'CONFIG_SMS_SET_D',NULL),(12,'CONFIG_TEL_SET_D',NULL),(13,'CONFIG_EVENT_SET_D',NULL),(14,'CONFIG_UNIQUE_SET_D',NULL),(15,'CONFIG_ZONE_SET_D',NULL),(17,'CONFIG_ID_SET_D',NULL),(18,'CONFIG_OTHER_SET_D',NULL),(20,'DRIVER_MESSAGE_SET_M',NULL),(21,'CONFIG_SMS_SET_M',NULL),(22,'CONFIG_TEL_SET_M',NULL),(23,'CONFIG_EVENT_SET_M',NULL),(24,'CONFIG_UNIQUE_SET_M',NULL),(25,'CONFIG_ZONE_SET_M',NULL),(27,'CONFIG_ID_SET_M',NULL),(28,'CONFIG_OTHER_SET_M',NULL),(31,'CONFIG_SMS_GET_D',NULL),(32,'CONFIG_TEL_GET_D',NULL),(33,'CONFIG_EVENT_GET_D',NULL),(34,'CONFIG_UNIQUE_GET_D',NULL),(35,'CONFIG_ZONE_GET_D',NULL),(36,'DATA_GPS_GET_D',NULL),(37,'CONFIG_ID_GET_D',NULL),(38,'CONFIG_OTHER_GET_D',NULL),(41,'CONFIG_SMS_GET_M',NULL),(42,'CONFIG_TEL_GET_M',NULL),(43,'CONFIG_EVENT_GET_M',NULL),(44,'CONFIG_UNIQUE_GET_M',NULL),(45,'CONFIG_ZONE_GET_M',NULL),(46,'DATA_GPS_GET_M',NULL),(47,'CONFIG_ID_GET_M',NULL),(48,'CONFIG_OTHER_GET_M',NULL),(49,'AUTO_SEND_GET_M',NULL),(99,'ERROR_COMMAND','Невозможно раскодировать входящее сообщение'),(102,'MOBITEL_SERVICE_SEND',NULL),(103,'INTERNAL_1',NULL),(104,'INTERNAL_2',NULL),(105,'INTERNAL_3',NULL),(50,'CONFIG_GPRS_MAIN_SET_D',NULL),(51,'CONFIG_GPRS_EMAIL_SET_D',NULL),(52,'CONFIG_GPRS_SOCKET_SET_D',NULL),(53,'CONFIG_GPRS_FTP_SET_D',NULL),(60,'CONFIG_GPRS_MAIN_SET_M',NULL),(61,'CONFIG_GPRS_EMAIL_SET_M',NULL),(62,'CONFIG_GPRS_SOCKET_SET_M',NULL),(63,'CONFIG_GPRS_FTP_SET_M',NULL),(70,'CONFIG_GPRS_MAIN_GET_D',NULL),(71,'CONFIG_GPRS_EMAIL_GET_D',NULL),(72,'CONFIG_GPRS_SOCKET_GET_D',NULL),(73,'CONFIG_GPRS_FTP_GET_D',NULL),(80,'CONFIG_GPRS_MAIN_GET_M',NULL),(81,'CONFIG_GPRS_EMAIL_GET_M',NULL),(82,'CONFIG_GPRS_SOCKET_GET_M',NULL),(83,'CONFIG_GPRS_FTP_GET_M',NULL),(54,'CONFIG_GPRS_INIT_SET_D',NULL),(64,'CONFIG_GPRS_INIT_SET_M',NULL),(74,'CONFIG_GPRS_INIT_GET_D',NULL),(84,'CONFIG_GPRS_INIT_GET_M',NULL);

--
-- Table structure for table `configdrivermessage`
--

CREATE TABLE `configdrivermessage` (
  `ConfigDriverMessage_ID` int(11) NOT NULL AUTO_INCREMENT,
  `Name` char(50) DEFAULT NULL,
  `Descr` char(200) DEFAULT NULL,
  `ID` int(11) DEFAULT '0',
  `Flags` int(11) DEFAULT '0',
  `Message_ID` int(11) DEFAULT '0',
  `DriverMessage` char(200) DEFAULT NULL,
  PRIMARY KEY (`ConfigDriverMessage_ID`),
  KEY `Index_2` (`ID`)
) ENGINE=InnoDB AUTO_INCREMENT=217 DEFAULT CHARSET=cp1251;

--
-- Dumping data for table `configdrivermessage`
--

INSERT INTO `configdrivermessage` VALUES (216,'Record 22.09.2005 12:14:57','Description for record created at 22.09.2005 12:14:57',216,0,0,NULL);

--
-- Table structure for table `configevent`
--

CREATE TABLE `configevent` (
  `ConfigEvent_ID` int(11) NOT NULL AUTO_INCREMENT,
  `Name` char(50) DEFAULT NULL,
  `Descr` char(200) DEFAULT NULL,
  `ID` int(11) DEFAULT '0',
  `Flags` int(11) DEFAULT '0',
  `Message_ID` int(11) DEFAULT '0',
  `tmr1Log` int(11) DEFAULT '0',
  `tmr2Send` int(11) DEFAULT '0',
  `tmr3Zone` int(11) DEFAULT '0',
  `dist1Log` int(11) DEFAULT '0',
  `dist2Send` int(11) DEFAULT '0',
  `dist3Zone` int(11) DEFAULT '0',
  `deltaTimeZone` int(11) DEFAULT '0',
  `gprsEmail` int(11) NOT NULL DEFAULT '0',
  `gprsFtp` int(11) NOT NULL DEFAULT '0',
  `gprsSocket` int(11) NOT NULL DEFAULT '0',
  `maskSensor` char(50) DEFAULT NULL,
  `maskEvent1` int(11) DEFAULT '0',
  `maskEvent2` int(11) DEFAULT '0',
  `maskEvent3` int(11) DEFAULT '0',
  `maskEvent4` int(11) DEFAULT '0',
  `maskEvent5` int(11) DEFAULT '0',
  `maskEvent6` int(11) DEFAULT '0',
  `maskEvent7` int(11) DEFAULT '0',
  `maskEvent8` int(11) DEFAULT '0',
  `maskEvent9` int(11) DEFAULT '0',
  `maskEvent10` int(11) DEFAULT '0',
  `maskEvent11` int(11) DEFAULT '0',
  `maskEvent12` int(11) DEFAULT '0',
  `maskEvent13` int(11) DEFAULT '0',
  `maskEvent14` int(11) DEFAULT '0',
  `maskEvent15` int(11) DEFAULT '0',
  `maskEvent16` int(11) DEFAULT '0',
  `maskEvent17` int(11) DEFAULT '0',
  `maskEvent18` int(11) DEFAULT '0',
  `maskEvent19` int(11) DEFAULT '0',
  `maskEvent20` int(11) DEFAULT '0',
  `maskEvent21` int(11) DEFAULT '0',
  `maskEvent22` int(11) DEFAULT '0',
  `maskEvent23` int(11) DEFAULT '0',
  `maskEvent24` int(11) DEFAULT '0',
  `maskEvent25` int(11) DEFAULT '0',
  `maskEvent26` int(11) DEFAULT '0',
  `maskEvent27` int(11) DEFAULT '0',
  `maskEvent28` int(11) DEFAULT '0',
  `maskEvent29` int(11) DEFAULT '0',
  `maskEvent30` int(11) DEFAULT '0',
  `maskEvent31` int(11) DEFAULT '0',
  PRIMARY KEY (`ConfigEvent_ID`),
  KEY `Index_2` (`ID`)
) ENGINE=InnoDB AUTO_INCREMENT=1797 DEFAULT CHARSET=cp1251;

--
-- Dumping data for table `configevent`
--

INSERT INTO `configevent` VALUES (1785,'Record 22.09.2005 12:14:57','Description for record created at 22.09.2005 12:14:57',1785,0,0,0,0,0,0,0,0,0,0,0,0,NULL,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0),(1786,'Default','Настройки по умолчанию',1785,0,200799,3,120,600,100,1000,5000,2,162,104,225,'',1,1,1,1,1,1,1,1,1,1,1,1,25,25,25,25,273,273,1,1,1,1,1,1,0,0,0,0,0,0,0),(1787,'Default','Настройки по умолчанию',1785,0,200800,0,3600,300,30,5000,5000,3,1,104,225,'',1,1,1,1,1,1,0,1,1,1,1,1,25,25,25,25,273,273,1,0,0,0,1,1,0,0,0,0,0,0,0),(1788,'Default','Настройки по умолчанию',1785,0,200804,0,3600,300,30,5000,5000,3,1,104,225,'',1,5,5,1,5,1,0,1,1,1,1,0,25,25,25,25,273,273,0,0,0,0,5,1,0,0,0,0,0,0,0),(1789,'Default','Настройки по умолчанию',1785,0,200805,0,3600,300,30,5000,5000,3,1,104,225,'',1,5,5,1,5,1,0,1,1,1,1,0,25,25,25,25,273,273,0,0,0,0,5,1,0,0,0,0,0,0,0),(1790,'','',1785,0,200806,0,3600,300,30,5000,5000,3,1,10,10,'----',1,5,5,1,5,1,0,1,1,1,1,0,25,25,25,25,273,273,0,0,0,0,5,0,0,0,0,0,0,0,0),(1791,'Default','Настройки по умолчанию',1785,0,200968,0,3600,300,30,5000,5000,3,1,104,225,'',1,5,0,1,5,1,0,1,1,1,1,0,25,25,25,25,273,273,0,0,0,0,5,1,0,0,0,0,0,0,0),(1792,'','',1785,0,200969,0,3600,300,30,5000,5000,3,1,10,10,'----',1,5,0,1,5,1,0,1,1,1,1,0,25,25,25,25,273,273,0,0,0,0,5,0,0,0,0,0,0,0,0),(1793,'2658','+37254723831',1793,0,0,0,0,0,0,0,0,0,0,0,0,NULL,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0),(1794,'3978','Desctiption for Teletrack registered at 24.03.2018 9:49:16',1794,0,0,0,0,0,0,0,0,0,0,0,0,NULL,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0),(1795,'2840','+372575383900',1795,0,0,0,0,0,0,0,0,0,0,0,0,NULL,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0),(1796,'','',1796,0,0,0,0,0,0,0,0,0,0,0,0,NULL,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);

--
-- Table structure for table `configgprsemail`
--

CREATE TABLE `configgprsemail` (
  `ConfigGprsEmail_ID` int(11) NOT NULL AUTO_INCREMENT,
  `Name` varchar(50) DEFAULT NULL,
  `Descr` varchar(200) DEFAULT NULL,
  `ID` int(11) DEFAULT '0',
  `Flags` int(11) DEFAULT '0',
  `Message_ID` int(11) DEFAULT '0',
  `Smtpserv` varchar(50) NOT NULL DEFAULT '',
  `Smtpun` varchar(50) NOT NULL DEFAULT '',
  `Smtppw` varchar(50) NOT NULL DEFAULT '',
  `Pop3serv` varchar(50) NOT NULL DEFAULT '',
  `Pop3un` varchar(50) NOT NULL DEFAULT '',
  `Pop3pw` varchar(50) NOT NULL DEFAULT '',
  PRIMARY KEY (`ConfigGprsEmail_ID`),
  KEY `Index_2` (`ID`)
) ENGINE=InnoDB AUTO_INCREMENT=357 DEFAULT CHARSET=cp1251;

--
-- Dumping data for table `configgprsemail`
--

INSERT INTO `configgprsemail` VALUES (341,'Record 22.09.2005 12:14:57','Description for record created at 22.09.2005 12:14:57',341,0,0,'','','','','',''),(342,'Record 22.09.2005 12:14:57','Description for record created at 22.09.2005 12:14:57',341,0,200887,'smtp.p314.net','','','pop.p314.net','3051@','1%NDzZnt'),(343,'','',341,0,200888,'smtp.p314.net','','','pop.p314.net','3051@','1%NDzZnt'),(352,'','',341,0,218876,'','','','','',''),(353,'2658','+37254723831',353,0,0,'','','','','',''),(354,'3978','Desctiption for Teletrack registered at 24.03.2018 9:49:16',354,0,0,'','','','','',''),(355,'2840','+372575383900',355,0,0,'','','','','',''),(356,'','',356,0,0,'','','','','','');

--
-- Table structure for table `configgprsinit`
--

CREATE TABLE `configgprsinit` (
  `ConfigGprsInit_ID` int(11) NOT NULL AUTO_INCREMENT,
  `Name` varchar(50) DEFAULT NULL,
  `Descr` varchar(200) DEFAULT NULL,
  `ID` int(11) DEFAULT '0',
  `Flags` int(11) DEFAULT '0',
  `Message_ID` int(11) DEFAULT '0',
  `Domain` varchar(50) NOT NULL DEFAULT '0',
  `InitString` varchar(200) NOT NULL DEFAULT '',
  PRIMARY KEY (`ConfigGprsInit_ID`),
  KEY `Index_2` (`ID`)
) ENGINE=InnoDB AUTO_INCREMENT=311 DEFAULT CHARSET=cp1251;

--
-- Dumping data for table `configgprsinit`
--

INSERT INTO `configgprsinit` VALUES (299,'Record 22.09.2005 12:14:57','Description for record created at 22.09.2005 12:14:57',299,0,0,'0',''),(300,'Record 22.09.2005 12:14:57','Description for record created at 22.09.2005 12:14:57',299,0,200889,'smtp.p314.net',''),(301,'','',299,0,200890,'smtp.p314.net',''),(310,'','',299,0,218877,'','');

--
-- Table structure for table `configgprsmain`
--

CREATE TABLE `configgprsmain` (
  `ConfigGprsMain_ID` int(11) NOT NULL AUTO_INCREMENT,
  `Name` varchar(50) DEFAULT NULL,
  `Descr` varchar(200) DEFAULT NULL,
  `ID` int(11) DEFAULT '0',
  `Flags` int(11) DEFAULT '0',
  `Message_ID` int(11) DEFAULT '0',
  `Mode` int(11) NOT NULL DEFAULT '0',
  `Apnserv` varchar(50) NOT NULL DEFAULT '',
  `Apnun` varchar(50) NOT NULL DEFAULT '',
  `Apnpw` varchar(50) NOT NULL DEFAULT '',
  `Dnsserv1` varchar(50) NOT NULL DEFAULT '',
  `Dialn1` varchar(50) NOT NULL DEFAULT '',
  `Ispun` varchar(50) NOT NULL DEFAULT '',
  `Isppw` varchar(50) NOT NULL DEFAULT '',
  PRIMARY KEY (`ConfigGprsMain_ID`)
) ENGINE=InnoDB AUTO_INCREMENT=401 DEFAULT CHARSET=cp1251;

--
-- Dumping data for table `configgprsmain`
--

INSERT INTO `configgprsmain` VALUES (382,'Record 22.09.2005 12:14:57','Description for record created at 22.09.2005 12:14:57',382,0,0,0,'','','','','','',''),(383,'Record 22.09.2005 12:14:57','Description for record created at 22.09.2005 12:14:57',382,0,200882,1,'www.kyivstar.net','igprs','internet','193.41.60.55','80672222901','internet','kyivstar'),(384,'','',382,0,200883,1,'www.kyivstar.net','igprs','internet','193.41.60.55','Ђg\"\"ђ000?0','internet','kyivstar'),(396,'','',382,0,218875,1,'www.kyivstar.net','igprs','internet','193.41.60.55','','internet','kyivstar'),(397,'2658','+37254723831',397,0,0,0,'','','','','','',''),(398,'3978','Desctiption for Teletrack registered at 24.03.2018 9:49:16',398,0,0,0,'','','','','','',''),(399,'2840','+372575383900',399,0,0,0,'','','','','','',''),(400,'','',400,0,0,0,'','','','','','','');

--
-- Table structure for table `configmain`
--

CREATE TABLE `configmain` (
  `ConfigMain_ID` int(11) NOT NULL AUTO_INCREMENT,
  `Name` char(50) DEFAULT NULL,
  `Descr` char(200) DEFAULT NULL,
  `ID` int(11) DEFAULT '0',
  `Flags` int(11) DEFAULT '0',
  `ConfigOther_ID` int(11) DEFAULT '0',
  `ConfigDriverMessage_ID` int(11) DEFAULT '0',
  `ConfigEvent_ID` int(11) DEFAULT '0',
  `ConfigUnique_ID` int(11) DEFAULT '0',
  `ConfigZoneSet_ID` int(11) DEFAULT '0',
  `ConfigSensorSet_ID` int(11) DEFAULT '0',
  `ConfigTel_ID` int(11) DEFAULT '0',
  `ConfigSms_ID` int(11) DEFAULT '0',
  `Mobitel_ID` int(11) DEFAULT '0',
  `ConfigGprsMain_ID` int(11) NOT NULL DEFAULT '0',
  `ConfigGprsEmail_ID` int(11) NOT NULL DEFAULT '0',
  `ConfigGprsInit_ID` int(11) NOT NULL DEFAULT '0',
  PRIMARY KEY (`ConfigMain_ID`),
  KEY `Index_2` (`Mobitel_ID`)
) ENGINE=InnoDB AUTO_INCREMENT=99 DEFAULT CHARSET=cp1251;

--
-- Dumping data for table `configmain`
--

INSERT INTO `configmain` VALUES (94,'Mobitel1','Descr',0,0,115,216,1785,128,247,103,514,708,97,382,341,299),(95,'mobitel','mca4',0,0,50,50,1793,50,50,50,528,721,98,397,353,50),(96,'mobitel','mca4',0,0,50,50,1794,50,50,50,529,722,99,398,354,50),(97,'mobitel','mca4',0,0,50,50,1795,50,50,50,530,723,100,399,355,50),(98,'','',0,0,50,50,1796,50,50,50,531,724,825503800,400,356,50);

--
-- Table structure for table `configother`
--

CREATE TABLE `configother` (
  `ConfigOther_ID` int(11) NOT NULL AUTO_INCREMENT,
  `Name` char(50) DEFAULT NULL,
  `Descr` char(200) DEFAULT NULL,
  `ID` int(11) DEFAULT '0',
  `Flags` int(11) DEFAULT '0',
  `Pin` int(11) DEFAULT '0',
  `Lang` int(11) DEFAULT '0',
  `Message_ID` int(11) DEFAULT '0',
  PRIMARY KEY (`ConfigOther_ID`),
  KEY `Index_2` (`ID`)
) ENGINE=InnoDB AUTO_INCREMENT=116 DEFAULT CHARSET=cp1251;

--
-- Dumping data for table `configother`
--

INSERT INTO `configother` VALUES (115,'Record 22.09.2005 12:14:57','Description for record created at 22.09.2005 12:14:57',115,0,0,0,0);

--
-- Table structure for table `configsensorset`
--

CREATE TABLE `configsensorset` (
  `ConfigSensorSet_ID` int(11) NOT NULL AUTO_INCREMENT,
  `Name` char(50) DEFAULT NULL,
  `Descr` char(200) DEFAULT NULL,
  `ID` int(11) DEFAULT '0',
  `Flags` int(11) DEFAULT '0',
  `Message_ID` int(11) DEFAULT '0',
  PRIMARY KEY (`ConfigSensorSet_ID`)
) ENGINE=InnoDB AUTO_INCREMENT=104 DEFAULT CHARSET=cp1251;

--
-- Dumping data for table `configsensorset`
--

INSERT INTO `configsensorset` VALUES (103,'Record 22.09.2005 12:14:57','Description for record created at 22.09.2005 12:14:57',103,0,0);

--
-- Table structure for table `configsms`
--

CREATE TABLE `configsms` (
  `ConfigSms_ID` int(11) NOT NULL AUTO_INCREMENT,
  `Name` char(50) DEFAULT NULL,
  `Descr` char(200) DEFAULT NULL,
  `ID` int(11) DEFAULT '0',
  `Flags` int(11) DEFAULT '0',
  `Message_ID` int(11) DEFAULT '0',
  `smsCenter_ID` int(11) DEFAULT '0',
  `smsDspt_ID` int(11) DEFAULT '0',
  `smsEmailGate_ID` int(11) DEFAULT '0',
  `dsptEmail` char(14) DEFAULT NULL,
  `dsptGprsEmail` char(50) DEFAULT NULL,
  PRIMARY KEY (`ConfigSms_ID`),
  KEY `Index_2` (`ID`)
) ENGINE=InnoDB AUTO_INCREMENT=725 DEFAULT CHARSET=cp1251;

--
-- Dumping data for table `configsms`
--

INSERT INTO `configsms` VALUES (708,'Record 22.09.2005 12:14:57','Description for record created at 22.09.2005 12:14:57',708,0,0,0,0,0,NULL,NULL),(709,'Record 22.09.2005 12:14:57','Description for record created at 22.09.2005 12:14:57',708,0,200809,9,62,74,'d000@p314.net','d000@p314.net'),(710,'Record 22.09.2005 12:14:57','Description for record created at 22.09.2005 12:14:57',708,0,200810,9,62,74,'d000@p314.net','d000@p314.net'),(711,'','',708,0,200811,-1,62,74,'d000@p314.net','d000@p314.net'),(720,'','',708,0,218874,0,0,0,'',''),(721,'2658','+37254723831',721,0,0,0,0,0,NULL,NULL),(722,'3978','Desctiption for Teletrack registered at 24.03.2018 9:49:16',722,0,0,0,0,0,NULL,NULL),(723,'2840','+372575383900',723,0,0,0,0,0,NULL,NULL),(724,'','',724,0,0,0,0,0,NULL,NULL);

--
-- Table structure for table `configtel`
--

CREATE TABLE `configtel` (
  `ConfigTel_ID` int(11) NOT NULL AUTO_INCREMENT,
  `Name` char(50) DEFAULT NULL,
  `Descr` char(200) DEFAULT NULL,
  `ID` int(11) DEFAULT '0',
  `Flags` int(11) DEFAULT '0',
  `Message_ID` int(11) DEFAULT '0',
  `telSOS` int(11) DEFAULT '0',
  `telDspt` int(11) DEFAULT '0',
  `telAccept1` int(11) DEFAULT '0',
  `telAccept2` int(11) DEFAULT '0',
  `telAccept3` int(11) DEFAULT '0',
  `telAnswer` int(11) DEFAULT '0',
  PRIMARY KEY (`ConfigTel_ID`),
  KEY `Index_2` (`ID`)
) ENGINE=InnoDB AUTO_INCREMENT=532 DEFAULT CHARSET=cp1251;

--
-- Dumping data for table `configtel`
--

INSERT INTO `configtel` VALUES (514,'Record 22.09.2005 12:14:57','Description for record created at 22.09.2005 12:14:57',514,0,0,0,0,0,0,0,0),(515,'Record 22.09.2005 12:14:57','Description for record created at 22.09.2005 12:14:57',514,0,200807,57,57,71,89,75,0),(516,'','',514,0,200808,57,57,71,89,75,0),(527,'','',514,0,218873,58,58,58,58,58,0),(528,'2658','+37254723831',528,0,0,0,0,0,0,0,0),(529,'3978','Desctiption for Teletrack registered at 24.03.2018 9:49:16',529,0,0,0,0,0,0,0,0),(530,'2840','+372575383900',530,0,0,0,0,0,0,0,0),(531,'','',531,0,0,0,0,0,0,0,0);

--
-- Table structure for table `configunique`
--

CREATE TABLE `configunique` (
  `ConfigUnique_ID` int(11) NOT NULL AUTO_INCREMENT,
  `Name` char(50) DEFAULT NULL,
  `Descr` char(200) DEFAULT NULL,
  `ID` int(11) DEFAULT '0',
  `Flags` int(11) DEFAULT '0',
  `Message_ID` int(11) DEFAULT '0',
  `pswd` char(8) DEFAULT NULL,
  `tmpPswd` char(8) DEFAULT NULL,
  `dsptId` char(4) DEFAULT NULL,
  PRIMARY KEY (`ConfigUnique_ID`),
  KEY `Index_2` (`ID`)
) ENGINE=InnoDB AUTO_INCREMENT=129 DEFAULT CHARSET=cp1251;

--
-- Dumping data for table `configunique`
--

INSERT INTO `configunique` VALUES (128,'Record 22.09.2005 12:14:57','Description for record created at 22.09.2005 12:14:57',128,0,0,NULL,NULL,NULL);

--
-- Table structure for table `configzoneset`
--

CREATE TABLE `configzoneset` (
  `ConfigZoneSet_ID` int(11) NOT NULL AUTO_INCREMENT,
  `Name` char(50) DEFAULT NULL,
  `Descr` char(200) DEFAULT NULL,
  `ID` int(11) DEFAULT '0',
  `Flags` int(11) DEFAULT '0',
  `Message_ID` int(11) DEFAULT '0',
  PRIMARY KEY (`ConfigZoneSet_ID`)
) ENGINE=InnoDB AUTO_INCREMENT=250 DEFAULT CHARSET=cp1251;

--
-- Dumping data for table `configzoneset`
--

INSERT INTO `configzoneset` VALUES (247,'Record 22.09.2005 12:14:57','Description for record created at 22.09.2005 12:14:57',247,0,0),(248,'','',247,0,200812),(249,'','',247,0,200847);

--
-- Table structure for table `data_zones`
--

CREATE TABLE `data_zones` (
  `ID` int(11) NOT NULL AUTO_INCREMENT,
  `DataGps_ID` int(11) DEFAULT NULL,
  `Zone_ID` int(11) DEFAULT NULL,
  `Zone_IO` int(11) DEFAULT NULL,
  PRIMARY KEY (`ID`)
) ENGINE=InnoDB DEFAULT CHARSET=cp1251;

--
-- Dumping data for table `data_zones`
--


--
-- Table structure for table `datagps`
--

CREATE TABLE `datagps` (
  `DataGps_ID` int(11) NOT NULL AUTO_INCREMENT,
  `Mobitel_ID` int(11) DEFAULT '0',
  `Message_ID` int(11) DEFAULT '0',
  `Latitude` int(11) DEFAULT '0',
  `Longitude` int(11) DEFAULT '0',
  `Altitude` int(11) DEFAULT NULL,
  `UnixTime` int(11) DEFAULT '0',
  `Speed` smallint(6) DEFAULT '0',
  `Direction` int(11) NOT NULL DEFAULT '0',
  `Valid` tinyint(4) DEFAULT '1',
  `InMobitelID` int(11) DEFAULT NULL,
  `Events` int(10) unsigned DEFAULT '0',
  `Sensor1` tinyint(4) unsigned DEFAULT '0',
  `Sensor2` tinyint(4) unsigned DEFAULT '0',
  `Sensor3` tinyint(4) unsigned DEFAULT '0',
  `Sensor4` tinyint(4) unsigned DEFAULT '0',
  `Sensor5` tinyint(4) unsigned DEFAULT '0',
  `Sensor6` tinyint(4) unsigned DEFAULT '0',
  `Sensor7` tinyint(4) unsigned DEFAULT '0',
  `Sensor8` tinyint(4) unsigned DEFAULT '0',
  `LogID` int(11) DEFAULT '0',
  `isShow` tinyint(4) DEFAULT '0',
  `whatIs` smallint(6) unsigned DEFAULT '0',
  `Counter1` int(11) NOT NULL DEFAULT '-1',
  `Counter2` int(11) NOT NULL DEFAULT '-1',
  `Counter3` int(11) NOT NULL DEFAULT '-1',
  `Counter4` int(11) NOT NULL DEFAULT '-1',
  `SrvPacketID` bigint(20) NOT NULL DEFAULT '0' COMMENT 'ID серверного пакета в состав которого входит эта запись',
  PRIMARY KEY (`DataGps_ID`),
  UNIQUE KEY `BMC_MobitelID_LogID_UnixTime_UNIQUE` (`Mobitel_ID`,`LogID`,`UnixTime`),
  KEY `Index_3` (`Mobitel_ID`,`UnixTime`,`Valid`),
  KEY `IDX_MobitelIDSrvPacketID` (`Mobitel_ID`,`SrvPacketID`)
) ENGINE=InnoDB DEFAULT CHARSET=cp1251;

--
-- Dumping data for table `datagps`
--


--
-- Table structure for table `datagps64`
--

CREATE TABLE `datagps64` (
  `DataGps_ID` bigint(20) NOT NULL AUTO_INCREMENT,
  `Mobitel_ID` int(11) NOT NULL DEFAULT '0' COMMENT 'РљРѕРґ РўРµР»РµС‚СЂРµРєР°',
  `Latitude` int(11) NOT NULL DEFAULT '0' COMMENT 'РЁРёСЂРѕС‚Р°',
  `Longitude` int(11) NOT NULL DEFAULT '0' COMMENT 'Р”РѕР»РіРѕС‚Р°',
  `Direction` tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT 'РіСЂР°РґСѓСЃС‹/1.5',
  `Acceleration` int(11) NOT NULL DEFAULT '0' COMMENT 'РР·РјРµРЅРµРЅРёРµ СЃРєРѕСЂРѕСЃС‚Рё РїРѕ GPS Р·Р° РїРѕСЃР»РµРґРЅСЋСЋ СЃРµРєСѓРЅРґСѓ',
  `UnixTime` int(11) NOT NULL DEFAULT '0',
  `Speed` smallint(6) NOT NULL DEFAULT '0' COMMENT 'РЎРѕС‚РµРЅ РјРµС‚СЂРѕРІ РІ С‡Р°СЃ (0,1 РєРј/С‡)',
  `Valid` tinyint(1) NOT NULL DEFAULT '1',
  `Satellites` tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT 'РљРѕР»РёС‡РµСЃС‚РІРѕ СЃРїСѓС‚РЅРёРєРѕРІ ',
  `RssiGsm` tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT 'РЈСЂРѕРІРµРЅСЊ GSM СЃРёРіРЅР°Р»Р°',
  `Events` int(11) NOT NULL DEFAULT '0' COMMENT 'Р¤Р»Р°РіРё СЃРѕР±С‹С‚РёР№',
  `SensorsSet` tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT 'РљРѕРґ РЅР°Р±РѕСЂР° РґР°С‚С‡РёРєРѕРІ',
  `Sensors` varbinary(50) NOT NULL DEFAULT '0' COMMENT 'Р—РЅР°С‡РµРЅРёСЏ РґР°С‚С‡РёРєРѕРІ',
  `Voltage` tinyint(4) unsigned NOT NULL DEFAULT '0' COMMENT 'РќР°РїСЂСЏР¶РµРЅРёРµ РїРёС‚Р°РЅРёСЏ С‚РµРєСѓС‰РµРіРѕ РёСЃС‚РѕС‡РЅРёРєР°/1.5 РѕС‚ 0 РґРѕ 38,2',
  `DGPS` varchar(32) DEFAULT NULL,
  `LogID` int(11) NOT NULL DEFAULT '0' COMMENT 'РРґРµРЅС‚РёС„РёРєР°С‚РѕСЂ Р·Р°РїРёСЃРё РІ Р¶СѓСЂРЅР°Р»Рµ РўРµР»РµС‚СЂРµРєР°',
  `SrvPacketID` bigint(20) NOT NULL DEFAULT '0' COMMENT 'ID СЃРµСЂРІРµСЂРЅРѕРіРѕ РїР°РєРµС‚Р° РІ СЃРѕСЃС‚Р°РІ РєРѕС‚РѕСЂРѕРіРѕ РІС…РѕРґРёС‚ СЌС‚Р° Р·Р°РїРёСЃСЊ',
  PRIMARY KEY (`DataGps_ID`),
  UNIQUE KEY `BMC_MobitelID_LogID_UnixTime_UNIQUE` (`Mobitel_ID`,`LogID`,`UnixTime`),
  KEY `IDX_MobitelIDSrvPacketID64` (`Mobitel_ID`,`SrvPacketID`),
  KEY `Index_3_64` (`Mobitel_ID`,`UnixTime`,`Valid`),
  CONSTRAINT `FK_datagps64_mobitels_Mobitel_ID` FOREIGN KEY (`Mobitel_ID`) REFERENCES `mobitels` (`Mobitel_ID`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=cp1251;

--
-- Dumping data for table `datagps64`
--


--
-- Table structure for table `datagpsbuffer`
--

CREATE TABLE `datagpsbuffer` (
  `DataGps_ID` int(11) NOT NULL AUTO_INCREMENT,
  `Mobitel_ID` int(11) DEFAULT '0',
  `Message_ID` int(11) DEFAULT '0',
  `Latitude` int(11) DEFAULT '0',
  `Longitude` int(11) DEFAULT '0',
  `Altitude` int(11) DEFAULT NULL,
  `UnixTime` int(11) DEFAULT '0',
  `Speed` smallint(6) DEFAULT '0',
  `Direction` int(11) NOT NULL DEFAULT '0',
  `Valid` tinyint(4) DEFAULT '1',
  `InMobitelID` int(11) DEFAULT NULL,
  `Events` int(10) unsigned DEFAULT '0',
  `Sensor1` tinyint(4) unsigned DEFAULT '0',
  `Sensor2` tinyint(4) unsigned DEFAULT '0',
  `Sensor3` tinyint(4) unsigned DEFAULT '0',
  `Sensor4` tinyint(4) unsigned DEFAULT '0',
  `Sensor5` tinyint(4) unsigned DEFAULT '0',
  `Sensor6` tinyint(4) unsigned DEFAULT '0',
  `Sensor7` tinyint(4) unsigned DEFAULT '0',
  `Sensor8` tinyint(4) unsigned DEFAULT '0',
  `LogID` int(11) DEFAULT '0',
  `isShow` tinyint(4) DEFAULT '0',
  `whatIs` smallint(6) DEFAULT '0',
  `Counter1` int(11) NOT NULL DEFAULT '-1',
  `Counter2` int(11) NOT NULL DEFAULT '-1',
  `Counter3` int(11) NOT NULL DEFAULT '-1',
  `Counter4` int(11) NOT NULL DEFAULT '-1',
  PRIMARY KEY (`DataGps_ID`),
  KEY `IDX_MobitelIDLogID` (`Mobitel_ID`,`LogID`)
) ENGINE=InnoDB DEFAULT CHARSET=cp1251;

--
-- Dumping data for table `datagpsbuffer`
--


--
-- Table structure for table `datagpsbuffer_dr`
--

CREATE TABLE `datagpsbuffer_dr` (
  `Mobitel_ID` int(11) DEFAULT '0',
  `Message_ID` int(11) DEFAULT '0',
  `Latitude` int(11) NOT NULL DEFAULT '0',
  `Longitude` int(11) NOT NULL DEFAULT '0',
  `Altitude` int(11) DEFAULT '0',
  `UnixTime` int(11) NOT NULL DEFAULT '0',
  `Speed` smallint(6) NOT NULL DEFAULT '0',
  `Direction` int(11) NOT NULL DEFAULT '0',
  `Valid` tinyint(4) NOT NULL DEFAULT '1',
  `InMobitelID` int(11) DEFAULT '0',
  `Events` int(10) unsigned DEFAULT '0',
  `Sensor1` tinyint(4) unsigned DEFAULT '0',
  `Sensor2` tinyint(4) unsigned DEFAULT '0',
  `Sensor3` tinyint(4) unsigned DEFAULT '0',
  `Sensor4` tinyint(4) unsigned DEFAULT '0',
  `Sensor5` tinyint(4) unsigned DEFAULT '0',
  `Sensor6` tinyint(4) unsigned DEFAULT '0',
  `Sensor7` tinyint(4) unsigned DEFAULT '0',
  `Sensor8` tinyint(4) unsigned DEFAULT '0',
  `LogID` int(11) DEFAULT '0',
  `isShow` tinyint(4) DEFAULT '0',
  `whatIs` smallint(6) unsigned NOT NULL DEFAULT '0',
  `Counter1` int(11) NOT NULL DEFAULT '-1',
  `Counter2` int(11) NOT NULL DEFAULT '-1',
  `Counter3` int(11) NOT NULL DEFAULT '-1',
  `Counter4` int(11) NOT NULL DEFAULT '-1',
  KEY `IDX_MobitelIDLogID` (`Mobitel_ID`,`LogID`) USING BTREE,
  KEY `IDX_MobitelidUnixtime` (`Mobitel_ID`,`UnixTime`) USING BTREE,
  KEY `IDX_MobitelidUnixtimeValid` (`Mobitel_ID`,`UnixTime`,`Valid`) USING BTREE
) ENGINE=MEMORY DEFAULT CHARSET=cp1251 COMMENT='Буфер приема данных поступающих по socket-ам от телетреков';

--
-- Dumping data for table `datagpsbuffer_dr`
--


--
-- Table structure for table `datagpsbuffer_on`
--

CREATE TABLE `datagpsbuffer_on` (
  `Mobitel_ID` int(11) NOT NULL DEFAULT '0',
  `Message_ID` int(11) DEFAULT '0',
  `Latitude` int(11) NOT NULL DEFAULT '0',
  `Longitude` int(11) NOT NULL DEFAULT '0',
  `Altitude` int(11) DEFAULT NULL,
  `UnixTime` int(11) NOT NULL DEFAULT '0',
  `Speed` smallint(6) NOT NULL DEFAULT '0',
  `Direction` int(11) NOT NULL DEFAULT '0',
  `Valid` tinyint(4) NOT NULL DEFAULT '1',
  `InMobitelID` int(11) DEFAULT NULL,
  `Events` int(10) unsigned DEFAULT '0',
  `Sensor1` tinyint(4) unsigned DEFAULT '0',
  `Sensor2` tinyint(4) unsigned DEFAULT '0',
  `Sensor3` tinyint(4) unsigned DEFAULT '0',
  `Sensor4` tinyint(4) unsigned DEFAULT '0',
  `Sensor5` tinyint(4) unsigned DEFAULT '0',
  `Sensor6` tinyint(4) unsigned DEFAULT '0',
  `Sensor7` tinyint(4) unsigned DEFAULT '0',
  `Sensor8` tinyint(4) unsigned DEFAULT '0',
  `LogID` int(11) NOT NULL DEFAULT '0',
  `isShow` tinyint(4) DEFAULT '0',
  `whatIs` smallint(6) NOT NULL DEFAULT '0',
  `Counter1` int(11) NOT NULL DEFAULT '-1',
  `Counter2` int(11) NOT NULL DEFAULT '-1',
  `Counter3` int(11) NOT NULL DEFAULT '-1',
  `Counter4` int(11) NOT NULL DEFAULT '-1',
  `SrvPacketID` bigint(20) NOT NULL DEFAULT '0',
  KEY `IDX_MobitelidLogid` (`Mobitel_ID`,`LogID`) USING BTREE,
  KEY `IDX_MobitelidUnixtime` (`Mobitel_ID`,`UnixTime`) USING BTREE,
  KEY `IDX_MobitelidUnixtimeValid` (`Mobitel_ID`,`UnixTime`,`Valid`) USING BTREE,
  KEY `IDX_SrvPacketID` (`SrvPacketID`) USING BTREE
) ENGINE=MEMORY DEFAULT CHARSET=cp1251 COMMENT='Буфер онлайн данных';

--
-- Dumping data for table `datagpsbuffer_on`
--


--
-- Table structure for table `datagpsbuffer_on64`
--

CREATE TABLE `datagpsbuffer_on64` (
  `Mobitel_ID` int(11) NOT NULL DEFAULT '0' COMMENT 'РљРѕРґ РўРµР»РµС‚СЂРµРєР°',
  `Latitude` int(11) NOT NULL DEFAULT '0' COMMENT 'РЁРёСЂРѕС‚Р°',
  `Longitude` int(11) NOT NULL DEFAULT '0' COMMENT 'Р”РѕР»РіРѕС‚Р°',
  `Direction` tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT 'РіСЂР°РґСѓСЃС‹/1.5',
  `Acceleration` int(11) NOT NULL DEFAULT '0' COMMENT 'РР·РјРµРЅРµРЅРёРµ СЃРєРѕСЂРѕСЃС‚Рё РїРѕ GPS Р·Р° РїРѕСЃР»РµРґРЅСЋСЋ СЃРµРєСѓРЅРґСѓ',
  `UnixTime` int(11) NOT NULL DEFAULT '0',
  `Speed` smallint(6) NOT NULL DEFAULT '0' COMMENT 'РЎРѕС‚РµРЅ РјРµС‚СЂРѕРІ РІ С‡Р°СЃ (0,1 РєРј/С‡)',
  `Valid` tinyint(1) NOT NULL DEFAULT '1',
  `Satellites` tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT 'РљРѕР»РёС‡РµСЃС‚РІРѕ СЃРїСѓС‚РЅРёРєРѕРІ ',
  `RssiGsm` tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT 'РЈСЂРѕРІРµРЅСЊ GSM СЃРёРіРЅР°Р»Р°',
  `Events` int(11) NOT NULL DEFAULT '0' COMMENT 'Р¤Р»Р°РіРё СЃРѕР±С‹С‚РёР№',
  `SensorsSet` tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT 'РљРѕРґ РЅР°Р±РѕСЂР° РґР°С‚С‡РёРєРѕРІ',
  `Sensors` varbinary(50) NOT NULL DEFAULT '0' COMMENT 'Р—РЅР°С‡РµРЅРёСЏ РґР°С‚С‡РёРєРѕРІ',
  `Voltage` tinyint(4) unsigned NOT NULL DEFAULT '0' COMMENT 'РќР°РїСЂСЏР¶РµРЅРёРµ РїРёС‚Р°РЅРёСЏ С‚РµРєСѓС‰РµРіРѕ РёСЃС‚РѕС‡РЅРёРєР°/1.5 РѕС‚ 0 РґРѕ 38,2',
  `DGPS` varchar(32) NOT NULL DEFAULT '0' COMMENT 'Р”Р°РЅРЅС‹Рµ РґРёС„С„РµСЂРµРЅС†РёР°Р»СЊРЅРѕР№ СЃРёСЃС‚РµРјС‹ GPS - РІС‹СЃРѕС‚Р°,С€РёСЂРѕС‚Р°,РґРѕР»РіРѕС‚Р°',
  `LogID` int(11) NOT NULL DEFAULT '0' COMMENT 'РРґРµРЅС‚РёС„РёРєР°С‚РѕСЂ Р·Р°РїРёСЃРё РІ Р¶СѓСЂРЅР°Р»Рµ РўРµР»РµС‚СЂРµРєР°',
  `SrvPacketID` bigint(20) NOT NULL DEFAULT '0' COMMENT 'ID СЃРµСЂРІРµСЂРЅРѕРіРѕ РїР°РєРµС‚Р° РІ СЃРѕСЃС‚Р°РІ РєРѕС‚РѕСЂРѕРіРѕ РІС…РѕРґРёС‚ СЌС‚Р° Р·Р°РїРёСЃСЊ',
  KEY `IDX_MobitelidLogid_64` (`Mobitel_ID`,`LogID`) USING BTREE,
  KEY `IDX_MobitelidUnixtime_64` (`Mobitel_ID`,`UnixTime`) USING BTREE,
  KEY `IDX_MobitelidUnixtimeValid_64` (`Mobitel_ID`,`UnixTime`,`Valid`) USING BTREE,
  KEY `IDX_SrvPacketID_64` (`SrvPacketID`) USING BTREE,
  CONSTRAINT `FK_datagps64_mobitels_Mobitel_ID_1` FOREIGN KEY (`Mobitel_ID`) REFERENCES `mobitels` (`Mobitel_ID`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=cp1251;

--
-- Dumping data for table `datagpsbuffer_on64`
--


--
-- Table structure for table `datagpsbuffer_ontmp`
--

CREATE TABLE `datagpsbuffer_ontmp` (
  `Mobitel_ID` int(11) NOT NULL DEFAULT '0',
  `LogID` int(11) NOT NULL DEFAULT '0',
  `SrvPacketID` bigint(20) NOT NULL DEFAULT '0',
  KEY `IDX_MobitelidSrvpacketid` (`Mobitel_ID`,`SrvPacketID`) USING BTREE,
  KEY `IDX_Mobitelid` (`Mobitel_ID`) USING BTREE
) ENGINE=MEMORY DEFAULT CHARSET=cp1251 COMMENT='Временный вспомогательный буфер онлайн данных';

--
-- Dumping data for table `datagpsbuffer_ontmp`
--


--
-- Table structure for table `datagpsbuffer_ontmp64`
--

CREATE TABLE `datagpsbuffer_ontmp64` (
  `Mobitel_ID` int(11) NOT NULL DEFAULT '0' COMMENT 'РљРѕРґ РўРµР»РµС‚СЂРµРєР°',
  `LogID` int(11) unsigned DEFAULT '0' COMMENT 'РРґРµРЅС‚РёС„РёРєР°С‚РѕСЂ Р·Р°РїРёСЃРё РІ Р¶СѓСЂРЅР°Р»Рµ РўРµР»РµС‚СЂРµРєР°',
  `SrvPacketID` bigint(20) unsigned NOT NULL DEFAULT '0' COMMENT 'ID СЃРµСЂРІРµСЂРЅРѕРіРѕ РїР°РєРµС‚Р° РІ СЃРѕСЃС‚Р°РІ РєРѕС‚РѕСЂРѕРіРѕ РІС…РѕРґРёС‚ СЌС‚Р° Р·Р°РїРёСЃСЊ',
  KEY `IDX_Mobitelid64` (`Mobitel_ID`),
  KEY `IDX_MobitelidSrvpacketid64` (`Mobitel_ID`,`SrvPacketID`),
  CONSTRAINT `FK_datagps64_mobitels_Mobitel_ID_2` FOREIGN KEY (`Mobitel_ID`) REFERENCES `mobitels` (`Mobitel_ID`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=cp1251;

--
-- Dumping data for table `datagpsbuffer_ontmp64`
--


--
-- Table structure for table `datagpsbuffer_pop`
--

CREATE TABLE `datagpsbuffer_pop` (
  `Mobitel_ID` int(11) DEFAULT '0',
  `Message_ID` int(11) DEFAULT '0',
  `Latitude` int(11) NOT NULL DEFAULT '0',
  `Longitude` int(11) NOT NULL DEFAULT '0',
  `Altitude` int(11) DEFAULT '0',
  `UnixTime` int(11) NOT NULL DEFAULT '0',
  `Speed` smallint(6) NOT NULL DEFAULT '0',
  `Direction` int(11) NOT NULL DEFAULT '0',
  `Valid` tinyint(4) NOT NULL DEFAULT '1',
  `InMobitelID` int(11) DEFAULT '0',
  `Events` int(10) unsigned DEFAULT '0',
  `Sensor1` tinyint(4) unsigned DEFAULT '0',
  `Sensor2` tinyint(4) unsigned DEFAULT '0',
  `Sensor3` tinyint(4) unsigned DEFAULT '0',
  `Sensor4` tinyint(4) unsigned DEFAULT '0',
  `Sensor5` tinyint(4) unsigned DEFAULT '0',
  `Sensor6` tinyint(4) unsigned DEFAULT '0',
  `Sensor7` tinyint(4) unsigned DEFAULT '0',
  `Sensor8` tinyint(4) unsigned DEFAULT '0',
  `LogID` int(11) DEFAULT '0',
  `isShow` tinyint(4) DEFAULT '0',
  `whatIs` smallint(6) unsigned NOT NULL DEFAULT '0',
  `Counter1` int(11) NOT NULL DEFAULT '-1',
  `Counter2` int(11) NOT NULL DEFAULT '-1',
  `Counter3` int(11) NOT NULL DEFAULT '-1',
  `Counter4` int(11) NOT NULL DEFAULT '-1',
  KEY `IDX_MobitelIDLogID` (`Mobitel_ID`,`LogID`) USING BTREE,
  KEY `IDX_MobitelidUnixtime` (`Mobitel_ID`,`UnixTime`) USING BTREE,
  KEY `IDX_MobitelidUnixtimeValid` (`Mobitel_ID`,`UnixTime`,`Valid`) USING BTREE
) ENGINE=MEMORY DEFAULT CHARSET=cp1251 COMMENT='Буфер приема данных поступающих по POP3 протоколу';

--
-- Dumping data for table `datagpsbuffer_pop`
--


--
-- Table structure for table `datagpsbufferlite`
--

CREATE TABLE `datagpsbufferlite` (
  `DataGps_ID` int(11) NOT NULL AUTO_INCREMENT,
  `Mobitel_ID` int(11) DEFAULT '0',
  `Message_ID` int(11) DEFAULT '0',
  `Latitude` int(11) DEFAULT '0',
  `Longitude` int(11) DEFAULT '0',
  `Altitude` int(11) DEFAULT NULL,
  `UnixTime` int(11) DEFAULT '0',
  `Speed` smallint(6) DEFAULT '0',
  `Direction` int(11) NOT NULL DEFAULT '0',
  `Valid` tinyint(4) DEFAULT '1',
  `InMobitelID` int(11) DEFAULT NULL,
  `Events` int(10) unsigned DEFAULT '0',
  `Sensor1` tinyint(4) unsigned DEFAULT '0',
  `Sensor2` tinyint(4) unsigned DEFAULT '0',
  `Sensor3` tinyint(4) unsigned DEFAULT '0',
  `Sensor4` tinyint(4) unsigned DEFAULT '0',
  `Sensor5` tinyint(4) unsigned DEFAULT '0',
  `Sensor6` tinyint(4) unsigned DEFAULT '0',
  `Sensor7` tinyint(4) unsigned DEFAULT '0',
  `Sensor8` tinyint(4) unsigned DEFAULT '0',
  `LogID` int(11) DEFAULT '0',
  `isShow` tinyint(4) DEFAULT '0',
  `whatIs` smallint(6) DEFAULT '0',
  `Counter1` int(11) NOT NULL DEFAULT '-1',
  `Counter2` int(11) NOT NULL DEFAULT '-1',
  `Counter3` int(11) NOT NULL DEFAULT '-1',
  `Counter4` int(11) NOT NULL DEFAULT '-1',
  PRIMARY KEY (`DataGps_ID`)
) ENGINE=InnoDB DEFAULT CHARSET=cp1251;

--
-- Dumping data for table `datagpsbufferlite`
--


--
-- Table structure for table `datagpslost`
--

CREATE TABLE `datagpslost` (
  `Mobitel_ID` int(11) NOT NULL DEFAULT '0',
  `Begin_LogID` int(11) NOT NULL DEFAULT '0' COMMENT 'Значение LogID после которого начинается разрыв',
  `End_LogID` int(11) NOT NULL DEFAULT '0' COMMENT 'Значение LogID перед которым завершается разрыв',
  PRIMARY KEY (`Mobitel_ID`,`Begin_LogID`),
  KEY `IDX_MobitelID` (`Mobitel_ID`)
) ENGINE=InnoDB DEFAULT CHARSET=cp1251 COMMENT='Список пропусков в данных DataGPS пришодящих от RF-модемов';

--
-- Dumping data for table `datagpslost`
--


--
-- Table structure for table `datagpslost_on`
--

CREATE TABLE `datagpslost_on` (
  `Mobitel_ID` int(11) NOT NULL DEFAULT '0',
  `Begin_LogID` int(11) NOT NULL DEFAULT '0' COMMENT 'Значение LogID после которого начинается разрыв',
  `End_LogID` int(11) NOT NULL DEFAULT '0' COMMENT 'Значение LogID перед которым завершается разрыв',
  `Begin_SrvPacketID` bigint(20) NOT NULL DEFAULT '0',
  `End_SrvPacketID` bigint(20) NOT NULL DEFAULT '0',
  `Id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  PRIMARY KEY (`Mobitel_ID`,`Begin_LogID`),
  UNIQUE KEY `IDX_MobitelID_BeginSrvPacketID` (`Mobitel_ID`,`Begin_SrvPacketID`),
  UNIQUE KEY `Id` (`Id`),
  KEY `IDX_MobitelID` (`Mobitel_ID`)
) ENGINE=InnoDB DEFAULT CHARSET=cp1251 COMMENT='Пропуски в данных DataGPS, приходящих от Online сервера';

--
-- Dumping data for table `datagpslost_on`
--


--
-- Table structure for table `datagpslost_ontmp`
--

CREATE TABLE `datagpslost_ontmp` (
  `LogID` int(11) NOT NULL DEFAULT '0',
  `SrvPacketID` bigint(20) NOT NULL
) ENGINE=MEMORY DEFAULT CHARSET=cp1251 COMMENT='Используется исключительно процедурой OnLostDataGPS';

--
-- Dumping data for table `datagpslost_ontmp`
--


--
-- Table structure for table `datagpslost_rftmp`
--

CREATE TABLE `datagpslost_rftmp` (
  `LogID` int(11) DEFAULT '0'
) ENGINE=MEMORY DEFAULT CHARSET=cp1251 COMMENT='Используется исключительно процедурой LostDataGPS';

--
-- Dumping data for table `datagpslost_rftmp`
--


--
-- Table structure for table `datagpslosted`
--

CREATE TABLE `datagpslosted` (
  `Mobitel_ID` int(11) NOT NULL DEFAULT '0',
  `Begin_LogID` int(11) NOT NULL DEFAULT '0',
  `End_LogID` int(11) NOT NULL DEFAULT '0',
  PRIMARY KEY (`Mobitel_ID`,`Begin_LogID`)
) ENGINE=InnoDB DEFAULT CHARSET=cp1251;

--
-- Dumping data for table `datagpslosted`
--


--
-- Temporary view structure for view `datavalue1`
--

/*!50001 DROP VIEW IF EXISTS `datavalue1`*/;
/*!50001 CREATE VIEW `datavalue1` AS SELECT 
 1 AS `lon`,
 1 AS `lat`,
 1 AS `Mobitel_ID`,
 1 AS `Value`,
 1 AS `speed`,
 1 AS `time`,
 1 AS `sensor_id`,
 1 AS `datavalue_id`*/;

--
-- Temporary view structure for view `dataview`
--

/*!50001 DROP VIEW IF EXISTS `dataview`*/;
/*!50001 CREATE VIEW `dataview` AS SELECT 
 1 AS `DataGps_ID`,
 1 AS `Mobitel_ID`,
 1 AS `Lat`,
 1 AS `Lon`,
 1 AS `Altitude`,
 1 AS `time`,
 1 AS `speed`,
 1 AS `direction`,
 1 AS `Valid`,
 1 AS `sensor`,
 1 AS `Events`,
 1 AS `LogID`*/;

--
-- Temporary view structure for view `deviceview`
--

/*!50001 DROP VIEW IF EXISTS `deviceview`*/;
/*!50001 CREATE VIEW `deviceview` AS SELECT 
 1 AS `Mobitel_ID`,
 1 AS `Name`,
 1 AS `Descr`,
 1 AS `devIdShort`,
 1 AS `DeviceType`,
 1 AS `ConfirmedID`,
 1 AS `moduleIdRf`*/;

--
-- Table structure for table `driver`
--

CREATE TABLE `driver` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `Family` char(40) DEFAULT NULL COMMENT 'Фамилия',
  `Name` char(40) DEFAULT NULL COMMENT 'Имя',
  `ByrdDay` date DEFAULT NULL COMMENT 'Дата рождения',
  `Category` char(5) DEFAULT NULL COMMENT 'Категория',
  `Permis` char(20) DEFAULT NULL COMMENT 'Права',
  `foto` blob COMMENT 'фото',
  `Identifier` smallint(5) unsigned DEFAULT NULL COMMENT '10 битный идентификатор водителя',
  `OutLinkId` varchar(20) DEFAULT NULL COMMENT 'Код внешней базы',
  `idType` int(11) DEFAULT '0' COMMENT 'Код специализации водителя',
  `numTelephone` varchar(32) DEFAULT '' COMMENT 'Телефон водителя для связи',
  `Department` varchar(40) DEFAULT NULL COMMENT 'Организация водителя',
  PRIMARY KEY (`id`),
  UNIQUE KEY `id` (`id`) USING BTREE,
  UNIQUE KEY `UQ_Identifier` (`Identifier`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=cp1251;

--
-- Dumping data for table `driver`
--

INSERT INTO `driver` VALUES (1,'','','2009-01-01','с','1111',NULL,NULL,NULL,0,'',NULL),(2,'Водитель','','2009-01-22','с','1111',NULL,NULL,NULL,0,'',NULL);

--
-- Table structure for table `driver_types`
--

CREATE TABLE `driver_types` (
  `Id` int(11) NOT NULL AUTO_INCREMENT,
  `TypeName` varchar(50) DEFAULT NULL COMMENT 'Специализация водителя',
  PRIMARY KEY (`Id`),
  UNIQUE KEY `id` (`Id`)
) ENGINE=InnoDB DEFAULT CHARSET=cp1251;

--
-- Dumping data for table `driver_types`
--


--
-- Table structure for table `gpsmasks`
--

CREATE TABLE `gpsmasks` (
  `GpsMask_ID` int(11) NOT NULL AUTO_INCREMENT,
  `ID` int(11) DEFAULT '0',
  `Name` char(200) DEFAULT NULL,
  `Descr` char(200) DEFAULT NULL,
  `Mobitel_ID` int(11) DEFAULT '0',
  `Message_ID` int(11) DEFAULT '0',
  `LastRecords` int(11) DEFAULT '0',
  `LastTimes` int(11) DEFAULT '0',
  `LastTimesIndex` int(11) DEFAULT '0',
  `LastMeters` int(11) DEFAULT '0',
  `LastMetersIndex` int(11) DEFAULT '0',
  `MaxSmsNum` int(11) DEFAULT '0',
  `MaxSmsNumIndex` int(11) DEFAULT '0',
  `LatitudeStart` int(11) DEFAULT '0',
  `LatitudeEnd` int(11) DEFAULT '0',
  `LongitudeStart` int(11) DEFAULT '0',
  `LongitudeEnd` int(11) DEFAULT '0',
  `AltitudeStart` int(11) DEFAULT '0',
  `AltitudeEnd` int(11) DEFAULT '0',
  `UnixTimeStart` int(11) DEFAULT '0',
  `UnixTimeEnd` int(11) DEFAULT '0',
  `SpeedStart` int(11) DEFAULT '0',
  `SpeedEnd` int(11) DEFAULT '0',
  `DirectionStart` int(11) DEFAULT '0',
  `DirectionEnd` int(11) DEFAULT '0',
  `NumbersStart` int(11) DEFAULT '0',
  `NumbersEnd` int(11) DEFAULT '0',
  `WhatSend` int(1) DEFAULT '0',
  `CheckMask` int(11) DEFAULT '0',
  `InMobitelID` int(11) DEFAULT '0',
  `Events` int(11) DEFAULT '0',
  `Number1` int(11) DEFAULT '0',
  `Number2` int(11) DEFAULT '0',
  `Number3` int(11) DEFAULT '0',
  `Number4` int(11) DEFAULT '0',
  `Number5` int(11) DEFAULT '0',
  PRIMARY KEY (`GpsMask_ID`)
) ENGINE=InnoDB AUTO_INCREMENT=1134 DEFAULT CHARSET=cp1251;

--
-- Dumping data for table `gpsmasks`
--

INSERT INTO `gpsmasks` VALUES (1132,0,'','',97,200893,8,-10800,0,0,0,0,0,0,0,0,0,0,0,-10800,-10800,0,0,0,0,0,0,1023,1,0,0,0,0,0,0,0),(1133,0,'','',97,201039,100,-10800,0,0,0,0,0,0,0,0,0,0,0,-10800,-10800,0,0,0,0,0,0,1023,1,0,0,0,0,0,0,0);

--
-- Table structure for table `internalmobitelconfig`
--

CREATE TABLE `internalmobitelconfig` (
  `InternalMobitelConfig_ID` int(11) NOT NULL AUTO_INCREMENT,
  `Name` char(50) DEFAULT NULL,
  `Descr` char(200) DEFAULT NULL,
  `ID` int(11) DEFAULT '0',
  `Message_ID` int(11) DEFAULT '0',
  `devIdLong` char(16) DEFAULT NULL,
  `devIdShort` char(4) DEFAULT NULL,
  `verProtocolLong` char(16) DEFAULT NULL,
  `verProtocolShort` char(2) DEFAULT NULL,
  `moduleIdGps` char(50) DEFAULT NULL,
  `moduleIdGsm` char(50) DEFAULT NULL,
  `moduleIdRf` char(50) DEFAULT NULL,
  `RfType` smallint(6) NOT NULL DEFAULT '0',
  `ActiveRf` tinyint(1) NOT NULL DEFAULT '0',
  `moduleIdSs` char(50) DEFAULT NULL,
  `moduleIdMm` char(50) NOT NULL DEFAULT 'moduleIdMm',
  PRIMARY KEY (`InternalMobitelConfig_ID`),
  KEY `Index_3` (`Message_ID`),
  KEY `Index_4` (`devIdShort`),
  KEY `IDX_InternalmobitelconfigID` (`ID`)
) ENGINE=InnoDB AUTO_INCREMENT=807 DEFAULT CHARSET=cp1251;

--
-- Dumping data for table `internalmobitelconfig`
--

INSERT INTO `internalmobitelconfig` VALUES (789,'Record 22.09.2005 12:14:57','Description for record created at 22.09.2005 12:14:57',789,0,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,NULL,'moduleIdMm'),(790,'Record 22.09.2005 12:14:57','Description for record created at 22.09.2005 12:14:57',789,200801,'','3051','','','','','',0,0,'','moduleIdMm'),(791,'','',789,200803,'5040003TT201','3051','1.18','яя','яяяя','яяяя','яяяя',0,0,'яяяя','яяяя'),(801,'','',789,218878,'','','1.18','яя','яяяя','яяяя','яяяя',0,0,'яяяя','moduleIdMm'),(802,'','',789,1,'','2104','1.18','яя','яяяя','яяяя','яяяя',0,0,'яяяя','moduleIdMm'),(803,'','',803,0,'0','2658','0','0','0','0','0',0,0,'0','0'),(804,'','',804,0,'0','3978','0','0','0','0','0',0,0,'0','0'),(805,'','',805,0,'0','2840','0','0','0','0','0',0,0,'0','0'),(806,'','',806,0,'0','1408','0','0','0','0','0',0,0,'0','0');

--
-- Temporary view structure for view `internalmobitelconfigview`
--

/*!50001 DROP VIEW IF EXISTS `internalmobitelconfigview`*/;
/*!50001 CREATE VIEW `internalmobitelconfigview` AS SELECT 
 1 AS `ID`,
 1 AS `LastRecord`*/;

--
-- Table structure for table `lastmeters`
--

CREATE TABLE `lastmeters` (
  `LastMeter_ID` int(11) DEFAULT '0',
  `ID` int(11) DEFAULT '0',
  `Name` char(200) DEFAULT NULL,
  `Descr` char(200) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=cp1251;

--
-- Dumping data for table `lastmeters`
--

INSERT INTO `lastmeters` VALUES (200,2,'200 метров',NULL),(1000,3,'1 километр',NULL),(5000,4,'5 километров',NULL),(25000,5,'25 километров',NULL),(100000,6,'100 километров',NULL);

--
-- Table structure for table `lastrecords`
--

CREATE TABLE `lastrecords` (
  `LastRecord_ID` int(11) DEFAULT '0',
  `ID` int(11) DEFAULT '0',
  `Name` char(200) DEFAULT NULL,
  `Descr` char(200) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=cp1251;

--
-- Dumping data for table `lastrecords`
--

INSERT INTO `lastrecords` VALUES (5,1,'5 записей',NULL),(20,2,'20 записей',NULL),(50,3,'50 записей',NULL),(200,4,'200 записей',NULL),(1000,6,'1000 записей',NULL),(500,5,'500 записей',NULL),(3000,7,'3000 записей','3000 записей');

--
-- Table structure for table `lasttimes`
--

CREATE TABLE `lasttimes` (
  `LastTime_ID` int(11) DEFAULT '0',
  `ID` int(11) DEFAULT '0',
  `Name` char(200) DEFAULT NULL,
  `Descr` char(200) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=cp1251;

--
-- Dumping data for table `lasttimes`
--

INSERT INTO `lasttimes` VALUES (5,1,'5 минут',NULL),(20,2,'20 минут',NULL),(120,3,'2 часа',NULL),(360,4,'6 часов',NULL),(1440,5,'сутки',NULL);

--
-- Table structure for table `lines`
--

CREATE TABLE `lines` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `Color` int(11) DEFAULT '0' COMMENT 'Цвет',
  `Width` int(11) DEFAULT '3' COMMENT 'Толщина линии',
  `Mobitel_ID` int(11) DEFAULT NULL,
  `Icon` blob,
  PRIMARY KEY (`id`),
  KEY `lines_FK1` (`Mobitel_ID`) USING BTREE,
  CONSTRAINT `lines_FK1` FOREIGN KEY (`Mobitel_ID`) REFERENCES `mobitels` (`Mobitel_ID`)
) ENGINE=InnoDB AUTO_INCREMENT=10 DEFAULT CHARSET=cp1251 COMMENT='Описание линии';

--
-- Dumping data for table `lines`
--

INSERT INTO `lines` VALUES (5,-16777077,3,825503800,NULL),(6,-16777077,3,97,NULL),(7,-16777077,3,98,NULL),(8,-16777077,3,99,NULL),(9,-16777077,3,100,NULL);

--
-- Table structure for table `mapstyleglobal`
--

CREATE TABLE `mapstyleglobal` (
  `MapStyleGlobal_ID` int(11) NOT NULL AUTO_INCREMENT,
  `Name` char(50) DEFAULT NULL,
  `Descr` char(200) DEFAULT NULL,
  `ID` int(11) DEFAULT '0',
  `DefaultLineStyle_ID` int(11) DEFAULT '0',
  `DefaulPointStyle_ID` int(11) DEFAULT '0',
  `EventPointStyle1_ID` int(11) DEFAULT '0',
  `EventPointStyle2_ID` int(11) DEFAULT '0',
  `EventPointStyle3_ID` int(11) DEFAULT '0',
  `EventPointStyle4_ID` int(11) DEFAULT '0',
  `EventPointStyle5_ID` int(11) DEFAULT '0',
  `EventPointStyle6_ID` int(11) DEFAULT '0',
  `EventPointStyle7_ID` int(11) DEFAULT '0',
  `EventPointStyle8_ID` int(11) DEFAULT '0',
  `EventPointStyle9_ID` int(11) DEFAULT '0',
  `EventPointStyle10_ID` int(11) DEFAULT '0',
  `EventPointStyle11_ID` int(11) DEFAULT '0',
  `EventPointStyle12_ID` int(11) DEFAULT '0',
  `EventPointStyle13_ID` int(11) DEFAULT '0',
  `EventPointStyle14_ID` int(11) DEFAULT '0',
  `EventPointStyle15_ID` int(11) DEFAULT '0',
  `EventPointStyle16_ID` int(11) DEFAULT '0',
  `EventPointStyle17_ID` int(11) DEFAULT '0',
  `EventPointStyle18_ID` int(11) DEFAULT '0',
  `EventPointStyle19_ID` int(11) DEFAULT '0',
  `EventPointStyle20_ID` int(11) DEFAULT '0',
  `EventPointStyle21_ID` int(11) DEFAULT '0',
  `EventPointStyle22_ID` int(11) DEFAULT '0',
  `EventPointStyle23_ID` int(11) DEFAULT '0',
  `EventPointStyle24_ID` int(11) DEFAULT '0',
  `EventPointStyle25_ID` int(11) DEFAULT '0',
  `EventPointStyle26_ID` int(11) DEFAULT '0',
  `EventPointStyle27_ID` int(11) DEFAULT '0',
  `EventPointStyle28_ID` int(11) DEFAULT '0',
  `EventPointStyle29_ID` int(11) DEFAULT '0',
  `EventPointStyle30_ID` int(11) DEFAULT '0',
  `EventPointStyle31_ID` int(11) DEFAULT '0',
  `EventPointStyle32_ID` int(11) DEFAULT '0',
  `SensorPointStyle1_ID` int(11) DEFAULT '0',
  `SensorPointStyle2_ID` int(11) DEFAULT '0',
  `SensorPointStyle3_ID` int(11) DEFAULT '0',
  `SensorPointStyle4_ID` int(11) DEFAULT '0',
  `SensorPointStyle5_ID` int(11) DEFAULT '0',
  `SensorPointStyle6_ID` int(11) DEFAULT '0',
  `SensorPointStyle7_ID` int(11) DEFAULT '0',
  `SensorPointStyle8_ID` int(11) DEFAULT '0',
  PRIMARY KEY (`MapStyleGlobal_ID`)
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=cp1251;

--
-- Dumping data for table `mapstyleglobal`
--

INSERT INTO `mapstyleglobal` VALUES (1,'Настройка 1','Настнойки для Мобител',0,1,1,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0),(2,'Настнойки 4','Настнойки mob 4',0,2,2,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0),(3,'Настнойки 3','Настнойки для Мобител 3',0,3,3,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0),(4,'Tune 2','Настнойки для Мобител 2',0,4,4,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);

--
-- Table structure for table `mapstylelines`
--

CREATE TABLE `mapstylelines` (
  `MapStyleLine_ID` int(11) NOT NULL AUTO_INCREMENT,
  `Name` char(50) DEFAULT NULL,
  `Descr` char(200) DEFAULT NULL,
  `ID` int(11) DEFAULT '0',
  `Color` int(11) DEFAULT '0',
  `Width` tinyint(4) DEFAULT '0',
  `Style` tinyint(4) DEFAULT '0',
  PRIMARY KEY (`MapStyleLine_ID`)
) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=cp1251;

--
-- Dumping data for table `mapstylelines`
--

INSERT INTO `mapstylelines` VALUES (1,'Стиль линий Black','Описание',1,0,1,0),(2,'Стиль линий Blue','Стиль линий 2',2,16711680,4,0),(3,'Стиль линий Green','Стиль линий 3',3,32768,5,0),(4,'Стиль линий Red','Стиль линий 4',4,255,1,0),(6,'DEFAULT','Стиль по умолчанию',0,8388736,2,0),(8,'Style Fuchsia','Description for linestyle created at 13.08.2004 10:39:31',0,16711935,1,0);

--
-- Table structure for table `mapstylepoints`
--

CREATE TABLE `mapstylepoints` (
  `MapStylePoint_ID` int(11) NOT NULL AUTO_INCREMENT,
  `Name` char(50) DEFAULT NULL,
  `Descr` char(200) DEFAULT NULL,
  `ID` int(11) DEFAULT '0',
  `isBitmap` tinyint(1) DEFAULT NULL,
  `SymbolCode` tinyint(4) DEFAULT '0',
  `Color` int(11) DEFAULT '0',
  `Font` char(200) DEFAULT NULL,
  `Size` int(11) DEFAULT '0',
  `Rotation` int(11) DEFAULT '0',
  `BitmapName` char(200) DEFAULT NULL,
  `BitmapStyle` tinyint(4) DEFAULT '0',
  `Style` tinyint(4) DEFAULT '0',
  PRIMARY KEY (`MapStylePoint_ID`)
) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=cp1251;

--
-- Dumping data for table `mapstylepoints`
--

INSERT INTO `mapstylepoints` VALUES (2,'Blue Style','Стиль точек 1',2,0,0,16711680,NULL,3,0,NULL,0,0),(3,'Red Style','Стиль точек 2',3,0,0,255,NULL,4,0,NULL,0,0),(5,'DEFAULT','Стиль по умолчанию',0,0,0,128,NULL,5,0,NULL,0,0),(6,'Yellow Style','Стиль точек 3',4,0,0,65535,NULL,4,0,NULL,0,0),(8,'Fuchisia Style','Description for pointstyle created at 13.08.2004 10:39:45',0,0,0,16711935,NULL,3,0,NULL,0,0),(9,'Lime Style','Description for pointstyle created at 13.08.2004 10:41:19',0,0,0,65280,NULL,2,0,NULL,0,0),(10,'test','Description for pointstyle created at 06.12.2004 17:36:40',0,NULL,0,8421376,NULL,3,0,NULL,0,0);

--
-- Table structure for table `messages`
--

CREATE TABLE `messages` (
  `Message_ID` int(11) NOT NULL AUTO_INCREMENT,
  `Time1` int(11) DEFAULT '0',
  `Time2` int(11) DEFAULT '0',
  `Time3` int(11) DEFAULT '0',
  `Time4` int(11) DEFAULT '0',
  `isSend` tinyint(1) DEFAULT NULL,
  `isDelivered` tinyint(1) DEFAULT NULL,
  `isNew` tinyint(1) DEFAULT NULL,
  `Direction` tinyint(1) DEFAULT NULL,
  `Mobitel_ID` int(11) DEFAULT '0',
  `ServiceInit_ID` int(11) DEFAULT '0',
  `Command_ID` tinyint(4) DEFAULT '0',
  `CommandMask_ID` int(11) DEFAULT '0',
  `MessageCounter` int(11) DEFAULT '0',
  `DataFromService` char(32) DEFAULT NULL,
  `Address` char(20) DEFAULT NULL,
  `Source_ID` int(11) DEFAULT '0',
  `Crc` tinyint(4) DEFAULT '1',
  `SmsId` int(11) DEFAULT '0',
  `AdvCounter` int(11) NOT NULL DEFAULT '0',
  `isNewFromMob` tinyint(4) NOT NULL DEFAULT '1',
  PRIMARY KEY (`Message_ID`),
  KEY `Index_2` (`isNewFromMob`,`Message_ID`,`Time1`) USING BTREE,
  KEY `Index_6` (`isNew`,`Direction`,`ServiceInit_ID`),
  KEY `Index_4` (`Mobitel_ID`,`Command_ID`),
  KEY `Index_5` (`Mobitel_ID`,`MessageCounter`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=cp1251;

--
-- Dumping data for table `messages`
--

INSERT INTO `messages` VALUES (1,1509117147,0,0,0,0,0,1,1,97,1,17,0,1,'',NULL,0,1,0,0,0);

--
-- Table structure for table `mobitels`
--

CREATE TABLE `mobitels` (
  `Mobitel_ID` int(11) NOT NULL AUTO_INCREMENT,
  `Name` char(50) DEFAULT NULL,
  `Descr` char(200) DEFAULT NULL,
  `ID` bigint(20) DEFAULT '0',
  `Flags` int(11) DEFAULT '0',
  `ServiceInit_ID` int(11) DEFAULT '0',
  `ServiceSend_ID` int(11) DEFAULT '0',
  `InternalMobitelConfig_ID` int(11) DEFAULT '0',
  `MapStyleLine_ID` int(11) DEFAULT '0',
  `MapStyleLastPoint_ID` int(11) DEFAULT '0',
  `MapStylePoint_ID` int(11) DEFAULT '0',
  `Route_ID` int(11) DEFAULT '0',
  `DeviceType` int(11) DEFAULT '0',
  `DeviceEngine` int(11) DEFAULT '0',
  `ConfirmedID` int(11) NOT NULL DEFAULT '0' COMMENT 'MIN значение LogID менее которого считается нет пропусков или уже невозможно загрузить',
  `LastInsertTime` int(11) NOT NULL DEFAULT '0' COMMENT 'UNIX_TIMESTAMP Время последней вставки данных в DataGPS',
  `Is64bitPackets` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'передача данных идет 64 байтными пакетами',
  `IsNotDrawDgps` tinyint(1) NOT NULL DEFAULT '1' COMMENT 'РѕС‚РѕР±СЂР°Р¶Р°С‚СЊ РёР»Рё РЅРµС‚ РґР°РЅРЅС‹Рµ DGPS РЅР° РєР°СЂС‚Рµ',
  PRIMARY KEY (`Mobitel_ID`),
  KEY `IDX_InternalmobitelconfigID` (`InternalMobitelConfig_ID`)
) ENGINE=InnoDB AUTO_INCREMENT=825503801 DEFAULT CHARSET=cp1251;

--
-- Dumping data for table `mobitels`
--

INSERT INTO `mobitels` VALUES (97,'2104','+37282469826',0,0,0,250,789,6,8,3,0,0,0,0,1620394702,1,0),(98,'2658','+37254723831',0,0,0,257,803,6,5,5,0,0,0,0,1620394673,1,0),(99,'3978','+37254723835',0,0,0,259,804,6,5,5,0,0,0,0,1620394794,1,0),(100,'2840','+372575383900',0,0,0,261,805,6,5,5,0,0,0,0,1620394757,1,0),(825503800,'','',0,0,0,263,806,6,5,5,0,0,0,0,1620394733,1,1);

--
-- Table structure for table `mobitels_info`
--

CREATE TABLE `mobitels_info` (
  `Mobitel_ID` int(10) unsigned NOT NULL,
  `Map_Style_Car` text,
  `Track_Color` int(10) unsigned DEFAULT NULL,
  PRIMARY KEY (`Mobitel_ID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

--
-- Dumping data for table `mobitels_info`
--

INSERT INTO `mobitels_info` VALUES (79,'object TDrawersGroup\r\n  DrawMode = gdmDrawAll\r\n  object TPointIconDrawer\r\n    AdjustSize = False\r\n    Image_Data = {\r\n      0000010001001313000000000000E80400001600000028000000130000002600\r\n      00000100180000000000C0040000000000000000000000000000000000000000\r\n      00FFA284FFA284FFA284FFA284FFA284FFA284FFA284FFA284FFA284FFA284FF\r\n      A284FFA284FFA284FFA284FFA284FFA284FFA284000000000000FFA284FFA284\r\n      0000000000000000000000000000000000000000000000000000000000000000\r\n      00000000000000000000000000FFA284FFA284000000FFA28400000000000000\r\n      0000000000000000000000800000800000800000800000800000000000000000\r\n      000000000000000000000000FFA284000000FFA2840000000000000000000000\r\n      00800000800000800000FFFFFFFFFFFFFFFFFF80000080000080000000000000\r\n      0000000000000000FFA284000000FFA284000000000000000000800000800000\r\n      FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF8000008000000000000000\r\n      00000000FFA284000000FFA284000000000000800000800000800000FFFFFFFF\r\n      FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF800000800000800000000000000000\r\n      FFA284000000FFA284000000000000800000FFFFFF800000800000FFFFFFFFFF\r\n      FFFFFFFFFFFFFFFFFFFF800000800000FFFFFF800000000000000000FFA28400\r\n      0000FFA284000000800000800000FFFFFFFFFFFF800000800000800000FFFFFF\r\n      800000800000800000FFFFFFFFFFFF800000800000000000FFA284000000FFA2\r\n      84000000800000FFFFFFFFFFFFFFFFFFFFFFFF80000080000080000080000080\r\n      0000FFFFFFFFFFFFFFFFFFF0FBFF800000000000FFA284000000FFA284000000\r\n      800000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF800000800000800000FFFFFFFFFF\r\n      FFFFFFFFFFFFFFF0FBFF800000000000FFA284000000FFA28400000080000080\r\n      0000FFFFFFFFFFFFFFFFFFFFFFFF800000800000800000FFFFFFFFFFFFFFFFFF\r\n      FFFFFF800000800000000000FFA284000000FFA284000000000000800000FFFF\r\n      FFFFFFFFFFFFFFFFFFFFFFFFFF800000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF80\r\n      0000000000000000FFA284000000FFA284000000000000800000800000FFFFFF\r\n      FFFFFFFFFFFFFFFFFF800000FFFFFFFFFFFFFFFFFFFFFFFF8000008000000000\r\n      00000000FFA284000000FFA284000000000000000000800000FFFFFFFFFFFFFF\r\n      FFFFFFFFFF800000FFFFFFFFFFFFFFFFFFFFFFFF800000000000000000000000\r\n      FFA284000000FFA284000000000000000000000000800000800000FFFFFFFFFF\r\n      FF800000FFFFFFFFFFFF800000800000000000000000000000000000FFA28400\r\n      0000FFA284000000000000000000000000000000800000800000800000800000\r\n      800000800000800000000000000000000000000000000000FFA284000000FFA2\r\n      8400000000000000000000000000000000000000000000000000000000000000\r\n      0000000000000000000000000000000000000000FFA284000000FFA284FFA284\r\n      0000000000000000000000000000000000000000000000000000000000000000\r\n      00000000000000000000000000FFA284FFA284000000000000FFA284FFA284FF\r\n      A284FFA284FFA284FFA284FFA284FFA284FFA284FFA284FFA284FFA284FFA284\r\n      FFA284FFA284FFA284FFA28400000000000080003FFF3FFF9FFF7E0FDFFF7803\r\n      DFFF7001DFFF6000DFFF6000DFFF40005FFF40005FFF40005FFF40005FFF6000\r\n      DFFF6000DFFF7001DFFF7803DFFF7C07DFFF7FFFDFFF3FFF9FFF80003FFF}\r\n  end\r\n  object TPointTextDrawer\r\n    Font.Charset = RUSSIAN_CHARSET\r\n    Font.Color = clBlack\r\n    Font.Height = -11\r\n    Font.Name = \'Arial\'\r\n    Font.Style = []\r\n    OutlineColor = clWhite\r\n    VAlignment = vaTop\r\n    HAlignment = haLeft\r\n  end\r\nend',NULL),(97,'object TDrawersGroup\r\n  DrawMode = gdmDrawAll\r\n  object TPointIconDrawer\r\n    AdjustSize = False\r\n    Image_Data = {\r\n      0000010001001313000000000000E80400001600000028000000130000002600\r\n      00000100180000000000C0040000000000000000000000000000000000000000\r\n      00FFA284FFA284FFA284FFA284FFA284FFA284FFA284FFA284FFA284FFA284FF\r\n      A284FFA284FFA284FFA284FFA284FFA284FFA284000000000000FFA284FFA284\r\n      0000000000000000000000000000000000000000000000000000000000000000\r\n      00000000000000000000000000FFA284FFA284000000FFA28400000000000000\r\n      0000000000000000000000800000800000800000800000800000000000000000\r\n      000000000000000000000000FFA284000000FFA2840000000000000000000000\r\n      00800000800000800000FFFFFFFFFFFFFFFFFF80000080000080000000000000\r\n      0000000000000000FFA284000000FFA284000000000000000000800000800000\r\n      FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF8000008000000000000000\r\n      00000000FFA284000000FFA284000000000000800000800000800000FFFFFFFF\r\n      FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF800000800000800000000000000000\r\n      FFA284000000FFA284000000000000800000FFFFFF800000800000FFFFFFFFFF\r\n      FFFFFFFFFFFFFFFFFFFF800000800000FFFFFF800000000000000000FFA28400\r\n      0000FFA284000000800000800000FFFFFFFFFFFF800000800000800000FFFFFF\r\n      800000800000800000FFFFFFFFFFFF800000800000000000FFA284000000FFA2\r\n      84000000800000FFFFFFFFFFFFFFFFFFFFFFFF80000080000080000080000080\r\n      0000FFFFFFFFFFFFFFFFFFF0FBFF800000000000FFA284000000FFA284000000\r\n      800000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF800000800000800000FFFFFFFFFF\r\n      FFFFFFFFFFFFFFF0FBFF800000000000FFA284000000FFA28400000080000080\r\n      0000FFFFFFFFFFFFFFFFFFFFFFFF800000800000800000FFFFFFFFFFFFFFFFFF\r\n      FFFFFF800000800000000000FFA284000000FFA284000000000000800000FFFF\r\n      FFFFFFFFFFFFFFFFFFFFFFFFFF800000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF80\r\n      0000000000000000FFA284000000FFA284000000000000800000800000FFFFFF\r\n      FFFFFFFFFFFFFFFFFF800000FFFFFFFFFFFFFFFFFFFFFFFF8000008000000000\r\n      00000000FFA284000000FFA284000000000000000000800000FFFFFFFFFFFFFF\r\n      FFFFFFFFFF800000FFFFFFFFFFFFFFFFFFFFFFFF800000000000000000000000\r\n      FFA284000000FFA284000000000000000000000000800000800000FFFFFFFFFF\r\n      FF800000FFFFFFFFFFFF800000800000000000000000000000000000FFA28400\r\n      0000FFA284000000000000000000000000000000800000800000800000800000\r\n      800000800000800000000000000000000000000000000000FFA284000000FFA2\r\n      8400000000000000000000000000000000000000000000000000000000000000\r\n      0000000000000000000000000000000000000000FFA284000000FFA284FFA284\r\n      0000000000000000000000000000000000000000000000000000000000000000\r\n      00000000000000000000000000FFA284FFA284000000000000FFA284FFA284FF\r\n      A284FFA284FFA284FFA284FFA284FFA284FFA284FFA284FFA284FFA284FFA284\r\n      FFA284FFA284FFA284FFA28400000000000080003FFF3FFF9FFF7E0FDFFF7803\r\n      DFFF7001DFFF6000DFFF6000DFFF40005FFF40005FFF40005FFF40005FFF6000\r\n      DFFF6000DFFF7001DFFF7803DFFF7C07DFFF7FFFDFFF3FFF9FFF80003FFF}\r\n  end\r\n  object TPointTextDrawer\r\n    Font.Charset = RUSSIAN_CHARSET\r\n    Font.Color = clBlack\r\n    Font.Height = -11\r\n    Font.Name = \'Arial\'\r\n    Font.Style = []\r\n    OutlineColor = clWhite\r\n    VAlignment = vaTop\r\n    HAlignment = haLeft\r\n  end\r\nend',NULL),(98,'object TDrawersGroup\r\n  DrawMode = gdmDrawAll\r\n  object TPointIconDrawer\r\n    AdjustSize = False\r\n    Image_Data = {\r\n      0000010001001313000000000000E80400001600000028000000130000002600\r\n      00000100180000000000C0040000000000000000000000000000000000000000\r\n      00FFA284FFA284FFA284FFA284FFA284FFA284FFA284FFA284FFA284FFA284FF\r\n      A284FFA284FFA284FFA284FFA284FFA284FFA284000000000000FFA284FFA284\r\n      0000000000000000000000000000000000000000000000000000000000000000\r\n      00000000000000000000000000FFA284FFA284000000FFA28400000000000000\r\n      0000000000000000000000800000800000800000800000800000000000000000\r\n      000000000000000000000000FFA284000000FFA2840000000000000000000000\r\n      00800000800000800000FFFFFFFFFFFFFFFFFF80000080000080000000000000\r\n      0000000000000000FFA284000000FFA284000000000000000000800000800000\r\n      FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF8000008000000000000000\r\n      00000000FFA284000000FFA284000000000000800000800000800000FFFFFFFF\r\n      FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF800000800000800000000000000000\r\n      FFA284000000FFA284000000000000800000FFFFFF800000800000FFFFFFFFFF\r\n      FFFFFFFFFFFFFFFFFFFF800000800000FFFFFF800000000000000000FFA28400\r\n      0000FFA284000000800000800000FFFFFFFFFFFF800000800000800000FFFFFF\r\n      800000800000800000FFFFFFFFFFFF800000800000000000FFA284000000FFA2\r\n      84000000800000FFFFFFFFFFFFFFFFFFFFFFFF80000080000080000080000080\r\n      0000FFFFFFFFFFFFFFFFFFF0FBFF800000000000FFA284000000FFA284000000\r\n      800000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF800000800000800000FFFFFFFFFF\r\n      FFFFFFFFFFFFFFF0FBFF800000000000FFA284000000FFA28400000080000080\r\n      0000FFFFFFFFFFFFFFFFFFFFFFFF800000800000800000FFFFFFFFFFFFFFFFFF\r\n      FFFFFF800000800000000000FFA284000000FFA284000000000000800000FFFF\r\n      FFFFFFFFFFFFFFFFFFFFFFFFFF800000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF80\r\n      0000000000000000FFA284000000FFA284000000000000800000800000FFFFFF\r\n      FFFFFFFFFFFFFFFFFF800000FFFFFFFFFFFFFFFFFFFFFFFF8000008000000000\r\n      00000000FFA284000000FFA284000000000000000000800000FFFFFFFFFFFFFF\r\n      FFFFFFFFFF800000FFFFFFFFFFFFFFFFFFFFFFFF800000000000000000000000\r\n      FFA284000000FFA284000000000000000000000000800000800000FFFFFFFFFF\r\n      FF800000FFFFFFFFFFFF800000800000000000000000000000000000FFA28400\r\n      0000FFA284000000000000000000000000000000800000800000800000800000\r\n      800000800000800000000000000000000000000000000000FFA284000000FFA2\r\n      8400000000000000000000000000000000000000000000000000000000000000\r\n      0000000000000000000000000000000000000000FFA284000000FFA284FFA284\r\n      0000000000000000000000000000000000000000000000000000000000000000\r\n      00000000000000000000000000FFA284FFA284000000000000FFA284FFA284FF\r\n      A284FFA284FFA284FFA284FFA284FFA284FFA284FFA284FFA284FFA284FFA284\r\n      FFA284FFA284FFA284FFA28400000000000080003FFF3FFF9FFF7E0FDFFF7803\r\n      DFFF7001DFFF6000DFFF6000DFFF40005FFF40005FFF40005FFF40005FFF6000\r\n      DFFF6000DFFF7001DFFF7803DFFF7C07DFFF7FFFDFFF3FFF9FFF80003FFF}\r\n  end\r\n  object TPointTextDrawer\r\n    Font.Charset = RUSSIAN_CHARSET\r\n    Font.Color = clBlack\r\n    Font.Height = -11\r\n    Font.Name = \'Arial\'\r\n    Font.Style = []\r\n    OutlineColor = clWhite\r\n    VAlignment = vaTop\r\n    HAlignment = haLeft\r\n  end\r\nend',NULL),(99,'object TDrawersGroup\r\n  DrawMode = gdmDrawAll\r\n  object TPointIconDrawer\r\n    AdjustSize = False\r\n    Image_Data = {\r\n      0000010001001313000000000000E80400001600000028000000130000002600\r\n      00000100180000000000C0040000000000000000000000000000000000000000\r\n      00FFA284FFA284FFA284FFA284FFA284FFA284FFA284FFA284FFA284FFA284FF\r\n      A284FFA284FFA284FFA284FFA284FFA284FFA284000000000000FFA284FFA284\r\n      0000000000000000000000000000000000000000000000000000000000000000\r\n      00000000000000000000000000FFA284FFA284000000FFA28400000000000000\r\n      0000000000000000000000800000800000800000800000800000000000000000\r\n      000000000000000000000000FFA284000000FFA2840000000000000000000000\r\n      00800000800000800000FFFFFFFFFFFFFFFFFF80000080000080000000000000\r\n      0000000000000000FFA284000000FFA284000000000000000000800000800000\r\n      FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF8000008000000000000000\r\n      00000000FFA284000000FFA284000000000000800000800000800000FFFFFFFF\r\n      FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF800000800000800000000000000000\r\n      FFA284000000FFA284000000000000800000FFFFFF800000800000FFFFFFFFFF\r\n      FFFFFFFFFFFFFFFFFFFF800000800000FFFFFF800000000000000000FFA28400\r\n      0000FFA284000000800000800000FFFFFFFFFFFF800000800000800000FFFFFF\r\n      800000800000800000FFFFFFFFFFFF800000800000000000FFA284000000FFA2\r\n      84000000800000FFFFFFFFFFFFFFFFFFFFFFFF80000080000080000080000080\r\n      0000FFFFFFFFFFFFFFFFFFF0FBFF800000000000FFA284000000FFA284000000\r\n      800000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF800000800000800000FFFFFFFFFF\r\n      FFFFFFFFFFFFFFF0FBFF800000000000FFA284000000FFA28400000080000080\r\n      0000FFFFFFFFFFFFFFFFFFFFFFFF800000800000800000FFFFFFFFFFFFFFFFFF\r\n      FFFFFF800000800000000000FFA284000000FFA284000000000000800000FFFF\r\n      FFFFFFFFFFFFFFFFFFFFFFFFFF800000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF80\r\n      0000000000000000FFA284000000FFA284000000000000800000800000FFFFFF\r\n      FFFFFFFFFFFFFFFFFF800000FFFFFFFFFFFFFFFFFFFFFFFF8000008000000000\r\n      00000000FFA284000000FFA284000000000000000000800000FFFFFFFFFFFFFF\r\n      FFFFFFFFFF800000FFFFFFFFFFFFFFFFFFFFFFFF800000000000000000000000\r\n      FFA284000000FFA284000000000000000000000000800000800000FFFFFFFFFF\r\n      FF800000FFFFFFFFFFFF800000800000000000000000000000000000FFA28400\r\n      0000FFA284000000000000000000000000000000800000800000800000800000\r\n      800000800000800000000000000000000000000000000000FFA284000000FFA2\r\n      8400000000000000000000000000000000000000000000000000000000000000\r\n      0000000000000000000000000000000000000000FFA284000000FFA284FFA284\r\n      0000000000000000000000000000000000000000000000000000000000000000\r\n      00000000000000000000000000FFA284FFA284000000000000FFA284FFA284FF\r\n      A284FFA284FFA284FFA284FFA284FFA284FFA284FFA284FFA284FFA284FFA284\r\n      FFA284FFA284FFA284FFA28400000000000080003FFF3FFF9FFF7E0FDFFF7803\r\n      DFFF7001DFFF6000DFFF6000DFFF40005FFF40005FFF40005FFF40005FFF6000\r\n      DFFF6000DFFF7001DFFF7803DFFF7C07DFFF7FFFDFFF3FFF9FFF80003FFF}\r\n  end\r\n  object TPointTextDrawer\r\n    Font.Charset = RUSSIAN_CHARSET\r\n    Font.Color = clBlack\r\n    Font.Height = -11\r\n    Font.Name = \'Arial\'\r\n    Font.Style = []\r\n    OutlineColor = clWhite\r\n    VAlignment = vaTop\r\n    HAlignment = haLeft\r\n  end\r\nend',NULL),(100,'object TDrawersGroup\r\n  DrawMode = gdmDrawAll\r\n  object TPointIconDrawer\r\n    AdjustSize = False\r\n    Image_Data = {\r\n      0000010001001313000000000000E80400001600000028000000130000002600\r\n      00000100180000000000C0040000000000000000000000000000000000000000\r\n      00FFA284FFA284FFA284FFA284FFA284FFA284FFA284FFA284FFA284FFA284FF\r\n      A284FFA284FFA284FFA284FFA284FFA284FFA284000000000000FFA284FFA284\r\n      0000000000000000000000000000000000000000000000000000000000000000\r\n      00000000000000000000000000FFA284FFA284000000FFA28400000000000000\r\n      0000000000000000000000800000800000800000800000800000000000000000\r\n      000000000000000000000000FFA284000000FFA2840000000000000000000000\r\n      00800000800000800000FFFFFFFFFFFFFFFFFF80000080000080000000000000\r\n      0000000000000000FFA284000000FFA284000000000000000000800000800000\r\n      FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF8000008000000000000000\r\n      00000000FFA284000000FFA284000000000000800000800000800000FFFFFFFF\r\n      FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF800000800000800000000000000000\r\n      FFA284000000FFA284000000000000800000FFFFFF800000800000FFFFFFFFFF\r\n      FFFFFFFFFFFFFFFFFFFF800000800000FFFFFF800000000000000000FFA28400\r\n      0000FFA284000000800000800000FFFFFFFFFFFF800000800000800000FFFFFF\r\n      800000800000800000FFFFFFFFFFFF800000800000000000FFA284000000FFA2\r\n      84000000800000FFFFFFFFFFFFFFFFFFFFFFFF80000080000080000080000080\r\n      0000FFFFFFFFFFFFFFFFFFF0FBFF800000000000FFA284000000FFA284000000\r\n      800000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF800000800000800000FFFFFFFFFF\r\n      FFFFFFFFFFFFFFF0FBFF800000000000FFA284000000FFA28400000080000080\r\n      0000FFFFFFFFFFFFFFFFFFFFFFFF800000800000800000FFFFFFFFFFFFFFFFFF\r\n      FFFFFF800000800000000000FFA284000000FFA284000000000000800000FFFF\r\n      FFFFFFFFFFFFFFFFFFFFFFFFFF800000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF80\r\n      0000000000000000FFA284000000FFA284000000000000800000800000FFFFFF\r\n      FFFFFFFFFFFFFFFFFF800000FFFFFFFFFFFFFFFFFFFFFFFF8000008000000000\r\n      00000000FFA284000000FFA284000000000000000000800000FFFFFFFFFFFFFF\r\n      FFFFFFFFFF800000FFFFFFFFFFFFFFFFFFFFFFFF800000000000000000000000\r\n      FFA284000000FFA284000000000000000000000000800000800000FFFFFFFFFF\r\n      FF800000FFFFFFFFFFFF800000800000000000000000000000000000FFA28400\r\n      0000FFA284000000000000000000000000000000800000800000800000800000\r\n      800000800000800000000000000000000000000000000000FFA284000000FFA2\r\n      8400000000000000000000000000000000000000000000000000000000000000\r\n      0000000000000000000000000000000000000000FFA284000000FFA284FFA284\r\n      0000000000000000000000000000000000000000000000000000000000000000\r\n      00000000000000000000000000FFA284FFA284000000000000FFA284FFA284FF\r\n      A284FFA284FFA284FFA284FFA284FFA284FFA284FFA284FFA284FFA284FFA284\r\n      FFA284FFA284FFA284FFA28400000000000080003FFF3FFF9FFF7E0FDFFF7803\r\n      DFFF7001DFFF6000DFFF6000DFFF40005FFF40005FFF40005FFF40005FFF6000\r\n      DFFF6000DFFF7001DFFF7803DFFF7C07DFFF7FFFDFFF3FFF9FFF80003FFF}\r\n  end\r\n  object TPointTextDrawer\r\n    Font.Charset = RUSSIAN_CHARSET\r\n    Font.Color = clBlack\r\n    Font.Height = -11\r\n    Font.Name = \'Arial\'\r\n    Font.Style = []\r\n    OutlineColor = clWhite\r\n    VAlignment = vaTop\r\n    HAlignment = haLeft\r\n  end\r\nend',NULL),(101,'object TDrawersGroup\r\n  DrawMode = gdmDrawAll\r\n  object TPointIconDrawer\r\n    AdjustSize = False\r\n    Image_Data = {\r\n      0000010001001313000000000000E80400001600000028000000130000002600\r\n      00000100180000000000C0040000000000000000000000000000000000000000\r\n      00FFA284FFA284FFA284FFA284FFA284FFA284FFA284FFA284FFA284FFA284FF\r\n      A284FFA284FFA284FFA284FFA284FFA284FFA284000000000000FFA284FFA284\r\n      0000000000000000000000000000000000000000000000000000000000000000\r\n      00000000000000000000000000FFA284FFA284000000FFA28400000000000000\r\n      0000000000000000000000800000800000800000800000800000000000000000\r\n      000000000000000000000000FFA284000000FFA2840000000000000000000000\r\n      00800000800000800000FFFFFFFFFFFFFFFFFF80000080000080000000000000\r\n      0000000000000000FFA284000000FFA284000000000000000000800000800000\r\n      FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF8000008000000000000000\r\n      00000000FFA284000000FFA284000000000000800000800000800000FFFFFFFF\r\n      FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF800000800000800000000000000000\r\n      FFA284000000FFA284000000000000800000FFFFFF800000800000FFFFFFFFFF\r\n      FFFFFFFFFFFFFFFFFFFF800000800000FFFFFF800000000000000000FFA28400\r\n      0000FFA284000000800000800000FFFFFFFFFFFF800000800000800000FFFFFF\r\n      800000800000800000FFFFFFFFFFFF800000800000000000FFA284000000FFA2\r\n      84000000800000FFFFFFFFFFFFFFFFFFFFFFFF80000080000080000080000080\r\n      0000FFFFFFFFFFFFFFFFFFF0FBFF800000000000FFA284000000FFA284000000\r\n      800000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF800000800000800000FFFFFFFFFF\r\n      FFFFFFFFFFFFFFF0FBFF800000000000FFA284000000FFA28400000080000080\r\n      0000FFFFFFFFFFFFFFFFFFFFFFFF800000800000800000FFFFFFFFFFFFFFFFFF\r\n      FFFFFF800000800000000000FFA284000000FFA284000000000000800000FFFF\r\n      FFFFFFFFFFFFFFFFFFFFFFFFFF800000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF80\r\n      0000000000000000FFA284000000FFA284000000000000800000800000FFFFFF\r\n      FFFFFFFFFFFFFFFFFF800000FFFFFFFFFFFFFFFFFFFFFFFF8000008000000000\r\n      00000000FFA284000000FFA284000000000000000000800000FFFFFFFFFFFFFF\r\n      FFFFFFFFFF800000FFFFFFFFFFFFFFFFFFFFFFFF800000000000000000000000\r\n      FFA284000000FFA284000000000000000000000000800000800000FFFFFFFFFF\r\n      FF800000FFFFFFFFFFFF800000800000000000000000000000000000FFA28400\r\n      0000FFA284000000000000000000000000000000800000800000800000800000\r\n      800000800000800000000000000000000000000000000000FFA284000000FFA2\r\n      8400000000000000000000000000000000000000000000000000000000000000\r\n      0000000000000000000000000000000000000000FFA284000000FFA284FFA284\r\n      0000000000000000000000000000000000000000000000000000000000000000\r\n      00000000000000000000000000FFA284FFA284000000000000FFA284FFA284FF\r\n      A284FFA284FFA284FFA284FFA284FFA284FFA284FFA284FFA284FFA284FFA284\r\n      FFA284FFA284FFA284FFA28400000000000080003FFF3FFF9FFF7E0FDFFF7803\r\n      DFFF7001DFFF6000DFFF6000DFFF40005FFF40005FFF40005FFF40005FFF6000\r\n      DFFF6000DFFF7001DFFF7803DFFF7C07DFFF7FFFDFFF3FFF9FFF80003FFF}\r\n  end\r\n  object TPointTextDrawer\r\n    Font.Charset = RUSSIAN_CHARSET\r\n    Font.Color = clBlack\r\n    Font.Height = -11\r\n    Font.Name = \'Arial\'\r\n    Font.Style = []\r\n    OutlineColor = clWhite\r\n    VAlignment = vaTop\r\n    HAlignment = haLeft\r\n  end\r\nend',NULL),(102,'object TDrawersGroup\r\n  DrawMode = gdmDrawAll\r\n  object TPointIconDrawer\r\n    AdjustSize = False\r\n    Image_Data = {\r\n      0000010001001313000000000000E80400001600000028000000130000002600\r\n      00000100180000000000C0040000000000000000000000000000000000000000\r\n      00FFA284FFA284FFA284FFA284FFA284FFA284FFA284FFA284FFA284FFA284FF\r\n      A284FFA284FFA284FFA284FFA284FFA284FFA284000000000000FFA284FFA284\r\n      0000000000000000000000000000000000000000000000000000000000000000\r\n      00000000000000000000000000FFA284FFA284000000FFA28400000000000000\r\n      0000000000000000000000800000800000800000800000800000000000000000\r\n      000000000000000000000000FFA284000000FFA2840000000000000000000000\r\n      00800000800000800000FFFFFFFFFFFFFFFFFF80000080000080000000000000\r\n      0000000000000000FFA284000000FFA284000000000000000000800000800000\r\n      FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF8000008000000000000000\r\n      00000000FFA284000000FFA284000000000000800000800000800000FFFFFFFF\r\n      FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF800000800000800000000000000000\r\n      FFA284000000FFA284000000000000800000FFFFFF800000800000FFFFFFFFFF\r\n      FFFFFFFFFFFFFFFFFFFF800000800000FFFFFF800000000000000000FFA28400\r\n      0000FFA284000000800000800000FFFFFFFFFFFF800000800000800000FFFFFF\r\n      800000800000800000FFFFFFFFFFFF800000800000000000FFA284000000FFA2\r\n      84000000800000FFFFFFFFFFFFFFFFFFFFFFFF80000080000080000080000080\r\n      0000FFFFFFFFFFFFFFFFFFF0FBFF800000000000FFA284000000FFA284000000\r\n      800000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF800000800000800000FFFFFFFFFF\r\n      FFFFFFFFFFFFFFF0FBFF800000000000FFA284000000FFA28400000080000080\r\n      0000FFFFFFFFFFFFFFFFFFFFFFFF800000800000800000FFFFFFFFFFFFFFFFFF\r\n      FFFFFF800000800000000000FFA284000000FFA284000000000000800000FFFF\r\n      FFFFFFFFFFFFFFFFFFFFFFFFFF800000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF80\r\n      0000000000000000FFA284000000FFA284000000000000800000800000FFFFFF\r\n      FFFFFFFFFFFFFFFFFF800000FFFFFFFFFFFFFFFFFFFFFFFF8000008000000000\r\n      00000000FFA284000000FFA284000000000000000000800000FFFFFFFFFFFFFF\r\n      FFFFFFFFFF800000FFFFFFFFFFFFFFFFFFFFFFFF800000000000000000000000\r\n      FFA284000000FFA284000000000000000000000000800000800000FFFFFFFFFF\r\n      FF800000FFFFFFFFFFFF800000800000000000000000000000000000FFA28400\r\n      0000FFA284000000000000000000000000000000800000800000800000800000\r\n      800000800000800000000000000000000000000000000000FFA284000000FFA2\r\n      8400000000000000000000000000000000000000000000000000000000000000\r\n      0000000000000000000000000000000000000000FFA284000000FFA284FFA284\r\n      0000000000000000000000000000000000000000000000000000000000000000\r\n      00000000000000000000000000FFA284FFA284000000000000FFA284FFA284FF\r\n      A284FFA284FFA284FFA284FFA284FFA284FFA284FFA284FFA284FFA284FFA284\r\n      FFA284FFA284FFA284FFA28400000000000080003FFF3FFF9FFF7E0FDFFF7803\r\n      DFFF7001DFFF6000DFFF6000DFFF40005FFF40005FFF40005FFF40005FFF6000\r\n      DFFF6000DFFF7001DFFF7803DFFF7C07DFFF7FFFDFFF3FFF9FFF80003FFF}\r\n  end\r\n  object TPointTextDrawer\r\n    Font.Charset = RUSSIAN_CHARSET\r\n    Font.Color = clBlack\r\n    Font.Height = -11\r\n    Font.Name = \'Arial\'\r\n    Font.Style = []\r\n    OutlineColor = clWhite\r\n    VAlignment = vaTop\r\n    HAlignment = haLeft\r\n  end\r\nend',NULL),(103,'object TDrawersGroup\r\n  DrawMode = gdmDrawAll\r\n  object TPointIconDrawer\r\n    AdjustSize = False\r\n    Image_Data = {\r\n      0000010001001313000000000000E80400001600000028000000130000002600\r\n      00000100180000000000C0040000000000000000000000000000000000000000\r\n      00FFA284FFA284FFA284FFA284FFA284FFA284FFA284FFA284FFA284FFA284FF\r\n      A284FFA284FFA284FFA284FFA284FFA284FFA284000000000000FFA284FFA284\r\n      0000000000000000000000000000000000000000000000000000000000000000\r\n      00000000000000000000000000FFA284FFA284000000FFA28400000000000000\r\n      0000000000000000000000800000800000800000800000800000000000000000\r\n      000000000000000000000000FFA284000000FFA2840000000000000000000000\r\n      00800000800000800000FFFFFFFFFFFFFFFFFF80000080000080000000000000\r\n      0000000000000000FFA284000000FFA284000000000000000000800000800000\r\n      FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF8000008000000000000000\r\n      00000000FFA284000000FFA284000000000000800000800000800000FFFFFFFF\r\n      FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF800000800000800000000000000000\r\n      FFA284000000FFA284000000000000800000FFFFFF800000800000FFFFFFFFFF\r\n      FFFFFFFFFFFFFFFFFFFF800000800000FFFFFF800000000000000000FFA28400\r\n      0000FFA284000000800000800000FFFFFFFFFFFF800000800000800000FFFFFF\r\n      800000800000800000FFFFFFFFFFFF800000800000000000FFA284000000FFA2\r\n      84000000800000FFFFFFFFFFFFFFFFFFFFFFFF80000080000080000080000080\r\n      0000FFFFFFFFFFFFFFFFFFF0FBFF800000000000FFA284000000FFA284000000\r\n      800000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF800000800000800000FFFFFFFFFF\r\n      FFFFFFFFFFFFFFF0FBFF800000000000FFA284000000FFA28400000080000080\r\n      0000FFFFFFFFFFFFFFFFFFFFFFFF800000800000800000FFFFFFFFFFFFFFFFFF\r\n      FFFFFF800000800000000000FFA284000000FFA284000000000000800000FFFF\r\n      FFFFFFFFFFFFFFFFFFFFFFFFFF800000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF80\r\n      0000000000000000FFA284000000FFA284000000000000800000800000FFFFFF\r\n      FFFFFFFFFFFFFFFFFF800000FFFFFFFFFFFFFFFFFFFFFFFF8000008000000000\r\n      00000000FFA284000000FFA284000000000000000000800000FFFFFFFFFFFFFF\r\n      FFFFFFFFFF800000FFFFFFFFFFFFFFFFFFFFFFFF800000000000000000000000\r\n      FFA284000000FFA284000000000000000000000000800000800000FFFFFFFFFF\r\n      FF800000FFFFFFFFFFFF800000800000000000000000000000000000FFA28400\r\n      0000FFA284000000000000000000000000000000800000800000800000800000\r\n      800000800000800000000000000000000000000000000000FFA284000000FFA2\r\n      8400000000000000000000000000000000000000000000000000000000000000\r\n      0000000000000000000000000000000000000000FFA284000000FFA284FFA284\r\n      0000000000000000000000000000000000000000000000000000000000000000\r\n      00000000000000000000000000FFA284FFA284000000000000FFA284FFA284FF\r\n      A284FFA284FFA284FFA284FFA284FFA284FFA284FFA284FFA284FFA284FFA284\r\n      FFA284FFA284FFA284FFA28400000000000080003FFF3FFF9FFF7E0FDFFF7803\r\n      DFFF7001DFFF6000DFFF6000DFFF40005FFF40005FFF40005FFF40005FFF6000\r\n      DFFF6000DFFF7001DFFF7803DFFF7C07DFFF7FFFDFFF3FFF9FFF80003FFF}\r\n  end\r\n  object TPointTextDrawer\r\n    Font.Charset = RUSSIAN_CHARSET\r\n    Font.Color = clBlack\r\n    Font.Height = -11\r\n    Font.Name = \'Arial\'\r\n    Font.Style = []\r\n    OutlineColor = clWhite\r\n    VAlignment = vaTop\r\n    HAlignment = haLeft\r\n  end\r\nend',NULL),(104,'object TDrawersGroup\r\n  DrawMode = gdmDrawAll\r\n  object TPointIconDrawer\r\n    AdjustSize = False\r\n    Image_Data = {\r\n      0000010001001313000000000000E80400001600000028000000130000002600\r\n      00000100180000000000C0040000000000000000000000000000000000000000\r\n      00FFA284FFA284FFA284FFA284FFA284FFA284FFA284FFA284FFA284FFA284FF\r\n      A284FFA284FFA284FFA284FFA284FFA284FFA284000000000000FFA284FFA284\r\n      0000000000000000000000000000000000000000000000000000000000000000\r\n      00000000000000000000000000FFA284FFA284000000FFA28400000000000000\r\n      0000000000000000000000800000800000800000800000800000000000000000\r\n      000000000000000000000000FFA284000000FFA2840000000000000000000000\r\n      00800000800000800000FFFFFFFFFFFFFFFFFF80000080000080000000000000\r\n      0000000000000000FFA284000000FFA284000000000000000000800000800000\r\n      FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF8000008000000000000000\r\n      00000000FFA284000000FFA284000000000000800000800000800000FFFFFFFF\r\n      FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF800000800000800000000000000000\r\n      FFA284000000FFA284000000000000800000FFFFFF800000800000FFFFFFFFFF\r\n      FFFFFFFFFFFFFFFFFFFF800000800000FFFFFF800000000000000000FFA28400\r\n      0000FFA284000000800000800000FFFFFFFFFFFF800000800000800000FFFFFF\r\n      800000800000800000FFFFFFFFFFFF800000800000000000FFA284000000FFA2\r\n      84000000800000FFFFFFFFFFFFFFFFFFFFFFFF80000080000080000080000080\r\n      0000FFFFFFFFFFFFFFFFFFF0FBFF800000000000FFA284000000FFA284000000\r\n      800000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF800000800000800000FFFFFFFFFF\r\n      FFFFFFFFFFFFFFF0FBFF800000000000FFA284000000FFA28400000080000080\r\n      0000FFFFFFFFFFFFFFFFFFFFFFFF800000800000800000FFFFFFFFFFFFFFFFFF\r\n      FFFFFF800000800000000000FFA284000000FFA284000000000000800000FFFF\r\n      FFFFFFFFFFFFFFFFFFFFFFFFFF800000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF80\r\n      0000000000000000FFA284000000FFA284000000000000800000800000FFFFFF\r\n      FFFFFFFFFFFFFFFFFF800000FFFFFFFFFFFFFFFFFFFFFFFF8000008000000000\r\n      00000000FFA284000000FFA284000000000000000000800000FFFFFFFFFFFFFF\r\n      FFFFFFFFFF800000FFFFFFFFFFFFFFFFFFFFFFFF800000000000000000000000\r\n      FFA284000000FFA284000000000000000000000000800000800000FFFFFFFFFF\r\n      FF800000FFFFFFFFFFFF800000800000000000000000000000000000FFA28400\r\n      0000FFA284000000000000000000000000000000800000800000800000800000\r\n      800000800000800000000000000000000000000000000000FFA284000000FFA2\r\n      8400000000000000000000000000000000000000000000000000000000000000\r\n      0000000000000000000000000000000000000000FFA284000000FFA284FFA284\r\n      0000000000000000000000000000000000000000000000000000000000000000\r\n      00000000000000000000000000FFA284FFA284000000000000FFA284FFA284FF\r\n      A284FFA284FFA284FFA284FFA284FFA284FFA284FFA284FFA284FFA284FFA284\r\n      FFA284FFA284FFA284FFA28400000000000080003FFF3FFF9FFF7E0FDFFF7803\r\n      DFFF7001DFFF6000DFFF6000DFFF40005FFF40005FFF40005FFF40005FFF6000\r\n      DFFF6000DFFF7001DFFF7803DFFF7C07DFFF7FFFDFFF3FFF9FFF80003FFF}\r\n  end\r\n  object TPointTextDrawer\r\n    Font.Charset = RUSSIAN_CHARSET\r\n    Font.Color = clBlack\r\n    Font.Height = -11\r\n    Font.Name = \'Arial\'\r\n    Font.Style = []\r\n    OutlineColor = clWhite\r\n    VAlignment = vaTop\r\n    HAlignment = haLeft\r\n  end\r\nend',NULL),(105,'object TDrawersGroup\r\n  DrawMode = gdmDrawAll\r\n  object TPointIconDrawer\r\n    AdjustSize = False\r\n    Image_Data = {\r\n      0000010001001313000000000000E80400001600000028000000130000002600\r\n      00000100180000000000C0040000000000000000000000000000000000000000\r\n      00FFA284FFA284FFA284FFA284FFA284FFA284FFA284FFA284FFA284FFA284FF\r\n      A284FFA284FFA284FFA284FFA284FFA284FFA284000000000000FFA284FFA284\r\n      0000000000000000000000000000000000000000000000000000000000000000\r\n      00000000000000000000000000FFA284FFA284000000FFA28400000000000000\r\n      0000000000000000000000800000800000800000800000800000000000000000\r\n      000000000000000000000000FFA284000000FFA2840000000000000000000000\r\n      00800000800000800000FFFFFFFFFFFFFFFFFF80000080000080000000000000\r\n      0000000000000000FFA284000000FFA284000000000000000000800000800000\r\n      FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF8000008000000000000000\r\n      00000000FFA284000000FFA284000000000000800000800000800000FFFFFFFF\r\n      FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF800000800000800000000000000000\r\n      FFA284000000FFA284000000000000800000FFFFFF800000800000FFFFFFFFFF\r\n      FFFFFFFFFFFFFFFFFFFF800000800000FFFFFF800000000000000000FFA28400\r\n      0000FFA284000000800000800000FFFFFFFFFFFF800000800000800000FFFFFF\r\n      800000800000800000FFFFFFFFFFFF800000800000000000FFA284000000FFA2\r\n      84000000800000FFFFFFFFFFFFFFFFFFFFFFFF80000080000080000080000080\r\n      0000FFFFFFFFFFFFFFFFFFF0FBFF800000000000FFA284000000FFA284000000\r\n      800000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF800000800000800000FFFFFFFFFF\r\n      FFFFFFFFFFFFFFF0FBFF800000000000FFA284000000FFA28400000080000080\r\n      0000FFFFFFFFFFFFFFFFFFFFFFFF800000800000800000FFFFFFFFFFFFFFFFFF\r\n      FFFFFF800000800000000000FFA284000000FFA284000000000000800000FFFF\r\n      FFFFFFFFFFFFFFFFFFFFFFFFFF800000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF80\r\n      0000000000000000FFA284000000FFA284000000000000800000800000FFFFFF\r\n      FFFFFFFFFFFFFFFFFF800000FFFFFFFFFFFFFFFFFFFFFFFF8000008000000000\r\n      00000000FFA284000000FFA284000000000000000000800000FFFFFFFFFFFFFF\r\n      FFFFFFFFFF800000FFFFFFFFFFFFFFFFFFFFFFFF800000000000000000000000\r\n      FFA284000000FFA284000000000000000000000000800000800000FFFFFFFFFF\r\n      FF800000FFFFFFFFFFFF800000800000000000000000000000000000FFA28400\r\n      0000FFA284000000000000000000000000000000800000800000800000800000\r\n      800000800000800000000000000000000000000000000000FFA284000000FFA2\r\n      8400000000000000000000000000000000000000000000000000000000000000\r\n      0000000000000000000000000000000000000000FFA284000000FFA284FFA284\r\n      0000000000000000000000000000000000000000000000000000000000000000\r\n      00000000000000000000000000FFA284FFA284000000000000FFA284FFA284FF\r\n      A284FFA284FFA284FFA284FFA284FFA284FFA284FFA284FFA284FFA284FFA284\r\n      FFA284FFA284FFA284FFA28400000000000080003FFF3FFF9FFF7E0FDFFF7803\r\n      DFFF7001DFFF6000DFFF6000DFFF40005FFF40005FFF40005FFF40005FFF6000\r\n      DFFF6000DFFF7001DFFF7803DFFF7C07DFFF7FFFDFFF3FFF9FFF80003FFF}\r\n  end\r\n  object TPointTextDrawer\r\n    Font.Charset = RUSSIAN_CHARSET\r\n    Font.Color = clBlack\r\n    Font.Height = -11\r\n    Font.Name = \'Arial\'\r\n    Font.Style = []\r\n    OutlineColor = clWhite\r\n    VAlignment = vaTop\r\n    HAlignment = haLeft\r\n  end\r\nend',NULL),(106,'object TDrawersGroup\r\n  DrawMode = gdmDrawAll\r\n  object TPointIconDrawer\r\n    AdjustSize = False\r\n    Image_Data = {\r\n      0000010001001313000000000000E80400001600000028000000130000002600\r\n      00000100180000000000C0040000000000000000000000000000000000000000\r\n      00FFA284FFA284FFA284FFA284FFA284FFA284FFA284FFA284FFA284FFA284FF\r\n      A284FFA284FFA284FFA284FFA284FFA284FFA284000000000000FFA284FFA284\r\n      0000000000000000000000000000000000000000000000000000000000000000\r\n      00000000000000000000000000FFA284FFA284000000FFA28400000000000000\r\n      0000000000000000000000800000800000800000800000800000000000000000\r\n      000000000000000000000000FFA284000000FFA2840000000000000000000000\r\n      00800000800000800000FFFFFFFFFFFFFFFFFF80000080000080000000000000\r\n      0000000000000000FFA284000000FFA284000000000000000000800000800000\r\n      FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF8000008000000000000000\r\n      00000000FFA284000000FFA284000000000000800000800000800000FFFFFFFF\r\n      FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF800000800000800000000000000000\r\n      FFA284000000FFA284000000000000800000FFFFFF800000800000FFFFFFFFFF\r\n      FFFFFFFFFFFFFFFFFFFF800000800000FFFFFF800000000000000000FFA28400\r\n      0000FFA284000000800000800000FFFFFFFFFFFF800000800000800000FFFFFF\r\n      800000800000800000FFFFFFFFFFFF800000800000000000FFA284000000FFA2\r\n      84000000800000FFFFFFFFFFFFFFFFFFFFFFFF80000080000080000080000080\r\n      0000FFFFFFFFFFFFFFFFFFF0FBFF800000000000FFA284000000FFA284000000\r\n      800000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF800000800000800000FFFFFFFFFF\r\n      FFFFFFFFFFFFFFF0FBFF800000000000FFA284000000FFA28400000080000080\r\n      0000FFFFFFFFFFFFFFFFFFFFFFFF800000800000800000FFFFFFFFFFFFFFFFFF\r\n      FFFFFF800000800000000000FFA284000000FFA284000000000000800000FFFF\r\n      FFFFFFFFFFFFFFFFFFFFFFFFFF800000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF80\r\n      0000000000000000FFA284000000FFA284000000000000800000800000FFFFFF\r\n      FFFFFFFFFFFFFFFFFF800000FFFFFFFFFFFFFFFFFFFFFFFF8000008000000000\r\n      00000000FFA284000000FFA284000000000000000000800000FFFFFFFFFFFFFF\r\n      FFFFFFFFFF800000FFFFFFFFFFFFFFFFFFFFFFFF800000000000000000000000\r\n      FFA284000000FFA284000000000000000000000000800000800000FFFFFFFFFF\r\n      FF800000FFFFFFFFFFFF800000800000000000000000000000000000FFA28400\r\n      0000FFA284000000000000000000000000000000800000800000800000800000\r\n      800000800000800000000000000000000000000000000000FFA284000000FFA2\r\n      8400000000000000000000000000000000000000000000000000000000000000\r\n      0000000000000000000000000000000000000000FFA284000000FFA284FFA284\r\n      0000000000000000000000000000000000000000000000000000000000000000\r\n      00000000000000000000000000FFA284FFA284000000000000FFA284FFA284FF\r\n      A284FFA284FFA284FFA284FFA284FFA284FFA284FFA284FFA284FFA284FFA284\r\n      FFA284FFA284FFA284FFA28400000000000080003FFF3FFF9FFF7E0FDFFF7803\r\n      DFFF7001DFFF6000DFFF6000DFFF40005FFF40005FFF40005FFF40005FFF6000\r\n      DFFF6000DFFF7001DFFF7803DFFF7C07DFFF7FFFDFFF3FFF9FFF80003FFF}\r\n  end\r\n  object TPointTextDrawer\r\n    Font.Charset = RUSSIAN_CHARSET\r\n    Font.Color = clBlack\r\n    Font.Height = -11\r\n    Font.Name = \'Arial\'\r\n    Font.Style = []\r\n    OutlineColor = clWhite\r\n    VAlignment = vaTop\r\n    HAlignment = haLeft\r\n  end\r\nend',NULL),(107,'object TDrawersGroup\r\n  DrawMode = gdmDrawAll\r\n  object TPointIconDrawer\r\n    AdjustSize = False\r\n    Image_Data = {\r\n      0000010001001313000000000000E80400001600000028000000130000002600\r\n      00000100180000000000C0040000000000000000000000000000000000000000\r\n      00FFA284FFA284FFA284FFA284FFA284FFA284FFA284FFA284FFA284FFA284FF\r\n      A284FFA284FFA284FFA284FFA284FFA284FFA284000000000000FFA284FFA284\r\n      0000000000000000000000000000000000000000000000000000000000000000\r\n      00000000000000000000000000FFA284FFA284000000FFA28400000000000000\r\n      0000000000000000000000800000800000800000800000800000000000000000\r\n      000000000000000000000000FFA284000000FFA2840000000000000000000000\r\n      00800000800000800000FFFFFFFFFFFFFFFFFF80000080000080000000000000\r\n      0000000000000000FFA284000000FFA284000000000000000000800000800000\r\n      FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF8000008000000000000000\r\n      00000000FFA284000000FFA284000000000000800000800000800000FFFFFFFF\r\n      FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF800000800000800000000000000000\r\n      FFA284000000FFA284000000000000800000FFFFFF800000800000FFFFFFFFFF\r\n      FFFFFFFFFFFFFFFFFFFF800000800000FFFFFF800000000000000000FFA28400\r\n      0000FFA284000000800000800000FFFFFFFFFFFF800000800000800000FFFFFF\r\n      800000800000800000FFFFFFFFFFFF800000800000000000FFA284000000FFA2\r\n      84000000800000FFFFFFFFFFFFFFFFFFFFFFFF80000080000080000080000080\r\n      0000FFFFFFFFFFFFFFFFFFF0FBFF800000000000FFA284000000FFA284000000\r\n      800000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF800000800000800000FFFFFFFFFF\r\n      FFFFFFFFFFFFFFF0FBFF800000000000FFA284000000FFA28400000080000080\r\n      0000FFFFFFFFFFFFFFFFFFFFFFFF800000800000800000FFFFFFFFFFFFFFFFFF\r\n      FFFFFF800000800000000000FFA284000000FFA284000000000000800000FFFF\r\n      FFFFFFFFFFFFFFFFFFFFFFFFFF800000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF80\r\n      0000000000000000FFA284000000FFA284000000000000800000800000FFFFFF\r\n      FFFFFFFFFFFFFFFFFF800000FFFFFFFFFFFFFFFFFFFFFFFF8000008000000000\r\n      00000000FFA284000000FFA284000000000000000000800000FFFFFFFFFFFFFF\r\n      FFFFFFFFFF800000FFFFFFFFFFFFFFFFFFFFFFFF800000000000000000000000\r\n      FFA284000000FFA284000000000000000000000000800000800000FFFFFFFFFF\r\n      FF800000FFFFFFFFFFFF800000800000000000000000000000000000FFA28400\r\n      0000FFA284000000000000000000000000000000800000800000800000800000\r\n      800000800000800000000000000000000000000000000000FFA284000000FFA2\r\n      8400000000000000000000000000000000000000000000000000000000000000\r\n      0000000000000000000000000000000000000000FFA284000000FFA284FFA284\r\n      0000000000000000000000000000000000000000000000000000000000000000\r\n      00000000000000000000000000FFA284FFA284000000000000FFA284FFA284FF\r\n      A284FFA284FFA284FFA284FFA284FFA284FFA284FFA284FFA284FFA284FFA284\r\n      FFA284FFA284FFA284FFA28400000000000080003FFF3FFF9FFF7E0FDFFF7803\r\n      DFFF7001DFFF6000DFFF6000DFFF40005FFF40005FFF40005FFF40005FFF6000\r\n      DFFF6000DFFF7001DFFF7803DFFF7C07DFFF7FFFDFFF3FFF9FFF80003FFF}\r\n  end\r\n  object TPointTextDrawer\r\n    Font.Charset = RUSSIAN_CHARSET\r\n    Font.Color = clBlack\r\n    Font.Height = -11\r\n    Font.Name = \'Arial\'\r\n    Font.Style = []\r\n    OutlineColor = clWhite\r\n    VAlignment = vaTop\r\n    HAlignment = haLeft\r\n  end\r\nend',NULL),(108,'object TDrawersGroup\r\n  DrawMode = gdmDrawAll\r\n  object TPointIconDrawer\r\n    AdjustSize = False\r\n    Image_Data = {\r\n      0000010001001313000000000000E80400001600000028000000130000002600\r\n      00000100180000000000C0040000000000000000000000000000000000000000\r\n      00FFA284FFA284FFA284FFA284FFA284FFA284FFA284FFA284FFA284FFA284FF\r\n      A284FFA284FFA284FFA284FFA284FFA284FFA284000000000000FFA284FFA284\r\n      0000000000000000000000000000000000000000000000000000000000000000\r\n      00000000000000000000000000FFA284FFA284000000FFA28400000000000000\r\n      0000000000000000000000800000800000800000800000800000000000000000\r\n      000000000000000000000000FFA284000000FFA2840000000000000000000000\r\n      00800000800000800000FFFFFFFFFFFFFFFFFF80000080000080000000000000\r\n      0000000000000000FFA284000000FFA284000000000000000000800000800000\r\n      FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF8000008000000000000000\r\n      00000000FFA284000000FFA284000000000000800000800000800000FFFFFFFF\r\n      FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF800000800000800000000000000000\r\n      FFA284000000FFA284000000000000800000FFFFFF800000800000FFFFFFFFFF\r\n      FFFFFFFFFFFFFFFFFFFF800000800000FFFFFF800000000000000000FFA28400\r\n      0000FFA284000000800000800000FFFFFFFFFFFF800000800000800000FFFFFF\r\n      800000800000800000FFFFFFFFFFFF800000800000000000FFA284000000FFA2\r\n      84000000800000FFFFFFFFFFFFFFFFFFFFFFFF80000080000080000080000080\r\n      0000FFFFFFFFFFFFFFFFFFF0FBFF800000000000FFA284000000FFA284000000\r\n      800000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF800000800000800000FFFFFFFFFF\r\n      FFFFFFFFFFFFFFF0FBFF800000000000FFA284000000FFA28400000080000080\r\n      0000FFFFFFFFFFFFFFFFFFFFFFFF800000800000800000FFFFFFFFFFFFFFFFFF\r\n      FFFFFF800000800000000000FFA284000000FFA284000000000000800000FFFF\r\n      FFFFFFFFFFFFFFFFFFFFFFFFFF800000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF80\r\n      0000000000000000FFA284000000FFA284000000000000800000800000FFFFFF\r\n      FFFFFFFFFFFFFFFFFF800000FFFFFFFFFFFFFFFFFFFFFFFF8000008000000000\r\n      00000000FFA284000000FFA284000000000000000000800000FFFFFFFFFFFFFF\r\n      FFFFFFFFFF800000FFFFFFFFFFFFFFFFFFFFFFFF800000000000000000000000\r\n      FFA284000000FFA284000000000000000000000000800000800000FFFFFFFFFF\r\n      FF800000FFFFFFFFFFFF800000800000000000000000000000000000FFA28400\r\n      0000FFA284000000000000000000000000000000800000800000800000800000\r\n      800000800000800000000000000000000000000000000000FFA284000000FFA2\r\n      8400000000000000000000000000000000000000000000000000000000000000\r\n      0000000000000000000000000000000000000000FFA284000000FFA284FFA284\r\n      0000000000000000000000000000000000000000000000000000000000000000\r\n      00000000000000000000000000FFA284FFA284000000000000FFA284FFA284FF\r\n      A284FFA284FFA284FFA284FFA284FFA284FFA284FFA284FFA284FFA284FFA284\r\n      FFA284FFA284FFA284FFA28400000000000080003FFF3FFF9FFF7E0FDFFF7803\r\n      DFFF7001DFFF6000DFFF6000DFFF40005FFF40005FFF40005FFF40005FFF6000\r\n      DFFF6000DFFF7001DFFF7803DFFF7C07DFFF7FFFDFFF3FFF9FFF80003FFF}\r\n  end\r\n  object TPointTextDrawer\r\n    Font.Charset = RUSSIAN_CHARSET\r\n    Font.Color = clBlack\r\n    Font.Height = -11\r\n    Font.Name = \'Arial\'\r\n    Font.Style = []\r\n    OutlineColor = clWhite\r\n    VAlignment = vaTop\r\n    HAlignment = haLeft\r\n  end\r\nend',NULL),(109,'object TDrawersGroup\r\n  DrawMode = gdmDrawAll\r\n  object TPointIconDrawer\r\n    AdjustSize = False\r\n    Image_Data = {\r\n      0000010001001313000000000000E80400001600000028000000130000002600\r\n      00000100180000000000C0040000000000000000000000000000000000000000\r\n      00FFA284FFA284FFA284FFA284FFA284FFA284FFA284FFA284FFA284FFA284FF\r\n      A284FFA284FFA284FFA284FFA284FFA284FFA284000000000000FFA284FFA284\r\n      0000000000000000000000000000000000000000000000000000000000000000\r\n      00000000000000000000000000FFA284FFA284000000FFA28400000000000000\r\n      0000000000000000000000800000800000800000800000800000000000000000\r\n      000000000000000000000000FFA284000000FFA2840000000000000000000000\r\n      00800000800000800000FFFFFFFFFFFFFFFFFF80000080000080000000000000\r\n      0000000000000000FFA284000000FFA284000000000000000000800000800000\r\n      FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF8000008000000000000000\r\n      00000000FFA284000000FFA284000000000000800000800000800000FFFFFFFF\r\n      FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF800000800000800000000000000000\r\n      FFA284000000FFA284000000000000800000FFFFFF800000800000FFFFFFFFFF\r\n      FFFFFFFFFFFFFFFFFFFF800000800000FFFFFF800000000000000000FFA28400\r\n      0000FFA284000000800000800000FFFFFFFFFFFF800000800000800000FFFFFF\r\n      800000800000800000FFFFFFFFFFFF800000800000000000FFA284000000FFA2\r\n      84000000800000FFFFFFFFFFFFFFFFFFFFFFFF80000080000080000080000080\r\n      0000FFFFFFFFFFFFFFFFFFF0FBFF800000000000FFA284000000FFA284000000\r\n      800000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF800000800000800000FFFFFFFFFF\r\n      FFFFFFFFFFFFFFF0FBFF800000000000FFA284000000FFA28400000080000080\r\n      0000FFFFFFFFFFFFFFFFFFFFFFFF800000800000800000FFFFFFFFFFFFFFFFFF\r\n      FFFFFF800000800000000000FFA284000000FFA284000000000000800000FFFF\r\n      FFFFFFFFFFFFFFFFFFFFFFFFFF800000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF80\r\n      0000000000000000FFA284000000FFA284000000000000800000800000FFFFFF\r\n      FFFFFFFFFFFFFFFFFF800000FFFFFFFFFFFFFFFFFFFFFFFF8000008000000000\r\n      00000000FFA284000000FFA284000000000000000000800000FFFFFFFFFFFFFF\r\n      FFFFFFFFFF800000FFFFFFFFFFFFFFFFFFFFFFFF800000000000000000000000\r\n      FFA284000000FFA284000000000000000000000000800000800000FFFFFFFFFF\r\n      FF800000FFFFFFFFFFFF800000800000000000000000000000000000FFA28400\r\n      0000FFA284000000000000000000000000000000800000800000800000800000\r\n      800000800000800000000000000000000000000000000000FFA284000000FFA2\r\n      8400000000000000000000000000000000000000000000000000000000000000\r\n      0000000000000000000000000000000000000000FFA284000000FFA284FFA284\r\n      0000000000000000000000000000000000000000000000000000000000000000\r\n      00000000000000000000000000FFA284FFA284000000000000FFA284FFA284FF\r\n      A284FFA284FFA284FFA284FFA284FFA284FFA284FFA284FFA284FFA284FFA284\r\n      FFA284FFA284FFA284FFA28400000000000080003FFF3FFF9FFF7E0FDFFF7803\r\n      DFFF7001DFFF6000DFFF6000DFFF40005FFF40005FFF40005FFF40005FFF6000\r\n      DFFF6000DFFF7001DFFF7803DFFF7C07DFFF7FFFDFFF3FFF9FFF80003FFF}\r\n  end\r\n  object TPointTextDrawer\r\n    Font.Charset = RUSSIAN_CHARSET\r\n    Font.Color = clBlack\r\n    Font.Height = -11\r\n    Font.Name = \'Arial\'\r\n    Font.Style = []\r\n    OutlineColor = clWhite\r\n    VAlignment = vaTop\r\n    HAlignment = haLeft\r\n  end\r\nend',NULL),(110,'object TDrawersGroup\r\n  DrawMode = gdmDrawAll\r\n  object TPointIconDrawer\r\n    AdjustSize = False\r\n    Image_Data = {\r\n      0000010001001313000000000000E80400001600000028000000130000002600\r\n      00000100180000000000C0040000000000000000000000000000000000000000\r\n      00FFA284FFA284FFA284FFA284FFA284FFA284FFA284FFA284FFA284FFA284FF\r\n      A284FFA284FFA284FFA284FFA284FFA284FFA284000000000000FFA284FFA284\r\n      0000000000000000000000000000000000000000000000000000000000000000\r\n      00000000000000000000000000FFA284FFA284000000FFA28400000000000000\r\n      0000000000000000000000800000800000800000800000800000000000000000\r\n      000000000000000000000000FFA284000000FFA2840000000000000000000000\r\n      00800000800000800000FFFFFFFFFFFFFFFFFF80000080000080000000000000\r\n      0000000000000000FFA284000000FFA284000000000000000000800000800000\r\n      FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF8000008000000000000000\r\n      00000000FFA284000000FFA284000000000000800000800000800000FFFFFFFF\r\n      FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF800000800000800000000000000000\r\n      FFA284000000FFA284000000000000800000FFFFFF800000800000FFFFFFFFFF\r\n      FFFFFFFFFFFFFFFFFFFF800000800000FFFFFF800000000000000000FFA28400\r\n      0000FFA284000000800000800000FFFFFFFFFFFF800000800000800000FFFFFF\r\n      800000800000800000FFFFFFFFFFFF800000800000000000FFA284000000FFA2\r\n      84000000800000FFFFFFFFFFFFFFFFFFFFFFFF80000080000080000080000080\r\n      0000FFFFFFFFFFFFFFFFFFF0FBFF800000000000FFA284000000FFA284000000\r\n      800000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF800000800000800000FFFFFFFFFF\r\n      FFFFFFFFFFFFFFF0FBFF800000000000FFA284000000FFA28400000080000080\r\n      0000FFFFFFFFFFFFFFFFFFFFFFFF800000800000800000FFFFFFFFFFFFFFFFFF\r\n      FFFFFF800000800000000000FFA284000000FFA284000000000000800000FFFF\r\n      FFFFFFFFFFFFFFFFFFFFFFFFFF800000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF80\r\n      0000000000000000FFA284000000FFA284000000000000800000800000FFFFFF\r\n      FFFFFFFFFFFFFFFFFF800000FFFFFFFFFFFFFFFFFFFFFFFF8000008000000000\r\n      00000000FFA284000000FFA284000000000000000000800000FFFFFFFFFFFFFF\r\n      FFFFFFFFFF800000FFFFFFFFFFFFFFFFFFFFFFFF800000000000000000000000\r\n      FFA284000000FFA284000000000000000000000000800000800000FFFFFFFFFF\r\n      FF800000FFFFFFFFFFFF800000800000000000000000000000000000FFA28400\r\n      0000FFA284000000000000000000000000000000800000800000800000800000\r\n      800000800000800000000000000000000000000000000000FFA284000000FFA2\r\n      8400000000000000000000000000000000000000000000000000000000000000\r\n      0000000000000000000000000000000000000000FFA284000000FFA284FFA284\r\n      0000000000000000000000000000000000000000000000000000000000000000\r\n      00000000000000000000000000FFA284FFA284000000000000FFA284FFA284FF\r\n      A284FFA284FFA284FFA284FFA284FFA284FFA284FFA284FFA284FFA284FFA284\r\n      FFA284FFA284FFA284FFA28400000000000080003FFF3FFF9FFF7E0FDFFF7803\r\n      DFFF7001DFFF6000DFFF6000DFFF40005FFF40005FFF40005FFF40005FFF6000\r\n      DFFF6000DFFF7001DFFF7803DFFF7C07DFFF7FFFDFFF3FFF9FFF80003FFF}\r\n  end\r\n  object TPointTextDrawer\r\n    Font.Charset = RUSSIAN_CHARSET\r\n    Font.Color = clBlack\r\n    Font.Height = -11\r\n    Font.Name = \'Arial\'\r\n    Font.Style = []\r\n    OutlineColor = clWhite\r\n    VAlignment = vaTop\r\n    HAlignment = haLeft\r\n  end\r\nend',NULL);

--
-- Table structure for table `mobitels_rotate_bands`
--

CREATE TABLE `mobitels_rotate_bands` (
  `Id` int(11) NOT NULL AUTO_INCREMENT,
  `Mobitel_ID` int(11) NOT NULL DEFAULT '0',
  `Bound` int(11) NOT NULL DEFAULT '0',
  PRIMARY KEY (`Id`),
  KEY `FK_mobitels_rotate_bands_mobitels_Mobitel_ID` (`Mobitel_ID`),
  CONSTRAINT `FK_mobitels_rotate_bands_mobitels_Mobitel_ID` FOREIGN KEY (`Mobitel_ID`) REFERENCES `mobitels` (`Mobitel_ID`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=cp1251;

--
-- Dumping data for table `mobitels_rotate_bands`
--


--
-- Table structure for table `ntf_emails`
--

CREATE TABLE `ntf_emails` (
  `Id` int(11) NOT NULL AUTO_INCREMENT,
  `Id_main` int(11) NOT NULL,
  `IsActive` tinyint(1) NOT NULL DEFAULT '0',
  `Email` varchar(127) NOT NULL,
  PRIMARY KEY (`Id`),
  KEY `FK_ntf_email_ntf_main_Id` (`Id_main`),
  CONSTRAINT `FK_ntf_email_ntf_main_Id` FOREIGN KEY (`Id_main`) REFERENCES `ntf_main` (`Id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=cp1251;

--
-- Dumping data for table `ntf_emails`
--


--
-- Table structure for table `ntf_events`
--

CREATE TABLE `ntf_events` (
  `Id` int(11) NOT NULL AUTO_INCREMENT,
  `Id_main` int(11) NOT NULL,
  `TypeEvent` tinyint(4) NOT NULL,
  `EventId` int(11) NOT NULL DEFAULT '0',
  `ParInt1` int(11) NOT NULL DEFAULT '0' COMMENT 'INT параметр любого события',
  `ParDbl1` double NOT NULL DEFAULT '0' COMMENT 'DOUBLE параметр №1 любого события',
  `ParDbl2` double NOT NULL DEFAULT '0' COMMENT 'DOUBLE параметр №2 любого события',
  `ParBool` bit(1) NOT NULL DEFAULT b'0' COMMENT 'BOOL параметр любого события',
  `ParInt2` int(11) NOT NULL DEFAULT '0' COMMENT 'INT параметр №2 любого события',
  PRIMARY KEY (`Id`),
  KEY `FK_ntf_events_ntf_main_Id` (`Id_main`),
  CONSTRAINT `FK_ntf_events_ntf_main_Id` FOREIGN KEY (`Id_main`) REFERENCES `ntf_main` (`Id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=cp1251;

--
-- Dumping data for table `ntf_events`
--


--
-- Table structure for table `ntf_log`
--

CREATE TABLE `ntf_log` (
  `Id` int(11) NOT NULL AUTO_INCREMENT,
  `Id_main` int(11) NOT NULL,
  `DateEvent` datetime NOT NULL,
  `DateWrite` datetime NOT NULL,
  `TypeEvent` tinyint(4) NOT NULL,
  `Mobitel_id` int(11) NOT NULL DEFAULT '0',
  `Zone_id` int(11) NOT NULL DEFAULT '0',
  `Location` varchar(255) DEFAULT NULL,
  `Lat` double DEFAULT '0',
  `Lng` double DEFAULT '0',
  `Infor` varchar(255) DEFAULT NULL,
  `IsRead` bit(1) DEFAULT b'0' COMMENT 'Уведомление прочитано ',
  `DataGps_ID` bigint(20) DEFAULT '0',
  `Speed` double DEFAULT '0',
  `Value` double DEFAULT '0' COMMENT 'Цифровое значение события (датчики)',
  PRIMARY KEY (`Id`),
  KEY `FK_ntf_log_ntf_main_Id` (`Id_main`),
  CONSTRAINT `FK_ntf_log_ntf_main_Id` FOREIGN KEY (`Id_main`) REFERENCES `ntf_main` (`Id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=cp1251;

--
-- Dumping data for table `ntf_log`
--


--
-- Table structure for table `ntf_main`
--

CREATE TABLE `ntf_main` (
  `Id` int(11) NOT NULL AUTO_INCREMENT,
  `IsActive` tinyint(1) NOT NULL DEFAULT '0',
  `IsPopup` tinyint(1) NOT NULL DEFAULT '0',
  `Title` varchar(255) NOT NULL,
  `IconSmall` blob,
  `IconLarge` blob,
  `SoundName` varchar(50) DEFAULT NULL,
  `TimeForControl` double DEFAULT NULL,
  `IsEmailActive` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'Активна E-mail рассылка уведомления',
  `Period` int(11) NOT NULL DEFAULT '0' COMMENT 'Периодичность появления уведомления(не чаще)',
  PRIMARY KEY (`Id`)
) ENGINE=InnoDB DEFAULT CHARSET=cp1251;

--
-- Dumping data for table `ntf_main`
--


--
-- Table structure for table `ntf_mobitels`
--

CREATE TABLE `ntf_mobitels` (
  `Id` int(11) NOT NULL AUTO_INCREMENT,
  `Id_main` int(11) NOT NULL,
  `MobitelId` int(11) NOT NULL,
  `SensorLogicId` int(11) DEFAULT '0',
  `SensorId` int(11) DEFAULT '0',
  PRIMARY KEY (`Id`),
  KEY `FK_ntf_mobitels_ntf_main_Id` (`Id_main`),
  CONSTRAINT `FK_ntf_mobitels_ntf_main_Id` FOREIGN KEY (`Id_main`) REFERENCES `ntf_main` (`Id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=cp1251;

--
-- Dumping data for table `ntf_mobitels`
--


--
-- Table structure for table `ntf_popupusers`
--

CREATE TABLE `ntf_popupusers` (
  `Id` int(11) NOT NULL AUTO_INCREMENT,
  `Id_main` int(11) NOT NULL,
  `Id_user` int(11) NOT NULL,
  PRIMARY KEY (`Id`),
  KEY `FK_ntf_popupUsers_ntf_main_Id` (`Id_main`),
  CONSTRAINT `FK_ntf_popupUsers_ntf_main_Id` FOREIGN KEY (`Id_main`) REFERENCES `ntf_main` (`Id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=cp1251;

--
-- Dumping data for table `ntf_popupusers`
--


--
-- Table structure for table `online`
--

CREATE TABLE `online` (
  `DataGps_ID` int(11) NOT NULL AUTO_INCREMENT,
  `Mobitel_ID` int(11) DEFAULT '0',
  `Message_ID` int(11) DEFAULT '0',
  `Latitude` int(11) NOT NULL DEFAULT '0',
  `Longitude` int(11) NOT NULL DEFAULT '0',
  `Altitude` int(11) DEFAULT '0',
  `UnixTime` int(11) NOT NULL DEFAULT '0',
  `Speed` smallint(6) NOT NULL DEFAULT '0',
  `Direction` int(11) NOT NULL DEFAULT '0',
  `Valid` tinyint(4) NOT NULL DEFAULT '1',
  `InMobitelID` int(11) DEFAULT '0',
  `Events` int(10) unsigned DEFAULT '0',
  `Sensor1` tinyint(4) unsigned DEFAULT '0',
  `Sensor2` tinyint(4) unsigned DEFAULT '0',
  `Sensor3` tinyint(4) unsigned DEFAULT '0',
  `Sensor4` tinyint(4) unsigned DEFAULT '0',
  `Sensor5` tinyint(4) unsigned DEFAULT '0',
  `Sensor6` tinyint(4) unsigned DEFAULT '0',
  `Sensor7` tinyint(4) unsigned DEFAULT '0',
  `Sensor8` tinyint(4) unsigned DEFAULT '0',
  `LogID` int(11) DEFAULT '0',
  `isShow` tinyint(4) DEFAULT '0',
  `whatIs` smallint(6) unsigned NOT NULL DEFAULT '0',
  `Counter1` int(11) NOT NULL DEFAULT '-1',
  `Counter2` int(11) NOT NULL DEFAULT '-1',
  `Counter3` int(11) NOT NULL DEFAULT '-1',
  `Counter4` int(11) NOT NULL DEFAULT '-1',
  PRIMARY KEY (`DataGps_ID`),
  KEY `IDX_MobitelidUnixtimeValid` (`Mobitel_ID`,`UnixTime`,`Valid`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=cp1251 COMMENT='Оперативные данные';

--
-- Dumping data for table `online`
--


--
-- Table structure for table `online64`
--

CREATE TABLE `online64` (
  `DataGps_ID` int(11) NOT NULL AUTO_INCREMENT,
  `Mobitel_ID` int(11) NOT NULL DEFAULT '0' COMMENT 'РљРѕРґ РўРµР»РµС‚СЂРµРєР°',
  `Latitude` int(11) NOT NULL DEFAULT '0' COMMENT 'РЁРёСЂРѕС‚Р°',
  `Longitude` int(11) NOT NULL DEFAULT '0' COMMENT 'Р”РѕР»РіРѕС‚Р°',
  `Direction` tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT 'РіСЂР°РґСѓСЃС‹/1.5',
  `Acceleration` int(11) DEFAULT '0' COMMENT 'РР·РјРµРЅРµРЅРёРµ СЃРєРѕСЂРѕСЃС‚Рё РїРѕ GPS Р·Р° РїРѕСЃР»РµРґРЅСЋСЋ СЃРµРєСѓРЅРґСѓ',
  `UnixTime` int(11) NOT NULL DEFAULT '0',
  `Speed` smallint(6) NOT NULL DEFAULT '0' COMMENT 'РЎРѕС‚РµРЅ РјРµС‚СЂРѕРІ РІ С‡Р°СЃ (0,1 РєРј/С‡)',
  `Valid` tinyint(1) NOT NULL DEFAULT '1',
  `Satellites` tinyint(1) unsigned DEFAULT '0' COMMENT 'РљРѕР»РёС‡РµСЃС‚РІРѕ СЃРїСѓС‚РЅРёРєРѕРІ ',
  `RssiGsm` tinyint(1) unsigned DEFAULT '0' COMMENT 'РЈСЂРѕРІРµРЅСЊ GSM СЃРёРіРЅР°Р»Р°',
  `Events` int(11) DEFAULT '0' COMMENT 'Р¤Р»Р°РіРё СЃРѕР±С‹С‚РёР№',
  `SensorsSet` tinyint(1) DEFAULT '0' COMMENT 'РљРѕРґ РЅР°Р±РѕСЂР° РґР°С‚С‡РёРєРѕРІ',
  `Sensors` varbinary(50) DEFAULT '0' COMMENT 'Р—РЅР°С‡РµРЅРёСЏ РґР°С‚С‡РёРєРѕРІ',
  `Voltage` tinyint(4) unsigned DEFAULT '0' COMMENT 'РќР°РїСЂСЏР¶РµРЅРёРµ РїРёС‚Р°РЅРёСЏ С‚РµРєСѓС‰РµРіРѕ РёСЃС‚РѕС‡РЅРёРєР°/1.5 РѕС‚ 0 РґРѕ 38,2',
  `DGPS` varchar(32) DEFAULT NULL,
  `LogID` int(11) DEFAULT '0' COMMENT 'РРґРµРЅС‚РёС„РёРєР°С‚РѕСЂ Р·Р°РїРёСЃРё РІ Р¶СѓСЂРЅР°Р»Рµ РўРµР»РµС‚СЂРµРєР°',
  `SrvPacketID` bigint(20) NOT NULL DEFAULT '0' COMMENT 'ID СЃРµСЂРІРµСЂРЅРѕРіРѕ РїР°РєРµС‚Р° РІ СЃРѕСЃС‚Р°РІ РєРѕС‚РѕСЂРѕРіРѕ РІС…РѕРґРёС‚ СЌС‚Р° Р·Р°РїРёСЃСЊ',
  PRIMARY KEY (`DataGps_ID`),
  KEY `IDX_MobitelidUnixtimeValid64` (`Mobitel_ID`,`UnixTime`,`Valid`)
) ENGINE=InnoDB AUTO_INCREMENT=4302 DEFAULT CHARSET=cp1251;

--
-- Dumping data for table `online64`
--

INSERT INTO `online64` VALUES (3220,98,506331600,262815000,221,0,1620388874,0,1,17,0,0,0,_binary 'AAAHOoqFAABMYHEAAAAAAAAAAP////8AAA==',165,'',1924182,420908719190),(3221,97,506332200,262813800,74,0,1620388891,0,1,17,0,0,0,_binary 'EAAHr8O0AAAAaWwAABHyAAAAAAAAAAAROQ==',180,'',2203366,416614031078),(3225,98,506331600,262815000,221,0,1620388934,0,1,16,0,0,0,_binary 'AAAHOoqFAABMYHYAAAAAAAAAAP////8AAA==',165,'',1924183,420908719191),(3226,97,506332200,262813800,74,0,1620388940,0,1,16,0,0,0,_binary 'AAAHr8O0AAAAZKMAABHyAAAAAAAAAAAAAA==',172,'',2203367,416614031079),(3230,98,506331600,262815000,221,0,1620388994,0,1,15,0,0,0,_binary 'AAAHOoqFAABMYG8AAAAAAAAAAP////8AAA==',165,'',1924184,420908719192),(3231,97,506332200,262813800,74,0,1620389000,0,1,16,0,0,0,_binary 'AAAHr8O0AAAAYFUAABHyAAAAAAAAAAAAAA==',165,'',2203368,416614031080),(3240,98,506331600,262815000,221,0,1620389054,0,1,16,0,0,0,_binary 'AAAHOoqFAABMYFUAAAAAAAAAAP////8AAA==',165,'',1924185,420908719193),(3241,97,506332200,262813800,74,0,1620389060,0,1,17,0,0,0,_binary 'AAAHr8O0AAAAX9AAABHyAAAAAAAAAAAAAA==',163,'',2203369,416614031081),(3246,99,506331900,262813600,191,0,1620389076,0,1,9,0,0,0,_binary 'AAAAAAAAAAAAX/IAAAAAAAAAAAAAAAAAAA==',164,'',1423617,425203185921),(3247,98,506331600,262815000,221,0,1620389114,0,1,14,0,0,0,_binary 'AAAHOoqFAABMYDAAAAAAAAAAAP////8AAA==',164,'',1924186,420908719194),(3248,97,506332200,262813800,74,0,1620389120,0,1,17,0,0,0,_binary 'AAAHr8O0AAAAX04AABHyAAAAAAAAAAAAAA==',163,'',2203370,416614031082),(3257,99,506331900,262813600,191,0,1620389136,0,1,9,0,0,0,_binary 'AAAAAAAAAAAAX6kAAAAAAAAAAAAAAAAAAA==',163,'',1423618,425203185922),(3258,98,506331600,262815000,221,0,1620389174,0,1,16,0,0,0,_binary 'AAAHOoqFAABMYBYAAAAAAAAAAP////8AAA==',164,'',1924187,420908719195),(3259,97,506332200,262813800,74,0,1620389180,0,1,17,0,0,0,_binary 'AAAHr8O0AAAAXvYAABHyAAAAAAAAAAAAAA==',162,'',2203371,416614031083),(3264,99,506331900,262813600,191,0,1620389196,0,1,8,0,0,0,_binary 'AAAAAAAAAAAAX1EAAAAAAAAAAAAAAAAAAA==',163,'',1423619,425203185923),(3265,98,506331600,262815000,221,0,1620389234,0,1,16,0,0,0,_binary 'AAAHOoqFAABMYBQAAAAAAAAAAP////8AAA==',164,'',1924188,420908719196),(3266,97,506332200,262813800,74,0,1620389240,0,1,17,0,0,0,_binary 'AAAHr8O0AAAAXswAABHyAAAAAAAAAAAAAA==',162,'',2203372,416614031084),(3279,99,506331900,262813600,191,0,1620389256,0,1,8,0,0,0,_binary 'AAAAAAAAAAAAXzcAAAAAAAAAAAAAAAAAAA==',163,'',1423620,425203185924),(3280,98,506331600,262815000,221,0,1620389294,0,1,15,0,0,0,_binary 'AAAHOoqFAABMYAEAAAAAAAAAAP////8AAA==',164,'',1924189,420908719197),(3281,97,506332200,262813800,74,0,1620389300,0,1,16,0,0,0,_binary 'AAAHr8O0AAAAXqgAABHyAAAAAAAAAAAAAA==',161,'',2203373,416614031085),(3289,99,506331900,262813600,191,0,1620389316,0,1,7,0,0,0,_binary 'AAAAAAAAAAAAXx8AAAAAAAAAAAAAAAAAAA==',163,'',1423621,425203185925),(3290,98,506331600,262815000,221,0,1620389354,0,1,16,0,0,0,_binary 'AAAHOoqFAABMX/oAAAAAAAAAAP////8AAA==',164,'',1924190,420908719198),(3291,97,506332200,262813800,74,0,1620389360,0,1,16,0,0,0,_binary 'AAAHr8O0AAAAXoMAABHyAAAAAAAAAAAAAA==',161,'',2203374,416614031086),(3292,99,506331900,262813600,191,0,1620389376,0,1,8,0,0,0,_binary 'AAAAAAAAAAAAXqgAAAAAAAAAAAAAAAAAAA==',161,'',1423622,425203185926),(3293,99,506331900,262813600,191,0,1620389389,0,1,8,0,0,0,_binary 'EAAAAAAAAAAAXrIAAAAAAAAAAAAAAAAAAA==',161,'',1423623,425203185927),(3297,98,506331600,262815000,221,0,1620389414,0,1,17,0,0,0,_binary 'AAAHOoqFAABMX/QAAAAAAAAAAP////8AAA==',164,'',1924191,420908719199),(3298,97,506332200,262813800,74,0,1620389420,0,1,16,0,0,0,_binary 'AAAHr8O0AAAAXmkAABHyAAAAAAAAAAAAAA==',161,'',2203375,416614031087),(3299,99,506331900,262813600,191,0,1620389449,0,1,8,0,0,0,_binary 'EAAAAAAAAAAAXaYAAAAAAAAAAAAAAAAAAA==',160,'',1423624,425203185928),(3304,98,506331600,262815000,221,0,1620389474,0,1,17,0,0,0,_binary 'AAAHOoqFAABMX+8AAAAAAAAAAP////8AAA==',164,'',1924192,420908719200),(3305,97,506332200,262813800,74,0,1620389480,0,1,16,0,0,0,_binary 'AAAHr8O0AAAAXlcAABHyAAAAAAAAAAAAAA==',161,'',2203376,416614031088),(3306,99,506331900,262813600,191,0,1620389486,0,1,8,0,0,0,_binary 'AAAAAAAAAAAAZtIAAAAAAAAAAAAAAAAAAA==',175,'',1423625,425203185929),(3307,99,506331900,262813600,191,0,1620389506,0,1,8,0,0,0,_binary 'EAAAAAAAAAAAX1sAAAAAAAAAAAAAAAAAAA==',163,'',1423626,425203185930),(3321,98,506331600,262815000,221,0,1620389534,0,1,17,0,0,0,_binary 'AAAHOoqFAABMX+IAAAAAAAAAAP////8AAA==',163,'',1924193,420908719201),(3322,97,506332200,262813800,74,0,1620389540,0,1,16,0,0,0,_binary 'AAAHr8O0AAAAXkcAABHyAAAAAAAAAAAAAA==',161,'',2203377,416614031089),(3323,99,506331900,262813600,191,0,1620389565,0,1,8,0,0,0,_binary 'EAAAAAAAAAAAak4AAAAAAAAAAAAAAAAAAA==',181,'',1423627,425203185931),(3334,98,506331600,262815000,221,0,1620389594,0,1,16,0,0,0,_binary 'AAAHOoqFAABMX9oAAAAAAAAAAP////8AAA==',163,'',1924194,420908719202),(3335,99,506331900,262813600,191,0,1620389597,0,1,8,0,0,0,_binary 'AAAAAAAAAAAAZ9MAAAAAAAAAAAAAAAAAAA==',177,'',1423628,425203185932),(3336,97,506332200,262813800,74,0,1620389600,0,1,16,0,0,0,_binary 'AAAHr8O0AAAAXj0AABHyAAAAAAAAAAAAAA==',161,'',2203378,416614031090),(3347,98,506331600,262815000,221,0,1620389654,0,1,17,0,0,0,_binary 'AAAHOoqFAABMX9AAAAAAAAAAAP////8AAA==',163,'',1924195,420908719203),(3348,99,506331900,262813600,191,0,1620389656,0,1,8,0,0,0,_binary 'AAAAAAAAAAAAX4UAAAAAAAAAAAAAAAAAAA==',163,'',1423629,425203185933),(3353,97,506332200,262813800,74,0,1620389660,0,1,16,0,0,0,_binary 'AAAHr8O0AAAAXjMAABHyAAAAAAAAAAAAAA==',161,'',2203379,416614031091),(3356,98,506331600,262815000,221,0,1620389714,0,1,17,0,0,0,_binary 'AAAHOoqFAABMX9AAAAAAAAAAAP////8AAA==',163,'',1924196,420908719204),(3357,99,506331900,262813600,191,0,1620389716,0,1,8,0,0,0,_binary 'AAAAAAAAAAAAX9UAAAAAAAAAAAAAAAAAAA==',163,'',1423630,425203185934),(3358,97,506332200,262813800,74,0,1620389720,0,1,16,0,0,0,_binary 'AAAHr8O0AAAAXhEAABHyAAAAAAAAAAAAAA==',161,'',2203380,416614031092),(3363,97,506332200,262813800,74,0,1620389754,0,1,17,0,0,0,_binary 'EAAHr8O2AAAAXZ4AABHyAAAAAAAAAAD//w==',160,'',2203381,416614031093),(3381,98,506331600,262815000,221,0,1620389774,0,1,15,0,0,0,_binary 'AAAHOoqFAABMX80AAAAAAAAAAP////8AAA==',163,'',1924197,420908719205),(3382,99,506331900,262813600,191,0,1620389776,0,1,7,0,0,0,_binary 'AAAAAAAAAAAAX8gAAAAAAAAAAAAAAAAAAA==',163,'',1423631,425203185935),(3403,97,506332200,262813800,74,0,1620389814,0,1,17,0,0,0,_binary 'EAAHr8O2AAAAaaoAABHyAAAAAAAAAAARMw==',180,'',2203382,416614031094),(3407,98,506331600,262815000,221,0,1620389834,0,1,17,0,0,0,_binary 'AAAHOoqFAABMX74AAAAAAAAAAP////8AAA==',163,'',1924198,420908719206),(3408,99,506331900,262813600,191,0,1620389836,0,1,7,0,0,0,_binary 'AAAAAAAAAAAAXy8AAAAAAAAAAAAAAAAAAA==',163,'',1423632,425203185936),(3409,97,506332200,262813800,74,0,1620389850,0,1,17,0,0,0,_binary 'AAAHr8O2AAAAY/oAABHyAAAAAAAAAAAAAA==',171,'',2203383,416614031095),(3413,98,506331600,262815000,221,0,1620389894,0,1,17,0,0,0,_binary 'AAAHOoqFAABMX7kAAAAAAAAAAP////8AAA==',163,'',1924199,420908719207),(3414,99,506331900,262813600,191,0,1620389896,0,1,8,0,0,0,_binary 'AAAAAAAAAAAAX1YAAAAAAAAAAAAAAAAAAA==',163,'',1423633,425203185937),(3415,97,506332200,262813800,74,0,1620389910,0,1,17,0,0,0,_binary 'AAAHr8O2AAAAXskAABHyAAAAAAAAAAAAAA==',162,'',2203384,416614031096),(3426,98,506331600,262815000,221,0,1620389954,0,1,17,0,0,0,_binary 'AAAHOoqFAABMX64AAAAAAAAAAP////8AAA==',163,'',1924200,420908719208),(3427,99,506331900,262813600,191,0,1620389956,0,1,7,0,0,0,_binary 'AAAAAAAAAAAAX1gAAAAAAAAAAAAAAAAAAA==',163,'',1423634,425203185938),(3436,97,506332200,262813800,74,0,1620389970,0,1,16,0,0,0,_binary 'AAAHr8O2AAAAXfkAABHyAAAAAAAAAAAAAA==',161,'',2203385,416614031097),(3439,98,506331600,262815000,221,0,1620390014,0,1,16,0,0,0,_binary 'AAAHOoqFAABMX64AAAAAAAAAAP////8AAA==',163,'',1924201,420908719209),(3440,99,506331900,262813600,191,0,1620390016,0,1,7,0,0,0,_binary 'AAAAAAAAAAAAXxoAAAAAAAAAAAAAAAAAAA==',162,'',1423635,425203185939),(3441,97,506332200,262813800,74,0,1620390030,0,1,16,0,0,0,_binary 'AAAHr8O2AAAAXWgAABHyAAAAAAAAAAAAAA==',159,'',2203386,416614031098),(3467,98,506331600,262815000,221,0,1620390074,0,1,16,0,0,0,_binary 'AAAHOoqFAABMX6wAAAAAAAAAAP////8AAA==',163,'',1924202,420908719210),(3468,99,506331900,262813600,191,0,1620390076,0,1,7,0,0,0,_binary 'AAAAAAAAAAAAXvgAAAAAAAAAAAAAAAAAAA==',162,'',1423636,425203185940),(3469,97,506332200,262813800,74,0,1620390090,0,1,17,0,0,0,_binary 'AAAHr8O2AAAAXRUAABHyAAAAAAAAAAAAAA==',159,'',2203387,416614031099),(3477,98,506331600,262815000,221,0,1620390134,0,1,15,0,0,0,_binary 'AAAHOoqFAABMX6YAAAAAAAAAAP////8AAA==',163,'',1924203,420908719211),(3478,99,506331900,262813600,191,0,1620390136,0,1,8,0,0,0,_binary 'AAAAAAAAAAAAXxIAAAAAAAAAAAAAAAAAAA==',162,'',1423637,425203185941),(3479,97,506332200,262813800,74,0,1620390150,0,1,17,0,0,0,_binary 'AAAHr8O2AAAAXQAAABHyAAAAAAAAAAAAAA==',159,'',2203388,416614031100),(3485,98,506331600,262815000,221,0,1620390194,0,1,16,0,0,0,_binary 'AAAHOoqFAABMX7kAAAAAAAAAAP////8AAA==',163,'',1924204,420908719212),(3486,99,506331900,262813600,191,0,1620390196,0,1,8,0,0,0,_binary 'AAAAAAAAAAAAXwAAAAAAAAAAAAAAAAAAAA==',162,'',1423638,425203185942),(3487,97,506332200,262813800,74,0,1620390210,0,1,17,0,0,0,_binary 'AAAHr8O2AAAAXWAAABHyAAAAAAAAAAAAAA==',159,'',2203389,416614031101),(3497,98,506331600,262815000,221,0,1620390254,0,1,16,0,0,0,_binary 'AAAHOoqFAABMX9MAAAAAAAAAAP////8AAA==',163,'',1924205,420908719213),(3498,99,506331900,262813600,191,0,1620390256,0,1,7,0,0,0,_binary 'AAAAAAAAAAAAXwUAAAAAAAAAAAAAAAAAAA==',162,'',1423639,425203185943),(3499,97,506332200,262813800,74,0,1620390270,0,1,17,0,0,0,_binary 'AAAHr8O2AAAAXWMAABHyAAAAAAAAAAAAAA==',159,'',2203390,416614031102),(3507,98,506331600,262815000,221,0,1620390314,0,1,16,0,0,0,_binary 'AAAHOoqFAABMX7MAAAAAAAAAAP////8AAA==',163,'',1924206,420908719214),(3508,99,506331900,262813600,191,0,1620390316,0,1,7,0,0,0,_binary 'AAAAAAAAAAAAXvgAAAAAAAAAAAAAAAAAAA==',162,'',1423640,425203185944),(3509,97,506332200,262813800,74,0,1620390330,0,1,17,0,0,0,_binary 'AAAHr8O2AAAAXWAAABHyAAAAAAAAAAAAAA==',159,'',2203391,416614031103),(3528,98,506331600,262815000,221,0,1620390374,0,1,15,0,0,0,_binary 'AAAHOoqFAABMX6YAAAAAAAAAAP////8AAA==',163,'',1924207,420908719215),(3529,99,506331900,262813600,191,0,1620390376,0,1,7,0,0,0,_binary 'AAAAAAAAAAAAXu4AAAAAAAAAAAAAAAAAAA==',162,'',1423641,425203185945),(3530,97,506332200,262813800,74,0,1620390390,0,1,17,0,0,0,_binary 'AAAHr8O2AAAAXVMAABHyAAAAAAAAAAAAAA==',159,'',2203392,416614031104),(3545,98,506331600,262815000,221,0,1620390434,0,1,16,0,0,0,_binary 'AAAHOoqFAABMX5IAAAAAAAAAAP////8AAA==',163,'',1924208,420908719216),(3546,99,506331900,262813600,191,0,1620390436,0,1,7,0,0,0,_binary 'AAAAAAAAAAAAXuMAAAAAAAAAAAAAAAAAAA==',162,'',1423642,425203185946),(3547,97,506332200,262813800,74,0,1620390450,0,1,17,0,0,0,_binary 'AAAHr8O2AAAAXUYAABHyAAAAAAAAAAAAAA==',159,'',2203393,416614031105),(3551,98,506331600,262815000,221,0,1620390494,0,1,17,0,0,0,_binary 'AAAHOoqFAABMX38AAAAAAAAAAP////8AAA==',163,'',1924209,420908719217),(3552,99,506331900,262813600,191,0,1620390496,0,1,7,0,0,0,_binary 'AAAAAAAAAAAAXtkAAAAAAAAAAAAAAAAAAA==',162,'',1423643,425203185947),(3553,97,506332200,262813800,74,0,1620390510,0,1,17,0,0,0,_binary 'AAAHr8O2AAAAXTwAABHyAAAAAAAAAAAAAA==',159,'',2203394,416614031106),(3558,98,506331600,262815000,221,0,1620390554,0,1,17,0,0,0,_binary 'AAAHOoqFAABMX4UAAAAAAAAAAP////8AAA==',163,'',1924210,420908719218),(3559,99,506331900,262813600,191,0,1620390556,0,1,7,0,0,0,_binary 'AAAAAAAAAAAAXt4AAAAAAAAAAAAAAAAAAA==',162,'',1423644,425203185948),(3560,97,506332200,262813800,74,0,1620390570,0,1,17,0,0,0,_binary 'AAAHr8O2AAAAXTwAABHyAAAAAAAAAAAAAA==',159,'',2203395,416614031107),(3564,98,506331600,262815000,221,0,1620390614,0,1,17,0,0,0,_binary 'AAAHOoqFAABMX4UAAAAAAAAAAP////8AAA==',163,'',1924211,420908719219),(3565,99,506331900,262813600,191,0,1620390616,0,1,7,0,0,0,_binary 'AAAAAAAAAAAAXtwAAAAAAAAAAAAAAAAAAA==',162,'',1423645,425203185949),(3566,97,506332200,262813800,74,0,1620390630,0,1,17,0,0,0,_binary 'AAAHr8O2AAAAXS8AABHyAAAAAAAAAAAAAA==',159,'',2203396,416614031108),(3578,98,506331600,262815000,221,0,1620390674,0,1,16,0,0,0,_binary 'AAAHOoqFAABMX4UAAAAAAAAAAP////8AAA==',163,'',1924212,420908719220),(3579,99,506331900,262813600,191,0,1620390676,0,1,7,0,0,0,_binary 'AAAAAAAAAAAAXlwAAAAAAAAAAAAAAAAAAA==',161,'',1423646,425203185950),(3580,97,506332200,262813800,74,0,1620390690,0,1,17,0,0,0,_binary 'AAAHr8O2AAAAXSkAABHyAAAAAAAAAAAAAA==',159,'',2203397,416614031109),(3601,98,506331600,262815000,221,0,1620390734,0,1,15,0,0,0,_binary 'AAAHOoqFAABMX6wAAAAAAAAAAP////8AAA==',163,'',1924213,420908719221),(3602,99,506331900,262813600,191,0,1620390736,0,1,7,0,0,0,_binary 'AAAAAAAAAAAAXoEAAAAAAAAAAAAAAAAAAA==',161,'',1423647,425203185951),(3603,97,506332200,262813800,74,0,1620390750,0,1,16,0,0,0,_binary 'AAAHr8O2AAAAXR8AABHyAAAAAAAAAAAAAA==',159,'',2203398,416614031110),(3612,98,506331600,262815000,221,0,1620390794,0,1,16,0,0,0,_binary 'AAAHOoqFAABMX7YAAAAAAAAAAP////8AAA==',163,'',1924214,420908719222),(3613,99,506331900,262813600,191,0,1620390796,0,1,7,0,0,0,_binary 'AAAAAAAAAAAAXosAAAAAAAAAAAAAAAAAAA==',161,'',1423648,425203185952),(3614,97,506332200,262813800,74,0,1620390810,0,1,16,0,0,0,_binary 'AAAHr8O2AAAAXPsAABHyAAAAAAAAAAAAAA==',159,'',2203399,416614031111),(3618,98,506331600,262815000,221,0,1620390854,0,1,16,0,0,0,_binary 'AAAHOoqFAABMX7kAAAAAAAAAAP////8AAA==',163,'',1924215,420908719223),(3619,99,506331900,262813600,191,0,1620390856,0,1,7,0,0,0,_binary 'AAAAAAAAAAAAXmwAAAAAAAAAAAAAAAAAAA==',161,'',1423649,425203185953),(3620,97,506332200,262813800,74,0,1620390870,0,1,15,0,0,0,_binary 'AAAHr8O2AAAAXRIAABHyAAAAAAAAAAAAAA==',159,'',2203400,416614031112),(3624,98,506331600,262815000,221,0,1620390914,0,1,14,0,0,0,_binary 'AAAHOoqFAABMX7EAAAAAAAAAAP////8AAA==',163,'',1924216,420908719224),(3625,99,506331900,262813600,191,0,1620390916,0,1,7,0,0,0,_binary 'AAAAAAAAAAAAXosAAAAAAAAAAAAAAAAAAA==',161,'',1423650,425203185954),(3626,97,506332200,262813800,74,0,1620390930,0,1,16,0,0,0,_binary 'AAAHr8O2AAAAXQ0AABHyAAAAAAAAAAAAAA==',159,'',2203401,416614031113),(3631,98,506331600,262815000,221,0,1620390974,0,1,16,0,0,0,_binary 'AAAHOoqFAABMX7kAAAAAAAAAAP////8AAA==',163,'',1924217,420908719225),(3632,99,506331900,262813600,191,0,1620390976,0,1,8,0,0,0,_binary 'AAAAAAAAAAAAXo4AAAAAAAAAAAAAAAAAAA==',161,'',1423651,425203185955),(3633,97,506332200,262813800,74,0,1620390990,0,1,16,0,0,0,_binary 'AAAHr8O2AAAAXQgAABHyAAAAAAAAAAAAAA==',159,'',2203402,416614031114),(3641,98,506331600,262815000,221,0,1620391034,0,1,16,0,0,0,_binary 'AAAHOoqFAABMX74AAAAAAAAAAP////8AAA==',163,'',1924218,420908719226),(3642,99,506331900,262813600,191,0,1620391036,0,1,8,0,0,0,_binary 'AAAAAAAAAAAAXoMAAAAAAAAAAAAAAAAAAA==',161,'',1423652,425203185956),(3643,97,506332200,262813800,74,0,1620391050,0,1,16,0,0,0,_binary 'AAAHr8O2AAAAXP0AABHyAAAAAAAAAAAAAA==',159,'',2203403,416614031115),(3653,98,506331600,262815000,221,0,1620391094,0,1,15,0,0,0,_binary 'AAAHOoqFAABMX7sAAAAAAAAAAP////8AAA==',163,'',1924219,420908719227),(3654,99,506331900,262813600,191,0,1620391096,0,1,8,0,0,0,_binary 'AAAAAAAAAAAAXoYAAAAAAAAAAAAAAAAAAA==',161,'',1423653,425203185957),(3655,97,506332200,262813800,74,0,1620391110,0,1,16,0,0,0,_binary 'AAAHr8O2AAAAXPMAABHyAAAAAAAAAAAAAA==',159,'',2203404,416614031116),(3657,98,506331600,262815000,221,0,1620391154,0,1,15,0,0,0,_binary 'AAAHOoqFAABMX7kAAAAAAAAAAP////8AAA==',163,'',1924220,420908719228),(3658,99,506331900,262813600,191,0,1620391156,0,1,8,0,0,0,_binary 'AAAAAAAAAAAAXk8AAAAAAAAAAAAAAAAAAA==',161,'',1423654,425203185958),(3659,97,506332200,262813800,74,0,1620391170,0,1,16,0,0,0,_binary 'AAAHr8O2AAAAXO4AABHyAAAAAAAAAAAAAA==',159,'',2203405,416614031117),(3662,98,506331600,262815000,221,0,1620391214,0,1,16,0,0,0,_binary 'AAAHOoqFAABMX7sAAAAAAAAAAP////8AAA==',163,'',1924221,420908719229),(3663,99,506331900,262813600,191,0,1620391217,0,1,8,0,0,0,_binary 'AAAAAAAAAAAAXoEAAAAAAAAAAAAAAAAAAA==',161,'',1423655,425203185959),(3664,97,506332200,262813800,74,0,1620391230,0,1,16,0,0,0,_binary 'AAAHr8O2AAAAXO4AABHyAAAAAAAAAAAAAA==',159,'',2203406,416614031118),(3667,98,506331600,262815000,221,0,1620391274,0,1,16,0,0,0,_binary 'AAAHOoqFAABMX48AAAAAAAAAAP////8AAA==',163,'',1924222,420908719230),(3668,99,506331900,262813600,191,0,1620391277,0,1,8,0,0,0,_binary 'AAAAAAAAAAAAXoEAAAAAAAAAAAAAAAAAAA==',161,'',1423656,425203185960),(3669,97,506332200,262813800,74,0,1620391290,0,1,16,0,0,0,_binary 'AAAHr8O2AAAAXOYAABHyAAAAAAAAAAAAAA==',159,'',2203407,416614031119),(3672,98,506331600,262815000,221,0,1620391334,0,1,16,0,0,0,_binary 'AAAHOoqFAABMX7YAAAAAAAAAAP////8AAA==',163,'',1924223,420908719231),(3673,99,506331900,262813600,191,0,1620391337,0,1,8,0,0,0,_binary 'AAAAAAAAAAAAXoEAAAAAAAAAAAAAAAAAAA==',161,'',1423657,425203185961),(3674,97,506332200,262813800,74,0,1620391350,0,1,16,0,0,0,_binary 'AAAHr8O2AAAAXOEAABHyAAAAAAAAAAAAAA==',159,'',2203408,416614031120),(3677,98,506331600,262815000,221,0,1620391394,0,1,16,0,0,0,_binary 'AAAHOoqFAABMX6wAAAAAAAAAAP////8AAA==',163,'',1924224,420908719232),(3678,99,506331900,262813600,191,0,1620391397,0,1,8,0,0,0,_binary 'AAAAAAAAAAAAXn4AAAAAAAAAAAAAAAAAAA==',161,'',1423658,425203185962),(3679,97,506332200,262813800,74,0,1620391410,0,1,16,0,0,0,_binary 'AAAHr8O2AAAAXNkAABHyAAAAAAAAAAAAAA==',159,'',2203409,416614031121),(3682,98,506331600,262815000,221,0,1620391454,0,1,16,0,0,0,_binary 'AAAHOoqFAABMX6wAAAAAAAAAAP////8AAA==',163,'',1924225,420908719233),(3683,99,506331900,262813600,191,0,1620391457,0,1,8,0,0,0,_binary 'AAAAAAAAAAAAXn4AAAAAAAAAAAAAAAAAAA==',161,'',1423659,425203185963),(3684,97,506332200,262813800,74,0,1620391470,0,1,16,0,0,0,_binary 'AAAHr8O2AAAAXNQAABHyAAAAAAAAAAAAAA==',159,'',2203410,416614031122),(3687,98,506331600,262815000,221,0,1620391514,0,1,15,0,0,0,_binary 'AAAHOoqFAABMX64AAAAAAAAAAP////8AAA==',163,'',1924226,420908719234),(3688,99,506331900,262813600,191,0,1620391517,0,1,7,0,0,0,_binary 'AAAAAAAAAAAAXnkAAAAAAAAAAAAAAAAAAA==',161,'',1423660,425203185964),(3691,97,506332200,262813800,74,0,1620391530,0,1,16,0,0,0,_binary 'AAAHr8O2AAAAXMwAABHyAAAAAAAAAAAAAA==',159,'',2203411,416614031123),(3693,98,506331600,262815000,221,0,1620391574,0,1,16,0,0,0,_binary 'AAAHOoqFAABMX5IAAAAAAAAAAP////8AAA==',163,'',1924227,420908719235),(3694,99,506331900,262813600,191,0,1620391577,0,1,8,0,0,0,_binary 'AAAAAAAAAAAAXnkAAAAAAAAAAAAAAAAAAA==',161,'',1423661,425203185965),(3714,97,506332200,262813800,74,0,1620391590,0,1,16,0,0,0,_binary 'AAAHr8O2AAAAXJAAABHyAAAAAAAAAAAAAA==',158,'',2203412,416614031124),(3716,98,506331600,262815000,221,0,1620391634,0,1,16,0,0,0,_binary 'AAAHOoqFAABMX5IAAAAAAAAAAP////8AAA==',163,'',1924228,420908719236),(3717,99,506331900,262813600,191,0,1620391637,0,1,8,0,0,0,_binary 'AAAAAAAAAAAAXmwAAAAAAAAAAAAAAAAAAA==',161,'',1423662,425203185966),(3729,97,506332200,262813800,74,0,1620391650,0,1,16,0,0,0,_binary 'AAAHr8O2AAAAXMcAABHyAAAAAAAAAAAAAA==',159,'',2203413,416614031125),(3731,98,506331600,262815000,221,0,1620391694,0,1,16,0,0,0,_binary 'AAAHOoqFAABMX6EAAAAAAAAAAP////8AAA==',163,'',1924229,420908719237),(3732,99,506331900,262813600,191,0,1620391697,0,1,8,0,0,0,_binary 'AAAAAAAAAAAAXmcAAAAAAAAAAAAAAAAAAA==',161,'',1423663,425203185967),(3734,97,506332200,262813800,74,0,1620391710,0,1,16,0,0,0,_binary 'AAAHr8O2AAAAXMQAABHyAAAAAAAAAAAAAA==',158,'',2203414,416614031126),(3743,98,506331600,262815000,221,0,1620391754,0,1,15,0,0,0,_binary 'AAAHOoqFAABMX6QAAAAAAAAAAP////8AAA==',163,'',1924230,420908719238),(3744,99,506331900,262813600,191,0,1620391757,0,1,8,0,0,0,_binary 'AAAAAAAAAAAAXjAAAAAAAAAAAAAAAAAAAA==',161,'',1423664,425203185968),(3755,97,506332200,262813800,74,0,1620391770,0,1,15,0,0,0,_binary 'AAAHr8O2AAAAXMQAABHyAAAAAAAAAAAAAA==',158,'',2203415,416614031127),(3759,97,506332200,262813800,74,0,1620391808,0,1,15,0,0,0,_binary 'EAAHr8O2AAAAXHkAABHyAAAAAAAAAAD//w==',158,'',2203416,416614031128),(3760,98,506331600,262815000,221,0,1620391814,0,1,13,0,0,0,_binary 'AAAHOoqFAABMX6QAAAAAAAAAAP////8AAA==',163,'',1924231,420908719239),(3761,99,506331900,262813600,191,0,1620391817,0,1,7,0,0,0,_binary 'AAAAAAAAAAAAXhsAAAAAAAAAAAAAAAAAAA==',161,'',1423665,425203185969),(3774,97,506332200,262813800,74,0,1620391822,0,1,16,0,0,0,_binary 'AAAHr8O2AAAAYC4AABHyAAAAAAAAAAAAAA==',164,'',2203417,416614031129),(3778,98,506331600,262815000,221,0,1620391874,0,1,16,0,0,0,_binary 'AAAHOoqFAABMX6kAAAAAAAAAAP////8AAA==',163,'',1924232,420908719240),(3779,99,506331900,262813600,191,0,1620391877,0,1,7,0,0,0,_binary 'AAAAAAAAAAAAXnsAAAAAAAAAAAAAAAAAAA==',161,'',1423666,425203185970),(3798,97,506332200,262813800,74,0,1620391882,0,1,16,0,0,0,_binary 'AAAHr8O2AAAAXMQAABHyAAAAAAAAAAAAAA==',158,'',2203418,416614031130),(3802,98,506331600,262815000,221,0,1620391934,0,1,16,0,0,0,_binary 'AAAHOoqFAABMX6YAAAAAAAAAAP////8AAA==',163,'',1924233,420908719241),(3803,99,506331900,262813600,191,0,1620391937,0,1,7,0,0,0,_binary 'AAAAAAAAAAAAXoEAAAAAAAAAAAAAAAAAAA==',161,'',1423667,425203185971),(3808,97,506332200,262813800,74,0,1620391942,0,1,16,0,0,0,_binary 'AAAHr8O2AAAAXRwAABHyAAAAAAAAAAAAAA==',159,'',2203419,416614031131),(3809,98,506331600,262815000,221,0,1620391994,0,1,16,0,0,0,_binary 'AAAHOoqFAABMX3gAAAAAAAAAAP////8AAA==',163,'',1924234,420908719242),(3816,99,506331900,262813600,191,0,1620391997,0,1,6,0,0,0,_binary 'AAAAAAAAAAAAXoEAAAAAAAAAAAAAAAAAAA==',161,'',1423668,425203185972),(3820,97,506332200,262813800,74,0,1620392002,0,1,17,0,0,0,_binary 'AAAHr8O2AAAAXS8AABHyAAAAAAAAAAAAAA==',159,'',2203420,416614031132),(3828,98,506331600,262815000,221,0,1620392054,0,1,16,0,0,0,_binary 'AAAHOoqFAABMX3IAAAAAAAAAAP////8AAA==',163,'',1924235,420908719243),(3829,99,506331900,262813600,191,0,1620392057,0,1,6,0,0,0,_binary 'AAAAAAAAAAAAXloAAAAAAAAAAAAAAAAAAA==',161,'',1423669,425203185973),(3837,97,506332200,262813800,74,0,1620392062,0,1,16,0,0,0,_binary 'AAAHr8O2AAAAXTEAABHyAAAAAAAAAAAAAA==',159,'',2203421,416614031133),(3846,98,506331600,262815000,221,0,1620392114,0,1,16,0,0,0,_binary 'AAAHOoqFAABMX2AAAAAAAAAAAP////8AAA==',163,'',1924236,420908719244),(3847,99,506331900,262813600,191,0,1620392117,0,1,7,0,0,0,_binary 'AAAAAAAAAAAAXnkAAAAAAAAAAAAAAAAAAA==',161,'',1423670,425203185974),(3853,97,506332200,262813800,74,0,1620392122,0,1,17,0,0,0,_binary 'AAAHr8O2AAAAXTEAABHyAAAAAAAAAAAAAA==',159,'',2203422,416614031134),(3861,98,506331600,262815000,221,0,1620392174,0,1,17,0,0,0,_binary 'AAAHOoqFAABMX4UAAAAAAAAAAP////8AAA==',163,'',1924237,420908719245),(3862,99,506331900,262813600,191,0,1620392177,0,1,9,0,0,0,_binary 'AAAAAAAAAAAAXmQAAAAAAAAAAAAAAAAAAA==',161,'',1423671,425203185975),(3863,97,506332200,262813800,74,0,1620392182,0,1,18,0,0,0,_binary 'AAAHr8O2AAAAXSkAABHyAAAAAAAAAAAAAA==',159,'',2203423,416614031135),(3873,98,506331600,262815000,221,0,1620392234,0,1,17,0,0,0,_binary 'AAAHOoqFAABMX4cAAAAAAAAAAP////8AAA==',163,'',1924238,420908719246),(3874,99,506331900,262813600,191,0,1620392237,0,1,9,0,0,0,_binary 'AAAAAAAAAAAAXn4AAAAAAAAAAAAAAAAAAA==',161,'',1423672,425203185976),(3877,97,506332200,262813800,74,0,1620392242,0,1,18,0,0,0,_binary 'AAAHr8O2AAAAXSwAABHyAAAAAAAAAAAAAA==',159,'',2203424,416614031136),(3884,98,506331600,262815000,221,0,1620392294,0,1,17,0,0,0,_binary 'AAAHOoqFAABMX4cAAAAAAAAAAP////8AAA==',163,'',1924239,420908719247),(3885,99,506331900,262813600,191,0,1620392297,0,1,8,0,0,0,_binary 'AAAAAAAAAAAAXn4AAAAAAAAAAAAAAAAAAA==',161,'',1423673,425203185977),(3886,97,506332200,262813800,74,0,1620392302,0,1,17,0,0,0,_binary 'AAAHr8O2AAAAXSwAABHyAAAAAAAAAAAAAA==',159,'',2203425,416614031137),(3897,98,506331600,262815000,221,0,1620392354,0,1,17,0,0,0,_binary 'AAAHOoqFAABMX3AAAAAAAAAAAP////8AAA==',163,'',1924240,420908719248),(3898,99,506331900,262813600,191,0,1620392357,0,1,8,0,0,0,_binary 'AAAAAAAAAAAAXhkAAAAAAAAAAAAAAAAAAA==',161,'',1423674,425203185978),(3907,97,506332200,262813800,74,0,1620392362,0,1,17,0,0,0,_binary 'AAAHr8O2AAAAXSwAABHyAAAAAAAAAAAAAA==',159,'',2203426,416614031138),(3915,98,506331600,262815000,221,0,1620392414,0,1,17,0,0,0,_binary 'AAAHOoqFAABMX1gAAAAAAAAAAP////8AAA==',163,'',1924241,420908719249),(3916,99,506331900,262813600,191,0,1620392417,0,1,8,0,0,0,_binary 'AAAAAAAAAAAAXm4AAAAAAAAAAAAAAAAAAA==',161,'',1423675,425203185979),(3920,97,506332200,262813800,74,0,1620392422,0,1,18,0,0,0,_binary 'AAAHr8O2AAAAXSwAABHyAAAAAAAAAAAAAA==',159,'',2203427,416614031139),(3927,98,506331600,262815000,221,0,1620392474,0,1,17,0,0,0,_binary 'AAAHOoqFAABMX0kAAAAAAAAAAP////8AAA==',163,'',1924242,420908719250),(3928,99,506331900,262813600,191,0,1620392477,0,1,9,0,0,0,_binary 'AAAAAAAAAAAAXnYAAAAAAAAAAAAAAAAAAA==',161,'',1423676,425203185980),(3931,97,506332200,262813800,74,0,1620392482,0,1,18,0,0,0,_binary 'AAAHr8O2AAAAXSwAABHyAAAAAAAAAAAAAA==',159,'',2203428,416614031140),(3938,98,506331600,262815000,221,0,1620392534,0,1,16,0,0,0,_binary 'AAAHOoqFAABMXzkAAAAAAAAAAP////8AAA==',163,'',1924243,420908719251),(3939,99,506331900,262813600,191,0,1620392537,0,1,9,0,0,0,_binary 'AAAAAAAAAAAAXnQAAAAAAAAAAAAAAAAAAA==',161,'',1423677,425203185981),(3945,97,506332200,262813800,74,0,1620392542,0,1,18,0,0,0,_binary 'AAAHr8O2AAAAXSwAABHyAAAAAAAAAAAAAA==',159,'',2203429,416614031141),(3950,98,506331600,262815000,221,0,1620392594,0,1,14,0,0,0,_binary 'AAAHOoqFAABMXzcAAAAAAAAAAP////8AAA==',163,'',1924244,420908719252),(3951,99,506331900,262813600,191,0,1620392597,0,1,9,0,0,0,_binary 'AAAAAAAAAAAAXm4AAAAAAAAAAAAAAAAAAA==',161,'',1423678,425203185982),(3955,97,506332200,262813800,74,0,1620392602,0,1,18,0,0,0,_binary 'AAAHr8O2AAAAXR8AABHyAAAAAAAAAAAAAA==',159,'',2203430,416614031142),(3958,98,506331600,262815000,221,0,1620392654,0,1,16,0,0,0,_binary 'AAAHOoqFAABMXy8AAAAAAAAAAP////8AAA==',163,'',1924245,420908719253),(3959,99,506331900,262813600,191,0,1620392657,0,1,8,0,0,0,_binary 'AAAAAAAAAAAAXnQAAAAAAAAAAAAAAAAAAA==',161,'',1423679,425203185983),(3962,97,506332200,262813800,74,0,1620392662,0,1,17,0,0,0,_binary 'AAAHr8O2AAAAXScAABHyAAAAAAAAAAAAAA==',159,'',2203431,416614031143),(3963,825503800,498176400,308660600,219,0,1620392658,620,1,17,0,0,0,_binary 'EAAFhpDlAADWa7IAAAAAAAAAAAAEAHUixg==',184,'',108282,3545511823723833082),(3964,825503800,498216600,308624800,219,0,1620392688,610,1,16,0,0,0,_binary 'EAAFhpFKAADWbH0AAAAAAAAAAAAEAHUidg==',185,'',108283,3545511823723833083),(3965,98,506331600,262815000,221,0,1620392714,0,1,15,0,0,0,_binary 'AAAHOoqFAABMXzEAAAAAAAAAAP////8AAA==',163,'',1924246,420908719254),(3966,99,506331900,262813600,191,0,1620392717,0,1,7,0,0,0,_binary 'AAAAAAAAAAAAXnQAAAAAAAAAAAAAAAAAAA==',161,'',1423680,425203185984),(3974,97,506332200,262813800,74,0,1620392722,0,1,17,0,0,0,_binary 'AAAHr8O2AAAAXSQAABHyAAAAAAAAAAAAAA==',159,'',2203432,416614031144),(3975,825503800,498257800,308588000,220,0,1620392718,620,1,17,0,0,0,_binary 'EAAFhpGyAADVbHoAAAAAAAAAAAAEAHUiag==',185,'',108284,3545511823723833084),(3976,825503800,498298100,308552100,219,0,1620392748,640,1,17,0,0,0,_binary 'EAAFhpIYAADVbGsAAAAAAAAAAAAEAHYjsg==',185,'',108285,3545511823723833085),(3977,98,506331600,262815000,221,0,1620392774,0,1,16,0,0,0,_binary 'AAAHOoqFAABMX0sAAAAAAAAAAP////8AAA==',163,'',1924247,420908719255),(3978,99,506331900,262813600,191,0,1620392777,0,1,9,0,0,0,_binary 'AAAAAAAAAAAAXg4AAAAAAAAAAAAAAAAAAA==',161,'',1423681,425203185985),(3985,97,506332200,262813800,74,0,1620392782,0,1,17,0,0,0,_binary 'AAAHr8O2AAAAXR8AABHyAAAAAAAAAAAAAA==',159,'',2203433,416614031145),(3986,825503800,498338700,308515900,219,0,1620392777,640,1,16,0,0,0,_binary 'EAAFhpJ+AADUbFsAAAAAAAAAAAAEAHYjyA==',185,'',108286,3545511823723833086),(3987,825503800,498379500,308479500,220,0,1620392806,650,1,16,0,0,0,_binary 'EAAFhpLlAADUbB0AAAAAAAAAAAAEAHYkFg==',185,'',108287,3545511823723833087),(3988,98,506331600,262815000,221,0,1620392834,0,1,16,0,0,0,_binary 'AAAHOoqFAABMX0sAAAAAAAAAAP////8AAA==',163,'',1924248,420908719256),(3989,99,506331900,262813600,191,0,1620392837,0,1,9,0,0,0,_binary 'AAAAAAAAAAAAXlcAAAAAAAAAAAAAAAAAAA==',161,'',1423682,425203185986),(3998,97,506332200,262813800,74,0,1620392842,0,1,17,0,0,0,_binary 'AAAHr8O2AAAAXSIAABHyAAAAAAAAAAAAAA==',159,'',2203434,416614031146),(3999,99,506331900,262813600,191,0,1620392849,0,1,9,0,0,0,_binary 'EAAAAAAAAAAAXbMAAAAAAAAAAAAAAAAAAA==',160,'',1423683,425203185987),(4000,825503800,498421000,308442400,219,0,1620392836,640,1,16,0,0,0,_binary 'EAAFhpNNAADUbAgAAAAAAAAAAAAEAHcjPA==',185,'',108288,3545511823723833088),(4001,825503800,498461100,308406500,220,0,1620392866,600,1,16,0,0,0,_binary 'EAAFhpOyAADTbHgAAAAAAAAAAAAEAHchSA==',185,'',108289,3545511823723833089),(4002,825503800,498475500,308394400,224,0,1620392877,570,1,17,0,0,0,_binary 'EAAFhpPWAADTbG0AAAAAAAAAAAAEAHcfjA==',185,'',108290,3545511823723833090),(4003,825503800,498480900,308391200,228,0,1620392881,560,1,17,0,0,0,_binary 'EAAFhpPiAADTbD4AAAAAAAAAAAAEAHcfWg==',185,'',108291,3545511823723833091),(4004,825503800,498487700,308388500,232,0,1620392886,560,1,17,0,0,0,_binary 'EAAFhpPyAADTbE4AAAAAAAAAAAAEAHcfrA==',185,'',108292,3545511823723833092),(4005,98,506331600,262815000,221,0,1620392894,0,1,16,0,0,0,_binary 'AAAHOoqFAABMX14AAAAAAAAAAP////8AAA==',163,'',1924249,420908719257),(4011,97,506332200,262813800,74,0,1620392902,0,1,16,0,0,0,_binary 'AAAHr8O2AAAAXRwAABHyAAAAAAAAAAAAAA==',159,'',2203435,416614031147),(4012,99,506331900,262813600,191,0,1620392908,0,1,9,0,0,0,_binary 'EAAAAAAAAAAAXRwAAAAAAAAAAAAAAAAAAA==',159,'',1423684,425203185988),(4013,98,506331600,262815000,221,0,1620392915,0,1,16,0,0,0,_binary 'EAAHOoqFAAAJXvMAAAAAAAAAAP////8ROg==',162,'',1924250,420908719258),(4014,825503800,498493400,308387200,236,0,1620392890,560,1,17,0,0,0,_binary 'EAAFhpP+AADTbBUAAAAAAAAAAAAEAHce2A==',185,'',108293,3545511823723833093),(4015,825503800,498503200,308386400,0,0,1620392897,550,1,17,0,0,0,_binary 'EAAFhpQTAADTbGUAAAAAAAAAAAAEAHce6A==',185,'',108294,3545511823723833094),(4016,825503800,498508800,308387100,4,0,1620392901,540,1,17,0,0,0,_binary 'EAAFhpQfAADSbFEAAAAAAAAAAAAEAHcd0g==',185,'',108295,3545511823723833095),(4017,825503800,498523200,308391400,8,0,1620392912,540,1,17,0,0,0,_binary 'EAAFhpQ/AADSbG0AAAAAAAAAAAAEAHceYA==',185,'',108296,3545511823723833096),(4023,97,506332200,262813800,74,0,1620392962,0,1,17,0,0,0,_binary 'AAAHr8O2AAAAXRoAABHyAAAAAAAAAAAAAA==',159,'',2203436,416614031148),(4024,99,506331900,262813600,191,0,1620392968,0,1,9,0,0,0,_binary 'EAAAAAAAAAAAXPgAAAAAAAAAAAAAAAAAAA==',159,'',1423685,425203185989),(4025,98,506331600,262815000,221,0,1620392975,0,1,16,0,0,0,_binary 'EAAHOoqFAABRbAAAAAAAAAAAAP////8RJA==',184,'',1924251,420908719259),(4026,825503800,498569100,308406700,8,0,1620392948,490,1,17,0,0,0,_binary 'EAAFhpSlAADTbCoAAAAAAAAAAAAEAHca0A==',185,'',108297,3545511823723833097),(4027,825503800,498590300,308413500,3,0,1620392966,480,1,17,0,0,0,_binary 'EAAFhpTUAADTbDwAAAAAAAAAAAAEAHgahA==',185,'',108298,3545511823723833098),(4028,825503800,498593900,308413600,239,0,1620392969,490,1,17,0,0,0,_binary 'EAAFhpTcAADTa8wAAAAAAAAAAAAEAHgalg==',184,'',108299,3545511823723833099),(4029,825503800,498596300,308413300,234,0,1620392971,480,1,17,0,0,0,_binary 'EAAFhpThAADTbDEAAAAAAAAAAAAEAHgZhg==',185,'',108300,3545511823723833100),(4030,825503800,498598700,308412500,229,0,1620392973,470,1,17,0,0,0,_binary 'EAAFhpTmAADTbB8AAAAAAAAAAAAEAHgZzg==',185,'',108301,3545511823723833101),(4031,825503800,498600900,308411300,225,0,1620392975,460,1,17,0,0,0,_binary 'EAAFhpTrAADTa+EAAAAAAAAAAAAEAHgYhA==',184,'',108302,3545511823723833102),(4032,825503800,498602900,308409800,221,-1,1620392977,410,1,17,0,0,0,_binary 'EAAFhpTwAADTa+MAAAAAAAAAAAAEAHgcXg==',184,'',108303,3545511823723833103),(4033,825503800,498604600,308408100,217,0,1620392979,390,1,17,0,0,0,_binary 'EAAFhpT0AADTbAgAAAAAAAAAAAAEAHgbKA==',185,'',108304,3545511823723833104),(4034,825503800,498606800,308405400,213,0,1620392982,350,1,17,0,0,0,_binary 'EAAFhpT6AADTbEEAAAAAAAAAAAAEAHggmA==',185,'',108305,3545511823723833105),(4035,825503800,498609500,308401600,209,0,1620392986,360,1,17,0,0,0,_binary 'EAAFhpUCAADTbEsAAAAAAAAAAAAEAHggNA==',185,'',108306,3545511823723833106),(4036,825503800,498611100,308398300,203,0,1620392989,350,1,17,0,0,0,_binary 'EAAFhpUIAADTbFgAAAAAAAAAAAAEAHggVA==',185,'',108307,3545511823723833107),(4037,825503800,498612000,308396000,199,0,1620392991,360,1,17,0,0,0,_binary 'EAAFhpUMAADTbFYAAAAAAAAAAAAEAHggog==',185,'',108308,3545511823723833108),(4038,825503800,498612800,308393400,195,0,1620392993,370,1,17,0,0,0,_binary 'EAAFhpUQAADTbF4AAAAAAAAAAAAEAHghfg==',185,'',108309,3545511823723833109),(4040,97,506332200,262813800,74,0,1620393022,0,1,17,0,0,0,_binary 'AAAHr8O2AAAAXRcAABHyAAAAAAAAAAAAAA==',159,'',2203437,416614031149),(4041,99,506331900,262813600,191,0,1620393028,0,1,9,0,0,0,_binary 'EAAAAAAAAAAAXOsAAAAAAAAAAAAAAAAAAA==',159,'',1423686,425203185990),(4042,98,506331600,262815000,221,0,1620393035,0,1,16,0,0,0,_binary 'EAAHOoqGAABQbDQAAAAAAAAAAP////8RPg==',185,'',1924252,420908719260),(4043,98,506331600,262815000,221,0,1620393037,0,1,16,0,0,0,_binary 'AAAHOoqGAABQaEMAAAAAAAAAAP////8AAA==',178,'',1924253,420908719261),(4044,99,506331900,262813600,191,0,1620393054,0,1,9,0,0,0,_binary 'AAAAAAAAAAAAXOgAAAAAAAAAAAAAAAAAAA==',159,'',1423687,425203185991),(4045,825503800,498631300,308325100,193,0,1620393036,460,1,17,0,0,0,_binary 'EAAFhpV2AADTbDcAAAAAAAAAAAAEAHghMA==',185,'',108310,3545511823723833110),(4046,825503800,498637500,308296800,189,0,1620393053,270,1,16,0,0,0,_binary 'EAAFhpWgAADTa9YAAAAAAAAAAAAEAHghiA==',184,'',108311,3545511823723833111),(4047,825503800,498637800,308295100,194,-2,1620393055,150,1,17,0,0,0,_binary 'EAAFhpWiAADTa5AAAAAAAAAAAAAEAHgTKg==',183,'',108312,3545511823723833112),(4048,825503800,498638100,308294000,199,-1,1620393058,70,1,17,0,0,0,_binary 'EAAFhpWkAADTbC8AAAAAAAAAAAAEAHgY5A==',185,'',108313,3545511823723833113),(4049,825503800,498638300,308293500,193,0,1620393061,50,1,17,0,0,0,_binary 'EAAFhpWlAADTbGUAAAAAAAAAAAAEAHgedA==',185,'',108314,3545511823723833114),(4050,825503800,498638300,308293300,189,0,1620393062,50,1,17,0,0,0,_binary 'EAAFhpWlAADTbEsAAAAAAAAAAAAEAHgkdg==',185,'',108315,3545511823723833115),(4051,100,506447600,349868300,20,0,1620393022,500,1,9,0,0,0,_binary 'EAAHV+KVAAAAaOQAAAAAAAAAAAAAAAAAAA==',179,'',1278649,429498008249),(4052,100,506449700,349870500,25,0,1620393024,520,1,8,0,0,0,_binary 'EAAHV+KVAAAAaQEAAAAAAAAAAAAAAAAAAA==',179,'',1278650,429498008250),(4053,100,506451700,349873300,29,0,1620393026,530,1,8,0,0,0,_binary 'EAAHV+KVAAAAaREAAAAAAAAAAAAAAAAAAA==',179,'',1278651,429498008251),(4054,100,506464600,349893100,25,0,1620393039,570,1,9,0,0,0,_binary 'EAAHV+KVAAAAaQsAAAAAAAAAAAAAAAAAAA==',179,'',1278652,429498008252),(4055,100,506470400,349899900,21,0,1620393044,600,1,9,0,0,0,_binary 'EAAHV+KVAAAAaRMAAAAAAAAAAAAAAAAAAA==',179,'',1278653,429498008253),(4056,100,506475800,349904400,17,0,1620393048,610,1,8,0,0,0,_binary 'EAAHV+KVAAAAaRMAAAAAAAAAAAAAAAAAAA==',179,'',1278654,429498008254),(4057,100,506481500,349908100,13,0,1620393052,620,1,9,0,0,0,_binary 'EAAHV+KVAAAAaQ4AAAAAAAAAAAAAAAAAAA==',179,'',1278655,429498008255),(4058,100,506487600,349910900,9,0,1620393056,630,1,9,0,0,0,_binary 'EAAHV+KVAAAAaRgAAAAAAAAAAAAAAAAAAA==',179,'',1278656,429498008256),(4059,97,506332200,262813800,74,0,1620393082,0,1,17,0,0,0,_binary 'AAAHr8O2AAAAXRUAABHyAAAAAAAAAAAAAA==',159,'',2203438,416614031150),(4060,100,506522600,349925200,13,0,1620393079,630,1,9,0,0,0,_binary 'EAAHV+KVAAAAaRYAAAAAAAAAAAAAAAAAAA==',179,'',1278657,429498008257),(4061,98,506331600,262815000,221,0,1620393097,0,1,16,0,0,0,_binary 'AAAHOoqGAABQYXoAAAAAAAAAAP////8AAA==',167,'',1924254,420908719262),(4062,99,506331900,262813600,191,0,1620393114,0,1,9,0,0,0,_binary 'AAAAAAAAAAAAXasAAAAAAAAAAAAAAAAAAA==',160,'',1423688,425203185992),(4063,825503800,498638600,308291400,193,0,1620393068,80,1,17,0,0,0,_binary 'EAAFhpWoAADUbBUAAAAAAAAAAAAEAHgcyA==',185,'',108316,3545511823723833116),(4064,825503800,498640700,308281700,189,0,1620393087,170,1,17,0,0,0,_binary 'EAAFhpW4AADUbFYAAAAAAAAAAAAEAHg5gA==',185,'',108317,3545511823723833117),(4065,825503800,498642600,308273500,193,0,1620393101,140,1,18,0,0,0,_binary 'EAAFhpXEAADUbFsAAAAAAAAAAAAEAHkwYA==',185,'',108318,3545511823723833118),(4066,100,506557000,349947100,17,0,1620393106,330,1,9,0,0,0,_binary 'EAAHV+KVAAAAaLMAAAAAAAAAAAAAAAAAAA==',179,'',1278658,429498008258),(4067,100,506564500,349952700,21,0,1620393130,90,1,9,0,0,0,_binary 'EAAHV+KVAAAAaOwAAAAAAAAAAAAAAAAAAA==',179,'',1278659,429498008259),(4068,97,506332200,262813800,74,0,1620393142,0,1,17,0,0,0,_binary 'AAAHr8O2AAAAXRUAABHyAAAAAAAAAAAAAA==',159,'',2203439,416614031151),(4069,98,506331600,262815000,221,0,1620393157,0,1,16,0,0,0,_binary 'AAAHOoqGAABQYHQAAAAAAAAAAP////8AAA==',165,'',1924255,420908719263),(4070,99,506331900,262813600,191,0,1620393174,0,1,9,0,0,0,_binary 'AAAAAAAAAAAAXc0AAAAAAAAAAAAAAAAAAA==',160,'',1423689,425203185993),(4071,825503800,498646100,308257500,189,0,1620393134,80,1,18,0,0,0,_binary 'EAAFhpXdAADTa8kAAAAAAAAAAAAEAHkWiA==',184,'',108319,3545511823723833119),(4072,825503800,498646200,308256700,185,0,1620393138,70,1,18,0,0,0,_binary 'EAAFhpXeAADTbGMAAAAAAAAAAAAEAHkvag==',185,'',108320,3545511823723833120),(4073,825503800,498646300,308256500,191,1,1620393139,90,1,18,0,0,0,_binary 'EAAFhpXeAADTbD4AAAAAAAAAAAAEAHkyQA==',185,'',108321,3545511823723833121),(4074,825503800,498646500,308255800,195,0,1620393141,90,1,17,0,0,0,_binary 'EAAFhpXfAADTbEsAAAAAAAAAAAAEAHkjMg==',185,'',108322,3545511823723833122),(4075,825503800,498648500,308247700,191,0,1620393155,210,1,16,0,0,0,_binary 'EAAFhpXsAADTbFMAAAAAAAAAAAAEAHki5A==',185,'',108323,3545511823723833123),(4076,825503800,498650400,308240000,195,0,1620393163,290,1,18,0,0,0,_binary 'EAAFhpX4AADTbBcAAAAAAAAAAAAEAHkjKA==',185,'',108324,3545511823723833124),(4077,825503800,498651700,308235800,200,0,1620393167,260,1,18,0,0,0,_binary 'EAAFhpX/AADTa/sAAAAAAAAAAAAEAHkeaA==',184,'',108325,3545511823723833125),(4078,825503800,498652800,308233300,207,0,1620393170,250,1,18,0,0,0,_binary 'EAAFhpYDAADTbGMAAAAAAAAAAAAEAHkgrA==',185,'',108326,3545511823723833126),(4079,825503800,498653300,308232500,211,1,1620393171,270,1,18,0,0,0,_binary 'EAAFhpYEAADTbDwAAAAAAAAAAAAEAHkiAg==',185,'',108327,3545511823723833127),(4080,825503800,498654400,308231100,216,0,1620393173,280,1,18,0,0,0,_binary 'EAAFhpYIAADTa/gAAAAAAAAAAAAEAHkgjA==',184,'',108328,3545511823723833128),(4081,825503800,498656100,308229500,221,0,1620393176,230,1,18,0,0,0,_binary 'EAAFhpYMAADTbDQAAAAAAAAAAAAEAHkb1g==',185,'',108329,3545511823723833129),(4082,825503800,498657200,308228700,227,0,1620393178,200,1,18,0,0,0,_binary 'EAAFhpYOAADSbDQAAAAAAAAAAAAEAHkbAg==',185,'',108330,3545511823723833130),(4083,825503800,498658300,308228300,232,0,1620393180,220,1,18,0,0,0,_binary 'EAAFhpYRAADSbAoAAAAAAAAAAAAEAHka/A==',185,'',108331,3545511823723833131),(4084,825503800,498658900,308228200,238,0,1620393181,220,1,18,0,0,0,_binary 'EAAFhpYSAADSbB8AAAAAAAAAAAAEAHkbJA==',185,'',108332,3545511823723833132),(4085,825503800,498660500,308228200,2,0,1620393184,220,1,18,0,0,0,_binary 'EAAFhpYWAADSbCIAAAAAAAAAAAAEAHkYwA==',185,'',108333,3545511823723833133),(4086,100,506596900,349980400,18,0,1620393190,330,1,9,0,0,0,_binary 'EAAHV+KVAAAAaOoAAAAAAAAAAAAAAAAAAA==',179,'',1278660,429498008260),(4087,100,506601800,349983800,14,0,1620393197,230,1,8,0,0,0,_binary 'EAAHV+KVAAAAaLAAAAAAAAAAAAAAAAAAAA==',179,'',1278661,429498008261),(4088,97,506332200,262813800,74,0,1620393202,0,1,17,0,0,0,_binary 'AAAHr8O2AAAAXRcAABHyAAAAAAAAAAAAAA==',159,'',2203440,416614031152),(4089,98,506331600,262815000,221,0,1620393217,0,1,15,0,0,0,_binary 'AAAHOoqGAABQX74AAAAAAAAAAP////8AAA==',163,'',1924256,420908719264),(4090,99,506331900,262813600,191,0,1620393234,0,1,9,0,0,0,_binary 'AAAAAAAAAAAAXhsAAAAAAAAAAAAAAAAAAA==',161,'',1423690,425203185994),(4091,825503800,498686600,308230200,3,0,1620393243,260,1,18,0,0,0,_binary 'EAAFhpZPAADSbEsAAAAAAAAAAAAEAHofAg==',185,'',108334,3545511823723833134),(4092,100,506603700,349984700,9,0,1620393201,170,1,9,0,0,0,_binary 'EAAHV+KVAAAAaGUAAAAAAAAAAAAAAAAAAA==',178,'',1278662,429498008262),(4093,100,506604800,349985200,14,0,1620393205,100,1,9,0,0,0,_binary 'EAAHV+KVAAAAaKkAAAAAAAAAAAAAAAAAAA==',179,'',1278663,429498008263),(4094,97,506332200,262813800,74,0,1620393262,0,1,17,0,0,0,_binary 'AAAHr8O2AAAAXRUAABHyAAAAAAAAAAAAAA==',159,'',2203441,416614031153),(4095,98,506331600,262815000,221,0,1620393277,0,1,16,0,0,0,_binary 'AAAHOoqGAABQX5wAAAAAAAAAAP////8AAA==',163,'',1924257,420908719265),(4096,99,506331900,262813600,191,0,1620393294,0,1,8,0,0,0,_binary 'AAAAAAAAAAAAXisAAAAAAAAAAAAAAAAAAA==',161,'',1423691,425203185995),(4097,825503800,498733800,308237100,3,0,1620393289,580,1,19,0,0,0,_binary 'EAAFhpa2AADSbEQAAAAAAAAAAAAEAHopmA==',185,'',108335,3545511823723833135),(4098,100,506605100,349985300,12,0,1620393265,0,1,10,0,0,0,_binary 'EAAHV+KVAAAAaPQAAAAAAAAAAAAAAAAAAA==',179,'',1278664,429498008264),(4099,97,506332200,262813800,74,0,1620393322,0,1,16,0,0,0,_binary 'AAAHr8O2AAAAXRUAABHyAAAAAAAAAAAAAA==',159,'',2203442,416614031154),(4100,98,506331600,262815000,221,0,1620393337,0,1,16,0,0,0,_binary 'AAAHOoqGAABQX3gAAAAAAAAAAP////8AAA==',163,'',1924258,420908719266),(4101,99,506331900,262813600,191,0,1620393354,0,1,9,0,0,0,_binary 'AAAAAAAAAAAAXfQAAAAAAAAAAAAAAAAAAA==',161,'',1423692,425203185996),(4102,825503800,498780500,308242700,237,0,1620393322,460,1,20,0,0,0,_binary 'EAAFhpcbAADSbD4AAAAAAAAAAAAEAHoqVA==',185,'',108336,3545511823723833136),(4103,825503800,498782700,308242200,233,0,1620393324,430,1,20,0,0,0,_binary 'EAAFhpcgAADSbCoAAAAAAAAAAAAEAHopIA==',185,'',108337,3545511823723833137),(4104,825503800,498784800,308241400,228,0,1620393326,440,1,19,0,0,0,_binary 'EAAFhpclAADSbHUAAAAAAAAAAAAEAHooWA==',185,'',108338,3545511823723833138),(4105,825503800,498786900,308240200,224,0,1620393328,430,1,20,0,0,0,_binary 'EAAFhpcqAADSbD4AAAAAAAAAAAAEAHoo1g==',185,'',108339,3545511823723833139),(4106,825503800,498796600,308232200,220,0,1620393338,470,1,19,0,0,0,_binary 'EAAFhpdDAADSbDQAAAAAAAAAAAAEAHssUg==',185,'',108340,3545511823723833140),(4107,100,506605100,349985300,12,0,1620393325,0,1,11,0,0,0,_binary 'EAAHV+KVAAAAaP4AAAAAAAAAAAAAAAAAAA==',179,'',1278665,429498008265),(4108,100,506605500,349985400,8,0,1620393359,50,1,11,0,0,0,_binary 'EAAHV+KVAAAAaNUAAAAAAAAAAAAAAAAAAA==',179,'',1278666,429498008266),(4109,100,506608400,349986200,2,0,1620393367,190,1,11,0,0,0,_binary 'EAAHV+KVAAAAaJwAAAAAAAAAAAAAAAAAAA==',179,'',1278667,429498008267),(4110,100,506608900,349986200,238,1,1620393368,210,1,11,0,0,0,_binary 'EAAHV+KVAAAAaJYAAAAAAAAAAAAAAAAAAA==',179,'',1278668,429498008268),(4111,100,506611200,349986200,3,0,1620393372,250,1,11,0,0,0,_binary 'EAAHV+KVAAAAaNAAAAAAAAAAAAAAAAAAAA==',179,'',1278669,429498008269),(4112,100,506618000,349986700,239,0,1620393380,400,1,11,0,0,0,_binary 'EAAHV+KVAAAAaPcAAAAAAAAAAAAAAAAAAA==',179,'',1278670,429498008270),(4113,97,506332200,262813800,74,0,1620393382,0,1,17,0,0,0,_binary 'AAAHr8O2AAAAXQ8AABHyAAAAAAAAAAAAAA==',159,'',2203443,416614031155),(4114,98,506331600,262815000,221,0,1620393397,0,1,17,0,0,0,_binary 'AAAHOoqGAABQX1MAAAAAAAAAAP////8AAA==',163,'',1924259,420908719267),(4115,99,506331900,262813600,191,0,1620393414,0,1,8,0,0,0,_binary 'AAAAAAAAAAAAXjgAAAAAAAAAAAAAAAAAAA==',161,'',1423693,425203185997),(4116,825503800,498838500,308196900,221,0,1620393371,660,1,20,0,0,0,_binary 'EAAFhpesAADSbCIAAAAAAAAAAAAEAHwlYA==',185,'',108341,3545511823723833141),(4117,825503800,498879700,308162600,221,0,1620393398,670,1,19,0,0,0,_binary 'EAAFhpgSAADSbDcAAAAAAAAAAAAEAHwcgA==',185,'',108342,3545511823723833142),(4118,825503800,498920600,308128600,221,0,1620393425,700,1,18,0,0,0,_binary 'EAAFhph4AADSbGMAAAAAAAAAAAAEAHwefA==',185,'',108343,3545511823723833143),(4119,100,506666200,349986900,239,0,1620393440,340,1,10,0,0,0,_binary 'EAAHV+KVAAAAaRgAAAAAAAAAAAAAAAAAAA==',179,'',1278671,429498008271),(4120,97,506332200,262813800,74,0,1620393442,0,1,17,0,0,0,_binary 'AAAHr8O2AAAAXRUAABHyAAAAAAAAAAAAAA==',159,'',2203444,416614031156),(4121,98,506331600,262815000,221,0,1620393457,0,1,17,0,0,0,_binary 'AAAHOoqGAABQX2MAAAAAAAAAAP////8AAA==',163,'',1924260,420908719268),(4122,99,506331900,262813600,191,0,1620393474,0,1,8,0,0,0,_binary 'AAAAAAAAAAAAXkAAAAAAAAAAAAAAAAAAAA==',161,'',1423694,425203185998),(4123,825503800,498961800,308094400,221,0,1620393451,700,1,18,0,0,0,_binary 'EAAFhpjeAADSbGAAAAAAAAAAAAAEAH0eOA==',185,'',108344,3545511823723833144),(4124,825503800,499003500,308059500,221,0,1620393478,690,1,18,0,0,0,_binary 'EAAFhplFAADSbEYAAAAAAAAAAAAEAH0dvA==',185,'',108345,3545511823723833145),(4125,100,506704600,349987100,4,0,1620393495,230,1,10,0,0,0,_binary 'EAAHV+KVAAAAaREAAAAAAAAAAAAAAAAAAA==',179,'',1278672,429498008272),(4126,100,506705700,349987200,239,0,1620393497,240,1,11,0,0,0,_binary 'EAAHV+KVAAAAaSMAAAAAAAAAAAAAAAAAAA==',179,'',1278673,429498008273),(4127,97,506332200,262813800,74,0,1620393502,0,1,17,0,0,0,_binary 'AAAHr8O2AAAAXQ0AABHyAAAAAAAAAAAAAA==',159,'',2203445,416614031157),(4128,98,506331600,262815000,221,0,1620393517,0,1,16,0,0,0,_binary 'AAAHOoqGAABQX14AAAAAAAAAAP////8AAA==',163,'',1924261,420908719269),(4129,99,506331900,262813600,191,0,1620393534,0,1,8,0,0,0,_binary 'AAAAAAAAAAAAXkIAAAAAAAAAAAAAAAAAAA==',161,'',1423695,425203185999),(4130,825503800,499045500,308024700,221,0,1620393508,580,1,18,0,0,0,_binary 'EAAFhpmtAADSbFsAAAAAAAAAAAAEAH0gfg==',185,'',108346,3545511823723833146),(4131,825503800,499086800,307990500,221,0,1620393544,520,1,19,0,0,0,_binary 'EAAFhpoTAADSbFMAAAAAAAAAAAAEAH0cGg==',185,'',108347,3545511823723833147),(4132,100,506720100,349986900,3,0,1620393519,200,1,11,0,0,0,_binary 'EAAHV+KVAAAAaQYAAAAAAAAAAAAAAAAAAA==',179,'',1278674,429498008274),(4133,100,506722400,349987000,239,0,1620393523,200,1,11,0,0,0,_binary 'EAAHV+KVAAAAaSgAAAAAAAAAAAAAAAAAAA==',179,'',1278675,429498008275),(4134,97,506332200,262813800,74,0,1620393562,0,1,18,0,0,0,_binary 'AAAHr8O2AAAAXRIAABHyAAAAAAAAAAAAAA==',159,'',2203446,416614031158),(4135,98,506331600,262815000,221,0,1620393577,0,1,16,0,0,0,_binary 'AAAHOoqGAABQX1YAAAAAAAAAAP////8AAA==',163,'',1924262,420908719270),(4136,99,506331900,262813600,191,0,1620393594,0,1,9,0,0,0,_binary 'AAAAAAAAAAAAXkIAAAAAAAAAAAAAAAAAAA==',161,'',1423696,425203186000),(4137,825503800,499128600,307956500,221,0,1620393582,530,1,20,0,0,0,_binary 'EAAFhpp6AADSbF4AAAAAAAAAAAAEAH4eUA==',185,'',108348,3545511823723833148),(4138,100,506753600,349986900,3,0,1620393572,110,1,9,0,0,0,_binary 'EAAHV+KVAAAAaGAAAAAAAAAAAAAAAAAAAA==',178,'',1278676,429498008276),(4139,100,506754900,349987300,8,0,1620393577,100,1,10,0,0,0,_binary 'EAAHV+KVAAAAaRsAAAAAAAAAAAAAAAAAAA==',179,'',1278677,429498008277),(4140,100,506755900,349987600,4,0,1620393580,150,1,10,0,0,0,_binary 'EAAHV+KVAAAAaRYAAAAAAAAAAAAAAAAAAA==',179,'',1278678,429498008278),(4141,100,506756800,349987700,0,1,1620393582,200,1,10,0,0,0,_binary 'EAAHV+KVAAAAaPcAAAAAAAAAAAAAAAAAAA==',179,'',1278679,429498008279),(4142,97,506332200,262813800,74,0,1620393622,0,1,18,0,0,0,_binary 'AAAHr8O2AAAAXQ8AABHyAAAAAAAAAAAAAA==',159,'',2203447,416614031159),(4143,98,506331600,262815000,221,0,1620393637,0,1,16,0,0,0,_binary 'AAAHOoqGAABQX0YAAAAAAAAAAP////8AAA==',163,'',1924263,420908719271),(4144,99,506331900,262813600,191,0,1620393654,0,1,7,0,0,0,_binary 'AAAAAAAAAAAAXkUAAAAAAAAAAAAAAAAAAA==',161,'',1423697,425203186001),(4145,825503800,499171200,307922000,221,0,1620393619,490,1,18,0,0,0,_binary 'EAAFhprjAADRbGMAAAAAAAAAAAAEAH4bvA==',185,'',108349,3545511823723833149),(4146,825503800,499213600,307887600,221,0,1620393657,510,1,20,0,0,0,_binary 'EAAFhptLAADRbFgAAAAAAAAAAAAEAH4khA==',185,'',108350,3545511823723833150),(4147,100,506803700,349987700,2,0,1620393622,520,1,10,0,0,0,_binary 'EAAHV+KVAAAAaN0AAAAAAAAAAAAAAAAAAA==',179,'',1278680,429498008280),(4148,100,506817600,349989900,6,0,1620393632,560,1,10,0,0,0,_binary 'EAAHV+KVAAAAaOwAAAAAAAAAAAAAAAAAAA==',179,'',1278681,429498008281),(4149,100,506863300,350006500,9,0,1620393668,550,1,10,0,0,0,_binary 'EAAHV+KVAAAAaQsAAAAAAAAAAAAAAAAAAA==',179,'',1278682,429498008282),(4150,97,506332200,262813800,74,0,1620393682,0,1,17,0,0,0,_binary 'AAAHr8O2AAAAXQgAABHyAAAAAAAAAAAAAA==',159,'',2203448,416614031160),(4151,98,506331600,262815000,221,0,1620393697,0,1,15,0,0,0,_binary 'AAAHOoqGAABQX0EAAAAAAAAAAP////8AAA==',163,'',1924264,420908719272),(4152,99,506331900,262813600,191,0,1620393714,0,1,8,0,0,0,_binary 'AAAAAAAAAAAAXkAAAAAAAAAAAAAAAAAAAA==',161,'',1423698,425203186002),(4153,825503800,499255800,307853600,221,0,1620393692,560,1,18,0,0,0,_binary 'EAAFhpu0AADRbDQAAAAAAAAAAAAEAH8olg==',185,'',108351,3545511823723833151),(4154,825503800,499268100,307841900,217,0,1620393702,560,1,19,0,0,0,_binary 'EAAFhpvTAADRbFgAAAAAAAAAAAAEAH8n5g==',185,'',108352,3545511823723833152),(4155,825503800,499283600,307823700,212,0,1620393716,550,1,16,0,0,0,_binary 'EAAFhpv9AADRbEEAAAAAAAAAAAAEAH8n9g==',185,'',108353,3545511823723833153),(4156,100,506909600,350024000,9,0,1620393700,640,1,10,0,0,0,_binary 'EAAHV+KVAAAAaRgAAAAAAAAAAAAAAAAAAA==',179,'',1278683,429498008283),(4157,100,506943200,350035700,4,0,1620393725,600,1,10,0,0,0,_binary 'EAAHV+KVAAAAaRYAAAAAAAAAAAAAAAAAAA==',179,'',1278684,429498008284),(4158,100,506952500,350036400,0,0,1620393731,630,1,10,0,0,0,_binary 'EAAHV+KVAAAAaQEAAAAAAAAAAAAAAAAAAA==',179,'',1278685,429498008285),(4159,100,506964100,350035700,236,0,1620393738,690,1,10,0,0,0,_binary 'EAAHV+KVAAAAaP4AAAAAAAAAAAAAAAAAAA==',179,'',1278686,429498008286),(4160,97,506332200,262813800,74,0,1620393742,0,1,17,0,0,0,_binary 'AAAHr8O2AAAAXQgAABHyAAAAAAAAAAAAAA==',159,'',2203449,416614031161),(4161,98,506331600,262815000,221,0,1620393757,0,1,15,0,0,0,_binary 'AAAHOoqGAABQXzcAAAAAAAAAAP////8AAA==',163,'',1924265,420908719273),(4162,99,506331900,262813600,191,0,1620393774,0,1,9,0,0,0,_binary 'AAAAAAAAAAAAXkoAAAAAAAAAAAAAAAAAAA==',161,'',1423699,425203186003),(4163,825503800,499319100,307776300,212,0,1620393748,620,1,19,0,0,0,_binary 'EAAFhpxkAADRa2wAAAAAAAAAAAAEAIAjfA==',183,'',108354,3545511823723833154),(4164,825503800,499354800,307728200,213,0,1620393774,770,1,17,0,0,0,_binary 'EAAFhpzMAADRbGMAAAAAAAAAAAAEAIAh4A==',185,'',108355,3545511823723833155),(4165,100,506969400,350034300,231,0,1620393741,720,1,9,0,0,0,_binary 'EAAHV+KVAAAAaP4AAAAAAAAAAAAAAAAAAA==',179,'',1278687,429498008287),(4166,100,506991000,350024200,227,0,1620393753,760,1,9,0,0,0,_binary 'EAAHV+KVAAAAaREAAAAAAAAAAAAAAAAAAA==',179,'',1278688,429498008288),(4167,100,507035700,349999600,228,0,1620393781,490,1,9,0,0,0,_binary 'EAAHV+KVAAAAaLYAAAAAAAAAAAAAAAAAAA==',179,'',1278689,429498008289),(4168,97,506332200,262813800,74,0,1620393802,0,1,18,0,0,0,_binary 'AAAHr8O2AAAAXQ0AABHyAAAAAAAAAAAAAA==',159,'',2203450,416614031162),(4169,98,506331600,262815000,221,0,1620393817,0,1,13,0,0,0,_binary 'AAAHOoqGAABQXyoAAAAAAAAAAP////8AAA==',163,'',1924266,420908719274),(4170,99,506331900,262813600,191,0,1620393834,0,1,9,0,0,0,_binary 'AAAAAAAAAAAAXkUAAAAAAAAAAAAAAAAAAA==',161,'',1423700,425203186004),(4171,825503800,499390300,307680300,212,0,1620393797,850,1,18,0,0,0,_binary 'EAAFhp0zAADRbCQAAAAAAAAAAAAEAIElCg==',185,'',108356,3545511823723833156),(4172,825503800,499425600,307632600,212,0,1620393819,830,1,18,0,0,0,_binary 'EAAFhp2aAADRbFYAAAAAAAAAAAAEAIEkWg==',185,'',108357,3545511823723833157),(4173,825503800,499461200,307584400,213,0,1620393842,810,1,17,0,0,0,_binary 'EAAFhp4AAADRbFgAAAAAAAAAAAAEAIEjLg==',185,'',108358,3545511823723833158),(4174,100,507081300,349975800,227,0,1620393816,710,1,9,0,0,0,_binary 'EAAHV+KVAAAAaRgAAAAAAAAAAAAAAAAAAA==',179,'',1278690,429498008290),(4175,100,507126300,349951800,227,0,1620393840,830,1,9,0,0,0,_binary 'EAAHV+KVAAAAaPcAAAAAAAAAAAAAAAAAAA==',179,'',1278691,429498008291),(4176,97,506332200,262813800,74,0,1620393862,0,1,17,0,0,0,_binary 'AAAHr8O2AAAAXQ0AABHyAAAAAAAAAAAAAA==',159,'',2203451,416614031163),(4177,98,506331600,262815000,221,0,1620393877,0,1,13,0,0,0,_binary 'AAAHOoqGAABQXyIAAAAAAAAAAP////8AAA==',163,'',1924267,420908719275),(4178,99,506331900,262813600,191,0,1620393894,0,1,8,0,0,0,_binary 'AAAAAAAAAAAAXj0AAAAAAAAAAAAAAAAAAA==',161,'',1423701,425203186005),(4179,825503800,499497000,307536100,213,0,1620393865,810,1,17,0,0,0,_binary 'EAAFhp5oAADRbGUAAAAAAAAAAAAEAIIjKg==',185,'',108359,3545511823723833159),(4180,825503800,499532100,307488800,213,0,1620393888,820,1,17,0,0,0,_binary 'EAAFhp7NAADQbFgAAAAAAAAAAAAEAIIjUg==',185,'',108360,3545511823723833160),(4181,100,507170800,349926500,227,0,1620393863,730,1,9,0,0,0,_binary 'EAAHV+KVAAAAaI8AAAAAAAAAAAAAAAAAAA==',179,'',1278692,429498008292),(4182,100,507215300,349902500,227,0,1620393890,690,1,9,0,0,0,_binary 'EAAHV+KVAAAAaPEAAAAAAAAAAAAAAAAAAA==',179,'',1278693,429498008293),(4183,100,507259300,349879500,227,0,1620393916,740,1,8,0,0,0,_binary 'EAAHV+KVAAAAaP4AAAAAAAAAAAAAAAAAAA==',179,'',1278694,429498008294),(4184,97,506332200,262813800,74,0,1620393922,0,1,16,0,0,0,_binary 'AAAHr8O2AAAAXQIAABHyAAAAAAAAAAAAAA==',159,'',2203452,416614031164),(4185,98,506331600,262815000,221,0,1620393937,0,1,15,0,0,0,_binary 'AAAHOoqGAABQXx0AAAAAAAAAAP////8AAA==',162,'',1924268,420908719276),(4186,99,506331900,262813600,191,0,1620393954,0,1,7,0,0,0,_binary 'AAAAAAAAAAAAXloAAAAAAAAAAAAAAAAAAA==',161,'',1423702,425203186006),(4187,825503800,499567500,307441000,212,0,1620393911,800,1,17,0,0,0,_binary 'EAAFhp8zAADQbC8AAAAAAAAAAAAEAIIizA==',185,'',108361,3545511823723833161),(4188,825503800,499603600,307392900,214,0,1620393935,770,1,16,0,0,0,_binary 'EAAFhp+bAADQbGsAAAAAAAAAAAAEAIIhfA==',185,'',108362,3545511823723833162),(4189,825503800,499642100,307349200,215,0,1620393959,810,1,17,0,0,0,_binary 'EAAFhqACAADQbFsAAAAAAAAAAAAEAIIjOg==',185,'',108363,3545511823723833163),(4190,100,507303000,349855800,227,0,1620393939,840,1,9,0,0,0,_binary 'EAAHV+KVAAAAaPEAAAAAAAAAAAAAAAAAAA==',179,'',1278695,429498008295),(4191,100,507348000,349831200,227,0,1620393964,690,1,9,0,0,0,_binary 'EAAHV+KVAAAAaQYAAAAAAAAAAAAAAAAAAA==',179,'',1278696,429498008296),(4192,97,506332200,262813800,74,0,1620393982,0,1,17,0,0,0,_binary 'AAAHr8O2AAAAXQgAABHyAAAAAAAAAAAAAA==',159,'',2203453,416614031165),(4193,98,506331600,262815000,221,0,1620393997,0,1,15,0,0,0,_binary 'AAAHOoqGAABQXtwAAAAAAAAAAP////8AAA==',162,'',1924269,420908719277),(4194,99,506331900,262813600,191,0,1620394014,0,1,7,0,0,0,_binary 'AAAAAAAAAAAAXloAAAAAAAAAAAAAAAAAAA==',161,'',1423703,425203186007),(4195,825503800,499680700,307305400,215,0,1620393984,690,1,17,0,0,0,_binary 'EAAFhqBqAADQbEYAAAAAAAAAAAAEAIIdpA==',185,'',108364,3545511823723833164),(4196,100,507393100,349808900,231,0,1620393996,650,1,9,0,0,0,_binary 'EAAHV+KVAAAAaQYAAAAAAAAAAAAAAAAAAA==',179,'',1278697,429498008297),(4197,100,507439600,349793900,232,0,1620394027,600,1,9,0,0,0,_binary 'EAAHV+KVAAAAaRsAAAAAAAAAAAAAAAAAAA==',179,'',1278698,429498008298),(4198,98,506331600,262815000,221,0,1620394040,0,1,15,0,0,0,_binary 'EAAHOoqGAABYXrUAAAAAAAAAAP////8RUg==',161,'',1924270,420908719278),(4199,97,506332200,262813800,74,0,1620394042,0,1,18,0,0,0,_binary 'AAAHr8O2AAAAXQAAABHyAAAAAAAAAAAAAA==',159,'',2203454,416614031166),(4200,98,506331600,262815000,221,0,1620394073,0,1,13,0,0,0,_binary 'AAAHOoqGAABYXZcAAAAAAAAAAP////8AAA==',160,'',1924271,420908719279),(4201,99,506331900,262813600,191,0,1620394074,0,1,7,0,0,0,_binary 'AAAAAAAAAAAAXlcAAAAAAAAAAAAAAAAAAA==',161,'',1423704,425203186008),(4202,825503800,499701700,307281800,216,0,1620394043,0,1,17,0,0,0,_binary 'EAAFhqCgAADQayMAAAAAAAAAAAAEAIIRXA==',183,'',108365,3545511823723833165),(4203,100,507485300,349779300,232,0,1620394053,810,1,8,0,0,0,_binary 'EAAHV+KVAAAAaSMAAAAAAAAAAAAAAAAAAA==',179,'',1278699,429498008299),(4204,100,507530600,349765200,232,0,1620394078,710,1,10,0,0,0,_binary 'EAAHV+KVAAAAaREAAAAAAAAAAAAAAAAAAA==',179,'',1278700,429498008300),(4205,100,507546800,349759100,228,0,1620394088,620,1,9,0,0,0,_binary 'EAAHV+KVAAAAaHwAAAAAAAAAAAAAAAAAAA==',178,'',1278701,429498008301),(4206,100,507551100,349756300,223,0,1620394091,630,1,8,0,0,0,_binary 'EAAHV+KVAAAAaQEAAAAAAAAAAAAAAAAAAA==',179,'',1278702,429498008302),(4207,97,506332200,262813800,74,0,1620394102,0,1,18,0,0,0,_binary 'AAAHr8O2AAAAXP0AABHyAAAAAAAAAAAAAA==',159,'',2203455,416614031167),(4208,100,507553800,349753800,218,0,1620394093,640,1,8,0,0,0,_binary 'EAAHV+KVAAAAaQQAAAAAAAAAAAAAAAAAAA==',179,'',1278703,429498008303),(4209,100,507556400,349750800,213,0,1620394095,650,1,9,0,0,0,_binary 'EAAHV+KVAAAAaPcAAAAAAAAAAAAAAAAAAA==',179,'',1278704,429498008304),(4210,100,507558600,349747200,209,0,1620394097,660,1,9,0,0,0,_binary 'EAAHV+KVAAAAaQsAAAAAAAAAAAAAAAAAAA==',179,'',1278705,429498008305),(4211,100,507561700,349741500,205,0,1620394100,630,1,9,0,0,0,_binary 'EAAHV+KVAAAAaLAAAAAAAAAAAAAAAAAAAA==',179,'',1278706,429498008306),(4212,100,507590600,349680900,204,0,1620394127,750,1,10,0,0,0,_binary 'EAAHV+KVAAAAaQQAAAAAAAAAAAAAAAAAAA==',179,'',1278707,429498008307),(4213,98,506331600,262815000,221,0,1620394133,0,1,14,0,0,0,_binary 'AAAHOoqGAABYXoMAAAAAAAAAAP////8AAA==',161,'',1924272,420908719280),(4214,99,506331900,262813600,191,0,1620394134,0,1,8,0,0,0,_binary 'AAAAAAAAAAAAXloAAAAAAAAAAAAAAAAAAA==',161,'',1423705,425203186009),(4215,825503800,499701700,307281800,216,0,1620394103,0,1,16,0,0,0,_binary 'EAAFhqCgAADRa8kAAAAAAAAAAAAEAIMRTg==',184,'',108366,3545511823723833166),(4216,100,507619100,349621100,204,0,1620394155,630,1,9,0,0,0,_binary 'EAAHV+KVAAAAaPwAAAAAAAAAAAAAAAAAAA==',179,'',1278708,429498008308),(4217,97,506332200,262813800,74,0,1620394162,0,1,18,0,0,0,_binary 'AAAHr8O2AAAAXQAAABHyAAAAAAAAAAAAAA==',159,'',2203456,416614031168),(4218,98,506331600,262815000,221,0,1620394193,0,1,16,0,0,0,_binary 'AAAHOoqGAABYXosAAAAAAAAAAP////8AAA==',161,'',1924273,420908719281),(4219,99,506331900,262813600,191,0,1620394194,0,1,8,0,0,0,_binary 'AAAAAAAAAAAAXloAAAAAAAAAAAAAAAAAAA==',161,'',1423706,425203186010),(4220,825503800,499701700,307281800,216,0,1620394163,0,1,16,0,0,0,_binary 'EAAFhqCgAADRa6UAAAAAAAAAAAAEAIMRMA==',184,'',108367,3545511823723833167),(4221,97,506332200,262813800,74,0,1620394222,0,1,18,0,0,0,_binary 'AAAHr8O2AAAAXQAAABHyAAAAAAAAAAAAAA==',159,'',2203457,416614031169),(4222,100,507647600,349560200,205,0,1620394192,610,1,10,0,0,0,_binary 'EAAHV+KVAAAAaQEAAAAAAAAAAAAAAAAAAA==',179,'',1278709,429498008309),(4223,100,507664900,349527200,210,0,1620394211,420,1,10,0,0,0,_binary 'EAAHV+KVAAAAaIwAAAAAAAAAAAAAAAAAAA==',179,'',1278710,429498008310),(4224,100,507670500,349518700,214,0,1620394220,290,1,11,0,0,0,_binary 'EAAHV+KVAAAAaKkAAAAAAAAAAAAAAAAAAA==',179,'',1278711,429498008311),(4225,98,506331600,262815000,221,0,1620394253,0,1,16,0,0,0,_binary 'AAAHOoqGAABYXswAAAAAAAAAAP////8AAA==',162,'',1924274,420908719282),(4226,99,506331900,262813600,191,0,1620394254,0,1,9,0,0,0,_binary 'AAAAAAAAAAAAXlcAAAAAAAAAAAAAAAAAAA==',161,'',1423707,425203186011),(4227,825503800,499701700,307281800,216,0,1620394223,0,1,16,0,0,0,_binary 'EAAFhqCgAADRa9kAAAAAAAAAAAAEAIMROg==',184,'',108368,3545511823723833168),(4228,100,507673400,349514900,217,0,1620394280,0,1,11,0,0,0,_binary 'EAAHV+KVAAAAaO8AAAAAAAAAAAAAAAAAAA==',179,'',1278712,429498008312),(4229,97,506332200,262813800,74,0,1620394282,0,1,18,0,0,0,_binary 'AAAHr8O2AAAAXQAAABHyAAAAAAAAAAAAAA==',159,'',2203458,416614031170),(4230,98,506331600,262815000,221,0,1620394313,0,1,15,0,0,0,_binary 'AAAHOoqGAABYXvMAAAAAAAAAAP////8AAA==',162,'',1924275,420908719283),(4231,99,506331900,262813600,191,0,1620394314,0,1,11,0,0,0,_binary 'AAAAAAAAAAAAXloAAAAAAAAAAAAAAAAAAA==',161,'',1423708,425203186012),(4232,825503800,499701700,307281800,216,0,1620394283,0,1,16,0,0,0,_binary 'EAAFhqCgAADSa8IAAAAAAAAAAAAEAIMRPA==',184,'',108369,3545511823723833169),(4233,100,507673700,349514500,211,0,1620394290,60,1,11,0,0,0,_binary 'EAAHV+KVAAAAaQYAAAAAAAAAAAAAAAAAAA==',179,'',1278713,429498008313),(4234,100,507677800,349508500,215,0,1620394303,260,1,11,0,0,0,_binary 'EAAHV+KVAAAAaMgAAAAAAAAAAAAAAAAAAA==',179,'',1278714,429498008314),(4235,97,506332200,262813800,74,0,1620394342,0,1,17,0,0,0,_binary 'AAAHr8O2AAAAXPsAABHyAAAAAAAAAAAAAA==',159,'',2203459,416614031171),(4236,98,506331600,262815000,221,0,1620394373,0,1,16,0,0,0,_binary 'AAAHOoqGAABYXxIAAAAAAAAAAP////8AAA==',162,'',1924276,420908719284),(4237,99,506331900,262813600,191,0,1620394374,0,1,10,0,0,0,_binary 'AAAAAAAAAAAAXlcAAAAAAAAAAAAAAAAAAA==',161,'',1423709,425203186013),(4238,825503800,499701700,307281800,216,0,1620394343,0,1,17,0,0,0,_binary 'EAAFhqCgAADSa9EAAAAAAAAAAAAEAIMRSA==',184,'',108370,3545511823723833170),(4239,100,507715800,349462400,215,0,1620394344,630,1,11,0,0,0,_binary 'EAAHV+KVAAAAaQkAAAAAAAAAAAAAAAAAAA==',179,'',1278715,429498008315),(4240,100,507752900,349418700,215,0,1620394374,570,1,11,0,0,0,_binary 'EAAHV+KVAAAAaSsAAAAAAAAAAAAAAAAAAA==',179,'',1278716,429498008316),(4241,97,506332200,262813800,74,0,1620394402,0,1,17,0,0,0,_binary 'AAAHr8O2AAAAXPgAABHyAAAAAAAAAAAAAA==',159,'',2203460,416614031172),(4242,98,506331600,262815000,221,0,1620394433,0,1,16,0,0,0,_binary 'AAAHOoqGAABYXxoAAAAAAAAAAP////8AAA==',162,'',1924277,420908719285),(4243,99,506331900,262813600,191,0,1620394434,0,1,10,0,0,0,_binary 'AAAAAAAAAAAAXkAAAAAAAAAAAAAAAAAAAA==',161,'',1423710,425203186014),(4244,825503800,499701700,307281800,216,0,1620394403,0,1,18,0,0,0,_binary 'EAAFhqCgAADSa/0AAAAAAAAAAAAEAIMRIg==',184,'',108371,3545511823723833171),(4245,97,506332200,262813800,74,0,1620394462,0,1,17,0,0,0,_binary 'AAAHr8O2AAAAXPgAABHyAAAAAAAAAAAAAA==',159,'',2203461,416614031173),(4246,100,507790800,349373300,215,0,1620394411,530,1,11,0,0,0,_binary 'EAAHV+KVAAAAaTUAAAAAAAAAAAAAAAAAAA==',179,'',1278717,429498008317),(4247,100,507803000,349359700,219,0,1620394422,550,1,11,0,0,0,_binary 'EAAHV+KVAAAAaSUAAAAAAAAAAAAAAAAAAA==',179,'',1278718,429498008318),(4248,100,507808000,349355800,223,0,1620394426,530,1,11,0,0,0,_binary 'EAAHV+KVAAAAaTgAAAAAAAAAAAAAAAAAAA==',179,'',1278719,429498008319),(4249,100,507813100,349352800,228,0,1620394430,530,1,10,0,0,0,_binary 'EAAHV+KVAAAAaT8AAAAAAAAAAAAAAAAAAA==',179,'',1278720,429498008320),(4250,100,507818500,349350700,232,0,1620394434,540,1,11,0,0,0,_binary 'EAAHV+KVAAAAaSUAAAAAAAAAAAAAAAAAAA==',179,'',1278721,429498008321),(4251,100,507865400,349338700,233,0,1620394468,540,1,11,0,0,0,_binary 'EAAHV+KVAAAAaREAAAAAAAAAAAAAAAAAAA==',179,'',1278722,429498008322),(4252,98,506331600,262815000,221,0,1620394493,0,1,16,0,0,0,_binary 'AAAHOoqGAABYXyIAAAAAAAAAAP////8AAA==',163,'',1924278,420908719286),(4253,99,506331900,262813600,191,0,1620394494,0,1,9,0,0,0,_binary 'AAAAAAAAAAAAXhkAAAAAAAAAAAAAAAAAAA==',161,'',1423711,425203186015),(4254,825503800,499701700,307281800,216,0,1620394463,0,1,17,0,0,0,_binary 'EAAFhqCgAADTa6AAAAAAAAAAAAAEAIMRLA==',184,'',108372,3545511823723833172),(4255,100,507879800,349334700,238,0,1620394483,250,1,9,0,0,0,_binary 'EAAHV+KVAAAAaM0AAAAAAAAAAAAAAAAAAA==',179,'',1278723,429498008323),(4256,100,507880300,349334700,3,0,1620394484,250,1,10,0,0,0,_binary 'EAAHV+KVAAAAaJkAAAAAAAAAAAAAAAAAAA==',179,'',1278724,429498008324),(4257,100,507881500,349334600,238,0,1620394486,270,1,11,0,0,0,_binary 'EAAHV+KVAAAAaQsAAAAAAAAAAAAAAAAAAA==',179,'',1278725,429498008325),(4258,100,507882800,349334300,233,0,1620394488,280,1,11,0,0,0,_binary 'EAAHV+KVAAAAaQEAAAAAAAAAAAAAAAAAAA==',179,'',1278726,429498008326),(4259,97,506332200,262813800,74,0,1620394522,0,1,15,0,0,0,_binary 'AAAHr8O2AAAAXPsAABHyAAAAAAAAAAAAAA==',159,'',2203462,416614031174),(4260,100,507894700,349331000,227,0,1620394511,190,1,11,0,0,0,_binary 'EAAHV+KVAAAAaRsAAAAAAAAAAAAAAAAAAA==',179,'',1278727,429498008327),(4261,100,507895200,349330700,222,0,1620394512,200,1,10,0,0,0,_binary 'EAAHV+KVAAAAaTIAAAAAAAAAAAAAAAAAAA==',179,'',1278728,429498008328),(4262,100,507895600,349330200,218,1,1620394513,220,1,10,0,0,0,_binary 'EAAHV+KVAAAAaR4AAAAAAAAAAAAAAAAAAA==',179,'',1278729,429498008329),(4263,98,506331600,262815000,221,0,1620394553,0,1,16,0,0,0,_binary 'AAAHOoqGAABYXycAAAAAAAAAAP////8AAA==',163,'',1924279,420908719287),(4264,99,506331900,262813600,191,0,1620394554,0,1,9,0,0,0,_binary 'AAAAAAAAAAAAXeUAAAAAAAAAAAAAAAAAAA==',160,'',1423712,425203186016),(4265,825503800,499724200,307256100,219,0,1620394523,130,1,18,0,0,0,_binary 'EAAFhqDfAADSbD4AAAAAAAAAAAAEAIMZsA==',185,'',108373,3545511823723833173),(4266,825503800,499724500,307255800,213,0,1620394524,130,1,18,0,0,0,_binary 'EAAFhqDfAADSbD4AAAAAAAAAAAAEAIMZsA==',185,'',108374,3545511823723833174),(4267,825503800,499740000,307238000,217,0,1620394555,240,1,18,0,0,0,_binary 'EAAFhqEJAADQa+kAAAAAAAAAAAAEAIQbrg==',184,'',108375,3545511823723833175),(4268,100,507904100,349321600,214,0,1620394528,260,1,11,0,0,0,_binary 'EAAHV+KVAAAAaLMAAAAAAAAAAAAAAAAAAA==',179,'',1278730,429498008330),(4269,100,507904900,349320400,210,-1,1620394530,210,1,11,0,0,0,_binary 'EAAHV+KVAAAAaHUAAAAAAAAAAAAAAAAAAA==',178,'',1278731,429498008331),(4270,100,507905200,349319800,206,-1,1620394531,190,1,11,0,0,0,_binary 'EAAHV+KVAAAAaHwAAAAAAAAAAAAAAAAAAA==',178,'',1278732,429498008332),(4271,100,507906000,349318700,211,0,1620394533,210,1,11,0,0,0,_binary 'EAAHV+KVAAAAaNUAAAAAAAAAAAAAAAAAAA==',179,'',1278733,429498008333),(4272,100,507907000,349317000,207,0,1620394536,200,1,11,0,0,0,_binary 'EAAHV+KVAAAAaSMAAAAAAAAAAAAAAAAAAA==',179,'',1278734,429498008334),(4273,100,507909500,349312000,203,0,1620394547,140,1,11,0,0,0,_binary 'EAAHV+KVAAAAaR4AAAAAAAAAAAAAAAAAAA==',179,'',1278735,429498008335),(4274,100,507911500,349307000,198,0,1620394555,230,1,10,0,0,0,_binary 'EAAHV+KVAAAAaSAAAAAAAAAAAAAAAAAAAA==',179,'',1278736,429498008336),(4275,100,507913600,349300000,194,0,1620394562,300,1,10,0,0,0,_binary 'EAAHV+KVAAAAaR4AAAAAAAAAAAAAAAAAAA==',179,'',1278737,429498008337),(4276,97,506332200,262813800,74,0,1620394582,0,1,17,0,0,0,_binary 'AAAHr8O2AAAAXPMAABHyAAAAAAAAAAAAAA==',159,'',2203463,416614031175),(4277,98,506331600,262815000,221,0,1620394613,0,1,16,0,0,0,_binary 'AAAHOoqGAABYXyoAAAAAAAAAAP////8AAA==',163,'',1924280,420908719288),(4278,99,506331900,262813600,191,0,1620394614,0,1,9,0,0,0,_binary 'AAAAAAAAAAAAXcsAAAAAAAAAAAAAAAAAAA==',160,'',1423713,425203186017),(4279,825503800,499762500,307212500,221,0,1620394588,300,1,18,0,0,0,_binary 'EAAFhqFGAADPbEsAAAAAAAAAAAAEAIQbWA==',185,'',108376,3545511823723833176),(4280,825503800,499764500,307210800,217,0,1620394591,310,1,18,0,0,0,_binary 'EAAFhqFLAADPbDwAAAAAAAAAAAAEAIQbUA==',185,'',108377,3545511823723833177),(4281,100,507928700,349234500,198,0,1620394596,700,1,10,0,0,0,_binary 'EAAHV+KVAAAAaS0AAAAAAAAAAAAAAAAAAA==',179,'',1278738,429498008338),(4282,100,507932300,349224900,202,0,1620394600,700,1,10,0,0,0,_binary 'EAAHV+KVAAAAaTUAAAAAAAAAAAAAAAAAAA==',179,'',1278739,429498008339),(4283,100,507938600,349212000,206,0,1620394606,690,1,11,0,0,0,_binary 'EAAHV+KVAAAAaTUAAAAAAAAAAAAAAAAAAA==',179,'',1278740,429498008340),(4284,100,507971300,349158900,209,0,1620394633,750,1,11,0,0,0,_binary 'EAAHV+KVAAAAaSsAAAAAAAAAAAAAAAAAAA==',179,'',1278741,429498008341),(4285,97,506332200,262813800,74,0,1620394642,0,1,15,0,0,0,_binary 'AAAHr8O2AAAAXLcAAAAAAAAAAAAAAAAAAA==',158,'',2203464,416614031176),(4286,98,506331600,262815000,221,0,1620394673,0,1,17,0,0,0,_binary 'AAAHOoqGAABYXy8AAAAAAAAAAP////8AAA==',163,'',1924281,420908719289),(4287,99,506331900,262813600,191,0,1620394674,0,1,9,0,0,0,_binary 'AAAAAAAAAAAAXjMAAAAAAAAAAAAAAAAAAA==',161,'',1423714,425203186018),(4288,825503800,499802700,307167600,216,0,1620394632,570,1,18,0,0,0,_binary 'EAAFhqGzAADPbCcAAAAAAAAAAAAEAIUoQg==',185,'',108378,3545511823723833178),(4289,825503800,499840900,307123600,215,0,1620394664,600,1,17,0,0,0,_binary 'EAAFhqIbAADPbGsAAAAAAAAAAAAEAIUhSA==',185,'',108379,3545511823723833179),(4290,100,508003900,349106200,209,0,1620394658,750,1,11,0,0,0,_binary 'EAAHV+KVAAAAaRYAAAAAAAAAAAAAAAAAAA==',179,'',1278742,429498008342),(4291,100,508037300,349052100,209,0,1620394683,730,1,11,0,0,0,_binary 'EAAHV+KVAAAAaSUAAAAAAAAAAAAAAAAAAA==',179,'',1278743,429498008343),(4292,97,506332200,262813800,74,0,1620394702,0,1,17,0,0,0,_binary 'AAAHr8O2AAAAXOsAAAAAAAAAAAAAAAAAAA==',159,'',2203465,416614031177),(4293,99,506331900,262813600,191,0,1620394734,0,1,8,0,0,0,_binary 'AAAAAAAAAAAAXfIAAAAAAAAAAAAAAAAAAA==',160,'',1423715,425203186019),(4294,825503800,499879300,307080200,215,0,1620394700,530,1,17,0,0,0,_binary 'EAAFhqKCAADPbDcAAAAAAAAAAAAEAIUd4A==',185,'',108380,3545511823723833180),(4295,825503800,499917200,307034700,213,0,1620394733,620,1,17,0,0,0,_binary 'EAAFhqLrAADQbEkAAAAAAAAAAAAEAIUjSA==',185,'',108381,3545511823723833181),(4296,100,508064100,349009800,213,0,1620394703,730,1,11,0,0,0,_binary 'EAAHV+KVAAAAaM0AAAAAAAAAAAAAAAAAAA==',179,'',1278744,429498008344),(4297,100,508068400,349004400,217,0,1620394706,740,1,11,0,0,0,_binary 'EAAHV+KVAAAAaRYAAAAAAAAAAAAAAAAAAA==',179,'',1278745,429498008345),(4298,100,508073000,348999900,221,0,1620394709,750,1,11,0,0,0,_binary 'EAAHV+KVAAAAaTIAAAAAAAAAAAAAAAAAAA==',179,'',1278746,429498008346),(4299,100,508116700,348968500,223,0,1620394734,790,1,10,0,0,0,_binary 'EAAHV+KVAAAAaSsAAAAAAAAAAAAAAAAAAA==',179,'',1278747,429498008347),(4300,100,508159700,348937700,224,0,1620394757,840,1,10,0,0,0,_binary 'EAAHV+KVAAAAaS0AAAAAAAAAAAAAAAAAAA==',179,'',1278748,429498008348),(4301,99,506331900,262813600,191,0,1620394794,0,1,8,0,0,0,_binary 'AAAAAAAAAAAAXjUAAAAAAAAAAAAAAAAAAA==',161,'',1423716,425203186020);

--
-- Table structure for table `parameters`
--

CREATE TABLE `parameters` (
  `Id` int(11) NOT NULL AUTO_INCREMENT,
  `Number` int(11) NOT NULL COMMENT 'Номер параметра',
  `Value` varchar(255) DEFAULT NULL COMMENT 'Значение',
  PRIMARY KEY (`Id`)
) ENGINE=InnoDB AUTO_INCREMENT=15 DEFAULT CHARSET=cp1251;

--
-- Dumping data for table `parameters`
--

INSERT INTO `parameters` VALUES (1,24,'False'),(2,18,'True'),(3,13,'True'),(4,22,'0'),(5,12,'False'),(6,21,'uk'),(7,19,'osm.lwco.biz'),(8,23,'f36cef7840e21b8df5011fe88cb3e408'),(9,25,'False'),(10,20,'----'),(11,26,'ABQIAAAAWaQgWiEBF3lW97ifKnAczhRAzBk5Igf8Z5n2W3hNnMT0j2TikxTLtVIGU7hCLLHMAuAMt-BO5UrEWA'),(12,29,'812'),(13,27,'False'),(14,28,'gisfile.com');

--
-- Table structure for table `pcbdata`
--

CREATE TABLE `pcbdata` (
  `Id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT 'Индекс',
  `Typedata` varchar(255) NOT NULL DEFAULT ' ' COMMENT 'Тип данных',
  `koeffK` double NOT NULL DEFAULT '0' COMMENT 'Коеффициент К',
  `Startbit` int(11) NOT NULL DEFAULT '0' COMMENT 'Стартовый бит поля',
  `Lengthbit` int(11) NOT NULL DEFAULT '0' COMMENT 'Длина поля',
  `Comment` varchar(255) DEFAULT ' ' COMMENT 'Коментарий',
  `Idpcb` int(11) NOT NULL DEFAULT '0' COMMENT 'Индекс платы датчика',
  `NameVal` varchar(12) DEFAULT ' ' COMMENT 'Name meassurement value',
  `NumAlg` int(11) DEFAULT '0' COMMENT 'Number of algorithm',
  `Shifter` double DEFAULT '0' COMMENT 'Shift coefficient',
  `S` tinyint(1) DEFAULT '0' COMMENT 'Sign arifmetic',
  PRIMARY KEY (`Id`)
) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=cp1251 AVG_ROW_LENGTH=2340 COMMENT='Описание платы датчиков';

--
-- Dumping data for table `pcbdata`
--

INSERT INTO `pcbdata` VALUES (1,'бортмережа',0.1181,36,8,'',1,'В',6,0,0),(2,'запалювання',1,60,1,'',1,'#',5,0,0),(3,'правий бак',1,80,16,'',2,' л',7,0,0),(4,'штатний ДРП',0.4,128,8,'',2,' %',11,0,0),(5,'оберти двигуна',0.125,0,16,'',2,' rpm',5,0,0),(6,'витрата',0.5,16,64,'',2,' л',8,0,0),(7,'бортмережа',0.001,112,16,'',2,' В',6,0,0),(8,'пробіг за тахографом',0.005,152,32,'',2,' км',6,0,0),(9,'запалювання',1,196,1,'',2,' ',2,0,0),(10,'лівий бак',1,96,16,'',2,'л',7,0,0);

--
-- Table structure for table `pcbversion`
--

CREATE TABLE `pcbversion` (
  `Id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT 'Индекс',
  `Name` varchar(50) NOT NULL DEFAULT '*' COMMENT 'Имя платы датчика',
  `Comment` varchar(255) DEFAULT ' ' COMMENT 'Комментарий',
  `MobitelId` int(11) DEFAULT '-1' COMMENT 'ID машины на которую назначена эта плата датчиков',
  PRIMARY KEY (`Id`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=cp1251 AVG_ROW_LENGTH=5461 COMMENT='Распределение данных для версии исполнения платы датчиков';

--
-- Dumping data for table `pcbversion`
--

INSERT INTO `pcbversion` VALUES (1,'SCAD_37','для версии исполнения ПД SCAD',-1),(2,'SCAD_CAN64','для версии исполнения ПД SCAD',-1);

--
-- Table structure for table `points`
--

CREATE TABLE `points` (
  `Point_ID` int(11) NOT NULL AUTO_INCREMENT,
  `Name` char(50) DEFAULT NULL,
  `Descr` char(200) DEFAULT NULL,
  `ID` int(11) DEFAULT '0',
  `Latitude` int(11) DEFAULT '0',
  `Longitude` int(11) DEFAULT '0',
  `Zone_ID` int(11) DEFAULT '0',
  PRIMARY KEY (`Point_ID`),
  KEY `FK_points_zones` (`Zone_ID`),
  CONSTRAINT `FK_points_zones` FOREIGN KEY (`Zone_ID`) REFERENCES `zones` (`Zone_ID`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=cp1251;

--
-- Dumping data for table `points`
--


--
-- Table structure for table `relationalgorithms`
--

CREATE TABLE `relationalgorithms` (
  `ID` int(11) NOT NULL AUTO_INCREMENT,
  `AlgorithmID` int(11) NOT NULL DEFAULT '0',
  `SensorID` int(11) NOT NULL DEFAULT '0',
  PRIMARY KEY (`ID`),
  UNIQUE KEY `ID` (`ID`)
) ENGINE=InnoDB AUTO_INCREMENT=37 DEFAULT CHARSET=cp1251;

--
-- Dumping data for table `relationalgorithms`
--

INSERT INTO `relationalgorithms` VALUES (3,5,3),(5,4,5),(6,6,6),(7,2,7),(9,7,9),(10,5,10),(11,8,11),(12,4,12),(13,9,13),(14,2,14),(15,7,15),(18,5,18),(20,6,20),(21,6,21),(22,2,22),(25,5,25),(27,4,27),(28,6,28),(29,2,29),(31,7,31),(32,5,32),(33,8,33),(34,4,34),(35,6,35),(36,2,36);

--
-- Table structure for table `report_pass_zones`
--

CREATE TABLE `report_pass_zones` (
  `ID` int(11) NOT NULL AUTO_INCREMENT,
  `ZoneID` int(11) NOT NULL COMMENT 'Идентификатор КЗ',
  PRIMARY KEY (`ID`),
  KEY `IDX_ZoneID` (`ZoneID`) USING BTREE,
  CONSTRAINT `FK_RPZ_Zones` FOREIGN KEY (`ZoneID`) REFERENCES `zones` (`Zone_ID`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=cp1251 COMMENT='Список зон, используемый в отчетах по пассажиропотоку.';

--
-- Dumping data for table `report_pass_zones`
--


--
-- Table structure for table `route_items`
--

CREATE TABLE `route_items` (
  `ID` int(11) NOT NULL AUTO_INCREMENT,
  `Seq` int(11) DEFAULT NULL,
  `Route_ID` int(11) DEFAULT NULL,
  `Zone_ID` int(11) DEFAULT NULL,
  `Zone_IO` int(11) DEFAULT NULL,
  `GoNext_Min` int(11) DEFAULT NULL,
  `GoNext_Max` int(11) DEFAULT NULL,
  `Link_Item` int(11) DEFAULT NULL,
  `Link_Info` int(11) DEFAULT NULL,
  PRIMARY KEY (`ID`)
) ENGINE=InnoDB DEFAULT CHARSET=cp1251;

--
-- Dumping data for table `route_items`
--


--
-- Table structure for table `route_list`
--

CREATE TABLE `route_list` (
  `Route_ID` int(11) NOT NULL AUTO_INCREMENT,
  `GIS` blob,
  `Name` varchar(50) DEFAULT NULL,
  `Descr` varchar(200) DEFAULT NULL,
  `Modified` int(11) DEFAULT NULL,
  PRIMARY KEY (`Route_ID`)
) ENGINE=InnoDB DEFAULT CHARSET=cp1251;

--
-- Dumping data for table `route_list`
--


--
-- Table structure for table `route_lists`
--

CREATE TABLE `route_lists` (
  `ID` int(11) NOT NULL AUTO_INCREMENT,
  `Parent` int(11) DEFAULT NULL,
  `Title` varchar(70) DEFAULT NULL,
  `Data` text,
  PRIMARY KEY (`ID`)
) ENGINE=InnoDB DEFAULT CHARSET=cp1251;

--
-- Dumping data for table `route_lists`
--


--
-- Table structure for table `route_mobitel_links`
--

CREATE TABLE `route_mobitel_links` (
  `ID` int(11) NOT NULL AUTO_INCREMENT,
  `List_ID` int(11) DEFAULT NULL,
  `Route_ID` int(11) DEFAULT NULL,
  `Mobitel_ID` int(11) DEFAULT NULL,
  `Time1` int(11) DEFAULT NULL,
  `Time2` int(11) DEFAULT NULL,
  PRIMARY KEY (`ID`)
) ENGINE=InnoDB DEFAULT CHARSET=cp1251;

--
-- Dumping data for table `route_mobitel_links`
--


--
-- Table structure for table `route_mobitel_plans`
--

CREATE TABLE `route_mobitel_plans` (
  `ID` int(11) NOT NULL AUTO_INCREMENT,
  `Title` varchar(70) DEFAULT NULL,
  `Time1` int(11) DEFAULT NULL,
  `Time2` int(11) DEFAULT NULL,
  PRIMARY KEY (`ID`)
) ENGINE=InnoDB DEFAULT CHARSET=cp1251;

--
-- Dumping data for table `route_mobitel_plans`
--


--
-- Table structure for table `route_points`
--

CREATE TABLE `route_points` (
  `ID` int(11) NOT NULL AUTO_INCREMENT,
  `Route_ID` int(11) DEFAULT NULL,
  `Zone_ID` int(11) DEFAULT NULL,
  PRIMARY KEY (`ID`)
) ENGINE=InnoDB DEFAULT CHARSET=cp1251;

--
-- Dumping data for table `route_points`
--


--
-- Table structure for table `rt_events`
--

CREATE TABLE `rt_events` (
  `Id` int(11) NOT NULL AUTO_INCREMENT,
  `Name` varchar(50) NOT NULL,
  PRIMARY KEY (`Id`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=cp1251;

--
-- Dumping data for table `rt_events`
--

INSERT INTO `rt_events` VALUES (1,'Въезд'),(2,'Выезд');

--
-- Table structure for table `rt_route`
--

CREATE TABLE `rt_route` (
  `Id` int(11) NOT NULL AUTO_INCREMENT,
  `Id_sample` int(11) NOT NULL COMMENT 'Ссылка на шаблон маршрута ',
  `Id_mobitel` int(11) NOT NULL DEFAULT '0' COMMENT 'Транспортное средство ',
  `Id_driver` int(11) NOT NULL DEFAULT '0' COMMENT 'Водитель',
  `TimeStartPlan` datetime DEFAULT NULL COMMENT 'План время начала маршрута',
  `Distance` double NOT NULL DEFAULT '0' COMMENT 'Общий путь, км',
  `TimePlanTotal` varchar(20) DEFAULT NULL COMMENT 'Общее время на маршруте (план)',
  `TimeFactTotal` varchar(20) DEFAULT NULL COMMENT 'Общее время на маршруте (факт)',
  `Deviation` varchar(20) DEFAULT NULL COMMENT 'Отклонение от графика',
  `DeviationAr` varchar(20) DEFAULT NULL COMMENT 'Отклонение по времени прибытия',
  `Remark` text COMMENT 'Примечание',
  `FuelStart` double(10,2) NOT NULL DEFAULT '0.00' COMMENT 'ДУТ Топливо в начале',
  `FuelAdd` double(10,2) NOT NULL DEFAULT '0.00' COMMENT 'ДУТ Заправлено',
  `FuelSub` double(10,2) NOT NULL DEFAULT '0.00' COMMENT 'ДУТ Слито',
  `FuelEnd` double(10,2) NOT NULL DEFAULT '0.00' COMMENT 'ДУТ Топливо в конце',
  `FuelExpens` double(10,2) NOT NULL DEFAULT '0.00' COMMENT 'ДУТ Общий расход топлива',
  `FuelExpensAvg` double(10,2) NOT NULL DEFAULT '0.00' COMMENT 'ДУТ Средний расход,  л/100 км',
  `Fuel_ExpensMove` double(10,2) NOT NULL DEFAULT '0.00' COMMENT 'ДРТ/CAN Расход топлива в движении, л',
  `Fuel_ExpensStop` double(10,2) NOT NULL DEFAULT '0.00' COMMENT 'ДРТ/CAN Расход топлива на стоянках, л',
  `Fuel_ExpensTotal` double(10,2) NOT NULL DEFAULT '0.00' COMMENT 'ДРТ/CAN Общий расход, л',
  `Fuel_ExpensAvg` double(10,2) NOT NULL DEFAULT '0.00' COMMENT 'ДРТ/CAN Средний расход, л/100 км',
  `TimeMove` varchar(20) DEFAULT NULL COMMENT 'Время движения',
  `TimeStop` varchar(20) DEFAULT NULL COMMENT 'Время остановок',
  `SpeedAvg` double(10,2) DEFAULT '0.00' COMMENT 'Средняя скорость',
  `FuelAddQty` int(11) DEFAULT '0' COMMENT 'ДУТ Заправлено - кол-во',
  `FuelSubQty` int(11) DEFAULT '0' COMMENT 'ДУТ Слито - кол-во',
  `PointsValidity` int(11) DEFAULT '0' COMMENT 'Валидность данных',
  `PointsCalc` int(11) DEFAULT '0' COMMENT 'Количество точек (по Log_ID) расчетное',
  `PointsFact` int(11) DEFAULT '0' COMMENT 'Количество точек (по Log_ID) фактическое',
  `PointsIntervalMax` varchar(20) DEFAULT NULL COMMENT 'Максимальный интервал между точками',
  `Type` tinyint(4) NOT NULL DEFAULT '1' COMMENT 'Тип маршрутного листа - КЗ или населенные пункты',
  `TimeEndFact` datetime DEFAULT NULL COMMENT 'Фактическое время окончания маршрута',
  `DistLogicSensor` double(10,2) DEFAULT '0.00' COMMENT 'Путь с включенным логическим датчиком, км',
  `OutLinkId` varchar(20) DEFAULT NULL COMMENT 'Код внешней базы',
  PRIMARY KEY (`Id`)
) ENGINE=InnoDB DEFAULT CHARSET=cp1251;

--
-- Dumping data for table `rt_route`
--


--
-- Table structure for table `rt_route_fuel`
--

CREATE TABLE `rt_route_fuel` (
  `Id` int(11) NOT NULL AUTO_INCREMENT,
  `Id_main` int(11) NOT NULL,
  `Location` varchar(255) NOT NULL,
  `time_` datetime NOT NULL,
  `dValueCalc` double NOT NULL DEFAULT '0' COMMENT 'Расчетная величина',
  `dValueHandle` double DEFAULT '0' COMMENT 'Ручная правка',
  PRIMARY KEY (`Id`),
  UNIQUE KEY `Id` (`Id`) USING BTREE,
  KEY `rt_route_fuel_FK1` (`Id_main`),
  CONSTRAINT `rt_route_fuel_FK1` FOREIGN KEY (`Id_main`) REFERENCES `rt_route` (`Id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=cp1251;

--
-- Dumping data for table `rt_route_fuel`
--


--
-- Table structure for table `rt_route_sensors`
--

CREATE TABLE `rt_route_sensors` (
  `Id` int(11) NOT NULL AUTO_INCREMENT,
  `Id_main` int(11) NOT NULL,
  `SensorName` varchar(127) NOT NULL,
  `Location` varchar(255) NOT NULL,
  `EventTime` datetime NOT NULL,
  `Duration` time NOT NULL,
  `Description` varchar(255) DEFAULT NULL,
  `Speed` double DEFAULT '0',
  `Distance` double(10,2) DEFAULT '0.00' COMMENT 'Путь, км',
  PRIMARY KEY (`Id`),
  KEY `rt_route_sensors_FK1` (`Id_main`) USING BTREE,
  CONSTRAINT `rt_route_sensors_FK1` FOREIGN KEY (`Id_main`) REFERENCES `rt_route` (`Id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=cp1251;

--
-- Dumping data for table `rt_route_sensors`
--


--
-- Table structure for table `rt_route_stops`
--

CREATE TABLE `rt_route_stops` (
  `Id` int(11) NOT NULL AUTO_INCREMENT,
  `Id_main` int(11) NOT NULL,
  `Location` varchar(255) DEFAULT NULL,
  `InitialTime` datetime DEFAULT NULL,
  `FinalTime` datetime DEFAULT NULL,
  `Interval` time DEFAULT NULL,
  `CheckZone` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'Остановка в контрольной зоне',
  PRIMARY KEY (`Id`),
  KEY `rt_route_stops_FK1` (`Id_main`) USING BTREE,
  CONSTRAINT `rt_route_stops_FK1` FOREIGN KEY (`Id_main`) REFERENCES `rt_route` (`Id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=cp1251;

--
-- Dumping data for table `rt_route_stops`
--


--
-- Table structure for table `rt_route_type`
--

CREATE TABLE `rt_route_type` (
  `Id` int(11) NOT NULL AUTO_INCREMENT,
  `Name` varchar(50) NOT NULL COMMENT 'Тип маршрута',
  PRIMARY KEY (`Id`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=cp1251;

--
-- Dumping data for table `rt_route_type`
--

INSERT INTO `rt_route_type` VALUES (1,'Контрольные зоны'),(2,'Населенные пункты');

--
-- Table structure for table `rt_routet`
--

CREATE TABLE `rt_routet` (
  `Id` int(11) NOT NULL AUTO_INCREMENT,
  `Id_main` int(11) NOT NULL,
  `Id_zone` int(11) NOT NULL DEFAULT '0' COMMENT 'Контрольная зона',
  `Id_event` int(11) NOT NULL DEFAULT '1' COMMENT 'Событие - въезд / выезд ',
  `DatePlan` datetime DEFAULT NULL COMMENT 'План время события ',
  `DateFact` datetime DEFAULT NULL COMMENT 'Факт время события ',
  `Deviation` varchar(10) DEFAULT NULL COMMENT 'Отклонение от графика',
  `Remark` text COMMENT 'Примечание',
  `Distance` double DEFAULT '0' COMMENT 'Путь между точками маршрута',
  `Location` varchar(255) DEFAULT NULL COMMENT 'Населенный пункт',
  PRIMARY KEY (`Id`),
  KEY `rt_routet_FK1` (`Id_main`) USING BTREE,
  CONSTRAINT `rt_routet_FK1` FOREIGN KEY (`Id_main`) REFERENCES `rt_route` (`Id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=cp1251;

--
-- Dumping data for table `rt_routet`
--


--
-- Table structure for table `rt_sample`
--

CREATE TABLE `rt_sample` (
  `Id` int(11) NOT NULL AUTO_INCREMENT,
  `Name` varchar(100) NOT NULL,
  `Id_mobitel` int(11) DEFAULT '0' COMMENT 'Транспортное средство (опц)',
  `TimeStart` time DEFAULT NULL COMMENT 'Время начала маршрута (опц)',
  `Distance` double DEFAULT '0' COMMENT 'Общий путь, км',
  `Remark` text COMMENT 'Примечание',
  `Id_main` int(11) NOT NULL DEFAULT '0' COMMENT 'Ссылка на элемент верхнего уровня в иерархии',
  `IsGroupe` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'Запись - группа',
  `AutoCreate` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'Маршрут может автосоздаваться ',
  `OutLinkId` varchar(20) DEFAULT NULL COMMENT 'Код внешней базы',
  PRIMARY KEY (`Id`)
) ENGINE=InnoDB DEFAULT CHARSET=cp1251;

--
-- Dumping data for table `rt_sample`
--


--
-- Table structure for table `rt_samplet`
--

CREATE TABLE `rt_samplet` (
  `Id` int(11) NOT NULL AUTO_INCREMENT,
  `Id_main` int(11) NOT NULL,
  `Position` tinyint(4) NOT NULL COMMENT 'Порядковый номер записи шаблона маршрута',
  `Id_event` int(11) NOT NULL COMMENT 'Событие - въезд / выезд ',
  `Id_zone` int(11) DEFAULT NULL COMMENT 'Контрольная зона',
  `TimeRel` char(5) DEFAULT '00:00' COMMENT 'Относительное время от начала маршрута',
  `TimeRelP` char(5) DEFAULT '00:00' COMMENT 'Допустимое отклонение (+)',
  `TimeRelM` char(5) DEFAULT '00:00' COMMENT 'Допустимое отклонение (-)',
  `TimeAbs` char(8) DEFAULT '00:00:00' COMMENT 'Абсолютное время маршрута',
  PRIMARY KEY (`Id`),
  KEY `rt_samplet_FK1` (`Id_main`) USING BTREE,
  CONSTRAINT `rt_samplet_FK1` FOREIGN KEY (`Id_main`) REFERENCES `rt_sample` (`Id`)
) ENGINE=InnoDB DEFAULT CHARSET=cp1251;

--
-- Dumping data for table `rt_samplet`
--


--
-- Table structure for table `rt_shedule`
--

CREATE TABLE `rt_shedule` (
  `Id` int(11) NOT NULL AUTO_INCREMENT,
  `Id_shedule_dc` int(11) DEFAULT NULL COMMENT 'Ссылка на справочник графиков',
  `Id_zone_main` int(11) DEFAULT NULL COMMENT 'Зона старта транспортных средств',
  `DateShedule` datetime NOT NULL COMMENT 'Дата графика',
  `Remark` varchar(127) DEFAULT NULL COMMENT 'Примечание',
  `OutLinkId` varchar(20) DEFAULT NULL COMMENT 'Ссылка на внешний документ учетной системы',
  PRIMARY KEY (`Id`)
) ENGINE=InnoDB DEFAULT CHARSET=cp1251 COMMENT='Шапка документа ГРАФИК ДВИЖЕНИЯ';

--
-- Dumping data for table `rt_shedule`
--


--
-- Table structure for table `rt_shedule_dc`
--

CREATE TABLE `rt_shedule_dc` (
  `Id` int(11) NOT NULL AUTO_INCREMENT,
  `Name` varchar(127) NOT NULL COMMENT 'Название шаблона графика движения',
  `Id_zone_main` int(11) DEFAULT NULL COMMENT 'Зона старта транспортных средств',
  `Remark` varchar(127) DEFAULT NULL COMMENT 'Примечание',
  PRIMARY KEY (`Id`)
) ENGINE=InnoDB DEFAULT CHARSET=cp1251 COMMENT='Шаблон шапки документа ГРАФИК ДВИЖЕНИЯ';

--
-- Dumping data for table `rt_shedule_dc`
--


--
-- Table structure for table `rt_shedulet`
--

CREATE TABLE `rt_shedulet` (
  `Id` int(11) NOT NULL AUTO_INCREMENT,
  `Id_main` int(11) NOT NULL COMMENT 'Ссылка на шапку документа',
  `Id_zone_to` int(11) DEFAULT NULL COMMENT 'Зона прибытия транспортного средства',
  `Id_vehicle` int(11) DEFAULT NULL COMMENT 'Транспортное средство',
  `TimePlanStart` datetime NOT NULL COMMENT 'Плановая дата начала движения',
  `TimePlanEnd` datetime DEFAULT NULL COMMENT 'Плановая дата окончания движения',
  `TimeFactStart` datetime DEFAULT NULL COMMENT 'Фактическая дата начала движения',
  `TimeFactEnd` datetime DEFAULT NULL COMMENT 'Фактическая дата окончания движения',
  `Distance` float NOT NULL DEFAULT '0' COMMENT 'Плановое расстояние',
  `State` varchar(127) DEFAULT NULL COMMENT 'Статус слежения за транспортным средством',
  `IsClose` bit(1) NOT NULL DEFAULT b'0' COMMENT 'Слежение за транспортным средством прекращено',
  PRIMARY KEY (`Id`),
  KEY `FK_rt_shedulet_rt_shedule` (`Id_main`) USING BTREE,
  CONSTRAINT `FK_rt_shedulet_rt_shedule` FOREIGN KEY (`Id_main`) REFERENCES `rt_shedule` (`Id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=cp1251 COMMENT='Содержимое документа ГРАФИК ДВИЖЕНИЯ';

--
-- Dumping data for table `rt_shedulet`
--


--
-- Table structure for table `rt_shedulet_dc`
--

CREATE TABLE `rt_shedulet_dc` (
  `Id` int(11) NOT NULL AUTO_INCREMENT,
  `Id_main` int(11) NOT NULL COMMENT 'Ссылка на шапку документа',
  `Id_zone_to` int(11) DEFAULT NULL COMMENT 'Зона прибытия транспортного средства',
  `TimePlanStart` char(5) NOT NULL COMMENT 'Плановая дата начала движения',
  `TimePlanEnd` char(5) DEFAULT NULL COMMENT 'Плановая дата окончания движения',
  `Distance` float NOT NULL DEFAULT '0' COMMENT 'Плановое расстояние',
  PRIMARY KEY (`Id`),
  KEY `FK_rt_shedulet_rt_shedule` (`Id_main`) USING BTREE,
  CONSTRAINT `FK_rt_shedulet_dc_rt_shedule_dc` FOREIGN KEY (`Id_main`) REFERENCES `rt_shedule_dc` (`Id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=cp1251 COMMENT='Шаблон содержимого документа ГРАФИК ДВИЖЕНИЯ';

--
-- Dumping data for table `rt_shedulet_dc`
--


--
-- Table structure for table `rules`
--

CREATE TABLE `rules` (
  `Rule_ID` int(11) NOT NULL AUTO_INCREMENT,
  `Name` char(50) DEFAULT NULL,
  `Password` char(50) DEFAULT NULL,
  `Descr` char(200) DEFAULT NULL,
  `ID` int(11) NOT NULL DEFAULT '0',
  `Rule1` tinyint(4) NOT NULL DEFAULT '0',
  `Rule2` tinyint(4) NOT NULL DEFAULT '0',
  `Rule3` tinyint(4) NOT NULL DEFAULT '0',
  `Rule4` tinyint(4) NOT NULL DEFAULT '0',
  `Rule5` tinyint(4) NOT NULL DEFAULT '0',
  `Rule6` tinyint(4) NOT NULL DEFAULT '0',
  `Rule7` tinyint(4) NOT NULL DEFAULT '0',
  `Rule8` tinyint(4) NOT NULL DEFAULT '0',
  `Rule9` tinyint(4) NOT NULL DEFAULT '0',
  `Rule10` tinyint(4) NOT NULL DEFAULT '0',
  `Rule11` tinyint(4) NOT NULL DEFAULT '0',
  `Rule12` tinyint(4) NOT NULL DEFAULT '0',
  `Rule13` tinyint(4) NOT NULL DEFAULT '0',
  `Rule14` tinyint(4) NOT NULL DEFAULT '0',
  `Rule15` tinyint(4) NOT NULL DEFAULT '0',
  `Rule16` tinyint(4) NOT NULL DEFAULT '0',
  PRIMARY KEY (`Rule_ID`)
) ENGINE=InnoDB AUTO_INCREMENT=10 DEFAULT CHARSET=cp1251;

--
-- Dumping data for table `rules`
--

INSERT INTO `rules` VALUES (1,'guest','guest','guest account',0,1,1,1,0,0,0,0,1,0,0,0,0,0,0,0,0),(8,'power','power','Description for Power User Profile',0,1,1,1,1,1,0,0,1,1,0,0,0,0,0,0,0),(9,'root','root','Description for root  Profile',0,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0);

--
-- Table structure for table `sensor_hookups`
--

CREATE TABLE `sensor_hookups` (
  `ID` int(11) NOT NULL AUTO_INCREMENT,
  `Mobitel_ID` int(11) DEFAULT NULL,
  `Sensor_ID` int(11) DEFAULT NULL,
  `FirstBit` int(11) DEFAULT NULL,
  PRIMARY KEY (`ID`)
) ENGINE=InnoDB DEFAULT CHARSET=cp1251;

--
-- Dumping data for table `sensor_hookups`
--


--
-- Table structure for table `sensor_list`
--

CREATE TABLE `sensor_list` (
  `ID` int(11) NOT NULL AUTO_INCREMENT,
  `Title` varchar(70) DEFAULT NULL,
  `Kind` varchar(20) DEFAULT NULL,
  `BitsCount` int(11) DEFAULT NULL,
  `FirstBit` int(11) DEFAULT NULL,
  `Data` text,
  PRIMARY KEY (`ID`)
) ENGINE=InnoDB DEFAULT CHARSET=cp1251;

--
-- Dumping data for table `sensor_list`
--


--
-- Table structure for table `sensoralgorithms`
--

CREATE TABLE `sensoralgorithms` (
  `ID` int(11) NOT NULL AUTO_INCREMENT,
  `Name` char(45) NOT NULL,
  `Description` char(45) DEFAULT NULL,
  `AlgorithmID` int(11) NOT NULL DEFAULT '0',
  PRIMARY KEY (`ID`),
  UNIQUE KEY `ID` (`ID`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=32 DEFAULT CHARSET=cp1251;

--
-- Dumping data for table `sensoralgorithms`
--

INSERT INTO `sensoralgorithms` VALUES (1,'Логический датчик','Для анализа используется критерий вкл. выкл.',1),(2,'Работа основного двигателя','Обычно используется при подключении к заж.',2),(3,'Обороты оборудования','Для анализа используются к-во оборотов',3),(4,'Напряжение','Контролируется борт сеть',4),(5,'Обороты основного двигателя','Для анализа используются к-во оборотов',5),(6,'Температура','Датчик температуры',6),(7,'Уровень топлива','Уровень топлива в баке1',7),(8,'Расход топлива','Уровень топлива в баке2',8),(9,'Пассажиры1','Для подсчета количества пассажиров1',9),(10,'Пассажиры2','Для подсчета количества пассажиров2',10),(11,'Дверь1','Для пассажиров1',11),(12,'Дверь2','Для пассажиров2',12),(13,'Идентификация водителя','Для идентификации водителей',13),(14,'Идентификация прицепного устройства','Для идентификации прицепных устройств',14),(15,'Топливозаправщик','Для контроля запровок с бензовоза',15),(16,'Слежение - логический датчик','Для отображения в режиме слежения',16),(17,'Прицепное оборудование - логический датчик','Для контроля состояний работа/переезд',17),(18,'Инклинометр - продольная ось X,','Для контроля угла наклона по оси Х',18),(19,'Инклинометр - продольная ось Y,','Для контроля угла наклона по оси Y',19),(20,'Идентификация оператора','Для идентификации водителя принявшего топливо',20),(21,'Идентификация транспортного средства','Для идентификации топливозаправщика',21),(22,'Угломерный датчик рабочего положения','Для идентификации агрегата в агро',22),(23,'Датчик разгрузки транспортного средства','Выгрузка бункера комбайна в агро',23),(24,'Расход топлива прямой','Расход топлива в баке прямой',24),(25,'Расход топлива обратный','Расход топлива в баке обратный',25),(26,'Дальномер','Дальномер',26),(27,'Расходомер топлива накопительный','Расходомер типа ДРТ, только накопительный',27),(28,'Определение уровня зерна в бункере','Алгоритм определения уровня зерна в бункере',28),(29,'Расход топлива дифференциальный','Дифференциальный проточник',29),(30,'Топливозаправщик (дифференциальный)','Топливозаправщик на дифф ДРТ',30),(31,'Уровень топлива в агрегате','Уровень топлива в баке агрегата',31);

--
-- Table structure for table `sensorcoefficient`
--

CREATE TABLE `sensorcoefficient` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `Sensor_id` int(10) unsigned NOT NULL,
  `UserValue` double(10,5) NOT NULL,
  `SensorValue` double(10,5) NOT NULL,
  `K` double(10,5) NOT NULL DEFAULT '1.00000',
  `b` double NOT NULL DEFAULT '0',
  PRIMARY KEY (`id`),
  UNIQUE KEY `Index_2` (`Sensor_id`,`UserValue`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=73 DEFAULT CHARSET=cp1251;

--
-- Dumping data for table `sensorcoefficient`
--

INSERT INTO `sensorcoefficient` VALUES (18,9,100.00000,0.00000,1.66667,100),(19,9,120.00000,12.00000,2.00000,96),(20,9,140.00000,22.00000,2.00000,96),(21,9,160.00000,32.00000,2.00000,96),(22,9,180.00000,42.00000,3.00000,54),(23,9,210.00000,52.00000,2.00000,106),(24,9,230.00000,62.00000,2.00000,106),(25,9,250.00000,72.00000,2.00000,106),(26,9,270.00000,82.00000,2.38095,74.76190476190476),(27,9,320.00000,103.00000,2.38095,74.76190476190476),(28,9,370.00000,124.00000,2.38095,74.76190476190476),(29,9,420.00000,145.00000,2.38095,74.76190476190476),(30,9,470.00000,166.00000,2.38095,74.76190476190476),(31,9,520.00000,187.00000,2.38095,74.76190476190476),(32,9,570.00000,208.00000,2.38095,74.76190476190476),(33,9,620.00000,229.00000,2.00000,162),(34,9,640.00000,239.00000,1.81818,205.4545454545455),(35,9,660.00000,250.00000,1.81818,205.4545454545455),(55,15,0.00000,523.00000,0.13605,-71.15646258503402),(56,15,20.00000,670.00000,0.11111,-54.44444444444444),(57,15,40.00000,850.00000,0.11561,-58.26589595375722),(58,15,60.00000,1023.00000,0.12500,-67.875),(59,15,80.00000,1183.00000,0.12579,-68.80503144654088),(60,15,100.00000,1342.00000,0.12987,-74.28571428571428),(61,15,120.00000,1496.00000,0.13550,-82.71002710027099),(62,15,170.00000,1865.00000,0.14085,-92.67605633802816),(63,15,220.00000,2220.00000,0.14286,-97.14285714285711),(64,15,270.00000,2570.00000,0.14409,-100.31700288184436),(65,15,320.00000,2917.00000,0.15106,-120.63444108761325),(66,15,370.00000,3248.00000,0.14124,-88.75706214689268),(67,15,420.00000,3602.00000,0.13966,-83.07262569832398),(68,15,470.00000,3960.00000,0.13333,-58),(69,15,520.00000,4335.00000,0.12755,-32.93367346938771),(70,15,570.00000,4727.00000,0.11628,20.34883720930236),(71,15,590.00000,4899.00000,0.11338,34.55782312925169),(72,15,640.00000,5340.00000,0.11338,34.55782312925169);

--
-- Table structure for table `sensordata`
--

CREATE TABLE `sensordata` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `datagps_id` int(10) unsigned NOT NULL,
  `sensor_id` int(10) unsigned NOT NULL,
  `Value` double(10,2) NOT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `Index_2` (`datagps_id`,`sensor_id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=cp1251;

--
-- Dumping data for table `sensordata`
--


--
-- Table structure for table `sensors`
--

CREATE TABLE `sensors` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `mobitel_id` int(11) NOT NULL,
  `Name` varchar(45) NOT NULL,
  `Description` varchar(200) NOT NULL,
  `StartBit` int(10) unsigned NOT NULL,
  `Length` int(10) unsigned NOT NULL,
  `NameUnit` varchar(45) NOT NULL,
  `K` double(10,5) NOT NULL DEFAULT '0.00000',
  `B` double DEFAULT '0' COMMENT 'Shift coefficient',
  `S` tinyint(1) DEFAULT '0' COMMENT 'Sign arifmetic',
  PRIMARY KEY (`id`),
  KEY `Index_2` (`mobitel_id`)
) ENGINE=InnoDB AUTO_INCREMENT=37 DEFAULT CHARSET=cp1251;

--
-- Dumping data for table `sensors`
--

INSERT INTO `sensors` VALUES (3,97,'оберти двигуна','',0,16,' rpm',0.12500,0,0),(5,97,'бортмережа','',112,16,' В',0.00100,0,0),(6,97,'пробіг за тахографом','',152,32,' км',0.00500,0,0),(7,97,'запалювання','',196,1,' ',1.00000,0,0),(9,98,'штатний ДРП','',128,8,' л',0.00000,0,0),(10,98,'оберти двигуна','',0,16,' rpm',0.12500,0,0),(11,98,'витрата','',16,64,' л',0.50000,0,0),(12,98,'бортмережа','',112,16,' В',0.00100,0,0),(13,98,'пробіг за тахографом','',152,32,' км',0.00500,0,0),(14,98,'запалювання','',196,1,' ',1.00000,0,0),(15,97,'бак','',80,16,'л',0.00000,0,0),(18,99,'оберти двигуна','',0,16,' rpm',0.12500,0,0),(20,99,'бортмережа','',112,16,' В',0.00100,0,0),(21,99,'пробіг за тахографом','',152,32,' км',0.00500,0,0),(22,99,'запалювання','',196,1,' ',1.00000,0,0),(25,100,'оберти двигуна','',0,16,' rpm',0.12500,0,0),(27,100,'бортмережа','',112,16,' В',0.00100,0,0),(28,100,'пробіг за тахографом','',152,32,' км',0.00500,0,0),(29,100,'запалювання','',196,1,' ',1.00000,0,0),(31,825503800,'штатний ДРП','',128,8,' %',0.40000,0,0),(32,825503800,'оберти двигуна','',0,16,' rpm',0.12500,0,0),(33,825503800,'витрата','',16,64,' л',0.50000,0,0),(34,825503800,'бортмережа','',112,16,' В',0.00100,0,0),(35,825503800,'пробіг за тахографом','',152,32,' км',0.00500,0,0),(36,825503800,'запалювання','',196,1,' ',1.00000,0,0);

--
-- Table structure for table `serviceinit`
--

CREATE TABLE `serviceinit` (
  `ServiceInit_ID` int(11) NOT NULL AUTO_INCREMENT,
  `Name` char(50) DEFAULT NULL,
  `Descr` char(200) DEFAULT NULL,
  `ID` int(11) DEFAULT '0',
  `Flags` int(11) DEFAULT '0',
  `ServiceType_ID` int(11) DEFAULT '0',
  `A1` char(50) DEFAULT NULL,
  `A2` char(50) DEFAULT NULL,
  `A3` char(50) DEFAULT NULL,
  `A4` char(50) DEFAULT NULL,
  `A5` char(50) DEFAULT NULL,
  `A6` char(50) DEFAULT NULL,
  `A7` char(50) DEFAULT NULL,
  `A8` char(50) DEFAULT NULL,
  `A9` char(50) DEFAULT NULL,
  `A10` char(200) DEFAULT NULL,
  `CAtoSAint` int(11) DEFAULT '0',
  `CAtoSAtime` int(11) DEFAULT '0',
  `SAtoCAint` int(11) DEFAULT '0',
  `SAtoCAtime` int(11) DEFAULT '0',
  `SAtoCAtext` char(50) DEFAULT 'STOPPED',
  `CAtoSAtext` char(50) DEFAULT 'STOPPED',
  `MobitelActive_ID` int(11) NOT NULL DEFAULT '0',
  `Active` tinyint(3) unsigned NOT NULL DEFAULT '0',
  PRIMARY KEY (`ServiceInit_ID`)
) ENGINE=InnoDB AUTO_INCREMENT=31 DEFAULT CHARSET=cp1251;

--
-- Dumping data for table `serviceinit`
--

INSERT INTO `serviceinit` VALUES (1,'Direct Cable','Сервис для прямого кабельного соединения',0,0,5,'COM1','115200','','','','','','','','',0,0,1,1222352358,'Running',NULL,83,0),(7,'GSM модем','Отправка SMS по  GSM каналу',0,0,2,'COM2','115200','','','','','','','','XXX',0,0,1,1127307060,'Running',NULL,75,0),(29,'EMail','Сервис отправки данных через E-mail',29,1125886839,6,'','','','smtp.p314.net','pop.p314.net','25','110','60','','XXX',0,0,1,1128962351,'Running',NULL,68,0),(30,'Online','Онлайн через телематический сервер',30,0,3,'','9010','','','','','','','','',0,0,0,0,'STOPPED','STOPPED',0,0);

--
-- Table structure for table `servicesend`
--

CREATE TABLE `servicesend` (
  `ServiceSend_ID` int(11) NOT NULL AUTO_INCREMENT,
  `Name` varchar(50) DEFAULT NULL,
  `Descr` varchar(200) DEFAULT NULL,
  `ID` int(11) DEFAULT '0',
  `Flags` int(11) DEFAULT '0',
  `telMobitel` varchar(64) DEFAULT NULL,
  `smsMobitel` varchar(64) DEFAULT NULL,
  `emailMobitel` varchar(64) DEFAULT NULL,
  `IPMobitel` varchar(64) DEFAULT NULL,
  `URLMobitel` varchar(64) DEFAULT NULL,
  `PortMobitel` int(11) DEFAULT '0',
  `RfMobitel` varchar(50) DEFAULT NULL,
  `Message_ID` int(11) DEFAULT '0',
  PRIMARY KEY (`ServiceSend_ID`),
  KEY `Index_2` (`ID`)
) ENGINE=InnoDB AUTO_INCREMENT=264 DEFAULT CHARSET=cp1251;

--
-- Dumping data for table `servicesend`
--

INSERT INTO `servicesend` VALUES (250,'Record 22.09.2005 12:14:57','Description for record created at 22.09.2005 12:14:57',250,0,'103',NULL,NULL,NULL,NULL,0,NULL,0),(252,'Record 22.09.2005 12:14:57','Description for record created at 22.09.2005 12:14:57',250,0,'98','106','3051@p314.net','',NULL,0,'',200892),(255,'Record 22.09.2005 12:14:57','Description for record created at 22.09.2005 12:14:57',250,0,'96','80','','',NULL,0,'',218879),(256,'set','phone',250,0,'102',NULL,NULL,NULL,NULL,0,NULL,0),(257,'2658','+37254723831',257,0,'105',NULL,NULL,NULL,NULL,0,NULL,0),(258,'set','phone',257,0,'104',NULL,NULL,NULL,NULL,0,NULL,0),(259,'3978','Desctiption for Teletrack registered at 24.03.2018 9:49:16',259,0,'107',NULL,NULL,NULL,NULL,0,NULL,0),(260,'set','phone',259,0,'106',NULL,NULL,NULL,NULL,0,NULL,0),(261,'2840','+372575383900',261,0,'109',NULL,NULL,NULL,NULL,0,NULL,0),(262,'set','phone',261,0,'108',NULL,NULL,NULL,NULL,0,NULL,0),(263,'','',263,0,'110',NULL,NULL,NULL,NULL,0,NULL,0);

--
-- Table structure for table `servicetypes`
--

CREATE TABLE `servicetypes` (
  `ServiceType_ID` int(11) NOT NULL AUTO_INCREMENT,
  `Name` char(50) DEFAULT NULL,
  `Descr` char(200) DEFAULT NULL,
  `Flags` int(11) DEFAULT '0',
  `D1` char(200) DEFAULT NULL,
  `D2` char(200) DEFAULT NULL,
  `D3` char(200) DEFAULT NULL,
  `D4` char(200) DEFAULT NULL,
  `D5` char(200) DEFAULT NULL,
  `D6` char(200) DEFAULT NULL,
  `D7` char(200) DEFAULT NULL,
  `D8` char(200) DEFAULT NULL,
  `D9` char(200) DEFAULT NULL,
  `D10` char(200) DEFAULT NULL,
  PRIMARY KEY (`ServiceType_ID`)
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=cp1251;

--
-- Dumping data for table `servicetypes`
--

INSERT INTO `servicetypes` VALUES (1,'reserved','Зарезервировано',0,'Parameter 1','Parameter 2','Parameter 3','','','','','','',''),(2,'GSM','Тип сервиса для отправки SMS через GSM соединение',0,'Номер порта','Скорость порта','','','','','','','',''),(3,'Online','Online',0,'IP','Port','Login','Password','','','','','',''),(4,'RF modem','Радиомодем (не реализовано)',0,'Номер порта','Скорость порта','','','','','','','',''),(5,'DC','Тип сервиса \"прямое кабельное соединения\"',0,'Номер порта','Скорость порта',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),(6,'E-Mail','Тип сервиса \" E-Mail \" для отправки SMS через электронную почту',0,'EMAIL','Login','Password','Smtp Server','Pop3 Server','Smtp Port','Pop3 Port','Check Out time',NULL,NULL);

--
-- Table structure for table `setting`
--

CREATE TABLE `setting` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `TimeBreak` time DEFAULT '00:01:00' COMMENT 'Минимальное время остановки',
  `RotationMain` int(11) DEFAULT '100' COMMENT 'Обороты основного двигателя',
  `RotationAdd` int(11) DEFAULT '100' COMMENT 'Обороты доп. двигателя',
  `FuelingEdge` int(11) DEFAULT '0' COMMENT 'Минимальная заправка',
  `band` int(11) DEFAULT '25' COMMENT 'Полоса осреднения',
  `FuelingDischarge` int(11) DEFAULT '0' COMMENT 'Минимальный слив топлива',
  `accelMax` double DEFAULT '1' COMMENT 'Максимальное ускорение',
  `breakMax` double DEFAULT '1' COMMENT 'Максимальное торможение',
  `speedMax` double DEFAULT '70' COMMENT 'Максимальная скорость',
  `idleRunningMain` int(11) DEFAULT '0' COMMENT 'Холостой ход основного двигателя',
  `idleRunningAdd` int(11) DEFAULT '0' COMMENT 'Холосой ход доп. двигателя',
  `Name` char(20) DEFAULT 'Установки' COMMENT 'Название',
  `Desc` char(80) DEFAULT 'Описание установки' COMMENT 'Описание ',
  `AvgFuelRatePerHour` double(10,5) NOT NULL DEFAULT '15.00000' COMMENT 'Средний расход топлива в час',
  `FuelApproximationTime` time NOT NULL DEFAULT '00:02:00' COMMENT 'Временной интервал перед стоянкой, по точка которого уточняется уровень топлива в начале стоянки',
  `TimeGetFuelAfterStop` time NOT NULL DEFAULT '00:00:00' COMMENT 'Временной интервал между началом стоянки и замером уровня топлива',
  `TimeGetFuelBeforeMotion` time NOT NULL DEFAULT '00:00:00' COMMENT 'Временной интервал между замером уровня топлива и началом движения',
  `CzMinCrossingPairTime` time NOT NULL DEFAULT '00:01:00' COMMENT 'Min временной интервал между двумя пересечениями КЗ',
  `FuelerRadiusFinds` int(11) NOT NULL DEFAULT '10' COMMENT 'Радиус поиска заправляемых ТС вокруг топливозаправщика',
  `FuelerMaxTimeStop` time NOT NULL DEFAULT '00:02:00' COMMENT 'Минимальное время до заправки следующего ТС',
  `FuelerMinFuelrate` int(11) NOT NULL DEFAULT '1' COMMENT 'Минимальная величина заправки, что будет попадать в отчет',
  `FuelerCountInMotion` int(11) NOT NULL DEFAULT '0' COMMENT 'Считать ли заправки, при не нулевой скорости',
  `FuelrateWithDischarge` int(11) NOT NULL DEFAULT '0' COMMENT 'Считать ли в расходе сливы',
  `FuelingMinMaxAlgorithm` int(11) NOT NULL DEFAULT '0' COMMENT 'Считать заправки по MAX-MIN',
  `TimeBreakMaxPermitted` time NOT NULL DEFAULT '03:00:00' COMMENT 'Макс. время разрешенной стоянки',
  `InclinometerMaxAngleAxisX` double NOT NULL DEFAULT '5' COMMENT 'Предельный угол наклона относительно продольной оси Х ',
  `InclinometerMaxAngleAxisY` double NOT NULL DEFAULT '5' COMMENT 'Предельный угол наклона относительно продольной оси Y ',
  `MinTimeSwitch` int(11) NOT NULL DEFAULT '0' COMMENT 'Минимальное время между двумя событиями датчика',
  `TimeMinimMovingSize` time NOT NULL DEFAULT '00:00:00' COMMENT 'Минимальное время движения в начале смены',
  `speedMin` float NOT NULL DEFAULT '0' COMMENT 'Минимальная скорость в км/ч',
  PRIMARY KEY (`id`),
  UNIQUE KEY `id` (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=cp1251;

--
-- Dumping data for table `setting`
--

INSERT INTO `setting` VALUES (1,'00:01:00',100,100,15,3,8,1,1,85,0,0,'Настройка 1','Настройка по умолчанию',18.00000,'00:02:00','00:00:00','00:00:00','00:01:00',10,'00:02:00',1,0,1,0,'03:00:00',5,5,0,'00:00:00',0);

--
-- Table structure for table `smsnumbers`
--

CREATE TABLE `smsnumbers` (
  `SmsNumber_ID` int(11) NOT NULL AUTO_INCREMENT,
  `Name` char(50) DEFAULT NULL,
  `Descr` char(200) DEFAULT NULL,
  `ID` int(11) DEFAULT '0',
  `Flags` int(11) DEFAULT '0',
  `smsNumber` char(14) DEFAULT NULL,
  PRIMARY KEY (`SmsNumber_ID`)
) ENGINE=InnoDB AUTO_INCREMENT=86 DEFAULT CHARSET=cp1251;

--
-- Dumping data for table `smsnumbers`
--

INSERT INTO `smsnumbers` VALUES (9,'UMC SMS Center','UMC SMS Center descr',0,0,'+380500005010'),(42,'Golden SMS Center','Golden SMS Center descr',0,0,'+380390001008'),(53,'GOLDEN SMS Шлюз','Номер телефона, на который отправляются данные с ТТ через E_MAIL',0,0,'025'),(80,'SMS',' (SMS)',0,0,'+38067'),(81,'RCSB (SMS)','Телефон (SMS)',0,0,'+380672452724'),(82,'RCSB2 (SMS)',' (SMS)',0,0,'+380672452734'),(83,'RCS1 (SMS)',' (SMS)',0,0,'+380637562677'),(84,'RCS2 (SMS)',' (SMS)',0,0,'+380933222277'),(85,'RCS3 (SMS)',' (SMS)',0,0,'+380637562678');

--
-- Table structure for table `sources`
--

CREATE TABLE `sources` (
  `Source_ID` int(11) NOT NULL AUTO_INCREMENT,
  `SourceText` char(200) DEFAULT NULL,
  `SourceError` char(200) DEFAULT NULL,
  PRIMARY KEY (`Source_ID`)
) ENGINE=InnoDB DEFAULT CHARSET=cp1251;

--
-- Dumping data for table `sources`
--


--
-- Table structure for table `specialmessages`
--

CREATE TABLE `specialmessages` (
  `SpecMessage_ID` int(11) NOT NULL AUTO_INCREMENT,
  `DataString` char(50) DEFAULT NULL,
  `DataInteger` int(11) DEFAULT '0',
  `unixtime` char(50) DEFAULT NULL,
  `isNew` int(11) DEFAULT '0',
  PRIMARY KEY (`SpecMessage_ID`)
) ENGINE=InnoDB DEFAULT CHARSET=cp1251;

--
-- Dumping data for table `specialmessages`
--


--
-- Table structure for table `state`
--

CREATE TABLE `state` (
  `Id` int(11) NOT NULL AUTO_INCREMENT,
  `MinValue` double NOT NULL,
  `MaxValue` double NOT NULL,
  `Title` varchar(50) NOT NULL,
  `SensorId` int(11) DEFAULT NULL,
  PRIMARY KEY (`Id`),
  KEY `State_FK` (`SensorId`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=cp1251 COMMENT='Состояния автомобиля';

--
-- Dumping data for table `state`
--

INSERT INTO `state` VALUES (1,0,0.1,'0',7),(2,1,1.1,'1',7),(3,0,0.1,'0',14),(4,1,1.1,'1',14),(5,0,0.1,'0',22),(6,1,1.1,'1',22),(7,0,0.1,'0',29),(8,1,1.1,'1',29),(9,0,0.1,'0',36),(10,1,1.1,'1',36);

--
-- Table structure for table `swupdate`
--

CREATE TABLE `swupdate` (
  `ID` int(11) NOT NULL AUTO_INCREMENT,
  `ShortID` char(4) NOT NULL COMMENT 'Идентификатор телетрека(логин)',
  `Soft` mediumtext NOT NULL COMMENT 'Прошивка',
  `InsertTime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT 'Дата и время вставки в таблицу',
  PRIMARY KEY (`ID`)
) ENGINE=InnoDB DEFAULT CHARSET=cp1251 COMMENT='Обновление прошивки телетрека';

--
-- Dumping data for table `swupdate`
--


--
-- Table structure for table `team`
--

CREATE TABLE `team` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `Name` varchar(50) DEFAULT NULL,
  `Descr` text COMMENT 'Описание',
  `Setting_id` int(11) DEFAULT NULL,
  `OutLinkId` varchar(20) DEFAULT NULL COMMENT 'Код внешней базы',
  `FuelWayKmGrp` double DEFAULT '0' COMMENT 'Норма расхода топлива л/100 км',
  `FuelMotoHrGrp` double DEFAULT '0' COMMENT 'Норма расхода топлива на холостом ходу л/моточас',
  PRIMARY KEY (`id`),
  UNIQUE KEY `id` (`id`) USING BTREE,
  KEY `Setting_id` (`Setting_id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=cp1251;

--
-- Dumping data for table `team`
--

INSERT INTO `team` VALUES (1,'Автомобиль',NULL,1,NULL,0,0),(2,'Трактор',NULL,1,NULL,0,0),(3,'Комбайн',NULL,1,NULL,0,0),(4,'Заправщик',NULL,1,NULL,0,0),(5,'Кран',NULL,1,NULL,0,0),(6,'Авто','',1,'',0,0);

--
-- Table structure for table `telnumbers`
--

CREATE TABLE `telnumbers` (
  `TelNumber_ID` int(11) NOT NULL AUTO_INCREMENT,
  `Name` char(50) DEFAULT NULL,
  `Descr` char(200) DEFAULT NULL,
  `ID` int(11) DEFAULT '0',
  `Flags` int(11) DEFAULT '0',
  `TelNumber` char(50) DEFAULT NULL,
  PRIMARY KEY (`TelNumber_ID`)
) ENGINE=InnoDB AUTO_INCREMENT=111 DEFAULT CHARSET=cp1251;

--
-- Dumping data for table `telnumbers`
--

INSERT INTO `telnumbers` VALUES (56,'RCSB','Телефон',0,0,'80672452724'),(57,'Телефон','Телефон',0,0,'22222222222'),(58,'Телефон','Телефон',0,0,'33333333333'),(59,'Телефон','Телефон',0,0,'44444444444'),(68,'Телефон','Телефон',0,0,'55555555555'),(71,'Телефон','',0,0,'66666666666'),(73,'Телефон','Телефон',0,0,'77777777777'),(74,'Телефон','Телефон',0,0,'88888888888'),(75,'Телефон','',0,0,'99999999999'),(81,'RCS3','',0,0,'80637562678'),(89,'RCS2','',0,0,'80933222277'),(90,'RCS1','',0,0,'80637562677'),(97,'RCSB2','',0,0,'80672452734'),(101,'Телефон','',0,0,'1'),(102,'2104',NULL,0,0,'+380981675604'),(103,'rcs','mtel',0,0,'+380981675604'),(104,'2658',NULL,0,0,'0981675594'),(105,'rcs','mtel',0,0,'0981675594'),(106,'3978',NULL,0,0,'+380981881640'),(107,'rcs','mtel',0,0,'+380981881640'),(108,'2840',NULL,0,0,'+380679248922'),(109,'rcs','mtel',0,0,'+380679248922'),(110,'rcs','mtel',0,0,'+380673605178');

--
-- Table structure for table `temp`
--

CREATE TABLE `temp` (
  `datagps_id` int(10) unsigned NOT NULL DEFAULT '0',
  `sensor_id` int(10) unsigned NOT NULL DEFAULT '0',
  `Value` double(10,2) NOT NULL DEFAULT '0.00'
) ENGINE=MEMORY DEFAULT CHARSET=cp1251;

--
-- Dumping data for table `temp`
--


--
-- Table structure for table `tmpdatagps`
--

CREATE TABLE `tmpdatagps` (
  `DataGps_ID` int(11) NOT NULL DEFAULT '0',
  `Mobitel_ID` int(11) DEFAULT '0',
  `Message_ID` int(11) DEFAULT '0',
  `Latitude` int(11) DEFAULT '0',
  `Longitude` int(11) DEFAULT '0',
  `Altitude` int(11) DEFAULT NULL,
  `UnixTime` int(11) DEFAULT '0',
  `Speed` smallint(6) DEFAULT '0',
  `Direction` int(11) NOT NULL DEFAULT '0',
  `Valid` tinyint(4) DEFAULT '1',
  `InMobitelID` int(11) DEFAULT NULL,
  `Events` int(10) unsigned DEFAULT '0',
  `Sensor1` tinyint(4) unsigned DEFAULT '0',
  `Sensor2` tinyint(4) unsigned DEFAULT '0',
  `Sensor3` tinyint(4) unsigned DEFAULT '0',
  `Sensor4` tinyint(4) unsigned DEFAULT '0',
  `Sensor5` tinyint(4) unsigned DEFAULT '0',
  `Sensor6` tinyint(4) unsigned DEFAULT '0',
  `Sensor7` tinyint(4) unsigned DEFAULT '0',
  `Sensor8` tinyint(4) unsigned DEFAULT '0',
  `LogID` int(11) DEFAULT '0',
  `isShow` tinyint(4) DEFAULT '0',
  `whatIs` smallint(6) unsigned DEFAULT '0',
  `Counter1` int(11) NOT NULL DEFAULT '-1',
  `Counter2` int(11) NOT NULL DEFAULT '-1',
  `Counter3` int(11) NOT NULL DEFAULT '-1',
  `Counter4` int(11) NOT NULL DEFAULT '-1'
) ENGINE=MEMORY DEFAULT CHARSET=cp1251;

--
-- Dumping data for table `tmpdatagps`
--


--
-- Table structure for table `transition`
--

CREATE TABLE `transition` (
  `Id` int(11) NOT NULL AUTO_INCREMENT,
  `InitialStateId` int(11) DEFAULT NULL,
  `FinalStateId` int(11) DEFAULT NULL,
  `Title` varchar(50) NOT NULL,
  `SensorId` int(11) DEFAULT NULL,
  `IconName` varchar(50) NOT NULL,
  `SoundName` varchar(50) NOT NULL,
  `Enabled` tinyint(1) NOT NULL,
  `ViewInReport` tinyint(1) NOT NULL DEFAULT '0',
  PRIMARY KEY (`Id`),
  KEY `Sensors_FK` (`SensorId`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=cp1251 COMMENT='Переходы между состояниями';

--
-- Dumping data for table `transition`
--

INSERT INTO `transition` VALUES (1,1,2,'увімк.',7,'Default','Default',0,1),(2,2,1,'вимк.',7,'Default','Default',0,1),(3,3,4,'увімк.',14,'Default','Default',0,1),(4,4,3,'вимк.',14,'Default','Default',0,1),(5,5,6,'увімк.',22,'Default','Default',0,1),(6,6,5,'вимк.',22,'Default','Default',0,1),(7,7,8,'увімк.',29,'Default','Default',0,1),(8,8,7,'вимк.',29,'Default','Default',0,1),(9,9,10,'увімк.',36,'Default','Default',0,1),(10,10,9,'вимк.',36,'Default','Default',0,1);

--
-- Table structure for table `users_acs_objects`
--

CREATE TABLE `users_acs_objects` (
  `Id` int(11) NOT NULL AUTO_INCREMENT,
  `Id_role` int(11) NOT NULL,
  `Id_type` int(11) NOT NULL,
  `Id_object` int(11) NOT NULL,
  PRIMARY KEY (`Id`),
  KEY `FK_users_acs_objects_users_acs_roles_Id` (`Id_role`),
  CONSTRAINT `FK_users_acs_objects_users_acs_roles_Id` FOREIGN KEY (`Id_role`) REFERENCES `users_acs_roles` (`Id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=32 DEFAULT CHARSET=cp1251;

--
-- Dumping data for table `users_acs_objects`
--

INSERT INTO `users_acs_objects` VALUES (21,2,3,5),(22,2,3,11),(23,2,3,12),(24,2,3,13),(25,2,3,14),(26,2,3,15),(27,2,3,16),(28,2,3,19),(29,2,3,20),(30,2,3,21),(31,2,3,22);

--
-- Table structure for table `users_acs_roles`
--

CREATE TABLE `users_acs_roles` (
  `Id` int(11) NOT NULL AUTO_INCREMENT,
  `Name` varchar(255) NOT NULL,
  PRIMARY KEY (`Id`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=cp1251;

--
-- Dumping data for table `users_acs_roles`
--

INSERT INTO `users_acs_roles` VALUES (1,'Администратор'),(2,'Redko');

--
-- Table structure for table `users_actions_log`
--

CREATE TABLE `users_actions_log` (
  `Id` int(11) NOT NULL AUTO_INCREMENT,
  `TypeLog` int(11) NOT NULL DEFAULT '0',
  `DateAction` datetime NOT NULL,
  `Id_document` int(11) NOT NULL DEFAULT '0',
  `TextLog` varchar(255) NOT NULL,
  `User` varchar(127) NOT NULL,
  `Computer` varchar(63) NOT NULL,
  PRIMARY KEY (`Id`)
) ENGINE=InnoDB AUTO_INCREMENT=84 DEFAULT CHARSET=cp1251;

--
-- Dumping data for table `users_actions_log`
--

INSERT INTO `users_actions_log` VALUES (1,8,'2017-10-27 15:15:19',0,'15->18 Средний расход топлива, л/ч','admin','MNK'),(2,8,'2017-10-27 15:15:19',0,'25->4 Полоса сглаживания','admin','MNK'),(3,8,'2017-10-27 15:15:19',0,'10->8 Порог слива','admin','MNK'),(4,8,'2017-10-27 15:15:19',0,'50->20 Порог заправки','admin','MNK'),(5,8,'2017-10-27 15:15:19',0,'70->85 Максимальная скорость движения, км/ч','admin','MNK'),(6,8,'2017-10-27 15:15:19',0,'0->1 Не учитывать сливы в расходе','admin','MNK'),(7,8,'2017-11-29 18:37:52',0,'4->3 Полоса сглаживания','admin','MNK'),(8,8,'2017-11-29 18:37:53',0,'8->1 Порог слива','admin','MNK'),(9,8,'2017-11-29 18:37:53',0,'20->1 Порог заправки','admin','MNK'),(10,8,'2017-11-29 18:37:53',0,'0->1 Заправки считать по Min/Max','admin','MNK'),(11,9,'2018-01-02 13:41:19',15,'Вход','admin','MNK'),(12,9,'2018-01-02 13:41:20',15,'Загрузить','admin','MNK'),(13,9,'2018-01-02 13:41:56',15,'Удаление строки 0','admin','MNK'),(14,9,'2018-01-02 13:41:57',15,'Удаление строки 0','admin','MNK'),(15,9,'2018-01-02 13:41:57',15,'Удаление строки 0','admin','MNK'),(16,9,'2018-01-02 13:41:57',15,'Удаление строки 0','admin','MNK'),(17,9,'2018-01-02 13:41:57',15,'Удаление строки 0','admin','MNK'),(18,9,'2018-01-02 13:41:57',15,'Удаление строки 0','admin','MNK'),(19,9,'2018-01-02 13:41:58',15,'Удаление строки 0','admin','MNK'),(20,9,'2018-01-02 13:41:58',15,'Удаление строки 0','admin','MNK'),(21,9,'2018-01-02 13:42:02',15,'Удаление строки 0','admin','MNK'),(22,9,'2018-01-02 13:42:02',15,'Удаление строки 0','admin','MNK'),(23,9,'2018-01-02 13:42:03',15,'Удаление строки 0','admin','MNK'),(24,9,'2018-01-02 13:42:03',15,'Удаление строки 0','admin','MNK'),(25,9,'2018-01-02 13:42:03',15,'Удаление строки 0','admin','MNK'),(26,9,'2018-01-02 13:42:03',15,'Удаление строки 0','admin','MNK'),(27,9,'2018-01-02 13:42:03',15,'Удаление строки 0','admin','MNK'),(28,9,'2018-01-02 13:42:04',15,'Удаление строки 0','admin','MNK'),(29,9,'2018-01-02 13:42:04',15,'Удаление строки 0','admin','MNK'),(30,9,'2018-01-02 13:42:19',15,'Загрузить','admin','MNK'),(31,9,'2018-01-02 14:14:49',9,'Вход','admin','MNK'),(32,9,'2018-01-02 14:14:50',9,'Загрузить','admin','MNK'),(33,8,'2018-01-02 14:17:02',0,'1->8 Порог слива','admin','MNK'),(34,8,'2018-01-02 14:17:02',0,'1->15 Порог заправки','admin','MNK'),(35,8,'2018-01-02 14:17:02',0,'1->0 Заправки считать по Min/Max','admin','MNK'),(36,9,'2018-01-03 12:09:03',15,'Вход','admin','MNK'),(37,9,'2018-01-03 12:09:12',15,'Установка (18 - Пользовательские) в  600','admin','MNK'),(38,9,'2018-01-03 12:09:17',15,'Установка (18 - Измеренные) в  4900','admin','MNK'),(39,9,'2018-01-03 12:10:03',15,'Вход','admin','MNK'),(40,9,'2018-01-03 12:10:06',15,'Удаление строки 0','admin','MNK'),(41,9,'2018-01-03 12:10:06',15,'Удаление строки 0','admin','MNK'),(42,9,'2018-01-03 12:10:07',15,'Удаление строки 0','admin','MNK'),(43,9,'2018-01-03 12:10:07',15,'Удаление строки 0','admin','MNK'),(44,9,'2018-01-03 12:10:07',15,'Удаление строки 0','admin','MNK'),(45,9,'2018-01-03 12:10:07',15,'Удаление строки 0','admin','MNK'),(46,9,'2018-01-03 12:10:07',15,'Удаление строки 0','admin','MNK'),(47,9,'2018-01-03 12:10:08',15,'Удаление строки 0','admin','MNK'),(48,9,'2018-01-03 12:10:08',15,'Удаление строки 0','admin','MNK'),(49,9,'2018-01-03 12:10:11',15,'Удаление строки 0','admin','MNK'),(50,9,'2018-01-03 12:10:11',15,'Удаление строки 0','admin','MNK'),(51,9,'2018-01-03 12:10:11',15,'Удаление строки 0','admin','MNK'),(52,9,'2018-01-03 12:10:11',15,'Удаление строки 0','admin','MNK'),(53,9,'2018-01-03 12:10:12',15,'Удаление строки 0','admin','MNK'),(54,9,'2018-01-03 12:10:12',15,'Удаление строки 0','admin','MNK'),(55,9,'2018-01-03 12:10:12',15,'Удаление строки 0','admin','MNK'),(56,9,'2018-01-03 12:10:12',15,'Удаление строки 0','admin','MNK'),(57,9,'2018-01-03 12:10:13',15,'Удаление строки 0','admin','MNK'),(58,9,'2018-01-03 12:17:00',15,'Вход','admin','MNK'),(59,9,'2018-01-03 12:17:01',15,'Загрузить','admin','MNK'),(60,9,'2018-01-03 12:18:27',15,'Вход','admin','MNK'),(61,9,'2018-01-03 12:18:29',15,'Удаление строки 0','admin','MNK'),(62,9,'2018-01-03 12:18:29',15,'Удаление строки 0','admin','MNK'),(63,9,'2018-01-03 12:18:29',15,'Удаление строки 0','admin','MNK'),(64,9,'2018-01-03 12:18:30',15,'Удаление строки 0','admin','MNK'),(65,9,'2018-01-03 12:18:30',15,'Удаление строки 0','admin','MNK'),(66,9,'2018-01-03 12:18:30',15,'Удаление строки 0','admin','MNK'),(67,9,'2018-01-03 12:18:30',15,'Удаление строки 0','admin','MNK'),(68,9,'2018-01-03 12:18:30',15,'Удаление строки 0','admin','MNK'),(69,9,'2018-01-03 12:18:31',15,'Удаление строки 0','admin','MNK'),(70,9,'2018-01-03 12:18:33',15,'Удаление строки 0','admin','MNK'),(71,9,'2018-01-03 12:18:33',15,'Удаление строки 0','admin','MNK'),(72,9,'2018-01-03 12:18:33',15,'Удаление строки 0','admin','MNK'),(73,9,'2018-01-03 12:18:33',15,'Удаление строки 0','admin','MNK'),(74,9,'2018-01-03 12:18:34',15,'Удаление строки 0','admin','MNK'),(75,9,'2018-01-03 12:18:34',15,'Удаление строки 0','admin','MNK'),(76,9,'2018-01-03 12:18:34',15,'Удаление строки 0','admin','MNK'),(77,9,'2018-01-03 12:18:35',15,'Удаление строки 0','admin','MNK'),(78,9,'2018-01-03 12:18:35',15,'Удаление строки 0','admin','MNK'),(79,9,'2018-01-03 12:18:36',15,'Загрузить','admin','MNK'),(80,9,'2018-01-03 12:19:01',15,'Вход','admin','MNK'),(81,9,'2018-01-03 12:19:08',15,'Установка (18 - Измеренные) в  5340','admin','MNK'),(82,9,'2021-05-07 16:32:40',9,'Вхід','admin','MNK'),(83,9,'2021-05-07 16:34:18',15,'Вхід','admin','MNK');

--
-- Table structure for table `users_list`
--

CREATE TABLE `users_list` (
  `Id` int(11) NOT NULL AUTO_INCREMENT,
  `Name` varchar(255) NOT NULL,
  `WinLogin` varchar(50) DEFAULT NULL,
  `Password` blob NOT NULL,
  `Admin` tinyint(1) NOT NULL DEFAULT '0',
  `Id_role` int(11) DEFAULT '0' COMMENT 'Код роли пользователя',
  PRIMARY KEY (`Id`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=cp1251;

--
-- Dumping data for table `users_list`
--

INSERT INTO `users_list` VALUES (1,'Администратор','',_binary '�e�Y B/�A~Hg\�\�O��J?��~������z\�',1,1),(2,'Redko','',_binary '�e�Y B/�A~Hg\�\�O��J?��~������z\�',0,2);

--
-- Table structure for table `users_reports_list`
--

CREATE TABLE `users_reports_list` (
  `Id` int(11) NOT NULL AUTO_INCREMENT,
  `ReportType` varchar(127) NOT NULL,
  `ReportCaption` varchar(127) NOT NULL,
  PRIMARY KEY (`Id`)
) ENGINE=InnoDB AUTO_INCREMENT=23 DEFAULT CHARSET=cp1251;

--
-- Dumping data for table `users_reports_list`
--

INSERT INTO `users_reports_list` VALUES (1,'KilometrageControl','Пробег'),(2,'KilometrageDayControl','Пробег суточный'),(3,'KilometrageTotal','Пробег общий'),(4,'FuelControl','Заправки'),(5,'GrainLevel','Уровень зерна'),(6,'KilometrageControlDut','Пробег+ДУТ'),(7,'FuelExpensesControlDutDay','Топливо суточный ДУТ'),(8,'FuelExpensesControlDut','Общий расход ДУТ'),(9,'FlowmeterControl','Расход'),(10,'FuelExpensesControlDrt','Общий расход ДРТ'),(11,'RoadSafetyControl','Безопасность'),(12,'ParamOfMovingControl','Параметры движения'),(13,'CzDetailed','КЗ Детальный'),(14,'CZ_Detailed_General','КЗ Групповой'),(15,'FuelCZ_Inkom_DRT','ДРТ - КЗ'),(16,'FuelCZ_Inkom_DUT','ДУТ - КЗ'),(17,'SensorEventsControl','События датчиков'),(18,'RotationControl','Обороты'),(19,'PassTrafficDaily','Пассажиры суточный'),(20,'FuelerControlDrt','Заправщик'),(21,'ReportDrivers','Водители (RFID)'),(22,'ReportVehicles','Идентификация ТС');

--
-- Table structure for table `vehicle`
--

CREATE TABLE `vehicle` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `MakeCar` text COMMENT 'Марка автомобиля',
  `NumberPlate` text COMMENT 'Номерной знак',
  `Team_id` int(11) DEFAULT NULL,
  `Mobitel_id` int(11) DEFAULT NULL,
  `Odometr` int(11) DEFAULT '0' COMMENT 'Показания одометра',
  `CarModel` text COMMENT 'Модель',
  `setting_id` int(11) DEFAULT '1',
  `odoTime` datetime DEFAULT NULL COMMENT 'Дата и время сверки одометра',
  `driver_id` int(11) DEFAULT '-1',
  `OutLinkId` varchar(20) DEFAULT NULL COMMENT 'Код внешней базы',
  `Category_id` int(11) DEFAULT NULL COMMENT 'Категория транспортая',
  `Category_id2` int(11) DEFAULT NULL COMMENT 'Категория2 транспорта',
  `PcbVersionId` int(11) DEFAULT '-1' COMMENT 'Версия плат датчика назначенная на машину',
  `Category_id3` int(11) DEFAULT NULL COMMENT 'Категория3 транспорта',
  `Category_id4` int(11) DEFAULT NULL COMMENT 'Категория4 транспорта',
  `FuelWayLiter` double DEFAULT '0' COMMENT 'Расход топлива л/100 км',
  `FuelMotorLiter` double DEFAULT '0' COMMENT 'Расход топлива л/моточас',
  `Identifier` int(11) DEFAULT '0' COMMENT 'Идентификатор машины',
  PRIMARY KEY (`id`),
  UNIQUE KEY `id` (`id`) USING BTREE,
  KEY `Mobitel_id` (`Mobitel_id`) USING BTREE,
  KEY `Team_id` (`Team_id`) USING BTREE,
  KEY `setting_id` (`setting_id`) USING BTREE,
  KEY `FK_vehicle_vehicle_category_Id` (`Category_id`),
  KEY `FK_vehicle_vehicle_category_Id2` (`Category_id2`),
  KEY `FK_vehicle_vehicle_category_Id3` (`Category_id3`),
  KEY `FK_vehicle_vehicle_category_Id4` (`Category_id4`),
  CONSTRAINT `FK_vehicle_vehicle_category_Id` FOREIGN KEY (`Category_id`) REFERENCES `vehicle_category` (`Id`),
  CONSTRAINT `FK_vehicle_vehicle_category_Id2` FOREIGN KEY (`Category_id2`) REFERENCES `vehicle_category2` (`Id`),
  CONSTRAINT `FK_vehicle_vehicle_category_Id3` FOREIGN KEY (`Category_id3`) REFERENCES `vehicle_category3` (`Id`),
  CONSTRAINT `FK_vehicle_vehicle_category_Id4` FOREIGN KEY (`Category_id4`) REFERENCES `vehicle_category4` (`Id`)
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=cp1251;

--
-- Dumping data for table `vehicle`
--

INSERT INTO `vehicle` VALUES (1,'Renault Premium','BK 1395 HA',6,97,0,'',1,NULL,1,'',NULL,NULL,2,NULL,NULL,0,0,0),(2,'DAF','BK 2989 HA',6,98,0,'',1,NULL,1,'',NULL,NULL,-1,NULL,NULL,0,0,0),(3,'Renault','BK 5194 CM',6,99,0,'',1,NULL,1,'',NULL,NULL,2,NULL,NULL,0,0,0),(4,'Renault','BK 2114 HA',6,100,0,'Premium',1,NULL,1,'',NULL,NULL,2,NULL,NULL,0,0,0),(5,'DAF','BK 6108 HC',6,825503800,0,'',1,NULL,1,'',NULL,NULL,2,NULL,NULL,0,0,0);

--
-- Table structure for table `vehicle_category`
--

CREATE TABLE `vehicle_category` (
  `Id` int(11) NOT NULL AUTO_INCREMENT,
  `Name` varchar(50) NOT NULL COMMENT 'Категория транспортного средства',
  `Tonnage` decimal(10,3) NOT NULL DEFAULT '0.000' COMMENT 'Грузоподъемность,  тонн',
  `FuelNormMoving` double NOT NULL DEFAULT '0' COMMENT 'норма расхода топлива в движении л/100 км',
  `FuelNormParking` double NOT NULL DEFAULT '0' COMMENT 'норма расхода топлива на холостых оборотах л/час',
  PRIMARY KEY (`Id`)
) ENGINE=InnoDB DEFAULT CHARSET=cp1251;

--
-- Dumping data for table `vehicle_category`
--


--
-- Table structure for table `vehicle_category2`
--

CREATE TABLE `vehicle_category2` (
  `Id` int(11) NOT NULL AUTO_INCREMENT,
  `Name` varchar(255) NOT NULL COMMENT 'Категория2 транспортного средства',
  PRIMARY KEY (`Id`)
) ENGINE=InnoDB DEFAULT CHARSET=cp1251;

--
-- Dumping data for table `vehicle_category2`
--


--
-- Table structure for table `vehicle_category3`
--

CREATE TABLE `vehicle_category3` (
  `Id` int(11) NOT NULL AUTO_INCREMENT,
  `Name` varchar(255) NOT NULL COMMENT 'Категория3 транспортного средства',
  PRIMARY KEY (`Id`)
) ENGINE=InnoDB DEFAULT CHARSET=cp1251;

--
-- Dumping data for table `vehicle_category3`
--


--
-- Table structure for table `vehicle_category4`
--

CREATE TABLE `vehicle_category4` (
  `Id` int(11) NOT NULL AUTO_INCREMENT,
  `Name` varchar(255) NOT NULL COMMENT 'Категория4 транспортного средства',
  PRIMARY KEY (`Id`)
) ENGINE=InnoDB DEFAULT CHARSET=cp1251;

--
-- Dumping data for table `vehicle_category4`
--


--
-- Table structure for table `vehicle_commentary`
--

CREATE TABLE `vehicle_commentary` (
  `Id` int(11) NOT NULL AUTO_INCREMENT,
  `Comment` varchar(255) DEFAULT NULL,
  `Mobitel_id` int(11) NOT NULL,
  PRIMARY KEY (`Id`)
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=cp1251 COMMENT='Комментарий для машины';

--
-- Dumping data for table `vehicle_commentary`
--

INSERT INTO `vehicle_commentary` VALUES (1,'+37257910785',97),(2,'+37257910786',98),(3,'+37257910788',99),(4,'+37257910800',100),(5,'+37257910803',825503800);

--
-- Table structure for table `ver`
--

CREATE TABLE `ver` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `Num` int(11) unsigned NOT NULL DEFAULT '0' COMMENT 'Номер текущей сборки БД',
  `Desc` text NOT NULL COMMENT 'Описание текущей сборки БД',
  `time` datetime DEFAULT NULL COMMENT 'Время обновления',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=cp1251;

--
-- Dumping data for table `ver`
--

INSERT INTO `ver` VALUES (1,1,'Сборка от 9.12.2008','2008-12-09 00:00:00'),(2,2,'Сборка от 10.02.2009','2009-02-10 00:00:00');

--
-- Table structure for table `zone_category`
--

CREATE TABLE `zone_category` (
  `Id` int(11) NOT NULL AUTO_INCREMENT,
  `Name` varchar(255) DEFAULT NULL COMMENT 'Категория зоны',
  PRIMARY KEY (`Id`)
) ENGINE=InnoDB DEFAULT CHARSET=cp1251 COMMENT='Категории для зон';

--
-- Dumping data for table `zone_category`
--


--
-- Table structure for table `zone_category2`
--

CREATE TABLE `zone_category2` (
  `Id` int(11) NOT NULL AUTO_INCREMENT,
  `Name` varchar(255) DEFAULT NULL COMMENT 'Категория2 зоны',
  PRIMARY KEY (`Id`)
) ENGINE=InnoDB DEFAULT CHARSET=cp1251 COMMENT='Категории2 для зон';

--
-- Dumping data for table `zone_category2`
--


--
-- Table structure for table `zonerelations`
--

CREATE TABLE `zonerelations` (
  `ZoneRelation_ID` int(11) NOT NULL AUTO_INCREMENT,
  `Zone_ID` int(11) DEFAULT '0',
  `ConfigZoneSet_ID` int(11) DEFAULT '0',
  `In_flag` tinyint(4) NOT NULL DEFAULT '0',
  `Out_flag` tinyint(4) NOT NULL DEFAULT '0',
  `In_flag2` tinyint(4) NOT NULL DEFAULT '0',
  `Out_flag2` tinyint(4) NOT NULL DEFAULT '0',
  PRIMARY KEY (`ZoneRelation_ID`)
) ENGINE=InnoDB AUTO_INCREMENT=222 DEFAULT CHARSET=cp1251;

--
-- Dumping data for table `zonerelations`
--

INSERT INTO `zonerelations` VALUES (220,78,248,1,0,0,0),(221,78,249,1,0,0,0);

--
-- Table structure for table `zones`
--

CREATE TABLE `zones` (
  `Zone_ID` int(11) NOT NULL AUTO_INCREMENT,
  `Name` char(50) DEFAULT NULL,
  `Descr` text,
  `ID` int(11) DEFAULT '0',
  `Status` tinyint(4) DEFAULT '0',
  `Square` double(14,5) DEFAULT '0.00000' COMMENT 'Площадь контрольной зоны',
  `ZoneColor` int(11) DEFAULT '0' COMMENT 'Цвет контрольной зоны',
  `TextColor` int(11) DEFAULT '0' COMMENT 'Цвет подписи контрольной зоны',
  `TextFontName` char(50) DEFAULT 'Microsoft Sans Serif' COMMENT 'Шрирфт подписи контрольной зоны',
  `TextFontSize` double(5,2) DEFAULT '25.00' COMMENT 'Размер шрирфта подписи контрольной зоны',
  `TextFontParams` char(8) DEFAULT '0;0;0;0;' COMMENT 'Параметры шрирфта подписи контрольной зоны',
  `Icon` blob COMMENT 'Иконка контрольной зоны',
  `HatchStyle` int(11) DEFAULT '0' COMMENT 'Текстура контрольной зоны',
  `DateCreate` datetime DEFAULT NULL COMMENT 'Дата создания',
  `Id_main` int(11) DEFAULT '0' COMMENT 'Ссылка на элемент верхнего уровня в иерархии',
  `Level` tinyint(4) DEFAULT '1' COMMENT 'Уровень в иерархии',
  `StyleId` int(10) unsigned NOT NULL DEFAULT '0' COMMENT 'ID стиля зоны',
  `ZonesGroupId` int(10) unsigned NOT NULL DEFAULT '1' COMMENT 'ID Группы зон',
  `OutLinkId` varchar(20) DEFAULT NULL COMMENT 'Код внешней базы',
  `Category_id` int(11) DEFAULT NULL COMMENT 'Категория для зоны',
  `Category_id2` int(11) DEFAULT NULL COMMENT 'Категория2 для зоны',
  PRIMARY KEY (`Zone_ID`),
  KEY `FK_zones_zonesgroup` (`ZonesGroupId`),
  CONSTRAINT `FK_zones_zonesgroup` FOREIGN KEY (`ZonesGroupId`) REFERENCES `zonesgroup` (`Id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=cp1251;

--
-- Dumping data for table `zones`
--


--
-- Table structure for table `zonesgroup`
--

CREATE TABLE `zonesgroup` (
  `Id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `Title` varchar(50) NOT NULL,
  `Description` varchar(200) NOT NULL,
  `OutLinkId` varchar(20) DEFAULT NULL COMMENT 'Код внешней базы',
  PRIMARY KEY (`Id`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=cp1251;

--
-- Dumping data for table `zonesgroup`
--

INSERT INTO `zonesgroup` VALUES (1,'Все зоны','НЕ УДАЛЯТЬ! Корневой элемент дерева контрольных зон',NULL);

--
-- Dumping events for database 'redko'
--

--
-- Dumping routines for database 'redko'
--
/*!50003 DROP FUNCTION IF EXISTS `CheckVersion` */;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` FUNCTION `CheckVersion`(maskVersion TINYTEXT) RETURNS tinyint(4)
    SQL SECURITY INVOKER
    COMMENT 'Проверка версии СУБД. Должна быть maskVersion или выше. Результа'
BEGIN

  DECLARE currentVersion TINYTEXT;

  SELECT Left(VERSION(), Length(maskVersion)) INTO currentVersion;

  RETURN currentVersion >= maskVersion;

END ;;
DELIMITER ;
/*!50003 DROP FUNCTION IF EXISTS `HaveSuperPrivileges` */;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` FUNCTION `HaveSuperPrivileges`() RETURNS tinyint(4)
    SQL SECURITY INVOKER
    COMMENT 'Проверка, имеет ли пользователь привилегию SUPER. Результат: 1 -'
BEGIN

  DECLARE usrstr TINYTEXT DEFAULT '';



  DECLARE usr TINYTEXT DEFAULT '';

  DECLARE hst TINYTEXT DEFAULT '';

  DECLARE pos TINYINT;



  SELECT USER() INTO usrstr;



  SELECT INSTR(usrstr, '@') INTO pos;





  SELECT Left(usrstr, pos - 1), Right(usrstr, Length(usrstr) - pos) INTO usr, hst;



  RETURN (

    SELECT COUNT(*) > 0

    FROM mysql.`user` u

    WHERE u.`User` = usr AND u.Host = hst AND Super_priv = 'Y'

  );

END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `BMCTransferBuffer` */;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `BMCTransferBuffer`(IN DatagpsIsUpdated INT, IN Datagps64IsUpdated INT)
    COMMENT 'Обновление online* для BMC'
BEGIN
	DECLARE MobitelID INT;
	DECLARE done INT DEFAULT FALSE;
	DECLARE CursorMobitels CURSOR FOR SELECT Mobitel_ID FROM datagpsbuffer_bmc WHERE `Online`=1;
	DECLARE CursorMobitels64 CURSOR FOR SELECT Mobitel_ID FROM datagpsbuffer_bmc64 WHERE `Online`=1;
	DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE;
    
	/* datagps */
	IF DatagpsIsUpdated THEN
		OPEN CursorMobitels;
		read_loop: LOOP
			FETCH CursorMobitels INTO MobitelID;
			IF done THEN
				LEAVE read_loop;
			END IF;
			DELETE FROM `online` WHERE Mobitel_ID=MobitelID AND UnixTime <= (SELECT COALESCE(UnixTime, 0) FROM (SELECT UnixTime FROM `online` WHERE Mobitel_ID=MobitelID ORDER BY UnixTime DESC LIMIT 100, 1) o);
		END LOOP;
		CLOSE CursorMobitels;
		UPDATE mobitels m,datagpsbuffer_bmc b SET m.LastInsertTime=b.UnixTime WHERE m.Mobitel_ID=b.Mobitel_ID AND m.LastInsertTime<b.UnixTime;
	END IF;
	/* datagps64 */
	IF Datagps64IsUpdated THEN
		OPEN CursorMobitels64;
		read_loop: LOOP
			FETCH CursorMobitels64 INTO MobitelID;
			IF done THEN
				LEAVE read_loop;
			END IF;
			DELETE FROM `online64` WHERE Mobitel_ID=MobitelID AND UnixTime <= (SELECT COALESCE(UnixTime, 0) FROM (SELECT UnixTime FROM `online64` WHERE Mobitel_ID=MobitelID ORDER BY UnixTime DESC LIMIT 100, 1) o);
		END LOOP;
		CLOSE CursorMobitels64;
		UPDATE mobitels m,datagpsbuffer_bmc64 b SET m.LastInsertTime=b.UnixTime WHERE m.Mobitel_ID=b.Mobitel_ID AND m.LastInsertTime<b.UnixTime;
	END IF;
END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `CheckDB` */;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `CheckDB`()
    SQL SECURITY INVOKER
    COMMENT 'Проверка БД при подключении.'
BEGIN



  SELECT 'OK';


END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `CheckOdo` */;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `CheckOdo`(IN m_id INTEGER(11), IN end_time DATETIME)
    SQL SECURITY INVOKER
BEGIN

  SELECT 

   FROM_UNIXTIME(datagps.UnixTime) AS `time` ,

   (datagps.Latitude / 600000.00000) AS Lat,

   (datagps.Longitude / 600000.00000) AS Lon

  FROM

    datagps

  WHERE

    datagps.Mobitel_ID = m_id AND 

    datagps.UnixTime BETWEEN (SELECT UNIX_TIMESTAMP(odoTime)  FROM vehicle WHERE Mobitel_id = m_id) AND 

    UNIX_TIMESTAMP(end_time) AND 

    Valid = 1;

END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `CleaningDataGpsLostOn` */;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `CleaningDataGpsLostOn`()
    SQL SECURITY INVOKER
    COMMENT 'Сия процедура удаляет не корректно оформленные диапазоны пропусков из таблицы datagpslost_on'
BEGIN

  /* удаляем записи у которых BeginSrvPacketId >= EndSrvPacketId */

  DELETE d FROM datagpslost_on d WHERE d.Begin_SrvPacketID >= d.End_SrvPacketID;

  /* удаляем записи у которых EndLogId - BeginLogId <= 1 */

  DELETE d FROM datagpslost_on d WHERE d.End_LogID - d.Begin_LogID <= 1;

  /* удаляем записи которые с заданным LogId и SrvPackId отсутвут в таблице datagps или datagps64 (фантомные записи) */



  CREATE TEMPORARY TABLE MobiTemp (Id bigint(20) UNSIGNED DEFAULT 0)ENGINE = INNODB

    CHARACTER SET cp1251

    COLLATE cp1251_general_ci

    COMMENT = 'Промежуточная временная таблица';



  INSERT INTO MobiTemp SELECT d.Id FROM datagpslost_on d WHERE 

  NOT EXISTS(SELECT NULL FROM datagps d1 WHERE (d.Mobitel_ID = d1.Mobitel_ID) AND ((d.Begin_LogID = d1.LogID) AND (d.Begin_SrvPacketID = d1.SrvPacketID))) AND 

  NOT EXISTS(SELECT NULL FROM datagps64 d2 WHERE (d.Mobitel_ID = d2.Mobitel_ID) AND ((d.Begin_LogID = d2.LogID) AND (d.Begin_SrvPacketID = d2.SrvPacketID))); 

  DELETE d FROM datagpslost_on d, MobiTemp m WHERE m.Id = d.Id;



  TRUNCATE MobiTemp;



  INSERT INTO MobiTemp SELECT d.Id FROM datagpslost_on d WHERE 

  NOT EXISTS(SELECT NULL FROM datagps d1 WHERE (d.Mobitel_ID = d1.Mobitel_ID) AND ((d.End_LogID = d1.LogID) AND (d.End_SrvPacketID = d1.SrvPacketID))) AND 

  NOT EXISTS(SELECT NULL FROM datagps64 d2 WHERE (d.Mobitel_ID = d2.Mobitel_ID) AND ((d.End_LogID = d2.LogID) AND (d.End_SrvPacketID = d2.SrvPacketID))); 

  DELETE d FROM datagpslost_on d, MobiTemp m WHERE m.Id = d.Id;



  DROP TEMPORARY TABLE MobiTemp;



  SELECT 1;

  

END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `dataview` */;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `dataview`(

  IN m_id INTEGER(11), 

  IN val BOOL, 

  IN begin_time DATETIME, 

  IN end_time DATETIME)
    SQL SECURITY INVOKER
BEGIN

  SELECT DataGps_ID AS DataGps_ID,

    Mobitel_ID AS Mobitel_ID,

    ((Latitude * 1.0000) / 600000) AS Lat,

    ((Longitude * 1.0000) / 600000) AS Lon,

    Altitude AS Altitude,

    FROM_UNIXTIME(UnixTime) AS `time`,

    (Speed * 1.852) AS speed,

    ((Direction * 360) / 255) AS direction,

    Valid AS Valid,

    (Sensor8 + (Sensor7 << 8) + (Sensor6 << 16) + 

      (Sensor5 << 24) + (Sensor4 << 32) + (Sensor3 << 40) + 

      (Sensor2 << 48) + (Sensor1 << 56)) AS sensor,

    Events AS Events,

    LogID AS LogID 

  FROM datagps 

  WHERE Mobitel_ID = m_id AND  

    (UnixTime BETWEEN UNIX_TIMESTAMP(begin_time) AND UNIX_TIMESTAMP(end_time)) AND                                                                                                                                

    (Valid = val) AND NOT (Latitude = 0 AND Longitude =0)

  ORDER BY UnixTime;

END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `delDupSrvPacket` */;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `delDupSrvPacket`()
    SQL SECURITY INVOKER
    COMMENT 'Удаляет дубликаты SrvPacketID из таблицы datagpsbuffer_on64'
BEGIN

DROP TEMPORARY TABLE IF EXISTS tmp64;




CREATE TEMPORARY TABLE tmp64 SELECT Mobitel_ID,

  Latitude,

  Longitude,

  Direction,

  Acceleration,

  UnixTime,

  Speed,

  Valid,

  Satellites,

  RssiGsm,

  `Events`,

  SensorsSet,

  Sensors,

  Voltage,

  DGPS,

  LogID,

  SrvPacketID

FROM datagpsbuffer_on64 d

GROUP BY d.SrvPacketID;



  TRUNCATE TABLE datagpsbuffer_on64;



  INSERT INTO datagpsbuffer_on64 SELECT Mobitel_ID,

  Latitude,

  Longitude,

  Direction,

  Acceleration,

  UnixTime,

  Speed,

  Valid,

  Satellites,

  RssiGsm,

  `Events`,

  SensorsSet,

  Sensors,

  Voltage,

  DGPS,

  LogID,

  SrvPacketID

FROM tmp64 d;



DROP TEMPORARY TABLE IF EXISTS tmp64;


END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `DrListMobitelConfig` */;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `DrListMobitelConfig`()
    SQL SECURITY INVOKER
    COMMENT 'Выборка настроек телетреков в режиме DirectOnline'
BEGIN

  SELECT m.Mobitel_id AS MobitelID, 

    imc.DevIdShort AS DevIdShort,

    cge.Pop3un AS Login, 

    cge.Pop3pw AS Password

  FROM Mobitels m JOIN ConfigMain cm ON m.Mobitel_id = cm.Mobitel_ID

    JOIN ConfigGprsEmail cge ON cm.ConfigGprsEmail_ID = cge.ID

    JOIN internalmobitelconfig imc ON m.InternalMobitelConfig_ID = imc.ID 

  WHERE (cge.ConfigGprsEmail_ID = (

      SELECT MAX(intCge.ConfigGprsEmail_ID)

      FROM ConfigGprsEmail intCge

      WHERE intCge.ID = cge.ID)) AND

    (imc.InternalMobitelConfig_ID = (

      SELECT MAX(intConf.InternalMobitelConfig_ID)

      FROM internalmobitelconfig intConf

      WHERE intConf.ID = imc.ID)) AND 

    (imc.devIdShort IS NOT NULL) AND (imc.devIdShort <> _cp1251 '')	AND 

    (cge.Pop3un IS NOT NULL) AND (cge.Pop3un <> _cp1251 '') 

  ORDER BY m.Mobitel_ID;

END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `DrTransferBuffer` */;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `DrTransferBuffer`()
    SQL SECURITY INVOKER
    COMMENT 'Переносит GPS данные DirectOnline из буферной таблицы в datagps'
BEGIN

  DECLARE MobitelIDInCursor INT; 

  DECLARE DataExists TINYINT DEFAULT 1; 

  

  DECLARE TmpMaxUnixTime INT; 



  DECLARE CursorMobitels CURSOR FOR

    SELECT DISTINCT(Mobitel_ID) FROM datagpsbuffer_dr;



  

  DECLARE CONTINUE HANDLER FOR NOT FOUND SET DataExists = 0;





    

  

  

  DELETE o

  FROM online o, datagpsbuffer_dr dgb

  WHERE (o.Mobitel_ID = dgb.Mobitel_ID) AND (o.LogID = dgb.LogID);

  

  SET DataExists = 1;

  OPEN CursorMobitels;

  FETCH CursorMobitels INTO MobitelIDInCursor;

  WHILE DataExists = 1 DO

    

    SELECT COALESCE(MAX(UnixTime), 0) INTO TmpMaxUnixTime

    FROM online FORCE INDEX (IDX_Mobitelid)

    WHERE Mobitel_ID = MobitelIDInCursor;



    

    INSERT INTO online (

      Mobitel_ID, LogID, UnixTime, Latitude, Longitude, Altitude,

      Direction, Speed, Valid, `Events`,

      Sensor1, Sensor2, Sensor3, Sensor4, Sensor5, Sensor6, Sensor7, Sensor8,

      Counter1, Counter2, Counter3, Counter4, whatIs)

    SELECT

      Mobitel_ID, LogID, UnixTime, Latitude, Longitude, Altitude,

      Direction, Speed, Valid, `Events`,

      Sensor1, Sensor2, Sensor3, Sensor4, Sensor5, Sensor6, Sensor7, Sensor8,

      Counter1, Counter2, Counter3, Counter4, whatIs

    FROM (

      SELECT *

      FROM datagpsbuffer_dr

      WHERE (Mobitel_ID = MobitelIDInCursor)  AND 

        (UnixTime > TmpMaxUnixTime) AND (Valid = 1)

      GROUP BY Mobitel_ID, LogID

      ORDER BY UnixTime DESC

      LIMIT 100) AS T

    ORDER BY UnixTime ASC;



    

    DELETE FROM online

    WHERE (Mobitel_ID = MobitelIDInCursor) AND (UnixTime < 

      (SELECT COALESCE(MIN(UnixTime), 0) 

       FROM (

         SELECT UnixTime

         FROM online

         WHERE Mobitel_ID = MobitelIDInCursor 

         ORDER BY UnixTime DESC

         LIMIT 100) T1)); 

  

    FETCH CursorMobitels INTO MobitelIDInCursor;

  END WHILE;

  CLOSE CursorMobitels;

   





  

  UPDATE datagps d, datagpsbuffer_dr b SET

    d.Latitude = b.Latitude,

    d.Longitude = b.Longitude,

    d.Altitude = b.Altitude,

    d.UnixTime = b.UnixTime,

    d.Speed = b.Speed,

    d.Direction = b.Direction,

    d.Valid = b.Valid,

    d.InMobitelID = b.LogID,

    d.`Events` = b.`Events`,

    d.Sensor1 = b.Sensor1,

    d.Sensor2 = b.Sensor2,

    d.Sensor3 = b.Sensor3,

    d.Sensor4 = b.Sensor4,

    d.Sensor5 = b.Sensor5,

    d.Sensor6 = b.Sensor6,

    d.Sensor7 = b.Sensor7,

    d.Sensor8 = b.Sensor8,

    d.whatIs = b.whatIs,

    d.Counter1 = b.Counter1,

    d.Counter2 = b.Counter2,

    d.Counter3 = b.Counter3,

    d.Counter4 = b.Counter4

  WHERE (d.Mobitel_ID = b.Mobitel_ID) AND (d.LogID = b.LogID);



  

  DELETE b

  FROM datagps d, datagpsbuffer_dr b

  WHERE (d.Mobitel_ID = b.Mobitel_ID) AND (d.LogID = b.LogID);



  

  INSERT INTO datagps (

    Mobitel_ID, LogID, UnixTime, Latitude, Longitude, Altitude,

    Direction, Speed, Valid, `Events`, InMobitelID,

    Sensor1, Sensor2, Sensor3, Sensor4, Sensor5, Sensor6, Sensor7, Sensor8,

    Counter1, Counter2, Counter3, Counter4, whatIs)

  SELECT

    Mobitel_ID, LogID, UnixTime, Latitude, Longitude, Altitude,

    Direction, Speed, Valid, `Events`, LogID,

    Sensor1, Sensor2, Sensor3, Sensor4, Sensor5, Sensor6, Sensor7, Sensor8,

    Counter1, Counter2, Counter3, Counter4, whatIs

  FROM datagpsbuffer_dr

  GROUP BY Mobitel_ID, LogID;



  

  TRUNCATE TABLE datagpsbuffer_dr;

END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `ExecuteQuery` */;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `ExecuteQuery`(IN sqlQuery TINYTEXT)
    SQL SECURITY INVOKER
BEGIN

  SET @s = sqlQuery;

  PREPARE stmt FROM @s;

  EXECUTE stmt;

  DEALLOCATE PREPARE stmt;

END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `getDiapasone` */;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `getDiapasone`(

  IN mobile INTEGER(11),  

  IN prevLogId int, 

  IN currLogId int)
    SQL SECURITY INVOKER
BEGIN

  SELECT DataGps_ID AS DataGps_ID,

    Mobitel_ID AS Mobitel_ID,

    ((Latitude * 1.0000) / 600000) AS Lat,

    ((Longitude * 1.0000) / 600000) AS Lon,

    Altitude AS Altitude,

    FROM_UNIXTIME(UnixTime) AS `time`,

    (Speed * 1.852) AS speed,

    ((Direction * 360) / 255) AS direction,

    Valid AS Valid,

    (Sensor8 + (Sensor7 << 8) + (Sensor6 << 16) + 

      (Sensor5 << 24) + (Sensor4 << 32) + (Sensor3 << 40) + 

      (Sensor2 << 48) + (Sensor1 << 56)) AS sensor,

    Events AS Events,

    LogID AS LogID, 

    SrvPacketID AS srvPack

  FROM datagps 

  WHERE Mobitel_ID = mobile AND  Valid = 1 AND  

    (LogID BETWEEN prevLogId AND currLogId) ORDER BY UnixTime;

END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `getDiapasone64` */;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `getDiapasone64`(

  IN mobile INTEGER(11),  

  IN prevLogId int, 

  IN currLogId int)
    SQL SECURITY INVOKER
BEGIN

  SELECT  DataGps_ID, Mobitel_ID,

    ((Latitude * 1.000) / 10000000) AS Lat,

    ((Longitude * 1.000) / 10000000) AS Lng,

    Acceleration , 

    FROM_UNIXTIME(UnixTime) AS `time` , 

    Speed /10 AS Speed, 

    Valid,

    Sensors AS sensor, 

  `Events`, 

  LogID ,

  Voltage,

  DGPS,

  Direction,

  Satellites,

  SensorsSet,

  RssiGsm,

  SrvPacketID AS srvPack FROM datagps64 d WHERE Mobitel_ID = mobile AND d.Valid = 1 AND  

    (LogID BETWEEN prevLogId AND currLogId) ORDER BY UnixTime;

END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `hystoryOnline` */;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `hystoryOnline`(IN id INTEGER(11))
    SQL SECURITY INVOKER
BEGIN

  SELECT LogID, Mobitel_Id, 

    FROM_UNIXTIME(unixtime)  AS `time`,

    ROUND((Latitude / 600000.00000), 6) AS Lat,

    ROUND((Longitude / 600000.00000), 6)  AS Lon,

    Altitude  AS Altitude,

    (Speed * 1.852) AS speed,

    ((Direction * 360) / 255) AS direction,

    Valid AS Valid,

    (Sensor8 + (Sensor7 << 8) + (Sensor6 << 16) + 

      (Sensor5 << 24) + (Sensor4 << 32) + (Sensor3 << 40) + 

      (Sensor2 << 48) + (Sensor1 << 56)) AS sensor,

    Events AS Events,

    DataGPS_ID  AS 'DataGPS_ID'

  FROM online

  WHERE  datagps_id > id

  ORDER BY datagps_id DESC;

END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `IsTeletrackDatabase` */;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `IsTeletrackDatabase`()
    SQL SECURITY INVOKER
    COMMENT 'Проверка базы данных на соответствие структуре системы Teletrack'
BEGIN

  DECLARE i TINYINT;



END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `new_proc` */;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `new_proc`(IN sensor INTEGER(11), IN m_id INTEGER(11), IN s_id INTEGER(11), IN begin_time DATETIME, IN end_time DATETIME)
    READS SQL DATA
    SQL SECURITY INVOKER
BEGIN                                                                                                                                      
select                                                                                                                                     
    round((`datagps`.`Longitude` / 600000),6) AS `lon`,                                                                                    
    round((`datagps`.`Latitude` / 600000),6) AS `lat`,                                                                                     
    `datagps`.`Mobitel_ID` AS `Mobitel_ID`,                                                                                                
    `sensordata`.`Value` AS `Value`,                                                                                                       
    (`datagps`.`Speed` * 1.852) AS `speed`,                                                                                                
    from_unixtime(`datagps`.`UnixTime`) AS `time`,                                                                                         
    `sensordata`.`sensor_id` AS `sensor_id`,                                                                                               
    `datagps`.`DataGps_ID` AS `datagps_id`,                                                                                                
    `datagps`.`Sensor1`&`sensor` AS `sensor`                                                                                              
  from                                                                                                                                     
    (`sensordata` join `datagps` on((`sensordata`.`datagps_id` = `datagps`.`DataGps_ID`)))                                                 
  where                                                                                                                                    
    (`datagps`.`Valid` = 1) and                                                                                                            
    ( datagps.UnixTime BETWEEN UNIX_TIMESTAMP(begin_time) and UNIX_TIMESTAMP(end_time))                                                    
    and datagps.Mobitel_ID = m_id AND sensordata.sensor_id = s_id                                                                          
  order by                                                                                                                                 
    `datagps`.`UnixTime`,`datagps`.`Mobitel_ID`,`sensordata`.`sensor_id`;                                                                  
END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `OnCorrectInfotrackLogId` */;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `OnCorrectInfotrackLogId`()
    SQL SECURITY INVOKER
    COMMENT 'Корректировка значений LogId и InMobitelID в данных инфотреков'
BEGIN

  DECLARE MobitelIDInCursor INT; /* Текущее значение MobitelID */

  DECLARE DataExists TINYINT DEFAULT 1; /* Флаг наличия данных после фетча */

  DECLARE MaxLogId INT DEFAULT 0; /* Максимальный LogId для данного дивайса */

  DECLARE SrvPacketIDInCursor BIGINT DEFAULT 0; /* Текущее значение серверного пакета */

    

  /* Курсор по инфотрекам в множестве новых данных. 

     Все инфотреки начинаются с буквы I */

  DECLARE CursorInfoTrack CURSOR FOR

    SELECT DISTINCT buf.Mobitel_ID

    FROM datagpsbuffer_on buf 

      JOIN mobitels m ON (buf.mobitel_id = m.mobitel_id)

      JOIN internalmobitelconfig c ON (c.ID = m.InternalMobitelConfig_ID)

    WHERE (c.InternalMobitelConfig_ID = (

      SELECT intConf.InternalMobitelConfig_ID

      FROM internalmobitelconfig intConf

      WHERE (intConf.ID = c.ID) 

      ORDER BY intConf.InternalMobitelConfig_ID DESC

      LIMIT 1)) AND 

      (c.devIdShort LIKE "I%") AND (buf.LogId = 0)

    ORDER BY 1;

    

  /* Курсор по данным телетрека */

  DECLARE CursorInfoTrackUpdateSet CURSOR FOR

    SELECT SrvPacketID 

    FROM datagpsbuffer_on

    WHERE (Mobitel_ID = MobitelIDInCursor) AND (LogId = 0)

    ORDER BY UnixTime;  



  /* Обработчик отсутствующей записи при FETCH следующей записи */

  DECLARE CONTINUE HANDLER FOR NOT FOUND SET DataExists = 0;

  

  OPEN CursorInfoTrack;

  FETCH CursorInfoTrack INTO MobitelIDInCursor;

  WHILE DataExists = 1 DO

    /* Находим максимальный LogId для данного инфотрека */

    SELECT COALESCE(MAX(LogID), 0) INTO	MaxLogId

    FROM DataGps

    WHERE Mobitel_ID = MobitelIDInCursor;



    /* Обновляем LogId и InMobitelID в наборе новых данных текущего инфотрека */

    OPEN CursorInfoTrackUpdateSet;

    FETCH CursorInfoTrackUpdateSet INTO SrvPacketIDInCursor;

    WHILE DataExists = 1 DO

      SET MaxLogId = MaxLogId + 1;



      UPDATE datagpsbuffer_on

      SET LogId = MaxLogId, InMobitelID = MaxLogId

      WHERE SrvPacketID = SrvPacketIDInCursor;



      FETCH CursorInfoTrackUpdateSet INTO SrvPacketIDInCursor;

    END WHILE;

    CLOSE CursorInfoTrackUpdateSet;

 

    SET DataExists = 1;

    FETCH CursorInfoTrack INTO MobitelIDInCursor;

  END WHILE;

  CLOSE CursorInfoTrack;

END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `OnCorrectInfotrackLogId64` */;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `OnCorrectInfotrackLogId64`()
    SQL SECURITY INVOKER
    COMMENT 'РљРѕСЂСЂРµРєС‚РёСЂРѕРІРєР° Р·РЅР°С‡РµРЅРёР№ LogId Рё InMobitelID РІ РґР°РЅРЅС‹С… РёРЅС„РѕС‚СЂРµРєРѕРІ'
BEGIN

  DECLARE MobitelIDInCursor int; /* РўРµРєСѓС‰РµРµ Р·РЅР°С‡РµРЅРёРµ MobitelID */

  DECLARE DataExists tinyint DEFAULT 1; /* Р¤Р»Р°Рі РЅР°Р»РёС‡РёСЏ РґР°РЅРЅС‹С… РїРѕСЃР»Рµ С„РµС‚С‡Р° */

  DECLARE MaxLogId int DEFAULT 0; /* РњР°РєСЃРёРјР°Р»СЊРЅС‹Р№ LogId РґР»СЏ РґР°РЅРЅРѕРіРѕ РґРёРІР°Р№СЃР° */

  DECLARE SrvPacketIDInCursor bigint DEFAULT 0; /* РўРµРєСѓС‰РµРµ Р·РЅР°С‡РµРЅРёРµ СЃРµСЂРІРµСЂРЅРѕРіРѕ РїР°РєРµС‚Р° */



  /* РљСѓСЂСЃРѕСЂ РїРѕ РёРЅС„РѕС‚СЂРµРєР°Рј РІ РјРЅРѕР¶РµСЃС‚РІРµ РЅРѕРІС‹С… РґР°РЅРЅС‹С…. 

     Р’СЃРµ РёРЅС„РѕС‚СЂРµРєРё РЅР°С‡РёРЅР°СЋС‚СЃСЏ СЃ Р±СѓРєРІС‹ I */

  DECLARE CursorInfoTrack CURSOR FOR

  SELECT DISTINCT

    buf.Mobitel_ID

  FROM datagpsbuffer_on64 buf

    JOIN mobitels m

      ON (buf.mobitel_id = m.mobitel_id)

    JOIN internalmobitelconfig c

      ON (c.ID = m.InternalMobitelConfig_ID)

  WHERE (c.InternalMobitelConfig_ID = (SELECT

      intConf.InternalMobitelConfig_ID

    FROM internalmobitelconfig intConf

    WHERE (intConf.ID = c.ID)

    ORDER BY intConf.InternalMobitelConfig_ID DESC

    LIMIT 1)) AND

  (c.devIdShort LIKE "I%") AND (buf.LogId = 0)

  ORDER BY 1;



  /* РљСѓСЂСЃРѕСЂ РїРѕ РґР°РЅРЅС‹Рј С‚РµР»РµС‚СЂРµРєР° */

  DECLARE CursorInfoTrackUpdateSet CURSOR FOR

  SELECT

    SrvPacketID

  FROM datagpsbuffer_on64

  WHERE (Mobitel_ID = MobitelIDInCursor) AND (LogId = 0)

  ORDER BY UnixTime;



  /* РћР±СЂР°Р±РѕС‚С‡РёРє РѕС‚СЃСѓС‚СЃС‚РІСѓСЋС‰РµР№ Р·Р°РїРёСЃРё РїСЂРё FETCH СЃР»РµРґСѓСЋС‰РµР№ Р·Р°РїРёСЃРё */

  DECLARE CONTINUE HANDLER FOR NOT FOUND SET DataExists = 0;



  OPEN CursorInfoTrack;

  FETCH CursorInfoTrack INTO MobitelIDInCursor;

  WHILE DataExists = 1 DO

    /* РќР°С…РѕРґРёРј РјР°РєСЃРёРјР°Р»СЊРЅС‹Р№ LogId РґР»СЏ РґР°РЅРЅРѕРіРѕ РёРЅС„РѕС‚СЂРµРєР° */

    SELECT

      COALESCE(MAX(LogID), 0) INTO MaxLogId

    FROM DataGps

    WHERE Mobitel_ID = MobitelIDInCursor;



    /* РћР±РЅРѕРІР»СЏРµРј LogId Рё InMobitelID РІ РЅР°Р±РѕСЂРµ РЅРѕРІС‹С… РґР°РЅРЅС‹С… С‚РµРєСѓС‰РµРіРѕ РёРЅС„РѕС‚СЂРµРєР° */

    OPEN CursorInfoTrackUpdateSet;

    FETCH CursorInfoTrackUpdateSet INTO SrvPacketIDInCursor;

    WHILE DataExists = 1 DO

      SET MaxLogId = MaxLogId + 1;



      UPDATE datagpsbuffer_on64

      SET LogId = MaxLogId,

          InMobitelID = MaxLogId

      WHERE SrvPacketID = SrvPacketIDInCursor;



      FETCH CursorInfoTrackUpdateSet INTO SrvPacketIDInCursor;

    END WHILE;

    CLOSE CursorInfoTrackUpdateSet;



    SET DataExists = 1;

    FETCH CursorInfoTrack INTO MobitelIDInCursor;

  END WHILE;

  CLOSE CursorInfoTrack;

END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `OnDeleteDuplicates` */;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `OnDeleteDuplicates`()
    SQL SECURITY INVOKER
    COMMENT 'Удаление повторяющихся строк из datagpsbuffer_on'
BEGIN

  /* Удаляет дубликаты строк из таблицы datagpsbuffer_on. Критерием поиска

   являются одинаковые значения в полях Mobitel_Id + LogID. Из множества

   повторяющихся записей в таблице datagpsbuffer_on останется только одна - 

   последняя принятая телематическим сервером, т.е. с максимальным SrvPacketID. */

   

  /* Текущий MobitelId в курсоре CursorDuplicateGroups */

  DECLARE MobitelIdInCursor INT DEFAULT 0; 

  /* Текущий LogID в курсоре CursorDuplicateGroups */

  DECLARE LogIdInCursor INT DEFAULT 0; 

  /* Max SrvPacketId в множестве строк текущей группы дубликатов */

  DECLARE MaxSrvPacketId BIGINT DEFAULT 0; 

  DECLARE DataExists TINYINT DEFAULT 1;



  /* Курсор для прохода по всем группам дубликатов */  

  DECLARE CursorDuplicateGroups CURSOR FOR

    SELECT Mobitel_Id, LogId 

    FROM datagpsbuffer_on

    GROUP BY Mobitel_Id, LogId 

    HAVING COUNT(LogId) > 1;

    

  DECLARE CONTINUE HANDLER FOR NOT FOUND SET DataExists = 0;



  SET DataExists = 1;

  OPEN CursorDuplicateGroups;

  FETCH CursorDuplicateGroups INTO MobitelIdInCursor, LogIdInCursor;

  WHILE DataExists = 1 DO

    SELECT MAX(SrvPacketID) INTO MaxSrvPacketId

    FROM datagpsbuffer_on 

    WHERE (Mobitel_ID = MobitelIdInCursor) AND (LogId = LogIdInCursor);

         

    DELETE FROM datagpsbuffer_on  

    WHERE (Mobitel_ID = MobitelIdInCursor) AND (LogId = LogIdInCursor) 

      AND (SrvPacketID < MaxSrvPacketId);

        

    FETCH CursorDuplicateGroups INTO MobitelIdInCursor, LogIdInCursor;

  END WHILE;

  CLOSE CursorDuplicateGroups; 

END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `OnDeleteDuplicates64` */;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `OnDeleteDuplicates64`()
    SQL SECURITY INVOKER
    COMMENT 'РЈРґР°Р»РµРЅРёРµ РїРѕРІС‚РѕСЂСЏСЋС‰РёС…СЃСЏ СЃС‚СЂРѕРє РёР· datagpsbuffer_on64'
BEGIN

  /* РЈРґР°Р»СЏРµС‚ РґСѓР±Р»РёРєР°С‚С‹ СЃС‚СЂРѕРє РёР· С‚Р°Р±Р»РёС†С‹ datagpsbuffer_on64. РљСЂРёС‚РµСЂРёРµРј РїРѕРёСЃРєР°

   СЏРІР»СЏСЋС‚СЃСЏ РѕРґРёРЅР°РєРѕРІС‹Рµ Р·РЅР°С‡РµРЅРёСЏ РІ РїРѕР»СЏС… Mobitel_Id + LogID. РР· РјРЅРѕР¶РµСЃС‚РІР°

   РїРѕРІС‚РѕСЂСЏСЋС‰РёС…СЃСЏ Р·Р°РїРёСЃРµР№ РІ С‚Р°Р±Р»РёС†Рµ datagpsbuffer_on64 РѕСЃС‚Р°РЅРµС‚СЃСЏ С‚РѕР»СЊРєРѕ РѕРґРЅР° - 

   РїРѕСЃР»РµРґРЅСЏСЏ РїСЂРёРЅСЏС‚Р°СЏ С‚РµР»РµРјР°С‚РёС‡РµСЃРєРёРј СЃРµСЂРІРµСЂРѕРј, С‚.Рµ. СЃ РјР°РєСЃРёРјР°Р»СЊРЅС‹Рј SrvPacketID. */



  /* РўРµРєСѓС‰РёР№ MobitelId РІ РєСѓСЂСЃРѕСЂРµ CursorDuplicateGroups */

  DECLARE MobitelIdInCursor int DEFAULT 0;

  /* РўРµРєСѓС‰РёР№ LogID РІ РєСѓСЂСЃРѕСЂРµ CursorDuplicateGroups */

  DECLARE LogIdInCursor int DEFAULT 0;

  /* Max SrvPacketId РІ РјРЅРѕР¶РµСЃС‚РІРµ СЃС‚СЂРѕРє С‚РµРєСѓС‰РµР№ РіСЂСѓРїРїС‹ РґСѓР±Р»РёРєР°С‚РѕРІ */

  DECLARE MaxSrvPacketId bigint DEFAULT 0;

  DECLARE DataExists tinyint DEFAULT 1;



  /* РљСѓСЂСЃРѕСЂ РґР»СЏ РїСЂРѕС…РѕРґР° РїРѕ РІСЃРµРј РіСЂСѓРїРїР°Рј РґСѓР±Р»РёРєР°С‚РѕРІ */

  DECLARE CursorDuplicateGroups CURSOR FOR

  SELECT

    Mobitel_Id,

    LogId

  FROM datagpsbuffer_on64

  GROUP BY Mobitel_Id,

           LogId

  HAVING COUNT(LogId) > 1;



  DECLARE CONTINUE HANDLER FOR NOT FOUND SET DataExists = 0;



  SET DataExists = 1;

  OPEN CursorDuplicateGroups;

  FETCH CursorDuplicateGroups INTO MobitelIdInCursor, LogIdInCursor;

  WHILE DataExists = 1 DO

    SELECT

      MAX(SrvPacketID) INTO MaxSrvPacketId

    FROM datagpsbuffer_on64

    WHERE (Mobitel_ID = MobitelIdInCursor) AND (LogId = LogIdInCursor);



    DELETE

      FROM datagpsbuffer_on64

    WHERE (Mobitel_ID = MobitelIdInCursor) AND (LogId = LogIdInCursor)

      AND (SrvPacketID < MaxSrvPacketId);



    FETCH CursorDuplicateGroups INTO MobitelIdInCursor, LogIdInCursor;

  END WHILE;

  CLOSE CursorDuplicateGroups;

END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `OnDeleteLostRange` */;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `OnDeleteLostRange`(IN MobitelID INTEGER(11), IN BeginSrvPacketID BIGINT)
    SQL SECURITY INVOKER
    COMMENT 'Удаление указанного диапазона пропусков из datagpslost_on.'
BEGIN

  /* Определяем является ли запись, предназначенная для удаления,

     первой в списке заданного телетрека. Если является - тогда

     внесем поправку в значение ConfirmedID */  

     

  DECLARE MinBeginSrvPacketID BIGINT; -- Минимальное значение Begin_SrvPacketID для данного телетрека

  DECLARE NewConfirmedID INT; -- Новое значение ConfirmedID  



  /* Нахождение минимального значения Begin_SrvPacketID */  

  SELECT MIN(Begin_SrvPacketID) INTO MinBeginSrvPacketID

  FROM datagpslost_on

  WHERE Mobitel_ID = MobitelID;

  

  /* Если есть данные о пропусках у телетрека - продолжим */

  IF MinBeginSrvPacketID IS NOT NULL THEN

    /* Если удаляем первую запись - запомним новое значение ConfirmedID */

    IF MinBeginSrvPacketID = BeginSrvPacketID  THEN

      SELECT End_LogID INTO NewConfirmedID

      FROM datagpslost_on

      WHERE (Mobitel_ID = MobitelID) AND (Begin_SrvPacketID = BeginSrvPacketID);

    END IF;

  

    /* Удаление записи */

    DELETE FROM  datagpslost_on

    WHERE (Mobitel_ID = MobitelID) AND (Begin_SrvPacketID = BeginSrvPacketID);

    

    /* Если удалили первую запись - обновим ConfirmedID */  

    IF MinBeginSrvPacketID = BeginSrvPacketID  THEN

      UPDATE mobitels

      SET ConfirmedID = NewConfirmedID

      WHERE (Mobitel_ID = MobitelID) AND (NewConfirmedID > ConfirmedID);

    END IF;

  END IF;  

END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `OnInsertDatagpsLost` */;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `OnInsertDatagpsLost`(

  IN MobitelID INT, 

  IN BeginLogID INT, 

  IN EndLogID INT,

  IN BeginSrvPacketID BIGINT, 

  IN EndSrvPacketID BIGINT)
    SQL SECURITY INVOKER
    COMMENT 'Вставка данных в таблицу datagpslost_on.'
BEGIN

  /* Флаг существования записи с заданными Mobitel_ID и Begin_LogID

     в таблице datagpslost_on */

  DECLARE MobitelId_BeginLogID_Exists TINYINT DEFAULT 0; 

  /* Флаг существования записи с заданными Mobitel_ID и Begin_SrvPacketID

     в таблице datagpslost_on  */

  DECLARE MobitelId_BeginSrvPacketID_Exists TINYINT DEFAULT 0;

  

  DECLARE RowBeginSrvPacketID BIGINT; 

  

  IF EXISTS(

    SELECT NULL

    FROM datagpslost_on

    WHERE (Mobitel_ID = MobitelID) AND (Begin_LogID = BeginLogID))

  THEN

    SET MobitelId_BeginLogID_Exists = 1;

  END IF;



  IF EXISTS(

    SELECT NULL

    FROM datagpslost_on

    WHERE (Mobitel_ID = MobitelID) AND (Begin_SrvPacketID = BeginSrvPacketID))

  THEN

    SET MobitelId_BeginSrvPacketID_Exists = 1;

  END IF;



  IF (MobitelId_BeginLogID_Exists = 0) AND (MobitelId_BeginSrvPacketID_Exists = 0)

  THEN

    /* Вставка новой записи */

    INSERT INTO datagpslost_on(Mobitel_ID, Begin_LogID, End_LogID, Begin_SrvPacketID, End_SrvPacketID)

    VALUES (MobitelID, BeginLogID, EndLogID, BeginSrvPacketID, EndSrvPacketID);

  ELSE

    IF ((MobitelId_BeginLogID_Exists = 1) AND (MobitelId_BeginSrvPacketID_Exists = 1))

    THEN

      /* Обновление существующей записи */

      UPDATE datagpslost_on

      SET End_LogID = EndLogID, End_SrvPacketID = EndSrvPacketID

      WHERE (Mobitel_ID = MobitelID) AND (Begin_LogID = BeginLogID);

    ELSE

      /* Комбинацию MobitelId_BeginLogID_Exists = 0, MobitelId_BeginSrvPacketID_Exists = 1

         игнорируем - это исключительная ситуация, которая не должна возникать. */

      SELECT Begin_SrvPacketID

      INTO RowBeginSrvPacketID

      FROM datagpslost_on

      WHERE (Mobitel_ID = MobitelID) AND (Begin_LogID = BeginLogID)

      LIMIT 1;

      

      IF ((MobitelId_BeginLogID_Exists = 1) AND (MobitelId_BeginSrvPacketID_Exists = 0) AND

        (BeginSrvPacketID < RowBeginSrvPacketID))

      THEN

        /* В эту ветвь попадаем, если телетрек отдаст одну и ту же запись несколько раз 

           (LogID у записей один и тотже, а SrvPacketID различны) */

        UPDATE datagpslost_on

        SET End_LogID = EndLogID, Begin_SrvPacketID = BeginSrvPacketID, End_SrvPacketID = EndSrvPacketID

        WHERE (Mobitel_ID = MobitelID) AND (Begin_LogID = BeginLogID);

      END IF;

    END IF;

  END IF;

END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `online` */;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `online`()
    SQL SECURITY INVOKER
BEGIN

  SELECT Log_ID, MobitelId, 

    (SELECT DataGPS_ID

    FROM `online` 

    WHERE mobitel_id = MobitelId AND LogId = Log_ID Limit 1) AS 'DataGPS_ID',

      (SELECT from_unixtime(unixtime) 

      FROM `online` 

      WHERE mobitel_id = MobitelId AND LogId = Log_ID Limit 1) AS 'time',

        (SELECT ROUND((`Latitude` / 600000.00000),6)

        FROM `online` 

        WHERE mobitel_id = MobitelId AND LogId = Log_ID Limit 1) AS `Lat`,

          (SELECT ROUND((`Longitude` / 600000.00000),6) 

          FROM `online` 

          WHERE mobitel_id = MobitelId AND LogId = Log_ID Limit 1) AS `Lon`,

            (SELECT `Altitude` 

            FROM `online` 

            WHERE mobitel_id = MobitelId AND LogId = Log_ID Limit 1) AS `Altitude`,

              (SELECT (`Speed` * 1.852)

              FROM `online` 

              WHERE mobitel_id = MobitelId AND LogId = Log_ID Limit 1) AS `speed`,

                (SELECT ((`Direction` * 360) / 255)

                FROM `online` 

                WHERE mobitel_id = MobitelId AND LogId = Log_ID Limit 1) AS `direction`,

                  (SELECT `Valid`

                  FROM `online` 

                  WHERE mobitel_id = MobitelId AND LogId = Log_ID Limit 1) AS `Valid`,

                    (SELECT (((((((`Sensor8` + 

                    (`Sensor7` << 8)) + 

                    (`Sensor6` << 16)) + 

                    (`Sensor5` << 24)) + 

                    (`Sensor4` << 32)) + 

                    (`Sensor3` << 40)) + 

                    (`Sensor2` << 48)) + 

                    (`Sensor1` << 56)) 

                    FROM `online` 

                    WHERE mobitel_id = MobitelId AND LogId = Log_ID Limit 1) AS `sensor`,

                      (SELECT `Events`

                      FROM `online` 

                      WHERE mobitel_id = MobitelId AND LogId = Log_ID Limit 1) AS `Events`

   

  FROM (SELECT MAX(`LogID`) AS `Log_ID`, mobitel_id AS MobitelId

        FROM `online` 

        GROUP BY `Mobitel_ID`) T1;

END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `OnListMobitelConfig` */;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `OnListMobitelConfig`()
    SQL SECURITY INVOKER
    COMMENT 'Выборка настроек телетреков которые могут работать в online режиме'
BEGIN

  DECLARE MobitelIDInCursor INT;

  DECLARE DevIdShortInCursor CHAR(4);

  DECLARE DataExists TINYINT DEFAULT 1;



  /* Курсор в множестве настроенных телетреков */

  DECLARE CursorMobitels CURSOR FOR

    SELECT m.Mobitel_ID AS MobitelID, c.devIdShort AS DevIdShort

    FROM mobitels m

      JOIN internalmobitelconfig c ON (c.ID = m.InternalMobitelConfig_ID)

    WHERE (c.InternalMobitelConfig_ID = (

      SELECT intConf.InternalMobitelConfig_ID

      FROM internalmobitelconfig intConf

      WHERE (intConf.ID = c.ID)

      ORDER BY intConf.InternalMobitelConfig_ID DESC

      LIMIT 1)) AND

      (c.devIdShort IS NOT NULL) AND (c.devIdShort <> _cp1251'')

    ORDER BY m.Mobitel_ID;



  DECLARE CONTINUE HANDLER FOR NOT FOUND SET DataExists = 0;



  /* Временная таблица настроек телетрека */

  CREATE TEMPORARY TABLE tmpMobitelsConfig (

    MobitelID INT NOT NULL,

    DevIdShort CHAR(4) NOT NULL,

    LastPacketID BIGINT NOT NULL) ENGINE = MEMORY;



  OPEN CursorMobitels;

  FETCH CursorMobitels INTO MobitelIDInCursor, DevIdShortInCursor;

  WHILE DataExists = 1 DO



    INSERT INTO tmpMobitelsConfig SELECT MobitelIDInCursor, DevIdShortInCursor,

      (SELECT COALESCE(MAX(SrvPacketID), 0)

       FROM datagps

       WHERE Mobitel_ID = MobitelIDInCursor) AS LastPacketID;



    FETCH CursorMobitels INTO MobitelIDInCursor, DevIdShortInCursor;

  END WHILE;

  CLOSE CursorMobitels;



  SELECT MobitelID, DevIdShort, LastPacketID

  FROM tmpMobitelsConfig;



  DROP TEMPORARY TABLE tmpMobitelsConfig;  

END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `OnListMobitelConfig64` */;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `OnListMobitelConfig64`()
    SQL SECURITY INVOKER
    COMMENT 'Выборка настроек телетреков которые могут работать в online режиме для datagps и datagps64'
BEGIN

  DECLARE MobitelIDInCursor INT;

  DECLARE Is64Cursor tinyint;

  DECLARE DevIdShortInCursor CHAR(4);

  DECLARE DataExists TINYINT DEFAULT 1;



  /* Курсор в множестве настроенных телетреков */

  DECLARE CursorMobitels CURSOR FOR

    SELECT m.Mobitel_ID AS MobitelID, m.Is64bitPackets AS Is64, c.devIdShort AS DevIdShort

    FROM mobitels m

      JOIN internalmobitelconfig c ON (c.ID = m.InternalMobitelConfig_ID)

    WHERE (c.InternalMobitelConfig_ID = (

      SELECT intConf.InternalMobitelConfig_ID

      FROM internalmobitelconfig intConf

      WHERE (intConf.ID = c.ID)

      ORDER BY intConf.InternalMobitelConfig_ID DESC

      LIMIT 1)) AND

      (c.devIdShort IS NOT NULL) AND (c.devIdShort <> _cp1251'')

    ORDER BY m.Mobitel_ID;



  DECLARE CONTINUE HANDLER FOR NOT FOUND SET DataExists = 0;



  /* Временная таблица настроек телетрека */

  CREATE TEMPORARY TABLE tmpMobitelsConfig (

    MobitelID INT NOT NULL,

    Is64 tinyint NOT NULL,

    DevIdShort CHAR(4) NOT NULL,

    LastPacketID BIGINT NOT NULL,

    LastPacketID64 BIGINT NOT NULL) ENGINE = MEMORY;



  OPEN CursorMobitels;

  FETCH CursorMobitels INTO MobitelIDInCursor, Is64Cursor, DevIdShortInCursor;

  WHILE DataExists = 1 DO



    INSERT INTO tmpMobitelsConfig SELECT MobitelIDInCursor, Is64Cursor, DevIdShortInCursor,

      (SELECT COALESCE(MAX(d.SrvPacketID), 0)

       FROM datagps d

       WHERE d.Mobitel_ID = MobitelIDInCursor) AS LastPacketID,

      (SELECT COALESCE(MAX(t.SrvPacketID), 0)

       FROM datagps64 t

       WHERE t.Mobitel_ID = MobitelIDInCursor) AS LastPacketID64;



    FETCH CursorMobitels INTO MobitelIDInCursor, Is64Cursor, DevIdShortInCursor;

  END WHILE;

  CLOSE CursorMobitels;



  SELECT MobitelID, Is64, DevIdShort, LastPacketID, LastPacketID64

  FROM tmpMobitelsConfig;



  DROP TEMPORARY TABLE tmpMobitelsConfig;

END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `OnLostDataGPS` */;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `OnLostDataGPS`(IN MobitelID INTEGER(11), OUT NeedOptimize TINYINT)
    SQL SECURITY INVOKER
    COMMENT 'Поиск пропусков в online данных заданного телетрека и заполнение таблиц.'
BEGIN



  /********** DECLARE **********/

  

  DECLARE CurrentConfirmedID INT DEFAULT 0; /* Текущее значение ConfirmedID */

  DECLARE NewConfirmedID INT DEFAULT 0; /* Новое значение ConfirmedID */

  DECLARE StartLogIDSelect INT DEFAULT 0; /* min LogID для выборки */

  DECLARE FinishLogIDSelect INT DEFAULT 0; /* max LogID для выборки */

  DECLARE MaxEndLogID INT DEFAULT 0; /* max End_LogID в пропущенных диапазонах данного телетрека */

  

  DECLARE MinLogID_n INT DEFAULT 0; /* Минимальный LogID после ConfirmedID в множестве новых данных */

  DECLARE MaxLogID_n INT DEFAULT 0; /* Максимальный LogID в множестве новых данных */

  

  DECLARE DataExists TINYINT DEFAULT 1; /* Флаг наличия данных после фетча */

    

  DECLARE NewLogID INT; /* Значение LogID в курсоре CursorNewLogID */

  DECLARE NewSrvPacketID BIGINT; /* Значение SrvPacketID в курсоре CursorNewLogID */

  DECLARE FirstLogID INT DEFAULT -9999999; /* Первое значение LogID для анализа */

  DECLARE SecondLogID INT; /* Второе значение LogID для анализа */

  DECLARE FirstSrvPacketID BIGINT; /* Первое значение SrvPacketID */

  DECLARE SecondSrvPacketID BIGINT; /* Второе значение SrvPacketID */

  

  DECLARE tmpSrvPacketID BIGINT DEFAULT 0; /* Значение SrvPacketID для первой искусственной записи в анализе новых данных, не пересекающихся с существующими */  

  

  /* Курсор для прохода по новым LogID */

  DECLARE CursorNewLogID CURSOR FOR

    SELECT LogID, SrvPacketID 

    FROM datagpslost_ontmp;

    

  /* Обработчик отсутствующей записи при FETCH следующей записи */

  DECLARE CONTINUE HANDLER FOR NOT FOUND SET DataExists = 0;

  

  /********** END DECLARE **********/



  SET NeedOptimize = 0;

 

  SELECT COALESCE(ConfirmedID, 0) INTO CurrentConfirmedID

  FROM mobitels

  WHERE Mobitel_ID = MobitelID;



  /* Минимальный LogID в новом наборе данных c которым будем работать */

  SELECT MIN(LogID) INTO MinLogID_n

  FROM datagpsbuffer_on

  WHERE (Mobitel_ID = MobitelID) AND (LogID > CurrentConfirmedID);

  

  /* Максимальный LogID в новом наборе данных c которым будем работать */

  SELECT MAX(LogID) INTO MaxLogID_n

  FROM datagpsbuffer_on 

  WHERE Mobitel_ID = MobitelID;  

  

  /* Максимальный End_LogID в пропущенных диапазонах данного телетрека */

  SELECT COALESCE(MAX(End_LogID), 0) INTO MaxEndLogID

  FROM datagpslost_on 

  WHERE Mobitel_ID = MobitelID;  

  

  /* Проверим есть ли данные для анализа */

  IF MinLogID_n IS NOT NULL THEN

  

    /********** PREPARE **********/

    

    TRUNCATE TABLE datagpslost_ontmp;

  

    IF MinLogID_n < MaxEndLogID THEN

      /* Если  MinLogID_n < MaxEndLogID значит пришли данные, 

       которые возможно закроют часть пропусков. */

       

      /* Находим стартовый LogID для пересчета. */

      SELECT COALESCE(Begin_LogID, MinLogID_n) INTO StartLogIDSelect

      FROM datagpslost_on

      WHERE (Mobitel_ID = MobitelID) AND (MinLogID_n > Begin_LogID) 

        AND (MinLogID_n < End_LogID);

      

      /* Находим последний LogID для пересчета. */  

      SELECT COALESCE(End_LogID, MaxLogID_n) INTO FinishLogIDSelect

      FROM datagpslost_on

      WHERE (Mobitel_ID = MobitelID) AND (MaxLogID_n > Begin_LogID) 

        AND (MaxLogID_n < End_LogID);

       

      /* Удалим старые записи из реестра пропущенных записей 

         (стали неактуальными, надо пересчитать) */

      DELETE FROM datagpslost_on

      WHERE (Mobitel_ID = MobitelID) AND (Begin_LogID >= StartLogIDSelect)

        AND (Begin_LogID <= FinishLogIDSelect);

      

      /* Если первая запись LogID = 0 и этой записи нет в DataGps, тогда

         надо добавить первую фиктивную запись для анализа. */

      IF (StartLogIDSelect = 0) AND (NOT EXISTS

        (Select 1 

         FROM datagps 

         WHERE (Mobitel_ID = MobitelID) AND (LogID = StartLogIDSelect))) THEN

      

        INSERT INTO datagpslost_ontmp(LogID, SrvPacketID) VALUES (0, 0);  

      END IF;       

    ELSE

      /* Пришли новые данные. Надо добавить для анализа искусственную запись - 

         нижнюю границу */

      

      /* Находим стартовый LogID для пересчета. */

      SELECT COALESCE(MAX(End_LogID), CurrentConfirmedID) INTO StartLogIDSelect

      FROM datagpslost_on

      WHERE Mobitel_ID = MobitelID;   

         

      /* Находим последний LogID для пересчета. */  

      SELECT MAX(LogID)  INTO FinishLogIDSelect

      FROM datagpsbuffer_on

      WHERE Mobitel_ID = MobitelID;

      

      /* Выбираем из datagps соответствующее значение SrvPacketID  для первой

         искусственной записи */

      SELECT COALESCE(SrvPacketID, 0) INTO tmpSrvPacketID

      FROM datagps

      WHERE (Mobitel_ID = MobitelID) AND (LogID = StartLogIDSelect);

      

      /* Помещаем в таблицу datagpslost_ontmp для анализа пропусков 

         дополнительную первую запись */

      INSERT INTO datagpslost_ontmp(LogID, SrvPacketID)

      VALUES (StartLogIDSelect, tmpSrvPacketID);

    END IF; -- IF MinLogID_n < MaxEndLogID   

    

    /********** END PREPARE **********/

    

    /**********  INSERT ROWS **********/

    

    /* Заполнение временной таблицы последними данными телетрека

       для анализа разрывов */

    INSERT INTO datagpslost_ontmp  (LogID, SrvPacketID)

      SELECT LogID, SrvPacketID

      FROM datagps

      WHERE (Mobitel_ID = MobitelID) AND (LogID >= StartLogIDSelect)

        AND (LogID <= FinishLogIDSelect)

      ORDER BY LogID;

            

    /* Формирование команды-вставки в таблицу пропущенных диапазонов */

    SET DataExists = 1;

    OPEN CursorNewLogID;

    FETCH CursorNewLogID INTO NewLogID, NewSrvPacketID;

    WHILE DataExists = 1 DO

      IF FirstLogID = -9999999 THEN

        /* Первое значение в списке */

        SET FirstLogID = NewLogID;

        SET FirstSrvPacketID = NewSrvPacketID;

      ELSE

        /* Основная ветка расчета*/

        SET SecondLogID = NewLogID;

        SET SecondSrvPacketID = NewSrvPacketID;

        

        IF (SecondLogID - FirstLogID) > 1 THEN

          /* Найден разрыв */

          /* Из-за всяких комбинаций состояний LogId и SrvPacketId из-за особенностей работы телематического сервера

          и ТДМ вводим дополнительный анализ вставляемых записей, если запись не соответсвует указаным правилам, она 

          отбрасывается */

          IF (SecondSrvPacketID > FirstSrvPacketID) THEN

            IF EXISTS(SELECT NULL FROM datagps d WHERE (d.Mobitel_ID = MobitelID) AND ((d.LogID = FirstLogID) AND (d.SrvPacketID = FirstSrvPacketID))) THEN 

              IF EXISTS(SELECT NULL FROM datagps d WHERE (d.Mobitel_ID = MobitelID) AND ((d.LogID = SecondLogID) AND (d.SrvPacketID = SecondSrvPacketID))) THEN 



                CALL OnInsertDatagpsLost(MobitelID, FirstLogID, SecondLogID, FirstSrvPacketID, SecondSrvPacketID);

                IF NeedOptimize = 0 THEN SET NeedOptimize = 1; END IF;

                

              END IF;

            END IF;

          END IF;

        END IF;

        /* Переместим текущее второе значение на первую позицию

           для участия в следующей итерации в качестве начального значения */

        SET  FirstLogID = SecondLogID;

        SET FirstSrvPacketID = SecondSrvPacketID;

      END IF;  

      FETCH CursorNewLogID INTO NewLogID, NewSrvPacketID;

    END WHILE;

    CLOSE CursorNewLogID;

 

    /********** END INSERT ROWS **********/

               

    /********** UPDATE MOBITELS **********/

    

    /* Если пропущенных записей у данного телетрека нет - 

       тогда ConfirmedID будет равен максимальному LogID 

       данного телетрека. Иначе - минимальный Begin_LogID

       из таблицы пропусков */

    SELECT MIN(Begin_LogID) INTO NewConfirmedID

    FROM datagpslost_on

    WHERE Mobitel_ID = MobitelID;

       

    IF NewConfirmedID IS NULL THEN

      SELECT MAX(LogID) INTO NewConfirmedID

      FROM datagps

      WHERE Mobitel_ID = MobitelID;

    END IF;  

    

    /* Обновим ConfirmedID если надо */

    UPDATE mobitels

    SET ConfirmedID = NewConfirmedID

    WHERE (Mobitel_ID = MobitelID) AND (ConfirmedID < NewConfirmedID);

    

    /********** END UPDATE MOBITELS **********/

        

    TRUNCATE TABLE datagpslost_ontmp;

  END IF; -- IF MaxEndLogID IS NOT NULL  

END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `OnLostDataGPS2` */;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `OnLostDataGPS2`(IN MobitelID INTEGER(11), OUT NeedOptimize TINYINT)
    SQL SECURITY INVOKER
    COMMENT 'Модификация диапазонов пропусков. Анализ дублирующих данных заданного телетрека.'
BEGIN

    /********** DECLARE **********/

    

  DECLARE NewConfirmedID INT DEFAULT 0; /* Новое значение ConfirmedID */

  DECLARE BeginLogID INT; /* Begin_LogID в курсоре CursorLostRanges */

  DECLARE EndLogID INT; /* End_LogID в курсоре CursorLostRanges */

  DECLARE BeginSrvPacketID BIGINT; /* Begin_SrvPacketID в курсоре CursorLostRanges */

  DECLARE EndSrvPacketID BIGINT; /* End_SrvPacketID в курсоре CursorLostRanges */

  DECLARE RowCountForAnalyze INT DEFAULT 0; /* Количество записей для анализа */

  DECLARE DataExists TINYINT DEFAULT 1; /* Флаг наличия данных после фетча */

    

  /* Курсор для прохода по диапазонам пропусков телетрека */

  DECLARE CursorLostRanges CURSOR FOR

    SELECT Begin_LogID, End_LogID, Begin_SrvPacketID, End_SrvPacketID 

    FROM datagpslost_on

    WHERE Mobitel_ID = MobitelID;    



  /* Курсор для прохода по новым LogID */

  DECLARE CursorNewLogID CURSOR FOR

    SELECT LogID, SrvPacketID 

    FROM datagpslost_ontmp

    ORDER BY SrvPacketID;    

    

  /* Обработчик отсутствующей записи при FETCH следующей записи */

  DECLARE CONTINUE HANDLER FOR NOT FOUND SET DataExists = 0;

  

  /********** END DECLARE **********/



  SET NeedOptimize = 0;

  

  TRUNCATE TABLE datagpslost_ontmp;

  

  /* Перебираем диапазоны и сокращаем разрывы если это возможно */

  SET DataExists = 1;

  OPEN CursorLostRanges;

  FETCH CursorLostRanges INTO BeginLogID, EndLogID, BeginSrvPacketID, EndSrvPacketID;

  WHILE DataExists = 1 DO

    /* Заполнение временной таблицы дублирующими данными телетрека

       для анализа разрывов */

    INSERT INTO datagpslost_ontmp  (LogID, SrvPacketID)

      SELECT DISTINCT LogID, SrvPacketID

      FROM datagpsbuffer_ontmp

      WHERE (Mobitel_ID = MobitelID) AND (SrvPacketID > BeginSrvPacketID)

        AND (SrvPacketID < EndSrvPacketID)

      ORDER BY SrvPacketID;

      

    /* Если есть данные модифицируем диапазон */  

    SELECT COUNT(1) INTO RowCountForAnalyze

    FROM datagpslost_ontmp;  

    

    IF RowCountForAnalyze > 0 THEN  

      /* Добавляем первую и последнюю записи для анализа */  

      INSERT INTO datagpslost_ontmp (LogID, SrvPacketID)

      VALUES (BeginLogID, BeginSrvPacketID), (EndLogID, EndSrvPacketID);

      

      /* Удаляем старый диапазон */

      DELETE FROM datagpslost_on

      WHERE (Mobitel_ID = MobitelID) AND (Begin_LogID = BeginLogID);

       

      /**********  INSERT ROWS **********/             

      BEGIN

        DECLARE NewLogID INT; /* Значение LogID в курсоре CursorNewLogID */

        DECLARE NewSrvPacketID BIGINT; /* Значение SrvPacketID в курсоре CursorNewLogID */

        DECLARE FirstLogID INT DEFAULT -9999999; /* Первое значение LogID для анализа */

        DECLARE SecondLogID INT; /* Второе значение LogID для анализа */

        DECLARE FirstSrvPacketID BIGINT; /* Первое значение SrvPacketID */

        DECLARE SecondSrvPacketID BIGINT; /* Второе значение SrvPacketID */

        

        /* Обработчик отсутствующей записи при FETCH следующей записи */

        DECLARE CONTINUE HANDLER FOR NOT FOUND SET DataExists = 0;

        

        /* Формирование команды-вставки в таблицу пропущенных диапазонов */

        SET DataExists = 1;

        OPEN CursorNewLogID;

        FETCH CursorNewLogID INTO NewLogID, NewSrvPacketID;

        WHILE DataExists = 1 DO

          IF FirstLogID = -9999999 THEN

            /* Первое значение в списке */

            SET FirstLogID = NewLogID;

            SET FirstSrvPacketID = NewSrvPacketID;

          ELSE

            /* Основная ветка расчета*/

            SET SecondLogID = NewLogID;

            SET SecondSrvPacketID = NewSrvPacketID;

            

            IF (SecondLogID - FirstLogID) > 1 THEN

          /* Найден разрыв */

          /* Из-за всяких комбинаций состояний LogId и SrvPacketId из-за особенностей работы телематического сервера

          и ТДМ вводим дополнительный анализ вставляемых записей, если запись не соответсвует указаным правилам, она 

          отбрасывается */

          IF (SecondSrvPacketID > FirstSrvPacketID) THEN

            IF EXISTS(SELECT NULL FROM datagps d WHERE (d.Mobitel_ID = MobitelID) AND ((d.LogID = FirstLogID) AND (d.SrvPacketID = FirstSrvPacketID))) THEN 

              IF EXISTS(SELECT NULL FROM datagps d WHERE (d.Mobitel_ID = MobitelID) AND ((d.LogID = SecondLogID) AND (d.SrvPacketID = SecondSrvPacketID))) THEN 



                CALL OnInsertDatagpsLost(MobitelID, FirstLogID, SecondLogID, FirstSrvPacketID, SecondSrvPacketID);

                IF NeedOptimize = 0 THEN SET NeedOptimize = 1; END IF;

                

              END IF;

            END IF;

          END IF;

        END IF;

            /* Переместим текущее второе значение на первую позицию

               для участия в следующей итерации в качестве начального значения */

            SET FirstLogID = SecondLogID;

            SET FirstSrvPacketID = SecondSrvPacketID;

          END IF;  

          FETCH CursorNewLogID INTO NewLogID, NewSrvPacketID;

        END WHILE;

        CLOSE CursorNewLogID;

      END;

      /********** END INSERT ROWS **********/  



      TRUNCATE TABLE datagpslost_ontmp;

    END IF;

      

    FETCH CursorLostRanges INTO BeginLogID, EndLogID, BeginSrvPacketID, EndSrvPacketID;

  END WHILE;

  CLOSE CursorLostRanges;

  

  /********** UPDATE MOBITELS **********/

    

  /* Если пропущенных записей у данного телетрека нет - 

     тогда ConfirmedID будет равен максимальному LogID 

     данного телетрека. Иначе - минимальный Begin_LogID

     из таблицы пропусков */

  SELECT MIN(Begin_LogID) INTO NewConfirmedID

  FROM datagpslost_on

  WHERE Mobitel_ID = MobitelID;

       

  IF NewConfirmedID IS NULL THEN

    SELECT MAX(LogID) INTO NewConfirmedID

    FROM datagps

    WHERE Mobitel_ID = MobitelID;

  END IF;  

    

  /* Обновим ConfirmedID если надо */

  UPDATE mobitels

  SET ConfirmedID = NewConfirmedID

  WHERE (Mobitel_ID = MobitelID) AND (ConfirmedID < NewConfirmedID);

    

  /********** END UPDATE MOBITELS **********/

END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `OnLostDataGPS264` */;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `OnLostDataGPS264`(IN MobitelID integer(11), OUT NeedOptimize tinyint)
    SQL SECURITY INVOKER
    COMMENT 'РњРѕРґРёС„РёРєР°С†РёСЏ РґРёР°РїР°Р·РѕРЅРѕРІ РїСЂРѕРїСѓСЃРєРѕРІ. РђРЅР°Р»РёР· РґСѓР±Р»РёСЂСѓСЋС‰РёС… РґР°РЅРЅС‹С… Р·Р°РґР°РЅРЅРѕРіРѕ С‚РµР»РµС‚СЂРµРєР°.'
BEGIN

  /********** DECLARE **********/



  DECLARE NewConfirmedID int DEFAULT 0; /* РќРѕРІРѕРµ Р·РЅР°С‡РµРЅРёРµ ConfirmedID */

  DECLARE BeginLogID int; /* Begin_LogID РІ РєСѓСЂСЃРѕСЂРµ CursorLostRanges */

  DECLARE EndLogID int; /* End_LogID РІ РєСѓСЂСЃРѕСЂРµ CursorLostRanges */

  DECLARE BeginSrvPacketID bigint; /* Begin_SrvPacketID РІ РєСѓСЂСЃРѕСЂРµ CursorLostRanges */

  DECLARE EndSrvPacketID bigint; /* End_SrvPacketID РІ РєСѓСЂСЃРѕСЂРµ CursorLostRanges */

  DECLARE RowCountForAnalyze int DEFAULT 0; /* РљРѕР»РёС‡РµСЃС‚РІРѕ Р·Р°РїРёСЃРµР№ РґР»СЏ Р°РЅР°Р»РёР·Р° */

  DECLARE DataExists tinyint DEFAULT 1; /* Р¤Р»Р°Рі РЅР°Р»РёС‡РёСЏ РґР°РЅРЅС‹С… РїРѕСЃР»Рµ С„РµС‚С‡Р° */



  /* РљСѓСЂСЃРѕСЂ РґР»СЏ РїСЂРѕС…РѕРґР° РїРѕ РґРёР°РїР°Р·РѕРЅР°Рј РїСЂРѕРїСѓСЃРєРѕРІ С‚РµР»РµС‚СЂРµРєР° */

  DECLARE CursorLostRanges CURSOR FOR

  SELECT

    Begin_LogID,

    End_LogID,

    Begin_SrvPacketID,

    End_SrvPacketID

  FROM datagpslost_on

  WHERE Mobitel_ID = MobitelID;



  /* РљСѓСЂСЃРѕСЂ РґР»СЏ РїСЂРѕС…РѕРґР° РїРѕ РЅРѕРІС‹Рј LogID */

  DECLARE CursorNewLogID CURSOR FOR

  SELECT

    LogID,

    SrvPacketID

  FROM datagpslost_ontmp

  ORDER BY SrvPacketID;



  /* РћР±СЂР°Р±РѕС‚С‡РёРє РѕС‚СЃСѓС‚СЃС‚РІСѓСЋС‰РµР№ Р·Р°РїРёСЃРё РїСЂРё FETCH СЃР»РµРґСѓСЋС‰РµР№ Р·Р°РїРёСЃРё */

  DECLARE CONTINUE HANDLER FOR NOT FOUND SET DataExists = 0;



  /********** END DECLARE **********/



  SET NeedOptimize = 0;



  TRUNCATE TABLE datagpslost_ontmp;



  /* РџРµСЂРµР±РёСЂР°РµРј РґРёР°РїР°Р·РѕРЅС‹ Рё СЃРѕРєСЂР°С‰Р°РµРј СЂР°Р·СЂС‹РІС‹ РµСЃР»Рё СЌС‚Рѕ РІРѕР·РјРѕР¶РЅРѕ */

  SET DataExists = 1;

  OPEN CursorLostRanges;

  FETCH CursorLostRanges INTO BeginLogID, EndLogID, BeginSrvPacketID, EndSrvPacketID;

  WHILE DataExists = 1 DO

    /* Р—Р°РїРѕР»РЅРµРЅРёРµ РІСЂРµРјРµРЅРЅРѕР№ С‚Р°Р±Р»РёС†С‹ РґСѓР±Р»РёСЂСѓСЋС‰РёРјРё РґР°РЅРЅС‹РјРё С‚РµР»РµС‚СЂРµРєР°

       РґР»СЏ Р°РЅР°Р»РёР·Р° СЂР°Р·СЂС‹РІРѕРІ */

    INSERT INTO datagpslost_ontmp (LogID, SrvPacketID)

      SELECT DISTINCT

        LogID,

        SrvPacketID

      FROM datagpsbuffer_ontmp64

      WHERE (Mobitel_ID = MobitelID) AND (SrvPacketID > BeginSrvPacketID)

      AND (SrvPacketID < EndSrvPacketID)

      ORDER BY SrvPacketID;



    /* Р•СЃР»Рё РµСЃС‚СЊ РґР°РЅРЅС‹Рµ РјРѕРґРёС„РёС†РёСЂСѓРµРј РґРёР°РїР°Р·РѕРЅ */

    SELECT

      COUNT(1) INTO RowCountForAnalyze

    FROM datagpslost_ontmp;



    IF RowCountForAnalyze > 0 THEN

      /* Р”РѕР±Р°РІР»СЏРµРј РїРµСЂРІСѓСЋ Рё РїРѕСЃР»РµРґРЅСЋСЋ Р·Р°РїРёСЃРё РґР»СЏ Р°РЅР°Р»РёР·Р° */

      INSERT INTO datagpslost_ontmp (LogID, SrvPacketID)

        VALUES (BeginLogID, BeginSrvPacketID), (EndLogID, EndSrvPacketID);



      /* РЈРґР°Р»СЏРµРј СЃС‚Р°СЂС‹Р№ РґРёР°РїР°Р·РѕРЅ */

      DELETE

        FROM datagpslost_on

      WHERE (Mobitel_ID = MobitelID) AND (Begin_LogID = BeginLogID);



      /**********  INSERT ROWS **********/

      BEGIN

        DECLARE NewLogID int; /* Р—РЅР°С‡РµРЅРёРµ LogID РІ РєСѓСЂСЃРѕСЂРµ CursorNewLogID */

        DECLARE NewSrvPacketID bigint; /* Р—РЅР°С‡РµРЅРёРµ SrvPacketID РІ РєСѓСЂСЃРѕСЂРµ CursorNewLogID */

        DECLARE FirstLogID int DEFAULT -9999999; /* РџРµСЂРІРѕРµ Р·РЅР°С‡РµРЅРёРµ LogID РґР»СЏ Р°РЅР°Р»РёР·Р° */

        DECLARE SecondLogID int; /* Р’С‚РѕСЂРѕРµ Р·РЅР°С‡РµРЅРёРµ LogID РґР»СЏ Р°РЅР°Р»РёР·Р° */

        DECLARE FirstSrvPacketID bigint; /* РџРµСЂРІРѕРµ Р·РЅР°С‡РµРЅРёРµ SrvPacketID */

        DECLARE SecondSrvPacketID bigint; /* Р’С‚РѕСЂРѕРµ Р·РЅР°С‡РµРЅРёРµ SrvPacketID */



        /* РћР±СЂР°Р±РѕС‚С‡РёРє РѕС‚СЃСѓС‚СЃС‚РІСѓСЋС‰РµР№ Р·Р°РїРёСЃРё РїСЂРё FETCH СЃР»РµРґСѓСЋС‰РµР№ Р·Р°РїРёСЃРё */

        DECLARE CONTINUE HANDLER FOR NOT FOUND SET DataExists = 0;



        /* Р¤РѕСЂРјРёСЂРѕРІР°РЅРёРµ РєРѕРјР°РЅРґС‹-РІСЃС‚Р°РІРєРё РІ С‚Р°Р±Р»РёС†Сѓ РїСЂРѕРїСѓС‰РµРЅРЅС‹С… РґРёР°РїР°Р·РѕРЅРѕРІ */

        SET DataExists = 1;

        OPEN CursorNewLogID;

        FETCH CursorNewLogID INTO NewLogID, NewSrvPacketID;

        WHILE DataExists = 1 DO

          IF FirstLogID = -9999999 THEN

            /* РџРµСЂРІРѕРµ Р·РЅР°С‡РµРЅРёРµ РІ СЃРїРёСЃРєРµ */

            SET FirstLogID = NewLogID;

            SET FirstSrvPacketID = NewSrvPacketID;

          ELSE

            /* РћСЃРЅРѕРІРЅР°СЏ РІРµС‚РєР° СЂР°СЃС‡РµС‚Р°*/

            SET SecondLogID = NewLogID;

            SET SecondSrvPacketID = NewSrvPacketID;



            IF (SecondLogID - FirstLogID) > 1 THEN

          /* РќР°Р№РґРµРЅ СЂР°Р·СЂС‹РІ */

          /* РР·-Р·Р° РІСЃСЏРєРёС… РєРѕРјР±РёРЅР°С†РёР№ СЃРѕСЃС‚РѕСЏРЅРёР№ LogId Рё SrvPacketId РёР·-Р·Р° РѕСЃРѕР±РµРЅРЅРѕСЃС‚РµР№ СЂР°Р±РѕС‚С‹ С‚РµР»РµРјР°С‚РёС‡РµСЃРєРѕРіРѕ СЃРµСЂРІРµСЂР°

          Рё РўР”Рњ РІРІРѕРґРёРј РґРѕРїРѕР»РЅРёС‚РµР»СЊРЅС‹Р№ Р°РЅР°Р»РёР· РІСЃС‚Р°РІР»СЏРµРјС‹С… Р·Р°РїРёСЃРµР№, РµСЃР»Рё Р·Р°РїРёСЃСЊ РЅРµ СЃРѕРѕС‚РІРµС‚СЃРІСѓРµС‚ СѓРєР°Р·Р°РЅС‹Рј РїСЂР°РІРёР»Р°Рј, РѕРЅР° 

          РѕС‚Р±СЂР°СЃС‹РІР°РµС‚СЃСЏ */

          IF (SecondSrvPacketID > FirstSrvPacketID) THEN

            IF EXISTS(SELECT NULL FROM datagps64 d WHERE (d.Mobitel_ID = MobitelID) AND ((d.LogID = FirstLogID) AND (d.SrvPacketID = FirstSrvPacketID))) THEN 

              IF EXISTS(SELECT NULL FROM datagps64 d WHERE (d.Mobitel_ID = MobitelID) AND ((d.LogID = SecondLogID) AND (d.SrvPacketID = SecondSrvPacketID))) THEN 



                CALL OnInsertDatagpsLost(MobitelID, FirstLogID, SecondLogID, FirstSrvPacketID, SecondSrvPacketID);

                IF NeedOptimize = 0 THEN SET NeedOptimize = 1; END IF;

                

              END IF;

            END IF;

          END IF;

        END IF;

            /* РџРµСЂРµРјРµСЃС‚РёРј С‚РµРєСѓС‰РµРµ РІС‚РѕСЂРѕРµ Р·РЅР°С‡РµРЅРёРµ РЅР° РїРµСЂРІСѓСЋ РїРѕР·РёС†РёСЋ

               РґР»СЏ СѓС‡Р°СЃС‚РёСЏ РІ СЃР»РµРґСѓСЋС‰РµР№ РёС‚РµСЂР°С†РёРё РІ РєР°С‡РµСЃС‚РІРµ РЅР°С‡Р°Р»СЊРЅРѕРіРѕ Р·РЅР°С‡РµРЅРёСЏ */

            SET FirstLogID = SecondLogID;

            SET FirstSrvPacketID = SecondSrvPacketID;

          END IF;

          FETCH CursorNewLogID INTO NewLogID, NewSrvPacketID;

        END WHILE;

        CLOSE CursorNewLogID;

      END;

      /********** END INSERT ROWS **********/



      TRUNCATE TABLE datagpslost_ontmp;

    END IF;



    FETCH CursorLostRanges INTO BeginLogID, EndLogID, BeginSrvPacketID, EndSrvPacketID;

  END WHILE;

  CLOSE CursorLostRanges;



  /********** UPDATE MOBITELS **********/



  /* Р•СЃР»Рё РїСЂРѕРїСѓС‰РµРЅРЅС‹С… Р·Р°РїРёСЃРµР№ Сѓ РґР°РЅРЅРѕРіРѕ С‚РµР»РµС‚СЂРµРєР° РЅРµС‚ - 

     С‚РѕРіРґР° ConfirmedID Р±СѓРґРµС‚ СЂР°РІРµРЅ РјР°РєСЃРёРјР°Р»СЊРЅРѕРјСѓ LogID 

     РґР°РЅРЅРѕРіРѕ С‚РµР»РµС‚СЂРµРєР°. РРЅР°С‡Рµ - РјРёРЅРёРјР°Р»СЊРЅС‹Р№ Begin_LogID

     РёР· С‚Р°Р±Р»РёС†С‹ РїСЂРѕРїСѓСЃРєРѕРІ */

  SELECT

    MIN(Begin_LogID) INTO NewConfirmedID

  FROM datagpslost_on

  WHERE Mobitel_ID = MobitelID;



  IF NewConfirmedID IS NULL THEN

    SELECT

      MAX(LogID) INTO NewConfirmedID

    FROM datagps64

    WHERE Mobitel_ID = MobitelID;

  END IF;



  /* РћР±РЅРѕРІРёРј ConfirmedID РµСЃР»Рё РЅР°РґРѕ */

  UPDATE mobitels

  SET ConfirmedID = NewConfirmedID

  WHERE (Mobitel_ID = MobitelID) AND (ConfirmedID < NewConfirmedID);



/********** END UPDATE MOBITELS **********/

END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `OnLostDataGPS64` */;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `OnLostDataGPS64`(IN MobitelID integer(11), OUT NeedOptimize tinyint)
    SQL SECURITY INVOKER
    COMMENT 'РџРѕРёСЃРє РїСЂРѕРїСѓСЃРєРѕРІ РІ online РґР°РЅРЅС‹С… Р·Р°РґР°РЅРЅРѕРіРѕ С‚РµР»РµС‚СЂРµРєР° Рё Р·Р°РїРѕР»РЅРµРЅРёРµ С‚Р°Р±Р»РёС†.'
BEGIN



  /********** DECLARE **********/



  DECLARE CurrentConfirmedID int DEFAULT 0; /* РўРµРєСѓС‰РµРµ Р·РЅР°С‡РµРЅРёРµ ConfirmedID */

  DECLARE NewConfirmedID int DEFAULT 0; /* РќРѕРІРѕРµ Р·РЅР°С‡РµРЅРёРµ ConfirmedID */

  DECLARE StartLogIDSelect int DEFAULT 0; /* min LogID РґР»СЏ РІС‹Р±РѕСЂРєРё */

  DECLARE FinishLogIDSelect int DEFAULT 0; /* max LogID РґР»СЏ РІС‹Р±РѕСЂРєРё */

  DECLARE MaxEndLogID int DEFAULT 0; /* max End_LogID РІ РїСЂРѕРїСѓС‰РµРЅРЅС‹С… РґРёР°РїР°Р·РѕРЅР°С… РґР°РЅРЅРѕРіРѕ С‚РµР»РµС‚СЂРµРєР° */



  DECLARE MinLogID_n int DEFAULT 0; /* РњРёРЅРёРјР°Р»СЊРЅС‹Р№ LogID РїРѕСЃР»Рµ ConfirmedID РІ РјРЅРѕР¶РµСЃС‚РІРµ РЅРѕРІС‹С… РґР°РЅРЅС‹С… */

  DECLARE MaxLogID_n int DEFAULT 0; /* РњР°РєСЃРёРјР°Р»СЊРЅС‹Р№ LogID РІ РјРЅРѕР¶РµСЃС‚РІРµ РЅРѕРІС‹С… РґР°РЅРЅС‹С… */



  DECLARE DataExists tinyint DEFAULT 1; /* Р¤Р»Р°Рі РЅР°Р»РёС‡РёСЏ РґР°РЅРЅС‹С… РїРѕСЃР»Рµ С„РµС‚С‡Р° */



  DECLARE NewLogID int; /* Р—РЅР°С‡РµРЅРёРµ LogID РІ РєСѓСЂСЃРѕСЂРµ CursorNewLogID */

  DECLARE NewSrvPacketID bigint; /* Р—РЅР°С‡РµРЅРёРµ SrvPacketID РІ РєСѓСЂСЃРѕСЂРµ CursorNewLogID */

  DECLARE FirstLogID int DEFAULT -9999999; /* РџРµСЂРІРѕРµ Р·РЅР°С‡РµРЅРёРµ LogID РґР»СЏ Р°РЅР°Р»РёР·Р° */

  DECLARE SecondLogID int; /* Р’С‚РѕСЂРѕРµ Р·РЅР°С‡РµРЅРёРµ LogID РґР»СЏ Р°РЅР°Р»РёР·Р° */

  DECLARE FirstSrvPacketID bigint; /* РџРµСЂРІРѕРµ Р·РЅР°С‡РµРЅРёРµ SrvPacketID */

  DECLARE SecondSrvPacketID bigint; /* Р’С‚РѕСЂРѕРµ Р·РЅР°С‡РµРЅРёРµ SrvPacketID */



  DECLARE tmpSrvPacketID bigint DEFAULT 0; /* Р—РЅР°С‡РµРЅРёРµ SrvPacketID РґР»СЏ РїРµСЂРІРѕР№ РёСЃРєСѓСЃСЃС‚РІРµРЅРЅРѕР№ Р·Р°РїРёСЃРё РІ Р°РЅР°Р»РёР·Рµ РЅРѕРІС‹С… РґР°РЅРЅС‹С…, РЅРµ РїРµСЂРµСЃРµРєР°СЋС‰РёС…СЃСЏ СЃ СЃСѓС‰РµСЃС‚РІСѓСЋС‰РёРјРё */



  /* РљСѓСЂСЃРѕСЂ РґР»СЏ РїСЂРѕС…РѕРґР° РїРѕ РЅРѕРІС‹Рј LogID */

  DECLARE CursorNewLogID CURSOR FOR

  SELECT

    LogID,

    SrvPacketID

  FROM datagpslost_ontmp;



  /* РћР±СЂР°Р±РѕС‚С‡РёРє РѕС‚СЃСѓС‚СЃС‚РІСѓСЋС‰РµР№ Р·Р°РїРёСЃРё РїСЂРё FETCH СЃР»РµРґСѓСЋС‰РµР№ Р·Р°РїРёСЃРё */

  DECLARE CONTINUE HANDLER FOR NOT FOUND SET DataExists = 0;



  /********** END DECLARE **********/



  SET NeedOptimize = 0;



  SELECT

    COALESCE(ConfirmedID, 0) INTO CurrentConfirmedID

  FROM mobitels

  WHERE Mobitel_ID = MobitelID;



  /* РњРёРЅРёРјР°Р»СЊРЅС‹Р№ LogID РІ РЅРѕРІРѕРј РЅР°Р±РѕСЂРµ РґР°РЅРЅС‹С… c РєРѕС‚РѕСЂС‹Рј Р±СѓРґРµРј СЂР°Р±РѕС‚Р°С‚СЊ */

  SELECT

    MIN(LogID) INTO MinLogID_n

  FROM datagpsbuffer_on64

  WHERE (Mobitel_ID = MobitelID) AND (LogID > CurrentConfirmedID);



  /* РњР°РєСЃРёРјР°Р»СЊРЅС‹Р№ LogID РІ РЅРѕРІРѕРј РЅР°Р±РѕСЂРµ РґР°РЅРЅС‹С… c РєРѕС‚РѕСЂС‹Рј Р±СѓРґРµРј СЂР°Р±РѕС‚Р°С‚СЊ */

  SELECT

    MAX(LogID) INTO MaxLogID_n

  FROM datagpsbuffer_on64

  WHERE Mobitel_ID = MobitelID;



  /* РњР°РєСЃРёРјР°Р»СЊРЅС‹Р№ End_LogID РІ РїСЂРѕРїСѓС‰РµРЅРЅС‹С… РґРёР°РїР°Р·РѕРЅР°С… РґР°РЅРЅРѕРіРѕ С‚РµР»РµС‚СЂРµРєР° */

  SELECT

    COALESCE(MAX(End_LogID), 0) INTO MaxEndLogID

  FROM datagpslost_on

  WHERE Mobitel_ID = MobitelID;



  /* РџСЂРѕРІРµСЂРёРј РµСЃС‚СЊ Р»Рё РґР°РЅРЅС‹Рµ РґР»СЏ Р°РЅР°Р»РёР·Р° */

  IF MinLogID_n IS NOT NULL THEN



    /********** PREPARE **********/



    TRUNCATE TABLE datagpslost_ontmp;



    IF MinLogID_n < MaxEndLogID THEN

      /* Р•СЃР»Рё  MinLogID_n < MaxEndLogID Р·РЅР°С‡РёС‚ РїСЂРёС€Р»Рё РґР°РЅРЅС‹Рµ, 

       РєРѕС‚РѕСЂС‹Рµ РІРѕР·РјРѕР¶РЅРѕ Р·Р°РєСЂРѕСЋС‚ С‡Р°СЃС‚СЊ РїСЂРѕРїСѓСЃРєРѕРІ. */



      /* РќР°С…РѕРґРёРј СЃС‚Р°СЂС‚РѕРІС‹Р№ LogID РґР»СЏ РїРµСЂРµСЃС‡РµС‚Р°. */

      SELECT

        COALESCE(Begin_LogID, MinLogID_n) INTO StartLogIDSelect

      FROM datagpslost_on

      WHERE (Mobitel_ID = MobitelID) AND (MinLogID_n > Begin_LogID)

      AND (MinLogID_n < End_LogID);



      /* РќР°С…РѕРґРёРј РїРѕСЃР»РµРґРЅРёР№ LogID РґР»СЏ РїРµСЂРµСЃС‡РµС‚Р°. */

      SELECT

        COALESCE(End_LogID, MaxLogID_n) INTO FinishLogIDSelect

      FROM datagpslost_on

      WHERE (Mobitel_ID = MobitelID) AND (MaxLogID_n > Begin_LogID)

      AND (MaxLogID_n < End_LogID);



      /* РЈРґР°Р»РёРј СЃС‚Р°СЂС‹Рµ Р·Р°РїРёСЃРё РёР· СЂРµРµСЃС‚СЂР° РїСЂРѕРїСѓС‰РµРЅРЅС‹С… Р·Р°РїРёСЃРµР№ 

         (СЃС‚Р°Р»Рё РЅРµР°РєС‚СѓР°Р»СЊРЅС‹РјРё, РЅР°РґРѕ РїРµСЂРµСЃС‡РёС‚Р°С‚СЊ) */

      DELETE

        FROM datagpslost_on

      WHERE (Mobitel_ID = MobitelID) AND (Begin_LogID >= StartLogIDSelect)

        AND (Begin_LogID <= FinishLogIDSelect);



      /* Р•СЃР»Рё РїРµСЂРІР°СЏ Р·Р°РїРёСЃСЊ LogID = 0 Рё СЌС‚РѕР№ Р·Р°РїРёСЃРё РЅРµС‚ РІ DataGps, С‚РѕРіРґР°

         РЅР°РґРѕ РґРѕР±Р°РІРёС‚СЊ РїРµСЂРІСѓСЋ С„РёРєС‚РёРІРЅСѓСЋ Р·Р°РїРёСЃСЊ РґР»СЏ Р°РЅР°Р»РёР·Р°. */

      IF (StartLogIDSelect = 0) AND (NOT EXISTS (SELECT

            1

          FROM datagps64

          WHERE (Mobitel_ID = MobitelID) AND (LogID = StartLogIDSelect))) THEN



        INSERT INTO datagpslost_ontmp (LogID, SrvPacketID)

          VALUES (0, 0);

      END IF;

    ELSE

      /* РџСЂРёС€Р»Рё РЅРѕРІС‹Рµ РґР°РЅРЅС‹Рµ. РќР°РґРѕ РґРѕР±Р°РІРёС‚СЊ РґР»СЏ Р°РЅР°Р»РёР·Р° РёСЃРєСѓСЃСЃС‚РІРµРЅРЅСѓСЋ Р·Р°РїРёСЃСЊ - 

         РЅРёР¶РЅСЋСЋ РіСЂР°РЅРёС†Сѓ */



      /* РќР°С…РѕРґРёРј СЃС‚Р°СЂС‚РѕРІС‹Р№ LogID РґР»СЏ РїРµСЂРµСЃС‡РµС‚Р°. */

      SELECT

        COALESCE(MAX(End_LogID), CurrentConfirmedID) INTO StartLogIDSelect

      FROM datagpslost_on

      WHERE Mobitel_ID = MobitelID;



      /* РќР°С…РѕРґРёРј РїРѕСЃР»РµРґРЅРёР№ LogID РґР»СЏ РїРµСЂРµСЃС‡РµС‚Р°. */

      SELECT

        MAX(LogID) INTO FinishLogIDSelect

      FROM datagpsbuffer_on64

      WHERE Mobitel_ID = MobitelID;



      /* Р’С‹Р±РёСЂР°РµРј РёР· datagps СЃРѕРѕС‚РІРµС‚СЃС‚РІСѓСЋС‰РµРµ Р·РЅР°С‡РµРЅРёРµ SrvPacketID  РґР»СЏ РїРµСЂРІРѕР№

         РёСЃРєСѓСЃСЃС‚РІРµРЅРЅРѕР№ Р·Р°РїРёСЃРё */

      SELECT

        COALESCE(SrvPacketID, 0) INTO tmpSrvPacketID

      FROM datagps64

      WHERE (Mobitel_ID = MobitelID) AND (LogID = StartLogIDSelect);



      /* РџРѕРјРµС‰Р°РµРј РІ С‚Р°Р±Р»РёС†Сѓ datagpslost_ontmp64 РґР»СЏ Р°РЅР°Р»РёР·Р° РїСЂРѕРїСѓСЃРєРѕРІ 

         РґРѕРїРѕР»РЅРёС‚РµР»СЊРЅСѓСЋ РїРµСЂРІСѓСЋ Р·Р°РїРёСЃСЊ */

      INSERT INTO datagpslost_ontmp (LogID, SrvPacketID)

        VALUES (StartLogIDSelect, tmpSrvPacketID);

    END IF; -- IF MinLogID_n < MaxEndLogID   



    /********** END PREPARE **********/



    /**********  INSERT ROWS **********/



    /* Р—Р°РїРѕР»РЅРµРЅРёРµ РІСЂРµРјРµРЅРЅРѕР№ С‚Р°Р±Р»РёС†С‹ РїРѕСЃР»РµРґРЅРёРјРё РґР°РЅРЅС‹РјРё С‚РµР»РµС‚СЂРµРєР°

       РґР»СЏ Р°РЅР°Р»РёР·Р° СЂР°Р·СЂС‹РІРѕРІ */

    INSERT INTO datagpslost_ontmp (LogID, SrvPacketID)

      SELECT

        LogID,

        SrvPacketID

      FROM datagps64

      WHERE (Mobitel_ID = MobitelID) AND (LogID >= StartLogIDSelect)

      AND (LogID <= FinishLogIDSelect)

      ORDER BY LogID;



    /* Р¤РѕСЂРјРёСЂРѕРІР°РЅРёРµ РєРѕРјР°РЅРґС‹-РІСЃС‚Р°РІРєРё РІ С‚Р°Р±Р»РёС†Сѓ РїСЂРѕРїСѓС‰РµРЅРЅС‹С… РґРёР°РїР°Р·РѕРЅРѕРІ */

    SET DataExists = 1;

    OPEN CursorNewLogID;

    FETCH CursorNewLogID INTO NewLogID, NewSrvPacketID;

    WHILE DataExists = 1 DO

      IF FirstLogID = -9999999 THEN

        /* РџРµСЂРІРѕРµ Р·РЅР°С‡РµРЅРёРµ РІ СЃРїРёСЃРєРµ */

        SET FirstLogID = NewLogID;

        SET FirstSrvPacketID = NewSrvPacketID;

      ELSE

        /* РћСЃРЅРѕРІРЅР°СЏ РІРµС‚РєР° СЂР°СЃС‡РµС‚Р°*/

        SET SecondLogID = NewLogID;

        SET SecondSrvPacketID = NewSrvPacketID;



        IF (SecondLogID - FirstLogID) > 1 THEN

          /* РќР°Р№РґРµРЅ СЂР°Р·СЂС‹РІ */

          /* РР·-Р·Р° РІСЃСЏРєРёС… РєРѕРјР±РёРЅР°С†РёР№ СЃРѕСЃС‚РѕСЏРЅРёР№ LogId Рё SrvPacketId РёР·-Р·Р° РѕСЃРѕР±РµРЅРЅРѕСЃС‚РµР№ СЂР°Р±РѕС‚С‹ С‚РµР»РµРјР°С‚РёС‡РµСЃРєРѕРіРѕ СЃРµСЂРІРµСЂР°

          Рё РўР”Рњ РІРІРѕРґРёРј РґРѕРїРѕР»РЅРёС‚РµР»СЊРЅС‹Р№ Р°РЅР°Р»РёР· РІСЃС‚Р°РІР»СЏРµРјС‹С… Р·Р°РїРёСЃРµР№, РµСЃР»Рё Р·Р°РїРёСЃСЊ РЅРµ СЃРѕРѕС‚РІРµС‚СЃРІСѓРµС‚ СѓРєР°Р·Р°РЅС‹Рј РїСЂР°РІРёР»Р°Рј, РѕРЅР° 

          РѕС‚Р±СЂР°СЃС‹РІР°РµС‚СЃСЏ */

          IF (SecondSrvPacketID > FirstSrvPacketID) THEN

            IF EXISTS(SELECT NULL FROM datagps64 d WHERE (d.Mobitel_ID = MobitelID) AND ((d.LogID = FirstLogID) AND (d.SrvPacketID = FirstSrvPacketID))) THEN 

              IF EXISTS(SELECT NULL FROM datagps64 d WHERE (d.Mobitel_ID = MobitelID) AND ((d.LogID = SecondLogID) AND (d.SrvPacketID = SecondSrvPacketID))) THEN 



                CALL OnInsertDatagpsLost(MobitelID, FirstLogID, SecondLogID, FirstSrvPacketID, SecondSrvPacketID);

                IF NeedOptimize = 0 THEN SET NeedOptimize = 1; END IF;

                

              END IF;

            END IF;

          END IF;

        END IF;

        /* РџРµСЂРµРјРµСЃС‚РёРј С‚РµРєСѓС‰РµРµ РІС‚РѕСЂРѕРµ Р·РЅР°С‡РµРЅРёРµ РЅР° РїРµСЂРІСѓСЋ РїРѕР·РёС†РёСЋ

           РґР»СЏ СѓС‡Р°СЃС‚РёСЏ РІ СЃР»РµРґСѓСЋС‰РµР№ РёС‚РµСЂР°С†РёРё РІ РєР°С‡РµСЃС‚РІРµ РЅР°С‡Р°Р»СЊРЅРѕРіРѕ Р·РЅР°С‡РµРЅРёСЏ */

        SET FirstLogID = SecondLogID;

        SET FirstSrvPacketID = SecondSrvPacketID;

      END IF;

      FETCH CursorNewLogID INTO NewLogID, NewSrvPacketID;

    END WHILE;

    CLOSE CursorNewLogID;



    /********** END INSERT ROWS **********/



    /********** UPDATE MOBITELS **********/



    /* Р•СЃР»Рё РїСЂРѕРїСѓС‰РµРЅРЅС‹С… Р·Р°РїРёСЃРµР№ Сѓ РґР°РЅРЅРѕРіРѕ С‚РµР»РµС‚СЂРµРєР° РЅРµС‚ - 

       С‚РѕРіРґР° ConfirmedID Р±СѓРґРµС‚ СЂР°РІРµРЅ РјР°РєСЃРёРјР°Р»СЊРЅРѕРјСѓ LogID 

       РґР°РЅРЅРѕРіРѕ С‚РµР»РµС‚СЂРµРєР°. РРЅР°С‡Рµ - РјРёРЅРёРјР°Р»СЊРЅС‹Р№ Begin_LogID

       РёР· С‚Р°Р±Р»РёС†С‹ РїСЂРѕРїСѓСЃРєРѕРІ */

    SELECT

      MIN(Begin_LogID) INTO NewConfirmedID

    FROM datagpslost_on

    WHERE Mobitel_ID = MobitelID;



    IF NewConfirmedID IS NULL THEN

      SELECT

        MAX(LogID) INTO NewConfirmedID

      FROM datagps64

      WHERE Mobitel_ID = MobitelID;

    END IF;



    /* РћР±РЅРѕРІРёРј ConfirmedID РµСЃР»Рё РЅР°РґРѕ */

    UPDATE mobitels

    SET ConfirmedID = NewConfirmedID

    WHERE (Mobitel_ID = MobitelID) AND (ConfirmedID < NewConfirmedID);



    /********** END UPDATE MOBITELS **********/



    TRUNCATE TABLE datagpslost_ontmp;

  END IF; -- IF MaxEndLogID IS NOT NULL  

END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `OnTransferBuffer` */;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `OnTransferBuffer`()
    SQL SECURITY INVOKER
    COMMENT 'Переносит GPS данные из буферной таблицы в datagps'
BEGIN

  DECLARE MobitelIDInCursor INT; /* Текущее значение MobitelID */

  DECLARE DataExists TINYINT DEFAULT 1; /* Флаг наличия данных после фетча */

  DECLARE NeedOptimize TINYINT DEFAULT 0; /* Нужна оптимизация или нет */

  DECLARE NeedOptimizeParam TINYINT;

  

  DECLARE TmpMaxUnixTime INT; /* Временная переменная для хранения Max UnixTime из таблицы online */



  /* Курсор по телетрекам в множестве новых данных */

  DECLARE CursorMobitelsInsertSet CURSOR FOR

    SELECT DISTINCT(Mobitel_ID) FROM datagpsbuffer_on;

  /* Курсор по телетрекам в множестве повторных данных */

  DECLARE CursorMobitelsUpdateSet CURSOR FOR

    SELECT DISTINCT(Mobitel_ID) FROM datagpsbuffer_ontmp;  



  /* Обработчик отсутствующей записи при FETCH следующей записи */

  DECLARE CONTINUE HANDLER FOR NOT FOUND SET DataExists = 0;



  CALL OnDeleteDuplicates();

  CALL OnCorrectInfotrackLogId();

  

  /* Сохраняем записи, которые уже есть в БД, для второго этапа анализа пропусков 

     Используется процедурой OnLostDataGPS2. */

  INSERT INTO datagpsbuffer_ontmp (Mobitel_ID, LogID, SrvPacketID)

    SELECT b.Mobitel_ID, b.LogID, b.SrvPacketID

    FROM datagpsbuffer_on b LEFT JOIN datagps d ON

      (d.Mobitel_ID = b.Mobitel_ID) AND (d.LogID = b.LogID)

    WHERE d.LogID IS NOT NULL;

       

  /* -------------------- Заполнение таблицы Online ---------------------- */  

  /* Удаление из таблицы online дублирующих строк таблицы datagpsbuffer_on */

  /* по полям Mobitel_ID и LogID */

  DELETE o

  FROM `online` o, datagpsbuffer_on dgb

  WHERE (o.Mobitel_ID = dgb.Mobitel_ID) AND (o.LogID = dgb.LogID);

  

  SET DataExists = 1;

  OPEN CursorMobitelsInsertSet;

  FETCH CursorMobitelsInsertSet INTO MobitelIDInCursor;

  WHILE DataExists = 1 DO

    /* Нахождение Max значения UnixTime в таблице online для заданного

       телетрека. p.s. UnixTime в таблице online только валидный */

    SELECT COALESCE(MAX(UnixTime), 0) INTO TmpMaxUnixTime

    FROM online FORCE INDEX (IDX_Mobitelid)

    WHERE Mobitel_ID = MobitelIDInCursor;



    /* Вставка новых записей (максимум 100)каждого телетрека в online */

    INSERT INTO `online` (

      Mobitel_ID, LogID, UnixTime, Latitude, Longitude, Altitude,

      Direction, Speed, Valid, `Events`,

      Sensor1, Sensor2, Sensor3, Sensor4, Sensor5, Sensor6, Sensor7, Sensor8,

      Counter1, Counter2, Counter3, Counter4, whatIs)

    SELECT

      Mobitel_ID, LogID, UnixTime, Latitude, Longitude, Altitude,

      Direction, Speed, Valid, `Events`,

      Sensor1, Sensor2, Sensor3, Sensor4, Sensor5, Sensor6, Sensor7, Sensor8,

      Counter1, Counter2, Counter3, Counter4, whatIs

    FROM (

      SELECT *

      FROM datagpsbuffer_on

      WHERE (Mobitel_ID = MobitelIDInCursor)  AND 

        (UnixTime > TmpMaxUnixTime) AND (Valid = 1)

      GROUP BY Mobitel_ID, LogID

      ORDER BY UnixTime DESC

      LIMIT 100) AS T

    ORDER BY UnixTime ASC;



    /* Удаление строк из таблицы оперативных данных не удовлетворяющие

       условиям хранения - не являются последними 100 строками */

    DELETE FROM `online`

    WHERE (Mobitel_ID = MobitelIDInCursor) AND (UnixTime < 

      (SELECT COALESCE(MIN(UnixTime), 0) 

       FROM (

         SELECT UnixTime

         FROM `online`

         WHERE Mobitel_ID = MobitelIDInCursor 

         ORDER BY UnixTime DESC

         LIMIT 100) T1)); 

  

    FETCH CursorMobitelsInsertSet INTO MobitelIDInCursor;

  END WHILE;

  CLOSE CursorMobitelsInsertSet;

  /* ---------------- Online ---------------- */ 

  

  /* Зачем-то нужен апдейт ... */

  UPDATE datagps d, datagpsbuffer_on b SET

    d.Latitude = b.Latitude,

    d.Longitude = b.Longitude,

    d.Altitude = b.Altitude,

    d.UnixTime = b.UnixTime,

    d.Speed = b.Speed,

    d.Direction = b.Direction,

    d.Valid = b.Valid,

    d.InMobitelID = b.LogID,

    d.Events = b.Events,

    d.Sensor1 = b.Sensor1,

    d.Sensor2 = b.Sensor2,

    d.Sensor3 = b.Sensor3,

    d.Sensor4 = b.Sensor4,

    d.Sensor5 = b.Sensor5,

    d.Sensor6 = b.Sensor6,

    d.Sensor7 = b.Sensor7,

    d.Sensor8 = b.Sensor8,

    d.whatIs = b.whatIs,

    d.Counter1 = b.Counter1,

    d.Counter2 = b.Counter2,

    d.Counter3 = b.Counter3,

    d.Counter4 = b.Counter4,

    d.SrvPacketID = b.SrvPacketID

  WHERE (d.Mobitel_ID = b.Mobitel_ID) AND (d.LogID = b.LogID)

    AND (d.SrvPacketID < b.SrvPacketID);



  /* Удалим записи которые участвовали в апдейте */

  DELETE b

  FROM datagps d, datagpsbuffer_on b

  WHERE (d.Mobitel_ID = b.Mobitel_ID) AND (d.LogID = b.LogID);



  /* Вставка новых записей*/

  INSERT INTO datagps (

    Mobitel_ID, LogID, UnixTime, Latitude, Longitude, Altitude,

    Direction, Speed, Valid, `Events`, InMobitelID,

    Sensor1, Sensor2, Sensor3, Sensor4, Sensor5, Sensor6, Sensor7, Sensor8,

    Counter1, Counter2, Counter3, Counter4, whatIs, SrvPacketID)

  SELECT

    Mobitel_ID, LogID, UnixTime, Latitude, Longitude, Altitude,

    Direction, Speed, Valid, `Events`, LogID,

    Sensor1, Sensor2, Sensor3, Sensor4, Sensor5, Sensor6, Sensor7, Sensor8,

    Counter1, Counter2, Counter3, Counter4, whatIs, SrvPacketID

  FROM datagpsbuffer_on

  GROUP BY Mobitel_ID, LogID;



  /* ------------------- FETCH Mobitels (INSERT SET) ----------------------- */

  SET DataExists = 1;

  OPEN CursorMobitelsInsertSet;

  FETCH CursorMobitelsInsertSet INTO MobitelIDInCursor;

  WHILE DataExists = 1 DO

    /* ------ Обновление времени последней вставки записей ------- */

    UPDATE mobitels SET LastInsertTime = UNIX_TIMESTAMP(NOW())

    WHERE Mobitel_ID = MobitelIDInCursor;

       

    /* ------ Обновление списка пропущенных записей -------------- */

    CALL OnLostDataGPS(MobitelIDInCursor, NeedOptimizeParam);

    SET NeedOptimize = GREATEST(NeedOptimize, NeedOptimizeParam);

    FETCH CursorMobitelsInsertSet INTO MobitelIDInCursor;

  END WHILE;

  CLOSE CursorMobitelsInsertSet;



  /* Очистка буфера */

  TRUNCATE TABLE datagpsbuffer_on;

    

  /* ------------------- FETCH Mobitels (UPDATE SET) ---------------------- */

  SET DataExists = 1;

  OPEN CursorMobitelsUpdateSet;

  FETCH CursorMobitelsUpdateSet INTO MobitelIDInCursor;

  WHILE DataExists = 1 DO

    /* ---- Обновление списка пропущенных записей по второму алгоритму --- */

    CALL OnLostDataGPS2(MobitelIDInCursor, NeedOptimizeParam);

    SET NeedOptimize = GREATEST(NeedOptimize, NeedOptimizeParam);

    FETCH CursorMobitelsUpdateSet INTO MobitelIDInCursor;

  END WHILE;

  CLOSE CursorMobitelsUpdateSet;

  

  /* Очистка вспомогательного буфера */

  TRUNCATE TABLE datagpsbuffer_ontmp;



  /* Были изменения - сделаем оптимизацию */

  /*IF NeedOptimize = 1 THEN

    OPTIMIZE TABLE datagpslost_on;

  END IF; */           

END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `OnTransferBuffer64` */;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `OnTransferBuffer64`()
    SQL SECURITY INVOKER
BEGIN

  DECLARE MobitelIDInCursor int; /* пїЅпїЅпїЅпїЅпїЅпїЅпїЅ пїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅ MobitelID */

  DECLARE DataExists tinyint DEFAULT 1; /* пїЅпїЅпїЅпїЅ пїЅпїЅпїЅпїЅпїЅпїЅпїЅ пїЅпїЅпїЅпїЅпїЅпїЅ пїЅпїЅпїЅпїЅпїЅ пїЅпїЅпїЅпїЅпїЅ */

  DECLARE NeedOptimize tinyint DEFAULT 0; /* пїЅпїЅпїЅпїЅпїЅ пїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅ пїЅпїЅпїЅ пїЅпїЅпїЅ */

  DECLARE NeedOptimizeParam tinyint;



  DECLARE TmpMaxUnixTime int; /* пїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅ пїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅ пїЅпїЅпїЅ пїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅ Max UnixTime пїЅпїЅ пїЅпїЅпїЅпїЅпїЅпїЅпїЅ online */



  /* пїЅпїЅпїЅпїЅпїЅпїЅ пїЅпїЅ пїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅ пїЅ пїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅ пїЅпїЅпїЅпїЅпїЅ пїЅпїЅпїЅпїЅпїЅпїЅ */

  DECLARE CursorMobitelsInsertSet CURSOR FOR

  SELECT DISTINCT

    (Mobitel_ID)

  FROM datagpsbuffer_on64;

  /* пїЅпїЅпїЅпїЅпїЅпїЅ пїЅпїЅ пїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅ пїЅ пїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅ пїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅ пїЅпїЅпїЅпїЅпїЅпїЅ */

  DECLARE CursorMobitelsUpdateSet CURSOR FOR

  SELECT DISTINCT

    (Mobitel_ID)

  FROM datagpsbuffer_ontmp64;



  /* пїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅ пїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅ пїЅпїЅпїЅпїЅпїЅпїЅ пїЅпїЅпїЅ FETCH пїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅ пїЅпїЅпїЅпїЅпїЅпїЅ */

  DECLARE CONTINUE HANDLER FOR NOT FOUND SET DataExists = 0;

  /*DECLARE EXIT HANDLER FOR SQLEXCEPTION 

  BEGIN

    ROLLBACK;

    SELECT 'An error has occurred, operation rollbacked and the stored procedure was terminated';

  end;*/



  CALL delDupSrvPacket();

  CALL OnDeleteDuplicates64();

  /*CALL OnCorrectInfotrackLogId64();*/



  /* пїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅ пїЅпїЅпїЅпїЅпїЅпїЅ, пїЅпїЅпїЅпїЅпїЅпїЅпїЅ пїЅпїЅпїЅ пїЅпїЅпїЅпїЅ пїЅ пїЅпїЅ, пїЅпїЅпїЅ пїЅпїЅпїЅпїЅпїЅпїЅпїЅ пїЅпїЅпїЅпїЅпїЅ пїЅпїЅпїЅпїЅпїЅпїЅпїЅ пїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅ 

     пїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅ пїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅ OnLostDataGPS264. */

  /*INSERT INTO datagpsbuffer_ontmp64 (Mobitel_ID, LogID, SrvPacketID)

    SELECT

      b.Mobitel_ID,

      b.LogID,

      b.SrvPacketID

    FROM datagpsbuffer_on64 b

      LEFT JOIN datagps64 d

        ON (d.Mobitel_ID = b.Mobitel_ID) AND (d.LogID = b.LogID)

    WHERE d.LogID IS NOT NULL GROUP BY d.SrvPacketID;*/

 DROP TEMPORARY TABLE IF EXISTS temp1;

  DROP TABLE IF EXISTS temp1;

  CREATE TEMPORARY TABLE temp1  SELECT

      b.Mobitel_ID,

      b.LogID,

      b.SrvPacketID

    FROM datagpsbuffer_on64 b

      LEFT JOIN datagps64 d

        ON (d.Mobitel_ID = b.Mobitel_ID) AND (d.LogID = b.LogID)

    WHERE d.LogID IS NOT NULL GROUP BY d.SrvPacketID;



INSERT INTO datagpsbuffer_ontmp64 (Mobitel_ID, LogID, SrvPacketID) SELECT * FROM temp1 GROUP BY SrvPacketID;



DROP TEMPORARY TABLE IF EXISTS temp1;


  /* -------------------- пїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅ пїЅпїЅпїЅпїЅпїЅпїЅпїЅ Online ---------------------- */

  /* пїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅ пїЅпїЅ пїЅпїЅпїЅпїЅпїЅпїЅпїЅ online пїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅ пїЅпїЅпїЅпїЅпїЅ пїЅпїЅпїЅпїЅпїЅпїЅпїЅ datagpsbuffer_on64 */

  /* пїЅпїЅ пїЅпїЅпїЅпїЅпїЅ Mobitel_ID пїЅ LogID */

  DELETE o

    FROM online64 o, datagpsbuffer_on64 dgb

  WHERE (o.Mobitel_ID = dgb.Mobitel_ID) AND (o.LogID = dgb.LogID);



  SET DataExists = 1;

  OPEN CursorMobitelsInsertSet;

  FETCH CursorMobitelsInsertSet INTO MobitelIDInCursor;

  WHILE DataExists = 1 DO

    /* пїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅ Max пїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅ UnixTime пїЅ пїЅпїЅпїЅпїЅпїЅпїЅпїЅ online пїЅпїЅпїЅ пїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅ

       пїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅ. p.s. UnixTime пїЅ пїЅпїЅпїЅпїЅпїЅпїЅпїЅ online пїЅпїЅпїЅпїЅпїЅпїЅ пїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅ */

    SELECT

      COALESCE(MAX(UnixTime), 0) INTO TmpMaxUnixTime

    FROM online64 FORCE INDEX (IDX_Mobitelid64)

    WHERE Mobitel_ID = MobitelIDInCursor;



    /* пїЅпїЅпїЅпїЅпїЅпїЅпїЅ пїЅпїЅпїЅпїЅпїЅ пїЅпїЅпїЅпїЅпїЅпїЅпїЅ (пїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅ 100)пїЅпїЅпїЅпїЅпїЅпїЅпїЅ пїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅ пїЅ online */

    INSERT INTO online64 (Mobitel_ID, LogID, UnixTime, Latitude, Longitude, Acceleration,

    Direction, Speed, Valid, `Events`,

    Satellites, RssiGsm, SensorsSet, Sensors, Voltage, DGPS)

      SELECT

        Mobitel_ID,

        LogID,

        UnixTime,

        Latitude,

        Longitude,

        Acceleration,

        Direction,

        Speed,

        Valid,

        `Events`,

        Satellites,

        RssiGsm,

        SensorsSet,

        Sensors,

        Voltage,

        DGPS

      FROM (SELECT

          *

        FROM datagpsbuffer_on64

        WHERE (Mobitel_ID = MobitelIDInCursor) AND

        (UnixTime > TmpMaxUnixTime) AND (Valid = 1)

        GROUP BY Mobitel_ID,

                 LogID

        ORDER BY UnixTime DESC

        LIMIT 100) AS T

      ORDER BY UnixTime ASC;



    /* пїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅ пїЅпїЅпїЅпїЅпїЅ пїЅпїЅ пїЅпїЅпїЅпїЅпїЅпїЅпїЅ пїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅ пїЅпїЅпїЅпїЅпїЅпїЅ пїЅпїЅ пїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅ

       пїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅ пїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅ - пїЅпїЅ пїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅ пїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅ 100 пїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅ */

    DELETE

      FROM online64

    WHERE (Mobitel_ID = MobitelIDInCursor) AND (UnixTime < (SELECT

          COALESCE(MIN(UnixTime), 0)

        FROM (SELECT

            UnixTime

          FROM online64

          WHERE Mobitel_ID = MobitelIDInCursor

          ORDER BY UnixTime DESC

          LIMIT 100) T1));



    FETCH CursorMobitelsInsertSet INTO MobitelIDInCursor;

  END WHILE;

  CLOSE CursorMobitelsInsertSet;

  /* ---------------- Online ---------------- */

  /* пїЅпїЅпїЅпїЅпїЅ-пїЅпїЅ пїЅпїЅпїЅпїЅпїЅ пїЅпїЅпїЅпїЅпїЅпїЅ ... */

  UPDATE datagps64 d, datagpsbuffer_on64 b

  SET d.Latitude = b.Latitude,

      d.Longitude = b.Longitude,

      d.Acceleration = b.Acceleration,

      d.UnixTime = b.UnixTime,

      d.Speed = b.Speed,

      d.Direction = b.Direction,

      d.Valid = b.Valid,

      d.LogID = b.LogID,

      d.`Events` = b.`Events`,

      d.Satellites = b.Satellites,

      d.RssiGsm = b.RssiGsm,

      d.SensorsSet = b.SensorsSet,

      d.Sensors = b.Sensors,

      d.Voltage = b.Voltage,

      d.DGPS = b.DGPS,

      d.SrvPacketID = b.SrvPacketID

  WHERE (d.Mobitel_ID = b.Mobitel_ID) AND (d.LogID = b.LogID)

  AND (d.SrvPacketID < b.SrvPacketID);



  /* пїЅпїЅпїЅпїЅпїЅпїЅ пїЅпїЅпїЅпїЅпїЅпїЅ пїЅпїЅпїЅпїЅпїЅпїЅпїЅ пїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅ пїЅ пїЅпїЅпїЅпїЅпїЅпїЅпїЅ */

  DELETE b

    FROM datagps64 d, datagpsbuffer_on64 b

  WHERE (d.Mobitel_ID = b.Mobitel_ID) AND (d.LogID = b.LogID);



    /* пїЅпїЅпїЅпїЅпїЅпїЅпїЅ пїЅпїЅпїЅпїЅпїЅ пїЅпїЅпїЅпїЅпїЅпїЅпїЅ */ 

  INSERT INTO datagps64 (Mobitel_ID, LogID, UnixTime, Latitude, Longitude, Acceleration,

  Direction, Speed, Valid, `Events`,

  Satellites, RssiGsm, SensorsSet, Sensors, Voltage, DGPS, SrvPacketID)

    SELECT

      Mobitel_ID,

      LogID,

      UnixTime,

      Latitude,

      Longitude,

      Acceleration,

      Direction,

      Speed,

      Valid,

      `Events`,

      Satellites,

      RssiGsm,

      SensorsSet,

      Sensors,

      Voltage,

      DGPS,

      SrvPacketID

    FROM datagpsbuffer_on64

    GROUP BY Mobitel_ID,

             LogID;



  /* ------------------- FETCH Mobitels (INSERT SET) ----------------------- */

  SET DataExists = 1;

  OPEN CursorMobitelsInsertSet;

  FETCH CursorMobitelsInsertSet INTO MobitelIDInCursor;

  WHILE DataExists = 1 DO

    /* ------ пїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅ пїЅпїЅпїЅпїЅпїЅпїЅпїЅ пїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅ пїЅпїЅпїЅпїЅпїЅпїЅпїЅ пїЅпїЅпїЅпїЅпїЅпїЅпїЅ ------- */

    UPDATE mobitels

    SET LastInsertTime = UNIX_TIMESTAMP(NOW())

    WHERE Mobitel_ID = MobitelIDInCursor;



    /* ------ пїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅ пїЅпїЅпїЅпїЅпїЅпїЅ пїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅ пїЅпїЅпїЅпїЅпїЅпїЅпїЅ -------------- */

    CALL OnLostDataGPS64(MobitelIDInCursor, NeedOptimizeParam);

    SET NeedOptimize = GREATEST(NeedOptimize, NeedOptimizeParam);

    FETCH CursorMobitelsInsertSet INTO MobitelIDInCursor;

  END WHILE;

  CLOSE CursorMobitelsInsertSet;



  /* пїЅпїЅпїЅпїЅпїЅпїЅпїЅ пїЅпїЅпїЅпїЅпїЅпїЅ */

  TRUNCATE TABLE datagpsbuffer_on64;



  /* ------------------- FETCH Mobitels (UPDATE SET) ---------------------- */

  SET DataExists = 1;

  OPEN CursorMobitelsUpdateSet;

  FETCH CursorMobitelsUpdateSet INTO MobitelIDInCursor;

  WHILE DataExists = 1 DO

    /* ---- пїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅ пїЅпїЅпїЅпїЅпїЅпїЅ пїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅ пїЅпїЅпїЅпїЅпїЅпїЅпїЅ пїЅпїЅ пїЅпїЅпїЅпїЅпїЅпїЅпїЅ пїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅ --- */

    CALL OnLostDataGPS264(MobitelIDInCursor, NeedOptimizeParam);

    SET NeedOptimize = GREATEST(NeedOptimize, NeedOptimizeParam);

    FETCH CursorMobitelsUpdateSet INTO MobitelIDInCursor;

  END WHILE;

  CLOSE CursorMobitelsUpdateSet;



  /* пїЅпїЅпїЅпїЅпїЅпїЅпїЅ пїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅ пїЅпїЅпїЅпїЅпїЅпїЅ */

  TRUNCATE TABLE datagpsbuffer_ontmp64;



  /* пїЅпїЅпїЅпїЅ пїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅ - пїЅпїЅпїЅпїЅпїЅпїЅпїЅ пїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅ */

  /*IF NeedOptimize = 1 THEN

    OPTIMIZE TABLE datagpslost_on;

  END IF;*/

END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `PopListMobitelConfig` */;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `PopListMobitelConfig`()
    SQL SECURITY INVOKER
    COMMENT 'Выборка настроек телетреков для работы в режиме POP3'
BEGIN

  SELECT m.Mobitel_ID AS MobitelID, c.devIdShort AS DevIdShort,

    COALESCE(

      (SELECT s.EmailMobitel 

       FROM Mobitels m2 JOIN ServiceSend s ON s.ID = m2.ServiceSend_ID 

       WHERE m2.Mobitel_ID = m.Mobitel_ID

       ORDER BY s.ServiceSend_ID DESC

       LIMIT 1), "") AS Email

  FROM mobitels m JOIN internalmobitelconfig c ON c.ID = m.InternalMobitelConfig_ID

  WHERE (c.InternalMobitelConfig_ID = (

    SELECT intConf.InternalMobitelConfig_ID

    FROM internalmobitelconfig intConf

    WHERE (intConf.ID = c.ID)

    ORDER BY intConf.InternalMobitelConfig_ID DESC

    LIMIT 1)) AND (c.devIdShort IS NOT NULL) AND (c.devIdShort <> _cp1251 '')

  ORDER BY m.Mobitel_ID;

END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `PopTransferBuffer` */;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `PopTransferBuffer`()
    SQL SECURITY INVOKER
    COMMENT 'Переносит GPS данные из буферной таблицы в datagps'
BEGIN

  DECLARE MobitelIDInCursor INT; 

  DECLARE DataExists TINYINT DEFAULT 1; 

  

  DECLARE TmpMaxUnixTime INT; 



  DECLARE CursorMobitels CURSOR FOR

    SELECT DISTINCT(Mobitel_ID) FROM datagpsbuffer_pop;



  

  DECLARE CONTINUE HANDLER FOR NOT FOUND SET DataExists = 0;



    

  

  

  DELETE o

  FROM online o, datagpsbuffer_pop dgb

  WHERE (o.Mobitel_ID = dgb.Mobitel_ID) AND (o.LogID = dgb.LogID);

  

  SET DataExists = 1;

  OPEN CursorMobitels;

  FETCH CursorMobitels INTO MobitelIDInCursor;

  WHILE DataExists = 1 DO

    

    SELECT COALESCE(MAX(UnixTime), 0) INTO TmpMaxUnixTime

    FROM online FORCE INDEX (IDX_Mobitelid)

    WHERE Mobitel_ID = MobitelIDInCursor;



    

    INSERT INTO online (

      Mobitel_ID, LogID, UnixTime, Latitude, Longitude, Altitude,

      Direction, Speed, Valid, `Events`,

      Sensor1, Sensor2, Sensor3, Sensor4, Sensor5, Sensor6, Sensor7, Sensor8,

      Counter1, Counter2, Counter3, Counter4, whatIs)

    SELECT

      Mobitel_ID, LogID, UnixTime, Latitude, Longitude, Altitude,

      Direction, Speed, Valid, `Events`,

      Sensor1, Sensor2, Sensor3, Sensor4, Sensor5, Sensor6, Sensor7, Sensor8,

      Counter1, Counter2, Counter3, Counter4, whatIs

    FROM (

      SELECT *

      FROM datagpsbuffer_pop

      WHERE (Mobitel_ID = MobitelIDInCursor)  AND 

        (UnixTime > TmpMaxUnixTime) AND (Valid = 1)

      GROUP BY Mobitel_ID, LogID

      ORDER BY UnixTime DESC

      LIMIT 100) AS T

    ORDER BY UnixTime ASC;



    

    DELETE FROM online

    WHERE (Mobitel_ID = MobitelIDInCursor) AND (UnixTime < 

      (SELECT COALESCE(MIN(UnixTime), 0) 

       FROM (

         SELECT UnixTime

         FROM online

         WHERE Mobitel_ID = MobitelIDInCursor 

         ORDER BY UnixTime DESC

         LIMIT 100) T1)); 

  

    FETCH CursorMobitels INTO MobitelIDInCursor;

  END WHILE;

  CLOSE CursorMobitels;

    



  

  UPDATE datagps d, datagpsbuffer_pop b SET

    d.Latitude = b.Latitude,

    d.Longitude = b.Longitude,

    d.Altitude = b.Altitude,

    d.UnixTime = b.UnixTime,

    d.Speed = b.Speed,

    d.Direction = b.Direction,

    d.Valid = b.Valid,

    d.InMobitelID = b.LogID,

    d.`Events` = b.`Events`,

    d.Sensor1 = b.Sensor1,

    d.Sensor2 = b.Sensor2,

    d.Sensor3 = b.Sensor3,

    d.Sensor4 = b.Sensor4,

    d.Sensor5 = b.Sensor5,

    d.Sensor6 = b.Sensor6,

    d.Sensor7 = b.Sensor7,

    d.Sensor8 = b.Sensor8,

    d.whatIs = b.whatIs,

    d.Counter1 = b.Counter1,

    d.Counter2 = b.Counter2,

    d.Counter3 = b.Counter3,

    d.Counter4 = b.Counter4

  WHERE (d.Mobitel_ID = b.Mobitel_ID) AND (d.LogID = b.LogID);



  

  DELETE b

  FROM datagps d, datagpsbuffer_pop b

  WHERE (d.Mobitel_ID = b.Mobitel_ID) AND (d.LogID = b.LogID);



  

  INSERT INTO datagps (

    Mobitel_ID, LogID, UnixTime, Latitude, Longitude, Altitude,

    Direction, Speed, Valid, `Events`, InMobitelID,

    Sensor1, Sensor2, Sensor3, Sensor4, Sensor5, Sensor6, Sensor7, Sensor8,

    Counter1, Counter2, Counter3, Counter4, whatIs)

  SELECT

    Mobitel_ID, LogID, UnixTime, Latitude, Longitude, Altitude,

    Direction, Speed, Valid, `Events`, LogID,

    Sensor1, Sensor2, Sensor3, Sensor4, Sensor5, Sensor6, Sensor7, Sensor8,

    Counter1, Counter2, Counter3, Counter4, whatIs

  FROM datagpsbuffer_pop

  GROUP BY Mobitel_ID, LogID;



  

  TRUNCATE TABLE datagpsbuffer_pop;

END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `RfFillLostDataGPS` */;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `RfFillLostDataGPS`()
    COMMENT 'Поиск пропусков в RF данных и заполнение таблицы datagpslost'
BEGIN

  DECLARE MobitelIDInCursor INT; 

  DECLARE DataExists TINYINT DEFAULT 1; 

  DECLARE NeedOptimize TINYINT DEFAULT 0; 

  DECLARE NeedOptimizeParam TINYINT;



  

  DECLARE CursorMobitels CURSOR FOR

    SELECT m.Mobitel_ID AS Mobitel_ID
    FROM mobitels m
      JOIN internalmobitelconfig c ON (c.ID = m.InternalMobitelConfig_ID)
    WHERE (c.InternalMobitelConfig_ID = (
      SELECT intConf.InternalMobitelConfig_ID
      FROM internalmobitelconfig intConf
      WHERE intConf.ID = c.ID 
      ORDER BY intConf.InternalMobitelConfig_ID DESC
      LIMIT 1)) AND
      (c.moduleIdRf IS NOT NULL) AND (c.moduleIdRf <> _cp1251'')
    ORDER BY m.Mobitel_ID;

  

  DECLARE CONTINUE HANDLER FOR NOT FOUND SET DataExists = 0;

  

  SET DataExists = 1;

  

  

  DELETE d

  FROM datagpslost d

  WHERE NOT EXISTS(

    SELECT 1

    FROM mobitels m

    WHERE m.Mobitel_ID = d.Mobitel_ID);

  

  

  OPEN CursorMobitels;

  FETCH CursorMobitels INTO MobitelIDInCursor;

  WHILE DataExists = 1 DO

    CALL RfLostDataGPS(MobitelIDInCursor, NeedOptimizeParam);

    SET NeedOptimize = GREATEST(NeedOptimize, NeedOptimizeParam);

    FETCH CursorMobitels INTO MobitelIDInCursor;

  END WHILE;

  CLOSE CursorMobitels;



  

  IF NeedOptimize = 1 THEN

    OPTIMIZE TABLE datagpslost;

  END IF;

END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `RfListMobitelConfig` */;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `RfListMobitelConfig`()
    COMMENT 'Выборка RF настроек телетреков'
BEGIN

  DECLARE MobitelIDInCursor INT;

  DECLARE NameInCursor CHAR(50);

  DECLARE DescrInCursor CHAR(200);

  DECLARE ConfirmedIDInCursor INT;

  DECLARE moduleIdRfInCursor CHAR(50);

  DECLARE LastInsertTimeInCursor DateTime;

  DECLARE DataExists TINYINT DEFAULT 1;



  

  DECLARE CursorMobitels CURSOR FOR

    SELECT m.Mobitel_ID AS Mobitel_ID,
      m.Name AS Name,
      m.Descr AS Descr,
      m.ConfirmedID AS ConfirmedID,
      c.moduleIdRf AS moduleIdRf,
      FROM_UNIXTIME(m.LastInsertTime) AS LastInsertTime
    FROM mobitels m
      JOIN internalmobitelconfig c ON (c.ID = m.InternalMobitelConfig_ID)
    WHERE (c.InternalMobitelConfig_ID = (
      SELECT intConf.InternalMobitelConfig_ID
      FROM internalmobitelconfig intConf
      WHERE intConf.ID = c.ID 
      ORDER BY intConf.InternalMobitelConfig_ID DESC
      LIMIT 1)) AND
      (c.moduleIdRf IS NOT NULL) AND (c.moduleIdRf <> _cp1251'')
    ORDER BY m.Mobitel_ID;



  DECLARE CONTINUE HANDLER FOR NOT FOUND SET DataExists = 0;



  

  CREATE TEMPORARY TABLE tmpMobitelsConfig (

    Mobitel_ID INT NOT NULL,

    Name CHAR(50),

    Descr CHAR(200),

    ConfirmedID INT NOT NULL,

    moduleIdRf CHAR(50) NOT NULL,

    LastInsertTime DateTime NOT NULL,

    LastLogID INT NOT NULL) ENGINE = MEMORY;



  OPEN CursorMobitels;

  FETCH CursorMobitels INTO MobitelIDInCursor, NameInCursor, DescrInCursor, 

    ConfirmedIDInCursor, moduleIdRfInCursor, LastInsertTimeInCursor;

  WHILE DataExists = 1 DO



    INSERT INTO tmpMobitelsConfig SELECT MobitelIDInCursor, NameInCursor, DescrInCursor, 

      ConfirmedIDInCursor, moduleIdRfInCursor, LastInsertTimeInCursor,

      (SELECT COALESCE(MAX(LogID), 0)
       FROM datagps
       WHERE Mobitel_ID = MobitelIDInCursor) AS LastLogID;



    FETCH CursorMobitels INTO MobitelIDInCursor, NameInCursor, DescrInCursor, 

    ConfirmedIDInCursor, moduleIdRfInCursor, LastInsertTimeInCursor;

  END WHILE;

  CLOSE CursorMobitels;



  SELECT Mobitel_ID, Name, Descr, ConfirmedID, moduleIdRf, LastInsertTime, LastLogID

  FROM tmpMobitelsConfig;



  DROP TEMPORARY TABLE tmpMobitelsConfig;

END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `RfLostDataGPS` */;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `RfLostDataGPS`(IN MobitelID INTEGER(11), OUT NeedOptimize TINYINT)
    COMMENT 'Поиск пропусков в RF данных заданного телетрека и заполнение таб'
BEGIN

  

  DECLARE MAX_RECORD_COUNT INT DEFAULT 33792;

  DECLARE FirstActualLogID INT; 



  DECLARE CurrentConfirmedID INT; 

  DECLARE NewConfirmedID INT DEFAULT 0; 

  DECLARE NewStartLogIDSelect INT DEFAULT 0; 

  DECLARE MaxMobitelLogID INT; 



  DECLARE BeginLogIDInCursor INT; 

  DECLARE EndLogIDInCursor INT; 

  DECLARE CountInLostRange INT; 

  DECLARE DataExists TINYINT DEFAULT 1; 

  DECLARE DataChanged TINYINT DEFAULT 0; 

  DECLARE NeedAnalyze TINYINT DEFAULT 0; 

  

  DECLARE NewRowCount INT DEFAULT 0; 

  

  DECLARE NewLogID INT; 

  DECLARE FirstLogID INT DEFAULT -9999999; 

  DECLARE SecondLogID INT; 

                                                                                    

  

  

  DECLARE CursorLostData CURSOR FOR

    SELECT Begin_LogID, End_LogID

    FROM datagpslost

    WHERE Mobitel_ID = MobitelID

    ORDER BY Begin_LogID;

    

  

  DECLARE CursorNewLogID CURSOR FOR

    SELECT LogID 

    FROM datagpslost_rftmp;

    

  

  DECLARE CONTINUE HANDLER FOR NOT FOUND SET DataExists = 0;



  SET DataExists = 1;

  SET NeedOptimize = 0;

 

  SELECT COALESCE(ConfirmedID, 0) INTO CurrentConfirmedID

  FROM mobitels

  WHERE Mobitel_ID = MobitelID;



  

  SELECT COALESCE(MAX(LogID), 0) INTO MaxMobitelLogID

  FROM datagps

  WHERE (Mobitel_ID = MobitelID);



  IF CurrentConfirmedID <> MaxMobitelLogID THEN

    

    SET FirstActualLogID = MaxMobitelLogID - MAX_RECORD_COUNT;

    IF FirstActualLogID < 0 THEN

      SET FirstActualLogID = 0;

    END IF;



    

    DELETE FROM datagpslost

    WHERE (Mobitel_ID = MobitelID) AND (Begin_LogID < FirstActualLogID);

    

    

    OPEN CursorLostData;

    FETCH CursorLostData INTO BeginLogIDInCursor, EndLogIDInCursor;

    

    

    IF DataExists = 0 THEN

      SET DataChanged = 0;

      SET NeedAnalyze = 1;

      

      SET NewStartLogIDSelect = GREATEST(CurrentConfirmedID, FirstActualLogID);

    END IF;



    

    WHILE DataExists = 1 DO

      

      SELECT COUNT(1) INTO CountInLostRange

      FROM datagps

      WHERE (Mobitel_ID = MobitelID) AND

        (LogID > BeginLogIDInCursor) AND (LogID < EndLogIDInCursor);



      

      IF (CountInLostRange > 0)  THEN

        

        DELETE FROM datagpslost

        WHERE (Mobitel_ID = MobitelID) AND (Begin_LogID >= BeginLogIDInCursor);



        SET DataChanged = 1;

        SET NeedAnalyze = 1;

        SET NewStartLogIDSelect = BeginLogIDInCursor;

        

        

        SET DataExists = 0;

      ELSE

        FETCH CursorLostData INTO BeginLogIDInCursor, EndLogIDInCursor;

      END IF;	

    END WHILE;

    CLOSE CursorLostData;

   

    

       

    IF (NeedAnalyze = 0) AND (EndLogIDInCursor < MaxMobitelLogID) THEN

      SET NewStartLogIDSelect = EndLogIDInCursor;

      SET NeedAnalyze = 1;

    END IF;

   

    



    IF NeedAnalyze = 1 THEN

      TRUNCATE TABLE datagpslost_rftmp;



      

      INSERT INTO datagpslost_rftmp	(LogID)

      SELECT DISTINCT(LogID)

      FROM datagps

      WHERE (Mobitel_ID = MobitelID) AND (LogID >= NewStartLogIDSelect)

      ORDER BY LogID;

      

      

      SET @InsertLostDataStatement = 

        "INSERT INTO datagpslost(Mobitel_ID, Begin_LogID, End_LogID) VALUES ";

      

      

      SET DataExists = 1;

      OPEN CursorNewLogID;

      FETCH CursorNewLogID INTO NewLogID;

      WHILE DataExists = 1 DO

        IF FirstLogID = -9999999 THEN

          

          SET FirstLogID = NewLogID;

        ELSE

          

          SET SecondLogID = NewLogID;

          IF (SecondLogID -	FirstLogID) > 1 THEN

            

            IF NewRowCount > 0 THEN

              SET @InsertLostDataStatement = 

                CONCAT(@InsertLostDataStatement, ",");

            END IF;

            SET @InsertLostDataStatement = 

              CONCAT(@InsertLostDataStatement, 

                " (", MobitelID, ", ", FirstLogID, ", ", SecondLogID, ")");

            

            SET NewRowCount = NewRowCount + 1;

          END IF;

          

          SET	FirstLogID = SecondLogID;

        END IF;	

        FETCH CursorNewLogID INTO NewLogID;

      END WHILE;

      CLOSE CursorNewLogID;

      

        

      IF NewRowCount > 0 THEN

        

        PREPARE stmt FROM @InsertLostDataStatement;

        EXECUTE stmt;

        DEALLOCATE PREPARE stmt;

        

        SET DataChanged = 1;

      END IF; 
             

      

      

      SELECT COALESCE(MIN(Begin_LogID), -1) INTO NewConfirmedID

      FROM datagpslost

      WHERE Mobitel_ID = MobitelID;



      

      IF NewConfirmedID = -1 THEN

        SET NewConfirmedID = MaxMobitelLogID;

      END IF;



      

      IF NewConfirmedID > CurrentConfirmedID THEN

        UPDATE mobitels

        SET ConfirmedID = NewConfirmedID

        WHERE (Mobitel_ID = MobitelID) AND (ConfirmedID < NewConfirmedID);

      END IF;

      

      TRUNCATE TABLE datagpslost_rftmp;

    END IF;	 
    

    IF DataChanged = 1 THEN

      SET NeedOptimize = 1;

    END IF;

  

  END IF;	
END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `RfMobitelConfig` */;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `RfMobitelConfig`(IN paramMobitelID INTEGER(11))
    COMMENT 'Выборка RF настроек заданного телетрека'
BEGIN

SELECT
  m.Mobitel_ID AS Mobitel_ID,
  m.Name AS Name,
  m.Descr AS Descr,
  m.ConfirmedID AS ConfirmedID,
  c.moduleIdRf AS moduleIdRf,
  FROM_UNIXTIME(m.LastInsertTime) AS LastInsertTime,
  ( SELECT COALESCE(d.LogID, 0)
    FROM datagps d
    WHERE d.Mobitel_ID = m.Mobitel_ID
    ORDER BY d.LogID DESC
    LIMIT 1 ) AS LastLogID
FROM mobitels m
  JOIN internalmobitelconfig c ON (c.ID = m.InternalMobitelConfig_ID)
WHERE (m.Mobitel_ID = paramMobitelID) AND
  (c.InternalMobitelConfig_ID = (
    SELECT intConf.InternalMobitelConfig_ID
    FROM internalmobitelconfig intConf
    WHERE intConf.ID = c.ID
    ORDER BY intConf.InternalMobitelConfig_ID DESC
    LIMIT 1)) AND
  (c.moduleIdRf IS NOT NULL) AND (c.moduleIdRf <> _cp1251'')
ORDER BY m.Mobitel_ID;
END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `RfTransferBuffer` */;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `RfTransferBuffer`()
    SQL SECURITY INVOKER
    COMMENT 'Переносит GPS данные из буферной таблицы в datagps.'
BEGIN



  DECLARE MobitelIDInCursor INT; 

  DECLARE DataExists TINYINT DEFAULT 1; 

  DECLARE NeedOptimize TINYINT DEFAULT 0; 

  DECLARE NeedOptimizeParam TINYINT;

  DECLARE TmpMaxUnixTime INT; 



  DECLARE CursorMobitels CURSOR FOR

    SELECT DISTINCT(Mobitel_ID) FROM datagpsbuffer;



  

  DECLARE CONTINUE HANDLER FOR NOT FOUND SET DataExists = 0;

  

    

  

  

  DELETE o

  FROM online o, datagpsbuffer_pop dgb

  WHERE (o.Mobitel_ID = dgb.Mobitel_ID) AND (o.LogID = dgb.LogID);

  

  SET DataExists = 1;

  OPEN CursorMobitels;

  FETCH CursorMobitels INTO MobitelIDInCursor;

  WHILE DataExists = 1 DO

    

    SELECT COALESCE(MAX(UnixTime), 0) INTO TmpMaxUnixTime

    FROM online FORCE INDEX (IDX_Mobitelid)

    WHERE Mobitel_ID = MobitelIDInCursor;



    

    INSERT INTO online (

      Mobitel_ID, LogID, UnixTime, Latitude, Longitude, Altitude,

      Direction, Speed, Valid, `Events`,

      Sensor1, Sensor2, Sensor3, Sensor4, Sensor5, Sensor6, Sensor7, Sensor8,

      Counter1, Counter2, Counter3, Counter4, whatIs)

    SELECT

      Mobitel_ID, LogID, UnixTime, Latitude, Longitude, Altitude,

      Direction, Speed, Valid, `Events`,

      Sensor1, Sensor2, Sensor3, Sensor4, Sensor5, Sensor6, Sensor7, Sensor8,

      Counter1, Counter2, Counter3, Counter4, whatIs

    FROM (

      SELECT * 

      FROM datagpsbuffer

      WHERE (Mobitel_ID = MobitelIDInCursor)  AND 

        (UnixTime > TmpMaxUnixTime) AND (Valid = 1)

      GROUP BY Mobitel_ID, LogID

      ORDER BY UnixTime DESC

      LIMIT 100) AS T

    ORDER BY UnixTime ASC; 



    

    DELETE FROM online

    WHERE (Mobitel_ID = MobitelIDInCursor) AND (UnixTime < 

      (SELECT COALESCE(MIN(UnixTime), 0) 

       FROM (

         SELECT UnixTime

         FROM online

         WHERE Mobitel_ID = MobitelIDInCursor 

         ORDER BY UnixTime DESC

         LIMIT 100) T1)); 

  

    FETCH CursorMobitels INTO MobitelIDInCursor;

  END WHILE;

  CLOSE CursorMobitels;

    





  

  UPDATE datagps d, datagpsbuffer b SET

    d.Message_ID = 0, d.Latitude = b.Latitude,

    d.Longitude = b.Longitude,

    d.Altitude = b.Altitude,

    d.UnixTime = b.UnixTime,

    d.Speed = b.Speed,

    d.Direction = b.Direction,

    d.Valid = b.Valid,

    d.InMobitelID = b.LogID,

    d.`Events` = b.`Events`,

    d.Sensor1 = b.Sensor1,

    d.Sensor2 = b.Sensor2,

    d.Sensor3 = b.Sensor3,

    d.Sensor4 = b.Sensor4,

    d.Sensor5 = b.Sensor5,

    d.Sensor6 = b.Sensor6,

    d.Sensor7 = b.Sensor7,

    d.Sensor8 = b.Sensor8,

    d.isShow = 0,

    d.whatIs = b.whatIs,

    d.Counter1 = b.Counter1,

    d.Counter2 = b.Counter2,

    d.Counter3 = b.Counter3,

    d.Counter4 = b.Counter4

  WHERE (d.Mobitel_ID = b.Mobitel_ID) AND (d.LogID = b.LogID);



  

  DELETE b

  FROM datagps d, datagpsbuffer b

  WHERE (d.Mobitel_ID = b.Mobitel_ID) AND (d.LogID = b.LogID);



  

  INSERT INTO datagps (

    Mobitel_ID, LogID, UnixTime, Latitude, Longitude, Altitude,

    Direction, Speed, Valid, `Events`, InMobitelID,

    Sensor1, Sensor2, Sensor3, Sensor4, Sensor5, Sensor6, Sensor7, Sensor8,

    Counter1, Counter2, Counter3, Counter4, whatIs)

  SELECT

    Mobitel_ID, LogID, UnixTime, Latitude, Longitude, Altitude,

    Direction, Speed, Valid, `Events`, LogID,

    Sensor1, Sensor2, Sensor3, Sensor4, Sensor5, Sensor6, Sensor7, Sensor8,

    Counter1, Counter2, Counter3, Counter4,

    whatIs

  FROM datagpsbuffer

  GROUP BY Mobitel_ID, LogID;



  

  SET DataExists = 1;

  OPEN CursorMobitels;

  FETCH CursorMobitels INTO MobitelIDInCursor;

  WHILE DataExists = 1 DO

    

    UPDATE mobitels SET LastInsertTime = UNIX_TIMESTAMP(NOW())

    WHERE Mobitel_ID = MobitelIDInCursor;

        

    

    CALL RfLostDataGPS(MobitelIDInCursor, NeedOptimizeParam);

    SET NeedOptimize = GREATEST(NeedOptimize, NeedOptimizeParam);

    

    FETCH CursorMobitels INTO MobitelIDInCursor;

  END WHILE;

  CLOSE CursorMobitels;



  

  TRUNCATE TABLE datagpsbuffer;



  

  IF NeedOptimize = 1 THEN

    OPTIMIZE TABLE datagpslost;

  END IF;

END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `SelectDataGpsPeriodAll` */;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `SelectDataGpsPeriodAll`(IN mobile int, IN beginperiod datetime, IN endperiod datetime,

IN timebegin varchar(9), IN timeend varchar(9), IN weekdays varchar(15), IN daymonth varchar(90))
BEGIN

  DECLARE time0 time DEFAULT '23:59:59';

  DECLARE time1 time DEFAULT '00:00:00'; 



  DROP TEMPORARY TABLE IF EXISTS tempperiod4;



  CREATE TEMPORARY TABLE tempperiod4 -- временная таблица выборок в указанном диапазоне

  SELECT

    DataGps_ID AS DataGps_ID,

    Mobitel_ID AS Mobitel_ID,

    ((Latitude * 1.0000) / 600000) AS Lat,

    ((Longitude * 1.0000) / 600000) AS Lon,

    Altitude AS Altitude,

    FROM_UNIXTIME(UnixTime) AS `time`,

    (Speed * 1.852) AS speed,

    Valid AS Valid,

    (Sensor8 + (Sensor7 << 8) + (Sensor6 << 16) + (Sensor5 << 24) + (Sensor4 << 32) + (Sensor3 << 40) + (Sensor2 << 48) + (Sensor1 << 56)) AS sensor,

    Events AS Events,

    LogID AS LogID

  FROM datagps

  WHERE Mobitel_ID = mobile AND

  (UnixTime BETWEEN UNIX_TIMESTAMP(beginperiod) AND UNIX_TIMESTAMP(endperiod)) AND

  (Valid = 1) AND NOT (Latitude = 0 AND Longitude = 0)

  ORDER BY UnixTime;



  DROP TEMPORARY TABLE IF EXISTS tempweeks;



  IF weekdays != '' THEN



    CREATE TEMPORARY TABLE tempweeks (

      shead varchar(2)

    );



    SET @saTail = weekdays;

    WHILE @saTail != '' DO

      SET @sHead = SUBSTRING_INDEX(@saTail, ';', 1);

      SET @saTail = SUBSTRING(@saTail, LENGTH(@sHead) + 2);

      INSERT INTO tempweeks (shead)

        VALUES (@sHead);

    END WHILE;

  END IF;



  DROP TEMPORARY TABLE IF EXISTS tempday0;



  IF daymonth != '' THEN



    CREATE TEMPORARY TABLE tempday0 (

      shead varchar(2)

    );



    SET @saTail = daymonth;

    WHILE @saTail != '' DO

      SET @sHead = SUBSTRING_INDEX(@saTail, ';', 1);

      SET @saTail = SUBSTRING(@saTail, LENGTH(@sHead) + 2);

      INSERT INTO tempday0 (shead)

        VALUES (@sHead);

    END WHILE;

  END IF;



  -- getting selecting data

  IF (daymonth != '') AND (weekdays != '') THEN

    IF TIME(timebegin) < TIME(timeend) then

    SELECT

      *

    FROM tempperiod4

    WHERE ((DAY(`time`) IN (SELECT

      *

    FROM tempday0)) AND -- чтение по дням месяца

    (WEEKDAY(`time`) IN (SELECT

      *

    FROM tempweeks)) AND -- чтение по дням недели

    (TIME(`time`) BETWEEN TIME(timebegin) AND TIME(timeend))); -- чтение дат

    END IF;



    IF TIME(timebegin) > TIME(timeend) then

    SELECT

      *

    FROM tempperiod4

    WHERE ((DAY(`time`) IN (SELECT

      *

    FROM tempday0)) AND -- чтение по дням месяца

    (WEEKDAY(`time`) IN (SELECT

      *

    FROM tempweeks)) AND -- чтение по дням недели

    ((time(`time`) > time(timebegin) and time(`time`) < time(time0))

    OR (time(`time`) > time(time1) AND time(`time`) < time(timeend)))); -- чтение дат

    END IF;

    END IF;



      IF (daymonth = '') AND (weekdays != '') THEN

        IF TIME(timebegin) < TIME(timeend) then

        SELECT

          *

        FROM tempperiod4

        WHERE ((WEEKDAY(`time`) IN (SELECT

          *

        FROM tempweeks)) AND -- чтение по дням недели

        (TIME(`time`) BETWEEN TIME(timebegin) AND TIME(timeend))); -- чтение дат

          end IF;



        IF TIME(timebegin) > TIME(timeend) then

        SELECT

          *

        FROM tempperiod4

        WHERE ((WEEKDAY(`time`) IN (SELECT

          *

        FROM tempweeks)) AND -- чтение по дням недели

        ((time(`time`) > time(timebegin) and time(`time`) < time(time0))

    OR (time(`time`) > time(time1) AND time(`time`) < time(timeend)))); -- чтение дат

          end IF;

        END IF;



          IF (daymonth != '') AND (weekdays = '') THEN

            IF TIME(timebegin) < TIME(timeend) then

            SELECT

              *

            FROM tempperiod4

            WHERE ((DAY(`time`) IN (SELECT

              *

            FROM tempday0)) AND -- чтение по дням месяца

            (TIME(`time`) BETWEEN TIME(timebegin) AND TIME(timeend))); -- чтение дат

              END IF;



            IF TIME(timebegin) > TIME(timeend) then

            SELECT

              *

            FROM tempperiod4

            WHERE ((DAY(`time`) IN (SELECT

              *

            FROM tempday0)) AND -- чтение по дням месяца

            ((time(`time`) > time(timebegin) and time(`time`) < time(time0))

              OR (time(`time`) > time(time1) AND time(`time`) < time(timeend)))); -- чтение дат

              END IF;

            END IF;



              IF (daymonth = '') AND (weekdays = '') THEN

                IF TIME(timebegin) < TIME(timeend) then

                SELECT

                  *

                FROM tempperiod4

                WHERE (TIME(`time`) BETWEEN TIME(timebegin) AND TIME(timeend)); -- чтение дат

                  end IF;



                IF TIME(timebegin) > TIME(timeend) then

                SELECT

                  *

                FROM tempperiod4

                WHERE ((time(`time`) > time(timebegin) and time(`time`) < time(time0))

                  OR (time(`time`) > time(time1) AND time(`time`) < time(timeend))); -- чтение дат

                  end IF;

              END IF;

            END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `TestP` */;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `TestP`()
BEGIN

  SELECT VERSION();

END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `TransferBuffer` */;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `TransferBuffer`()
    SQL SECURITY INVOKER
    COMMENT 'Переносит GPS данные из буферной таблицы в datagps.'
BEGIN









CREATE TEMPORARY TABLE IF NOT EXISTS temp1 ENGINE=HEAP(

  SELECT DataGPS_ID FROM datagpsbuffer

  );





UPDATE datagps d, datagpsbuffer b, temp1 t SET

  d.Message_ID = 0, 
  d.Latitude = b.Latitude,

  d.Longitude = b.Longitude,

  d.Altitude = b.Altitude,

  d.UnixTime = b.UnixTime,

  d.Speed = b.Speed,

  d.Direction = b.Direction,

  d.Valid = b.Valid,

  d.InMobitelID = NULL, 
  d.`Events` = b.`Events`,

  d.Sensor1 = b.Sensor1,

  d.Sensor2 = b.Sensor2,

  d.Sensor3 = b.Sensor3,

  d.Sensor4 = b.Sensor4,

  d.Sensor5 = b.Sensor5,

  d.Sensor6 = b.Sensor6,

  d.Sensor7 = b.Sensor7,

  d.Sensor8 = b.Sensor8,

  d.isShow = 0, 
  d.whatIs = b.whatIs,

  d.Counter1 = b.Counter1,

  d.Counter2 = b.Counter2,

  d.Counter3 = b.Counter3,

  d.Counter4 = b.Counter4

WHERE b.DataGps_ID = t.DataGps_ID

  AND d.Mobitel_ID = b.Mobitel_ID

  AND d.LogID = b.LogID;




DELETE b

FROM datagps d, datagpsbuffer b, temp1 t

WHERE b.DataGps_ID = t.DataGps_ID

  AND d.Mobitel_ID = b.Mobitel_ID

  AND d.LogID = b.LogID;




INSERT INTO datagps

  (

  Mobitel_ID,

  LogID,

  UnixTime,

  Latitude,

  Longitude,

  Altitude,

  Direction,

  Speed,

  Valid,

  `Events`,

  Sensor1,

  Sensor2,

  Sensor3,

  Sensor4,

  Sensor5,

  Sensor6,

  Sensor7,

  Sensor8,

  Counter1,

  Counter2,

  Counter3,

  Counter4,

  whatIs

  )

SELECT

  b.Mobitel_ID,

  b.LogID,

  b.UnixTime,

  b.Latitude,

  b.Longitude,

  b.Altitude,

  b.Direction,

  b.Speed,

  b.Valid,

  b.`Events`,

  b.Sensor1,

  b.Sensor2,

  b.Sensor3,

  b.Sensor4,

  b.Sensor5,

  b.Sensor6,

  b.Sensor7,

  b.Sensor8,

  b.Counter1,

  b.Counter2,

  b.Counter3,

  b.Counter4,

  b.whatIs

FROM datagpsbuffer b, temp1 t

WHERE b.DataGps_ID = t.DataGps_ID

GROUP BY b.Mobitel_ID, b.LogID;




DELETE b

FROM datagpsbuffer b, temp1 t

WHERE b.DataGps_ID = t.DataGps_ID;




DROP TEMPORARY TABLE temp1;

END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `TransferLiteBuffer` */;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `TransferLiteBuffer`()
    SQL SECURITY INVOKER
    COMMENT 'Переносит GPS данные из буферной таблицы в datagps.'
BEGIN









CREATE TEMPORARY TABLE IF NOT EXISTS temp2 ENGINE=HEAP(

  SELECT DataGPS_ID FROM datagpsbufferlite

  );





UPDATE datagps d, datagpsbuffer b, temp2 t SET

  d.Message_ID = b.Message_ID,

  d.Latitude = b.Latitude,

  d.Longitude = b.Longitude,

  d.Altitude = b.Altitude,

  d.UnixTime = b.UnixTime,

  d.Speed = b.Speed,

  d.Direction = b.Direction,

  d.Valid = b.Valid,

  d.InMobitelID = NULL, 
  d.`Events` = b.`Events`,

  d.Sensor1 = b.Sensor1,

  d.Sensor2 = b.Sensor2,

  d.Sensor3 = b.Sensor3,

  d.Sensor4 = b.Sensor4,

  d.Sensor5 = b.Sensor5,

  d.Sensor6 = b.Sensor6,

  d.Sensor7 = b.Sensor7,

  d.Sensor8 = b.Sensor8,

  d.isShow = b.IsShow,

  d.whatIs = b.whatIs,

  d.Counter1 = b.Counter1,

  d.Counter2 = b.Counter2,

  d.Counter3 = b.Counter3,

  d.Counter4 = b.Counter4

WHERE b.DataGps_ID = t.DataGps_ID

  AND d.Mobitel_ID = b.Mobitel_ID

  AND d.Latitude = b.Latitude

  AND d.Longitude = b.Longitude

  AND d.Altitude = b.Altitude

  AND d.UnixTime = b.UnixTime;




DELETE b

FROM datagps d, datagpsbufferlite b, temp2 t

WHERE b.DataGps_ID = t.DataGps_ID

  AND d.Mobitel_ID = b.Mobitel_ID

  AND d.Latitude = b.Latitude

  AND d.Longitude = b.Longitude

  AND d.Altitude = b.Altitude

  AND d.UnixTime = b.UnixTime;




INSERT INTO datagps

  (

  Mobitel_ID,

  LogID,

  UnixTime,

  Latitude,

  Longitude,

  Altitude,

  Direction,

  Speed,

  Valid,

  `Events`,

  Sensor1,

  Sensor2,

  Sensor3,

  Sensor4,

  Sensor5,

  Sensor6,

  Sensor7,

  Sensor8,

  Counter1,

  Counter2,

  Counter3,

  Counter4,

  whatIs

  )

SELECT

  b.Mobitel_ID,

  b.LogID,

  b.UnixTime,

  b.Latitude,

  b.Longitude,

  b.Altitude,

  b.Direction,

  b.Speed,

  b.Valid,

  b.`Events`,

  b.Sensor1,

  b.Sensor2,

  b.Sensor3,

  b.Sensor4,

  b.Sensor5,

  b.Sensor6,

  b.Sensor7,

  b.Sensor8,

  b.Counter1,

  b.Counter2,

  b.Counter3,

  b.Counter4,

  b.whatIs

FROM datagpsbufferlite b, temp2 t

WHERE b.DataGps_ID = t.DataGps_ID

GROUP BY b.Mobitel_ID, b.LogID, b.Latitude, b.Longitude, b.Altitude, b.UnixTime;




DELETE b

FROM datagpsbufferlite b, temp2 t

WHERE b.DataGps_ID = t.DataGps_ID;




DROP TEMPORARY TABLE temp2;

END ;;
DELIMITER ;

--
-- Final view structure for view `datavalue1`
--

/*!50001 DROP VIEW IF EXISTS `datavalue1`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `datavalue1` AS select round((`datagps`.`Longitude` / 600000),6) AS `lon`,round((`datagps`.`Latitude` / 600000),6) AS `lat`,`datagps`.`Mobitel_ID` AS `Mobitel_ID`,`sensordata`.`Value` AS `Value`,(`datagps`.`Speed` * 1.852) AS `speed`,from_unixtime(`datagps`.`UnixTime`) AS `time`,`sensordata`.`sensor_id` AS `sensor_id`,`datagps`.`DataGps_ID` AS `datavalue_id` from (`sensordata` join `datagps` on((`sensordata`.`datagps_id` = `datagps`.`DataGps_ID`))) where (`datagps`.`Valid` = 1) order by `datagps`.`UnixTime`,`datagps`.`Mobitel_ID`,`sensordata`.`sensor_id` */;

--
-- Final view structure for view `dataview`
--

/*!50001 DROP VIEW IF EXISTS `dataview`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `dataview` AS select `datagps`.`DataGps_ID` AS `DataGps_ID`,`datagps`.`Mobitel_ID` AS `Mobitel_ID`,(`datagps`.`Latitude` / 600000.00000) AS `Lat`,(`datagps`.`Longitude` / 600000.00000) AS `Lon`,`datagps`.`Altitude` AS `Altitude`,from_unixtime(`datagps`.`UnixTime`) AS `time`,(`datagps`.`Speed` * 1.852) AS `speed`,((`datagps`.`Direction` * 360) / 255) AS `direction`,`datagps`.`Valid` AS `Valid`,(((((((`datagps`.`Sensor8` + (`datagps`.`Sensor7` << 8)) + (`datagps`.`Sensor6` << 16)) + (`datagps`.`Sensor5` << 24)) + (`datagps`.`Sensor4` << 32)) + (`datagps`.`Sensor3` << 40)) + (`datagps`.`Sensor2` << 48)) + (`datagps`.`Sensor1` << 56)) AS `sensor`,`datagps`.`Events` AS `Events`,`datagps`.`LogID` AS `LogID` from `datagps` order by `datagps`.`LogID` */;

--
-- Final view structure for view `deviceview`
--

/*!50001 DROP VIEW IF EXISTS `deviceview`*/;
/*!50001 CREATE ALGORITHM=MERGE */
/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `deviceview` AS (select `m`.`Mobitel_ID` AS `Mobitel_ID`,`m`.`Name` AS `Name`,`m`.`Descr` AS `Descr`,`c`.`devIdShort` AS `devIdShort`,`m`.`DeviceType` AS `DeviceType`,`m`.`ConfirmedID` AS `ConfirmedID`,`c`.`moduleIdRf` AS `moduleIdRf` from ((`mobitels` `m` join `internalmobitelconfig` `c`) join `internalmobitelconfigview` `v`) where ((`v`.`ID` = `m`.`InternalMobitelConfig_ID`) and (`v`.`LastRecord` = `c`.`InternalMobitelConfig_ID`)) order by `m`.`Name`) */;

--
-- Final view structure for view `internalmobitelconfigview`
--

/*!50001 DROP VIEW IF EXISTS `internalmobitelconfigview`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `internalmobitelconfigview` AS (select `c`.`ID` AS `ID`,max(`c`.`InternalMobitelConfig_ID`) AS `LastRecord` from `internalmobitelconfig` `c` where (`c`.`devIdShort` <> _cp1251'') group by `c`.`ID`) */;


