From 59d429fd2caa1ecb879abfd21e9be17d42a39ee0 Mon Sep 17 00:00:00 2001
From: yl <ykxkd@outlook.com>
Date: 星期四, 22 九月 2022 17:38:22 +0800
Subject: [PATCH] 点检记录导出接口报错优化、不良明细查询接口优化 安灯系统PC端接口开发

---
 VueWebApi/DLL/DAL/BasicSettingDAL.cs |  499 ++++++++++++++++++++++++++++++++++++++++++++++++++----
 1 files changed, 458 insertions(+), 41 deletions(-)

diff --git a/VueWebApi/DLL/DAL/BasicSettingDAL.cs b/VueWebApi/DLL/DAL/BasicSettingDAL.cs
index 60137cb..81d8f54 100644
--- a/VueWebApi/DLL/DAL/BasicSettingDAL.cs
+++ b/VueWebApi/DLL/DAL/BasicSettingDAL.cs
@@ -126,7 +126,7 @@
                         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;
 
@@ -147,7 +147,7 @@
         #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>();
@@ -159,7 +159,7 @@
                     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;
@@ -170,7 +170,7 @@
 
                     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);
@@ -237,7 +237,7 @@
                 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 = "褰撳墠缁勭粐鏈変笅绾у叧鑱�,璇峰厛鍒犻櫎涓嬬骇缁勭粐!";
@@ -277,7 +277,7 @@
 
 
         #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 = "";
@@ -431,7 +431,7 @@
         #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
@@ -623,7 +623,7 @@
                 {
                     //娓呴櫎鐢ㄦ埛鍏宠仈瑙掕壊琛ㄦ暟鎹�
                     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 } });
@@ -633,20 +633,20 @@
                     //娓呴櫎鐢ㄦ埛鍏宠仈瑙掕壊琛ㄦ暟鎹�
                     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)
@@ -703,18 +703,22 @@
                         {
                             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()
+                                }
                             });
                         }
                     }
@@ -777,7 +781,7 @@
         #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>();
@@ -852,7 +856,7 @@
                 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;
@@ -862,7 +866,7 @@
                 }
                 sql = @"delete TGroup where group_code=@UserGrupCode";
                 list.Add(new { str = sql, parm = new { UserGrupCode = UserGrupCode } });
-               
+
                 bool aa = DapperHelper.DoTransaction(list);
                 if (aa)
                 {
@@ -992,9 +996,9 @@
             {
                 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)
                 {
@@ -1300,7 +1304,7 @@
                 //鑾峰彇瑙掕壊绫诲瀷闆嗗悎(鍖呭惈缁戝畾鏍囪瘑)
                 dynamicParams.Add("@role_code", rolecode);
                 var data = DapperHelper.selectProcedure("h_p_T_RoleAssociationUserDisplay", dynamicParams);
-                
+
                 mes.code = "200";
                 mes.Message = "鏌ヨ鎴愬姛!";
                 mes.data = data;
@@ -1334,7 +1338,7 @@
                     //鏍囪瑙掕壊琛ㄥ叧鑱旂敤鎴锋爣璇�
                     sql = @"update TRole set is_user='N' where role_code=@rolecode";
                     list.Add(new { str = sql, parm = new { rolecode = rolecode } });
-                    
+
                 }
                 else
                 {
@@ -1379,9 +1383,9 @@
         #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)
@@ -1393,7 +1397,8 @@
                 {
                     list.Add(SeachEncode.RightLocation(rolecode, type));
                 }
-                else {
+                else
+                {
                     list.Add(SeachEncode.RightLocation(rolecode, type));
                 }
                 mes.code = "200";
@@ -1413,7 +1418,7 @@
         #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>();
@@ -1438,15 +1443,20 @@
                     for (int i = 0; i < json.Count; i++)  //PC銆丄PP灞�
                     {
                         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()
+                                    }
                                 });
                             }
                         }
@@ -1550,7 +1560,7 @@
         #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 mtypecode, string btypecode, string htypecode, string person, string contact, string description, string usercode, string OperType)
         {
             var dynamicParams = new DynamicParameters();
             try
@@ -1686,5 +1696,412 @@
             return mes;
         }
         #endregion
+
+
+        #region[瀹夌伅绯荤粺/鑷畾涔夊畨鐏懠鍙被鍨嬫煡璇
+        public static ToMessage AnDengTypeSearch(int startNum, int endNum, string prop, string order)
+        {
+            var dynamicParams = new DynamicParameters();
+            try
+            {
+                // --------------鏌ヨ鎸囧畾鏁版嵁--------------
+                var total = 0; //鎬绘潯鏁�
+                var sql = @"select id, code,name 
+                            from TAnDonType 
+                            where  is_delete<>'1' ";
+                var data = DapperHelper.GetPageList<object>(sql, dynamicParams, prop, order, startNum, endNum, out total);
+                mes.code = "200";
+                mes.Message = "鏌ヨ鎴愬姛!";
+                mes.count = total;
+                mes.data = data.ToList();
+            }
+            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";
+                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 AnDengDialogResponUserSearch(string wkshopcode, string calltypecode)
+        {
+            var sql = "";
+            var dynamicParams = new DynamicParameters();
+            try
+            {
+                sql = @"select B.user_code as code,U.username as name,(case when C.usercode is null then 'N' else 'Y' end) flag from TUserRoleRelation B 
+                            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
+                            )  C  on B.user_code=C.usercode
+                            left  join TUser U on B.user_code=U.usercode";
+                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);
+                mid = Convert.ToInt32(data.Rows[0]["ID"].ToString());
+                if (json == null || json.Rows.Count <= 0)
+                {
+                    //娓呴櫎瀹夌伅銆佽澶囦换鍔¢厤缃〃鏁版嵁
+                    sql = @"delete TAnDon_Roul_ConFig where id=@mid";
+                    list.Add(new { str = sql, parm = new { mid = mid } });
+                    //娓呴櫎瀹夌伅銆佽澶囦换鍔¢厤缃叧鑱斾汉鍛樿〃鏁版嵁
+                    sql = @"delete TAnDon_Roul_ConFigUser  where ando_cogfigid=@mid";
+                    list.Add(new { str = sql, parm = new { mid = mid } });
+                }
+                else
+                {
+                    //娓呴櫎瀹夌伅銆佽澶囦换鍔¢厤缃〃鏁版嵁
+                    sql = @"delete TAnDon_Roul_ConFig where id=@mid";
+                    list.Add(new { str = sql, parm = new { mid = mid } });
+                    //娓呴櫎瀹夌伅銆佽澶囦换鍔¢厤缃叧鑱斾汉鍛樿〃鏁版嵁
+                    sql = @"delete TAnDon_Roul_ConFigUser  where ando_cogfigid=@mid";
+                    list.Add(new { str = sql, parm = new { mid = mid } });
+
+
+                    //鑾峰彇涓昏〃鏈�澶D
+                    sql = @"select ISNULL(IDENT_CURRENT('TK_Wrk_Record')+1,1) as id";
+                    var dt = DapperHelper.selecttable(sql);
+
+                    //鍐欏叆瀹夌伅銆佽澶囦换鍔¢厤缃〃鏁版嵁
+                    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,user_code) values(@usercode,@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
     }
 }
\ No newline at end of file

--
Gitblit v1.9.3