組態王6.55——日報表


 

 

 

 //..............................................................

float Ayear;
float Amonth;
float Aday;
long x;
long y;
long Row;
long StartTime;
string temp;
Ayear=ADate1.Year;
Amonth=ADate1.Month;
Aday=ADate1.Day;
temp=StrFromInt( Ayear, 10 );
if(Amonth<10)
temp=temp+"-0"+StrFromInt( Amonth, 10 );
else
temp=temp+"-"+StrFromInt( Amonth, 10 );
if(Aday<10)
temp=temp+"-0"+StrFromInt( Aday, 10 );
else
temp=temp+"-"+StrFromInt( Aday, 10 );
\\本站點\選擇日期=temp;
ReportSetCellString2("日報表", 5, 1, 28, 10, " "); //清空單元格
ReportSetCellString("日報表", 3, 2, temp);//填寫日期
//查詢數據
StartTime=NewHTConvertTime(Ayear,Amonth,Aday,0,0,0);
ReportSetHistData("日報表", "\\本站點\閘門開度", StartTime, 3600, "B4:B20");
ReportSetHistData("日報表", "\\本站點\產生水位隨機數", StartTime, 3600, "C4:C20");

//填寫時間
x=0;
while(x<24)
{
row=5+x;
y=StartTime+x*3600;
temp=StrFromTime( y, 2 );
ReportSetCellString("日報表", row, 1, temp);
x=x+1;
}

//..........................................................................................

 

 

long x;//天
long t;//時間戳
long m1;//月處理值
long n1;//年處理值

//年月處理初值
n1=year1;
m1=month1-2;

//年月處理
if(m1<=0)
{m1=m1+12;n1=n1-1;}

//天數
x=int(n1/4) -int( n1/100) + int(n1/400) + int(367*m1/12) + day1 + n1*365 - 719499;
//時間戳結果
t=x*24*3600+(hour1-8)*3600+minite1*60+second1;

//錯誤處理
if(t<0)
{t=0;}

//返回計算值
return t;

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM