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; using LeadDataBaseUtility; using System.Text.RegularExpressions; using CleanMachineHMI.Utils; using CleanMachineHMI.FrmUserControl; namespace CleanMachineHMI.frmChild { public partial class frmEditWorkingPalletData : KryptonForm { public frmEditWorkingPalletData() { InitializeComponent(); } public string PalletCode { get; set; } private void frmEditWorkingPalletData_Load(object sender, EventArgs e) { try { this.SetFormControlText(); string sql = $@"select * from VW_WORKING_PALLET_MSG where WORKING_PALLET_CODE = '{PalletCode}'"; DataTable dt = LeadDbHelperSQLite.Query(sql).Tables[0]; if (dt != null && dt.Rows.Count > 0) { kryptonDataGridView1.Rows.Clear(); foreach (DataRow item in dt.Rows) { int index = kryptonDataGridView1.Rows.Add(); kryptonDataGridView1.Rows[index].Cells[0].Value = item["WORKING_PALLET_DTL_ID"].ToString(); kryptonDataGridView1.Rows[index].Cells[1].Value = item["CLEAN_MODE_NAME"].ToString(); kryptonDataGridView1.Rows[index].Cells[2].Value = item["CONTAMINATION_TYPE_NAME"].ToString(); kryptonDataGridView1.Rows[index].Cells[3].Value = item["CONTAMINATION_DTL_NAME"].ToString(); kryptonDataGridView1.Rows[index].Cells[4].Value = item["CURRENT_NUMBER"].ToString(); kryptonDataGridView1.Rows[index].Cells[6].Value = item["IR_CODE"].ToString(); kryptonDataGridView1.Rows[index].Cells[7].Value = item["WORKING_PALLET_CODE"].ToString(); kryptonDataGridView1.Rows[index].Cells[8].Value = item["SHEET_TYPE_NAME"].ToString(); kryptonDataGridView1.Rows[index].Cells[9].Value = item["INPUT_TIME"].ToString(); } kryptonDataGridView1.SetDataViewColumnText(this.Name, GlobalHelper.LanguageCode); } } catch (Exception ex) { KryptonMessageBox.Show(this.GetInfoText("编辑作业托盘数据界面加载异常", "LoadEditFrmExp") + $":【{ex.Message}】!"); } } private void kbtn_Confirm_Click(object sender, EventArgs e) { try { int rowIndex = 0; foreach (DataGridViewRow item in kryptonDataGridView1.Rows) { rowIndex++; string workingDtlId = item.Cells[0].Value.ToString(); if (item.Cells[5].Value != null) { if (Regex.IsMatch(item.Cells[5].Value.ToString(), "^([1-9][0-9]*)$")) { string sql = $@"update CM_WORKING_PALLET_DTL set CURRENT_NUMBER = '{item.Cells[5].Value}',OPERATE_USER_ID = '{GlobalHelper.UserInfo.UserId}',OPERATE_USER_TIME = datetime('now', 'localtime'),DATA_VERSION = DATA_VERSION + 1 where WORKING_PALLET_DTL_ID = '{workingDtlId}'"; string sql1 = $@"update ZBK_WORKING_PALLET_DTL set CURRENT_NUMBER = '{item.Cells[5].Value}',OPERATE_USER_ID = '{GlobalHelper.UserInfo.UserId}',OPERATE_USER_TIME = datetime('now', 'localtime'),DATA_VERSION = DATA_VERSION + 1 where WORKING_PALLET_DTL_ID = '{workingDtlId}'"; LeadDbHelperSQLite.ExecuteSql(sql); LeadDbHelperSQLite.ExecuteSql(sql1); } else { //KryptonMessageBox.Show($"第:{rowIndex}行输入的更改数量,不是正整数!"); KryptonMessageBox.Show($"The number of changes entered in line: {rowIndex} is not a positive integer!"); } } } frmPrinterMain.RefreshFrmHost(); KryptonMessageBox.Show($"Edit Success!"); this.Close(); } catch (Exception ex) { KryptonMessageBox.Show(this.GetInfoText("编辑作业托盘数据异常", "EditWorkingPalletDataExp") + $":【{ex.Message}】!"); } } private void kbtn_Cancel_Click(object sender, EventArgs e) { this.Close(); } private void kryptonDataGridView1_CellLeave(object sender, DataGridViewCellEventArgs e) { if (e.ColumnIndex == 5) { BeginInvoke(new Action(() => { KeyboardAutoPopUp.HideInputPanel(); })); } } private void kryptonDataGridView1_DataError(object sender, DataGridViewDataErrorEventArgs e) { } private void kryptonDataGridView1_CellBeginEdit(object sender, DataGridViewCellCancelEventArgs e) { if (e.ColumnIndex == 5) { BeginInvoke(new Action(() => { KeyboardAutoPopUp.ShowInputPanel(); })); } } private void kryptonDataGridView1_CellContentDoubleClick(object sender, DataGridViewCellEventArgs e) { } } }