BadItem.cs 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Windows.Forms;
  9. using UAS_MES_NEW.DataOperate;
  10. using UAS_MES_NEW.Entity;
  11. using UAS_MES_NEW.PublicMethod;
  12. namespace UAS_MES_NEW.Query
  13. {
  14. public partial class BadItem : Form
  15. {
  16. DataHelper dh = SystemInf.dh;
  17. AutoSizeFormClass asc = new AutoSizeFormClass();
  18. string _linecode;
  19. string _prodcode;
  20. string _wccode;
  21. string _begindate;
  22. string _enddate;
  23. string _stepcode;
  24. string _makind;
  25. public BadItem(string linecode, string prodcode, string wccode, string begindate, string enddate, string stepcode,string makind)
  26. {
  27. InitializeComponent();
  28. _linecode = linecode;
  29. _prodcode = prodcode;
  30. _wccode = wccode;
  31. _begindate = begindate;
  32. _enddate = enddate;
  33. _stepcode = stepcode;
  34. _makind = makind;
  35. }
  36. private void BadItem_SizeChanged(object sender, EventArgs e)
  37. {
  38. asc.controlAutoSize(this);
  39. }
  40. private void BadItem_Load(object sender, EventArgs e)
  41. {
  42. string condition = " mb_indate between to_date('" + _begindate + "', 'yyyy-mm-dd hh24:mi:ss') and to_date('" + _enddate + "', 'yyyy-mm-dd hh24:mi:ss') ";
  43. if (_prodcode != "")
  44. {
  45. condition += " and ma_prodcode = '" + _prodcode + "'";
  46. }
  47. if (_linecode != "")
  48. {
  49. condition += " and mb_linecode = '" + _linecode + "'";
  50. }
  51. if (_wccode != "")
  52. {
  53. condition += " and ma_wccode = '" + _wccode + "'";
  54. }
  55. if (_makind != "")
  56. {
  57. condition += " and ma_kind = '" + _makind + " '";
  58. }
  59. if (_stepcode != "")
  60. {
  61. condition += " and mb_stepcode = '" + _stepcode + "'";
  62. }
  63. string v_sql = "";
  64. if (_stepcode != "")
  65. {
  66. if (_stepcode == "CT1" || _stepcode == "CT2")
  67. {
  68. LogicHandler.GetQuerySQL(condition, "不良代码CT", out v_sql);
  69. }
  70. else
  71. {
  72. LogicHandler.GetQuerySQL(condition, "不良代码", out v_sql);
  73. }
  74. }
  75. {
  76. LogicHandler.GetQuerySQL(condition, "不良代码ALL", out v_sql);
  77. }
  78. DataTable dt = (DataTable)dh.ExecuteSql(v_sql, "select");
  79. BaseUtil.FillDgvWithDataTable(Data, dt);
  80. }
  81. private void Data_CellContentClick(object sender, DataGridViewCellEventArgs e)
  82. {
  83. try
  84. {
  85. if (Data.Columns[e.ColumnIndex].Name == "times"&& _stepcode != "CT1" && _stepcode != "CT2")
  86. {
  87. Form badsn = new BadSn(_linecode, _prodcode, _wccode, _begindate, _enddate, _stepcode, _makind, Data.Rows[e.RowIndex].Cells["mb_badname"].Value.ToString());
  88. badsn.Show();
  89. }
  90. }
  91. catch (Exception ex)
  92. {
  93. MessageBox.Show(ex.Message);
  94. }
  95. }
  96. }
  97. }