From 7027494352b6b0ac941f0a03e70f44d70f91bb71 Mon Sep 17 00:00:00 2001 From: maqiao <625215135@qq.com> Date: Tue, 19 Nov 2024 11:16:43 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8A=BD=E5=B1=89=E5=8A=A0=E8=8D=AF=E3=80=81?= =?UTF-8?q?=E6=8A=BD=E5=B1=89=E5=8F=96=E8=8D=AF=E9=A1=B5=E9=9D=A2=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0=E5=BC=80=E8=8D=AF=E7=9B=92=E6=8C=89=E9=92=AE=E5=8F=8A?= =?UTF-8?q?=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- DM_Weight/Converter/OpenBoxConverter.cs | 32 +++++++++++++++++++ .../DrawerAddDrugWindowViewModel.cs | 14 +++++++- .../DrawerTakeDrugWindowViewModel.cs | 14 ++++++-- .../OrderTakeDrugWindowViewModel.cs | 4 +-- DM_Weight/Views/DrawerAddDrugWindow.xaml | 13 ++++++-- DM_Weight/Views/DrawerTakeDrugWindow.xaml | 12 ++++++- 6 files changed, 81 insertions(+), 8 deletions(-) create mode 100644 DM_Weight/Converter/OpenBoxConverter.cs diff --git a/DM_Weight/Converter/OpenBoxConverter.cs b/DM_Weight/Converter/OpenBoxConverter.cs new file mode 100644 index 0000000..a2793df --- /dev/null +++ b/DM_Weight/Converter/OpenBoxConverter.cs @@ -0,0 +1,32 @@ +using System; +using System.Collections.Generic; +using System.Globalization; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Data; +using System.Windows; + +namespace DM_Weight.Converter +{ + internal class OpenBoxConverter : IValueConverter + { + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + bool status = bool.Parse(value.ToString()); + if (status) + { + return Visibility.Visible; + } + else + { + return Visibility.Collapsed; + } + } + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + throw new NotImplementedException(); + } + } +} diff --git a/DM_Weight/ViewModels/DrawerAddDrugWindowViewModel.cs b/DM_Weight/ViewModels/DrawerAddDrugWindowViewModel.cs index 10c9a52..3f1534d 100644 --- a/DM_Weight/ViewModels/DrawerAddDrugWindowViewModel.cs +++ b/DM_Weight/ViewModels/DrawerAddDrugWindowViewModel.cs @@ -33,6 +33,13 @@ namespace DM_Weight.ViewModels set => SetProperty(ref _channelStocks, value); } + private bool _openBoxVisibility = false; + public bool OpenBoxVisibility + { + get => _openBoxVisibility; + set => SetProperty(ref _openBoxVisibility, value); + } + private static readonly DateTime Jan1st1970 = new DateTime (1970, 1, 1, 0, 0, 0, DateTimeKind.Utc); @@ -137,7 +144,7 @@ namespace DM_Weight.ViewModels _portUtil.WindowName = "DrawerAddDrugWindow"; _portUtil.Operate = true; _portUtil.BoardType = singleChannels.Count > 0 ? singleChannels[0].BoardType : 1; - _portUtil.ColNos = singleChannels.Select(it => it.ColNo).ToArray(); + _portUtil.ColNos = singleChannels.Where(it => it.AddQuantity > 0).Select(it => it.ColNo).ToArray(); //singleChannels.Select(it => it.ColNo).ToArray(); _portUtil.DrawerNo = DrawerNo; _portUtil.Start(); @@ -441,6 +448,11 @@ namespace DM_Weight.ViewModels .Where(cs => cs.DrugId != null) .OrderBy(cs => cs.ColNo) .ToList(); + + if (queryData != null && queryData.Count > 0) + { + OpenBoxVisibility = queryData[0].BoardType == 3 ? true : queryData[0].BoardType == 35 ? true : false; + } ChannelStocks = queryData.Select(cs => { cs.drugManuNo = cs.DrugInfo.DrugManuNos.Find(it => it.ManuNo.Equals(cs.ManuNo)); diff --git a/DM_Weight/ViewModels/DrawerTakeDrugWindowViewModel.cs b/DM_Weight/ViewModels/DrawerTakeDrugWindowViewModel.cs index 3ed710b..57f95e5 100644 --- a/DM_Weight/ViewModels/DrawerTakeDrugWindowViewModel.cs +++ b/DM_Weight/ViewModels/DrawerTakeDrugWindowViewModel.cs @@ -35,7 +35,12 @@ namespace DM_Weight.ViewModels get => _channelStocks; set => SetProperty(ref _channelStocks, value); } - + private bool _openBoxVisibility = false; + public bool OpenBoxVisibility + { + get => _openBoxVisibility; + set => SetProperty(ref _openBoxVisibility, value); + } private static readonly DateTime Jan1st1970 = new DateTime (1970, 1, 1, 0, 0, 0, DateTimeKind.Utc); @@ -145,7 +150,7 @@ namespace DM_Weight.ViewModels _portUtil.WindowName = "DrawerTakeDrugWindow"; _portUtil.BoardType = singleChannels.Count > 0 ? singleChannels[0].BoardType : 1; - _portUtil.ColNos = singleChannels.Select(it => it.ColNo).ToArray(); + _portUtil.ColNos = singleChannels.Where(it=>it.TakeQuantity>0).Select(it => it.ColNo).ToArray(); _portUtil.DrawerNo = DrawerNo; Dispatcher.CurrentDispatcher.BeginInvoke(DispatcherPriority.Normal, () => _portUtil.Start()) ; @@ -446,6 +451,11 @@ namespace DM_Weight.ViewModels .Where(cs => cs.Quantity > 0) .OrderBy(cs => cs.ColNo) .ToList(); + + if (queryData != null && queryData.Count > 0) + { + OpenBoxVisibility = queryData[0].BoardType == 3 ? true : queryData[0].BoardType == 35 ? true : false; + } ChannelStocks = queryData; } diff --git a/DM_Weight/ViewModels/OrderTakeDrugWindowViewModel.cs b/DM_Weight/ViewModels/OrderTakeDrugWindowViewModel.cs index 9ae0bf3..8d9083d 100644 --- a/DM_Weight/ViewModels/OrderTakeDrugWindowViewModel.cs +++ b/DM_Weight/ViewModels/OrderTakeDrugWindowViewModel.cs @@ -225,7 +225,7 @@ namespace DM_Weight.ViewModels List queryData = SqlSugarHelper.Db.Queryable() .InnerJoin((oi, od) => oi.OrderNo == od.OrderNo) .InnerJoin(SqlSugarHelper.Db.Queryable().Where(cs => cs.DrawerType == 1).Where(cs => cs.MachineId.Equals(ConfigurationManager.AppSettings["machineId"] ?? "DM1")).GroupBy(cs => cs.DrugId), (oi, od, t) => od.DrugId == t.DrugId) - .WhereIF(OrderDate != null, oi => oi.OrderDate.ToString("yyyy-MM-dd") == OrderDate) + .WhereIF(OrderDate != null, oi => oi.ChargeDate.ToString("yyyy-MM-dd") == OrderDate) .WhereIF(!String.IsNullOrEmpty(SearchValue) && SelectedItem.Code.Equals("OrderNo"), oi => oi.OrderNo == SearchValue) .WhereIF(!String.IsNullOrEmpty(SearchValue) && SelectedItem.Code.Equals("PatientId"), oi => oi.PatientId == SearchValue) .WhereIF(!String.IsNullOrEmpty(ConfigurationManager.AppSettings["storage"]), oi => oi.Pharmacy == ConfigurationManager.AppSettings["storage"]) @@ -233,7 +233,7 @@ namespace DM_Weight.ViewModels .Where(oi => oi.HisDispFlag == 0) .Where(oi => oi.CancelFlag == 0) .Where(oi=>oi.Pharmacy.Equals(ConfigurationManager.AppSettings["storage"] ?? "")) - .GroupBy(oi => oi.OrderDate) + .GroupBy(oi => oi.ChargeDate) .Select(oi => oi) .ToPageList(PageNum, PageSize, ref totalCount); //.ToList(); diff --git a/DM_Weight/Views/DrawerAddDrugWindow.xaml b/DM_Weight/Views/DrawerAddDrugWindow.xaml index 410fee2..c92e947 100644 --- a/DM_Weight/Views/DrawerAddDrugWindow.xaml +++ b/DM_Weight/Views/DrawerAddDrugWindow.xaml @@ -12,8 +12,10 @@ + + @@ -21,7 +23,7 @@ - + @@ -294,7 +296,14 @@ - + + + +