| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493 |
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using Infragistics.Win;
- using System.Windows.Forms;
- using CoreFS.CA06;
- using Infragistics.Win.UltraWinGrid;
- using System.Diagnostics;
- using System.Text.RegularExpressions;
- using Infragistics.Win.UltraWinEditors;
- using System.Collections;
- namespace Core.LZMes.Client.QCM
- {
- public partial class QCM030612 : FrmBase
- {
- public QCM030612()
- {
- 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.canceljudge();
- break;
- case "Exit":
- this.Close();
- break;
- case "Export":
- this.DoExport();
- break;
- }
- }
- private void Judge()
- {
- try
- {
- List<UltraGridRow> lists = new List<UltraGridRow>();
- foreach (UltraGridRow ugr in this.ultraGrid1.Rows)
- {
- if (ugr.Cells["CHECK"].Text.ToString() == "True")
- {
- if (ultraComboEditor2.Text == "" || ultraComboEditor1.Text == "" || ultraComboEditor3.Text == "")
- {
- MessageBox.Show("请输入表面结果或者选择好缺陷!");
- return;
- }
- string material_no = ugr.Cells["MATERIAL_NO"].Value.ToString();
- string sflv_code = this.ultraComboEditor1.Value.ToString();
- string sflv_name = this.ultraComboEditor1.Text.ToString();
- string qx_ly = this.ultraComboEditor2.Value.ToString();
- string qx_ly_name = this.ultraComboEditor2.Text.ToString();
- string qx = this.ultraComboEditor3.Value.ToString();
- string qx_name = this.ultraComboEditor3.Text.ToString();
- string username = this.UserInfo.GetUserName();
- string wrk_ord = this.UserInfo.GetUserOrderText();
- string wrk_grp = this.UserInfo.GetUserGroupText();
- string memo = this.textBox3.Text.ToString();
- CoreClientParam ccp = new CoreClientParam();
- ccp.ServerName = "QCM.QCM03.QCM0302.QcmJudgePhysicalServiceImpl";
- ccp.MethodName = "ultimateJudgeAutoJF";
- ccp.ServerParams = new object[] { material_no, username, sflv_code, sflv_name, qx_ly, qx_ly_name, qx, qx_name, wrk_ord, wrk_grp,memo };
- ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- if (ccp.ReturnCode == -1)
- {
- return;
- }
- lists.Add(ugr);
- }
- }
- if (lists.Count == 0)
- {
- MessageBox.Show("请选择数据!");
- return;
- }
- for (int i = 0; i < lists.Count; i++)
- {
- lists[i].Delete(false);
- }
- MessageBox.Show("判定成功!");
- }
- catch (Exception EX)
- {
- MessageBox.Show(EX.ToString());
- }
- }
- private void canceljudge()
- {
- //try
- //{
- // QCM030607 frm = new QCM030607();
- // if (frm.ShowDialog() == DialogResult.OK)
- // {
- // string remark = frm._memo;
- // if (remark == "")
- // {
- // MessageBox.Show("请录入备注信息!");
- // return;
- // }
- // if (this.ultraGrid18.Selected.Rows.Count == 0)
- // this.ultraGrid18.ActiveRow.Selected = true;
- // foreach (UltraGridRow ugr in this.ultraGrid18.Rows)
- // {
- // if (ugr.Cells["CHECK"].Text.ToString() == "True")
- // {
- // string MATERIAL_NO = ugr.Cells["MATERIAL_NO"].Value.ToString();
- // string utm_id = ugr.Cells["UTM_ID"].Value.ToString();
- // string username = this.UserInfo.GetUserName();
- // CoreClientParam ccp = new CoreClientParam();
- // ccp.ServerName = "QCM.QCM03.QCM0302.QcmJudgePhysicalServiceImpl";
- // ccp.MethodName = "cancelUltimateJudge";
- // ccp.ServerParams = new object[] { username, MATERIAL_NO, utm_id,remark };
- // ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- // if (ccp.ReturnCode == -1)
- // {
- // return;
- // }
- // }
- // }
- // MessageBox.Show("取消判定成功!");
- // }
- //}
- //catch (Exception EX)
- //{
- // MessageBox.Show(EX.ToString());
- //}
- //DoQuery();
- }
- private void DoQuery()
- {
- if (this.ultraTabControl1.Tabs[0].Selected) //待判信息
- {
- DoQueryMe();
- }
- if (this.ultraTabControl1.Tabs[1].Selected) //表面判定信息
- {
- DoQueryRe1();
- }
- if (this.ultraTabControl1.Tabs[2].Selected) //判定记录
- {
- DoQueryRe();
- }
- }
- //查询待判信息
- private void DoQueryMe()
- {
- try
- {
- if (comboBox4.SelectedIndex == 1)
- {
- MessageBox.Show("请选择入库时间!");
- return;
- }
- this.dataSet1.Clear();
- string ebatchno = "";
- string bbatchno = textBox4.Text.Trim();
- if (textBox2.Text.ToString() == "")
- {
- ebatchno = this.textBox4.Text.Trim();
- }
- else
- {
- ebatchno = textBox2.Text.Trim();
- }
- string starttime = this.dateTimePicker1.Value.ToString("yyyyMMdd");
- string endtime = this.dateTimePicker2.Value.ToString("yyyyMMdd");
- string design_key = textBox1.Text.Trim();
- CoreClientParam ccp = new CoreClientParam();
- ccp.ServerName = "QCM.QCM03.QCM0302.QcmJudgePhysicalServiceImpl";
- ccp.MethodName = "GetUnjudgeInfoJF";
- ccp.ServerParams = new object[] { starttime, endtime, bbatchno, ebatchno, design_key };
- ccp.SourceDataTable = this.dataSet1.Tables[0];
- this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
- }
- catch (Exception ex)
- {
- System.Diagnostics.Debug.WriteLine(ex.ToString());
- MessageBox.Show("系统出错,请联系管理人员", "警告");
- }
- }
- //查询判定记录
- private void DoQueryRe1()
- {
- try
- {
- if (comboBox4.SelectedIndex != 1)
- {
- MessageBox.Show("请选择判定时间!");
- return;
- }
- this.dataSet18.Clear();
- string ebatchno = "";
- string bbatchno = textBox4.Text.Trim();
- if (textBox2.Text.ToString() == "")
- {
- ebatchno = this.textBox4.Text.Trim();
- }
- else
- {
- ebatchno = textBox2.Text.Trim();
- }
- string design_key = textBox1.Text.Trim();
- CoreClientParam ccp = new CoreClientParam();
- ccp.ServerName = "QCM.QCM03.QCM0305.QcmJudgeSurfaceServiceImpl";
- ccp.MethodName = "GetSurfaceInfoK";
- ccp.ServerParams = new object[] { this.dateTimePicker1.Value.ToString("yyyyMMdd"), this.dateTimePicker2.Value.ToString("yyyyMMdd"), bbatchno, ebatchno, design_key ,"400JB1"};
- ccp.SourceDataTable = this.dataSet18.Tables[0];
- this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
- }
- catch (Exception ex)
- {
- System.Diagnostics.Debug.WriteLine(ex.ToString());
- MessageBox.Show("系统出错,请联系管理人员", "警告");
- }
- }
- //查询判定记录
- private void DoQueryRe()
- {
- try
- {
- if (comboBox4.SelectedIndex != 1)
- {
- MessageBox.Show("请选择判定时间!");
- return;
- }
- this.dataSet2.Clear();
- string ebatchno = "";
- string bbatchno = textBox4.Text.Trim();
- if (textBox2.Text.ToString() == "")
- {
- ebatchno = this.textBox4.Text.Trim();
- }
- else
- {
- ebatchno = textBox2.Text.Trim();
- }
- string design_key = textBox1.Text.Trim();
- CoreClientParam ccp = new CoreClientParam();
- ccp.ServerName = "QCM.QCM03.QCM0302.QcmJudgePhysicalServiceImpl";
- ccp.MethodName = "GetjudgeInfoJF";
- ccp.ServerParams = new object[] { this.dateTimePicker1.Value.ToString("yyyyMMdd"), this.dateTimePicker2.Value.ToString("yyyyMMdd"), bbatchno, ebatchno, design_key };
- ccp.SourceDataTable = this.dataSet2.Tables[0];
- this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
- }
- catch (Exception ex)
- {
- System.Diagnostics.Debug.WriteLine(ex.ToString());
- MessageBox.Show("系统出错,请联系管理人员", "警告");
- }
- }
- private void QCM030601_Load(object sender, EventArgs e)
- {
- this.comboBox4.SelectedIndex = 0;
- ValueList vsflv = new ValueList();
- CoreClientParam ccp = new CoreClientParam();
- this.ultraGrid1.DisplayLayout.Override.FilterUIType = FilterUIType.HeaderIcons;
- this.ultraGrid18.DisplayLayout.Override.FilterUIType = FilterUIType.HeaderIcons;
- this.dateTimePicker1.Value = System.DateTime.Now.AddDays(-7);
- ValueList vsflv2 = new ValueList();
- ccp = new CoreClientParam();
- ccp.ServerName = "QCM.QCM03.QCM0305.QcmJudgeSurfaceServiceImpl";
- ccp.MethodName = "findSfLvBj";
- this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
- for (int i = 0; i < ccp.SourceDataTable.Rows.Count; i++)
- {
- vsflv2.ValueListItems.Add(ccp.SourceDataTable.Rows[i]["SM_CD"].ToString(), ccp.SourceDataTable.Rows[i]["SM_CFNM"].ToString());
- }
- this.ultraComboEditor1.ValueList = vsflv2;
- //DoQuery();
- }
- public static bool SetUltraComboEditor(ref UltraComboEditor cbEdt, ref ValueList vlist, bool bNull)
- {
- if (cbEdt == null || vlist == null)
- return false;
- cbEdt.Items.Clear();
- if (bNull)
- cbEdt.Items.Add(null, "");
- for (int i = 0; i < vlist.ValueListItems.Count; i++)
- {
- try
- {
- cbEdt.Items.Add(vlist.ValueListItems[i].DataValue, vlist.ValueListItems[i].DisplayText);
- }
- catch { }
- }
- return true;
- }
- public static ValueList GeneralValuelist(ref DataTable table, string strKey, string strText)
- {
- if (table == null || !table.Columns.Contains(strKey) || !table.Columns.Contains(strText))
- return null;
- ArrayList alist = new ArrayList();
- ValueList vlist = new ValueList();
- for (int i = 0; i < table.Rows.Count; i++)
- {
- try
- {
- if (!alist.Contains(table.Rows[i][strKey]))
- {
- alist.Add(table.Rows[i][strKey]);
- vlist.ValueListItems.Add(table.Rows[i][strKey], Convert.ToString(table.Rows[i][strText]));
- }
- }
- catch { }
- }
- return vlist;
- }
- private void checkBox1_CheckedChanged(object sender, EventArgs e)
- {
- SetFilterUIType(this.ultraGrid1, this.checkBox1.Checked);
- SetFilterUIType(this.ultraGrid1, this.checkBox1.Checked);
- SetFilterUIType(this.ultraGrid16, this.checkBox1.Checked);
- SetFilterUIType(this.ultraGrid7, this.checkBox1.Checked);
- SetFilterUIType(this.ultraGrid11, this.checkBox1.Checked);
- SetFilterUIType(this.ultraGrid12, this.checkBox1.Checked);
- SetFilterUIType(this.ultraGrid13, this.checkBox1.Checked);
- SetFilterUIType(this.ultraGrid14, this.checkBox1.Checked);
- SetFilterUIType(this.ultraGrid15, this.checkBox1.Checked);
- }
- private void SetFilterUIType(UltraGrid grid, bool checkType)
- {
- if (checkType)
- {
- grid.DisplayLayout.Override.FilterUIType = FilterUIType.HeaderIcons;
- }
- else
- {
- grid.DisplayLayout.Bands[0].ColumnFilters.ClearAllFilters();
- grid.DisplayLayout.Override.FilterUIType = FilterUIType.Default;
- }
- }
- private void ultraTabControl1_Click(object sender, EventArgs e)
- {
- if (this.ultraTabControl1.Tabs[1].Selected) //判定记录
- {
- this.comboBox4.SelectedIndex = 1;
- }
- if (this.ultraTabControl1.Tabs[0].Selected) //判定记录
- {
- this.comboBox4.SelectedIndex = 0;
- }
- }
- private void DoExport()
- {
- try
- {
- if (this.ultraTabControl1.Tabs[0].Selected) //判定记录
- {
- if (this.ultraGrid1.Rows.Count == 0)
- {
- MessageBox.Show("没有可以导出的数据", "提示");
- return;
- }
- if (this.saveFileDialog1.ShowDialog(this) == DialogResult.OK)
- {
- string fName = this.saveFileDialog1.FileName;
- this.ultraGridExcelExporter1.Export(this.ultraGrid1, fName);
- Process.Start(fName);
- }
- }
- if (this.ultraTabControl1.Tabs[1].Selected) //判定记录
- {
- if (this.ultraGrid18.Rows.Count == 0)
- {
- MessageBox.Show("没有可以导出的数据", "提示");
- return;
- }
- if (this.saveFileDialog1.ShowDialog(this) == DialogResult.OK)
- {
- string fName = this.saveFileDialog1.FileName;
- this.ultraGridExcelExporter1.Export(this.ultraGrid18, fName);
- Process.Start(fName);
- }
- }
- }
- catch (Exception ex)
- {
- System.Diagnostics.Debug.WriteLine(ex.ToString());
- }
- }
- private void checkBox2_CheckedChanged(object sender, EventArgs e)
- {
- if (this.ultraTabControl1.Tabs[0].Selected) //待判信息
- {
- foreach (UltraGridRow ugr in this.ultraGrid1.Rows.Where(p => p.IsFilteredOut == false).ToList())
- {
- if (checkBox2.Checked)
- {
- ugr.Selected = true;
- }
- else
- {
- ugr.Selected = false;
- }
- }
- }
- if (this.ultraTabControl1.Tabs[1].Selected) //判定记录
- {
- foreach (UltraGridRow ugr in this.ultraGrid18.Rows.Where(p => p.IsFilteredOut == false).ToList())
- {
- if (checkBox2.Checked)
- {
- ugr.Cells["CHECK"].Value = "True";
- }
- else
- {
- ugr.Cells["CHECK"].Value = "False";
- }
- }
- }
- }
- private void ultraComboEditor2_ValueChanged(object sender, EventArgs e)
- {
- string lb;
- if (this.ultraComboEditor2.Text.ToString() == "钢质次(A)")
- {
- lb = "钢质";
- }
- else if (this.ultraComboEditor2.Text.ToString() == "热轧次(B)")
- {
- lb = "轧质";
- }
- else
- {
- return;
- }
- ArrayList alt = new ArrayList();
- alt.Add("UIB030110_021N1.SELECT");
- alt.Add(lb);
- //alt.Add("UIB030110_022.SELECT");
- ValueList vsflv3 = new ValueList();
- CoreClientParam ccp = new CoreClientParam();
- ccp.ServerName = "QCM.COMMUNAL.ComDBQueryQCM";
- ccp.MethodName = "doSimpleQuery";
- ccp.ServerParams = new object[] { alt };
- this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
- for (int i = 0; i < ccp.SourceDataTable.Rows.Count; i++)
- {
- vsflv3.ValueListItems.Add(ccp.SourceDataTable.Rows[i]["SM_CD"].ToString(), ccp.SourceDataTable.Rows[i]["SM_CFNM"].ToString());
- }
- this.ultraComboEditor3.ValueList = vsflv3;
- }
- private void ultraTabControl1_Click_1(object sender, EventArgs e)
- {
- if (this.ultraTabControl1.Tabs[1].Selected) //判定记录
- {
- this.comboBox4.SelectedIndex = 1;
- }
- if (this.ultraTabControl1.Tabs[2].Selected) //判定记录
- {
- this.comboBox4.SelectedIndex = 1;
- }
- if (this.ultraTabControl1.Tabs[0].Selected) //判定记录
- {
- this.comboBox4.SelectedIndex = 0;
- }
- }
- }
- }
|