|
|
(не показана одна промежуточная версия этого же участника) |
Строка 1: |
Строка 1: |
| [[SEND_FRO]] - это программа из справочника [[R266]] | | [[SEND_FRO]] - это программа из справочника [[R266]] |
− | = Текст =
| + | Отправить документ [[FRO]] на сервер |
− | local ip, my, end_data, fro, filt, sql, conn, path, msg, nrmtid | + | = Смотрите также = |
− | // NRMT
| + | |
− | nrmtid := GetFromIniFile( 'NRMTID' )
| + | |
− | path := GetPrm( 'CASHBOX', 'CASH_SHOP' )
| + | |
− | nrmtid := 0
| + | |
− |
| + | |
− | ip := [[InputPeriod]]( true )
| + | |
− | if Empty( ip )
| + | |
− | return
| + | |
− | endif
| + | |
− | my := StoD( ip[1] )
| + | |
− | end_data := StoD( ip[2] ) + 1
| + | |
− | while my <> end_data
| + | |
− |
| + | |
− | try
| + | |
− | conn := CreateConnection( path, 'admuser', "ora=111" )
| + | |
− | fro := OpenFData( 'DOCP' + Ret_f_ext( my ), 'DOCS', false, OpdataPath, 'DOCS' )
| + | |
− | filt := [ KINDDOC = 'FRO' and DtoS( DATDOC ) = '] + DtoS( my ) + [' ]
| + | |
− | ( fro )->( SetFilter( filt ) )
| + | |
− | ( fro )->( DbGoTop() )
| + | |
− |
| + | |
− | WaitMsg( 'Очистка документов FRO', msg )
| + | |
− | if !Empty( nrmtid )
| + | |
− | sql := [ Delete From DOCP] + Ret_f_ext( my ) + [ Where KINDDOC = 'FRO' and DATDOC = '] + SqlDate( my )+ [' and NRMT = '] + nrmtid + [' ]
| + | |
− | else
| + | |
− | sql := [ Delete From DOCP] + Ret_f_ext( my ) + [ Where KINDDOC = 'FRO' and DATDOC = '] + SqlDate( my )+ [' and DREFL2 = 'R179' and DANAL2 = ] + ( fro )->DANAL2
| + | |
− | endif
| + | |
− | SimpleSql( sql, conn )
| + | |
− |
| + | |
− | while !( fro )->( eof() )
| + | |
− | WaitMsg( a_s( ( fro )->AUTOID ), msg )
| + | |
− |
| + | |
− | ( fro )->EXTPARENT := ( fro )->RGNUM
| + | |
− | sql := [ Insert into DOCP] + Ret_f_ext( my ) + [ ;
| + | |
− | ( NRMT, "SUM", AMNT, DSHIFT, KSHIFT, M_TEXT, NUMDOC, NATTR1, NATTR2, NATTR3, NATTR4, ;
| + | |
− | NATTR5, NATTR6, NATTR7, NATTR8, NATTR9, NATTR10, KINDDOC, LVLNUM, PARENT, ;
| + | |
− | DATDOC, EXTPARENT, DREFL1, DANAL1, D1NAME, DREFL2, DANAL2, D2NAME, DREFL3, DANAL3, D3NAME, ;
| + | |
− | KREFL1, KANAL1, K1NAME, KREFL2, KANAL2, K2NAME, KREFL3, KANAL3, K3NAME ) ;
| + | |
− | VALUES ( '] + ( fro )->NRMT + [', ] + atr( str( ( fro )->SUM, 19, 4, '.' ) ) + [, ] + ;
| + | |
− | atr( str( ( fro )->AMNT, 19, 4, '.' ) ) + [, '] + ;
| + | |
− | ( fro )->DSHIFT + [', '] + ;
| + | |
− | ( fro )->KSHIFT + [', '] + ;
| + | |
− | STRTRAN( ( fro )->M_TEXT, ['], ["] ) + [', '] + ;
| + | |
− | ( fro )->NUMDOC + [', ] + ;
| + | |
− | atr( str( ( fro )->NATTR1, 19, 4, '.' ) ) + [, ] + ;
| + | |
− | atr( str( ( fro )->NATTR2, 19, 4, '.' ) ) + [, ] + ;
| + | |
− | atr( str( ( fro )->NATTR3, 19, 4, '.' ) ) + [, ] + ;
| + | |
− | atr( str( ( fro )->NATTR4, 19, 4, '.' ) ) + [, ] + ;
| + | |
− | atr( str( ( fro )->NATTR5, 19, 4, '.' ) ) + [, ] + ;
| + | |
− | atr( str( ( fro )->NATTR6, 19, 4, '.' ) ) + [, ] + ;
| + | |
− | atr( str( ( fro )->NATTR7, 19, 4, '.' ) ) + [, ] + ;
| + | |
− | atr( str( ( fro )->NATTR8, 19, 4, '.' ) ) + [, ] + ;
| + | |
− | atr( str( ( fro )->NATTR9, 19, 4, '.' ) ) + [, ] + ;
| + | |
− | atr( str( ( fro )->NATTR10, 19, 4, '.' ) ) + [, '] + ;
| + | |
− | ( fro )->KINDDOC + [', '] + ;
| + | |
− | ( fro )->LVLNUM + [', '] + ;
| + | |
− | ( fro )->PARENT + [', '] + ;
| + | |
− | SqlDate( ( fro )->DATDOC ) + [', '] + ;
| + | |
− | ( fro )->EXTPARENT + [', '] + ;
| + | |
− | ( fro )->DREFL1 + [', ] + ;
| + | |
− | ( fro )->DANAL1 + [, '] + ;
| + | |
− | ( fro )->D1NAME + [', '] + ;
| + | |
− | ( fro )->DREFL2 + [', ] + ;
| + | |
− | ( fro )->DANAL2 + [, '] + ;
| + | |
− | ( fro )->D2NAME + [', '] + ;
| + | |
− | ( fro )->DREFL3 + [', ] + ;
| + | |
− | ( fro )->DANAL3 + [, '] + ;
| + | |
− | ( fro )->D3NAME + [', '] + ;
| + | |
− | ( fro )->KREFL1 + [', ] + ;
| + | |
− | ( fro )->KANAL1 + [, '] + ;
| + | |
− | ( fro )->K1NAME + [', '] + ;
| + | |
− | ( fro )->KREFL2 + [', ] + ;
| + | |
− | ( fro )->KANAL2 + [, '] + ;
| + | |
− | STRTRAN( ( fro )->K2NAME, ['], ["] ) + [', '] + ;
| + | |
− | ( fro )->KREFL3 + [', ] + ;
| + | |
− | ( fro )->KANAL3 + [, '] + ;
| + | |
− | ( fro )->K3NAME + [' ) ]
| + | |
− |
| + | |
− |
| + | |
− | SimpleSql( sql, conn )
| + | |
− |
| + | |
− | ( fro )->( DbSkip() )
| + | |
− | end
| + | |
− |
| + | |
− | // заполняем RGNUM'ы
| + | |
− | sql := [ Update DOCP] + Ret_f_ext( my ) + [ Set RGNUM = Right( ' ' + Trim( Convert( AUTOID, sql_char ) ), 8 ) ;
| + | |
− | Where KINDDOC = 'FRO' and RGNUM = '' and DATDOC= '] + SqlDate( my ) + [' and DREFL2 = 'R179' and DANAL2 = ] + ( fro )->DANAL2
| + | |
− | SimpleSql( sql, conn )
| + | |
− |
| + | |
− | // BIG BUG
| + | |
− | // так как я не указал KINDDOC то ломались случайные документы в базе DOCP
| + | |
− | sql := [ Update d Set d.PARENT = dd.RGNUM From DOCP] + Ret_f_ext( my ) + [ d left outer join DOCP] + Ret_f_ext( my ) + [ dd ON d.PARENT = dd.EXTPARENT ;
| + | |
− | Where d.KINDDOC = 'FRO' and dd.KINDDOC = 'FRO' and d.LVLNUM = '2' and dd.LVLNUM = '1' and d.DATDOC = '] + SqlDate( my ) + [' and ;
| + | |
− | dd.DATDOC = '] + SqlDate( my ) + [' and d.DREFL2 = 'R179' and d.DANAL2 = ] + ( fro )->DANAL2 + [ and dd.DREFL2 = 'R179' and dd.DANAL2 = ] + ( fro )->DANAL2
| + | |
− | SimpleSql( sql, conn )
| + | |
− |
| + | |
− | // очищаем EXTPARENT
| + | |
− | sql := [ Update DOCP] + Ret_f_ext( my ) + [ Set EXTPARENT = '' Where KINDDOC = 'FRO' and DATDOC = '] + SqlDate( my ) + [' and DREFL2 = 'R179' and DANAL2 = ] + ( fro )->DANAL2
| + | |
− | SimpleSql( sql, conn )
| + | |
− |
| + | |
− | finally
| + | |
− | CloseTable( fro )
| + | |
− | FreeAndNil( conn )
| + | |
− | HideMsg( msg )
| + | |
− | end
| + | |
− |
| + | |
− | my := my + 1
| + | |
− | end
| + | |
− |
| + | |
− | Message( 'Документы FRO успешно перенесены' )
| + | |
− |
| + | |
− | // Select Right( ' ' + Trim( Convert( AUTOID, sql_char ) ), 8 ) From DOCP0117
| + | |
− |
| + | |
− |
| + | |
− | // local conn, path, sql, t
| + | |
− | // path := '\\192.168.234.15:5050\vol1\FabiusWIN\data\srg\reflis\dict.add'
| + | |
− | // try
| + | |
− | // conn := CreateConnection( path, 'admuser', "ora=1" )
| + | |
− | // sql := [ Select * From R09 ]
| + | |
− | // t := SelectSql( sql, conn )
| + | |
− | // finally
| + | |
− | // FreeAndNil( conn )
| + | |
− | // CloseTable( t )
| + | |
− | // end
| + | |
− |
| + | |
− | // наш сервер
| + | |
− | // path := '\\192.168.234.15:5050\vol1\FabiusWIN\data\srg\reflis\dict.add'
| + | |
− |
| + | |
− | // Жуковский
| + | |
− | // path := '\\4.7.47.51:5050\data\fabius\reflis\dict.add'= Смотрите также =
| + | |
| [[Полезные функции]] | | [[Полезные функции]] |
| | | |
| [[Функции Delphi]] | | [[Функции Delphi]] |