📄 rpttable.pas
字号:
CurrentLine:=-1;
PM_Cell.Items[8].Enabled:=False;
PM_Cell.Items[9].Enabled:=False;
end;
end
else
begin
PM_Cell.Items[8].Enabled:=False;
PM_Cell.Items[9].Enabled:=False;
end;
end;
Application.ProcessMessages;
end;
end;
end;
procedure TFrm_Table.N7Click(Sender: TObject);
begin
if CurrentLine<Content.Body.Count then
Content.Body.Insert(CurrentLine,'');
BindData(PageIndex);
PM_Cell.Items[8].Enabled:=false;
StatusBar.Panels[2].Text:='操作:插入空白行';
end;
procedure TFrm_Table.N8Click(Sender: TObject);
begin
if CurrentLine<Content.Body.Count then
Content.Body.Delete(CurrentLine);
BindData(PageIndex);
StatusBar.Panels[2].Text:='操作:删除一行';
end;
procedure TFrm_Table.FormActivate(Sender: TObject);
begin
BindData(PageIndex);
end;
procedure TFrm_Table.ED_NumChange(Sender: TObject);
begin
if trim(ED_NUM.Text)<>'' then
begin
if UpperCase(ADOTable.TableName)='KG_VIEW' then
Self.ADOTable.Filter:='KG.开关编号 like ''%'+Trim(ED_NUM.Text)+'%'''
else
Self.ADOTable.Filter:='开关编号 like ''%'+Trim(ED_NUM.Text)+'%''';
end
else ADOTable.Filter:='';
end;
procedure TFrm_Table.ED_NumKeyPress(Sender: TObject; var Key: Char);
begin
if key=#13 then
Self.DBGrid.SetFocus;
end;
procedure TFrm_Table.LB_CZKeyPress(Sender: TObject; var Key: Char);
begin
if key=#13 then
ED_NUM.SetFocus;
end;
procedure TFrm_Table.LB_CZDblClick(Sender: TObject);
var
s,Temp:WideString;
count:Integer;
begin
if LB_CZ.ItemIndex=0 then
begin
s:='检查'+content.Title+'无送电障碍';
count:=pos('线路停电',s);
if count>0 then
begin
Temp:=copy(s,0,count-1)+copy(s,Count+4,Length(s)-Count-4+1);
s:=temp;
end;
count:=pos('线路送电',s);
if count>0 then
begin
Temp:=copy(s,0,count-1)+copy(s,Count+4,Length(s)-Count-4+1);
s:=temp;
end;
count:=pos('改变运行方式',s);
if count>0 then
begin
Temp:=copy(s,0,count-1)+copy(s,Count+6,Length(s)-Count-6+1);
s:=temp;
end;
count:=pos('恢复运行方式',s);
if count>0 then
begin
Temp:=copy(s,0,count-1)+copy(s,Count+6,Length(s)-Count-6+1);
s:=temp;
end;
if (CurrentLine>=0) and (CurrentLine<content.Body.Count) and(trim(content.Body[CurrentLine])='') then
begin
content.Body[CurrentLine]:=s;
end
else
begin
content.Body.Add(s);
if (CurrentLine=content.Body.Count-1) then CurrentLine:=CurrentLine+1;
AddPage;
end;
end;
BindData(PageIndex);
end;
procedure TFrm_Table.LB_CZClick(Sender: TObject);
begin
//初始化
ED_NUM.Text:='';
DBGrid.Columns[1].FieldName:='';
DBGrid.Columns[0].FieldName:='';
Self.ADOTable.Filter:='';
if ADOTable.Active=true then ADOTable.Active:=False;
case LB_CZ.ItemIndex of
1://合上[]甲 刀 闸
begin
Self.ADOTable.TableName:='XLKG_View';
DBGrid.Columns[1].FieldName:='开关编号';
DBGrid.Columns[0].FieldName:='开关名称';
end;
2://合上[]乙 刀 闸
begin
Self.ADOTable.TableName:='XLKG_View';
DBGrid.Columns[1].FieldName:='开关编号';
DBGrid.Columns[0].FieldName:='开关名称';
end;
3: //合上[]开关(刀闸)
begin
Self.ADOTable.TableName:='XLKG_View';
DBGrid.Columns[1].FieldName:='开关编号';
DBGrid.Columns[0].FieldName:='开关名称';
end;
4: //拉开[]开关(刀闸)
begin
Self.ADOTable.TableName:='XLKG_View';
DBGrid.Columns[1].FieldName:='开关编号';
DBGrid.Columns[0].FieldName:='开关名称';
prefix:='拉开';
suffix:=',检查在开位';
end;
5://拉开[]乙 刀 闸
begin
Self.ADOTable.TableName:='XLKG_View';
DBGrid.Columns[1].FieldName:='开关编号';
DBGrid.Columns[0].FieldName:='开关名称';
end;
6://拉开[]甲 刀 闸
begin
Self.ADOTable.TableName:='XLKG_View';
DBGrid.Columns[1].FieldName:='开关编号';
DBGrid.Columns[0].FieldName:='开关名称';
end;
7://检查[]开关(刀闸)开位
begin
Self.ADOTable.TableName:='XLKG_View';
DBGrid.Columns[1].FieldName:='开关编号';
DBGrid.Columns[0].FieldName:='开关名称';
end;
8://检查[]甲刀闸开位
begin
Self.ADOTable.TableName:='XLKG_View';
DBGrid.Columns[1].FieldName:='开关编号';
DBGrid.Columns[0].FieldName:='开关名称';
end;
9://检查[]乙刀闸开位
begin
Self.ADOTable.TableName:='XLKG_View';
DBGrid.Columns[1].FieldName:='开关编号';
DBGrid.Columns[0].FieldName:='开关名称';
end;
10://待令[]停 电
begin
Self.ADOTable.TableName:='KG_View';
DBGrid.Columns[1].FieldName:='kG.开关编号';
DBGrid.Columns[1].Title.Caption:='开关编号';
DBGrid.Columns[0].FieldName:='开关名称';
end;
11: //待令[]送 电
begin
Self.ADOTable.TableName:='KG_View';
DBGrid.Columns[1].FieldName:='kG.开关编号';
DBGrid.Columns[1].Title.Caption:='开关编号';
DBGrid.Columns[0].FieldName:='开关名称';
end;
12://待令[]装安措
begin
Self.ADOTable.TableName:='KG_View';
DBGrid.Columns[1].FieldName:='kG.开关编号';
DBGrid.Columns[1].Title.Caption:='开关编号';
DBGrid.Columns[0].FieldName:='开关名称';
end;
13: // 待令[]拆安措
begin
Self.ADOTable.TableName:='KG_View';
DBGrid.Columns[1].FieldName:='KG.开关编号';
DBGrid.Columns[1].Title.Caption:='开关编号';
DBGrid.Columns[0].FieldName:='开关名称';
end;
14:// 转出[]变压器负荷
begin
Self.ADOTable.TableName:='ZCZH';
DBGrid.Columns[0].FieldName:='开关编号';
end;
15://转回[]变压器负荷
begin
Self.ADOTable.TableName:='ZCZH';
DBGrid.Columns[0].FieldName:='开关编号';
end;
16://减去[]变压器负荷
begin
Self.ADOTable.TableName:='XLKG_View';
DBGrid.Columns[1].FieldName:='开关编号';
DBGrid.Columns[0].FieldName:='开关名称';
end;
17://送上[]变压器负荷
begin
Self.ADOTable.TableName:='XLKG_View';
DBGrid.Columns[1].FieldName:='开关编号';
DBGrid.Columns[0].FieldName:='开关名称';
end;
18://拉开[]户外刀闸
begin
Self.ADOTable.TableName:='HWKG';
DBGrid.Columns[1].FieldName:='开关编号';
DBGrid.Columns[0].FieldName:='开关名称';
end;
19://合上[]户外刀闸
begin
Self.ADOTable.TableName:='HWKG';
DBGrid.Columns[1].FieldName:='开关编号';
DBGrid.Columns[0].FieldName:='开关名称';
end;
else ;
end;
if Self.ADOTable.TableName<>'' then
begin
DBGrid.Columns[0].Width:=100;
Self.ADOTable.Active:=true;
Self.ADOTable.Filtered:=true;
end;
end;
procedure TFrm_Table.DBGridDblClick(Sender: TObject);
var
MidStr,TableName,KGLX,TableKind,Filter:string;
TS:TStrings;
i:integer;
begin
TS:=TStringList.Create;
//获取筛选条件
TableName:=UpperCase(ADOTable.TableName);
if (TableName='KG_VIEW') or (TableName='XLKG_VIEW') then
KGLX:=ADOTable.FieldByName('开关类型').AsString;
if TableName='KG_VIEW' then
MidStr:=ADOTable.FieldByName('KG.开关编号').AsString
else
MidStr:=ADOTable.FieldByName('开关编号').AsString;
if(TableName<>'ZCZH') then
MidStr:=ADOTable.FieldByName('开关名称').AsString+MidStr;
if (LB_CZ.ItemIndex>=10) and (LB_CZ.ItemIndex<=13) then
MidStr:=ADOTable.FieldByName('变电所名称').AsString+MidStr;
if pos('VIEW',TableName)>0 then
TableKind:=copy(TableName,0,Length(TableName)-5)//去掉'view'
else TableKind:=TableName;
Filter:='操作选项='''+inttostr(LB_CZ.ItemIndex)+''' and 表类型='''+TableKind+''' and 开关类型='''+KGLX+'''';
ADOQuery.SQL.Text:='select * from dzczzh where '+Filter;
ADOQuery.Open;
if ADOQuery.RecordCount=0 then
begin
Filter:='操作选项='''+inttostr(LB_CZ.ItemIndex)+''' and 表类型='''+TableKind+''' and 开关类型 =''0''';
ADOQuery.SQL.Text:='select * from dzczzh where '+Filter;
ADOQuery.Open;
end;
ADOQuery.First;
while not ADOQuery.Eof do
begin
TS.Add(ADOQuery.FieldByName('前缀').AsString+MidStr+ADOQuery.FieldByName('后缀').AsString) ;
ADOQuery.Next;
end;
if (CurrentLine>=0) and (CurrentLine<content.Body.Count) and(trim(content.Body[CurrentLine])='') then
begin
for i:=0 to TS.Count-1 do
begin
if (CurrentLine+i<content.Body.Count) and(trim(content.Body[CurrentLine+i])='') then
content.Body[CurrentLine+i]:=TS[i]
else
content.Body.Insert(CurrentLine+i,TS[i]);
end;
end
else
begin
for i:=0 to TS.Count-1 do
begin
content.Body.Add(TS[i]);
AddPage;
end;
if (CurrentLine=content.Body.Count-1) then CurrentLine:=CurrentLine+1;
end;
BindData(PageIndex);
TS.Free;
end;
procedure TFrm_Table.DBGridKeyPress(Sender: TObject; var Key: Char);
var
MidStr,TableName,KGLX,TableKind,Filter:string;
TS:TStrings;
i:integer;
begin
if key=#13 then
begin
TS:=TStringList.Create;
//获取筛选条件
TableName:=UpperCase(ADOTable.TableName);
if (TableName='KG_VIEW') or (TableName='XLKG_VIEW') then
KGLX:=ADOTable.FieldByName('开关类型').AsString;
if TableName='KG_VIEW' then
MidStr:=ADOTable.FieldByName('KG.开关编号').AsString
else
MidStr:=ADOTable.FieldByName('开关编号').AsString;
if(TableName<>'ZCZH') then
MidStr:=ADOTable.FieldByName('开关名称').AsString+MidStr;
if (LB_CZ.ItemIndex>=10) and (LB_CZ.ItemIndex<=13) then
MidStr:=ADOTable.FieldByName('变电所名称').AsString+MidStr;
if pos('VIEW',TableName)>0 then
TableKind:=copy(TableName,0,Length(TableName)-5)//去掉'view'
else TableKind:=TableName;
Filter:='操作选项='''+inttostr(LB_CZ.ItemIndex)+''' and 表类型='''+TableKind+''' and 开关类型='''+KGLX+'''';
ADOQuery.SQL.Text:='select * from dzczzh where '+Filter;
ADOQuery.Open;
if ADOQuery.RecordCount=0 then
begin
Filter:='操作选项='''+inttostr(LB_CZ.ItemIndex)+''' and 表类型='''+TableKind+''' and 开关类型 =''0''';
ADOQuery.SQL.Text:='select * from dzczzh where '+Filter;
ADOQuery.Open;
end;
ADOQuery.First;
while not ADOQuery.Eof do
begin
TS.Add(ADOQuery.FieldByName('前缀').AsString+MidStr+ADOQuery.FieldByName('后缀').AsString) ;
ADOQuery.Next;
end;
if (CurrentLine>=0) and (CurrentLine<content.Body.Count) and(trim(content.Body[CurrentLine])='') then
begin
for i:=0 to TS.Count-1 do
begin
if (CurrentLine+i<content.Body.Count) and(trim(content.Body[CurrentLine+i])='') then
content.Body[CurrentLine+i]:=TS[i]
else
content.Body.Insert(CurrentLine+i,TS[i]);
end;
end
else
begin
for i:=0 to TS.Count-1 do
begin
content.Body.Add(TS[i]);
AddPage;
end;
if (CurrentLine=content.Body.Count-1) then CurrentLine:=CurrentLine+1;
end;
BindData(PageIndex);
TS.Free;
end;
end;
procedure TFrm_Table.N1Click(Sender: TObject);
begin
StatusBar.Panels[2].Text:='操作:撤消';
end;
procedure TFrm_Table.N2Click(Sender: TObject);
begin
StatusBar.Panels[2].Text:='操作:剪切选中文本';
end;
procedure TFrm_Table.N3Click(Sender: TObject);
begin
StatusBar.Panels[2].Text:='操作:复制选中文本';
end;
procedure TFrm_Table.N4Click(Sender: TObject);
begin
StatusBar.Panels[2].Text:='操作:粘贴';
end;
procedure TFrm_Table.D1Click(Sender: TObject);
begin
StatusBar.Panels[2].Text:='操作:删除选中文本';
end;
procedure TFrm_Table.N9Click(Sender: TObject);
begin
StatusBar.Panels[2].Text:='操作:全选当前行文本';
end;
procedure TFrm_Table.DetailBand1AfterPrint(Sender: TQRCustomBand;
BandPrinted: Boolean);
begin
//QuickRep1.NewPage;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -