⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 unitqcapis.~pas

📁 此代码是关于mapgis的在
💻 ~PAS
字号:
unit UnitQCAPIs;

interface

uses
  SysUtils, MapXLib_TLB, MapXAPIs, ComCtrls, ActiveX, Variants, AnyPoster;

{提交开关记录}
procedure PostPowerRecord(Ft: Feature; ADBPoster:TDBPosterWithSQL;
  const UnitID, DotId:Integer; const DotName:string;
  const DotType:Integer; const KgState:Boolean; const Script:string;
  newrvs:RowValues; const PostLocal, PostDB, InitPoster:Boolean);
{提交线路记录}
procedure PostLineRecord(Ft: Feature; ADBPoster:TDBPosterWithSQL;
  const UnitID, LineId: Integer; const LineName: string;
  const Length: Single; const Script: string; newrvs: RowValues;
  const PostLocal, PostDB, InitPoster: Boolean);
{提交子站记录}
procedure PostStationRecord(Ft: Feature; ADBPoster:TDBPosterWithSQL;
  const UnitID, StationId, ZKPowerId, GLPower1Id, GLPower2Id: Integer;
  newrvs: RowValues; const PostLocal, PostDB, InitPoster: Boolean);
  
implementation

procedure PostPowerRecord(Ft: Feature; ADBPoster:TDBPosterWithSQL;
  const UnitID, DotId:Integer; const DotName:string;
  const DotType:Integer; const KgState:Boolean; const Script:string;
  newrvs:RowValues; const PostLocal, PostDB, InitPoster:Boolean);
begin
  if PostLocal then
  begin
    if newrvs=nil then
      newrvs:=CreateRowValuesFromStruct(Ft.Layer.DataSets.Item[1].Fields,
                                        Ft.Layer.DataSets.Item[1]);
    
    newrvs.Item['DotID'].Value:=DotId;
    newrvs.Item['DotName'].Value:=DotName;
    newrvs.Item['Type'].Value:=DotType;
    newrvs.Item['KgState'].Value:=KgState;
    newrvs.Item['Script'].Value:=Script;
    Ft.Update(EmptyParam, newrvs);
  end;

  if PostDB then
  begin
    if InitPoster then
    begin
      ADBPoster.TableName:='t_CtrlDotsLayer';
      ADBPoster.SetInsertFields('UnitID,DotID,DotName,Type,KgState,Script');
      ADBPoster.SetModifyFields('DotName,Type,KgState,Script');
      ADBPoster.WhereSQL.Text:='DotID=:DotID';
    end;
  
    ADBPoster.SetCustomValue('UnitID', UnitID);
    ADBPoster.SetCustomValue('DotID', DotId);
    ADBPoster.SetCustomValue('DotName', DotName);
    ADBPoster.SetCustomValue('Type', DotType);
    ADBPoster.SetCustomValue('KgState', KgState);
    ADBPoster.SetCustomValue('Script', Script);
    ADBPoster.SetParamValue('DotID', DotId);
    ADBPoster.IniPost;
  end;
end;

procedure PostLineRecord(Ft: Feature; ADBPoster:TDBPosterWithSQL;
  const UnitID, LineId: Integer; const LineName: string;
  const Length: Single; const Script: string; newrvs: RowValues;
  const PostLocal, PostDB, InitPoster: Boolean);
begin
  if PostLocal then
  begin
    if newrvs=nil then
      newrvs:=CreateRowValuesFromStruct(Ft.Layer.DataSets.Item[1].Fields,
                                        Ft.Layer.DataSets.Item[1]);
    
    newrvs.Item['LineID'].Value:=LineId;
    newrvs.Item['LineName'].Value:=LineName;
    newrvs.Item['Length'].Value:=Length;
    newrvs.Item['Script'].Value:=Script;
    Ft.Update(EmptyParam, newrvs);
  end;

  if PostDB then
  begin
    if InitPoster then
    begin
      ADBPoster.TableName:='t_LinesLayer';
      ADBPoster.SetInsertFields('UnitID,LineID,LineName,Length,Script');
      ADBPoster.SetModifyFields('LineName,Length,Script');
      ADBPoster.WhereSQL.Text:='LineID=:LineID';
    end;

    ADBPoster.SetCustomValue('UnitID', UnitID);
    ADBPoster.SetCustomValue('LineID', LineId);
    ADBPoster.SetCustomValue('LineName', LineName);
    ADBPoster.SetCustomValue('Length', Length);
    ADBPoster.SetCustomValue('Script', Script);
    ADBPoster.SetParamValue('LineID', LineID);
    ADBPoster.IniPost;
  end;
end;

procedure PostStationRecord(Ft: Feature; ADBPoster:TDBPosterWithSQL;
  const UnitID, StationId, ZKPowerId, GLPower1Id, GLPower2Id: Integer;
  newrvs: RowValues; const PostLocal, PostDB, InitPoster: Boolean);
begin
  if PostLocal then
  begin
    if newrvs=nil then
      newrvs:=CreateRowValuesFromStruct(Ft.Layer.DataSets.Item[1].Fields,
                                        Ft.Layer.DataSets.Item[1]);
    
    newrvs.Item['StationID'].Value:=StationId;
    newrvs.Item['StationName'].Value:=IntToStr(StationId)+'号子站';
    newrvs.Item['ZKPowerId'].Value:=ZKPowerId;
    newrvs.Item['GLPower1Id'].Value:=GLPower1Id;
    newrvs.Item['GLPower2Id'].Value:=GLPower2Id;
    Ft.Update(EmptyParam, newrvs);
  end;

  if PostDB then
  begin
    if InitPoster then
    begin
      ADBPoster.TableName:='PJDataBase.dbo.StationMsg';
      ADBPoster.SetModifyFields('OnOff1Id,OnOff2Id,OnOff3Id');
      ADBPoster.WhereSQL.Text:='LanDType=:LanDType and SutStationNub=:SutStationNub';
    end;

    ADBPoster.SetCustomValue('OnOff1Id', ZKPowerId);
    ADBPoster.SetCustomValue('OnOff2Id', GLPower1Id);
    ADBPoster.SetCustomValue('OnOff3Id', GLPower2Id);
    ADBPoster.SetParamValue('LanDType', UnitID);
    ADBPoster.SetParamValue('SutStationNub', StationId);
    ADBPoster.CheckEditPost;
  end;
end;

end.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -