FrmCrmZcInlist.cs 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. using Core.Mes.Client.Comm.Control;
  2. using Core.Mes.Client.Comm.Tool;
  3. using Core.StlMes.Client.Mcp.Mch;
  4. using Core.StlMes.Client.YdmBcPipeManage.Entity;
  5. using CoreFS.CA06;
  6. using System;
  7. using System.Collections.Generic;
  8. using System.ComponentModel;
  9. using System.Data;
  10. using System.Drawing;
  11. using System.Linq;
  12. using System.Text;
  13. using System.Windows.Forms;
  14. namespace Core.StlMes.Client.YdmBcPipeManage
  15. {
  16. public partial class FrmCrmZcInlist : FrmBase
  17. {
  18. public FrmCrmZcInlist()
  19. {
  20. InitializeComponent();
  21. }
  22. protected override void OnLoad(EventArgs e)
  23. {
  24. base.OnLoad(e);
  25. EntityHelper.ShowGridCaption<CrmZcInlistEntity>(ultraGrid1.DisplayLayout.Bands[0]);
  26. comm.RefreshAndAutoSize(ultraGrid1);
  27. }
  28. private void ChkJudgeNo_CheckedChanged(object sender, EventArgs e)
  29. {
  30. this.JudgeNoText.Enabled = ChkJudgeNo.Checked;
  31. }
  32. public override void ToolBar_Click(object sender, string ToolbarKey)
  33. {
  34. switch (ToolbarKey)
  35. {
  36. case "Query":
  37. doQuery();
  38. break;
  39. case "Export":
  40. doExport();
  41. break;
  42. case "Close":
  43. this.Close();
  44. break;
  45. }
  46. }
  47. /// <summary>
  48. /// 查询
  49. /// </summary>
  50. public void doQuery()
  51. {
  52. string starttime = "";
  53. string endtime = "";
  54. string judgeno = "";
  55. if (ChkTime.Checked)
  56. {
  57. if (DateTime.Parse(this.StartTime.Value.ToString()) > DateTime.Parse(this.EndTime.Value.ToString()))
  58. {
  59. MessageUtil.ShowTips("开始时间不能大于结束时间!");
  60. return;
  61. }
  62. else
  63. {
  64. starttime = StartTime.DateTime.ToString("yyyy-MM-dd") + " 00:00:00";
  65. endtime = EndTime.DateTime.ToString("yyyy-MM-dd") + " 23:59:59";
  66. }
  67. }
  68. if (ChkJudgeNo.Checked)
  69. {
  70. judgeno = JudgeNoText.Text.ToString();
  71. }
  72. if (!ChkTime.Checked && !ChkJudgeNo.Checked)
  73. {
  74. MessageUtil.ShowTips("请选择至少一个筛选条件!");
  75. return;
  76. }
  77. TimeSpan ts1 = new TimeSpan(DateTime.ParseExact(StartTime.DateTime.ToString("yyyy-MM-dd"), "yyyy-MM-dd", System.Globalization.CultureInfo.CurrentCulture).Ticks);
  78. TimeSpan ts2 = new TimeSpan(DateTime.ParseExact(EndTime.DateTime.ToString("yyyy-MM-dd"), "yyyy-MM-dd", System.Globalization.CultureInfo.CurrentCulture).Ticks);
  79. if (ts2.Subtract(ts1).Days > 30)
  80. {
  81. MessageUtil.ShowTips("最大查询30天的数据!");
  82. return;
  83. }
  84. var wf = new WaitingForm2("查询中,请稍后。。。");
  85. Cursor = Cursors.WaitCursor;
  86. List<CrmZcInlistEntity> listSource = EntityHelper.GetData<CrmZcInlistEntity>(
  87. "com.steering.pss.crm.server.CrmZcInlistServer.Query",
  88. new object[] { starttime, endtime , judgeno }, this.ob);
  89. crmZcInlistEntityBindingSource.DataSource = listSource;
  90. wf.Close();
  91. Cursor = Cursors.Default;
  92. }
  93. /// <summary>
  94. /// 导出
  95. /// </summary>
  96. public void doExport()
  97. {
  98. string title = "";
  99. title += "入库信息";
  100. GridHelper.ulGridToExcel(ultraGrid1, title);
  101. }
  102. }
  103. }