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 System.Collections; using CoreFS.CA06; using Infragistics.Win.UltraWinGrid; using Infragistics.Win; using Newtonsoft.Json; using Newtonsoft.Json.Linq; namespace Core.LZMes.Client.QCM { public partial class QCM0208 : FrmBase { public QCM0208() { InitializeComponent(); } private void QCM0208_Load(object sender, EventArgs e) { dateTimePicker1.Value = DateTime.Now.Date.AddDays(-1); dateTimePicker2.Value = DateTime.Now.Date.AddDays(1); ValueList v = new ValueList(); v.ValueListItems.Add("0", "未发送"); v.ValueListItems.Add("2", "已接收"); v.ValueListItems.Add("3", "已完成"); v.ValueListItems.Add("7", "确认接收"); this.ultraGrid1.DisplayLayout.Bands[0].Columns["STATUS"].ValueList = v.Clone(); this.ultraGrid2.DisplayLayout.Bands[0].Columns["STATUS"].ValueList = v.Clone(); } public override void ToolBar_Click(object sender, string ToolbarKey) { switch (ToolbarKey) { case "Query": this.DoQuery(); break; case "InExport": break; } } #region 查询按钮 private void button1_Click(object sender, EventArgs e) { this.DoQuery(); } #endregion #region 查询 private void DoQuery() { try { String STARTTIME = this.dateTimePicker1.Value.ToString("yyyy-MM-dd"); String ENDTIME = this.dateTimePicker2.Value.ToString("yyyy-MM-dd"); String BATCH_NO = this.textBox1.Text.Trim(); String SPECIMEN_NO = this.textBox2.Text.Trim(); if (this.checkBox2.Checked) { STARTTIME = ""; ENDTIME = ""; } else { BATCH_NO = ""; } if (this.checkBox1.Checked) { STARTTIME = ""; ENDTIME = ""; } else { SPECIMEN_NO = ""; } Hashtable ht = new Hashtable(); ht.Add("STARTTIME", STARTTIME);// ht.Add("ENDTIME", ENDTIME);// ht.Add("BATCH_NO", BATCH_NO);// ht.Add("SPECIMEN_NO", SPECIMEN_NO);// CoreClientParam ccp = new CoreClientParam(); this.dataSet1.Clear(); ccp.ServerName = "QCM.JHY01.JHY0102.QuerryJhyQtly"; ccp.MethodName = "getZHBLRA"; ccp.SourceDataTable = this.dataSet1.Tables[0]; ccp.ServerParams = new object[] { ht }; this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal); ClsControlPack.RefreshAndAutoSize(ultraGrid1); } catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex.ToString()); MessageBox.Show("查询异常!", "警告"); } } private void ultraGrid1_AfterRowActivate(object sender, EventArgs e) { try { int num = this.ultraGrid1.Rows.Count(); if (num >= 1) { String SPECIMEN_NO = this.ultraGrid1.ActiveRow.Cells["SPECIMEN_NO"].Value.ToString(); Hashtable ht = new Hashtable(); ht.Add("SPECIMEN_NO", SPECIMEN_NO); CoreClientParam ccp = new CoreClientParam(); this.dataSet2.Clear(); ccp.ServerName = "QCM.JHY01.JHY0102.QuerryJhyQtly"; ccp.MethodName = "getZHBLRAITEM"; ccp.SourceDataTable = this.dataSet2.Tables[0]; ccp.ServerParams = new object[] { ht }; this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal); ClsControlPack.RefreshAndAutoSize(ultraGrid2); } else { this.dataSet1.Clear(); this.dataSet2.Clear(); } } catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex.ToString()); MessageBox.Show("查询异常!", "警告"); } } #endregion #region 修改 private void button2_Click(object sender, EventArgs e) { try { int num = 0; String SPECIMEN_NO_CK = ""; //判断勾选了几个轧批 foreach (UltraGridRow ugr in this.ultraGrid2.Rows) { if (ugr.Cells["CHECK"].Value.ToString().ToLower() == "true") { String BATCH_NO = ugr.Cells["BATCH_NO"].Value.ToString(); String STATUS = ugr.Cells["STATUS"].Value.ToString(); if (!"0".Equals(STATUS)) { this.alert("轧批[" + BATCH_NO +"]已下发委托不能修改为这个轧批,请先撤销委托再操作或换成其它未下发的轧批!"); return; } num = num + 1; SPECIMEN_NO_CK = ugr.Cells["SPECIMEN_NO"].Value.ToString(); } } if (num != 1) { this.alert("加做冲击只能勾选一个轧批做为送样的LRA,不可勾选多条数据请核实数据!"); return; } String SPECIMEN_NO = this.ultraGrid1.ActiveRow.Cells["SPECIMEN_NO"].Value.ToString(); Hashtable ht = new Hashtable(); ht.Add("SPECIMEN_NO", SPECIMEN_NO); ht.Add("SPECIMEN_NO_CK", SPECIMEN_NO_CK); ht.Add("USER_ID", this.UserInfo.GetUserID()); ht.Add("USER_NAME", this.UserInfo.GetUserName()); CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "QCM.JHY01.JHY0102.UpdateInfo"; ccp.MethodName = "UPZHBLRA"; ccp.ServerParams = new object[] { ht }; ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal); if (ccp.ReturnCode != -1) { MessageBox.Show("修改成功", "提示", MessageBoxButtons.OK, MessageBoxIcon.None); } } catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex.ToString()); MessageBox.Show("查询异常!", "警告"); } } #endregion private void checkBox2_Click(object sender, EventArgs e) { if (this.checkBox2.Checked) { this.dateTimePicker1.Enabled = false; this.dateTimePicker2.Enabled = false; this.textBox1.Enabled = true; } else { if (!this.checkBox1.Checked && !this.checkBox2.Checked ) { this.dateTimePicker1.Enabled = true; this.dateTimePicker2.Enabled = true; } this.textBox1.Enabled = false; } } private void checkBox1_Click(object sender, EventArgs e) { if (this.checkBox1.Checked) { this.dateTimePicker1.Enabled = false; this.dateTimePicker2.Enabled = false; this.textBox2.Enabled = true; } else { if (!this.checkBox1.Checked && !this.checkBox2.Checked) { this.dateTimePicker1.Enabled = true; this.dateTimePicker2.Enabled = true; } this.textBox2.Enabled = false; } } } }