壹佰网|ERP100 - 企业信息化知识门户

 找回密码
 注册

QQ登录

只需一步,快速开始

查看: 6223|回复: 0

[天思ERP] 天思ERP用户数自动调配方法

[复制链接]
发表于 2011/11/6 14:57:51 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。如果您注册时有任何问题请联系客服QQ: 83569622  。

您需要 登录 才可以下载或查看,没有帐号?注册

x
本帖最后由 oaerp 于 2011/11/6 14:59 编辑

针对那些买了天思ERP企业并发用户数不够的,天思本来就没有自动分配给企业内各部门用户数限制,导致各部门抢占有限的用户数,出现有些部门没有名额进入ERP工作,针对这些情况,本人特写了一个触发器,很好解决上面的问题!
主要功能:如分配制造部门5个用户名额,那么只要制造部第6个用户进入系统会被自动踢出。

在NetUser 用户表上创建触发器,代码很简单如下:

CREATE TRIGGER [TRIGGER user] ON [dbo].[Netuser]
FOR INSERT
AS
declare @UserNo nvarchar(50)
declare @dep nvarchar(50)
declare @count int
select @UserNo=UserNo from inserted
select @dep=dep  from PSWD,netuser where PSWD.USR = Netuser.UserNo and  Netuser.UserNo=@UserNo
SELECT  @count=COUNT(PSWD.DEP)
FROM PSWD INNER JOIN
      Netuser ON PSWD.USR = Netuser.UserNo AND PSWD.DEP =@dep
GROUP  BY DEP
if @dep='0000' and  @count>1
begin
delete from netuser where UserNo=@UserNo
end
if (@dep='0001'  or @dep='0003' or @dep='0004' or @dep='0010' or @dep='0011' or @dep='0020') and  @count>1
begin
delete from netuser where UserNo=@UserNo
end
if @dep='0002' and @count>3
begin
delete from netuser where UserNo=@UserNo
end
if @dep='0006' and @count>2
begin
delete from netuser where UserNo=@UserNo
end
if @dep='0014' and @count>2
begin
delete from netuser where UserNo=@UserNo
end
if @dep='0005' and @count>5
begin
delete from netuser where UserNo=@UserNo
end
if @dep='0008' and @count>1
begin
delete from netuser where UserNo=@UserNo
end
if @dep='0007' and @count>5
begin
delete from netuser where UserNo=@UserNo
end
if @dep='0009' and @count>5
begin
delete from netuser where UserNo=@UserNo
end
if @dep='0016' and @count>1
begin
delete from netuser where UserNo=@UserNo
end
if @dep='0017' and @count>1
begin
delete from netuser where UserNo=@UserNo
end
if @dep='0018' and @count>1
begin
delete from netuser where UserNo=@UserNo
end
if @dep='0021' and @count>1
begin
delete from netuser where UserNo=@UserNo
end
if @dep='0023' and @count>1
begin
delete from netuser where UserNo=@UserNo
end
if (@dep='0025' or @dep='0026') and @count>1
begin
delete from netuser where UserNo=@UserNo
end
if @dep='0015' and @count>1
begin
delete from netuser where UserNo=@UserNo
end

针对上面各部门用户数分配控制,本人写了一个小程序,在这里就不放出来,有需要可联系我:QQ:40789227


您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|Archiver|小黑屋|手机版|壹佰网 ERP100 ( 京ICP备19053597号-2 )

Copyright © 2005-2012 北京海之大网络技术有限责任公司 服务器托管由互联互通
手机:13911575376
网站技术点击发送消息给对方83569622   广告&合作 点击发送消息给对方27675401   点击发送消息给对方634043306   咨询及人才点击发送消息给对方138011526

GMT+8, 2025/11/30 09:15 , Processed in 0.012811 second(s), 14 queries , File On.

Powered by Discuz! X3.4

Copyright © 2001-2020, Tencent Cloud.

快速回复 返回顶部 返回列表