From eed6d5d0e96ebe955f62807e4f6c74a1ed60970b Mon Sep 17 00:00:00 2001 From: maqiao <625215135@qq.com> Date: Thu, 18 Jul 2024 09:46:01 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B4=A6=E5=86=8C=E6=B7=BB=E5=8A=A0=E7=B2=BE?= =?UTF-8?q?=E4=B8=80=E3=80=81=E7=B2=BE=E4=BA=8C=E8=8D=AF=E5=93=81=E7=B1=BB?= =?UTF-8?q?=E5=9E=8B=E6=9F=A5=E8=AF=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- DM_Weight/Models/DrugType.cs | 14 +++++++ .../ViewModels/AccountWindowViewModel.cs | 41 ++++++++++++++++--- DM_Weight/Views/AccountWindow.xaml | 10 ++++- 3 files changed, 58 insertions(+), 7 deletions(-) create mode 100644 DM_Weight/Models/DrugType.cs diff --git a/DM_Weight/Models/DrugType.cs b/DM_Weight/Models/DrugType.cs new file mode 100644 index 0000000..44eb58b --- /dev/null +++ b/DM_Weight/Models/DrugType.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace DM_Weight.Models +{ + public class DrugType + { + public int TypeValue { get; set; } + public string TypeName { get; set; } + } +} diff --git a/DM_Weight/ViewModels/AccountWindowViewModel.cs b/DM_Weight/ViewModels/AccountWindowViewModel.cs index bd1ba10..a2fb635 100644 --- a/DM_Weight/ViewModels/AccountWindowViewModel.cs +++ b/DM_Weight/ViewModels/AccountWindowViewModel.cs @@ -180,7 +180,32 @@ namespace DM_Weight.ViewModels RequestData(); } } + /// + /// 药品类型 + /// + private List _drugTypeList = new List() + { + new DrugType{ TypeValue=1,TypeName="精一"}, + new DrugType{TypeValue=2,TypeName="精二"} + }; + public List? DrugTypeList + { + get => _drugTypeList; + set + { + SetProperty(ref _drugTypeList, value); + } + } + private DrugType? _drugType; + public DrugType? _DrugType + { + get => _drugType; set + { + SetProperty(ref _drugType, value); + RequestData(); + } + } //MachineRecordService _machineRecordService; IEventAggregator _eventAggregator; ////private SqlSugarScope SqlSugarHelper.Db; @@ -194,7 +219,7 @@ namespace DM_Weight.ViewModels void RequestData() { int totalCount = 0; - AccountList = ReportAccountBook(StartDate, EndDate, AccountType == null ? 0 : AccountType.AccountTypeValue, DrugInfo == null ? "" : DrugInfo.DrugId.ToString() ?? ""); + AccountList = ReportAccountBook(StartDate, EndDate, AccountType == null ? 0 : AccountType.AccountTypeValue, _DrugType == null ? 0 : _DrugType.TypeValue, DrugInfo == null ? "" : DrugInfo.DrugId.ToString() ?? ""); //for (int i = 0; i < accountList.Count; i++) //{ // if (accountList[i].DrugInfo is null) @@ -293,7 +318,7 @@ namespace DM_Weight.ViewModels { } - private List ReportAccountBook(DateTime? startDate, DateTime? endDate, int type, string drug_id = "") + private List ReportAccountBook(DateTime? startDate, DateTime? endDate, int type,int drugType, string drug_id = "") { DateTime? p_startDate = startDate ?? Convert.ToDateTime("2010-1-1"); DateTime? p_endDate = endDate ?? DateTime.Now.AddDays(1); @@ -312,21 +337,25 @@ namespace DM_Weight.ViewModels { if (type == 1) { - SQL += " WHERE ac.add_quantity>0 "; + SQL += " AND ac.add_quantity>0 "; } if (type == 2) { - SQL += " WHERE ac.out_quantity>0 "; + SQL += " AND ac.out_quantity>0 "; } if (type == 3) { - SQL += " WHERE type=3 "; + SQL += " AND type=3 "; } if (type == 4) { - SQL += " WHERE type=4 "; + SQL += " AND type=4 "; } } + if (drugType > 0) + { + SQL += $" AND di.Drug_type={drugType}"; + } SQL += " ORDER BY ac.create_date desc,ac.drug_id"; diff --git a/DM_Weight/Views/AccountWindow.xaml b/DM_Weight/Views/AccountWindow.xaml index 54167ec..3c00696 100644 --- a/DM_Weight/Views/AccountWindow.xaml +++ b/DM_Weight/Views/AccountWindow.xaml @@ -63,13 +63,21 @@ SelectedItem="{Binding DrugInfo}" DisplayMemberPath="DrugName" />--> - --> +