📄 proc_changeequipment.asp
字号:
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
-- 存储过程(新增临时工单)
-- 返回值 0: 成功;
-- -1: 不成功
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
CREATE PROCEDURE proc_AddTWorksheet(@pEquisysid int, @pObjecttype int, @pComplaintid int, @pFormtype int, @pUrgency int, @pContent varchar(256),@pDepartment int,@pStarttime datetime,@pFailuretime datetime,@pRecorder varchar(20),@pRemindmethod int,@pPlanhours int,@pLimitdays int)
As
Set NOCOUNT ON
--define variables
declare @worksheet_id int --
declare @rows int --
declare @currentday char(10)
select @worksheet_id = 0
--select @currentday=cast(year(getdate()) as char(4))+'-'+cast(month(getdate()) as char(2))+'-'+cast(day(getdate()) as char(2))
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Begin Tran
----------------------------------------------------------------------------------------
--
----------------------------------------------------------------------------------------
insert into t_worksheet(equi_sys_id,object_type,form_type,urgency,content,department,starttime,failuretime,recorder,remind_method,plan_hours,limit_days,finished)
values(@pEquisysid,@pObjecttype,@pFormtype,@pUrgency,@pContent,@pDepartment,@pStarttime,@pFailuretime,@pRecorder,@pRemindmethod,@pPlanhours,@pLimitdays,0)
if @@ROWCOUNT = 0
begin
rollback tran
select @worksheet_id = -1
goto BeforeReturn
end
select @worksheet_id = @@IDENTITY
if @pComplaintid is not null
begin
update t_customer_complaints set worksheet_id=@worksheet_id where complaint_id=@pComplaintid
if @@ROWCOUNT = 0
begin
rollback tran
select @worksheet_id = -2
goto BeforeReturn
end
end
Commit Tran
BeforeReturn:
select @worksheet_id as 'rtn_code'
GO
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -