You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

164 lines
4.6 KiB
Plaintext

11 months ago
unit U_SetCompany;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, DB, ADODB, StdCtrls, wwdblook, Grids, Wwdbigrd, Wwdbgrid,
kbmMemTable,u_op_seae_DsWebService,SoapHTTPClient,InvokeRegistry,
bsSkinCtrls, DBCtrls, RxLookup;
type
Tfrm_SetCompany = class(TForm)
MT1: TkbmMemTable;
MT1ServerCompanyName: TStringField;
MT1LocalName: TStringField;
MT1SPXNO: TStringField;
spxcompanyDS: TDataSource;
wwDBGrid2: TwwDBGrid;
qry1: TADOQuery;
ds1: TDataSource;
bsSkinPanel3: TbsSkinPanel;
edt1: TEdit;
bsSkinButton10: TbsSkinButton;
bsSkinButton2: TbsSkinButton;
SetCompany: TADOQuery;
RxDBLookupCombo8: TRxDBLookupCombo;
procedure GetCompanyInfo(str:string);
procedure bsSkinButton10Click(Sender: TObject);
procedure bsSkinButton2Click(Sender: TObject);
procedure FormShow(Sender: TObject);
private
XML:String;
mServiceSoap_Ds:DsWebServiceSoap;
mHttpRIO_ds:THTTPRIO;
public
procedure getwebservice_ds;
end;
var
frm_SetCompany: Tfrm_SetCompany;
implementation
uses u_main,u_data_share,my_sys_function;
{$R *.dfm}
procedure Tfrm_SetCompany.GetCompanyInfo(str:string);
var _s,block:string;
aa:DsWebServiceSoap;
Companycount,_i,_j,p1,p2:integer;
begin
//<2F><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>λ<EFBFBD><CEBB>ϢXML
getwebservice_ds;
XML:=mServiceSoap_Ds.LoadAllCompany(frm_data_share.AnsiStringToWideString(str,936));
//XML:=aa.ReceiveBookingCargoSpace(_s);
Companycount:= frm_data_share.countString('Company',xml);
//result:= Opseaecount;
MT1.Close;
//MT1.EmptyTable;
//MT1.Open;
//д<><D0B4>MT1
for _i:=1 to Companycount do begin
p1:=frm_data_share.GettimePotion(_i,'<Company>',xml);
p2:=frm_data_share.GettimePotion(_i,'</Company>',xml);
block:=Copy(XML,p1,p2-p1);
MT1.Open;
MT1.Edit;
MT1.Insert;
MT1['ServerCompanyName']:=frm_data_share.GetXMLValue('Name',block);
MT1['SPXNO']:=frm_data_share.GetXMLValue('CompanyID',block);
MT1['LocalName']:='';
MT1.Post;
end;
if (Companycount=0) then begin
MT1.open;
end;
//<2F><>GetCompanyQry<72><79><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>λ<EFBFBD><CEBB>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϵͳ<CFB5><CDB3><EFBFBD>кŶ<D0BA>Ӧ<EFBFBD>Ŀͻ<C4BF><CDBB><EFBFBD><EFBFBD><EFBFBD>д<EFBFBD><D0B4>MT1
MT1.First;
qry1.close;
qry1.OPEN;
while not MT1.Eof do begin
qry1.First;
while not qry1.Eof do begin
if (qry1.FieldByName('<27><><EFBFBD><EFBFBD>ϵͳ<CFB5><CDB3><EFBFBD>к<EFBFBD>').AsString=MT1.FieldByName('SPXNO').AsString)
then begin
MT1.Edit;
MT1['LocalName']:=qry1.FieldByName('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').AsString;
MT1.Post;
//MT2.Edit;
//MT2.Delete;
//qry1.Post;
//MT2.first;
end;
qry1.Next;
end;
MT1.Next;
end;
end;
procedure Tfrm_SetCompany.getwebservice_ds;
var URL:String;
begin
try
URL:=get_WebseviceURL;
mHttpRIO_ds:=THTTPRIO.Create(nil);
mHttpRIO_ds.WSDLLocation:=URL+'?WSDL';
mHttpRIO_ds.URL:=URL;
// mHttpRIO_ds.WSDLLocation:='http://192.168.1.5:8086/webservice/DsWebService.asmx?WSDL';
// mHttpRIO_ds.URL:='http://192.168.1.5:8086/webservice/DsWebService.asmx';
mHttpRIO_ds.Port:='DsWebServiceSoap';
mHttpRIO_ds.Service:='DsWebService';
mHttpRIO_ds.HTTPWebNode.UseUTF8InHeader:=true;
InvRegistry.RegisterInvokeOptions(TypeInfo(DsWebServiceSoap),ioDocument );//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><D2BB>
mServiceSoap_Ds:=mHttpRIO_ds as DsWebServiceSoap;
except
on E:Exception do
begin
ShowMessage(e.Message);
exit;
end;
end;
end;
procedure Tfrm_SetCompany.bsSkinButton10Click(Sender: TObject);
begin
GetCompanyInfo(edt1.text);
end;
procedure Tfrm_SetCompany.bsSkinButton2Click(Sender: TObject);
begin
//<2F><><EFBFBD><EFBFBD>
//ѭ<><D1AD>MT1<54><31><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'<27><><EFBFBD>ؿͻ<D8BF><CDBB><EFBFBD><EFBFBD><EFBFBD>'<27><>ֵ <20><>ִ<EFBFBD><D6B4>setCompanyQry<72><79><EFBFBD>ö<EFBFBD><C3B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD>к<EFBFBD>
MT1.First;
while not MT1.Eof do begin
if (MT1.FieldByName('LocalName').AsString<>'') then begin
SetCompany.SQL.Clear;
SetCompany.sql.Add(' update t_crm_client set <20><><EFBFBD><EFBFBD>ϵͳ<CFB5><CDB3><EFBFBD>к<EFBFBD>='''' where <20><><EFBFBD><EFBFBD>ϵͳ<CFB5><CDB3><EFBFBD>к<EFBFBD>=:<3A><><EFBFBD><EFBFBD>ϵͳ<CFB5><CDB3><EFBFBD>к<EFBFBD>2');
SetCompany.sql.Add(' update t_crm_client set <20><><EFBFBD><EFBFBD>ϵͳ<CFB5><CDB3><EFBFBD>к<EFBFBD>=:<3A><><EFBFBD><EFBFBD>ϵͳ<CFB5><CDB3><EFBFBD>к<EFBFBD> where <20>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>=:<3A>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>');
SetCompany.Close;
SetCompany.Parameters.ParamByName('<27><><EFBFBD><EFBFBD>ϵͳ<CFB5><CDB3><EFBFBD>к<EFBFBD>').Value:=MT1.fieldbyname('SPXNO').asstring;
SetCompany.Parameters.ParamByName('<27><><EFBFBD><EFBFBD>ϵͳ<CFB5><CDB3><EFBFBD>к<EFBFBD>2').Value:=MT1.fieldbyname('SPXNO').asstring;
SetCompany.Parameters.ParamByName('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').Value:=MT1.fieldbyname('LocalName').asstring;
SetCompany.ExecSQL;
end;
MT1.Next;
end;
end;
procedure Tfrm_SetCompany.FormShow(Sender: TObject);
begin
frm_data_share.t_crm_client.close;
frm_data_share.t_crm_client.open;
end;
end.