添加项目文件。
This commit is contained in:
135
CleanMachineHMI/frmChild/frmAddSheetType.cs
Normal file
135
CleanMachineHMI/frmChild/frmAddSheetType.cs
Normal file
@@ -0,0 +1,135 @@
|
||||
using CleanMachineHMI.forms;
|
||||
using CleanMachineHMI.FrmUserControl;
|
||||
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.frmChild
|
||||
{
|
||||
public partial class frmAddSheetType : KryptonForm
|
||||
{
|
||||
public frmAddSheetType()
|
||||
{
|
||||
InitializeComponent();
|
||||
_InfoLanguageTextList = this.GetInfoLanguageText(GlobalHelper.LanguageCode);
|
||||
}
|
||||
private DataTable _InfoLanguageTextList;
|
||||
|
||||
private void btnAdd_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (string.IsNullOrEmpty(txtSheetTypeCode.Text))
|
||||
{
|
||||
//KryptonMessageBox.Show("请输入板材编码!");
|
||||
KryptonMessageBox.Show(_InfoLanguageTextList.GetInfoText("请输入板材编码!", "EnterSheetTypeCodeInfo"));
|
||||
return;
|
||||
}
|
||||
if (string.IsNullOrEmpty(txtSheetTypeName.Text))
|
||||
{
|
||||
//KryptonMessageBox.Show("请输入板材名称!");
|
||||
KryptonMessageBox.Show(_InfoLanguageTextList.GetInfoText("请输入板材名称!", "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,
|
||||
'{GlobalHelper.UserInfo.USER_ID}',
|
||||
datetime('now', 'localtime'),
|
||||
'{GlobalHelper.UserInfo.USER_ID}',
|
||||
datetime('now', 'localtime'),
|
||||
0,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL
|
||||
);
|
||||
";
|
||||
int row = LeadDbHelperSQLite.ExecuteSql(sql);
|
||||
if (row > 0)
|
||||
{
|
||||
//KryptonMessageBox.Show("新增板材数据成功!");
|
||||
KryptonMessageBox.Show(_InfoLanguageTextList.GetInfoText("新增板材数据成功!", "AddSuccessInfo"));
|
||||
frmSheetType.RefreshFrmHost();
|
||||
this.Close();
|
||||
}
|
||||
else
|
||||
{
|
||||
//KryptonMessageBox.Show("新增板材数据失败!");
|
||||
KryptonMessageBox.Show(_InfoLanguageTextList.GetInfoText("新增板材数据失败!", "AddFailInfo"));
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
KryptonMessageBox.Show(_InfoLanguageTextList.GetInfoText("新增板材类型数据发生异常", "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(GlobalHelper.LanguageCode);
|
||||
kryptonPanel1.Focus();
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user