From 2f6f2d57f37b1992d1b0d26a21c2257ce9e2b2c9 Mon Sep 17 00:00:00 2001
From: wtt <1985833171@qq.com>
Date: 星期五, 04 十月 2024 18:55:22 +0800
Subject: [PATCH] Merge branch 'master' of http://101.37.171.70:10101/r/MES-WEB-API

---
 WebAPI/WebBLL/JCJM/GYZL/Gy_CustomerService.cs                                  |   25 +
 WebAPI/Models/基础资料/Gy_Process.cs                                               |    2 
 WebAPI/Exceptions/ExcelException.cs                                            |   17 
 WebAPI/Utility/TreeUtil.cs                                                     |   74 ++
 SyntacticSugar/constant/EmptyConstant.cs                                       |   16 
 WebAPI/Models/QueryModel.cs                                                    |   21 
 WebAPI/WebAPI.csproj.user                                                      |    3 
 WebAPI/Controllers/CJGL/Cj_StationOutBillController.cs                         |   88 +--
 WebAPI/Controllers/基础资料/基础资料/Gy_MaterTypeBillController.cs                     |    4 
 WebAPI/Models/Query/QueryModel.cs                                              |   23 
 Model/obj/Release/Model.csproj.AssemblyReference.cache                         |    0 
 WebAPI/Controllers/CJGL/Sc_ProcessExchangeBillController.cs                    |   54 ++
 WebAPI/Controllers/CKGL/TMZD/Gy_BarCodeBillListController.cs                   |   77 +++
 WebAPI/Controllers/LMESController.cs                                           |  108 ++++
 WebAPI/Controllers/WebAPIController.cs                                         |   62 ++
 WebAPI/Controllers/BaseSet/Gy_ProcessController.cs                             |   11 
 WebAPI/WebBLL/JCJM/IMPL/Gy_CustomerImpl.cs                                     |  207 ++++++++
 WebAPI/Controllers/BaseSet/Gy_DepartmentController.cs                          |  242 +++++++++
 WebAPI/Controllers/BaseSet/Gy_BadReasonController.cs                           |    2 
 WebAPI/Controllers/BaseSet/Gy_CustomerController.cs                            |  116 ++++
 WebAPI/Exceptions/EmptyException.cs                                            |   17 
 WebAPI/Controllers/CJGL/Cj_StationEntrustInBillController.cs                   |   45 +
 WebAPI/Controllers/BaseSet/Gy_WarehouseController.cs                           |  242 +++++++++
 WebAPI/Controllers/SBGL/SBBB/Sb_EquipMentCollectionTechParam_TempController.cs |    5 
 24 files changed, 1,374 insertions(+), 87 deletions(-)

diff --git a/Model/obj/Release/Model.csproj.AssemblyReference.cache b/Model/obj/Release/Model.csproj.AssemblyReference.cache
index b588498..f2f1252 100644
--- a/Model/obj/Release/Model.csproj.AssemblyReference.cache
+++ b/Model/obj/Release/Model.csproj.AssemblyReference.cache
Binary files differ
diff --git a/SyntacticSugar/constant/EmptyConstant.cs b/SyntacticSugar/constant/EmptyConstant.cs
new file mode 100644
index 0000000..47d7bc1
--- /dev/null
+++ b/SyntacticSugar/constant/EmptyConstant.cs
@@ -0,0 +1,16 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace SyntacticSugar.constant
+{
+    public static class EmptyConstant
+    {
+        /// <summary>
+        /// 绌�
+        /// </summary>
+        public static int EMPTY = 0;
+    }
+}
diff --git a/WebAPI/Controllers/BaseSet/Gy_BadReasonController.cs b/WebAPI/Controllers/BaseSet/Gy_BadReasonController.cs
index 6a8549e..ad1d60a 100644
--- a/WebAPI/Controllers/BaseSet/Gy_BadReasonController.cs
+++ b/WebAPI/Controllers/BaseSet/Gy_BadReasonController.cs
@@ -4529,7 +4529,7 @@
                 }
 
                 string sql1 = "select * from  h_v_Gy_CusType where 1 = 1";
-                string sql = sql1 + sWhere + " order by HNumber ";
+                string sql = sql1 + sWhere;
                 ds = oCN.RunProcReturn(sql, "h_v_Gy_CusType");
 
                 //娣诲姞鍒楀悕
diff --git a/WebAPI/Controllers/BaseSet/Gy_CustomerController.cs b/WebAPI/Controllers/BaseSet/Gy_CustomerController.cs
index cd5c648..03f153d 100644
--- a/WebAPI/Controllers/BaseSet/Gy_CustomerController.cs
+++ b/WebAPI/Controllers/BaseSet/Gy_CustomerController.cs
@@ -9,6 +9,12 @@
 using System.Web.Http;
 using WebAPI.Models;
 using System.Text.RegularExpressions;
+using SyntacticSugar.constant;
+using System.Web;
+using WebAPI.Controllers.SCGL.鏃ヨ鍒掔鐞�;
+using WebAPI.WebBLL.JCJM.GYZL;
+using WebAPI.WebBLL.JCJM.IMPL;
+using System.IO;
 namespace WebAPI.Controllers
 {
     public class Gy_CustomerController : ApiController
@@ -19,9 +25,10 @@
 
         private json objJsonResult = new json();
         SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
+        private Gy_CustomerService customerService = new Gy_CustomerImpl();
         DataSet ds;
 
-
+        #region 杩斿洖瀹㈡埛鍒楄〃
         /// <summary>
         /// 杩斿洖瀹㈡埛鍒楄〃
         ///鍙傛暟锛歴tring sql銆�
@@ -93,6 +100,7 @@
                 return objJsonResult;
             }
         }
+        #endregion
 
         #region 瀹㈡埛瀛愯〃[鍏宠仈鐢ㄦ埛] 鏌ヨ
         /// <summary>
@@ -137,6 +145,7 @@
         }
         #endregion
 
+        #region 瀹㈡埛鍒楄〃淇敼鎸夐挳鏂规硶
         /// <summary>
         /// 瀹㈡埛鍒楄〃淇敼鎸夐挳鏂规硶
         ///鍙傛暟锛歴tring sql銆�
@@ -174,7 +183,7 @@
                 return objJsonResult;
             }
         }
-
+        #endregion
 
         #region 鑾峰彇褰撳墠鏈�澶х殑瀹㈡埛浠g爜
         [Route("Gy_Customer/getMaxCusNumber")]
@@ -214,6 +223,7 @@
         }
         #endregion
 
+        #region 鑾峰彇鏈�澶ц祫鏂橧D鍙傛暟
         /// <summary>
         /// 鑾峰彇鏈�澶у熀纭�璧勬枡ID
         ///鍙傛暟锛歴tring sql銆�
@@ -242,6 +252,7 @@
                 return objJsonResult;
             }
         }
+        #endregion
 
         #region 瀹㈡埛鏍规嵁鍒嗙被鑾峰彇鏈�澶у鎴风紪鐮�
         [Route("Gy_Customer/getMaxNum")]
@@ -320,7 +331,7 @@
         }
         #endregion
 
-
+        #region 瀹㈡埛鍒楄〃鏍戝舰缁撴瀯
         /// <summary>
         /// 瀹㈡埛鍒楄〃鏍戝舰缁撴瀯
         ///鍙傛暟锛歴tring sql銆�
@@ -350,7 +361,9 @@
                 return objJsonResult;
             }
         }
+        #endregion
 
+        #region 鏂板鍗曟嵁
         /// <summary>
         /// 鏂板鍗曟嵁-淇濆瓨鎸夐挳
         ///鍙傛暟锛歴tring sql銆�
@@ -506,9 +519,14 @@
                 return objJsonResult;
             }
         }
+        #endregion
 
-
-
+        #region 淇濆瓨瀹㈡埛鍒楄〃
+        /// <summary>
+        /// 淇濆瓨瀹㈡埛鍒楄〃
+        /// </summary>
+        /// <param name="oMain"></param>
+        /// <returns></returns>
         [Route("Gy_Customer/SaveGy_CustomerListApi")]
         [HttpPost]
         public object SaveGy_CustomerListApi([FromBody] JObject oMain)
@@ -632,9 +650,9 @@
                 return objJsonResult;
             }
         }
+        #endregion
 
-
-
+        #region 淇敼鍗曟嵁-淇濆瓨鎸夐挳
         /// <summary>
         /// 淇敼鍗曟嵁-淇濆瓨鎸夐挳
         ///鍙傛暟锛歴tring sql銆�
@@ -805,9 +823,9 @@
                 return objJsonResult;
             }
         }
+        #endregion
 
-
-
+        # region 瀹㈡埛鍒楄〃鍒犻櫎鎸夐挳
         /// <summary>
         /// 瀹㈡埛鍒楄〃鍒犻櫎鎸夐挳
         ///鍙傛暟锛歴tring sql銆�
@@ -898,7 +916,7 @@
                 return objJsonResult;
             }
         }
-
+        #endregion
 
         #region 瀹㈡埛瀹℃牳銆佸弽瀹℃牳
         /// <summary>
@@ -1090,7 +1108,6 @@
         }
         #endregion
 
-
         #region [鍚屾鍩虹璧勬枡]
         [Route("Gy_Customer/Gy_CustomerViewApi")]
         [HttpGet]
@@ -1253,7 +1270,7 @@
         }
         #endregion
 
-         #region 瀹㈡埛鍒嗙被 鏍戝舰鍥�(鏍规嵁浠g爜灞曞紑鏍戠姸鍥�)
+        #region 瀹㈡埛鍒嗙被 鏍戝舰鍥�(鏍规嵁浠g爜灞曞紑鏍戠姸鍥�)
 
         [Route("Gy_BadReason/Gy_CusrTypeTreeList")]
         [HttpGet]
@@ -1309,7 +1326,7 @@
         {
             try
             {
-                string sql1 = string.Format("select hitemid,hnumber,hname,hparentid,hlevel from Gy_CusType order by hnumber");
+                string sql1 = string.Format("select hitemid,hnumber,hname,hparentid,hlevel from Gy_CusType order by hnumber ");
 
                 ds = oCN.RunProcReturn(sql1, "Gy_CusType");
 
@@ -1349,7 +1366,77 @@
         }
         #endregion
 
+        #region 瀹㈡埛鍒楄〃 鏂囦欢涓婁紶
+        [Route("Gy_Customer/Gy_Process_Excel")]
+        [HttpPost]
+        public json Gy_Department_Excel()
+        {
+            json res = new json();
+            try
+            {
+                //鑾峰彇鏂囦欢鍚嶇О
+                var file = HttpContext.Current.Request.Files[0];
+                //鑾峰彇鏂囦欢鐗╃悊璺緞
+                string ExcelPath = HttpContext.Current.Server.MapPath("~/" + file.FileName);
+                //淇濆瓨鏂囦欢
+                file.SaveAs(ExcelPath);
 
+                NpoiHelper np = new NpoiHelper();
+                DataSet ExcelDs = np.ReadExcel(ExcelPath, 1, 1, "0");
+                //鍒犻櫎鏂囦欢
+                File.Delete(ExcelPath);
+                DataTable provisional = customerService.UploadExcel(ExcelDs);             
+                
+                res.code = CodeConstant.SUCCEED;
+                res.count = CountConstant.SUCCEED;
+                res.Message = "涓婁紶鎴愬姛";
+                res.data = provisional;
+                return res;
+            }
+            catch (Exception e)
+            {
+                res.code = "0";
+                res.count = 0;
+                res.Message = "Exception锛�" + e.ToString();
+                res.data = null;
+                return res;
+            }
+        }
+
+        /// <summary>
+        /// 鍒ゆ柇褰撳墠鑱屽憳鏄惁瀛樺湪
+        /// </summary>
+        /// <param name="HEmpNumber"></param>
+        /// <param name="HEmpName"></param>
+        /// <returns></returns>
+        private bool JudgeEmp(string HEmpNumber, string HEmpName)
+        {
+            if (!String.IsNullOrEmpty(HEmpNumber) && !String.IsNullOrEmpty(HEmpName))
+            {
+                DataSet emp = oCN.RunProcReturn("select * from Gy_Employee where HNumber = '" + HEmpNumber + "' and HName = '" + HEmpName + "'", "Gy_Employee");
+                return emp.Tables[0].Rows.Count <= EmptyConstant.EMPTY ? true : false;
+            }
+            return false;
+        }
+
+        /// <summary>
+        /// 鍒ゆ柇鍒�
+        /// </summary>
+        /// <param name="provisional"></param>
+        /// <returns></returns>
+        private static string JudgmentColumns(DataTable provisional)
+        {
+            var error = "";
+
+            //鏌ヨ娌℃湁鐨勫垪
+            if (!provisional.Columns.Contains("閮ㄩ棬浠g爜"))
+                error += "娌℃湁鎵惧埌銆愰儴闂ㄤ唬鐮併�戠殑鏍囬,";
+
+            if (!provisional.Columns.Contains("閮ㄩ棬鍚嶇О"))
+                error += "娌℃湁鎵惧埌銆愰儴闂ㄥ悕绉般�戠殑鏍囬,";
+            return error;
+        }
+        #endregion
 
         #region 鐗╂枡鍒嗙被 鏍戝舰鍥�(鏍规嵁浠g爜灞曞紑鏍戠姸鍥�)
 
@@ -1375,7 +1462,6 @@
                     getTreeByLevel(dt, tree[m].children, num + 1);//鍐嶆鐢ㄥ瓙闆嗗幓寰幆锛屾嬁鍑哄瓙闆嗙殑瀛愰泦
                 }
             }
-
         }
         public class TreeModel
         {
@@ -1386,6 +1472,7 @@
 
         #endregion
 
+        #region 閫掑綊鍑芥暟
         /// <summary>
         /// 閫掑綊鍑芥暟
         /// </summary>
@@ -1415,4 +1502,5 @@
         }
 
     }
+    #endregion
 }
\ No newline at end of file
diff --git a/WebAPI/Controllers/BaseSet/Gy_DepartmentController.cs b/WebAPI/Controllers/BaseSet/Gy_DepartmentController.cs
index 7abfd45..da05301 100644
--- a/WebAPI/Controllers/BaseSet/Gy_DepartmentController.cs
+++ b/WebAPI/Controllers/BaseSet/Gy_DepartmentController.cs
@@ -1,12 +1,16 @@
 锘縰sing Newtonsoft.Json;
 using Newtonsoft.Json.Linq;
 using Pub_Class;
+using SyntacticSugar.constant;
 using System;
 using System.Collections;
 using System.Collections.Generic;
 using System.Data;
 using System.Data.SqlClient;
+using System.IO;
+using System.Web;
 using System.Web.Http;
+using WebAPI.Controllers.SCGL.鏃ヨ鍒掔鐞�;
 using WebAPI.Models;
 namespace WebAPI.Controllers
 {
@@ -1161,5 +1165,243 @@
         }
         #endregion
 
+        #region 閮ㄩ棬鍒楄〃 鏂囦欢涓婁紶
+        [Route("Gy_Department/Gy_Process_Excel")]
+        [HttpPost]
+        public json Gy_Department_Excel()
+        {
+            json res = new json();
+            try
+            {
+                //鑾峰彇鏂囦欢鍚嶇О
+                var file = HttpContext.Current.Request.Files[0];
+                //鑾峰彇鏂囦欢鐗╃悊璺緞
+                string ExcelPath = HttpContext.Current.Server.MapPath("~/" + file.FileName);
+                //淇濆瓨鏂囦欢
+                file.SaveAs(ExcelPath);
+
+                NpoiHelper np = new NpoiHelper();
+                DataSet ExcelDs = np.ReadExcel(ExcelPath, 1, 1, "0");
+
+                //鍒犻櫎鏂囦欢
+                File.Delete(ExcelPath);
+
+                //鍒涘缓涓存椂琛�
+                DataTable provisional = new DataTable("dt2");
+
+                //娣诲姞鍒楀悕
+                for (int i = 0; i < ExcelDs.Tables[0].Columns.Count; i++)
+                {
+                    provisional.Columns.Add(ExcelDs.Tables[0].Rows[0][i].ToString());
+                }
+
+                //娣诲姞鏁版嵁
+                for (int i = 1; i < ExcelDs.Tables[0].Rows.Count; i++)
+                {
+                    DataRow row = provisional.NewRow();
+                    for (int j = 0; j < ExcelDs.Tables[0].Columns.Count; j++)
+                    {
+                        row[j] = ExcelDs.Tables[0].Rows[i][j].ToString();
+                    }
+                    provisional.Rows.Add(row);
+                }
+
+                //鍒ゆ柇鍒�
+                string error = JudgmentColumns(provisional);
+                if (error.Length > 0)
+                {
+                    res.code = "0";
+                    res.count = 0;
+                    res.Message = $"Excel妯℃澘瀛樺湪閿欒,{error}\r\n";
+                    res.data = null;
+                    return res;
+                }
+
+                for (int i = 0; i <= provisional.Rows.Count - 1; i++)
+                {
+                    string HNumber = DBUtility.ClsPub.isStrNull(provisional.Rows[i]["閮ㄩ棬浠g爜"].ToString());
+                    string HName = DBUtility.ClsPub.isStrNull(provisional.Rows[i]["閮ㄩ棬鍚嶇О"].ToString());
+                    string HEmpNumber = DBUtility.ClsPub.isStrNull(provisional.Rows[i]["璐熻矗浜轰唬鐮�"].ToString());
+                    string HEmpName = DBUtility.ClsPub.isStrNull(provisional.Rows[i]["璐熻矗浜哄悕绉�"].ToString());
+                    string HBarCode = DBUtility.ClsPub.isStrNull(provisional.Rows[i]["鏉″舰鐮�"].ToString());
+                    string HHelpCode = DBUtility.ClsPub.isStrNull(provisional.Rows[i]["鍔╄鐮�"]);
+                    string HRemark = DBUtility.ClsPub.isStrNull(provisional.Rows[i]["澶囨敞"].ToString());
+
+                    //鍒ゆ柇璐熻矗浜烘槸鍚﹀瓨鍦�
+                    if (JudgeEmp(HEmpNumber, HEmpName))
+                    {
+                        res.code = CodeConstant.FAIL;
+                        res.count = CountConstant.FAIL;
+                        res.Message = "褰撳墠鑱屽憳涓嶅瓨鍦�";
+                        res.data = null;
+                        return res;
+                    }
+                    //鑾峰彇鐪熷疄琛屾暟
+                    int line = i + 1;
+                }
+
+                res.code = "1";
+                res.count = 1;
+                res.Message = error;
+                res.data = provisional;
+                return res;
+            }
+            catch (Exception e)
+            {
+                res.code = "0";
+                res.count = 0;
+                res.Message = "Exception锛�" + e.ToString();
+                res.data = null;
+                return res;
+            }
+        }
+
+        /// <summary>
+        /// 鍒ゆ柇褰撳墠鑱屽憳鏄惁瀛樺湪
+        /// </summary>
+        /// <param name="HEmpNumber"></param>
+        /// <param name="HEmpName"></param>
+        /// <returns></returns>
+        private bool JudgeEmp(string HEmpNumber, string HEmpName)
+        {
+            if (!String.IsNullOrEmpty(HEmpNumber) && !String.IsNullOrEmpty(HEmpName))
+            {
+                DataSet emp = oCN.RunProcReturn("select * from Gy_Employee where HNumber = '" + HEmpNumber + "' and HName = '" + HEmpName + "'", "Gy_Employee");
+                return emp.Tables[0].Rows.Count <= EmptyConstant.EMPTY ? true : false;
+            }
+            return false;
+        }
+
+        /// <summary>
+        /// 鍒ゆ柇鍒�
+        /// </summary>
+        /// <param name="provisional"></param>
+        /// <returns></returns>
+        private static string JudgmentColumns(DataTable provisional)
+        {
+            var error = "";
+
+            //鏌ヨ娌℃湁鐨勫垪
+            if (!provisional.Columns.Contains("閮ㄩ棬浠g爜"))
+                error += "娌℃湁鎵惧埌銆愰儴闂ㄤ唬鐮併�戠殑鏍囬,";
+
+            if (!provisional.Columns.Contains("閮ㄩ棬鍚嶇О"))
+                error += "娌℃湁鎵惧埌銆愰儴闂ㄥ悕绉般�戠殑鏍囬,";
+            return error;
+        }
+        #endregion
+
+        #region 閮ㄩ棬鍒楄〃 瀵煎叆(淇濆瓨)
+        [Route("Gy_Department/Gy_Process_btnSave")]
+        [HttpPost]
+        public object Gy_InspectBasis_btnSave([FromBody] JObject sMainSub)
+        {
+            var _value = sMainSub["sMainSub"].ToString();
+            string msg1 = _value.ToString();
+            string[] sArray = msg1.Split(new string[] { "&鍜�" }, StringSplitOptions.RemoveEmptyEntries);
+            string msg2 = sArray[0].ToString();
+            string user = sArray[1].ToString();
+            string organ = sArray[2].ToString();
+            json res = new json();
+            try
+            {
+                if (!DBUtility.ClsPub.Security_Log("Gy_Group_Edit", 1, false, user))
+                {
+                    res.code = "0";
+                    res.count = 0;
+                    res.Message = "鏃犱繚瀛樻潈闄愶紒";
+                    res.data = null;
+                    return res;
+                }
+
+                List<object> Excel = Newtonsoft.Json.JsonConvert.DeserializeObject<List<object>>(msg2);
+                List<Dictionary<string, string>> list = new List<Dictionary<string, string>>();
+
+                foreach (JObject item in Excel)
+                {
+                    Dictionary<string, string> dic = new Dictionary<string, string>();
+                    foreach (var itm in item.Properties())
+                    {
+                        dic.Add(itm.Name, itm.Value.ToString());
+                    }
+                    list.Add(dic);
+                }
+
+                oCN.BeginTran();
+                int i = 1;
+                foreach (Dictionary<string, string> item in list)
+                {
+                    string HNumber = item["閮ㄩ棬浠g爜"].ToString();
+                    string HName = item["閮ㄩ棬鍚嶇О"].ToString();
+                    string HEmpNumber = item["璐熻矗浜轰唬鐮�"].ToString();
+                    string HEmpName = item["璐熻矗浜哄悕绉�"].ToString();
+                    string HBarCode = item["鏉″舰鐮�"].ToString();
+                    string HHelpCode = item["鍔╄鐮�"].ToString();
+                    string HRemark = item["澶囨敞"].ToString();
+                    int HEmpID = 0;
+                    if (!String.IsNullOrEmpty(HEmpName) && !String.IsNullOrEmpty(HEmpNumber))
+                    {
+                        DataSet emp = oCN.RunProcReturn("select HItemID from Gy_Employee where HNumber = '" + HEmpNumber + "' and HName = '" + HEmpName + "'", "Gy_Employee");
+                        HEmpID = (int)emp.Tables[0].Rows[0]["HItemID"];
+                    }
+                    string sShortNumber;
+                    sShortNumber = DBUtility.ClsPub.GetShortNumber(HNumber);//鐭唬鐮�
+                    if (sShortNumber.Trim() == "")
+                    {
+                        res.code = "0";
+                        res.count = 0;
+                        res.Message = "淇濆瓨澶辫触锛佺煭浠g爜涓虹┖锛�";
+                        res.data = 1;
+                        return res;
+                    }
+                    int HEndFlag = 1;//鏈骇鏍囧織
+                    int HLevel = DBUtility.ClsPub.GetLevel(HNumber); //绛夌骇
+
+
+                    if (!DBUtility.ClsPub.AllowNumber(HNumber.Trim()))
+                    {
+                        res.code = "0";
+                        res.count = 0;
+                        res.Message = "淇濆瓨澶辫触锛佷唬鐮佷腑涓嶈兘鍑虹幇杩炵画鈥�.鈥欏苟涓旈浣嶆湯浣嶄笉鑳戒负鈥�.鈥欙紒";
+                        res.data = 1;
+                        return res;
+                    }
+
+                    ds = oCN.RunProcReturn("select * from Gy_Department where HNumber='" + HNumber + "'", "Gy_InspectInstruMent");
+
+                    if (ds.Tables[0].Rows.Count == 0)
+                    {
+
+                        string sql = "insert into Gy_Department (HName,HNumber,HShortNumber,HLevel,HHelpCode,HParentID,HStopflag,HEndFlag,HRemark,HUseFlag, HUSEORGID, HCREATEORGID, HEmpID, HBarCodeForBase)" +
+                            $"values('{HName}', '{HNumber}', '{sShortNumber}',{HLevel},'',0,'0','0','{HRemark}', '鏈娇鐢�', '{organ}', '{organ}', '{HEmpID}', '{HBarCode}')";
+                        oCN.RunProc(sql);
+                    }
+                    else
+                    {
+                        oCN.RunProc("update Gy_Department  set  HName ='" + HName + "' , HHelpCode = '" + HHelpCode + " ', HBarCodeForBase = '" + HBarCode + "', HEmpID = '" + HEmpID + "', HModifyEmp = '" + user + "', HModifyTime = '" + System.DateTime.Now.ToString("G") + "' where HNumber= '" + HNumber + "'");
+                    }
+
+                    i++;
+                }
+
+                oCN.Commit();
+
+                res.code = "1";
+                res.count = 1;
+                res.Message = "瀵煎叆鎴愬姛!";
+                res.data = null;
+                return res;
+            }
+            catch (Exception e)
+            {
+                LogService.Write(e);
+                res.code = "0";
+                res.count = 0;
+                res.Message = "Exception锛�" + e.ToString();
+                res.data = null;
+                return res;
+            }
+        }
+        #endregion
     }
 }
\ No newline at end of file
diff --git a/WebAPI/Controllers/BaseSet/Gy_ProcessController.cs b/WebAPI/Controllers/BaseSet/Gy_ProcessController.cs
index 899915b..4760f32 100644
--- a/WebAPI/Controllers/BaseSet/Gy_ProcessController.cs
+++ b/WebAPI/Controllers/BaseSet/Gy_ProcessController.cs
@@ -725,9 +725,6 @@
                 int HQCSchemeID_Proc = list[0].HQCSchemeID_Proc;
                 int HQCSchemeID_Patrol = list[0].HQCSchemeID_Patrol;
 
-
-
-
                 long HWorkCenterID = list[0].HWorkCenterID;    //宸ヤ綔涓績
 
                 long HBadWHID = list[0].HBadWHID; //涓嶈壇浠撳簱
@@ -736,6 +733,8 @@
                 long HWWBadWHID = list[0].HWWBadWHID; //濮斿涓嶈壇浠撳簱
                 long HWWWasterWHID = list[0].HWWWasterWHID; //濮斿鎶ュ簾浠撳簱
                 long HWHID = list[0].HWHID; //鑹搧浠撳簱
+
+                string HPayMentType = list[0].HPayMentType; //璁′欢宸ヨ祫绫诲瀷
 
 
                 //鍒ゆ柇鏉冮檺
@@ -776,13 +775,14 @@
                         ",HLevel,HEndFlag,HStopflag,HRemark,HDeptID,HBarCodeForBase,HProcessID_K3,HBillSubType,HAutoTrunFlag" +
                         ",HFixPrice,HOverFixPrice,HProcMulID,HProcCheckNote" +
                         ",HUSEORGID,HWorkCenterID,HBadWHID,HWasterWHID,HBadCountDevelopWHID,HWWBadWHID,HWWWasterWHID,HWHID,HTProcessFlag" +
-                        ",HQCSchemeID_Fst,HQCSchemeID_Proc,HQCSchemeID_Patrol) " +
+                        ",HQCSchemeID_Fst,HQCSchemeID_Proc,HQCSchemeID_Patrol,HPayMentType) " +
                         " Values('" + HNumber + "','" + HName + "','" + HHelpCode + "','" + HShortNumber + "'," + HParentID.ToString() +
                         "," + Convert.ToString(HTypeFlow ? 1 : 0) + "," + Convert.ToString(HTypeCount ? 1 : 0) + ",'" + HDeptNumber + "','" + HSNo.ToString() +
                         "'," + HLevel.ToString() + "," + Convert.ToString(HEndFlag ? 1 : 0) + "," + Convert.ToString(HStopflag ? 1 : 0) + ",'" + HRemark + "'," + HDeptID +
                         ",'" + HBarCode + "'," + HProcessID_K3 + ",'" + HBillSubType + "'," + Convert.ToString(HAutoTrunFlag ? 1 : 0) +
                         ",'" + HFixPrice.ToString() + "'," + HOverFixPrice.ToString() + "," + HProcMulID.ToString() + ",'" + HProcCheckNote.ToString() + "'" +
-                        "," + HUSEORGID + "," + HWorkCenterID + "," + HBadWHID + "," + HWasterWHID + "," + HBadCountDevelopWHID + "," + HWWBadWHID + "," + HWWWasterWHID + "," + HWHID + "," + Convert.ToString(HTProcessFlag ? 1 : 0) + "," + HQCSchemeID_Fst + "," + HQCSchemeID_Proc + "," + HQCSchemeID_Patrol + ")", ref DBUtility.ClsPub.sExeReturnInfo);
+                        "," + HUSEORGID + "," + HWorkCenterID + "," + HBadWHID + "," + HWasterWHID + "," + HBadCountDevelopWHID + "," + HWWBadWHID + "," + HWWWasterWHID + "," + HWHID + "," + Convert.ToString(HTProcessFlag ? 1 : 0) + "," + HQCSchemeID_Fst + "," + HQCSchemeID_Proc + "," + HQCSchemeID_Patrol 
+                        + ",'" + HPayMentType + "'" + ")", ref DBUtility.ClsPub.sExeReturnInfo);
                     //淇敼涓婄骇涓洪潪鏈骇浠g爜
                     oCN.RunProc("Update Gy_Process set HEndflag=0 where HItemID=" + HParentID, ref DBUtility.ClsPub.sExeReturnInfo);
                     oCN.Commit();
@@ -824,6 +824,7 @@
                         ",HQCSchemeID_Fst= " + HQCSchemeID_Fst +
                         ",HQCSchemeID_Proc= " + HQCSchemeID_Proc +
                         ",HQCSchemeID_Patrol= " + HQCSchemeID_Patrol +
+                        ",HPayMentType= '" + HPayMentType + "'" +
                         ",HProcCheckNote='" + HProcCheckNote + "' Where HItemID=" + HItemID, ref DBUtility.ClsPub.sExeReturnInfo);
                     //淇敼涓婄骇涓洪潪鏈骇浠g爜
                     oCN.RunProc("Update Gy_Process set HEndflag=0 where HItemID=" + HParentID, ref DBUtility.ClsPub.sExeReturnInfo);
diff --git a/WebAPI/Controllers/BaseSet/Gy_WarehouseController.cs b/WebAPI/Controllers/BaseSet/Gy_WarehouseController.cs
index e8f092b..c04c1eb 100644
--- a/WebAPI/Controllers/BaseSet/Gy_WarehouseController.cs
+++ b/WebAPI/Controllers/BaseSet/Gy_WarehouseController.cs
@@ -2,11 +2,14 @@
 using Newtonsoft.Json;
 using Newtonsoft.Json.Linq;
 using Pub_Class;
+using SyntacticSugar.constant;
 using System;
 using System.Collections;
 using System.Collections.Generic;
 using System.Data;
 using System.Data.SqlClient;
+using System.IO;
+using System.Web;
 using System.Web.Http;
 using WebAPI.Controllers.SCGL.鏃ヨ鍒掔鐞�;
 using WebAPI.Models;
@@ -781,8 +784,6 @@
         }
         #endregion
 
-
-
         #region 鐗╂枡鍒嗙被瀹℃牳銆佸弽瀹℃牳
         /// <summary>
         /// 
@@ -973,5 +974,242 @@
         }
         #endregion
 
+        #region 妫�楠屼緷鎹垪琛� 鏂囦欢涓婁紶
+        [Route("Gy_Warehouse/Gy_Process_Excel")]
+        [HttpPost]
+        public json Gy_InspectBasis_Excel()
+        {
+            json res = new json();
+            try
+            {
+                //鑾峰彇鏂囦欢鍚嶇О
+                var file = HttpContext.Current.Request.Files[0];
+                //鑾峰彇鏂囦欢鐗╃悊璺緞
+                string ExcelPath = HttpContext.Current.Server.MapPath("~/" + file.FileName);
+                //淇濆瓨鏂囦欢
+                file.SaveAs(ExcelPath);
+
+                NpoiHelper np = new NpoiHelper();
+                DataSet ExcelDs = np.ReadExcel(ExcelPath, 1, 1, "0");
+
+                //鍒犻櫎鏂囦欢
+                File.Delete(ExcelPath);
+
+                //鍒涘缓涓存椂琛�
+                DataTable provisional = new DataTable("dt2");
+
+                //娣诲姞鍒楀悕
+                for (int i = 0; i < ExcelDs.Tables[0].Columns.Count; i++)
+                {
+                    provisional.Columns.Add(ExcelDs.Tables[0].Rows[0][i].ToString());
+                }
+
+                //娣诲姞鏁版嵁
+                for (int i = 1; i < ExcelDs.Tables[0].Rows.Count; i++)
+                {
+                    DataRow row = provisional.NewRow();
+                    for (int j = 0; j < ExcelDs.Tables[0].Columns.Count; j++)
+                    {
+                        row[j] = ExcelDs.Tables[0].Rows[i][j].ToString();
+                    }
+                    provisional.Rows.Add(row);
+                }
+
+                //鍒ゆ柇鍒�
+                string error = JudgmentColumns(provisional);
+                if (error.Length > 0)
+                {
+                    res.code = "0";
+                    res.count = 0;
+                    res.Message = $"Excel妯℃澘瀛樺湪閿欒,{error}\r\n";
+                    res.data = null;
+                    return res;
+                }
+
+                for (int i = 0; i <= provisional.Rows.Count - 1; i++)
+                {
+                    string HNumber = DBUtility.ClsPub.isStrNull(provisional.Rows[i]["浠撳簱浠g爜"].ToString());
+                    string HName = DBUtility.ClsPub.isStrNull(provisional.Rows[i]["浠撳簱鍚嶇О"].ToString());
+                    string phone = DBUtility.ClsPub.isStrNull(provisional.Rows[i]["鑱旂郴鐢佃瘽"].ToString());
+                    string HEmpNumber = DBUtility.ClsPub.isStrNull(provisional.Rows[i]["鑱屽憳浠g爜"].ToString());
+                    string HEmpName = DBUtility.ClsPub.isStrNull(provisional.Rows[i]["鑱屽憳鍚嶇О"].ToString());
+                    string HHelpCode = DBUtility.ClsPub.isStrNull(provisional.Rows[i]["鍔╄鐮�"]);
+                    string HRemark = DBUtility.ClsPub.isStrNull(provisional.Rows[i]["澶囨敞"].ToString());
+                    if(JudgeEmp(HEmpNumber, HEmpName))
+                    {
+                        res.code = CodeConstant.FAIL;
+                        res.count = CountConstant.FAIL;
+                        res.Message = "褰撳墠鑱屽憳涓嶅瓨鍦�";
+                        res.data = null;
+                        return res;
+                    }
+                    //鑾峰彇鐪熷疄琛屾暟
+                    int line = i + 1;
+                }
+
+                res.code = "1";
+                res.count = 1;
+                res.Message = error;
+                res.data = provisional;
+                return res;
+            }
+            catch (Exception e)
+            {
+                res.code = "0";
+                res.count = 0;
+                res.Message = "Exception锛�" + e.ToString();
+                res.data = null;
+                return res;
+            }
+        }
+
+        /// <summary>
+        /// 鍒ゆ柇褰撳墠鑱屽憳鏄惁瀛樺湪
+        /// </summary>
+        /// <param name="HEmpNumber"></param>
+        /// <param name="HEmpName"></param>
+        /// <returns></returns>
+        private bool JudgeEmp(string HEmpNumber, string HEmpName)
+        {
+            if (!String.IsNullOrEmpty(HEmpNumber) && !String.IsNullOrEmpty(HEmpName))
+            {
+                DataSet emp = oCN.RunProcReturn("select * from Gy_Employee where HNumber = '" + HEmpNumber + "' and HName = '" + HEmpName + "'", "Gy_Employee");
+                return emp.Tables[0].Rows.Count <= EmptyConstant.EMPTY ? true : false;
+            }
+            return false;
+        }
+
+        /// <summary>
+        /// 鍒ゆ柇鍒�
+        /// </summary>
+        /// <param name="provisional"></param>
+        /// <returns></returns>
+        private static string JudgmentColumns(DataTable provisional)
+        {
+            var error = "";
+
+            //鏌ヨ娌℃湁鐨勫垪
+            if (!provisional.Columns.Contains("浠撳簱浠g爜"))
+                error += "娌℃湁鎵惧埌銆愪粨搴撲唬鐮併�戠殑鏍囬,";
+
+            if (!provisional.Columns.Contains("浠撳簱鍚嶇О"))
+                error += "娌℃湁鎵惧埌銆愪粨搴撳悕绉般�戠殑鏍囬,";
+            return error;
+        }
+        #endregion
+
+        #region 妫�楠屼緷鎹垪琛� 瀵煎叆(淇濆瓨)
+        [Route("Gy_Warehouse/Gy_Process_btnSave")]
+        [HttpPost]
+        public object Gy_InspectBasis_btnSave([FromBody] JObject sMainSub)
+        {
+            var _value = sMainSub["sMainSub"].ToString();
+            string msg1 = _value.ToString();
+            string[] sArray = msg1.Split(new string[] { "&鍜�" }, StringSplitOptions.RemoveEmptyEntries);
+            string msg2 = sArray[0].ToString();
+            string user = sArray[1].ToString();
+            string organ = sArray[2].ToString();
+            json res = new json();
+            try
+            {
+                if (!DBUtility.ClsPub.Security_Log("Gy_Group_Edit", 1, false, user))
+                {
+                    res.code = "0";
+                    res.count = 0;
+                    res.Message = "鏃犱繚瀛樻潈闄愶紒";
+                    res.data = null;
+                    return res;
+                }
+
+                List<object> Excel = Newtonsoft.Json.JsonConvert.DeserializeObject<List<object>>(msg2);
+                List<Dictionary<string, string>> list = new List<Dictionary<string, string>>();
+
+                foreach (JObject item in Excel)
+                {
+                    Dictionary<string, string> dic = new Dictionary<string, string>();
+                    foreach (var itm in item.Properties())
+                    {
+                        dic.Add(itm.Name, itm.Value.ToString());
+                    }
+                    list.Add(dic);
+                }
+
+                oCN.BeginTran();
+                int i = 1;
+                foreach (Dictionary<string, string> item in list)
+                {
+                    string HNumber = item["浠撳簱浠g爜"].ToString();
+                    string HName = item["浠撳簱鍚嶇О"].ToString();
+                    string phone = item["鑱旂郴鐢佃瘽"].ToString();
+                    string HEmpNumber = item["鑱屽憳浠g爜"].ToString();
+                    string HEmpName = item["鑱屽憳鍚嶇О"].ToString();
+                    string HHelpCode = item["鍔╄鐮�"].ToString();
+                    string HRemark = item["澶囨敞"].ToString();
+                    int HEmpID = 0;
+                    if (!String.IsNullOrEmpty(HEmpName) && !String.IsNullOrEmpty(HEmpNumber))
+                    {
+                        DataSet emp = oCN.RunProcReturn("select HItemID from Gy_Employee where HNumber = '" + HEmpNumber + "' and HName = '" + HEmpName + "'", "Gy_Employee");
+                        HEmpID = (int)emp.Tables[0].Rows[0]["HItemID"];
+                    }
+                    string sShortNumber;
+                    sShortNumber = DBUtility.ClsPub.GetShortNumber(HNumber);//鐭唬鐮�
+                    if (sShortNumber.Trim() == "")
+                    {
+                        res.code = "0";
+                        res.count = 0;
+                        res.Message = "淇濆瓨澶辫触锛佺煭浠g爜涓虹┖锛�";
+                        res.data = 1;
+                        return res;
+                    }
+                    int HEndFlag = 1;//鏈骇鏍囧織
+                    int HLevel = DBUtility.ClsPub.GetLevel(HNumber); //绛夌骇
+
+
+                    if (!DBUtility.ClsPub.AllowNumber(HNumber.Trim()))
+                    {
+                        res.code = "0";
+                        res.count = 0;
+                        res.Message = "淇濆瓨澶辫触锛佷唬鐮佷腑涓嶈兘鍑虹幇杩炵画鈥�.鈥欏苟涓旈浣嶆湯浣嶄笉鑳戒负鈥�.鈥欙紒";
+                        res.data = 1;
+                        return res;
+                    }
+
+                    ds = oCN.RunProcReturn("select * from Gy_Warehouse where HNumber='" + HNumber + "'", "Gy_InspectInstruMent");
+
+                    if (ds.Tables[0].Rows.Count == 0)
+                    {
+
+                        string sql = "insert into Gy_Warehouse (HName,HNumber,HShortNumber,HLevel,HHelpCode,HParentID,HStopflag,HEndFlag,HRemark,HUseFlag, HUSEORGID, HCREATEORGID, HEmpID, HPhone)" +
+                            $"values('{HName}', '{HNumber}', '{sShortNumber}',{HLevel},'',0,'0','0','{HRemark}', '鏈娇鐢�', '{organ}', '{organ}', '{HEmpID}', '{phone}')";
+                        oCN.RunProc(sql);
+                    }
+                    else
+                    {
+                        oCN.RunProc("update Gy_Warehouse  set  HName ='" + HName + "' , HHelpCode = '" + HHelpCode + " ', HPhone= '" + phone + "', HEmpID = '" + HEmpID + "', HModifyEmp = '" + user + "', HModifyTime = '" + System.DateTime.Now.ToString("G") + "' where HNumber= '" + HNumber + "'");
+                    }
+
+                    i++;
+                }
+
+                oCN.Commit();
+
+                res.code = "1";
+                res.count = 1;
+                res.Message = "瀵煎叆鎴愬姛!";
+                res.data = null;
+                return res;
+            }
+            catch (Exception e)
+            {
+                LogService.Write(e);
+                res.code = "0";
+                res.count = 0;
+                res.Message = "Exception锛�" + e.ToString();
+                res.data = null;
+                return res;
+            }
+        }
+        #endregion
+
     }
 }
\ No newline at end of file
diff --git a/WebAPI/Controllers/CJGL/Cj_StationEntrustInBillController.cs b/WebAPI/Controllers/CJGL/Cj_StationEntrustInBillController.cs
index 35de00e..64fb9c4 100644
--- a/WebAPI/Controllers/CJGL/Cj_StationEntrustInBillController.cs
+++ b/WebAPI/Controllers/CJGL/Cj_StationEntrustInBillController.cs
@@ -339,6 +339,51 @@
         }
         #endregion
 
+        #region 宸ュ簭鍑虹珯姹囨姤鍗昉DA鎵搷浣滃憳
+        [Route("Cj_StationBill/txtHBarCode_KeyDown_Operator")]
+        [HttpGet]
+        public object txtHBarCode_KeyDown_Operator(string HBarCode, string HInterID, string UserID, string HBillType)
+        {
+            try
+            {
+                if (HBarCode == null || HBarCode.Equals(""))
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "绌虹櫧鐮�,鏉″舰鐮佷笉鑳戒负绌猴紒";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+
+                ds = oCN.RunProcReturn("select * from h_v_Gy_EmployeeList_New  where 鑱屽憳浠g爜 = '" + HBarCode + "'", "h_v_Gy_EmployeeList_New");
+
+                //鍐欏叆淇℃伅
+                if (ds == null || ds.Tables[0].Rows.Count == 0)
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鏈煡璇㈠埌鏉$爜淇℃伅锛�";
+                    objJsonResult.data = null;
+                    
+                    return objJsonResult;
+                }
+                objJsonResult.code = "1";
+                objJsonResult.count = 1;
+                objJsonResult.Message = "Sucess锛�";
+                objJsonResult.data = ds.Tables[0];
+                return objJsonResult;
+            }
+            catch (Exception e)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "Exception锛�" + e.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
+        #endregion
+
         #region 宸ュ簭杩涚珯鎵厤浠剁爜
         [Route("Cj_StationBill/txtHBarCode_Mater_KeyDown")]
         [HttpGet]
diff --git a/WebAPI/Controllers/CJGL/Cj_StationOutBillController.cs b/WebAPI/Controllers/CJGL/Cj_StationOutBillController.cs
index 2c8f87c..d15cceb 100644
--- a/WebAPI/Controllers/CJGL/Cj_StationOutBillController.cs
+++ b/WebAPI/Controllers/CJGL/Cj_StationOutBillController.cs
@@ -2,6 +2,7 @@
 using Newtonsoft.Json;
 using Newtonsoft.Json.Linq;
 using Pub_Class;
+using SyntacticSugar.constant;
 using System;
 using System.Collections;
 using System.Collections.Generic;
@@ -225,7 +226,7 @@
                 if (oSystemParameter.ShowBill(ref Ret))
                 {
                     //鍒ゆ柇瀹㈡埛涓嶄负榫欏北姹介厤
-                    if (oSystemParameter.omodel.WMS_CampanyName != "榫欏北姹介厤" && oSystemParameter.omodel.WMS_CampanyName != "鐟炰笌绁�") //绯荤粺鍙傛暟                      
+                    if (oSystemParameter.omodel.WMS_CampanyName != "榫欏北姹介厤" && oSystemParameter.omodel.WMS_CampanyName != "鐟炰笌绁�" && oSystemParameter.omodel.WMS_CampanyName != "娣诲悍绉戞妧") //绯荤粺鍙傛暟                      
                     {
                         if (HSourceID == 0)
                         {
@@ -1715,67 +1716,32 @@
         }
         #endregion
 
-        #region 杩斿洖宸ュ簭鍑虹珯姹囨姤鍗曞垪琛�     20240926鏂板
-        [Route("Cj_StationOutBillController/GetSc_StationOutBillList_Json")]
+        #region 宸ュ簭鍑虹珯姹囨姤鍗曞垪琛�
+        [Route("Cj_StationOutBill/page")]
         [HttpGet]
-        public object GetSc_StationOutBillList_Json(string sWhere, string HMaker, string HBillSubType, string OperationType, string ViewName)
+        public json page(string sWhere, string user, int page, int size)
         {
+            json res = new json();
             try
             {
                 List<object> columnNameList = new List<object>();
-                //鍒ゆ柇鏉冮檺
-                if (HBillSubType == "SUB")
-                {
                     //鍒ゆ柇鏄惁鏈夋煡璇㈡潈闄�
-                    if (!DBUtility.ClsPub.Security_Log("Cj_StationOutBill_Sub_Query", 1, false, HMaker))
+             if (!DBUtility.ClsPub.Security_Log("Cj_StationOutBill_Query", 1, false, user))
                     {
-                        objJsonResult.code = "0";
-                        objJsonResult.count = 0;
-                        objJsonResult.Message = "瀹屽伐鍗曟棤鏌ヨ鏉冮檺!";
-                        objJsonResult.data = null;
-                        return objJsonResult;
+                        res.code = "0";
+                        res.count = 0;
+                        res.Message = "鍑虹珯鍗曟棤鏌ヨ鏉冮檺!";
+                        res.data = null;
+                        return res;
                     }
-                }
-                else if(OperationType == "1")
+                if (sWhere == null || sWhere.Equals(""))
                 {
-                    //鍒ゆ柇鏄惁鏈夋煡璇㈡潈闄�
-                    if (!DBUtility.ClsPub.Security_Log("Cj_StationOutBill_Query", 1, false, HMaker))
-                    {
-                        objJsonResult.code = "0";
-                        objJsonResult.count = 0;
-                        objJsonResult.Message = "鍑虹珯鍗曟棤鏌ヨ鏉冮檺!";
-                        objJsonResult.data = null;
-                        return objJsonResult;
-                    }
+                    ds = oCN.RunProcReturn("exec h_p_MES_StationOutBillList " + page + "," + size + ",''", "h_p_MES_StationOutBillList");
                 }
-
-                //鑾峰彇绯荤粺鍙傛暟
-                string Ret = "";
-                if (oSystemParameter.ShowBill(ref Ret))
+                else
                 {
-                    //鍒ゆ柇瀹㈡埛涓洪緳灞辨苯閰�
-                    if (oSystemParameter.omodel.WMS_CampanyName == "榫欏北姹介厤")
-                    {
-                        //鑾峰彇闇�瑕佹嫾鎺ョ殑瀛楃涓�
-                        string sql_splice = DBUtility.ClsPub.SpliceSQL(HMaker, "宸ュ簭姹囨姤鍗曞垪琛�");
-
-                        if (sql_splice == "娌℃湁鏌ヨ鍒扮浉鍏崇敤鎴蜂俊鎭�")
-                        {
-                            objJsonResult.code = "0";
-                            objJsonResult.count = 0;
-                            objJsonResult.Message = "娌℃湁鏌ヨ鍒扮浉鍏崇敤鎴蜂俊鎭�!";
-                            objJsonResult.data = null;
-                            return objJsonResult;
-                        }
-                        else
-                        {
-                            sWhere += sql_splice;
-                        }
-                    }
+                    ds = oCN.RunProcReturn("exec h_p_MES_StationOutBillList " + page + "," + size + ",'" + sWhere + "'", "h_p_MES_StationOutBillList");
                 }
-
-                //杩斿洖鍒楄〃淇℃伅
-                ds = oCN.RunProcReturn("select * from " + ViewName + " where 1=1 " + sWhere + " order by hmainid desc", ViewName);
 
                 //娣诲姞鍒楀悕
                 foreach (DataColumn col in ds.Tables[0].Columns)
@@ -1784,24 +1750,24 @@
                     string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}";
                     columnNameList.Add(JsonConvert.DeserializeObject(ColmString));//鑾峰彇鍒癉ataColumn鍒楀璞$殑鍒楀悕
                 }
-                objJsonResult.code = "0";
-                objJsonResult.count = 1;
-                objJsonResult.Message = "鎴愬姛锛�";
-                objJsonResult.data = ds.Tables[0];
-                objJsonResult.list = columnNameList;
-                return objJsonResult;
+
+                res.code = CodeConstant.SUCCEED;
+                res.count = int.Parse(ds.Tables[1].Rows[0]["count"].ToString());
+                res.Message = "Sucess锛�";
+                res.list = columnNameList;
+                res.data = ds.Tables[0];
+                return res;
             }
             catch (Exception e)
             {
-                objJsonResult.code = "0";
-                objJsonResult.count = 0;
-                objJsonResult.Message = "鏌ヨ鍒楄〃淇℃伅澶辫触锛�" + e.ToString();
-                objJsonResult.data = null;
+                res.code = CodeConstant.FAIL;
+                res.count = CountConstant.FAIL;
+                res.Message = "Exception锛�" + e.ToString();
+                res.data = null;
                 return objJsonResult;
             }
         }
         #endregion
-
         #region 宸ュ簭鍑虹珯姹囨姤鍗� 瀛愯〃鏌ヨ
         [Route("Cj_StationOutBill/get_SubDisplay")]
         [HttpGet]
diff --git a/WebAPI/Controllers/CJGL/Sc_ProcessExchangeBillController.cs b/WebAPI/Controllers/CJGL/Sc_ProcessExchangeBillController.cs
index fef68a5..a14f30b 100644
--- a/WebAPI/Controllers/CJGL/Sc_ProcessExchangeBillController.cs
+++ b/WebAPI/Controllers/CJGL/Sc_ProcessExchangeBillController.cs
@@ -1,6 +1,7 @@
 锘縰sing Newtonsoft.Json;
 using Newtonsoft.Json.Linq;
 using Pub_Class;
+using SyntacticSugar.constant;
 using System;
 using System.Collections;
 using System.Collections.Generic;
@@ -1911,6 +1912,59 @@
         }
         #endregion
 
+        #region 宸ュ簭娴佽浆鍗″垎椤靛垪琛�
+        [Route("Sc_ProcessExchangeBillList/page")]
+        [HttpGet]
+        public json page(string sWhere, string user, int page, int size)
+        {
+            json res = new json();
+            try
+            {
+                List<object> columnNameList = new List<object>();
+                //缂栬緫鏉冮檺
+                if (!DBUtility.ClsPub.Security_Log_second("Sc_ProcessExchangeBill_SubQuery", 1, false, user))
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鏃犳煡鐪嬫潈闄愶紒";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+                if (sWhere == null || sWhere.Equals(""))
+                {
+                    ds = oCN.RunProcReturn("exec h_p_Sc_ProcessExchangeBillList_Query " + page + "," + size + ",''", "h_p_Sc_ProcessExchangeBillList_Query");
+                }
+                else
+                {
+                    ds = oCN.RunProcReturn("exec h_p_Sc_ProcessExchangeBillList_Query " + page + "," + size + ",'" + sWhere + "'", "h_p_Sc_ProcessExchangeBillList_Query");
+                }
+
+                //娣诲姞鍒楀悕
+                foreach (DataColumn col in ds.Tables[0].Columns)
+                {
+                    Type dataType = col.DataType;
+                    string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}";
+                    columnNameList.Add(JsonConvert.DeserializeObject(ColmString));//鑾峰彇鍒癉ataColumn鍒楀璞$殑鍒楀悕
+                }
+
+                res.code = CodeConstant.SUCCEED;
+                res.count = int.Parse(ds.Tables[1].Rows[0]["count"].ToString());
+                res.Message = "Sucess锛�";
+                res.list = columnNameList;
+                res.data = ds.Tables[0];
+                return res;
+            }
+            catch (Exception e)
+            {
+                res.code = CodeConstant.FAIL;
+                res.count = CountConstant.FAIL;
+                res.Message = "Exception锛�" + e.ToString();
+                res.data = null;
+                return objJsonResult;
+            }
+        }
+        #endregion
+
         #region 宸ュ簭娴佽浆鍗″垪琛�
         /// <summary>
         /// 鑾峰彇宸ュ簭娴佽浆鍗″垪琛ㄤ俊鎭�
diff --git a/WebAPI/Controllers/CKGL/TMZD/Gy_BarCodeBillListController.cs b/WebAPI/Controllers/CKGL/TMZD/Gy_BarCodeBillListController.cs
new file mode 100644
index 0000000..6a713dd
--- /dev/null
+++ b/WebAPI/Controllers/CKGL/TMZD/Gy_BarCodeBillListController.cs
@@ -0,0 +1,77 @@
+锘縰sing Newtonsoft.Json;
+using SyntacticSugar.constant;
+using System;
+using System.Collections.Generic;
+using System.Data;
+using System.Linq;
+using System.Net;
+using System.Net.Http;
+using System.Web.Http;
+using WebAPI.Models;
+
+namespace WebAPI.Controllers.CKGL.TMZD
+{
+    public class Gy_BarCodeBillListController : ApiController
+    {
+        //鑾峰彇绯荤粺鍙傛暟
+        Pub_Class.ClsXt_SystemParameter oSystemParameter = new Pub_Class.ClsXt_SystemParameter();
+        public DBUtility.ClsPub.Enum_BillStatus BillStatus;
+        public string sWhere = "";
+        private json objJsonResult = new json();
+        SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
+        DataSet ds;
+
+        #region 鏉$爜涓绘。鍒嗛〉鍒楄〃
+        [Route("Gy_BarCodeBillList/page")]
+        [HttpGet]
+        public json page(string sWhere, string user, int page, int size)
+        {
+            json res = new json();
+            try
+            {
+                List<object> columnNameList = new List<object>();
+                //缂栬緫鏉冮檺
+                if (!DBUtility.ClsPub.Security_Log_second("Gy_Material", 1, false, user))
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鏃犳煡鐪嬫潈闄愶紒";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+                if (sWhere == null || sWhere.Equals(""))
+                {
+                    ds = oCN.RunProcReturn("exec h_p_IF_BarCodeBillList " + page + "," + size  + ",''", "h_p_IF_BarCodeBillList");
+                }
+                else
+                {
+                    ds = oCN.RunProcReturn("exec h_p_IF_BarCodeBillList " + page + "," + size  +  ",'" + sWhere + "'", "h_p_IF_BarCodeBillList");
+                }
+
+                //娣诲姞鍒楀悕
+                foreach (DataColumn col in ds.Tables[0].Columns)
+                {
+                    Type dataType = col.DataType;
+                    string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}";
+                    columnNameList.Add(JsonConvert.DeserializeObject(ColmString));//鑾峰彇鍒癉ataColumn鍒楀璞$殑鍒楀悕
+                }
+
+                res.code = CodeConstant.SUCCEED;
+                res.count = int.Parse(ds.Tables[1].Rows[0]["count"].ToString());
+                res.Message = "Sucess锛�";
+                res.list = columnNameList;
+                res.data = ds.Tables[0];
+                return res;
+            }
+            catch (Exception e)
+            {
+                res.code = CodeConstant.FAIL;
+                res.count = CountConstant.FAIL;
+                res.Message = "Exception锛�" + e.ToString();
+                res.data = null;
+                return objJsonResult;
+            }
+        }
+        #endregion
+    }
+}
\ No newline at end of file
diff --git a/WebAPI/Controllers/LMESController.cs b/WebAPI/Controllers/LMESController.cs
index d1ddb30..08f05ba 100644
--- a/WebAPI/Controllers/LMESController.cs
+++ b/WebAPI/Controllers/LMESController.cs
@@ -1,6 +1,7 @@
 锘縰sing Newtonsoft.Json;
 using Newtonsoft.Json.Linq;
 using Pub_Class;
+using SyntacticSugar.constant;
 using System;
 using System.Collections;
 using System.Collections.Generic;
@@ -1114,6 +1115,60 @@
 
         #region 宸ヨ壓璺嚎
 
+        #region 宸ヨ壓璺嚎鍒嗛〉鍒楄〃
+        [Route("Gy_RoutingBill/page")]
+        [HttpGet]
+        public json Gy_RoutingBillPage(string sWhere, string user, int page, int size)
+        {
+            DataSet ds;
+            json res = new json();
+            try
+            {
+                List<object> columnNameList = new List<object>();
+                //缂栬緫鏉冮檺
+                if (!DBUtility.ClsPub.Security_Log_second("Gy_RoutingBill_Query", 1, false, user))
+                {
+                    res.code = "0";
+                    res.count = 0;
+                    res.Message = "鏃犳煡鐪嬫潈闄愶紒";
+                    res.data = null;
+                    return res;
+                }
+                if (sWhere == null || sWhere.Equals(""))
+                {
+                    ds = oCN.RunProcReturn("exec h_p_Gy_RoutingBillList " + page + "," + size + ",''", "h_p_Gy_RoutingBillList");
+                }
+                else
+                {
+                    ds = oCN.RunProcReturn("exec h_p_Gy_RoutingBillList " + page + "," + size + ",'" + sWhere + "'", "h_p_Gy_RoutingBillList");
+                }
+
+                //娣诲姞鍒楀悕
+                foreach (DataColumn col in ds.Tables[0].Columns)
+                {
+                    Type dataType = col.DataType;
+                    string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}";
+                    columnNameList.Add(JsonConvert.DeserializeObject(ColmString));//鑾峰彇鍒癉ataColumn鍒楀璞$殑鍒楀悕
+                }
+
+                res.code = CodeConstant.SUCCEED;
+                res.count = int.Parse(ds.Tables[1].Rows[0]["count"].ToString());
+                res.Message = "Sucess锛�";
+                res.list = columnNameList;
+                res.data = ds.Tables[0];
+                return res;
+            }
+            catch (Exception e)
+            {
+                res.code = CodeConstant.FAIL;
+                res.count = CountConstant.FAIL;
+                res.Message = "Exception锛�" + e.ToString();
+                res.data = null;
+                return objJsonResult;
+            }
+        }
+        #endregion
+
         #region 宸ヨ壓璺嚎鍒楄〃
         /// <summary>
         /// 杩斿洖宸ヨ壓璺嚎鍒楄〃
@@ -1676,6 +1731,59 @@
             return GetObjectJson(ds);
         }
 
+        #region 鐢熶骇璁㈠崟鍒嗛〉鍒楄〃
+        [Route("LEMS/MES_IF_ICMOBillListPage")]
+        [HttpGet]
+        public object MES_IF_ICMOBillListPage(string sWhere, string user, int page, int size)
+        {
+            DataSet ds;
+            try
+            {
+                List<object> columnNameList = new List<object>();
+                //缂栬緫鏉冮檺
+                if (!DBUtility.ClsPub.Security_Log_second("Sc_ICMOBillQuery", 1, false, user))
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鏃犳煡鐪嬫潈闄愶紒";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+                if (sWhere == null || sWhere.Equals(""))
+                {
+                    ds = oCN.RunProcReturn("exec h_p_IF_ICMOBillList " + page + "," + size + ",''", "h_p_IF_ICMOBillList");
+                }
+                else
+                {
+                    ds = oCN.RunProcReturn("exec h_p_IF_ICMOBillList " + page + "," + size + ",'" + sWhere + "'", "h_p_IF_ICMOBillList");
+                }
+
+                //娣诲姞鍒楀悕
+                foreach (DataColumn col in ds.Tables[0].Columns)
+                {
+                    Type dataType = col.DataType;
+                    string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}";
+                    columnNameList.Add(JsonConvert.DeserializeObject(ColmString));//鑾峰彇鍒癉ataColumn鍒楀璞$殑鍒楀悕
+                }
+
+                objJsonResult.code = "1";
+                objJsonResult.count = int.Parse(ds.Tables[1].Rows[0]["count"].ToString());
+                objJsonResult.Message = "Sucess锛�";
+                objJsonResult.list = columnNameList;
+                objJsonResult.data = ds.Tables[0];
+                return objJsonResult;
+            }
+            catch (Exception e)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "Exception锛�" + e.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
+        #endregion
+
         #region 宸ュ簭娴佽浆鍗′笅鎺ㄧ敓浜ц川閲忔眹鎶ュ崟
         [Route("LEMS/MES_IF_ProcessBillList_Json")]
         [HttpGet]
diff --git a/WebAPI/Controllers/SBGL/SBBB/Sb_EquipMentCollectionTechParam_TempController.cs b/WebAPI/Controllers/SBGL/SBBB/Sb_EquipMentCollectionTechParam_TempController.cs
index 11f896a..f08d474 100644
--- a/WebAPI/Controllers/SBGL/SBBB/Sb_EquipMentCollectionTechParam_TempController.cs
+++ b/WebAPI/Controllers/SBGL/SBBB/Sb_EquipMentCollectionTechParam_TempController.cs
@@ -1,4 +1,5 @@
-锘縰sing Newtonsoft.Json;
+锘縰sing Model;
+using Newtonsoft.Json;
 using SyntacticSugar.constant;
 using System;
 using System.Collections.Generic;
@@ -36,6 +37,8 @@
                 string sql = "select * from h_v_Sb_EquipMentCollectionTechParam_TempList where 1 = 1" + sWhere;
                 DataSet ds = oCN.RunProcReturn(sql, "h_v_Sb_EquipMentCollectionTechParam_TempList");
 
+
+
                 //鏁版嵁閬嶅巻, 鑾峰彇鍒楀悕
                 List<object> columnNameList = new List<object>();
                 foreach (DataColumn col in ds.Tables[0].Columns)
diff --git a/WebAPI/Controllers/WebAPIController.cs b/WebAPI/Controllers/WebAPIController.cs
index dfc5819..25dea84 100644
--- a/WebAPI/Controllers/WebAPIController.cs
+++ b/WebAPI/Controllers/WebAPIController.cs
@@ -171,6 +171,68 @@
             }
         }
 
+        [Route("Web/GetMAXNum_ProcExchange")]
+        [HttpGet]
+        public object GetMAXNum_ProcExchange(string HBillType)
+        {
+            try
+            {
+                string HBillNo = "";
+                string sErrMsg = "";
+                Int64 HInterID = 0;//鏄剧ず鐨勫瓧娈�
+                HInterID = DBUtility.ClsPub.CreateBillID_Prod(HBillType, ref sErrMsg);
+                HBillNo = DBUtility.ClsPub.CreateBillCode_Prod(HBillType, ref sErrMsg, true);
+
+                DataSet ds;
+                SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
+                ds = oCN.RunProcReturn("exec h_p_IF_CheckBillIDExists_WMS  " + HInterID + ",'" + HBillNo + "'", "h_p_IF_CheckBillIDExists_WMS");
+                if (ds == null || ds.Tables[0].Rows.Count == 0)
+                {
+                    sErrMsg = "瀛樺湪閲嶅鍗曟嵁鍐呯爜鎴栧崟鎹彿鐨勫崟鎹紝涓嶅厑璁告柊澧烇紝璇烽��鍑哄悗閲嶆柊鐧诲綍锛�";
+                    objjson.code = "0";
+                    objjson.count = 0;
+                    objjson.Message = sErrMsg;
+                    objjson.data = null;
+                    return objjson;
+                }
+                else if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0][0]) == "1")
+                {
+                    sErrMsg = "瀛樺湪閲嶅鍗曟嵁鍐呯爜鎴栧崟鎹彿鐨勫崟鎹紝涓嶅厑璁告柊澧烇紝璇烽��鍑哄悗閲嶆柊鐧诲綍锛�";
+                    objjson.code = "0";
+                    objjson.count = 0;
+                    objjson.Message = sErrMsg;
+                    objjson.data = null;
+                    return objjson;
+                }
+                else
+                {
+                    //----------鍒涘缓铏氳〃------------------------
+                    DataTable dt_Main = new DataTable("Json");
+                    dt_Main.Columns.Add("HBillNo", typeof(string));
+                    dt_Main.Columns.Add("HInterID", typeof(Int64));
+                    //---------鍒涘缓鏂拌------------------------
+                    DataRow dr_main = dt_Main.NewRow();//鍒涘缓鏂拌 
+                    dt_Main.Rows.Add(dr_main);//灏嗘柊琛屽姞鍏ュ埌琛ㄤ腑
+                    dr_main["HBillNo"] = DBUtility.ClsPub.isStrNull(HBillNo);
+                    dr_main["HInterID"] = DBUtility.ClsPub.isLong(HInterID);
+                    //杩斿洖鏁版嵁
+                    objjson.code = "0";
+                    objjson.count = 1;
+                    objjson.Message = "鑾峰彇鎴愬姛";
+                    objjson.data = dt_Main;
+                    return objjson;
+                }
+            }
+            catch (Exception e)
+            {
+                objjson.code = "0";
+                objjson.count = 0;
+                objjson.Message = "鑾峰彇澶辫触" + e.ToString();
+                objjson.data = null;
+                return objjson;
+            }
+        }
+
         /// <summary>
         /// 鑷姩鑾峰彇鍩虹璧勬枡 娴佹按鍙� 灏辨槸浠g爜
         /// </summary>
diff --git "a/WebAPI/Controllers/\345\237\272\347\241\200\350\265\204\346\226\231/\345\237\272\347\241\200\350\265\204\346\226\231/Gy_MaterTypeBillController.cs" "b/WebAPI/Controllers/\345\237\272\347\241\200\350\265\204\346\226\231/\345\237\272\347\241\200\350\265\204\346\226\231/Gy_MaterTypeBillController.cs"
index 5e40452..498d545 100644
--- "a/WebAPI/Controllers/\345\237\272\347\241\200\350\265\204\346\226\231/\345\237\272\347\241\200\350\265\204\346\226\231/Gy_MaterTypeBillController.cs"
+++ "b/WebAPI/Controllers/\345\237\272\347\241\200\350\265\204\346\226\231/\345\237\272\347\241\200\350\265\204\346\226\231/Gy_MaterTypeBillController.cs"
@@ -868,11 +868,11 @@
 
         [Route("Gy_MaterType/Gy_MaterTypeTreeListByLevel")]
         [HttpGet]
-        public object Gy_MaterTypeTreeListByLevel()
+        public object Gy_MaterTypeTreeListByLevel(string HOrgID)
         {
             try
             {
-                string sql1 = string.Format("select hitemid,hnumber,hname,hparentid,hlevel from Gy_MaterType order by hnumber");
+                string sql1 = string.Format("select hitemid,hnumber,hname,hparentid,hlevel from Gy_MaterType where HUSEORGID = '" + HOrgID + "' order by hnumber");
 
                 ds = oCN.RunProcReturn(sql1, "Gy_MaterType");
 
diff --git a/WebAPI/Exceptions/EmptyException.cs b/WebAPI/Exceptions/EmptyException.cs
new file mode 100644
index 0000000..6d9211b
--- /dev/null
+++ b/WebAPI/Exceptions/EmptyException.cs
@@ -0,0 +1,17 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Web;
+
+namespace WebAPI.Exceptions
+{
+    /// <summary>
+    /// 绌烘暟鎹紓甯�
+    /// </summary>
+    public class EmptyException : Exception
+    {
+        public EmptyException(string message): base(message)
+        { 
+        }
+    }
+}
\ No newline at end of file
diff --git a/WebAPI/Exceptions/ExcelException.cs b/WebAPI/Exceptions/ExcelException.cs
new file mode 100644
index 0000000..f7583df
--- /dev/null
+++ b/WebAPI/Exceptions/ExcelException.cs
@@ -0,0 +1,17 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Web;
+
+namespace WebAPI.Exceptions
+{
+    /// <summary>
+    /// EXCEL寮傚父鎶ラ敊绫�
+    /// </summary>
+    public class ExcelException : Exception
+    {
+        public ExcelException(string message) : base(message)
+        {
+        }
+    }
+}
\ No newline at end of file
diff --git a/WebAPI/Models/Query/QueryModel.cs b/WebAPI/Models/Query/QueryModel.cs
new file mode 100644
index 0000000..4e813c0
--- /dev/null
+++ b/WebAPI/Models/Query/QueryModel.cs
@@ -0,0 +1,23 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Web;
+
+namespace WebAPI.Models.Query
+{
+    /// <summary>
+    /// 鏌ヨ绫�
+    /// </summary>
+    public class QueryModel
+    {
+        /// <summary>
+        /// sql鏌ヨ璇彞
+        /// </summary>
+        public string sWhere { get; set; }
+
+        /// <summary>
+        /// 鏌ヨ鐢ㄦ埛
+        /// </summary>
+        public string user { get; set; }
+    }
+}
\ No newline at end of file
diff --git a/WebAPI/Models/QueryModel.cs b/WebAPI/Models/QueryModel.cs
new file mode 100644
index 0000000..3c3ffa1
--- /dev/null
+++ b/WebAPI/Models/QueryModel.cs
@@ -0,0 +1,21 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Model
+{
+    public class QueryModel
+    {
+        /// <summary>
+        /// sql鏌ヨ璇彞
+        /// </summary>
+        public string sWhere { get; set; }
+
+        /// <summary>
+        /// 鏌ヨ鐢ㄦ埛
+        /// </summary>
+        public string user { get; set; }
+    }
+}
diff --git "a/WebAPI/Models/\345\237\272\347\241\200\350\265\204\346\226\231/Gy_Process.cs" "b/WebAPI/Models/\345\237\272\347\241\200\350\265\204\346\226\231/Gy_Process.cs"
index a1a1b3a..925ed86 100644
--- "a/WebAPI/Models/\345\237\272\347\241\200\350\265\204\346\226\231/Gy_Process.cs"
+++ "b/WebAPI/Models/\345\237\272\347\241\200\350\265\204\346\226\231/Gy_Process.cs"
@@ -48,5 +48,7 @@
         public int HQCSchemeID_Fst { get; set; }
         public int HQCSchemeID_Proc { get; set; }
         public int HQCSchemeID_Patrol { get; set; }
+        public string HPayMentType { get; set; }
+
     }
 }
\ No newline at end of file
diff --git a/WebAPI/Utility/TreeUtil.cs b/WebAPI/Utility/TreeUtil.cs
new file mode 100644
index 0000000..9214747
--- /dev/null
+++ b/WebAPI/Utility/TreeUtil.cs
@@ -0,0 +1,74 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Data;
+using System.Linq;
+using System.Web;
+
+namespace WebAPI.Utility
+{
+    public class TreeUtil
+    {
+        public class TreeModel
+        {
+            public string id { get; set; }
+            public string title { get; set; }
+            public List<TreeModel> children = new List<TreeModel>();
+        }
+
+        #region 閫掑綊鍑芥暟
+        /// <summary>
+        /// 閫掑綊鍑芥暟
+        /// </summary>
+        public void digui(DataTable dt, List<TreeModel> tree, int num)
+        {
+            for (int m = 0; m < tree.Count; m++)
+            {
+                tree[m].children = new List<TreeModel>();
+                for (int i = 0; i < dt.Rows.Count; i++)//绗竴娆″惊鐜紝寰楀埌鎵�鏈夋牴鑺傜偣鐨勫瓙闆�
+                {
+                    var strLen = dt.Rows[i]["hnumber"].ToString().Split('.');
+                    if (strLen.Length == num && dt.Rows[i]["hnumber"].ToString().Contains(tree[m].id + "."))
+                    {
+                        TreeModel tbjson = new TreeModel();
+                        tbjson.id = dt.Rows[i]["hitemid"].ToString();
+                        tbjson.title = dt.Rows[i]["hname"].ToString();
+                        tree[m].children.Add(tbjson);
+                    }
+                }
+                var strLens = tree[m].id.Split('.');
+                for (int i = 0; i < tree[m].children.Count; i++)
+                {
+                    digui(dt, tree[m].children, strLens.Length + 2);//鍐嶆鐢ㄥ瓙闆嗗幓寰幆锛屾嬁鍑哄瓙闆嗙殑瀛愰泦
+                }
+            }
+
+        }
+        #endregion
+
+        #region 鍒嗙被 鏍戝舰鍥�(鏍规嵁浠g爜灞曞紑鏍戠姸鍥�)
+        public void getTreeByLevel(DataTable dt, List<TreeModel> tree, int num)
+        {
+            for (int m = 0; m < tree.Count; m++)
+            {
+                tree[m].children = new List<TreeModel>();
+                for (int i = 0; i < dt.Rows.Count; i++)//绗竴娆″惊鐜紝寰楀埌鎵�鏈夋牴鑺傜偣鐨勫瓙闆�
+                {
+                    var HLevel = (int)dt.Rows[i]["hlevel"];
+                    var HParentID = dt.Rows[i]["hparentid"].ToString();
+                    if (HLevel == num && HParentID == tree[m].id)
+                    {
+                        TreeModel tbjson = new TreeModel();
+                        tbjson.id = dt.Rows[i]["hitemid"].ToString();
+                        tbjson.title = dt.Rows[i]["hname"].ToString();
+                        tree[m].children.Add(tbjson);
+                    }
+                }
+                for (int i = 0; i < tree[m].children.Count; i++)
+                {
+                    getTreeByLevel(dt, tree[m].children, num + 1);//鍐嶆鐢ㄥ瓙闆嗗幓寰幆锛屾嬁鍑哄瓙闆嗙殑瀛愰泦
+                }
+            }
+        }
+        #endregion
+    }
+}
\ No newline at end of file
diff --git a/WebAPI/WebAPI.csproj.user b/WebAPI/WebAPI.csproj.user
index e86f0b9..7ef1707 100644
--- a/WebAPI/WebAPI.csproj.user
+++ b/WebAPI/WebAPI.csproj.user
@@ -10,7 +10,8 @@
     <NameOfLastUsedPublishProfile>FolderProfile</NameOfLastUsedPublishProfile>
     <NameOfLastUsedPublishProfile>D:\Git\houduan\WebAPI\Properties\PublishProfiles\FolderProfile.pubxml</NameOfLastUsedPublishProfile>
     <NameOfLastUsedPublishProfile>C:\Users\86130\Desktop\鏅轰簯杩堟�漒MES-WEB-API\WebAPI\Properties\PublishProfiles\FolderProfilewtt.pubxml</NameOfLastUsedPublishProfile>
-    <LastActiveSolutionConfig>Debug|Any CPU</LastActiveSolutionConfig>
+    <NameOfLastUsedPublishProfile>D:\缃戠珯鍙戝竷\鍚庣浠g爜\MES-WEB-API\MES-WEB-API\WebAPI\Properties\PublishProfiles\FolderProfile10.pubxml</NameOfLastUsedPublishProfile>
+    <LastActiveSolutionConfig>Release|Any CPU</LastActiveSolutionConfig>
     <UseIISExpress>true</UseIISExpress>
     <Use64BitIISExpress />
     <IISExpressSSLPort />
diff --git a/WebAPI/WebBLL/JCJM/GYZL/Gy_CustomerService.cs b/WebAPI/WebBLL/JCJM/GYZL/Gy_CustomerService.cs
new file mode 100644
index 0000000..3c33e30
--- /dev/null
+++ b/WebAPI/WebBLL/JCJM/GYZL/Gy_CustomerService.cs
@@ -0,0 +1,25 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Data;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace WebAPI.WebBLL.JCJM.GYZL
+{
+    interface Gy_CustomerService
+    {
+        /// <summary>
+        /// 瀵煎叆excel
+        /// </summary>
+        void ImportExcel();
+
+        /// <summary>
+        /// 涓婁紶excel
+        /// </summary>
+        /// <returns></returns>
+        DataTable UploadExcel(DataSet ExcelDs);
+    }
+
+
+}
diff --git a/WebAPI/WebBLL/JCJM/IMPL/Gy_CustomerImpl.cs b/WebAPI/WebBLL/JCJM/IMPL/Gy_CustomerImpl.cs
new file mode 100644
index 0000000..53ae588
--- /dev/null
+++ b/WebAPI/WebBLL/JCJM/IMPL/Gy_CustomerImpl.cs
@@ -0,0 +1,207 @@
+锘縰sing SyntacticSugar.constant;
+using System;
+using System.Collections.Generic;
+using System.Data;
+using System.Linq;
+using System.Threading.Tasks;
+using System.Web;
+using WebAPI.Exceptions;
+using WebAPI.WebBLL.JCJM.GYZL;
+
+namespace WebAPI.WebBLL.JCJM.IMPL
+{
+    public class Gy_CustomerImpl : Gy_CustomerService
+    {
+        // 绾跨▼璁℃暟鍣�
+        List<Task> taskList = new List<Task>();
+        SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
+        #region 瀵煎叆EXCEL
+        public void ImportExcel()
+        {
+            throw new NotImplementedException();
+        }
+        #endregion
+
+
+        /// <summary>
+        /// 鍒ゆ柇鍒�
+        /// </summary>
+        /// <param name="provisional"></param>
+        /// <returns></returns>
+        private static string JudgmentColumns(DataTable provisional)
+        {
+            var error = "";
+            //鏌ヨ娌℃湁鐨勫垪
+            if (!provisional.Columns.Contains("瀹㈡埛浠g爜"))
+                error += "娌℃湁鎵惧埌銆愬鎴蜂唬鐮併�戠殑鏍囬,";
+
+            if (!provisional.Columns.Contains("瀹㈡埛鍚嶇О"))
+                error += "娌℃湁鎵惧埌銆愬鎴峰悕绉般�戠殑鏍囬,";
+            return error;
+        }
+
+        #region 涓婁紶EXCEL
+        public DataTable UploadExcel(DataSet ExcelDs)
+        {
+            //鍒涘缓涓存椂琛�
+            DataTable provisional = new DataTable("dt2");
+
+            //娣诲姞鍒楀悕
+            for (int i = 0; i < ExcelDs.Tables[0].Columns.Count; i++)
+            {
+                provisional.Columns.Add(ExcelDs.Tables[0].Rows[0][i].ToString());
+            }
+
+            //娣诲姞鏁版嵁
+            for (int i = 1; i < ExcelDs.Tables[0].Rows.Count; i++)
+            {
+                DataRow row = provisional.NewRow();
+                for (int j = 0; j < ExcelDs.Tables[0].Columns.Count; j++)
+                {
+                    row[j] = ExcelDs.Tables[0].Rows[i][j].ToString();
+                }
+                provisional.Rows.Add(row);
+            }
+
+            //鍒ゆ柇鍒�
+            string error = JudgmentColumns(provisional);
+            if (error.Length > 0)
+            {
+                throw new ExcelException($"Excel妯℃澘瀛樺湪閿欒,{error}\r\n");
+            }
+
+            for (int i = 0; i <= provisional.Rows.Count - 1; i++)
+            {
+                string HRegionNumber = DBUtility.ClsPub.isStrNull(provisional.Rows[i]["鍦板尯浠g爜"].ToString());
+                string HRegionName = DBUtility.ClsPub.isStrNull(provisional.Rows[i]["鍦板尯鍚嶇О"].ToString());
+                string HCurrencyNumber = DBUtility.ClsPub.isStrNull(provisional.Rows[i]["榛樿璐у竵浠g爜"].ToString());
+                string HCurrencyName = DBUtility.ClsPub.isStrNull(provisional.Rows[i]["榛樿璐у竵鍚嶇О"].ToString());
+                //string HBillingNumber = DBUtility.ClsPub.isStrNull(provisional.Rows[i]["缁撶畻鏂瑰紡浠g爜"].ToString());
+                //string HBillingName = DBUtility.ClsPub.isStrNull(provisional.Rows[i]["缁撶畻鏂瑰紡鍚嶇О"].ToString());
+
+                string HCusTypeNumber = DBUtility.ClsPub.isStrNull(provisional.Rows[i]["瀹㈡埛鍒嗙被浠g爜"].ToString());
+                string HCusTypeName = DBUtility.ClsPub.isStrNull(provisional.Rows[i]["瀹㈡埛鍒嗙被鍚嶇О"].ToString());
+
+                //璁板綍浠诲姟
+                var tasks = new List<Task>();
+
+                //濡傛灉褰撳墠鍦板尯浠g爜鍜屽湴鍖哄悕绉颁笉涓虹┖鍒欏垽鏂槸鍚﹀瓨鍦�
+                if (!String.IsNullOrEmpty(HRegionName) || !String.IsNullOrEmpty(HRegionNumber))
+                {
+                    tasks.Add(JudgeRegion(HRegionNumber, HRegionName));
+                }
+
+                // 濡傛灉褰撳墠璐у竵浠g爜鍜岃揣甯佸悕绉颁笉涓虹┖鍒欏垽鏂槸鍚﹀瓨鍦�
+                if (!String.IsNullOrEmpty(HCurrencyName) || !String.IsNullOrEmpty(HCurrencyNumber))
+                    {
+                        tasks.Add(JudgeCurrency(HCurrencyNumber, HCurrencyName));
+                    }
+
+                //濡傛灉褰撳墠瀹㈡埛鍒嗙被浠g爜鍜屽悕绉�
+                if (!String.IsNullOrEmpty(HCusTypeName) || !String.IsNullOrEmpty(HCusTypeNumber))
+                    {
+                        tasks.Add(JudgeCusType(HCusTypeNumber, HCusTypeName));
+                    }
+                try
+                {
+                    //绛夊緟浠诲姟瀹屾垚
+                    Task.WaitAll(tasks.ToArray());
+                }
+                catch (AggregateException ae)
+                {
+                    string msg = ae.Message;
+                    ae.Handle(ex => {
+                        if (ex is EmptyException)
+                            msg = ex.Message;
+                            Console.WriteLine(ex.Message);
+                        return ex is EmptyException;
+                    });
+                    throw new Exception("绗�" + i +1 +"鏈夐棶棰�: " +msg);
+                }
+                  
+    
+                //鑾峰彇鐪熷疄琛屾暟
+                int line = i + 1;
+            }
+            return provisional;
+        }
+
+        /// <summary>
+        /// 鍒ゆ柇鍦板尯鏄惁姝g‘
+        /// </summary>
+        private Task<int> JudgeRegion(string HNumber, string HName)
+        {
+            return Task<int>.Factory.StartNew(() =>
+            {
+                try
+                {
+                    SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
+                    DataSet ds = oCN.RunProcReturn("select * from Gy_AreaSet where HNumber = '" + HNumber + "' and HName = '" + HName + "'", "Gy_AreaSet");
+                    if (ds.Tables[0].Rows.Count == EmptyConstant.EMPTY)
+                    {
+                        throw new EmptyException("褰撳墠鍦板尯涓嶅瓨鍦紝璇烽噸鏂伴�夋嫨");
+                    }
+                    return (int)ds.Tables[0].Rows[0][0];
+                }
+                catch (Exception e)
+                {
+                    throw new EmptyException(e.Message);
+                }
+            });
+        }
+
+        /// <summary>
+        /// 鍒ゆ柇璐у竵鏄惁姝g‘
+        /// </summary>
+        private Task<int> JudgeCurrency(string HNumber, string HName)
+        {
+            {
+                return Task<int>.Factory.StartNew(() =>
+                {
+                    try
+                    {
+                        SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
+                        DataSet ds = oCN.RunProcReturn("select * from Gy_Currency where HNumber = '" + HNumber + "' and HName = '" + HName + "'", "Gy_Currency");
+                        if (ds.Tables[0].Rows.Count == EmptyConstant.EMPTY)
+                        {
+                            throw new EmptyException("褰撳墠璐у竵涓嶅瓨鍦紝璇烽噸鏂伴�夋嫨");
+                        }
+                        return (int)ds.Tables[0].Rows[0][0];
+                    }
+                    catch (Exception e)
+                    {
+                        throw new EmptyException(e.Message);
+                    }
+                });
+            }
+        }
+
+        /// <summary>
+        /// 鍒ゆ柇瀹㈡埛鍒嗙被
+        /// </summary>
+        private Task<int> JudgeCusType(string HNumber, string HName)
+        {
+            {
+                return Task<int>.Factory.StartNew(() =>
+                {
+                    try
+                    {
+                        SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
+                        DataSet ds = oCN.RunProcReturn("select * from Gy_CusType where HNumber = '" + HNumber + "' and HName = '" + HName + "'", "Gy_CusType");
+                        if (ds.Tables[0].Rows.Count == EmptyConstant.EMPTY)
+                        {
+                            throw new EmptyException("褰撳墠鍒嗙被涓嶅瓨鍦紝璇烽噸鏂伴�夋嫨");
+                        }
+                        return (int)ds.Tables[0].Rows[0][0];
+                    }
+                    catch (Exception e)
+                    {
+                        throw new EmptyException(e.Message);
+                    }
+                });
+            }
+        }
+        #endregion
+    }
+
+}
\ No newline at end of file

--
Gitblit v1.9.1