diff --git a/DM_Weight/Models/CollectDrug.cs b/DM_Weight/Models/CollectDrug.cs index 7954c88..021b417 100644 --- a/DM_Weight/Models/CollectDrug.cs +++ b/DM_Weight/Models/CollectDrug.cs @@ -114,5 +114,9 @@ namespace DM_Weight.Models /// [Navigate(NavigateType.ManyToOne, nameof(DrugPleaseClaimId))] public DrugPleaseClaim drugPleaseClaim { get; set; } + + + [SugarColumn(IsIgnore = true)] + public List ManuNoList { get; set; } } } diff --git a/DM_Weight/Models/DrugPleaseClaim.cs b/DM_Weight/Models/DrugPleaseClaim.cs index 22f42e7..8bd248a 100644 --- a/DM_Weight/Models/DrugPleaseClaim.cs +++ b/DM_Weight/Models/DrugPleaseClaim.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; +using Newtonsoft.Json; using SqlSugar; namespace DM_Weight.Models @@ -54,7 +55,8 @@ namespace DM_Weight.Models /// 批次(多条) /// [SugarColumn(ColumnName = "drug_manu_no")] - public string DrugManuNo { get; set; } + [JsonProperty("drug_manu_no")] + public string _DrugManuNos { get; set; } /// /// 备注1 diff --git a/DM_Weight/Models/OrderInfo.cs b/DM_Weight/Models/OrderInfo.cs index c073e2e..e7769f1 100644 --- a/DM_Weight/Models/OrderInfo.cs +++ b/DM_Weight/Models/OrderInfo.cs @@ -204,6 +204,8 @@ namespace DM_Weight.Models //[SugarColumn(ColumnName = "identity")] //public string Identity { get; set; } - + + [SugarColumn(ColumnName = "machine_id")] + public string MachineId { get; set; } } } \ No newline at end of file diff --git a/DM_Weight/ViewModels/ApplyInStockWindowViewModel.cs b/DM_Weight/ViewModels/ApplyInStockWindowViewModel.cs index 65e6475..a2d8969 100644 --- a/DM_Weight/ViewModels/ApplyInStockWindowViewModel.cs +++ b/DM_Weight/ViewModels/ApplyInStockWindowViewModel.cs @@ -330,7 +330,7 @@ namespace DM_Weight.ViewModels { if (SelectDrugPleaseClaim.GetQuantity == 1) { - if (SelectDrugPleaseClaim.DrugManuNo is null) + if (SelectDrugPleaseClaim._DrugManuNos is null) { AlertMsg alertMsg = new AlertMsg { @@ -341,7 +341,7 @@ namespace DM_Weight.ViewModels return; } //请领单里只有一种药 - List drugManuInfoList = JsonConvert.DeserializeObject>(SelectDrugPleaseClaim.DrugManuNo); + List drugManuInfoList = JsonConvert.DeserializeObject>(SelectDrugPleaseClaim._DrugManuNos); drugManuInfoList.ForEach(dm => dm.DrugId = SelectDrugPleaseClaim.DrugId); for (int i = 0; i < drugManuInfoList.Count; i++) { @@ -383,7 +383,7 @@ namespace DM_Weight.ViewModels { foreach (DrugPleaseClaim item in pleaseClaimList) { - List drugManuInfoList = JsonConvert.DeserializeObject>(item.DrugManuNo); + List drugManuInfoList = JsonConvert.DeserializeObject>(item._DrugManuNos); drugManuInfoList.ForEach(dm => dm.DrugId = item.DrugId); for (int i = 0; i < drugManuInfoList.Count; i++) { diff --git a/DM_Weight/ViewModels/ApplyListWindowViewModel.cs b/DM_Weight/ViewModels/ApplyListWindowViewModel.cs index 0469b63..369f0d6 100644 --- a/DM_Weight/ViewModels/ApplyListWindowViewModel.cs +++ b/DM_Weight/ViewModels/ApplyListWindowViewModel.cs @@ -1,6 +1,7 @@ using DM_Weight.Models; using DM_Weight.select; using DM_Weight.util; +using Newtonsoft.Json; using Prism.Commands; using Prism.Mvvm; using Prism.Regions; @@ -150,11 +151,27 @@ namespace DM_Weight.ViewModels .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,dp)=>dp.State==_DrugPleaseState.StateValue) - .GroupBy(cd=>cd.Applyid) + .GroupBy(cd=>cd.DrugPleaseClaimId) + .GroupBy(cd => cd.DrugId) .OrderByDescending(cd => cd.Createdate) .OrderByDescending(cd => cd.DrugId) .ToList(); + if (CollectDrugLst != null && CollectDrugLst.Count > 0) + { + for (int i = 0; i < CollectDrugLst.Count; i++) + { + CollectDrugLst[i].ManuNoList = new List(); + DrugPleaseClaim drugManuNoStr = SqlSugarHelper.Db.Queryable().Where(dp => dp.PleaseNo == CollectDrugLst[i].DrugPleaseClaimId && dp.DrugId == CollectDrugLst[i].DrugId).First(); + + CollectDrugLst[i].Quantity = drugManuNoStr.GetQuantity; + if (!string.IsNullOrEmpty(drugManuNoStr._DrugManuNos)) + { + CollectDrugLst[i].ManuNoList = JsonConvert.DeserializeObject>(drugManuNoStr._DrugManuNos); + + } + } + } } /// /// 刷新 diff --git a/DM_Weight/ViewModels/CollectDrugDialogViewModel.cs b/DM_Weight/ViewModels/CollectDrugDialogViewModel.cs index f2b6ea8..09b8688 100644 --- a/DM_Weight/ViewModels/CollectDrugDialogViewModel.cs +++ b/DM_Weight/ViewModels/CollectDrugDialogViewModel.cs @@ -175,7 +175,8 @@ namespace DM_Weight.ViewModels SqlSugarHelper.Db.Updateable(new OrderInfo() { ApplyStatus = 1, - OrderNo = collectDrug.OrderNo + OrderNo = collectDrug.OrderNo, + MachineId = ConfigurationManager.AppSettings["machineId"].ToString() }).UpdateColumns(it => new { it.ApplyStatus }).Where(it => it.OrderNo == collectDrug.OrderNo).ExecuteCommand(); //保存处方、请领申请中间表 diff --git a/DM_Weight/Views/ApplyInStockWindow.xaml b/DM_Weight/Views/ApplyInStockWindow.xaml index cede7ab..0295020 100644 --- a/DM_Weight/Views/ApplyInStockWindow.xaml +++ b/DM_Weight/Views/ApplyInStockWindow.xaml @@ -190,9 +190,9 @@ - + + --> + --> - + + + + + + - - - diff --git a/DM_Weight/Views/ApplyListWindow.xaml b/DM_Weight/Views/ApplyListWindow.xaml index c3687f2..41e95e2 100644 --- a/DM_Weight/Views/ApplyListWindow.xaml +++ b/DM_Weight/Views/ApplyListWindow.xaml @@ -145,11 +145,11 @@ - + ElementStyle="{StaticResource MaterialDesignDataGridTextColumnStyle}"/>--> --> + + + + + + + + + + + + + + + + + + + + + +