针对早期有线数字机顶盒海特荣德股票系统部分股票丢失问题的一点解决技巧.doc

上传人:scccc 文档编号:11177437 上传时间:2021-07-09 格式:DOC 页数:12 大小:198KB
返回 下载 相关 举报
针对早期有线数字机顶盒海特荣德股票系统部分股票丢失问题的一点解决技巧.doc_第1页
第1页 / 共12页
针对早期有线数字机顶盒海特荣德股票系统部分股票丢失问题的一点解决技巧.doc_第2页
第2页 / 共12页
针对早期有线数字机顶盒海特荣德股票系统部分股票丢失问题的一点解决技巧.doc_第3页
第3页 / 共12页
针对早期有线数字机顶盒海特荣德股票系统部分股票丢失问题的一点解决技巧.doc_第4页
第4页 / 共12页
针对早期有线数字机顶盒海特荣德股票系统部分股票丢失问题的一点解决技巧.doc_第5页
第5页 / 共12页
点击查看更多>>
资源描述

《针对早期有线数字机顶盒海特荣德股票系统部分股票丢失问题的一点解决技巧.doc》由会员分享,可在线阅读,更多相关《针对早期有线数字机顶盒海特荣德股票系统部分股票丢失问题的一点解决技巧.doc(12页珍藏版)》请在三一文库上搜索。

1、针对早期有线数字机顶盒海特荣德股票系统部分股票丢失问题的一点解决技巧摘要 随着上交所和深交所发行的股票越来越多,基金和国债的品种也越来越多,早期机顶盒集成的股票系统出现了很多问题,其中之一就是会丢失部分上证股票。解决办法是通过软件升级来进行完善,但因为我市网内机顶盒芯片和型号有很多版本,升级势必涉及升级费用,造成成本的增加和升级潜在风险。我们通过对股票系统的深入了解和不断尝试,找到了一种既能显示全所有A股股票,保证用户收看A股行情的需求,又无需对股票系统繁琐升级的办法,供同仁们参考。 有线数字电视机顶盒股票系统作为一种数字电视增值业务深受老百姓的欢迎。特别是很多中老年人,由于不太懂电脑,想要每

2、天能看到股票行情,不得不跑去证券公司。而数字电视机顶盒股票系统解决了他们这个烦恼,使得他们在家就能及时收看到每天的股票行情。由于早期的机顶盒内存很小,在集成股票系统的过程中,考虑到股票软件所要使用到的内存空间要控制在相对比较小的范围,加上设计时的上交所和深交所发行的股票数量不多,所以将处理股票、国债、基金等最大只数设置为5000只左右,满足当时以及很长一段时间广大广电客户的需求。而近几年,随着上市公司、国债、基金等数量的快速增加,导致5000这个数字上限已经不能满足广大用户的需求,就出现了丢失部分上证股票的现象。虽然只是丢失部分股票,但也引起了一些用户的不满和投诉。为解决这一问题,笔者通过对股

3、票丢失原因的了解,找到了一种临时解决技巧,让这些丢失的股票重新显示出来。这个办法不需要对原来股票系统播出的硬件和软件进行升级,也不影响用户,希望能给面临同样问题的同仁带来一种思路。 首先,先弄清楚部分上证股票丢失的原因。上证股票源文件是show2003.dbf,深圳股票源文件是Sjshq.dbf、Sjsxx.dbf、Sjsxxn.dbf,各类指数源文件是Sjszs.dbf。股票前端配置文件中,上证股票限制参数设定为2900,深圳股票限制参数设定为2350。前端限制的是dbf的读取个数,而上证和深圳的dbf排列顺序是不一样的。上证的dbf的开始部分依次为指数,债券,基金,A股等,随着指数,债券,

4、基金的增加,导致了A股显示不全。深圳的dbf的开始部分依次为A股、债券、B股、指数、创业板等,而深圳A股个数并没有超过设定的2350,故没有影响。 其次,调整上证数据库文件show2003.dbf中A股、基金、国债等板块顺序。绝大多数用户只会收看上证指数、深证成指和A股股票(包括创业板),其他的债券、基金、B股及各类指数并不关心。将show2003.dbf中板块顺序依次调整为上证指数、A股、债券、基金等,或者直接把上证指数和A股以外的数据都删除。这样在上证股票限制参数为2900的情况下,就保证了所有上证A股可以正确显示。 最后,根据“调整上证数据库文件”这个思路,采用“Microsoft Vi

5、sual FoxPro 6.0”软件对该文件进行编程处理。具体步骤为:一,拷贝该源文件到文件夹temp。当上证数据库文件更新时,每隔5秒进行只读打开方式拷贝到temp下。二,拷贝命令执行后,马上处理temp中的库文件,将板块顺序调整或者直接把上证指数和A股以外的数据都删除。三,修改股票播出程序中的配置文件SWStockSvr.ini,使上证源文件路径对应temp下的库文件。整个处理过程以5秒为一个周期。当遇到文件处理失败情况,程序则自动忽略本次错误,继续下一个周期;当检测到库文件停止更新3分钟后,处理程序也自动停止。 以下是部分程序源代码:.set talk off set safety of

6、fon error quit*使用拷贝后的库文件use d:tempshow2003.dbf copy to tempuse temp*恢复相关指数记录recall for subs(s1,1,4)=0000*删除01开头的国债记录delete for subs(s1,1,2)=01*删除09开头的质押记录delete for subs(s1,1,2)=09*删除5开头的基金记录delete for subs(s1,1,1)=5.packcopy to d:shdbfshow2003.dbf.该处理程序通过一个月的实际使用验证,在股票系统服务器上的稳定运行,机顶盒实时出来的所有A股股票(包括创

7、业板)K线行情和各类指数都正确无误。唯一的缺点就是用户收看到的行情比真正的行情晚了5秒左右,但在不用升级前端和终端的情况下,仍不失为比较好的解决办法。附1 检测源数据库文件数据变化情况(部分程序代码)附2 处理上证和深证数据库文件附 3 运行界面附1 检测源数据库文件数据变化情况Dim hChangeHandle As LongDim hWatched As LongDim terminateFlag As LongDim stbs(32) As StringDim dvbv As StringDim services(32) As StringDim mpgs1, mpgs2 As Stri

8、ngDim vIndex, kIndex As IntegerDim pids(32) As LongDim openFlag, counterStop, counterUpdate As IntegerDim i As LongDim ss As StringConst SYNCHRONIZE = &H100000Const INFINITE = &HFFFFFFFFPrivate Declare Function OpenProcess Lib kernel32 (ByVal dwDesiredAccess As Long, ByVal bInheritHandle As Long, By

9、Val dwProcessId As Long) As LongPrivate Declare Function CloseHandle Lib kernel32 (ByVal hObject As Long) As LongPrivate Declare Function WaitForSingleObject Lib kernel32 (ByVal hHandle As Long, ByVal dwMilliseconds As Long) As LongPrivate Declare Function TerminateProcess Lib kernel32 Alias Termina

10、teProcess (ByVal hProcess As Long, ByVal uExitCode As Long) As Long Private Const INFINITE As Long = &HFFFFFFFFPrivate Const FILE_NOTIFY_CHANGE_FILE_NAME As Long = &H1Private Const FILE_NOTIFY_CHANGE_DIR_NAME As Long = &H2Private Const FILE_NOTIFY_CHANGE_ATTRIBUTES As Long = &H4Private Const FILE_NO

11、TIFY_CHANGE_SIZE As Long = &H8Private Const FILE_NOTIFY_CHANGE_LAST_WRITE As Long = &H10Private Const FILE_NOTIFY_CHANGE_LAST_ACCESS As Long = &H20Private Const FILE_NOTIFY_CHANGE_CREATION As Long = &H40Private Const FILE_NOTIFY_CHANGE_SECURITY As Long = &H100Private Const FILE_NOTIFY_FLAGS = FILE_N

12、OTIFY_CHANGE_ATTRIBUTES Or _ FILE_NOTIFY_CHANGE_FILE_NAME Or _ FILE_NOTIFY_CHANGE_LAST_WRITEPrivate Declare Function FindFirstChangeNotification Lib kernel32 _ Alias FindFirstChangeNotificationA _ (ByVal lpPathName As String, _ ByVal bWatchSubtree As Long, _ ByVal dwNotifyFilter As Long) As LongPriv

13、ate Declare Function FindCloseChangeNotification Lib kernel32 _ (ByVal hChangeHandle As Long) As LongPrivate Declare Function FindNextChangeNotification Lib kernel32 _ (ByVal hChangeHandle As Long) As LongPrivate Const WAIT_OBJECT_0 As Long = &H0Private Const WAIT_ABANDONED As Long = &H80Private Con

14、st WAIT_IO_COMPLETION As Long = &HC0Private Const WAIT_TIMEOUT As Long = &H102Private Const STATUS_PENDING As Long = &H103Private Sub Command4_Click() FileCopyEx d:tempshow2003.dbf, d:temptt.dbfEnd SubPrivate Sub Form_Load() Dim cmds As String Label2.Caption = Press Begin Watch dvbv = :363000:64:687

15、5 vIndex = 1 mpgs1 = D:VLC086vlc.exe -vvv mpgs2 = -repeat -sout-all -sout-spu -sout=#duplicatedst=stdaccess=udp,mux=ts,dst=224.1.2.3:850 Text3 = ! 未启动将造成股票不更新 ! openFlag = 0 counterStop = 0 counterUpdate = 0 ss = d:vfp98vfp6 d:shdbft.prg ss = d:shdbfdbf.bat LabelOpenFlag = 0 LabelUpdate = 0End SubPr

16、ivate Sub Command1_Click() Dim watchPath As String Dim watchStatus As Long watchPath = f:dbfsh terminateFlag = False Command1.Enabled = False Label2.Caption = Using Explorer and Notepad, create, modify, rename, delete or change the attributes of a text file in the watched directory. get the first fi

17、le text attributes to the listbox (if any) WatchChangeAction watchPath show a msgbox to indicate the watch is starting MsgBox Beginning watching of folder & watchPath & . press OK create a watched directory hWatched = WatchCreate(watchPath, FILE_NOTIFY_FLAGS) poll the watched folder watchStatus = Wa

18、tchDirectory(hWatched, 100) if WatchDirectory exited with watchStatus = 0, then there was a change in the folder. If watchStatus = 0 Then update the listbox for the first file found in the folder and indicate a change took place. WatchChangeAction watchPath MsgBox The watched directory has been chan

19、ged. Resuming watch. Call DoRun openFlag = 1 LabelOpenFlag = 1 (perform actions) this is where youd actually put code to perform a task based on the folder changing. now go into a second loop, this time calling the FindNextChangeNotification API, again exiting if watchStatus indicates the terminate

20、flag was set Do watchStatus = WatchResume(hWatched, 100) If watchStatus = -1 Then watchStatus must have exited with the terminate flag MsgBox Watching has been terminated for & watchPath Else WatchChangeAction watchPath MsgBox The watched directory has been changed again. (perform actions) this is w

21、here youd actually put code to perform a task based on the folder changing. Call DoRun openFlag = 1 LabelOpenFlag = 1 End If Loop While watchStatus = 0 Else watchStatus must have exited with the terminate flag MsgBox Watching has been terminated for & watchPath End If End SubPrivate Sub Command2_Cli

22、ck() clean up by deleting the handle to the watched directory Call WatchDelete(hWatched) hWatched = 0 Command1.Enabled = True Label2.Caption = Press Begin WatchEnd SubPrivate Sub Command3_Click() If hWatched 0 Then Call WatchDelete(hWatched) Unload MeEnd SubPrivate Sub TimerStop_Timer() counterStop

23、= counterStop + 1 If counterStop 30 Then counterStop = 0 openFlag = 0 LabelOpenFlag = 0 End IfEnd SubPrivate Sub TimerUpdate_Timer() If openFlag = 0 Then Exit Sub counterUpdate = counterUpdate + 1 LabelUpdate = counterUpdate If counterUpdate 11 Then Exit Sub counterUpdate = 0 调用程序处理 FileCopyEx f:dbf

24、show2003.dbf, d:dbftempshow2003.dbf FileCopyEx f:dbfsjshq.dbf, d:dbftempsjshq.dbf FileCopyEx f:dbfsjsxx.dbf, d:dbftempsjsxx.dbf FileCopyEx f:dbfsjsxxn.dbf, d:dbftempsjsxxn.dbf FileCopyEx f:dbfsjszs.dbf, d:dbftempsjszs.dbf i = Shell(ss, vbNormalFocus) i = Shell(ss, vbMinimizedNoFocus) DoEvents End Sub 附2 处理上证和深证数据库文件 附3 运行界面

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 社会民生


经营许可证编号:宁ICP备18001539号-1