报表日期查询添加时间
This commit is contained in:
parent
381381d65e
commit
bb0710b8bb
|
@ -316,6 +316,10 @@ namespace DM_Weight
|
|||
//紧急开锁页面
|
||||
containerRegistry.RegisterForNavigation<EmergencyWindow, EmergencyWindowViewModel>();
|
||||
|
||||
//日期加时间页面
|
||||
containerRegistry.RegisterDialog<DatetimeDialog>();
|
||||
containerRegistry.RegisterForNavigation<DatetimeDialog, DatetimeDialogViewModel>();
|
||||
|
||||
logger.Info("结束APP-RegisterTypes");
|
||||
|
||||
}
|
||||
|
|
|
@ -7,6 +7,7 @@ using Prism.Commands;
|
|||
using Prism.Events;
|
||||
using Prism.Mvvm;
|
||||
using Prism.Regions;
|
||||
using Prism.Services.Dialogs;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
@ -19,23 +20,14 @@ namespace DM_Weight.ViewModels
|
|||
{
|
||||
private readonly ILog logger = LogManager.GetLogger(typeof(AccountWindowViewModel));
|
||||
public static AccountWindowViewModel vm;
|
||||
private DateTime? _startDate = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day);
|
||||
|
||||
private DateTime? nowDate = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day);
|
||||
private DateTime? _startDate = 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);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -46,22 +38,16 @@ 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);
|
||||
}
|
||||
}
|
||||
IEventAggregator _eventAggregator;
|
||||
public AccountWindowViewModel(IEventAggregator eventAggregator)
|
||||
IDialogService _dialogService;
|
||||
public AccountWindowViewModel(IEventAggregator eventAggregator, IDialogService dialogService)
|
||||
{
|
||||
_eventAggregator = eventAggregator;
|
||||
vm = this;
|
||||
_dialogService = dialogService;
|
||||
}
|
||||
/// <summary>
|
||||
/// 导出账册
|
||||
|
@ -157,5 +143,34 @@ namespace DM_Weight.ViewModels
|
|||
}
|
||||
DrugInfos = SqlSugarHelper.Db.SqlQueryable<DrugInfo>(str).Where(di => di.DrugName.Contains(text) || di.PyCode.Contains(text)).OrderBy(di => di.DrugName).OrderBy(di => di.DrugId).ToList();
|
||||
}
|
||||
public DelegateCommand<string> SelectTimeAction
|
||||
{
|
||||
get => new DelegateCommand<string>(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<string?>("Type").Equals("1"))
|
||||
{
|
||||
StartDate = dialogResult.Parameters.GetValue<DateTime?>("DateTime");
|
||||
}
|
||||
else
|
||||
{
|
||||
EndDate = dialogResult.Parameters.GetValue<DateTime?>("DateTime");
|
||||
}
|
||||
}
|
||||
//MessageBox.Show("返回值:" + dialogResult.Result.ToString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -305,14 +305,6 @@ namespace DM_Weight.ViewModels
|
|||
// MachineId=jiaojie_it.MachineId,
|
||||
//}).UpdateColumns(jiaojie_it => new { jiaojie_it.Quantity }).WhereColumns(jiaojie_it=>new { jiaojie_it.DrugId, jiaojie_it.DrawerNo, jiaojie_it.MachineId }).ExecuteCommand();
|
||||
//}
|
||||
selectedStock.ForEach(cs =>
|
||||
{
|
||||
cs.Quantity = cs.Quantity + cs.AddToJJNum;
|
||||
//cs.NeedNum = 0;
|
||||
cs.AddToJJNum = 0;
|
||||
//cs.State = 0;
|
||||
});
|
||||
SqlSugarHelper.Db.Updateable(selectedStock).ExecuteCommand();
|
||||
// 更新交接柜状态为 已取药未入库
|
||||
//SqlSugarHelper.Db.Updateable(new ChannelList()
|
||||
//{
|
||||
|
@ -339,11 +331,19 @@ namespace DM_Weight.ViewModels
|
|||
OperationTime = DateTime.Now,
|
||||
Quantity = selectedStock[i].Quantity,
|
||||
Type = 2,
|
||||
InvoiceId = InvoiceId
|
||||
InvoiceId =$"交接柜药品入库{selectedStock[i].DrugId}-{selectedStock[i].AddToJJNum}"
|
||||
//,StockQuantity = nowChannels.Sum(it => it.Quantity),
|
||||
//CheckQuantity = it.CheckQuantity
|
||||
}).ExecuteCommand();
|
||||
}
|
||||
selectedStock.ForEach(cs =>
|
||||
{
|
||||
cs.Quantity = cs.Quantity + cs.AddToJJNum;
|
||||
//cs.NeedNum = 0;
|
||||
cs.AddToJJNum = 0;
|
||||
cs.State = 0;
|
||||
});
|
||||
SqlSugarHelper.Db.Updateable(selectedStock).ExecuteCommand();
|
||||
//List<ChannelStock> jiaojie = selectedStock.GroupBy(cs => cs.DrugId).Select(cs => cs.FirstOrDefault()).ToList();
|
||||
//if (jiaojie != null && jiaojie.Count > 0)
|
||||
//{
|
||||
|
|
|
@ -614,6 +614,7 @@ namespace DM_Weight.ViewModels
|
|||
if (accountBookG2Day != null)
|
||||
{
|
||||
accountBookG2Day.ManuStock = accountBookG2Day.ManuStock - oi._OrderDetail.Quantity;
|
||||
accountBookG2Day.OutQuantity= accountBookG2Day.OutQuantity + oi._OrderDetail.Quantity;
|
||||
SqlSugarHelper.Db.Updateable(accountBookG2Day).ExecuteCommand();
|
||||
}
|
||||
else
|
||||
|
@ -633,7 +634,8 @@ namespace DM_Weight.ViewModels
|
|||
MachineId = ConfigurationManager.AppSettings["dm_machineId"].ToString(),
|
||||
CreateDate = DateTime.Now.ToString("yyyy-MM-dd"),
|
||||
CreateTime=DateTime.Now,
|
||||
InvoiceNo = "日结存"
|
||||
InvoiceNo = "日结存",
|
||||
OutQuantity = oi._OrderDetail.Quantity,
|
||||
}).ExecuteCommand();
|
||||
if (iDayResult <= 0)
|
||||
{
|
||||
|
|
|
@ -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<IDialogResult> 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>("DateTime");
|
||||
|
||||
typeS = parameters.GetValue<string>("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);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
|
@ -11,6 +11,22 @@
|
|||
xmlns:convert="clr-namespace:DM_Weight.Converter"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="450" d:DesignWidth="800" Loaded="UserControl_Loaded">
|
||||
<UserControl.Resources>
|
||||
<Style TargetType="{x:Type TextBox}" BasedOn="{StaticResource MaterialDesignTextBox}">
|
||||
<Setter Property="Margin" Value="0,8" />
|
||||
<Setter Property="VerticalAlignment" Value="Center" />
|
||||
</Style>
|
||||
|
||||
<Style x:Key="FieldIcon" TargetType="materialDesign:PackIcon">
|
||||
<Setter Property="DockPanel.Dock" Value="Right" />
|
||||
<Setter Property="VerticalAlignment" Value="Center" />
|
||||
</Style>
|
||||
|
||||
<Style x:Key="FieldDockPanel" TargetType="DockPanel">
|
||||
<Setter Property="Margin" Value="0,0,8,16" />
|
||||
<Setter Property="VerticalAlignment" Value="Bottom" />
|
||||
</Style>
|
||||
</UserControl.Resources>
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
|
@ -19,12 +35,10 @@
|
|||
</Grid.RowDefinitions>
|
||||
<Grid Margin="0 6 0 6" Grid.Row="0">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="8*" />
|
||||
<ColumnDefinition Width="2*" />
|
||||
<ColumnDefinition Width="2*" />
|
||||
<ColumnDefinition Width="2*" />
|
||||
<ColumnDefinition Width="5*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<DatePicker
|
||||
<!--<DatePicker
|
||||
Grid.Column="0"
|
||||
SelectedDate="{Binding StartDate, TargetNullValue=''}"
|
||||
Margin="6 0 0 0"
|
||||
|
@ -37,18 +51,41 @@
|
|||
Margin="6 0 0 0"
|
||||
materialDesign:HintAssist.Hint="结束时间"
|
||||
Style="{StaticResource MaterialDesignOutlinedDatePicker}"
|
||||
/>
|
||||
<ComboBox
|
||||
Margin="6 0 6 0"
|
||||
Grid.Column="2"
|
||||
/>-->
|
||||
<StackPanel Grid.Row="0" Orientation="Horizontal" HorizontalAlignment="Left">
|
||||
<DockPanel Grid.Column="0" Style="{StaticResource FieldDockPanel}">
|
||||
<TextBox Style="{StaticResource MaterialDesignOutlinedTextBox}" x:Name="startDataBox" materialDesign:HintAssist.Hint="开始时间"
|
||||
Text="{Binding StartDate,StringFormat='yyyy-MM-dd HH:mm:ss'}" Margin="6 0 0 0" >
|
||||
|
||||
</TextBox>
|
||||
<Button
|
||||
Style="{StaticResource MaterialDesignIconForegroundButton}" Command="{Binding SelectTimeAction}" CommandParameter="1" >
|
||||
<materialDesign:PackIcon Width="40" Height="40" Kind="CalendarRange" Style="{StaticResource FieldIcon}" Foreground="{Binding ElementName=startDataBox, Path=BorderBrush}"/>
|
||||
</Button>
|
||||
|
||||
</DockPanel>
|
||||
<DockPanel Grid.Column="1" Style="{StaticResource FieldDockPanel}">
|
||||
<TextBox Style="{StaticResource MaterialDesignOutlinedTextBox}" x:Name="endDataBox" materialDesign:HintAssist.Hint="结束时间"
|
||||
Text="{Binding EndDate,StringFormat='yyyy-MM-dd HH:mm:ss'}" Margin="6 0 0 0" >
|
||||
|
||||
</TextBox>
|
||||
<Button
|
||||
Style="{StaticResource MaterialDesignIconForegroundButton}" Command="{Binding SelectTimeAction}" CommandParameter="2" >
|
||||
<materialDesign:PackIcon Width="40" Height="40" Kind="CalendarRange" Style="{StaticResource FieldIcon}" Foreground="{Binding ElementName=endDataBox, Path=BorderBrush}"/>
|
||||
</Button>
|
||||
|
||||
</DockPanel>
|
||||
<ComboBox
|
||||
Margin="6 0 6 0"
|
||||
materialDesign:HintAssist.Hint="药品名称/拼音码/药品编码"
|
||||
ItemsSource="{Binding DrugInfos}"
|
||||
SelectedItem="{Binding DrugInfo}"
|
||||
DisplayMemberPath="DrugName" IsEditable="True" IsTextSearchEnabled="False" KeyUp="ComboBox_KeyUp"
|
||||
/>
|
||||
<StackPanel Grid.Column="4" Orientation="Horizontal" HorizontalAlignment="Right">
|
||||
</StackPanel>
|
||||
<StackPanel Grid.Column="1" Orientation="Horizontal" HorizontalAlignment="Right">
|
||||
<Button
|
||||
Margin="0 0 3 0"
|
||||
Margin="0 0 13 0"
|
||||
VerticalAlignment="Center"
|
||||
Style="{StaticResource MaterialDesignOutlinedLightButton}"
|
||||
ToolTip="导出" Command="{Binding DownloadAccountBook}">
|
||||
|
|
|
@ -0,0 +1,36 @@
|
|||
<UserControl x:Class="DM_Weight.Views.Dialog.DatetimeDialog"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:local="clr-namespace:DM_Weight.Views.Dialog"
|
||||
xmlns:system="clr-namespace:System;assembly=mscorlib"
|
||||
xmlns:prism="http://prismlibrary.com/"
|
||||
prism:ViewModelLocator.AutoWireViewModel="True"
|
||||
xmlns:convert="clr-namespace:DM_Weight.Converter"
|
||||
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="450" d:DesignWidth="800">
|
||||
<Grid>
|
||||
<Grid Margin="-1">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="*" />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
<StackPanel Grid.Row="0" Orientation="Horizontal">
|
||||
<Calendar x:Name="CombinedCalendar" SelectedDate="{Binding Date}" Margin="-1 -4 -1 0" />
|
||||
<materialDesign:Clock Time="{Binding Time}" x:Name="CombinedClock" DisplayAutomation="CycleWithSeconds" Is24Hours="True" />
|
||||
</StackPanel>
|
||||
<StackPanel Grid.Row="1" Margin="8" HorizontalAlignment="Right" Orientation="Horizontal">
|
||||
<Button Style="{StaticResource MaterialDesignFlatButton}" Command="{Binding CloseAction}" CommandParameter="1" Content="确认" Cursor="" />
|
||||
<Button Style="{StaticResource MaterialDesignFlatButton}" Command="{x:Static materialDesign:DialogHost.CloseDialogCommand}" Content="取消">
|
||||
<Button.CommandParameter>
|
||||
<system:Boolean xmlns:system="clr-namespace:System;assembly=mscorlib">
|
||||
False
|
||||
</system:Boolean>
|
||||
</Button.CommandParameter>
|
||||
</Button>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</Grid>
|
||||
</UserControl>
|
|
@ -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
|
||||
{
|
||||
/// <summary>
|
||||
/// DatetimeDialog.xaml 的交互逻辑
|
||||
/// </summary>
|
||||
public partial class DatetimeDialog : UserControl
|
||||
{
|
||||
public DatetimeDialog()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue