ITC81DB_2/ITC81DB_2/Controls/CenterEquipment/ControlCenterEquipFunctionS...

461 lines
22 KiB
C#
Raw Normal View History

2020-07-09 08:01:31 +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 SmartX;
using ITC81DB_2.Forms;
using ITC81DB_2.DialogForms;
using ITC81DB_2_ImageDll;
using System.Threading;
namespace ITC81DB_2.Controls
{
public partial class ControlCenterEquipFunctionSetting : UserControl
{
#region Field
private FormMenu m_ParentForm;
#endregion
#region Constructor
public ControlCenterEquipFunctionSetting(FormMenu parent)
{
InitializeComponent();
this.ParentForm = parent;
this.InitializeDesign();
this.DefaultSetting();
}
#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();
this.ParentForm.DisplayTitleRoot(this.ParentForm.ParentForm.CurrentSystemStatus);
if (this.ParentForm.ParentForm.SystemConfig.Language == DataStore.LanguageID.English)
{
this.labelTitleBuzzerONTime.Text = "Buzzer ON time";
this.labelTitleRelayRunTime.Text = "Relay Run time";
this.labelTitleChattering.Text = "Chattering";
this.labelTitleLanguage.Text = "Language";
this.labelTitleEquipmentID.Text = "Equipment ID";
this.labelTitleLogin.Text = "Login";
this.labelTitleCommunicationLog.Text = "Log";
2022-07-29 06:33:41 +00:00
this.buttonLogin.DownImage = new Bitmap(images.GetImage(Class1.ButtonImages.engON_Black));
this.buttonLogin.UpImage = new Bitmap(images.GetImage(Class1.ButtonImages.engOFF_Black));
this.buttonCommunicationLog.DownImage = new Bitmap(images.GetImage(Class1.ButtonImages.engON_Black));
this.buttonCommunicationLog.UpImage = new Bitmap(images.GetImage(Class1.ButtonImages.engOFF_Black));
2020-07-09 08:01:31 +00:00
}
else if (this.ParentForm.ParentForm.SystemConfig.Language == DataStore.LanguageID.Chinese)
{
2022-07-29 06:33:41 +00:00
this.labelTitleBuzzerONTime.Text = "蜂鸣器开启时间";
this.labelTitleRelayRunTime.Text = "继电器接通时间";
this.labelTitleChattering.Text = "颤振";
this.labelTitleLanguage.Text = "语言";
this.labelTitleEquipmentID.Text = "设备编号";
this.labelTitleLogin.Text = "登錄";
this.labelTitleCommunicationLog.Text = "通讯日志";
this.buttonLogin.DownImage = new Bitmap(images.GetImage(Class1.ButtonImages.chnON_Black));
this.buttonLogin.UpImage = new Bitmap(images.GetImage(Class1.ButtonImages.chnOFF_Black));
this.buttonCommunicationLog.DownImage = new Bitmap(images.GetImage(Class1.ButtonImages.chnON_Black));
this.buttonCommunicationLog.UpImage = new Bitmap(images.GetImage(Class1.ButtonImages.chnOFF_Black));
2020-07-09 08:01:31 +00:00
}
else if (this.ParentForm.ParentForm.SystemConfig.Language == DataStore.LanguageID.Czech)
{
}
else if (this.ParentForm.ParentForm.SystemConfig.Language == DataStore.LanguageID.Russian)
{
}
else
{
this.labelTitleBuzzerONTime.Text = "부저 ON 시간";
this.labelTitleRelayRunTime.Text = "릴레이 동작 시간";
this.labelTitleChattering.Text = "채터링감지";
this.labelTitleLanguage.Text = "언어설정";
this.labelTitleEquipmentID.Text = "장비 ID";
this.labelTitleLogin.Text = "로그인";
this.labelTitleCommunicationLog.Text = "통신로그";
2022-07-29 06:33:41 +00:00
this.buttonLogin.DownImage = new Bitmap(images.GetImage(Class1.ButtonImages.engON_Black));
this.buttonLogin.UpImage = new Bitmap(images.GetImage(Class1.ButtonImages.engOFF_Black));
this.buttonCommunicationLog.DownImage = new Bitmap(images.GetImage(Class1.ButtonImages.engON_Black));
this.buttonCommunicationLog.UpImage = new Bitmap(images.GetImage(Class1.ButtonImages.engOFF_Black));
2020-07-09 08:01:31 +00:00
}
}
private void DefaultSetting()
{
this.comboBoxLanguage.SelectedIndexChanged -= new EventHandler(this.comboBoxLanguage_SelectedIndexChanged);
this.comboBoxLanguage.Items.Clear();
this.comboBoxLanguage.Items.Add("한국어");
this.comboBoxLanguage.Items.Add("English");
2022-07-29 06:33:41 +00:00
this.comboBoxLanguage.Items.Add("中國語");
2020-07-09 08:01:31 +00:00
this.comboBoxLanguage.SelectedIndexChanged += new EventHandler(this.comboBoxLanguage_SelectedIndexChanged);
}
private void UpdateParameterDisplay(SystemConfigurationItem item, SystemParameter9507 system)
2020-07-09 08:01:31 +00:00
{
string value = "";
int index = 0;
// Equipment ID
value = item.EquipmentID.ToString();
if (this.labelEquipmentID.Text != value)
this.labelEquipmentID.Text = value;
// 언어
index = (int)item.Language;
if (this.comboBoxLanguage.SelectedIndex != index)
{
this.comboBoxLanguage.SelectedIndexChanged -= new EventHandler(this.comboBoxLanguage_SelectedIndexChanged);
this.comboBoxLanguage.SelectedIndex = index;
this.comboBoxLanguage.SelectedIndexChanged += new EventHandler(this.comboBoxLanguage_SelectedIndexChanged);
}
// 로그인
if (item.IsLogin == false)
this.buttonLogin.ButtonUp();
else
this.buttonLogin.ButtonDown();
// 부저ON시간
value = system.BuzzerOnTime.Trim();
2020-07-09 08:01:31 +00:00
if (this.labelBuzzerOnTime.Text != value)
this.labelBuzzerOnTime.Text = value;
// 릴레이동작시간
value = system.RelayOnTime.Trim();
2020-07-09 08:01:31 +00:00
if (this.labelRelayOnTime.Text != value)
this.labelRelayOnTime.Text = value;
// 채터링감지
value = system.Chattering.Trim();
2020-07-09 08:01:31 +00:00
if (this.labelChattering.Text != value)
this.labelChattering.Text = value;
value = Helper.StringToDecimalPlaces(system.EntryNotDetectedWeight, this.ParentForm.ParentForm.SystemConfig.DecimalPlaces);
if (this.labelEntryNotDetected.Text != value)
this.labelEntryNotDetected.Text = value;
value = item.SensorErrorDetectingTime.ToString();
if (this.labelSensorErrorDetectingTime.Text != value)
this.labelSensorErrorDetectingTime.Text = value;
value = this.ParentForm.ParentForm.CurrentJudgmentSetItem1.JudgmentDelayTime.ToString();
if (this.labelJudgmentValue1.Text != value)
this.labelJudgmentValue1.Text = value;
2020-07-09 08:01:31 +00:00
value = this.ParentForm.ParentForm.CurrentJudgmentSetItem2.JudgmentDelayTime.ToString();
if (this.labelJudgmentValue2.Text != value)
this.labelJudgmentValue2.Text = value;
value = this.ParentForm.ParentForm.SystemConfig.Unit;
if (this.labelUnit.Text != value)
this.labelUnit.Text = value;
2020-07-09 08:01:31 +00:00
}
private void UpdateDisplayUser(UserItem user)
{
// 디버그 후 지울것
this.labelTitleCommunicationLog.Visible = true;
this.buttonCommunicationLog.Visible = true;
//if (user.Group == DataStore.UserGroup.Level4Developer && this.ParentForm.ParentForm.SystemConfig.IsLogin == true)
//{
// this.labelTitleCommunicationLog.Visible = true;
// this.buttonCommunicationLog.Visible = true;
//}
//else
//{
// this.labelTitleCommunicationLog.Visible = false;
// this.buttonCommunicationLog.Visible = false;
//}
}
public void DisplayRefresh(SystemStatus status)
{
this.ParentForm.ParentForm.CurrentSystemStatus.CurrentDisplay = DataStore.DisplayStore.EquipFuctionSetting;
this.ParentForm.ParentForm.SetDisplayMode(DataStore.DisplayMode.Menu);
this.ParentForm.DisplayTitleRoot(this.ParentForm.ParentForm.CurrentSystemStatus);
this.UpdateParameterDisplay(this.ParentForm.ParentForm.SystemConfig, this.ParentForm.ParentForm.CurrentSystemParameter9507);
this.UpdateDisplayUser(status.CurrentUser);
}
#endregion
#region Event Handler
private void labelEquipmentID_Click(object sender, EventArgs e)
{
DialogFormNumKeyPad myKeyPad = new DialogFormNumKeyPad(this.labelEquipmentID.Text, 3, 0, false, this.ParentForm.ParentForm.SystemConfig.Language);
if (myKeyPad.ShowDialog() == DialogResult.OK)
{
if (myKeyPad.doubleValue < 1 || myKeyPad.doubleValue > 9999)
{
// 입력범위를 확인하세요
DialogFormMessage myMsg = new DialogFormMessage(1, this.ParentForm.ParentForm.SystemConfig.Language);
myMsg.ShowDialog();
}
else
{
this.labelEquipmentID.Text = myKeyPad.StringValue;
this.ParentForm.ParentForm.SystemConfig.EquipmentID = myKeyPad.IntValue;
this.ParentForm.ParentForm.SaveSystemConfigurationFile(this.ParentForm.ParentForm.SystemConfig);
}
}
}
private void labelBuzzerOnTime_Click(object sender, EventArgs e)
{
string value = "";
DialogFormNumKeyPad myKeyPad = new DialogFormNumKeyPad(this.labelBuzzerOnTime.Text, 4, 0, false, this.ParentForm.ParentForm.SystemConfig.Language);
if (myKeyPad.ShowDialog() == DialogResult.OK)
{
if (myKeyPad.doubleValue < 0 || myKeyPad.doubleValue > 9999)
{
// 입력범위를 확인하세요
DialogFormMessage myMsg = new DialogFormMessage(1, this.ParentForm.ParentForm.SystemConfig.Language);
myMsg.ShowDialog();
}
else
{
this.labelBuzzerOnTime.Text = myKeyPad.StringValue;
this.ParentForm.ParentForm.CurrentSystemParameter9507.BuzzerOnTime = myKeyPad.StringValue;
value = Helper.StringZeroFillDigits4(myKeyPad.StringValue);
2020-07-09 08:01:31 +00:00
this.ParentForm.ParentForm.TransferDataStream(CommunicationCommand.Write, CommunicationID.MainBoard, CommunicationAddress._6001_BuzzerOnTime, value);
}
}
}
private void labelRelayOnTime_Click(object sender, EventArgs e)
{
string value = "";
DialogFormNumKeyPad myKeyPad = new DialogFormNumKeyPad(this.labelRelayOnTime.Text, 4, 0, false, this.ParentForm.ParentForm.SystemConfig.Language);
if (myKeyPad.ShowDialog() == DialogResult.OK)
{
if (myKeyPad.doubleValue < 0 || myKeyPad.doubleValue > 9999)
{
// 입력범위를 확인하세요
DialogFormMessage myMsg = new DialogFormMessage(1, this.ParentForm.ParentForm.SystemConfig.Language);
myMsg.ShowDialog();
}
else
{
this.labelRelayOnTime.Text = myKeyPad.StringValue;
this.ParentForm.ParentForm.CurrentSystemParameter9507.RelayOnTime = myKeyPad.StringValue;
value = Helper.StringZeroFillDigits4(myKeyPad.StringValue);
2020-07-09 08:01:31 +00:00
this.ParentForm.ParentForm.TransferDataStream(CommunicationCommand.Write, CommunicationID.MainBoard, CommunicationAddress._6002_RelayRunTime, value);
}
}
}
private void labelChattering_Click(object sender, EventArgs e)
{
string value = "";
DialogFormNumKeyPad myKeyPad = new DialogFormNumKeyPad(this.labelChattering.Text, 4, 0, false, this.ParentForm.ParentForm.SystemConfig.Language);
if (myKeyPad.ShowDialog() == DialogResult.OK)
{
if (myKeyPad.doubleValue < 0 || myKeyPad.doubleValue > 500)
{
// 입력범위를 확인하세요
DialogFormMessage myMsg = new DialogFormMessage(1, this.ParentForm.ParentForm.SystemConfig.Language);
myMsg.ShowDialog();
}
else
{
this.labelChattering.Text = myKeyPad.StringValue;
value = Helper.StringZeroFillDigits4(this.labelChattering.Text);
this.ParentForm.ParentForm.CurrentSystemParameter9507.Chattering = myKeyPad.StringValue;
this.ParentForm.ParentForm.TransferDataStream(CommunicationCommand.Write, CommunicationID.MainBoard, CommunicationAddress._6006_Chattering, value);
}
}
}
private void labelEntryNotDeteced_Click(object sender, EventArgs e)
2020-07-09 08:01:31 +00:00
{
string value = "";
DialogFormNumKeyPad myKeyPad = new DialogFormNumKeyPad(this.labelEntryNotDetected.Text, 5, this.ParentForm.ParentForm.SystemConfig.DecimalPlaces,
false, this.ParentForm.ParentForm.SystemConfig.Language);
2020-07-09 08:01:31 +00:00
if (myKeyPad.ShowDialog() == DialogResult.OK)
{
if (myKeyPad.doubleValue < 0.0)
2020-07-09 08:01:31 +00:00
{
// 입력범위를 확인하세요
DialogFormMessage myMsg = new DialogFormMessage(1, this.ParentForm.ParentForm.SystemConfig.Language);
myMsg.ShowDialog();
}
else
{
this.labelEntryNotDetected.Text = myKeyPad.StringValue;
this.ParentForm.ParentForm.CurrentSystemParameter9507.EntryNotDetectedWeight = myKeyPad.StringValue.Replace(".", "");
2020-07-09 08:01:31 +00:00
value = Helper.StringZeroFillDigits7(this.ParentForm.ParentForm.CurrentSystemParameter9507.EntryNotDetectedWeight);
this.ParentForm.ParentForm.TransferDataStream(CommunicationCommand.Write, CommunicationID.MainBoard, CommunicationAddress._6010_EntryNotDetectedWeight, value);
2020-07-09 08:01:31 +00:00
}
}
}
private void labelSensorErrorDetectingTime_Click(object sender, EventArgs e)
2020-07-09 08:01:31 +00:00
{
string value = "";
DialogFormNumKeyPad myKeyPad = new DialogFormNumKeyPad(this.labelSensorErrorDetectingTime.Text, 4, 0, false, this.ParentForm.ParentForm.SystemConfig.Language);
2020-07-09 08:01:31 +00:00
if (myKeyPad.ShowDialog() == DialogResult.OK)
{
if (myKeyPad.doubleValue < this.ParentForm.ParentForm.CurrentJudgmentSetItem1.JudgmentDelayTime
|| myKeyPad.doubleValue < this.ParentForm.ParentForm.CurrentJudgmentSetItem2.JudgmentDelayTime)
2020-07-09 08:01:31 +00:00
{
// 센서에러감지시간은 판정지연 값 이상이어야 합니다.
DialogFormMessage myMsg = new DialogFormMessage(43, this.ParentForm.ParentForm.SystemConfig.Language);
2020-07-09 08:01:31 +00:00
myMsg.ShowDialog();
}
else
{
this.labelSensorErrorDetectingTime.Text = myKeyPad.StringValue;
this.ParentForm.ParentForm.SystemConfig.SensorErrorDetectingTime = myKeyPad.IntValue;
this.ParentForm.ParentForm.SaveSystemConfigurationFile(this.ParentForm.ParentForm.SystemConfig);
2020-07-09 08:01:31 +00:00
this.ParentForm.ParentForm.TimerSensorErrorInterval(myKeyPad.IntValue);
2020-07-09 08:01:31 +00:00
value = Helper.StringZeroFillDigits4(myKeyPad.StringValue);
this.ParentForm.ParentForm.TransferDataStream(CommunicationCommand.Write, CommunicationID.MainBoard, CommunicationAddress._6011_SensorErrorDetectingTime, value);
2020-07-09 08:01:31 +00:00
}
}
}
private void comboBoxLanguage_SelectedIndexChanged(object sender, EventArgs e)
{
if (this.comboBoxLanguage.SelectedIndex == 0)
this.ParentForm.ParentForm.SystemConfig.Language = DataStore.LanguageID.Korean;
else if (this.comboBoxLanguage.SelectedIndex == 1)
this.ParentForm.ParentForm.SystemConfig.Language = DataStore.LanguageID.English;
else if (this.comboBoxLanguage.SelectedIndex == 2)
this.ParentForm.ParentForm.SystemConfig.Language = DataStore.LanguageID.Chinese;
else if (this.comboBoxLanguage.SelectedIndex == 3)
this.ParentForm.ParentForm.SystemConfig.Language = DataStore.LanguageID.Czech;
else
this.ParentForm.ParentForm.SystemConfig.Language = DataStore.LanguageID.Korean;
this.ParentForm.ParentForm.SaveSystemConfigurationFile(this.ParentForm.ParentForm.SystemConfig);
// 각 화면 언어 적용
SmartSplash splash = new SmartSplash();
splash.CenterPosition = true;
splash.AnimationInterval = 200;
splash.LoadingImagePathname = "SmartLoading4";
splash.Start();
this.ParentForm.ParentForm.ChildFormMainDisplay.InitializeDesign();
this.ParentForm.ParentForm.ChildFormMenu.InitializeDesign();
Thread.Sleep(50);
this.ParentForm.ParentForm.ChildFormMainDisplay.MainDisplayMenu.InitializeDesign();
this.ParentForm.ParentForm.ChildFormMainDisplay.MainDisplayNormal.InitializeDesign();
this.ParentForm.ParentForm.ChildFormMainDisplay.MainDisplayDataStatistics.InitializeDesign();
this.ParentForm.ParentForm.ChildFormMainDisplay.MainDisplayList.InitializeDesign();
this.ParentForm.ParentForm.ChildFormMainDisplay.MainDisplayXYChart.InitializeDesign();
Thread.Sleep(50);
this.ParentForm.ParentForm.ChildFormMenu.CenterBasicDataBackup.InitializeDesign();
this.ParentForm.ParentForm.ChildFormMenu.CenterBasicDataStatistics.InitializeDesign();
this.ParentForm.ParentForm.ChildFormMenu.CenterBasicHelp.InitializeDesign();
this.ParentForm.ParentForm.ChildFormMenu.CenterBasicProduct.InitializeDesign();
this.ParentForm.ParentForm.ChildFormMenu.CenterBasicTime.InitializeDesign();
Thread.Sleep(50);
this.ParentForm.ParentForm.ChildFormMenu.CenterConfiCommunication.InitializeDesign();
this.ParentForm.ParentForm.ChildFormMenu.CenterConfiHelp.InitializeDesign();
this.ParentForm.ParentForm.ChildFormMenu.CenterConfiOption.InitializeDesign();
this.ParentForm.ParentForm.ChildFormMenu.CenterConfiOptionBoard.InitializeDesign();
Thread.Sleep(50);
this.ParentForm.ParentForm.ChildFormMenu.CenterEquipFunctionSetting.InitializeDesign();
this.ParentForm.ParentForm.ChildFormMenu.CenterEquipHelp.InitializeDesign();
this.ParentForm.ParentForm.ChildFormMenu.CenterEquipInitialize.InitializeDesign();
this.ParentForm.ParentForm.ChildFormMenu.CenterEquipTest.InitializeDesign();
this.ParentForm.ParentForm.ChildFormMenu.CenterEquipUpdate.InitializeDesign();
this.ParentForm.ParentForm.ChildFormMenu.CenterEquipUser.InitializeDesign();
this.ParentForm.ParentForm.ChildFormMenu.CenterEquipEngineer.InitializeDesign();
2020-07-09 08:01:31 +00:00
Thread.Sleep(50);
this.ParentForm.ParentForm.ChildFormMenu.CenterInforAS.InitializeDesign();
this.ParentForm.ParentForm.ChildFormMenu.CenterInforHelp.InitializeDesign();
this.ParentForm.ParentForm.ChildFormMenu.CenterInforSystemInformation.InitializeDesign();
Thread.Sleep(50);
this.ParentForm.ParentForm.ChildFormMenu.CenterSystemAutoZero.InitializeDesign();
this.ParentForm.ParentForm.ChildFormMenu.CenterSystemCalibration.InitializeDesign();
this.ParentForm.ParentForm.ChildFormMenu.CenterSystemExternalOutput.InitializeDesign();
this.ParentForm.ParentForm.ChildFormMenu.CenterSystemHelp.InitializeDesign();
this.ParentForm.ParentForm.ChildFormMenu.CenterSystemIOTest.InitializeDesign();
this.ParentForm.ParentForm.ChildFormMenu.CenterSystemJudgmentSetting.InitializeDesign();
this.ParentForm.ParentForm.ChildFormMenu.CenterSystemSorterSetting.InitializeDesign();
Thread.Sleep(50);
this.ParentForm.ParentForm.ChildFormMenu.CenterInforAS.DefaultSetting();
splash.Finish();
}
private void buttonLogin_Click(object sender, EventArgs e)
{
DialogFormYesNo myDlg = new DialogFormYesNo(this.ParentForm.ParentForm.SystemConfig.Language, 15);
if (myDlg.ShowDialog() == DialogResult.Yes)
{
if (this.buttonLogin.ButtonStatus == SmartX.SmartButton.BUTSTATUS.UP)
this.ParentForm.ParentForm.SystemConfig.IsLogin = false;
else
this.ParentForm.ParentForm.SystemConfig.IsLogin = true;
this.ParentForm.ParentForm.SaveSystemConfigurationFile(this.ParentForm.ParentForm.SystemConfig);
DialogFormMessage msg = new DialogFormMessage(18, this.ParentForm.ParentForm.SystemConfig.Language);
msg.ShowDialog();
}
else
{
if (this.ParentForm.ParentForm.SystemConfig.IsLogin == false)
this.buttonLogin.ButtonUp();
else
this.buttonLogin.ButtonDown();
}
}
private void buttonCommunicationLog_Click(object sender, EventArgs e)
{
if (this.buttonCommunicationLog.ButtonStatus == SmartButton.BUTSTATUS.DOWN)
{
this.ParentForm.ParentForm.smartFileCommunicationLog.Close();
this.ParentForm.ParentForm.smartFileCommunicationLog.Open(this.ParentForm.ParentForm.BufferSmartUart);
this.ParentForm.ParentForm.IsCommunicationLogOpen = true;
}
else
{
this.ParentForm.ParentForm.IsCommunicationLogOpen = false;
this.ParentForm.ParentForm.smartFileCommunicationLog.Close();
}
}
#endregion
}
}