FrmCrmBaseMaterial.cs 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. using Core.Mes.Client.Comm.Control;
  2. using Core.Mes.Client.Comm.Tool;
  3. using Core.StlMes.Client.YdmBcPipeManage.Entity;
  4. using CoreFS.CA06;
  5. using System;
  6. using System.Collections.Generic;
  7. using System.ComponentModel;
  8. using System.Data;
  9. using System.Drawing;
  10. using System.Linq;
  11. using System.Text;
  12. using System.Windows.Forms;
  13. namespace Core.StlMes.Client.YdmBcPipeManage
  14. {
  15. public partial class FrmCrmBaseMaterial : FrmBase
  16. {
  17. public FrmCrmBaseMaterial()
  18. {
  19. InitializeComponent();
  20. EntityHelper.ShowGridCaption<CrmBaseMaterialEntity>(ultraGrid1.DisplayLayout.Bands[0]);
  21. IsLoadUserView = true;
  22. //startDateTime.DateTime = startDateTime.DateTime.AddDays(-7.0);
  23. }
  24. public override void ToolBar_Click(object sender, string ToolbarKey)
  25. {
  26. switch (ToolbarKey)
  27. {
  28. case "Query":
  29. doQuery();
  30. break;
  31. case "Export":
  32. doExport();
  33. break;
  34. case "Close":
  35. this.Close();
  36. break;
  37. }
  38. }
  39. private void doExport()
  40. {
  41. GridHelper.ulGridToExcel(ultraGrid1, "crm物料信息");
  42. }
  43. private void doQuery()
  44. {
  45. String material = "";
  46. String startDate = "";
  47. String endDate = "";
  48. if (materialCheck.Checked)
  49. {
  50. material = materialText.Text;
  51. }
  52. if (crateDateCheck.Checked)
  53. {
  54. startDate = startDateTime.DateTime.ToString("yyyy-MM-dd") + " 00:00:00"; ;
  55. endDate = endDateTime.DateTime.ToString("yyyy-MM-dd") + " 23:59:59";
  56. }
  57. if (!materialCheck.Checked && !crateDateCheck.Checked)
  58. {
  59. MessageUtil.ShowTips("请选择至少一个筛选条件!");
  60. return;
  61. }
  62. TimeSpan ts1 = new TimeSpan(DateTime.ParseExact(startDateTime.DateTime.ToString("yyyy-MM-dd"), "yyyy-MM-dd", System.Globalization.CultureInfo.CurrentCulture).Ticks);
  63. TimeSpan ts2 = new TimeSpan(DateTime.ParseExact(endDateTime.DateTime.ToString("yyyy-MM-dd"), "yyyy-MM-dd", System.Globalization.CultureInfo.CurrentCulture).Ticks);
  64. if (ts2.Subtract(ts1).Days > 30)
  65. {
  66. MessageUtil.ShowTips("最大查询30天的数据!");
  67. return;
  68. }
  69. List<CrmBaseMaterialEntity> listSource = EntityHelper.GetData<CrmBaseMaterialEntity>(
  70. "com.steering.pss.crm.server.CrmBaseMaterialServer.Query", new object[] { material, startDate, endDate }, this.ob);
  71. crmBaseMaterialEntityBindingSource.DataSource = listSource;
  72. }
  73. }
  74. }