diff --git a/MECF.Framework.UI.Client/TrayThickness/HistoryData/HistoryCoatingSqlHelp.cs b/MECF.Framework.UI.Client/TrayThickness/HistoryData/HistoryCoatingSqlHelp.cs index ccba8d2..c4c5cd5 100644 --- a/MECF.Framework.UI.Client/TrayThickness/HistoryData/HistoryCoatingSqlHelp.cs +++ b/MECF.Framework.UI.Client/TrayThickness/HistoryData/HistoryCoatingSqlHelp.cs @@ -52,7 +52,7 @@ namespace MECF.Framework.UI.Client.TrayThickness.HistoryData $"or ring_outer_number = '{name}'"; var dtAll = QueryDataClient.Instance.Service.QueryData(cmdAllName); - if (dtAll.Rows.Count != 0) + if (dtAll !=null && dtAll.Rows.Count != 0) { for (int i = 0; i < dtAll.Rows.Count; i++) { @@ -104,6 +104,9 @@ namespace MECF.Framework.UI.Client.TrayThickness.HistoryData try { var dt = QueryDataClient.Instance.Service.QueryData(cmd);//只能界面用 + if (dt == null || dt.Rows.Count == 0) + return null; + for (int i = 0; i < dt.Rows.Count; i++) { if (dt.Rows[i].ItemArray.Length != 0) @@ -140,6 +143,10 @@ namespace MECF.Framework.UI.Client.TrayThickness.HistoryData try { var dt = QueryDataClient.Instance.Service.QueryData(cmd);//只能界面用 + + if (dt == null || dt.Rows.Count == 0) + return null; + for (int i = 0; i < dt.Rows.Count; i++) { if (dt.Rows[i].ItemArray.Length != 0) @@ -173,15 +180,11 @@ namespace MECF.Framework.UI.Client.TrayThickness.HistoryData { string tray_numbers = ""; string sSql = $"select * from tray_thickness_data where tray_guid like '{tray_guid}'"; - DataSet ds = DB.ExecuteDataSet(sSql); - if (ds == null) - { + DataSet ds = DB.ExecuteDataset(sSql); + if (ds == null || ds.Tables[0].Rows.Count == 0) return false; - } - if (ds.Tables[0].Rows.Count == 0) - { - return false; - } + + tray_numbers = "'" + ds.Tables[0].Rows[0]["tray_number"].ToString() + "','" + ds.Tables[0].Rows[0]["tray_inner_number"].ToString() + "','" + ds.Tables[0].Rows[0]["ring_inner_number"].ToString() + "','" + ds.Tables[0].Rows[0]["ring_outer_number"].ToString() + "'"; @@ -206,11 +209,10 @@ namespace MECF.Framework.UI.Client.TrayThickness.HistoryData { string pm_Cmd = ""; string sSql = $"select * from pm_thickness_data where pm_guid like '{pmName}' "; - DataSet ds = DB.ExecuteDataSet(sSql); + DataSet ds = DB.ExecuteDataset(sSql); if (ds == null || ds.Tables[0].Rows.Count==0) - { return false; - } + pm_Cmd = $"'{ds.Tables[0].Rows[0]["pm_minor_cycle"].ToString()}','{ds.Tables[0].Rows[0]["pm_major_cycle"].ToString()}'"; @@ -236,7 +238,10 @@ namespace MECF.Framework.UI.Client.TrayThickness.HistoryData try { string sSql = $"select * from tray_thickness_data where tray_guid like '{tray_guid}'"; - DataSet ds = DB.ExecuteDataSet(sSql); + DataSet ds = DB.ExecuteDataset(sSql); + if (ds == null || ds.Tables[0].Rows.Count == 0) + return false; + string cmd = "select tray_coating_thickness , tray_max_thickness,tray_label from tray_thickness_main where "; cmd += $"tray_number='{ds.Tables[0].Rows[0]["tray_number"].ToString()}' " + $"or tray_number = '{ds.Tables[0].Rows[0]["tray_inner_number"].ToString()}' " + @@ -245,12 +250,11 @@ namespace MECF.Framework.UI.Client.TrayThickness.HistoryData string timeCmd = $" ORDER BY create_time DESC LIMIT 4"; - ds = DB.ExecuteDataSet(cmd+ timeCmd); + ds = DB.ExecuteDataset(cmd+ timeCmd); if (ds == null || ds.Tables[0].Rows.Count == 0) - { return false; - } + for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { double coating = double.Parse( ds.Tables[0].Rows[i]["tray_coating_thickness"].ToString()); @@ -279,19 +283,22 @@ namespace MECF.Framework.UI.Client.TrayThickness.HistoryData try { string sSql = $"select * from pm_thickness_data where pm_guid like '{pmId}'"; - DataSet ds = DB.ExecuteDataSet(sSql); + DataSet ds = DB.ExecuteDataset(sSql); + if (ds == null || ds.Tables[0].Rows.Count == 0) + return false; + + string cmd = "select pm_coating_thickness , pm_max_thickness,pm_label from pm_thickness_main where "; cmd += $"pm_cycle='{ds.Tables[0].Rows[0]["pm_minor_cycle"].ToString()}' " + $"or pm_cycle = '{ds.Tables[0].Rows[0]["pm_major_cycle"].ToString()}'"; string timeCmd = $" ORDER BY create_time DESC LIMIT 2"; - ds = DB.ExecuteDataSet(cmd + timeCmd); + ds = DB.ExecuteDataset(cmd + timeCmd); if (ds == null || ds.Tables[0].Rows.Count == 0) - { return false; - } + for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { double coating = double.Parse(ds.Tables[0].Rows[i]["pm_coating_thickness"].ToString());