金蝶K3本身的业务流程目前来讲有点牵强,发货通知在销售模块,但仓库模块又要查询,而且他们不能时时的知道发货通知信息,所以每次销售部门编制完成发货通知后系统会自动给指定的仓库管理员发送信息提示,有发货通知单需要处理.希望对大家有用,谢谢.
-----触发器完善
create trigger message
on seoutstock
for UPDATE
as
if update(fcheckerid) and (select fcheckerid from inserted )>0
begin
declare @p5 varchar(255)
select @p5=a.fbillno from inserted a,deleted b where a.fcheckerid>0 and b.fcheckerid is null
declare @p1 varchar(255),@p2 varchar(255),@p3 int
select @p1='您有新的单据需要处理',
@p2='您有新的发货通知单需要处理[email=]'+@p5[/email],
@p3=a.fcheckerid from seoutstock a where [email=fbillno=@p5]fbillno=@p5[/email]
declare @p4 int
select @p4=max(fmesid) from t_msglist
declare @fcheckid1 int,
@fcheckid2 int
select @fcheckid1=a.fcheckerid,@fcheckid2=b.fcheckerid from inserted a,deleted b
if @fcheckid1>0 and @fcheckid2 is null
Insert into t_Message(FMesName,FMesContent,FUserFromID,FDate,FImport,FMesType,FWorkFlow,FRecieve) values(@P1,@P2,@p3,GetDate(),1, 0,'''',1 )
----发给******
insert into t_msgList(FMesID,FUserID,FChecked,FNew,FMesState)values(@p4+1,******,0,1,0)
end |