From 5c2e5734a89b1831e55975d60a8c0a588511e3bb Mon Sep 17 00:00:00 2001
From: chenhaozhe <cgz@hz-kingdee.com>
Date: 星期三, 18 三月 2026 16:27:31 +0800
Subject: [PATCH] 1

---
 WebAPI/Controllers/WebAPIController.cs |  287 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 287 insertions(+), 0 deletions(-)

diff --git a/WebAPI/Controllers/WebAPIController.cs b/WebAPI/Controllers/WebAPIController.cs
index 08a39b6..19f9edd 100644
--- a/WebAPI/Controllers/WebAPIController.cs
+++ b/WebAPI/Controllers/WebAPIController.cs
@@ -20433,6 +20433,7 @@
             try
             {
                 SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
+
                 string sql = "exec h_p_Gy_GetQCCheckItemByProject_Sec " + CheckProjectID + "," + HBatchQty + "," + HMaterID + ",'" + HBillType + "'";
                 ds = oCN.RunProcReturn(sql, "h_p_Gy_GetQCCheckItemByProject_Sec");
                 if (ds == null || ds.Tables[0].Rows.Count <= 0)
@@ -23525,5 +23526,291 @@
             }
         }
         #endregion
+
+        #region 鑾峰彇 璁惧缁戝畾鑱屽憳淇℃伅(甯﹀嚭妯″叿鑱屽憳淇℃伅) 鍗庤垷
+        [Route("Web/getEquipBindingEmp")]
+        [HttpGet]
+        public object getEquipBindingEmp(string HEquipNumber)
+        {
+            try
+            {
+                List<object> columnNameList = new List<object>();
+
+                ds = oCN.RunProcReturn($"exec h_p_getEquipBindingEmp_huazhou {HEquipNumber}", "h_p_getEquipBindingEmp_huazhou");
+                if (ds.Tables[0].Rows.Count == 0)
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "褰撳墠璁惧娌℃湁涓婃ā淇℃伅";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+                //娣诲姞鍒楀悕
+                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
+
+        #region APP 鑾峰彇寮傚父鍙嶉鍗� 鑾峰彇 妫�楠屽崟鍐呭 閫氱敤鏂规硶
+        [Route("Web/getCheckBillStatus")]
+        [HttpGet]
+        public object getCheckBillStatus(Int64 HInterID, string HBillType)
+        {
+            try { 
+                string sql = "";
+                List<object> columnNameList = new List<object>();
+                if(HBillType == "7505")
+                {
+                    // 棣栨
+                    sql = $@"SELECT
+                          a.HInterID AS hmainid,b.HEntryID hsubid, a.HDate AS 鏃ユ湡, a.HBillNo AS 鍗曟嵁鍙�, 
+                          a.HRemark AS 琛ㄥご澶囨敞,s.HName 鐢熶骇璧勬簮鍚嶇О,s.HNumber 鐢熶骇璧勬簮浠g爜, m.HNumber AS 浜у搧鍐呯爜, m.HName AS 浜у搧鍚嶇О, m.HModel AS 浜у搧鍨嬪彿,e.HNumber as 妫�楠屽憳浠g爜, e.HName as 妫�楠屽憳鍚嶇О,
+                          a.HMaker AS 鍒跺崟浜�, a.HMakeDate AS 鍒跺崟鏃ユ湡, a.HChecker AS 瀹℃牳浜�, a.HCheckDate AS 瀹℃牳鏃ユ湡, a.HUpDater AS 淇敼浜�, 
+                          a.HUpDateDate AS 淇敼鏃ユ湡, a.HCloseMan AS 鍏抽棴浜�, a.HCloseDate AS 鍏抽棴鏃ユ湡, a.HDeleteMan AS 浣滃簾浜�, a.HDeleteDate AS 浣滃簾鏃ユ湡, 
+                          a.HBillType AS 鍗曟嵁绫诲瀷,b.HEntryID hsubid, a.HCheckQty 妫�楠屾暟閲�, a.HSourceID HSourceID,
+			       		  a.HProcExchInterID HProcExchInterID, a.HProcExchEntryID HProcExchEntryID, a.HProcExchBillNo 宸ュ簭娴佽浆鍗″彿,
+			       		  a.HICMOInterID HICMOInterID, a.HICMOEntryID HICMOEntryID, a.HICMOBillNo 鐢熶骇璁㈠崟鍙�
+                          FROM				  
+                          dbo.QC_FirstPieceCheckBillMain AS a INNER JOIN
+                          dbo.QC_FirstPieceCheckBillSub AS b ON a.HInterID = b.HInterID LEFT OUTER JOIN
+			       		  dbo.Gy_Source s on a.HSourceID =s.HItemID LEFT OUTER JOIN
+			       		  dbo.Gy_Material m on a.HMaterID = m.HItemID LEFT OUTER JOIN
+                          dbo.Gy_Employee AS e ON a.HFirstCheckEmp = e.HItemID ";
+                    sql += $" where a.HInterID = {HInterID}";
+
+                    ds = oCN.RunProcReturn(sql, "QC_FirstPieceCheckBillMain");
+
+                }
+                else if (HBillType == "7520")
+                {
+                    // 宸℃
+                    sql = $@"SELECT
+                          a.HInterID AS hmainid,b.HEntryID hsubid, a.HDate AS 鏃ユ湡, a.HBillNo AS 鍗曟嵁鍙�, 
+                          a.HRemark AS 琛ㄥご澶囨敞,s.HName 鐢熶骇璧勬簮鍚嶇О,s.HNumber 鐢熶骇璧勬簮浠g爜, m.HNumber AS 浜у搧鍐呯爜, m.HName AS 浜у搧鍚嶇О, m.HModel AS 浜у搧鍨嬪彿,e.HNumber as 妫�楠屽憳浠g爜, e.HName as 妫�楠屽憳鍚嶇О,
+                          a.HMaker AS 鍒跺崟浜�, a.HMakeDate AS 鍒跺崟鏃ユ湡, a.HChecker AS 瀹℃牳浜�, a.HCheckDate AS 瀹℃牳鏃ユ湡, a.HUpDater AS 淇敼浜�, 
+                          a.HUpDateDate AS 淇敼鏃ユ湡, a.HCloseMan AS 鍏抽棴浜�, a.HCloseDate AS 鍏抽棴鏃ユ湡, a.HDeleteMan AS 浣滃簾浜�, a.HDeleteDate AS 浣滃簾鏃ユ湡, 
+                          a.HBillType AS 鍗曟嵁绫诲瀷,b.HEntryID hsubid, a.HCheckQty 妫�楠屾暟閲�, a.HSourceID HSourceID,
+			       		  a.HProcExchInterID HProcExchInterID, a.HProcExchEntryID HProcExchEntryID, a.HProcExchBillNo 宸ュ簭娴佽浆鍗″彿,
+			       		  a.HICMOInterID HICMOInterID, a.HICMOEntryID HICMOEntryID, a.HICMOBillNo 鐢熶骇璁㈠崟鍙�
+                          FROM				  
+                          dbo.QC_PatrolProcCheckOtherBillMain AS a INNER JOIN
+                          dbo.QC_PatrolProcCheckOtherBillSub AS b ON a.HInterID = b.HInterID LEFT OUTER JOIN
+			       		  dbo.Gy_Source s on a.HSourceID =s.HItemID LEFT OUTER JOIN
+			       		  dbo.Gy_Material m on a.HMaterID = m.HItemID LEFT OUTER JOIN
+                          dbo.Gy_Employee AS e ON a.HFirstCheckEmp = e.HItemID ";
+                    sql += $" where a.HInterID = {HInterID}";
+
+                    ds = oCN.RunProcReturn(sql, "QC_PatrolProcCheckOtherBillMain");
+                }
+                else if(HBillType == "7507")
+                {
+                    // 鏈
+                    sql = $@"SELECT
+                          a.HInterID AS hmainid,b.HEntryID hsubid, a.HDate AS 鏃ユ湡, a.HBillNo AS 鍗曟嵁鍙�, 
+                          a.HRemark AS 琛ㄥご澶囨敞,s.HName 鐢熶骇璧勬簮鍚嶇О,s.HNumber 鐢熶骇璧勬簮浠g爜, m.HNumber AS 浜у搧鍐呯爜, m.HName AS 浜у搧鍚嶇О, m.HModel AS 浜у搧鍨嬪彿,e.HNumber as 妫�楠屽憳浠g爜, e.HName as 妫�楠屽憳鍚嶇О,
+                          a.HMaker AS 鍒跺崟浜�, a.HMakeDate AS 鍒跺崟鏃ユ湡, a.HChecker AS 瀹℃牳浜�, a.HCheckDate AS 瀹℃牳鏃ユ湡, a.HUpDater AS 淇敼浜�, 
+                          a.HUpDateDate AS 淇敼鏃ユ湡, a.HCloseMan AS 鍏抽棴浜�, a.HCloseDate AS 鍏抽棴鏃ユ湡, a.HDeleteMan AS 浣滃簾浜�, a.HDeleteDate AS 浣滃簾鏃ユ湡, 
+                          a.HBillType AS 鍗曟嵁绫诲瀷,b.HEntryID hsubid, a.HCheckQty 妫�楠屾暟閲�, a.HSourceID HSourceID,
+			       		  a.HProcExchInterID HProcExchInterID, a.HProcExchEntryID HProcExchEntryID, a.HProcExchBillNo 宸ュ簭娴佽浆鍗″彿,
+			       		  a.HICMOInterID HICMOInterID, a.HICMOEntryID HICMOEntryID, a.HICMOBillNo 鐢熶骇璁㈠崟鍙�
+                          , HRemarkSN 鏉$爜                          
+                          FROM				  
+                          dbo.QC_ProcessCheckBillMain AS a INNER JOIN
+                          dbo.QC_ProcessCheckBillSub AS b ON a.HInterID = b.HInterID LEFT OUTER JOIN
+			       		  dbo.Gy_Source s on a.HSourceID =s.HItemID LEFT OUTER JOIN
+			       		  dbo.Gy_Material m on a.HMaterID = m.HItemID LEFT OUTER JOIN
+                          dbo.Gy_Employee AS e ON a.HFirstCheckEmp = e.HItemID ";
+                    sql += $" where a.HInterID = {HInterID}";
+
+                    ds = oCN.RunProcReturn(sql, "QC_ProcessCheckBillMain");
+                }
+                if(ds == null || ds.Tables[0].Rows.Count == 0)
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鏌ヨ鏁版嵁寮傚父锛屾棤妫�楠屽崟锛�";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+
+                //娣诲姞鍒楀悕
+                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
+
+        #region 鏍规嵁璁惧id鑾峰彇璁惧鏁伴噰鏁版嵁
+        private class EquipTechParam
+        {
+            public string TechParamName { get; set; }
+            public DateTime CreateTime { get; set; }
+            public string Result { get; set; }
+        }
+
+        [Route("Web/getSB_EquipTechParamBillListByEquipID")]
+        [HttpGet]
+        public object getSB_EquipTechParamBillListByEquipID(Int64 HEquipID)
+        {
+            try
+            {
+                List<object> columnNameList = new List<object>();
+                // 宸ヨ壓鍙傛暟鍒嗙被鍒楄〃
+                List<string> categoryNames = new List<string>();
+                ds = oCN.RunProcReturn($"exec h_p_SB_EquipTechParamBillListByEquipID {HEquipID}", "h_p_SB_EquipTechParamBillListByEquipID");
+                var ds1 = oCN.RunProcReturn($"select * from h_v_Gy_Technology", "h_v_Gy_Technology");
+
+                if (ds.Tables[0].Rows.Count == 0)
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "褰撳墠璁惧娌℃湁鏁伴噰淇℃伅";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+
+                // 閬嶅巻鑾峰彇宸ヨ壓鍙傛暟鍒嗙被鍒楄〃
+                if (ds1.Tables[0].Rows.Count > 0)
+                {
+                    foreach (DataRow row in ds1.Tables[0].Rows)
+                    {
+                        string categoryName = row["宸ヨ壓鍙傛暟鍒嗙被鍚嶇О"].ToString().Trim();
+                        if (!string.IsNullOrEmpty(categoryName))
+                        {
+                            categoryNames.Add(categoryName);
+                        }
+                    }
+                }
+                // 鎻愬彇鍘熷鏁版嵁鍒版ā鍨嬪垪琛�
+                var rawParams = new List<EquipTechParam>();
+                foreach (DataRow row in ds.Tables[0].Rows)
+                {
+                    rawParams.Add(new EquipTechParam
+                    {
+                        TechParamName = row["HTechParamName"].ToString().Trim(),
+                        CreateTime = Convert.ToDateTime(row["HCreateTime"]),
+                        Result = row["HResult"].ToString()
+                    });
+                }
+
+                // 鎸夊伐鑹哄垎绫诲悕绉板垎缁�
+                Dictionary<string, List<EquipTechParam>> groupedParams = new Dictionary<string, List<EquipTechParam>>();
+                // 鍒濆鍖栨墍鏈夊伐鑹哄垎绫诲垎缁�
+                foreach (string category in categoryNames)
+                {
+                    groupedParams[category] = new List<EquipTechParam>();
+                }
+                // 鏂板鈥滃叾浠栧弬鏁扳�濆厹搴曞垎缁�
+                groupedParams["鍏朵粬鍙傛暟"] = new List<EquipTechParam>();
+
+                // 鍖归厤鍙傛暟鍒板搴斿垎缁勶紙鎸夊弬鏁板悕鍖呭惈鍒嗙被鍚嶇О瀛愪覆锛�
+                foreach (var param in rawParams)
+                {
+                    bool isMatched = false;
+                    // 閬嶅巻鎵�鏈夊伐鑹哄垎绫伙紝鍒ゆ柇鍙傛暟鍚嶆槸鍚﹀寘鍚鍒嗙被鍚嶇О
+                    foreach (string category in categoryNames)
+                    {
+                        if (param.TechParamName.Contains(category))
+                        {
+                            groupedParams[category].Add(param);
+                            isMatched = true;
+                            break; // 鍖归厤鍒扮涓�涓垎绫诲悗鍋滄锛堥伩鍏嶉噸澶嶅尮閰嶏級
+                        }
+                    }
+                    // 鏃犲尮閰嶅垎绫诲垯褰掍负鈥滃叾浠栧弬鏁扳��
+                    if (!isMatched)
+                    {
+                        groupedParams["鍏朵粬鍙傛暟"].Add(param);
+                    }
+                }
+
+                // 杞崲涓篔Array鏍煎紡锛堝墠绔彲鐩存帴瑙f瀽锛�
+                JArray resultJArray = new JArray();
+                foreach (var group in groupedParams)
+                {
+                    // 杩囨护绌哄垎缁勶紙鏃犳暟鎹殑鍒嗙被涓嶈繑鍥烇級
+                    if (group.Value.Count == 0) continue;
+
+                    JObject groupJObj = new JObject();
+                    groupJObj.Add("鍒嗙粍鍚嶇О", group.Key); // 宸ヨ壓鍙傛暟鍒嗙被鍚嶇О锛堝涓瓙銆佷繚鍘嬶級
+
+                    JArray paramsJArray = new JArray();
+                    foreach (var param in group.Value.OrderBy(p => p.TechParamName))
+                    {
+                        JObject paramJObj = new JObject();
+                        paramJObj.Add("HTechParamName", param.TechParamName);
+                        paramJObj.Add("HCreateTime", param.CreateTime.ToString("yyyy-MM-dd HH:mm:ss"));
+                        paramJObj.Add("HResult", param.Result);
+                        paramsJArray.Add(paramJObj);
+                    }
+                    groupJObj.Add("鍙傛暟鍒楄〃", paramsJArray);
+                    resultJArray.Add(groupJObj);
+                }
+
+                // 淇濈暀鍘熸湁鍒楀悕閫昏緫锛堝吋瀹瑰墠绔級
+                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));
+                }
+
+                // 缁勮杩斿洖缁撴灉
+                objJsonResult.code = "1";
+                objJsonResult.count = resultJArray.Count; // 鏈夋晥鍒嗙粍鏁伴噺
+                objJsonResult.Message = "Success锛�";
+                objJsonResult.data = resultJArray;
+                objJsonResult.list = columnNameList;
+                return objJsonResult;
+            }
+            catch (Exception ex)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "鏌ヨ鏁版嵁寮傚父锛岃涓庣鐞嗗憳鑱旂郴锛�" + ex.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
+        #endregion
     }
 }

--
Gitblit v1.9.1