goodsdm.pas

来自「非常地全面完整的物流供应链管理系统 包含全部的需求文档」· PAS 代码 · 共 86 行

PAS
86
字号
unit GoodsDm;

{$WARN SYMBOL_PLATFORM OFF}

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  ComServ, ComObj, VCLCom, StdVcl, bdemts, DataBkr, DBClient,
  MtsRdm, Mtx, GoodsData_TLB, Provider, DB, ADODB;

type
  TmtsGoodsObj = class(TMtsDataModule, ImtsGoodsObj)
    ADOConnection: TADOConnection;
    dspGoodsMaster: TDataSetProvider;
    ADOTGoodsMaster: TADOTable;
    ADOTGoodsSlave: TADOTable;
    dspGoodsSlave: TDataSetProvider;
    ADOTVendor: TADOTable;
    dspVendor: TDataSetProvider;
    dspABCCate: TDataSetProvider;
    ADOTABCCate: TADOTable;
    ADOTGoodsCate: TADOTable;
    dspGoodsCate: TDataSetProvider;
    procedure MtsDataModuleActivate(Sender: TObject);
    procedure MtsDataModuleDeactivate(Sender: TObject);
    procedure MtsDataModuleCreate(Sender: TObject);
  private
    { Private declarations }
  protected
    class procedure UpdateRegistry(Register: Boolean; const ClassID, ProgID: string); override;
  public
    { Public declarations }
  end;

var
  mtsGoodsObj: TmtsGoodsObj;

implementation
uses uDBConfig, uGlobal;
{$R *.DFM}

class procedure TmtsGoodsObj.UpdateRegistry(Register: Boolean; const ClassID, ProgID: string);
begin
  if Register then
  begin
    inherited UpdateRegistry(Register, ClassID, ProgID);
    EnableSocketTransport(ClassID);
    EnableWebTransport(ClassID);
  end else
  begin
    DisableSocketTransport(ClassID);
    DisableWebTransport(ClassID);
    inherited UpdateRegistry(Register, ClassID, ProgID);
  end;
end;

procedure TmtsGoodsObj.MtsDataModuleActivate(Sender: TObject);
begin
  try
    ADOConnection.Connected := true;
    ADOTGoodsMaster.Active := true;
    ADOTGoodsSlave.Active := true;
    ADOTVendor.Active := true;
    ADOTABCCate.Active := true;
    ADOTGoodsCate.Active := true;
  except
    raise Exception.Create(ERRORDBCONNECT);
  end;
end;

procedure TmtsGoodsObj.MtsDataModuleDeactivate(Sender: TObject);
begin
  ADOConnection.Connected := false;
end;

procedure TmtsGoodsObj.MtsDataModuleCreate(Sender: TObject);
begin
  ADOConnection.Close;
  ADOConnection.ConnectionString := GetConnectionString;
end;

initialization
  TComponentFactory.Create(ComServer, TmtsGoodsObj,
    CLASS_mtsGoodsObj, ciMultiInstance, tmApartment);
end.

⌨️ 快捷键说明

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