From 45cbe7319b1d46856e7168a413f50335a7aef39b Mon Sep 17 00:00:00 2001 From: wtt <1985833171@qq.com> Date: 星期二, 11 二月 2025 09:09:17 +0800 Subject: [PATCH] 1 --- WebAPI/Controllers/生产管理/生产报表/Sc_ProductReportController.cs | 95 +++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 95 insertions(+), 0 deletions(-) diff --git "a/WebAPI/Controllers/\347\224\237\344\272\247\347\256\241\347\220\206/\347\224\237\344\272\247\346\212\245\350\241\250/Sc_ProductReportController.cs" "b/WebAPI/Controllers/\347\224\237\344\272\247\347\256\241\347\220\206/\347\224\237\344\272\247\346\212\245\350\241\250/Sc_ProductReportController.cs" index 0a15bb7..8b4ef1c 100644 --- "a/WebAPI/Controllers/\347\224\237\344\272\247\347\256\241\347\220\206/\347\224\237\344\272\247\346\212\245\350\241\250/Sc_ProductReportController.cs" +++ "b/WebAPI/Controllers/\347\224\237\344\272\247\347\256\241\347\220\206/\347\224\237\344\272\247\346\212\245\350\241\250/Sc_ProductReportController.cs" @@ -115,5 +115,100 @@ } #endregion + + #region BOM灞傜骇鏌ヨ + [Route("Sc_ProductReport/Get_BOMReportList")] + [HttpGet] + public object Get_BOMReportList(string HMaterID, string user) + { + try + { + List<object> columnNameList = new List<object>(); + + ds = oCN.RunProcReturn("exec h_p_Sc_BOMReportList '" + HMaterID + "'", "h_p_Sc_BOMReportList"); + if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "姝ょ墿鏂欐煡鏃燘OM鏁版嵁!"; + 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; + } + } + + [Route("Sc_ProductReport/Get_BOMReportList_Routing")] + [HttpGet] + public object Get_BOMReportList_Routing(string HMaterID, string user) + { + try + { + List<object> columnNameList = new List<object>(); + + ds = oCN.RunProcReturn("select * from h_v_Gy_RoutingBillList_BOM where HMaterID='"+ HMaterID + "'", "h_v_Gy_RoutingBillList_BOM"); + 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 (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 } } -- Gitblit v1.9.1