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 Core.Mes.Client.Comm.Server; using Core.Mes.Client.Comm.Control; using Infragistics.Win.UltraWinGrid; using System.Collections; using Core.Mes.Client.Comm.Tool; using Core.StlMes.Client.YdmPipeManage.Controls; namespace Core.StlMes.Client.YdmPipeManage { public partial class FrmVarietie : FrmBase { string strStartTime = "2015-01-01 00:00:00";//开始时间 string strEndTime = "";//结束时间 DataTable ds1 = new DataTable(); DataTable ds2 = new DataTable(); DataTable ds3 = new DataTable(); DataTable ds4 = new DataTable(); public FrmVarietie(OpeBase ob,string StartTime) { this.ob = ob; strStartTime = StartTime; //strEndTime = EndTime; InitializeComponent(); } private void FrmVarietie_Load(object sender, EventArgs e) { //doQuery(); } protected override void OnLoad(EventArgs e) { base.OnLoad(e); PipeManageClass.SetUltraGridRowFilter(ref GridProducode, true); PipeManageClass.SetUltraGridRowFilter(ref GridKind, true); PipeManageClass.SetUltraGridRowFilter(ref ultraGrid1, true); PipeManageClass.SetUltraGridRowFilter(ref GridSteel, true); PipeManageClass.SetUltraGridRowFilter(ref GridzbSteel, true); PipeManageClass.SetUltraGridRowFilter(ref ultraGrid2, true); PipeManageClass.SetUltraGridRowFilter(ref GridSpec, true); PipeManageClass.SetUltraGridRowFilter(ref GridzbSpec, true); PipeManageClass.SetUltraGridRowFilter(ref ultraGrid3, true); PipeManageClass.SetUltraGridRowFilter(ref GridModel, true); PipeManageClass.SetUltraGridRowFilter(ref GridzbModel, true); PipeManageClass.SetUltraGridRowFilter(ref ultraGrid4, true); PipeManageClass.SetUltraGridRowFilter(ref ultraGrid5, true); PipeManageClass.SetUltraGridRowFilter(ref ultraGrid6, true); PipeManageClass.SetUltraGridRowFilter(ref ultraGrid7, true); PipeManageClass.SetUltraGridRowFilter(ref ultraGrid8, true); PipeManageClass.SetUltraGridRowFilter(ref ultraGrid9, true); PipeManageClass.SetUltraGridRowFilter(ref ultraGrid10, true); } /// /// 处理ultraToolbarsManager1的点击事件 /// /// /// private void ultraToolbarsManager1_ToolClick(object sender, Infragistics.Win.UltraWinToolbars.ToolClickEventArgs e) { switch (e.Tool.Key) { case "Query": doQuery(); break; case "Save": doAdd(); break; case "Delete": doDelete(); break; case "Refresh": doRefresh(); break; case "Close": this.Close(); break; default: break; } } /// /// 查询 /// private void doQuery() { if (ultraTabControl1.SelectedTab.Key.Equals("0")) { DataTable dt1 = ServerHelper.GetData("com.steering.pss.ydm.pipemanage.FrmVarietie.getKind", null, this.ob); GridHelper.CopyDataToDatatable(ref dt1, ref dataTable1, true); GridHelper.RefreshAndAutoSize(GridProducode); } else if (ultraTabControl1.SelectedTab.Key.Equals("1")) { DataTable dt1 = ServerHelper.GetData("com.steering.pss.ydm.pipemanage.FrmVarietie.getSteel", null, this.ob); GridHelper.CopyDataToDatatable(ref dt1, ref dtCX_Steel, true); GridHelper.RefreshAndAutoSize(GridSteel); } else if (ultraTabControl1.SelectedTab.Key.Equals("2")) { DataTable dt1 = ServerHelper.GetData("com.steering.pss.ydm.pipemanage.FrmVarietie.getSpec", null, this.ob); GridHelper.CopyDataToDatatable(ref dt1, ref dtCX_Spec, true); GridHelper.RefreshAndAutoSize(GridSpec); } else if (ultraTabControl1.SelectedTab.Key.Equals("3")) { DataTable dt1 = ServerHelper.GetData("com.steering.pss.ydm.pipemanage.FrmVarietie.getModel", null, this.ob); GridHelper.CopyDataToDatatable(ref dt1, ref dtCX_Model, true); GridHelper.RefreshAndAutoSize(GridModel); } else if (ultraTabControl1.SelectedTab.Key.Equals("4")) { DataTable dt1 = ServerHelper.GetData("com.steering.pss.ydm.pipemanage.FrmVarietie.getFactory", null, this.ob); GridHelper.CopyDataToDatatable(ref dt1, ref dataTable4, true); GridHelper.RefreshAndAutoSize(this.ultraGrid5); } else { DataTable dt1 = ServerHelper.GetData("com.steering.pss.ydm.pipemanage.FrmVarietie.getGrade", null, this.ob); GridHelper.CopyDataToDatatable(ref dt1, ref dataTable7, true); GridHelper.RefreshAndAutoSize(this.ultraGrid8); } doQueryZB(); } /// /// 保存 /// private void doAdd() { if (ultraTabControl1.SelectedTab.Key.Equals("0")) { #region 品名对应关系 UltraGridRow row = GridProducode.ActiveRow; UltraGridRow row1 = GridKind.ActiveRow; int counm = 0; if (row==null) { MessageUtil.ShowTips("无数据,不能进行此操作!"); return; } if (row.IsFilterRow) { MessageUtil.ShowTips("请选择产销系统品名!"); return; } if (row1 == null) { MessageUtil.ShowTips("质保无数据,不能进行此操作!"); return; } ArrayList list = new ArrayList(); //string strwhere = ""; foreach (Infragistics.Win.UltraWinGrid.UltraGridRow uRow in GridKind.Rows) { if (Convert.ToBoolean(uRow.Cells["CHK"].Text) == true) { counm += 1; ArrayList listSave = new ArrayList(); //listSave.Add(row.Cells["PRODUCCODE"].Text.Trim()); listSave.Add(uRow.Cells["kind"].Text); DataTable dt = ServerHelper.GetData("com.steering.pss.ydm.pipemanage.FrmVarietie.getQueryKind1", new object[] { listSave }, this.ob); if (dt.Rows.Count > 0) { MessageUtil.ShowTips("您选择的该条质保系统品名" + "【" + uRow.Cells["kind"].Text + "】" + "对应关系已存在,请重新选择!"); return; } ArrayList pram = new ArrayList(); pram.Add(row.Cells["PRODUCCODE"].Text); pram.Add(row.Cells["PRODUCNAME"].Text); pram.Add(row.Cells["PRODUC_JX"].Text); pram.Add(row.Cells["PRODUC_ENG"].Text); pram.Add(uRow.Cells["kind"].Text); pram.Add(this.UserInfo.GetUserName()); list.Add(pram); //strwhere += uRow.Cells["kind"].Text.Trim() + ","; } } //DataTable dt1 = PipeManageClass.RowFilterDataTable(ds1, strwhere); //GridHelper.CopyDataToDatatable(ref dt1, ref dataTable3, true); //GridHelper.RefreshAndAutoSize(GridKind); if (counm == 0) { MessageUtil.ShowTips("请选择质保系统品名!"); return; } int count = ServerHelper.SetData("com.steering.pss.ydm.pipemanage.FrmVarietie.addProduct", new Object[] { list }, this.ob); if (count > 0) { MessageUtil.ShowTips("保存成功!"); doQueryProduct(); } #endregion } else if (ultraTabControl1.SelectedTab.Key.Equals("1")) { #region 钢级对应关系 UltraGridRow row = GridSteel.ActiveRow; UltraGridRow row1 = GridzbSteel.ActiveRow; int counm = 0; if (row == null) { MessageUtil.ShowTips("无数据,不能进行此操作!"); return; } if (row.IsFilterRow) { MessageUtil.ShowTips("请选择产销系统钢级!"); return; } if (row1 == null) { MessageUtil.ShowTips("质保无数据,不能进行此操作!"); return; } ArrayList list = new ArrayList(); foreach (Infragistics.Win.UltraWinGrid.UltraGridRow uRow in GridzbSteel.Rows) { if (Convert.ToBoolean(uRow.Cells["CHK"].Text) == true) { counm += 1; ArrayList listSave = new ArrayList(); //listSave.Add(row.Cells["STEELCODE"].Text.Trim()); listSave.Add(uRow.Cells["steellevel"].Text); DataTable dt = ServerHelper.GetData("com.steering.pss.ydm.pipemanage.FrmVarietie.getQuerySteel1", new object[] { listSave }, this.ob); if (dt.Rows.Count > 0) { MessageUtil.ShowTips("您选择该条质保系统钢级" +"【"+ uRow.Cells["steellevel"].Text +"】"+ "对应关系已存在,请重新选择!"); return; } ArrayList pram = new ArrayList(); pram.Add(row.Cells["STEELCODE"].Text); pram.Add(row.Cells["STEELNAME"].Text); pram.Add(uRow.Cells["steellevel"].Text); pram.Add(this.UserInfo.GetUserName()); list.Add(pram); } } if (counm == 0) { MessageUtil.ShowTips("请选择质保系统钢级!"); return; } int count = ServerHelper.SetData("com.steering.pss.ydm.pipemanage.FrmVarietie.addSteel", new Object[] { list }, this.ob); if (count > 0) { MessageUtil.ShowTips("保存成功!"); doQueryProduct(); } #endregion} } else if (ultraTabControl1.SelectedTab.Key.Equals("2")) { #region 规格对应关系 UltraGridRow row = GridSpec.ActiveRow; UltraGridRow row1 = GridzbSpec.ActiveRow; int counm = 0; if (row == null) { MessageUtil.ShowTips("无数据,不能进行此操作!"); return; } if (row.IsFilterRow) { MessageUtil.ShowTips("请选择产销系统规格!"); return; } if (row1 == null) { MessageUtil.ShowTips("质保无数据,不能进行此操作!"); return; } ArrayList list = new ArrayList(); foreach (Infragistics.Win.UltraWinGrid.UltraGridRow uRow in GridzbSpec.Rows) { if (Convert.ToBoolean(uRow.Cells["CHK"].Text) == true) { counm += 1; ArrayList listSave = new ArrayList(); //listSave.Add(row.Cells["SPEC_CODE"].Text.Trim()); listSave.Add(uRow.Cells["gg"].Text); DataTable dt = ServerHelper.GetData("com.steering.pss.ydm.pipemanage.FrmVarietie.getQuerySpec1", new object[] { listSave }, this.ob); if (dt.Rows.Count > 0) { MessageUtil.ShowTips("您选择的该条质保系统规格" +"【"+ uRow.Cells["gg"].Text+"】" + "对应关系已存在,请重新选择!"); return; } ArrayList pram = new ArrayList(); pram.Add(row.Cells["SPEC_CODE"].Text); pram.Add(row.Cells["SPEC_NAME"].Text); pram.Add(uRow.Cells["gg"].Text); pram.Add(this.UserInfo.GetUserName()); list.Add(pram); } } if (counm == 0) { MessageUtil.ShowTips("请选择质保系统规格!"); return; } int count = ServerHelper.SetData("com.steering.pss.ydm.pipemanage.FrmVarietie.addSpec", new Object[] { list }, this.ob); if (count > 0) { MessageUtil.ShowTips("保存成功!"); doQueryProduct(); } #endregion} } else if (ultraTabControl1.SelectedTab.Key.Equals("3")) { #region 扣型对应关系 UltraGridRow row = GridModel.ActiveRow; UltraGridRow row1 = GridzbModel.ActiveRow; int counm = 0; if (row == null) { MessageUtil.ShowTips("无数据,不能进行此操作!"); return; } if (row.IsFilterRow) { MessageUtil.ShowTips("请选择产销系统扣型!"); return; } if (row1 == null) { MessageUtil.ShowTips("质保无数据,不能进行此操作!"); return; } ArrayList list = new ArrayList(); foreach (Infragistics.Win.UltraWinGrid.UltraGridRow uRow in GridzbModel.Rows) { if (Convert.ToBoolean(uRow.Cells["CHK"].Text) == true) { counm += 1; ArrayList listSave = new ArrayList(); //listSave.Add(row.Cells["MODEL_CODE"].Text.Trim()); listSave.Add(uRow.Cells["typeofThread"].Text); DataTable dt = ServerHelper.GetData("com.steering.pss.ydm.pipemanage.FrmVarietie.getQueryModel1", new object[] { listSave }, this.ob); if (dt.Rows.Count > 0) { MessageUtil.ShowTips("您选择的该条质保系统扣型" + "【" + uRow.Cells["typeofThread"].Text + "】" + "对应关系已存在,请重新选择!"); return; } ArrayList pram = new ArrayList(); pram.Add(row.Cells["MODEL_CODE"].Text); pram.Add(row.Cells["MODEL_DESC"].Text); pram.Add(uRow.Cells["typeofThread"].Text); pram.Add(this.UserInfo.GetUserName()); list.Add(pram); } } if (counm == 0) { MessageUtil.ShowTips("请选择质保系统扣型!"); return; } int count = ServerHelper.SetData("com.steering.pss.ydm.pipemanage.FrmVarietie.addModel", new Object[] { list }, this.ob); if (count > 0) { MessageUtil.ShowTips("保存成功!"); doQueryProduct(); } #endregion } else if (ultraTabControl1.SelectedTab.Key.Equals("4")) { #region 产线对应关系 UltraGridRow row = this.ultraGrid5.ActiveRow; UltraGridRow row1 = ultraGrid7.ActiveRow; int counm = 0; if (row == null) { MessageUtil.ShowTips("无数据,不能进行此操作!"); return; } if (row.IsFilterRow) { MessageUtil.ShowTips("请选择产销系统产线!"); return; } if (row1 == null) { MessageUtil.ShowTips("质保无数据,不能进行此操作!"); return; } ArrayList list = new ArrayList(); foreach (Infragistics.Win.UltraWinGrid.UltraGridRow uRow in ultraGrid7.Rows) { if (Convert.ToBoolean(uRow.Cells["CHK"].Text) == true) { counm += 1; ArrayList listSave = new ArrayList(); //listSave.Add(row.Cells["MODEL_CODE"].Text.Trim()); listSave.Add(uRow.Cells["factory"].Text); DataTable dt = ServerHelper.GetData("com.steering.pss.ydm.pipemanage.FrmVarietie.getQueryFactory1", new object[] { listSave }, this.ob); if (dt.Rows.Count > 0) { MessageUtil.ShowTips("您选择的该条质保系统产线" + "【" + uRow.Cells["factory"].Text + "】" + "对应关系已存在,请重新选择!"); return; } ArrayList pram = new ArrayList(); pram.Add(row.Cells["PLINE_CODE"].Text); pram.Add(row.Cells["PLINE_NAME"].Text); pram.Add(uRow.Cells["factory"].Text); pram.Add(this.UserInfo.GetUserName()); list.Add(pram); } } if (counm == 0) { MessageUtil.ShowTips("请选择质保系统产线!"); return; } int count = ServerHelper.SetData("com.steering.pss.ydm.pipemanage.FrmVarietie.addFactory", new Object[] { list }, this.ob); if (count > 0) { MessageUtil.ShowTips("保存成功!"); doQueryProduct(); } #endregion } else { #region 钢种对应关系 UltraGridRow row = this.ultraGrid8.ActiveRow; UltraGridRow row1 = ultraGrid10.ActiveRow; int counm = 0; if (row == null) { MessageUtil.ShowTips("无数据,不能进行此操作!"); return; } if (row.IsFilterRow) { MessageUtil.ShowTips("请选择产销系统钢种!"); return; } if (row1 == null) { MessageUtil.ShowTips("质保无数据,不能进行此操作!"); return; } ArrayList list = new ArrayList(); foreach (Infragistics.Win.UltraWinGrid.UltraGridRow uRow in ultraGrid10.Rows) { if (Convert.ToBoolean(uRow.Cells["CHK"].Text) == true) { counm += 1; ArrayList listSave = new ArrayList(); //listSave.Add(row.Cells["MODEL_CODE"].Text.Trim()); listSave.Add(uRow.Cells["steelgrade"].Text); DataTable dt = ServerHelper.GetData("com.steering.pss.ydm.pipemanage.FrmVarietie.getQueryGrade1", new object[] { listSave }, this.ob); if (dt.Rows.Count > 0) { MessageUtil.ShowTips("您选择的该条质保系统钢种" + "【" + uRow.Cells["steelgrade"].Text.Trim() + "】" + "对应关系已存在,请重新选择!"); return; } ArrayList pram = new ArrayList(); pram.Add(row.Cells["GRADECODE"].Text); pram.Add(row.Cells["GRADENAME"].Text); pram.Add(uRow.Cells["steelgrade"].Text); pram.Add(this.UserInfo.GetUserName()); list.Add(pram); } } if (counm == 0) { MessageUtil.ShowTips("请选择质保系统钢种!"); return; } int count = ServerHelper.SetData("com.steering.pss.ydm.pipemanage.FrmVarietie.addGrade", new Object[] { list }, this.ob); if (count > 0) { MessageUtil.ShowTips("保存成功!"); doQueryProduct(); } #endregion } } /// /// 删除 /// private void doDelete() { if (ultraTabControl1.SelectedTab.Key.Equals("0")) { #region 品名对应关系 UltraGridRow row = ultraGrid1.ActiveRow; int counm = 0; if (row == null) { MessageUtil.ShowTips("无数据,不能进行此操作!"); return; } foreach (Infragistics.Win.UltraWinGrid.UltraGridRow uRow in ultraGrid1.Rows) { if (Convert.ToBoolean(uRow.Cells["CHK"].Text) == true) { counm += 1; } } if (counm == 0) { MessageUtil.ShowTips("请选择产销系统与质保系统品名对应关系!"); return; } ArrayList list = new ArrayList(); foreach (Infragistics.Win.UltraWinGrid.UltraGridRow uRow in ultraGrid1.Rows) { if (Convert.ToBoolean(uRow.Cells["CHK"].Text) == true) { ArrayList pram = new ArrayList(); pram.Add(row.Cells["PRODUCCODE"].Text); pram.Add(uRow.Cells["ZB_PRODUCNAME"].Text); list.Add(pram); } } int count = ServerHelper.SetData("com.steering.pss.ydm.pipemanage.FrmVarietie.deleteProduct", new Object[] { list }, this.ob); if (count > 0) { MessageUtil.ShowTips("删除成功!"); doQueryProduct(); } else { MessageUtil.ShowTips("删除失败!"); } #endregion } else if (ultraTabControl1.SelectedTab.Key.Equals("1")) { #region 钢级对应关系 UltraGridRow row = ultraGrid2.ActiveRow; int counm = 0; if (row == null) { MessageUtil.ShowTips("无数据,不能进行此操作!"); return; } foreach (Infragistics.Win.UltraWinGrid.UltraGridRow uRow in ultraGrid2.Rows) { if (Convert.ToBoolean(uRow.Cells["CHK"].Text) == true) { counm += 1; } } if (counm == 0) { MessageUtil.ShowTips("请选择产销系统与质保系统钢级对应关系!"); return; } ArrayList list = new ArrayList(); foreach (Infragistics.Win.UltraWinGrid.UltraGridRow uRow in ultraGrid2.Rows) { if (Convert.ToBoolean(uRow.Cells["CHK"].Text) == true) { ArrayList pram = new ArrayList(); pram.Add(row.Cells["STEELCODE"].Text); pram.Add(uRow.Cells["ZB_STEELNAME"].Text); list.Add(pram); } } int count = ServerHelper.SetData("com.steering.pss.ydm.pipemanage.FrmVarietie.deleteSteel", new Object[] { list }, this.ob); if (count > 0) { MessageUtil.ShowTips("删除成功!"); doQueryProduct(); } else { MessageUtil.ShowTips("删除失败!"); } #endregion } else if (ultraTabControl1.SelectedTab.Key.Equals("2")) { #region 规格对应关系 UltraGridRow row = ultraGrid3.ActiveRow; int counm = 0; if (row == null) { MessageUtil.ShowTips("无数据,不能进行此操作!"); return; } foreach (Infragistics.Win.UltraWinGrid.UltraGridRow uRow in ultraGrid3.Rows) { if (Convert.ToBoolean(uRow.Cells["CHK"].Text) == true) { counm += 1; } } if (counm == 0) { MessageUtil.ShowTips("请选择产销系统与质保系统规格对应关系!"); return; } ArrayList list = new ArrayList(); foreach (Infragistics.Win.UltraWinGrid.UltraGridRow uRow in ultraGrid3.Rows) { if (Convert.ToBoolean(uRow.Cells["CHK"].Text) == true) { ArrayList pram = new ArrayList(); pram.Add(row.Cells["SPEC_CODE"].Text); pram.Add(uRow.Cells["ZB_SPEC_NAME"].Text); list.Add(pram); } } int count = ServerHelper.SetData("com.steering.pss.ydm.pipemanage.FrmVarietie.deleteSpec", new Object[] { list }, this.ob); if (count > 0) { MessageUtil.ShowTips("删除成功!"); doQueryProduct(); } else { MessageUtil.ShowTips("删除失败!"); } #endregion } else if (ultraTabControl1.SelectedTab.Key.Equals("3")) { #region 扣型对应关系 UltraGridRow row = ultraGrid4.ActiveRow; int counm = 0; if (row == null) { MessageUtil.ShowTips("无数据,不能进行此操作!"); return; } foreach (Infragistics.Win.UltraWinGrid.UltraGridRow uRow in ultraGrid4.Rows) { if (Convert.ToBoolean(uRow.Cells["CHK"].Text) == true) { counm += 1; } } if (counm == 0) { MessageUtil.ShowTips("请选择产销系统与质保系统扣型对应关系!"); return; } ArrayList list = new ArrayList(); foreach (Infragistics.Win.UltraWinGrid.UltraGridRow uRow in ultraGrid4.Rows) { if (Convert.ToBoolean(uRow.Cells["CHK"].Text) == true) { ArrayList pram = new ArrayList(); pram.Add(row.Cells["MODEL_CODE"].Text); pram.Add(uRow.Cells["ZB_MODEL_DESC"].Text); list.Add(pram); } } int count = ServerHelper.SetData("com.steering.pss.ydm.pipemanage.FrmVarietie.deleteModel", new Object[] { list }, this.ob); if (count > 0) { MessageUtil.ShowTips("删除成功!"); doQueryProduct(); } else { MessageUtil.ShowTips("删除失败!"); } #endregion } else if (ultraTabControl1.SelectedTab.Key.Equals("4")) { #region 产线对应关系 UltraGridRow row = ultraGrid6.ActiveRow; int counm = 0; if (row == null) { MessageUtil.ShowTips("无数据,不能进行此操作!"); return; } foreach (Infragistics.Win.UltraWinGrid.UltraGridRow uRow in ultraGrid6.Rows) { if (Convert.ToBoolean(uRow.Cells["CHK"].Text) == true) { counm += 1; } } if (counm == 0) { MessageUtil.ShowTips("请选择产销系统与质保系统产线对应关系!"); return; } ArrayList list = new ArrayList(); foreach (Infragistics.Win.UltraWinGrid.UltraGridRow uRow in ultraGrid6.Rows) { if (Convert.ToBoolean(uRow.Cells["CHK"].Text) == true) { ArrayList pram = new ArrayList(); pram.Add(row.Cells["PLINE_CODE"].Text); pram.Add(uRow.Cells["ZB_PLINENAME"].Text); list.Add(pram); } } int count = ServerHelper.SetData("com.steering.pss.ydm.pipemanage.FrmVarietie.deleteFactory", new Object[] { list }, this.ob); if (count > 0) { MessageUtil.ShowTips("删除成功!"); doQueryProduct(); } else { MessageUtil.ShowTips("删除失败!"); } #endregion } else { #region 钢种对应关系 UltraGridRow row = ultraGrid9.ActiveRow; int counm = 0; if (row == null) { MessageUtil.ShowTips("无数据,不能进行此操作!"); return; } foreach (Infragistics.Win.UltraWinGrid.UltraGridRow uRow in ultraGrid9.Rows) { if (Convert.ToBoolean(uRow.Cells["CHK"].Text) == true) { counm += 1; } } if (counm == 0) { MessageUtil.ShowTips("请选择产销系统与质保系统钢种对应关系!"); return; } ArrayList list = new ArrayList(); foreach (Infragistics.Win.UltraWinGrid.UltraGridRow uRow in ultraGrid9.Rows) { if (Convert.ToBoolean(uRow.Cells["CHK"].Text) == true) { ArrayList pram = new ArrayList(); pram.Add(row.Cells["GRADECODE"].Text); pram.Add(uRow.Cells["ZB_GRADENAME"].Text); list.Add(pram); } } int count = ServerHelper.SetData("com.steering.pss.ydm.pipemanage.FrmVarietie.deleteGrade", new Object[] { list }, this.ob); if (count > 0) { MessageUtil.ShowTips("删除成功!"); doQueryProduct(); } else { MessageUtil.ShowTips("删除失败!"); } #endregion } } /// /// 刷新 /// private void doRefresh() { doQueryZB(); } /// /// 查询质保系统数据 /// private void doQueryZB() { try { this.Cursor = Cursors.WaitCursor; //控制鼠标的样式为等待 if (Constant.WaitingForm == null) { Constant.WaitingForm = new WaitingForm(); } Constant.WaitingForm.ShowToUser = true; Constant.WaitingForm.Show(); Constant.WaitingForm.Update(); if (ultraTabControl1.SelectedTab.Key.Equals("0")) { DataTable dt3 = ServerHelper.GetData("com.steering.pss.ydm.pipemanage.FrmVarietie.getQueryKind", null, this.ob); string intt = ""; if (dt3.Rows.Count > 0) { for (int i = 0; i < dt3.Rows.Count; i++) { intt += "'" + dt3.Rows[i]["ZB_PRODUCNAME"].ToString() + "'" + ","; } } if (intt != "") { intt = intt.Substring(1, intt.Length - 3); } else intt = ""; DataTable dt2 = ServerHelper.GetData("com.steering.pss.ydm.pipemanage.FrmVarietie.getZBKind", new object[] { strStartTime, intt }, this.ob); GridHelper.CopyDataToDatatable(ref dt2, ref dataTable3, true); GridHelper.RefreshAndAutoSize(GridKind); ds1 = dt2.Copy(); } else if (ultraTabControl1.SelectedTab.Key.Equals("1")) { DataTable dt3 = ServerHelper.GetData("com.steering.pss.ydm.pipemanage.FrmVarietie.getQuerySteel", null, this.ob); string intt = ""; if (dt3.Rows.Count > 0) { for (int i = 0; i < dt3.Rows.Count; i++) { intt += "'" + dt3.Rows[i]["ZB_STEELNAME"].ToString() + "'" + ","; } } if (intt != "") { intt = intt.Substring(1, intt.Length - 3); } else intt = ""; DataTable dt2 = ServerHelper.GetData("com.steering.pss.ydm.pipemanage.FrmVarietie.getZBSteel", new object[] { strStartTime, intt }, this.ob); GridHelper.CopyDataToDatatable(ref dt2, ref dtZB_Steel, true); GridHelper.RefreshAndAutoSize(GridzbSteel); } else if (ultraTabControl1.SelectedTab.Key.Equals("2")) { DataTable dt3 = ServerHelper.GetData("com.steering.pss.ydm.pipemanage.FrmVarietie.getQuerySpec", null, this.ob); StringBuilder intt = new StringBuilder(); ArrayList listData = new ArrayList(); string ss = ""; DataTable dt2 = null; if (dt3.Rows.Count > 0) { for (int i = 0; i < dt3.Rows.Count; i++) { intt.Append("'" + dt3.Rows[i]["ZB_SPEC_NAME"].ToString() + "'" + ","); } ss = intt.ToString(); if (ss != "") { ss = ss.Substring(1, ss.Length - 3); } dt2 = ServerHelper.GetData("com.steering.pss.ydm.pipemanage.FrmVarietie.getZBSpec", new object[] { strStartTime}, this.ob); } //string ss = intt.ToString(); //if (ss != " //{ // ss = ss.Substring(1, ss.Length - 3); //} //else // ss = ""; //DataTable dt2 = ServerHelper.GetData("com.steering.pss.ydm.pipemanage.FrmVarietie.getZBSpec", new object[] { strStartTime, ss }, this.ob); DataRow[] drs = dt2.Select("GG IN ('" + ss + "')"); foreach (DataRow dr in drs) { dt2.Rows.Remove(dr); } GridHelper.CopyDataToDatatable(ref dt2, ref dtZB_Spec, true); GridHelper.RefreshAndAutoSize(GridzbSpec); } else if (ultraTabControl1.SelectedTab.Key.Equals("3")) { DataTable dt3 = ServerHelper.GetData("com.steering.pss.ydm.pipemanage.FrmVarietie.getQueryModel", null, this.ob); string intt = ""; if (dt3.Rows.Count > 0) { for (int i = 0; i < dt3.Rows.Count; i++) { intt += "'" + dt3.Rows[i]["ZB_MODEL_DESC"].ToString() + "'" + ","; } } if (intt != "") { intt = intt.Substring(1, intt.Length - 3); } else intt = ""; DataTable dt2 = ServerHelper.GetData("com.steering.pss.ydm.pipemanage.FrmVarietie.getZBModel", new object[] { strStartTime, intt }, this.ob); GridHelper.CopyDataToDatatable(ref dt2, ref dtZB_Model, true); GridHelper.RefreshAndAutoSize(GridzbModel); } else if (ultraTabControl1.SelectedTab.Key.Equals("4")) { DataTable dt4 = ServerHelper.GetData("com.steering.pss.ydm.pipemanage.FrmVarietie.getQueryFactory", null, this.ob); string intt = ""; if (dt4.Rows.Count > 0) { for (int i = 0; i < dt4.Rows.Count; i++) { intt += "'" + dt4.Rows[i]["ZB_PLINENAME"].ToString() + "'" + ","; } } if (intt != "") { intt = intt.Substring(1, intt.Length - 3); } else intt = ""; DataTable dt2 = ServerHelper.GetData("com.steering.pss.ydm.pipemanage.FrmVarietie.getZBFactory", new object[] { strStartTime, intt }, this.ob); GridHelper.CopyDataToDatatable(ref dt2, ref dataTable6, true); GridHelper.RefreshAndAutoSize(ultraGrid7); } else { DataTable dt5 = ServerHelper.GetData("com.steering.pss.ydm.pipemanage.FrmVarietie.getQueryGrade", null, this.ob); string intt = ""; if (dt5.Rows.Count > 0) { for (int i = 0; i < dt5.Rows.Count; i++) { intt += "'" + dt5.Rows[i]["ZB_GRADENAME"].ToString() + "'" + ","; } } if (intt != "") { intt = intt.Substring(1, intt.Length - 3); } else intt = ""; DataTable dt2 = ServerHelper.GetData("com.steering.pss.ydm.pipemanage.FrmVarietie.getZBGrade", new object[] { strStartTime, intt }, this.ob); GridHelper.CopyDataToDatatable(ref dt2, ref dataTable9, true); GridHelper.RefreshAndAutoSize(ultraGrid10); } this.Cursor = Cursors.Default; Constant.WaitingForm.ShowToUser = false; Constant.WaitingForm.Close(); Constant.WaitingForm = null; } catch (Exception e) { this.Cursor = Cursors.Default; Constant.WaitingForm.ShowToUser = false; Constant.WaitingForm.Close(); Constant.WaitingForm = null; } } /// /// 产销品名对应质保品名关系 /// /// /// private void GridProducode_AfterRowActivate(object sender, EventArgs e) { doQueryProduct(); } /// /// 产销钢级对应质保钢级关系 /// /// /// private void GridSteel_AfterRowActivate(object sender, EventArgs e) { doQueryProduct(); } /// /// 产销规格对应质保规格关系 /// /// /// private void GridSpec_AfterRowActivate(object sender, EventArgs e) { doQueryProduct(); } /// /// 产销扣型对应质保扣型关系 /// /// /// private void GridModel_AfterRowActivate(object sender, EventArgs e) { doQueryProduct(); } /// /// 产销产线对应质保产线关系 /// /// /// private void ultraGrid5_AfterRowActivate(object sender, EventArgs e) { doQueryProduct(); } /// /// 产销钢种对应质保钢种关系 /// /// /// private void ultraGrid8_AfterRowActivate(object sender, EventArgs e) { doQueryProduct(); } /// /// 查询对应关系 /// private void doQueryProduct() { if (ultraTabControl1.SelectedTab.Key.Equals("0")) { UltraGridRow row = GridProducode.ActiveRow; if (row == null) return; string strProduct = row.Cells["PRODUCCODE"].Text; DataTable dt = ServerHelper.GetData("com.steering.pss.ydm.pipemanage.FrmVarietie.queryProduct", new object[] { strProduct }, this.ob); GridHelper.CopyDataToDatatable(ref dt, ref dataTable2, true); GridHelper.RefreshAndAutoSize(ultraGrid1); } else if (ultraTabControl1.SelectedTab.Key.Equals("1")) { UltraGridRow row = GridSteel.ActiveRow; if (row == null) return; string strSteel = row.Cells["STEELCODE"].Text; DataTable dt = ServerHelper.GetData("com.steering.pss.ydm.pipemanage.FrmVarietie.querySteel", new object[] { strSteel }, this.ob); GridHelper.CopyDataToDatatable(ref dt, ref dtSteel, true); GridHelper.RefreshAndAutoSize(ultraGrid2); } else if (ultraTabControl1.SelectedTab.Key.Equals("2")) { UltraGridRow row = GridSpec.ActiveRow; if (row == null) return; string strSpec = row.Cells["SPEC_CODE"].Text; DataTable dt = ServerHelper.GetData("com.steering.pss.ydm.pipemanage.FrmVarietie.querySpec", new object[] { strSpec }, this.ob); GridHelper.CopyDataToDatatable(ref dt, ref dtSpec, true); GridHelper.RefreshAndAutoSize(ultraGrid3); } else if (ultraTabControl1.SelectedTab.Key.Equals("3")) { UltraGridRow row = GridModel.ActiveRow; if (row == null) return; string strModel = row.Cells["MODEL_CODE"].Text; DataTable dt = ServerHelper.GetData("com.steering.pss.ydm.pipemanage.FrmVarietie.queryModel", new object[] { strModel }, this.ob); GridHelper.CopyDataToDatatable(ref dt, ref dtModel, true); GridHelper.RefreshAndAutoSize(ultraGrid4); } else if (ultraTabControl1.SelectedTab.Key.Equals("4")) { UltraGridRow row = this.ultraGrid5.ActiveRow; if (row == null) return; string strfactory = row.Cells["PLINE_CODE"].Text; DataTable dt = ServerHelper.GetData("com.steering.pss.ydm.pipemanage.FrmVarietie.queryFactory", new object[] { strfactory }, this.ob); GridHelper.CopyDataToDatatable(ref dt, ref dataTable5, true); GridHelper.RefreshAndAutoSize(ultraGrid6); } else { UltraGridRow row = this.ultraGrid8.ActiveRow; if (row == null) return; string strgrade = row.Cells["GRADECODE"].Text; DataTable dt = ServerHelper.GetData("com.steering.pss.ydm.pipemanage.FrmVarietie.queryGrade", new object[] { strgrade }, this.ob); GridHelper.CopyDataToDatatable(ref dt, ref dataTable8, true); GridHelper.RefreshAndAutoSize(ultraGrid9); } } /// /// 托选 /// /// /// private void GridALL_AfterSelectChange(object sender, AfterSelectChangeEventArgs e) { if (ultraTabControl1.SelectedTab.Key.Equals("0")) { try { ultraGrid1.UpdateData(); GridKind.UpdateData(); foreach (UltraGridRow r in ultraGrid1.Rows) { r.Cells["CHK"].Value = r.Selected; } foreach (UltraGridRow r1 in GridKind.Rows) { r1.Cells["CHK"].Value = r1.Selected; } } catch { } } else if (ultraTabControl1.SelectedTab.Key.Equals("1")) { try { ultraGrid2.UpdateData(); GridzbSteel.UpdateData(); foreach (UltraGridRow r in ultraGrid2.Rows) { r.Cells["CHK"].Value = r.Selected; } foreach (UltraGridRow r1 in GridzbSteel.Rows) { r1.Cells["CHK"].Value = r1.Selected; } } catch { } } else if (ultraTabControl1.SelectedTab.Key.Equals("2")) { try { ultraGrid3.UpdateData(); GridzbSpec.UpdateData(); foreach (UltraGridRow r in ultraGrid3.Rows) { r.Cells["CHK"].Value = r.Selected; } foreach (UltraGridRow r1 in GridzbSpec.Rows) { r1.Cells["CHK"].Value = r1.Selected; } } catch { } } else if (ultraTabControl1.SelectedTab.Key.Equals("3")) { try { ultraGrid4.UpdateData(); GridzbModel.UpdateData(); foreach (UltraGridRow r in ultraGrid4.Rows) { r.Cells["CHK"].Value = r.Selected; } foreach (UltraGridRow r1 in GridzbModel.Rows) { r1.Cells["CHK"].Value = r1.Selected; } } catch { } } else if (ultraTabControl1.SelectedTab.Key.Equals("4")) { try { ultraGrid6.UpdateData(); ultraGrid5.UpdateData(); foreach (UltraGridRow r in ultraGrid6.Rows) { r.Cells["CHK"].Value = r.Selected; } foreach (UltraGridRow r1 in ultraGrid5.Rows) { r1.Cells["CHK"].Value = r1.Selected; } } catch { } } else { try { ultraGrid9.UpdateData(); ultraGrid8.UpdateData(); foreach (UltraGridRow r in ultraGrid9.Rows) { r.Cells["CHK"].Value = r.Selected; } foreach (UltraGridRow r1 in ultraGrid8.Rows) { r1.Cells["CHK"].Value = r1.Selected; } } catch { } } } } }