From c93ecbfb515a1289a2f9a32bf8f72d4e57891c3f Mon Sep 17 00:00:00 2001 From: maqiao <625215135@qq.com> Date: Tue, 2 Jul 2024 11:28:13 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=AF=B7=E9=A2=86=E5=88=97?= =?UTF-8?q?=E8=A1=A8=E7=8A=B6=E6=80=81=E6=9F=A5=E8=AF=A2=E6=9D=A1=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ViewModels/ApplyInStockWindowViewModel.cs | 33 ++++++++++++++++--- .../ViewModels/ApplyListWindowViewModel.cs | 3 +- DM_Weight/Views/ApplyListWindow.xaml | 1 + .../Views/Dialog/DestoryEmptyDialog.xaml | 5 --- 4 files changed, 31 insertions(+), 11 deletions(-) diff --git a/DM_Weight/ViewModels/ApplyInStockWindowViewModel.cs b/DM_Weight/ViewModels/ApplyInStockWindowViewModel.cs index daa735d..4056fa1 100644 --- a/DM_Weight/ViewModels/ApplyInStockWindowViewModel.cs +++ b/DM_Weight/ViewModels/ApplyInStockWindowViewModel.cs @@ -334,6 +334,16 @@ namespace DM_Weight.ViewModels { if (SelectDrugPleaseClaim.GetQuantity == 1) { + if (SelectDrugPleaseClaim.DrugManuNo is null) + { + AlertMsg alertMsg = new AlertMsg + { + Message = "药品没有批次效期信息!", + Type = MsgType.ERROR, + }; + _eventAggregator.GetEvent().Publish(alertMsg); + return; + } //请领单里只有一种药 List drugManuInfoList = JsonConvert.DeserializeObject>(SelectDrugPleaseClaim.DrugManuNo); drugManuInfoList.ForEach(dm => dm.DrugId = SelectDrugPleaseClaim.DrugId); @@ -353,7 +363,20 @@ namespace DM_Weight.ViewModels .OrderBy(cs => cs.DrawerNo) .OrderBy(cs => cs.ColNo) .First(); - q.AddQuantity = drugPleaseManuNo.Quantity; + if (q != null) + { + q.AddQuantity = drugPleaseManuNo.Quantity; + } + else + { + AlertMsg alertMsg = new AlertMsg + { + Message = "药品没有绑定库位信息!", + Type = MsgType.ERROR, + }; + _eventAggregator.GetEvent().Publish(alertMsg); + return; + } csList.Add(q); } @@ -389,7 +412,7 @@ namespace DM_Weight.ViewModels if (q != null) { q[0].AddQuantity = drugPleaseManuNo.Quantity; - q.ForEach(csq=>csq.PleaseClaim = item); + q.ForEach(csq => csq.PleaseClaim = item); csList.AddRange(q); } @@ -621,13 +644,13 @@ namespace DM_Weight.ViewModels //ReceiveDept = SelectedInvoice.PharmacyName2 ?? ConfigurationManager.AppSettings["receiveDept"].ToString() }).ExecuteCommand(); - int iIndex= Array.IndexOf(ConfigurationManager.AppSettings["colloctedId"].Split(','), SelectDrugPleaseClaim.MachineId.ToString()); - string dept = ConfigurationManager.AppSettings["colloctedId"].Split(',')[iIndex-1].ToString(); + int iIndex = Array.IndexOf(ConfigurationManager.AppSettings["colloctedId"].Split(','), SelectDrugPleaseClaim.MachineId.ToString()); + string dept = ConfigurationManager.AppSettings["colloctedId"].Split(',')[iIndex - 1].ToString(); //保存账册 int iInsertResult = SqlSugarHelper.Db.Insertable(new AccountBookG2() { - + DrugId = Convert.ToInt32(it.DrugId), Type = 1, Department = dept, diff --git a/DM_Weight/ViewModels/ApplyListWindowViewModel.cs b/DM_Weight/ViewModels/ApplyListWindowViewModel.cs index a068c52..8bb71d3 100644 --- a/DM_Weight/ViewModels/ApplyListWindowViewModel.cs +++ b/DM_Weight/ViewModels/ApplyListWindowViewModel.cs @@ -143,12 +143,13 @@ namespace DM_Weight.ViewModels CollectDrugLst = SqlSugarHelper.Db.Queryable() .Includes(cd => cd.drugPleaseClaim) .Includes(cd => cd.drugInfo) + .InnerJoin((cd, dp) => cd.DrugPleaseClaimId == dp.PleaseNo) .Where(cd => cd.MachineId.Equals(ConfigurationManager.AppSettings["machineId"] ?? "DM3")) .WhereIF(!String.IsNullOrEmpty(SearchValue) && SelectedItem.Code.Equals("DrugId"), (cd) => cd.drugInfo.DrugId.ToString() == SearchValue) .WhereIF(!String.IsNullOrEmpty(SearchValue) && SelectedItem.Code.Equals("DrugName"), (cd) => cd.drugInfo.DrugName.Contains(SearchValue)) .WhereIF(!String.IsNullOrEmpty(SearchValue) && SelectedItem.Code.Equals("PyCode"), (cd) => cd.drugInfo.PyCode.Contains(SearchValue)) .WhereIF(!String.IsNullOrEmpty(SearchValue) && SelectedItem.Code.Equals("DrugBarcode"), (cd) => cd.drugInfo.DrugBarcode.Contains(SearchValue)) - .WhereIF((_DrugPleaseState!=null&& _DrugPleaseState.StateValue>=0),(cd)=>cd.Status==_DrugPleaseState.StateValue) + .WhereIF((_DrugPleaseState != null && _DrugPleaseState.StateValue >= 0), (cd, dp) => dp.State == _DrugPleaseState.StateValue) .OrderByDescending(cd => cd.Createdate) .OrderByDescending(cd => cd.DrugId) .ToList(); diff --git a/DM_Weight/Views/ApplyListWindow.xaml b/DM_Weight/Views/ApplyListWindow.xaml index 8243d31..1b98f65 100644 --- a/DM_Weight/Views/ApplyListWindow.xaml +++ b/DM_Weight/Views/ApplyListWindow.xaml @@ -123,6 +123,7 @@ + diff --git a/DM_Weight/Views/Dialog/DestoryEmptyDialog.xaml b/DM_Weight/Views/Dialog/DestoryEmptyDialog.xaml index 733adbe..e1e8b2d 100644 --- a/DM_Weight/Views/Dialog/DestoryEmptyDialog.xaml +++ b/DM_Weight/Views/Dialog/DestoryEmptyDialog.xaml @@ -43,7 +43,6 @@ Foreground="{DynamicResource PrimaryHueDarkForegroundBrush}" HorizontalAlignment="Right" Command="{Binding BtnCloseCommand}" - IsEnabled="{Binding Status, Converter={StaticResource StatusConverter}, ConverterParameter=CloseBtn}" ToolTip="关闭" > @@ -179,15 +178,11 @@