11 lines
5.5 KiB
JSON
11 lines
5.5 KiB
JSON
{
|
|
"header": {
|
|
"version": 1,
|
|
"type": "record"
|
|
},
|
|
"body": {
|
|
"record1": {
|
|
"<1>": "declare function msg, end_window, fieldcount, msg\r\ndeclare subroutine rlist, record_lock, update_index, btree.extract\r\n$insert logical\r\n$insert rlist_equates\r\n$insert msg_equates\r\n$insert rds_equ\r\n$insert reactor_log_equ\r\n\r\nCurrentSize = .gasbar->size\r\nNewSize = CurrentSize\r\nNewSize<3> = 0\r\n.gasbar->size = NewSize\r\n.gasbar->visible = 1\r\nopen 'REACTOR_LOG' to ReactorLogTable else\r\n Void = msg( '', 'Unable to open REACTOR_LOG...' )\r\n return 0\r\nend\r\nopen 'DICT.RDS' to DictRdsTable else\r\n Void = msg( '', 'Unable to open DICT.RDS...' )\r\n return 0\r\nend\r\nopen 'RDS' to RdsTable else\r\n Void = msg( '', 'Unable to open RDS...' )\r\n return 0\r\nend\r\nopen 'SYSLISTS' to SysListsTable else\r\n Void = msg( '', 'Unable to open SYSLISTS...' )\r\n return 0\r\nend\r\nToday = date()\r\n*\r\n* only select reactor logs for up to a 3 days ago as to not keep trying to\r\n* link something that does not need linking for 6 months ago\r\nThreeDaysAgo = quote( oconv( Today-3, 'D2/' ) )\r\nStatement = 'SELECT REACTOR_LOG WITH RDS_NO = \"\" AND WITH ENTRY_DATE >= ':ThreeDaysAgo\r\nrlist( Statement, target_activelist$, '', '', '' )\r\n@rn.counter = 0\r\nEof = false$\r\nOnePercent = iconv( @reccount*.01, 'MD0' )\r\nListOut = ''\r\nloop\r\n readnext Id else Eof = true$\r\nuntil Eof\r\n read ReactorLogRec from ReactorLogTable, Id else\r\n Void = msg( '', 'Unable to read ':Id:' from REACTOR_LOG table.' )\r\n return 0\r\n end\r\n RlReactor = ReactorLogRec<reactor_log_reactor$>\r\n RlStartDate = ReactorLogRec<reactor_log_start_date$>\r\n RlStartTime = ReactorLogRec<reactor_log_start_time$>\r\n RlEndDate = ReactorLogRec<reactor_log_end_date$>\r\n RlEndTime = ReactorLogRec<reactor_log_end_time$>\r\n FindBeg = (RlStartDate*24*60*60)+RlStartTime\r\n FindEnd = (RlEndDate*24*60*60)+RlEndTime\r\n if ( RlStartDate <> '' ) and ( RlEndDate <> '' ) and ( RlReactor <> '' ) then\r\n\t SearchStr = ''\r\n\t SearchStr<-1> = 'DATE_IN':@vm:oconv(RlStartDate,'D2/')\r\n\t SearchStr<-1> = 'DATE_OUT':@vm:';':oconv(RlEndDate,'D2/')\r\n\t SearchStr<-1> = 'REACTOR':@vm:RlReactor\t \r\n\t SearchStr := @fm\r\n\t btree.extract( SearchStr, 'RDS', DictRdsTable, RdsKeys, '', Flag )\r\n\t Rcnt = fieldcount( RdsKeys, @vm )\r\n StampThis = false$\t \r\n\t for i = 1 to Rcnt\r\n\t ThisRdsId = RdsKeys<1,i>\r\n\t read RdsRec from RdsTable, ThisRdsId else\r\n\t Void = msg( '', 'Unable to read ':ThisRdsId:' from RDS...' )\r\n\t return 0\r\n\t end\r\n\t RdsReactor = RdsRec<rds_reactor$>\r\n\t RdsDateIn = RdsRec<rds_date_in$>\r\n\t RdsDateOut = RdsRec<rds_date_out$>\r\n\t RdsTimeIn = RdsRec<rds_time_in$>\r\n\t RdsTimeOut = RdsRec<rds_time_out$>\r\n\t RdsWo = RdsRec<rds_wo$>\r\n\t RdsCust = RdsRec<rds_cust_no$>\r\n\t BegRange = (RdsDateIn*24*60*60)+RdsTimeIn\r\n\t EndRange = (RdsDateOut*24*60*60)+RdsTimeOut\r\n\t if (RdsDateIn) and (RdsDateOut) and (RdsTimeIn) and (RdsTimeOut) then\r\n\t if ( FindBeg > BegRange ) and ( FindBeg < EndRange ) then\r\n\t gosub WriteRlRecord\t \t \r\n\t end else\r\n\t if ( FindEnd > BegRange ) and ( FindEnd < EndRange ) then\r\n \t gosub WriteRlRecord\t \r\n \t end\r\n \t end\r\n\t end\r\n\t *RlReactor = ReactorLogRec<reactor_log_reactor$>\r\n\t *RlStartDate = ReactorLogRec<reactor_start_date$>\r\n\t *RlStartTime = ReactorLogRec<reactor_start_time$>\r\n\t *RlEndDate = ReactorLogRec<reactor_end_date$>\r\n\t *RlEndTime = ReactorLogRec<reactor_end_time$>\r\n\t until StampThis\r\n\t next i\r\n\t if mod( @rn.counter, OnePercent ) else\r\n\t NewWidth = CurrentSize<3> * @rn.counter/@reccount\r\n\t\t .percent_complete->text = oconv(iconv( @rn.counter/@reccount*100, 'MD0' ), 'MD0' ):'%'\r\n\t\t NewSize<3> = NewWidth\r\n\t\t .gasbar->redraw = 0\r\n\t\t .gasbar->size = NewSize\r\n\t\t .gasbar->redraw = 1\r\n\t end\r\n\tend\r\n\tdoit:\r\nrepeat\r\nif @rn.counter > 0 and @reccount > 0 then\r\n\tNewWidth = CurrentSize<3> * @rn.counter/@reccount\r\n\t.percent_complete->text = oconv(iconv( @rn.counter/@reccount*100, 'MD0' ), 'MD0' ):'%'\r\n\tNewSize<3> = NewWidth\r\n\t.gasbar->redraw = 0\r\n\t.gasbar->size = NewSize\r\n\t.gasbar->redraw = 1\r\nend\r\nif ListOut <> '' then\r\n ListId = 'RL':oconv( date(), 'D2/' )\r\n write ListOut to SysListsTable, ListId else\r\n Void = msg( '', 'Unable to write ':ListId:' on SYSLISTS...' )\r\n return 0\r\n end\t\r\nend\r\nreturn 1\r\n*===========================================================================*\r\nWriteRLRecord:\r\nStampThis = true$\r\nListOut<-1> = Id:'->':ThisRdsId:'*':field(RdsKeys,@vm,i+1,999)\r\nrecord_lock( ReactorLogTable, 'Reactor Log', Id )\r\nReactorLogRec<reactor_log_rds_no$> = ThisRdsId\r\nReactorLogRec<reactor_log_wo$> = RdsWo\r\nReactorLogRec<reactor_log_reactor$> = RdsReactor\r\nReactorLogRec<reactor_log_cust_no$> = RdsCust\r\nwrite ReactorLogRec on ReactorLogTable, Id else\r\n Void = msg( '', 'Unable to write ':Id:' on REACTOR_LOG table.' )\r\n return 0\r\nend\r\nunlock ReactorLogTable, Id else\r\n Void = msg( '', 'Unable to unlock ':Id:' in REACTOR_LOG table.' )\r\n return 0\r\nend\r\nreturn\r\n*===========================================================================*"
|
|
}
|
|
}
|
|
} |