From 449c71df5b341ff2234bfe959dfbaff9fe0baa7d Mon Sep 17 00:00:00 2001
From: yl <ykxkd@outlook.com>
Date: 星期二, 11 十月 2022 18:53:05 +0800
Subject: [PATCH] 物料清单,新增、编辑、保存、获取版本号接口开发 自动排程接口开发

---
 VueWebApi/Controllers/ProductModelController.cs |  553 +++++++++++++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 536 insertions(+), 17 deletions(-)

diff --git a/VueWebApi/Controllers/ProductModelController.cs b/VueWebApi/Controllers/ProductModelController.cs
index fd161db..f74dcc1 100644
--- a/VueWebApi/Controllers/ProductModelController.cs
+++ b/VueWebApi/Controllers/ProductModelController.cs
@@ -1,11 +1,13 @@
 锘縰sing Newtonsoft.Json.Linq;
 using System;
 using System.Collections.Generic;
+using System.Data;
 using System.Linq;
 using System.Net;
 using System.Net.Http;
 using System.Web;
 using System.Web.Http;
+using System.Web.Script.Serialization;
 using VueWebApi.DLL.BLL;
 using VueWebApi.Models;
 using VueWebApi.Tools;
@@ -13,8 +15,9 @@
 namespace VueWebApi.Controllers
 {
 
-    [RoutePrefix(prefix: "api/BasicSetting")]
+    [RoutePrefix(prefix: "api/ProductModel")]
     [ControllerGroup("鍒堕�犳ā鍨�", "鍦ㄧ嚎鎺ュ彛")]
+    //[ChannelActionFilter]
     public class ProductModelController : ApiController
     {
         //瀹氫箟鍏ㄥ眬淇℃伅杩斿洖鍙橀噺
@@ -82,7 +85,7 @@
             string stocktypecode = obj["stocktypecode"].ToString(); //瀛樿揣绫诲瀷缂栫爜
             var username = HttpContext.Current.Request.Cookies["admin"].Value.ToString(); //鎿嶄綔浜哄憳
             string OperType = obj["OperType"].ToString();  //鎿嶄綔绫诲瀷
-            mes = ProductModelBLL.AddUpdateMaterialType(materialtypeid,materialtypecode, materialtypename, stocktypecode, username, OperType);
+            mes = ProductModelBLL.AddUpdateMaterialType(materialtypeid, materialtypecode, materialtypename, stocktypecode, username, OperType);
             return TJson.toJson(mes);
         }
         #endregion
@@ -137,7 +140,7 @@
         public HttpResponseMessage UomAdd(List<Uom> json)
         {
             var username = HttpContext.Current.Request.Cookies["admin"].Value.ToString(); //鎿嶄綔浜哄憳
-            mes = ProductModelBLL.UomAdd(username,json);
+            mes = ProductModelBLL.UomAdd(username, json);
             return TJson.toJson(mes);
         }
         #endregion
@@ -157,9 +160,9 @@
         }
         #endregion
 
-        #region[瀛樼被鍨嬫煡鎵剧墿鏂欑被鍨媇
+        #region[瀛樿揣绫诲瀷鏌ユ壘鐗╂枡绫诲瀷]
         /// <summary>
-        /// 瀛樼被鍨嬫煡鎵剧墿鏂欑被鍨�
+        /// 瀛樿揣绫诲瀷鏌ユ壘鐗╂枡绫诲瀷
         /// </summary>
         /// <param name="stocktypecode">瀛樿揣绫诲瀷缂栫爜</param>
         /// <returns></returns>
@@ -180,24 +183,38 @@
         }
         #endregion
 
+        #region[鍗曚綅涓嬫媺鍒楄〃鏌ヨ]
+        /// <summary>
+        /// 鍗曚綅涓嬫媺鍒楄〃鏌ヨ
+        /// </summary>
+        /// <returns></returns>
+        [Route(template: "UomSelect")]
+        [HttpGet]
+        public HttpResponseMessage UomSelect()
+        {
+            mes = ProductModelBLL.UomSelect();
+            return TJson.toJson(mes);
+        }
+        #endregion
+
         #region[瀛樿揣妗f鏌ヨ]
         /// <summary>
         /// 瀛樿揣妗f鏌ヨ
         /// </summary>
-        /// <param name="partcode"></param>
-        /// <param name="partname"></param>
-        /// <param name="partspec"></param>
-        /// <param name="stocktypecode"></param>
-        /// <param name="materialtypecode"></param>
-        /// <param name="storehousecode"></param>
-        /// <param name="page"></param>
-        /// <param name="rows"></param>
-        /// <param name="prop"></param>
-        /// <param name="order"></param>
+        /// <param name="partcode">鐗╂枡缂栫爜</param>
+        /// <param name="partname">鐗╂枡鍚嶇О</param>
+        /// <param name="partspec">鐗╂枡瑙勬牸</param>
+        /// <param name="stocktypecode">瀛樿揣绫诲瀷缂栫爜</param>
+        /// <param name="materialtypecode">鐗╂枡绫诲瀷缂栫爜</param>
+        /// <param name="storehousecode">鎵�灞炰粨搴撶紪鐮�</param>
+        /// <param name="page">椤电爜</param>
+        /// <param name="rows">姣忛〉鏄剧ず鏉℃暟</param>
+        /// <param name="prop">鎺掑簭瀛楁</param>
+        /// <param name="order">鎺掑簭瑙勫垯</param>
         /// <returns></returns>
         [Route(template: "InventoryFileSelect")]
         [HttpGet]
-        public HttpResponseMessage InventoryFileSelect(string partcode = null, string partname = null,string partspec=null,string stocktypecode = null,string materialtypecode=null,string storehousecode=null, int page = 0, int rows = 0, string prop = null, string order = null)
+        public HttpResponseMessage InventoryFileSelect(string partcode = null, string partname = null, string partspec = null, string stocktypecode = null, string materialtypecode = null, string storehousecode = null, int page = 0, int rows = 0, string prop = null, string order = null)
         {
             int startNum = rows * (page - 1) + 1;  //璧峰璁板綍rowNum
             int endNum = rows * page;   //缁撴潫璁板綍 rowNum
@@ -228,7 +245,7 @@
             string maxstockqty = obj["maxstockqty"].ToString(); //鏈�澶у簱瀛�
             var username = HttpContext.Current.Request.Cookies["admin"].Value.ToString(); //鎿嶄綔浜哄憳
             string OperType = obj["OperType"].ToString();  //鎿嶄綔绫诲瀷
-            mes = ProductModelBLL.AddUpdateInventoryFile(materialid, materialcode, materialname, materialspec, uomcode, warehousecode, stocktypecode, materialtypecode, minstockqty, maxstockqty,username, OperType);
+            mes = ProductModelBLL.AddUpdateInventoryFile(materialid, materialcode, materialname, materialspec, uomcode, warehousecode, stocktypecode, materialtypecode, minstockqty, maxstockqty, username, OperType);
             return TJson.toJson(mes);
         }
         #endregion
@@ -264,7 +281,509 @@
         #endregion
 
         #region[瀛樿揣妗f鍏宠仈宸ヨ壓璺嚎鎻愪氦]
+        /// <summary>
+        /// 瀛樿揣妗f鍏宠仈宸ヨ壓璺嚎鎻愪氦
+        /// </summary>
+        /// <param name="partcode">鐗╂枡缂栫爜</param>
+        /// <param name="defaultroute_code">榛樿宸ヨ壓璺嚎缂栫爜</param>
+        /// <param name="json">鎻愪氦鏁版嵁瀵硅薄</param>
+        /// <returns></returns>
+        [Route(template: "SaveInventoryFile")]
+        [HttpPost]
+        public HttpResponseMessage SaveInventoryFile(string partcode, List<ObjectData> json, string defaultroute_code = null)
+        {
+            var username = HttpContext.Current.Request.Cookies["admin"].Value.ToString(); //鎿嶄綔浜哄憳
+            mes = ProductModelBLL.SaveInventoryFile(partcode, defaultroute_code, username, json);
+            return TJson.toJson(mes);
+        }
+        #endregion
 
+
+
+        #region[鐗╂枡娓呭崟涓诲垪琛ㄦ煡璇
+        /// <summary>
+        /// 鐗╂枡娓呭崟涓诲垪琛ㄦ煡璇�
+        /// </summary>
+        /// <param name="parentpartcode">姣嶄欢缂栫爜</param>
+        /// <param name="parentpartname">姣嶄欢鍚嶇О</param>
+        /// <param name="parentpartspec">姣嶄欢瑙勬牸</param>
+        /// <param name="status">鍚敤鐘舵��</param>
+        /// <param name="version">鐗堟湰鍙�</param>
+        /// <param name="createusername">鍒涘缓浜哄憳</param>
+        /// <param name="createdate">鍒涘缓鏃ユ湡</param>
+        /// <param name="page">椤电爜</param>
+        /// <param name="rows">鍒嗛〉鏉℃暟</param>
+        /// <param name="prop">鎺掑簭瀛楁</param>
+        /// <param name="order">鎺掑簭瑙勬牸</param>
+        /// <returns></returns>
+        [Route(template: "BoIventorySelect")]
+        [HttpGet]
+        public HttpResponseMessage BoIventorySelect(string parentpartcode = null, string parentpartname = null,string parentpartspec=null,string parttype=null, string status = null, string version = null, string createusername = null, string createdate = null, int page = 0, int rows = 0, string prop = null, string order = null)
+        {
+            string createopendate = "";  //寮�濮嬫椂闂�
+            string createclosedate = "";    //缁撴潫鏃堕棿
+            if (createdate != "" && createdate != null)
+            {
+                createopendate = createdate.Split('~')[0].ToString();
+                createclosedate = createdate.Split('~')[1].ToString();
+            }
+            int startNum = rows * (page - 1) + 1;  //璧峰璁板綍rowNum
+            int endNum = rows * page;   //缁撴潫璁板綍 rowNum
+            mes = ProductModelBLL.BoIventorySelect(parentpartcode, parentpartname, parentpartspec, parttype, status, version, createusername, createopendate, createclosedate, startNum, endNum, prop, order);
+            return TJson.toJson(mes);
+        }
+        #endregion
+
+        #region[鐗╂枡娓呭崟缂栬緫鏄剧ず鍙婇瑙圿
+        /// <summary>
+        /// 鐗╂枡娓呭崟缂栬緫鏄剧ず鍙婇瑙�
+        /// </summary>
+        /// <param name="bomid">Bom涓昏〃id</param>
+        /// <returns></returns>
+        [Route(template: "BoIventorySelectView")]
+        [HttpGet]
+        public HttpResponseMessage BoIventorySelectView(string bomid)
+        {
+            mes = ProductModelBLL.BoIventorySelectView(bomid);
+            return TJson.toJson(mes);
+        }
+        #endregion
+
+        #region[鐗╂枡娓呭崟鏂板鏃惰幏鍙栨渶澶х増鏈彿]
+        /// <summary>
+        /// 鐗╂枡娓呭崟鏂板鏃惰幏鍙栨渶澶х増鏈彿
+        /// </summary>
+        /// <param name="parentpartcode">姣嶄欢缂栫爜</param>
+        /// <returns></returns>
+        [Route(template: "MaterielDetailedVsion")]
+        [HttpGet]
+        public HttpResponseMessage MaterielDetailedVsion(string parentpartcode)
+        {
+            mes = ProductModelBLL.MaterielDetailedVsion(parentpartcode);
+            return TJson.toJson(mes);
+        }
+        #endregion
+
+        #region[鐗╂枡娓呭崟鏂板/缂栬緫鎻愪氦]
+        /// <summary>
+        /// 鐗╂枡娓呭崟鏂板/缂栬緫鎻愪氦
+        /// </summary>
+        /// <param name="obj">鎻愪氦鏁版嵁</param>
+        /// <returns></returns>
+        [Route(template: "AddUpdateBoIventory")]
+        [HttpPost]
+        public HttpResponseMessage AddUpdateBoIventory([FromBody] JObject obj)
+        {
+            string bomid = obj["bomid"].ToString(); //姣嶄欢id
+            string parentpartcode = obj["parentpartcode"].ToString(); //姣嶄欢缂栫爜
+            string parentpartname = obj["parentpartname"].ToString(); //姣嶄欢鍚嶇О
+            string parentpartspec = obj["parentpartspec"].ToString(); //姣嶄欢瑙勬牸
+            string status = obj["status"].ToString();//鍚敤鐘舵��
+            string uomcode = obj["uomcode"].ToString(); //璁¢噺鍗曚綅缂栫爜
+            string quantity = obj["quantity"].ToString(); //鍩虹鏁伴噺
+            string startdate = obj["startdate"].ToString(); //鍩虹鏁伴噺
+            string version = obj["version"].ToString(); //鍩虹鏁伴噺
+            string worklist = obj["worklist"].ToString(); //鍩虹鏁伴噺
+            string opertype = obj["opertype"].ToString(); //鍩虹鏁伴噺
+            string username = HttpContext.Current.Request.Cookies["admin"].Value.ToString(); //鎿嶄綔浜哄憳
+            List<BomSub> objs = Newtonsoft.Json.JsonConvert.DeserializeObject<List<BomSub>>(worklist);
+            mes = ProductModelBLL.AddUpdateBoIventory(bomid,parentpartcode, parentpartname, parentpartspec, status, uomcode, quantity, startdate, version, username, opertype, objs);
+            return TJson.toJson(mes);
+        }
+        #endregion
+
+
+
+
+        #region[宸ュ簭涓嬫媺鏌ヨ鎺ュ彛]
+        /// <summary>
+        /// 宸ュ簭涓嬫媺鏌ヨ鎺ュ彛
+        /// </summary>
+        /// <returns></returns>
+        [Route(template: "StepSelect")]
+        [HttpGet]
+        public HttpResponseMessage StepSelect()
+        {
+            mes = ProductModelBLL.StepSelect();
+            return TJson.toJson(mes);
+        }
+        #endregion
+
+        #region[宸ヨ壓璺嚎鏌ヨ]
+        /// <summary>
+        /// 宸ヨ壓璺嚎鏌ヨ
+        /// </summary>
+        /// <param name="routecode">宸ヨ壓璺嚎缂栫爜</param>
+        /// <param name="routename">宸ヨ壓璺嚎鍚嶇О</param>
+        /// <param name="description">宸ヨ壓璺嚎鎻忚堪</param>
+        /// <param name="createuser">鍒涘缓浜哄憳</param>
+        /// <param name="page">椤电爜</param>
+        /// <param name="rows">姣忛〉鏄剧ず鏉℃暟</param>
+        /// <param name="prop">鎺掑簭瀛楁</param>
+        /// <param name="order">鎺掑簭瑙勫垯</param>
+        /// <returns></returns>
+        [Route(template: "RouteSearch")]
+        [HttpGet]
+        public HttpResponseMessage RouteSearch(string routecode = null, string routename = null, string description = null, string createuser = null, 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 = ProductModelBLL.RouteSearch(routecode, routename, description, createuser, startNum, endNum, prop, order);
+            return TJson.toJson(mes);
+        }
+        #endregion
+
+        #region[宸ヨ壓璺嚎棰勮]
+        /// <summary>
+        /// 宸ヨ壓璺嚎棰勮
+        /// </summary>
+        /// <param name="routecode">宸ヨ壓璺嚎缂栫爜</param>
+        /// <returns></returns>
+        [Route(template: "ViewRoute")]
+        [HttpGet]
+        public HttpResponseMessage ViewRoute(string routecode)
+        {
+            mes = ProductModelBLL.ViewRoute(routecode);
+            return TJson.toJson(mes);
+        }
+        #endregion
+
+        #region[宸ヨ壓璺嚎鏂板]
+        /// <summary>
+        /// 宸ヨ壓璺嚎鏂板
+        /// </summary>
+        /// <param name="id">宸ヨ壓璺嚎id</param>
+        /// <param name="opertype">鎿嶄綔绫诲瀷(鏂板)</param>
+        /// <param name="json">鎻愪氦鏁版嵁</param>
+        /// <returns></returns>
+        [Route(template: "AddUpdateRoute")]
+        [HttpPost]
+        public HttpResponseMessage AddUpdateRoute(string opertype, RoutEdit json,string id=null)
+        {
+            var username = HttpContext.Current.Request.Cookies["admin"].Value.ToString(); //鎿嶄綔浜哄憳
+            mes = ProductModelBLL.AddUpdateRoute(id, opertype, username, json);
+            return TJson.toJson(mes);
+        }
+        #endregion
+
+        #region[宸ヨ壓璺嚎鍒犻櫎]
+        /// <summary>
+        /// 宸ヨ壓璺嚎鍒犻櫎
+        /// </summary>
+        /// <param name="routecode">宸ヨ壓璺嚎缂栫爜</param>
+        /// <returns></returns>
+        [Route(template: "DeleteRoute")]
+        [HttpPost]
+        public HttpResponseMessage DeleteRoute(string routecode)
+        {
+            mes = ProductModelBLL.DeleteRoute(routecode);
+            return TJson.toJson(mes);
+        }
+        #endregion
+
+
+
+        #region[宸ュ簭鏌ヨ]
+        /// <summary>
+        /// 宸ュ簭鏌ヨ
+        /// </summary>
+        /// <param name="stepcode">宸ュ簭缂栫爜</param>
+        /// <param name="stepname">宸ュ簭鍚嶇О</param>
+        /// <param name="enable">鍚敤鐘舵��</param>
+        /// <param name="steptypecode">宸ュ簭绫诲瀷缂栫爜</param>
+        /// <param name="createuser">鍒涘缓浜哄憳</param>
+        /// <param name="page">椤电爜</param>
+        /// <param name="rows">姣忛〉鏄剧ず鏉℃暟</param>
+        /// <param name="prop">鎺掑簭瀛楁</param>
+        /// <param name="order">鎺掑簭瑙勫垯</param>
+        /// <returns></returns>
+        [Route(template: "StepSearch")]
+        [HttpGet]
+        public HttpResponseMessage StepSearch(string stepcode = null, string stepname = null, string enable = null, string steptypecode = null, string createuser = null, 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 = ProductModelBLL.StepSearch(stepcode, stepname, enable, steptypecode, createuser, startNum, endNum, prop, order);
+            return TJson.toJson(mes);
+        }
+        #endregion
+
+        #region[宸ュ簭鏂板缂栬緫]
+        /// <summary>
+        /// 宸ュ簭鏂板缂栬緫
+        /// </summary>
+        /// <param name="obj">鎻愪氦鏁版嵁瀵硅薄</param>
+        /// <returns></returns>
+        [Route(template: "AddUpdateStep")]
+        [HttpPost]
+        public HttpResponseMessage AddUpdateStep([FromBody] JObject obj)
+        {
+            string stepid = obj["id"].ToString();    //宸ュ簭id(涓婚敭)
+            string stepcode = obj["stepcode"].ToString(); //宸ュ簭缂栫爜
+            string stepname = obj["stepname"].ToString(); //宸ュ簭鍚嶇О
+            string steptypecode = obj["steptypecode"].ToString(); //宸ュ簭绫诲瀷缂栫爜
+            string enable = obj["enable"].ToString();           //鍚敤鐘舵��
+            string description = obj["description"].ToString(); //宸ュ簭鎻忚堪
+            var username = HttpContext.Current.Request.Cookies["admin"].Value.ToString(); //鎿嶄綔浜哄憳
+            string OperType = obj["OperType"].ToString();  //鎿嶄綔绫诲瀷
+            mes = ProductModelBLL.AddUpdateStep(stepid, stepcode, stepname, steptypecode, enable, description, username, OperType);
+            return TJson.toJson(mes);
+        }
+        #endregion
+
+        #region[宸ュ簭鍒犻櫎]
+        /// <summary>
+        /// 宸ュ簭鍒犻櫎
+        /// </summary>
+        /// <param name="stepcode">宸ュ簭缂栫爜</param>
+        /// <returns></returns>
+        [Route(template: "DeleteStep")]
+        [HttpPost]
+        public HttpResponseMessage DeleteStep(string stepcode)
+        {
+            mes = ProductModelBLL.DeleteStep(stepcode);
+            return TJson.toJson(mes);
+        }
+        #endregion
+
+        #region[宸ュ簭瀹氫箟鍏宠仈宸ヤ綔绔欐煡璇
+        /// <summary>
+        /// 宸ュ簭瀹氫箟鍏宠仈宸ヤ綔绔欐煡璇�
+        /// </summary>
+        /// <param name="stepcode">宸ュ簭缂栫爜</param>
+        /// <returns></returns>
+        [Route(template: "StepAssociationEqp")]
+        [HttpGet]
+        public HttpResponseMessage StepAssociationEqp(string stepcode)
+        {
+            mes = ProductModelBLL.StepAssociationEqp(stepcode);
+            return TJson.toJson(mes);
+        }
+        #endregion
+
+        #region [宸ュ簭瀹氫箟鍏宠仈宸ヤ綔绔欐彁浜
+        /// <summary>
+        /// 宸ュ簭瀹氫箟鍏宠仈宸ヤ綔绔欐彁浜�
+        /// </summary>
+        /// <param name="stepcode">宸ュ簭缂栫爜</param>
+        /// <param name="json">鎻愪氦鏁版嵁</param>
+        /// <returns></returns>
+        [Route(template: "SaveStepAssociationEqp")]
+        [HttpPost]
+        public HttpResponseMessage SaveStepAssociationEqp(string stepcode, List<ObjectData> json)
+        {
+            var username = HttpContext.Current.Request.Cookies["admin"].Value.ToString(); //鎿嶄綔浜哄憳
+            mes = ProductModelBLL.SaveStepAssociationEqp(stepcode, username, json);
+            return TJson.toJson(mes);
+        }
+        #endregion
+
+        #region[宸ュ簭鍏宠仈缂洪櫡鏌ヨ]
+        /// <summary>
+        /// 宸ュ簭鍏宠仈缂洪櫡鏌ヨ
+        /// </summary>
+        /// <param name="stepcode">宸ュ簭缂栫爜</param>
+        /// <returns></returns>
+        [Route(template: "StepAssociationDefect")]
+        [HttpGet]
+        public HttpResponseMessage StepAssociationDefect(string stepcode)
+        {
+            mes = ProductModelBLL.StepAssociationDefect(stepcode);
+            return TJson.toJson(mes);
+        }
+        #endregion
+
+        #region[宸ュ簭鍏宠仈缂洪櫡鎻愪氦]
+        /// <summary>
+        /// 宸ュ簭鍏宠仈缂洪櫡鎻愪氦
+        /// </summary>
+        /// <param name="stepcode">宸ュ簭缂栫爜</param>
+        /// <param name="json">鎻愪氦鏁版嵁</param>
+        /// <returns></returns>
+        [Route(template: "SaveStepAssociationDefect")]
+        [HttpPost]
+        public HttpResponseMessage SaveStepAssociationDefect(string stepcode, List<ObjectData> json)
+        {
+            var username = HttpContext.Current.Request.Cookies["admin"].Value.ToString(); //鎿嶄綔浜哄憳
+            mes = ProductModelBLL.SaveStepAssociationDefect(stepcode, username, json);
+            return TJson.toJson(mes);
+        }
+        #endregion
+
+
+
+        #region[浜у搧淇℃伅涓嬫媺妗嗘煡璇
+        /// <summary>
+        /// 浜у搧淇℃伅涓嬫媺妗嗘煡璇�
+        /// </summary>
+        /// <returns></returns>
+        [Route(template: "PartSelect")]
+        [HttpGet]
+        public HttpResponseMessage PartSelect()
+        {
+            try
+            {
+                mes = ProductModelBLL.PartSelect();
+            }
+            catch (Exception e)
+            {
+                mes.code = "300";
+                mes.Message = e.Message;
+            }
+            return TJson.toJson(mes);
+        }
+        #endregion
+
+        #region[浜у搧缂栫爜鏌ユ壘宸ヨ壓璺嚎涓嬫媺妗哴
+        /// <summary>
+        /// 浜у搧缂栫爜鏌ユ壘宸ヨ壓璺嚎涓嬫媺妗�
+        /// </summary>
+        /// <param name="partcode">浜у搧缂栫爜</param>
+        /// <returns></returns>
+        [Route(template: "PartSelectRpute")]
+        [HttpGet]
+        public HttpResponseMessage PartSelectRpute(string partcode)
+        {
+            try
+            {
+                mes = ProductModelBLL.PartSelectRpute(partcode);
+            }
+            catch (Exception e)
+            {
+                mes.code = "300";
+                mes.Message = e.Message;
+            }
+            return TJson.toJson(mes);
+        }
+        #endregion
+
+        #region[鏍规嵁宸ヨ壓璺嚎缂栫爜鏌ユ壘鍏宠仈宸ュ簭闆嗗悎]
+        /// <summary>
+        /// 鏍规嵁宸ヨ壓璺嚎缂栫爜鏌ユ壘鍏宠仈宸ュ簭闆嗗悎
+        /// </summary>
+        /// <param name="routecode">宸ヨ壓璺嚎缂栫爜</param>
+        /// <returns></returns>
+        [Route(template: "RouteSelectStep")]
+        [HttpGet]
+        public HttpResponseMessage RouteSelectStep(string routecode)
+        {
+            try
+            {
+                mes = ProductModelBLL.RouteSelectStep(routecode);
+            }
+            catch (Exception e)
+            {
+                mes.code = "300";
+                mes.Message = e.Message;
+            }
+            return TJson.toJson(mes);
+        }
+        #endregion
+
+        #region[鏍规嵁宸ュ簭绾跨紪鐮佹煡鎵惧叧鑱旇澶囦笅鎷夋闆嗗悎]
+        /// <summary>
+        /// 鏍规嵁宸ュ簭绾跨紪鐮佹煡鎵惧叧鑱旇澶囦笅鎷夋闆嗗悎
+        /// </summary>
+        /// <param name="stepcode">宸ュ簭缂栫爜</param>
+        /// <returns></returns>
+        [Route(template: "StepSelectEqp")]
+        [HttpGet]
+        public HttpResponseMessage StepSelectEqp(string stepcode)
+        {
+            mes = ProductModelBLL.StepSelectEqp(stepcode);
+            return TJson.toJson(mes);
+        }
+        #endregion
+
+        #region[鏍规嵁宸ュ簭绾跨紪鐮佹煡鎵惧叧鑱旇澶囧垪琛ㄩ泦鍚圿
+        /// <summary>
+        /// 鏍规嵁宸ュ簭绾跨紪鐮佹煡鎵惧叧鑱旇澶囧垪琛ㄩ泦鍚�
+        /// </summary>
+        /// <param name="partcode">浜у搧缂栫爜</param>
+        ///  <param name="routecode">宸ヨ壓璺嚎缂栫爜</param>
+        /// <param name="stepcode">宸ュ簭缂栫爜</param>
+        /// <param name="page">椤电爜</param>
+        /// <param name="rows">姣忛〉鏄剧ず鏉℃暟</param>
+        /// <param name="prop">鎺掑簭瀛楁</param>
+        /// <param name="order">鎺掑簭瑙勫垯</param>
+        /// <returns></returns>
+        [Route(template: "StepSelectEqpList")]
+        [HttpGet]
+        public HttpResponseMessage StepSelectEqpList(string partcode, string routecode, string stepcode, 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 = ProductModelBLL.StepSelectEqpList(partcode, routecode, stepcode, startNum, endNum, prop, order);
+            return TJson.toJson(mes);
+        }
+        #endregion
+
+        #region[鑺傛媿宸ヤ环鏌ヨ]
+        /// <summary>
+        /// 鑺傛媿宸ヤ环鏌ヨ
+        /// </summary>
+        /// <param name="partcode">浜у搧缂栫爜</param>
+        /// <param name="routecode">宸ヨ壓璺嚎缂栫爜</param>
+        /// <param name="stepcode">宸ュ簭缂栫爜</param>
+        /// <param name="eqpcode">璁惧缂栫爜</param>
+        /// <param name="page">椤电爜</param>
+        /// <param name="rows">姣忛〉鏄剧ず鏉℃暟</param>
+        /// <param name="prop">鎺掑簭瀛楁</param>
+        /// <param name="order">鎺掑簭瑙勫垯</param>
+        /// <returns></returns>
+        [Route(template: "BeatRateSearch")]
+        [HttpGet]
+        public HttpResponseMessage BeatRateSearch(string partcode = null, string routecode = null, string stepcode = null, string eqpcode = null,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 = ProductModelBLL.BeatRateSearch(partcode,routecode, stepcode, eqpcode, startNum, endNum, prop, order);
+            return TJson.toJson(mes);
+        }
+        #endregion
+
+        #region[鑺傛媿宸ヤ环鎻愪氦]
+        /// <summary>
+        /// 鑺傛媿宸ヤ环鎻愪氦
+        /// </summary>
+        /// <param name="obj">鎻愪氦鏁版嵁</param>
+        /// <returns></returns>
+        [Route(template: "SaveBeatRate")]
+        [HttpPost]
+        public HttpResponseMessage SaveBeatRate([FromBody] JObject obj)
+        {
+            string partcode = obj["partcode"].ToString(); //浜у搧缂栫爜
+            string routecode = obj["routecode"].ToString(); //宸ヨ壓璺嚎缂栫爜
+            string stepcode = obj["stepcode"].ToString(); //宸ュ簭缂栫爜
+            string eqpcode = obj["eqpcode"].ToString(); //璁惧缂栫爜
+            string wkshopcode = obj["wkshopcode"].ToString(); //鐢熶骇杞﹂棿缂栫爜
+            string eqp_value = obj["eqp_value"].ToString(); //璁惧鑺傛媿
+            string stand_value = obj["stand_value"].ToString(); //鐢熶骇鑺傛媿
+            string cavity_qty = obj["cavity_qty"].ToString(); //鍨嬭厰鏁�
+            string unprice = obj["unprice"].ToString(); //璁′欢鍗曚环
+            var username = HttpContext.Current.Request.Cookies["admin"].Value.ToString(); //鎿嶄綔浜哄憳
+            mes = ProductModelBLL.SaveBeatRate(partcode, routecode, stepcode, eqpcode, wkshopcode, eqp_value, stand_value, cavity_qty, unprice, username);
+            return TJson.toJson(mes);
+        }
+        #endregion
+
+        #region[鑺傛媿宸ヤ环鍒犻櫎]
+        /// <summary>
+        /// 鑺傛媿宸ヤ环鍒犻櫎
+        /// </summary>
+        /// <param name="partcode">浜у搧缂栫爜</param>
+        /// <param name="routecode">宸ヨ壓璺嚎缂栫爜</param>
+        /// <param name="stepcode">宸ュ簭缂栫爜</param>
+        /// <param name="eqpcode">璁惧缂栫爜</param>
+        /// <returns></returns>
+        [Route(template: "DeleteBeatRate")]
+        [HttpPost]
+        public HttpResponseMessage DeleteBeatRate(string partcode,string routecode,string stepcode,string eqpcode)
+        {
+            mes = ProductModelBLL.DeleteBeatRate(partcode, routecode, stepcode, eqpcode);
+            return TJson.toJson(mes);
+        }
         #endregion
 
     }

--
Gitblit v1.9.3