批号主档空格控制触发器
这个只能挡住批号主档的进入,如果到时批号文本有内容,但批号内码为0,这个触发器是没效果的
适合版本:云星空 V7.5之前版本,V7.6系统已添加控制
代码来源:金蝶总部研发工程师
create trigger trg_lotErrChar
on T_BD_LOTmaster for insert
as
begin
declare @l as nvarchar(511),@t as nvarchar(511),@i nvarchar(255)
if exists (select 1 from inserted where fnumber like '% ')
begin
select @l= fnumber from inserted where fnumber like '% '
select @i= m.fnumber from T_BD_MATERIAL m join inserted i on i.FMATERIALID =m.FMATERIALID where i.fnumber like '% '
select @t='批号不能在尾部有TAB键(空格),请清除尾部TAB键(空格)再保存!物料代码:'+ @i + ' 异常批号是: '+ @l
raiserror (@t ,16,1)
end
if exists (select 1 from inserted where fnumber like ' %')
begin
select @l= fnumber from inserted where fnumber like ' %'
select @i= m.fnumber from T_BD_MATERIAL m join inserted i on i.FMATERIALID =m.FMATERIALID where i.fnumber like ' %'
select @t='批号不能在头部有TAB键(空格),请清除头部制TAB键(空格)再保存!物料代码:'+ @i + ' 异常批号是:'+ @l
raiserror (@t ,16,1)
end
if exists (select 1 from inserted where fnumber like '% ')
begin
select @l= fnumber from inserted where fnumber like '% '
select @i= m.fnumber from T_BD_MATERIAL m join inserted i on i.FMATERIALID =m.FMATERIALID where i.fnumber like '% '
select @t='批号不能在尾部有空格,请清除尾部空格再保存!物料代码:'+ @i + ' 异常批号是:'+ @l
raiserror (@t ,16,1)
end
if exists (select 1 from inserted where fnumber like ' %')
begin
select @l= fnumber from inserted where fnumber like ' %'
select @i= m.fnumber from T_BD_MATERIAL m join inserted i on i.FMATERIALID =m.FMATERIALID where i.fnumber like ' %'
select @t='批号不能以空格开头,请清除头部空格再保存!物料代码:'+ @i + ' 异常批号是:'+ @l
raiserror (@t ,16,1)
end
if exists (SELECT 1 FROM inserted where CHARINDEX(char(13),fnumber)>0 )
begin
select @l= fnumber from inserted where CHARINDEX(char(13),fnumber)>0
select @i= m.fnumber from T_BD_MATERIAL m join inserted i on i.FMATERIALID =m.FMATERIALID where CHARINDEX(char(13),i.fnumber)>0
select @t='批号不能含有回车符,请检查并清除!物料代码:'+ @i + ' 异常批号是:' + @l
raiserror (@t,16,1)
end
if exists (SELECT 1 FROM inserted where CHARINDEX(char(10),fnumber)>0)
begin
select @l= fnumber from inserted where CHARINDEX(char(10),fnumber)>0
select @i= m.fnumber from T_BD_MATERIAL m join inserted i on i.FMATERIALID =m.FMATERIALID where CHARINDEX(char(10),i.fnumber)>0
select @t='批号不能含有换行符,请检查并清除!物料代码:'+ @i + ' 异常批号是:' + @l
raiserror (@t,16,1)
end
end
【emoji】
【emoji】
【emoji】
【emoji】
批号主档空格控制触发器
本文2024-09-16 17:23:16发表“云星空知识”栏目。
本文链接:https://wenku.my7c.com/article/kingdee-k3cloud-15389.html
- 鼎捷EAI整合規範文件V3.1.07 (集團).pdf
- 鼎捷OpenAPI應用場景說明_基礎資料.pdf
- 鼎捷OpenAPI應用場景說明_財務管理.pdf
- 鼎捷T100 API設計器使用手冊T100 APIDesigner(V1.0).docx
- 鼎新e-GoB2雲端ERP B2 線上課程E6-2應付票據整批郵寄 領取.pdf
- 鼎新e-GoB2雲端ERP B2 線上課程A4使用者建立權限設定.pdf
- 鼎新e-GoB2雲端ERP B2 線上課程C3會計開帳與會計傳票.pdf
- 鼎新e-GoB2雲端ERP B2 線上課程E6-1應付票據.pdf
- 鼎新e-GoB2雲端ERP B2 線上課程A5-1進銷存參數設定(初階篇).pdf
- 鼎新e-GoB2雲端ERP B2 線上課程D2帳款開帳與票據開帳.pdf