📄 tgl.~pas
字号:
a4:=a4+'分';
end;
///////
except
a4:='不明';
end;
a5:=(adoqcount.fieldbyname('fscrq').AsString);
//判断是否是过期数据(6小时后数据过期)/有点问题没解决/
try
if cbrq.Checked=false then
bt:=((round((strtotime(formatdatetime('hh:nn',now))-strtotime(adoqcount.fieldbyname('fccsj').AsString))*24*60)<360))
else
bt:=false;
except
bt:=false;
end;
//bt:=((round((strtotime(formatdatetime('hh:nn',now))-strtotime(adoqcount.fieldbyname('fccsj').AsString))*24*60)>360) or (round((strtotime(formatdatetime('hh:nn',now))-strtotime(adoqcount.fieldbyname('fccsj').AsString))*24*60)<0));
if not bt then
//if not ((round((strtotime(formatdatetime('hh:nn',now))-strtotime(adoqcount.fieldbyname('fccsj').AsString))*24*60)>360) or (round((strtotime(formatdatetime('hh:nn',now))-strtotime(adoqcount.fieldbyname('fccsj').AsString))*24*60)<0)) then
//if ((round((strtotime(formatdatetime('hh:nn',now))-strtotime(adoqcount.fieldbyname('fccsj').AsString))*24*60)<360)) then
begin
////写入数据////////////////////////////
adoqsl.Close;
adoqsl.SQL.Clear;
adoqsl.SQL.Add('insert into list1(ch,gd,fcsj,hs,jh,rq) values('''+a1+''','''+a2+''','''+a3+''','''+a4+''','''+'2'+''','''+a5+''')');
adoqsl.ExecSQL;
end;
adoqcount.next;
end;
///////////////////////////
///2号机///////////////
s1:='jh='''+'2'+'''';
adoqlist2.Close;
adoqlist2.SQL.Clear;
adoqlist2.SQL.Add('select * from list1 where '+s1+' order by rq desc,fcsj desc');
adoqlist2.Open;
dbgrid3.Columns[0].FieldName:='ch';
dbgrid3.Columns[0].Title.caption:='车号';
dbgrid3.Columns[0].Width:=65;
dbgrid3.Columns[1].FieldName:='gd';
dbgrid3.Columns[1].Title.caption:='工地';
dbgrid3.Columns[1].Width:=161;
dbgrid3.Columns[2].FieldName:='fcsj';
dbgrid3.Columns[2].Title.caption:='发车';
dbgrid3.Columns[2].Width:=45;
dbgrid3.Columns[3].FieldName:='hs';
dbgrid3.Columns[3].Title.caption:='耗时';
dbgrid3.Columns[3].Width:=33;
TStringGrid(DBGrid3).DefaultRowHeight:=24;
///////////////////////
//进行计算//333333////////////////
if cbrq.Checked=false then
s1:='fscbt<>'''+'1'+''' and fscbt<>'''+'2'+''' and fscrq='''+formatdatetime('yyyy-mm-dd',now)+''''
else
s1:='fscbt<>'''+'1'+''' and fscbt<>'''+'2'+'''';
adoqcount.Close;
adoqcount.SQL.Clear;
adoqcount.SQL.Add('select top 10 * from tjlb where '+s1+' order by fscrq desc,fccsj desc');
adoqcount.Open;
//写入//
while not adoqcount.Eof do
begin
a1:=(adoqcount.fieldbyname('fshch').AsString+'>'+adoqcount.fieldbyname('fsjxm').AsString);
//showmessage(a1);
a2:=(adoqcount.fieldbyname('fgcmc').AsString);
a3:=(adoqcount.fieldbyname('fccsj').AsString);
try
a4:=(floattostr(round((strtotime(adoqcount.fieldbyname('fccsj').AsString)-strtotime(adoqcount.fieldbyname('fdcsj').AsString))/3*4*24*60)));
///////
if strtofloat(a4)>0 then
begin
if strtofloat(a4)>30 then a4:='超时'
else a4:=a4+'分';
end
else
begin
a4:=floattostr(strtofloat(a4)+24*60);
a4:=a4+'分';
end;
///////
except
a4:='不明';
end;
a5:=(adoqcount.fieldbyname('fscrq').AsString);
//判断是否是过期数据(6小时后数据过期)/有点问题没解决/
try
if cbrq.Checked=false then
bt:=((round((strtotime(formatdatetime('hh:nn',now))-strtotime(adoqcount.fieldbyname('fccsj').AsString))*24*60)<360))
else
bt:=false;
except
bt:=false;
end;
//bt:=((round((strtotime(formatdatetime('hh:nn',now))-strtotime(adoqcount.fieldbyname('fccsj').AsString))*24*60)>360) or (round((strtotime(formatdatetime('hh:nn',now))-strtotime(adoqcount.fieldbyname('fccsj').AsString))*24*60)<0));
if not bt then
//if not ((round((strtotime(formatdatetime('hh:nn',now))-strtotime(adoqcount.fieldbyname('fccsj').AsString))*24*60)>360) or (round((strtotime(formatdatetime('hh:nn',now))-strtotime(adoqcount.fieldbyname('fccsj').AsString))*24*60)<0)) then
//if ((round((strtotime(formatdatetime('hh:nn',now))-strtotime(adoqcount.fieldbyname('fccsj').AsString))*24*60)<360)) then
begin
////写入数据////////////////////////////
adoqsl.Close;
adoqsl.SQL.Clear;
adoqsl.SQL.Add('insert into list1(ch,gd,fcsj,hs,jh,rq) values('''+a1+''','''+a2+''','''+a3+''','''+a4+''','''+'3'+''','''+a5+''')');
adoqsl.ExecSQL;
end;
adoqcount.next;
end;
///////////////////////////
///3号机///////////////
s1:='jh='''+'3'+'''';
adoqlist3.Close;
adoqlist3.SQL.Clear;
adoqlist3.SQL.Add('select * from list1 where '+s1+' order by rq desc,fcsj desc');
adoqlist3.Open;
dbgrid4.Columns[0].FieldName:='ch';
dbgrid4.Columns[0].Title.caption:='车号';
dbgrid4.Columns[0].Width:=65;
dbgrid4.Columns[1].FieldName:='gd';
dbgrid4.Columns[1].Title.caption:='工地';
dbgrid4.Columns[1].Width:=170;
dbgrid4.Columns[2].FieldName:='fcsj';
dbgrid4.Columns[2].Title.caption:='发车';
dbgrid4.Columns[2].Width:=45;
dbgrid4.Columns[3].FieldName:='hs';
dbgrid4.Columns[3].Title.caption:='耗时';
dbgrid4.Columns[3].Width:=33;
TStringGrid(DBGrid4).DefaultRowHeight:=24;
///////////////////////
end;
procedure TForm1.FormShow(Sender: TObject);
begin
bitbtn1.Click;
end;
procedure TForm1.Timer1Timer(Sender: TObject);
begin
if checkbox4.Checked=true then bitbtn1.Click;
end;
procedure TForm1.BitBtn2Click(Sender: TObject);
begin
close;
end;
procedure TForm1.BitBtn3Click(Sender: TObject);
begin
adoquery1.First;
end;
procedure TForm1.BitBtn6Click(Sender: TObject);
begin
adoquery1.Last;
end;
procedure TForm1.BitBtn5Click(Sender: TObject);
begin
//if adoquery1.Findlast=true then exit;
adoquery1.Next;
end;
procedure TForm1.BitBtn4Click(Sender: TObject);
begin
//if adoquery1.findFirst=true then exit;
adoquery1.Prior;
end;
procedure TForm1.ApplicationEvents1Message(var Msg: tagMSG;
var Handled: Boolean);
begin
if (DBGrid1.Focused) And (Msg.message = WM_MOUSEWHEEL) then
begin
if Msg.wParam > 0 then
SendMessage(DBGrid1.Handle, WM_KEYDOWN, VK_UP, 0)
else
SendMessage(DBGrid1.Handle, WM_KEYDOWN, VK_DOWN, 0);
Handled := True;
end;
end;
procedure TForm1.DBGrid1DrawColumnCell(Sender: TObject; const Rect: TRect;
DataCol: Integer; Column: TColumn; State: TGridDrawState);
begin
//exit;
if (DBGrid1.DataSource.DataSet.RecNo mod 2)=1 then
begin
DBGrid1.Canvas.Font.Color:=clBlue;
DBGrid1.Canvas.Brush.Color:=clCream;//clyellow;
end
else
begin
DBGrid1.Canvas.Font.Color := 00000000;
DBGrid1.Canvas.Brush.Color:=clwhite;// clGradientActiveCaption;
end;
DBGrid1.DefaultDrawColumnCell(Rect, DataCol, Column, State);
end;
procedure TForm1.ApplicationEvents2Message(var Msg: tagMSG;
var Handled: Boolean);
begin
if (DBGrid2.Focused) And (Msg.message = WM_MOUSEWHEEL) then
begin
if Msg.wParam > 0 then
SendMessage(DBGrid1.Handle, WM_KEYDOWN, VK_UP, 0)
else
SendMessage(DBGrid1.Handle, WM_KEYDOWN, VK_DOWN, 0);
Handled := True;
end;
end;
procedure TForm1.ApplicationEvents3Message(var Msg: tagMSG;
var Handled: Boolean);
begin
if (DBGrid3.Focused) And (Msg.message = WM_MOUSEWHEEL) then
begin
if Msg.wParam > 0 then
SendMessage(DBGrid1.Handle, WM_KEYDOWN, VK_UP, 0)
else
SendMessage(DBGrid1.Handle, WM_KEYDOWN, VK_DOWN, 0);
Handled := True;
end;
end;
procedure TForm1.ApplicationEvents4Message(var Msg: tagMSG;
var Handled: Boolean);
begin
if (DBGrid4.Focused) And (Msg.message = WM_MOUSEWHEEL) then
begin
if Msg.wParam > 0 then
SendMessage(DBGrid1.Handle, WM_KEYDOWN, VK_UP, 0)
else
SendMessage(DBGrid1.Handle, WM_KEYDOWN, VK_DOWN, 0);
Handled := True;
end;
end;
procedure TForm1.DBGrid2DrawColumnCell(Sender: TObject; const Rect: TRect;
DataCol: Integer; Column: TColumn; State: TGridDrawState);
begin
if (DBGrid2.DataSource.DataSet.RecNo mod 2)=1 then
begin
DBGrid2.Canvas.Font.Color:=clBlue;
DBGrid2.Canvas.Brush.Color:=clCream;//clyellow;
end
else
begin
DBGrid2.Canvas.Font.Color := 00000000;
DBGrid2.Canvas.Brush.Color:=clwhite;// clGradientActiveCaption;
end;
DBGrid2.DefaultDrawColumnCell(Rect, DataCol, Column, State);
end;
procedure TForm1.DBGrid3DrawColumnCell(Sender: TObject; const Rect: TRect;
DataCol: Integer; Column: TColumn; State: TGridDrawState);
begin
if (DBGrid3.DataSource.DataSet.RecNo mod 2)=1 then
begin
DBGrid3.Canvas.Font.Color:=clBlue;
DBGrid3.Canvas.Brush.Color:=clCream;//clyellow;
end
else
begin
DBGrid3.Canvas.Font.Color := 00000000;
DBGrid3.Canvas.Brush.Color:=clwhite;// clGradientActiveCaption;
end;
DBGrid3.DefaultDrawColumnCell(Rect, DataCol, Column, State);
end;
procedure TForm1.DBGrid4DrawColumnCell(Sender: TObject; const Rect: TRect;
DataCol: Integer; Column: TColumn; State: TGridDrawState);
begin
if (DBGrid4.DataSource.DataSet.RecNo mod 2)=1 then
begin
DBGrid4.Canvas.Font.Color:=clBlue;
DBGrid4.Canvas.Brush.Color:=clCream;//clyellow;
end
else
begin
DBGrid4.Canvas.Font.Color := 00000000;
DBGrid4.Canvas.Brush.Color:=clwhite;// clGradientActiveCaption;
end;
DBGrid4.DefaultDrawColumnCell(Rect, DataCol, Column, State);
end;
procedure TForm1.AALabel3Click(Sender: TObject);
begin
application.CreateForm(tfabout,fabout);
fabout.ShowModal;
fabout.Free;
end;
procedure TForm1.N1Click(Sender: TObject);
begin
if not(form1.ADOQuery1.RecordCount>0) then exit;
application.CreateForm(tlist,list);
list.ShowModal;
list.Free;
end;
procedure TForm1.DBGrid1DblClick(Sender: TObject);
begin
POPUPMENU1.Items[0].Click;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
if date()= strtodate('2007-12-30') then
begin
showmessage('对不起,软件即将过期!请向开发者付款800元进行授权!林金杉 13857655787');
end;
if date()= strtodate('2007-12-31') then
begin
showmessage('对不起,软件即将过期!请向开发者付款800元进行授权!林金杉 13857655787');
end;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -