📄 unitlinelost2.pas
字号:
unit UnitLineLost2;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, Buttons, ExtCtrls, ComCtrls, ImgList;
type
TFormLineLost2 = class(TForm)
ListViewRep: TListView;
Panel1: TPanel;
BtnExit: TSpeedButton;
ImageList: TImageList;
procedure FormCreate(Sender: TObject);
procedure LoadDNCnt();
procedure FormShow(Sender: TObject);
procedure BtnExitClick(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
strTime:string; iLineID:integer;
end;
var
FormLineLost2: TFormLineLost2;
implementation
uses UnitMain, UnitMyModule, UnitBasic2;
{$R *.dfm}
procedure TFormLineLost2.FormCreate(Sender: TObject);
begin
ListViewRep.Columns.Add();
ListViewRep.Columns.Items[0].Caption := '变台编号';
ListViewRep.Columns.Items[0].Width := 120;
ListViewRep.Columns.Add();
ListViewRep.Columns.Items[1].Caption := '变台名称';
ListViewRep.Columns.Items[1].Width := (FormMain.Width - FormMain.mxOutlookBarPro1.Width - 155) div 4;
ListViewRep.Columns.Add();
ListViewRep.Columns.Items[2].Caption := '数据日期';
ListViewRep.Columns.Items[2].Width := (FormMain.Width - FormMain.mxOutlookBarPro1.Width - 155) div 4;
ListViewRep.Columns.Add();
ListViewRep.Columns.Items[3].Caption := '上月日期';
ListViewRep.Columns.Items[3].Width := (FormMain.Width - FormMain.mxOutlookBarPro1.Width - 155) div 4;
ListViewRep.Columns.Add();
ListViewRep.Columns.Items[4].Caption := '上月表字';
ListViewRep.Columns.Items[4].Width := (FormMain.Width - FormMain.mxOutlookBarPro1.Width - 155) div 4;
ListViewRep.Columns.Add();
ListViewRep.Columns.Items[5].Caption := '本月日期';
ListViewRep.Columns.Items[5].Width := (FormMain.Width - FormMain.mxOutlookBarPro1.Width - 155) div 4;
ListViewRep.Columns.Add();
ListViewRep.Columns.Items[6].Caption := '本月表字';
ListViewRep.Columns.Items[6].Width := (FormMain.Width - FormMain.mxOutlookBarPro1.Width - 155) div 4;
ListViewRep.Columns.Add();
ListViewRep.Columns.Items[7].Caption := '售电表字';
ListViewRep.Columns.Items[7].Width := (FormMain.Width - FormMain.mxOutlookBarPro1.Width - 155) div 4;
ListViewRep.Columns.Add();
ListViewRep.Columns.Items[8].Caption := '售电电量';
ListViewRep.Columns.Items[8].Width := (FormMain.Width - FormMain.mxOutlookBarPro1.Width - 155) div 4;
end;
procedure TFormLineLost2.LoadDNCnt();
var
i : Integer;
ListItem : TListItem;
strSQL : string;
Year, Month, Day : word;
strTime2 : string;
begin
ListViewRep.Clear;
DecodeDate(StrToDate(strTime), Year, Month, Day);
strTime2 := Format('%d-%d-%d 0:0:0', [Year, Month, Day]);
with MyModule.AdoQuery do
begin//with
Close;
SQL.Clear();
strSQL := Format('select * from tx_DN_Cnt where fd_LineID=%d and fd_Time=''%s''',
[iLineID,
strTime2]);
SQL.Add(strSQL);
try
Open();
except
ExecSQL();
end;
if RecordCount <> 0 then
begin
First();
//Last();
while not eof do
begin
ListItem := ListViewRep.Items.Add();
//fd_BianTaiID
ListItem.Caption := Trim(FieldByName('fd_BianTaiID').AsString);
//fd_Name
for i:=0 to FormBasic2.ListView.Items.Count-1 do
begin
if StrToInt(FormBasic2.ListView.Items[i].Caption) = StrToInt(ListItem.Caption) then
begin
ListItem.SubItems.Add(FormBasic2.ListView.Items[i].SubItems.Strings[0]);
break;
end;
end;
//fd_Time
DecodeDate(StrToDate(FieldByName('fd_Time').AsString), Year, Month, Day);
ListItem.SubItems.Add(Format('%04d-%02d-%02d', [Year, Month, Day]) );
//fd_Time1
ListItem.SubItems.Add(Trim(FieldByName('fd_Time1').AsString) );
//fd_Kwh1
ListItem.SubItems.Add(Trim(FieldByName('fd_Kwh1').AsString) );
//fd_Time2
ListItem.SubItems.Add(Trim(FieldByName('fd_Time2').AsString) );
//fd_Kwh2
ListItem.SubItems.Add(Trim(FieldByName('fd_Kwh2').AsString) );
//fd_Kwh_Cnt
ListItem.SubItems.Add(Trim(FieldByName('fd_Kwh_Cnt').AsString) );
//fd_Dn_Cnt
ListItem.SubItems.Add(Trim(FieldByName('fd_Dn_Cnt').AsString) );
if ( Trim(FieldByName('fd_Dn_Cnt').AsString) = '') then
begin
ListItem.ImageIndex := 1;
end
else begin
ListItem.ImageIndex := 0;
end;
//长时间操作的过程中.加上本函数可以保证系统对其他消息的响应
Application.ProcessMessages();
Next();
end; //end while
end; //end if
end; //end with
end;
procedure TFormLineLost2.FormShow(Sender: TObject);
begin
LoadDNCnt();
end;
procedure TFormLineLost2.BtnExitClick(Sender: TObject);
begin
close;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -