From af7cef297da2ac1937dbcf437c3a91b00658f6c2 Mon Sep 17 00:00:00 2001
From: yl <ykxkd@outlook.com>
Date: 星期三, 29 三月 2023 10:47:39 +0800
Subject: [PATCH] 订单下达获取工单语句修改,手工创建工单获取单号接口

---
 VueWebApi/Controllers/ProductionManagementController.cs |   14 ++++++++++++++
 .vs/VueWebApi/v16/.suo                                  |    0 
 VueWebApi/DLL/BLL/ProductionManagementBLL.cs            |    7 +++++++
 VueWebApi/DLL/DAL/ProductionManagementDAL.cs            |   30 +++++++++++++++++++++++++++++-
 4 files changed, 50 insertions(+), 1 deletions(-)

diff --git a/.vs/VueWebApi/v16/.suo b/.vs/VueWebApi/v16/.suo
index 26acc6c..713b813 100644
--- a/.vs/VueWebApi/v16/.suo
+++ b/.vs/VueWebApi/v16/.suo
Binary files differ
diff --git a/VueWebApi/Controllers/ProductionManagementController.cs b/VueWebApi/Controllers/ProductionManagementController.cs
index 5473ebd..c5a8ca6 100644
--- a/VueWebApi/Controllers/ProductionManagementController.cs
+++ b/VueWebApi/Controllers/ProductionManagementController.cs
@@ -248,6 +248,20 @@
         }
         #endregion
 
+        #region[MES宸ュ崟鏂板銆佽幏鍙栧伐鍗曞彿]
+        /// <summary>
+        /// MES宸ュ崟鏂板銆佽幏鍙栧伐鍗曞彿
+        /// </summary>
+        /// <returns></returns>
+        [Route(template: "AddMesOrderCodeSearch")]
+        [HttpPost]
+        public HttpResponseMessage AddMesOrderCodeSearch()
+        {
+            mes = ProductionManagementBLL.AddMesOrderCodeSearch();
+            return TJson.toJson(mes);
+        }
+        #endregion
+
         #region[MES宸ュ崟鏂板銆佺紪杈戞彁浜
         /// <summary>
         /// MES宸ュ崟鏂板銆佺紪杈戞彁浜�
diff --git a/VueWebApi/DLL/BLL/ProductionManagementBLL.cs b/VueWebApi/DLL/BLL/ProductionManagementBLL.cs
index db9e473..2740802 100644
--- a/VueWebApi/DLL/BLL/ProductionManagementBLL.cs
+++ b/VueWebApi/DLL/BLL/ProductionManagementBLL.cs
@@ -83,6 +83,13 @@
         }
         #endregion
 
+        #region[MES宸ュ崟鏂板銆佽幏鍙栧伐鍗曞彿]
+        public static ToMessage AddMesOrderCodeSearch()
+        {
+            return ProductionManagementDAL.AddMesOrderCodeSearch();
+        }
+        #endregion
+
         #region[MES宸ュ崟鏂板銆佺紪杈戞彁浜
         public static ToMessage AddUpdateMesOrder(string mesorderstus, string mesordercode,string sourceorder,string ordertype, string partcode, string mesqty, string routecode, string wkshopcode, string planstartdate, string planenddate, string orderlev, string username, string opertype,string is_aps,string bom_id)
         {
diff --git a/VueWebApi/DLL/DAL/ProductionManagementDAL.cs b/VueWebApi/DLL/DAL/ProductionManagementDAL.cs
index a127401..745bc95 100644
--- a/VueWebApi/DLL/DAL/ProductionManagementDAL.cs
+++ b/VueWebApi/DLL/DAL/ProductionManagementDAL.cs
@@ -127,7 +127,8 @@
                     //鑾峰彇鏈�澶у崟鎹彿
                     if (i == 1)  //棣栧崟鑾峰彇宸ュ崟鍙�
                     {
-                        sql = @"select isnull(max(substring(wo_code,charindex('_',wo_code)+1,len(wo_code)-charindex('_',wo_code))),0)+1 as worknumb from TK_Wrk_Man where m_po=@erpordercode";
+                        sql = @"select isnull(max(cast(substring(wo_code,charindex('_',wo_code)+1,len(wo_code)-charindex('_',wo_code)) as numeric)),0)+1 as worknumb   
+                                from TK_Wrk_Man where m_po=@erpordercode";
                         dynamicParams.Add("@erpordercode", erpordercode);
                         var data = DapperHelper.selectdata(sql, dynamicParams);
                         num = Convert.ToInt32(data.Rows[0]["WORKNUMB"].ToString());
@@ -652,6 +653,33 @@
         }
         #endregion
 
+        #region[MES宸ュ崟鏂板銆佽幏鍙栧伐鍗曞彿]
+        public static ToMessage AddMesOrderCodeSearch()
+        {
+            string sql = "";
+            string wo_code = "";
+            var dynamicParams = new DynamicParameters();
+            try
+            {
+                //鑾峰彇鍗曟嵁鍙�
+                sql = @"SELECT 'SGPO'+CONVERT(varchar(12) , getdate(), 112 )+'_'+cast(isnull(max(cast(substring(wo_code,charindex('_',wo_code)+1,len(wo_code)-charindex('_',wo_code)) as numeric)),0)+1 as varchar) as numct
+                        FROM TK_Wrk_Man where wo_code like '%SGPO%'";
+                var data = DapperHelper.selecttable(sql);
+                mes.code = "200";
+                mes.Message = "鏌ヨ鎴愬姛!";
+                mes.data = data.Rows[0]["numct"].ToString();
+            }
+            catch (Exception e)
+            {
+                mes.code = "300";
+                mes.count = 0;
+                mes.Message = e.Message;
+                mes.data = null;
+            }
+            return mes;
+        }
+        #endregion
+
         #region[MES宸ュ崟鏂板銆佺紪杈戞彁浜
         public static ToMessage AddUpdateMesOrder(string mesorderstus, string sourceorder, string ordertype, string mesordercode, string partcode, string mesqty, string routecode, string wkshopcode, string planstartdate, string planenddate, string orderlev, string username, string opertype, string is_aps, string bom_id)
         {

--
Gitblit v1.9.3