From ee9271773eda0a7a883fceafc6d416677015801a Mon Sep 17 00:00:00 2001 From: hehaibing-1996 Date: Fri, 24 Jan 2025 16:37:18 +0800 Subject: [PATCH] =?UTF-8?q?=E7=9B=98=E7=82=B9=E6=95=B0=E6=8D=AE=E7=9A=84?= =?UTF-8?q?=20=E6=9F=A5=E8=AF=A2=E3=80=81=E5=88=A0=E9=99=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DbModels/STZL/MatDetailStocktakingInfo.cs | 13 +- .../Services/IService/IStockTakingService.cs | 8 + .../Services/Service/StockTakingService.cs | 156 +++++++ .../Stocktaking/GetStocktakingInfosRequest.cs | 23 + .../MatDetailStocktakingInfoModel.cs | 113 +++++ .../UpdateStocktakingInfoRequest.cs | 13 + .../MatDetailCurrenInfoController.cs | 13 +- .../Controllers/PDAStocktakingController.cs | 47 +- .../ViewModels/MatDetailStocktakingInfoViewModel.cs | 354 +++++++++++++++ .../Views/MainWindows/MainWindow1.xaml | 2 +- .../Views/MatDetailStocktakingInfoUpdateView.xaml | 186 ++++++++ .../Views/MatDetailStocktakingInfoUpdateView.xaml.cs | 76 ++++ .../Views/MatDetailStocktakingInfoView.xaml | 407 ++++++++++++++++++ .../Views/MatDetailStocktakingInfoView.xaml.cs | 77 ++++ 14 files changed, 1467 insertions(+), 21 deletions(-) create mode 100644 WCS.Model/ApiModel/Stocktaking/GetStocktakingInfosRequest.cs create mode 100644 WCS.Model/ApiModel/Stocktaking/MatDetailStocktakingInfoModel.cs create mode 100644 WCS.Model/ApiModel/Stocktaking/UpdateStocktakingInfoRequest.cs create mode 100644 货架标准上位机/ViewModels/MatDetailStocktakingInfoViewModel.cs create mode 100644 货架标准上位机/Views/MatDetailStocktakingInfoUpdateView.xaml create mode 100644 货架标准上位机/Views/MatDetailStocktakingInfoUpdateView.xaml.cs create mode 100644 货架标准上位机/Views/MatDetailStocktakingInfoView.xaml create mode 100644 货架标准上位机/Views/MatDetailStocktakingInfoView.xaml.cs diff --git a/WCS.BLL/DbModels/STZL/MatDetailStocktakingInfo.cs b/WCS.BLL/DbModels/STZL/MatDetailStocktakingInfo.cs index ee67bb1..8be2d9b 100644 --- a/WCS.BLL/DbModels/STZL/MatDetailStocktakingInfo.cs +++ b/WCS.BLL/DbModels/STZL/MatDetailStocktakingInfo.cs @@ -1,10 +1,5 @@ using SqlSugar; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using WCS.DAL.DbModels; +using WCS.Model.ApiModel.Stocktaking; namespace WCS.BLL.DbModels { @@ -127,9 +122,5 @@ namespace WCS.BLL.DbModels public bool IsSelected { get; set; } } - public enum StocktakingStatusEnum - { - 未提交 = 0, - 已提交 = 1, - } + } diff --git a/WCS.BLL/Services/IService/IStockTakingService.cs b/WCS.BLL/Services/IService/IStockTakingService.cs index 4f1f0e6..fbad8b7 100644 --- a/WCS.BLL/Services/IService/IStockTakingService.cs +++ b/WCS.BLL/Services/IService/IStockTakingService.cs @@ -5,6 +5,8 @@ using System.Text; using System.Threading.Tasks; using WCS.BLL.DbModels; using WCS.Model; +using WCS.Model.ApiModel.MatBaseInfo; +using WCS.Model.ApiModel.MatDetailCurrentInfo; using WCS.Model.ApiModel.Stocktaking; namespace WCS.BLL.Services.IService @@ -36,6 +38,12 @@ namespace WCS.BLL.Services.IService #region 赛特制冷 public Task stockTakingById(StockTakingByIdRequest request); + + public Task> getStocktakingInfos(GetStocktakingInfosRequest request); + + public Task> updateStocktakingInfo(UpdateStocktakingInfoRequest request); + + public Task> deleteStocktakingInfos(DeleteInfosRequest request); #endregion } } diff --git a/WCS.BLL/Services/Service/StockTakingService.cs b/WCS.BLL/Services/Service/StockTakingService.cs index c6bb7d6..835b985 100644 --- a/WCS.BLL/Services/Service/StockTakingService.cs +++ b/WCS.BLL/Services/Service/StockTakingService.cs @@ -12,6 +12,8 @@ using WCS.DAL.Db; using WCS.DAL.DbModels; using WCS.Model; using WCS.Model.ApiModel.InOutRecord; +using WCS.Model.ApiModel.MatBaseInfo; +using WCS.Model.ApiModel.MatDetailCurrentInfo; using WCS.Model.ApiModel.Stocktaking; using WCS.Model.WebSocketModel; @@ -1104,6 +1106,160 @@ namespace WCS.BLL.Services.Service Message = $"success", }; } + + public async Task> getStocktakingInfos(GetStocktakingInfosRequest request) + { + try + { + var recordsQueryable = DbHelp.db.Queryable() + .LeftJoin((mci, si) => mci.ShlefId == si.Id) + .LeftJoin((mci, si, li) => (si.TransStatus == TransStatusEnum.静止 && si.CurrentLocationId == li.Id) + || (si.TransStatus == TransStatusEnum.运输中 && si.DestinationLocationId == li.Id)) + .WhereIF(!string.IsNullOrEmpty(request.MatCode), (mci, si, li) => mci.MatCode.Contains(request.MatCode)) + .WhereIF(!string.IsNullOrEmpty(request.MatName), (mci, si, li) => mci.MatName.Contains(request.MatName)) + .WhereIF(!string.IsNullOrEmpty(request.StocktakingUser), (mci, si, li) => mci.StocktakingUser.Contains(request.StocktakingUser)) + .WhereIF(request.StocktakingStatus != null, (mci, si, li) => mci.StocktakingStatus == request.StocktakingStatus) + .Select((mci, si, li) => new MatDetailStocktakingInfoModel() + { + Id = mci.Id, + MatDetailCurrentId = mci.MatDetailCurrentId, + + ShlefId = mci.ShlefId, + ShelfCode = mci.ShelfCode, + ShelfType = si.ShelfTypeName, + ShelfArea = li.LocationArea, + + MatCode = mci.MatCode, + MatName = mci.MatName, + MatSpec = mci.MatSpec, + MatQty = mci.MatQty, + StocktakingQty = mci.StocktakingQty, + MatSupplier = mci.MatSupplier, + MatCustomer = mci.MatCustomer, + + StocktakingUser = mci.StocktakingUser, + StocktakingTime = mci.StocktakingTime, + StocktakingStatus = mci.StocktakingStatus, + }); + + //分页 + var totalCount = await recordsQueryable.CountAsync(); + var records = await recordsQueryable + .OrderByDescending(mci => mci.Id) + .Skip((request.PageNumber - 1) * request.PageSize).Take(request.PageSize) + .ToListAsync(); + //生成序号 + for (int i = 0; i < records.Count; i++) + { + records[i].RowNumber = (request.PageNumber - 1) * request.PageSize + i + 1; + } + return new PageQueryResponse() + { + Code = 200, + Message = $"success", + Data = new PageQueryResponseData() + { + TotalCount = totalCount, + MaxPage = request.PageSize == 0 ? 0 : (int)Math.Ceiling((decimal)totalCount / request.PageSize), + Count = records.Count, + Lists = records.ToList() + } + }; + } + catch (Exception ex) + { + return new PageQueryResponse() + { + Code = 300, + Message = $"操作失败:{ex.Message}", + }; + } + } + + /// + /// 更新盘点数据的数量 + /// + /// + /// + public async Task> updateStocktakingInfo(UpdateStocktakingInfoRequest request) + { + try + { + var matDetailCurrentInfo = await DbHelp.db.Queryable() + .Where(t => t.Id == request.MatDetailStocktakingInfoId) + .FirstAsync(); + if (matDetailCurrentInfo == null) + { + return new ResponseCommon + { + Code = 205, + Message = $"更新盘点数据失败:此条数据不存在,请确认!", + Data = null + }; + } + matDetailCurrentInfo.StocktakingQty = request.StocktakingQty; + matDetailCurrentInfo.StocktakingUser = request.UserName; + matDetailCurrentInfo.StocktakingTime = DateTime.Now; + var rowNum = await DbHelp.db.Updateable(matDetailCurrentInfo).ExecuteCommandAsync(); + if (rowNum == 0) + { + return new ResponseCommon + { + Code = 201, + Message = $"更新盘点数据失败:请重试!", + Data = null + }; + } + else + { + return new ResponseCommon + { + Code = 200, + Message = $"更新盘点数据成功!", + Data = null + }; + } + } + catch (Exception ex) + { + var response = new ResponseCommon + { + Code = 300, + Message = $"操作失败:{ex.Message}", + Data = null + }; + return response; + } + } + + public async Task> deleteStocktakingInfos(DeleteInfosRequest request) + { + //先查询出具体的Id + var MatDetailCurrentInfos = await DbHelp.db.Queryable() + .Where(t => request.needDeleteIds.Contains(t.Id)) + .ToListAsync(); + //执行删除 + try + { + var deleteRows = await DbHelp.db.Deleteable(MatDetailCurrentInfos).ExecuteCommandAsync(); + return new ResponseCommon + { + Code = 200, + Message = $"已删除{deleteRows}条数据!", + Data = null + }; + } + catch (Exception ex) + { + var response = new ResponseCommon + { + Code = 300, + Message = $"操作失败:{ex.Message}", + Data = null + }; + return response; + } + } #endregion } } diff --git a/WCS.Model/ApiModel/Stocktaking/GetStocktakingInfosRequest.cs b/WCS.Model/ApiModel/Stocktaking/GetStocktakingInfosRequest.cs new file mode 100644 index 0000000..db42187 --- /dev/null +++ b/WCS.Model/ApiModel/Stocktaking/GetStocktakingInfosRequest.cs @@ -0,0 +1,23 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace WCS.Model.ApiModel.Stocktaking +{ + public class GetStocktakingInfosRequest : PageQueryRequestBase + { + public string MatCode { get; set; } + + public string MatName { get; set; } + + public string StocktakingUser { get; set; } + + public StocktakingStatusEnum? StocktakingStatus { get; set; }//盘点状态 + } + + public enum StocktakingStatusEnum + { + 未提交 = 0, + 已提交 = 1, + } +} diff --git a/WCS.Model/ApiModel/Stocktaking/MatDetailStocktakingInfoModel.cs b/WCS.Model/ApiModel/Stocktaking/MatDetailStocktakingInfoModel.cs new file mode 100644 index 0000000..851c8c4 --- /dev/null +++ b/WCS.Model/ApiModel/Stocktaking/MatDetailStocktakingInfoModel.cs @@ -0,0 +1,113 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Text; + +namespace WCS.Model.ApiModel.Stocktaking +{ + public class MatDetailStocktakingInfoModel : INotifyPropertyChanged + { + /// + /// 主键 自增Id + /// + public int Id { get; set; } + + /// + /// 货架库存明细当前的ID + /// + public int MatDetailCurrentId { get; set; } + + #region 货架属性 + /// + /// 货架ID + /// + public int ShlefId { get; set; } + + /// + /// 货架编码 对应二维码 + /// + public string ShelfCode { get; set; } + + /// + /// 货架类型 + /// + public string ShelfType { get; set; } + + /// + /// 货架区域 + /// + public string ShelfArea { get; set; } + + #endregion + + #region 物料属性 + /// + /// 物料编码 + /// + public string MatCode { get; set; } + /// + /// 物料名称 + /// + public string MatName { get; set; } + + /// + /// 物料规格 + /// + public string? MatSpec { get; set; } + + /// + /// 物料数量(原始数量) + /// + public int MatQty { get; set; } + + /// + /// 物料数量(盘点数量) + /// + public int StocktakingQty { get; set; } + + /// + /// 物料供应商 + /// + public string? MatSupplier { get; set; } + + /// + /// 物料客户 + /// + public string? MatCustomer { get; set; } + #endregion + + /// + /// 盘点人 + /// + public string? StocktakingUser { get; set; } + + /// + /// 盘点时间 + /// + public DateTime? StocktakingTime { get; set; } = DateTime.Now; + + /// + /// 盘点状态 + /// + public StocktakingStatusEnum StocktakingStatus { get; set; } = StocktakingStatusEnum.未提交; + + public bool IsSelected + { + get { return isSelected; } + set + { + isSelected = value; + OnPropertyChanged(nameof(IsSelected)); + } + } + public bool isSelected; + + public int RowNumber { get; set; } + + public event PropertyChangedEventHandler PropertyChanged; + protected virtual void OnPropertyChanged(string propertyName) + { + PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); + } + } +} diff --git a/WCS.Model/ApiModel/Stocktaking/UpdateStocktakingInfoRequest.cs b/WCS.Model/ApiModel/Stocktaking/UpdateStocktakingInfoRequest.cs new file mode 100644 index 0000000..20d9695 --- /dev/null +++ b/WCS.Model/ApiModel/Stocktaking/UpdateStocktakingInfoRequest.cs @@ -0,0 +1,13 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace WCS.Model.ApiModel.Stocktaking +{ + public class UpdateStocktakingInfoRequest : RequestBase + { + public int MatDetailStocktakingInfoId { get; set; } + + public int StocktakingQty { get; set; } + } +} diff --git a/WCS.WebApi/Controllers/MatDetailCurrenInfoController.cs b/WCS.WebApi/Controllers/MatDetailCurrenInfoController.cs index f71f66e..197e6d2 100644 --- a/WCS.WebApi/Controllers/MatDetailCurrenInfoController.cs +++ b/WCS.WebApi/Controllers/MatDetailCurrenInfoController.cs @@ -11,7 +11,7 @@ using WCS.DAL.DbModels; namespace WCS.WebApi.Controllers { /// - /// 货架管理、模组管理、库位管理的接口 + /// 当前库存存量的数据 当前库存数据 /// [ApiController] [Route("[controller]")] @@ -23,7 +23,7 @@ namespace WCS.WebApi.Controllers _matDetailCurrentInfoService = matDetailCurrentInfoService; } - #region 位置管理 + #region 库存数据管理 [Route("getMatDetailCurrentInfos")] [HttpPost(Name = "getMatDetailCurrentInfos")] public async Task GetMatDetailCurrentInfos(GetMatDetailCurrentInfosRequest request) @@ -56,6 +56,15 @@ namespace WCS.WebApi.Controllers [HttpPost("deleteMatDetailCurrentInfo")] public async Task> deleteMatDetailCurrentInfo(DeleteInfosRequest request) { + //校验 + if (request.needDeleteIds == null || request.needDeleteIds.Count == 0) + { + return new ResponseCommon() + { + Code = 201, + Message = "操作失败:参数校验失败(ID)." + }; + } return await _matDetailCurrentInfoService.deleteMatDetailCurrentInfo(request); } #endregion diff --git a/WCS.WebApi/Controllers/PDAStocktakingController.cs b/WCS.WebApi/Controllers/PDAStocktakingController.cs index 96e3c84..e498dc5 100644 --- a/WCS.WebApi/Controllers/PDAStocktakingController.cs +++ b/WCS.WebApi/Controllers/PDAStocktakingController.cs @@ -1,14 +1,9 @@ using Microsoft.AspNetCore.Mvc; -using WCS.BLL.DbModels; using WCS.BLL.Services.IService; -using WCS.DAL.Db; -using WCS.DAL.DbModels; +using WCS.BLL.Services.Service; using WCS.Model; -using WCS.Model.ApiModel; -using WCS.Model.ApiModel.PDAMatBind; +using WCS.Model.ApiModel.MatBaseInfo; using WCS.Model.ApiModel.Stocktaking; -using WCS.Model.ApiModel.User; -using WCS.Model.WebSocketModel; namespace WCS.WebApi.Controllers { @@ -67,6 +62,44 @@ namespace WCS.WebApi.Controllers } } + [Route("getStocktakingInfos")] + [HttpPost(Name = "getStocktakingInfos")] + public async Task getStocktakingInfos(GetStocktakingInfosRequest request) + { + try + { + return await _stockTakingService.getStocktakingInfos(request); + } + catch (Exception ex) + { + return new ResponseCommon() + { + Code = 201, + Message = ex.Message, + Data = null, + }; + } + } + [HttpPost("updateStocktakingInfos")] + public async Task> updateStocktakingInfos(UpdateStocktakingInfoRequest request) + { + return await _stockTakingService.updateStocktakingInfo(request); + } + + [HttpPost("deleteStocktakingInfos")] + public async Task> deleteStocktakingInfos(DeleteInfosRequest request) + { + //校验 + if (request.needDeleteIds == null || request.needDeleteIds.Count == 0) + { + return new ResponseCommon() + { + Code = 201, + Message = "操作失败:参数校验失败(ID)." + }; + } + return await _stockTakingService.deleteStocktakingInfos(request); + } } } diff --git a/货架标准上位机/ViewModels/MatDetailStocktakingInfoViewModel.cs b/货架标准上位机/ViewModels/MatDetailStocktakingInfoViewModel.cs new file mode 100644 index 0000000..540fcd1 --- /dev/null +++ b/货架标准上位机/ViewModels/MatDetailStocktakingInfoViewModel.cs @@ -0,0 +1,354 @@ +using HandyControl.Controls; +using MiniExcelLibs; +using Ping9719.WpfEx.Mvvm; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Runtime.CompilerServices; +using System.Text; +using System.Threading; +using System.Threading.Tasks; +using System.Windows.Input; +using System.Windows.Media; +using SqlSugar; +using HandyControl.Data; +using System.Windows; +using Newtonsoft.Json.Linq; +using 智慧物流软件系统.Views.Controls; +using WCS.Model.ApiModel.User; +using 智慧物流软件系统.Api; +using WCS.Model; +using WCS.Model.ApiModel; +using System.Windows.Controls; +using WCS.Model.ApiModel.InterfaceRecord; +using WCS.BLL.DbModels; +using WCS.Model.ApiModel.MatBaseInfo; +using System.Collections.ObjectModel; +using HandyControl.Tools.Extension; +using 智慧物流软件系统.Tool; +using WCS.Model.ApiModel.Stocktaking; + +namespace 智慧物流软件系统.ViewModel +{ + public class MatDetailStocktakingInfoViewModel : BindableBase + { + + public MatDetailStocktakingInfoViewModel() + { + //初始化下拉列表框 + StocktakingStatuses.Add("全部"); + var statuses = Enum.GetValues(typeof(StocktakingStatusEnum)) + .Cast() + .ToList(); + foreach (var status in statuses) + { + StocktakingStatuses.Add(status.ToString()); + } + + selectedStocktakingStatus = StocktakingStatuses.First(); + } + + #region Property + private ObservableCollection dataGridItemSource; + public ObservableCollection DataGridItemSource + { + get { return dataGridItemSource; } + set + { + SetProperty(ref dataGridItemSource, value); + } + } + + public MatDetailStocktakingInfoModel selectedataGridItem; + public MatDetailStocktakingInfoModel SelectedataGridItem + { + get { return selectedataGridItem; } + set + { + SetProperty(ref selectedataGridItem, value); + } + } + + /// + /// 物料编码 + /// + private string matCode; + public string MatCode + { + get { return matCode; } + set + { + SetProperty(ref matCode, value); + } + } + + /// + /// 物料名称 + /// + private string matName; + public string MatName + { + get { return matName; } + set + { + SetProperty(ref matName, value); + } + } + + /// + /// 盘点人 + /// + private string stocktakingUser; + public string StocktakingUser + { + get { return stocktakingUser; } + set + { + SetProperty(ref stocktakingUser, value); + } + } + + /// + /// 盘点状态列表 + /// + private List stocktakingStatuses = new List(); + public List StocktakingStatuses + { + get { return stocktakingStatuses; } + set + { + SetProperty(ref stocktakingStatuses, value); + } + } + + private string selectedStocktakingStatus; + public string SelectedStocktakingStatus + { + get { return selectedStocktakingStatus; } + set + { + SetProperty(ref selectedStocktakingStatus, value); + } + } + + #endregion + + #region Command + public ICommand BtnResetCommand { get => new DelegateCommand(BtnReset); } + public void BtnReset() + { + MatCode = string.Empty; + MatName = string.Empty; + StocktakingUser = string.Empty; + + } + + public ICommand BtnSearchCommand { get => new DelegateCommand(BtnSearchReset); } + public void BtnSearchReset() + { + BtnSearch(true); + } + public void BtnSearch(bool IsPageReset = true) + { + if (CurrentPage == 0 || IsPageReset) + { + CurrentPage = 1; + return; + } + var isSelected = Enum.TryParse(SelectedStocktakingStatus, out StocktakingStatusEnum status); + #region 调用接口获取数据 + var dia = Dialog.Show(new TextDialog()); + try + { + var body = new GetStocktakingInfosRequest() + { + MatCode = MatCode, + MatName = MatName, + StocktakingUser = StocktakingUser, + StocktakingStatus = isSelected ? status : null, + + UserName = LocalStatic.CurrentUser, + DeviceType = LocalFile.Config.DeviceType, + PageNumber = CurrentPage, + PageSize = PageSize, + + }; + var Result = ApiHelp.GetDataFromHttp>(LocalFile.Config.ApiIpHost + "PDAStocktaking/getStocktakingInfos", body, "POST"); + if (Result != null && Result.Data != null && Result.Data.Lists != null) + { + DataGridItemSource = new ObservableCollection(Result.Data.Lists); + MaxPage = Result.Data.MaxPage; + TotalCount = Result.Data.TotalCount; + } + } + catch (Exception ex) + { + Growl.Error("加载数据失败:" + ex.Message); + } + finally + { + dia.Close(); + } + #endregion + } + + + /// + /// 物料修改操作 + /// + public ICommand BtnEditCommand { get => new DelegateCommand(BtnEdit); } + public async void BtnEdit() + { + //查询勾选的第一个数据 + var matDetailStocktakingInfo = DataGridItemSource?.Where(t => t.IsSelected == true).FirstOrDefault(); + if (matDetailStocktakingInfo == null) + { + Growl.Warning("请选择需要修改的数据!"); + return; + } + else + { + var updateView = new MatDetailStocktakingInfoUpdateView("修改盘点数据", matDetailStocktakingInfo); + updateView.ShowDialog(); + if (updateView.DialogResult == true) + { + matDetailStocktakingInfo = updateView.matDetailStocktakingInfo; + var body = new UpdateStocktakingInfoRequest() + { + MatDetailStocktakingInfoId = matDetailStocktakingInfo.Id, + StocktakingQty = matDetailStocktakingInfo.StocktakingQty, + UserName = LocalStatic.CurrentUser, + DeviceType = LocalFile.Config.DeviceType, + }; + var Result = ApiHelp.GetDataFromHttp>(LocalFile.Config.ApiIpHost + "PDAStocktaking/updateStocktakingInfos", body, "POST"); + if (Result != null && Result.Code == 200) + { + CurrentPage = 1; + Growl.Success("修改成功!"); + } + else + { + Growl.Error($"{Result?.Message?.ToString()}"); + } + } + } + } + + /// + /// 物料删除操作 + /// + public ICommand BtnDeleteCommand { get => new DelegateCommand(BtnDelete); } + public async void BtnDelete() + { + Growl.Ask($"是否删除所有勾选得数据]!", isConfirmed => + { + if (isConfirmed) + { + //查询勾选的第一个数据 + var needDeleteIds = DataGridItemSource?.Where(t => t.IsSelected == true) + .Select(t => t.Id) + .ToList(); + + if (needDeleteIds == null) + { + Growl.Warning("请选择需要修改的数据!"); + } + else + { + var body = new DeleteInfosRequest() + { + UserName = LocalStatic.CurrentUser, + DeviceType = LocalFile.Config.DeviceType, + needDeleteIds = needDeleteIds, + }; + var Result = ApiHelp.GetDataFromHttp>(LocalFile.Config.ApiIpHost + "PDAStocktaking/deleteStocktakingInfos", body, "POST"); + if (Result != null && Result.Code == 200) + { + CurrentPage = 1; + Growl.Success("删除成功!" + Result?.Message); + } + else + { + Growl.Error($"{Result?.Message?.ToString()}"); + } + } + } + return true; + }); + } + #endregion + + #region PageOperation 分页操作 + private int currentPage; + public int CurrentPage + { + get { return currentPage; } + set + { + SetProperty(ref currentPage, value); + BtnSearch(false); + } + } + + private int maxPage; + public int MaxPage + { + get { return maxPage; } + set { SetProperty(ref maxPage, value); } + } + + //总数量 + private int totalCount; + public int TotalCount + { + get { return totalCount; } + set { SetProperty(ref totalCount, value); } + } + + private int pageSize = 10; + public int PageSize + { + get => pageSize; + set + { + SetProperty(ref pageSize, value); + BtnSearch(true); + } + } + + + public ICommand BtnFirstPageCommand { get => new DelegateCommand(BtnFirstPage); } + public void BtnFirstPage() + { + CurrentPage = 1; + } + + public ICommand BtnPrePageCommand { get => new DelegateCommand(BtnPrePage); } + public void BtnPrePage() + { + if (CurrentPage > 1) + { + CurrentPage--; + } + } + + public ICommand BtnNextPageCommand { get => new DelegateCommand(BtnNextPage); } + public void BtnNextPage() + { + if (CurrentPage < MaxPage) + { + CurrentPage++; + } + } + + public ICommand BtnLastPageCommand { get => new DelegateCommand(BtnLastPage); } + public void BtnLastPage() + { + if (CurrentPage != MaxPage) + { + CurrentPage = MaxPage; + } + } + #endregion + } +} diff --git a/货架标准上位机/Views/MainWindows/MainWindow1.xaml b/货架标准上位机/Views/MainWindows/MainWindow1.xaml index 94219da..a6e3382 100644 --- a/货架标准上位机/Views/MainWindows/MainWindow1.xaml +++ b/货架标准上位机/Views/MainWindows/MainWindow1.xaml @@ -200,7 +200,7 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 10条/页 + 20条/页 + 50条/页 + 100条/页 + 500条/页 + + + + + + + + + + + + + + +