From f780704a804361561bb09758f58233ecb620cb82 Mon Sep 17 00:00:00 2001
From: zrg <z1873@LAPTOP-EAVL132E>
Date: 星期四, 30 四月 2026 14:53:44 +0800
Subject: [PATCH] 修复模具编辑没有存入代码 增加设备产量接口

---
 WebAPI/Controllers/生产管理/设备状态分步/Sc_HEquipStateDistributionController.cs |  101 ++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 101 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 0ad2747..406c065 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"
@@ -408,5 +408,106 @@
             }
         }
         #endregion
+
+
+        #region 璁惧浜ч噺 鑾峰彇璁惧閲囬泦浜ч噺鏈�澶�
+
+        [Route("Sc_HEquipStateDistribution/Get_EquipOutputHQty")]
+        [HttpGet]
+        public object Get_EquipOutputHQty(string sWhere, string user)
+        {
+            try
+            {
+                List<object> columnNameList = new List<object>();
+
+                string sql = @"SELECT b.HItemID HSourceID,c.HInterID HEquipID, a.HSourceCode 璁惧鍚嶇О,SUM(CASE WHEN HTechParamName = '浜ч噺' THEN TRY_CAST(HResult AS DECIMAL(18,2)) ELSE 0 END) AS 浜ч噺,
+                        MAX(CASE WHEN HTechParamName = '杩愯鏃堕暱' THEN TRY_CAST(HResult AS DECIMAL(18, 2)) ELSE NULL END) AS 杩愯鏃堕暱
+                    FROM Sb_EquipMentCollectionTechParam_Temp a with(nolock)
+                    left join Gy_Source b on a.HSourceCode=b.HMacAddr
+                    left join Gy_EquipFileBillMain c on b.HItemID=c.HSourceID
+                    WHERE HTechParamName IN('浜ч噺', '杩愯鏃堕暱')  " + sWhere+ "  GROUP BY a.HSourceCode,b.HItemID,c.HInterID";
+
+                ds = oCN.RunProcReturn(sql, "Sb_EquipMentCollectionTechParam_Temp");
+
+                //娣诲姞鍒楀悕
+                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 e)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "Exception锛�" + e.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
+        #endregion
+
+        #region 璁惧浜ч噺 鑾峰彇璁惧閲囬泦浜ч噺鏄庣粏
+
+        [Route("Sc_HEquipStateDistribution/Get_EquipOutputHQty_Detail")]
+        [HttpGet]
+        public object Get_EquipOutputHQty_Detail(int HEquipID, string HDate)
+        {
+            try
+            {
+                List<object> columnNameList = new List<object>();
+
+                ds = oCN.RunProcReturn("exec h_p_Sb_EquipMentCollectionTechParam_TempHQty_Deltail '" + HEquipID + "','" + HDate + "'", "h_p_Sb_EquipMentCollectionTechParam_TempHQty_Deltail");
+                if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "褰撳墠璁惧鏌ユ棤璇︽儏鏁版嵁!";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+                // 閬嶅巻鎵�鏈夎〃
+                foreach (DataTable table in ds.Tables)
+                {
+                    List<object> tableColumnList = new List<object>();
+
+                    // 娣诲姞鍒楀悕
+                    foreach (DataColumn col in table.Columns)
+                    {
+                        Type dataType = col.DataType;
+                        string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}";
+                        tableColumnList.Add(JsonConvert.DeserializeObject(ColmString));
+                    }
+
+                    // 灏嗘瘡涓〃鐨勫垪鍚嶅垪琛ㄦ坊鍔犲埌鎬诲垪鍚嶅垪琛�
+                    columnNameList.Add(new { TableName = table.TableName, Columns = tableColumnList });
+                }
+
+                objJsonResult.code = "1";
+                objJsonResult.count = 1;
+                objJsonResult.Message = "Sucess锛�";
+                objJsonResult.data = ds;
+                objJsonResult.list = columnNameList;
+                return objJsonResult;
+            }
+            catch (Exception e)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "Exception锛�" + e.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
+        #endregion
+
     }
 }
\ No newline at end of file

--
Gitblit v1.9.1