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

746 lines
37 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 ControlCenterSystemJudgmentUpdown : UserControl
{
#region Field
private FormMenu m_ParentForm;
private int MovePoint;
//private int SelectedProductNo;
private string RefrenceADC;
//private ProductItem SelectedProductItem;
//private JudgmentSetItem SelectedJudgmentSetItem;
private JudgmentSetItem CaptureJudgmentSetItem;
private Collection<int> CollectionGraphDataTemp;
#endregion
#region Constructor
public ControlCenterSystemJudgmentUpdown(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.smartGroupBox1.Image = new Bitmap(images.GetImage(Class1.ButtonImages.engBackgroundJudgment_Updown));
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));
}
else if (this.ParentForm.ParentForm.SystemConfig1.Language == DataStore.LanguageID.Chinese)
{
this.smartGroupBox1.Image = new Bitmap(images.GetImage(Class1.ButtonImages.chnBackgroundJudgment_Updown));
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));
}
else if (this.ParentForm.ParentForm.SystemConfig1.Language == DataStore.LanguageID.Czech)
{
}
else if (this.ParentForm.ParentForm.SystemConfig1.Language == DataStore.LanguageID.Russian)
{
this.smartGroupBox1.Image = new Bitmap(images.GetImage(Class1.ButtonImages.rusBackgroundJudgment_Updown));
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));
}
else if (this.ParentForm.ParentForm.SystemConfig1.Language == DataStore.LanguageID.German)
{
this.smartGroupBox1.Image = new Bitmap(images.GetImage(Class1.ButtonImages.gerBackgroundJudgment_Updown));
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));
}
else if (this.ParentForm.ParentForm.SystemConfig1.Language == DataStore.LanguageID.Spanish)
{
this.smartGroupBox1.Image = new Bitmap(images.GetImage(Class1.ButtonImages.engBackgroundJudgment_Updown));
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));
}
else
{
this.smartGroupBox1.Image = new Bitmap(images.GetImage(Class1.ButtonImages.korBackgroundJudgment_Updown));
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));
}
}
private void DefaultSetting()
{
this.RefrenceADC = "0";
this.CaptureJudgmentSetItem = new JudgmentSetItem();
this.ControlInitialize();
}
private void ControlInitialize()
{
this.labelProductNo.Text = this.ParentForm.ParentForm.SystemConfig1.ProductNumber.ToString();
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 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);
}
private void UpdateSystemParameterDisplay(JudgmentSetItem item)
{
string value = "";
value = item.Filter.ToString();
if (this.labelFilter.Text != value)
this.labelFilter.Text = value;
value = item.DescendDelayTime.ToString();
if (this.labelDescendDelayTime.Text != value)
this.labelDescendDelayTime.Text = value;
value = item.AscendDelayTime.ToString();
if (this.labelAscendDelayTime.Text != value)
this.labelAscendDelayTime.Text = value;
value = item.JudgmentDelayTime.ToString();
if (this.labelJudgmentDelayTime.Text != value)
this.labelJudgmentDelayTime.Text = value;
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;
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 DisplayRefresh(SystemStatus status)
{
this.ParentForm.ParentForm.CurrentSystemStatus.CurrentDisplay = DataStore.DisplayStore.SystemJudgmentManual;
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);
// 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);
}
}
}
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);
}
}
}
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);
}
}
}
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);
}
}
}
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);
}
}
}
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);
}
}
}
private void labelDescendDelayTime_Click(object sender, EventArgs e)
{
string value = "", message = "";
DialogFormNumKeyPad myKeyPad = new DialogFormNumKeyPad(this.labelDescendDelayTime.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.labelDescendDelayTime.Text = myKeyPad.StringValue;
value = Helper.StringZeroFillDigits4(myKeyPad.StringValue);
this.ParentForm.ParentForm.CurrentJudgmentSetItem.DescendDelayTime = myKeyPad.IntValue;
this.ParentForm.ParentForm.TransferDataStream(CommunicationCommand.Write, CommunicationID.MainBoard, CommunicationAddress.DescendDelayTime, value);
this.ParentForm.ParentForm.SaveJudgmentSetFile(this.ParentForm.ParentForm.CurrentJudgmentSetItem, this.ParentForm.ParentForm.SystemConfig1.ProductNumber - 1);
}
}
}
private void labelAscendDelayTime_Click(object sender, EventArgs e)
{
string value = "", message = "";
DialogFormNumKeyPad myKeyPad = new DialogFormNumKeyPad(this.labelAscendDelayTime.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.labelAscendDelayTime.Text = myKeyPad.StringValue;
value = Helper.StringZeroFillDigits4(myKeyPad.StringValue);
this.ParentForm.ParentForm.CurrentJudgmentSetItem.AscendDelayTime = myKeyPad.IntValue;
this.ParentForm.ParentForm.TransferDataStream(CommunicationCommand.Write, CommunicationID.MainBoard, CommunicationAddress.AscendDelayTime, value);
this.ParentForm.ParentForm.SaveJudgmentSetFile(this.ParentForm.ParentForm.CurrentJudgmentSetItem, this.ParentForm.ParentForm.SystemConfig1.ProductNumber - 1);
}
}
}
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
}
}