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 WMS.Business; using WMS.Common; using WMS.DBUtility; using WMS.Frm.Base; using WMS.Model.CK; using WMS.Model.RK; namespace WMS.FrmReport { public partial class FrmEc : FormBase { string plcId = ""; string type = ""; string locid = ""; String outstand = ""; public FrmEc() { InitializeComponent(); } /// /// 清空按钮 /// public void Clear() { //if (SystemCommon.ShowMessageBoxResultCancel("确定要删除任务吗?") == DialogResult.OK) //{ // IBussFactory.Instance().DeleteEcxeData(plcId, type); // BindData(); //} } public (string password, string number) GetPasswordAndNumber() { string sql = "select * from T_CK_NUMBER"; DataSet result = OracleHelper.ExecuteDataset(CommandType.Text, sql); string password = result.Tables[0].Rows[0]["PASSWORD"].ToString(); string number = result.Tables[0].Rows[0]["NUM"].ToString(); return (password, number); } private void ctrlButtons4_Click(object sender, EventArgs e) { if (locid.Trim().Length == 0) { SystemCommon.ShowInfoMessageBox("库位为空不能出库"); return; } if (SystemCommon.ShowMessageBoxResultCancel("确定要完成任务吗?") == DialogResult.OK) { var (password, num) = GetPasswordAndNumber();//获取两个值 TextBox txtInput = new TextBox { Width = 200, PasswordChar = '*', Anchor = AnchorStyles.None // 取消锚定,便于居中 }; Form prompt = new Form { Width = 300, Height = 150, Text = "密码验证", StartPosition = FormStartPosition.CenterScreen, FormBorderStyle = FormBorderStyle.FixedDialog, // 固定对话框样式 MaximizeBox = false, MinimizeBox = false }; System.Windows.Forms.Label lblPrompt = new System.Windows.Forms.Label { Text = "请输入密码:", AutoSize = true, Anchor = AnchorStyles.None // 取消锚定 }; Button btnOK = new Button { Text = "确定", Width = 80, Anchor = AnchorStyles.None }; // 使用 TableLayoutPanel 实现居中布局 TableLayoutPanel tableLayout = new TableLayoutPanel { Dock = DockStyle.Fill, ColumnCount = 1, RowCount = 3, Padding = new Padding(20) }; // 添加控件到 TableLayoutPanel tableLayout.Controls.Add(lblPrompt, 0, 0); tableLayout.Controls.Add(txtInput, 0, 1); tableLayout.Controls.Add(btnOK, 0, 2); // 设置行和列的样式 tableLayout.RowStyles.Add(new RowStyle(SizeType.AutoSize)); tableLayout.RowStyles.Add(new RowStyle(SizeType.AutoSize)); tableLayout.RowStyles.Add(new RowStyle(SizeType.AutoSize)); // 设置控件在单元格内的居中 lblPrompt.Anchor = AnchorStyles.None; txtInput.Anchor = AnchorStyles.None; btnOK.Anchor = AnchorStyles.None; // 按钮点击事件 btnOK.Click += (s, ev) => prompt.Close(); // 将 TableLayoutPanel 添加到窗体 prompt.Controls.Add(tableLayout); prompt.ShowDialog(); if (txtInput.Text != password) { SystemCommon.ShowErrorMessageBox("密码验证失败"); return; } IBussFactory.Instance().UpdateEcxeData(plcId, type, "9"); BindData(); } } private void gridView3_RowClick(object sender, DevExpress.XtraGrid.Views.Grid.RowClickEventArgs e) { if (gridView3.RowCount > 0) { locid = gridView3.GetFocusedRowCellValue("LOCATION_ID").ToString(); plcId = gridView3.GetFocusedRowCellValue("PlcID").ToString(); type = "in"; } } void BindData() { DataTable ds = IBussFactory.Instance().GetexceData2(); if (ds != null) { List ckgoodsInfo = ConvertHelper.ConvertToList(ds); bgc_outMx.DataSource = ckgoodsInfo; } //DataTable ds2 = IBussFactory.Instance().GetexceData(); //if (ds2 != null) //{ // List RkgoodsInfo = ConvertHelper.ConvertToList(ds2); // bindingSource1.DataSource = RkgoodsInfo; //} } private void FrmEc_Load(object sender, EventArgs e) { BindData(); } private void gdv_Kcmx_RowClick(object sender, DevExpress.XtraGrid.Views.Grid.RowClickEventArgs e) { if (gdv_Kcmx.RowCount > 0) { plcId = gdv_Kcmx.GetFocusedRowCellValue("plcId").ToString(); locid = gdv_Kcmx.GetFocusedRowCellValue("LOC_ID").ToString(); //outstand= gdv_Kcmx.GetFocusedRowCellValue("outstand").ToString(); type = "out"; } } private void UPDATE_STAKER() { } private void ctrlButtons2_Click(object sender, EventArgs e) { BindData(); } private void ctrlButtons1_Click(object sender, EventArgs e) { //if (SystemCommon.ShowMessageBoxResultCancel("确定要删除任务吗?") == DialogResult.OK) //{ // IBussFactory.Instance().DeleteEcxeData(plcId, type); // BindData(); //} } private void ctrlButtons3_Click(object sender, EventArgs e) { if (SystemCommon.ShowMessageBoxResultCancel("确定要删除任务吗?") == DialogResult.OK) { IBussFactory.Instance().DeleteEcxeData(plcId, "0"); BindData(); } } private void ctrlButtons1_Click_1(object sender, EventArgs e) { if (SystemCommon.ShowMessageBoxResultCancel("确定要优先执行吗?") == DialogResult.OK) { var (password, num) = GetPasswordAndNumber();//获取两个值 TextBox txtInput = new TextBox { Width = 200, PasswordChar = '*', Anchor = AnchorStyles.None // 取消锚定,便于居中 }; Form prompt = new Form { Width = 300, Height = 150, Text = "密码验证", StartPosition = FormStartPosition.CenterScreen, FormBorderStyle = FormBorderStyle.FixedDialog, // 固定对话框样式 MaximizeBox = false, MinimizeBox = false }; System.Windows.Forms.Label lblPrompt = new System.Windows.Forms.Label { Text = "请输入密码:", AutoSize = true, Anchor = AnchorStyles.None // 取消锚定 }; Button btnOK = new Button { Text = "确定", Width = 80, Anchor = AnchorStyles.None }; // 使用 TableLayoutPanel 实现居中布局 TableLayoutPanel tableLayout = new TableLayoutPanel { Dock = DockStyle.Fill, ColumnCount = 1, RowCount = 3, Padding = new Padding(20) }; // 添加控件到 TableLayoutPanel tableLayout.Controls.Add(lblPrompt, 0, 0); tableLayout.Controls.Add(txtInput, 0, 1); tableLayout.Controls.Add(btnOK, 0, 2); // 设置行和列的样式 tableLayout.RowStyles.Add(new RowStyle(SizeType.AutoSize)); tableLayout.RowStyles.Add(new RowStyle(SizeType.AutoSize)); tableLayout.RowStyles.Add(new RowStyle(SizeType.AutoSize)); // 设置控件在单元格内的居中 lblPrompt.Anchor = AnchorStyles.None; txtInput.Anchor = AnchorStyles.None; btnOK.Anchor = AnchorStyles.None; // 按钮点击事件 btnOK.Click += (s, ev) => prompt.Close(); // 将 TableLayoutPanel 添加到窗体 prompt.Controls.Add(tableLayout); prompt.ShowDialog(); if (txtInput.Text != password) { SystemCommon.ShowErrorMessageBox("密码验证失败"); return; } IBussFactory.Instance().UpDate_TaskTime(plcId); BindData(); } } } }