123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129 |
- using ComponentFactory.Krypton.Toolkit;
- using NXWMS.Client.Code.Extends;
- using NXWMS.Client.Model.AppModels.Condition.Report;
- using NXWMS.Client.Model.AppModels.Result;
- using NXWMS.Client.Model.AppModels.Result.Report;
- using NXWMS.Client.Model.CoreModels;
- using NXWMS.Commons;
- using NXWMS.Services;
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Windows.Forms;
- namespace NXWMS.Forms.Report
- {
- public partial class frmBinUseSituationReport : KryptonForm
- {
- /// <summary>
- /// 客户端字段排序列表
- /// </summary>
- private List<ClientFieldOrderResult> _clientFieldOrderList;
-
- private int _pageSize;
- private int _pageIndex;
- private int _totalCount;
- public frmBinUseSituationReport()
- {
- InitializeComponent();
- InitData();
- InitControl();
- }
- /// <summary>
- /// 数据初始化
- /// </summary>
- private void InitData()
- {
- _clientFieldOrderList = new List<ClientFieldOrderResult>();
- _clientFieldOrderList.Add(new ClientFieldOrderResult { FieldName = "WarehouseName", FieldDesc = "仓库" });
- _clientFieldOrderList.Add(new ClientFieldOrderResult { FieldName = "RegionName", FieldDesc = "库区" });
- _clientFieldOrderList.Add(new ClientFieldOrderResult { FieldName = "BinQTY", FieldDesc = "库位总数" });
- _clientFieldOrderList.Add(new ClientFieldOrderResult { FieldName = "IdleBinQTY", FieldDesc = "空闲库位数" });
- _clientFieldOrderList.Add(new ClientFieldOrderResult { FieldName = "EmplyBinQTY", FieldDesc = "空托在库数" });
- _clientFieldOrderList.Add(new ClientFieldOrderResult { FieldName = "FullBinQTY", FieldDesc = "满托在库数" });
- _clientFieldOrderList.Add(new ClientFieldOrderResult { FieldName = "InstockOccupyQTY", FieldDesc = "入库占用数" });
- _clientFieldOrderList.Add(new ClientFieldOrderResult { FieldName = "OutstockOccupyQTY", FieldDesc = "出库占用数" });
- _clientFieldOrderList.Add(new ClientFieldOrderResult { FieldName = "DisableOccupyQTY", FieldDesc = "禁用数量" });
- }
- /// <summary>
- /// 控件初始化
- /// </summary>
- private void InitControl()
- {
- CheckForIllegalCrossThreadCalls = false;
- dataGridView.BuildDataGridView(CommonUtil.GetFieldOrderDic(_clientFieldOrderList), false);
- _pageIndex = 1;
- _pageSize = 20;
- }
- private void btnSearch_Click(object sender, EventArgs e)
- {
- _pageIndex = 1;
- var loadfrm = new frmLoading();
- loadfrm.Show();
- var message = loadfrm.EventCalExec(LoadSearch, this.pageTool.PageIndex, this.pageTool.PageSize);
- pageTool.DataCount = _totalCount;
- if (!string.IsNullOrWhiteSpace(message))
- {
- KryptonMessageBox.Show($"查询失败!\r\n{message}", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Information);
- }
- }
- private string LoadSearch(int pageIndex, int pageSize)
- {
- var result = ReportServices.reportSearchService.GetBinUseSituationList(new BinUseSituationCondition
- {
- OperationUserId = AppConfig.UserLoginResult.UserInfo.UserId,
- DisableOccupyQTY= numSearchDisableOccupyQTY.Value,
- EmplyBinQTY=numSearchEmplyBinQTY.Value,
- FullBinQTY=numSearchFullBinQTY.Value,
- IdleBinQTY=numSearchIdleBinQTY.Value,
- InstockOccupyQTY=numSearchIdleBinQTY.Value,
- OutstockOccupyQTY=numSearchOutstockOccupyQTY.Value,
- RegionInfo=txtSearchRegion.Text,
- WarehouseInfo=txtSearchWarehouse.Text,
- PageIndex = pageIndex,
- PageSize = pageSize
- });
- if (result.Status == OperateStatus.Success)
- {
- _totalCount = result.Data.TotalCount;
- _pageIndex = pageIndex;
- _pageSize = pageSize;
- if (result.Data.RowData.Any())
- {
- dataGridView.Columns.Clear();
- dataGridView.DataSource = result.Data.RowData.ToList();
- dataGridView.BuildDataGridView(CommonUtil.GetFieldOrderDic(_clientFieldOrderList));
- }
- else
- {
- if (dataGridView.DataSource != null)
- {
- dataGridView.DataSource = new List<BinUseSituationResult>();
- }
- dataGridView.BuildDataGridView(CommonUtil.GetFieldOrderDic(_clientFieldOrderList), false);
- }
- return string.Empty;
- }
- else
- {
- return result.Message;
- }
- }
- private void btnSearchExport_Click(object sender, EventArgs e)
- {
- this.dataGridView.DataGridViewExport($"{AppConfig.CurrentMenu.FirstOrDefault().MenuName}列表" + DateTime.Now.ToString("yyyyMMddHH"));
- }
- }
- }
|