2021-06-05 14:17:30 +08:00
|
|
|
|
using CleanMachineHMI.forms;
|
|
|
|
|
|
using CleanMachineHMI.FrmUserControl;
|
|
|
|
|
|
using CleanMachineHMI.Utils;
|
2021-12-26 21:30:02 +08:00
|
|
|
|
using Krypton.Toolkit;
|
2021-06-05 14:17:30 +08:00
|
|
|
|
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.frmChild
|
|
|
|
|
|
{
|
|
|
|
|
|
public partial class frmAddCleanCode : KryptonForm
|
|
|
|
|
|
{
|
|
|
|
|
|
public frmAddCleanCode()
|
|
|
|
|
|
{
|
|
|
|
|
|
InitializeComponent();
|
|
|
|
|
|
_InfoLanguageTextList = this.GetInfoLanguageText(GlobalHelper.LanguageCode);
|
|
|
|
|
|
}
|
|
|
|
|
|
private DataTable _InfoLanguageTextList;
|
|
|
|
|
|
|
|
|
|
|
|
private void frmAddCleanCode_Load(object sender, EventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
InitControlEvent();
|
2022-03-18 19:06:26 +08:00
|
|
|
|
this.SetFormControlText();
|
2021-06-05 14:17:30 +08:00
|
|
|
|
}
|
|
|
|
|
|
private void txt_GotFocus(object sender, EventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
KeyboardAutoPopUp.ShowInputPanel();
|
|
|
|
|
|
}
|
|
|
|
|
|
private void txt_LostFocus(object sender, EventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
KeyboardAutoPopUp.HideInputPanel();
|
|
|
|
|
|
}
|
|
|
|
|
|
private void InitControlEvent()
|
|
|
|
|
|
{
|
|
|
|
|
|
txtCleanModeCode.GotFocus += new EventHandler(txt_GotFocus); //获取焦点前发生事件
|
|
|
|
|
|
txtCleanModeCode.LostFocus += new EventHandler(txt_LostFocus); //失去焦点后发生事件
|
|
|
|
|
|
|
|
|
|
|
|
txtCleanModeName.GotFocus += new EventHandler(txt_GotFocus); //获取焦点前发生事件
|
|
|
|
|
|
txtCleanModeName.LostFocus += new EventHandler(txt_LostFocus); //失去焦点后发生事件
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void btnAdd_Click(object sender, EventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
try
|
|
|
|
|
|
{
|
|
|
|
|
|
if (string.IsNullOrEmpty(txtCleanModeCode.Text))
|
|
|
|
|
|
{
|
2022-03-18 19:06:26 +08:00
|
|
|
|
KryptonMessageBox.Show(this.GetInfoText("请输入清洗方式编码!", "EnterCleanCodeInfo"));
|
2021-06-05 14:17:30 +08:00
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
if (string.IsNullOrEmpty(txtCleanModeName.Text))
|
|
|
|
|
|
{
|
2022-03-18 19:06:26 +08:00
|
|
|
|
KryptonMessageBox.Show(this.GetInfoText("请输入清洗方式名称!", "EnterCleanNameInfo"));
|
2021-06-05 14:17:30 +08:00
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
string sqlIsExistCode = $@"SELECT 1 FROM BAS_CLEAN_MODE WHERE CLEAN_MODE_CODE = '{txtCleanModeCode.Text}'";
|
|
|
|
|
|
DataTable dtIsExistCode = LeadDbHelperSQLite.Query(sqlIsExistCode).Tables[0];
|
|
|
|
|
|
if (dtIsExistCode != null && dtIsExistCode.Rows.Count > 0)
|
|
|
|
|
|
{
|
|
|
|
|
|
//KryptonMessageBox.Show($"清洗方式条码:【{txtCleanModeCode.Text}】已经存在,请重新输入!");
|
|
|
|
|
|
KryptonMessageBox.Show($"Clean methol code: 【{txtCleanModeCode.Text}】already exist, please re-enter!");
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
string sql = $@"
|
|
|
|
|
|
INSERT INTO BAS_CLEAN_MODE (
|
|
|
|
|
|
CLEAN_MODE_CODE,
|
|
|
|
|
|
CLEAN_MODE_NAME,
|
|
|
|
|
|
USED_FLAG,
|
|
|
|
|
|
DEL_FLAG,
|
|
|
|
|
|
CREATE_BY,
|
|
|
|
|
|
CREATE_TIME,
|
|
|
|
|
|
UPDATE_BY,
|
|
|
|
|
|
UPDATE_TIME,
|
|
|
|
|
|
DATA_VERSION,
|
|
|
|
|
|
REMARKS1,
|
|
|
|
|
|
REMARKS2,
|
|
|
|
|
|
REMARKS3,
|
|
|
|
|
|
REMARKS4,
|
|
|
|
|
|
REMARKS5
|
|
|
|
|
|
)
|
|
|
|
|
|
VALUES
|
|
|
|
|
|
(
|
|
|
|
|
|
'{txtCleanModeCode.Text}',
|
|
|
|
|
|
'{txtCleanModeName.Text}',
|
|
|
|
|
|
1,
|
|
|
|
|
|
0,
|
2021-12-31 16:27:14 +08:00
|
|
|
|
'{GlobalHelper.UserInfo.UserId}',
|
2021-06-05 14:17:30 +08:00
|
|
|
|
datetime('now', 'localtime'),
|
2021-12-31 16:27:14 +08:00
|
|
|
|
'{GlobalHelper.UserInfo.UserId}',
|
2021-06-05 14:17:30 +08:00
|
|
|
|
datetime('now', 'localtime'),
|
|
|
|
|
|
0,
|
|
|
|
|
|
NULL,
|
|
|
|
|
|
NULL,
|
|
|
|
|
|
NULL,
|
|
|
|
|
|
NULL,
|
|
|
|
|
|
NULL
|
|
|
|
|
|
);
|
|
|
|
|
|
";
|
|
|
|
|
|
int row = LeadDbHelperSQLite.ExecuteSql(sql);
|
|
|
|
|
|
if (row > 0)
|
|
|
|
|
|
{
|
2022-03-18 19:06:26 +08:00
|
|
|
|
KryptonMessageBox.Show(this.GetInfoText("新增清洗方式数据成功!", "AddSuccessInfo"));
|
2021-06-05 14:17:30 +08:00
|
|
|
|
frmCleanMode.RefreshFrmHost();
|
|
|
|
|
|
this.Close();
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
2022-03-18 19:06:26 +08:00
|
|
|
|
KryptonMessageBox.Show(this.GetInfoText("新增清洗方式数据失败!", "AddFailInfo"));
|
2021-06-05 14:17:30 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
|
{
|
2022-03-18 19:06:26 +08:00
|
|
|
|
KryptonMessageBox.Show(this.GetInfoText("新增清洗方式数据发生异常", "AddCleanModeDataExp") + $":【{ex.Message}】!");
|
2021-06-05 14:17:30 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void btnEdit_Click(object sender, EventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
this.Close();
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|