用組態(tài)王事件命令控制自動(dòng)生成報(bào)表時(shí)發(fā)現(xiàn)問(wèn)題
預(yù)期效果是:每到整點(diǎn)時(shí)間,報(bào)表自動(dòng)讀取歷史數(shù)據(jù),生成報(bào)表,并保存到文件夾。
實(shí)際效果是:必須把組態(tài)王打開(kāi)到報(bào)表界面時(shí),當(dāng)整點(diǎn)時(shí)間一到自動(dòng)生成報(bào)表并保存文件,處于其他界面時(shí)(比如控制界面),整點(diǎn)時(shí)間到不能生成報(bào)表。
但是實(shí)際生產(chǎn)過(guò)程中不可能一直處于報(bào)表界面,另外有兩個(gè)報(bào)表界面,即使一直處于一個(gè)報(bào)表,另一個(gè)也不能生成。效果還不如在報(bào)表界面用控件生成。
請(qǐng)教各位是否有解決方案
————————————————————————
事件命令如下:
條件:\\本站點(diǎn)\$分==0
命令:
long StartTime;
StartTime=HTConvertTime(\\本站點(diǎn)\$年,\\本站點(diǎn)\$月,\\本站點(diǎn)\$日,0,0,0);
{
ReportSetHistData("日?qǐng)?bào)","\\本站點(diǎn)\一號(hào)溫度1", StartTime,3600, "b4:b27");
ReportSetHistData("日?qǐng)?bào)","\\本站點(diǎn)\一號(hào)溫度2", StartTime,3600, "c4:c27");
ReportSetHistData("日?qǐng)?bào)","\\本站點(diǎn)\一號(hào)溫度3", StartTime,3600, "d4:d27");
ReportSetHistData("日?qǐng)?bào)","\\本站點(diǎn)\一號(hào)溫度4", StartTime,3600, "e4:e27");
string datatime;
datatime=StrFromTime( StartTime,1);
string strtime;
long hang;
hang=4;
while (hang<=27)
{strtime=StrFromTime( StartTime, 3);
ReportSetCellString("日?qǐng)?bào)",hang, 1, strtime);
hang=hang+1;
StartTime=StartTime+3600;}
}
\\本站點(diǎn)\year=StrFromInt(\\本站點(diǎn)\$年, 10 );
if (\\本站點(diǎn)\$月<10)
{
\\本站點(diǎn)\month="0"+StrFromInt(\\本站點(diǎn)\$月,10 );
}
else
{
\\本站點(diǎn)\month=StrFromInt(\\本站點(diǎn)\$月,10 );
}
if (\\本站點(diǎn)\$日<10)
{
\\本站點(diǎn)\data="0"+StrFromInt(\\本站點(diǎn)\$日, 10 );
}
else
{
\\本站點(diǎn)\data=StrFromInt(\\本站點(diǎn)\$日, 10 );
}
string filename1="d:\報(bào)表\"+\\本站點(diǎn)\year+\\本站點(diǎn)\month+\\本站點(diǎn)\data+"一號(hào)日?qǐng)?bào)表.xls";
string filename2="d:\報(bào)表\"+\\本站點(diǎn)\year+\\本站點(diǎn)\month+\\本站點(diǎn)\data+"一號(hào)日?qǐng)?bào)表.rtl";
ReportSaveAs("日?qǐng)?bào)",filename1);
ReportSaveAs("日?qǐng)?bào)",filename2);