ITC81DB_V8/ITC81DB/Controls/CenterSystem/ControlCenterSystemJudgment...

1044 lines
50 KiB
C#
Raw Normal View History

2023-07-11 01:56:01 +00:00
using System;
using System.Linq;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Text;
using System.Windows.Forms;
using ITC81DB.DialogForms;
using ITC81DB.Forms;
using SmartX;
using System.Collections.ObjectModel;
using ITC81DB_ImageDll;
namespace ITC81DB.Controls
{
public partial class ControlCenterSystemJudgmentManual : UserControl
{
#region Field
private FormMenu m_ParentForm;
private int MovePoint;
private string RefrenceADC;
private JudgmentSetItem CaptureJudgmentSetItem;
private Collection<int> CollectionGraphDataTemp;
#endregion
#region Constructor
public ControlCenterSystemJudgmentManual(FormMenu parent)
{
InitializeComponent();
this.ParentForm = parent;
this.InitializeDesign();
this.DefaultSetting();
this.CollectionGraphDataTemp = new Collection<int>();
this.CollectionGraphDataTemp.Clear();
for (int i = 0; i < 300; i++)
this.CollectionGraphDataTemp.Add(0);
}
#endregion
#region Property
public FormMenu ParentForm
{
get { return this.m_ParentForm; }
private set { this.m_ParentForm = value; }
}
#endregion
#region Method
public void InitializeDesign()
{
Class1 images = new Class1();
if (this.ParentForm.ParentForm.SystemConfig1.Language == DataStore.LanguageID.English)
{
this.buttonWeightReference.DisableImage = new Bitmap(images.GetImage(Class1.ButtonImages.engJudgmentStandardDisable));
this.buttonWeightReference.DownImage = new Bitmap(images.GetImage(Class1.ButtonImages.engJudgmentStandardDown));
this.buttonWeightReference.UpImage = new Bitmap(images.GetImage(Class1.ButtonImages.engJudgmentStandardUp));
this.labelWarningRandomMode.Text = "※ When setting No. 996 ~ 1000, the same value of 5 part number judgment setting items is applied";
}
else if (this.ParentForm.ParentForm.SystemConfig1.Language == DataStore.LanguageID.Chinese)
{
this.buttonWeightReference.DisableImage = new Bitmap(images.GetImage(Class1.ButtonImages.chnFormJudgmentStandardDisable));
this.buttonWeightReference.DownImage = new Bitmap(images.GetImage(Class1.ButtonImages.chnFormJudgmentStandardDown));
this.buttonWeightReference.UpImage = new Bitmap(images.GetImage(Class1.ButtonImages.chnFormJudgmentStandardUp));
this.labelWarningRandomMode.Text = "※ 设定 No. 996 ~ 1000 时,适用 5 个零件编号判断设定项目的相同值";
}
else if (this.ParentForm.ParentForm.SystemConfig1.Language == DataStore.LanguageID.Czech)
{
}
else if (this.ParentForm.ParentForm.SystemConfig1.Language == DataStore.LanguageID.Russian)
{
this.buttonWeightReference.DisableImage = new Bitmap(images.GetImage(Class1.ButtonImages.rusJudgmentStandardDisable));
this.buttonWeightReference.DownImage = new Bitmap(images.GetImage(Class1.ButtonImages.rusJudgmentStandardDown));
this.buttonWeightReference.UpImage = new Bitmap(images.GetImage(Class1.ButtonImages.rusJudgmentStandardUp));
this.labelWarningRandomMode.Text = "※ При настройке № 996 ~ 1000 применяется то же значение, что и для 5 элементов настройки оценки номера детали.";
}
else if (this.ParentForm.ParentForm.SystemConfig1.Language == DataStore.LanguageID.German)
{
this.buttonWeightReference.DisableImage = new Bitmap(images.GetImage(Class1.ButtonImages.gerJudgmentStandardDisable));
this.buttonWeightReference.DownImage = new Bitmap(images.GetImage(Class1.ButtonImages.gerJudgmentStandardDown));
this.buttonWeightReference.UpImage = new Bitmap(images.GetImage(Class1.ButtonImages.gerJudgmentStandardUp));
this.labelWarningRandomMode.Text = "※ Bei der Einstellung von Nr. 996 ~ 1000 wird derselbe Wert von 5 Einstellelementen zur Beurteilung der Teilenummer angewendet";
}
else if (this.ParentForm.ParentForm.SystemConfig1.Language == DataStore.LanguageID.Spanish)
{
this.buttonWeightReference.DisableImage = new Bitmap(images.GetImage(Class1.ButtonImages.engJudgmentStandardDisable));
this.buttonWeightReference.DownImage = new Bitmap(images.GetImage(Class1.ButtonImages.engJudgmentStandardDown));
this.buttonWeightReference.UpImage = new Bitmap(images.GetImage(Class1.ButtonImages.engJudgmentStandardUp));
this.labelWarningRandomMode.Text = "※ Cuando se configura el No. 996 ~ 1000, se aplica el mismo valor de los 5 elementos de configuración de evaluación del número de pieza.";
}
else
{
this.buttonWeightReference.DisableImage = new Bitmap(images.GetImage(Class1.ButtonImages.korJudgmentStandardDisable));
this.buttonWeightReference.DownImage = new Bitmap(images.GetImage(Class1.ButtonImages.korJudgmentStandardDown));
this.buttonWeightReference.UpImage = new Bitmap(images.GetImage(Class1.ButtonImages.korJudgmentStandardUp));
this.labelWarningRandomMode.Text = "※ 996 ~ 1000번 설정 시, 5개 품번 판정설정 항목 동일값 적용됨";
}
this.ChangeScreen();
}
private void DefaultSetting()
{
this.RefrenceADC = "0";
this.CaptureJudgmentSetItem = new JudgmentSetItem();
this.ControlInitializeAsEquipmentType();
this.ControlInitialize();
}
private void ControlInitializeAsEquipmentType()
{
}
private void ControlInitialize()
{
this.labelProductNo.Text = this.ParentForm.ParentForm.SystemConfig1.ProductNumber.ToString();
if (this.ParentForm.ParentForm.SystemConfig1.ProductNumber >= 996)
this.labelWarningRandomMode.Visible = true;
else
this.labelWarningRandomMode.Visible = false;
this.buttonCopy.Text = "00";
this.labelSensingTime.Text = "";
this.buttonWeightReference.Text = Helper.StringToDecimalPlaces("0", this.ParentForm.ParentForm.SystemConfig1.DecimalPlaces);
this.labelWeightJudgment.Text = Helper.StringToDecimalPlaces("0", this.ParentForm.ParentForm.SystemConfig1.DecimalPlaces);
this.labelDoubleDelayTime.Text = " -";
this.labelJudgmentDelayTime.Text = " -";
this.labelFilter.Text = " -";
this.smartDraw.PutDataAllClear();
}
public void ChangeScreen()
{
Class1 images = new Class1();
this.buttonUp.Visible = false;
this.buttonDown.Visible = false;
// 0 : 컨베어, 4 : 업다운, 6 : 정지계량
if (this.ParentForm.ParentForm.SystemConfig1.Language == DataStore.LanguageID.English)
{
switch (int.Parse(this.ParentForm.ParentForm.CurrentSystemParameter1.EquipmentType))
{
case 0:
this.smartGroupBox1.Image = new Bitmap(images.GetImage(Class1.ButtonImages.engBackgroundJudgment));
break;
case 4:
break;
case 6:
this.smartGroupBox1.Image = new Bitmap(images.GetImage(Class1.ButtonImages.engBackgroundJudgment_StopWeighing));
break;
default:
this.smartGroupBox1.Image = new Bitmap(images.GetImage(Class1.ButtonImages.engBackgroundJudgment));
break;
}
}
else if (this.ParentForm.ParentForm.SystemConfig1.Language == DataStore.LanguageID.Chinese)
{
switch (int.Parse(this.ParentForm.ParentForm.CurrentSystemParameter1.EquipmentType))
{
case 0:
this.smartGroupBox1.Image = new Bitmap(images.GetImage(Class1.ButtonImages.chnBackgroundJudgment));
break;
case 4:
break;
case 6:
this.smartGroupBox1.Image = new Bitmap(images.GetImage(Class1.ButtonImages.chnBackgroundJudgment_StopWeighing));
break;
default:
this.smartGroupBox1.Image = new Bitmap(images.GetImage(Class1.ButtonImages.chnBackgroundJudgment));
break;
}
}
else if (this.ParentForm.ParentForm.SystemConfig1.Language == DataStore.LanguageID.Czech)
{
}
else if (this.ParentForm.ParentForm.SystemConfig1.Language == DataStore.LanguageID.Russian)
{
switch (int.Parse(this.ParentForm.ParentForm.CurrentSystemParameter1.EquipmentType))
{
case 0:
this.smartGroupBox1.Image = new Bitmap(images.GetImage(Class1.ButtonImages.rusBackgroundJudgment));
break;
case 4:
break;
case 6:
this.smartGroupBox1.Image = new Bitmap(images.GetImage(Class1.ButtonImages.rusBackgroundJudgment_StopWeighing));
break;
default:
this.smartGroupBox1.Image = new Bitmap(images.GetImage(Class1.ButtonImages.rusBackgroundJudgment));
break;
}
}
else if (this.ParentForm.ParentForm.SystemConfig1.Language == DataStore.LanguageID.German)
{
switch (int.Parse(this.ParentForm.ParentForm.CurrentSystemParameter1.EquipmentType))
{
case 0:
this.smartGroupBox1.Image = new Bitmap(images.GetImage(Class1.ButtonImages.gerBackgroundJudgment));
break;
case 4:
break;
case 6:
this.smartGroupBox1.Image = new Bitmap(images.GetImage(Class1.ButtonImages.gerBackgroundJudgment_StopWeighing));
break;
default:
this.smartGroupBox1.Image = new Bitmap(images.GetImage(Class1.ButtonImages.gerBackgroundJudgment));
break;
}
}
else if (this.ParentForm.ParentForm.SystemConfig1.Language == DataStore.LanguageID.Spanish)
{
switch (int.Parse(this.ParentForm.ParentForm.CurrentSystemParameter1.EquipmentType))
{
case 0:
this.smartGroupBox1.Image = new Bitmap(images.GetImage(Class1.ButtonImages.engBackgroundJudgment));
break;
case 4:
break;
case 6:
this.smartGroupBox1.Image = new Bitmap(images.GetImage(Class1.ButtonImages.engBackgroundJudgment_StopWeighing));
break;
default:
this.smartGroupBox1.Image = new Bitmap(images.GetImage(Class1.ButtonImages.engBackgroundJudgment));
break;
}
}
else
{
switch (int.Parse(this.ParentForm.ParentForm.CurrentSystemParameter1.EquipmentType))
{
case 0:
this.smartGroupBox1.Image = new Bitmap(images.GetImage(Class1.ButtonImages.korBackgroundJudgment));
break;
case 4:
break;
case 6:
this.smartGroupBox1.Image = new Bitmap(images.GetImage(Class1.ButtonImages.korBackgroundJudgment_StopWeighing));
break;
default:
this.smartGroupBox1.Image = new Bitmap(images.GetImage(Class1.ButtonImages.korBackgroundJudgment));
break;
}
}
}
private void IsAutoMode(bool value)
{
if (value == true)
{
this.labelJudgmentDelayTime.ForeColor = Color.Gray;
this.labelDoubleDelayTime.ForeColor = Color.Gray;
this.labelFeedSpeed.ForeColor = Color.Gray;
this.labelJudgmentDelayTime.Enabled = false;
this.labelDoubleDelayTime.Enabled = false;
this.labelFeedSpeed.Enabled = false;
}
else
{
this.labelJudgmentDelayTime.ForeColor = Color.White;
this.labelDoubleDelayTime.ForeColor = Color.White;
this.labelFeedSpeed.ForeColor = Color.White;
this.labelJudgmentDelayTime.Enabled = true;
this.labelDoubleDelayTime.Enabled = true;
this.labelFeedSpeed.Enabled = true;
}
}
public void DrawInitialize()
{
SmartX.SmartDraw.CHARTREFRESH charRefreshType = SmartX.SmartDraw.CHARTREFRESH.LEFTSCROLL;
SmartX.SmartDraw.CHARTPENSTYLE[] charPenStyle;
charPenStyle = new SmartX.SmartDraw.CHARTPENSTYLE[1];
charPenStyle[0].m_chColor = Color.Yellow;
charPenStyle[0].m_iPenWidth = 2;
this.smartDraw.SetChartCfg(25, 250, 300, 240, 1, charRefreshType, 1);
this.smartDraw.ChartChannelPenStyle = charPenStyle;
this.smartDraw.ChartDrawStep = 1;
}
public void GraphBackRedraw()
{
int xPoint, temp;
this.smartDraw.PutDataAllClear();
this.DrawInitialize();
this.smartDraw.BackDraw.BackErase(Color.Black);
// 가로선
//this.smartDraw.BackDraw.SetPenStyle(Color.Gray, 1);
//this.smartDraw.BackDraw.Line(25, 110, 325, 110);
//this.smartDraw.BackDraw.Line(25, 150, 325, 150);
// 가로 중심선
this.smartDraw.BackDraw.SetPenStyle(Color.Blue, 1);
this.smartDraw.BackDraw.Line(25, 130, 325, 130);
// 세로선
this.smartDraw.BackDraw.SetPenStyle(Color.Blue, 3);
this.smartDraw.BackDraw.Line(25, 10, 25, 250);
this.smartDraw.BackDraw.Line(325, 10, 325, 250);
// 세로 중심선
this.smartDraw.BackDraw.SetPenStyle(Color.Red, 1);
this.smartDraw.BackDraw.Line(175, 50, 175, 210);
// 판정개수 표시선
temp = int.Parse(this.labelJudgmentCount.Text);
xPoint = 175 - temp;
this.smartDraw.BackDraw.SetPenStyle(Color.Red, 1);
this.smartDraw.BackDraw.Line(xPoint, 50, xPoint, 210);
}
public void DisplaySpeedmmin(string value)
{
this.labelFeedSpeedUnitmmin.Text = value;
}
public void CaculateJudgmentData(int time1)
{
if (this.buttonUsingAutoMode.ButtonStatus == SmartButton.BUTSTATUS.DOWN)
{
double time2; // 시간2 : (컨베이어 길이 - 제품길이) / 속도
double speed; // 이송속도 : 제품길이 / 시간1
// 이중지연 = 시간1 = 센서 검출 시간
this.ParentForm.ParentForm.CurrentJudgmentSetItem.DoubleDelayTime = time1;
this.labelDoubleDelayTime.Text = this.ParentForm.ParentForm.CurrentJudgmentSetItem.DoubleDelayTime.ToString();
// 이송속도 = 제품길이 / 시간1
speed = Convert.ToDouble(this.ParentForm.ParentForm.CurrentJudgmentSetItem.ProductLength) / Convert.ToDouble(time1);
//speed = Math.Round(speed + 0.5, 2);
//this.labelFeedSpeed.Text = speed.ToString();
//this.labelFeedSpeedUnitmmin.Text = Math.Round(speed * 60, 2).ToString();
time2 = Convert.ToDouble(this.ParentForm.ParentForm.SystemConfig2.ConveyorLength -
this.ParentForm.ParentForm.CurrentJudgmentSetItem.ProductLength) / speed;
time2 = Math.Floor(time2);
// 판정지연 = 시간1 + 시간2(=(컨베어 길이-제품길이) / 속도)
this.ParentForm.ParentForm.CurrentJudgmentSetItem.JudgmentDelayTime = time1 + Convert.ToInt32(time2);
this.labelJudgmentDelayTime.Text = this.ParentForm.ParentForm.CurrentJudgmentSetItem.JudgmentDelayTime.ToString();
this.ParentForm.ParentForm.TransferProductParameter(this.ParentForm.ParentForm.SystemConfig1.ProductNumber);
this.buttonUsingAutoMode.ButtonUp();
this.IsAutoMode(false);
}
this.labelSensingTime.Text = time1.ToString();
}
private void UpdateSystemParameterDisplay(JudgmentSetItem item)
{
string value = "";
value = item.Filter.ToString();
if (this.labelFilter.Text != value)
this.labelFilter.Text = value;
value = item.JudgmentDelayTime.ToString();
if (this.labelJudgmentDelayTime.Text != value)
this.labelJudgmentDelayTime.Text = value;
if (int.Parse(this.ParentForm.ParentForm.CurrentSystemParameter1.EquipmentType) != 6)
{
if (int.Parse(value) < item.DoubleDelayTime)
{
value = Helper.StringZeroFillDigits4(item.JudgmentDelayTime.ToString());
this.ParentForm.ParentForm.CurrentJudgmentSetItem.DoubleDelayTime = this.ParentForm.ParentForm.CurrentJudgmentSetItem.JudgmentDelayTime;
this.ParentForm.ParentForm.TransferDataStream(CommunicationCommand.Write, CommunicationID.MainBoard, CommunicationAddress.DoubleDelayTime, value);
this.ParentForm.ParentForm.SaveJudgmentSetFile(this.ParentForm.ParentForm.CurrentJudgmentSetItem, this.ParentForm.ParentForm.SystemConfig1.ProductNumber - 1);
}
}
value = item.DoubleDelayTime.ToString();
if (this.labelDoubleDelayTime.Text != value)
this.labelDoubleDelayTime.Text = value;
value = item.JudgmentCount.ToString();
if (this.labelJudgmentCount.Text != value)
this.labelJudgmentCount.Text = value;
value = item.FeedSpeed1.ToString();
if (this.labelFeedSpeed.Text != value)
this.labelFeedSpeed.Text = value;
value = Helper.DoubleToString(item.DynamicCorrection, 6);
if (this.labelDynamicCorrection.Text != value)
this.labelDynamicCorrection.Text = value;
this.GraphBackRedraw();
}
public void UpdateEquipmentStatusDisplay(DataStore.EquipmentStatus status)
{
if (status == DataStore.EquipmentStatus.Start)
{
this.smartDraw.PutDataAllClear();
this.labelProductNo.Enabled = false;
this.buttonWeightReference.Enabled = false;
this.buttonCopy.Enabled = false;
this.buttonPaste.Enabled = false;
this.buttonPasteAll.Enabled = false;
}
else
{
this.labelProductNo.Enabled = true;
this.buttonWeightReference.Enabled = true;
this.buttonCopy.Enabled = true;
this.buttonPaste.Enabled = true;
this.buttonPasteAll.Enabled = true;
}
}
public void UpdateCurrentProductDisplay(DataStore.EquipmentStatus status, ProductItem pItem)
{
string value = "";
value = pItem.Number.ToString();
if (this.labelProductNo.Text != value)
this.labelProductNo.Text = value;
if (pItem.Number >= 996)
this.labelWarningRandomMode.Visible = true;
else
this.labelWarningRandomMode.Visible = false;
this.UpdateSystemParameterDisplay(this.ParentForm.ParentForm.CurrentJudgmentSetItem);
}
public void UpdateGraphDataDisplay(DataStore.EquipmentStatus status, WeightData weightData, Collection<int> values)
{
int iValue = 0, temp = 0, inputValue = 0;
string sValue = "";
this.ParentForm.ParentForm.TransferDataStream(CommunicationCommand.Read, CommunicationID.MainBoard, CommunicationAddress.ReadSensingTime, "");
sValue = Helper.DoubleToString(weightData.Weight, this.ParentForm.ParentForm.SystemConfig1.DecimalPlaces);
if (this.labelWeightJudgment.Text != sValue)
this.labelWeightJudgment.Text = sValue;
this.smartDraw.PutDataAllClear();
iValue = int.Parse(this.RefrenceADC);
temp = 120 - iValue;
for (int i = 0; i < values.Count; i++)
{
inputValue = values[i] + temp;
if (inputValue > 240)
inputValue = 240;
else if (inputValue < 0)
inputValue = 1;
this.smartDraw.PutData(inputValue);
}
}
public void UpdateStopWeightDisplay(DataStore.EquipmentStatus status, WeightData data)
{
string value = "";
value = Helper.DoubleToString(data.Weight, this.ParentForm.ParentForm.SystemConfig1.DecimalPlaces);
if (this.labelWeightValue.Text != value)
this.labelWeightValue.Text = value;
value = data.ADCValue;
if (this.labelADCValue.Text != value)
this.labelADCValue.Text = value;
}
public void UpdateConstantDisplay(DataStore.EquipmentStatus status, CalibrationItem item)
{
string value = "";
value = Helper.StringToDecimalPlaces(item.Constant.Trim(), 6);
if (this.labelConstant.Text != value)
this.labelConstant.Text = value;
}
public void UpdateChecksumDisplay(string value1, string value2)
{
this.label1.Text = value1;
this.label2.Text = value2;
}
public void DisplayRefresh(SystemStatus status)
{
this.ParentForm.ParentForm.CurrentSystemStatus.CurrentDisplay = DataStore.DisplayStore.SystemJudgmentManual;
if (int.Parse(this.ParentForm.ParentForm.CurrentSystemParameter1.EquipmentType) != 0) // 0 : 컨베어, Select 화면에서 모드 셋팅함
{
this.ParentForm.ParentForm.SetDisplayMode(DataStore.DisplayMode.SystemSetting);
this.ParentForm.DisplayTitleRoot(this.ParentForm.ParentForm.CurrentSystemStatus);
}
this.CaptureJudgmentSetItem = new JudgmentSetItem();
this.ControlInitialize();
if (this.ParentForm != null)
this.ParentForm.UpdateEquipmentStatusDisplay(this.ParentForm.ParentForm.CurrentSystemStatus.Equipment);
this.UpdateSystemParameterDisplay(this.ParentForm.ParentForm.CurrentJudgmentSetItem);
if (int.Parse(this.ParentForm.ParentForm.CurrentSystemParameter1.EquipmentType) != 0)
this.buttonUsingAutoMode.Enabled = false;
else
{
this.buttonUsingAutoMode.Enabled = true;
this.buttonUsingAutoMode.ButtonUp();
}
this.IsAutoMode(false);
// Read Calibration Constant
this.ParentForm.ParentForm.TransferDataStream(CommunicationCommand.Read, CommunicationID.MainBoard, CommunicationAddress.ReadConstant, "");
}
#endregion
#region Event Handler
private void labelProductNo_Click(object sender, EventArgs e)
{
string message = "";
DialogFormNumKeyPad myKeyPad = new DialogFormNumKeyPad(this.labelProductNo.Text, 4, 0, false, this.ParentForm.ParentForm.SystemConfig1.Language);
if (myKeyPad.ShowDialog() == DialogResult.OK)
{
if (myKeyPad.doubleValue < 1 || myKeyPad.doubleValue > this.ParentForm.ParentForm.ProductCount)
{
// 입력범위를 확인하세요
message = string.Format("1 ~ {0}", this.ParentForm.ParentForm.ProductCount);
DialogFormMessage myMsg = new DialogFormMessage(1, this.ParentForm.ParentForm.SystemConfig1.Language, message);
myMsg.ShowDialog();
}
else
{
this.labelProductNo.Text = myKeyPad.StringValue;
this.labelProductNo.Text = "**";
this.ParentForm.ParentForm.TransferProductParameter(myKeyPad.IntValue);
}
}
}
private void labelFilter_Click(object sender, EventArgs e)
{
string value = "", message = "";
DialogFormNumKeyPad myKeyPad = new DialogFormNumKeyPad(this.labelFilter.Text, 2, 0, false, this.ParentForm.ParentForm.SystemConfig1.Language);
if (myKeyPad.ShowDialog() == DialogResult.OK)
{
if (myKeyPad.doubleValue < 1 || myKeyPad.doubleValue > 16)
{
// 입력범위를 확인하세요
message = "1~16";
DialogFormMessage myMsg = new DialogFormMessage(1, this.ParentForm.ParentForm.SystemConfig1.Language, message);
myMsg.ShowDialog();
}
else
{
this.labelFilter.Text = myKeyPad.StringValue;
this.ParentForm.ParentForm.CurrentJudgmentSetItem.Filter = myKeyPad.IntValue;
value = Helper.StringZeroFillDigits4(myKeyPad.StringValue);
this.ParentForm.ParentForm.TransferDataStream(CommunicationCommand.Write, CommunicationID.MainBoard, CommunicationAddress.Filter, value);
this.ParentForm.ParentForm.SaveJudgmentSetFile(this.ParentForm.ParentForm.CurrentJudgmentSetItem, this.ParentForm.ParentForm.SystemConfig1.ProductNumber - 1);
if (this.ParentForm.ParentForm.SystemConfig1.ProductNumber >= 996)
{
JudgmentSetItem jItem = new JudgmentSetItem();
for (int i = 995; i < 1000; i++)
{
jItem = this.ParentForm.ParentForm.CollectionJudgmentItem[i];
jItem.Filter = myKeyPad.IntValue;
this.ParentForm.ParentForm.SaveJudgmentSetFile(jItem, i);
}
}
}
}
}
private void labelJudgmentDelayTime_Click(object sender, EventArgs e)
{
string value = "", message = "";
DialogFormNumKeyPad myKeyPad = new DialogFormNumKeyPad(this.labelJudgmentDelayTime.Text, 4, 0, false, this.ParentForm.ParentForm.SystemConfig1.Language);
if (myKeyPad.ShowDialog() == DialogResult.OK)
{
if (myKeyPad.doubleValue < 0 || myKeyPad.doubleValue > 9999)
{
// 입력범위를 확인하세요
message = "0~9999";
DialogFormMessage myMsg = new DialogFormMessage(1, this.ParentForm.ParentForm.SystemConfig1.Language, message);
myMsg.ShowDialog();
}
else
{
this.labelJudgmentDelayTime.Text = myKeyPad.StringValue;
value = Helper.StringZeroFillDigits4(myKeyPad.StringValue);
this.ParentForm.ParentForm.CurrentJudgmentSetItem.JudgmentDelayTime = myKeyPad.IntValue;
this.ParentForm.ParentForm.TransferDataStream(CommunicationCommand.Write, CommunicationID.MainBoard, CommunicationAddress.JudgmentDelayTime, value);
if (int.Parse(this.ParentForm.ParentForm.CurrentSystemParameter1.EquipmentType) != 6)
{
if (this.ParentForm.ParentForm.CurrentJudgmentSetItem.JudgmentDelayTime < this.ParentForm.ParentForm.CurrentJudgmentSetItem.DoubleDelayTime)
{
this.labelDoubleDelayTime.Text = this.labelJudgmentDelayTime.Text;
value = Helper.StringZeroFillDigits4(this.ParentForm.ParentForm.CurrentJudgmentSetItem.JudgmentDelayTime.ToString());
this.ParentForm.ParentForm.CurrentJudgmentSetItem.DoubleDelayTime = this.ParentForm.ParentForm.CurrentJudgmentSetItem.JudgmentDelayTime;
this.ParentForm.ParentForm.TransferDataStream(CommunicationCommand.Write, CommunicationID.MainBoard, CommunicationAddress.DoubleDelayTime, value);
}
}
this.ParentForm.ParentForm.SaveJudgmentSetFile(this.ParentForm.ParentForm.CurrentJudgmentSetItem, this.ParentForm.ParentForm.SystemConfig1.ProductNumber - 1);
if (this.ParentForm.ParentForm.SystemConfig1.ProductNumber >= 996)
{
JudgmentSetItem jItem = new JudgmentSetItem();
for (int i = 995; i < 1000; i++)
{
jItem = this.ParentForm.ParentForm.CollectionJudgmentItem[i];
jItem.JudgmentDelayTime = myKeyPad.IntValue;
this.ParentForm.ParentForm.SaveJudgmentSetFile(jItem, i);
}
}
}
}
}
private void labelDoubleDelayTime_Click(object sender, EventArgs e)
{
string value = "", message = "";
DialogFormNumKeyPad myKeyPad = new DialogFormNumKeyPad(this.labelDoubleDelayTime.Text, 4, 0, false, this.ParentForm.ParentForm.SystemConfig1.Language);
if (myKeyPad.ShowDialog() == DialogResult.OK)
{
if (myKeyPad.doubleValue < 0 || myKeyPad.doubleValue > 9999)
{
// 입력범위를 확인하세요
message = "0~9999";
DialogFormMessage myMsg = new DialogFormMessage(1, this.ParentForm.ParentForm.SystemConfig1.Language, message);
myMsg.ShowDialog();
}
else
{
if (int.Parse(this.ParentForm.ParentForm.CurrentSystemParameter1.EquipmentType) != 6)
{
if (myKeyPad.IntValue > this.ParentForm.ParentForm.CurrentJudgmentSetItem.JudgmentDelayTime)
{
this.labelDoubleDelayTime.Text = this.labelJudgmentDelayTime.Text;
value = Helper.StringZeroFillDigits4(this.ParentForm.ParentForm.CurrentJudgmentSetItem.JudgmentDelayTime.ToString());
this.ParentForm.ParentForm.CurrentJudgmentSetItem.DoubleDelayTime = this.ParentForm.ParentForm.CurrentJudgmentSetItem.JudgmentDelayTime;
}
else
{
this.labelDoubleDelayTime.Text = myKeyPad.StringValue;
value = Helper.StringZeroFillDigits4(myKeyPad.StringValue);
this.ParentForm.ParentForm.CurrentJudgmentSetItem.DoubleDelayTime = myKeyPad.IntValue;
}
}
else
{
this.labelDoubleDelayTime.Text = myKeyPad.StringValue;
value = Helper.StringZeroFillDigits4(myKeyPad.StringValue);
this.ParentForm.ParentForm.CurrentJudgmentSetItem.DoubleDelayTime = myKeyPad.IntValue;
}
this.ParentForm.ParentForm.TransferDataStream(CommunicationCommand.Write, CommunicationID.MainBoard, CommunicationAddress.DoubleDelayTime, value);
this.ParentForm.ParentForm.SaveJudgmentSetFile(this.ParentForm.ParentForm.CurrentJudgmentSetItem, this.ParentForm.ParentForm.SystemConfig1.ProductNumber - 1);
if (this.ParentForm.ParentForm.SystemConfig1.ProductNumber >= 996)
{
JudgmentSetItem jItem = new JudgmentSetItem();
for (int i = 995; i < 1000; i++)
{
jItem = this.ParentForm.ParentForm.CollectionJudgmentItem[i];
jItem.DoubleDelayTime = myKeyPad.IntValue;
this.ParentForm.ParentForm.SaveJudgmentSetFile(jItem, i);
}
}
}
}
}
private void labelJudgmentCount_Click(object sender, EventArgs e)
{
string value = "", message = "";
DialogFormNumKeyPad myKeyPad = new DialogFormNumKeyPad(this.labelJudgmentCount.Text, 4, 0, false, this.ParentForm.ParentForm.SystemConfig1.Language);
if (myKeyPad.ShowDialog() == DialogResult.OK)
{
if (myKeyPad.doubleValue < 1 || myKeyPad.doubleValue > 20)
{
// 입력범위를 확인하세요
message = "1~20";
DialogFormMessage myMsg = new DialogFormMessage(1, this.ParentForm.ParentForm.SystemConfig1.Language, message);
myMsg.ShowDialog();
}
else
{
this.labelJudgmentCount.Text = myKeyPad.StringValue;
this.ParentForm.ParentForm.CurrentJudgmentSetItem.JudgmentCount = myKeyPad.IntValue;
this.GraphBackRedraw();
value = Helper.StringZeroFillDigits4(myKeyPad.StringValue);
this.ParentForm.ParentForm.TransferDataStream(CommunicationCommand.Write, CommunicationID.MainBoard, CommunicationAddress.JudgmentCount, value);
this.ParentForm.ParentForm.SaveJudgmentSetFile(this.ParentForm.ParentForm.CurrentJudgmentSetItem, this.ParentForm.ParentForm.SystemConfig1.ProductNumber - 1);
if (this.ParentForm.ParentForm.SystemConfig1.ProductNumber >= 996)
{
JudgmentSetItem jItem = new JudgmentSetItem();
for (int i = 995; i < 1000; i++)
{
jItem = this.ParentForm.ParentForm.CollectionJudgmentItem[i];
jItem.JudgmentCount = myKeyPad.IntValue;
this.ParentForm.ParentForm.SaveJudgmentSetFile(jItem, i);
}
}
}
}
}
private void labelFeedSpeed_Click(object sender, EventArgs e)
{
string value = "", message = "";
DialogFormNumKeyPad myKeyPad = new DialogFormNumKeyPad(this.labelFeedSpeed.Text, 4, 0, false, this.ParentForm.ParentForm.SystemConfig1.Language);
if (myKeyPad.ShowDialog() == DialogResult.OK)
{
if (myKeyPad.doubleValue < 1 || myKeyPad.doubleValue > 120)
{
// 입력범위를 확인하세요
message = "1~120";
DialogFormMessage myMsg = new DialogFormMessage(1, this.ParentForm.ParentForm.SystemConfig1.Language, message);
myMsg.ShowDialog();
}
else
{
this.labelFeedSpeed.Text = myKeyPad.StringValue;
this.ParentForm.ParentForm.CurrentJudgmentSetItem.FeedSpeed1 = myKeyPad.IntValue;
value = Helper.StringZeroFillDigits4(myKeyPad.StringValue);
this.ParentForm.ParentForm.TransferDataStream(CommunicationCommand.Write, CommunicationID.MainBoard, CommunicationAddress.FeedSpeed, value);
this.ParentForm.ParentForm.SaveJudgmentSetFile(this.ParentForm.ParentForm.CurrentJudgmentSetItem, this.ParentForm.ParentForm.SystemConfig1.ProductNumber - 1);
if (this.ParentForm.ParentForm.SystemConfig1.ProductNumber >= 996)
{
JudgmentSetItem jItem = new JudgmentSetItem();
for (int i = 995; i < 1000; i++)
{
jItem = this.ParentForm.ParentForm.CollectionJudgmentItem[i];
jItem.FeedSpeed1 = myKeyPad.IntValue;
this.ParentForm.ParentForm.SaveJudgmentSetFile(jItem, i);
}
}
}
}
}
private void labelDynamicCorrection_Click(object sender, EventArgs e)
{
string value = "", message = "";
DialogFormNumKeyPad myKeyPad = new DialogFormNumKeyPad(this.labelDynamicCorrection.Text, 7, 6, false, this.ParentForm.ParentForm.SystemConfig1.Language);
if (myKeyPad.ShowDialog() == DialogResult.OK)
{
if (myKeyPad.doubleValue < 0.500000 || myKeyPad.doubleValue > 2.000000)
{
// 입력범위를 확인하세요
message = "0.500000~2.000000";
DialogFormMessage myMsg = new DialogFormMessage(1, this.ParentForm.ParentForm.SystemConfig1.Language, message);
myMsg.ShowDialog();
}
else
{
this.labelDynamicCorrection.Text = myKeyPad.StringValue;
this.ParentForm.ParentForm.CurrentJudgmentSetItem.DynamicCorrection = myKeyPad.doubleValue;
value = string.Format("{0:f6}", this.labelDynamicCorrection.Text);
value = value.Remove(1, 1);
value = Helper.StringZeroFillDigits7(value);
this.ParentForm.ParentForm.TransferDataStream(CommunicationCommand.Write, CommunicationID.MainBoard, CommunicationAddress.DynamicCorrection, value);
this.ParentForm.ParentForm.SaveJudgmentSetFile(this.ParentForm.ParentForm.CurrentJudgmentSetItem, this.ParentForm.ParentForm.SystemConfig1.ProductNumber - 1);
if (this.ParentForm.ParentForm.SystemConfig1.ProductNumber >= 996)
{
JudgmentSetItem jItem = new JudgmentSetItem();
for (int i = 995; i < 1000; i++)
{
jItem = this.ParentForm.ParentForm.CollectionJudgmentItem[i];
jItem.DynamicCorrection = myKeyPad.IntValue;
this.ParentForm.ParentForm.SaveJudgmentSetFile(jItem, i);
}
}
}
}
}
private void buttonUsingAutoMode_Click(object sender, EventArgs e)
{
if (this.buttonUsingAutoMode.ButtonStatus == SmartButton.BUTSTATUS.DOWN)
{
this.IsAutoMode(true);
}
else
{
this.IsAutoMode(false);
}
}
private void buttonToLeftOrRight_Click(object sender, EventArgs e)
{
int iValue = 0, temp = 0, inputValue = 0, graphInitValue = 0, unit = 50;
int removeData = 0;
SmartX.SmartButton button = sender as SmartX.SmartButton;
if (button == null)
return;
if (button == this.buttonToLeft)
{
this.MovePoint -= 1;
removeData = (unit * 2) / (this.ParentForm.ParentForm.CurrentJudgmentSetItem.JudgmentDelayTime / 150);
this.ParentForm.ParentForm.CurrentJudgmentSetItem.JudgmentDelayTime += unit;
}
else
{
this.MovePoint += 1;
removeData = (unit * 2) / (this.ParentForm.ParentForm.CurrentJudgmentSetItem.JudgmentDelayTime / 150);
this.ParentForm.ParentForm.CurrentJudgmentSetItem.JudgmentDelayTime -= unit;
}
this.labelJudgmentDelayTime.Text = this.ParentForm.ParentForm.CurrentJudgmentSetItem.JudgmentDelayTime.ToString();
this.ParentForm.ParentForm.SaveJudgmentSetFile(this.ParentForm.ParentForm.CurrentJudgmentSetItem, this.ParentForm.ParentForm.SystemConfig1.ProductNumber - 1);
this.ParentForm.ParentForm.TransferProductParameter(this.ParentForm.ParentForm.SystemConfig1.ProductNumber);
this.smartDraw.PutDataAllClear();
iValue = int.Parse(this.RefrenceADC);
temp = 120 - iValue;
if (this.MovePoint < 0)
{
graphInitValue = removeData * this.MovePoint * -1;
for (int i = graphInitValue; i < this.CollectionGraphDataTemp.Count; i++)
{
inputValue = this.CollectionGraphDataTemp[i] + temp;
if (inputValue > 240)
inputValue = 240;
else if (inputValue < 0)
inputValue = 1;
this.smartDraw.PutData(inputValue);
}
for (int i = 0; i < graphInitValue; i++)
this.smartDraw.PutData(1);
}
else
{
graphInitValue = removeData * this.MovePoint;
for (int i = 0; i < graphInitValue; i++)
this.smartDraw.PutData(1);
for (int i = 0; i < this.CollectionGraphDataTemp.Count - graphInitValue; i++)
{
inputValue = this.CollectionGraphDataTemp[i] + temp;
if (inputValue > 240)
inputValue = 240;
else if (inputValue < 0)
inputValue = 1;
this.smartDraw.PutData(inputValue);
}
}
}
private void buttonUp_Click(object sender, EventArgs e)
{
this.ParentForm.ParentForm.TransferData(CommunicationCommand.MotorUp, CommunicationID.MainBoard);
}
private void buttonDown_Click(object sender, EventArgs e)
{
this.ParentForm.ParentForm.TransferData(CommunicationCommand.MotorDown, CommunicationID.MainBoard);
}
private void buttonCopy_Click(object sender, EventArgs e)
{
this.buttonCopy.Text = this.labelProductNo.Text;
this.CaptureJudgmentSetItem.Filter = this.ParentForm.ParentForm.CurrentJudgmentSetItem.Filter;
this.CaptureJudgmentSetItem.JudgmentDelayTime = this.ParentForm.ParentForm.CurrentJudgmentSetItem.JudgmentDelayTime;
this.CaptureJudgmentSetItem.DoubleDelayTime = this.ParentForm.ParentForm.CurrentJudgmentSetItem.DoubleDelayTime;
this.CaptureJudgmentSetItem.JudgmentCount = this.ParentForm.ParentForm.CurrentJudgmentSetItem.JudgmentCount;
this.CaptureJudgmentSetItem.FeedSpeed1 = this.ParentForm.ParentForm.CurrentJudgmentSetItem.FeedSpeed1;
this.CaptureJudgmentSetItem.DynamicCorrection = this.ParentForm.ParentForm.CurrentJudgmentSetItem.DynamicCorrection;
this.CaptureJudgmentSetItem.Sorter1Mode = this.ParentForm.ParentForm.CurrentJudgmentSetItem.Sorter1Mode;
this.CaptureJudgmentSetItem.Sorter1DelayTime = this.ParentForm.ParentForm.CurrentJudgmentSetItem.Sorter1DelayTime;
this.CaptureJudgmentSetItem.Sorter1RunTime = this.ParentForm.ParentForm.CurrentJudgmentSetItem.Sorter1RunTime;
this.CaptureJudgmentSetItem.Sorter2Mode = this.ParentForm.ParentForm.CurrentJudgmentSetItem.Sorter2Mode;
this.CaptureJudgmentSetItem.Sorter2DelayTime = this.ParentForm.ParentForm.CurrentJudgmentSetItem.Sorter2DelayTime;
this.CaptureJudgmentSetItem.Sorter2RunTime = this.ParentForm.ParentForm.CurrentJudgmentSetItem.Sorter2RunTime;
this.CaptureJudgmentSetItem.DescendDelayTime = this.ParentForm.ParentForm.CurrentJudgmentSetItem.DescendDelayTime;
this.CaptureJudgmentSetItem.AscendDelayTime = this.ParentForm.ParentForm.CurrentJudgmentSetItem.AscendDelayTime;
this.CaptureJudgmentSetItem.ProductLength = this.ParentForm.ParentForm.CurrentJudgmentSetItem.ProductLength;
}
private void buttonPaste_Click(object sender, EventArgs e)
{
if (this.buttonCopy.Text == "00")
return;
this.ParentForm.ParentForm.CurrentJudgmentSetItem.Filter = this.CaptureJudgmentSetItem.Filter;
this.ParentForm.ParentForm.CurrentJudgmentSetItem.JudgmentDelayTime = this.CaptureJudgmentSetItem.JudgmentDelayTime;
this.ParentForm.ParentForm.CurrentJudgmentSetItem.DoubleDelayTime = this.CaptureJudgmentSetItem.DoubleDelayTime;
this.ParentForm.ParentForm.CurrentJudgmentSetItem.JudgmentCount = this.CaptureJudgmentSetItem.JudgmentCount;
this.ParentForm.ParentForm.CurrentJudgmentSetItem.FeedSpeed1 = this.CaptureJudgmentSetItem.FeedSpeed1;
this.ParentForm.ParentForm.CurrentJudgmentSetItem.DynamicCorrection = this.CaptureJudgmentSetItem.DynamicCorrection;
this.ParentForm.ParentForm.CurrentJudgmentSetItem.Sorter1Mode = this.CaptureJudgmentSetItem.Sorter1Mode;
this.ParentForm.ParentForm.CurrentJudgmentSetItem.Sorter1DelayTime = this.CaptureJudgmentSetItem.Sorter1DelayTime;
this.ParentForm.ParentForm.CurrentJudgmentSetItem.Sorter1RunTime = this.CaptureJudgmentSetItem.Sorter1RunTime;
this.ParentForm.ParentForm.CurrentJudgmentSetItem.Sorter2Mode = this.CaptureJudgmentSetItem.Sorter2Mode;
this.ParentForm.ParentForm.CurrentJudgmentSetItem.Sorter2DelayTime = this.CaptureJudgmentSetItem.Sorter2DelayTime;
this.ParentForm.ParentForm.CurrentJudgmentSetItem.Sorter2RunTime = this.CaptureJudgmentSetItem.Sorter2RunTime;
this.ParentForm.ParentForm.CurrentJudgmentSetItem.DescendDelayTime = this.CaptureJudgmentSetItem.DescendDelayTime;
this.ParentForm.ParentForm.CurrentJudgmentSetItem.AscendDelayTime = this.CaptureJudgmentSetItem.AscendDelayTime;
this.ParentForm.ParentForm.CurrentJudgmentSetItem.ProductLength = this.CaptureJudgmentSetItem.ProductLength;
this.ParentForm.ParentForm.SaveJudgmentSetFile(this.ParentForm.ParentForm.CurrentJudgmentSetItem, this.ParentForm.ParentForm.SystemConfig1.ProductNumber - 1);
this.labelProductNo.Text = "**";
this.ParentForm.ParentForm.TransferProductParameter(this.ParentForm.ParentForm.SystemConfig1.ProductNumber);
}
private void buttonPasteAll_Click(object sender, EventArgs e)
{
string fullFilePath = "";
StructJudgmentSetItem structItem;
if (this.buttonCopy.Text == "00")
return;
SmartSplash splash = new SmartSplash();
splash.CenterPosition = true;
splash.AnimationInterval = 200;
splash.LoadingImagePathname = "SmartLoading4";
splash.Start();
this.ParentForm.Enabled = false;
fullFilePath = this.ParentForm.ParentForm.PathSDCardSystemFile2Folder + "JudgmentSetItem.int";
this.ParentForm.ParentForm.smartFileIO.FilePathName = fullFilePath;
this.ParentForm.ParentForm.smartFileIO.Open(this.ParentForm.ParentForm.BufferSmartUart);
for (int i = 0; i < this.ParentForm.ParentForm.ProductCount; i++)
{
structItem.Filter = this.CaptureJudgmentSetItem.Filter;
structItem.JudgmentDelayTime = this.CaptureJudgmentSetItem.JudgmentDelayTime;
structItem.DoubleDelayTime = this.CaptureJudgmentSetItem.DoubleDelayTime;
structItem.JudgmentCount = this.CaptureJudgmentSetItem.JudgmentCount;
structItem.FeedSpeed1 = this.CaptureJudgmentSetItem.FeedSpeed1;
structItem.FeedSpeed2 = this.CaptureJudgmentSetItem.FeedSpeed2;
structItem.FeedSpeed3 = this.CaptureJudgmentSetItem.FeedSpeed3;
structItem.DynamicCorrection = this.CaptureJudgmentSetItem.DynamicCorrection;
structItem.Sorter1Mode = this.CaptureJudgmentSetItem.Sorter1Mode;
structItem.Sorter1DelayTime = this.CaptureJudgmentSetItem.Sorter1DelayTime;
structItem.Sorter1RunTime = this.CaptureJudgmentSetItem.Sorter1RunTime;
structItem.Sorter2Mode = this.CaptureJudgmentSetItem.Sorter2Mode;
structItem.Sorter2DelayTime = this.CaptureJudgmentSetItem.Sorter2DelayTime;
structItem.Sorter2RunTime = this.CaptureJudgmentSetItem.Sorter2RunTime;
structItem.ProductLength = this.CaptureJudgmentSetItem.ProductLength;
structItem.AutoJudgment1 = this.CaptureJudgmentSetItem.AutoJudgment1;
structItem.AutoJudgment2 = this.CaptureJudgmentSetItem.AutoJudgment2;
structItem.AutoJudgment3 = this.CaptureJudgmentSetItem.AutoJudgment3;
structItem.DescendDelayTime = this.CaptureJudgmentSetItem.DescendDelayTime;
structItem.AscendDelayTime = this.CaptureJudgmentSetItem.AscendDelayTime;
structItem.DummyInt1 = 0;
structItem.DummyInt2 = 0;
structItem.DummyInt3 = 0;
structItem.DummyString1 = "0";
structItem.DummyString2 = "0";
structItem.DummyString3 = "0";
structItem.DummyString4 = "0";
structItem.DummyString5 = "0";
this.ParentForm.ParentForm.smartFileIO.WriteStructure_Begin(structItem, i);
}
this.ParentForm.ParentForm.smartFileIO.WriteStructure_End();
this.ParentForm.ParentForm.smartFileIO.Close();
this.ParentForm.ParentForm.ReLoadJudgmentSetFile();
this.labelProductNo.Text = "**";
this.ParentForm.ParentForm.TransferProductParameter(this.ParentForm.ParentForm.SystemConfig1.ProductNumber);
this.ParentForm.Enabled = true;
splash.Finish();
}
private void buttonWeightReference_Click(object sender, EventArgs e)
{
string value = "";
value = this.labelWeightValue.Text;
if (this.buttonWeightReference.Text != value)
this.buttonWeightReference.Text = value;
this.RefrenceADC = this.labelADCValue.Text;
}
#endregion
}
}