From e1629fbdc7d7ff54e18d447b43b702ef3e445ad2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=A9=AC=E5=B7=A7?= <625215135@qq.com> Date: Mon, 28 Jul 2025 15:16:43 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8A=A5=E8=A1=A8=E6=9F=A5=E8=AF=A2=E6=9D=A1?= =?UTF-8?q?=E4=BB=B6=E6=B7=BB=E5=8A=A0=E6=97=B6=E9=97=B4=E9=80=89=E6=8B=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- DM_Weight/App.xaml.cs | 2 + DM_Weight/ReportTemp/account_use_temp.grf | 45 +++---- .../ViewModels/ApplyInStockWindowViewModel.cs | 3 + .../ViewModels/DatetimeDialogViewModel.cs | 73 +++++++++++ .../DrawerAddDrugWindowViewModel.cs | 8 +- .../DrawerTakeDrugWindowViewModel.cs | 8 +- .../ViewModels/InvoiceAddDialogViewModel.cs | 9 +- .../ViewModels/InvoiceTakeDialogViewModel.cs | 6 +- .../ViewModels/OrderReturnDialogViewModel.cs | 6 +- .../ViewModels/OrderTakeDialogViewModel.cs | 6 +- DM_Weight/ViewModels/PickersViewModel.cs | 47 +++++++ .../ViewModels/ReturnDrugDialogViewModel.cs | 6 +- .../ViewModels/SelfAddDialogViewModel.cs | 6 +- .../ViewModels/SelfTakeDialogViewModel.cs | 6 +- .../ViewModels/UseAccountWindowViewModel.cs | 65 ++++++---- DM_Weight/Views/Dialog/DatetimeDialog.xaml | 36 ++++++ DM_Weight/Views/Dialog/DatetimeDialog.xaml.cs | 28 +++++ DM_Weight/Views/UseAccountWindow.xaml | 116 ++++++++++++++---- 18 files changed, 398 insertions(+), 78 deletions(-) create mode 100644 DM_Weight/ViewModels/DatetimeDialogViewModel.cs create mode 100644 DM_Weight/ViewModels/PickersViewModel.cs create mode 100644 DM_Weight/Views/Dialog/DatetimeDialog.xaml create mode 100644 DM_Weight/Views/Dialog/DatetimeDialog.xaml.cs diff --git a/DM_Weight/App.xaml.cs b/DM_Weight/App.xaml.cs index 6ef46ef..8b517a6 100644 --- a/DM_Weight/App.xaml.cs +++ b/DM_Weight/App.xaml.cs @@ -269,6 +269,8 @@ namespace DM_Weight //交接柜加药页面 containerRegistry.RegisterForNavigation(); + containerRegistry.RegisterDialog(); + containerRegistry.RegisterForNavigation(); } } diff --git a/DM_Weight/ReportTemp/account_use_temp.grf b/DM_Weight/ReportTemp/account_use_temp.grf index 847a25f..a5da9b3 100644 --- a/DM_Weight/ReportTemp/account_use_temp.grf +++ b/DM_Weight/ReportTemp/account_use_temp.grf @@ -115,6 +115,10 @@ "Name":"手术间", "Width":1.00542 }, + { + "Name":"Column1", + "Width":2.35479 + }, { "Name":"病人姓名", "Width":1.79917 @@ -157,11 +161,8 @@ }, { "Name":"空安瓿药房接收者", - "Width":1.61396 - }, - { - "Name":"Column1", - "Width":2.35479 + "Width":1.61396, + "Visible":false } ], "ColumnContent":{ @@ -194,6 +195,11 @@ "TextAlign":"MiddleCenter", "DataField":"手术间" }, + { + "Column":"Column1", + "TextAlign":"MiddleCenter", + "DataField":"住院号" + }, { "Column":"病人姓名", "TextAlign":"MiddleCenter", @@ -247,11 +253,6 @@ "Column":"空安瓿药房接收者", "TextAlign":"MiddleCenter", "DataField":"空安瓿药房接收者" - }, - { - "Column":"Column1", - "TextAlign":"MiddleCenter", - "DataField":"住院号" } ] }, @@ -319,6 +320,18 @@ "TextAlign":"MiddleCenter", "Text":"手\r\n术\r\n间" }, + { + "GroupTitle":false, + "Column":"Column1", + "Font":{ + "Name":"宋体", + "Size":105000, + "Bold":true, + "Charset":134 + }, + "TextAlign":"MiddleCenter", + "Text":"住院号" + }, { "GroupTitle":false, "Column":"病人姓名", @@ -450,18 +463,6 @@ }, "TextAlign":"MiddleCenter", "Text":"空安瓿\r\n药房\r\n接收者" - }, - { - "GroupTitle":false, - "Column":"Column1", - "Font":{ - "Name":"宋体", - "Size":105000, - "Bold":true, - "Charset":134 - }, - "TextAlign":"MiddleCenter", - "Text":"住院号" } ] } diff --git a/DM_Weight/ViewModels/ApplyInStockWindowViewModel.cs b/DM_Weight/ViewModels/ApplyInStockWindowViewModel.cs index 5ba686d..8e14bfe 100644 --- a/DM_Weight/ViewModels/ApplyInStockWindowViewModel.cs +++ b/DM_Weight/ViewModels/ApplyInStockWindowViewModel.cs @@ -655,6 +655,7 @@ namespace DM_Weight.ViewModels UserId2 = HomeWindowViewModel.Reviewer?.Id, MachineId = ConfigurationManager.AppSettings["machineId"].ToString(), CreateDate = DateTime.Now.ToString("yyyy-MM-dd"), + CreateTime = DateTime.Now, //CreateTime = DateTime.Now, InvoiceNo = SelectDrugPleaseClaim.PleaseNo @@ -687,6 +688,7 @@ namespace DM_Weight.ViewModels UserId2 = HomeWindowViewModel.Reviewer?.Id, MachineId = ConfigurationManager.AppSettings["machineId"].ToString(), CreateDate = DateTime.Now.ToString("yyyy-MM-dd"), + CreateTime = DateTime.Now, InvoiceNo = "日结存" }).ExecuteCommand(); if (iDayResult <= 0) @@ -720,6 +722,7 @@ namespace DM_Weight.ViewModels UserId2 = HomeWindowViewModel.Reviewer?.Id, MachineId = ConfigurationManager.AppSettings["machineId"].ToString(), CreateDate = DateTime.Now.ToString("yyyy-MM-dd"), + CreateTime = DateTime.Now, InvoiceNo = "总结存" }).ExecuteCommand(); if (iTotalResult <= 0) diff --git a/DM_Weight/ViewModels/DatetimeDialogViewModel.cs b/DM_Weight/ViewModels/DatetimeDialogViewModel.cs new file mode 100644 index 0000000..7d67334 --- /dev/null +++ b/DM_Weight/ViewModels/DatetimeDialogViewModel.cs @@ -0,0 +1,73 @@ +using DM_Weight.Models; +using DM_Weight.msg; +using Prism.Commands; +using Prism.Mvvm; +using Prism.Services.Dialogs; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace DM_Weight.ViewModels +{ + internal class DatetimeDialogViewModel : BindableBase, IDialogAware + { + public string Title => throw new NotImplementedException(); + + public event Action RequestClose; + + private DateTime? _date = new DateTime(); + public DateTime? Date + { + get => _date; + set + { + SetProperty(ref _date, value); + } + } + private DateTime? _time = new DateTime(); + public DateTime? Time + { + get => _time; + set + { + SetProperty(ref _time, value); + } + } + + public bool CanCloseDialog() + { + return true; + } + + public void OnDialogClosed() + { + + } + string typeS; + public void OnDialogOpened(IDialogParameters parameters) + { + DateTime o = parameters.GetValue("DateTime"); + + typeS = parameters.GetValue("Type"); + Date = o; + Time = o; + } + + public DelegateCommand CloseAction + { + get => new DelegateCommand(() => + { + var datetime=new DateTime(Date?.Year ?? DateTime.Now.Year, Date?.Month ?? DateTime.Now.Month, Date?.Day ?? DateTime.Now.Day, + Time?.Hour ?? DateTime.Now.Hour, Time?.Minute ?? DateTime.Now.Minute, Time?.Second ?? DateTime.Now.Second); + var result = new DialogResult(ButtonResult.OK, new DialogParameters + { + { "DateTime", datetime }, + {"Type",typeS } + }); + RequestClose?.Invoke(result); + }); + } + } +} diff --git a/DM_Weight/ViewModels/DrawerAddDrugWindowViewModel.cs b/DM_Weight/ViewModels/DrawerAddDrugWindowViewModel.cs index 7ad6476..0b01279 100644 --- a/DM_Weight/ViewModels/DrawerAddDrugWindowViewModel.cs +++ b/DM_Weight/ViewModels/DrawerAddDrugWindowViewModel.cs @@ -255,7 +255,7 @@ namespace DM_Weight.ViewModels CreateDate = DateTime.Now.ToString("yyyy-MM-dd"), CreateTime = DateTime.Now, TotalStock = nowChannels.Sum(itx => itx.Quantity), - ManuStock = nowChannels.Where(itx => itx.ManuNo == it.ManuNo && itx.EffDate == it.EffDate).Sum(itx => itx.Quantity) + ManuStock = nowChannels.Where(itx => itx.ManuNo == it.ManuNo && itx.EffDate == it.EffDate).Sum(itx => itx.Quantity), }).ExecuteCommand(); //修改凌晨生成的日结存数据 AccountBookG2 accountBookG2Day = SqlSugarHelper.Db.Queryable() @@ -267,6 +267,7 @@ namespace DM_Weight.ViewModels if (accountBookG2Day != null) { accountBookG2Day.ManuStock = accountBookG2Day.ManuStock + it.AddQuantity; + accountBookG2Day.AddQuantity = accountBookG2Day.AddQuantity + it.AddQuantity; SqlSugarHelper.Db.Updateable(accountBookG2Day).ExecuteCommand(); } else @@ -285,7 +286,9 @@ namespace DM_Weight.ViewModels UserId2 = HomeWindowViewModel.Reviewer?.Id, MachineId = ConfigurationManager.AppSettings["machineId"].ToString(), CreateDate = DateTime.Now.ToString("yyyy-MM-dd"), - InvoiceNo = "日结存" + CreateTime=DateTime.Now, + InvoiceNo = "日结存", + AddQuantity=it.AddQuantity }).ExecuteCommand(); if (iDayResult <= 0) { @@ -317,6 +320,7 @@ namespace DM_Weight.ViewModels UserId2 = HomeWindowViewModel.Reviewer?.Id, MachineId = ConfigurationManager.AppSettings["machineId"].ToString(), CreateDate = DateTime.Now.ToString("yyyy-MM-dd"), + CreateTime = DateTime.Now, InvoiceNo = "总结存" }).ExecuteCommand(); if (iTotalResult <= 0) diff --git a/DM_Weight/ViewModels/DrawerTakeDrugWindowViewModel.cs b/DM_Weight/ViewModels/DrawerTakeDrugWindowViewModel.cs index 49ae933..bd5fc94 100644 --- a/DM_Weight/ViewModels/DrawerTakeDrugWindowViewModel.cs +++ b/DM_Weight/ViewModels/DrawerTakeDrugWindowViewModel.cs @@ -266,6 +266,7 @@ namespace DM_Weight.ViewModels if (accountBookG2Day != null) { accountBookG2Day.ManuStock = accountBookG2Day.ManuStock - it.TakeQuantity; + accountBookG2Day.OutQuantity = accountBookG2Day.OutQuantity + accountBookG2Day.OutQuantity; SqlSugarHelper.Db.Updateable(accountBookG2Day).ExecuteCommand(); } else @@ -284,7 +285,9 @@ namespace DM_Weight.ViewModels UserId2 = HomeWindowViewModel.Reviewer?.Id, MachineId = ConfigurationManager.AppSettings["machineId"].ToString(), CreateDate = DateTime.Now.ToString("yyyy-MM-dd"), - InvoiceNo = "日结存" + CreateTime = DateTime.Now, + InvoiceNo = "日结存", + OutQuantity=it.TakeQuantity }).ExecuteCommand(); if (iDayResult <= 0) { @@ -299,7 +302,7 @@ namespace DM_Weight.ViewModels .Where(ab => ab.CreateDate == DateTime.Now.ToString("yyyy-MM-dd")).First(); if (accountBookG2Total != null) { - accountBookG2Total.TotalStock = accountBookG2Total.TotalStock - it.TakeQuantity; + accountBookG2Total.TotalStock = accountBookG2Total.TotalStock - it.TakeQuantity; SqlSugarHelper.Db.Updateable(accountBookG2Total).ExecuteCommand(); } else @@ -316,6 +319,7 @@ namespace DM_Weight.ViewModels UserId2 = HomeWindowViewModel.Reviewer?.Id, MachineId = ConfigurationManager.AppSettings["machineId"].ToString(), CreateDate = DateTime.Now.ToString("yyyy-MM-dd"), + CreateTime = DateTime.Now, InvoiceNo = "总结存" }).ExecuteCommand(); if (iTotalResult <= 0) diff --git a/DM_Weight/ViewModels/InvoiceAddDialogViewModel.cs b/DM_Weight/ViewModels/InvoiceAddDialogViewModel.cs index ef5629a..c8c8ed7 100644 --- a/DM_Weight/ViewModels/InvoiceAddDialogViewModel.cs +++ b/DM_Weight/ViewModels/InvoiceAddDialogViewModel.cs @@ -318,6 +318,7 @@ namespace DM_Weight.ViewModels if (accountBookG2Day != null) { accountBookG2Day.ManuStock = accountBookG2Day.ManuStock + it.AddQuantity; + accountBookG2Day.AddQuantity = accountBookG2Day.AddQuantity + it.AddQuantity; SqlSugarHelper.Db.Updateable(accountBookG2Day).ExecuteCommand(); } else @@ -336,7 +337,9 @@ namespace DM_Weight.ViewModels UserId2 = HomeWindowViewModel.Reviewer?.Id, MachineId = ConfigurationManager.AppSettings["machineId"].ToString(), CreateDate = DateTime.Now.ToString("yyyy-MM-dd"), - InvoiceNo = "日结存" + CreateTime=DateTime.Now, + InvoiceNo = "日结存", + AddQuantity=it.AddQuantity }).ExecuteCommand(); if (iDayResult <= 0) { @@ -368,7 +371,9 @@ namespace DM_Weight.ViewModels UserId2 = HomeWindowViewModel.Reviewer?.Id, MachineId = ConfigurationManager.AppSettings["machineId"].ToString(), CreateDate = DateTime.Now.ToString("yyyy-MM-dd"), - InvoiceNo = "总结存" + CreateTime = DateTime.Now, + InvoiceNo = "总结存", + AddQuantity = it.AddQuantity }).ExecuteCommand(); if (iTotalResult <= 0) { diff --git a/DM_Weight/ViewModels/InvoiceTakeDialogViewModel.cs b/DM_Weight/ViewModels/InvoiceTakeDialogViewModel.cs index 08fbfa9..19569b2 100644 --- a/DM_Weight/ViewModels/InvoiceTakeDialogViewModel.cs +++ b/DM_Weight/ViewModels/InvoiceTakeDialogViewModel.cs @@ -372,6 +372,7 @@ namespace DM_Weight.ViewModels if (accountBookG2Day != null) { accountBookG2Day.ManuStock = accountBookG2Day.ManuStock - it.TakeQuantity; + accountBookG2Day.OutQuantity = accountBookG2Day.OutQuantity + it.TakeQuantity; SqlSugarHelper.Db.Updateable(accountBookG2Day).ExecuteCommand(); } else @@ -390,7 +391,9 @@ namespace DM_Weight.ViewModels UserId2 = HomeWindowViewModel.Reviewer?.Id, MachineId = ConfigurationManager.AppSettings["machineId"].ToString(), CreateDate = DateTime.Now.ToString("yyyy-MM-dd"), - InvoiceNo = "日结存" + CreateTime = DateTime.Now, + InvoiceNo = "日结存", + OutQuantity=it.TakeQuantity }).ExecuteCommand(); if (iDayResult <= 0) { @@ -422,6 +425,7 @@ namespace DM_Weight.ViewModels UserId2 = HomeWindowViewModel.Reviewer?.Id, MachineId = ConfigurationManager.AppSettings["machineId"].ToString(), CreateDate = DateTime.Now.ToString("yyyy-MM-dd"), + CreateTime = DateTime.Now, InvoiceNo = "总结存" }).ExecuteCommand(); if (iTotalResult <= 0) diff --git a/DM_Weight/ViewModels/OrderReturnDialogViewModel.cs b/DM_Weight/ViewModels/OrderReturnDialogViewModel.cs index 7dd89c4..afc7436 100644 --- a/DM_Weight/ViewModels/OrderReturnDialogViewModel.cs +++ b/DM_Weight/ViewModels/OrderReturnDialogViewModel.cs @@ -368,6 +368,7 @@ namespace DM_Weight.ViewModels if (accountBookG2Day != null) { accountBookG2Day.ManuStock = accountBookG2Day.ManuStock + it.ReturnQuantity; + accountBookG2Day.AddQuantity = accountBookG2Day.AddQuantity + it.ReturnQuantity; SqlSugarHelper.Db.Updateable(accountBookG2Day).ExecuteCommand(); } else @@ -386,7 +387,9 @@ namespace DM_Weight.ViewModels UserId2 = HomeWindowViewModel.Reviewer?.Id, MachineId = ConfigurationManager.AppSettings["machineId"].ToString(), CreateDate = DateTime.Now.ToString("yyyy-MM-dd"), - InvoiceNo = "日结存" + CreateTime = DateTime.Now, + InvoiceNo = "日结存", + AddQuantity= it.ReturnQuantity }).ExecuteCommand(); if (iDayResult <= 0) { @@ -418,6 +421,7 @@ namespace DM_Weight.ViewModels UserId2 = HomeWindowViewModel.Reviewer?.Id, MachineId = ConfigurationManager.AppSettings["machineId"].ToString(), CreateDate = DateTime.Now.ToString("yyyy-MM-dd"), + CreateTime = DateTime.Now, InvoiceNo = "总结存" }).ExecuteCommand(); if (iTotalResult <= 0) diff --git a/DM_Weight/ViewModels/OrderTakeDialogViewModel.cs b/DM_Weight/ViewModels/OrderTakeDialogViewModel.cs index 4f1da94..8c5e157 100644 --- a/DM_Weight/ViewModels/OrderTakeDialogViewModel.cs +++ b/DM_Weight/ViewModels/OrderTakeDialogViewModel.cs @@ -391,6 +391,7 @@ namespace DM_Weight.ViewModels if (accountBookG2Day != null) { accountBookG2Day.ManuStock = accountBookG2Day.ManuStock - it.TakeQuantity; + accountBookG2Day.OutQuantity = accountBookG2Day.OutQuantity + it.TakeQuantity; SqlSugarHelper.Db.Updateable(accountBookG2Day).ExecuteCommand(); } else @@ -409,7 +410,9 @@ namespace DM_Weight.ViewModels UserId2 = HomeWindowViewModel.Reviewer?.Id, MachineId = ConfigurationManager.AppSettings["machineId"].ToString(), CreateDate = DateTime.Now.ToString("yyyy-MM-dd"), - InvoiceNo = "日结存" + CreateTime = DateTime.Now, + InvoiceNo = "日结存", + OutQuantity=it.TakeQuantity }).ExecuteCommand(); if(iDayResult<=0) { @@ -441,6 +444,7 @@ namespace DM_Weight.ViewModels UserId2 = HomeWindowViewModel.Reviewer?.Id, MachineId = ConfigurationManager.AppSettings["machineId"].ToString(), CreateDate = DateTime.Now.ToString("yyyy-MM-dd"), + CreateTime = DateTime.Now, InvoiceNo = "总结存" }).ExecuteCommand(); if (iTotalResult <= 0) diff --git a/DM_Weight/ViewModels/PickersViewModel.cs b/DM_Weight/ViewModels/PickersViewModel.cs new file mode 100644 index 0000000..ca3c490 --- /dev/null +++ b/DM_Weight/ViewModels/PickersViewModel.cs @@ -0,0 +1,47 @@ +using Prism.Mvvm; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace DM_Weight.ViewModels +{ + internal class PickersViewModel:BindableBase + { + private DateTime _date; + private DateTime _time; + private string? _validatingTime; + private DateTime? _futureValidatingDate; + + public PickersViewModel() + { + Date = DateTime.Now; + Time = DateTime.Now; + } + + public DateTime Date + { + get => _date; + set => SetProperty(ref _date, value); + } + + public DateTime Time + { + get => _time; + set => SetProperty(ref _time, value); + } + + public string? ValidatingTime + { + get => _validatingTime; + set => SetProperty(ref _validatingTime, value); + } + + public DateTime? FutureValidatingDate + { + get => _futureValidatingDate; + set => SetProperty(ref _futureValidatingDate, value); + } + } +} diff --git a/DM_Weight/ViewModels/ReturnDrugDialogViewModel.cs b/DM_Weight/ViewModels/ReturnDrugDialogViewModel.cs index 5c7e013..d2f6e29 100644 --- a/DM_Weight/ViewModels/ReturnDrugDialogViewModel.cs +++ b/DM_Weight/ViewModels/ReturnDrugDialogViewModel.cs @@ -300,6 +300,7 @@ namespace DM_Weight.ViewModels if (accountBookG2Day != null) { accountBookG2Day.ManuStock = accountBookG2Day.ManuStock + ChannelStock.ReturnQuantity; + accountBookG2Day.AddQuantity = accountBookG2Day.AddQuantity + ChannelStock.ReturnQuantity; SqlSugarHelper.Db.Updateable(accountBookG2Day).ExecuteCommand(); } else @@ -318,7 +319,9 @@ namespace DM_Weight.ViewModels UserId2 = HomeWindowViewModel.Reviewer?.Id, MachineId = ConfigurationManager.AppSettings["machineId"].ToString(), CreateDate = DateTime.Now.ToString("yyyy-MM-dd"), - InvoiceNo = "日结存" + CreateTime = DateTime.Now, + InvoiceNo = "日结存", + AddQuantity=ChannelStock.ReturnQuantity }).ExecuteCommand(); if (iDayResult <= 0) { @@ -350,6 +353,7 @@ namespace DM_Weight.ViewModels UserId2 = HomeWindowViewModel.Reviewer?.Id, MachineId = ConfigurationManager.AppSettings["machineId"].ToString(), CreateDate = DateTime.Now.ToString("yyyy-MM-dd"), + CreateTime = DateTime.Now, InvoiceNo = "总结存" }).ExecuteCommand(); if (iTotalResult <= 0) diff --git a/DM_Weight/ViewModels/SelfAddDialogViewModel.cs b/DM_Weight/ViewModels/SelfAddDialogViewModel.cs index 713d7af..fbfb013 100644 --- a/DM_Weight/ViewModels/SelfAddDialogViewModel.cs +++ b/DM_Weight/ViewModels/SelfAddDialogViewModel.cs @@ -298,6 +298,7 @@ namespace DM_Weight.ViewModels if (accountBookG2Day != null) { accountBookG2Day.ManuStock = accountBookG2Day.ManuStock + it.AddQuantity; + accountBookG2Day.AddQuantity = accountBookG2Day.AddQuantity + it.AddQuantity; SqlSugarHelper.Db.Updateable(accountBookG2Day).ExecuteCommand(); } else @@ -316,7 +317,9 @@ namespace DM_Weight.ViewModels UserId2 = HomeWindowViewModel.Reviewer?.Id, MachineId = ConfigurationManager.AppSettings["machineId"].ToString(), CreateDate = DateTime.Now.ToString("yyyy-MM-dd"), - InvoiceNo = "日结存" + CreateTime = DateTime.Now, + InvoiceNo = "日结存", + AddQuantity=it.AddQuantity }).ExecuteCommand(); if (iDayResult <= 0) { @@ -349,6 +352,7 @@ namespace DM_Weight.ViewModels UserId2 = HomeWindowViewModel.Reviewer?.Id, MachineId = ConfigurationManager.AppSettings["machineId"].ToString(), CreateDate = DateTime.Now.ToString("yyyy-MM-dd"), + CreateTime = DateTime.Now, InvoiceNo = "总结存" }).ExecuteCommand(); if (iTotalResult <= 0) diff --git a/DM_Weight/ViewModels/SelfTakeDialogViewModel.cs b/DM_Weight/ViewModels/SelfTakeDialogViewModel.cs index 493dcf6..c13788a 100644 --- a/DM_Weight/ViewModels/SelfTakeDialogViewModel.cs +++ b/DM_Weight/ViewModels/SelfTakeDialogViewModel.cs @@ -276,6 +276,7 @@ namespace DM_Weight.ViewModels if (accountBookG2Day != null) { accountBookG2Day.ManuStock = accountBookG2Day.ManuStock - it.TakeQuantity; + accountBookG2Day.OutQuantity = accountBookG2Day.OutQuantity - it.TakeQuantity; SqlSugarHelper.Db.Updateable(accountBookG2Day).ExecuteCommand(); } else @@ -294,7 +295,9 @@ namespace DM_Weight.ViewModels UserId2 = HomeWindowViewModel.Reviewer?.Id, MachineId = ConfigurationManager.AppSettings["machineId"].ToString(), CreateDate = DateTime.Now.ToString("yyyy-MM-dd"), - InvoiceNo = "日结存" + CreateTime = DateTime.Now, + InvoiceNo = "日结存", + OutQuantity=it.TakeQuantity }).ExecuteCommand(); if (iDayResult <= 0) { @@ -326,6 +329,7 @@ namespace DM_Weight.ViewModels UserId2 = HomeWindowViewModel.Reviewer?.Id, MachineId = ConfigurationManager.AppSettings["machineId"].ToString(), CreateDate = DateTime.Now.ToString("yyyy-MM-dd"), + CreateTime = DateTime.Now, InvoiceNo = "总结存" }).ExecuteCommand(); if (iTotalResult <= 0) diff --git a/DM_Weight/ViewModels/UseAccountWindowViewModel.cs b/DM_Weight/ViewModels/UseAccountWindowViewModel.cs index 23ae54a..3b759a1 100644 --- a/DM_Weight/ViewModels/UseAccountWindowViewModel.cs +++ b/DM_Weight/ViewModels/UseAccountWindowViewModel.cs @@ -4,9 +4,11 @@ using DM_Weight.util; using Prism.Commands; using Prism.Mvvm; using Prism.Regions; +using Prism.Services.Dialogs; using System; using System.Collections.Generic; using System.Configuration; +using System.DirectoryServices.ActiveDirectory; using System.Drawing.Printing; using System.Linq; using System.Text; @@ -16,23 +18,16 @@ namespace DM_Weight.ViewModels { public class UseAccountWindowViewModel : BindableBase, INavigationAware { - private DateTime? _startDate = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day); + private DateTime? _startDate =DateTime.Now; - private DateTime? nowDate = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day); + private DateTime? nowDate = DateTime.Now; public DateTime? StartDate { get => _startDate; set - { - if (value != null) - { - SetProperty(ref _startDate, new DateTime(value?.Year ?? 0, value?.Month ?? 0, value?.Day ?? 0)); - } - else - { - SetProperty(ref _startDate, value); - } + { + SetProperty(ref _startDate, value); } } @@ -42,16 +37,8 @@ namespace DM_Weight.ViewModels { get => _endDate; set - { - if (value != null) - { - TimeSpan ershisi = new TimeSpan(23, 59, 59); - SetProperty(ref _endDate, new DateTime(value?.Year ?? 0, value?.Month ?? 0, value?.Day ?? 0, 23, 59, 59)); - } - else - { - SetProperty(ref _endDate, value); - } + { + SetProperty(ref _endDate, value); } } private string _name; @@ -94,7 +81,11 @@ namespace DM_Weight.ViewModels { return (long)(DateTime.UtcNow - Jan1st1970).TotalMilliseconds; } - + IDialogService _dialogService; + public UseAccountWindowViewModel(IDialogService dialogService) + { + _dialogService = dialogService; + } public void OnNavigatedTo(NavigationContext navigationContext) { //绑定用户信息 @@ -123,5 +114,35 @@ namespace DM_Weight.ViewModels } public bool KeepAlive => true; + + public DelegateCommand SelectTimeAction + { + get=> new DelegateCommand(async (s) => + { + // 此处延时1毫秒,等待页面渲染 + await Task.Delay(TimeSpan.FromMilliseconds(1)); + DialogParameters dialogParameters = new DialogParameters(); + dialogParameters.Add("DateTime", StartDate); + dialogParameters.Add("Type", s); + DialogServiceExtensions.ShowDialogHost(_dialogService, "DatetimeDialog", dialogParameters, DoDialogResult, "RootDialog"); + }); + } + private void DoDialogResult(IDialogResult dialogResult) + { + // 委托 被动执行 被子窗口执行 + // dialogResult 第一方面可以拿到任意参数 第二方面 可判断关闭状态 + if (dialogResult.Result == ButtonResult.OK) + { + if (dialogResult.Parameters.GetValue("Type").Equals("1")) + { + StartDate = dialogResult.Parameters.GetValue("DateTime"); + } + else + { + EndDate= dialogResult.Parameters.GetValue("DateTime"); + } + } + //MessageBox.Show("返回值:" + dialogResult.Result.ToString()); + } } } diff --git a/DM_Weight/Views/Dialog/DatetimeDialog.xaml b/DM_Weight/Views/Dialog/DatetimeDialog.xaml new file mode 100644 index 0000000..775816f --- /dev/null +++ b/DM_Weight/Views/Dialog/DatetimeDialog.xaml @@ -0,0 +1,36 @@ + + + + + + + + + + + + + + + + + diff --git a/DM_Weight/Views/Dialog/DatetimeDialog.xaml.cs b/DM_Weight/Views/Dialog/DatetimeDialog.xaml.cs new file mode 100644 index 0000000..4635027 --- /dev/null +++ b/DM_Weight/Views/Dialog/DatetimeDialog.xaml.cs @@ -0,0 +1,28 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Navigation; +using System.Windows.Shapes; + +namespace DM_Weight.Views.Dialog +{ + /// + /// DatetimeDialog.xaml 的交互逻辑 + /// + public partial class DatetimeDialog : UserControl + { + public DatetimeDialog() + { + InitializeComponent(); + } + } +} diff --git a/DM_Weight/Views/UseAccountWindow.xaml b/DM_Weight/Views/UseAccountWindow.xaml index 4676a92..03fa53a 100644 --- a/DM_Weight/Views/UseAccountWindow.xaml +++ b/DM_Weight/Views/UseAccountWindow.xaml @@ -8,18 +8,19 @@ mc:Ignorable="d" d:DesignHeight="450" d:DesignWidth="800"> - + + + + @@ -34,18 +35,89 @@ - - + + + + + + + + + + + + + + + + + IsEditable="True" IsTextSearchEnabled="False" Cursor=""/> - +