|
|
Строка 6: |
Строка 6: |
| | | |
| _date - дата | | _date - дата |
− |
| |
− | = Текст =
| |
− |
| |
− | parameters _, _date
| |
− |
| |
− | local year, month, day, login, password, base, server_name, server_ip, ;
| |
− | connection_string, sql, t, msg
| |
− |
| |
− | year := [[Year]]( _date )
| |
− | month := [[Month]]( _date )
| |
− | day := [[Day]]( _date )
| |
− |
| |
− | login := 'fabius'
| |
− | password := '13082012_fabius'
| |
− | base := 'TensoM1'
| |
− | server_name := '192.168.32.84\SQLEXPRESS'
| |
− | server_ip := '192.168.32.84'
| |
− | connection_string := [ ;
| |
− | Provider = SQLOLEDB.1 ;;
| |
− | Persist Security Info = true ;;
| |
− | User ID = ] + login + [ ;;
| |
− | password = ] + password + [ ;;
| |
− | Initial Catalog = ] + base + [ ;;
| |
− | Data Source = ] + server_name + [ ;;
| |
− | Use Procedure for Prepare = 1 ;;
| |
− | Auto Translate = true ;;
| |
− | Packet Size = 4096 ;;
| |
− | Workstation ID = ] + server_ip + [ ;;
| |
− | Use Encryption for Data = false ;;
| |
− | Tag with column collation when possible = false ]
| |
− |
| |
− | sql := [ Select *, TIME + 0.125 TIME2 ;
| |
− | From MasterSCADADataRaw ;
| |
− | Where Year( "Time" ) = ] + year + [ and Month( "Time" ) = ] + month + [ and ;
| |
− | Day( "Time" ) = ] + day + [ and ;
| |
− | ( ItemID = 34827 or ItemID = 34828 or ItemID = 37019 ) ]
| |
− |
| |
− | try
| |
− | msg := WaitMsg( 'Подготовка данных за ' + _date )
| |
− | t := OpenADOQuery( connection_string, sql )
| |
− | ( t )->( DbGoTop() )
| |
− | while !( t )->( eof() )
| |
− | ( _ )->( DbAppend() )
| |
− | ( _ )->_1 := ( t )->ItemID
| |
− | ( _ )->_2 := Left( ( t )->Time, 20 )
| |
− | if Rat( ':', ( _ )->_2 ) = 16
| |
− | ( _ )->_2 := Left( ( _ )->_2, 10 ) + ' 0' + SubStr( ( _ )->_2, 12, 7 )
| |
− | endif
| |
− | ( _ )->_3 := ( t )->Value
| |
− | ( _ )->_4 := Left( ( t )->TIME2, 20 )
| |
− | if Rat( ':', ( _ )->_4 ) = 16
| |
− | ( _ )->_4 := Left( ( _ )->_4, 10 ) + ' 0' + SubStr( ( _ )->_4, 12, 7 )
| |
− | endif
| |
− | ( t )->( DbSkip() )
| |
− | end
| |
− | finally
| |
− | HideMsg( msg )
| |
− | CloseTable( t )
| |
− | end
| |
− |
| |
− | // _1 - ItemID
| |
− | // _2 - Time
| |
− | // _3 - Value
| |
− |
| |
− | // База TensoM1
| |
− | // Таблица - dbo.MasterSCADADataRaw
| |
− | // В колонке Value значение счетчика
| |
− | // ItemID - 34827 - Дозатор муки Тензо.Мука 1с
| |
− | // ItemID - 34828 - Дозатор муки Тензо.Мука В/с
| |
− | // ItemID - 37019 - Дозатор муки Агро.Мука ржаная
| |
| | | |
| = Смотрите также = | | = Смотрите также = |
| [[Полезные функции]] | | [[Полезные функции]] |