Files
CleanMachine/CleanMachineHMI/frmChild/frmEditWorkingPalletData.cs

130 lines
5.5 KiB
C#
Raw Normal View History

2021-12-26 21:30:02 +08:00
using Krypton.Toolkit;
2021-06-05 14:17:30 +08:00
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();
}
2022-03-18 21:25:34 +08:00
2021-06-05 14:17:30 +08:00
public string PalletCode { get; set; }
private void frmEditWorkingPalletData_Load(object sender, EventArgs e)
{
try
{
2022-03-18 19:06:26 +08:00
this.SetFormControlText();
2021-06-05 14:17:30 +08:00
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();
}
2022-03-19 12:46:23 +08:00
kryptonDataGridView1.SetDataViewColumnText(this.Name);
2021-06-05 14:17:30 +08:00
}
}
catch (Exception ex)
{
2022-05-06 08:45:56 +08:00
KryptonMessageBox.Show(this.T("编辑作业托盘数据界面加载异常", "LoadEditFrmExp") + $":【{ex.Message}】!");
2021-06-05 14:17:30 +08:00
}
}
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]*)$"))
{
2022-05-06 12:28:16 +08:00
string sql = $@"update CM_WORKING_PALLET_DTL set CURRENT_NUMBER = '{item.Cells[5].Value}',OPERATE_USER_ID = '{Global.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 = '{Global.UserInfo.UserId}',OPERATE_USER_TIME = datetime('now', 'localtime'),DATA_VERSION = DATA_VERSION + 1 where WORKING_PALLET_DTL_ID = '{workingDtlId}'";
2021-06-05 14:17:30 +08:00
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)
{
2022-05-06 08:45:56 +08:00
KryptonMessageBox.Show(this.T("编辑作业托盘数据异常", "EditWorkingPalletDataExp") + $":【{ex.Message}】!");
2021-06-05 14:17:30 +08:00
}
}
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)
{
}
}
}