unit U_MSG; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls,u_op_seae_DsWebService,SoapHTTPClient,InvokeRegistry; type Tfrm_MSG = class(TForm) mmo1: TMemo; mmo2: TMemo; btn1: TButton; procedure FormShow(Sender: TObject); procedure btn1Click(Sender: TObject); private Letter_flag:Integer; mServiceSoap_Ds:DsWebServiceSoap; mHttpRIO_ds:THTTPRIO; XML :String; public function GetXML:integer; end; var frm_MSG: Tfrm_MSG; implementation uses U_op_seae, u_data_share, u_sys_progress; procedure Tfrm_MSG.FormShow(Sender: TObject); var _i,MSGCount,p1,p2:integer; block:string; begin //刷新 MSGCount:= GetXML; if (MSGCount>0) then begin mmo1.Clear; for _i:=1 to MSGCount do begin p1:=frm_data_share.GettimePotion(_i,'',xml); p2:=frm_data_share.GettimePotion(_i,'',xml); block:=Copy(xml,p1,p2-p1); mmo1.Lines.Add(frm_data_share.GetXMLValue('SENDERNAME',block)+' '+frm_data_share.GetXMLValue('MSGDate',block)); mmo1.Lines.Add(frm_data_share.GetXMLValue('FieldValue',block)); end; mmo1.SelStart := Length(mmo1.Text); mmo1.SelLength:= Length(mmo1.Text);//0; end; end; function Tfrm_MSG.GetXML:integer; var _s,url,block:string; p1,p2,MSGCount:integer; begin if not ASSIGNED(frm_sys_progress) then frm_sys_progress:=tfrm_sys_progress.Create(application); frm_sys_progress.bsSkinGauge1.ProgressText:='正在获取数据请等候。。。'; frm_sys_progress.bsSkinGauge1.MaxValue:=100; frm_sys_progress.bsSkinGauge1.MinValue:=0; frm_sys_progress.Show; frm_sys_progress.bsSkinGauge1.Value:=0; try frm_op_seae.getwebservice_ds; //获取该业务的沟通信息 _s:=' '; _s:=_s+' '; _s:=_s+' '; _s:=_s+' '; _s:=_s+' '+frm_data_share.t_load_employee.fieldbyname('订舱系统序列号').asstring+' '; // _s:=_s+' SENDERCOMPANYID '; _s:=_s+' '+frm_op_seae.t_op_seae.fieldbyname('订舱序列号').asstring+' '; _s:=_s+' '; _s:=_s+' '; _s:=_s+' '; //ShowMessage(_s); XML:=mServiceSoap_Ds.ReceiveMSG(_s); XML:=StringReplace(XML,'#$A','',[rfReplaceAll]); p1:=frm_data_share.GettimePotion(1,'',XML); p2:=frm_data_share.GettimePotion(1,'',xml); XML:=copy(XML,p1,p2-p1); //ShowMessage(XML); MSGcount:= frm_data_share.countString('MSGInfo',xml); result:= MSGcount; finally frm_sys_progress.Close; frm_sys_progress.Free; frm_sys_progress:=nil; if (XML='') then begin result:=0; //showmessage('没有连接到服务器'); end; end; //if assigned(MT1) then MT1.first; end; procedure Tfrm_MSG.btn1Click(Sender: TObject); var _s,XML :string; begin //发出 frm_op_seae.getwebservice_ds; _s:=''; _s:=_s+''; _s:=_s+' '; _s:=_s+' '; _s:=_s+' '+frm_data_share.t_load_employee.fieldbyname('订舱系统序列号').asstring+' '; //_s:=_s+' SENDERCOMPANYID '; //_s:=_s+' SENDERNAME '; //_s:=_s+' SENDERCOMPANYNAME '; //_s:=_s+' RECEIVERID '; //_s:=_s+' RECEIVERCOMPANYID '; //_s:=_s+' RECEIVERNAME '; //_s:=_s+' RECEIVERCOMPANYNAME '; _s:=_s+' 沟通消息 '; _s:=_s+' '+frm_op_seae.t_op_seae.fieldbyname('订舱序列号').asstring+' '; _s:=_s+' 信息内容 '; _s:=_s+' '+mmo2.Lines.Text+' '; //_s:=_s+' '; //_s:=_s+' '; _s:=_s+' '; _s:=_s+' '; _s:=_s+' '; XML:=mServiceSoap_Ds.SendMSG(_s); if (pos('成功',XML)>0) then begin mmo2.Clear; frm_MSG.FormShow(Self); end else begin showmessage('发送失败'); end; end; end.