| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239 |
- 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;
- using System.Collections;
- using Infragistics.Win.UltraWinGrid;
- using System.Diagnostics;
- namespace Core.LZMes.Client.QCM
- {
- public partial class QCM030805 : FrmBase
- {
- public QCM030805()
- {
- InitializeComponent();
- }
- public override void ToolBar_Click(object sender, string ToolbarKey)
- {
- switch (ToolbarKey)
- {
- case"Query":
- this.DoQuery();
- break;
- case "Update":
- this.Edit();
- break;
- case "Update1":
- this.Update1();
- break;
- case "Export":
- this.DoExport();
- break;
- }
- }
- private void Edit()
- {
- try
- {
- UltraGridRow ugr = this.ultraGrid2.ActiveRow;
- if (ugr == null)
- return;
- string heat_no = ugr.Cells["HEAT_NO"].Value.ToString();
- string assay_no = ugr.Cells["ASSAY_NO"].Value.ToString();
- string pline_code = ugr.Cells["pline_code"].Value.ToString();
- if(String.IsNullOrEmpty(txt_heat_no.Text.Trim())) {
- MessageBox.Show("修改号炉号不能为空!!");
- return;
- }
- if(String.IsNullOrEmpty(txt_assay_no.Text.Trim())) {
- MessageBox.Show("修改号检验号不能为空!!");
- return;
- }
- string new_heat_no = txt_heat_no.Text.Trim();
- string new_assay_no = txt_assay_no.Text.Trim();
- if (MessageBox.Show("是否确认把炉号:" + heat_no + " 检验号 " + assay_no + " 修改为【" + new_heat_no + "】【" + new_assay_no + "】!", "提示", MessageBoxButtons.YesNo) == DialogResult.No) return;
- ArrayList list1 = new ArrayList();
- list1.Add(heat_no);
- list1.Add(assay_no);
- list1.Add(pline_code);
- list1.Add(new_heat_no);
- list1.Add(new_assay_no);
- list1.Add(this.UserInfo.GetUserName());
- CoreClientParam ccp = new CoreClientParam();
- ccp.ServerName = "QCM.QCM03.QCM0301.QcmJhyElementsServiceImpl";
- ccp.MethodName = "UpdateChemeInfo";
- ccp.ServerParams = new object[] { list1 };
- ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- if (ccp.ReturnCode == -1)
- {
- return;
- }
- DoQuery();
- MessageBox.Show("修改成功!");
- }
- catch(Exception EX)
- {
- MessageBox.Show(EX.ToString());
- }
- }
- public static bool IsNumberal(string input)
- {
- bool flag = true;
- int count = 0;
- int count1 = 0;
- if (input.Length == 0)
- {
- flag = false;
- }
- else
- {
- char[] x = input.ToCharArray();
- for (int i = 0; i < input.Length; i++)
- {
- if (!char.IsNumber(x[i]) && x[i] != '.' && x[i] != '-')
- {
- flag = false; break;
- }
- if (x[i] == '.')
- {
- count++;
- if (i == 0 || i == input.Length - 1) flag = false;
- }
- if (x[i] == '-')
- {
- count1++;
- if (i > 1) flag = false;
- }
- }
- if (count > 1 || count1 > 1) flag = false;
- }
- return flag;
- }
- private void Update1()
- {
- try
- {
- UltraGridRow ugr = this.ultraGrid2.ActiveRow;
- if (ugr == null)
- return;
- string assay_no = ugr.Cells["ASSAY_NO"].Value.ToString();
- string heat_no = ugr.Cells["HEAT_NO"].Value.ToString();
- if (String.IsNullOrEmpty(this.textBox2.Text.Trim()) && String.IsNullOrEmpty(this.textBox3.Text.Trim()))
- {
- MessageBox.Show("成分信息不能为空!");
- return;
- }
- if (!IsNumberal(this.textBox2.Text.Trim()) && this.textBox2.Text.Trim() != "")
- {
- MessageBox.Show("请输入数字!");
- return;
- }
- if (!IsNumberal(this.textBox3.Text.Trim()) && this.textBox3.Text.Trim() != "")
- {
- MessageBox.Show("请输入数字!");
- return;
- }
- string new_heat_no = txt_heat_no.Text.Trim();
- string new_assay_no = txt_assay_no.Text.Trim();
- if (MessageBox.Show("是否确认修改化验号:" + assay_no + "的成分信息!", "提示", MessageBoxButtons.YesNo) == DialogResult.No) return;
- ArrayList list1 = new ArrayList();
- list1.Add(assay_no);
- list1.Add(this.textBox2.Text.Trim().ToString());
- list1.Add(this.textBox3.Text.Trim().ToString());
- list1.Add(this.UserInfo.GetUserName());
- list1.Add(heat_no);
- CoreClientParam ccp = new CoreClientParam();
- ccp.ServerName = "QCM.QCM03.QCM0301.QcmJhyElementsServiceImpl";
- ccp.MethodName = "UpdateChemeInfo1";
- ccp.ServerParams = new object[] { list1 };
- ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- if (ccp.ReturnCode == -1)
- {
- return;
- }
- DoQuery();
- MessageBox.Show("修改成功!");
- }
- catch (Exception EX)
- {
- MessageBox.Show(EX.ToString());
- }
- }
- private void DoQuery()
- {
- DoQueryMe();
- }
- //查询待判信息
- private void DoQueryMe()
- {
- try
- {
- this.dataSet3.Clear();
- string heatno = this.textBox1.Text.Trim();
- CoreClientParam ccp = new CoreClientParam();
- ccp.ServerName = "QCM.QCM03.QCM0301.QcmJhyElementsServiceImpl";
- ccp.MethodName = "GetElement";
- ccp.SourceDataTable = this.dataSet3.Tables[0];
- ccp.ServerParams = new object[] { this.dateTimePicker1.Value.ToString("yyyy-MM-dd"), this.dateTimePicker2.Value.ToString("yyyy-MM-dd"), heatno};
- this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
- }
- catch (Exception ex)
- {
- System.Diagnostics.Debug.WriteLine(ex.ToString());
- MessageBox.Show("系统出错,请联系管理人员", "警告");
- }
- }
- private void QCM030803_Load(object sender, EventArgs e)
- {
- this.ultraGrid2.DisplayLayout.Override.FilterUIType = FilterUIType.HeaderIcons;
- this.dateTimePicker1.Value = System.DateTime.Now.AddDays(-3);
- }
- private void DoExport()
- {
- try
- {
- if (this.ultraGrid2.Rows.Count == 0)
- {
- MessageBox.Show("没有可以导出的数据", "提示");
- return;
- }
- if (this.saveFileDialog1.ShowDialog(this) == DialogResult.OK)
- {
- string fName = this.saveFileDialog1.FileName;
- this.ultraGridExcelExporter1.Export(this.ultraGrid2, fName);
- Process.Start(fName);
- }
- }
- catch (Exception ex)
- {
- System.Diagnostics.Debug.WriteLine(ex.ToString());
- }
- }
- private void ultraGrid2_AfterRowActivate(object sender, EventArgs e)
- {
- UltraGridRow ugr = this.ultraGrid2.ActiveRow;
- if (ugr == null)
- return;
- txt_heat_no.Text = ugr.Cells["HEAT_NO"].Value.ToString();
- txt_assay_no.Text = ugr.Cells["ASSAY_NO"].Value.ToString();
- }
- }
- }
|