QcmJhyElementsQueryCtrl.cs 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. using Core.Mes.Client.Comm.Control;
  2. using Core.Mes.Client.Comm.Tool;
  3. using Core.StlMes.Client.Judge.Commons;
  4. using CoreFS.CA06;
  5. using System;
  6. using System.Data;
  7. using System.Linq;
  8. using System.Windows.Forms;
  9. namespace Core.StlMes.Client.Judge.Controls
  10. {
  11. public partial class QcmJhyElementsQueryCtrl : UserControl
  12. {
  13. private Dal _d;
  14. public QcmJhyElementsQueryCtrl(Control container, OpeBase ob)
  15. {
  16. InitializeComponent();
  17. _d = new Dal(ob);
  18. container.Controls.Add(this);
  19. this.Dock = DockStyle.Fill;
  20. this.BringToFront();
  21. }
  22. private string _stoveNo = "";
  23. private string _timeB = "";
  24. private string _timeE = "";
  25. private string[] _plines;
  26. private string _judgeStoveNo = "";
  27. private string _customInfo = "";
  28. public void Query(string stoveNo, string timeB, string timeE, string[] plines, string judgeStoveNo, string customInfo)
  29. {
  30. _stoveNo = stoveNo;
  31. _timeB = timeB;
  32. _timeE = timeE;
  33. _plines = plines;
  34. _judgeStoveNo = judgeStoveNo;
  35. _customInfo = customInfo;
  36. DataTable dtJhy = _d.GetTableByXmlId("QcmJhyElementsDAL.queryQcmJhyElementsQuery", stoveNo, timeB, timeE, plines.Length, plines, judgeStoveNo, customInfo);
  37. dtJhy.Columns["asn"].ColumnName = "as";
  38. DataTable dtBaseChem = _d.GetTableByXmlId("JdgComBaseChem.queryBaseChem");
  39. ultraGrid1.BeginUpdate();
  40. dataTable1.Clear();
  41. foreach (DataRow drBaseChem in dtBaseChem.Rows)
  42. {
  43. //foreach (DataColumn colJhy in dtJhy.Columns)
  44. //{
  45. // if(colJhy)
  46. //}
  47. if (!dataTable1.Columns.Contains(drBaseChem["chemName"].ToString()) && dtJhy.Columns.Contains(drBaseChem["chemName"].ToString()))
  48. {
  49. dataTable1.Columns.Add(drBaseChem["chemName"].ToString());
  50. }
  51. }
  52. foreach (DataRow drJhy in dtJhy.Rows)
  53. {
  54. DataRow dr = dataTable1.NewRow();
  55. foreach (DataColumn col in dataTable1.Columns)
  56. {
  57. dr[col.ColumnName] = drJhy[col.ColumnName].ToString();
  58. }
  59. dataTable1.Rows.Add(dr);
  60. }
  61. GridHelper.RefreshAndAutoSizeExceptColumns(ultraGrid1, "orderNo");
  62. ultraGrid1.EndUpdate();
  63. }
  64. public void DeleteJhyChem()
  65. {
  66. if (ultraGrid1.ActiveRow == null)
  67. {
  68. MessageUtil.ShowWarning("请选择一行记录!");
  69. return;
  70. }
  71. string assayNo = ultraGrid1.ActiveRow.GetValue("assayNo");
  72. string[] assayNos = assayNo.Split('_');
  73. string stoveNo = assayNos[0];
  74. string sampleNo = assayNos[1];
  75. DataRow drChemJudgeCnt = _d.GetRowByXmlId("QcmLgChemJudgeDAL.queryCntByStoveNo", stoveNo, "B");
  76. if (drChemJudgeCnt[0].ToString() != "0")
  77. {
  78. MessageUtil.ShowWarning("该熔炼炉号存在判定记录,请到炼钢成分判定界面操作删除!");
  79. return;
  80. }
  81. if (MessageUtil.ShowYesNoAndQuestion("是否确认删除此记录?") == DialogResult.No)
  82. {
  83. return;
  84. }
  85. _d.Set("com.steering.pss.judge.Bll.BllQcmJhyElementsQuery.deleteJhyChem", stoveNo, sampleNo);
  86. MessageUtil.ShowTips("操作成功!");
  87. Query(_stoveNo, _timeB, _timeE, _plines, _judgeStoveNo, _customInfo);
  88. var row = ultraGrid1.Rows.Where(a => a.GetValue("assayNo") == assayNo).FirstOrDefault();
  89. if (row != null)
  90. {
  91. row.Activate();
  92. }
  93. }
  94. }
  95. }