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.

1547 lines
43 KiB
Plaintext

This file contains ambiguous Unicode 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 my_sys_chat;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
ImgList, bsSkinData, BusinessSkinForm, DB, ADODB, bsSkinCtrls, dxsbar,
ComCtrls, bsSkinTabs, ExtCtrls, StdCtrls, Menus, AppEvnts,dxBar,
jpeg, Mask, DBCtrls, NMUDP,u_main,u_sys_message_tell;
//发现在线发消息,接受方写入
//没有在线,不发消息,写入
// function GetLocalIP:String;//返回本地ip地址
procedure SetBroadCastIp;//广播ip
procedure SendlogIn();//登陆消息发送广播
procedure Sendlogtell(ip:string);//登陆广播反馈
procedure SendLogoutMsg;//退出广播
procedure SendMsg(ip:string;Msg:string);//发送消息
procedure SendMsg_pri(ip:string;Msg:string);//私聊
procedure SendMsg_all(Msg:string);//发布所有
procedure tell_message(str:string);//消息提醒
procedure Send_fee_shen(str_tell,str_quan,tell_type,str_cao,str_kefu,str_lanhuo:string;bsno:string='');//费用提交
procedure Send_fee_shen_new(str_tell,str_quan,tell_type,str_cao,str_kefu,str_lanhuo:string;bsno:string='');//费用提交
procedure Send_fee_check(str_tell,tell_type,str_lu,str_cao,str_kefu,str_lanhuo:string;bsno:string='');//费用审核
procedure Send_fee_check_new(str_tell,tell_type,str_lu,str_cao,str_kefu,str_lanhuo:string;bsno:string='');//费用审核
procedure Send_invocie_check_shen(str_tell,str_quan,tell_type:string;bsno:string='');//申请支付/发票
procedure Send_invocie_check_shen_new(str_tell,str_quan,tell_type:string;bsno:string='');//申请支付/发票
procedure Send_invocie_check_check(str_tell,str_ren,tell_type:string;bsno:string=''); //申请支付/发票 审核
procedure Send_invocie_check_check_new(str_tell,str_ren,tell_type:string;bsno:string=''); //申请支付/发票 审核
procedure Send_op_do(str_tell,tell_type,str_cao,str_kefu,str_lanhuo:string);
procedure Send_op_do_new(str_tell,tell_type,str_cao,str_kefu,str_lanhuo:string);
procedure SendMsg_gonggao(tell_type,Msg:string);
procedure SendMsg_gonggao_new(tell_type,Msg:string);
procedure SendMsg_liuyan(give_ren,Msg:string);
implementation
uses my_sys_function, Client_TLB, u_data_share;
procedure tell_message(str:string);//消息提醒
begin
if not assigned(frm_sys_message_tell) then
begin
frm_sys_message_tell:=tfrm_sys_message_tell.Create(application);
frm_sys_message_tell.Left:=round((screen.Width-frm_sys_message_tell.Width)/2);
frm_sys_message_tell.Top:=2;
frm_sys_message_tell.Height:=22;
frm_sys_message_tell.Show;
end;
if not frm_sys_message_tell.Visible then
frm_sys_message_tell.Show;
frm_sys_message_tell.RichEdit1.text:=str;
frm_sys_message_tell.Edit1.Lines.Insert(0,str);
frm_sys_message_tell.Edit1.text:=trim(frm_sys_message_tell.Edit1.text);
end;
{
function GetLocalIP:String;
type
TaPInAddr = array [0..10] of PInAddr;
PaPInAddr = ^TaPInAddr;
var
phe : PHostEnt;
pptr : PaPInAddr;
Buffer : array [0..63] of char;
I : Integer;
GInitData : TWSADATA;
begin
WSAStartup($101, GInitData);
try
Result:='';
GetHostName(Buffer, SizeOf(Buffer));
phe :=GetHostByName(buffer);
if phe = nil then Exit;
pptr := PaPInAddr(Phe^.h_addr_list);
I := 0;
while pptr^[I] <> nil do
begin
result:=StrPas(inet_ntoa(pptr^[I]^));
Inc(I);
end;
finally
WSACleanup;
end;
end;
}
procedure SetBroadCastIp;
var
i,j,iHead:Integer;
sHead,s:String;
ai:array [1..3] of integer;
begin
{1~126.255.255.255 (A类网广播地址
128~191.XXX.255.255 (B类网广播地址
192~254.XXX.XXX.255 (C类网广播地址}
j:=1;
for i:=0 to Length(LocalIP) do
begin
if LocalIP[i]='.' then
begin
ai[j]:=i;
Inc(j);
end;
if j>3 then break;
end;
sHead:=Copy(LocalIp,1,ai[1]-1);
iHead:=StrToInt(sHead);
if iHead<128 then //A类网
begin
BroadCastIP:=sHead+'.255.255.255';
end
else
begin
if iHead<192 then //B类网
begin
s:=Copy(LocalIP,1,ai[2]-1);
BroadCastIP:=s+'.255.255';
end
else //C类网
begin
s:=Copy(LocalIP,1,ai[3]-1);
BroadCastIP:=s+'.255';
end;
end;
end;
procedure SendlogIn();
var
Msg:string;
begin
try
Msg:=Format('%-16s%-2s%-10s',[LocalIP,'01',employee]);
SendMsg(BroadCastIP,Msg);
frm_main.t_sys_message_no.insert;
frm_main.t_sys_message_no['类型']:='登陆系统';
frm_main.t_sys_message_no['发送方']:=employee;
frm_main.t_sys_message_no['发送地址']:=LocalIP;
frm_main.t_sys_message_no['是否知道']:=1;
frm_main.t_sys_message_no['时间']:=now;
frm_main.t_sys_message_no.post;
except
;
end;
end;
procedure Sendlogtell(ip:string);
var
Msg:string;
begin
try
Msg:=Format('%-16s%-2s%-10s',[LocalIP,'02',employee]);
SendMsg(IP,Msg);
except
;
end;
end;
procedure SendLogoutMsg;//退出UDP发广播
var
Msg:string;
begin
try
Msg:=Format('%-16s%-2s%-10s',[LocalIP,'03',employee]);
SendMsg(BroadCastIp,Msg);
except
;
end;
end;
procedure SendMsg(ip:string;Msg:string);//向IP发送信息
var
CLine:array[1..255]of Char;
I:Integer;
begin
try
for i:=1 to Length(Msg) do
CLine[i]:=Msg[i];
frm_main.NMUDP.RemoteHost:=IP;
frm_main.NMUDP.SendBuffer(CLine,length(Msg));
except
;
end;
end;
procedure SendMsg_pri(ip:string;Msg:string);
var
str:string;
begin
try
str:=Format('%-16s%-2s%-10s',[LocalIP,'04',employee])+Msg;
SendMsg(IP,str);
except
;
end;
end;
procedure SendMsg_all(Msg:string);
var
str:string;
begin
try
str:=Format('%-16s%-2s%-10s',[LocalIP,'05',employee])+Msg;
SendMsg(BroadCastIp,str);
except
;
end;
end;
procedure Send_fee_shen(str_tell,str_quan,tell_type,str_cao,str_kefu,str_lanhuo:string;bsno:string='');
var
Msg:string;
begin
if (trim(isopenwoke)='是') then begin
Send_fee_shen_new(str_tell,str_quan,tell_type,str_cao,str_kefu,str_lanhuo,bsno);
exit;
end;
try
frm_main.t_do_shenhe_fee.Filtered:=false;
frm_main.t_do_shenhe_fee.Filter:='权限代码='+''''+str_quan+'''';
frm_main.t_do_shenhe_fee.Filtered:=true;
frm_main.t_do_shenhe_fee.first;
if not frm_main.t_do_shenhe_fee.IsEmpty then
while not frm_main.t_do_shenhe_fee.eof do
begin
if frm_main.t_do_shenhe_fee.fieldbyname('人员').asstring<>employee then
begin
if frm_main.t_chat_man.locate('在线职员',frm_main.t_do_shenhe_fee.fieldbyname('人员').asstring,[]) then
begin
Msg:=Format('%-16s%-2s%-10s',[LocalIP,tell_type,employee])+str_tell;
SendMsg(frm_main.t_chat_man.fieldbyname('所在电脑').asstring,msg);
end
else
begin
frm_main.t_sys_message_no.insert;
case strtoint(tell_type)of
6:
begin
frm_main.t_sys_message_no['类型']:='费用提交审核';
end;
7:
begin
frm_main.t_sys_message_no['类型']:='费用申请修改';
end;
8:
begin
frm_main.t_sys_message_no['类型']:='费用申请删除';
end;
end;
frm_main.t_sys_message_no['发送方']:=employee;
frm_main.t_sys_message_no['发送地址']:=LocalIP;
frm_main.t_sys_message_no['接收方']:=frm_main.t_do_shenhe_fee.fieldbyname('人员').asstring;
frm_main.t_sys_message_no['是否知道']:=0;
frm_main.t_sys_message_no['事件描述']:=str_tell;
frm_main.t_sys_message_no['时间']:=now;
frm_main.t_sys_message_no.post;
end;
end;
frm_main.t_do_shenhe_fee.next;
end;
if str_cao<>employee then
begin
if frm_main.t_chat_man.locate('在线职员',str_cao,[]) then
begin
Msg:=Format('%-16s%-2s%-10s',[LocalIP,tell_type,employee])+str_tell;
SendMsg(frm_main.t_chat_man.fieldbyname('所在电脑').asstring,msg);
end
else
begin
frm_main.t_sys_message_no.insert;
case strtoint(tell_type)of
6:
begin
frm_main.t_sys_message_no['类型']:='费用提交审核';
end;
7:
begin
frm_main.t_sys_message_no['类型']:='费用申请修改';
end;
8:
begin
frm_main.t_sys_message_no['类型']:='费用申请删除';
end;
end;
frm_main.t_sys_message_no['发送方']:=employee;
frm_main.t_sys_message_no['发送地址']:=LocalIP;
frm_main.t_sys_message_no['接收方']:=str_cao;
frm_main.t_sys_message_no['是否知道']:=0;
frm_main.t_sys_message_no['事件描述']:=str_tell;
frm_main.t_sys_message_no['时间']:=now;
frm_main.t_sys_message_no.post;
end;
end;
if str_kefu<>employee then
begin
if frm_main.t_chat_man.locate('在线职员',str_kefu,[]) then
begin
Msg:=Format('%-16s%-2s%-10s',[LocalIP,tell_type,employee])+str_tell;
SendMsg(frm_main.t_chat_man.fieldbyname('所在电脑').asstring,msg);
end
else
begin
frm_main.t_sys_message_no.insert;
case strtoint(tell_type)of
6:
begin
frm_main.t_sys_message_no['类型']:='费用提交审核';
end;
7:
begin
frm_main.t_sys_message_no['类型']:='费用申请修改';
end;
8:
begin
frm_main.t_sys_message_no['类型']:='费用申请删除';
end;
end;
frm_main.t_sys_message_no['发送方']:=employee;
frm_main.t_sys_message_no['发送地址']:=LocalIP;
frm_main.t_sys_message_no['接收方']:=str_kefu;
frm_main.t_sys_message_no['是否知道']:=0;
frm_main.t_sys_message_no['事件描述']:=str_tell;
frm_main.t_sys_message_no['时间']:=now;
frm_main.t_sys_message_no.post;
end;
end;
if str_lanhuo<>employee then
begin
if frm_main.t_chat_man.locate('在线职员',str_lanhuo,[]) then
begin
Msg:=Format('%-16s%-2s%-10s',[LocalIP,tell_type,employee])+str_tell;
SendMsg(frm_main.t_chat_man.fieldbyname('所在电脑').asstring,msg);
end
else
begin
frm_main.t_sys_message_no.insert;
case strtoint(tell_type)of
6:
begin
frm_main.t_sys_message_no['类型']:='费用提交审核';
end;
7:
begin
frm_main.t_sys_message_no['类型']:='费用申请修改';
end;
8:
begin
frm_main.t_sys_message_no['类型']:='费用申请删除';
end;
end;
frm_main.t_sys_message_no['发送方']:=employee;
frm_main.t_sys_message_no['发送地址']:=LocalIP;
frm_main.t_sys_message_no['接收方']:=str_lanhuo;
frm_main.t_sys_message_no['是否知道']:=0;
frm_main.t_sys_message_no['事件描述']:=str_tell;
frm_main.t_sys_message_no['时间']:=now;
frm_main.t_sys_message_no.post;
end;
end;
except
;
end;
end;
procedure Send_fee_shen_new(str_tell,str_quan,tell_type,str_cao,str_kefu,str_lanhuo:string;bsno:string='');
var
Msg,strbsno,strtitle:string;
str_html:tstringlist;
str:string;
begin
try
str_html:=TStringList.Create;
try
frm_main.t_do_shenhe_fee.Filtered:=false;
frm_main.t_do_shenhe_fee.Filter:='权限代码='+''''+str_quan+'''';
frm_main.t_do_shenhe_fee.Filtered:=true;
frm_main.t_do_shenhe_fee.first;
if not frm_main.t_do_shenhe_fee.IsEmpty then begin
if copy(str_tell,1,8)='海运出口' then
str:='01'
else if copy(str_tell,1,8)='海运进口' then
str:='02'
else if copy(str_tell,1,8)='空运出口' then
str:='03'
else if copy(str_tell,1,8)='空运进口' then
str:='04';
strbsno:='"DSHUODAI00'+inttostr(strtoint(tell_type))+str+bsno+'"';
str_html.Add('<html>');
str_html.Add('<body>');
str_html.Add('<p>');
str_html.Add('<a href='+strbsno+'>'+str_tell+'</a>');
str_html.Add('</p>');
// str_html.Add('');
case strtoint(tell_type)of
6:
begin
strtitle:='费用提交审核';
end;
7:
begin
strtitle:='费用申请修改';
end;
8:
begin
strtitle:='费用申请删除';
end;
end;
str:='';
while not frm_main.t_do_shenhe_fee.eof do
begin
if frm_main.t_do_shenhe_fee.fieldbyname('人员').asstring<>employee then
begin
if str<>'' then str:=str+',';
str:=str+frm_main.t_do_shenhe_fee.fieldbyname('人员').asstring;
end;
frm_main.t_do_shenhe_fee.next;
end;
str:='接收人:'+str;
// str_html.Add(str);
str_html.Add('</body>');
str_html.Add('</html>');
frm_main.t_do_shenhe_fee.first;
while not frm_main.t_do_shenhe_fee.eof do
begin
if frm_main.t_do_shenhe_fee.fieldbyname('人员').asstring<>employee then
begin
if Assigned(msgclient) then
msgclient.sendmsg('费用请核消息',strtitle,str_html.Text,frm_main.t_do_shenhe_fee.fieldbyname('人员').asstring,'TCP',str);
end;
frm_main.t_do_shenhe_fee.next;
end;
end;
finally
freeandnil(str_html);
end;
except
;
end;
end;
procedure Send_fee_check(str_tell,tell_type,str_lu,str_cao,str_kefu,str_lanhuo:string;bsno:string='');
var
Msg:string;
begin
if (trim(isopenwoke)='是') then begin
Send_fee_check_new(str_tell,tell_type,str_lu,str_cao,str_kefu,str_lanhuo,bsno);
exit;
end;
try
if (str_lu<>employee) then
begin
if frm_main.t_chat_man.locate('在线职员',str_lu,[]) then
begin
Msg:=Format('%-16s%-2s%-10s',[LocalIP,tell_type,employee])+str_tell;
SendMsg(frm_main.t_chat_man.fieldbyname('所在电脑').asstring,msg);
end
else
begin
frm_main.t_sys_message_no.insert;
case strtoint(tell_type)of
9:
begin
frm_main.t_sys_message_no['类型']:='费用审核通过';
end;
10:
begin
frm_main.t_sys_message_no['类型']:='费用驳回提交';
end;
11:
begin
frm_main.t_sys_message_no['类型']:='费用批准修改';
end;
12:
begin
frm_main.t_sys_message_no['类型']:='费用禁止修改';
end;
13:
begin
frm_main.t_sys_message_no['类型']:='费用批准删除';
end;
14:
begin
frm_main.t_sys_message_no['类型']:='费用禁止删除';
end;
end;
frm_main.t_sys_message_no['发送方']:=employee;
frm_main.t_sys_message_no['发送地址']:=LocalIP;
frm_main.t_sys_message_no['接收方']:=str_lu;
frm_main.t_sys_message_no['是否知道']:=0;
frm_main.t_sys_message_no['事件描述']:=str_tell;
frm_main.t_sys_message_no['时间']:=now;
frm_main.t_sys_message_no.post;
end;
end;
if (str_lu<>str_cao)and(str_cao<>employee) then
begin
if frm_main.t_chat_man.locate('在线职员',str_cao,[]) then
begin
Msg:=Format('%-16s%-2s%-10s',[LocalIP,tell_type,employee])+str_tell;
SendMsg(frm_main.t_chat_man.fieldbyname('所在电脑').asstring,msg);
end
else
begin
frm_main.t_sys_message_no.insert;
case strtoint(tell_type)of
9:
begin
frm_main.t_sys_message_no['类型']:='费用审核通过';
end;
10:
begin
frm_main.t_sys_message_no['类型']:='费用驳回提交';
end;
11:
begin
frm_main.t_sys_message_no['类型']:='费用批准修改';
end;
12:
begin
frm_main.t_sys_message_no['类型']:='费用禁止修改';
end;
13:
begin
frm_main.t_sys_message_no['类型']:='费用批准删除';
end;
14:
begin
frm_main.t_sys_message_no['类型']:='费用禁止删除';
end;
end;
frm_main.t_sys_message_no['发送方']:=employee;
frm_main.t_sys_message_no['发送地址']:=LocalIP;
frm_main.t_sys_message_no['接收方']:=str_cao;
frm_main.t_sys_message_no['是否知道']:=0;
frm_main.t_sys_message_no['事件描述']:=str_tell;
frm_main.t_sys_message_no['时间']:=now;
frm_main.t_sys_message_no.post;
end;
end;
if (str_lu<>str_kefu)and(str_kefu<>employee) then
begin
if frm_main.t_chat_man.locate('在线职员',str_kefu,[]) then
begin
Msg:=Format('%-16s%-2s%-10s',[LocalIP,tell_type,employee])+str_tell;
SendMsg(frm_main.t_chat_man.fieldbyname('所在电脑').asstring,msg);
end
else
begin
frm_main.t_sys_message_no.insert;
case strtoint(tell_type)of
9:
begin
frm_main.t_sys_message_no['类型']:='费用审核通过';
end;
10:
begin
frm_main.t_sys_message_no['类型']:='费用驳回提交';
end;
11:
begin
frm_main.t_sys_message_no['类型']:='费用批准修改';
end;
12:
begin
frm_main.t_sys_message_no['类型']:='费用禁止修改';
end;
13:
begin
frm_main.t_sys_message_no['类型']:='费用批准删除';
end;
14:
begin
frm_main.t_sys_message_no['类型']:='费用禁止删除';
end;
end;
frm_main.t_sys_message_no['发送方']:=employee;
frm_main.t_sys_message_no['发送地址']:=LocalIP;
frm_main.t_sys_message_no['接收方']:=str_kefu;
frm_main.t_sys_message_no['是否知道']:=0;
frm_main.t_sys_message_no['事件描述']:=str_tell;
frm_main.t_sys_message_no['时间']:=now;
frm_main.t_sys_message_no.post;
end;
end;
if (str_lu<>str_lanhuo)and(str_lanhuo<>employee) then
begin
if frm_main.t_chat_man.locate('在线职员',str_lanhuo,[]) then
begin
Msg:=Format('%-16s%-2s%-10s',[LocalIP,tell_type,employee])+str_tell;
SendMsg(frm_main.t_chat_man.fieldbyname('所在电脑').asstring,msg);
end
else
begin
frm_main.t_sys_message_no.insert;
case strtoint(tell_type)of
9:
begin
frm_main.t_sys_message_no['类型']:='费用审核通过';
end;
10:
begin
frm_main.t_sys_message_no['类型']:='费用驳回提交';
end;
11:
begin
frm_main.t_sys_message_no['类型']:='费用批准修改';
end;
12:
begin
frm_main.t_sys_message_no['类型']:='费用禁止修改';
end;
13:
begin
frm_main.t_sys_message_no['类型']:='费用批准删除';
end;
14:
begin
frm_main.t_sys_message_no['类型']:='费用禁止删除';
end;
end;
frm_main.t_sys_message_no['发送方']:=employee;
frm_main.t_sys_message_no['发送地址']:=LocalIP;
frm_main.t_sys_message_no['接收方']:=str_lanhuo;
frm_main.t_sys_message_no['是否知道']:=0;
frm_main.t_sys_message_no['事件描述']:=str_tell;
frm_main.t_sys_message_no['时间']:=now;
frm_main.t_sys_message_no.post;
end;
end;
except
;
end;
end;
procedure Send_fee_check_new(str_tell,tell_type,str_lu,str_cao,str_kefu,str_lanhuo:string;bsno:string='');
var
Msg,strbsno:string;
str_html:tstringlist;
str:string;
begin
try
str_html:=TStringList.Create;
try
strbsno:='"DSHUODAI00'+tell_type+'01'+bsno+'"';
str_html.Add('<html>');
str_html.Add('<body>');
str_html.Add(str_tell);
// str_html.Add('');
if str_lu<>employee then
str:='接收人:'+str_lu;
{
if str_cao<>employee then
str:=str+','+str_cao;
if str_kefu<>employee then
str:=str+','+str_kefu;
if str_lanhuo<>employee then
str:=str+','+str_lanhuo;
}
// str_html.Add(str);
str_html.Add('</body>');
str_html.Add('</html>');
if (str_lu<>employee) then
begin
if Assigned(msgclient) then
msgclient.sendmsg('费用审核消息',str_tell,str_html.Text,str_lu,'TCP',str);
end;
{
if (str_lu<>str_cao)and(str_cao<>employee) then
begin
if Assigned(msgclient) then
msgclient.sendmsg('费用审核消息',str_tell,str_html.Text,str_cao,'TCP');
end;
if (str_lu<>str_kefu)and(str_kefu<>employee) then
begin
if Assigned(msgclient) then
msgclient.sendmsg('费用审核消息',str_tell,str_html.Text,str_kefu,'TCP');
end;
if (str_lu<>str_lanhuo)and(str_lanhuo<>employee) then
begin
if Assigned(msgclient) then
msgclient.sendmsg('费用审核消息',str_tell,str_html.Text,str_lanhuo,'TCP');
end;
}
{
mysendmsg.msgtype:='费用审核消息';
mysendmsg.msgtitle:=str_tell;
mysendmsg.msgdetail:=str_html.Text;
mysendmsg.cmd:='TCP';
if (str_lu<>employee) then
begin
mysendmsg.reciver:=str_lu;
end;
if (str_lu<>str_cao)and(str_cao<>employee) then
begin
mysendmsg.reciver:=str_cao;
end;
if (str_lu<>str_kefu)and(str_kefu<>employee) then
begin
mysendmsg.reciver:=str_kefu;
end;
if (str_lu<>str_lanhuo)and(str_lanhuo<>employee) then
begin
mysendmsg.reciver:=str_lanhuo;
end;
TmsgclientThread.create(false,employee,department,mysendmsg);
}
finally
freeandnil(str_html);
end;
except
;
end;
end;
procedure Send_invocie_check_shen(str_tell,str_quan,tell_type:string;bsno:string='');
var
Msg:string;
begin
if (trim(isopenwoke)='是') then begin
Send_invocie_check_shen_new(str_tell,str_quan,tell_type,bsno);
exit;
end;
try
frm_main.t_do_shenhe_other.Filtered:=false;
frm_main.t_do_shenhe_other.Filter:='权限代码='+''''+str_quan+'''';
frm_main.t_do_shenhe_other.Filtered:=true;
frm_main.t_do_shenhe_other.first;
if not frm_main.t_do_shenhe_other.IsEmpty then
while not frm_main.t_do_shenhe_other.eof do
begin
if frm_main.t_do_shenhe_other.fieldbyname('人员').asstring<>employee then
begin
if frm_main.t_chat_man.locate('在线职员',frm_main.t_do_shenhe_other.fieldbyname('人员').asstring,[]) then
begin
Msg:=Format('%-16s%-2s%-10s',[LocalIP,tell_type,employee])+str_tell;
SendMsg(frm_main.t_chat_man.fieldbyname('所在电脑').asstring,msg);
end
else
begin
frm_main.t_sys_message_no.insert;
case strtoint(tell_type)of
15:
begin
frm_main.t_sys_message_no['类型']:='申请业务发票';
end;
16:
begin
frm_main.t_sys_message_no['类型']:='申请修改发票';
end;
17:
begin
frm_main.t_sys_message_no['类型']:='申请支付费用';
end;
18:
begin
frm_main.t_sys_message_no['类型']:='申请修改支付';
end;
19:
begin
frm_main.t_sys_message_no['类型']:='批准开出发票';
end;
20:
begin
frm_main.t_sys_message_no['类型']:='批准支付费用';
end;
31:
begin
frm_main.t_sys_message_no['类型']:='收费核销完毕';
end;
34:
begin
frm_main.t_sys_message_no['类型']:='申请发送快递';
end;
37:
begin
frm_main.t_sys_message_no['类型']:='申请调度派车';
end;
45:
begin
frm_main.t_sys_message_no['类型']:='客户申请转正';
end;
end;
frm_main.t_sys_message_no['发送方']:=employee;
frm_main.t_sys_message_no['发送地址']:=LocalIP;
frm_main.t_sys_message_no['接收方']:=frm_main.t_do_shenhe_other.fieldbyname('人员').asstring;
frm_main.t_sys_message_no['是否知道']:=0;
frm_main.t_sys_message_no['事件描述']:=str_tell;
frm_main.t_sys_message_no['时间']:=now;
frm_main.t_sys_message_no.post;
end;
end;
frm_main.t_do_shenhe_other.next;
end;
except
;
end;
end;
procedure Send_invocie_check_shen_new(str_tell,str_quan,tell_type:string;bsno:string='');
var
Msg,strbsno,strtitle,stritems:string;
str_html:tstringlist;
str:string;
begin
try
str_html:=TStringList.Create;
try
frm_main.t_do_shenhe_other.Filtered:=false;
frm_main.t_do_shenhe_other.Filter:='权限代码='+''''+str_quan+'''';
frm_main.t_do_shenhe_other.Filtered:=true;
frm_main.t_do_shenhe_other.first;
if not frm_main.t_do_shenhe_other.IsEmpty then begin
if strtoint(tell_type) in [15,16,17,18] then
strbsno:='href="DSHUODAI0'+inttostr(strtoint(tell_type))+'01'+bsno+'"'
else
strbsno:='';
str_html.Add('<html>');
str_html.Add('<body>');
if strtoint(tell_type) in [15,16,17,18,19] then begin
str_html.Add('<p>');
str_html.Add('<a '+strbsno+'>'+str_tell+'</a>');
str_html.Add('</p>');
end else
str_html.Add(str_tell);
// str_html.Add('');
case strtoint(tell_type)of
15:
begin
strtitle:='申请业务发票';
stritems:='结算及发票申请消息';
end;
16:
begin
strtitle:='申请修改发票';
stritems:='结算及发票申请消息';
end;
17:
begin
strtitle:='申请支付费用';
stritems:='结算及发票申请消息';
end;
18:
begin
strtitle:='申请修改支付';
stritems:='结算及发票申请消息';
end;
19:
begin
strtitle:='批准开出发票';
stritems:='结算及发票审批消息';
end;
20:
begin
strtitle:='批准支付费用';
stritems:='结算及发票审批消息';
end;
31:
begin
strtitle:='收费核销完毕';
stritems:='结算及发票审批消息';
end;
34:
begin
strtitle:='申请发送快递';
stritems:='结算及发票申请消息';
end;
37:
begin
strtitle:='申请调度派车';
stritems:='结算及发票申请消息';
end;
45:
begin
strtitle:='客户申请转正';
stritems:='结算及发票申请消息';
end;
end;
str:='';
while not frm_main.t_do_shenhe_other.eof do
begin
if frm_main.t_do_shenhe_other.fieldbyname('人员').asstring<>employee then
begin
if (str<>'') then str:=str+',';
str:=str+frm_main.t_do_shenhe_other.fieldbyname('人员').asstring;
end;
frm_main.t_do_shenhe_other.next;
end;
str:='接收人:'+str;
// str_html.Add(str);
str_html.Add('</body>');
str_html.Add('</html>');
frm_main.t_do_shenhe_other.first;
while not frm_main.t_do_shenhe_other.eof do
begin
if frm_main.t_do_shenhe_other.fieldbyname('人员').asstring<>employee then
begin
if Assigned(msgclient) then
msgclient.sendmsg(stritems,strtitle,str_html.Text,frm_main.t_do_shenhe_other.fieldbyname('人员').asstring,'TCP',str);
end;
frm_main.t_do_shenhe_other.next;
end;
end;
finally
freeAndnil(str_html);
end;
except
;
end;
end;
procedure Send_invocie_check_check(str_tell,str_ren,tell_type:string;bsno:string='');
var
Msg:string;
begin
if (trim(isopenwoke)='是') then begin
Send_invocie_check_check_new(str_tell,str_ren,tell_type,bsno);
exit;
end;
try
if (str_ren<>employee) then
begin
if frm_main.t_chat_man.locate('在线职员',str_ren,[]) then
begin
Msg:=Format('%-16s%-2s%-10s',[LocalIP,tell_type,employee])+str_tell;
SendMsg(frm_main.t_chat_man.fieldbyname('所在电脑').asstring,msg);
end
else
begin
frm_main.t_sys_message_no.insert;
case strtoint(tell_type)of
21:
begin
frm_main.t_sys_message_no['类型']:='批准开出发票';
end;
22:
begin
frm_main.t_sys_message_no['类型']:='驳回申请发票';
end;
23:
begin
frm_main.t_sys_message_no['类型']:='批准修改发票';
end;
24:
begin
frm_main.t_sys_message_no['类型']:='禁止修改发票';
end;
25:
begin
frm_main.t_sys_message_no['类型']:='申请发票开出';
end;
26:
begin
frm_main.t_sys_message_no['类型']:='批准支付费用';
end;
27:
begin
frm_main.t_sys_message_no['类型']:='驳回申请支付';
end;
28:
begin
frm_main.t_sys_message_no['类型']:='批准修改支付';
end;
29:
begin
frm_main.t_sys_message_no['类型']:='禁止修改支付';
end;
30:
begin
frm_main.t_sys_message_no['类型']:='收费核销通知';
end;
32:
begin
frm_main.t_sys_message_no['类型']:='收费核销完毕';
end;
33:
begin
frm_main.t_sys_message_no['类型']:='收费核销审核';
end;
35:
begin
frm_main.t_sys_message_no['类型']:='快递确认发出';
end;
36:
begin
frm_main.t_sys_message_no['类型']:='驳回快递申请';
end;
46:
begin
frm_main.t_sys_message_no['类型']:='客户转正通过';
end;
47:
begin
frm_main.t_sys_message_no['类型']:='驳回客户转正';
end;
end;
frm_main.t_sys_message_no['发送方']:=employee;
frm_main.t_sys_message_no['发送地址']:=LocalIP;
frm_main.t_sys_message_no['接收方']:=str_ren;
frm_main.t_sys_message_no['是否知道']:=0;
frm_main.t_sys_message_no['事件描述']:=str_tell;
frm_main.t_sys_message_no['时间']:=now;
frm_main.t_sys_message_no.post;
end;
end;
except
;
end;
end;
procedure Send_invocie_check_check_new(str_tell,str_ren,tell_type:string;bsno:string='');
var
Msg,strbsno,stritems,strtitle:string;
str_html:tstringlist;
begin
try
str_html:=TStringList.Create;
try
if (str_ren<>employee) then
begin
if strtoint(tell_type) in [15,16,17,18] then
strbsno:='href="DSHUODAI0'+tell_type+'01'+bsno+'"'
else
strbsno:='';
str_html.Add('<html>');
str_html.Add('<body>');
str_html.Add(str_tell);
{
str_html.Add('<p>');
str_html.Add('<a'+strbsno+'>'+str_tell+'</a>');
str_html.Add('</p>');
}
// str_html.Add('');
// str_html.Add('接收人:'+str_ren);
str_html.Add('</body>');
str_html.Add('</html>');
case strtoint(tell_type)of
21:
begin
strtitle:='批准开出发票';
stritems:='结算及发票审批消息';
end;
22:
begin
strtitle:='驳回申请发票';
stritems:='结算及发票审批消息';
end;
23:
begin
strtitle:='批准修改发票';
stritems:='结算及发票审批消息';
end;
24:
begin
strtitle:='禁止修改发票';
stritems:='结算及发票审批消息';
end;
25:
begin
strtitle:='申请发票开出';
stritems:='结算及发票审批消息';
end;
26:
begin
strtitle:='批准支付费用';
stritems:='结算及发票审批消息';
end;
27:
begin
strtitle:='驳回申请支付';
stritems:='结算及发票审批消息';
end;
28:
begin
strtitle:='批准修改支付';
stritems:='结算及发票审批消息';
end;
29:
begin
strtitle:='禁止修改支付';
stritems:='结算及发票审批消息';
end;
30:
begin
strtitle:='收费核销通知';
stritems:='收费核销信息';
end;
32:
begin
strtitle:='收费核销完毕';
stritems:='收费核销信息';
end;
33:
begin
strtitle:='收费核销审核';
stritems:='收费核销信息';
end;
35:
begin
strtitle:='快递确认发出';
stritems:='快递信息';
end;
36:
begin
strtitle:='驳回快递申请';
stritems:='快递信息';
end;
46:
begin
strtitle:='客户转正通过';
stritems:='客户信息';
end;
47:
begin
strtitle:='驳回客户转正';
stritems:='客户信息';
end;
end;
{
mysendmsg.msgtype:=stritems;
mysendmsg.msgtitle:=strtitle;
mysendmsg.msgdetail:=str_html.Text;
mysendmsg.reciver:=str_ren;
mysendmsg.cmd:='TCP';
TmsgclientThread.create(false,employee,department,mysendmsg);
}
if Assigned(msgclient) then
msgclient.sendmsg(stritems,strtitle,str_html.Text,str_ren,'TCP','接收人:'+str_ren);
end;
finally
freeandnil(str_html);
end;
except
;
end;
end;
procedure Send_op_do(str_tell,tell_type,str_cao,str_kefu,str_lanhuo:string);
var
Msg:string;
begin
if (trim(isopenwoke)='是') then begin
// Send_op_do_new(str_tell,tell_type,str_cao,str_kefu,str_lanhuo);
exit;
end;
try
if (str_cao<>employee) then
begin
if frm_main.t_chat_man.locate('在线职员',str_cao,[]) then
begin
Msg:=Format('%-16s%-2s%-10s',[LocalIP,tell_type,employee])+str_tell;
SendMsg(frm_main.t_chat_man.fieldbyname('所在电脑').asstring,msg);
end
else
begin
frm_main.t_sys_message_no.insert;
case strtoint(tell_type)of
38:
begin
frm_main.t_sys_message_no['类型']:='调度确认派车';
end;
39:
begin
frm_main.t_sys_message_no['类型']:='海运退税确认';
end;
40:
begin
frm_main.t_sys_message_no['类型']:='海运签单确认';
end;
41:
begin
frm_main.t_sys_message_no['类型']:='业务信息封帐';
end;
42:
begin
frm_main.t_sys_message_no['类型']:='费用信息封帐';
end;
43:
begin
frm_main.t_sys_message_no['类型']:='业务信息解封';
end;
44:
begin
frm_main.t_sys_message_no['类型']:='费用信息解封';
end;
50:
begin
frm_main.t_sys_message_no['类型']:='海运费用解锁';
end;
62:
begin
frm_main.t_sys_message_no['类型']:='海运费用解锁';
end;
end;
frm_main.t_sys_message_no['发送方']:=employee;
frm_main.t_sys_message_no['发送地址']:=LocalIP;
frm_main.t_sys_message_no['接收方']:=str_cao;
frm_main.t_sys_message_no['是否知道']:=0;
frm_main.t_sys_message_no['事件描述']:=str_tell;
frm_main.t_sys_message_no['时间']:=now;
frm_main.t_sys_message_no.post;
end;
end;
if (str_kefu<>employee) then
begin
if frm_main.t_chat_man.locate('在线职员',str_kefu,[]) then
begin
Msg:=Format('%-16s%-2s%-10s',[LocalIP,tell_type,employee])+str_tell;
SendMsg(frm_main.t_chat_man.fieldbyname('所在电脑').asstring,msg);
end
else
begin
frm_main.t_sys_message_no.insert;
case strtoint(tell_type)of
38:
begin
frm_main.t_sys_message_no['类型']:='调度确认派车';
end;
39:
begin
frm_main.t_sys_message_no['类型']:='海运退税确认';
end;
40:
begin
frm_main.t_sys_message_no['类型']:='海运签单确认';
end;
41:
begin
frm_main.t_sys_message_no['类型']:='业务信息封帐';
end;
42:
begin
frm_main.t_sys_message_no['类型']:='费用信息封帐';
end;
43:
begin
frm_main.t_sys_message_no['类型']:='业务信息解封';
end;
44:
begin
frm_main.t_sys_message_no['类型']:='费用信息解封';
end;
50:
begin
frm_main.t_sys_message_no['类型']:='海运费用解锁';
end;
end;
frm_main.t_sys_message_no['发送方']:=employee;
frm_main.t_sys_message_no['发送地址']:=LocalIP;
frm_main.t_sys_message_no['接收方']:=str_kefu;
frm_main.t_sys_message_no['是否知道']:=0;
frm_main.t_sys_message_no['事件描述']:=str_tell;
frm_main.t_sys_message_no['时间']:=now;
frm_main.t_sys_message_no.post;
end;
end;
if (str_lanhuo<>employee) then
begin
if frm_main.t_chat_man.locate('在线职员',str_lanhuo,[]) then
begin
Msg:=Format('%-16s%-2s%-10s',[LocalIP,tell_type,employee])+str_tell;
SendMsg(frm_main.t_chat_man.fieldbyname('所在电脑').asstring,msg);
end
else
begin
frm_main.t_sys_message_no.insert;
case strtoint(tell_type)of
38:
begin
frm_main.t_sys_message_no['类型']:='调度确认派车';
end;
39:
begin
frm_main.t_sys_message_no['类型']:='海运退税确认';
end;
40:
begin
frm_main.t_sys_message_no['类型']:='海运签单确认';
end;
41:
begin
frm_main.t_sys_message_no['类型']:='业务信息封帐';
end;
42:
begin
frm_main.t_sys_message_no['类型']:='费用信息封帐';
end;
43:
begin
frm_main.t_sys_message_no['类型']:='业务信息解封';
end;
44:
begin
frm_main.t_sys_message_no['类型']:='费用信息解封';
end;
50:
begin
frm_main.t_sys_message_no['类型']:='海运费用解锁';
end;
end;
frm_main.t_sys_message_no['发送方']:=employee;
frm_main.t_sys_message_no['发送地址']:=LocalIP;
frm_main.t_sys_message_no['接收方']:=str_lanhuo;
frm_main.t_sys_message_no['是否知道']:=0;
frm_main.t_sys_message_no['事件描述']:=str_tell;
frm_main.t_sys_message_no['时间']:=now;
frm_main.t_sys_message_no.post;
end;
end;
except
;
end;
end;
procedure Send_op_do_new(str_tell,tell_type,str_cao,str_kefu,str_lanhuo:string);
var
Msg,strbsno,stritems,strtitle:string;
str_html:tstringlist;
str:string;
begin
try
str_html:=TStringList.Create;
try
// if strtoint(tell_type) in [15,16,17,18] then
// strbsno:='href="0'+tell_type+'01'+bsno+'"'
// else
strbsno:='';
str_html.Add('<html>');
str_html.Add('<body>');
str_html.Add(str_tell);
// str_html.Add('');
str:='';
if str_cao<>employee then
str:=str_cao;
if str_kefu<>employee then
if str<>'' then
str:=str+','+str_kefu
else
str:=str_kefu;
if str_lanhuo<>employee then
if str<>'' then
str:=str+','+str_lanhuo
else
str:=str_lanhuo;
str:='接收人:'+str;
// str_html.Add(str);
str_html.Add('</body>');
str_html.Add('</html>');
case strtoint(tell_type)of
38:
begin
strtitle:='调度确认派车';
stritems:='业务操作消息';
end;
39:
begin
strtitle:='海运退税确认';
stritems:='业务操作消息';
end;
40:
begin
strtitle:='海运签单确认';
stritems:='业务操作消息';
end;
41:
begin
strtitle:='业务信息封帐';
stritems:='封帐信息';
end;
42:
begin
strtitle:='费用信息封帐';
stritems:='封帐信息';
end;
43:
begin
strtitle:='业务信息解封';
stritems:='封帐信息';
end;
44:
begin
strtitle:='费用信息解封';
stritems:='封帐信息';
end;
50:
begin
strtitle:='海运费用解锁';
stritems:='业务操作消息';
end;
62:
begin
strtitle:='海运费用解锁';
stritems:='业务操作消息';
end;
end;
if (str_cao<>employee) then
begin
if Assigned(msgclient) then
msgclient.sendmsg(stritems,strtitle,str_html.Text,str_cao,'TCP',str);
{
mysendmsg.msgtype:=stritems;
mysendmsg.msgtitle:=strtitle;
mysendmsg.msgdetail:=str_html.Text;
mysendmsg.reciver:=str_cao;
mysendmsg.cmd:='TCP';
TmsgclientThread.create(false,employee,department,mysendmsg);
}
end;
if (str_kefu<>employee) then
begin
if Assigned(msgclient) then
msgclient.sendmsg(stritems,strtitle,str_html.Text,str_kefu,'TCP',str);
{
mysendmsg.msgtype:=stritems;
mysendmsg.msgtitle:=strtitle;
mysendmsg.msgdetail:=str_html.Text;
mysendmsg.reciver:=str_kefu;
mysendmsg.cmd:='TCP';
TmsgclientThread.create(false,employee,department,mysendmsg);
}
end;
if (str_lanhuo<>employee) then
begin
if Assigned(msgclient) then
msgclient.sendmsg(stritems,strtitle,str_html.Text,str_lanhuo,'TCP',str);
{
mysendmsg.msgtype:=stritems;
mysendmsg.msgtitle:=strtitle;
mysendmsg.msgdetail:=str_html.Text;
mysendmsg.reciver:=str_lanhuo;
mysendmsg.cmd:='TCP';
TmsgclientThread.create(false,employee,department,mysendmsg);
}
end;
finally
freeandnil(str_html);
end;
except
;
end;
end;
procedure SendMsg_gonggao(tell_type,Msg:string);
var
str:string;
begin
if (trim(isopenwoke)='是') then begin
if msg<>'' then
SendMsg_gonggao_new(tell_type,Msg);
exit;
end;
try
str:=Format('%-16s%-2s%-10s',[LocalIP,tell_type,employee])+Msg;
SendMsg(BroadCastIp,str);
except
;
end;
end;
procedure SendMsg_gonggao_new(tell_type,Msg:string);
var
str:string;
i:Integer;
str_html:tstringlist;
begin
try
str_html:=TStringList.Create;
str_html.Add('<html>');
str_html.Add('<body>');
str_html.Add(msg);
// str_html.Add('');
// str_html.Add('接收人:所有人');
// str_html.Add('<p>');
// str_html.Add('<a>'+msg+'</a>');
// str_html.Add('</p>');
str_html.Add('</body>');
str_html.Add('</html>');
frm_data_share.t_sys_employee.First;
while not frm_data_share.t_sys_employee.eof do begin
if frm_data_share.t_sys_employee.fieldbyname('姓名').AsString<>employee then begin
if Assigned(msgclient) then
msgclient.sendmsg('系统公告','系统公告',str_html.Text,frm_data_share.t_sys_employee.fieldbyname('姓名').AsString,'TCP','接收人:所有人');
{
mysendmsg.msgtype:='系统公告';
mysendmsg.msgtitle:='系统公告';
mysendmsg.msgdetail:=str_html.Text;
mysendmsg.reciver:=frm_data_share.t_sys_employee.fieldbyname('姓名').AsString;
mysendmsg.cmd:='TCP';
TmsgclientThread.create(false,employee,department,mysendmsg);
}
end;
frm_data_share.t_sys_employee.next;
end;
finally
freeandnil(str_html);
end;
end;
procedure SendMsg_liuyan(give_ren,Msg:string);
var
str:string;
begin
try
if frm_main.t_chat_man.locate('在线职员',give_ren,[]) then
begin
str:=Format('%-16s%-2s%-10s',[LocalIP,'49',employee])+Msg;
SendMsg(frm_main.t_chat_man.fieldbyname('所在电脑').asstring,str);
end;
except
;
end;
end;
end.