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.

239 lines
6.7 KiB
Plaintext

11 months ago
unit U_SelectLinkMan;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, DB, ADODB, Grids, DBGrids,u_op_seae_DsWebService,my_sys_function,
kbmMemTable, dxExEdtr, dxTL, dxDBCtrl, dxDBGrid, dxCntner, StdCtrls,
bsSkinCtrls,SoapHTTPClient,InvokeRegistry;
type
Tfrm_SelectLinkMan = class(TForm)
ds1: TDataSource;
MT1: TkbmMemTable;
MT1UserID: TStringField;
MT1USERNAME: TStringField;
MT1Mobile: TStringField;
MT1Companyid: TStringField;
dxDBGrid1: TdxDBGrid;
dxDBGrid1Column1: TdxDBGridColumn;
dxDBGrid1Column2: TdxDBGridColumn;
bsSkinPanel3: TbsSkinPanel;
edt1: TEdit;
Label1: TLabel;
dxDBGrid1Column3: TdxDBGridColumn;
MT1Email: TStringField;
SaveQry: TADOQuery;
edt2: TEdit;
Label2: TLabel;
bsSkinButton8: TbsSkinButton;
Label3: TLabel;
GetQry: TADOQuery;
SaveQry2: TADOQuery;
procedure FormShow(Sender: TObject);
procedure dxDBGrid1DblClick(Sender: TObject);
procedure edt1KeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
procedure bsSkinButton8Click(Sender: TObject);
private
XML:String;
mServiceSoap_Ds:DsWebServiceSoap;
mHttpRIO_ds:THTTPRIO;
procedure SaveUserInfo;
public
procedure GetUserInfo;
procedure GetCurrUserInfo;
procedure getwebservice_ds;
end;
var
frm_SelectLinkMan: Tfrm_SelectLinkMan;
implementation
uses crm_spxcompany, u_data_share,u_main;
{$R *.dfm}
procedure Tfrm_SelectLinkMan.FormShow(Sender: TObject);
var
str:widestring;
begin
GetCurrUserInfo;
end;
procedure Tfrm_SelectLinkMan.GetUserInfo;
var _s,url,block,XML,str,PWD:string;
UserCount,_i,_j,p1,p2:integer;
begin
getwebservice_ds;
str:=edt1.Text;
PWD:=edt2.text;
XML:=mServiceSoap_Ds.SearchUser(frm_data_share.AnsiStringToWideString(str,936),frm_data_share.AnsiStringToWideString(PWD,936));
UserCount:= frm_data_share.countString('User',xml);
if (UserCount>0) then begin
MT1.Close;
//д<><D0B4>MT1
for _i:=1 to UserCount do begin
p1:=frm_data_share.GettimePotion(_i,'<User>',xml);
p2:=frm_data_share.GettimePotion(_i,'</User>',xml);
block:=Copy(XML,p1,p2-p1);
MT1.Open;
MT1.Edit;
MT1.Insert;
MT1['UserID']:=frm_data_share.GetXMLValue('UserID',block);
MT1['USERNAME']:=frm_data_share.GetXMLValue('USERNAME',block);
MT1['Mobile']:=frm_data_share.GetXMLValue('Mobile',block);
MT1['Companyid']:=frm_data_share.GetXMLValue('Companyid',block);
MT1['Email']:=frm_data_share.GetXMLValue('Email',block);
MT1.Post;
end;
end;
end;
procedure Tfrm_SelectLinkMan.dxDBGrid1DblClick(Sender: TObject);
var _t_employee:string;
begin
end;
procedure Tfrm_SelectLinkMan.edt1KeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
if (Key=13) then begin
bsSkinButton8Click(self);
end;
end;
procedure Tfrm_SelectLinkMan.bsSkinButton8Click(Sender: TObject);
var _s,url,block,XML,str,PWD:string;
UserCount,_i,_j,p1,p2:integer;
begin
if (edt1.text='') and (edt2.text='') then begin
if MessageDlg('<27><><EFBFBD><EFBFBD>дshippingbox<6F><78>¼<EFBFBD><C2BC>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD>ͬ<EFBFBD><CDAC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD>ǰ<EFBFBD>û<EFBFBD><C3BB><EFBFBD>ͬ<EFBFBD><CDAC><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2>ȷ<EFBFBD><C8B7><EFBFBD><EFBFBD>',mtWarning,[mbyes,mbno],0)=mryes then
begin
//<2F>ÿ<EFBFBD>ֵͬ<D6B5><CDAC><EFBFBD><EFBFBD>ǰ<EFBFBD><C7B0>Ϣ
MT1.Delete;
MT1.Open;
MT1.Edit;
MT1.Insert;
MT1['UserID']:='';
MT1['USERNAME']:='';
MT1['Mobile']:='';
MT1['Companyid']:='';
MT1['Email']:='';
MT1.Post;
SaveQry2.Close;
SaveQry2.Parameters.ParamByName('UserID').Value:=MT1.fieldbyname('UserID').asstring;
SaveQry2.Parameters.ParamByName('<27><><EFBFBD><EFBFBD>').Value:=employee;
SaveQry2.ExecSQL;
showmessage('ȡ<><C8A1><EFBFBD>ɹ<EFBFBD>');
frm_data_share.t_load_employee.close;
frm_data_share.t_load_employee.Parameters.ParamByName('<27><><EFBFBD><EFBFBD>').Value:=employee;
frm_data_share.t_load_employee.open;
end;
end else
if (length(trim(edt1.text))<8) or (pos('@',edt1.text)=-1) then begin
showmessage('<27><><EFBFBD><EFBFBD>ȷ<EFBFBD><C8B7>дshippingbox<6F>ĵ<EFBFBD>½<EFBFBD>û<EFBFBD><C3BB><EFBFBD>');
end else begin
GetUserInfo;
SaveUserInfo;
end;
end;
procedure Tfrm_SelectLinkMan.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_SelectLinkMan.SaveUserInfo;
var _t_employee:string;
begin
//employee
if (MT1.RecordCount>0) then begin
SaveQry.Close;
SaveQry.Parameters.ParamByName('UserID').Value:=MT1.fieldbyname('UserID').asstring;
SaveQry.Parameters.ParamByName('Mobile').Value:=MT1.fieldbyname('Mobile').asstring;
SaveQry.Parameters.ParamByName('<27><><EFBFBD><EFBFBD>').Value:=employee;
SaveQry.ExecSQL;
showmessage('ͬ<><CDAC><EFBFBD>ɹ<EFBFBD>');
_t_employee:=employee;
frm_data_share.t_load_employee.close;
frm_data_share.t_load_employee.Parameters.ParamByName('<27><><EFBFBD><EFBFBD>').Value:=_t_employee;
frm_data_share.t_load_employee.open;
end;
end;
procedure Tfrm_SelectLinkMan.GetCurrUserInfo;
var _s,url,block,XML,str,PWD,SPXNO:string;
UserCount,_i,_j,p1,p2:integer;
begin
getwebservice_ds;
str:=edt1.Text;
PWD:=edt2.text;
getqry.close;
getqry.Parameters.ParamByName('<27><><EFBFBD><EFBFBD>').Value:=employee;
getqry.open;
SPXNO:=getqry.fieldbyname('<27><><EFBFBD><EFBFBD>ϵͳ<CFB5><CDB3><EFBFBD>к<EFBFBD>').asstring;
XML:=mServiceSoap_Ds.GetCurrUserInfo(frm_data_share.AnsiStringToWideString(SPXNO,936));
UserCount:= frm_data_share.countString('User',xml);
MT1.Close;
//д<><D0B4>MT1
for _i:=1 to UserCount do begin
p1:=frm_data_share.GettimePotion(_i,'<User>',xml);
p2:=frm_data_share.GettimePotion(_i,'</User>',xml);
block:=Copy(XML,p1,p2-p1);
MT1.Open;
MT1.Edit;
MT1.Insert;
MT1['UserID']:=frm_data_share.GetXMLValue('UserID',block);
MT1['USERNAME']:=frm_data_share.GetXMLValue('USERNAME',block);
MT1['Mobile']:=frm_data_share.GetXMLValue('Mobile',block);
MT1['Companyid']:=frm_data_share.GetXMLValue('Companyid',block);
MT1['Email']:=frm_data_share.GetXMLValue('Email',block);
MT1.Post;
end;
MT1.first;
end;
end.