?? sp.txt
字號:
set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON
go
alter proc [dbo].[CK_Flow_Sms]
@ObjType int,
@FTaskID int,
@FDataBase Nvarchar(50)
AS
begin
declare @Table nvarchar (20)
declare @TableName nvarchar (50)
declare @Fdocentry int
declare @FStep int
declare @FlowName nvarchar (50)
declare @Content nvarchar (200)
declare @Sql nvarchar (4000)
Select @TableName =Case @ObjType When 23 then N'報價單'
When 17 then N'訂單'
When 15 then N'交貨單'
When 13 then N'發(fā)票'
When 14 then N'貸項憑證'
When 16 then N'退貨'
When 22 then N'采購訂單'
When 20 then N'采購交貨'
When 18 then N'采購發(fā)票'
When 19 then N'采購貸項憑證'
When 21 then N'采購?fù)素?#039;
When 67 then N'庫存轉(zhuǎn)儲'
end ,
@Table =Case @ObjType When 23 then N'OQUT'
When 17 then N'ORDR'
When 15 then N'ODLN'
When 13 then N'OINV'
When 14 then N'ORIN'
When 16 then N'ORDN'
When 22 then N'OPOR'
When 20 then N'OPDN'
When 18 then N'OPCH'
When 19 then N'ORPC'
When 21 then N'ORPD'
When 67 then N'OWTR'
end
SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED
select Top 1 @Fdocentry= FDocKey,@FlowName=FCheckFlowName,@FStep=FNextStep
from ck_flow_task
where FtaskId=@FTaskID
select @Sql= N'SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED if exists(select top 1 1 from sysobjects where name=N''FTemp'') drop table FTemp '
select @Sql=@Sql + N' Select Top 1 CardCode,CardName,DocNum,U_Opname,DocTotal into FTemp From ' +@FDataBase+N'..odrf'
+N' where docentry=' +cast(@Fdocentry as nvarchar)
exec(@Sql)
if exists(select top 1 1 from sysobjects where name=N'FTemp')
begin
select @Content=N'審批流程 '+''''+@FlowName+''''+N':由' +isnull(U_Opname,N'') +N'做的,合作伙伴 '+isnull(CardCode,N'')+N' '+ isnull(CardName,N'') +
N',金額:'+ cast( DocTotal as nvarchar)+N' 單號:' + cast(DocNum as nvarchar) +N'的' + isnull(@TableName,N'') +N'要求你審批.請回復(fù)'+cast(@FTaskID as nvarchar) +N'SP 加字母Y或N 進行審批'
from FTemp
drop table FTemp
end
declare @j int
declare @s nvarchar(100)
select @j=0
while @j< len(@Content)/69 +1
begin
select @s=substring(@Content,@j*69+1,@j*69+69)
insert T_SMSSendList( S_ReceiveCardNo ,S_SendContent )
select U.Fphone ,@s
from userinfo U ,ck_flow_step S
where CharIndex(U.FUserCode, S.FCheckers) > 0
and S.FstepId= @FStep
and isnull(@s,'')<>''
and isnull(Fphone,'')<>''
select @j=@j+1
end
end
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -