diff --git a/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe b/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe index 4405d66..876c624 100644 --- a/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe +++ b/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe Binary files differ diff --git a/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe b/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe index 4405d66..876c624 100644 --- a/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe +++ b/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe Binary files differ diff --git a/RbFreqStandMeasure/home/HomeCtrlForm.cs b/RbFreqStandMeasure/home/HomeCtrlForm.cs index ca3181d..c827cf3 100644 --- a/RbFreqStandMeasure/home/HomeCtrlForm.cs +++ b/RbFreqStandMeasure/home/HomeCtrlForm.cs @@ -485,10 +485,7 @@ Location = new Point(899, 0), Size = new Size(75, 30) }; - - - - + dataGridView_Channel.Controls.Add(colAgingRate); colAgingRate.BringToFront(); @@ -496,144 +493,150 @@ public void refreshChannelList() { - channelFreeList.Clear(); - channelFreeList.Add("1"); - channelFreeList.Add("2"); - channelFreeList.Add("3"); - channelFreeList.Add("4"); - channelFreeList.Add("5"); - - listChannelStatus = deviceService.getDeviceByChannel(); - if (listChannelStatus != null && listChannelStatus.Count > 0) + lock (obj) { - foreach (DeviceView device in listChannelStatus) - { - channelFreeList.Remove(device.Channel); - } - } - } - public void LoadChannelStatus() - { - try - { - channelsTable = new DataTable(); - - channelsTable.Columns.Add("channelNo", Type.GetType("System.String")); - channelsTable.Columns.Add("devName", Type.GetType("System.String")); - channelsTable.Columns.Add("devCode", Type.GetType("System.String")); - channelsTable.Columns.Add("customComp", Type.GetType("System.String")); - channelsTable.Columns.Add("startTime", Type.GetType("System.String")); - channelsTable.Columns.Add("endTime", Type.GetType("System.String")); - channelsTable.Columns.Add("channelStatus", Type.GetType("System.String")); - channelsTable.Columns.Add("stablility", Type.GetType("System.String")); - channelsTable.Columns.Add("accuracy", Type.GetType("System.String")); - channelsTable.Columns.Add("startup", Type.GetType("System.String")); - channelsTable.Columns.Add("agingRate", Type.GetType("System.String")); - channelsTable.Columns.Add("deviceId", Type.GetType("System.Int64")); - channelsTable.Columns.Add("deviceItemId", Type.GetType("System.Int64")); - //channelsTable.Columns.Add("devType", Type.GetType("System.String")); - //channelsTable.Columns.Add("devModel", Type.GetType("System.String")); - //channelsTable.Columns.Add("customCom", Type.GetType("System.String")); - - listChannelStatus = deviceService.getDeviceByChannel(); - - channelsTable.Rows.Add(channelsTable.NewRow()); - channelsTable.Rows.Add(channelsTable.NewRow()); - channelsTable.Rows.Add(channelsTable.NewRow()); - channelsTable.Rows.Add(channelsTable.NewRow()); - channelsTable.Rows.Add(channelsTable.NewRow()); channelFreeList.Clear(); channelFreeList.Add("1"); channelFreeList.Add("2"); channelFreeList.Add("3"); channelFreeList.Add("4"); channelFreeList.Add("5"); - LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "listChannelStatus.count :" + listChannelStatus.Count); + listChannelStatus = deviceService.getDeviceByChannel(); if (listChannelStatus != null && listChannelStatus.Count > 0) { foreach (DeviceView device in listChannelStatus) { channelFreeList.Remove(device.Channel); - int index = Convert.ToInt32(device.Channel) - 1; - channelsTable.Rows[index]["channelNo"] = device.Channel; - channelsTable.Rows[index]["devName"] = device.DevName; - channelsTable.Rows[index]["devCode"] = device.DevCode; - channelsTable.Rows[index]["customComp"] = device.CustomerDev; - channelsTable.Rows[index]["startTime"] = device.StartTime; - channelsTable.Rows[index]["endTime"] = device.EndTime; - channelsTable.Rows[index]["channelStatus"] = "占用"; - channelsTable.Rows[index]["deviceId"] = device.Id; - channelsTable.Rows[index]["deviceItemId"] = device.DetectionItemId; - - if (device.Stability.Equals("-3")) this.Controls.Find("pic_stability_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.line; - else if (device.Stability.Equals("-2")) this.Controls.Find("pic_stability_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_gray; - else if (device.Stability.Equals("-1")) this.Controls.Find("pic_stability_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_orange; - else this.Controls.Find("pic_stability_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_green; - - if (device.Accuracy.Equals("-3")) this.Controls.Find("pic_accuracy_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.line; - else if (device.Accuracy.Equals("-2")) this.Controls.Find("pic_accuracy_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_gray; - else if (device.Accuracy.Equals("-1")) this.Controls.Find("pic_accuracy_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_orange; - else this.Controls.Find("pic_accuracy_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_green; - - if (device.AgeRate.Equals("-3")) this.Controls.Find("pic_ageRate_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.line; - else if (device.AgeRate.Equals("-2")) this.Controls.Find("pic_ageRate_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_gray; - else if (device.AgeRate.Equals("-1")) this.Controls.Find("pic_ageRate_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_orange; - else this.Controls.Find("pic_ageRate_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_green; - - if (device.BootFeature.Equals("-3")) this.Controls.Find("pic_bootFeature_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.line; - else if (device.BootFeature.Equals("-2")) this.Controls.Find("pic_bootFeature_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_gray; - else if (device.BootFeature.Equals("-1")) this.Controls.Find("pic_bootFeature_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_orange; - else this.Controls.Find("pic_bootFeature_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_green; - - } } - else + } + } + public void LoadChannelStatus() + { + try + { + lock (obj) { - channelsTable.Rows.Clear(); - channelsTable.Rows.Add("1", "", "", "", "", "", "空闲", "", ""); - channelsTable.Rows.Add("2", "", "", "", "", "", "空闲", "", ""); - channelsTable.Rows.Add("3", "", "", "", "", "", "空闲", "", ""); - channelsTable.Rows.Add("4", "", "", "", "", "", "空闲", "", ""); - channelsTable.Rows.Add("5", "", "", "", "", "", "空闲", "", ""); + channelsTable = new DataTable(); + + channelsTable.Columns.Add("channelNo", Type.GetType("System.String")); + channelsTable.Columns.Add("devName", Type.GetType("System.String")); + channelsTable.Columns.Add("devCode", Type.GetType("System.String")); + channelsTable.Columns.Add("customComp", Type.GetType("System.String")); + channelsTable.Columns.Add("startTime", Type.GetType("System.String")); + channelsTable.Columns.Add("endTime", Type.GetType("System.String")); + channelsTable.Columns.Add("channelStatus", Type.GetType("System.String")); + channelsTable.Columns.Add("stablility", Type.GetType("System.String")); + channelsTable.Columns.Add("accuracy", Type.GetType("System.String")); + channelsTable.Columns.Add("startup", Type.GetType("System.String")); + channelsTable.Columns.Add("agingRate", Type.GetType("System.String")); + channelsTable.Columns.Add("deviceId", Type.GetType("System.Int64")); + channelsTable.Columns.Add("deviceItemId", Type.GetType("System.Int64")); + //channelsTable.Columns.Add("devType", Type.GetType("System.String")); + //channelsTable.Columns.Add("devModel", Type.GetType("System.String")); + //channelsTable.Columns.Add("customCom", Type.GetType("System.String")); + + listChannelStatus = deviceService.getDeviceByChannel(); + + channelsTable.Rows.Add(channelsTable.NewRow()); + channelsTable.Rows.Add(channelsTable.NewRow()); + channelsTable.Rows.Add(channelsTable.NewRow()); + channelsTable.Rows.Add(channelsTable.NewRow()); + channelsTable.Rows.Add(channelsTable.NewRow()); + channelFreeList.Clear(); + channelFreeList.Add("1"); + channelFreeList.Add("2"); + channelFreeList.Add("3"); + channelFreeList.Add("4"); + channelFreeList.Add("5"); + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "listChannelStatus.count :" + listChannelStatus.Count); + + if (listChannelStatus != null && listChannelStatus.Count > 0) + { + foreach (DeviceView device in listChannelStatus) + { + channelFreeList.Remove(device.Channel); + int index = Convert.ToInt32(device.Channel) - 1; + channelsTable.Rows[index]["channelNo"] = device.Channel; + channelsTable.Rows[index]["devName"] = device.DevName; + channelsTable.Rows[index]["devCode"] = device.DevCode; + channelsTable.Rows[index]["customComp"] = device.CustomerDev; + channelsTable.Rows[index]["startTime"] = device.StartTime; + channelsTable.Rows[index]["endTime"] = device.EndTime; + channelsTable.Rows[index]["channelStatus"] = "占用"; + channelsTable.Rows[index]["deviceId"] = device.Id; + channelsTable.Rows[index]["deviceItemId"] = device.DetectionItemId; + + if (device.Stability.Equals("-3")) this.Controls.Find("pic_stability_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.line; + else if (device.Stability.Equals("-2")) this.Controls.Find("pic_stability_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_gray; + else if (device.Stability.Equals("-1")) this.Controls.Find("pic_stability_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_orange; + else this.Controls.Find("pic_stability_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_green; + + if (device.Accuracy.Equals("-3")) this.Controls.Find("pic_accuracy_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.line; + else if (device.Accuracy.Equals("-2")) this.Controls.Find("pic_accuracy_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_gray; + else if (device.Accuracy.Equals("-1")) this.Controls.Find("pic_accuracy_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_orange; + else this.Controls.Find("pic_accuracy_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_green; + + if (device.AgeRate.Equals("-3")) this.Controls.Find("pic_ageRate_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.line; + else if (device.AgeRate.Equals("-2")) this.Controls.Find("pic_ageRate_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_gray; + else if (device.AgeRate.Equals("-1")) this.Controls.Find("pic_ageRate_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_orange; + else this.Controls.Find("pic_ageRate_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_green; + + if (device.BootFeature.Equals("-3")) this.Controls.Find("pic_bootFeature_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.line; + else if (device.BootFeature.Equals("-2")) this.Controls.Find("pic_bootFeature_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_gray; + else if (device.BootFeature.Equals("-1")) this.Controls.Find("pic_bootFeature_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_orange; + else this.Controls.Find("pic_bootFeature_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_green; + + + } + } + else + { + channelsTable.Rows.Clear(); + channelsTable.Rows.Add("1", "", "", "", "", "", "空闲", "", ""); + channelsTable.Rows.Add("2", "", "", "", "", "", "空闲", "", ""); + channelsTable.Rows.Add("3", "", "", "", "", "", "空闲", "", ""); + channelsTable.Rows.Add("4", "", "", "", "", "", "空闲", "", ""); + channelsTable.Rows.Add("5", "", "", "", "", "", "空闲", "", ""); + } + + foreach (string no in channelFreeList) + { + channelsTable.Rows[Convert.ToInt32(no) - 1]["channelNo"] = no; + channelsTable.Rows[Convert.ToInt32(no) - 1]["channelStatus"] = "空闲"; + } + + + dataGridView_Channel.DataSource = channelsTable; + + // width=764px + dataGridView_Channel.Columns[11].Visible = false; + dataGridView_Channel.Columns[12].Visible = false; + dataGridView_Channel.Columns[0].Width = 50; + dataGridView_Channel.Columns[1].Width = 110; + dataGridView_Channel.Columns[2].Width = 110; + dataGridView_Channel.Columns[3].Width = 110; + dataGridView_Channel.Columns[4].Width = 120; + dataGridView_Channel.Columns[5].Width = 120; + dataGridView_Channel.Columns[6].Width = 64; + dataGridView_Channel.Columns[7].Width = 75; + dataGridView_Channel.Columns[8].Width = 75; + dataGridView_Channel.Columns[9].Width = 75; + dataGridView_Channel.Columns[10].Width = 75; + + dataGridView_Channel.Columns[0].ReadOnly = true; + dataGridView_Channel.Columns[1].ReadOnly = true; + dataGridView_Channel.Columns[2].ReadOnly = true; + dataGridView_Channel.Columns[3].ReadOnly = true; + dataGridView_Channel.Columns[4].ReadOnly = true; + dataGridView_Channel.Columns[5].ReadOnly = true; + dataGridView_Channel.Columns[6].ReadOnly = true; + dataGridView_Channel.Columns[7].ReadOnly = true; + dataGridView_Channel.Columns[8].ReadOnly = true; + dataGridView_Channel.Columns[9].ReadOnly = true; + dataGridView_Channel.Columns[10].ReadOnly = true; } - - foreach (string no in channelFreeList) - { - channelsTable.Rows[Convert.ToInt32(no) - 1]["channelNo"] = no; - channelsTable.Rows[Convert.ToInt32(no) - 1]["channelStatus"] = "空闲"; - } - - - dataGridView_Channel.DataSource = channelsTable; - - // width=764px - dataGridView_Channel.Columns[11].Visible = false; - dataGridView_Channel.Columns[12].Visible = false; - dataGridView_Channel.Columns[0].Width = 50; - dataGridView_Channel.Columns[1].Width = 110; - dataGridView_Channel.Columns[2].Width = 110; - dataGridView_Channel.Columns[3].Width = 110; - dataGridView_Channel.Columns[4].Width = 120; - dataGridView_Channel.Columns[5].Width = 120; - dataGridView_Channel.Columns[6].Width = 64; - dataGridView_Channel.Columns[7].Width = 75; - dataGridView_Channel.Columns[8].Width = 75; - dataGridView_Channel.Columns[9].Width = 75; - dataGridView_Channel.Columns[10].Width = 75; - - dataGridView_Channel.Columns[0].ReadOnly = true; - dataGridView_Channel.Columns[1].ReadOnly = true; - dataGridView_Channel.Columns[2].ReadOnly = true; - dataGridView_Channel.Columns[3].ReadOnly = true; - dataGridView_Channel.Columns[4].ReadOnly = true; - dataGridView_Channel.Columns[5].ReadOnly = true; - dataGridView_Channel.Columns[6].ReadOnly = true; - dataGridView_Channel.Columns[7].ReadOnly = true; - dataGridView_Channel.Columns[8].ReadOnly = true; - dataGridView_Channel.Columns[9].ReadOnly = true; - dataGridView_Channel.Columns[10].ReadOnly = true; } catch (Exception ex) { @@ -646,23 +649,26 @@ { try { - dataGridView_Channel.ClearSelection(); + lock (obj) + { + dataGridView_Channel.ClearSelection(); - int channelNo = e.RowIndex + 1; - if (channelFreeList.Contains(channelNo + "")) - { - dataGridView_Channel.Rows[e.RowIndex].DefaultCellStyle.BackColor = Color.FromArgb(232, 234, 238); - panel_channelList.Controls.Find("panel" + channelNo, true)[0].Visible = false; - } - else - { - dataGridView_Channel.Rows[e.RowIndex].DefaultCellStyle.BackColor = Color.FromArgb(201, 203, 208); - panel_channelList.Controls.Find("panel" + channelNo, true)[0].Visible = true; - } - foreach (string no in channelFreeList) - { - dataGridView_Channel.Rows[Convert.ToInt32(no) - 1].DefaultCellStyle.BackColor = Color.FromArgb(232, 234, 238); - panel_channelList.Controls.Find("panel" + no, true)[0].Visible = false; + int channelNo = e.RowIndex + 1; + if (channelFreeList.Contains(channelNo + "")) + { + dataGridView_Channel.Rows[e.RowIndex].DefaultCellStyle.BackColor = Color.FromArgb(232, 234, 238); + panel_channelList.Controls.Find("panel" + channelNo, true)[0].Visible = false; + } + else + { + dataGridView_Channel.Rows[e.RowIndex].DefaultCellStyle.BackColor = Color.FromArgb(201, 203, 208); + panel_channelList.Controls.Find("panel" + channelNo, true)[0].Visible = true; + } + foreach (string no in channelFreeList.ToArray()) + { + dataGridView_Channel.Rows[Convert.ToInt32(no) - 1].DefaultCellStyle.BackColor = Color.FromArgb(232, 234, 238); + panel_channelList.Controls.Find("panel" + no, true)[0].Visible = false; + } } } catch (Exception ex)