using Core.Mes.Client.Comm.Control; using Core.Mes.Client.Comm.Tool; using Core.StlMes.Client.Judge.Commons; using CoreFS.CA06; using System; using System.Data; using System.Linq; using System.Windows.Forms; namespace Core.StlMes.Client.Judge.Controls { public partial class QcmJhyElementsQueryCtrl : UserControl { private Dal _d; public QcmJhyElementsQueryCtrl(Control container, OpeBase ob) { InitializeComponent(); _d = new Dal(ob); container.Controls.Add(this); this.Dock = DockStyle.Fill; this.BringToFront(); } private string _stoveNo = ""; private string _timeB = ""; private string _timeE = ""; private string[] _plines; private string _judgeStoveNo = ""; private string _customInfo = ""; public void Query(string stoveNo, string timeB, string timeE, string[] plines, string judgeStoveNo, string customInfo) { _stoveNo = stoveNo; _timeB = timeB; _timeE = timeE; _plines = plines; _judgeStoveNo = judgeStoveNo; _customInfo = customInfo; DataTable dtJhy = _d.GetTableByXmlId("QcmJhyElementsDAL.queryQcmJhyElementsQuery", stoveNo, timeB, timeE, plines.Length, plines, judgeStoveNo, customInfo); dtJhy.Columns["asn"].ColumnName = "as"; DataTable dtBaseChem = _d.GetTableByXmlId("JdgComBaseChem.queryBaseChem"); ultraGrid1.BeginUpdate(); dataTable1.Clear(); foreach (DataRow drBaseChem in dtBaseChem.Rows) { //foreach (DataColumn colJhy in dtJhy.Columns) //{ // if(colJhy) //} if (!dataTable1.Columns.Contains(drBaseChem["chemName"].ToString()) && dtJhy.Columns.Contains(drBaseChem["chemName"].ToString())) { dataTable1.Columns.Add(drBaseChem["chemName"].ToString()); } } foreach (DataRow drJhy in dtJhy.Rows) { DataRow dr = dataTable1.NewRow(); foreach (DataColumn col in dataTable1.Columns) { dr[col.ColumnName] = drJhy[col.ColumnName].ToString(); } dataTable1.Rows.Add(dr); } GridHelper.RefreshAndAutoSizeExceptColumns(ultraGrid1, "orderNo"); ultraGrid1.EndUpdate(); } public void DeleteJhyChem() { if (ultraGrid1.ActiveRow == null) { MessageUtil.ShowWarning("请选择一行记录!"); return; } string assayNo = ultraGrid1.ActiveRow.GetValue("assayNo"); string[] assayNos = assayNo.Split('_'); string stoveNo = assayNos[0]; string sampleNo = assayNos[1]; DataRow drChemJudgeCnt = _d.GetRowByXmlId("QcmLgChemJudgeDAL.queryCntByStoveNo", stoveNo, "B"); if (drChemJudgeCnt[0].ToString() != "0") { MessageUtil.ShowWarning("该熔炼炉号存在判定记录,请到炼钢成分判定界面操作删除!"); return; } if (MessageUtil.ShowYesNoAndQuestion("是否确认删除此记录?") == DialogResult.No) { return; } _d.Set("com.steering.pss.judge.Bll.BllQcmJhyElementsQuery.deleteJhyChem", stoveNo, sampleNo); MessageUtil.ShowTips("操作成功!"); Query(_stoveNo, _timeB, _timeE, _plines, _judgeStoveNo, _customInfo); var row = ultraGrid1.Rows.Where(a => a.GetValue("assayNo") == assayNo).FirstOrDefault(); if (row != null) { row.Activate(); } } } }