From d84f46b624d74d50b5bb1df7234216042e4f8b2c Mon Sep 17 00:00:00 2001 From: liuwf Date: Thu, 9 Nov 2023 17:45:48 +0800 Subject: [PATCH] =?UTF-8?q?change=20-=20=E4=BF=AE=E6=94=B9=E7=BB=9F?= =?UTF-8?q?=E8=AE=A1=E5=88=86=E6=9E=90=E9=A1=B5=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ViewModels/IndexPageViewModel.cs | 1 - .../ViewModels/StatisticsPageViewModel.cs | 70 +++++++++++-------- 2 files changed, 41 insertions(+), 30 deletions(-) diff --git a/Aucma.Core.ProductOffLine/ViewModels/IndexPageViewModel.cs b/Aucma.Core.ProductOffLine/ViewModels/IndexPageViewModel.cs index 1ef27343..73f91d6f 100644 --- a/Aucma.Core.ProductOffLine/ViewModels/IndexPageViewModel.cs +++ b/Aucma.Core.ProductOffLine/ViewModels/IndexPageViewModel.cs @@ -41,7 +41,6 @@ namespace Aucma.Core.ProductOffLine.ViewModels _productPlanInfoServices = App.ServiceProvider.GetService(); MvCodeHelper.ReceiveCodeEvent += ReceiveCode; - // test(); //List listdatabase = Appsettings.app("DBS") // .Where(i => i.Enabled).ToList(); diff --git a/Aucma.Core.ProductOffLine/ViewModels/StatisticsPageViewModel.cs b/Aucma.Core.ProductOffLine/ViewModels/StatisticsPageViewModel.cs index 8bc655d8..6af330f1 100644 --- a/Aucma.Core.ProductOffLine/ViewModels/StatisticsPageViewModel.cs +++ b/Aucma.Core.ProductOffLine/ViewModels/StatisticsPageViewModel.cs @@ -1,4 +1,5 @@ -using Aucma.Core.ProductOffLine.Models; +using Admin.Core.Model; +using Aucma.Core.ProductOffLine.Models; using CommunityToolkit.Mvvm.ComponentModel; using CommunityToolkit.Mvvm.Input; using System; @@ -8,6 +9,7 @@ using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows; +using System.Windows.Documents; namespace Aucma.Core.ProductOffLine.ViewModels { @@ -54,35 +56,45 @@ namespace Aucma.Core.ProductOffLine.ViewModels [RelayCommand] private void ExecQuery(object obj) { - var result = (StatisticModel)obj; - if (string.IsNullOrEmpty(result.BeginTime)) - { - MessageBox.Show("开始时间不能为空!"); - return; - } - if (string.IsNullOrEmpty(result.EndTime)) - { - MessageBox.Show("结束时间不能为空!"); - return; - } - var beginTime = result.BeginTime; - var endTime = result.EndTime; + //List list; + //var result = (StatisticModel)obj; + //if (string.IsNullOrEmpty(result.BeginTime) && string.IsNullOrEmpty(result.EndTime)) + //{ + // list = await _codeBindingRecordServices.QueryAllByTime(null, null); + //} + //else if (string.IsNullOrEmpty(result.BeginTime)) + //{ + // list = await _codeBindingRecordServices.QueryAllByTime(result.BeginTime, null); + //} + //else if (string.IsNullOrEmpty(result.EndTime)) + //{ + // list = await _codeBindingRecordServices.QueryAllByTime(null, result.EndTime); + //} + //else + //{ + // DateTime theBeginTime = Convert.ToDateTime(result.BeginTime); + // DateTime theEndTime = Convert.ToDateTime(result.EndTime); + // if (theBeginTime > theEndTime) + // { + // MessageBox.Show("结束时间要大于开始时间!"); + // return; + // } + // list = await _codeBindingRecordServices.QueryAllByTime(result.BeginTime, result.EndTime); + //} - System.Windows.Application.Current.Dispatcher.Invoke((Action)(() => - { - if (!string.IsNullOrEmpty(beginTime)) - { - MaterialDataGrid.Clear(); - MaterialDataGrid.Add(new MaterialComplateInfo() { No = 1, ProductPlanCode = "8659452123", MaterialCode = "8659452123", MaterialName = "SC-AUCMA-可口可乐,SC", PlanAmount = 50, CompleteAmount = 10 }); - } - else - { - MaterialDataGrid.Clear(); - LoadData(); - } - //Datalist.Insert(0, Datalist[Datalist.Count - 1]); - //Datalist.RemoveAt(Datalist.Count - 1); - })); + + //if (list != null) + //{ + // System.Windows.Application.Current.Dispatcher.Invoke((Action)(async () => + // { + // MaterialDataGrid.Clear(); + // foreach (CodeBindingRecord item in list) + // { + // MaterialDataGrid.Add(new ReaderInfo() { No = item.ObjId, BoxCode = item.BoxCode, BoxName = item.BoxName, ProductCode = item.ProductCode, BindingResult = item.BindingResult, RecordTime = item.RecordTime1.ToString() }); + // } + + // })); + //} } #endregion }