FrmCrmOrderProduce.cs 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  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 FrmCrmOrderProduce : FrmBase
  17. {
  18. public FrmCrmOrderProduce()
  19. {
  20. InitializeComponent();
  21. }
  22. protected override void OnLoad(EventArgs e)
  23. {
  24. base.OnLoad(e);
  25. EntityHelper.ShowGridCaption<CrmOrderProduceEntity>(ultraGrid1.DisplayLayout.Bands[0]);
  26. comm.RefreshAndAutoSize(ultraGrid1);
  27. }
  28. private void ChkOrderNo_CheckedChanged(object sender, EventArgs e)
  29. {
  30. this.OrderNoText.Enabled = ChkOrderNo.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 orderno = "";
  55. if(ChkTime.Checked){
  56. if (DateTime.Parse(this.StartTime.Value.ToString()) > DateTime.Parse(this.EndTime.Value.ToString()))
  57. {
  58. MessageUtil.ShowTips("开始时间不能大于结束时间!");
  59. return;
  60. }
  61. else
  62. {
  63. starttime = StartTime.DateTime.ToString("yyyy-MM-dd") + " 00:00:00";
  64. endtime = EndTime.DateTime.ToString("yyyy-MM-dd") + " 23:59:59";
  65. }
  66. }
  67. if (ChkOrderNo.Checked)
  68. {
  69. orderno = OrderNoText.Text.ToString();
  70. }
  71. if (!ChkTime.Checked && !ChkOrderNo.Checked)
  72. {
  73. MessageUtil.ShowTips("请选择至少一个筛选条件!");
  74. return;
  75. }
  76. TimeSpan ts1 = new TimeSpan(DateTime.ParseExact(StartTime.DateTime.ToString("yyyy-MM-dd"), "yyyy-MM-dd", System.Globalization.CultureInfo.CurrentCulture).Ticks);
  77. TimeSpan ts2 = new TimeSpan(DateTime.ParseExact(EndTime.DateTime.ToString("yyyy-MM-dd"), "yyyy-MM-dd", System.Globalization.CultureInfo.CurrentCulture).Ticks);
  78. if (ts2.Subtract(ts1).Days > 30)
  79. {
  80. MessageUtil.ShowTips("最大查询30天的数据!");
  81. return;
  82. }
  83. List<CrmOrderProduceEntity> listSource = EntityHelper.GetData<CrmOrderProduceEntity>(
  84. "com.steering.pss.crm.server.CrmOrderProduceServer.Query",
  85. new object[] { starttime, endtime , orderno }, this.ob);
  86. crmOrderProduceEntityBindingSource.DataSource = listSource;
  87. }
  88. /// <summary>
  89. /// 导出
  90. /// </summary>
  91. public void doExport()
  92. {
  93. string title = "";
  94. title += "生产进度信息";
  95. GridHelper.ulGridToExcel(ultraGrid1, title);
  96. }
  97. }
  98. }