134 lines
5.2 KiB
C#
134 lines
5.2 KiB
C#
using CleanMachineHMI.forms;
|
|
using CleanMachineHMI.FrmUserControl;
|
|
using CleanMachineHMI.Utils;
|
|
using 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.frmChild
|
|
{
|
|
public partial class frmAddSheetType : KryptonForm
|
|
{
|
|
public frmAddSheetType()
|
|
{
|
|
InitializeComponent();
|
|
}
|
|
|
|
private void btnAdd_Click(object sender, EventArgs e)
|
|
{
|
|
try
|
|
{
|
|
if (string.IsNullOrEmpty(txtSheetTypeCode.Text))
|
|
{
|
|
//KryptonMessageBox.Show("请输入板材编码!");
|
|
KryptonMessageBox.Show(this.T("请输入板材编码!", "EnterSheetTypeCodeInfo"));
|
|
return;
|
|
}
|
|
if (string.IsNullOrEmpty(txtSheetTypeName.Text))
|
|
{
|
|
//KryptonMessageBox.Show("请输入板材名称!");
|
|
KryptonMessageBox.Show(this.T("请输入板材名称!", "EnterSheetTypeNameInfo"));
|
|
return;
|
|
}
|
|
string sqlIsExistCode = $@"SELECT 1 FROM BAS_SHEET_TYPE WHERE SHEET_TYPE_CODE = '{txtSheetTypeCode.Text}'";
|
|
DataTable dtIsExistCode = LeadDbHelperSQLite.Query(sqlIsExistCode).Tables[0];
|
|
if (dtIsExistCode != null && dtIsExistCode.Rows.Count > 0)
|
|
{
|
|
//KryptonMessageBox.Show($"板材条码:【{txtSheetTypeCode.Text}】已经存在,请重新输入!");
|
|
KryptonMessageBox.Show($"Sheet type code 【{txtSheetTypeCode.Text}】already exist, please re-enter!");
|
|
return;
|
|
}
|
|
string sql = $@"
|
|
INSERT INTO BAS_SHEET_TYPE (
|
|
SHEET_TYPE_CODE,
|
|
SHEET_TYPE_NAME,
|
|
USED_FLAG,
|
|
DEL_FLAG,
|
|
CREATE_BY,
|
|
CREATE_TIME,
|
|
UPDATE_BY,
|
|
UPDATE_TIME,
|
|
DATA_VERSION,
|
|
REMARKS1,
|
|
REMARKS2,
|
|
REMARKS3,
|
|
REMARKS4,
|
|
REMARKS5
|
|
)
|
|
VALUES
|
|
(
|
|
'{txtSheetTypeCode.Text}',
|
|
'{txtSheetTypeName.Text}',
|
|
1,
|
|
0,
|
|
'{Global.UserInfo.UserId}',
|
|
datetime('now', 'localtime'),
|
|
'{Global.UserInfo.UserId}',
|
|
datetime('now', 'localtime'),
|
|
0,
|
|
NULL,
|
|
NULL,
|
|
NULL,
|
|
NULL,
|
|
NULL
|
|
);
|
|
";
|
|
int row = LeadDbHelperSQLite.Execute(sql);
|
|
if (row > 0)
|
|
{
|
|
//KryptonMessageBox.Show("新增板材数据成功!");
|
|
KryptonMessageBox.Show(this.T("新增板材数据成功!", "AddSuccessInfo"));
|
|
frmSheetType.RefreshFrmHost();
|
|
this.Close();
|
|
}
|
|
else
|
|
{
|
|
//KryptonMessageBox.Show("新增板材数据失败!");
|
|
KryptonMessageBox.Show(this.T("新增板材数据失败!", "AddFailInfo"));
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
KryptonMessageBox.Show(this.T("新增板材类型数据发生异常", "AddSheetTypeDataExp") + $":【{ex.Message}】!");
|
|
}
|
|
}
|
|
|
|
private void btnEdit_Click(object sender, EventArgs e)
|
|
{
|
|
this.Close();
|
|
}
|
|
private void txt_GotFocus(object sender, EventArgs e)
|
|
{
|
|
KeyboardAutoPopUp.ShowInputPanel();
|
|
}
|
|
private void txt_LostFocus(object sender, EventArgs e)
|
|
{
|
|
KeyboardAutoPopUp.HideInputPanel();
|
|
}
|
|
private void InitControlEvent()
|
|
{
|
|
txtSheetTypeCode.GotFocus += new EventHandler(txt_GotFocus); //获取焦点前发生事件
|
|
txtSheetTypeCode.LostFocus += new EventHandler(txt_LostFocus); //失去焦点后发生事件
|
|
|
|
txtSheetTypeName.GotFocus += new EventHandler(txt_GotFocus); //获取焦点前发生事件
|
|
txtSheetTypeName.LostFocus += new EventHandler(txt_LostFocus); //失去焦点后发生事件
|
|
}
|
|
|
|
private void frmAddSheetType_Load(object sender, EventArgs e)
|
|
{
|
|
InitControlEvent();
|
|
this.SetFormControlText();
|
|
kryptonPanel1.Focus();
|
|
|
|
}
|
|
}
|
|
}
|