| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454 |
- 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 QCM030101 : FrmBase
- {
- public QCM030101()
- {
- InitializeComponent();
- }
- public override void ToolBar_Click(object sender, string ToolbarKey)
- {
- switch (ToolbarKey)
- {
- case"Query":
- this.DoQuery();
- break;
- case "Judge":
- this.Judge();
- break;
- case "Cancel":
- this.Cancel();
- break;
- case "Export":
- this.DoExport();
- break;
- }
- }
- private void Judge()
- {
- try
- {
- UltraGridRow ugr = this.ultraGrid1.ActiveRow;
- List<string> list1 = new List<string>();
- if (ugr == null)
- return;
- string smp_no = ugr.Cells["SMP_NO"].Value.ToString();
- string material_no = ugr.Cells["MATERIAL_NO"].Value.ToString();
- string design_key = ugr.Cells["DESIGN_KEY"].Value.ToString();
- string grade_name = ugr.Cells["GRADE_NAME"].Value.ToString();
- string username = this.UserInfo.GetUserName();
- string assay_no = "";
- foreach (UltraGridRow ugrs in this.ultraGrid2.Rows)
- {
- if (ugrs.Cells["CHECKBOX"].Text.ToString() == "True")
- {
- assay_no = ugrs.Cells["STD_TYPE"].Value.ToString();
- list1.Add(assay_no);
- }
- }
- if (list1.Count == 0)
- {
- MessageBox.Show("请选择检验实绩!");
- return;
- }
- CoreClientParam ccp = new CoreClientParam();
- ccp.ServerName = "QCM.QCM03.QCM0301.QcmJhyElementsServiceImpl";
- ccp.MethodName = "JudgeByHuman1";
- ccp.ServerParams = new object[] { smp_no, username, list1 };
- ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- if (ccp.ReturnCode == -1)
- {
- return;
- }
- ugr.Delete(false);
- MessageBox.Show("判定成功!");
- }
- catch (Exception EX)
- {
- MessageBox.Show(EX.ToString());
- }
-
- }
- private void Cancel()
- {
- try
- {
- UltraGridRow ugr = this.ultraGrid4.ActiveRow;
- if (ugr == null)
- return;
- string inspection_lot = ugr.Cells["inspection_lot"].Value.ToString();
- string smp_no = ugr.Cells["smp_no"].Value.ToString();
- string username = this.UserInfo.GetUserName();
- CoreClientParam ccp = new CoreClientParam();
- ccp.ServerName = "QCM.QCM03.QCM0301.QcmJudgeChemicalServiceImpl";
- ccp.MethodName = "CancelJudge";
- ccp.ServerParams = new object[] { inspection_lot,smp_no,username };
- ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- if (ccp.ReturnCode == -1)
- {
- return;
- }
- MessageBox.Show("取消判定成功!");
- }
- catch (Exception ex)
- {
- System.Diagnostics.Debug.WriteLine(ex.ToString());
- MessageBox.Show("系统出错,请联系管理人员", "警告");
- }
- }
- private void DoQuery()
- {
- if (this.ultraTabControl1.Tabs[0].Selected) //待判信息
- {
- DoQueryMe();
- }
- if (this.ultraTabControl1.Tabs[1].Selected) //判定记录
- {
- DoQueryRe();
- }
- }
- //查询待判信息
- private void DoQueryMe()
- {
- try
- {
- if (comboBox1.SelectedIndex == 2)
- {
- MessageBox.Show("请选择委托生成或者发送时间!");
- return;
- }
- this.dataSet2.Clear();
- string heatno = textBox1.Text.Trim();
- string BOARD_NO = textBox2.Text.Trim();
- string design_key = textBox3.Text.Trim();
- string psc = textBox4.Text.Trim();
- string prodline = comboBox3.Text.ToString();
- string status = this.comboBox1.SelectedIndex.ToString();
- CoreClientParam ccp = new CoreClientParam();
- ccp.ServerName = "QCM.QCM03.QCM0301.QcmJhyElementsServiceImpl";
- ccp.MethodName = "getRejudgeInfo";
- ccp.ServerParams = new object[] { this.dateTimePicker1.Value.ToString("yyyyMMdd"), this.dateTimePicker2.Value.ToString("yyyyMMdd"),heatno, BOARD_NO, design_key, psc,"1" ,prodline,status};
- ccp.SourceDataTable = this.dataSet2.Tables[0];
- this.ExecuteQueryToDataTable(ccp,CoreInvokeType.Internal);
- }
- catch (Exception ex)
- {
- System.Diagnostics.Debug.WriteLine(ex.ToString());
- MessageBox.Show("系统出错,请联系管理人员", "警告");
- }
- }
-
- //查询判定记录
- private void DoQueryRe()
- {
- try
- {
- if (comboBox1.SelectedIndex != 2)
- {
- MessageBox.Show("请选择判定时间!");
- return;
- }
- this.dataSet1.Clear();
- string heatno = textBox1.Text.Trim();
- string BOARD_NO = textBox2.Text.Trim();
- string design_key = textBox3.Text.Trim();
- string psc = textBox4.Text.Trim();
- string prodline = comboBox3.Text.ToString();
- CoreClientParam ccp = new CoreClientParam();
- ccp.ServerName = "QCM.QCM03.QCM0301.QcmJudgeChemicalServiceImpl";
- ccp.MethodName = "GetJudgeChemRecord";
- ccp.ServerParams = new object[] { this.dateTimePicker1.Value.ToString("yyyyMMdd"), this.dateTimePicker2.Value.ToString("yyyyMMdd"), heatno, BOARD_NO, design_key, psc,"1",prodline };
- ccp.SourceDataTable = this.dataSet1.Tables[0];
- this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
- }
- catch (Exception ex)
- {
- System.Diagnostics.Debug.WriteLine(ex.ToString());
- MessageBox.Show("系统出错,请联系管理人员", "警告");
- }
- }
- private void ultraGrid4_AfterRowActivate(object sender, EventArgs e)
- {
- try
- {
- UltraGridRow ugr = this.ultraGrid4.ActiveRow;
- if (ugr == null)
- return;
- this.dataSet4.Clear();
- string cic_id = ugr.Cells["CIC_ID"].Value.ToString();
- CoreClientParam ccp = new CoreClientParam();
- ccp.ServerName = "QCM.QCM03.QCM0301.QcmJhyElementsServiceImpl";
- ccp.MethodName = "GetChemeResult";
- ccp.ServerParams = new object[] { cic_id };
- ccp.SourceDataTable = this.dataSet4.Tables[0];
- this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
- ccp = new CoreClientParam();
- ccp.ServerName = "QCM.QCM03.QCM0301.QcmJhyElementsServiceImpl";
- ccp.MethodName = "GetCheme";
- ccp.ServerParams = new object[] { cic_id };
- this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
- UltraGridRow judge_row = null;
- foreach (UltraGridRow ugst in this.ultraGrid5.Rows)
- {
- if (!ugst.Cells["STD_TYPE"].Text.ToString().Contains("标准") && !ugst.Cells["STD_TYPE"].Text.ToString().Contains("要求"))
- {
- judge_row = ugst;
- }
- if (judge_row != null)
- {
- foreach (UltraGridRow ugs in this.ultraGrid5.Rows)
- {
- if (!string.IsNullOrEmpty(ugs.Cells["STD_TYPE"].Text) && (ugs.Cells["STD_TYPE"].Text.ToString() == "交付标准(成品成分)" || ugs.Cells["STD_TYPE"].Text.ToString() == "特殊要求(成品成分)"))
- {
- for (int i = 0; i < ugs.Cells.Count; i++)
- {
- if (!string.IsNullOrEmpty(ugs.Cells[i].Text) && ugs.Cells[i].Text.ToString().Contains(" "))
- {
- string[] str_arr = ugs.Cells[i].Text.ToString().Replace(" ", "#").Split('#');
- if (str_arr.Length == 1)
- {
- if (str_arr[0].Contains("<=") && !string.IsNullOrEmpty(judge_row.Cells[i].Text))
- {
- if (double.Parse(str_arr[0].Replace("<=", "")) < double.Parse(judge_row.Cells[i].Text.ToString()))
- {
- judge_row.Cells[i].Appearance.BackColor = Color.Red;
- judge_row.Cells["STD_TYPE"].Appearance.BackColor = Color.Red;
- }
- }
- else if (str_arr[0].Contains(">=") && !string.IsNullOrEmpty(judge_row.Cells[i].Text))
- {
- if (double.Parse(str_arr[0].Replace(">=", "")) > double.Parse(judge_row.Cells[i].Text.ToString()))
- {
- judge_row.Cells[i].Appearance.BackColor = Color.Red;
- judge_row.Cells["STD_TYPE"].Appearance.BackColor = Color.Red;
- }
- }
- }
- else if (str_arr.Length == 2)
- {
- if (str_arr[0].Contains("<=") && !string.IsNullOrEmpty(judge_row.Cells[i].Text))
- {
- if (double.Parse(str_arr[0].Replace("<=", "")) < double.Parse(judge_row.Cells[i].Text.ToString()))
- {
- judge_row.Cells[i].Appearance.BackColor = Color.Red;
- judge_row.Cells["STD_TYPE"].Appearance.BackColor = Color.Red;
- }
- }
- else if (str_arr[0].Contains(">=") && !string.IsNullOrEmpty(judge_row.Cells[i].Text))
- {
- if (double.Parse(str_arr[0].Replace(">=", "")) > double.Parse(judge_row.Cells[i].Text.ToString()))
- {
- judge_row.Cells[i].Appearance.BackColor = Color.Red;
- judge_row.Cells["STD_TYPE"].Appearance.BackColor = Color.Red;
- }
- }
- if (str_arr[1].Contains("<=") && !string.IsNullOrEmpty(judge_row.Cells[i].Text))
- {
- if (double.Parse(str_arr[1].Replace("<=", "")) < double.Parse(judge_row.Cells[i].Text.ToString()))
- {
- judge_row.Cells[i].Appearance.BackColor = Color.Red;
- judge_row.Cells["STD_TYPE"].Appearance.BackColor = Color.Red;
- }
- }
- else if (str_arr[1].Contains(">=") && !string.IsNullOrEmpty(judge_row.Cells[i].Text))
- {
- if (double.Parse(str_arr[1].Replace(">=", "")) > double.Parse(judge_row.Cells[i].Text.ToString()))
- {
- judge_row.Cells[i].Appearance.BackColor = Color.Red;
- judge_row.Cells["STD_TYPE"].Appearance.BackColor = Color.Red;
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
- catch (Exception ex)
- {
- System.Diagnostics.Debug.WriteLine(ex.ToString());
- MessageBox.Show("系统出错,请联系管理人员", "警告");
- }
- }
- private void ultraGrid1_AfterRowActivate(object sender, EventArgs e)
- {
- try
- {
- UltraGridRow ugr = this.ultraGrid1.ActiveRow;
- if (ugr == null)
- return;
- this.dataSet3.Clear();
- string design_key = ugr.Cells["DESIGN_KEY"].Value.ToString();
- string smp_no = ugr.Cells["SMP_NO"].Value.ToString();
- CoreClientParam ccp = new CoreClientParam();
- ccp.ServerName = "QCM.QCM03.QCM0301.QcmJhyElementsServiceImpl";
- ccp.MethodName = "GetChemeInfo";
- ccp.ServerParams = new object[] { design_key, smp_no };
- ccp.SourceDataTable = this.dataSet3.Tables[0];
- this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
- foreach (UltraGridRow ugs in this.ultraGrid2.Rows)
- {
- ugs.Cells["CHECKBOX"].Value = ugs.Cells["CHECKBOXS"].Text.ToString();
- }
- UltraGridRow judge_row = null;
- foreach (UltraGridRow ugst in this.ultraGrid2.Rows)
- {
- if (!ugst.Cells["STD_TYPE"].Text.ToString().Contains("标准") && !ugst.Cells["STD_TYPE"].Text.ToString().Contains("要求"))
- {
- judge_row = ugst;
- }
- if (judge_row != null)
- {
- foreach (UltraGridRow ugs in this.ultraGrid2.Rows)
- {
- if (!string.IsNullOrEmpty(ugs.Cells["STD_TYPE"].Text) && (ugs.Cells["STD_TYPE"].Text.ToString() == "交付标准(成品成分)" || ugs.Cells["STD_TYPE"].Text.ToString() == "特殊要求(成品成分)"))
- {
- for (int i = 0; i < ugs.Cells.Count; i++)
- {
- if (!string.IsNullOrEmpty(ugs.Cells[i].Text) && ugs.Cells[i].Text.ToString().Contains(" "))
- {
- string[] str_arr = ugs.Cells[i].Text.ToString().Replace(" ", "#").Split('#');
- if (str_arr.Length == 1)
- {
- if (str_arr[0].Contains("<=") && !string.IsNullOrEmpty(judge_row.Cells[i].Text))
- {
- if (double.Parse(str_arr[0].Replace("<=", "")) < double.Parse(judge_row.Cells[i].Text.ToString()))
- {
- judge_row.Cells[i].Appearance.BackColor = Color.Red;
- judge_row.Cells["STD_TYPE"].Appearance.BackColor = Color.Red;
- }
- }
- else if (str_arr[0].Contains(">=") && !string.IsNullOrEmpty(judge_row.Cells[i].Text))
- {
- if (double.Parse(str_arr[0].Replace(">=", "")) > double.Parse(judge_row.Cells[i].Text.ToString()))
- {
- judge_row.Cells[i].Appearance.BackColor = Color.Red;
- judge_row.Cells["STD_TYPE"].Appearance.BackColor = Color.Red;
- }
- }
- }
- else if (str_arr.Length == 2)
- {
- if (str_arr[0].Contains("<=") && !string.IsNullOrEmpty(judge_row.Cells[i].Text))
- {
- if (double.Parse(str_arr[0].Replace("<=", "")) < double.Parse(judge_row.Cells[i].Text.ToString()))
- {
- judge_row.Cells[i].Appearance.BackColor = Color.Red;
- judge_row.Cells["STD_TYPE"].Appearance.BackColor = Color.Red;
- }
- }
- else if (str_arr[0].Contains(">=") && !string.IsNullOrEmpty(judge_row.Cells[i].Text))
- {
- if (double.Parse(str_arr[0].Replace(">=", "")) > double.Parse(judge_row.Cells[i].Text.ToString()))
- {
- judge_row.Cells[i].Appearance.BackColor = Color.Red;
- judge_row.Cells["STD_TYPE"].Appearance.BackColor = Color.Red;
- }
- }
- if (str_arr[1].Contains("<=") && !string.IsNullOrEmpty(judge_row.Cells[i].Text))
- {
- if (double.Parse(str_arr[1].Replace("<=", "")) < double.Parse(judge_row.Cells[i].Text.ToString()))
- {
- judge_row.Cells[i].Appearance.BackColor = Color.Red;
- judge_row.Cells["STD_TYPE"].Appearance.BackColor = Color.Red;
- }
- }
- else if (str_arr[1].Contains(">=") && !string.IsNullOrEmpty(judge_row.Cells[i].Text))
- {
- if (double.Parse(str_arr[1].Replace(">=", "")) > double.Parse(judge_row.Cells[i].Text.ToString()))
- {
- judge_row.Cells[i].Appearance.BackColor = Color.Red;
- judge_row.Cells["STD_TYPE"].Appearance.BackColor = Color.Red;
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
- catch (Exception ex)
- {
- System.Diagnostics.Debug.WriteLine(ex.ToString());
- MessageBox.Show("系统出错,请联系管理人员", "警告");
- }
- }
- private void QCM030101_Load(object sender, EventArgs e)
- {
- this.comboBox3.SelectedIndex = 0;
- this.comboBox1.SelectedIndex = 1;
- this.ultraGrid1.DisplayLayout.Override.FilterUIType = FilterUIType.HeaderIcons;
- this.ultraGrid4.DisplayLayout.Override.FilterUIType = FilterUIType.HeaderIcons;
- this.dateTimePicker1.Value = System.DateTime.Now.AddDays(-7);
- this.DoQuery();
- }
- private void ultraTabControl1_Click(object sender, EventArgs e)
- {
- if (this.ultraTabControl1.Tabs[1].Selected) //判定记录
- {
- this.comboBox1.SelectedIndex = 2;
- }
- if (this.ultraTabControl1.Tabs[0].Selected) //判定记录
- {
- this.comboBox1.SelectedIndex = 1;
- }
- }
- private void DoExport()
- {
- try
- {
- if (this.ultraGrid4.Rows.Count == 0)
- {
- MessageBox.Show("没有可以导出的数据", "提示");
- return;
- }
- if (this.saveFileDialog1.ShowDialog(this) == DialogResult.OK)
- {
- string fName = this.saveFileDialog1.FileName;
- this.ultraGridExcelExporter1.Export(this.ultraGrid4, fName);
- Process.Start(fName);
- }
- }
- catch (Exception ex)
- {
- System.Diagnostics.Debug.WriteLine(ex.ToString());
- }
- }
- }
- }
|