Merge branch 'develop' into feature/整理优化数据库代码

# Conflicts:
#	MECF.Framework.UI.Client/TrayThickness/HistoryData/HistoryCoatingSqlHelp.cs
This commit is contained in:
HCL 2023-06-29 08:59:55 +08:00
commit 8f6d520f7c
1 changed files with 27 additions and 20 deletions

View File

@ -52,7 +52,7 @@ namespace MECF.Framework.UI.Client.TrayThickness.HistoryData
$"or ring_outer_number = '{name}'"; $"or ring_outer_number = '{name}'";
var dtAll = QueryDataClient.Instance.Service.QueryData(cmdAllName); 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++) for (int i = 0; i < dtAll.Rows.Count; i++)
{ {
@ -104,6 +104,9 @@ namespace MECF.Framework.UI.Client.TrayThickness.HistoryData
try try
{ {
var dt = QueryDataClient.Instance.Service.QueryData(cmd);//只能界面用 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++) for (int i = 0; i < dt.Rows.Count; i++)
{ {
if (dt.Rows[i].ItemArray.Length != 0) if (dt.Rows[i].ItemArray.Length != 0)
@ -140,6 +143,10 @@ namespace MECF.Framework.UI.Client.TrayThickness.HistoryData
try try
{ {
var dt = QueryDataClient.Instance.Service.QueryData(cmd);//只能界面用 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++) for (int i = 0; i < dt.Rows.Count; i++)
{ {
if (dt.Rows[i].ItemArray.Length != 0) if (dt.Rows[i].ItemArray.Length != 0)
@ -173,15 +180,11 @@ namespace MECF.Framework.UI.Client.TrayThickness.HistoryData
{ {
string tray_numbers = ""; string tray_numbers = "";
string sSql = $"select * from tray_thickness_data where tray_guid like '{tray_guid}'"; 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) if (ds == null || ds.Tables[0].Rows.Count == 0)
{
return false; 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() + "','" + 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() + "'"; 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 pm_Cmd = "";
string sSql = $"select * from pm_thickness_data where pm_guid like '{pmName}' "; 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) if (ds == null || ds.Tables[0].Rows.Count==0)
{
return false; return false;
}
pm_Cmd = $"'{ds.Tables[0].Rows[0]["pm_minor_cycle"].ToString()}','{ds.Tables[0].Rows[0]["pm_major_cycle"].ToString()}'"; 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 try
{ {
string sSql = $"select * from tray_thickness_data where tray_guid like '{tray_guid}'"; 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 "; 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()}' " + cmd += $"tray_number='{ds.Tables[0].Rows[0]["tray_number"].ToString()}' " +
$"or tray_number = '{ds.Tables[0].Rows[0]["tray_inner_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"; 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) if (ds == null || ds.Tables[0].Rows.Count == 0)
{
return false; return false;
}
for (int i = 0; i < ds.Tables[0].Rows.Count; i++) for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
{ {
double coating = double.Parse( ds.Tables[0].Rows[i]["tray_coating_thickness"].ToString()); 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 try
{ {
string sSql = $"select * from pm_thickness_data where pm_guid like '{pmId}'"; 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 "; 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()}' " + cmd += $"pm_cycle='{ds.Tables[0].Rows[0]["pm_minor_cycle"].ToString()}' " +
$"or pm_cycle = '{ds.Tables[0].Rows[0]["pm_major_cycle"].ToString()}'"; $"or pm_cycle = '{ds.Tables[0].Rows[0]["pm_major_cycle"].ToString()}'";
string timeCmd = $" ORDER BY create_time DESC LIMIT 2"; 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) if (ds == null || ds.Tables[0].Rows.Count == 0)
{
return false; return false;
}
for (int i = 0; i < ds.Tables[0].Rows.Count; i++) for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
{ {
double coating = double.Parse(ds.Tables[0].Rows[i]["pm_coating_thickness"].ToString()); double coating = double.Parse(ds.Tables[0].Rows[i]["pm_coating_thickness"].ToString());