192 lines
		
	
	
		
			8.4 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
		
		
			
		
	
	
			192 lines
		
	
	
		
			8.4 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
| 
								 | 
							
								@page "/return/byRecord"
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								<style>
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								    .rz-custom-header {
							 | 
						|||
| 
								 | 
							
								        width: 100%;
							 | 
						|||
| 
								 | 
							
								    }
							 | 
						|||
| 
								 | 
							
								</style>
							 | 
						|||
| 
								 | 
							
								<div class="container-fluid">
							 | 
						|||
| 
								 | 
							
								    <div class="row">
							 | 
						|||
| 
								 | 
							
								        <div class="col-12 mb-4">
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            <form onsubmit="@(() => grid.Reload())">
							 | 
						|||
| 
								 | 
							
								                <RadzenFieldset Text="<22><>ѯ">
							 | 
						|||
| 
								 | 
							
								                    <RadzenStack Orientation="Orientation.Horizontal" Gap="1rem">
							 | 
						|||
| 
								 | 
							
								                        <RadzenRow AlignItems="AlignItems.Center">
							 | 
						|||
| 
								 | 
							
								                            <RadzenColumn Size="4">
							 | 
						|||
| 
								 | 
							
								                                <RadzenLabel Text="<22><>ʼʱ<CABC><CAB1>" Component="Start" />
							 | 
						|||
| 
								 | 
							
								                            </RadzenColumn>
							 | 
						|||
| 
								 | 
							
								                            <RadzenColumn Size="8">
							 | 
						|||
| 
								 | 
							
								                                <RadzenDatePicker DateFormat="yyyy-MM-dd" @bind-Value="start" Style="width: 100%;" Name="Start" />
							 | 
						|||
| 
								 | 
							
								                            </RadzenColumn>
							 | 
						|||
| 
								 | 
							
								                        </RadzenRow>
							 | 
						|||
| 
								 | 
							
								                        <RadzenRow AlignItems="AlignItems.Center">
							 | 
						|||
| 
								 | 
							
								                            <RadzenColumn Size="4">
							 | 
						|||
| 
								 | 
							
								                                <RadzenLabel Text="<22><><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>" Component="End" />
							 | 
						|||
| 
								 | 
							
								                            </RadzenColumn>
							 | 
						|||
| 
								 | 
							
								                            <RadzenColumn Size="8">
							 | 
						|||
| 
								 | 
							
								                                <RadzenDatePicker DateFormat="yyyy-MM-dd" @bind-Value="end" Style="width: 100%;" Name="End" />
							 | 
						|||
| 
								 | 
							
								                            </RadzenColumn>
							 | 
						|||
| 
								 | 
							
								                        </RadzenRow>
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								                        <RadzenRow AlignItems="AlignItems.Center">
							 | 
						|||
| 
								 | 
							
								                            <RadzenColumn Size="12">
							 | 
						|||
| 
								 | 
							
								                                <RadzenButton Size="ButtonSize.Large" ButtonType="ButtonType.Submit" IsBusy="isLoading" Icon="search" Text="<22><>ѯ" />
							 | 
						|||
| 
								 | 
							
								                                <RadzenButton Size="ButtonSize.Large" Click="reloadGrid" IsBusy="isLoading" Icon="refresh" Text="<22><><EFBFBD><EFBFBD>" ButtonStyle="ButtonStyle.Warning" />
							 | 
						|||
| 
								 | 
							
								                            </RadzenColumn>
							 | 
						|||
| 
								 | 
							
								                        </RadzenRow>
							 | 
						|||
| 
								 | 
							
								                    </RadzenStack>
							 | 
						|||
| 
								 | 
							
								                </RadzenFieldset>
							 | 
						|||
| 
								 | 
							
								            </form>
							 | 
						|||
| 
								 | 
							
								        </div>
							 | 
						|||
| 
								 | 
							
								        <div class="col-12 mb-4" style="height:50vh;overflow:auto">
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            <RadzenDataGrid @ref="grid" Style="height:48vh;"
							 | 
						|||
| 
								 | 
							
								                            LoadData="@LoadData"
							 | 
						|||
| 
								 | 
							
								                            IsLoading="@isLoading"
							 | 
						|||
| 
								 | 
							
								                            Count="@count"
							 | 
						|||
| 
								 | 
							
								                            EmptyText="<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"
							 | 
						|||
| 
								 | 
							
								                            Data="@_forecasts"
							 | 
						|||
| 
								 | 
							
								                            AllowColumnResize="true" AllowAlternatingRows="false"
							 | 
						|||
| 
								 | 
							
								                            AllowRowSelectOnRowClick="true"
							 | 
						|||
| 
								 | 
							
								                            CellClick="@((DataGridCellMouseEventArgs<MachineRecord> args) => OnCellClick(args))"
							 | 
						|||
| 
								 | 
							
								                            AllowPaging="true" PageSize="8" PagerHorizontalAlign="HorizontalAlign.Left" ShowPagingSummary="true" PagingSummaryFormat="{0}/{1} <20><>{2}<7D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>">
							 | 
						|||
| 
								 | 
							
								                <HeaderTemplate>
							 | 
						|||
| 
								 | 
							
								                    <RadzenRow JustifyContent="JustifyContent.End">
							 | 
						|||
| 
								 | 
							
								                        <RadzenButton ButtonStyle="ButtonStyle.Warning" Disabled="_forecasts == null || !_forecasts.Any(mr => mr.CurrentReturnQuantity > 0)" Variant="Variant.Outlined" Shade="Shade.Light" Text="<22>黹" Click="@OpenReturnDialog" />
							 | 
						|||
| 
								 | 
							
								                    </RadzenRow>
							 | 
						|||
| 
								 | 
							
								                </HeaderTemplate>
							 | 
						|||
| 
								 | 
							
								                <Columns>
							 | 
						|||
| 
								 | 
							
								                    <RadzenDataGridColumn Frozen="true" Title="<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>" Property="OperatorUser.NickName"></RadzenDataGridColumn>
							 | 
						|||
| 
								 | 
							
								                    <RadzenDataGridColumn Width="170px" Title="<22><><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>" Property="OperationTime"></RadzenDataGridColumn>
							 | 
						|||
| 
								 | 
							
								                    <RadzenDataGridColumn Width="200px" Title="ҩƷ<D2A9><C6B7><EFBFBD><EFBFBD>" Property="Drug.DrugName">
							 | 
						|||
| 
								 | 
							
								                        <Template Context="mr">
							 | 
						|||
| 
								 | 
							
								                            <RadzenText TextStyle="TextStyle.Subtitle2" class="mb-0">@mr.Drug?.DrugName</RadzenText>
							 | 
						|||
| 
								 | 
							
								                            <RadzenText TextStyle="TextStyle.Caption">@mr.Drug?.DrugSpec</RadzenText>
							 | 
						|||
| 
								 | 
							
								                        </Template>
							 | 
						|||
| 
								 | 
							
								                    </RadzenDataGridColumn>
							 | 
						|||
| 
								 | 
							
								                    <RadzenDataGridColumn Width="60px" Title="ҩ<><D2A9>" Property="OperationTime">
							 | 
						|||
| 
								 | 
							
								                        <Template Context="mr">
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								                            @if (mr.BoxDrawer > 0)
							 | 
						|||
| 
								 | 
							
								                            {
							 | 
						|||
| 
								 | 
							
								                                if (mr.DrawerNo == 99)
							 | 
						|||
| 
								 | 
							
								                                {
							 | 
						|||
| 
								 | 
							
								                                    <b class="rz-pr-3">@($"<22><><EFBFBD><EFBFBD>ҩ<EFBFBD><D2A9>")</b>
							 | 
						|||
| 
								 | 
							
								                                }
							 | 
						|||
| 
								 | 
							
								                                else if (mr.DrawerNo == 111)
							 | 
						|||
| 
								 | 
							
								                                {
							 | 
						|||
| 
								 | 
							
								                                    <b class="rz-pr-3">@($"<22>ָ<EFBFBD><D6B8><EFBFBD>ҩ<EFBFBD><D2A9>")</b>
							 | 
						|||
| 
								 | 
							
								                                }
							 | 
						|||
| 
								 | 
							
								                                else
							 | 
						|||
| 
								 | 
							
								                                {
							 | 
						|||
| 
								 | 
							
								                                    <b class="rz-pr-3">@($"{mr.DrawerNo}-{(mr.ColNo == 1 ? '<27><>' : '<27><>')}")</b>
							 | 
						|||
| 
								 | 
							
								                                }
							 | 
						|||
| 
								 | 
							
								                            }
							 | 
						|||
| 
								 | 
							
								                            else
							 | 
						|||
| 
								 | 
							
								                            {
							 | 
						|||
| 
								 | 
							
								                                <b class="rz-pr-3"><3E><></b>
							 | 
						|||
| 
								 | 
							
								                            }
							 | 
						|||
| 
								 | 
							
								                        </Template>
							 | 
						|||
| 
								 | 
							
								                    </RadzenDataGridColumn>
							 | 
						|||
| 
								 | 
							
								                    <RadzenDataGridColumn Title="<22><><EFBFBD><EFBFBD>" Property="ManuNo" Width="123px">
							 | 
						|||
| 
								 | 
							
								                        <Template Context="mr">
							 | 
						|||
| 
								 | 
							
								                            <RadzenText TextStyle="TextStyle.Subtitle2" class="mb-0">@mr.ManuNo</RadzenText>
							 | 
						|||
| 
								 | 
							
								                            <RadzenText TextStyle="TextStyle.Caption"> @mr.EffDate?.ToString("yyyy-MM-dd")</RadzenText>
							 | 
						|||
| 
								 | 
							
								                        </Template>
							 | 
						|||
| 
								 | 
							
								                    </RadzenDataGridColumn>
							 | 
						|||
| 
								 | 
							
								                    <RadzenDataGridColumn Title="<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>" Property="Quantity">
							 | 
						|||
| 
								 | 
							
								                        <HeaderTemplate>
							 | 
						|||
| 
								 | 
							
								                            <div style="text-align: center;">
							 | 
						|||
| 
								 | 
							
								                                <20><><EFBFBD><EFBFBD><br><3E><><EFBFBD><EFBFBD>
							 | 
						|||
| 
								 | 
							
								                            </div>
							 | 
						|||
| 
								 | 
							
								                        </HeaderTemplate>
							 | 
						|||
| 
								 | 
							
								                    </RadzenDataGridColumn>
							 | 
						|||
| 
								 | 
							
								                    <RadzenDataGridColumn Title="<22>ѻ<EFBFBD>ҩƷ" Property="ReturnQuantity1">
							 | 
						|||
| 
								 | 
							
								                        <HeaderTemplate>
							 | 
						|||
| 
								 | 
							
								                            <div style="text-align: center;">
							 | 
						|||
| 
								 | 
							
								                                <20>ѻ<EFBFBD><br>ҩƷ
							 | 
						|||
| 
								 | 
							
								                            </div>
							 | 
						|||
| 
								 | 
							
								                        </HeaderTemplate>
							 | 
						|||
| 
								 | 
							
								                    </RadzenDataGridColumn>
							 | 
						|||
| 
								 | 
							
								                    <RadzenDataGridColumn Title="<22>ѻ<EFBFBD><D1BB><EFBFBD>ƿ" Property="ReturnQuantity2">
							 | 
						|||
| 
								 | 
							
								                        <HeaderTemplate>
							 | 
						|||
| 
								 | 
							
								                            <div style="text-align: center;">
							 | 
						|||
| 
								 | 
							
								                                <20>ѻ<EFBFBD><br><3E><>ƿ
							 | 
						|||
| 
								 | 
							
								                            </div>
							 | 
						|||
| 
								 | 
							
								                        </HeaderTemplate>
							 | 
						|||
| 
								 | 
							
								                    </RadzenDataGridColumn>
							 | 
						|||
| 
								 | 
							
								                    <RadzenDataGridColumn Title="<22><><EFBFBD>ι黹" Property="CurrentReturnQuantity" Width="90px">
							 | 
						|||
| 
								 | 
							
								                        <HeaderTemplate>
							 | 
						|||
| 
								 | 
							
								                            <div style="text-align: center;">
							 | 
						|||
| 
								 | 
							
								                                <20><><EFBFBD><EFBFBD><br><3E>黹
							 | 
						|||
| 
								 | 
							
								                            </div>
							 | 
						|||
| 
								 | 
							
								                        </HeaderTemplate>
							 | 
						|||
| 
								 | 
							
								                        <EditTemplate Context="mr">
							 | 
						|||
| 
								 | 
							
								                            <RadzenNumeric Min="0" Style="display: block" Max="@(mr.Quantity - mr.ReturnQuantity1 - mr.ReturnQuantity2)" Name="Quantity" @bind-Value=@mr.CurrentReturnQuantity />
							 | 
						|||
| 
								 | 
							
								                        </EditTemplate>
							 | 
						|||
| 
								 | 
							
								                    </RadzenDataGridColumn>
							 | 
						|||
| 
								 | 
							
								                </Columns>
							 | 
						|||
| 
								 | 
							
								            </RadzenDataGrid>
							 | 
						|||
| 
								 | 
							
								        </div>
							 | 
						|||
| 
								 | 
							
								    </div>
							 | 
						|||
| 
								 | 
							
								</div>
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								@code {
							 | 
						|||
| 
								 | 
							
								    @inject IMachineRecordDao machineRecordDao;
							 | 
						|||
| 
								 | 
							
								    @inject DialogService dialogService;
							 | 
						|||
| 
								 | 
							
								    RadzenDataGrid<MachineRecord> grid;
							 | 
						|||
| 
								 | 
							
								    bool isLoading;
							 | 
						|||
| 
								 | 
							
								    int count;
							 | 
						|||
| 
								 | 
							
								    private List<MachineRecord>? _forecasts;
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								    DateTime start;
							 | 
						|||
| 
								 | 
							
								    DateTime end;
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								    async Task LoadData(LoadDataArgs args)
							 | 
						|||
| 
								 | 
							
								    {
							 | 
						|||
| 
								 | 
							
								        isLoading = true;
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        var result = await machineRecordDao.GetCanReturnRecords(start, end, 0, "", args.Top, args.Skip);
							 | 
						|||
| 
								 | 
							
								        // Update the Data property
							 | 
						|||
| 
								 | 
							
								        _forecasts = result.Desserts;
							 | 
						|||
| 
								 | 
							
								        // Update the count
							 | 
						|||
| 
								 | 
							
								        count = result.TotalDesserts;
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        isLoading = false;
							 | 
						|||
| 
								 | 
							
								    }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								    async Task reloadGrid()
							 | 
						|||
| 
								 | 
							
								    {
							 | 
						|||
| 
								 | 
							
								        start = DateTime.MinValue;
							 | 
						|||
| 
								 | 
							
								        end = DateTime.MinValue;
							 | 
						|||
| 
								 | 
							
								        await grid.Reload();
							 | 
						|||
| 
								 | 
							
								    }
							 | 
						|||
| 
								 | 
							
								    async Task OpenReturnDialog()
							 | 
						|||
| 
								 | 
							
								    {
							 | 
						|||
| 
								 | 
							
								        var list = _forecasts.Where(mr => mr.CurrentReturnQuantity > 0).ToList();
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        var b = await dialogService.OpenAsync<RecordReturnDrugDialog>(
							 | 
						|||
| 
								 | 
							
								                $"<22><>¼<EFBFBD><C2BC>ҩ",
							 | 
						|||
| 
								 | 
							
								              new Dictionary<string, object>() { { "records", list } },
							 | 
						|||
| 
								 | 
							
								              new DialogOptions() { Width = "85vw", Resizable = true, Draggable = true, ShowClose = false }
							 | 
						|||
| 
								 | 
							
								        );
							 | 
						|||
| 
								 | 
							
								        if (b)
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            await reloadGrid();
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								    }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								    void OnCellClick(DataGridCellMouseEventArgs<MachineRecord> args)
							 | 
						|||
| 
								 | 
							
								    {
							 | 
						|||
| 
								 | 
							
								        grid.EditRow(args.Data);
							 | 
						|||
| 
								 | 
							
								    }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								}
							 |