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

This file contains invisible Unicode characters!

This file contains invisible Unicode characters that may be processed differently from what appears below. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to reveal hidden characters.

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

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
//»ñÈ¡ÍùÀ´µ¥Î»ÐÅÏ¢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;
//дÈë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;
//´ÓGetCompanyQryÖÐÖð¸ö¶ÁÈ¡±¾µØÍùÀ´µ¥Î»ÐÅÏ¢£¬½«¶©²ÕϵͳÐòÁкŶÔÓ¦µÄ¿Í»§¼ò³ÆдÈëMT1
MT1.First;
qry1.close;
qry1.OPEN;
while not MT1.Eof do begin
qry1.First;
while not qry1.Eof do begin
if (qry1.FieldByName('¶©²ÕϵͳÐòÁкÅ').AsString=MT1.FieldByName('SPXNO').AsString)
then begin
MT1.Edit;
MT1['LocalName']:=qry1.FieldByName('¿Í»§¼ò³Æ').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 );//¾ÍÊÇÕâÒ»ÐÐ
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
//±£´æ
//Ñ­»·MT1£¬Èç¹û'±¾µØ¿Í»§¼ò³Æ'ÓÐÖµ ÔòÖ´ÐÐsetCompanyQryÉèÖö©²ÕÐòÁкÅ
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 ¶©²ÕϵͳÐòÁкÅ='''' where ¶©²ÕϵͳÐòÁкÅ=:¶©²ÕϵͳÐòÁкÅ2');
SetCompany.sql.Add(' update t_crm_client set ¶©²ÕϵͳÐòÁкÅ=:¶©²ÕϵͳÐòÁкŠwhere ¿Í»§¼ò³Æ=:¿Í»§¼ò³Æ');
SetCompany.Close;
SetCompany.Parameters.ParamByName('¶©²ÕϵͳÐòÁкÅ').Value:=MT1.fieldbyname('SPXNO').asstring;
SetCompany.Parameters.ParamByName('¶©²ÕϵͳÐòÁкÅ2').Value:=MT1.fieldbyname('SPXNO').asstring;
SetCompany.Parameters.ParamByName('¿Í»§¼ò³Æ').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.