| | |
| | | "and (产品名称=''" + com.HProductName + "'' or ''" + com.HBillNo + "''='''') " + |
| | | "and (规格型号=''" + com.HProductModel + "'' or ''" + com.HProductModel + "''='''') " + com.RandomSearch; |
| | | |
| | | ds = oCN.RunProcReturn($"exec h_p_Kf_MaterOutSumReport_Cloth_New '{sql}','1' , ''" , "h_p_Kf_MaterOutSumReport_Cloth_New"); |
| | | |
| | | |
| | | DataTable dt = ds.Tables[0]; |
| | | ds = oCN.RunProcReturn($"exec h_p_Kf_MaterOutSumReport_Cloth_New '{sql}'" , "h_p_Kf_MaterOutSumReport_Cloth_New"); |
| | | |
| | | //获取列名 |
| | | List<object> columnNameList = new List<object>(); |
| | | //添加列名 |
| | | foreach (DataColumn col in ds.Tables[0].Columns) |
| | | { |
| | | int headLen = col.ColumnName.ToString().Length; //列名的长度 |
| | | int colLen = 0; |
| | | if (ds.Tables[1].Rows[0][col.ColumnName] != null) |
| | | { |
| | | string colLenStr=ds.Tables[1].Rows[0][col.ColumnName].ToString(); |
| | | if(colLenStr != "") |
| | | { |
| | | colLen = int.Parse(colLenStr); //列中最长数据的长度 |
| | | } |
| | | |
| | | } |
| | | colLen = (headLen >= colLen) ? headLen : colLen; |
| | | Type dataType = col.DataType; |
| | | string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}"; |
| | | string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\",\"width\":\"" + colLen + "\"}"; |
| | | columnNameList.Add(JsonConvert.DeserializeObject(ColmString));//获取到DataColumn列对象的列名 |
| | | } |
| | | |
| | |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "Sucess!"; |
| | | objJsonResult.list = columnNameList; |
| | | objJsonResult.data = dt; |
| | | objJsonResult.data = ds.Tables[0]; |
| | | return objJsonResult; |
| | | } |
| | | catch (Exception e) |
| | |
| | | "and (产品名称=''" + com.HProductName + "'' or ''" + com.HBillNo + "''='''') " + |
| | | "and (规格型号=''" + com.HProductModel + "'' or ''" + com.HProductModel + "''='''') " + com.RandomSearch; |
| | | |
| | | ds = oCN.RunProcReturn($"exec h_p_Kf_MaterOutEntryReport_Cloth_New '{sql}','1' , ''", "h_p_Kf_MaterOutEntryReport_Cloth_New"); |
| | | ds = oCN.RunProcReturn($"exec h_p_Kf_MaterOutEntryReport_Cloth_New '{sql}'", "h_p_Kf_MaterOutEntryReport_Cloth_New"); |
| | | |
| | | DataTable dt = ds.Tables[0]; |
| | | |
| | |
| | | //添加列名 |
| | | foreach (DataColumn col in ds.Tables[0].Columns) |
| | | { |
| | | int headLen = col.ColumnName.ToString().Length; //列名的长度 |
| | | int colLen = 0; |
| | | if (ds.Tables[1].Rows[0][col.ColumnName] != null) |
| | | { |
| | | string colLenStr = ds.Tables[1].Rows[0][col.ColumnName].ToString(); |
| | | if (colLenStr != "") |
| | | { |
| | | colLen = int.Parse(colLenStr); //列中最长数据的长度 |
| | | } |
| | | |
| | | } |
| | | colLen = (headLen >= colLen) ? headLen : colLen; |
| | | Type dataType = col.DataType; |
| | | string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}"; |
| | | string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name +"\",\"width\":\"" + colLen + "\"}"; |
| | | columnNameList.Add(JsonConvert.DeserializeObject(ColmString));//获取到DataColumn列对象的列名 |
| | | } |
| | | |