| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035 |
- 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 QCM0403 : FrmBase
- {
-
- #region 窗体初始化
- public QCM0403()
- {
- InitializeComponent();
- }
- private void QCM0403_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", "合格");
- v1.ValueListItems.Add("2", "不合格");
- ultraGrid1.DisplayLayout.Bands[0].Columns["PHYFSTSRESULT"].ValueList = v1.Clone();
- ultraGrid5.DisplayLayout.Bands[0].Columns["PHYFSTSRESULT"].ValueList = v1.Clone();
- ultraGrid2.DisplayLayout.Bands[0].Columns["PHYFSTSRESULT"].ValueList = v1.Clone();
- //this.PLINE_NAME.SelectedIndex = 0;
- // ValueList v2 = new ValueList();
- //v2.ValueListItems.Add("00", "待提报");
- //v2.ValueListItems.Add("10", "待确认");
- //v2.ValueListItems.Add("20", "审批中");
- //v2.ValueListItems.Add("30", "审批拒绝");
- //v2.ValueListItems.Add("40", "审批退回");
- //v2.ValueListItems.Add("50", "审批通过");
- //ultraGrid2.DisplayLayout.Bands[0].Columns["CERT_STATUS"].ValueList = v2.Clone();
-
- //v2 = new ValueList();
- //v2.ValueListItems.Add("0", "已发送");
- //v2.ValueListItems.Add("1", "未发送");
- //ultraGrid2.DisplayLayout.Bands[0].Columns["SEND_FLAG"].ValueList = v2.Clone();
- // doCertInstCode();
- //this.DoQuery();//查询
- }
- #endregion
- #region 功能
- public override void ToolBar_Click(object sender, string ToolbarKey)
- {
- switch (ToolbarKey)
- {
- case "Query":
- this.DoQuery();//查询
- break;
- case "Add":
- // this.DoAdd1();
- this.DoAdd2();//认证申报
- break;
- case "UnAdd":
- this.DoUnAdd();//撤销认证申报
- break;
- case "Del":
- this.DoDelz();//剔除子板 (作废)
- break;
- case "Excel":
- this.Excel();//导出
- //ClsControlPack.ExportDataWithSaveDialog2(ref ultraGrid1, this.Text);
- break;
- case "DoQuote":
- doQuote();
- break;
- case "Excel2":
- ClsControlPack.ExportDataWithSaveDialog2(ref ultraGrid1, this.Text);//导出
- break;
-
- }
- }
- private void doQuote()
- {
- try
- {
- if (this.ultraGrid5.Selected.Rows.Count == 0)
- this.ultraGrid5.ActiveRow.Selected = true;
- List<UltraGridRow> lists = new List<UltraGridRow>();
- foreach (UltraGridRow ugr in this.ultraGrid5.Selected.Rows)
- {
- string material_no = ugr.Cells["MATERIAL_NO"].Value.ToString();
- string PHYFSTSRESULT1 = ugr.Cells["PHYFSTSRESULT1"].Text.ToString();
- if (PHYFSTSRESULT1.Equals("待判"))
- {
- string username = this.UserInfo.GetUserName();
- CoreClientParam ccp = new CoreClientParam();
- ccp.ServerName = "QCM.QCM03.QCM0302.QcmJudgePhysicalServiceImpl";
- ccp.MethodName = "doQuote";
- ccp.ServerParams = new object[] { material_no, username };
- ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- if (ccp.ReturnCode == -1)
- {
- return;
- }
- }
- }
- // DoQuery();
- this.alert("已引用,稍等10秒再刷新查询!正在综判中");
- }
- catch (Exception EX)
- {
- MessageBox.Show(EX.ToString());
- }
- }
-
- #endregion
- #region 功能事件
- #region 导出
- private void Excel()
- {
- 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();//认证机构
- String BATCH_NO = this.textBox1.Text.Trim();//轧批号
- String shordh = this.textBox4.Text.Trim();//销售订单号
- String PROD_NAMEMOME = this.textBox3.Text.Trim();//产品规范描述
- if (this.ultraTabControl1.Tabs[3].Selected) //库存信息
- {
- KsQueryExcel(STARTTIME, ENDTIME, CERT_INST_NAME, BATCH_NO, shordh, PROD_NAMEMOME);//库存信息
- }
- else
- {
- this.alert("请选择【申报记录】!再点击导出");
- }
- }
- catch (Exception ex)
- {
- System.Diagnostics.Debug.WriteLine(ex.ToString());
- MessageBox.Show("系统出错,请联系管理人员", "警告");
- }
- }
- #region 导出 库存信息
- public void KsQueryExcel(String starttime, String endtime, String cert_inst_name, String batch_no, String shordh, String prod_namemome)
- {
- try
- {
- String plineName = this.PLINE_NAME.Text;
- if (String.IsNullOrEmpty(plineName))
- {
- plineName = "";
- }
-
- this.dataSet5.Clear();
- CoreClientParam ccp = new CoreClientParam();
- ccp.ServerName = "QCM.JHY01.JHY0103.QuerryThirdInfo";
- ccp.MethodName = "KsQueryExcel";
- ccp.ServerParams = new object[] { starttime, endtime, batch_no, cert_inst_name, shordh, prod_namemome, plineName };
- ccp.SourceDataTable = this.dataSet5.Tables[0];
- this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
- //导出是否加订单备注
- if (this.checkBox3.Checked)
- {
- this.ultraGrid4.DisplayLayout.Bands[0].Columns["订单备注"].Hidden = false;
- }
- else
- {
- this.ultraGrid4.DisplayLayout.Bands[0].Columns["订单备注"].Hidden = true;
- }
- ClsControlPack.ExportDataWithSaveDialog2(ref ultraGrid4, "船检导出清单");
- }
- catch (Exception ex)
- {
- System.Diagnostics.Debug.WriteLine(ex.ToString());
- MessageBox.Show("系统出错,请联系管理人员", "警告");
- }
- }
- #endregion
- #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 CERT_INST_NAME = this.textBox2.Text.Trim();//认证机构
- if (CERT_INST_NAME.Equals("全部"))
- {
- CERT_INST_NAME = "";
- }
- String BATCH_NO = this.textBox1.Text.Trim();//轧批号
- String shordh = this.textBox4.Text.Trim();//销售订单号
- String PROD_NAMEMOME = 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 = "";
- }
- if (this.ultraTabControl1.Tabs[0].Selected) //库存信息
- {
- KsQuery(STARTTIME, ENDTIME, CERT_INST_NAME, BATCH_NO, shordh, PROD_NAMEMOME,radio);//库存信息
- }
- if (this.ultraTabControl1.Tabs[1].Selected) //申报轧批
- {
- SbQuery(STARTTIME, ENDTIME, CERT_INST_NAME, BATCH_NO, shordh, PROD_NAMEMOME);//申报记录
- }
- if (this.ultraTabControl1.Tabs[3].Selected) //申报记录合并
- {
- SbQueryhb(STARTTIME, ENDTIME, CERT_INST_NAME, BATCH_NO, shordh, PROD_NAMEMOME);//申报记录
- }
- }
- catch (Exception ex)
- {
- System.Diagnostics.Debug.WriteLine(ex.ToString());
- MessageBox.Show("系统出错,请联系管理人员", "警告");
- }
- }
- #region 库存信息
- public void KsQuery(String starttime, String endtime, String cert_inst_name, String batch_no, String shordh, String prod_namemome, String radio)
- {
- try {
- this.dataSet1.Clear();
- CoreClientParam ccp = new CoreClientParam();
- String radioYN = "全部";
- if (radioYN1.Checked)
- {
- radioYN = "全部";
- }
- else if (radioYN2.Checked)
- {
- radioYN = "1";
- }
- else if (radioYN3.Checked)
- {
- radioYN = "0";
- }
- ccp.ServerName = "QCM.JHY01.JHY0103.QuerryThirdInfo";
- if (this.PLINE_NAME.Text.ToString().Trim().Equals("中板线"))
- {
- ccp.MethodName = "QueryKczInfo";
- }
- else if (this.PLINE_NAME.Text.ToString().Trim().Equals("厚板线"))
- {
- ccp.MethodName = "QueryKSInfo";
- }
- else
- {
- ccp.MethodName = "QueryKSAllInfo";
- }
- ccp.ServerParams = new object[] { starttime, endtime, batch_no, cert_inst_name, shordh, prod_namemome, radio, radioYN };
- ccp.SourceDataTable = this.dataSet1.Tables[0];
- this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
- if (this.ultraTabControl1.Tabs[0].Selected)
- {
- foreach (UltraGridRow ugr in this.ultraGrid1.Rows)
- {
- if (ugr.Cells["PHYFSTSRESULT"].Value.ToString().Equals("0"))
- {
- ugr.Cells["初检时间"].Value = "";
- }
- }
- }
- ClsControlPack.RefreshAndAutoSize(ultraGrid1);
- }
- catch (Exception ex)
- {
- System.Diagnostics.Debug.WriteLine(ex.ToString());
- MessageBox.Show("系统出错,请联系管理人员", "警告");
- }
- }
- #endregion
- #region 申报记录
- //按轧批
- public void SbQuery(String starttime, String endtime, String cert_inst_name, String batch_no, String shordh, String prod_namemome)
- {
- try {
- this.dataSet6.Clear();
- CoreClientParam ccp = new CoreClientParam();
- ccp.ServerName = "QCM.JHY01.JHY0103.QuerryThirdInfo";
- ccp.MethodName = "QueryBatchNo";
- ccp.ServerParams = new object[] { starttime, endtime, cert_inst_name, batch_no, shordh };
- ccp.SourceDataTable = this.dataSet6.Tables[0];
- this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
- }
- catch (Exception ex)
- {
- System.Diagnostics.Debug.WriteLine(ex.ToString());
- MessageBox.Show("系统出错,请联系管理人员", "警告");
- }
- }
- //按子板 申报记录
- public void SbQueryhb(String starttime, String endtime, String cert_inst_name, String batch_no, String shordh, String prod_namemome)
- {
- try
- {
- String plineName = this.PLINE_NAME.Text;
- if (String.IsNullOrEmpty(plineName) || plineName.Equals("全部"))
- {
- plineName = "";
- }
- String certNo = this.CERT_NO.Text.Trim().ToString();
- this.dataSet4.Clear();
- CoreClientParam ccp = new CoreClientParam();
- ccp.ServerName = "QCM.JHY01.JHY0103.QuerryThirdInfo";
- ccp.MethodName = "QueryMainInfoHb";
- ccp.ServerParams = new object[] { starttime, endtime, cert_inst_name, batch_no, shordh, prod_namemome, plineName, certNo };
- ccp.SourceDataTable = this.dataSet4.Tables[0];
- this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
- if (this.ultraTabControl1.Tabs[3].Selected) //申报记录
- {
- foreach (UltraGridRow ugr in this.ultraGrid5.Rows)
- {
- if (ugr.Cells["备注"].Value.ToString().Equals("已脱单"))
- {
- ugr.Appearance.BackColor = Color.Aquamarine;
- }
- if (ugr.Cells["VALIDFLAG"].Value.ToString().Equals("1"))
- {
- ugr.Appearance.BackColor = Color.Red;
- }
- if (ugr.Cells["PHYFSTSRESULT1"].Value.ToString().Equals("船检合格"))
- {
- ugr.Cells["PHYFSTSRESULT"].Value = 1;
- }
- }
- }
- ClsControlPack.RefreshAndAutoSize(ultraGrid5);
- }
- catch (Exception ex)
- {
- System.Diagnostics.Debug.WriteLine(ex.ToString());
- MessageBox.Show("系统出错,请联系管理人员", "警告");
- }
- }
- #endregion
- #region 认证机构
- public void doCertInstCode()
- {
- this.dataSet7.Clear();
- CoreClientParam ccp = new CoreClientParam();
- ccp.ServerName = "QCM.JHY01.JHY0103.QuerryThirdInfo";//调用java地址
- ccp.MethodName = "getCertInstCode";//调用的方法
- //ccp.ServerParams = new object[] { };
- ccp.SourceDataTable = this.dataSet7.Tables[0];
- this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
- DataTable dt = new DataTable();
- dt.Columns.Add("CERT_INST_NAME");
- dt.Columns.Add("CERT_INST_CODE");
- DataRow dr0 = dt.NewRow();
- dr0[0] = "全部";
- dr0[1] = "全部";
- dt.Rows.Add(dr0);
- for (int i = 0; i < ccp.SourceDataTable.Rows.Count; i++)
- {
- DataRow dr = dt.NewRow();
- dr[0] = ccp.SourceDataTable.Rows[i]["CERT_INST_NAME"].ToString();
- dr[1] = ccp.SourceDataTable.Rows[i]["CERT_INST_CODE"].ToString();
- dt.Rows.Add(dr);
- }
- this.textBox2.DataSource = dt;
- this.textBox2.DisplayMember = "CERT_INST_NAME";
- this.textBox2.ValueMember = "CERT_INST_CODE";
- }
- #endregion
- #endregion
- #region 认证申报 已报废
- private void DoAdd1()
- {
- ultraGrid1.UpdateData();
- if (ultraGrid1.Rows.Count == 0)
- {
- MessageBox.Show("库存信息为空!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
- return;
- }
- ArrayList CERT_INST_CODE = new ArrayList();
- ArrayList CERT_INST_NAME = new ArrayList();
- ArrayList MEMO = new ArrayList();
- ArrayList CREATE_ID = new ArrayList();
- ArrayList CREATE_NAME = new ArrayList();
- ArrayList CERT_NO = new ArrayList(); //认证申报编号
- ArrayList CERT_STATUS = new ArrayList();
- ArrayList APPLY_ORG_NO = new ArrayList();
- ArrayList APPLY_ORG_DESC = new ArrayList();
- ArrayList DEP_TYPE_CODE = new ArrayList();
- ArrayList DUTY_ID = new ArrayList();
- ArrayList INSTANCE_ID = new ArrayList();
- ArrayList material_no = new ArrayList(); //产品序号
- ArrayList design_key = new ArrayList(); //DESIGN_KEY
- ArrayList psc = new ArrayList(); //产品规范代码
- ArrayList prod_code = new ArrayList(); //产品名称代码
- ArrayList prod_name = new ArrayList(); //产品名称描述
- ArrayList steel_code = new ArrayList(); //产品牌号代码
- ArrayList steel_name = new ArrayList(); //产品牌号名称
- ArrayList std_code = new ArrayList(); //执行标准代码
- ArrayList std_name = new ArrayList(); //执行标准名称
- ArrayList delivery_state_code = new ArrayList(); //交货状态代码
- ArrayList delivery_state_desc = new ArrayList(); //交货状态描述
- ArrayList delivery_date = new ArrayList(); //交货日期
- ArrayList cut_type = new ArrayList(); //切边状态
- ArrayList heat_no = new ArrayList(); //炉号
- ArrayList batch_no = new ArrayList(); //轧批号
- ArrayList inspection_lot = new ArrayList(); //检验号
- ArrayList board_no = new ArrayList(); //母板号
- ArrayList thick = new ArrayList(); //厚度(mm)
- ArrayList width = new ArrayList(); //宽度(mm)
- ArrayList length = new ArrayList(); //长度
- ArrayList mat_weight = new ArrayList(); //重量
- ArrayList pline_code = new ArrayList(); //产线代码
- ArrayList pline_name = new ArrayList(); //产线名称
- for (int i = 0; i < ultraGrid1.Rows.Count; i++)
- {
- if (ultraGrid1.Rows[i].Cells["check"].Value.ToString() == "True")
- {
- CERT_INST_CODE.Add(ultraGrid1.Rows[i].Cells["CERT_INST_CODE"].Value.ToString());
- CERT_INST_NAME.Add(ultraGrid1.Rows[i].Cells["CERT_INST_NAME"].Value.ToString());
- MEMO.Add(ultraGrid1.Rows[i].Cells["MEMO"].Value.ToString());
- CREATE_ID.Add(ultraGrid1.Rows[i].Cells["CREATE_ID"].Value.ToString());
- CREATE_NAME.Add(ultraGrid1.Rows[i].Cells["CREATE_NAME"].Value.ToString());
- CERT_NO.Add(ultraGrid1.Rows[i].Cells["CERT_NO"].Value.ToString());
- CERT_STATUS.Add(ultraGrid1.Rows[i].Cells["CERT_STATUS"].Value.ToString());
- APPLY_ORG_NO.Add(ultraGrid1.Rows[i].Cells["APPLY_ORG_NO"].Value.ToString());
- APPLY_ORG_DESC.Add(ultraGrid1.Rows[i].Cells["APPLY_ORG_DESC"].Value.ToString());
- DEP_TYPE_CODE.Add(ultraGrid1.Rows[i].Cells["DEP_TYPE_CODE"].Value.ToString());
- DUTY_ID.Add(ultraGrid1.Rows[i].Cells["DUTY_ID"].Value.ToString());
- INSTANCE_ID.Add(ultraGrid1.Rows[i].Cells["INSTANCE_ID"].Value.ToString());
- material_no.Add(ultraGrid1.Rows[i].Cells["MATERIAL_NO"].Value.ToString());
- design_key.Add(ultraGrid1.Rows[i].Cells["DESIGN_KEY"].Value.ToString());
- psc.Add(ultraGrid1.Rows[i].Cells["PSC"].Value.ToString());
- prod_code.Add(ultraGrid1.Rows[i].Cells["PROD_CODE"].Value.ToString());
- prod_name.Add(ultraGrid1.Rows[i].Cells["PROD_NAME"].Value.ToString());
- steel_code.Add(ultraGrid1.Rows[i].Cells["STEEL_CODE"].Value.ToString());
- steel_name.Add(ultraGrid1.Rows[i].Cells["STEEL_NAME"].Value.ToString());
- std_code.Add(ultraGrid1.Rows[i].Cells["STD_CODE"].Value.ToString());
- std_name.Add(ultraGrid1.Rows[i].Cells["STD_NAME"].Value.ToString());
- delivery_state_code.Add(ultraGrid1.Rows[i].Cells["DELIVERY_STATE_CODE"].Value.ToString());
- delivery_state_desc.Add(ultraGrid1.Rows[i].Cells["DELIVERY_STATE_DESC"].Value.ToString());
- delivery_date.Add(ultraGrid1.Rows[i].Cells["DELIVERY_DATE"].Value.ToString());
- cut_type.Add(ultraGrid1.Rows[i].Cells["CUT_TYPE"].Value.ToString());
- heat_no.Add(ultraGrid1.Rows[i].Cells["HEAT_NO"].Value.ToString());
- batch_no.Add(ultraGrid1.Rows[i].Cells["BATCH_NO"].Value.ToString());
- inspection_lot.Add(ultraGrid1.Rows[i].Cells["INSPECTION_LOT"].Value.ToString());
- board_no.Add(ultraGrid1.Rows[i].Cells["BOARD_NO"].Value.ToString());
- thick.Add(ultraGrid1.Rows[i].Cells["THICK"].Value.ToString());
- width.Add(ultraGrid1.Rows[i].Cells["WIDTH"].Value.ToString());
- length.Add(ultraGrid1.Rows[i].Cells["LENGTH"].Value.ToString());
- mat_weight.Add(ultraGrid1.Rows[i].Cells["MAT_WEIGHT"].Value.ToString());
- pline_code.Add(ultraGrid1.Rows[i].Cells["PLINE_CODE"].Value.ToString());
- pline_name.Add(ultraGrid1.Rows[i].Cells["PLINE_NAME"].Value.ToString());
- }
- }
- CoreClientParam ccp = new CoreClientParam();
- ccp.ServerName = "QCM.JHY01.JHY0103.AddThirdInfo";
- ccp.MethodName = "addList";
- ccp.ServerParams = new object[] { CERT_INST_CODE, CERT_INST_NAME, MEMO, CREATE_ID, CREATE_NAME, CERT_NO, CERT_STATUS,
- APPLY_ORG_NO, APPLY_ORG_DESC,DEP_TYPE_CODE,DUTY_ID,INSTANCE_ID,
- material_no,
- design_key,
- psc,
- prod_code,
- prod_name,
- steel_code,
- steel_name,
- std_code,
- std_name,
- delivery_state_code,
- delivery_state_desc,
- delivery_date,
- cut_type,
- heat_no,
- batch_no,
- inspection_lot,
- board_no,
- thick,
- width,
- length,
- mat_weight,
- pline_code,
- pline_name,this.UserInfo.GetUserID(),this.UserInfo.GetUserName() };
- ccp.SourceDataTable = this.dataSet1.Tables[0];
- ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- if (ccp.ReturnCode != -1)
- {
- MessageBox.Show("认证申报成功", "提示", MessageBoxButtons.OK, MessageBoxIcon.None);
- }
- this.DoQuery();
- }
- #endregion
- #region 认证申报
- private void DoAdd2()
- {
- try
- {
- ultraGrid1.UpdateData();
- //判断是否存在初检结果为未初检的数据
- //DataView dvDown = this.dataTable1.DefaultView;
- //dvDown.RowFilter = "PHYFSTSRESULT = '未初检'";
- //DataTable selectedTb = dvDown.ToTable();
- //if (selectedTb != null && selectedTb.Rows != null && selectedTb.Rows.Count > 0)
- //{
- // if (MessageBox.Show("存在初检结果为未初检的数据,请确认是否继续?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) != DialogResult.Yes)
- // {
- // return;
- // }
- //}
- ////判断是否存在相同的轧批号,同一个认证机构同时申报
- //dvDown.RowFilter = "";
- //var query = from data in dataTable1.AsEnumerable()
- // where "true" == data.Field<string>("check")
- // group data by new { t1 = data.Field<string>("BATCH_NO"), t2 = data.Field<string>("CERT_INST_NAME") }
- // into r
- // select new
- // {
- // count = r.Count(),
- // batch_no = r.Key.t1,
- // cert_inst_name = r.Key.t2,
- // };
- //if (query.ToList().Count > 0)
- //{
- // query.ToList().ForEach(q =>
- // {
- // if (q.count > 1)
- // {
- // if (MessageBox.Show("存在" + q.count + "条轧批号【" + q.batch_no + "】认证机构【" + q.cert_inst_name + "】的记录,请确认是否继续?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) != DialogResult.Yes)
- // {
- // return;
- // }
- // }
- // });
- //}
- if (ultraGrid1.Rows.Count == 0)
- {
- MessageBox.Show("库存信息为空!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
- return;
- }
- StringBuilder sb = new StringBuilder("[");
- Dictionary<string, string> openWith = new Dictionary<string, string>();
- int tf = 0;
- foreach (UltraGridRow row in this.ultraGrid1.Rows)
- {
- if (row.Cells["check"].Value.ToString().ToLower() == "true")
- {
- if (!row.Cells["PHYFSTSRESULT"].Value.ToString().Equals("1") || !row.Cells["PHYFSTSRESULT"].Text.ToString().Equals("合格"))
- {
- MessageBox.Show(row.Cells["MATERIAL_NO"].Value.ToString()+"还未初检合格不可申报!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
- return;
- }
- if (tf == 0)
- {
- openWith.Add("CERT_INST_CODE", row.Cells["CERT_INST_CODE"].Value.ToString());//认证机构代码
- openWith.Add("CERT_INST_NAME", row.Cells["CERT_INST_NAME"].Value.ToString());//认证机构
- openWith.Add("MEMO", row.Cells["MEMO"].Value.ToString());//备注
- openWith.Add("CREATE_ID", row.Cells["CREATE_ID"].Value.ToString());
- openWith.Add("CREATE_NAME", row.Cells["CREATE_NAME"].Value.ToString());
- openWith.Add("CERT_NO", row.Cells["CERT_NO"].Value.ToString());//认证申报编号
- openWith.Add("CERT_STATUS", row.Cells["CERT_STATUS"].Value.ToString());//确认状态
- openWith.Add("APPLY_ORG_NO", row.Cells["APPLY_ORG_NO"].Value.ToString());//申请机构编码
- openWith.Add("APPLY_ORG_DESC", row.Cells["APPLY_ORG_DESC"].Value.ToString());//申请机构
- openWith.Add("DEP_TYPE_CODE", row.Cells["DEP_TYPE_CODE"].Value.ToString());//部门级别
- openWith.Add("DUTY_ID", row.Cells["DUTY_ID"].Value.ToString());//岗位id
- openWith.Add("INSTANCE_ID", row.Cells["INSTANCE_ID"].Value.ToString());//流程实例id
- openWith.Add("MATERIAL_NO", row.Cells["MATERIAL_NO"].Value.ToString());//产品序号
- openWith.Add("DESIGN_KEY", row.Cells["DESIGN_KEY"].Value.ToString());//订单号
- openWith.Add("PSC", row.Cells["PSC"].Value.ToString());//产品规范代码
- openWith.Add("PROD_CODE", row.Cells["PROD_CODE"].Value.ToString());//产品名称代码
- openWith.Add("PROD_NAME", row.Cells["PROD_NAME"].Value.ToString());//产品名称
- openWith.Add("STEEL_CODE", row.Cells["STEEL_CODE"].Value.ToString());//产品牌号代码
- openWith.Add("STEEL_NAME", row.Cells["STEEL_NAME"].Value.ToString());//产品牌号
- openWith.Add("STD_CODE", row.Cells["STD_CODE"].Value.ToString());//执行标准代码
- openWith.Add("STD_NAME", row.Cells["STD_NAME"].Value.ToString());//执行标准
- openWith.Add("DELIVERY_STATE_CODE", row.Cells["DELIVERY_STATE_CODE"].Value.ToString());//交货状态代码
- openWith.Add("DELIVERY_STATE_DESC", row.Cells["DELIVERY_STATE_DESC"].Value.ToString());//交货状态
- openWith.Add("DELIVERY_DATE", row.Cells["DELIVERY_DATE"].Value.ToString());//交货日期
- openWith.Add("CUT_TYPE", row.Cells["CUT_TYPE"].Value.ToString());//切边状态
- openWith.Add("HEAT_NO", row.Cells["HEAT_NO"].Value.ToString());//炉号
- openWith.Add("BATCH_NO", row.Cells["BATCH_NO"].Value.ToString());//轧批号
- openWith.Add("INSPECTION_LOT", row.Cells["INSPECTION_LOT"].Value.ToString());//检验号
- openWith.Add("BOARD_NO", row.Cells["BOARD_NO"].Value.ToString());//母板号
- openWith.Add("THICK", row.Cells["THICK"].Value.ToString());//厚度
- openWith.Add("WIDTH", row.Cells["WIDTH"].Value.ToString());//宽度
- openWith.Add("LENGTH", row.Cells["LENGTH"].Value.ToString());//长度
- openWith.Add("MAT_WEIGHT", row.Cells["MAT_WEIGHT"].Value.ToString());//重量
- openWith.Add("PLINE_CODE", row.Cells["PLINE_CODE"].Value.ToString());//产线代码
- openWith.Add("PLINE_NAME", row.Cells["PLINE_NAME"].Value.ToString());//产线名称
- openWith.Add("PSC_DESC", row.Cells["PSC_DESC"].Value.ToString());//产品规范
- openWith.Add("finalResults", row.Cells["判定结果"].Value.ToString());//判定结果
- openWith.Add("APPROACH", row.Cells["approach"].Value.ToString());//定尺方式
- openWith.Add("storageTime", row.Cells["storageTime"].Value.ToString());//入库时间
- openWith.Add("PHYFSTSRESULT", row.Cells["PHYFSTSRESULT"].Value.ToString());//初检结果
- openWith.Add("PHYFSTSRESULT1", row.Cells["PHYFSTSRESULT1"].Value.ToString());//是否已船检
- openWith.Add("INCEPTCORPCODE", row.Cells["INCEPTCORPCODE"].Value.ToString());//收货单位
- openWith.Add("BUYERCODE", row.Cells["BUYERCODE"].Value.ToString());//合同单位
- openWith.Add("CONTRACTNO", row.Cells["合同号"].Value.ToString());//合同号
- openWith.Add("VESSEL", row.Cells["VESSEL"].Value.ToString());//类别
- sb.Append(JsonConvert.SerializeObject(openWith));
- }
- if (tf != 0)
- {
- sb.Append(",");
- openWith["CERT_INST_CODE"] = row.Cells["CERT_INST_CODE"].Value.ToString();
- openWith["CERT_INST_NAME"] = row.Cells["CERT_INST_NAME"].Value.ToString();
- openWith["MEMO"] = row.Cells["MEMO"].Value.ToString();
- openWith["CREATE_ID"] = row.Cells["CREATE_ID"].Value.ToString();
- openWith["CREATE_NAME"] = row.Cells["CREATE_NAME"].Value.ToString();
- openWith["CERT_NO"] = row.Cells["CERT_NO"].Value.ToString();
- openWith["CERT_STATUS"] = row.Cells["CERT_STATUS"].Value.ToString();
- openWith["APPLY_ORG_NO"] = row.Cells["APPLY_ORG_NO"].Value.ToString();
- openWith["APPLY_ORG_DESC"] = row.Cells["APPLY_ORG_DESC"].Value.ToString();
- openWith["DEP_TYPE_CODE"] = row.Cells["DEP_TYPE_CODE"].Value.ToString();
- openWith["DUTY_ID"] = row.Cells["DUTY_ID"].Value.ToString();
- openWith["INSTANCE_ID"] = row.Cells["INSTANCE_ID"].Value.ToString();
- openWith["MATERIAL_NO"] = row.Cells["MATERIAL_NO"].Value.ToString();
- openWith["DESIGN_KEY"] = row.Cells["DESIGN_KEY"].Value.ToString();
- openWith["PSC"] = row.Cells["PSC"].Value.ToString();
- openWith["PROD_CODE"] = row.Cells["PROD_CODE"].Value.ToString();
- openWith["PROD_NAME"] = row.Cells["PROD_NAME"].Value.ToString();
- openWith["STEEL_CODE"] = row.Cells["STEEL_CODE"].Value.ToString();
- openWith["STEEL_NAME"] = row.Cells["STEEL_NAME"].Value.ToString();
- openWith["STD_CODE"] = row.Cells["STD_CODE"].Value.ToString();
- openWith["STD_NAME"] = row.Cells["STD_NAME"].Value.ToString();
- openWith["DELIVERY_STATE_CODE"] = row.Cells["DELIVERY_STATE_CODE"].Value.ToString();
- openWith["DELIVERY_STATE_DESC"] = row.Cells["DELIVERY_STATE_DESC"].Value.ToString();
- openWith["DELIVERY_DATE"] = row.Cells["DELIVERY_DATE"].Value.ToString();
- openWith["CUT_TYPE"] = row.Cells["CUT_TYPE"].Value.ToString();
- openWith["HEAT_NO"] = row.Cells["HEAT_NO"].Value.ToString();
- openWith["BATCH_NO"] = row.Cells["BATCH_NO"].Value.ToString();
- openWith["INSPECTION_LOT"] = row.Cells["INSPECTION_LOT"].Value.ToString();
- openWith["BOARD_NO"] = row.Cells["BOARD_NO"].Value.ToString();
- openWith["THICK"] = row.Cells["THICK"].Value.ToString();
- openWith["WIDTH"] = row.Cells["WIDTH"].Value.ToString();
- openWith["LENGTH"] = row.Cells["LENGTH"].Value.ToString();
- openWith["MAT_WEIGHT"] = row.Cells["MAT_WEIGHT"].Value.ToString();
- openWith["PLINE_CODE"] = row.Cells["PLINE_CODE"].Value.ToString();
- openWith["PLINE_NAME"] = row.Cells["PLINE_NAME"].Value.ToString();
- openWith["PSC_DESC"] = row.Cells["PSC_DESC"].Value.ToString();//产品规范
- openWith["finalResults"] = row.Cells["判定结果"].Value.ToString();//判定结果
- openWith["APPROACH"] = row.Cells["approach"].Value.ToString();//定尺方式
- openWith["storageTime"] = row.Cells["storageTime"].Value.ToString();//入库时间
- openWith["PHYFSTSRESULT"] = row.Cells["PHYFSTSRESULT"].Value.ToString();//初检结果
- openWith["PHYFSTSRESULT1"] = row.Cells["PHYFSTSRESULT1"].Value.ToString();//是否已船检
- openWith["INCEPTCORPCODE"] = row.Cells["INCEPTCORPCODE"].Value.ToString();//收货单位
- openWith["BUYERCODE"] = row.Cells["BUYERCODE"].Value.ToString();//合同单位
- openWith["CONTRACTNO"] = row.Cells["合同号"].Value.ToString();//合同号
- openWith["VESSEL"] = row.Cells["VESSEL"].Value.ToString();//类别
- sb.Append(JsonConvert.SerializeObject(openWith));
- }
- tf = tf + 1;
- }
- }
- sb.Append("]");
- string sbb = sb.ToString();
- //JArray jo = (JArray)JsonConvert.DeserializeObject(sbb);
- //查询数据库里的数据
- CoreClientParam ccp = new CoreClientParam();
- DataTable datatable = new DataTable();
- ccp.ServerName = "QCM.JHY01.JHY0103.AddThirdInfo";
- ccp.MethodName = "addList2";
- ccp.ServerParams = new object[] { sbb, this.UserInfo.GetUserID(), this.UserInfo.GetUserName() };
- ccp.SourceDataTable = this.dataSet1.Tables[0];
- ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- if (ccp.ReturnCode != -1)
- {
- MessageBox.Show("认证申报成功", "提示", MessageBoxButtons.OK, MessageBoxIcon.None);
- }
- this.DoQuery();
- }
- catch (Exception ex)
- {
- System.Diagnostics.Debug.WriteLine(ex.ToString());
- MessageBox.Show("系统出错,请联系管理人员", "警告");
- }
- }
- #endregion
- #region 撤销认证申报
- private void DoUnAdd()
- {
- try
- {
- if (this.ultraTabControl1.Tabs[0].Selected)
- {
- MessageBox.Show("请选择申报记录!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
- return;
- }
- if (MessageBox.Show("确认撤销申报?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
- {
- return;
- }
-
- if (this.ultraTabControl1.Tabs[3].Selected)
- {
- foreach (UltraGridRow ugr in this.ultraGrid5.Rows)
- {
- if (ugr.Cells["CHECK"].Value.ToString().ToLower() == "true")
- {
- string cert_no = ugr.Cells["认证申报编号"].Value.ToString();
- string batch_no = ugr.Cells["BATCH_NO"].Value.ToString();
- string material_no = ugr.Cells["MATERIAL_NO"].Value.ToString();
- string cert_inst_code = ugr.Cells["认证机构代码"].Value.ToString();
- Hashtable ht = new Hashtable();
- ht.Add("CERT_NO", cert_no);
- ht.Add("BATCH_NO", batch_no);
- ht.Add("MATERIAL_NO", material_no);
- ht.Add("USER_NAME", this.UserInfo.GetUserName());
- ht.Add("CERT_INST_CODE", cert_inst_code);
- CoreClientParam ccp = new CoreClientParam();
- ccp.ServerName = "QCM.JHY01.JHY0103.DeleteMaterialInfo";
- ccp.MethodName = "deleteMD";
- 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
- #region 剔除子板
- private void DoDelz()
- {
- try
- {
- if (this.ultraTabControl1.Tabs[0].Selected)
- {
- MessageBox.Show("请选择申报记录!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
- return;
- }
- if (MessageBox.Show("确认剔除子板?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
- {
- return;
- }
- String CERT_NO = "";
- String MATERIAL_NO = "";
- int num = 0;
- string fh = "";
- if (this.ultraTabControl1.Tabs[1].Selected)
- {
- UltraGridRow row = ultraGrid2.ActiveRow;
- CERT_NO = row.Cells["CERT_NO"].Value.ToString();//认证申报编号
- MATERIAL_NO = row.Cells["MATERIAL_NO"].Value.ToString();//产品序号
- }
- else if (this.ultraTabControl1.Tabs[3].Selected)
- {
- foreach (UltraGridRow ugr in this.ultraGrid5.Rows)
- {
- if (ugr.Cells["CHECK"].Value.ToString().ToLower() == "true")
- {
- num = num + 1;
- if (num <= 1)
- {
- CERT_NO = ugr.Cells["认证申报编号"].Value.ToString();
- MATERIAL_NO = ugr.Cells["MATERIAL_NO"].Value.ToString();
- fh = ",";
- }
- else
- {
- CERT_NO = CERT_NO + fh + ugr.Cells["认证申报编号"].Value.ToString();
- MATERIAL_NO = MATERIAL_NO + fh + ugr.Cells["MATERIAL_NO"].Value.ToString();
- }
- }
- }
-
- }
-
- Hashtable columnMap = new Hashtable();
- this.dataSet3.Clear();
- CoreClientParam ccp = new CoreClientParam();
- ccp.ServerName = "QCM.JHY01.JHY0103.DeleteMaterialInfo";
- ccp.MethodName = "delete2";
- ccp.ServerParams = new object[] { CERT_NO,MATERIAL_NO, this.UserInfo.GetUserName() };
- ccp.SourceDataTable = this.dataSet3.Tables[0];
- this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
- //ultraGrid2AfterRowActivate();
- this.DoQuery();//查询
- }
- catch (Exception ex)
- {
- System.Diagnostics.Debug.WriteLine(ex.ToString());
- MessageBox.Show("系统出错,请联系管理人员", "警告");
- }
- }
- #endregion
- #region 申报记录 事件
- private void ultraGrid2_AfterRowActivate(object sender, EventArgs e)
- {
- ultraGrid2AfterRowActivate();
- }
- public void ultraGrid2AfterRowActivate()
- {
- try
- {
- UltraGridRow row = ultraGrid2.ActiveRow;
- if (row == null)
- {
- this.dataSet3.Clear();
- }
- String CERT_NO = row.Cells["CERT_NO"].Value.ToString();//认证申报编号
- String BATCH_NO = "";//轧批号
- String design_key = "";//design_key
- this.dataSet3.Clear();
- CoreClientParam ccp = new CoreClientParam();
- ccp.ServerName = "QCM.JHY01.JHY0103.QuerryThirdInfo";
- ccp.MethodName = "QueryDetailInfo";
- ccp.ServerParams = new object[] { CERT_NO, BATCH_NO, design_key };
- ccp.SourceDataTable = this.dataSet3.Tables[0];
- this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
- }
- 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 (ultraTabControl1.SelectedTab.Text == "库存信息")
- {
- this.ToolBarItemEnable(this, "UnAdd", false);
- this.ToolBarItemEnable(this, "Del", false);
- this.ToolBarItemEnable(this, "Add", true);
- this.ToolBarItemEnable(this, "Excel", false);
- this.ToolBarItemEnable(this, "DoQuote", false);
- this.ToolBarItemEnable(this, "Excel2", true);
- checkBox2.Checked = false;
- }
- if (ultraTabControl1.SelectedTab.Index == 1)
- {
- this.ToolBarItemEnable(this, "Add", false);
- this.ToolBarItemEnable(this, "UnAdd", false);
- this.ToolBarItemEnable(this, "Del", false);
- this.ToolBarItemEnable(this, "Excel", false);
- this.ToolBarItemEnable(this, "DoQuote", false);
- this.ToolBarItemEnable(this, "Excel2", false);
- //this.PLINE_NAME.Hide();
- checkBox2.Checked = false;
-
- }
- if (ultraTabControl1.SelectedTab.Index == 3)
- {
- this.ToolBarItemEnable(this, "Add", false);
- this.ToolBarItemEnable(this, "UnAdd", true);
- this.ToolBarItemEnable(this, "Del", true);
- this.ToolBarItemEnable(this, "Excel", true);
- this.ToolBarItemEnable(this, "DoQuote", true);
- this.ToolBarItemEnable(this, "Excel2", false);
- checkBox2.Checked = false;
- }
-
- }
- #endregion
- private void ultraGrid1_InitializeRow(object sender, InitializeRowEventArgs e)
- {
- if (e.Row.Cells["PHYFSTSRESULT1"].Value.ToString().Equals("船检合格"))
- {
- e.Row.Appearance.ForeColor = Color.Red;
- }
- }
- 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
- }
- }
|