WebAPI/Controllers/BaseSet/Gy_CustomerController.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
WebAPI/Controllers/BaseSet/Gy_SupplierController.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
WebAPI/Properties/PublishProfiles/FolderProfile.pubxml.user | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 |
WebAPI/Controllers/BaseSet/Gy_CustomerController.cs
@@ -1175,5 +1175,166 @@ } #endregion #region 客户分类 树形图(根据代码展开树状图) [Route("Gy_BadReason/Gy_CusrTypeTreeList")] [HttpGet] public object Gy_CusrTypeTreeList() { try { string sql1 = string.Format("select hitemid,hnumber,hname from Gy_MaterType order by hnumber"); ds = oCN.RunProcReturn(sql1, "Gy_MaterType"); List<TreeModel> treeModels = new List<TreeModel>(); TreeModel first = new TreeModel(); first.id = "0"; first.title = "客户分类设置"; treeModels.Add(first); foreach (DataRow row in ds.Tables[0].Rows) { var strLen = row["hnumber"].ToString().Split('.'); if (strLen.Length == 1) { TreeModel tree = new TreeModel(); tree.id = row["hitemid"].ToString(); tree.title = row["hname"].ToString(); treeModels[0].children.Add(tree); } } digui(ds.Tables[0], treeModels[0].children, 2); objJsonResult.code = "1"; objJsonResult.count = 1; objJsonResult.Message = "Sucess!"; objJsonResult.data = Newtonsoft.Json.JsonConvert.SerializeObject(treeModels); return objJsonResult; } catch (Exception e) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "Exception!" + e.ToString(); objJsonResult.data = null; return objJsonResult; } } #endregion #region 根据父id和等级获得树状图递归 [Route("Gy_BadReason/Gy_CusTypeTreeListByLevel")] [HttpGet] public object Gy_CusTypeTreeListByLevel() { try { string sql1 = string.Format("select hitemid,hnumber,hname,hparentid,hlevel from Gy_CusType order by hnumber"); ds = oCN.RunProcReturn(sql1, "Gy_CusType"); List<TreeModel> treeModels = new List<TreeModel>(); TreeModel first = new TreeModel(); first.id = "0"; first.title = "客户分类设置"; treeModels.Add(first); foreach (DataRow row in ds.Tables[0].Rows) { var HLevel = (int)row["hlevel"]; if (HLevel == 1) { TreeModel tree = new TreeModel(); tree.id = row["hitemid"].ToString(); tree.title = row["hname"].ToString(); treeModels[0].children.Add(tree); } } getTreeByLevel(ds.Tables[0], treeModels[0].children, 2); objJsonResult.code = "1"; objJsonResult.count = 1; objJsonResult.Message = "Sucess!"; objJsonResult.data = Newtonsoft.Json.JsonConvert.SerializeObject(treeModels); return objJsonResult; } catch (Exception e) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "Exception!" + e.ToString(); objJsonResult.data = null; return objJsonResult; } } #endregion #region 物料分类 树形图(根据代码展开树状图) 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);//再次用子集去循环,拿出子集的子集 } } } public class TreeModel { public string id { get; set; } public string title { get; set; } public List<TreeModel> children = new List<TreeModel>(); } #endregion /// <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);//再次用子集去循环,拿出子集的子集 } } } } } WebAPI/Controllers/BaseSet/Gy_SupplierController.cs
@@ -932,5 +932,114 @@ } #endregion #region 根据父id和等级获得树状图递归 [Route("Gy_BadReason/Gy_SupTypeTreeListByLevel")] [HttpGet] public object Gy_MaterTypeTreeListByLevel() { try { string sql1 = string.Format("select hitemid,hnumber,hname,hparentid,hlevel from Gy_SupType order by hnumber"); ds = oCN.RunProcReturn(sql1, "Gy_SupType"); List<TreeModel> treeModels = new List<TreeModel>(); TreeModel first = new TreeModel(); first.id = "0"; first.title = "供应商分类设置"; treeModels.Add(first); foreach (DataRow row in ds.Tables[0].Rows) { var HLevel = (int)row["hlevel"]; if (HLevel == 1) { TreeModel tree = new TreeModel(); tree.id = row["hitemid"].ToString(); tree.title = row["hname"].ToString(); treeModels[0].children.Add(tree); } } getTreeByLevel(ds.Tables[0], treeModels[0].children, 2); objJsonResult.code = "1"; objJsonResult.count = 1; objJsonResult.Message = "Sucess!"; objJsonResult.data = Newtonsoft.Json.JsonConvert.SerializeObject(treeModels); return objJsonResult; } catch (Exception e) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "Exception!" + e.ToString(); objJsonResult.data = null; return objJsonResult; } } 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 #region 物料分类 树形图(根据代码展开树状图) public class TreeModel { public string id { get; set; } public string title { get; set; } public List<TreeModel> children = new List<TreeModel>(); } /// <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 } } WebAPI/Properties/PublishProfiles/FolderProfile.pubxml.user
@@ -23,12 +23,12 @@ <File Include="bin/BLL.dll"> <publishTime>11/09/2022 16:02:08</publishTime> <publishTime>11/02/2022 22:03:01</publishTime> <publishTime>08/08/2024 10:24:31</publishTime> <publishTime>08/09/2024 17:06:15</publishTime> </File> <File Include="bin/BLL.pdb"> <publishTime>11/09/2022 16:02:08</publishTime> <publishTime>11/02/2022 22:03:01</publishTime> <publishTime>08/08/2024 10:24:31</publishTime> <publishTime>08/09/2024 17:06:15</publishTime> </File> <File Include="bin/BouncyCastle.Crypto.dll"> <publishTime>12/18/2020 05:32:28</publishTime> @@ -36,12 +36,12 @@ <File Include="bin/DAL.dll"> <publishTime>11/09/2022 16:02:06</publishTime> <publishTime>11/02/2022 22:02:58</publishTime> <publishTime>08/08/2024 10:24:29</publishTime> <publishTime>08/09/2024 17:06:12</publishTime> </File> <File Include="bin/DAL.pdb"> <publishTime>11/09/2022 16:02:06</publishTime> <publishTime>11/02/2022 22:02:58</publishTime> <publishTime>08/08/2024 10:24:29</publishTime> <publishTime>08/09/2024 17:06:12</publishTime> </File> <File Include="bin/Dapper.dll"> <publishTime>07/22/2016 22:52:40</publishTime> @@ -49,12 +49,12 @@ <File Include="bin/DBUtility.dll"> <publishTime>11/02/2022 22:02:56</publishTime> <publishTime>11/15/2022 13:55:23</publishTime> <publishTime>08/08/2024 10:24:24</publishTime> <publishTime>08/09/2024 17:06:06</publishTime> </File> <File Include="bin/DBUtility.pdb"> <publishTime>11/09/2022 16:01:58</publishTime> <publishTime>11/02/2022 22:02:56</publishTime> <publishTime>08/08/2024 10:24:24</publishTime> <publishTime>08/09/2024 17:06:06</publishTime> </File> <File Include="bin/Grpc.Core.Api.dll"> <publishTime>03/22/2022 13:17:26</publishTime> @@ -110,12 +110,12 @@ <File Include="bin/Model.dll"> <publishTime>11/09/2022 16:02:01</publishTime> <publishTime>11/02/2022 22:02:56</publishTime> <publishTime>08/08/2024 10:24:25</publishTime> <publishTime>08/09/2024 17:06:07</publishTime> </File> <File Include="bin/Model.pdb"> <publishTime>11/09/2022 16:02:01</publishTime> <publishTime>11/02/2022 22:02:56</publishTime> <publishTime>08/08/2024 10:24:25</publishTime> <publishTime>08/09/2024 17:06:07</publishTime> </File> <File Include="bin/Models/ClsSc_MouldScrapOutBillMain.cs"> <publishTime>04/15/2024 12:55:45</publishTime> @@ -150,33 +150,33 @@ <File Include="bin/Pub_Class.dll"> <publishTime>11/09/2022 16:01:56</publishTime> <publishTime>11/02/2022 22:02:54</publishTime> <publishTime>08/08/2024 10:24:22</publishTime> <publishTime>08/09/2024 17:06:05</publishTime> </File> <File Include="bin/Pub_Class.pdb"> <publishTime>11/09/2022 16:01:56</publishTime> <publishTime>11/02/2022 22:02:54</publishTime> <publishTime>08/08/2024 10:24:22</publishTime> <publishTime>08/09/2024 17:06:05</publishTime> </File> <File Include="bin/Pub_Control.dll"> <publishTime>11/09/2022 16:01:57</publishTime> <publishTime>11/02/2022 22:02:55</publishTime> <publishTime>08/08/2024 10:24:24</publishTime> <publishTime>08/09/2024 17:06:05</publishTime> </File> <File Include="bin/Pub_Control.pdb"> <publishTime>11/09/2022 16:01:57</publishTime> <publishTime>11/02/2022 22:02:55</publishTime> <publishTime>08/08/2024 10:24:24</publishTime> <publishTime>08/09/2024 17:06:05</publishTime> </File> <File Include="bin/RestSharp.dll"> <publishTime>08/31/2012 06:22:50</publishTime> </File> <File Include="bin/SQLHelper.dll"> <publishTime>08/08/2024 10:24:24</publishTime> <publishTime>08/09/2024 17:06:05</publishTime> </File> <File Include="bin/SQLHelper.pdb"> <publishTime>11/09/2022 16:01:57</publishTime> <publishTime>11/02/2022 22:02:55</publishTime> <publishTime>08/08/2024 10:24:24</publishTime> <publishTime>08/09/2024 17:06:05</publishTime> </File> <File Include="bin/stdole.dll"> <publishTime>05/09/2021 13:35:37</publishTime> @@ -295,7 +295,7 @@ <File Include="bin/WebAPI.dll"> <publishTime>11/14/2022 11:23:59</publishTime> <publishTime>11/02/2022 22:03:04</publishTime> <publishTime>08/08/2024 10:24:39</publishTime> <publishTime>08/09/2024 17:06:21</publishTime> </File> <File Include="bin/WebAPI.dll.config"> <publishTime>12/15/2021 17:59:43</publishTime> @@ -303,7 +303,7 @@ <File Include="bin/WebAPI.pdb"> <publishTime>11/14/2022 11:23:59</publishTime> <publishTime>11/02/2022 22:03:04</publishTime> <publishTime>08/08/2024 10:24:39</publishTime> <publishTime>08/09/2024 17:06:21</publishTime> </File> <File Include="bin/WebGrease.dll"> <publishTime>07/18/2013 01:03:52</publishTime> @@ -512,7 +512,7 @@ <File Include="Web.config"> <publishTime>11/14/2022 11:24:08</publishTime> <publishTime>11/02/2022 22:03:20</publishTime> <publishTime>08/08/2024 10:31:57</publishTime> <publishTime>08/09/2024 17:07:33</publishTime> </File> </ItemGroup> </Project>