| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358 |
- 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 Infragistics.Win;
- using Newtonsoft.Json;
- namespace Core.LZMes.Client.QCM
- {
- public partial class QCM0404 : FrmBase
- {
-
- #region 窗体初始化
- public QCM0404()
- {
- InitializeComponent();
- }
- private void QCM0404_Load(object sender, EventArgs e)
- {
- dateTimePicker1.Value = DateTime.Now.Date.AddDays(-1);
- dateTimePicker2.Value = DateTime.Now.Date.AddDays(1);
- //检测中心是否合格
- ValueList v1 = new ValueList();
- v1.ValueListItems.Add("0", "否");
- v1.ValueListItems.Add("1", "是");
- ultraGrid1.DisplayLayout.Bands[0].Columns["MATWITNE"].ValueList = v1.Clone();
- ultraGrid5.DisplayLayout.Bands[0].Columns["MATWITNE"].ValueList = v1.Clone();
- }
- #endregion
- #region 功能
- public override void ToolBar_Click(object sender, string ToolbarKey)
- {
- switch (ToolbarKey)
- {
- case "Query":
- this.DoQuery();//查询
- break;
- case "Add":
- this.DoAdd();//认证申报
- break;
- case "UnAdd":
- this.DoUnAdd();//撤销认证申报
- break;
- case "Excel":
- ClsControlPack.ExportDataWithSaveDialog2(ref ultraGrid5, this.Text);
- break;
-
- }
- }
- #endregion
- #region 功能事件
- #region 查询
- private void DoQuery()
- {
- try
- {
- String STARTTIME = this.dateTimePicker1.Value.ToString("yyyy-MM-dd");
- String ENDTIME = this.dateTimePicker2.Value.ToString("yyyy-MM-dd");
- String CERT_INST_NAME = this.textBox2.Text.Trim();//认证机构
- if (CERT_INST_NAME.Equals("全部"))
- {
- CERT_INST_NAME = "";
- }
- String BATCH_NO = this.textBox1.Text.Trim();//轧批号
- String DESIGN_KEY = this.textBox4.Text.Trim();//销售订单号
- String STEEL_CODE = this.textBox3.Text.Trim();//牌号
- String radio = "全部";
- if (radio1.Checked)
- {
- radio = "全部";
- }
- else if (radio2.Checked)
- {
- radio = "1";
- }
- else if (radio3.Checked)
- {
- radio = "0";
- }
- if (this.checkBox1.Checked)
- {
- STARTTIME = "";
- ENDTIME = "";
- }
- else
- {
- BATCH_NO = "";
- }
- String PLINENAME = "全部";
- if (this.PLINE_NAME.Text.ToString().Trim().Equals("中板线"))
- {
- PLINENAME = "ZB1";
- }
- else if (this.PLINE_NAME.Text.ToString().Trim().Equals("厚板线"))
- {
- PLINENAME = "HB1";
- }
- Hashtable ht = new Hashtable();
- ht.Add("STARTTIME", STARTTIME);
- ht.Add("ENDTIME", ENDTIME);
- ht.Add("CERT_INST_NAME", CERT_INST_NAME);
- ht.Add("BATCH_NO", BATCH_NO);
- ht.Add("DESIGN_KEY", DESIGN_KEY);
- ht.Add("STEEL_CODE", STEEL_CODE);
- ht.Add("RADIO", radio);
- ht.Add("PLINENAME", PLINENAME);
- CoreClientParam ccp = new CoreClientParam();
- if (this.ultraTabControl1.Tabs[0].Selected) //委托信息
- {
- this.dataSet1.Clear();
- ccp.ServerName = "QCM.JHY01.JHY0103.QuerryThirdInfo";
- ccp.MethodName = "getMatWitneD";
- ccp.SourceDataTable = this.dataSet1.Tables[0];
- }else if (this.ultraTabControl1.Tabs[1].Selected) //申报委托记录
- {
- this.dataSet2.Clear();
- ccp.ServerName = "QCM.JHY01.JHY0103.QuerryThirdInfo";
- ccp.MethodName = "getQcmMatWitneD";
- ccp.SourceDataTable = this.dataSet2.Tables[0];
- }
- ccp.ServerParams = new object[] { ht };
- this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
- }
- catch (Exception ex)
- {
- System.Diagnostics.Debug.WriteLine(ex.ToString());
- MessageBox.Show("系统出错,请联系管理人员", "警告");
- }
- }
- #endregion
- #region 认证申报
- private void DoAdd()
- {
- try
- {
- List<UltraGridRow> lists = new List<UltraGridRow>();
- CoreClientParam ccp = new CoreClientParam();
- string SPECIMEN_NO = "";
- string fh = "";
- int num = 0;
- foreach (UltraGridRow ugr in this.ultraGrid1.Rows)
- {
- string specimeNo = "";
- if (ugr.Cells["CHECK"].Value.ToString().ToLower() == "true")
- {
- String matwitne = ugr.Cells["MATWITNE"].Value.ToString();
- if (matwitne.Equals("0"))
- {
- this.alert("检测中心未合格不可申报第三方见证委托!请核实数据!");
- return;
- }
- specimeNo = ugr.Cells["SPECIMEN_NO"].Value.ToString();
- num = num + 1;
- if (num <= 1)
- {
- SPECIMEN_NO = specimeNo;
- fh = ",";
- }
- else
- {
- SPECIMEN_NO = SPECIMEN_NO + fh + specimeNo;
- }
- lists.Add(ugr);
- }
- }
- ccp.ServerName = "QCM.JHY01.JHY0103.AddThirdInfo";
- ccp.MethodName = "addMatWitneD";
- ccp.ServerParams = new object[] { SPECIMEN_NO, this.UserInfo.GetUserID(), this.UserInfo.GetUserName() };
- ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- if (ccp.ReturnCode != -1)
- {
- for (int i = 0; i < lists.Count; i++)
- {
- lists[i].Delete(false);
- }
- MessageBox.Show("申报第三方见证委托成功", "提示", MessageBoxButtons.OK, MessageBoxIcon.None);//ccp.ReturnInfo "发送成功" ccp.ReturnInfo
- }
- }
- catch (Exception ex)
- {
- System.Diagnostics.Debug.WriteLine(ex.ToString());
- MessageBox.Show("系统出错,请联系管理人员", "警告");
- }
- }
- #endregion
- #region 撤销认证申报
- private void DoUnAdd()
- {
- try
- {
- if (MessageBox.Show("确认撤销申报?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
- {
- return;
- }
-
- if (this.ultraTabControl1.Tabs[1].Selected)
- {
- foreach (UltraGridRow ugr in this.ultraGrid5.Rows)
- {
- if (ugr.Cells["CHECK"].Value.ToString().ToLower() == "true")
- {
- string SPECIMEN_NO = ugr.Cells["SPECIMEN_NO"].Value.ToString();
- string BATCH_NO = ugr.Cells["BATCH_NO"].Value.ToString();
- string MATERIAL_NO = ugr.Cells["MATERIAL_NO"].Value.ToString();
- string PLINE_CODE = ugr.Cells["PLINE_CODE"].Value.ToString();
- Hashtable ht = new Hashtable();
- ht.Add("SPECIMEN_NO", SPECIMEN_NO);
- ht.Add("USER_ID", this.UserInfo.GetUserID());
- ht.Add("USER_NAME", this.UserInfo.GetUserName());
- ht.Add("BATCH_NO", BATCH_NO);
- ht.Add("MATERIAL_NO", MATERIAL_NO);
- ht.Add("PLINE_CODE", PLINE_CODE);
- CoreClientParam ccp = new CoreClientParam();
- ccp.ServerName = "QCM.JHY01.JHY0103.DeleteMaterialInfo";
- ccp.MethodName = "DoDelMatWitne";
- ccp.ServerParams = new object[] { ht };
- this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
- if (ccp.ReturnCode == -1)
- {
- return;
- }
- }
- }
- }
- this.DoQuery();
- }
- catch (Exception ex)
- {
- System.Diagnostics.Debug.WriteLine(ex.ToString());
- MessageBox.Show("系统出错,请联系管理人员", "警告");
- }
- }
- #endregion
- #endregion
- #region 其它事件
- #region 更新
- private void ultraGrid1_AfterHeaderCheckStateChanged(object sender, AfterHeaderCheckStateChangedEventArgs e)
- {
- ultraGrid1.UpdateData();
- }
- private void ultraGrid1_CellChange(object sender, CellEventArgs e)
- {
- ultraGrid1.UpdateData();
- }
- private void ultraGrid5_AfterHeaderCheckStateChanged(object sender, AfterHeaderCheckStateChangedEventArgs e)
- {
- ultraGrid5.UpdateData();
- }
- private void ultraGrid5_CellChange(object sender, CellEventArgs e)
- {
- ultraGrid5.UpdateData();
- }
- #endregion
- #endregion
- #region 按钮是否显示
- private void ultraTabControl1_SelectedTabChanged(object sender, Infragistics.Win.UltraWinTabControl.SelectedTabChangedEventArgs e)
- {
- if (this.ultraTabControl1.Tabs[0].Selected)
- {
- this.ToolBarItemEnable(this, "Add", true);
- this.ToolBarItemEnable(this, "UnAdd", false);
- this.ToolBarItemEnable(this, "Excel", false);
- checkBox2.Checked = false;
- }else if (this.ultraTabControl1.Tabs[1].Selected)
- {
- this.ToolBarItemEnable(this, "Add", false);
- this.ToolBarItemEnable(this, "UnAdd", true);
- this.ToolBarItemEnable(this, "Excel", true);
- checkBox2.Checked = false;
-
- }
-
- }
- #endregion
- private void checkBox1_Click(object sender, EventArgs e)
- {
- if (this.checkBox1.Checked)
- {
- this.dateTimePicker1.Enabled = false;
- this.dateTimePicker2.Enabled = false;
- this.textBox1.Enabled = true;
- }
- else
- {
- this.dateTimePicker1.Enabled = true;
- this.dateTimePicker2.Enabled = true;
- this.textBox1.Enabled = false;
- }
- }
- #region 全选
- 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.Cells["check"].Value = "True";
- }
- else
- {
- ugr.Cells["check"].Value = "False";
- }
- }
- }
- else if (this.ultraTabControl1.Tabs[3].Selected) //申报记录
- {
- foreach (UltraGridRow ugr in this.ultraGrid5.Rows.Where(p => p.IsFilteredOut == false).ToList())
- {
- if (checkBox2.Checked)
- {
- ugr.Cells["check"].Value = "True";
- }
- else
- {
- ugr.Cells["check"].Value = "False";
- }
- }
- }
- }
- #endregion
- }
- }
|