From 32c0daf9a78039004bb6c39d578f7734f13d54b1 Mon Sep 17 00:00:00 2001
From: yl <ykxkd@outlook.com>
Date: 星期二, 10 十月 2023 10:54:47 +0800
Subject: [PATCH] 1.工单派发校验工价,工价未提前设置或设置部分,如果开关关闭时,不校验是否未设置 或者未设置全,工价复制表中都会写入,没有设置的工价就默认0 如果开关打开就必须要设置工价

---
 VueWebApi/Controllers/ProductModelController.cs |   97 +++++++++++++++++++++++++++++++++---------------
 1 files changed, 67 insertions(+), 30 deletions(-)

diff --git a/VueWebApi/Controllers/ProductModelController.cs b/VueWebApi/Controllers/ProductModelController.cs
index f74dcc1..e8bd332 100644
--- a/VueWebApi/Controllers/ProductModelController.cs
+++ b/VueWebApi/Controllers/ProductModelController.cs
@@ -17,7 +17,7 @@
 
     [RoutePrefix(prefix: "api/ProductModel")]
     [ControllerGroup("鍒堕�犳ā鍨�", "鍦ㄧ嚎鎺ュ彛")]
-    //[ChannelActionFilter]
+    [ChannelActionFilter]
     public class ProductModelController : ApiController
     {
         //瀹氫箟鍏ㄥ眬淇℃伅杩斿洖鍙橀噺
@@ -216,9 +216,11 @@
         [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)
         {
+            var stu_torgcode = HttpContext.Current.Request.Cookies["stu_torgcode"].Value.ToString(); //鎵�灞炵粍缁�
+            var stu_torgtypecode = HttpContext.Current.Request.Cookies["description"].Value.ToString(); //鎵�灞炵粍缁囩被鍨�
             int startNum = rows * (page - 1) + 1;  //璧峰璁板綍rowNum
             int endNum = rows * page;   //缁撴潫璁板綍 rowNum
-            mes = ProductModelBLL.InventoryFileSelect(partcode, partname, partspec, stocktypecode, materialtypecode, storehousecode, startNum, endNum, prop, order);
+            mes = ProductModelBLL.InventoryFileSelect(stu_torgcode, stu_torgtypecode,partcode, partname, partspec, stocktypecode, materialtypecode, storehousecode, startNum, endNum, prop, order);
             return TJson.toJson(mes);
         }
         #endregion
@@ -240,12 +242,15 @@
             string uomcode = obj["uomcode"].ToString();           //鍗曚綅缂栫爜
             string warehousecode = obj["warehousecode"].ToString(); //鎵�灞炰粨搴撶紪鐮�
             string stocktypecode = obj["stocktypecode"].ToString(); //瀛樿揣绫诲瀷缂栫爜
-            string materialtypecode = obj["materialtypecode"].ToString(); //鐗╂枡绫诲瀷缂栫爜
             string minstockqty = obj["minstockqty"].ToString(); //鏈�灏忓簱瀛�
             string maxstockqty = obj["maxstockqty"].ToString(); //鏈�澶у簱瀛�
+            string is_batchno = obj["is_batchno"].ToString();   //鏄惁鎵规绠$悊
+            string is_fifo = obj["is_fifo"].ToString();         //鏄惁鍏堣繘鍏堝嚭
+            string is_incheck = obj["is_incheck"].ToString();   //鏄惁鍏ュ巶妫�楠�
+            string is_outcheck = obj["is_outcheck"].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, minstockqty, maxstockqty,is_batchno,is_fifo,is_incheck,is_outcheck, username, OperType);
             return TJson.toJson(mes);
         }
         #endregion
@@ -275,7 +280,9 @@
         [HttpGet]
         public HttpResponseMessage InventoryFileAssociationRoute(string partcode)
         {
-            mes = ProductModelBLL.InventoryFileAssociationRoute(partcode);
+            var stu_torgcode = HttpContext.Current.Request.Cookies["stu_torgcode"].Value.ToString(); //鎵�灞炵粍缁�
+            var stu_torgtypecode = HttpContext.Current.Request.Cookies["description"].Value.ToString(); //鎵�灞炵粍缁囩被鍨�
+            mes = ProductModelBLL.InventoryFileAssociationRoute(stu_torgcode, stu_torgtypecode,partcode);
             return TJson.toJson(mes);
         }
         #endregion
@@ -290,10 +297,12 @@
         /// <returns></returns>
         [Route(template: "SaveInventoryFile")]
         [HttpPost]
-        public HttpResponseMessage SaveInventoryFile(string partcode, List<ObjectData> json, string defaultroute_code = null)
+        public HttpResponseMessage SaveInventoryFile(string partcode, List<PartRout> json, string defaultroute_code = null)
         {
+            var stu_torgcode = HttpContext.Current.Request.Cookies["stu_torgcode"].Value.ToString(); //鎵�灞炵粍缁�
+            var stu_torgtypecode = HttpContext.Current.Request.Cookies["description"].Value.ToString(); //鎵�灞炵粍缁囩被鍨�
             var username = HttpContext.Current.Request.Cookies["admin"].Value.ToString(); //鎿嶄綔浜哄憳
-            mes = ProductModelBLL.SaveInventoryFile(partcode, defaultroute_code, username, json);
+            mes = ProductModelBLL.SaveInventoryFile(stu_torgcode, stu_torgtypecode, partcode, defaultroute_code, username, json);
             return TJson.toJson(mes);
         }
         #endregion
@@ -381,13 +390,28 @@
             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 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>
+        /// <param name="bomid">Bom涓昏〃id</param>
+        /// <returns></returns>
+        [Route(template: "DeleteBoIventory")]
+        [HttpPost]
+        public HttpResponseMessage DeleteBoIventory(string bomid)
+        {
+            mes = ProductModelBLL.DeleteBoIventory(bomid);
             return TJson.toJson(mes);
         }
         #endregion
@@ -402,9 +426,9 @@
         /// <returns></returns>
         [Route(template: "StepSelect")]
         [HttpGet]
-        public HttpResponseMessage StepSelect()
+        public HttpResponseMessage StepSelect(string WorkShop)
         {
-            mes = ProductModelBLL.StepSelect();
+            mes = ProductModelBLL.StepSelect(WorkShop);
             return TJson.toJson(mes);
         }
         #endregion
@@ -413,6 +437,7 @@
         /// <summary>
         /// 宸ヨ壓璺嚎鏌ヨ
         /// </summary>
+        /// <param name="WorkShop">鎵�灞炶溅闂�</param>
         /// <param name="routecode">宸ヨ壓璺嚎缂栫爜</param>
         /// <param name="routename">宸ヨ壓璺嚎鍚嶇О</param>
         /// <param name="description">宸ヨ壓璺嚎鎻忚堪</param>
@@ -424,11 +449,13 @@
         /// <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)
+        public HttpResponseMessage RouteSearch(string WorkShop=null,string routecode = null, string routename = null, string description = null, string createuser = null, int page = 0, int rows = 0, string prop = null, string order = null)
         {
+            var stu_torgcode = HttpContext.Current.Request.Cookies["stu_torgcode"].Value.ToString(); //鎵�灞炵粍缁�
+            var stu_torgtypecode = HttpContext.Current.Request.Cookies["description"].Value.ToString(); //鎵�灞炵粍缁囩被鍨�
             int startNum = rows * (page - 1) + 1;  //璧峰璁板綍rowNum
             int endNum = rows * page;   //缁撴潫璁板綍 rowNum
-            mes = ProductModelBLL.RouteSearch(routecode, routename, description, createuser, startNum, endNum, prop, order);
+            mes = ProductModelBLL.RouteSearch(stu_torgcode, stu_torgtypecode, WorkShop, routecode, routename, description, createuser, startNum, endNum, prop, order);
             return TJson.toJson(mes);
         }
         #endregion
@@ -487,6 +514,7 @@
         /// <summary>
         /// 宸ュ簭鏌ヨ
         /// </summary>
+        /// <param name="WorkShop">鎵�灞炶溅闂�</param>
         /// <param name="stepcode">宸ュ簭缂栫爜</param>
         /// <param name="stepname">宸ュ簭鍚嶇О</param>
         /// <param name="enable">鍚敤鐘舵��</param>
@@ -499,11 +527,13 @@
         /// <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)
+        public HttpResponseMessage StepSearch(string WorkShop=null, 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)
         {
+            var stu_torgcode = HttpContext.Current.Request.Cookies["stu_torgcode"].Value.ToString(); //鎵�灞炵粍缁�
+            var stu_torgtypecode = HttpContext.Current.Request.Cookies["description"].Value.ToString(); //鎵�灞炵粍缁囩被鍨�
             int startNum = rows * (page - 1) + 1;  //璧峰璁板綍rowNum
             int endNum = rows * page;   //缁撴潫璁板綍 rowNum
-            mes = ProductModelBLL.StepSearch(stepcode, stepname, enable, steptypecode, createuser, startNum, endNum, prop, order);
+            mes = ProductModelBLL.StepSearch(stu_torgcode, stu_torgtypecode, WorkShop, stepcode, stepname, enable, steptypecode, createuser, startNum, endNum, prop, order);
             return TJson.toJson(mes);
         }
         #endregion
@@ -519,6 +549,7 @@
         public HttpResponseMessage AddUpdateStep([FromBody] JObject obj)
         {
             string stepid = obj["id"].ToString();    //宸ュ簭id(涓婚敭)
+            string WorkShop = obj["WorkShop"].ToString(); //杞﹂棿缂栫爜
             string stepcode = obj["stepcode"].ToString(); //宸ュ簭缂栫爜
             string stepname = obj["stepname"].ToString(); //宸ュ簭鍚嶇О
             string steptypecode = obj["steptypecode"].ToString(); //宸ュ簭绫诲瀷缂栫爜
@@ -526,7 +557,7 @@
             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);
+            mes = ProductModelBLL.AddUpdateStep(stepid, WorkShop,stepcode, stepname, steptypecode, enable, description, username, OperType);
             return TJson.toJson(mes);
         }
         #endregion
@@ -554,9 +585,9 @@
         /// <returns></returns>
         [Route(template: "StepAssociationEqp")]
         [HttpGet]
-        public HttpResponseMessage StepAssociationEqp(string stepcode)
+        public HttpResponseMessage StepAssociationEqp(string WorkShop, string stepcode)
         {
-            mes = ProductModelBLL.StepAssociationEqp(stepcode);
+            mes = ProductModelBLL.StepAssociationEqp(WorkShop,stepcode);
             return TJson.toJson(mes);
         }
         #endregion
@@ -565,15 +596,16 @@
         /// <summary>
         /// 宸ュ簭瀹氫箟鍏宠仈宸ヤ綔绔欐彁浜�
         /// </summary>
+        /// <param name="WorkShop">鎵�灞炵粍缁囩紪鐮�(杞﹂棿)</param>
         /// <param name="stepcode">宸ュ簭缂栫爜</param>
         /// <param name="json">鎻愪氦鏁版嵁</param>
         /// <returns></returns>
         [Route(template: "SaveStepAssociationEqp")]
         [HttpPost]
-        public HttpResponseMessage SaveStepAssociationEqp(string stepcode, List<ObjectData> json)
+        public HttpResponseMessage SaveStepAssociationEqp(string WorkShop, string stepcode, List<ObjectData> json)
         {
             var username = HttpContext.Current.Request.Cookies["admin"].Value.ToString(); //鎿嶄綔浜哄憳
-            mes = ProductModelBLL.SaveStepAssociationEqp(stepcode, username, json);
+            mes = ProductModelBLL.SaveStepAssociationEqp(WorkShop,stepcode, username, json);
             return TJson.toJson(mes);
         }
         #endregion
@@ -586,9 +618,9 @@
         /// <returns></returns>
         [Route(template: "StepAssociationDefect")]
         [HttpGet]
-        public HttpResponseMessage StepAssociationDefect(string stepcode)
+        public HttpResponseMessage StepAssociationDefect(string WorkShop,  string stepcode)
         {
-            mes = ProductModelBLL.StepAssociationDefect(stepcode);
+            mes = ProductModelBLL.StepAssociationDefect(WorkShop,stepcode);
             return TJson.toJson(mes);
         }
         #endregion
@@ -602,10 +634,10 @@
         /// <returns></returns>
         [Route(template: "SaveStepAssociationDefect")]
         [HttpPost]
-        public HttpResponseMessage SaveStepAssociationDefect(string stepcode, List<ObjectData> json)
+        public HttpResponseMessage SaveStepAssociationDefect(string WorkShop, string stepcode, List<ObjectData> json)
         {
             var username = HttpContext.Current.Request.Cookies["admin"].Value.ToString(); //鎿嶄綔浜哄憳
-            mes = ProductModelBLL.SaveStepAssociationDefect(stepcode, username, json);
+            mes = ProductModelBLL.SaveStepAssociationDefect(WorkShop,stepcode, username, json);
             return TJson.toJson(mes);
         }
         #endregion
@@ -646,7 +678,9 @@
         {
             try
             {
-                mes = ProductModelBLL.PartSelectRpute(partcode);
+                var stu_torgcode = HttpContext.Current.Request.Cookies["stu_torgcode"].Value.ToString(); //鎵�灞炵粍缁�
+                var stu_torgtypecode = HttpContext.Current.Request.Cookies["description"].Value.ToString(); //鎵�灞炵粍缁囩被鍨�
+                mes = ProductModelBLL.PartSelectRpute(stu_torgcode, stu_torgtypecode,partcode);
             }
             catch (Exception e)
             {
@@ -702,6 +736,7 @@
         /// <param name="partcode">浜у搧缂栫爜</param>
         ///  <param name="routecode">宸ヨ壓璺嚎缂栫爜</param>
         /// <param name="stepcode">宸ュ簭缂栫爜</param>
+        /// <param name="steptype">宸ュ簭绫诲瀷</param>
         /// <param name="page">椤电爜</param>
         /// <param name="rows">姣忛〉鏄剧ず鏉℃暟</param>
         /// <param name="prop">鎺掑簭瀛楁</param>
@@ -709,12 +744,12 @@
         /// <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)
+        public HttpResponseMessage StepSelectEqpList(string partcode, string routecode, string stepcode,string steptype, 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);
+            mes = ProductModelBLL.StepSelectEqpList(partcode, routecode, stepcode, steptype, startNum, endNum, prop, order);
             return TJson.toJson(mes);
         }
         #endregion
@@ -736,9 +771,11 @@
         [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)
         {
+            var stu_torgcode = HttpContext.Current.Request.Cookies["stu_torgcode"].Value.ToString(); //鎵�灞炵粍缁�
+            var stu_torgtypecode = HttpContext.Current.Request.Cookies["description"].Value.ToString(); //鎵�灞炵粍缁囩被鍨�
             int startNum = rows * (page - 1) + 1;  //璧峰璁板綍rowNum
             int endNum = rows * page;   //缁撴潫璁板綍 rowNum
-            mes = ProductModelBLL.BeatRateSearch(partcode,routecode, stepcode, eqpcode, startNum, endNum, prop, order);
+            mes = ProductModelBLL.BeatRateSearch(stu_torgcode, stu_torgtypecode,partcode, routecode, stepcode, eqpcode, startNum, endNum, prop, order);
             return TJson.toJson(mes);
         }
         #endregion

--
Gitblit v1.9.3