112 lines
3.9 KiB
C#
112 lines
3.9 KiB
C#
using CleanMachine.Model.BAS;
|
|
using CleanMachineHMI.Utils;
|
|
using Krypton.Toolkit;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel;
|
|
using System.Data;
|
|
using System.Drawing;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
using System.Windows.Forms;
|
|
|
|
namespace CleanMachineHMI.frmChild
|
|
{
|
|
public partial class frmSwitchRunDirection : KryptonForm
|
|
{
|
|
public frmSwitchRunDirection()
|
|
{
|
|
InitializeComponent();
|
|
}
|
|
|
|
private void frmSwitchRunDirection_Load(object sender, EventArgs e)
|
|
{
|
|
try
|
|
{
|
|
this.SetFormControlText();
|
|
int directNum = Convert.ToInt32(PlcOperationHelper.Instance.ReadPlcItem("DischargeDirectionSelection", PlcItemTypeDesc.D));
|
|
if (Global.LanguageCode != "zh-CN")
|
|
{
|
|
if (directNum == 0)
|
|
{
|
|
ktb_CurrRunDirection.Text = "Positive direction";
|
|
}
|
|
else
|
|
{
|
|
ktb_CurrRunDirection.Text = "Negative direction";
|
|
}
|
|
kcmb_SwitchRunDirection.Items.Clear();
|
|
kcmb_SwitchRunDirection.Items.Add(new ListItem
|
|
{
|
|
Value = "",
|
|
Text = "Please Select",
|
|
});
|
|
kcmb_SwitchRunDirection.Items.Add(new ListItem
|
|
{
|
|
Value = "1",
|
|
Text = "Positive direction",
|
|
});
|
|
kcmb_SwitchRunDirection.Items.Add(new ListItem
|
|
{
|
|
Value = "2",
|
|
Text = "Negative direction",
|
|
});
|
|
}
|
|
else
|
|
{
|
|
if (directNum == 0)
|
|
{
|
|
ktb_CurrRunDirection.Text = "正方向";
|
|
}
|
|
else
|
|
{
|
|
ktb_CurrRunDirection.Text = "反方向";
|
|
}
|
|
}
|
|
kcmb_SwitchRunDirection.SelectedIndex = 0;
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
KryptonMessageBox.Show(this.T("加载出料运行方向切换界面发生异常", "LoadSwitchRunDirectionExp") + $":【{ex.Message}】!");
|
|
}
|
|
}
|
|
|
|
private void btnAdd_Click(object sender, EventArgs e)
|
|
{
|
|
try
|
|
{
|
|
if (kcmb_SwitchRunDirection.SelectedIndex == 0)
|
|
{
|
|
KryptonMessageBox.Show(this.T("请选择切换方向!", "SelectSwitchDirectionInfo"));
|
|
return;
|
|
}
|
|
if (!PlcOperationHelper.Instance.isConn)
|
|
{
|
|
KryptonMessageBox.Show("The PLC is disconnected and unable to operate the equipment.");
|
|
return;
|
|
}
|
|
if (PlcOperationHelper.Instance.WritePlcItem("DischargeDirectionSelection", (kcmb_SwitchRunDirection.SelectedIndex - 1).ToString(), PlcItemTypeDesc.D))
|
|
{
|
|
KryptonMessageBox.Show(this.T("切换出料运行方向成功!", "SwitchDirectionSuccessInfo"));
|
|
this.Close();
|
|
}
|
|
else
|
|
{
|
|
KryptonMessageBox.Show(this.T("切换出料运行方向失败!", "SwitchDirectionFailInfo"));
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
KryptonMessageBox.Show(this.T("切换出料运行方向的函数发生异常", "SwitchRunDirectionExp") + $":【{ex.Message}】!");
|
|
}
|
|
}
|
|
|
|
private void btnEdit_Click(object sender, EventArgs e)
|
|
{
|
|
this.Close();
|
|
}
|
|
}
|
|
}
|