From 7a0d98456b4ecaf1867cd62ecb7c8169ec15d042 Mon Sep 17 00:00:00 2001
From: yl <ykxkd@outlook.com>
Date: 星期三, 22 六月 2022 18:20:34 +0800
Subject: [PATCH] 设备清单查询、新增、编辑、删除接口开发 设备类型(新增、删除)、设备组(新增、删除)接口开发 仓库定义(新增、编辑、删除)、库位定义(新增、编辑、删除) 存货类型、存货档案接口开发

---
 VueWebApi/DLL/DAL/BasicSettingDAL.cs |   95 +++++++++++++++++++++++++----------------------
 1 files changed, 51 insertions(+), 44 deletions(-)

diff --git a/VueWebApi/DLL/DAL/BasicSettingDAL.cs b/VueWebApi/DLL/DAL/BasicSettingDAL.cs
index a66ec5a..4a2f631 100644
--- a/VueWebApi/DLL/DAL/BasicSettingDAL.cs
+++ b/VueWebApi/DLL/DAL/BasicSettingDAL.cs
@@ -807,6 +807,30 @@
         }
         #endregion
 
+        #region[瑙掕壊绫诲瀷涓嬫媺鎺ュ彛]
+        public static ToMessage RoleTypeSelect()
+        {
+            string sql = "";
+            try
+            {
+                //鑾峰彇璁惧绫诲瀷鏁版嵁
+                sql = @"select roletype_code,roletype_name from TRoleType where is_delete<>'1' ";
+                var data = DapperHelper.selecttable(sql);
+                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
+
         #region[瑙掕壊娓呭崟鏌ヨ]
         public static ToMessage RoleSearch(string RoleCode, string RoleName, string RoleTypeCode, string CreateUser, int startNum, int endNum, string prop, string order)
         {
@@ -1041,39 +1065,6 @@
         #region[鐢ㄦ埛娓呭崟鍏宠仈瑙掕壊鏌ヨ1]
         public static ToMessage RoleAssociationUserTwo(string rolecode)
         {
-            var dynamicParams = new DynamicParameters();
-            string sql = "";
-            try
-            {
-                List<TreeDG> list = new List<TreeDG>();
-                sql = @"select id,parent_id,org_code,org_name,description  
-                      FROM TOrganization ";
-                var dt = DapperHelper.selectdata(sql, dynamicParams);
-                for (int i = 0; i < dt.Rows.Count; i++)   //杩欓噷鏄惊鐜墍鏈�
-                {
-                    if (string.IsNullOrEmpty(dt.Rows[i]["PARENT_ID"].ToString()) || dt.Rows[i]["PARENT_ID"].ToString() == "0")  //鍒ゆ柇鏄惁鏈�澶栧眰鏍硅妭鐐�
-                    {
-                        TreeDG tbj = new TreeDG();
-                        tbj.id = dt.Rows[i]["ID"].ToString();
-                        tbj.code = dt.Rows[i]["ORG_CODE"].ToString();
-                        tbj.name = dt.Rows[i]["ORG_NAME"].ToString();
-                        list.Add(tbj);
-                    }
-                }
-                digui(dt, list);
-                mes.code = "200";
-                mes.Message = "鍔犺浇瀹屾垚";
-                mes.data = list;
-            }
-            catch (Exception e)
-            {
-                mes.code = "300";
-                mes.count = 0;
-                mes.data = e.Message;
-                mes.data = null;
-            }
-            return mes;
-
             string sql = "";
             var dynamicParams = new DynamicParameters();
             List<TreeObejct> list = new List<TreeObejct>();
@@ -1160,8 +1151,6 @@
         #region[瑙掕壊娓呭崟鍏宠仈鍔熻兘鏌ヨ]
         public static ToMessage RoleAssociationRight(string rolecode,string type)
         {
-
-            Dictionary<object, object> dList = new Dictionary<object, object>();
             List<object> list=new List<object>();
             try
             {
@@ -1178,6 +1167,7 @@
                     list.Add(SeachEncode.RightLocation(rolecode, type));
                 }
                 mes.code = "200";
+                mes.count = list.Count;
                 mes.Message = "鏌ヨ鎴愬姛!";
                 mes.data = list;
             }
@@ -1282,8 +1272,21 @@
                 }
                 if (unitAttr != "" && unitAttr != null)
                 {
-                    search += "and unitattribute=@unitAttr ";
-                    dynamicParams.Add("@unitAttr", unitAttr);
+                    switch (unitAttr)
+                    {
+                        case "WG":  //澶栬喘
+                            search += "and mtype=@unitAttr ";
+                            dynamicParams.Add("@unitAttr", unitAttr);
+                            break;
+                        case "WX":  //澶栧崗
+                            search += "and btype=@unitAttr ";
+                            dynamicParams.Add("@unitAttr", unitAttr);
+                            break;
+                        default:    //瀹㈡埛
+                            search += "and htype=@unitAttr ";
+                            dynamicParams.Add("@unitAttr", unitAttr);
+                            break;
+                    }
                 }
                 if (createUser != "" && createUser != null)
                 {
@@ -1296,7 +1299,7 @@
                 }
                 // --------------鏌ヨ鎸囧畾鏁版嵁--------------
                 var total = 0; //鎬绘潯鏁�
-                var sql = @"select id,code,name,unitattribute,conttacts,addr,lm_user,lm_date from TCustomer
+                var sql = @"select id,code,name,mtype,btype,htype,conttacts,conttphone,addr,lm_user,lm_date from TCustomer
                             where  is_delete<>'1' " + search;
                 var data = DapperHelper.GetPageList<object>(sql, dynamicParams, prop, order, startNum, endNum, out total);
                 mes.code = "200";
@@ -1316,18 +1319,20 @@
         #endregion
 
         #region[寰�鏉ュ崟浣嶆柊澧炵紪杈慮
-        public static ToMessage AddUpdateCurrentUnit(string unitid, string unitcode, string unitname, string unitattr, 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
             {
                 if (OperType == "Add")
                 {
-                    var sql = @"insert into TCustomer(code,name,unitattribute,conttacts,conttphone,addr,lm_user,lm_date) 
-                            values(@unitcode,@unitname,@unitattr,@person,@contact,@description,@usercode,@CreateDate)";
+                    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)";
                     dynamicParams.Add("@unitcode", unitcode);
                     dynamicParams.Add("@unitname", unitname);
-                    dynamicParams.Add("@unitattr", unitattr);
+                    dynamicParams.Add("@mtypecode", mtypecode);
+                    dynamicParams.Add("@btypecode", btypecode);
+                    dynamicParams.Add("@htypecode", htypecode);
                     dynamicParams.Add("@person", person);
                     dynamicParams.Add("@contact", contact);
                     dynamicParams.Add("@description", description);
@@ -1351,10 +1356,12 @@
                 }
                 if (OperType == "Update")
                 {
-                    var sql = @"update TCustomer set name=@unitname,unitattribute=@unitattr,conttacts=@person,conttphone=@contact,addr=@description,lm_user=@usercode,lm_date=@CreateDate where id=@RoleId";
+                    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";
                     dynamicParams.Add("@unitid", unitid);
                     dynamicParams.Add("@unitname", unitname);
-                    dynamicParams.Add("@unitattr", unitattr);
+                    dynamicParams.Add("@mtypecode", mtypecode);
+                    dynamicParams.Add("@btypecode", btypecode);
+                    dynamicParams.Add("@htypecode", htypecode);
                     dynamicParams.Add("@person", person);
                     dynamicParams.Add("@contact", contact);
                     dynamicParams.Add("@description", description);

--
Gitblit v1.9.3