FrmOrderStock.cs 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  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 Core.Mes.Client.Comm.Control;
  10. using Core.Mes.Client.Comm.Tool;
  11. using Core.StlMes.Client.YdmPipeReport.Entity;
  12. using Core.StlMes.Client.YdmPipeReport.Tool;
  13. using CoreFS.CA06;
  14. using Infragistics.Win.UltraWinGrid;
  15. namespace Core.StlMes.Client.YdmPipeReport
  16. {
  17. public partial class FrmOrderStock : FrmBase
  18. {
  19. private static string[] saleCodes = null;
  20. public FrmOrderStock()
  21. {
  22. IsLoadUserView = true;
  23. InitializeComponent();
  24. }
  25. /// <summary>
  26. /// 初始化时间
  27. /// </summary>
  28. private void InitTime()
  29. {
  30. BeginTime.Value = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd")).AddMonths(-1);
  31. EndTime.Value = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd")).AddDays(1).AddSeconds(-1);
  32. }
  33. private void FrmOrderStock_Load(object sender, EventArgs e)
  34. {
  35. saleCodes = BaseHelper.InitPermissions(this.ValidDataPurviewIds,this.ob);
  36. InitTime();
  37. EntityHelper.ShowGridCaption<OrderStockEntity>(GridStorge.DisplayLayout.Bands[0]);
  38. BaseHelper.setOtherColumnReadOnly(GridStorge, new string[] { "" });
  39. BaseHelper.InitCellPosition(GridStorge, new string[] { "ActCount", "ActWeight", "BillCount", "BillWeight", "TallCount", "TallWeight", "LoadCount", "LoadWeight", "OnBillCount", "OnBillWeight", "OnTallCount", "OnTallWeight" });
  40. BaseHelper.GridColumnSum(GridStorge, new string[] { "ActCount", "ActWeight", "BillCount", "BillWeight", "TallCount", "TallWeight", "LoadCount", "LoadWeight", "OnBillCount", "OnBillWeight", "OnTallCount", "OnTallWeight" });
  41. BaseHelper.setUltraGridColumnMaxInput(GridStorge, new string[] { "ActWeight", "BillWeight", "TallWeight", "LoadWeight", "OnBillWeight", "OnTallWeight" });
  42. }
  43. public override void ToolBar_Click(object sender, string ToolbarKey)
  44. {
  45. switch (ToolbarKey)
  46. {
  47. case "Query":
  48. DoQuery();
  49. break;
  50. case "Export":
  51. GridHelper.ulGridToExcel(GridStorge, "出库跟踪信息");
  52. break;
  53. case "Close":
  54. this.Close();
  55. break;
  56. default:
  57. break;
  58. }
  59. }
  60. private void DoQuery()
  61. {
  62. string orderNo = "";
  63. if (ChcOrderNo.Checked)
  64. {
  65. orderNo = TxtOrderNo.Text.Trim();
  66. }
  67. string beginTime = "";
  68. string endTime = "";
  69. if (ChcTime.Checked && BeginTime.Value != null && EndTime.Value != null)
  70. {
  71. beginTime = BeginTime.Value.ToString();
  72. endTime = EndTime.Value.ToString();
  73. }
  74. List<OrderStockEntity> listSource = EntityHelper.GetData<OrderStockEntity>(
  75. "com.steering.pss.ydm.Report.FrmOrderStock.getOrderStockInfo", new object[] { orderNo, beginTime, endTime, saleCodes }, this.ob);
  76. orderStockEntityBindingSource.DataSource = listSource;
  77. setValue();
  78. }
  79. private void ChcOrderNo_CheckedChanged(object sender, EventArgs e)
  80. {
  81. if (ChcOrderNo.Checked)
  82. {
  83. TxtOrderNo.ReadOnly = false;
  84. }
  85. else
  86. {
  87. TxtOrderNo.ReadOnly = true;
  88. }
  89. if (ChcTime.Checked)
  90. { BeginTime.Enabled = true; EndTime.Enabled = true; }
  91. else
  92. { BeginTime.Enabled = false; EndTime.Enabled = false; }
  93. }
  94. private void setValue()
  95. {
  96. foreach (UltraGridRow ugr in GridStorge.Rows)
  97. {
  98. ugr.Cells["OnBillCount"].Value = Convert.ToDouble(ugr.Cells["BillCount"].Text) - Convert.ToDouble(ugr.Cells["LoadCount"].Text);
  99. ugr.Cells["OnBillWeight"].Value = Convert.ToDouble(ugr.Cells["BillWeight"].Text) - Convert.ToDouble(ugr.Cells["LoadWeight"].Text);
  100. ugr.Cells["OnTallCount"].Value = Convert.ToDouble(ugr.Cells["TallCount"].Text) - Convert.ToDouble(ugr.Cells["LoadCount"].Text);
  101. ugr.Cells["OnTallWeight"].Value = Convert.ToDouble(ugr.Cells["TallWeight"].Text) - Convert.ToDouble(ugr.Cells["LoadWeight"].Text);
  102. }
  103. }
  104. }
  105. }