From 02149a8ae296cf7a4bb88ea4f6579a4481e84c06 Mon Sep 17 00:00:00 2001
From: chenhaozhe <cgz@hz-kingdee.com>
Date: 星期三, 15 四月 2026 17:24:34 +0800
Subject: [PATCH] 新建设备运行切片 API
---
WebAPI/Controllers/生产管理/设备状态分步/Sc_HEquipStateDistributionController.cs | 123 +++++++++++++++++++++++++++++++++++++++++
1 files changed, 123 insertions(+), 0 deletions(-)
diff --git "a/WebAPI/Controllers/\347\224\237\344\272\247\347\256\241\347\220\206/\350\256\276\345\244\207\347\212\266\346\200\201\345\210\206\346\255\245/Sc_HEquipStateDistributionController.cs" "b/WebAPI/Controllers/\347\224\237\344\272\247\347\256\241\347\220\206/\350\256\276\345\244\207\347\212\266\346\200\201\345\210\206\346\255\245/Sc_HEquipStateDistributionController.cs"
index 9e1eec6..120b776 100644
--- "a/WebAPI/Controllers/\347\224\237\344\272\247\347\256\241\347\220\206/\350\256\276\345\244\207\347\212\266\346\200\201\345\210\206\346\255\245/Sc_HEquipStateDistributionController.cs"
+++ "b/WebAPI/Controllers/\347\224\237\344\272\247\347\256\241\347\220\206/\350\256\276\345\244\207\347\212\266\346\200\201\345\210\206\346\255\245/Sc_HEquipStateDistributionController.cs"
@@ -23,6 +23,7 @@
//鑾峰彇绯荤粺鍙傛暟
Pub_Class.ClsXt_SystemParameter oSystemParameter = new Pub_Class.ClsXt_SystemParameter();
+
#region 璁惧鍒嗗竷 璁惧缁戝畾鐨勭敓浜ц祫婧愪笂姝e湪鐢熶骇鐨勫伐鍗�
@@ -175,5 +176,127 @@
}
}
#endregion
+
+ #region 璁惧杩愯鍒囩墖锛岃幏鍙栭儴闂�-璁惧 鏍戠姸鍥�
+ private class HEquipTreeList_DAQ_Node
+ {
+ public int id { get; set; }
+ public string title { get; set; }
+ public List<HEquipTreeList_DAQ_Node> children { get; set; }
+ }
+
+
+ [Route("DAQ_EquipRunningSlice/GetHEquipTreeList_DAQ")]
+ [HttpGet]
+ public object Sc_HEquipStateDistribution_Souce(string sWhere)
+ {
+ try
+ {
+ List<HEquipTreeList_DAQ_Node> treeArr = new List<HEquipTreeList_DAQ_Node>();
+ // 璁板綍閮ㄩ棬鏄惁宸茬粡鍔犲叆treeArr(涓嶅彲閲嶅鍔犲叆)
+ HashSet<String> HDeptSet = new HashSet<String>();
+
+ ds = oCN.RunProcReturn($@"select hmainid HEquipID, 璁惧鍚嶇О HEquipName, HDeptID HDeptID, 浣跨敤閮ㄩ棬 HDeptName from h_v_Gy_EquipFileMainList
+ {sWhere}
+ order by HEquipName asc", "h_v_Gy_EquipFileMainList");
+
+ foreach(DataRow row in ds.Tables[0].Rows)
+ {
+ int HDeptID = int.Parse(row["HDeptID"].ToString());
+ string HDeptName = row["HDeptName"] as string;
+ int HEquipID = int.Parse(row["HEquipID"].ToString());
+ string HEquipName = row["HEquipName"] as string;
+
+ if (!HDeptSet.Contains(row["HDeptID"].ToString()))
+ {
+ // 娌℃湁閮ㄩ棬瀵瑰簲鐨勪竴绾ц妭鐐癸紝鍒欐坊鍔犱竴绾ц妭鐐�
+ treeArr.Add(new HEquipTreeList_DAQ_Node
+ {
+ id = int.Parse(row["HDeptID"].ToString()),
+ title = row["HDeptName"].ToString(),
+ children = new List<HEquipTreeList_DAQ_Node>()
+ });
+
+ // 閮ㄩ棬ID娣诲姞鍒癝et锛岀‘淇濆敮涓�鎬�
+ HDeptSet.Add(row["HDeptID"].ToString());
+ }
+
+ // 閮ㄩ棬瀵瑰嵃鐨勪竴绾ц妭鐐瑰凡缁忚缃ソ锛岃缃簩绾ц妭鐐�
+ HEquipTreeList_DAQ_Node Node = treeArr.First(item => item.id == HDeptID);
+ Node.children.Add(new HEquipTreeList_DAQ_Node
+ {
+ id = HEquipID,
+ title = HEquipName,
+ children = new List<HEquipTreeList_DAQ_Node>()
+ });
+ }
+
+ objJsonResult.code = "1";
+ objJsonResult.count = 1;
+ objJsonResult.Message = "鏌ヨ鎴愬姛";
+ objJsonResult.data = JArray.FromObject(treeArr);
+ return objJsonResult;
+ }
+ catch (Exception e)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "Exception锛�" + e.Message.ToString();
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ }
+ #endregion
+
+ #region 璁惧杩愯鍒囩墖 杩斿洖璁惧鐘舵�� 鍥捐〃鏁版嵁
+ [Route("DAQ_EquipRunningSlice/GetHEquipStatusReportList_DAQ")]
+ [HttpGet]
+ public object GetHEquipStatusReportList_DAQ(string HEquipID, string HDeptID, string HBeginDate, string HEndDate, string user)
+ {
+ try
+ {
+ List<object> columnNameList = new List<object>();
+
+ string sql = "select * from h_v_Sb_EquipRunningStatusReport where 1 = 1";
+ if(!string.IsNullOrWhiteSpace(HEquipID) && HEquipID != "0")
+ {
+ sql += $" and HEquipID = {HEquipID}";
+ }
+ if(!string.IsNullOrWhiteSpace(HDeptID) && HDeptID != "0")
+ {
+ sql += $" and HDeptID = {HDeptID}";
+ }
+ if(!string.IsNullOrWhiteSpace(HBeginDate) && !string.IsNullOrWhiteSpace(HEndDate))
+ {
+ sql += $"and (鎵�灞炴棩鏈� between CONVERT(DATETIME, '{HBeginDate} 00:00:00', 120) AND CONVERT(DATETIME, '{HEndDate} 23:59:59', 120))";
+ }
+
+ ds = oCN.RunProcReturn(sql, "h_v_Sb_EquipRunningStatusReport");
+
+ //娣诲姞鍒楀悕
+ 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 = 1;
+ objJsonResult.Message = "Sucess锛�";
+ objJsonResult.data = ds.Tables[0];
+ objJsonResult.list = columnNameList;
+ return objJsonResult;
+ }
+ catch (Exception ex)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鏌ヨ鏁版嵁寮傚父锛岃涓庣鐞嗗憳鑱旂郴锛�" + ex.ToString();
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ }
+ #endregion
}
}
\ No newline at end of file
--
Gitblit v1.9.1