@page "/Box/Check" @using MasaBlazorApp3.Pojo.Config @using MasaBlazorApp3.Report @using Radzen.Blazor.Rendering @*
@foreach (int i in DrawerNos) { }
*@ @*
@foreach (int i in DrawerNos) { }
*@
@* *@ @* *@
@* *@ @* *@ @* *@ @((context as DrugManuNo)?.ManuNo) @if ((context as DrugManuNo).EffDate != null && (context as DrugManuNo).EffDate.ToString().Length > 10) { @((context as DrugManuNo).EffDate.ToString().Substring(0, 10)) } else { @((context as DrugManuNo)?.EffDate) } @* *@
@code { @inject IOrderInfoDao orderInfoDao; @inject DialogService dialogService; @inject Microsoft.Extensions.Options.IOptions setting; @inject NotificationService _message; @inject IReportDataDao reportDataDao; bool allowRowSelectOnRowClick = true; IEnumerable orderInfos; IList selectedOrderInfos; RadzenDataGrid grid; //麻醉师集合 List NamesList = new List(); Anaesthetist Name; //麻醉师集合 List BoxList = new List(); BoxModel BoxNum; bool isLoading; int count; int[] DrawerNos = new int[] { 1, 2, 3, 4, 5, 6, 7, 8 }; int status = 0; string OrderNo; DateTime? OrderDate = null; DateTime PortOrderDate = DateTime.Now; Popup popup; RadzenButton button; void OnCurrentDateChanged(DateTime args) { OrderDate = new DateTime(args.Year, args.Month, args.Day); } void OnCurrentPortDateChanged(DateTime args) { PortOrderDate = new DateTime(args.Year, args.Month, args.Day); } //重置 async Task reloadGrid() { OrderNo = ""; OrderDate = DateTime.MinValue; await grid.Reload(); } void OnCellClick(DataGridCellMouseEventArgs args) { if (args.Data.DetailInfo.SetManuNo != null) { args.Data.DetailInfo.drugManuNo = args.Data.DetailInfo.Drug.Manus.Where(m => m.ManuNo == args.Data.DetailInfo.SetManuNo).FirstOrDefault(); } if (args.Data.DetailInfo.drugManuNo==null) { args.Data.DetailInfo.drugManuNo = args.Data.DetailInfo.Drug.Manus.FirstOrDefault(); } grid.EditRow(args.Data); } //确认 async Task Confirm() { if (selectedOrderInfos==null) { _message.Notify( new NotificationMessage { Severity = NotificationSeverity.Error, Summary = "提示", Detail = $"请选择处方", Duration = 4000 } ); return; } if (BoxNum==null) { _message.Notify( new NotificationMessage { Severity = NotificationSeverity.Error, Summary = "提示", Detail = $"请选择药箱", Duration = 4000 } ); return; } if (selectedOrderInfos.Any(it => it.DetailInfo.drugManuNo == null)) { _message.Notify( new NotificationMessage { Severity = NotificationSeverity.Error, Summary = "提示", Detail = $"请选择批次信息", Duration = 4000 } ); return; } bool bResult = await orderInfoDao.CheckOrderInfo(selectedOrderInfos, BoxNum); if (bResult) { _message.Notify( new NotificationMessage { Severity = NotificationSeverity.Success, Summary = "提示", Detail = $"处方已核对完成", Duration = 4000 } ); await GetInitialDate(); await grid.Reload(); } else { _message.Notify( new NotificationMessage { Severity = NotificationSeverity.Error, Summary = "提示", Detail = $"处方已核对失败", Duration = 4000 } ); } } PageData result; protected override async Task OnInitializedAsync() { await GetInitialDate(); await base.OnInitializedAsync(); } async Task GetInitialDate() { result = await orderInfoDao.GetAllOrderInfo(null, null, null, null, null); List nameList = result.Desserts.Select(it => it.anaesthetistName).Distinct().ToList(); NamesList = nameList.Select(it => new Anaesthetist { Name = it }).ToList(); Name = NamesList.FirstOrDefault(); } async Task LoadData(LoadDataArgs args) { if (result != null) { isLoading = true; orderInfos = result.Desserts; // Update the count count = result.TotalDesserts; // Update the Data property if (Name != null) { orderInfos = orderInfos.Where(it => it.anaesthetistName == Name.Name); count = orderInfos.Count(); } if(OrderDate != null && OrderDate != DateTime.MinValue) { orderInfos = orderInfos.Where(it => it.ChargeDate.Date == OrderDate.Value.Date); // Update the count count = orderInfos.Count(); } if(!string.IsNullOrEmpty(OrderNo)) { orderInfos = orderInfos.Where(it => it.OrderNo.Contains(OrderNo)); // Update the count count = orderInfos.Count(); } if (Name != null && OrderDate != null && OrderDate != DateTime.MinValue && !string.IsNullOrEmpty(OrderNo)) { orderInfos = orderInfos.Where(it => it.anaesthetistName == Name.Name && it.ChargeDate.Date == OrderDate.Value.Date && it.OrderNo.Contains(OrderNo)); // Update the count count = orderInfos.Count(); } orderInfos = orderInfos.Skip(args.Skip.Value).Take(args.Top.Value).ToList(); //查找该麻醉师对应的手术室 //List roomNameList = orderInfos.Select(it => it.RoomName).Distinct().ToList(); List roomNameList = orderInfos.Select(it => Convert.ToInt32(it.RoomName.Substring(6, it.RoomName.Length - 6))).Distinct().ToList(); BoxList = await orderInfoDao.GetDrawerNumByOperationNum(setting.Value.boxMachineId, roomNameList); //roomNameList.Select(it => new BoxModel { BoxName = it, BoxNo = Convert.ToInt32(it.Substring(it.Length - 2, 2)) }).ToList(); BoxNum = BoxList.FirstOrDefault(); isLoading = false; } } //麻醉药品使用登记本导出 async Task StockExport() { if (PortOrderDate == DateTime.MinValue) { _message.Notify( new NotificationMessage { Severity = NotificationSeverity.Error, Summary = "提示", Detail = $"请选择处方时间再导出", Duration = 4000 } ); return; } PageData pageData = await reportDataDao.GetOrderInfoData(PortOrderDate); GridReportUtil.PrintReport("Usage_Temp.grf", pageData); } // protected override async Task OnInitializedAsync() // { // await base.OnInitializedAsync(); // // orderInfos = dbContext.Employees; // var result = await orderInfoDao.GetAllOrderInfo(OrderNo, OrderDate, args.Top, args.Skip); // // Update the Data property // orderInfos = result.Desserts; // // Update the count // count = result.TotalDesserts; // isLoading = false; // } }