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

📄 uwritegoodsbizdm.pas

📁 物流供应链管理系统
💻 PAS
字号:
unit uWriteGoodsBizDm;

{$WARN SYMBOL_PLATFORM OFF}

interface

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

type
  TmtsWriteGoodsBizObj = class(TMtsDataModule, ImtsWriteGoodsBizObj)
    DCOMConGoods: TDCOMConnection;
    cdsGoodsMaster: TClientDataSet;
    cdsGoodsCate: TClientDataSet;
    cdsVendor: TClientDataSet;
    DCOMConGoodsCate: TDCOMConnection;
    DCOMConVendor: TDCOMConnection;
    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;
    procedure UpdateGoods(ADatas: OleVariant); safecall;
    procedure UpdateGoodsCate(ADatas: OleVariant); safecall;
    function QueryGoodsCate: OleVariant; safecall;
    function QueryVendor: OleVariant; safecall;
  public
    { Public declarations }
  end;

var
  mtsWriteGoodsBizObj: TmtsWriteGoodsBizObj;

implementation
uses BizDBConfig, uBizGlobal;
{$R *.DFM}

class procedure TmtsWriteGoodsBizObj.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 TmtsWriteGoodsBizObj.UpdateGoods(ADatas: OleVariant);
var
  eCount: integer;
  OwnerData: OleVariant;
begin
  try
    DCOMConGoods.Connected := true;
    DCOMConGoodsCate.GetServer.AS_ApplyUpdates(cdsGoodsMaster.ProviderName,
      ADatas, 0, ecount, OwnerData);

    SetComplete;
    DCOMConGoods.Connected := false;
  except
    SetAbort;
    DCOMConGoods.Connected := false;
    raise;
  end;
end;

procedure TmtsWriteGoodsBizObj.UpdateGoodsCate(ADatas: OleVariant);
var
  ecount: integer;
  OwnerData: OleVariant;
begin
  try
    DCOMConGoodsCate.Connected := true;
    DCOMConGoodsCate.GetServer.AS_ApplyUpdates(cdsGoodsCate.ProviderName,
      ADatas, 0, ecount, OwnerData);
    SetComplete;
    DCOMConGoodsCate.Connected := false;
  except
    SetAbort;
    DCOMConGoodsCate.Connected := false;
    raise;
  end;
end;

function TmtsWriteGoodsBizObj.QueryGoodsCate: OleVariant;
begin
  try
    DCOMConGoodsCate.Connected := true;
    cdsGoodsCate.Active := true;
    result := cdsGoodsCate.Data;
    cdsGoodsCate.Active := false;
  finally
    DCOMConGoodsCate.Connected := false;
  end;
end;

function TmtsWriteGoodsBizObj.QueryVendor: OleVariant;
begin
  try
    DCOMConVendor.Connected := true;
    cdsVendor.Active := true;
    result := cdsVendor.Data;
    cdsVendor.Active := false;
  finally
    DCOMConVendor.Connected := false;
  end;
end;

procedure TmtsWriteGoodsBizObj.MtsDataModuleActivate(Sender: TObject);
begin

  DCOMConGoods.Connected := true;
end;

procedure TmtsWriteGoodsBizObj.MtsDataModuleDeactivate(Sender: TObject);
begin
  DCOMConGoods.Connected := false;
end;

procedure TmtsWriteGoodsBizObj.MtsDataModuleCreate(Sender: TObject);
begin
  DCOMConGoods.ComputerName := GetComputerName;
end;

initialization
  TComponentFactory.Create(ComServer, TmtsWriteGoodsBizObj,
    Class_mtsWriteGoodsBizObj, ciMultiInstance, tmApartment);
end.

⌨️ 快捷键说明

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