From 8552aecdfdf50a4eba5bb5df30bc32c8f5882763 Mon Sep 17 00:00:00 2001
From: zzr99 <1940172413@qq.com>
Date: 星期一, 18 十月 2021 11:06:34 +0800
Subject: [PATCH] Merge branch 'master' of http://101.37.171.70:10101/r/MES-WEB-API

---
 WorkM/流转卡管理/Sc_ProcessExchangeBillQuery.cs                    |    4 
 WebAPI/Models/Menu.cs                                         |   20 ++++
 WebAPI/Models/ModelConvertHelper.cs                           |   45 +++++++++
 WebAPI/Models/ToHierarchy.cs                                  |   50 ++++++++++
 WebAPI/Controllers/SBGL/Sb_EquipMaintainBillController.cs     |   55 +++++-----
 WebAPI/Controllers/SBGL/Sb_EquipMaintainPlanBillController.cs |   55 +++++-----
 Model/obj/x86/Release/build.force                             |    0 
 WebAPI/Controllers/WebAPIController.cs                        |   51 ++++++++++
 Model/obj/x86/Release/Model.csprojAssemblyReference.cache     |    0 
 WebAPI/WebAPI.csproj                                          |    3 
 LMES/obj/x86/Release/LMES.csprojAssemblyReference.cache       |    0 
 LMES/obj/x86/Release/build.force                              |    0 
 12 files changed, 231 insertions(+), 52 deletions(-)

diff --git a/LMES/obj/x86/Release/LMES.csprojAssemblyReference.cache b/LMES/obj/x86/Release/LMES.csprojAssemblyReference.cache
new file mode 100644
index 0000000..154951c
--- /dev/null
+++ b/LMES/obj/x86/Release/LMES.csprojAssemblyReference.cache
Binary files differ
diff --git a/LMES/obj/x86/Release/build.force b/LMES/obj/x86/Release/build.force
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/LMES/obj/x86/Release/build.force
diff --git a/Model/obj/x86/Release/Model.csprojAssemblyReference.cache b/Model/obj/x86/Release/Model.csprojAssemblyReference.cache
new file mode 100644
index 0000000..d91a28a
--- /dev/null
+++ b/Model/obj/x86/Release/Model.csprojAssemblyReference.cache
Binary files differ
diff --git a/Model/obj/x86/Release/build.force b/Model/obj/x86/Release/build.force
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/Model/obj/x86/Release/build.force
diff --git a/WebAPI/Controllers/SBGL/Sb_EquipMaintainBillController.cs b/WebAPI/Controllers/SBGL/Sb_EquipMaintainBillController.cs
index e735caf..00db2c6 100644
--- a/WebAPI/Controllers/SBGL/Sb_EquipMaintainBillController.cs
+++ b/WebAPI/Controllers/SBGL/Sb_EquipMaintainBillController.cs
@@ -162,36 +162,39 @@
                 }
                 //閰嶄欢琛ㄤ綋鏁版嵁
                 //鎸� },{鏉ユ媶鍒嗘暟缁� //鍘绘帀銆愬拰銆�
-                msg4 = msg4.Substring(1, msg4.Length - 2);
-                msg4 = msg4.Replace("\\", "");
-                msg4 = msg4.Replace("\n", "");  //\n
-                //msg2 = msg2.Replace("'", "鈥�");
-                List<Model.ClsSb_EquipMaintainBillSub> ls1 = new List<Model.ClsSb_EquipMaintainBillSub>();
-                ls1 = oListModels.getObjectByJson_Sb_EquipMaintainBillSub(msg4);
-                int j = 0;
-                foreach (Model.ClsSb_EquipMaintainBillSub oItemSub in ls1)
+                if (msg4 != "undefined" && msg4 != "" && msg4 != "[]")
                 {
+                    msg4 = msg4.Substring(1, msg4.Length - 2);
+                    msg4 = msg4.Replace("\\", "");
+                    msg4 = msg4.Replace("\n", "");  //\n
+                                                    //msg2 = msg2.Replace("'", "鈥�");
+                    List<Model.ClsSb_EquipMaintainBillSub> ls1 = new List<Model.ClsSb_EquipMaintainBillSub>();
+                    ls1 = oListModels.getObjectByJson_Sb_EquipMaintainBillSub(msg4);
+                    int j = 0;
+                    foreach (Model.ClsSb_EquipMaintainBillSub oItemSub in ls1)
+                    {
 
-                    j++;
-                    oItemSub.HEntryID = i;
-                    //oItemSub.HCloseMan = "";       //琛屽叧闂�
-                    oItemSub.HEntryCloseDate = DBUtility.ClsPub.isDate(DateTime.Now);
-                    oItemSub.HCloseType = false;   //鍏抽棴绫诲瀷
-                    //oItemSub.HRemark = "";         //澶囨敞
-                    oItemSub.HSourceInterID = 0;     // 婧愬崟涓诲唴鐮�
-                    oItemSub.HSourceEntryID = 0;   //婧愬崟瀛愬唴鐮�
-                    //oItemSub.HSourceBillNo = "";  //婧愬崟鍗曞彿
-                    //oItemSub.HSourceBillType = ""; //婧愬崟绫诲瀷
-                    oItemSub.HRelationQty = 0;     //鍏宠仈鏁伴噺
-                                                   //oItemSub.HRelationMoney = 0;   //鍏宠仈閲戦
-                                                   //HMaterID = "";//閰嶄欢浠g爜
-                                                   //HUnitID = "";//鍗曚綅浠g爜
-                                                   //HQty = "";//瀹為檯鐢ㄩ噺
-                                                   //HQtyMust = "";//鍗曚綅鐢ㄩ噺
-                                                   //HRemark = "";//澶囨敞
+                        j++;
+                        oItemSub.HEntryID = i;
+                        //oItemSub.HCloseMan = "";       //琛屽叧闂�
+                        oItemSub.HEntryCloseDate = DBUtility.ClsPub.isDate(DateTime.Now);
+                        oItemSub.HCloseType = false;   //鍏抽棴绫诲瀷
+                                                       //oItemSub.HRemark = "";         //澶囨敞
+                        oItemSub.HSourceInterID = 0;     // 婧愬崟涓诲唴鐮�
+                        oItemSub.HSourceEntryID = 0;   //婧愬崟瀛愬唴鐮�
+                                                       //oItemSub.HSourceBillNo = "";  //婧愬崟鍗曞彿
+                                                       //oItemSub.HSourceBillType = ""; //婧愬崟绫诲瀷
+                        oItemSub.HRelationQty = 0;     //鍏宠仈鏁伴噺
+                                                       //oItemSub.HRelationMoney = 0;   //鍏宠仈閲戦
+                                                       //HMaterID = "";//閰嶄欢浠g爜
+                                                       //HUnitID = "";//鍗曚綅浠g爜
+                                                       //HQty = "";//瀹為檯鐢ㄩ噺
+                                                       //HQtyMust = "";//鍗曚綅鐢ㄩ噺
+                                                       //HRemark = "";//澶囨敞
 
-                    oBill.DetailColl.Add(oItemSub);
+                        oBill.DetailColl.Add(oItemSub);
 
+                    }
                 }
                 //淇濆瓨
                 //淇濆瓨瀹屾瘯鍚庡鐞�
diff --git a/WebAPI/Controllers/SBGL/Sb_EquipMaintainPlanBillController.cs b/WebAPI/Controllers/SBGL/Sb_EquipMaintainPlanBillController.cs
index 270672c..636bc84 100644
--- a/WebAPI/Controllers/SBGL/Sb_EquipMaintainPlanBillController.cs
+++ b/WebAPI/Controllers/SBGL/Sb_EquipMaintainPlanBillController.cs
@@ -157,36 +157,39 @@
                 }
                 //閰嶄欢椤硅〃浣撴暟鎹�
                 //鎸� },{鏉ユ媶鍒嗘暟缁� //鍘绘帀銆愬拰銆�
-                msg4 = msg4.Substring(1, msg4.Length - 2);
-                msg4 = msg4.Replace("\\", "");
-                msg4 = msg4.Replace("\n", "");  //\n
-                //msg2 = msg2.Replace("'", "鈥�");
-                List<Model.ClsSb_EquipMaintainPlanBillSub> ls1 = new List<Model.ClsSb_EquipMaintainPlanBillSub>();
-                ls1 = oListModels.getObjectByJson_Sb_EquipMaintainPlanBillSub(msg4);
-                int j = 0;
-                foreach (Model.ClsSb_EquipMaintainPlanBillSub oItemSub in ls1)
+                if (msg4 != "undefined" && msg4 != "" && msg4 != "[]")
                 {
+                    msg4 = msg4.Substring(1, msg4.Length - 2);
+                    msg4 = msg4.Replace("\\", "");
+                    msg4 = msg4.Replace("\n", "");  //\n
+                                                    //msg2 = msg2.Replace("'", "鈥�");
+                    List<Model.ClsSb_EquipMaintainPlanBillSub> ls1 = new List<Model.ClsSb_EquipMaintainPlanBillSub>();
+                    ls1 = oListModels.getObjectByJson_Sb_EquipMaintainPlanBillSub(msg4);
+                    int j = 0;
+                    foreach (Model.ClsSb_EquipMaintainPlanBillSub oItemSub in ls1)
+                    {
 
-                    j++;
-                    oItemSub.HEntryID = j;
-                    //oItemSub.HCloseMan = "";       //琛屽叧闂�
-                    oItemSub.HEntryCloseDate = DBUtility.ClsPub.isDate(DateTime.Now);
-                    oItemSub.HCloseType = false;   //鍏抽棴绫诲瀷
-                    //oItemSub.HRemark = "";         //澶囨敞
-                    oItemSub.HSourceInterID = 0;     // 婧愬崟涓诲唴鐮�
-                    oItemSub.HSourceEntryID = 0;   //婧愬崟瀛愬唴鐮�
-                    //oItemSub.HSourceBillNo = "";  //婧愬崟鍗曞彿
-                    //oItemSub.HSourceBillType = ""; //婧愬崟绫诲瀷
-                    oItemSub.HRelationQty = 0;     //鍏宠仈鏁伴噺
-                                                   //oItemSub.HRelationMoney = 0;   //鍏宠仈閲戦
-                                                   //HMaterID = "";//閰嶄欢浠g爜
-                                                   //HUnitID = "";//鍗曚綅浠g爜
-                                                   //HQty = "";//瀹為檯鐢ㄩ噺
-                                                   //HQtyMust = "";//鍗曚綅鐢ㄩ噺
-                                                   //HRemark = "";//澶囨敞
+                        j++;
+                        oItemSub.HEntryID = j;
+                        //oItemSub.HCloseMan = "";       //琛屽叧闂�
+                        oItemSub.HEntryCloseDate = DBUtility.ClsPub.isDate(DateTime.Now);
+                        oItemSub.HCloseType = false;   //鍏抽棴绫诲瀷
+                                                       //oItemSub.HRemark = "";         //澶囨敞
+                        oItemSub.HSourceInterID = 0;     // 婧愬崟涓诲唴鐮�
+                        oItemSub.HSourceEntryID = 0;   //婧愬崟瀛愬唴鐮�
+                                                       //oItemSub.HSourceBillNo = "";  //婧愬崟鍗曞彿
+                                                       //oItemSub.HSourceBillType = ""; //婧愬崟绫诲瀷
+                        oItemSub.HRelationQty = 0;     //鍏宠仈鏁伴噺
+                                                       //oItemSub.HRelationMoney = 0;   //鍏宠仈閲戦
+                                                       //HMaterID = "";//閰嶄欢浠g爜
+                                                       //HUnitID = "";//鍗曚綅浠g爜
+                                                       //HQty = "";//瀹為檯鐢ㄩ噺
+                                                       //HQtyMust = "";//鍗曚綅鐢ㄩ噺
+                                                       //HRemark = "";//澶囨敞
 
-                    oBill.DetailColl.Add(oItemSub);
+                        oBill.DetailColl.Add(oItemSub);
 
+                    }
                 }
                 //淇濆瓨
                 //淇濆瓨瀹屾瘯鍚庡鐞�
diff --git a/WebAPI/Controllers/WebAPIController.cs b/WebAPI/Controllers/WebAPIController.cs
index 73c88c0..e783b85 100644
--- a/WebAPI/Controllers/WebAPIController.cs
+++ b/WebAPI/Controllers/WebAPIController.cs
@@ -1,6 +1,8 @@
 锘縰sing DAL;
 using DBUtility;
 using Model;
+using Newtonsoft.Json;
+using Newtonsoft.Json.Converters;
 using Newtonsoft.Json.Linq;
 using SQLHelper;
 using System;
@@ -2195,6 +2197,55 @@
             }
         }
 
+
+        #region [鏌ヨ鑿滃崟鍒楄〃]
+        [Route("Web/MenuList")]
+        [HttpGet]
+        public object MenuList()
+        {
+            try
+            {
+                List<Menu> mu = new List<Menu>();
+                SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
+                ds = oCn.RunProcReturn("Select * from Gy_Menu Order by HItemID ", "Gy_Menu");
+                //List<Menu> mu1 = ds.Tables[0].AsEnumerable().Select(t => new Menu()).ToList();
+                //List<Menu> users = ModelConvertHelper<Menu>.ConvertToModel(ds.Tables[0]);
+                //var dd = ToHierarchy.ToHierarchyList(users);
+                //string json = JsonConvert.SerializeObject(dd);
+                for (int i = 0; i < ds.Tables[0].Rows.Count; i++)   //杩欓噷鏄惊鐜墍鏈�
+                {
+                    if (ds.Tables[0].Rows[i]["HPartentID"].ToString()=="0" || ds.Tables[0].Rows[i]["HitemID"].ToString() == ds.Tables[0].Rows[i]["HPartentID"].ToString())  //鍒ゆ柇鏄惁鏈�澶栧眰鏍硅妭鐐�
+                    {
+                        Menu tbj = new Menu();
+                        tbj.HitemID = ds.Tables[0].Rows[i]["HitemID"].ToString();
+                        tbj.HNumber = ds.Tables[0].Rows[i]["HNumber"].ToString();
+                        tbj.HName = ds.Tables[0].Rows[i]["HName"].ToString();
+                        tbj.HPartentID =ds.Tables[0].Rows[i]["HPartentID"].ToString();
+                        tbj.HLevel = int.Parse(ds.Tables[0].Rows[i]["HLevel"].ToString());
+                        tbj.Hurl = ds.Tables[0].Rows[i]["Hurl"].ToString();
+                        mu.Add(tbj);
+                    }
+                }
+                ToHierarchy.digui(ds.Tables[0], mu);
+                
+
+                objJsonResult.code = "1";
+                objJsonResult.count = 1;
+                objJsonResult.Message = "鍒犻櫎鎴愬姛锛�";
+                objJsonResult.data =Newtonsoft.Json.JsonConvert.SerializeObject(mu);
+                return objJsonResult;
+            }
+            catch (Exception e)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "鍒犻櫎澶辫触锛�";
+                objJsonResult.data = e.ToString();
+                return objJsonResult;
+            }
+        }
+        #endregion
+
     }
 
 }
diff --git a/WebAPI/Models/Menu.cs b/WebAPI/Models/Menu.cs
new file mode 100644
index 0000000..bb83439
--- /dev/null
+++ b/WebAPI/Models/Menu.cs
@@ -0,0 +1,20 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Web;
+
+namespace WebAPI.Models
+{
+    public class Menu
+    {
+        //public int HitemID { get; set; }
+        public string HitemID { get; set; }
+        //public int? HPartentID { get; set; }
+        public string HPartentID { get; set; }
+        public string HNumber { get; set; }
+        public string HName { get; set; }
+        public int HLevel { get; set; }
+        public string Hurl { get; set; }
+        public List<Menu> childMenus { get; set; }
+    }
+}
\ No newline at end of file
diff --git a/WebAPI/Models/ModelConvertHelper.cs b/WebAPI/Models/ModelConvertHelper.cs
new file mode 100644
index 0000000..35423a6
--- /dev/null
+++ b/WebAPI/Models/ModelConvertHelper.cs
@@ -0,0 +1,45 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Data;
+using System.Linq;
+using System.Reflection;
+using System.Web;
+
+namespace WebAPI.Models
+{
+    public class ModelConvertHelper<T> where T : new()
+    {
+        public static List<T> ConvertToModel(DataTable dt)
+        {
+            // 瀹氫箟闆嗗悎    
+            List<T> ts = new List<T>();
+
+            // 鑾峰緱姝ゆā鍨嬬殑绫诲瀷   
+            Type type = typeof(T);
+            string tempName = "";
+
+            foreach (DataRow dr in dt.Rows)
+            {
+                T t = new T();
+                // 鑾峰緱姝ゆā鍨嬬殑鍏叡灞炴��      
+                PropertyInfo[] propertys = t.GetType().GetProperties();
+                foreach (PropertyInfo pi in propertys)
+                {
+                    tempName = pi.Name;  // 妫�鏌ataTable鏄惁鍖呭惈姝ゅ垪    
+
+                    if (dt.Columns.Contains(tempName))
+                    {
+                        // 鍒ゆ柇姝ゅ睘鎬ф槸鍚︽湁Setter      
+                        if (!pi.CanWrite) continue;
+
+                        object value = dr[tempName];
+                        if (value != DBNull.Value)
+                            pi.SetValue(t, value, null);
+                    }
+                }
+                ts.Add(t);
+            }
+            return ts;
+        }
+    }    
+}
\ No newline at end of file
diff --git a/WebAPI/Models/ToHierarchy.cs b/WebAPI/Models/ToHierarchy.cs
new file mode 100644
index 0000000..9495771
--- /dev/null
+++ b/WebAPI/Models/ToHierarchy.cs
@@ -0,0 +1,50 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Data;
+using System.Linq;
+using System.Web;
+
+namespace WebAPI.Models
+{
+    public class ToHierarchy
+    {
+        public static List<Menu> ToHierarchyList(List<Menu> limits, string HPartentID/*int? HPartentID = 0*/)
+        {
+            List<Menu> newLimitList = new List<Menu>();
+            newLimitList = limits.Where(t => t.HPartentID == HPartentID).ToList();
+            for (int i = 0; i < newLimitList.Count; i++)
+            {
+                newLimitList[i].childMenus = ToHierarchyList(limits, newLimitList[i].HPartentID);//涓嬩竴灞傜骇
+            }
+            return newLimitList;
+        }
+
+
+        public static void digui(DataTable dt, List<Menu> tree)
+        {
+            for (int m = 0; m < tree.Count; m++)
+            {
+                tree[m].childMenus = new List<Menu>();
+                for (int i = 0; i < dt.Rows.Count; i++)//绗竴娆″惊鐜紝寰楀埌鎵�鏈夋牴鑺傜偣鐨勫瓙闆�
+                {
+                    if (tree[m].HitemID.ToString() == dt.Rows[i]["HPartentID"].ToString() && dt.Rows[i]["HitemID"].ToString() != dt.Rows[i]["HPartentID"].ToString())
+                    {
+                        Menu tbjson = new Menu();
+                        tbjson.HitemID = dt.Rows[i]["HitemID"].ToString();
+                        tbjson.HPartentID = dt.Rows[i]["HPartentID"].ToString();
+                        tbjson.HNumber = dt.Rows[i]["HNumber"].ToString();
+                        tbjson.HName = dt.Rows[i]["HName"].ToString();
+                        tbjson.HLevel = tree[m].HLevel;
+                        tbjson.Hurl = dt.Rows[i]["Hurl"].ToString();
+                        tree[m].childMenus.Add(tbjson);
+                    }
+                }
+                for (int i = 0; i < tree[m].childMenus.Count; i++)
+                {
+                    digui(dt, tree[m].childMenus);//鍐嶆鐢ㄥ瓙闆嗗幓寰幆锛屾嬁鍑哄瓙闆嗙殑瀛愰泦
+                }
+            }
+
+        }
+    }
+}
\ No newline at end of file
diff --git a/WebAPI/WebAPI.csproj b/WebAPI/WebAPI.csproj
index 29bbc19..8616f1f 100644
--- a/WebAPI/WebAPI.csproj
+++ b/WebAPI/WebAPI.csproj
@@ -437,12 +437,15 @@
     <Compile Include="Models\ClsSc_MouldRepairOutBillMain.cs" />
     <Compile Include="Models\ClsSc_MouldRepairOutBillSub.cs" />
     <Compile Include="Models\ClsGy_ProcPrice.cs" />
+    <Compile Include="Models\Menu.cs" />
+    <Compile Include="Models\ModelConvertHelper.cs" />
     <Compile Include="Models\Pay_OtherBalBill.cs" />
     <Compile Include="Models\Pay_WorkTimesBillSub.cs" />
     <Compile Include="Models\Pay_WorkTimesBill.cs" />
     <Compile Include="Models\Pay_SingleBalBill.cs" />
     <Compile Include="Models\Pay_OtherBalBillSub.cs" />
     <Compile Include="Models\Pay_SingleBalBillSub.cs" />
+    <Compile Include="Models\ToHierarchy.cs" />
     <Compile Include="Models\Xt_ORGANIZATIONS.cs" />
     <Compile Include="Models\ClsSb_EquipRepairWorkBillSub.cs" />
     <Compile Include="Models\ClsSc_ICMOBillWorkQtyStatus_Tmp.cs" />
diff --git "a/WorkM/\346\265\201\350\275\254\345\215\241\347\256\241\347\220\206/Sc_ProcessExchangeBillQuery.cs" "b/WorkM/\346\265\201\350\275\254\345\215\241\347\256\241\347\220\206/Sc_ProcessExchangeBillQuery.cs"
index a84cd38..e8d7492 100644
--- "a/WorkM/\346\265\201\350\275\254\345\215\241\347\256\241\347\220\206/Sc_ProcessExchangeBillQuery.cs"
+++ "b/WorkM/\346\265\201\350\275\254\345\215\241\347\256\241\347\220\206/Sc_ProcessExchangeBillQuery.cs"
@@ -1168,6 +1168,10 @@
 
         private void cf_Click(object sender, EventArgs e)
         {
+            //鏅鸿鐗瑰埆鎺у埗
+            MessageBox.Show("鍗曟嵁鎷嗗垎鍔熻兘宸叉帶鍒讹紝璇蜂笌绠$悊鍛樿仈绯�", "鎻愮ず");
+            return;
+            //
             Int64 lngBillKey = 0;
             if (grdMain.CurrentRow == null)
                 return;

--
Gitblit v1.9.1