添加项目文件。
This commit is contained in:
161
CleanMachineHMI/FrmUserControl/frmParamater.cs
Normal file
161
CleanMachineHMI/FrmUserControl/frmParamater.cs
Normal file
@@ -0,0 +1,161 @@
|
||||
using CleanMachineHMI.Domain.Enums;
|
||||
using CleanMachineHMI.frmChild;
|
||||
using CleanMachineHMI.Utils;
|
||||
using ComponentFactory.Krypton.Toolkit;
|
||||
using LeadDataBaseUtility;
|
||||
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.FrmUserControl
|
||||
{
|
||||
[FormType(EnumFormType.Parameter)]
|
||||
public partial class frmParamater : UserControl
|
||||
{
|
||||
private DataTable _InfoLanguageTextList;
|
||||
public delegate void dlgRefreshFrmHost();
|
||||
public static dlgRefreshFrmHost RefreshFrmHost;
|
||||
|
||||
public frmParamater()
|
||||
{
|
||||
InitializeComponent();
|
||||
_InfoLanguageTextList = this.GetInfoLanguageText(GlobalHelper.LanguageCode);
|
||||
}
|
||||
|
||||
|
||||
public void Init()
|
||||
{
|
||||
var sql = $@"select PARAMETER_ID 序号,PARAMETER_CODE 参数编码,PARAMETER_NAME 参数名称,PARAMETER_VALUE 参数值,CREATE_TIME 创建时间 from SYS_PARAMETER where USED_FLAG=1 and DEL_FLAG=0 ";
|
||||
if (!string.IsNullOrEmpty(ktb_ParamaterCode.Text))
|
||||
{
|
||||
sql += $" AND PARAMETER_CODE LIKE '%{ktb_ParamaterCode.Text}%'";
|
||||
}
|
||||
if (!string.IsNullOrEmpty(ktb_ParamaterName.Text))
|
||||
{
|
||||
sql += $" AND PARAMETER_NAME LIKE '%{ktb_ParamaterName.Text}%'";
|
||||
}
|
||||
if (kdtp_CreateStartTime.Checked)
|
||||
{
|
||||
sql += $" AND CREATE_TIME >= '{kdtp_CreateStartTime.Value.ToString("yyyy-MM-dd HH:mm:ss")}'";
|
||||
}
|
||||
if (kdtp_CreateEndTime.Checked)
|
||||
{
|
||||
sql += $" AND CREATE_TIME <= '{kdtp_CreateEndTime.Value.ToString("yyyy-MM-dd HH:mm:ss")}'";
|
||||
}
|
||||
|
||||
DataTable dt = LeadDbHelperSQLite.Query(sql).Tables[0];
|
||||
|
||||
kryptonDataGridView1.Columns.Clear();
|
||||
kryptonDataGridView1.DataSource = dt;
|
||||
kryptonDataGridView1.SetDataViewColumnText(this.Name, GlobalHelper.LanguageCode);
|
||||
|
||||
|
||||
}
|
||||
private void txt_GotFocus(object sender, EventArgs e)
|
||||
{
|
||||
KeyboardAutoPopUp.ShowInputPanel();
|
||||
}
|
||||
private void txt_LostFocus(object sender, EventArgs e)
|
||||
{
|
||||
KeyboardAutoPopUp.HideInputPanel();
|
||||
}
|
||||
private void InitControlEvent()
|
||||
{
|
||||
ktb_ParamaterCode.GotFocus += new EventHandler(txt_GotFocus); //获取焦点前发生事件
|
||||
ktb_ParamaterCode.LostFocus += new EventHandler(txt_LostFocus); //失去焦点后发生事件
|
||||
|
||||
ktb_ParamaterName.GotFocus += new EventHandler(txt_GotFocus); //获取焦点前发生事件
|
||||
ktb_ParamaterName.LostFocus += new EventHandler(txt_LostFocus); //失去焦点后发生事件
|
||||
}
|
||||
|
||||
private void frmParamater_Load(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
InitControlEvent();
|
||||
kdtp_CreateStartTime.Value = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd 00:00:00"));
|
||||
kdtp_CreateEndTime.Value = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd 23:59:59"));
|
||||
kdtp_CreateStartTime.Checked = false;
|
||||
kdtp_CreateEndTime.Checked = false;
|
||||
this.SetFormControlText(GlobalHelper.LanguageCode);
|
||||
RefreshFrmHost = new dlgRefreshFrmHost(Init);
|
||||
Init();
|
||||
foreach (Control item in tableLayoutPanel2.Controls)
|
||||
{
|
||||
if (item.Tag == null)
|
||||
{
|
||||
DataRow[] drs = GlobalHelper.RoleMenuPermission.Select($" MENU_URL = '{this.Name}' AND MENU_PID = '-1'");
|
||||
DataRow[] drs1 = GlobalHelper.RoleMenuPermission.Select($" MENU_URL = '{item.Name}' AND MENU_PID = '{drs[0]["MENU_ID"]}'");
|
||||
if (drs1.Length > 0)
|
||||
{
|
||||
item.Enabled = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
item.Enabled = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
kryptonGroupBox3.Focus();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
KryptonMessageBox.Show(_InfoLanguageTextList.GetInfoText("加载系统参数界面发生异常", "LoadSysParamaterExp") + $":【{ex.Message}】!");
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private void kbt_Query_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
Init();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
KryptonMessageBox.Show(_InfoLanguageTextList.GetInfoText("查询系统参数数据发生异常", "QuerySysParamaterData") + $":【{ex.Message}】!");
|
||||
}
|
||||
}
|
||||
|
||||
private void kbt_Reset_Click(object sender, EventArgs e)
|
||||
{
|
||||
ktb_ParamaterCode.Text = "";
|
||||
ktb_ParamaterName.Text = "";
|
||||
kdtp_CreateStartTime.Value = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd 00:00:00"));
|
||||
kdtp_CreateEndTime.Value = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd 23:59:59"));
|
||||
kdtp_CreateStartTime.Checked = false;
|
||||
kdtp_CreateEndTime.Checked = false;
|
||||
}
|
||||
|
||||
private void kbt_Edit_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (kryptonDataGridView1.SelectedRows.Count > 0)
|
||||
{
|
||||
frmEditParamater frm = new frmEditParamater();
|
||||
frm.ParamaterId = kryptonDataGridView1.SelectedRows[0].Cells[0].Value.ToString();
|
||||
frm.ShowDialog();
|
||||
}
|
||||
else
|
||||
{
|
||||
KryptonMessageBox.Show(_InfoLanguageTextList.GetInfoText("请选择要编辑的参数信息数据行!", "SelectWantToEditRow"));
|
||||
}
|
||||
}
|
||||
|
||||
private void kryptonButton1_Click(object sender, EventArgs e)
|
||||
{
|
||||
//if (!PlcOperationHelper.Instance.isConn)
|
||||
//{
|
||||
// KryptonMessageBox.Show("The PLC is disconnected and unable to operate the equipment.");
|
||||
// return;
|
||||
//}
|
||||
frmSwitchRunDirection frm = new frmSwitchRunDirection();
|
||||
frm.ShowDialog();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user