📄 unitsubstationinfo.~pas
字号:
unit UnitSubStationInfo;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, Buttons, Global, MapXLib_TLB, AnyPoster, DBM_MSSQL,
AnyDBFactory;
type
TForm_SubStationInfo = class(TForm)
Label1: TLabel;
edStationId: TEdit;
BitBtn1: TBitBtn;
BitBtn2: TBitBtn;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
edZKPowerId: TEdit;
edGLPower1Id: TEdit;
edGLPower2Id: TEdit;
procedure BitBtn1Click(Sender: TObject);
procedure BitBtn2Click(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure edStationIdKeyPress(Sender: TObject; var Key: Char);
private
{ Private declarations }
FFeature: CMapXFeature;
FIsOk: Boolean;
FMode: TConfigMode;
FStationId: Integer;
FUnitID: Integer;
FDBFactory: TAnyDBFactory;
procedure ApplayData;
public
{ Public declarations }
property IsOk:Boolean read FIsOk;
property Mode:TConfigMode read FMode write FMode;
property UnitID:Integer read FUnitID write FUnitID;
property StationId:Integer read FStationId write FStationId;
property Feature:CMapXFeature read FFeature write FFeature;
property DBFactory:TAnyDBFactory read FDBFactory write FDBFactory;
end;
var
Form_SubStationInfo: TForm_SubStationInfo;
function NewSubStationInfo(MapX:TMapXObject; ADBFactory:TAnyDBFactory;
AUnitID:Integer; AFt:Feature):Boolean;
function ConfigSubStationInfo(MapX:TMapXObject; ADBFactory:TAnyDBFactory;
AUnitID:Integer; AFt:Feature):Boolean;
implementation
uses
ADODBTools, BusinessDialogs, WinControl, UnitProject, UnitChooseSDLine,
UnitQCAPIs, UnitDMLinks;
{$R *.dfm}
function NewSubStationInfo(MapX:TMapXObject; ADBFactory:TAnyDBFactory;
AUnitID:Integer; AFt:Feature):Boolean;
begin
with TForm_SubStationInfo.Create(nil) do
begin
try
DBFactory:=ADBFactory;
Feature:=AFt;
Mode:=cmAdd;
UnitID:=AUnitID;
ShowModal;
Result:=IsOk;
if not Result then
MyDefInformation('您已取消属性设置,如要删除图形,请手动操作!')
finally
Free;
end;
end;
end;
function ConfigSubStationInfo(MapX:TMapXObject; ADBFactory:TAnyDBFactory;
AUnitID:Integer; AFt:Feature):Boolean;
begin
with TForm_SubStationInfo.Create(nil) do
begin
try
DBFactory:=ADBFactory;
Feature:=AFt;
Mode:=cmModify;
UnitID:=AUnitID;
StationId:=StrToInt(AFt.KeyValue);
ShowModal;
Result:=IsOk;
finally
Free;
end;
end;
end;
{ TForm_SubStationInfo }
procedure TForm_SubStationInfo.ApplayData;
var
FDBPoster:TDBPosterWithSQL;
begin
FDBPoster:=FDBFactory.CreateSQLPoster;
try
PostStationRecord(Feature,
FDBPoster,
UnitID,
StrToInt(edStationId.Text),
StrToInt(edZKPowerId.Text),
StrToInt(edGLPower1Id.Text),
StrToInt(edGLPower2Id.Text),
nil,
True,
True,
True);
finally
FDBPoster.Free;
end;
FStationId:=StrToInt(edStationId.Text);
end;
procedure TForm_SubStationInfo.BitBtn1Click(Sender: TObject);
begin
if edStationId.Text='' then
WarningAbort('提示', '子站号不能为空!');
if edZKPowerId.Text='' then
WarningAbort('提示', '必须填写真空开关编号,如果无真空开关则填 "0"!');
if edGLPower1Id.Text='' then
WarningAbort('提示', '必须填写隔离开关编号,如果无隔离开关则填 "0"!');
if edGLPower2Id.Text='' then
WarningAbort('提示', '必须填写隔离开关编号,如果无隔离开关则填 "0"!');
ApplayData;
FIsOk:=True;
Close;
end;
procedure TForm_SubStationInfo.BitBtn2Click(Sender: TObject);
begin
Close;
end;
procedure TForm_SubStationInfo.FormShow(Sender: TObject);
begin
FIsOk:=False;
if Mode=cmModify then
begin
edStationId.Text:=FFeature.KeyValue;
with FDBFactory.CreateDataSet do
begin
try
SQL.Add('select OnOff1Id, OnOff2Id, OnOff3Id from PJDataBase.dbo.StationMsg');
SQL.Add('where LanDType=:LanDType and SutStationNub=:SutStationNub');
SetParamValue('LanDType', FUnitID);
SetParamValue('SutStationNub', FStationId);
Open;
if not Eof then
begin
edZKPowerId.Text:=Fields[0].AsString;
edGLPower1Id.Text:=Fields[1].AsString;
edGLPower2Id.Text:=Fields[2].AsString;
end;
finally
Free;
end;
end;
end;
end;
procedure TForm_SubStationInfo.FormCreate(Sender: TObject);
begin
FStationId:=-1;
end;
procedure TForm_SubStationInfo.edStationIdKeyPress(Sender: TObject;
var Key: Char);
begin
IntegerEditKeyPress(TEdit(Sender), Key);
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -