ITC81DB_2/ITC81DB_2/Forms/FormMainDisplay.cs

1164 lines
52 KiB
C#

using System;
using System.Linq;
using System.Collections.ObjectModel;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Threading;
using System.Windows.Forms;
using SmartX;
using ITC81DB_2.Controls;
using ITC81DB_2.DialogForms;
using ITC81DB_2_ImageDll;
namespace ITC81DB_2.Forms
{
public partial class FormMainDisplay : Form
{
#region Field
private FormMain m_ParentForm;
private List<bool> AlarmListBool;
private Define.E_MainDisplayStore CurrentDisplay;
public ControlMainAlarm MainAlarm;
public ControlMainBarGraph MainBarGraph;
public ControlMainDataStatistics MainDataStatistics;
public ControlMainFeedback MainFeedback;
public ControlMainLineGraph MainLineGraph;
public ControlMainList MainList;
public ControlMainSubMenu MainSubMenu;
public ControlMainWeightScreen MainWeightScreen;
#endregion
#region Constructor
public FormMainDisplay(FormMain parent)
{
InitializeComponent();
this.ParentForm = parent;
this.InitializeDesign();
this.DefaultSetting();
}
#endregion
#region Property
public FormMain 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.SystemConfig1.Language == Define.E_LanguageID.English)
{
this.buttonZero.DisableImage = new Bitmap(images.GetImage(Class1.ButtonImages.engFormMainDisplayZeroDisable));
this.buttonZero.DownImage = new Bitmap(images.GetImage(Class1.ButtonImages.engFormMainDisplayZeroDown));
this.buttonZero.UpImage = new Bitmap(images.GetImage(Class1.ButtonImages.engFormMainDisplayZeroUp));
this.buttonWeightInputMode.DownImage = new Bitmap(images.GetImage(Class1.ButtonImages.engFormMainDisplayDeviationUp));
this.buttonWeightInputMode.UpImage = new Bitmap(images.GetImage(Class1.ButtonImages.engFormMainDisplayWeightUp));
this.buttonClear.DisableImage = new Bitmap(images.GetImage(Class1.ButtonImages.engFormMainDisplayClearDisable));
this.buttonClear.DownImage = new Bitmap(images.GetImage(Class1.ButtonImages.engFormMainDisplayClearDown));
this.buttonClear.UpImage = new Bitmap(images.GetImage(Class1.ButtonImages.engFormMainDisplayClearUp));
this.buttonUser.DisableImage = new Bitmap(images.GetImage(Class1.ButtonImages.engFormMainDisplayLogOffDisable));
this.buttonUser.DownImage = new Bitmap(images.GetImage(Class1.ButtonImages.engFormMainDisplayLogOffDown));
this.buttonUser.UpImage = new Bitmap(images.GetImage(Class1.ButtonImages.engFormMainDisplayLogOffUp));
}
else if (this.ParentForm.SystemConfig1.Language == Define.E_LanguageID.Chinese)
{
this.buttonZero.DisableImage = new Bitmap(images.GetImage(Class1.ButtonImages.chnMainZeroDisable));
this.buttonZero.DownImage = new Bitmap(images.GetImage(Class1.ButtonImages.chnMainZeroDown));
this.buttonZero.UpImage = new Bitmap(images.GetImage(Class1.ButtonImages.chnMainZeroUp));
this.buttonWeightInputMode.DownImage = new Bitmap(images.GetImage(Class1.ButtonImages.chnMainDeviationUp));
this.buttonWeightInputMode.UpImage = new Bitmap(images.GetImage(Class1.ButtonImages.chnMainWeightUp));
this.buttonClear.DisableImage = new Bitmap(images.GetImage(Class1.ButtonImages.chnMainClearDisable));
this.buttonClear.DownImage = new Bitmap(images.GetImage(Class1.ButtonImages.chnMainClearDown));
this.buttonClear.UpImage = new Bitmap(images.GetImage(Class1.ButtonImages.chnMainClearUp));
this.buttonUser.DisableImage = new Bitmap(images.GetImage(Class1.ButtonImages.chnMainLogOffDisable));
this.buttonUser.DownImage = new Bitmap(images.GetImage(Class1.ButtonImages.chnMainLogOffDown));
this.buttonUser.UpImage = new Bitmap(images.GetImage(Class1.ButtonImages.chnMainLogOffUp));
}
else if (this.ParentForm.SystemConfig1.Language == Define.E_LanguageID.Spanish)
{
this.buttonZero.DisableImage = new Bitmap(images.GetImage(Class1.ButtonImages.spnFormMainDisplayZeroDisable));
this.buttonZero.DownImage = new Bitmap(images.GetImage(Class1.ButtonImages.spnFormMainDisplayZeroDown));
this.buttonZero.UpImage = new Bitmap(images.GetImage(Class1.ButtonImages.spnFormMainDisplayZeroUp));
this.buttonWeightInputMode.DownImage = new Bitmap(images.GetImage(Class1.ButtonImages.spnFormMainDisplayDeviationUp));
this.buttonWeightInputMode.UpImage = new Bitmap(images.GetImage(Class1.ButtonImages.spnFormMainDisplayWeightUp));
this.buttonClear.DisableImage = new Bitmap(images.GetImage(Class1.ButtonImages.spnFormMainDisplayClearDisable));
this.buttonClear.DownImage = new Bitmap(images.GetImage(Class1.ButtonImages.spnFormMainDisplayClearDown));
this.buttonClear.UpImage = new Bitmap(images.GetImage(Class1.ButtonImages.spnFormMainDisplayClearUp));
this.buttonUser.DisableImage = new Bitmap(images.GetImage(Class1.ButtonImages.spnFormMainDisplayLogOffDisable));
this.buttonUser.DownImage = new Bitmap(images.GetImage(Class1.ButtonImages.spnFormMainDisplayLogOffDown));
this.buttonUser.UpImage = new Bitmap(images.GetImage(Class1.ButtonImages.spnFormMainDisplayLogOffUp));
}
else
{
this.buttonZero.DisableImage = new Bitmap(images.GetImage(Class1.ButtonImages.korFormMainDisplayZeroDisable));
this.buttonZero.DownImage = new Bitmap(images.GetImage(Class1.ButtonImages.korFormMainDisplayZeroDown));
this.buttonZero.UpImage = new Bitmap(images.GetImage(Class1.ButtonImages.korFormMainDisplayZeroUp));
this.buttonWeightInputMode.DownImage = new Bitmap(images.GetImage(Class1.ButtonImages.korFormMainDisplayDeviationUp));
this.buttonWeightInputMode.UpImage = new Bitmap(images.GetImage(Class1.ButtonImages.korFormMainDisplayWeightUp));
this.buttonClear.DisableImage = new Bitmap(images.GetImage(Class1.ButtonImages.korFormMainDisplayClearDisable));
this.buttonClear.DownImage = new Bitmap(images.GetImage(Class1.ButtonImages.korFormMainDisplayClearDown));
this.buttonClear.UpImage = new Bitmap(images.GetImage(Class1.ButtonImages.korFormMainDisplayClearUp));
this.buttonUser.DisableImage = new Bitmap(images.GetImage(Class1.ButtonImages.engFormMainDisplayLogOffDisable));
this.buttonUser.DownImage = new Bitmap(images.GetImage(Class1.ButtonImages.engFormMainDisplayLogOffDown));
this.buttonUser.UpImage = new Bitmap(images.GetImage(Class1.ButtonImages.engFormMainDisplayLogOffUp));
}
if (this.ParentForm.CurrentSystemStatus.CurrentWeightInputMode == Define.E_WeightInputMode.Deviation)
this.buttonWeightInputMode.ButtonDown();
else
this.buttonWeightInputMode.ButtonUp();
}
private void InitializeControl()
{
this.MainBarGraph = new ControlMainBarGraph(this);
this.MainDataStatistics = new ControlMainDataStatistics(this);
this.MainList = new ControlMainList(this);
this.MainLineGraph = new ControlMainLineGraph(this);
this.MainSubMenu = new ControlMainSubMenu(this);
this.MainAlarm = new ControlMainAlarm();
this.MainFeedback = new ControlMainFeedback(this);
this.MainWeightScreen = new ControlMainWeightScreen(this);
this.MainBarGraph.Location = new Point(0, 90);
this.MainDataStatistics.Location = new Point(0, 90);
this.MainList.Location = new Point(0, 90);
this.MainLineGraph.Location = new Point(0, 90);
this.MainSubMenu.Location = new Point(0, 90);
this.MainAlarm.Location = new Point(390, 60);
this.MainFeedback.Location = new Point(0, 90);
this.MainWeightScreen.Location = new Point(536, 90);
this.Controls.Add(this.MainBarGraph);
this.Controls.Add(this.MainDataStatistics);
this.Controls.Add(this.MainList);
this.Controls.Add(this.MainLineGraph);
this.Controls.Add(this.MainSubMenu);
this.Controls.Add(this.MainAlarm);
this.Controls.Add(this.MainFeedback);
this.Controls.Add(this.MainWeightScreen);
if (this.ParentForm.SystemConfig1.IsLogin == true)
{
this.labelUserID.Visible = true;
this.labelUserLevel.Visible = true;
this.buttonUser.Visible = true;
}
else
{
this.labelUserID.Visible = false;
this.labelUserLevel.Visible = false;
this.buttonUser.Visible = false;
}
}
private void DefaultSetting()
{
if (this.ParentForm.IsBootingComplete == false)
this.buttonProductNo.Text = "**";
else
this.buttonProductNo.Text = this.ParentForm.SystemConfig1.ProductNumber.ToString();
this.pictureBoxStop.Visible = true;
this.pictureBoxStart.Visible = false;
this.InitializeControl();
this.UpdateIcomDisplay();
this.DisplayPrintButton(this.ParentForm.SystemConfig1);
// 알람 표시
this.pictureBoxIconAlarm.Visible = false;
this.MainAlarm.Visible = false;
this.MainAlarm.BringToFront();
this.AlarmListBool = new List<bool>();
if (this.ParentForm.SystemConfig1.EquipmentType == 4)
this.UpdateControlVisible(true);
else
this.UpdateControlVisible(false);
if (this.ParentForm.SystemConfig1.IsLogin == true)
this.UpdateDisplayUser(this.ParentForm.CurrentSystemStatus);
else
this.ParentForm.CurrentSystemStatus.CurrentUser.Group = Define.E_UserGroup.Level4Developer;
this.CurrentDisplay = Define.E_MainDisplayStore.BarGraph;
this.DisplayBottomMain(this.CurrentDisplay);
}
private void UpdateDisplayAlarmView(WeightData data1, WeightData data2)
{
bool flagAlarm = false;
bool flagChange = false;
if (this.AlarmListBool.Count > 0)
{
if (this.AlarmListBool[0] != data1.IsLoadCellError) flagChange = true;
if (this.AlarmListBool[1] != data2.IsLoadCellError) flagChange = true;
if (this.AlarmListBool[2] != data1.IsEmergencyStop) flagChange = true;
if (this.AlarmListBool[3] != data1.IsEntrySensorError) flagChange = true;
if (this.AlarmListBool[4] != data2.IsEntrySensorError) flagChange = true;
if (this.AlarmListBool[5] != data1.IsEntryNotDetected) flagChange = true;
if (this.AlarmListBool[6] != data2.IsEntryNotDetected) flagChange = true;
if (this.AlarmListBool[7] != data1.IsEntryStucked) flagChange = true;
if (this.AlarmListBool[8] != data2.IsEntryStucked) flagChange = true;
}
this.AlarmListBool.Clear();
this.AlarmListBool.Add(data1.IsLoadCellError);
this.AlarmListBool.Add(data2.IsLoadCellError);
this.AlarmListBool.Add(data1.IsEmergencyStop);
this.AlarmListBool.Add(data1.IsEntrySensorError);
this.AlarmListBool.Add(data2.IsEntrySensorError);
this.AlarmListBool.Add(data1.IsEntryNotDetected);
this.AlarmListBool.Add(data2.IsEntryNotDetected);
this.AlarmListBool.Add(data1.IsEntryStucked);
this.AlarmListBool.Add(data2.IsEntryStucked);
foreach (bool listBool in this.AlarmListBool)
{
if (listBool == true)
{
flagAlarm = true;
break;
}
}
if (flagAlarm == true)
{
if (this.pictureBoxIconAlarm.Visible == false)
this.pictureBoxIconAlarm.Visible = true;
}
else
{
this.pictureBoxIconAlarm.Visible = false;
this.MainAlarm.Visible = false;
return;
}
this.MainAlarm.listBoxMessage.Items.Clear();
if (data1.IsLoadCellError == true)
this.MainAlarm.listBoxMessage.Items.Add("#1 LoadCell Error");
if (data2.IsLoadCellError == true)
this.MainAlarm.listBoxMessage.Items.Add("#2 LoadCell Error");
if (data1.IsEmergencyStop == true)
this.MainAlarm.listBoxMessage.Items.Add("Emergency Stop");
if (data1.IsEntrySensorError == true)
this.MainAlarm.listBoxMessage.Items.Add("#1 Entry Sensor Error");
if (data2.IsEntrySensorError == true)
this.MainAlarm.listBoxMessage.Items.Add("#2 Entry Sensor Error");
if (data1.IsEntryNotDetected == true)
{
this.MainAlarm.listBoxMessage.Items.Add("#1 Entry Not Detected");
if (this.ParentForm.SystemConfig1.Language == Define.E_LanguageID.Korean)
this.PopUpWarning("#1 제품진입 미감지");
else
this.PopUpWarning("#1 Entry not detected");
}
if (data2.IsEntryNotDetected == true)
{
this.MainAlarm.listBoxMessage.Items.Add("#2 Entry Not Detected");
if (this.ParentForm.SystemConfig1.Language == Define.E_LanguageID.Korean)
this.PopUpWarning("#2 제품진입 미감지");
else
this.PopUpWarning("#2 Entry not detected");
}
if (data1.IsEntryStucked == true)
{
this.MainAlarm.listBoxMessage.Items.Add("#1 Entry Sensor Stucked");
if (this.ParentForm.SystemConfig1.Language == Define.E_LanguageID.Korean)
this.PopUpWarning("#1 진입센서 이상");
else
this.PopUpWarning("#1 Entry Sensor Stucked");
}
if (data2.IsEntryStucked == true)
{
this.MainAlarm.listBoxMessage.Items.Add("#2 Entry Sensor Stucked");
if (this.ParentForm.SystemConfig1.Language == Define.E_LanguageID.Korean)
this.PopUpWarning("#2 진입센서 이상");
else
this.PopUpWarning("#2 Entry Sensor Stucked");
}
if (flagChange == true && this.MainAlarm.listBoxMessage.Items.Count > 0)
{
// 로그
if (this.ParentForm.IsCommunicationLogOpen == true)
{
for (int i = 0; i < this.MainAlarm.listBoxMessage.Items.Count; i++)
this.ParentForm.smartFileCommunicationLog.WriteString(
string.Format("Alarm ({0:yyyy-MM-dd HH:mm:ss}): {1}", DateTime.Now, this.MainAlarm.listBoxMessage.Items[i]));
}
}
}
private void ProductChange(int productNumber)
{
this.buttonProductNo.Text = "**";
this.ParentForm.TransferProductParameter1(productNumber);
}
public void RescaleControl()
{
this.MainBarGraph.RescaleProgressBar1();
this.MainBarGraph.RescaleProgressBar2();
}
public void Clear()
{
this.ParentForm.CurrentWeightData1.ClearCount();
this.ParentForm.CurrentWeightData2.ClearCount();
this.ParentForm.SaveCounterFile1(this.ParentForm.CurrentWeightData1, this.ParentForm.SystemConfig1.ProductNumber - 1);
this.ParentForm.SaveCounterFile2(this.ParentForm.CurrentWeightData2, this.ParentForm.SystemConfig1.ProductNumber - 1);
if (this.MainBarGraph != null)
this.MainBarGraph.Clear();
if (this.MainDataStatistics != null)
this.MainDataStatistics.Clear();
if (this.MainList != null)
this.MainList.Clear();
if (this.MainLineGraph != null)
this.MainLineGraph.Clear();
}
public void DisplayPrintButton(SystemConfigurationItem system)
{
if (system.SerialCOM1Mode == 3 || system.SerialCOM3Mode == 3)
{
this.buttonPrint1.Visible = true;
this.buttonPrint2.Visible = true;
}
else
{
this.buttonPrint1.Visible = false;
this.buttonPrint2.Visible = false;
}
}
public void UpdateIcomDisplay()
{
// Icon - 데이터 백업
if (this.ParentForm.SystemConfig1.IsDataBackup == true)
{
this.pictureBoxIconUsbEnable.Visible = true;
this.pictureBoxIconUsbDesable.Visible = false;
}
else
{
this.pictureBoxIconUsbEnable.Visible = false;
this.pictureBoxIconUsbDesable.Visible = true;
}
// Icon - COM1
if (this.ParentForm.SystemConfig1.SerialCOM1Mode == 0)
{
this.pictureBoxCOM1Enable.Visible = false;
this.pictureBoxCOM1Disable.Visible = true;
}
else
{
this.pictureBoxCOM1Enable.Visible = true;
this.pictureBoxCOM1Disable.Visible = false;
}
// Icon - COM3
if (this.ParentForm.SystemConfig1.SerialCOM3Mode == 0)
{
this.pictureBoxCOM3Enable.Visible = false;
this.pictureBoxCOM3Disable.Visible = true;
}
else
{
this.pictureBoxCOM3Enable.Visible = true;
this.pictureBoxCOM3Disable.Visible = false;
}
// Icon - Feedback
if (this.MainFeedback.IsUsingFeedback() == true) // Feedback
{
this.pictureBoxFeedbackDisable.Visible = false;
this.pictureBoxFeedbackEnable.Visible = true;
}
else
{
this.pictureBoxFeedbackDisable.Visible = true;
this.pictureBoxFeedbackEnable.Visible = false;
}
}
private void UpdateDisplayUser(SystemStatus status)
{
string id = "", group = "";
switch (status.CurrentUser.Group)
{
case Define.E_UserGroup.LogOff:
id = "";
if (this.ParentForm.SystemConfig1.Language == Define.E_LanguageID.Chinese)
group = "关闭";
else if (this.ParentForm.SystemConfig1.Language == Define.E_LanguageID.Spanish)
group = "Apagado";
else
group = "Off";
if (this.labelUserLevel.ForeColor != this.ParentForm.ColorLogOff)
this.labelUserLevel.ForeColor = this.labelUserID.ForeColor = this.ParentForm.ColorLogOff;
this.buttonUser.ButtonUp();
this.buttonProductNo.Enabled = false;
this.buttonClear.Enabled = false;
this.labelProductName.Enabled = false;
this.buttonMenu.Enabled = false;
break;
case Define.E_UserGroup.Level1Operator:
id = status.CurrentUser.ID;
if (this.ParentForm.SystemConfig1.Language == Define.E_LanguageID.Chinese)
group = "级别1";
else if (this.ParentForm.SystemConfig1.Language == Define.E_LanguageID.Spanish)
group = "Nivel 1";
else
group = "Level1";
if (this.labelUserLevel.ForeColor != this.ParentForm.ColorLogOn)
this.labelUserLevel.ForeColor = this.labelUserID.ForeColor = this.ParentForm.ColorLogOn;
this.buttonUser.ButtonDown();
this.buttonProductNo.Enabled = true;
this.buttonClear.Enabled = true;
this.labelProductName.Enabled = true;
if (status.Equipment == Define.E_EquipmentStatus.Stop)
this.buttonMenu.Enabled = true;
else
this.buttonMenu.Enabled = false;
break;
case Define.E_UserGroup.Level2Engineer:
id = status.CurrentUser.ID;
if (this.ParentForm.SystemConfig1.Language == Define.E_LanguageID.Chinese)
group = "级别2";
else if (this.ParentForm.SystemConfig1.Language == Define.E_LanguageID.Spanish)
group = "Nivel 2";
else
group = "Level2";
if (this.labelUserLevel.ForeColor != this.ParentForm.ColorLogOn)
this.labelUserLevel.ForeColor = this.labelUserID.ForeColor = this.ParentForm.ColorLogOn;
this.buttonUser.ButtonDown();
this.buttonProductNo.Enabled = true;
this.buttonClear.Enabled = true;
this.labelProductName.Enabled = true;
if (status.Equipment == Define.E_EquipmentStatus.Stop)
this.buttonMenu.Enabled = true;
else
this.buttonMenu.Enabled = false;
break;
case Define.E_UserGroup.Level3Manager:
id = status.CurrentUser.ID;
if (this.ParentForm.SystemConfig1.Language == Define.E_LanguageID.Chinese)
group = "级别3";
else if (this.ParentForm.SystemConfig1.Language == Define.E_LanguageID.Spanish)
group = "Nivel 3";
else
group = "Level3";
if (this.labelUserLevel.ForeColor != this.ParentForm.ColorLogOn)
this.labelUserLevel.ForeColor = this.labelUserID.ForeColor = this.ParentForm.ColorLogOn;
this.buttonUser.ButtonDown();
this.buttonProductNo.Enabled = true;
this.buttonClear.Enabled = true;
this.labelProductName.Enabled = true;
if (status.Equipment == Define.E_EquipmentStatus.Stop)
this.buttonMenu.Enabled = true;
else
this.buttonMenu.Enabled = false;
break;
case Define.E_UserGroup.Level4Developer:
id = status.CurrentUser.ID;
if (this.ParentForm.SystemConfig1.Language == Define.E_LanguageID.Chinese)
group = "级别4";
else if (this.ParentForm.SystemConfig1.Language == Define.E_LanguageID.Spanish)
group = "Nivel 4";
else
group = "Level4";
if (this.labelUserLevel.ForeColor != this.ParentForm.ColorLogOn)
this.labelUserLevel.ForeColor = this.labelUserID.ForeColor = this.ParentForm.ColorLogOn;
this.buttonUser.ButtonDown();
this.buttonProductNo.Enabled = true;
this.buttonClear.Enabled = true;
this.labelProductName.Enabled = true;
if (status.Equipment == Define.E_EquipmentStatus.Stop)
this.buttonMenu.Enabled = true;
else
this.buttonMenu.Enabled = false;
break;
default:
id = "";
if (this.ParentForm.SystemConfig1.Language == Define.E_LanguageID.Chinese)
group = "关闭";
else if (this.ParentForm.SystemConfig1.Language == Define.E_LanguageID.Spanish)
group = "Apagado";
else
group = "Off";
if (this.labelUserLevel.ForeColor != this.ParentForm.ColorLogOff)
this.labelUserLevel.ForeColor = this.labelUserID.ForeColor = this.ParentForm.ColorLogOff;
this.buttonUser.ButtonUp();
this.buttonProductNo.Enabled = false;
this.buttonClear.Enabled = false;
this.buttonMenu.Enabled = false;
this.labelProductName.Enabled = false;
break;
}
if (this.labelUserLevel.Text != group)
this.labelUserLevel.Text = group;
if (this.labelUserID.Text != id)
this.labelUserID.Text = id;
}
public void UpdateEquipmentStatusDisplay(Define.E_EquipmentStatus status)
{
this.MainBarGraph.UpdateEquipmentStatusDisplay(status);
this.MainWeightScreen.UpdateEquipmentStatusDisplay(status);
if (status == Define.E_EquipmentStatus.Start)
{
this.pictureBoxStart.Visible = true;
this.pictureBoxStop.Visible = false;
this.buttonProductNo.Enabled = false;
this.labelProductName.Enabled = false;
this.buttonConveyorUpDown.Enabled = false;
this.buttonMenu.Enabled = false;
}
else
{
this.pictureBoxStart.Visible = false;
this.pictureBoxStop.Visible = true;
this.buttonConveyorUpDown.Enabled = true;
this.buttonConveyorUpDown.ButtonUp();
if (this.ParentForm.CurrentSystemStatus.CurrentUser.Group == Define.E_UserGroup.LogOff)
{
this.buttonProductNo.Enabled = false;
this.labelProductName.Enabled = false;
this.buttonMenu.Enabled = false;
}
else
{
this.buttonProductNo.Enabled = true;
this.labelProductName.Enabled = true;
this.buttonMenu.Enabled = true;
}
}
}
public void UpdateCurrentProductDisplay(Define.E_EquipmentStatus status, ProductItem pItem1, ProductItem pItem2, WeightData wData1, WeightData wData2)
{
string value = "";
value = pItem1.Number.ToString();
if (this.buttonProductNo.Text != value)
this.buttonProductNo.Text = value;
value = pItem1.Name;
if (this.labelProductName.Text != value)
this.labelProductName.Text = value;
value = pItem1.LotNo;
if (this.labelLotNo.Text != value)
this.labelLotNo.Text = value;
if (this.MainBarGraph != null)
this.MainBarGraph.UpdateCurrentProductDisplay(status, pItem1, pItem2, wData1, wData2);
if (this.MainDataStatistics != null)
this.MainDataStatistics.UpdateCurrentProductDisplay(status, pItem1, pItem2, wData1, wData2);
if (this.MainWeightScreen != null)
this.MainWeightScreen.UpdateCurrentProductDisplay(status, pItem1, pItem2, wData1, wData2);
if (this.MainLineGraph != null)
this.MainLineGraph.UpdateCurrentProductDisplay(status, pItem1, pItem2, wData1, wData2);
}
public void UpdateStopWeightDisplay(Define.E_EquipmentStatus status, WeightData data1, WeightData data2)
{
// 알람표시
this.UpdateDisplayAlarmView(data1, data2);
if (this.MainBarGraph != null)
this.MainBarGraph.UpdateStopWeightDisplay(status, data1, data2);
if (this.MainWeightScreen != null)
this.MainWeightScreen.UpdateStopWeightDisplay(status, data1, data2);
}
public void UpdateStartWeightDisplay1(Define.E_EquipmentStatus status, WeightData data)
{
// 알람표시
this.UpdateDisplayAlarmView(data, this.ParentForm.CurrentWeightData2);
if (data.JudgmentStatus == Define.E_JudgmentStatus.Empty)
return;
if (this.MainBarGraph != null)
this.MainBarGraph.UpdateStartWeightDisplay1(status, data);
if (this.MainDataStatistics != null)
this.MainDataStatistics.UpdateStartWeightDisplay1(status, data);
if (this.MainList != null)
this.MainList.UpdateStartWeightDisplay1(status, data);
if (this.MainLineGraph != null)
this.MainLineGraph.UpdateStartWeightDisplay1(status, data);
if (this.MainWeightScreen != null)
this.MainWeightScreen.UpdateStartWeightDisplay1(status, data);
}
public void UpdateStartWeightDisplay2(Define.E_EquipmentStatus status, WeightData data)
{
// 알람표시
this.UpdateDisplayAlarmView(this.ParentForm.CurrentWeightData1, data);
if (data.JudgmentStatus == Define.E_JudgmentStatus.Empty)
return;
if (this.MainBarGraph != null)
this.MainBarGraph.UpdateStartWeightDisplay2(status, data);
if (this.MainDataStatistics != null)
this.MainDataStatistics.UpdateStartWeightDisplay2(status, data);
if (this.MainList != null)
this.MainList.UpdateStartWeightDisplay2(status, data);
if (this.MainLineGraph != null)
this.MainLineGraph.UpdateStartWeightDisplay2(status, data);
if (this.MainWeightScreen != null)
this.MainWeightScreen.UpdateStartWeightDisplay2(status, data);
}
public void PopUpWarning(string warning)
{
this.labelAlarmWindow.Text = warning;
this.labelAlarmWindow.BringToFront();
this.labelAlarmWindow.Visible = true;
}
public void PopUpWarningClose()
{
if (this.labelAlarmWindow.Visible == true)
{
this.labelAlarmWindow.Visible = false;
this.ParentForm.TransferData(CommunicationCommand.BuzzerOnContinuousDisable, CommunicationID.MainBoard);
}
}
public void BottomButtonLocation(int buttonNo, SmartX.SmartButton button)
{
switch (buttonNo)
{
case 1:
button.Location = new Point(385, 0);
break;
case 2:
button.Location = new Point(456, 0);
break;
case 3:
button.Location = new Point(527, 0);
break;
default:
break;
}
}
public void CurrentBottomMenuControlEnable()
{
Collection<SmartButton> buttons = new Collection<SmartButton>();
bool feedback = this.MainFeedback.IsUsingFeedback();
int sampleCount = int.Parse(this.ParentForm.CurrentSystemParameter9508.OPT1SamplingCount);
buttons.Clear();
buttons.Add(this.buttonFeedback);
for (int i = 0; i < buttons.Count; i++)
buttons[i].Visible = false;
buttons.Clear();
if (feedback == true)
{
if (sampleCount != 0)
{
buttons.Add(this.buttonFeedback);
if (this.ParentForm.CurrentSystemParameter9508.OPT1OverRange1Int <= 0 && this.ParentForm.CurrentSystemParameter9508.OPT1UnderRange1Int <= 0)
{
this.ParentForm.UpdateFeedbackData1(this.ParentForm.CurrentProductItem1, this.ParentForm.CurrentSystemParameter9508);
this.ParentForm.UpdateFeedbackDeviation1(this.ParentForm.CurrentProductItem1, this.ParentForm.CurrentSystemParameter9508);
}
else
this.ParentForm.UpdateFeedbackDeviation1(this.ParentForm.CurrentProductItem1, this.ParentForm.CurrentSystemParameter9508);
if (this.ParentForm.CurrentSystemParameter9508.OPT1OverRange2Int <= 0 && this.ParentForm.CurrentSystemParameter9508.OPT1UnderRange2Int <= 0)
{
this.ParentForm.UpdateFeedbackData2(this.ParentForm.CurrentProductItem2, this.ParentForm.CurrentSystemParameter9508);
this.ParentForm.UpdateFeedbackDeviation2(this.ParentForm.CurrentProductItem2, this.ParentForm.CurrentSystemParameter9508);
}
else
this.ParentForm.UpdateFeedbackDeviation2(this.ParentForm.CurrentProductItem2, this.ParentForm.CurrentSystemParameter9508);
}
}
else
{
this.CurrentDisplay = Define.E_MainDisplayStore.BarGraph;
this.DisplayBottomMain(this.CurrentDisplay);
}
for (int i = 0; i < buttons.Count; i++)
{
this.BottomButtonLocation(i + 1, buttons[i]);
buttons[i].Visible = true;
}
}
public void UpdateDisplayMenuButton(Define.E_MainDisplayStore main)
{
this.buttonStop.ButtonUp();
this.buttonStartMenu.ButtonUp();
this.buttonBargraph.ButtonUp();
this.buttonLinegraph.ButtonUp();
this.buttonFeedback.ButtonUp();
this.buttonList.ButtonUp();
this.buttonDataStat.ButtonUp();
switch (main)
{
case Define.E_MainDisplayStore.SubMenu:
if (this.buttonStartMenu.ButtonStatus != SmartButton.BUTSTATUS.DOWN)
this.buttonStartMenu.ButtonDown();
break;
case Define.E_MainDisplayStore.BarGraph:
if (this.buttonBargraph.ButtonStatus != SmartButton.BUTSTATUS.DOWN)
this.buttonBargraph.ButtonDown();
break;
case Define.E_MainDisplayStore.LineGraph:
if (this.buttonLinegraph.ButtonStatus != SmartButton.BUTSTATUS.DOWN)
this.buttonLinegraph.ButtonDown();
break;
case Define.E_MainDisplayStore.List:
if (this.buttonList.ButtonStatus != SmartButton.BUTSTATUS.DOWN)
this.buttonList.ButtonDown();
break;
case Define.E_MainDisplayStore.DataStat:
if (this.buttonDataStat.ButtonStatus != SmartButton.BUTSTATUS.DOWN)
this.buttonDataStat.ButtonDown();
break;
case Define.E_MainDisplayStore.Feedback:
if (this.buttonFeedback.ButtonStatus != SmartButton.BUTSTATUS.DOWN)
this.buttonFeedback.ButtonDown();
break;
default:
break;
}
}
public void DisplayBottomMain(Define.E_MainDisplayStore main)
{
this.UpdateDisplayMenuButton(main);
switch (main)
{
case Define.E_MainDisplayStore.SubMenu:
this.MainSubMenu.DisplayRefresh(this.ParentForm.CurrentSystemStatus);
this.MainSubMenu.BringToFront();
this.MainWeightScreen.BringToFront();
break;
case Define.E_MainDisplayStore.BarGraph:
this.MainBarGraph.DisplayRefresh(this.ParentForm.CurrentSystemStatus);
this.MainBarGraph.BringToFront();
break;
case Define.E_MainDisplayStore.LineGraph:
this.MainLineGraph.DisplayRefresh(this.ParentForm.CurrentSystemStatus);
this.MainLineGraph.BringToFront();
this.MainWeightScreen.BringToFront();
break;
case Define.E_MainDisplayStore.List:
this.MainList.DisplayRefresh(this.ParentForm.CurrentSystemStatus);
this.MainList.BringToFront();
this.MainWeightScreen.BringToFront();
break;
case Define.E_MainDisplayStore.DataStat:
this.MainDataStatistics.DisplayRefresh(this.ParentForm.CurrentSystemStatus);
this.MainDataStatistics.BringToFront();
this.MainWeightScreen.BringToFront();
break;
case Define.E_MainDisplayStore.Feedback:
this.MainFeedback.DisplayRefresh(this.ParentForm.CurrentSystemStatus);
this.MainFeedback.BringToFront();
this.MainWeightScreen.BringToFront();
break;
default:
break;
}
}
public void UpdateControlVisible(bool enable)
{
this.buttonConveyorUpDown.Visible = enable;
}
public void UpdateTimeDisplay()
{
this.labelTime.Text = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
}
public void DisplayRefresh(SystemStatus status)
{
this.ParentForm.CurrentSystemStatus.CurrentDisplay = Define.E_DisplayStore.MainDisplay;
this.ParentForm.SetDisplayMode(Define.E_DisplayMode.Normal);
this.UpdateDisplayUser(status);
this.UpdateIcomDisplay();
if (this.ParentForm.SystemConfig1.EquipmentType == 4)
this.buttonConveyorUpDown.ButtonUp();
if (this.CurrentDisplay == Define.E_MainDisplayStore.Feedback)
{
if (this.MainFeedback.IsUsingFeedback() == false)
{
this.CurrentDisplay = Define.E_MainDisplayStore.BarGraph;
this.DisplayBottomMain(this.CurrentDisplay);
}
}
this.MainBarGraph.DisplayRefresh(status);
this.MainList.DisplayRefresh(status);
this.MainSubMenu.DisplayRefresh(status);
this.MainLineGraph.DisplayRefresh(status);
this.MainDataStatistics.DisplayRefresh(status);
this.MainFeedback.DisplayRefresh(status);
this.MainWeightScreen.DisplayRefresh(status);
this.ProductChange(this.ParentForm.SystemConfig1.ProductNumber);
}
#endregion
#region Override Member
protected override void OnLoad(EventArgs e)
{
base.OnLoad(e);
//this.InitializeDesign();
//this.DefaultSetting();
//this.smartMemory1.ParentWindow = this;
//this.smartMemory1.MemoryStatusInfomationShow(SmartX.SmartMemory.VIEWPOSITION.CENTER);
}
#endregion
#region Event Handler
private void buttonZero_Click(object sender, EventArgs e)
{
this.ParentForm.TransferData(CommunicationCommand.Zero, CommunicationID.MainBoard);
}
private void buttonProductNo_Click(object sender, EventArgs e)
{
DialogFormNumKeyPad myKeyPad = new DialogFormNumKeyPad(this.buttonProductNo.Text, 4, 0, false, this.ParentForm.SystemConfig1.Language);
if (myKeyPad.ShowDialog() == DialogResult.OK)
{
if (myKeyPad.doubleValue < 1 || myKeyPad.doubleValue > 1000)
{
// 입력범위를 확인하세요
DialogFormMessage myMsg = new DialogFormMessage(1, this.ParentForm.SystemConfig1.Language);
myMsg.ShowDialog();
}
else
{
this.ParentForm.SystemConfig1.ProductNumber = myKeyPad.IntValue;
this.ParentForm.SaveSystemConfigurationFile(this.ParentForm.SystemConfig1);
this.ProductChange(this.ParentForm.SystemConfig1.ProductNumber);
}
}
}
private void labelProductName_Click(object sender, EventArgs e)
{
int listIndex = 0, listViewIndex = 0;
Collection<string> productNames = new Collection<string>();
this.ParentForm.LoadProductName1(ref productNames);
listIndex = this.ParentForm.SystemConfig1.ProductNumber - 1;
listViewIndex = (listIndex / 10) * 10;
if (listViewIndex > 990)
listViewIndex = 990;
DialogFormProductList product = new DialogFormProductList(productNames, listViewIndex);
product.Location = new Point(79, 60);
if (product.ShowDialog() == DialogResult.OK)
{
this.ParentForm.SystemConfig1.ProductNumber = product.SelectedProductNumber;
this.ParentForm.SaveSystemConfigurationFile(this.ParentForm.SystemConfig1);
this.ProductChange(product.SelectedProductNumber);
}
}
private void pictureBoxStart_Click(object sender, EventArgs e)
{
this.ParentForm.TransferData(CommunicationCommand.Stop, CommunicationID.MainBoard);
}
private void pictureBoxStop_Click(object sender, EventArgs e)
{
this.ParentForm.TransferData(CommunicationCommand.Start, CommunicationID.MainBoard);
}
private void timerPrinting_Tick(object sender, EventArgs e)
{
//this.timerPrinting.Enabled = false;
//this.buttonPrint.Enabled = true;
//this.buttonClear.Enabled = true;
}
private void pictureBoxIconAlarm_Click(object sender, EventArgs e)
{
if (this.MainAlarm.Visible == true)
this.MainAlarm.Visible = false;
else
{
this.MainAlarm.BringToFront();
this.MainAlarm.Visible = true;
}
}
private void labelAlarmWindow_Click(object sender, EventArgs e)
{
this.PopUpWarningClose();
}
private void buttonPrint1_Click(object sender, EventArgs e)
{
if (this.buttonPrint1.ButtonStatus == SmartButton.BUTSTATUS.DOWN)
{
this.ParentForm.SystemConfig1.IsPrint1Enable = true;
if (this.buttonPrint2.ButtonStatus != SmartButton.BUTSTATUS.DOWN)
this.ParentForm.PrintingHeadLine();
}
else
{
this.ParentForm.SystemConfig1.IsPrint1Enable = false;
if (this.buttonPrint2.ButtonStatus != SmartButton.BUTSTATUS.DOWN)
{
if (this.ParentForm.SystemConfig1.SerialCOM1Mode == 3)
this.ParentForm.TransferSerialCOM1("\n\n\n\n");
else if (this.ParentForm.SystemConfig1.SerialCOM3Mode == 3)
this.ParentForm.TransferSerialCOM3("\n\n\n\n");
}
}
//this.buttonPrint.Enabled = false;
//this.buttonClear.Enabled = false;
//this.timerPrinting.Interval = 10000;
//this.timerPrinting.Enabled = true;
//this.ParentForm.PrintingWeight(this.ParentForm.CurrentWeightData, this.ParentForm.CurrentProductItem);
}
private void buttonPrint2_Click(object sender, EventArgs e)
{
if (this.buttonPrint2.ButtonStatus == SmartButton.BUTSTATUS.DOWN)
{
this.ParentForm.SystemConfig1.IsPrint2Enable = true;
if (this.buttonPrint1.ButtonStatus != SmartButton.BUTSTATUS.DOWN)
this.ParentForm.PrintingHeadLine();
}
else
{
this.ParentForm.SystemConfig1.IsPrint2Enable = false;
if (this.buttonPrint1.ButtonStatus != SmartButton.BUTSTATUS.DOWN)
{
if (this.ParentForm.SystemConfig1.SerialCOM1Mode == 3)
this.ParentForm.TransferSerialCOM1("\n\n\n\n");
else if (this.ParentForm.SystemConfig1.SerialCOM3Mode == 3)
this.ParentForm.TransferSerialCOM3("\n\n\n\n");
}
}
}
private void buttonClear_Click(object sender, EventArgs e)
{
DialogFormYesNo myDlg = new DialogFormYesNo(this.ParentForm.SystemConfig1.Language, 8);
if (myDlg.ShowDialog() == DialogResult.Yes)
{
this.Clear();
}
}
private void buttonUser_Click(object sender, EventArgs e)
{
if (this.ParentForm.CurrentSystemStatus.CurrentUser.Group == Define.E_UserGroup.LogOff)
{
DialogFormLogOn logOn = new DialogFormLogOn(this.ParentForm, this.ParentForm.SystemConfig1.Language);
if (logOn.ShowDialog() == DialogResult.OK)
{
this.DisplayRefresh(this.ParentForm.CurrentSystemStatus);
this.buttonUser.ButtonDown();
switch (this.CurrentDisplay)
{
case Define.E_MainDisplayStore.SubMenu:
this.MainSubMenu.DisplayRefresh(this.ParentForm.CurrentSystemStatus);
break;
case Define.E_MainDisplayStore.BarGraph:
this.MainBarGraph.DisplayRefresh(this.ParentForm.CurrentSystemStatus);
break;
case Define.E_MainDisplayStore.LineGraph:
this.MainLineGraph.DisplayRefresh(this.ParentForm.CurrentSystemStatus);
break;
case Define.E_MainDisplayStore.List:
this.MainList.DisplayRefresh(this.ParentForm.CurrentSystemStatus);
break;
case Define.E_MainDisplayStore.DataStat:
this.MainDataStatistics.DisplayRefresh(this.ParentForm.CurrentSystemStatus);
break;
default:
break;
}
}
else
{
this.buttonUser.ButtonUp();
}
}
else
{
DialogFormYesNo msg = new DialogFormYesNo(this.ParentForm.SystemConfig1.Language, 12);
if (msg.ShowDialog() == DialogResult.Yes)
{
this.ParentForm.CurrentSystemStatus.CurrentUser.Group = Define.E_UserGroup.LogOff;
this.buttonUser.ButtonUp();
this.DisplayRefresh(this.ParentForm.CurrentSystemStatus);
switch (this.CurrentDisplay)
{
case Define.E_MainDisplayStore.SubMenu:
this.MainSubMenu.DisplayRefresh(this.ParentForm.CurrentSystemStatus);
break;
case Define.E_MainDisplayStore.BarGraph:
this.MainBarGraph.DisplayRefresh(this.ParentForm.CurrentSystemStatus);
break;
case Define.E_MainDisplayStore.LineGraph:
this.MainLineGraph.DisplayRefresh(this.ParentForm.CurrentSystemStatus);
break;
case Define.E_MainDisplayStore.List:
this.MainList.DisplayRefresh(this.ParentForm.CurrentSystemStatus);
break;
case Define.E_MainDisplayStore.DataStat:
this.MainDataStatistics.DisplayRefresh(this.ParentForm.CurrentSystemStatus);
break;
default:
break;
}
}
}
}
private void buttonWeightInputMode_Click(object sender, EventArgs e)
{
if (this.buttonWeightInputMode.ButtonStatus == SmartX.SmartButton.BUTSTATUS.DOWN)
this.ParentForm.CurrentSystemStatus.CurrentWeightInputMode = Define.E_WeightInputMode.Deviation;
else
this.ParentForm.CurrentSystemStatus.CurrentWeightInputMode = Define.E_WeightInputMode.Weight;
this.UpdateCurrentProductDisplay(this.ParentForm.CurrentSystemStatus.Equipment, this.ParentForm.CurrentProductItem1, this.ParentForm.CurrentProductItem2,
this.ParentForm.CurrentWeightData1, this.ParentForm.CurrentWeightData2);
}
private void buttonMenu_Click(object sender, EventArgs e)
{
if (this.ParentForm.SystemConfig1.IsLogin == false)
{
if (this.ParentForm.CurrentSystemStatus.Equipment == Define.E_EquipmentStatus.Stop)
{
((FormMain)(Owner)).smartForm.Show((int)Define.E_FormStore.FormMenu);
this.ParentForm.ChildFormMenu.DisplayRefresh(this.ParentForm.CurrentSystemStatus);
}
}
else
{
if (this.ParentForm.CurrentSystemStatus.Equipment == Define.E_EquipmentStatus.Stop)
{
((FormMain)(Owner)).smartForm.Show((int)Define.E_FormStore.FormMenu);
this.ParentForm.ChildFormMenu.DisplayRefresh(this.ParentForm.CurrentSystemStatus);
}
}
}
private void buttonStop_Click(object sender, EventArgs e)
{
this.CurrentDisplay = Define.E_MainDisplayStore.BarGraph;
this.DisplayBottomMain(this.CurrentDisplay);
}
private void buttonBargraph_Click(object sender, EventArgs e)
{
this.CurrentDisplay = Define.E_MainDisplayStore.BarGraph;
this.DisplayBottomMain(this.CurrentDisplay);
}
private void buttonLinegraph_Click(object sender, EventArgs e)
{
this.CurrentDisplay = Define.E_MainDisplayStore.LineGraph;
this.DisplayBottomMain(this.CurrentDisplay);
}
private void buttonList_Click(object sender, EventArgs e)
{
this.CurrentDisplay = Define.E_MainDisplayStore.List;
this.DisplayBottomMain(this.CurrentDisplay);
}
private void buttonDataStat_Click(object sender, EventArgs e)
{
this.CurrentDisplay = Define.E_MainDisplayStore.DataStat;
this.DisplayBottomMain(this.CurrentDisplay);
}
private void buttonStartMenu_Click(object sender, EventArgs e)
{
this.CurrentDisplay = Define.E_MainDisplayStore.SubMenu;
this.DisplayBottomMain(this.CurrentDisplay);
}
private void buttonFeedback_Click(object sender, EventArgs e)
{
this.CurrentDisplay = Define.E_MainDisplayStore.Feedback;
this.DisplayBottomMain(this.CurrentDisplay);
}
#endregion
private void buttonExit_Click(object sender, EventArgs e)
{
this.ParentForm.CloseSmartUartLink();
this.ParentForm.smartFileCommunicationLog.Close();
this.ParentForm.Close();
}
private void buttonConveyorUpDown_Click(object sender, EventArgs e)
{
if (this.buttonConveyorUpDown.ButtonStatus == SmartX.SmartButton.BUTSTATUS.DOWN)
this.ParentForm.TransferData(CommunicationCommand.MotorDown, CommunicationID.MainBoard);
else
this.ParentForm.TransferData(CommunicationCommand.MotorUp, CommunicationID.MainBoard);
}
}
}