139 lines
		
	
	
		
			7.1 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
		
		
			
		
	
	
			139 lines
		
	
	
		
			7.1 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
| 
								 | 
							
								@page "/Box/Check"
							 | 
						||
| 
								 | 
							
								@using MasaBlazorApp3.Pojo.Config
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								<RadzenStack Orientation="Orientation.Horizontal" class="col-12 mb-4">
							 | 
						||
| 
								 | 
							
								    <div class="col-12 row justify-content-center align-items-center text-center" style="background: url('/images/box-16.jpg')  no-repeat; background-size: 100% 100%; width: 380px; height:650px">
							 | 
						||
| 
								 | 
							
								        <div class="row justify-content-around align-items-center" style="margin-top: 220px; height: 430px;">
							 | 
						||
| 
								 | 
							
								            @foreach (int i in DrawerNos)
							 | 
						||
| 
								 | 
							
								            {
							 | 
						||
| 
								 | 
							
								                <RadzenButton class="col-5" Click="@(() => SelectDrawer(i))" Text="@i.ToString()" Disabled="@(status > 0)" Shade="Shade.Light" Variant="@(drawerNo !=i ? Variant.Outlined : Variant.Flat)" />
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								            }
							 | 
						||
| 
								 | 
							
								        </div>
							 | 
						||
| 
								 | 
							
								    </div>
							 | 
						||
| 
								 | 
							
								    <div class="col-9 mb-4">
							 | 
						||
| 
								 | 
							
								        <form onsubmit="@(() => grid.Reload())">
							 | 
						||
| 
								 | 
							
								            <RadzenFieldset Text="查询">
							 | 
						||
| 
								 | 
							
								                <RadzenStack Orientation="Orientation.Horizontal" Gap="1rem">
							 | 
						||
| 
								 | 
							
								                    <RadzenRow AlignItems="AlignItems.Center">
							 | 
						||
| 
								 | 
							
								                        <RadzenColumn Size="4">
							 | 
						||
| 
								 | 
							
								                            <RadzenLabel Text="处方号" Component="OrderNo" />
							 | 
						||
| 
								 | 
							
								                        </RadzenColumn>
							 | 
						||
| 
								 | 
							
								                        <RadzenColumn Size="8">
							 | 
						||
| 
								 | 
							
								                            <RadzenTextBox @bind-Value="OrderNo" Style="width: 100%;" Name="OrderNo"></RadzenTextBox>
							 | 
						||
| 
								 | 
							
								                        </RadzenColumn>
							 | 
						||
| 
								 | 
							
								                    </RadzenRow>
							 | 
						||
| 
								 | 
							
								                    <RadzenRow AlignItems="AlignItems.Center">
							 | 
						||
| 
								 | 
							
								                        <RadzenColumn Size="4">
							 | 
						||
| 
								 | 
							
								                            <RadzenLabel Text="处方时间" Component="OrderDate" />
							 | 
						||
| 
								 | 
							
								                        </RadzenColumn>
							 | 
						||
| 
								 | 
							
								                        <RadzenColumn Size="8">
							 | 
						||
| 
								 | 
							
								                            <RadzenDatePicker DateFormat="yyyy-MM-dd" CurrentDateChanged="@OnCurrentDateChanged" @bind-Value="OrderDate" Style="width: 100%;" Name="OrderDate" />
							 | 
						||
| 
								 | 
							
								                        </RadzenColumn>
							 | 
						||
| 
								 | 
							
								                    </RadzenRow>
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								                    <RadzenRow AlignItems="AlignItems.Center">
							 | 
						||
| 
								 | 
							
								                        <RadzenColumn Size="12">
							 | 
						||
| 
								 | 
							
								                            <RadzenButton Size="ButtonSize.Medium" ButtonType="ButtonType.Submit" IsBusy="isLoading" Icon="search" Text="查询" />
							 | 
						||
| 
								 | 
							
								                            <RadzenButton Size="ButtonSize.Medium" Click="reloadGrid" IsBusy="isLoading" Icon="refresh" Text="重置" ButtonStyle="ButtonStyle.Warning" />
							 | 
						||
| 
								 | 
							
								                        </RadzenColumn>
							 | 
						||
| 
								 | 
							
								                    </RadzenRow>
							 | 
						||
| 
								 | 
							
								                </RadzenStack>
							 | 
						||
| 
								 | 
							
								            </RadzenFieldset>
							 | 
						||
| 
								 | 
							
								            <RadzenButton Size="ButtonSize.Medium" Click="Confirm" ButtonType="ButtonType.Button" IsBusy="isLoading" Icon="check_circle" Text="确认" Style="margin:0.5rem" />
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								        </form>
							 | 
						||
| 
								 | 
							
								        <RadzenDataGrid @ref="grid" AllowRowSelectOnRowClick="@allowRowSelectOnRowClick" AllowFiltering="true" LoadData="@LoadData"
							 | 
						||
| 
								 | 
							
								        FilterPopupRenderMode="PopupRenderMode.OnDemand" FilterCaseSensitivity="FilterCaseSensitivity.CaseInsensitive"
							 | 
						||
| 
								 | 
							
								        Data="@orderInfos" ColumnWidth="200px" IsLoading="@isLoading" Count="@count" EmptyText="无数据"
							 | 
						||
| 
								 | 
							
								        SelectionMode="DataGridSelectionMode.Multiple" @bind-Value=@selectedOrderInfos
							 | 
						||
| 
								 | 
							
								        AllowPaging="true" PageSize="10" PagerHorizontalAlign="HorizontalAlign.Left" ShowPagingSummary="true" PagingSummaryFormat="{0}/{1} 共{2}条数据">
							 | 
						||
| 
								 | 
							
								            <Columns>
							 | 
						||
| 
								 | 
							
								                <RadzenDataGridColumn Sortable="false" Filterable="false" Width="4rem">
							 | 
						||
| 
								 | 
							
								                    <HeaderTemplate>
							 | 
						||
| 
								 | 
							
								                        <RadzenCheckBox TabIndex="-1" TriState="false" TValue="bool?" InputAttributes="@(new Dictionary<string,object>(){ { "aria-label", "Select all items" }})"
							 | 
						||
| 
								 | 
							
								                        Value="@(selectedOrderInfos == null || selectedOrderInfos?.Any() != true ? false : !orderInfos.All(i => selectedOrderInfos.Contains(i)) ? null : orderInfos.Any(i => selectedOrderInfos.Contains(i)))"
							 | 
						||
| 
								 | 
							
								                                        Change="@(args => selectedOrderInfos = args == true ? orderInfos.ToList() : null)" />
							 | 
						||
| 
								 | 
							
								                    </HeaderTemplate>
							 | 
						||
| 
								 | 
							
								                    <Template Context="data">
							 | 
						||
| 
								 | 
							
								                        <RadzenCheckBox TabIndex="-1" TriState="false" Value="@(selectedOrderInfos != null && selectedOrderInfos.Contains(data))" InputAttributes="@(new Dictionary<string,object>(){ { "aria-label", "Select item" }})"
							 | 
						||
| 
								 | 
							
								                                        TValue="bool" Change="@(args => { if (!allowRowSelectOnRowClick) { grid.SelectRow(data); } })" />
							 | 
						||
| 
								 | 
							
								                    </Template>
							 | 
						||
| 
								 | 
							
								                </RadzenDataGridColumn>
							 | 
						||
| 
								 | 
							
								                <RadzenDataGridColumn Property="PatientName" Title="姓名" Sortable="false" Filterable="false" Width="4rem" />
							 | 
						||
| 
								 | 
							
								                <RadzenDataGridColumn Property="Sex" Title="性别" Sortable="false" Filterable="false" Width="2rem" />
							 | 
						||
| 
								 | 
							
								                <RadzenDataGridColumn Property="OrderNo" Title="单号" Sortable="false" Filterable="false" Width="8rem" />
							 | 
						||
| 
								 | 
							
								                <RadzenDataGridColumn Property="Detail.Drug.DrugName" Title="药品名称" FormatString="{0:d}" Sortable="false" Filterable="false" Width="8rem" />
							 | 
						||
| 
								 | 
							
								                <RadzenDataGridColumn Property="Detail.SetManuNo" Title="药品批次" Sortable="false" Filterable="false" Width="8rem" />
							 | 
						||
| 
								 | 
							
								                <RadzenDataGridColumn Property="Detail.Quantity" Title="数量" Sortable="false" Filterable="false" Width="2rem" />
							 | 
						||
| 
								 | 
							
								            </Columns>
							 | 
						||
| 
								 | 
							
								        </RadzenDataGrid>
							 | 
						||
| 
								 | 
							
								    </div>
							 | 
						||
| 
								 | 
							
								</RadzenStack>
							 | 
						||
| 
								 | 
							
								@code {
							 | 
						||
| 
								 | 
							
								    @inject IOrderInfoDao orderInfoDao;
							 | 
						||
| 
								 | 
							
								    @inject DialogService dialogService;
							 | 
						||
| 
								 | 
							
								    @inject Microsoft.Extensions.Options.IOptions<Pojo.Config.SettingConfig> setting;
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								    bool allowRowSelectOnRowClick = true;
							 | 
						||
| 
								 | 
							
								    IEnumerable<OrderInfo> orderInfos;
							 | 
						||
| 
								 | 
							
								    IList<OrderInfo> selectedOrderInfos;
							 | 
						||
| 
								 | 
							
								    RadzenDataGrid<OrderInfo> grid;
							 | 
						||
| 
								 | 
							
								    bool isLoading;
							 | 
						||
| 
								 | 
							
								    int count;
							 | 
						||
| 
								 | 
							
								    int[] DrawerNos = new int[] { 1, 2, 3, 4, 5, 6, 7, 8 };
							 | 
						||
| 
								 | 
							
								    int status = 0;
							 | 
						||
| 
								 | 
							
								    int drawerNo = 1;
							 | 
						||
| 
								 | 
							
								    string OrderNo;
							 | 
						||
| 
								 | 
							
								    DateTime OrderDate;
							 | 
						||
| 
								 | 
							
								    void SelectDrawer(int drawerNo)
							 | 
						||
| 
								 | 
							
								    {
							 | 
						||
| 
								 | 
							
								        this.drawerNo = drawerNo;
							 | 
						||
| 
								 | 
							
								        grid.Reload();
							 | 
						||
| 
								 | 
							
								    }
							 | 
						||
| 
								 | 
							
								    void OnCurrentDateChanged(DateTime args)
							 | 
						||
| 
								 | 
							
								    {
							 | 
						||
| 
								 | 
							
								        OrderDate = new DateTime(args.Year, args.Month, args.Day);
							 | 
						||
| 
								 | 
							
								    }
							 | 
						||
| 
								 | 
							
								    //重置
							 | 
						||
| 
								 | 
							
								    async Task reloadGrid()
							 | 
						||
| 
								 | 
							
								    {
							 | 
						||
| 
								 | 
							
								        OrderNo = "";
							 | 
						||
| 
								 | 
							
								        OrderDate = DateTime.MinValue;
							 | 
						||
| 
								 | 
							
								        await grid.Reload();
							 | 
						||
| 
								 | 
							
								    }
							 | 
						||
| 
								 | 
							
								    //确认
							 | 
						||
| 
								 | 
							
								    async Task Confirm()
							 | 
						||
| 
								 | 
							
								    {
							 | 
						||
| 
								 | 
							
								        orderInfoDao.CheckOrderInfo(selectedOrderInfos, drawerNo);
							 | 
						||
| 
								 | 
							
								    }
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								    async Task LoadData(LoadDataArgs args)
							 | 
						||
| 
								 | 
							
								    {
							 | 
						||
| 
								 | 
							
								        isLoading = true;
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								        var result = await orderInfoDao.GetAllOrderInfoByBox(drawerNo, OrderNo, OrderDate, args.Top, args.Skip);
							 | 
						||
| 
								 | 
							
								        // Update the Data property
							 | 
						||
| 
								 | 
							
								        orderInfos = result.Desserts;
							 | 
						||
| 
								 | 
							
								        // Update the count
							 | 
						||
| 
								 | 
							
								        count = result.TotalDesserts;
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								        isLoading = false;
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								        DrawerNos = await orderInfoDao.GetDrawerNum(setting.Value.boxMachineId);
							 | 
						||
| 
								 | 
							
								    }
							 | 
						||
| 
								 | 
							
								    // 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;
							 | 
						||
| 
								 | 
							
								    // }
							 | 
						||
| 
								 | 
							
								}
							 |