From 2ee2e1bb7f94b048925b8f898f3b4e9529d48f75 Mon Sep 17 00:00:00 2001
From: yusijie <ysj@hz-kingdee.com>
Date: 星期一, 25 三月 2024 13:19:13 +0800
Subject: [PATCH] 固定资产变动单
---
WebAPI/Controllers/SBGL/Gy_EquipFileMainController.cs | 84 +++++++++++++++++++++++++++++++++++++++++
1 files changed, 83 insertions(+), 1 deletions(-)
diff --git a/WebAPI/Controllers/SBGL/Gy_EquipFileMainController.cs b/WebAPI/Controllers/SBGL/Gy_EquipFileMainController.cs
index 7882ae9..e765a51 100644
--- a/WebAPI/Controllers/SBGL/Gy_EquipFileMainController.cs
+++ b/WebAPI/Controllers/SBGL/Gy_EquipFileMainController.cs
@@ -397,7 +397,7 @@
public object Sb_EquipFileBillResumeDate(string HInterID)
{
- DataTable ds, ds1;
+ DataTable ds, ds1,ds2;
long HInterID1 = long.Parse(HInterID);
List<object> list = new List<object>();
try
@@ -407,9 +407,11 @@
string sql1 = string.Format($"exec h_p_Gy_EquipRecord {HInterID1}");
ds = oCN.RunProcReturn(sql1, "h_p_Gy_EquipRecord").Tables[0];
ds1 = oCN.RunProcReturn(sql1, "h_p_Gy_EquipRecord").Tables[1];
+ ds2 = oCN.RunProcReturn(sql1, "h_p_Gy_EquipRecord").Tables[2];
list.Add(ds);//鏃ュ父璁板綍
list.Add(ds1);//缁翠慨璁板綍
+ list.Add(ds2);//閰嶄欢鏇存崲娓呭崟
objJsonResult.code = "0";
objJsonResult.count = 1;
objJsonResult.Message = "鑾峰彇淇℃伅鎴愬姛锛�";
@@ -649,5 +651,85 @@
}
}
#endregion
+
+ #region 璁惧妗f鍒楄〃 鏍戠姸鍥� 璁惧鍒嗙被鏌ヨ
+ public class TreeModel
+ {
+ public string id { get; set; }
+ public string title { get; set; }
+ public List<TreeModel> children = new List<TreeModel>();
+ }
+ [Route("Gy_EquipFileMain/TreeGetList")]
+ [HttpGet]
+ public object TreeGetList(string sWhere, string user)
+ {
+ try
+ {
+
+ ds = oCN.RunProcReturn("select HItemID,HNumber,HName from Gy_EquipFileType", "Gy_EquipFileType");
+
+ 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["hitemid"].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;
+ }
+ }
+ /// <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
}
}
--
Gitblit v1.9.1