Batch_Generation_Code.cs 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. using System;
  2. using System.Data;
  3. using System.Text;
  4. using System.Windows.Forms;
  5. using 优软MES.DataOperate;
  6. using 优软MES.Properties;
  7. using 优软MES.PublicMethod;
  8. namespace 优软MES
  9. {
  10. public partial class Batch_Generation_Code : Form
  11. {
  12. string caller = "BarcodeIn!Deal";
  13. string formname = "Batch_Generation_Code";
  14. string defaultCondition = "pi_statuscode='UNPOST' and nvl(pr_tracekind,0)>0 ";
  15. string[] hiddenfield = { };
  16. DataHelper dh = new DataHelper();
  17. AutoSizeFormClass asc = new AutoSizeFormClass();
  18. public Batch_Generation_Code()
  19. {
  20. InitializeComponent();
  21. DataTable dt = dh.GetConfigureData(caller, "DataList", defaultCondition);
  22. //添加图片列
  23. DataGridViewImageColumn ic = new DataGridViewImageColumn();
  24. ic.Image = Resources.write_15_893687707641px_1181413_easyicon_net;
  25. ic.Width = 40;
  26. ic.Name = "操作";
  27. ic.ToolTipText = "修改当前行数据";
  28. BGC_DataGrid.DataSource = dt;
  29. BGC_DataGrid.Columns.Add(ic);
  30. //带有DbFind的需要传递Caller 和Form的名称
  31. //BaseUtil.HideField(BGC_DataGrid,hiddenfield);
  32. pi_inoutno.Caller = caller;
  33. pi_inoutno.FormName = formname;
  34. pr_code.Caller = caller;
  35. pr_code.FormName = formname;
  36. wh_code.Caller = caller;
  37. wh_code.FormName = formname;
  38. }
  39. private void Screen_Button_Click(object sender, EventArgs e)
  40. {
  41. string beginTime = timePickerWithCombo1.BeginTime;
  42. string endTime = timePickerWithCombo1.EndTime;
  43. //因为是自定义控件,所以需要获取控件的子控件,然后再去获取值
  44. string pi_inoutno = this.pi_inoutno.Text;
  45. string pr_code = this.pr_code.Text;
  46. string pd_location = wh_code.Text;
  47. string pi_status = this.pi_status.Text;
  48. StringBuilder condition = new StringBuilder();
  49. if (!string.IsNullOrWhiteSpace(beginTime) && !string.IsNullOrWhiteSpace(endTime))
  50. {
  51. condition.Append(" to_char(pi_date,'yyyy/MM/dd hh:mm:ss') between '" + beginTime + "' and '" + endTime + "'");
  52. }
  53. if (!string.IsNullOrEmpty(pi_inoutno))
  54. {
  55. if (condition.Length == 0)
  56. {
  57. condition.Append(" pi_inoutno like '%" + pi_inoutno + "%' ");
  58. }
  59. else
  60. {
  61. condition.Append(" and pi_inoutno like '%" + pi_inoutno + "%'");
  62. }
  63. }
  64. if (!string.IsNullOrEmpty(pr_code))
  65. {
  66. if (condition.Length == 0)
  67. {
  68. condition.Append(" pr_code like '%" + pr_code + "%'");
  69. }
  70. else
  71. {
  72. condition.Append(" and pr_code like '%" + pr_code + "%'");
  73. }
  74. }
  75. if (!string.IsNullOrEmpty(pd_location))
  76. {
  77. if (condition.Length == 0)
  78. {
  79. condition.Append(" pd_whcode like '%" + pd_location + "%'");
  80. }
  81. else
  82. {
  83. condition.Append(" and pd_whcode like '%" + pd_location + "%'");
  84. }
  85. }
  86. if (condition.Length != 0)
  87. {
  88. BGC_DataGrid.DataSource = dh.GetConfigureData(caller, "DataList", condition.ToString());
  89. }
  90. else
  91. {
  92. BGC_DataGrid.DataSource = dh.GetConfigureData(caller, "DataList", defaultCondition);
  93. }
  94. }
  95. private void BGC_DataGrid_CellContentClick(object sender, DataGridViewCellEventArgs e)
  96. {
  97. if (BGC_DataGrid.Columns[e.ColumnIndex].Name == "操作")
  98. {
  99. Batch_Generation_CodeDetail BGCD = new Batch_Generation_CodeDetail(BGC_DataGrid.Rows[e.RowIndex].Cells["ID"].Value.ToString());
  100. BGCD.ShowDialog();
  101. }
  102. }
  103. private void Batch_Generation_Code_Load(object sender, EventArgs e)
  104. {
  105. asc.controllInitializeSize(this);
  106. }
  107. private void Batch_Generation_Code_SizeChanged(object sender, EventArgs e)
  108. {
  109. asc.controlAutoSize(this);
  110. }
  111. private void Panel0_Paint(object sender, PaintEventArgs e)
  112. {
  113. }
  114. }
  115. }