| | |
| | | } |
| | | if (userName != "" && userName != null) |
| | | { |
| | | search += "and parent.lm_user like '%'+@userName+'%' "; |
| | | search += "and U.username like '%'+@userName+'%' "; |
| | | dynamicParams.Add("@userName", userName); |
| | | } |
| | | if (search == "") |
| | |
| | | parent.parent_id, |
| | | child.org_code as parentorg_code, |
| | | child.org_name as parentorg_name, |
| | | parent.lm_user, |
| | | U.username as lm_user, |
| | | parent.lm_date |
| | | from TOrganization as parent |
| | | left join TOrganization as child on parent.parent_id=child.id where parent.is_delete<>1 " + search; |
| | | left join TOrganization as child on parent.parent_id=child.id |
| | | left join TUser U on parent.lm_user=U.usercode |
| | | where parent.is_delete<>1 " + search; |
| | | var data = DapperHelper.GetPageList<object>(sql, dynamicParams, prop, order, startNum, endNum, out total); |
| | | mes.code = "200"; |
| | | mes.Message = "查询成功!"; |
| | |
| | | dynamicParams.Add("@orgcode", orgcode); |
| | | break; |
| | | } |
| | | sql = @"select id,org_code,org_name |
| | | sql = @"select id,org_code,org_name |
| | | from TOrganization |
| | | where is_delete<>'1' " + search; |
| | | |
| | |
| | | #endregion |
| | | |
| | | #region[新增编辑组织架构] |
| | | public static ToMessage AddUpdateOrganization(string organType, string organCode, string organName, string Operator, int supUnit,string RightCode,string numvalue, string operType) |
| | | public static ToMessage AddUpdateOrganization(string organType, string organCode, string organName, string Operator, int supUnit, string RightCode, string numvalue, string operType) |
| | | { |
| | | string sql = ""; |
| | | List<object> list = new List<object>(); |
| | |
| | | sql = @"select * from TOrganization where org_code=@organCode"; |
| | | dynamicParams.Add("@organCode", organCode); |
| | | var data = DapperHelper.selectdata(sql, dynamicParams); |
| | | if (data.Rows.Count > 0) |
| | | if (data.Rows.Count > 0) |
| | | { |
| | | mes.code = "300"; |
| | | mes.count = 0; |
| | |
| | | |
| | | sql = @"insert into TOrganization(parent_id,org_code,org_name,lm_user,lm_date,description) |
| | | values(@supUnit,@organCode,@organName,@Operator,@CreateDate,@organType)"; |
| | | list.Add(new { str = sql, parm = new { supUnit = supUnit, organCode= organCode, organName= organName, Operator= Operator, CreateDate= DateTime.Now.ToString(), organType= organType } }); |
| | | list.Add(new { str = sql, parm = new { supUnit = supUnit, organCode = organCode, organName = organName, Operator = Operator, CreateDate = DateTime.Now.ToString(), organType = organType } }); |
| | | //sql = @"update T_CodeRules set value=@cunm2 where rightcode=@RightCode"; |
| | | //list.Add(new { str = sql, parm = new { cunm2 = numvalue, RightCode = RightCode } }); |
| | | bool aa = DapperHelper.DoTransaction(list); |
| | |
| | | var dynamicParams = new DynamicParameters(); |
| | | try |
| | | { |
| | | sql = @"select * from TOrganization where parent_id=@orgid"; |
| | | sql = @"select * from TOrganization where parent_id=@orgid and is_delete<>'1'"; |
| | | dynamicParams.Add(@"orgid", orgid); |
| | | cont = DapperHelper.selectcount(sql, dynamicParams); |
| | | if (cont>0) |
| | | if (cont > 0) |
| | | { |
| | | mes.code = "300"; |
| | | mes.Message = "当前组织有下级关联,请先删除下级组织!"; |
| | |
| | | |
| | | |
| | | #region[用户清单数据查询] |
| | | public static ToMessage UserSearch(string UserCode, string UserName, string StuOrg,string wagetype, string Enable, int startNum, int endNum, string prop, string order) |
| | | public static ToMessage UserSearch(string UserCode, string UserName, string StuOrg, string wagetype, string Enable, int startNum, int endNum, string prop, string order) |
| | | { |
| | | var dynamicParams = new DynamicParameters(); |
| | | string search = ""; |
| | |
| | | } |
| | | if (UserName != "" && UserName != null) |
| | | { |
| | | search += "and u.username like '%'+@UserName+'%' "; |
| | | search += "and S.username like '%'+@UserName+'%' "; |
| | | dynamicParams.Add("@UserName", UserName); |
| | | } |
| | | if (StuOrg != "" && StuOrg != null) |
| | |
| | | //search = search.Substring(3);//截取索引2后面的字符 |
| | | // --------------查询指定数据-------------- |
| | | var total = 0; //总条数 |
| | | var sql = @"select u.id,u.usercode,u.username,g.group_code,g.group_name,u.stu_torgcode,t.org_name,u.password,u.mobile,u.email,u.wagetype,u.enable,u.lm_user,u.lm_date,u.is_role |
| | | var sql = @"select u.id,u.usercode,u.username,g.group_code,g.group_name,u.stu_torgcode,t.org_name,u.password,u.mobile,u.email,u.wagetype,u.enable,S.username as lm_user,u.lm_date,u.is_role |
| | | from TUser u |
| | | left join TOrganization t on u.stu_torgcode=t.org_code |
| | | left join TGroup g on u.usergroup_code=g.group_code |
| | | where u.is_delete<>1 " + search; |
| | | left join TUser S on u.lm_user=S.usercode |
| | | where u.is_delete='0' and u.userclassid='0' " + search; |
| | | var data = DapperHelper.GetPageList<object>(sql, dynamicParams, prop, order, startNum, endNum, out total); |
| | | mes.code = "200"; |
| | | mes.Message = "查询成功!"; |
| | |
| | | #endregion |
| | | |
| | | #region[用户清单新增编辑] |
| | | public static ToMessage AddUpdateUser(string UserId, string UserCode, string UserName,string Password, string Enable, string StuOrg,string groupcode, string wagetype, string Mobile, string Email, string Operator, string OperType) |
| | | public static ToMessage AddUpdateUser(string UserId, string UserCode, string UserName, string Password, string Enable, string StuOrg, string groupcode, string wagetype, string Mobile, string Email, string Operator, string OperType) |
| | | { |
| | | var dynamicParams = new DynamicParameters(); |
| | | try |
| | |
| | | { |
| | | sql = @"select B.role_code as code,B.role_name as name,(case when C.role_code is null then 'N' else 'Y' end) flag from TRole B |
| | | left join(select role_code from TUserRoleRelation where user_code=@usercode) C on B.role_code=C.role_code |
| | | where B.roletype_code=@roletype_code and B.is_delete='0'"; |
| | | where B.roletype_code=@roletype_code and B.is_delete='0' and B.is_system='0'"; |
| | | dynamicParams.Add("@roletype_code", data[i].code); |
| | | dynamicParams.Add("@usercode", usercode); |
| | | var data0 = DapperHelper.select<TreeObejctCn>(sql, dynamicParams); |
| | |
| | | { |
| | | //清除用户关联角色表数据 |
| | | sql = @"delete TUserRoleRelation where user_code=@usercode"; |
| | | list.Add(new { str = sql, parm =new {usercode = usercode } }); |
| | | list.Add(new { str = sql, parm = new { usercode = usercode } }); |
| | | //清除用户表关联角色标识 |
| | | sql = @"update TUser set is_role='N' where usercode=@usercode"; |
| | | list.Add(new { str = sql, parm = new { usercode = usercode } }); |
| | |
| | | //清除用户关联角色表数据 |
| | | sql = @"delete TUserRoleRelation where user_code=@usercode"; |
| | | list.Add(new { str = sql, parm = new { usercode = usercode } }); |
| | | |
| | | |
| | | //循环写入用户关联角色表 |
| | | for (int i = 0; i < json.Count; i++) |
| | | { |
| | | for (int j = 0; j < json[i].Data.Count; j++) |
| | | { |
| | | sql = @"insert into TUserRoleRelation(user_code,role_code) values(@usercode,@role_code)"; |
| | | list.Add(new { str = sql, parm = new { usercode = usercode, role_code= json[i].Data[j] } }); |
| | | list.Add(new { str = sql, parm = new { usercode = usercode, role_code = json[i].Data[j] } }); |
| | | |
| | | } |
| | | } |
| | | //标记用户表关联角色标识 |
| | | sql = @"update TUser set is_role='Y' where usercode=@usercode"; |
| | | list.Add(new { str = sql, parm = new { usercode = usercode} }); |
| | | list.Add(new { str = sql, parm = new { usercode = usercode } }); |
| | | } |
| | | bool aa = DapperHelper.DoTransaction(list); |
| | | if (aa) |
| | |
| | | { |
| | | sql = @"insert into TUser(usercode,username,enable,password,mobile,email,lm_user,lm_date,wagetype,stu_torgcode) |
| | | values(@usercode,@username,@enable,@password,@mobile,@email,@lm_user,@lm_date,@wagetype,@stu_torgcode)"; |
| | | list.Add(new { str = sql, parm = new { |
| | | usercode = ds.Rows[i][1].ToString(), |
| | | username = ds.Rows[i][2].ToString(), |
| | | enable = ds.Rows[i][3].ToString(), |
| | | password = ds.Rows[i][4].ToString(), |
| | | mobile = ds.Rows[i][5].ToString(), |
| | | email = ds.Rows[i][6].ToString(), |
| | | lm_user = username, |
| | | lm_date = DateTime.Now.ToString(), |
| | | wagetype = ds.Rows[i][7].ToString(), |
| | | stu_torgcode = ds.Rows[i][8].ToString() |
| | | } |
| | | list.Add(new |
| | | { |
| | | str = sql, |
| | | parm = new |
| | | { |
| | | usercode = ds.Rows[i][1].ToString(), |
| | | username = ds.Rows[i][2].ToString(), |
| | | enable = ds.Rows[i][3].ToString(), |
| | | password = ds.Rows[i][4].ToString(), |
| | | mobile = ds.Rows[i][5].ToString(), |
| | | email = ds.Rows[i][6].ToString(), |
| | | lm_user = username, |
| | | lm_date = DateTime.Now.ToString(), |
| | | wagetype = ds.Rows[i][7].ToString(), |
| | | stu_torgcode = ds.Rows[i][8].ToString() |
| | | } |
| | | }); |
| | | } |
| | | } |
| | |
| | | #endregion |
| | | |
| | | #region[用户组新增] |
| | | public static ToMessage UserGroupAdd(List<StepDefect> json,string username) |
| | | public static ToMessage UserGroupAdd(List<StepDefect> json, string username) |
| | | { |
| | | var sql = ""; |
| | | List<object> list = new List<object>(); |
| | |
| | | sql = @"select * from TUser where is_delete<>'1' and usergroup_code=@UserGrupCode"; |
| | | dynamicParams.Add("@UserGrupCode", UserGrupCode); |
| | | var data = DapperHelper.selectdata(sql, dynamicParams); |
| | | if (data.Rows.Count > 0) |
| | | if (data.Rows.Count > 0) |
| | | { |
| | | mes.code = "300"; |
| | | mes.count = 0; |
| | |
| | | } |
| | | sql = @"delete TGroup where group_code=@UserGrupCode"; |
| | | list.Add(new { str = sql, parm = new { UserGrupCode = UserGrupCode } }); |
| | | |
| | | |
| | | bool aa = DapperHelper.DoTransaction(list); |
| | | if (aa) |
| | | { |
| | |
| | | { |
| | | list.Clear(); |
| | | sql = @"delete TRoleType where roletype_code=@roletypecode"; |
| | | list.Add(new { str = sql, parm = new { roletypecode = roleTypeCode}}); |
| | | list.Add(new { str = sql, parm = new { roletypecode = roleTypeCode } }); |
| | | sql = @"delete TRole where roletype_code=@roletypecode"; |
| | | list.Add(new { str = sql, parm = new { roletypecode = roleTypeCode }}); |
| | | list.Add(new { str = sql, parm = new { roletypecode = roleTypeCode } }); |
| | | bool aa = DapperHelper.DoTransaction(list); |
| | | if (aa) |
| | | { |
| | |
| | | from TRole A |
| | | left join TRoleType B on A.roletype_code=B.roletype_code |
| | | left join TUser T on A.lm_user=T.usercode |
| | | where A.is_delete<>'1' " + search; |
| | | where A.is_delete='0' and A.is_system='0' " + search; |
| | | var data = DapperHelper.GetPageList<object>(sql, dynamicParams, prop, order, startNum, endNum, out total); |
| | | mes.code = "200"; |
| | | mes.Message = "查询成功!"; |
| | |
| | | left join TOrganization B on A.stu_torgcode=B.org_code |
| | | left join ( |
| | | select distinct user_code from TUserRoleRelation where role_code=@rolecode |
| | | ) C on A.usercode=C.user_code where A.is_delete<>'1' " + search; |
| | | ) C on A.usercode=C.user_code where A.is_delete='0' and A.userclassid='0' " + search; |
| | | dynamicParams.Add("@rolecode", rolecode); |
| | | var data = DapperHelper.GetPageList<object>(sql, dynamicParams, prop, order, startNum, endNum, out total); |
| | | mes.code = "200"; |
| | |
| | | //获取角色类型集合(包含绑定标识) |
| | | dynamicParams.Add("@role_code", rolecode); |
| | | var data = DapperHelper.selectProcedure("h_p_T_RoleAssociationUserDisplay", dynamicParams); |
| | | |
| | | |
| | | mes.code = "200"; |
| | | mes.Message = "查询成功!"; |
| | | mes.data = data; |
| | |
| | | public static ToMessage SaveRoleAssoctUser(string rolecode, List<ObjectData> json) |
| | | { |
| | | var sql = ""; |
| | | var sql2 = ""; |
| | | List<object> list = new List<object>(); |
| | | var dynamicParams = new DynamicParameters(); |
| | | try |
| | | { |
| | | list.Clear(); |
| | |
| | | //标记角色表关联用户标识 |
| | | sql = @"update TRole set is_user='N' where role_code=@rolecode"; |
| | | list.Add(new { str = sql, parm = new { rolecode = rolecode } }); |
| | | |
| | | } |
| | | else |
| | | { |
| | |
| | | #endregion |
| | | |
| | | #region[角色清单关联功能查询] |
| | | public static ToMessage RoleAssociationRight(string rolecode,string type) |
| | | public static ToMessage RoleAssociationRight(string rolecode, string type) |
| | | { |
| | | List<object> list=new List<object>(); |
| | | List<object> list = new List<object>(); |
| | | try |
| | | { |
| | | if (type == "" || type == null) |
| | |
| | | { |
| | | list.Add(SeachEncode.RightLocation(rolecode, type)); |
| | | } |
| | | else { |
| | | else |
| | | { |
| | | list.Add(SeachEncode.RightLocation(rolecode, type)); |
| | | } |
| | | mes.code = "200"; |
| | |
| | | #endregion |
| | | |
| | | #region [角色清单关联功能保存] |
| | | public static ToMessage SaveUserAssoctRight(string rolecode,string usercode, List<TreeDM> json) |
| | | public static ToMessage SaveUserAssoctRight(string rolecode, string usercode, List<TreeDM> json) |
| | | { |
| | | var sql = ""; |
| | | List<object> list = new List<object>(); |
| | |
| | | for (int i = 0; i < json.Count; i++) //PC、APP层 |
| | | { |
| | | for (int j = 0; j < json[i].children.Count; j++) //一级菜单 |
| | | { |
| | | { |
| | | for (int k = 0; k < json[i].children[j].children.Count; k++) //二级菜单 |
| | | { |
| | | sql = @"insert into TRoleRightRelation(role_code,right_code,lm_user,lm_date) values(@role_code,@right_code,@lm_user,@lm_date)"; |
| | | list.Add(new { str = sql, parm = new { |
| | | role_code = rolecode, |
| | | right_code= json[i].children[j].children[k].code, |
| | | lm_user= usercode, lm_date= DateTime.Now.ToString() |
| | | } |
| | | list.Add(new |
| | | { |
| | | str = sql, |
| | | parm = new |
| | | { |
| | | role_code = rolecode, |
| | | right_code = json[i].children[j].children[k].code, |
| | | lm_user = usercode, |
| | | lm_date = DateTime.Now.ToString() |
| | | } |
| | | }); |
| | | } |
| | | } |
| | |
| | | } |
| | | if (unitAttr != "" && unitAttr != null) |
| | | { |
| | | switch (unitAttr) |
| | | { |
| | | case "WG": //外购 |
| | | search += "and A.mtype=@unitAttr "; |
| | | dynamicParams.Add("@unitAttr", unitAttr); |
| | | break; |
| | | case "WX": //外协 |
| | | search += "and A.btype=@unitAttr "; |
| | | dynamicParams.Add("@unitAttr", unitAttr); |
| | | break; |
| | | default: //客户 |
| | | search += "and A.htype=@unitAttr "; |
| | | dynamicParams.Add("@unitAttr", unitAttr); |
| | | break; |
| | | } |
| | | search += "and A.type=@unitAttr "; |
| | | dynamicParams.Add("@unitAttr", unitAttr); |
| | | } |
| | | if (createUser != "" && createUser != null) |
| | | { |
| | |
| | | } |
| | | // --------------查询指定数据-------------- |
| | | var total = 0; //总条数 |
| | | var sql = @"select A.id,A.code,A.name,A.mtype,A.btype,A.htype,A.conttacts,A.conttphone,A.addr,T.username as lm_user,A.lm_date from TCustomer A |
| | | var sql = @"select A.id,A.code,A.name,A.type,A.conttacts,A.conttphone,A.addr,T.username as lm_user,A.lm_date from TCustomer A |
| | | left join TUser T on A.lm_user=T.usercode |
| | | where A.is_delete<>'1' " + search; |
| | | var data = DapperHelper.GetPageList<object>(sql, dynamicParams, prop, order, startNum, endNum, out total); |
| | |
| | | #endregion |
| | | |
| | | #region[往来单位新增编辑] |
| | | public static ToMessage AddUpdateCurrentUnit(string unitid, string unitcode, string unitname, string mtypecode, string btypecode, string htypecode, string person, string contact, string description, string usercode,string OperType) |
| | | public static ToMessage AddUpdateCurrentUnit(string unitid, string unitcode, string unitname, string typecode, string person, string contact, string description, string usercode, string OperType) |
| | | { |
| | | var dynamicParams = new DynamicParameters(); |
| | | try |
| | | { |
| | | if (OperType == "Add") |
| | | { |
| | | var sql0 = @"select * from TCustomer where code=@code"; |
| | | var sql0 = @"select * from TCustomer where code=@unitcode"; |
| | | dynamicParams.Add("@unitcode", unitcode); |
| | | var data = DapperHelper.selectdata(sql0, dynamicParams); |
| | | if (data.Rows.Count > 0) |
| | |
| | | mes.data = null; |
| | | return mes; |
| | | } |
| | | var sql = @"insert into TCustomer(code,name,mtype,btype,htype,conttacts,conttphone,addr,lm_user,lm_date) |
| | | values(@unitcode,@unitname,@mtypecode,@btypecode,@htypecode,@person,@contact,@description,@usercode,@CreateDate)"; |
| | | var sql = @"insert into TCustomer(code,name,type,conttacts,conttphone,addr,lm_user,lm_date) |
| | | values(@unitcode,@unitname,@typecode,@person,@contact,@description,@usercode,@CreateDate)"; |
| | | dynamicParams.Add("@unitcode", unitcode); |
| | | dynamicParams.Add("@unitname", unitname); |
| | | dynamicParams.Add("@mtypecode", mtypecode); |
| | | dynamicParams.Add("@btypecode", btypecode); |
| | | dynamicParams.Add("@htypecode", htypecode); |
| | | dynamicParams.Add("@typecode", typecode); |
| | | dynamicParams.Add("@person", person); |
| | | dynamicParams.Add("@contact", contact); |
| | | dynamicParams.Add("@description", description); |
| | |
| | | } |
| | | if (OperType == "Update") |
| | | { |
| | | var sql = @"update TCustomer set name=@unitname,mtype=@mtypecode,btype=@btypecode,htype=@htypecode,conttacts=@person,conttphone=@contact,addr=@description,lm_user=@usercode,lm_date=@CreateDate where id=@unitid"; |
| | | var sql = @"update TCustomer set name=@unitname,type=@typecode,conttacts=@person,conttphone=@contact,addr=@description,lm_user=@usercode,lm_date=@CreateDate where id=@unitid"; |
| | | dynamicParams.Add("@unitid", unitid); |
| | | dynamicParams.Add("@unitname", unitname); |
| | | dynamicParams.Add("@mtypecode", mtypecode); |
| | | dynamicParams.Add("@btypecode", btypecode); |
| | | dynamicParams.Add("@htypecode", htypecode); |
| | | dynamicParams.Add("@typecode", typecode); |
| | | dynamicParams.Add("@person", person); |
| | | dynamicParams.Add("@contact", contact); |
| | | dynamicParams.Add("@description", description); |
| | |
| | | return mes; |
| | | } |
| | | #endregion |
| | | |
| | | |
| | | #region[安灯系统/自定义安灯呼叫类型查询] |
| | | public static ToMessage AnDengTypeSearch() |
| | | { |
| | | try |
| | | { |
| | | // --------------查询指定数据-------------- |
| | | var total = 0; //总条数 |
| | | var sql = @"select id, code,name |
| | | from TAnDonType |
| | | where is_delete<>'1' "; |
| | | var data = DapperHelper.selecttable(sql); |
| | | mes.code = "200"; |
| | | mes.Message = "查询成功!"; |
| | | mes.count = total; |
| | | mes.data = data; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | mes.code = "300"; |
| | | mes.count = 0; |
| | | mes.Message = e.Message; |
| | | mes.data = null; |
| | | } |
| | | return mes; |
| | | } |
| | | #endregion |
| | | |
| | | #region[安灯系统/自定义安灯呼叫类型新增] |
| | | public static ToMessage AddUpdateAnDengType(List<ObjectData> json, string username) |
| | | { |
| | | var sql = ""; |
| | | List<object> list = new List<object>(); |
| | | var dynamicParams = new DynamicParameters(); |
| | | try |
| | | { |
| | | list.Clear(); |
| | | //循环写入呼叫类型表 |
| | | for (int i = 0; i < json.Count; i++) |
| | | { |
| | | sql = @"insert into TAnDonType(code,name,lm_user,lm_date) values(@code,@name,@username,@createdate)"; |
| | | list.Add(new |
| | | { |
| | | str = sql, |
| | | parm = new |
| | | { |
| | | code = json[i].code, |
| | | name = json[i].name, |
| | | username = username, |
| | | createdate = DateTime.Now.ToString() |
| | | } |
| | | }); |
| | | } |
| | | bool aa = DapperHelper.DoTransaction(list); |
| | | if (aa) |
| | | { |
| | | mes.code = "200"; |
| | | mes.count = 0; |
| | | mes.Message = "操作成功!"; |
| | | mes.data = null; |
| | | } |
| | | else |
| | | { |
| | | mes.code = "300"; |
| | | mes.count = 0; |
| | | mes.Message = "操作失败!"; |
| | | mes.data = null; |
| | | } |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | mes.code = "300"; |
| | | mes.count = 0; |
| | | mes.Message = e.Message; |
| | | mes.data = null; |
| | | } |
| | | return mes; |
| | | } |
| | | #endregion |
| | | |
| | | #region[安灯系统/自定义安灯呼叫类型删除] |
| | | public static ToMessage DeleteAnDengType(string andengtypecode) |
| | | { |
| | | var sql = ""; |
| | | List<object> list = new List<object>(); |
| | | var dynamicParams = new DynamicParameters(); |
| | | try |
| | | { |
| | | list.Clear(); |
| | | //判断呼叫类型下是否关联 |
| | | sql = @"select * from TAnDon_Roul_ConFig where andotype_code=@andengtypecode and is_delete<>'1'"; |
| | | dynamicParams.Add("@andengtypecode", andengtypecode); |
| | | var data = DapperHelper.selectdata(sql, dynamicParams); |
| | | if (data.Rows.Count > 0) |
| | | { |
| | | mes.code = "300"; |
| | | mes.count = 0; |
| | | mes.Message = "当前呼叫类型已关联呼叫配置,不允许删除!"; |
| | | mes.data = null; |
| | | } |
| | | else |
| | | { |
| | | sql = @"delete TAnDonType where code=@andengtypecode"; |
| | | list.Add(new { str = sql, parm = new { andengtypecode = andengtypecode } }); |
| | | bool aa = DapperHelper.DoTransaction(list); |
| | | if (aa) |
| | | { |
| | | mes.code = "200"; |
| | | mes.count = 0; |
| | | mes.Message = "删除成功!"; |
| | | mes.data = null; |
| | | } |
| | | else |
| | | { |
| | | mes.code = "300"; |
| | | mes.count = 0; |
| | | mes.Message = "删除失败!"; |
| | | mes.data = null; |
| | | } |
| | | } |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | mes.code = "300"; |
| | | mes.count = 0; |
| | | mes.Message = e.Message; |
| | | mes.data = null; |
| | | } |
| | | return mes; |
| | | } |
| | | #endregion |
| | | |
| | | #region[安灯系统/查询绑定的响应人员] |
| | | public static ToMessage AnDengResponUserSearch(string wkshopcode, string calltypecode) |
| | | { |
| | | var sql = ""; |
| | | var dynamicParams = new DynamicParameters(); |
| | | try |
| | | { |
| | | sql = @"select B.id,B.ando_cogfigid,U.usercode,U.username,A.enable from TAnDon_Roul_ConFig A |
| | | inner join TAnDon_Roul_ConFigUser B on A.id=B.ando_cogfigid |
| | | left join TUser U on B.usercode=U.usercode |
| | | where A.wkshp_code=@wkshopcode and A.andotype_code=@calltypecode and U.is_delete=0"; |
| | | dynamicParams.Add("@wkshopcode", wkshopcode); |
| | | dynamicParams.Add("@calltypecode", calltypecode); |
| | | var data = DapperHelper.selectdata(sql, dynamicParams); |
| | | |
| | | mes.code = "200"; |
| | | mes.count = 0; |
| | | mes.Message = "查询成功!"; |
| | | mes.data = data; |
| | | |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | mes.code = "300"; |
| | | mes.count = 0; |
| | | mes.Message = e.Message; |
| | | mes.data = null; |
| | | } |
| | | return mes; |
| | | } |
| | | #endregion |
| | | |
| | | #region[安灯系统/新增响应人员查询已绑定的响应人员] |
| | | public static ToMessage AnDengDialogResponUserSearch(string wkshopcode, string calltypecode) |
| | | { |
| | | var sql = ""; |
| | | var dynamicParams = new DynamicParameters(); |
| | | try |
| | | { |
| | | sql = @"select A.usercode,A.username,(case when B.usercode<>'' then 'Y' else 'N' end) as flag |
| | | from TUser A |
| | | left join ( |
| | | select B.usercode from TAnDon_Roul_ConFig A |
| | | inner join TAnDon_Roul_ConFigUser B on A.id=B.ando_cogfigid |
| | | where A.wkshp_code=@wkshopcode and A.andotype_code=@calltypecode |
| | | ) B on A.usercode=B.usercode |
| | | where A.userclassid='0'"; |
| | | dynamicParams.Add("@wkshopcode", wkshopcode); |
| | | dynamicParams.Add("@calltypecode", calltypecode); |
| | | var data = DapperHelper.selectdata(sql, dynamicParams); |
| | | if (data.Rows.Count > 0) |
| | | { |
| | | mes.code = "200"; |
| | | mes.count = 0; |
| | | mes.Message = "查询成功!"; |
| | | mes.data = data; |
| | | } |
| | | else |
| | | { |
| | | mes.code = "300"; |
| | | mes.count = 0; |
| | | mes.Message = "暂无响应人员!"; |
| | | mes.data = null; |
| | | } |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | mes.code = "300"; |
| | | mes.count = 0; |
| | | mes.Message = e.Message; |
| | | mes.data = null; |
| | | } |
| | | return mes; |
| | | } |
| | | #endregion |
| | | |
| | | #region[安灯系统/新增响应人员提交] |
| | | public static ToMessage AnDengDigoResponUserSeave(string wkshopcode, string calltypecode, string enable, string usercode, DataTable json) |
| | | { |
| | | var sql = ""; |
| | | int mid = 0; |
| | | List<object> list = new List<object>(); |
| | | var dynamicParams = new DynamicParameters(); |
| | | try |
| | | { |
| | | list.Clear(); |
| | | //判断呼叫类型下是否关联 |
| | | sql = @"select isnull(id,0) id from TAnDon_Roul_ConFig where wkshp_code=@wkshopcode and andotype_code=@calltypecode and is_delete<>'1'"; |
| | | dynamicParams.Add("@wkshopcode", wkshopcode); |
| | | dynamicParams.Add("@calltypecode", calltypecode); |
| | | var data = DapperHelper.selectdata(sql, dynamicParams); |
| | | if (data.Rows.Count > 0) |
| | | { |
| | | mid = Convert.ToInt32(data.Rows[0]["ID"].ToString()); |
| | | //清除安灯、设备任务配置关联人员表数据 |
| | | sql = @"delete TAnDon_Roul_ConFigUser where ando_cogfigid=@mid"; |
| | | list.Add(new { str = sql, parm = new { mid = mid } }); |
| | | } |
| | | else |
| | | { |
| | | //获取主表最大ID |
| | | sql = @"select ISNULL(IDENT_CURRENT('TAnDon_Roul_ConFig')+1,1) as id"; |
| | | var dt = DapperHelper.selecttable(sql); |
| | | mid = Convert.ToInt32(dt.Rows[0]["ID"].ToString()); |
| | | //写入安灯、设备任务配置表数据 |
| | | sql = @"insert into TAnDon_Roul_ConFig(wkshp_code,andotype_code,lm_user,lm_date,enable) values(@wkshp_code,@andotype_code,@lm_user,@lm_date,@enable)"; |
| | | list.Add(new |
| | | { |
| | | str = sql, |
| | | parm = new |
| | | { |
| | | wkshp_code = wkshopcode, |
| | | andotype_code = calltypecode, |
| | | lm_user = usercode, |
| | | lm_date = DateTime.Now.ToString(), |
| | | enable = enable |
| | | } |
| | | }); |
| | | } |
| | | //循环写入安灯、设备任务配置关联人员表 |
| | | for (int i = 0; i < json.Rows.Count; i++) |
| | | { |
| | | sql = @"insert into TAnDon_Roul_ConFigUser(ando_cogfigid,usercode) values(@ando_cogfigid,@role_code)"; |
| | | list.Add(new { str = sql, parm = new { ando_cogfigid = mid, role_code = json.Rows[i]["CODE"].ToString() } }); |
| | | } |
| | | bool aa = DapperHelper.DoTransaction(list); |
| | | if (aa) |
| | | { |
| | | mes.code = "200"; |
| | | mes.count = 0; |
| | | mes.Message = "操作成功!"; |
| | | mes.data = null; |
| | | } |
| | | else |
| | | { |
| | | mes.code = "300"; |
| | | mes.count = 0; |
| | | mes.Message = "操作失败!"; |
| | | mes.data = null; |
| | | } |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | mes.code = "300"; |
| | | mes.count = 0; |
| | | mes.Message = e.Message; |
| | | mes.data = null; |
| | | } |
| | | return mes; |
| | | } |
| | | #endregion |
| | | |
| | | #region[安灯系统/响应人员允许关闭] |
| | | public static ToMessage AnDengResponUserCloseSeave(string wkshopcode, string calltypecode, string enable, string usercode) |
| | | { |
| | | var sql = ""; |
| | | List<object> list = new List<object>(); |
| | | try |
| | | { |
| | | list.Clear(); |
| | | //更新安灯、设备任务配置表状态 |
| | | sql = @"update TAnDon_Roul_ConFig set enable=@enable,lm_user=@lm_user,lm_date=@lm_date where wkshp_code=@wkshp_code and andotype_code=@andengtypecode"; |
| | | list.Add(new |
| | | { |
| | | str = sql, |
| | | parm = new |
| | | { |
| | | wkshp_code = wkshopcode, |
| | | andengtypecode = calltypecode, |
| | | lm_user = usercode, |
| | | lm_date = DateTime.Now.ToString(), |
| | | enable = enable |
| | | } |
| | | }); |
| | | bool aa = DapperHelper.DoTransaction(list); |
| | | if (aa) |
| | | { |
| | | mes.code = "200"; |
| | | mes.count = 0; |
| | | mes.Message = "操作成功!"; |
| | | mes.data = null; |
| | | } |
| | | else |
| | | { |
| | | mes.code = "300"; |
| | | mes.count = 0; |
| | | mes.Message = "删除失败!"; |
| | | mes.data = null; |
| | | } |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | mes.code = "300"; |
| | | mes.count = 0; |
| | | mes.Message = e.Message; |
| | | mes.data = null; |
| | | } |
| | | return mes; |
| | | } |
| | | #endregion |
| | | |
| | | #region[安灯系统/响应人员删除] |
| | | public static ToMessage AnDengResponUserDeleteSeave(string id, string ando_cogfigid) |
| | | { |
| | | var sql = ""; |
| | | List<object> list = new List<object>(); |
| | | var dynamicParams = new DynamicParameters(); |
| | | try |
| | | { |
| | | list.Clear(); |
| | | //查询安灯、设备任务配置表 |
| | | sql = @"select id from TAnDon_Roul_ConFigUser where ando_cogfigid=@ando_cogfigid"; |
| | | dynamicParams.Add("@ando_cogfigid", ando_cogfigid); |
| | | var data = DapperHelper.selectdata(sql, dynamicParams); |
| | | if (data.Rows.Count > 1) |
| | | { |
| | | //根据子表id删除对应子表人员 |
| | | sql = @"delete TAnDon_Roul_ConFigUser where id=@id"; |
| | | list.Add(new { str = sql, parm = new { id = id } }); |
| | | } |
| | | else |
| | | { |
| | | //根据子表id删除对应子表人员 |
| | | sql = @"delete TAnDon_Roul_ConFigUser where id=@id"; |
| | | list.Add(new { str = sql, parm = new { id = id } }); |
| | | //根据主表id删除主表数据 |
| | | sql = @"delete TAnDon_Roul_ConFig where id=@id"; |
| | | list.Add(new { str = sql, parm = new { id = ando_cogfigid } }); |
| | | } |
| | | bool aa = DapperHelper.DoTransaction(list); |
| | | if (aa) |
| | | { |
| | | mes.code = "200"; |
| | | mes.count = 0; |
| | | mes.Message = "删除成功!"; |
| | | mes.data = null; |
| | | } |
| | | else |
| | | { |
| | | mes.code = "300"; |
| | | mes.count = 0; |
| | | mes.Message = "删除失败!"; |
| | | mes.data = null; |
| | | } |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | mes.code = "300"; |
| | | mes.count = 0; |
| | | mes.Message = e.Message; |
| | | mes.data = null; |
| | | } |
| | | return mes; |
| | | } |
| | | #endregion |
| | | |
| | | |
| | | #region[通过车间编码查找设备信息] |
| | | public static ToMessage WhkspIsEqpSearch(string wkshpcode) |
| | | { |
| | | string sql = ""; |
| | | var dynamicParams = new DynamicParameters(); |
| | | try |
| | | { |
| | | //获取设备下拉框数据 |
| | | sql = @"select code as eqp_code,name as eqp_name |
| | | from TEqpInfo where wksp_code=@wkshpcode and enable='Y' "; |
| | | dynamicParams.Add("@wkshpcode", wkshpcode); |
| | | var data = DapperHelper.selectdata(sql, dynamicParams); |
| | | mes.code = "200"; |
| | | mes.Message = "查询成功!"; |
| | | mes.data = data; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | mes.code = "300"; |
| | | mes.count = 0; |
| | | mes.Message = e.Message; |
| | | mes.data = null; |
| | | } |
| | | return mes; |
| | | } |
| | | #endregion |
| | | } |
| | | } |