@page "/Box/BoxStockAAA" @using MasaBlazorApp3.Pojo.Config
@foreach (var cs in channelStockList) { }
@code { @inject IOrderInfoDao orderInfoDao; @inject IChannelListDao channelListDao; @inject DialogService dialogService; @inject Microsoft.Extensions.Options.IOptions setting; @inject NotificationService _message @inject IDrugInfoDao drugInfoDao; private IEnumerable? _forecasts; bool allowRowSelectOnRowClick = true; // IEnumerable drugManuNos; // IList selectedDrugManuNos; RadzenDataGrid grid; // RadzenDataGrid gridManuNo; bool isLoading; int count; int[] DrawerNos = new int[] { 1, 2, 3, 4, 5, 6, 7, 8 }; List channelStockList = new(); int status = 0; string drawerNo = "1-1"; string OrderNo; DateTime OrderDate; async Task SelectDrawer(string strDrawerNoColNo) { this.drawerNo = strDrawerNoColNo; BoxModel boxModel = new BoxModel(); boxModel.BoxName = 1; boxModel.BoxNo = 1; // grid.Reload(); if (drawerNo != null) { string[] strArr = drawerNo.Split('-'); boxModel.BoxName = Convert.ToInt32(strArr[0]); boxModel.BoxNo = Convert.ToInt32(strArr[1]); } var result = await drugInfoDao.GetAllDrugAndStockByBox(boxModel); _forecasts = result; } // void OnCurrentDateChanged(DateTime args) // { // OrderDate = new DateTime(args.Year, args.Month, args.Day); // } //重置 async Task reloadGrid() { OrderNo = ""; OrderDate = DateTime.MinValue; await grid.Reload(); } protected override async Task OnInitializedAsync() { await base.OnInitializedAsync(); isLoading = true; BoxModel boxModel = new BoxModel(); boxModel.BoxName = 1; boxModel.BoxNo = 1; isLoading = true; if (drawerNo != null) { string[] strArr = drawerNo.Split('-'); boxModel.BoxName = Convert.ToInt32(strArr[0]); boxModel.BoxNo = Convert.ToInt32(strArr[1]); } var result = await drugInfoDao.GetAllDrugAndStockByBox(boxModel);// await channelListDao.GetBoxDrugInfo(drawerNo, args.Top, args.Skip); // Update the Data property _forecasts = result; // Update the count //count = result.TotalDesserts; isLoading = false; channelStockList = await orderInfoDao.GetDrawerNum(setting.Value.boxMachineId); isLoading = false; } protected override async Task OnAfterRenderAsync(bool firstRender) { base.OnAfterRender(firstRender); if (firstRender) { await grid.ExpandRows(grid.PagedView.Where(di => di.Stocks.Count > 0)); } } void RowRender(RowRenderEventArgs args) { args.Expandable = args.Data.Stocks.Count > 0; } //确认 async Task Confirm() { // orderInfoDao.CheckOrderInfo(selectedOrderInfos, drawerNo); } async Task LoadData(LoadDataArgs args) { BoxModel boxModel = new BoxModel(); boxModel.BoxName = 1; boxModel.BoxNo = 1; isLoading = true; if (drawerNo != null) { string[] strArr = drawerNo.Split(','); boxModel.BoxName = Convert.ToInt32(strArr[0]); boxModel.BoxNo = Convert.ToInt32(strArr[1]); } var result = await drugInfoDao.GetAllDrugAndStockByBox(boxModel);// await channelListDao.GetBoxDrugInfo(drawerNo, args.Top, args.Skip); // Update the Data property _forecasts = result; // Update the count //count = result.TotalDesserts; isLoading = false; channelStockList = await orderInfoDao.GetDrawerNum(setting.Value.boxMachineId); } //替换按钮 async Task replaceClick(ChannelStock cs) { if (cs.Quantity > 0) { var b = await dialogService.OpenAsync( $"{cs.DrawerNo}号药盒替换药品详情", new Dictionary() { { "channelStock", cs } }, new DialogOptions() { Width = "85vw", Resizable = true, Draggable = true, ShowClose = false } ); if (b) { await reloadGrid(); } } else { //库存为0无法操作 _message.Notify( new NotificationMessage { Severity = NotificationSeverity.Error, Summary = "提示", Detail = $"库存为0无法替换", Duration = 4000 } ); } } //移除按钮 async Task removeClick(ChannelStock cs) { if (cs.Quantity > 0) { var b = await dialogService.OpenAsync( $"{cs.DrawerNo}号药盒替换药品详情", new Dictionary() { { "channelStock", cs } }, new DialogOptions() { Width = "85vw", Resizable = true, Draggable = true, ShowClose = false } ); if (b) { await reloadGrid(); } } else { //库存为0无法操作 _message.Notify( new NotificationMessage { Severity = NotificationSeverity.Error, Summary = "提示", Detail = $"库存为0,没有要移出的药品", Duration = 4000 } ); } } }