frmBinUseSituationReport.cs 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. using ComponentFactory.Krypton.Toolkit;
  2. using NXWMS.Client.Code.Extends;
  3. using NXWMS.Client.Model.AppModels.Condition.Report;
  4. using NXWMS.Client.Model.AppModels.Result;
  5. using NXWMS.Client.Model.AppModels.Result.Report;
  6. using NXWMS.Client.Model.CoreModels;
  7. using NXWMS.Commons;
  8. using NXWMS.Services;
  9. using System;
  10. using System.Collections.Generic;
  11. using System.ComponentModel;
  12. using System.Data;
  13. using System.Drawing;
  14. using System.Linq;
  15. using System.Text;
  16. using System.Windows.Forms;
  17. namespace NXWMS.Forms.Report
  18. {
  19. public partial class frmBinUseSituationReport : KryptonForm
  20. {
  21. /// <summary>
  22. /// 客户端字段排序列表
  23. /// </summary>
  24. private List<ClientFieldOrderResult> _clientFieldOrderList;
  25. private int _pageSize;
  26. private int _pageIndex;
  27. private int _totalCount;
  28. public frmBinUseSituationReport()
  29. {
  30. InitializeComponent();
  31. InitData();
  32. InitControl();
  33. }
  34. /// <summary>
  35. /// 数据初始化
  36. /// </summary>
  37. private void InitData()
  38. {
  39. _clientFieldOrderList = new List<ClientFieldOrderResult>();
  40. _clientFieldOrderList.Add(new ClientFieldOrderResult { FieldName = "WarehouseName", FieldDesc = "仓库" });
  41. _clientFieldOrderList.Add(new ClientFieldOrderResult { FieldName = "RegionName", FieldDesc = "库区" });
  42. _clientFieldOrderList.Add(new ClientFieldOrderResult { FieldName = "BinQTY", FieldDesc = "库位总数" });
  43. _clientFieldOrderList.Add(new ClientFieldOrderResult { FieldName = "IdleBinQTY", FieldDesc = "空闲库位数" });
  44. _clientFieldOrderList.Add(new ClientFieldOrderResult { FieldName = "EmplyBinQTY", FieldDesc = "空托在库数" });
  45. _clientFieldOrderList.Add(new ClientFieldOrderResult { FieldName = "FullBinQTY", FieldDesc = "满托在库数" });
  46. _clientFieldOrderList.Add(new ClientFieldOrderResult { FieldName = "InstockOccupyQTY", FieldDesc = "入库占用数" });
  47. _clientFieldOrderList.Add(new ClientFieldOrderResult { FieldName = "OutstockOccupyQTY", FieldDesc = "出库占用数" });
  48. _clientFieldOrderList.Add(new ClientFieldOrderResult { FieldName = "DisableOccupyQTY", FieldDesc = "禁用数量" });
  49. }
  50. /// <summary>
  51. /// 控件初始化
  52. /// </summary>
  53. private void InitControl()
  54. {
  55. CheckForIllegalCrossThreadCalls = false;
  56. dataGridView.BuildDataGridView(CommonUtil.GetFieldOrderDic(_clientFieldOrderList), false);
  57. _pageIndex = 1;
  58. _pageSize = 20;
  59. }
  60. private void btnSearch_Click(object sender, EventArgs e)
  61. {
  62. _pageIndex = 1;
  63. var loadfrm = new frmLoading();
  64. loadfrm.Show();
  65. var message = loadfrm.EventCalExec(LoadSearch, this.pageTool.PageIndex, this.pageTool.PageSize);
  66. pageTool.DataCount = _totalCount;
  67. if (!string.IsNullOrWhiteSpace(message))
  68. {
  69. KryptonMessageBox.Show($"查询失败!\r\n{message}", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Information);
  70. }
  71. }
  72. private string LoadSearch(int pageIndex, int pageSize)
  73. {
  74. var result = ReportServices.reportSearchService.GetBinUseSituationList(new BinUseSituationCondition
  75. {
  76. OperationUserId = AppConfig.UserLoginResult.UserInfo.UserId,
  77. DisableOccupyQTY= numSearchDisableOccupyQTY.Value,
  78. EmplyBinQTY=numSearchEmplyBinQTY.Value,
  79. FullBinQTY=numSearchFullBinQTY.Value,
  80. IdleBinQTY=numSearchIdleBinQTY.Value,
  81. InstockOccupyQTY=numSearchIdleBinQTY.Value,
  82. OutstockOccupyQTY=numSearchOutstockOccupyQTY.Value,
  83. RegionInfo=txtSearchRegion.Text,
  84. WarehouseInfo=txtSearchWarehouse.Text,
  85. PageIndex = pageIndex,
  86. PageSize = pageSize
  87. });
  88. if (result.Status == OperateStatus.Success)
  89. {
  90. _totalCount = result.Data.TotalCount;
  91. _pageIndex = pageIndex;
  92. _pageSize = pageSize;
  93. if (result.Data.RowData.Any())
  94. {
  95. dataGridView.Columns.Clear();
  96. dataGridView.DataSource = result.Data.RowData.ToList();
  97. dataGridView.BuildDataGridView(CommonUtil.GetFieldOrderDic(_clientFieldOrderList));
  98. }
  99. else
  100. {
  101. if (dataGridView.DataSource != null)
  102. {
  103. dataGridView.DataSource = new List<BinUseSituationResult>();
  104. }
  105. dataGridView.BuildDataGridView(CommonUtil.GetFieldOrderDic(_clientFieldOrderList), false);
  106. }
  107. return string.Empty;
  108. }
  109. else
  110. {
  111. return result.Message;
  112. }
  113. }
  114. private void btnSearchExport_Click(object sender, EventArgs e)
  115. {
  116. this.dataGridView.DataGridViewExport($"{AppConfig.CurrentMenu.FirstOrDefault().MenuName}列表" + DateTime.Now.ToString("yyyyMMddHH"));
  117. }
  118. }
  119. }