INT69DC_7C/INT69DC_7C/Controls/ControlMainDisplayFeedbacak.cs

1024 lines
50 KiB
C#
Raw Normal View History

2023-07-21 04:42:01 +00:00
using System;
using System.Linq;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Text;
using System.Windows.Forms;
using SmartX;
using INT69DC_7C.Forms;
using INT69DC_7C.DialogForms;
namespace INT69DC_7C.Controls
{
public partial class ControlMainDisplayFeedbacak : UserControl
{
#region Field
private FormMainDisplay m_ParentForm;
private Collection<SmartLabel> CollectionLane;
private Collection<SmartLabel> CollectionSampleCount;
private Collection<SmartLabel> CollectionIgnoreCount;
private Collection<SmartLabel> CollectionFeedbackWeight;
private Collection<SmartLabel> CollectionCurrentWeight;
#endregion
#region Constructor
public ControlMainDisplayFeedbacak(FormMainDisplay parent)
{
InitializeComponent();
this.ParentForm = parent;
this.CreateCollection();
this.InitializeControl();
}
#endregion
#region Property
public FormMainDisplay ParentForm
{
get { return this.m_ParentForm; }
private set { this.m_ParentForm = value; }
}
#endregion
#region Method
private void CreateCollection()
{
this.CollectionLane = new Collection<SmartLabel>();
this.CollectionLane.Clear();
this.CollectionLane.Add(this.labelLane1);
this.CollectionLane.Add(this.labelLane2);
this.CollectionLane.Add(this.labelLane3);
this.CollectionLane.Add(this.labelLane4);
this.CollectionLane.Add(this.labelLane5);
this.CollectionLane.Add(this.labelLane6);
this.CollectionLane.Add(this.labelLane7);
this.CollectionLane.Add(this.labelLane8);
this.CollectionLane.Add(this.labelLane9);
this.CollectionLane.Add(this.labelLane10);
this.CollectionLane.Add(this.labelLane11);
this.CollectionLane.Add(this.labelLane12);
this.CollectionSampleCount = new Collection<SmartLabel>();
this.CollectionSampleCount.Clear();
this.CollectionSampleCount.Add(this.labelSampleCount1);
this.CollectionSampleCount.Add(this.labelSampleCount2);
this.CollectionSampleCount.Add(this.labelSampleCount3);
this.CollectionSampleCount.Add(this.labelSampleCount4);
this.CollectionSampleCount.Add(this.labelSampleCount5);
this.CollectionSampleCount.Add(this.labelSampleCount6);
this.CollectionSampleCount.Add(this.labelSampleCount7);
this.CollectionSampleCount.Add(this.labelSampleCount8);
this.CollectionSampleCount.Add(this.labelSampleCount9);
this.CollectionSampleCount.Add(this.labelSampleCount10);
this.CollectionSampleCount.Add(this.labelSampleCount11);
this.CollectionSampleCount.Add(this.labelSampleCount12);
this.CollectionIgnoreCount = new Collection<SmartLabel>();
this.CollectionIgnoreCount.Clear();
this.CollectionIgnoreCount.Add(this.labelIgnoreCount1);
this.CollectionIgnoreCount.Add(this.labelIgnoreCount2);
this.CollectionIgnoreCount.Add(this.labelIgnoreCount3);
this.CollectionIgnoreCount.Add(this.labelIgnoreCount4);
this.CollectionIgnoreCount.Add(this.labelIgnoreCount5);
this.CollectionIgnoreCount.Add(this.labelIgnoreCount6);
this.CollectionIgnoreCount.Add(this.labelIgnoreCount7);
this.CollectionIgnoreCount.Add(this.labelIgnoreCount8);
this.CollectionIgnoreCount.Add(this.labelIgnoreCount9);
this.CollectionIgnoreCount.Add(this.labelIgnoreCount10);
this.CollectionIgnoreCount.Add(this.labelIgnoreCount11);
this.CollectionIgnoreCount.Add(this.labelIgnoreCount12);
this.CollectionFeedbackWeight = new Collection<SmartLabel>();
this.CollectionFeedbackWeight.Clear();
this.CollectionFeedbackWeight.Add(this.labelFeedbackWeight1);
this.CollectionFeedbackWeight.Add(this.labelFeedbackWeight2);
this.CollectionFeedbackWeight.Add(this.labelFeedbackWeight3);
this.CollectionFeedbackWeight.Add(this.labelFeedbackWeight4);
this.CollectionFeedbackWeight.Add(this.labelFeedbackWeight5);
this.CollectionFeedbackWeight.Add(this.labelFeedbackWeight6);
this.CollectionFeedbackWeight.Add(this.labelFeedbackWeight7);
this.CollectionFeedbackWeight.Add(this.labelFeedbackWeight8);
this.CollectionFeedbackWeight.Add(this.labelFeedbackWeight9);
this.CollectionFeedbackWeight.Add(this.labelFeedbackWeight10);
this.CollectionFeedbackWeight.Add(this.labelFeedbackWeight11);
this.CollectionFeedbackWeight.Add(this.labelFeedbackWeight12);
this.CollectionCurrentWeight = new Collection<SmartLabel>();
this.CollectionCurrentWeight.Clear();
this.CollectionCurrentWeight.Add(this.labelCurrentWeight1);
this.CollectionCurrentWeight.Add(this.labelCurrentWeight2);
this.CollectionCurrentWeight.Add(this.labelCurrentWeight3);
this.CollectionCurrentWeight.Add(this.labelCurrentWeight4);
this.CollectionCurrentWeight.Add(this.labelCurrentWeight5);
this.CollectionCurrentWeight.Add(this.labelCurrentWeight6);
this.CollectionCurrentWeight.Add(this.labelCurrentWeight7);
this.CollectionCurrentWeight.Add(this.labelCurrentWeight8);
this.CollectionCurrentWeight.Add(this.labelCurrentWeight9);
this.CollectionCurrentWeight.Add(this.labelCurrentWeight10);
this.CollectionCurrentWeight.Add(this.labelCurrentWeight11);
this.CollectionCurrentWeight.Add(this.labelCurrentWeight12);
}
private void InitializeControl()
{
this.comboBoxCorrectionRate.SelectedIndexChanged -= new EventHandler(this.comboBoxCollectionRate_SelectedIndexChanged);
this.comboBoxCorrectionRate.Items.Clear();
this.comboBoxCorrectionRate.Items.Add(Helper.StringToDecimalPlaces("1", this.ParentForm.ParentForm.SystemConfig.DecimalPlaces));
this.comboBoxCorrectionRate.Items.Add(Helper.StringToDecimalPlaces("2", this.ParentForm.ParentForm.SystemConfig.DecimalPlaces));
this.comboBoxCorrectionRate.Items.Add(Helper.StringToDecimalPlaces("5", this.ParentForm.ParentForm.SystemConfig.DecimalPlaces));
this.comboBoxCorrectionRate.Items.Add(Helper.StringToDecimalPlaces("10", this.ParentForm.ParentForm.SystemConfig.DecimalPlaces));
this.comboBoxCorrectionRate.SelectedIndex = 0;
this.comboBoxCorrectionRate.SelectedIndexChanged += new EventHandler(this.comboBoxCollectionRate_SelectedIndexChanged);
this.UpdateBoardStatusDisplay(false);
for (int i = 0; i < this.ParentForm.ParentForm.SystemConfig.EquipmentColumns; i++)
{
this.CollectionLane[i].Visible = true;
this.CollectionSampleCount[i].Visible = true;
this.CollectionSampleCount[i].Text = "0";
this.CollectionIgnoreCount[i].Visible = true;
this.CollectionIgnoreCount[i].Text = "0";
this.CollectionFeedbackWeight[i].Visible = true;
this.CollectionFeedbackWeight[i].Text = Helper.StringToDecimalPlaces("0", this.ParentForm.ParentForm.SystemConfig.DecimalPlaces);
this.CollectionCurrentWeight[i].Visible = true;
this.CollectionCurrentWeight[i].Text = Helper.StringToDecimalPlaces("0", this.ParentForm.ParentForm.SystemConfig.DecimalPlaces);
}
}
public void UpdateFeedbackDisplay(FeedbackConfiguration feedback, SystemConfigurationItem system, ProductItem product)
{
int passRange = 0, underRange = 0, overRange = 0, deadZone = 0, deadZoneHigh = 0, deadZoneLow = 0, lowLimit = 0, highLimit = 0;
string value = "";
underRange = int.Parse(product.UnderRange);
passRange = int.Parse(product.PassRange);
overRange = int.Parse(product.OverRange);
deadZone = int.Parse(feedback.DeadZone);
deadZoneHigh = passRange + deadZone;
deadZoneLow = passRange - deadZone;
lowLimit = int.Parse(feedback.LowLimit);
highLimit = int.Parse(feedback.HighLimit);
// Board Status
this.labelBoardStatus.Visible = system.IsOptFeedbackBoardUse;
// SampleCount
value = system.FeedbackSampleCount.ToString();
if (this.labelSampleCount.Text != value)
this.labelSampleCount.Text = value;
// IgnorePackages
value = system.FeedbackIgnorePackages.ToString();
if (this.labelIgnorePackages.Text != value)
this.labelIgnorePackages.Text = value;
// CollectionRate
value = system.FeedbackCorrectionRate.ToString();
this.comboBoxCorrectionRate.SelectedIndexChanged -= new EventHandler(this.comboBoxCollectionRate_SelectedIndexChanged);
this.comboBoxCorrectionRate.SelectedItem = Helper.StringToDecimalPlaces(value, this.ParentForm.ParentForm.SystemConfig.DecimalPlaces);
this.comboBoxCorrectionRate.SelectedIndexChanged += new EventHandler(this.comboBoxCollectionRate_SelectedIndexChanged);
// PulseWidth
value = system.FeedbackPulseWidth.ToString();
if (this.labelPulseWidth.Text != value)
this.labelPulseWidth.Text = value;
// DeadZone
value = Helper.StringToDecimalPlaces(feedback.DeadZone, system.DecimalPlaces);
if (this.labelDeadZone.Text != value)
this.labelDeadZone.Text = value;
// HightLimit
value = Helper.StringToDecimalPlaces(feedback.HighLimit, system.DecimalPlaces);
if (this.labelHighLimitRange.Text != value)
{
this.labelHighLimitRange.Text = value;
this.labelHighLimitRange1.Text = value;
}
// LowLimit
value = Helper.StringToDecimalPlaces(feedback.LowLimit, system.DecimalPlaces);
if (this.labelLowLimitRange.Text != value)
{
this.labelLowLimitRange.Text = value;
this.labelLowLimitRange1.Text = value;
}
// DeadZoneLowLimit
value = Helper.StringToDecimalPlaces(deadZoneLow.ToString(), system.DecimalPlaces);
if (this.labelDeadZoneLowLimitRange.Text != value)
this.labelDeadZoneLowLimitRange.Text = value;
// DeadZoneHighLimit
value = Helper.StringToDecimalPlaces(deadZoneHigh.ToString(), system.DecimalPlaces);
if (this.labelDeadZoneHighLimitRange.Text != value)
this.labelDeadZoneHighLimitRange.Text = value;
// OverRange
value = Helper.StringToDecimalPlaces(product.OverRange, system.DecimalPlaces);
if (this.labelOverRange.Text != value)
this.labelOverRange.Text = value;
// PassRange
value = Helper.StringToDecimalPlaces(product.PassRange, system.DecimalPlaces);
if (this.labelPassRange.Text != value)
this.labelPassRange.Text = value;
// UnderRange
value = Helper.StringToDecimalPlaces(product.UnderRange, system.DecimalPlaces);
if (this.labelUnderRange.Text != value)
this.labelUnderRange.Text = value;
// Information Feedback Range
if (highLimit > overRange && lowLimit < underRange)
{
this.pictureBoxFeedback1.Visible = false;
this.pictureBoxFeedback2.Visible = false;
this.pictureBoxFeedback3.Visible = false;
this.pictureBoxFeedback4.Visible = true;
this.labelOverRange.Location = new Point(854, 61);
this.labelHighLimitRange1.Location = new Point(854, 23);
this.labelLowLimitRange1.Location = new Point(854, 330);
this.labelUnderRange.Location = new Point(854, 291);
}
else if (highLimit > overRange)
{
this.pictureBoxFeedback1.Visible = false;
this.pictureBoxFeedback2.Visible = true;
this.pictureBoxFeedback3.Visible = false;
this.pictureBoxFeedback4.Visible = false;
this.labelOverRange.Location = new Point(854, 61);
this.labelHighLimitRange1.Location = new Point(854, 23);
this.labelLowLimitRange1.Location = new Point(854, 291);
this.labelUnderRange.Location = new Point(854, 330);
}
else if (lowLimit < underRange)
{
this.pictureBoxFeedback1.Visible = false;
this.pictureBoxFeedback2.Visible = false;
this.pictureBoxFeedback3.Visible = true;
this.pictureBoxFeedback4.Visible = false;
this.labelOverRange.Location = new Point(854, 23);
this.labelHighLimitRange1.Location = new Point(854, 61);
this.labelLowLimitRange1.Location = new Point(854, 330);
this.labelUnderRange.Location = new Point(854, 291);
}
else
{
this.pictureBoxFeedback1.Visible = true;
this.pictureBoxFeedback2.Visible = false;
this.pictureBoxFeedback3.Visible = false;
this.pictureBoxFeedback4.Visible = false;
this.labelOverRange.Location = new Point(854, 23);
this.labelHighLimitRange1.Location = new Point(854, 61);
this.labelLowLimitRange1.Location = new Point(854, 291);
this.labelUnderRange.Location = new Point(854, 330);
}
}
public void UpdateEquipmentStatusDisplay(DataStore.EquipmentStatus status)
{
this.UpdateFeedbackDataDisplay(status, this.ParentForm.ParentForm.CollectionFeedbackStatus);
if (status == DataStore.EquipmentStatus.Start)
{
}
else
{
}
}
public void UpdateBoardStatusDisplay(bool booting)
{
if (booting == true)
{
if (this.labelBoardStatus.ForeColor != Color.DarkGreen)
this.labelBoardStatus.ForeColor = Color.DarkGreen;
if (this.labelBoardStatus.Text != "Online")
this.labelBoardStatus.Text = "Online";
}
else
{
if (this.labelBoardStatus.ForeColor != Color.Red)
this.labelBoardStatus.ForeColor = Color.Red;
if (this.labelBoardStatus.Text != "Offline")
this.labelBoardStatus.Text = "Offline";
}
}
public void UpdateFeedbackDataDisplay(DataStore.EquipmentStatus status, Collection<FeedBackSystem1> weightDatas)
{
this.UpdateFeedbackDataDisplay1(status, weightDatas[0]);
this.UpdateFeedbackDataDisplay2(status, weightDatas[1]);
this.UpdateFeedbackDataDisplay3(status, weightDatas[2]);
this.UpdateFeedbackDataDisplay4(status, weightDatas[3]);
this.UpdateFeedbackDataDisplay5(status, weightDatas[4]);
this.UpdateFeedbackDataDisplay6(status, weightDatas[5]);
this.UpdateFeedbackDataDisplay7(status, weightDatas[6]);
switch (this.ParentForm.ParentForm.SystemConfig.EquipmentColumns)
{
case 8:
this.UpdateFeedbackDataDisplay8(status, weightDatas[7]);
break;
case 10:
this.UpdateFeedbackDataDisplay8(status, weightDatas[7]);
this.UpdateFeedbackDataDisplay9(status, weightDatas[8]);
this.UpdateFeedbackDataDisplay10(status, weightDatas[9]);
break;
case 12:
this.UpdateFeedbackDataDisplay8(status, weightDatas[7]);
this.UpdateFeedbackDataDisplay9(status, weightDatas[8]);
this.UpdateFeedbackDataDisplay10(status, weightDatas[9]);
this.UpdateFeedbackDataDisplay11(status, weightDatas[10]);
this.UpdateFeedbackDataDisplay12(status, weightDatas[11]);
break;
default:
break;
}
}
public void UpdateFeedbackDataDisplay1(DataStore.EquipmentStatus status, FeedBackSystem1 feedbackData)
{
string value = "";
// Sample Count
value = feedbackData.WeightList.Count.ToString();
if (this.labelSampleCount1.Text != value)
this.labelSampleCount1.Text = value;
// Ignore Count
value = feedbackData.IgnoreCount.ToString();
if (this.labelIgnoreCount1.Text != value)
this.labelIgnoreCount1.Text = value;
// Feedback Weight
if (feedbackData.FeedbackWeight <= 0)
value = Helper.DoubleToString(feedbackData.FeedbackWeight, this.ParentForm.ParentForm.SystemConfig.DecimalPlaces);
else
value = string.Format("+{0}", Helper.DoubleToString(feedbackData.FeedbackWeight, this.ParentForm.ParentForm.SystemConfig.DecimalPlaces));
if (this.labelFeedbackWeight1.Text != value)
this.labelFeedbackWeight1.Text = value;
}
public void UpdateFeedbackDataDisplay2(DataStore.EquipmentStatus status, FeedBackSystem1 feedbackData)
{
string value = "";
// Sample Count
value = feedbackData.WeightList.Count.ToString();
if (this.labelSampleCount2.Text != value)
this.labelSampleCount2.Text = value;
// Ignore Count
value = feedbackData.IgnoreCount.ToString();
if (this.labelIgnoreCount2.Text != value)
this.labelIgnoreCount2.Text = value;
// Feedback Weight
if (feedbackData.FeedbackWeight <= 0)
value = Helper.DoubleToString(feedbackData.FeedbackWeight, this.ParentForm.ParentForm.SystemConfig.DecimalPlaces);
else
value = string.Format("+{0}", Helper.DoubleToString(feedbackData.FeedbackWeight, this.ParentForm.ParentForm.SystemConfig.DecimalPlaces));
if (this.labelFeedbackWeight2.Text != value)
this.labelFeedbackWeight2.Text = value;
}
public void UpdateFeedbackDataDisplay3(DataStore.EquipmentStatus status, FeedBackSystem1 feedbackData)
{
string value = "";
// Sample Count
value = feedbackData.WeightList.Count.ToString();
if (this.labelSampleCount3.Text != value)
this.labelSampleCount3.Text = value;
// Ignore Count
value = feedbackData.IgnoreCount.ToString();
if (this.labelIgnoreCount3.Text != value)
this.labelIgnoreCount3.Text = value;
// Feedback Weight
if (feedbackData.FeedbackWeight <= 0)
value = Helper.DoubleToString(feedbackData.FeedbackWeight, this.ParentForm.ParentForm.SystemConfig.DecimalPlaces);
else
value = string.Format("+{0}", Helper.DoubleToString(feedbackData.FeedbackWeight, this.ParentForm.ParentForm.SystemConfig.DecimalPlaces));
if (this.labelFeedbackWeight3.Text != value)
this.labelFeedbackWeight3.Text = value;
}
public void UpdateFeedbackDataDisplay4(DataStore.EquipmentStatus status, FeedBackSystem1 feedbackData)
{
string value = "";
// Sample Count
value = feedbackData.WeightList.Count.ToString();
if (this.labelSampleCount4.Text != value)
this.labelSampleCount4.Text = value;
// Ignore Count
value = feedbackData.IgnoreCount.ToString();
if (this.labelIgnoreCount4.Text != value)
this.labelIgnoreCount4.Text = value;
// Feedback Weight
if (feedbackData.FeedbackWeight <= 0)
value = Helper.DoubleToString(feedbackData.FeedbackWeight, this.ParentForm.ParentForm.SystemConfig.DecimalPlaces);
else
value = string.Format("+{0}", Helper.DoubleToString(feedbackData.FeedbackWeight, this.ParentForm.ParentForm.SystemConfig.DecimalPlaces));
if (this.labelFeedbackWeight4.Text != value)
this.labelFeedbackWeight4.Text = value;
}
public void UpdateFeedbackDataDisplay5(DataStore.EquipmentStatus status, FeedBackSystem1 feedbackData)
{
string value = "";
// Sample Count
value = feedbackData.WeightList.Count.ToString();
if (this.labelSampleCount5.Text != value)
this.labelSampleCount5.Text = value;
// Ignore Count
value = feedbackData.IgnoreCount.ToString();
if (this.labelIgnoreCount5.Text != value)
this.labelIgnoreCount5.Text = value;
// Feedback Weight
if (feedbackData.FeedbackWeight <= 0)
value = Helper.DoubleToString(feedbackData.FeedbackWeight, this.ParentForm.ParentForm.SystemConfig.DecimalPlaces);
else
value = string.Format("+{0}", Helper.DoubleToString(feedbackData.FeedbackWeight, this.ParentForm.ParentForm.SystemConfig.DecimalPlaces));
if (this.labelFeedbackWeight5.Text != value)
this.labelFeedbackWeight5.Text = value;
}
public void UpdateFeedbackDataDisplay6(DataStore.EquipmentStatus status, FeedBackSystem1 feedbackData)
{
string value = "";
// Sample Count
value = feedbackData.WeightList.Count.ToString();
if (this.labelSampleCount6.Text != value)
this.labelSampleCount6.Text = value;
// Ignore Count
value = feedbackData.IgnoreCount.ToString();
if (this.labelIgnoreCount6.Text != value)
this.labelIgnoreCount6.Text = value;
// Feedback Weight
if (feedbackData.FeedbackWeight <= 0)
value = Helper.DoubleToString(feedbackData.FeedbackWeight, this.ParentForm.ParentForm.SystemConfig.DecimalPlaces);
else
value = string.Format("+{0}", Helper.DoubleToString(feedbackData.FeedbackWeight, this.ParentForm.ParentForm.SystemConfig.DecimalPlaces));
if (this.labelFeedbackWeight6.Text != value)
this.labelFeedbackWeight6.Text = value;
}
public void UpdateFeedbackDataDisplay7(DataStore.EquipmentStatus status, FeedBackSystem1 feedbackData)
{
string value = "";
// Sample Count
value = feedbackData.WeightList.Count.ToString();
if (this.labelSampleCount7.Text != value)
this.labelSampleCount7.Text = value;
// Ignore Count
value = feedbackData.IgnoreCount.ToString();
if (this.labelIgnoreCount7.Text != value)
this.labelIgnoreCount7.Text = value;
// Feedback Weight
if (feedbackData.FeedbackWeight <= 0)
value = Helper.DoubleToString(feedbackData.FeedbackWeight, this.ParentForm.ParentForm.SystemConfig.DecimalPlaces);
else
value = string.Format("+{0}", Helper.DoubleToString(feedbackData.FeedbackWeight, this.ParentForm.ParentForm.SystemConfig.DecimalPlaces));
if (this.labelFeedbackWeight7.Text != value)
this.labelFeedbackWeight7.Text = value;
}
public void UpdateFeedbackDataDisplay8(DataStore.EquipmentStatus status, FeedBackSystem1 feedbackData)
{
string value = "";
// Sample Count
value = feedbackData.WeightList.Count.ToString();
if (this.labelSampleCount8.Text != value)
this.labelSampleCount8.Text = value;
// Ignore Count
value = feedbackData.IgnoreCount.ToString();
if (this.labelIgnoreCount8.Text != value)
this.labelIgnoreCount8.Text = value;
// Feedback Weight
if (feedbackData.FeedbackWeight <= 0)
value = Helper.DoubleToString(feedbackData.FeedbackWeight, this.ParentForm.ParentForm.SystemConfig.DecimalPlaces);
else
value = string.Format("+{0}", Helper.DoubleToString(feedbackData.FeedbackWeight, this.ParentForm.ParentForm.SystemConfig.DecimalPlaces));
if (this.labelFeedbackWeight8.Text != value)
this.labelFeedbackWeight8.Text = value;
}
public void UpdateFeedbackDataDisplay9(DataStore.EquipmentStatus status, FeedBackSystem1 feedbackData)
{
string value = "";
// Sample Count
value = feedbackData.WeightList.Count.ToString();
if (this.labelSampleCount9.Text != value)
this.labelSampleCount9.Text = value;
// Ignore Count
value = feedbackData.IgnoreCount.ToString();
if (this.labelIgnoreCount9.Text != value)
this.labelIgnoreCount9.Text = value;
// Feedback Weight
if (feedbackData.FeedbackWeight <= 0)
value = Helper.DoubleToString(feedbackData.FeedbackWeight, this.ParentForm.ParentForm.SystemConfig.DecimalPlaces);
else
value = string.Format("+{0}", Helper.DoubleToString(feedbackData.FeedbackWeight, this.ParentForm.ParentForm.SystemConfig.DecimalPlaces));
if (this.labelFeedbackWeight9.Text != value)
this.labelFeedbackWeight9.Text = value;
}
public void UpdateFeedbackDataDisplay10(DataStore.EquipmentStatus status, FeedBackSystem1 feedbackData)
{
string value = "";
// Sample Count
value = feedbackData.WeightList.Count.ToString();
if (this.labelSampleCount10.Text != value)
this.labelSampleCount10.Text = value;
// Ignore Count
value = feedbackData.IgnoreCount.ToString();
if (this.labelIgnoreCount10.Text != value)
this.labelIgnoreCount10.Text = value;
// Feedback Weight
if (feedbackData.FeedbackWeight <= 0)
value = Helper.DoubleToString(feedbackData.FeedbackWeight, this.ParentForm.ParentForm.SystemConfig.DecimalPlaces);
else
value = string.Format("+{0}", Helper.DoubleToString(feedbackData.FeedbackWeight, this.ParentForm.ParentForm.SystemConfig.DecimalPlaces));
if (this.labelFeedbackWeight10.Text != value)
this.labelFeedbackWeight10.Text = value;
}
public void UpdateFeedbackDataDisplay11(DataStore.EquipmentStatus status, FeedBackSystem1 feedbackData)
{
string value = "";
// Sample Count
value = feedbackData.WeightList.Count.ToString();
if (this.labelSampleCount11.Text != value)
this.labelSampleCount11.Text = value;
// Ignore Count
value = feedbackData.IgnoreCount.ToString();
if (this.labelIgnoreCount11.Text != value)
this.labelIgnoreCount11.Text = value;
// Feedback Weight
if (feedbackData.FeedbackWeight <= 0)
value = Helper.DoubleToString(feedbackData.FeedbackWeight, this.ParentForm.ParentForm.SystemConfig.DecimalPlaces);
else
value = string.Format("+{0}", Helper.DoubleToString(feedbackData.FeedbackWeight, this.ParentForm.ParentForm.SystemConfig.DecimalPlaces));
if (this.labelFeedbackWeight11.Text != value)
this.labelFeedbackWeight11.Text = value;
}
public void UpdateFeedbackDataDisplay12(DataStore.EquipmentStatus status, FeedBackSystem1 feedbackData)
{
string value = "";
// Sample Count
value = feedbackData.WeightList.Count.ToString();
if (this.labelSampleCount12.Text != value)
this.labelSampleCount12.Text = value;
// Ignore Count
value = feedbackData.IgnoreCount.ToString();
if (this.labelIgnoreCount12.Text != value)
this.labelIgnoreCount12.Text = value;
// Feedback Weight
if (feedbackData.FeedbackWeight <= 0)
value = Helper.DoubleToString(feedbackData.FeedbackWeight, this.ParentForm.ParentForm.SystemConfig.DecimalPlaces);
else
value = string.Format("+{0}", Helper.DoubleToString(feedbackData.FeedbackWeight, this.ParentForm.ParentForm.SystemConfig.DecimalPlaces));
if (this.labelFeedbackWeight12.Text != value)
this.labelFeedbackWeight12.Text = value;
}
public void UpdateStopWeightDisplay(DataStore.EquipmentStatus status, Collection<WeightData> weightDatas)
{
string value = "";
if (this.ParentForm.ParentForm.SystemConfig.EquipmentColumns > weightDatas.Count)
return;
if (status == DataStore.EquipmentStatus.Stop)
{
for (int i = 0; i < this.ParentForm.ParentForm.SystemConfig.EquipmentColumns; i++)
{
// 중량
value = Helper.DoubleToString(weightDatas[i].Weight, this.ParentForm.ParentForm.SystemConfig.DecimalPlaces);
if (this.CollectionCurrentWeight[i].Text != value)
this.CollectionCurrentWeight[i].Text = value;
}
}
}
public void UpdateStartWeightDisplay(DataStore.EquipmentStatus status, Collection<WeightData> weightDatas)
{
this.UpdateStartWeightDisplay1(status, weightDatas[0]);
this.UpdateStartWeightDisplay2(status, weightDatas[1]);
this.UpdateStartWeightDisplay3(status, weightDatas[2]);
this.UpdateStartWeightDisplay4(status, weightDatas[3]);
this.UpdateStartWeightDisplay5(status, weightDatas[4]);
this.UpdateStartWeightDisplay6(status, weightDatas[5]);
this.UpdateStartWeightDisplay7(status, weightDatas[6]);
this.UpdateStartWeightDisplay8(status, weightDatas[7]);
switch (this.ParentForm.ParentForm.SystemConfig.EquipmentColumns)
{
case 8:
this.UpdateStartWeightDisplay9(status, weightDatas[8]);
break;
case 10:
this.UpdateStartWeightDisplay9(status, weightDatas[8]);
this.UpdateStartWeightDisplay10(status, weightDatas[9]);
break;
case 12:
this.UpdateStartWeightDisplay9(status, weightDatas[8]);
this.UpdateStartWeightDisplay10(status, weightDatas[9]);
this.UpdateStartWeightDisplay11(status, weightDatas[10]);
this.UpdateStartWeightDisplay12(status, weightDatas[11]);
break;
default:
break;
}
}
public void UpdateStartWeightDisplay1(DataStore.EquipmentStatus status, WeightData weightData)
{
string value = "";
if (weightData.JudgmentStatus == DataStore.JudgmentStatus.Empty)
return;
value = Helper.DoubleToString(weightData.Weight, this.ParentForm.ParentForm.SystemConfig.DecimalPlaces);
if (this.labelCurrentWeight1.Text != value)
this.labelCurrentWeight1.Text = value;
}
public void UpdateStartWeightDisplay2(DataStore.EquipmentStatus status, WeightData weightData)
{
string value = "";
if (weightData.JudgmentStatus == DataStore.JudgmentStatus.Empty)
return;
value = Helper.DoubleToString(weightData.Weight, this.ParentForm.ParentForm.SystemConfig.DecimalPlaces);
if (this.labelCurrentWeight2.Text != value)
this.labelCurrentWeight2.Text = value;
}
public void UpdateStartWeightDisplay3(DataStore.EquipmentStatus status, WeightData weightData)
{
string value = "";
if (weightData.JudgmentStatus == DataStore.JudgmentStatus.Empty)
return;
value = Helper.DoubleToString(weightData.Weight, this.ParentForm.ParentForm.SystemConfig.DecimalPlaces);
if (this.labelCurrentWeight3.Text != value)
this.labelCurrentWeight3.Text = value;
}
public void UpdateStartWeightDisplay4(DataStore.EquipmentStatus status, WeightData weightData)
{
string value = "";
if (weightData.JudgmentStatus == DataStore.JudgmentStatus.Empty)
return;
value = Helper.DoubleToString(weightData.Weight, this.ParentForm.ParentForm.SystemConfig.DecimalPlaces);
if (this.labelCurrentWeight4.Text != value)
this.labelCurrentWeight4.Text = value;
}
public void UpdateStartWeightDisplay5(DataStore.EquipmentStatus status, WeightData weightData)
{
string value = "";
if (weightData.JudgmentStatus == DataStore.JudgmentStatus.Empty)
return;
value = Helper.DoubleToString(weightData.Weight, this.ParentForm.ParentForm.SystemConfig.DecimalPlaces);
if (this.labelCurrentWeight5.Text != value)
this.labelCurrentWeight5.Text = value;
}
public void UpdateStartWeightDisplay6(DataStore.EquipmentStatus status, WeightData weightData)
{
string value = "";
if (weightData.JudgmentStatus == DataStore.JudgmentStatus.Empty)
return;
value = Helper.DoubleToString(weightData.Weight, this.ParentForm.ParentForm.SystemConfig.DecimalPlaces);
if (this.labelCurrentWeight6.Text != value)
this.labelCurrentWeight6.Text = value;
}
public void UpdateStartWeightDisplay7(DataStore.EquipmentStatus status, WeightData weightData)
{
string value = "";
if (weightData.JudgmentStatus == DataStore.JudgmentStatus.Empty)
return;
value = Helper.DoubleToString(weightData.Weight, this.ParentForm.ParentForm.SystemConfig.DecimalPlaces);
if (this.labelCurrentWeight7.Text != value)
this.labelCurrentWeight7.Text = value;
}
public void UpdateStartWeightDisplay8(DataStore.EquipmentStatus status, WeightData weightData)
{
string value = "";
if (weightData.JudgmentStatus == DataStore.JudgmentStatus.Empty)
return;
value = Helper.DoubleToString(weightData.Weight, this.ParentForm.ParentForm.SystemConfig.DecimalPlaces);
if (this.labelCurrentWeight8.Text != value)
this.labelCurrentWeight8.Text = value;
}
public void UpdateStartWeightDisplay9(DataStore.EquipmentStatus status, WeightData weightData)
{
string value = "";
if (weightData.JudgmentStatus == DataStore.JudgmentStatus.Empty)
return;
value = Helper.DoubleToString(weightData.Weight, this.ParentForm.ParentForm.SystemConfig.DecimalPlaces);
if (this.labelCurrentWeight9.Text != value)
this.labelCurrentWeight9.Text = value;
}
public void UpdateStartWeightDisplay10(DataStore.EquipmentStatus status, WeightData weightData)
{
string value = "";
if (weightData.JudgmentStatus == DataStore.JudgmentStatus.Empty)
return;
value = Helper.DoubleToString(weightData.Weight, this.ParentForm.ParentForm.SystemConfig.DecimalPlaces);
if (this.labelCurrentWeight10.Text != value)
this.labelCurrentWeight10.Text = value;
}
public void UpdateStartWeightDisplay11(DataStore.EquipmentStatus status, WeightData weightData)
{
string value = "";
if (weightData.JudgmentStatus == DataStore.JudgmentStatus.Empty)
return;
value = Helper.DoubleToString(weightData.Weight, this.ParentForm.ParentForm.SystemConfig.DecimalPlaces);
if (this.labelCurrentWeight11.Text != value)
this.labelCurrentWeight11.Text = value;
}
public void UpdateStartWeightDisplay12(DataStore.EquipmentStatus status, WeightData weightData)
{
string value = "";
if (weightData.JudgmentStatus == DataStore.JudgmentStatus.Empty)
return;
value = Helper.DoubleToString(weightData.Weight, this.ParentForm.ParentForm.SystemConfig.DecimalPlaces);
if (this.labelCurrentWeight12.Text != value)
this.labelCurrentWeight12.Text = value;
}
public void Clear()
{
for (int i = 0; i < this.ParentForm.ParentForm.SystemConfig.EquipmentColumns; i++)
{
this.ParentForm.ParentForm.CollectionFeedbackStatus[i].ClearDataAll();
}
this.UpdateFeedbackDataDisplay(this.ParentForm.ParentForm.EquipmentStatus, this.ParentForm.ParentForm.CollectionFeedbackStatus);
}
public void DisplayRefresh()
{
this.UpdateFeedbackDisplay(this.ParentForm.ParentForm.CurrentFeedbackItem, this.ParentForm.ParentForm.SystemConfig, this.ParentForm.ParentForm.CurrentProductItem);
}
#endregion
#region Event Handler
private void labelSampleCount_Click(object sender, EventArgs e)
{
DialogFormNumKeyPad myKeyPad = new DialogFormNumKeyPad(this.labelSampleCount.Text, 4, 0, false, this.ParentForm.ParentForm.SystemConfig.Language);
if (myKeyPad.ShowDialog() == DialogResult.OK)
{
if (myKeyPad.doubleValue < 1 || myKeyPad.doubleValue > 9999)
{
// 입력범위를 확인하세요
DialogFormMessage myMsg = new DialogFormMessage(1, this.ParentForm.ParentForm.SystemConfig.Language);
myMsg.ShowDialog();
}
else
{
this.labelSampleCount.Text = myKeyPad.StringValue;
this.ParentForm.ParentForm.SystemConfig.FeedbackSampleCount = myKeyPad.IntValue;
this.ParentForm.ParentForm.SaveSystemConfigurationFile(this.ParentForm.ParentForm.SystemConfig);
this.ParentForm.ParentForm.Update30000ModbusData();
this.ParentForm.ParentForm.ModbusCommonDataSend();
for (int i = 0; i < this.ParentForm.ParentForm.SystemConfig.EquipmentColumns; i++)
this.ParentForm.ParentForm.CollectionFeedbackStatus[i].ClearData();
}
}
}
private void labelIgnorePackages_Click(object sender, EventArgs e)
{
DialogFormNumKeyPad myKeyPad = new DialogFormNumKeyPad(this.labelIgnorePackages.Text, 4, 0, false, this.ParentForm.ParentForm.SystemConfig.Language);
if (myKeyPad.ShowDialog() == DialogResult.OK)
{
if (myKeyPad.doubleValue < 1 || myKeyPad.doubleValue > 9999)
{
// 입력범위를 확인하세요
DialogFormMessage myMsg = new DialogFormMessage(1, this.ParentForm.ParentForm.SystemConfig.Language);
myMsg.ShowDialog();
}
else
{
this.labelIgnorePackages.Text = myKeyPad.StringValue;
this.ParentForm.ParentForm.SystemConfig.FeedbackIgnorePackages = myKeyPad.IntValue;
this.ParentForm.ParentForm.SaveSystemConfigurationFile(this.ParentForm.ParentForm.SystemConfig);
this.ParentForm.ParentForm.Update30000ModbusData();
this.ParentForm.ParentForm.ModbusCommonDataSend();
}
}
}
private void labelPulseWidth_Click(object sender, EventArgs e)
{
int iValue = 0;
string value = "";
DialogFormNumKeyPad myKeyPad = new DialogFormNumKeyPad(this.labelPulseWidth.Text, 4, 0, false, this.ParentForm.ParentForm.SystemConfig.Language);
if (myKeyPad.ShowDialog() == DialogResult.OK)
{
iValue = myKeyPad.IntValue % 2;
if (myKeyPad.doubleValue < 2 || myKeyPad.doubleValue > 1000 || iValue == 1)
{
// 입력범위를 확인하세요
DialogFormMessage myMsg = new DialogFormMessage(1, this.ParentForm.ParentForm.SystemConfig.Language);
myMsg.ShowDialog();
}
else
{
this.labelPulseWidth.Text = myKeyPad.StringValue;
this.ParentForm.ParentForm.SystemConfig.FeedbackPulseWidth = myKeyPad.IntValue;
this.ParentForm.ParentForm.SaveSystemConfigurationFile(this.ParentForm.ParentForm.SystemConfig);
this.ParentForm.ParentForm.CurrentFeedbackItem.DataTransfer = DataStore.FeedbackBoardDataTransfer.Step1_6203;
value = Helper.StringZeroFillDigits4(this.labelPulseWidth.Text);
this.ParentForm.ParentForm.UartCom3FeedbackBoardTransfer(CommunicationAddress._6203_FeedbackPulseWidth, value);
}
}
}
private void labelDeadZone_Click(object sender, EventArgs e)
{
int passRange = 0, deadZone = 0, deadZoneHigh = 0, deadZoneLow = 0;
DialogFormNumKeyPad myKeyPad = new DialogFormNumKeyPad(this.labelDeadZone.Text, 5, this.ParentForm.ParentForm.SystemConfig.DecimalPlaces, false, this.ParentForm.ParentForm.SystemConfig.Language);
if (myKeyPad.ShowDialog() == DialogResult.OK)
{
passRange = int.Parse(this.ParentForm.ParentForm.CurrentProductItem.PassRange);
deadZone = int.Parse(myKeyPad.StringValue.Replace(".", ""));
deadZoneHigh = passRange + deadZone;
deadZoneLow = passRange - deadZone;
if (deadZoneLow < int.Parse(this.ParentForm.ParentForm.CurrentFeedbackItem.LowLimit) ||
deadZoneLow < int.Parse(this.ParentForm.ParentForm.CurrentProductItem.UnderRange) ||
deadZoneHigh > int.Parse(this.ParentForm.ParentForm.CurrentFeedbackItem.HighLimit) ||
deadZoneHigh > int.Parse(this.ParentForm.ParentForm.CurrentProductItem.OverRange))
{
// 입력범위를 확인하세요
DialogFormMessage myMsg = new DialogFormMessage(1, this.ParentForm.ParentForm.SystemConfig.Language);
myMsg.ShowDialog();
}
else
{
this.labelDeadZone.Text = myKeyPad.StringValue;
this.labelDeadZoneHighLimitRange.Text = Helper.StringToDecimalPlaces(deadZoneHigh.ToString(), this.ParentForm.ParentForm.SystemConfig.DecimalPlaces);
this.labelDeadZoneLowLimitRange.Text = Helper.StringToDecimalPlaces(deadZoneLow.ToString(), this.ParentForm.ParentForm.SystemConfig.DecimalPlaces);
this.ParentForm.ParentForm.CurrentFeedbackItem.DeadZone = myKeyPad.StringValue.Replace(".", "");
this.ParentForm.ParentForm.SaveFeedbackItemFile(this.ParentForm.ParentForm.CurrentFeedbackItem, this.ParentForm.ParentForm.SystemConfig.ProductNumber - 1);
this.ParentForm.ParentForm.Update30000ModbusData();
this.ParentForm.ParentForm.ModbusCommonDataSend();
}
}
}
private void labelHighLimitRange_Click(object sender, EventArgs e)
{
bool saveEnable = false;
int passRange = 0, deadZone = 0, deadZoneHigh = 0;
string data = "";
DialogFormNumKeyPad myKeyPad = new DialogFormNumKeyPad(this.labelHighLimitRange.Text, 5, this.ParentForm.ParentForm.SystemConfig.DecimalPlaces, false, this.ParentForm.ParentForm.SystemConfig.Language);
passRange = int.Parse(this.ParentForm.ParentForm.CurrentProductItem.PassRange);
deadZone = int.Parse(this.ParentForm.ParentForm.CurrentFeedbackItem.DeadZone);
deadZoneHigh = passRange + deadZone;
if (myKeyPad.ShowDialog() == DialogResult.OK)
{
if (myKeyPad.doubleValue < Helper.StringToWeight(deadZoneHigh.ToString(), this.ParentForm.ParentForm.SystemConfig.DecimalPlaces))
{
// 입력범위를 확인하세요
data = string.Format("{0} ~ {1}", Helper.StringToDecimalPlaces(deadZoneHigh.ToString(), this.ParentForm.ParentForm.SystemConfig.DecimalPlaces),
Helper.StringToDecimalPlaces("99999", this.ParentForm.ParentForm.SystemConfig.DecimalPlaces));
DialogFormMessage myMsg = new DialogFormMessage(1, this.ParentForm.ParentForm.SystemConfig.Language, data);
myMsg.ShowDialog();
}
else
{
if (myKeyPad.doubleValue > Helper.StringToWeight(this.ParentForm.ParentForm.CurrentProductItem.OverRange, this.ParentForm.ParentForm.SystemConfig.DecimalPlaces))
{
DialogFormYesNo myMsgYesNo = new DialogFormYesNo(this.ParentForm.ParentForm.SystemConfig.Language, 6);
if (myMsgYesNo.ShowDialog() == DialogResult.Yes)
saveEnable = true;
}
else
saveEnable = true;
if (saveEnable == true)
{
this.labelHighLimitRange.Text = myKeyPad.StringValue;
this.labelHighLimitRange1.Text = myKeyPad.StringValue;
this.ParentForm.ParentForm.CurrentFeedbackItem.HighLimit = myKeyPad.StringValue.Replace(".", "");
this.ParentForm.ParentForm.SaveFeedbackItemFile(this.ParentForm.ParentForm.CurrentFeedbackItem, this.ParentForm.ParentForm.SystemConfig.ProductNumber - 1);
this.ParentForm.ParentForm.Update30000ModbusData();
this.ParentForm.ParentForm.ModbusCommonDataSend();
this.UpdateFeedbackDisplay(this.ParentForm.ParentForm.CurrentFeedbackItem, this.ParentForm.ParentForm.SystemConfig, this.ParentForm.ParentForm.CurrentProductItem);
}
}
}
}
private void labelLowLimitRange_Click(object sender, EventArgs e)
{
bool saveEnable = false;
int passRange = 0, deadZone = 0, deadZoneLow = 0;
string data = "";
DialogFormNumKeyPad myKeyPad = new DialogFormNumKeyPad(this.labelLowLimitRange.Text, 5, this.ParentForm.ParentForm.SystemConfig.DecimalPlaces, false, this.ParentForm.ParentForm.SystemConfig.Language);
passRange = int.Parse(this.ParentForm.ParentForm.CurrentProductItem.PassRange);
deadZone = int.Parse(this.ParentForm.ParentForm.CurrentFeedbackItem.DeadZone);
deadZoneLow = passRange - deadZone;
if (myKeyPad.ShowDialog() == DialogResult.OK)
{
if (myKeyPad.doubleValue > Helper.StringToWeight(deadZoneLow.ToString(), this.ParentForm.ParentForm.SystemConfig.DecimalPlaces))
{
// 입력범위를 확인하세요
data = string.Format("{0} ~ {1}", Helper.StringToDecimalPlaces("0", this.ParentForm.ParentForm.SystemConfig.DecimalPlaces),
Helper.StringToDecimalPlaces(deadZoneLow.ToString(), this.ParentForm.ParentForm.SystemConfig.DecimalPlaces));
DialogFormMessage myMsg = new DialogFormMessage(1, this.ParentForm.ParentForm.SystemConfig.Language, data);
myMsg.ShowDialog();
}
else
{
if (myKeyPad.doubleValue < Helper.StringToWeight(this.ParentForm.ParentForm.CurrentProductItem.UnderRange, this.ParentForm.ParentForm.SystemConfig.DecimalPlaces))
{
DialogFormYesNo myMsgYesNo = new DialogFormYesNo(this.ParentForm.ParentForm.SystemConfig.Language, 7);
if (myMsgYesNo.ShowDialog() == DialogResult.Yes)
saveEnable = true;
}
else
saveEnable = true;
if (saveEnable == true)
{
this.labelLowLimitRange.Text = myKeyPad.StringValue;
this.labelLowLimitRange1.Text = myKeyPad.StringValue;
this.ParentForm.ParentForm.CurrentFeedbackItem.LowLimit = myKeyPad.StringValue.Replace(".", "");
this.ParentForm.ParentForm.SaveFeedbackItemFile(this.ParentForm.ParentForm.CurrentFeedbackItem, this.ParentForm.ParentForm.SystemConfig.ProductNumber - 1);
this.ParentForm.ParentForm.Update30000ModbusData();
this.ParentForm.ParentForm.ModbusCommonDataSend();
this.UpdateFeedbackDisplay(this.ParentForm.ParentForm.CurrentFeedbackItem, this.ParentForm.ParentForm.SystemConfig, this.ParentForm.ParentForm.CurrentProductItem);
}
}
}
}
private void comboBoxCollectionRate_SelectedIndexChanged(object sender, EventArgs e)
{
int value = 0;
string sValue = "";
ComboBox cb = sender as ComboBox;
if (cb.SelectedIndex == 0)
{
value = 1;
}
else if (cb.SelectedIndex == 1)
{
value = 2;
}
else if (cb.SelectedIndex == 2)
{
value = 5;
}
else if (cb.SelectedIndex == 3)
{
value = 10;
}
this.ParentForm.ParentForm.SystemConfig.FeedbackCorrectionRate = value;
this.ParentForm.ParentForm.SaveSystemConfigurationFile(this.ParentForm.ParentForm.SystemConfig);
this.ParentForm.ParentForm.CurrentFeedbackItem.DataTransfer = DataStore.FeedbackBoardDataTransfer.Step2_6208;
sValue = Helper.StringZeroFillDigits4(value.ToString());
this.ParentForm.ParentForm.UartCom3FeedbackBoardTransfer(CommunicationAddress._6208_FeedbackCollectionRate, sValue);
}
#endregion
}
}