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

---
 VueWebApi/Controllers/DeviceManagerController.cs |  148 +++++++++++++++++++++++++++++++++++++++++++------
 1 files changed, 129 insertions(+), 19 deletions(-)

diff --git a/VueWebApi/Controllers/DeviceManagerController.cs b/VueWebApi/Controllers/DeviceManagerController.cs
index bd92ed0..263c74c 100644
--- a/VueWebApi/Controllers/DeviceManagerController.cs
+++ b/VueWebApi/Controllers/DeviceManagerController.cs
@@ -7,6 +7,7 @@
 using System.Web;
 using System.Web.Http;
 using VueWebApi.DLL.BLL;
+using VueWebApi.Models;
 using VueWebApi.Tools;
 
 namespace VueWebApi.Controllers
@@ -43,18 +44,14 @@
         /// <summary>
         /// 璁惧绫诲瀷鏂板
         /// </summary>
-        /// <param name="obj">鎻愪氦鏁版嵁瀵硅薄</param>
+        /// <param name="json">鎻愪氦鏁版嵁瀵硅薄</param>
         /// <returns></returns>
         [Route(template: "AddUpdateDeviceType")]
         [HttpPost]
-        public HttpResponseMessage AddUpdateDeviceType([FromBody] JObject obj)
+        public HttpResponseMessage AddUpdateDeviceType(List<ObjectDataCont> json)
         {
-            //string deviceid = obj["id"].ToString();    //璁惧绫诲瀷id(涓婚敭)
-            string devicetypecode = obj["devicetypecode"].ToString(); //璁惧绫诲瀷缂栫爜
-            string devicetypename = obj["devicetypename"].ToString(); //璁惧绫诲瀷鍚嶇О
-            string devicetypedescipt = obj["devicetypedescipt"].ToString(); //璁惧绫诲瀷鎻忚堪
-            var usercode = HttpContext.Current.Request.Cookies["navTabId"].Value.ToString();
-            mes = DeviceManagerBLL.AddUpdateDeviceType(devicetypecode, devicetypename, devicetypedescipt, usercode);
+            var username = HttpContext.Current.Request.Cookies["admin"].Value.ToString();
+            mes = DeviceManagerBLL.AddUpdateDeviceType(json, username);
             return TJson.toJson(mes);
         }
         #endregion
@@ -63,18 +60,129 @@
         /// <summary>
         /// 璁惧绫诲瀷鍒犻櫎
         /// </summary>
-        /// <param name="devicetypeid">璁惧绫诲瀷ID</param>
+        /// <param name="devicetypecode">璁惧绫诲瀷缂栫爜</param>
         /// <returns></returns>
         [Route(template: "DeleteDeviceType")]
         [HttpPost]
-        public HttpResponseMessage DeleteDeviceType(string devicetypeid)
+        public HttpResponseMessage DeleteDeviceType(string devicetypecode)
         {
-            mes = DeviceManagerBLL.DeleteDeviceType(devicetypeid);
+            mes = DeviceManagerBLL.DeleteDeviceType(devicetypecode);
             return TJson.toJson(mes);
         }
         #endregion
 
 
+        #region[璁惧绫诲瀷涓嬫媺妗嗘帴鍙
+        /// <summary>
+        /// 璁惧绫诲瀷涓嬫媺妗嗘帴鍙�
+        /// </summary>
+        /// <returns></returns>
+        [Route(template: "DeviceTypeSelect")]
+        [HttpGet]
+        public HttpResponseMessage DeviceTypeSelect()
+        {
+            try
+            {
+                mes = DeviceManagerBLL.DeviceTypeSelect();
+            }
+            catch (Exception e)
+            {
+                mes.code = "300";
+                mes.Message = e.Message;
+            }
+            return TJson.toJson(mes);
+        }
+        #endregion
+
+        #region[璁惧缁勬煡璇
+        /// <summary>
+        /// 璁惧缁勬煡璇�
+        /// </summary>
+        /// <param name="page">椤电爜</param>
+        /// <param name="rows">姣忛〉鏄剧ず鏉℃暟</param>
+        /// <param name="prop">鎺掑簭瀛楁</param>
+        /// <param name="order">鎺掑簭瑙勫垯</param>
+        /// <returns></returns>
+        [Route(template: "DeviceGroupSearch")]
+        [HttpGet]
+        public HttpResponseMessage DeviceGroupSearch(int page = 0, int rows = 0, string prop = null, string order = null)
+        {
+            int startNum = rows * (page - 1) + 1;  //璧峰璁板綍rowNum
+            int endNum = rows * page;   //缁撴潫璁板綍 rowNum
+            mes = DeviceManagerBLL.DeviceGroupSearch(startNum, endNum, prop, order);
+            return TJson.toJson(mes);
+        }
+        #endregion
+
+        #region[璁惧缁勬柊澧瀅
+        /// <summary>
+        /// 璁惧缁勬柊澧�
+        /// </summary>
+        /// <param name="json">鎻愪氦鏁版嵁瀵硅薄</param>
+        /// <returns></returns>
+        [Route(template: "AddUpdateDeviceGroup")]
+        [HttpPost]
+        public HttpResponseMessage AddUpdateDeviceGroup(List<ObjectDataCont> json)
+        {
+            var username = HttpContext.Current.Request.Cookies["admin"].Value.ToString();
+            mes = DeviceManagerBLL.AddUpdateDeviceGroup(json, username);
+            return TJson.toJson(mes);
+        }
+        #endregion
+
+        #region[璁惧缁勫垹闄
+        /// <summary>
+        /// 璁惧缁勫垹闄�
+        /// </summary>
+        /// <param name="devicegroupcode">璁惧缁勭紪鐮�</param>
+        /// <returns></returns>
+        [Route(template: "DeleteDeviceGroup")]
+        [HttpPost]
+        public HttpResponseMessage DeleteDeviceGroup(string devicegroupcode)
+        {
+            mes = DeviceManagerBLL.DeleteDeviceGroup(devicegroupcode);
+            return TJson.toJson(mes);
+        }
+        #endregion
+
+
+        #region[璁惧绫诲瀷鏌ユ壘璁惧缁刔
+        /// <summary>
+        /// 璁惧绫诲瀷鏌ユ壘璁惧缁�
+        /// </summary>
+        /// <param name="eqptypecode">璁惧绫诲瀷缂栫爜</param>
+        /// <returns></returns>
+        [Route(template: "DeviceTypeSelectGroup")]
+        [HttpGet]
+        public HttpResponseMessage DeviceTypeSelectGroup(string eqptypecode)
+        {
+            try
+            {
+                mes = DeviceManagerBLL.DeviceTypeSelectGroup(eqptypecode);
+            }
+            catch (Exception e)
+            {
+                mes.code = "300";
+                mes.Message = e.Message;
+            }
+            return TJson.toJson(mes);
+        }
+        #endregion
+
+        #region[鎵�灞炶溅闂翠笅鎷夋帴鍙
+        /// <summary>
+        /// 鎵�灞炶溅闂翠笅鎷夋帴鍙�
+        /// </summary>
+        /// <returns></returns>
+
+        [Route(template: "WorkShopSelect")]
+        [HttpGet]
+        public HttpResponseMessage WorkShopSelect()
+        {
+            mes = DeviceManagerBLL.WorkShopSelect();
+            return TJson.toJson(mes);
+        }
+        #endregion
 
         #region[璁惧娓呭崟鏌ヨ]
         /// <summary>
@@ -115,15 +223,16 @@
             string deviceid = obj["id"].ToString();    //璁惧娓呭崟id(涓婚敭)
             string devicecode = obj["devicecode"].ToString(); //璁惧缂栫爜
             string devicename = obj["devicename"].ToString(); //璁惧鍚嶇О
-            string devicetype = obj["devicetype"].ToString(); //璁惧绫诲瀷
-            string devicegroup = obj["devicegroup"].ToString(); //璁惧缁�
+            string devicetype = obj["devicetypecode"].ToString(); //璁惧绫诲瀷缂栫爜
+            string devicegroup = obj["devicegroupcode"].ToString(); //璁惧缁勭紪鐮�
             string importdate = obj["importdate"].ToString(); //鎶曞叆鏃ユ湡
-            string workshop = obj["workshop"].ToString(); //鎵�灞炶溅闂�
+            string workshop = obj["workshopcode"].ToString(); //鎵�灞炶溅闂寸紪鐮�
+            string linecode = obj["linecode"].ToString(); //鎵�灞炰骇绾跨紪鐮�
             string status = obj["status"].ToString(); //浣跨敤鐘舵��
             string ratio = obj["ratio"].ToString(); //绋煎姩鐜�
-            var usercode = HttpContext.Current.Request.Cookies["navTabId"].Value.ToString();
+            var usercode = HttpContext.Current.Request.Cookies["admin"].Value.ToString();
             string OperType = obj["OperType"].ToString();  //鎿嶄綔绫诲瀷
-            mes = DeviceManagerBLL.AddUpdateDeviceManger(deviceid, devicecode, devicename, devicetype, devicegroup, importdate, workshop, status, ratio, usercode, OperType);
+            mes = DeviceManagerBLL.AddUpdateDeviceManger(deviceid, devicecode, devicename, devicetype, devicegroup, importdate, workshop, linecode, status, ratio, usercode, OperType);
             return TJson.toJson(mes);
         }
         #endregion
@@ -132,15 +241,16 @@
         /// <summary>
         /// 璁惧娓呭崟鍒犻櫎
         /// </summary>
-        /// <param name="deviceid">璁惧ID</param>
+        /// <param name="devicecode">璁惧缂栫爜</param>
         /// <returns></returns>
         [Route(template: "DeleteDeviceManger")]
         [HttpPost]
-        public HttpResponseMessage DeleteDeviceManger(string deviceid)
+        public HttpResponseMessage DeleteDeviceManger(string devicecode)
         {
-            mes = DeviceManagerBLL.DeleteDeviceManger(deviceid);
+            mes = DeviceManagerBLL.DeleteDeviceManger(devicecode);
             return TJson.toJson(mes);
         }
         #endregion
+
     }
 }

--
Gitblit v1.9.3