using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using CoreFS.CA06; namespace Core.LZMes.Client.UIM { /*中间库废次品数据查询*/ public partial class UIM010320 : FrmBase { public UIM010320() { InitializeComponent(); } //工具栏事件处理 public override void ToolBar_Click(object sender, string ToolbarKey) { switch (ToolbarKey) { case "Query": this.doQuery(); break; case "Out": this.doOut(); break; case "Export": this.doExport(); break; case "Exit": this.doClose(); break; } } //查询废次品信息 private void doQuery() { try { this.dataSet1.Tables[0].Clear(); string coilNo = this.ultraTextEditor1.Text; string fromTime = this.ultraDateTimeEditor1.DateTime.ToString("yyyyMMdd"); string toTime = this.ultraDateTimeEditor2.DateTime.ToString("yyyyMMdd"); CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "UIM.UIM010320"; ccp.MethodName = "query"; ccp.ServerParams = new object[] { coilNo, fromTime, toTime }; ccp.SourceDataTable = this.dataSet1.Tables[0]; this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal); } catch (Exception e) { MessageBox.Show(e.ToString()); } } //导出废品信息 private void doExport() { try { if (this.saveFileDialog1.ShowDialog(this) == DialogResult.OK) { this.ultraGrid1.DisplayLayout.Bands[0].Columns["CHK"].Hidden = true; string fileName = this.saveFileDialog1.FileName; ultraGridExcelExporter1.Export(ultraGrid1, fileName); System.Diagnostics.Process.Start(fileName); this.ultraGrid1.DisplayLayout.Bands[0].Columns["CHK"].Hidden = false; } } catch (Exception EX) { MessageBox.Show(EX.ToString()); } } //退出功能 private void doClose() { try { DialogResult dr = MessageBox.Show("确定退出系统吗?", "提示", MessageBoxButtons.OKCancel); if (dr == DialogResult.OK) { this.Dispose(); } else { return; } }catch(Exception e){ MessageBox.Show(e.ToString()); } } //复选框点击处理 private void ultraGrid1_CellChange(object sender, Infragistics.Win.UltraWinGrid.CellEventArgs e) { if (e.Cell.Column.Key == "CHK") { if (!Convert.ToBoolean(e.Cell.Value)) { for (int i = 0; i < ultraGrid1.Rows.Count; i++) { ultraGrid1.Rows[i].Cells["CHK"].Value = false; } e.Cell.Value = true; } else { e.Cell.Value = false; } } } //出库功能 public void doOut() { try { bool flag = false; for (int i = 0; i < ultraGrid1.Rows.Count; i++) { if (Convert.ToBoolean(ultraGrid1.Rows[i].Cells["CHK"].Value)) { flag = true; break; } } if (!flag) { MessageBox.Show("请选择需要出库的钢卷!"); return; } string coilNo = this.ultraGrid1.ActiveRow.Cells["OLD_SAMPL_NO"].Text; string regID = this.UserInfo.GetUserID();//出库人 string trnfShift = this.UserInfo.GetUserOrder();//出库班次 string trnfGroup = this.UserInfo.GetUserGroup();//出库班组 string trnfDtime = this.ultraDateTimeEditor3.Value != null ? this.ultraDateTimeEditor3.DateTime.ToString("yyyyMMddHHmmss") : "";//出库时间 CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "UIM.UIM010320"; ccp.MethodName = "out"; ccp.ServerParams = new object[] { coilNo, regID, trnfShift, trnfGroup, trnfDtime}; this.ExecuteNonQuery(ccp, CoreInvokeType.Internal); if (0 == ccp.ReturnCode) { MessageBox.Show("出库成功!"); } doQuery(); } catch (Exception e) { MessageBox.Show(e.ToString()); } } } }