📄 gczljc.cpp
字号:
//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include "gczljc.h"
#include "dm.h"
#include "gczlrep.h"
#include "main.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma link "KsSkinButtons"
#pragma link "KsSkinCheckBoxs"
#pragma link "KsSkinForms"
#pragma link "KsSkinGroupBoxs"
#pragma link "KsSkinLabels"
#pragma link "se_controls"
#pragma resource "*.dfm"
TForm54 *Form54;
AnsiString gczlbh[100],gczljh[100],gczlxfrq[100],gczlywrq[100];
int gczlfh[100],gczlld[100],gczlldfhdq[100],gczlcount;
TColor color[100];
TCheckBox* xuanzhong[100];
//---------------------------------------------------------------------------
__fastcall TForm54::TForm54(TComponent* Owner)
: TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TForm54::FormCreate(TObject *Sender)
{
Left=220;
Top=80;
}
//---------------------------------------------------------------------------
void __fastcall TForm54::FormPaint(TObject *Sender)
{
int y=int(gczlcount/3)+1;
int x=4;
int heightfh=int(Height/(y+1));
if(heightfh>60)heightfh=60;
int widthfh=180;
int widthshiji;
int sjlength;
int widthlx;
AnsiString fhname,qidian,zhongdian;
Canvas->Brush->Color=clBtnFace;
Canvas->Font->Name = "宋体";
Canvas->Font->Size=10;
for(int j=0;j<y;j++)
for(int i=0;i<x;i++)
{
if(j*3+i>=gczlcount)break;
if(gczlld[j*3+i]!=0)
{
fhname=gczljh[j*3+i]+"飞机"+gczlbh[j*3+i];
qidian="0LD";
zhongdian=IntToStr(gczlld[j*3+i])+"LD";
sjlength=gczlldfhdq[j*3+i];
widthlx=gczlld[j*3+i];
}
else if(gczlfh[j*3+i]!=0)
{
fhname=gczljh[j*3+i]+"飞机"+gczlbh[j*3+i];
qidian="0FH";
zhongdian=IntToStr(gczlfh[j*3+i])+"FH";
sjlength=gczlldfhdq[j*3+i];
widthlx=gczlfh[j*3+i];
}
else if(gczlywrq[j*3+i]!="")
{
fhname=gczljh[j*3+i]+"飞机"+gczlbh[j*3+i];
qidian=gczlxfrq[j*3+i];
zhongdian=gczlywrq[j*3+i];
sjlength=Date()-StrToDate(gczlxfrq[j*3+i]);
if(gczlxfrq[j*3+i]!="")
widthlx=StrToDate(gczlywrq[j*3+i])-StrToDate(gczlxfrq[j*3+i]);
}
Canvas->Brush->Color=clBtnFace;
Canvas->Font->Color=clPurple;
Canvas->TextOutA(i*widthfh+25,j*heightfh+int(2*heightfh/3)+2,qidian);
Canvas->TextOutA(i*widthfh+widthfh-50,j*heightfh+int(2*heightfh/3)+2,zhongdian);
Canvas->Font->Color=clBlue;
Canvas->TextOutA(i*widthfh+25,j*heightfh+5,fhname+"监控条");
if(widthlx==0)widthlx=1;
Canvas->Rectangle(i*widthfh+25,j*heightfh+int(heightfh/3),(i+1)*widthfh,j*heightfh+int(2*heightfh/3));
Canvas->Brush->Color=color[j*3+i];
widthshiji= int(i*widthfh+25+(widthfh-25)*sjlength/widthlx);
Canvas->FillRect(Rect(i*widthfh+26,j*heightfh+int(heightfh/3)+1,widthshiji
,j*heightfh+int(2*heightfh/3)-1));
if((gczlld[j*3+i]!=0)||(gczlfh[j*3+i]!=0))
Canvas->TextOutA(i*widthfh+50,j*heightfh+22,"当前值:"+IntToStr(sjlength)/60);
}
}
//---------------------------------------------------------------------------
void __fastcall TForm54::Button2Click(TObject *Sender)
{
Close();
}
//---------------------------------------------------------------------------
void __fastcall TForm54::Button1Click(TObject *Sender)
{
AnsiString querystr;
int qidian;
if(yellowck->Checked)
{
for(int i=0;i<gczlcount;i++)
if(xuanzhong[i]->Checked)
{querystr="机号 = '"+gczljh[i]+"' AND 指令编号 = '"+gczlbh[i]+"'";
qidian=i;
break;
}
for(int i=qidian+1;i<gczlcount;i++)
{
if(xuanzhong[i]->Checked)
querystr=querystr+" OR 机号 = '"+gczljh[i]+"' AND 指令编号 = '"+gczlbh[i]+"'";
}
DataModule1->gczl->Filtered=false;
DataModule1->gczl->Filter=querystr;
DataModule1->gczl->Filtered=true;
TForm53 *f53=new TForm53(this);
f53->QuickRep1->Prepare();
f53->QuickRep1->Preview();
delete f53;
if(gaixie->Checked)
{
DataModule1->gczl->Last();
for(int j=0;j<DataModule1->gczl->RecordCount;j++)
{
DataModule1->gczl->Edit();
DataModule1->gczlswrq->AsDateTime=DateToStr(Date());
DataModule1->gczl->Post();
DataModule1->gczl->Prior();
}
}
}
else
{
querystr="";
for(int i=0;i<gczlcount;i++)
{
if((color[i]==clRed)&&xuanzhong[i]->Checked)
querystr=querystr+"机号 = '"+gczljh[i]+"' AND 指令编号 = '"+gczlbh[i]+"' OR ";
}
int l=querystr.Length();
querystr=querystr.SubString(1,l-4);
DataModule1->gczl->Filtered=false;
DataModule1->gczl->Filter=querystr;
DataModule1->gczl->Filtered=true;
TForm53 *f53=new TForm53(this);
f53->QuickRep1->Prepare();
f53->QuickRep1->Preview();
delete f53;
if(gaixie->Checked)
{ DataModule1->gczl->Last();
for(int j=0;j<DataModule1->gczl->RecordCount;j++)
{
DataModule1->gczl->Edit();
DataModule1->gczlswrq->AsDateTime=DateToStr(Date());
DataModule1->gczl->Post();
DataModule1->gczl->Prior();
}
}
}
}
//---------------------------------------------------------------------------
void __fastcall TForm54::FormClose(TObject *Sender, TCloseAction &Action)
{
Form1->N64->Checked=false;
for(int i=0;i<gczlcount;i++)
delete xuanzhong[i];
}
//---------------------------------------------------------------------------
void __fastcall TForm54::FormShow(TObject *Sender)
{
int y=int(gczlcount/3)+1;
int x=3;
int heightfh=int(Height/(y+1));
if(heightfh>60)heightfh=60;
int widthfh=180;
for(int j=0;j<y;j++)
for(int i=0;i<x;i++)
{
if(j*3+i>=gczlcount)break;
xuanzhong[j*3+i]=new TCheckBox(this);
xuanzhong[j*3+i]->Parent=this;
xuanzhong[j*3+i]->Caption="";
xuanzhong[j*3+i]->Width=15;
xuanzhong[j*3+i]->Left=10+widthfh*i;
xuanzhong[j*3+i]->Top= j*heightfh+int(heightfh/3)+1;
}
}
//---------------------------------------------------------------------------
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -