|  |  | 
 |  |  | using Newtonsoft.Json.Linq; | 
 |  |  | using Newtonsoft.Json; | 
 |  |  | using Newtonsoft.Json.Linq; | 
 |  |  | using System; | 
 |  |  | using System.Collections.Generic; | 
 |  |  | using System.Data; | 
 |  |  | 
 |  |  |         { | 
 |  |  |             try | 
 |  |  |             { | 
 |  |  |                 List<object> columnNameList = new List<object>(); | 
 |  |  |                 //编辑权限 | 
 |  |  |                 //if (!DBUtility.ClsPub.Security_Log_second("Gy_MateMould", 1, false, user)) | 
 |  |  |                 //{ | 
 |  |  | 
 |  |  |                     ds = oCN.RunProcReturn(sql, "h_v_Gy_MateMouldInfoList"); | 
 |  |  |                 } | 
 |  |  |  | 
 |  |  |                 //添加列名 | 
 |  |  |                 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));//获取到DataColumn列对象的列名 | 
 |  |  |                 } | 
 |  |  |  | 
 |  |  |                 objJsonResult.code = "1"; | 
 |  |  |                 objJsonResult.count = 1; | 
 |  |  |                 objJsonResult.Message = "Sucess!"; | 
 |  |  |                 objJsonResult.data = ds.Tables[0]; | 
 |  |  |                 objJsonResult.list = columnNameList; | 
 |  |  |                 return objJsonResult; | 
 |  |  |             } | 
 |  |  |             catch (Exception e) | 
 |  |  | 
 |  |  |         { | 
 |  |  |             try | 
 |  |  |             { | 
 |  |  |                 List<object> columnNameList = new List<object>(); | 
 |  |  |                 //ds = oCN.RunProcReturn("select " + | 
 |  |  |                 //    "a.HItemID,ltrim(a.HMaterID)+'-'+ltrim(a.HRelationID) 模具产品对应表代码,a.HUnitID,b.HName HRelationNameCol" + | 
 |  |  |                 //    ",b.HNumber HRelationNumberCol,a.HMaterID HMaterIDCol,c.HNumber HMaterNumberCol,c.HName HMaterNameCol,c.HModel HMaterModelCol" + | 
 |  |  |                 //    ",a.HRelationID HRelationIDCol,d.HNumber HUnitNumberCol,d.HName HUnitNameCol" + | 
 |  |  |                 //    ",a.HUnitID HUnitIDCol" + | 
 |  |  |                 //    ",a.HBeginDate HBeginDateCol,a.HEndDate HEndDateCol" + | 
 |  |  |                 //    ",a.HRemark HRemarkCol " + | 
 |  |  |                 //    " from Gy_MateMouldInfo a " + | 
 |  |  |                 //    " left join h_v_Gy_Mould b on a.HRelationID = b.HItemID " + | 
 |  |  |                 //    " left join Gy_Material c on a.HMaterID = c.HItemID " + | 
 |  |  |                 //    " left join Gy_Unit d on a.HUnitID = d.HItemID where a.HItemID = " + HItemID, "Gy_MateMouldInfo"); | 
 |  |  |                 ds = oCN.RunProcReturn("select " + | 
 |  |  |                     "a.HItemID,ltrim(a.HMaterID)+'-'+ltrim(a.HRelationID) 模具产品对应表代码,a.HUnitID,b.HName HRelationNameCol" + | 
 |  |  |                     ",b.HNumber HRelationNumberCol,a.HMaterID HMaterIDCol,c.HNumber HMaterNumberCol,c.HName HMaterNameCol,c.HModel HMaterModelCol" + | 
 |  |  |                     ",a.HRelationID HRelationIDCol,d.HNumber HUnitNumberCol,d.HName HUnitNameCol" + | 
 |  |  |                     "a.HItemID,a.模具产品对应表代码,a.HUnitID,b.HName 模具名称" + | 
 |  |  |                     ",b.HNumber 模具代码,a.HMaterID HMaterIDCol,c.HNumber 物料代码,c.HName 物料名称,c.HModel 规格型号" + | 
 |  |  |                     ",a.HRelationID HRelationIDCol,d.HNumber 单位代码,d.HName 单位名称" + | 
 |  |  |                     ",a.HUnitID HUnitIDCol" + | 
 |  |  |                     ",a.HBeginDate HBeginDateCol,a.HEndDate HEndDateCol" + | 
 |  |  |                     ",a.HRemark HRemarkCol " + | 
 |  |  |                     " from Gy_MateMouldInfo a " + | 
 |  |  |                     ",a.开始日期,a.结束日期" + | 
 |  |  |                     ",a.备注 " + | 
 |  |  |                     " from h_v_Gy_MateMouldInfoList a " + | 
 |  |  |                     " left join h_v_Gy_Mould b on a.HRelationID = b.HItemID " + | 
 |  |  |                     " left join Gy_Material c on a.HMaterID = c.HItemID " + | 
 |  |  |                     " left join Gy_Unit d on a.HUnitID = d.HItemID where a.HItemID = " + HItemID, "Gy_MateMouldInfo"); | 
 |  |  | 
 |  |  |                 { | 
 |  |  |                     objJsonResult.code = "0"; | 
 |  |  |                     objJsonResult.count = 0; | 
 |  |  |                     objJsonResult.Message = "false!"; | 
 |  |  |                     objJsonResult.Message = "无列表信息!"; | 
 |  |  |                     objJsonResult.data = null; | 
 |  |  |                     return objJsonResult; | 
 |  |  |                 } | 
 |  |  |                 else | 
 |  |  |                 { | 
 |  |  |                     //添加列名 | 
 |  |  |                     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));//获取到DataColumn列对象的列名 | 
 |  |  |                     } | 
 |  |  |  | 
 |  |  |                     objJsonResult.code = "1"; | 
 |  |  |                     objJsonResult.count = 1; | 
 |  |  |                     objJsonResult.Message = "Sucess!"; | 
 |  |  |                     objJsonResult.data = ds.Tables[0]; | 
 |  |  |                     objJsonResult.list = columnNameList; | 
 |  |  |                     return objJsonResult; | 
 |  |  |                 } | 
 |  |  |             } |