239 lines
		
	
	
		
			13 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
		
		
			
		
	
	
			239 lines
		
	
	
		
			13 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
| 
								 | 
							
								@page "/Box/BoxStock"
							 | 
						|||
| 
								 | 
							
								@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">
							 | 
						|||
| 
								 | 
							
								        @*   <RadzenFieldset Text="">
							 | 
						|||
| 
								 | 
							
								            <RadzenStack Orientation="Orientation.Horizontal" Gap="1rem">
							 | 
						|||
| 
								 | 
							
								                <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> *@
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        @* <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> *@
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        <RadzenDataList @ref="grid" LoadData="@LoadData" WrapItems="true" Count="@count" IsLoading="@isLoading"
							 | 
						|||
| 
								 | 
							
								                        Data="@_forecasts" PageSize="6" AllowPaging="true" PagerHorizontalAlign="HorizontalAlign.Left"
							 | 
						|||
| 
								 | 
							
								                        ShowPagingSummary="true" PagingSummaryFormat="{0}/{1} 共{2}条数据">
							 | 
						|||
| 
								 | 
							
								            <Template Context="pd">
							 | 
						|||
| 
								 | 
							
								                <RadzenCard Variant="Variant.Outlined" class="rz-p-0" Style="width: 100%; overflow: hidden;">
							 | 
						|||
| 
								 | 
							
								                    <RadzenRow Gap="0">
							 | 
						|||
| 
								 | 
							
								                        <RadzenColumn Size="12" SizeLG="2" class="rz-p-4 product-title">
							 | 
						|||
| 
								 | 
							
								                            <RadzenText TextStyle="TextStyle.H6" TagName="TagName.H5" class="rz-color-on-secondary-lighter">@(pd._DrugInfo.DrugName)</RadzenText>
							 | 
						|||
| 
								 | 
							
								                        </RadzenColumn>
							 | 
						|||
| 
								 | 
							
								                        <RadzenColumn Size="12" SizeLG="3" class="rz-p-4 product-title">
							 | 
						|||
| 
								 | 
							
								                            <RadzenText TextStyle="TextStyle.H6" TagName="TagName.H5" class="rz-color-on-secondary-lighter">@(pd._DrugInfo.Manufactory)</RadzenText>
							 | 
						|||
| 
								 | 
							
								                        </RadzenColumn>
							 | 
						|||
| 
								 | 
							
								                        <RadzenColumn Size="12" SizeLG="2" class="rz-p-4 product-title">
							 | 
						|||
| 
								 | 
							
								                            <RadzenText TextStyle="TextStyle.H6" TagName="TagName.H5" class="rz-color-on-secondary-lighter">@(pd._DrugInfo.DrugSpec)</RadzenText>
							 | 
						|||
| 
								 | 
							
								                        </RadzenColumn>
							 | 
						|||
| 
								 | 
							
								                        <RadzenColumn Size="12" SizeLG="1" class="rz-p-4 product-title">
							 | 
						|||
| 
								 | 
							
								                            <RadzenText TextStyle="TextStyle.H6" TagName="TagName.H5" class="rz-color-on-secondary-lighter">@(pd.BaseQuantity)</RadzenText>
							 | 
						|||
| 
								 | 
							
								                        </RadzenColumn>
							 | 
						|||
| 
								 | 
							
								                       @*  <RadzenColumn Size="12" SizeLG="2" class="rz-p-4">
							 | 
						|||
| 
								 | 
							
								                            <RadzenButton Text="替换药品" Style="width: 100%" Click="@(() => replaceClick(pd))" />
							 | 
						|||
| 
								 | 
							
								                        </RadzenColumn>
							 | 
						|||
| 
								 | 
							
								                        <RadzenColumn Size="12" SizeLG="2" class="rz-p-4">
							 | 
						|||
| 
								 | 
							
								                            <RadzenButton Text="移出药品" Style="width: 100%" Click="@(()=>removeClick(pd))" />
							 | 
						|||
| 
								 | 
							
								                        </RadzenColumn> *@
							 | 
						|||
| 
								 | 
							
								                        @if (pd.channelStocks != null && pd.channelStocks.Count > 0)
							 | 
						|||
| 
								 | 
							
								                        {
							 | 
						|||
| 
								 | 
							
								                            for (int i = 0; i < pd.channelStocks.Count; i++)
							 | 
						|||
| 
								 | 
							
								                            {
							 | 
						|||
| 
								 | 
							
								                                var manuInfo = pd.channelStocks[i];
							 | 
						|||
| 
								 | 
							
								                                var manuNo = 1;
							 | 
						|||
| 
								 | 
							
								                                if (i == 0)
							 | 
						|||
| 
								 | 
							
								                                {
							 | 
						|||
| 
								 | 
							
								                                    manuNo = 0;
							 | 
						|||
| 
								 | 
							
								                                }
							 | 
						|||
| 
								 | 
							
								                                <RadzenColumn Size="12" SizeLG="7" class="rz-p-4">
							 | 
						|||
| 
								 | 
							
								                                    @if (manuInfo != null && manuInfo.ManuNo != null)
							 | 
						|||
| 
								 | 
							
								                                    {
							 | 
						|||
| 
								 | 
							
								                                        <RadzenRow Gap="0">
							 | 
						|||
| 
								 | 
							
								                                            <RadzenColumn Size="12" SizeMD="6" SizeLG="2">
							 | 
						|||
| 
								 | 
							
								                                                @if (manuNo == 0)
							 | 
						|||
| 
								 | 
							
								                                                {
							 | 
						|||
| 
								 | 
							
								                                                    <RadzenText TextStyle="TextStyle.H6" TagName="TagName.H5" class="rz-mb-0">批次</RadzenText>
							 | 
						|||
| 
								 | 
							
								                                                }
							 | 
						|||
| 
								 | 
							
								                                                <RadzenText TextStyle="TextStyle.Body2">@(manuInfo.ManuNo)</RadzenText>
							 | 
						|||
| 
								 | 
							
								                                            </RadzenColumn>
							 | 
						|||
| 
								 | 
							
								                                            <RadzenColumn Size="12" SizeMD="6" SizeLG="2">
							 | 
						|||
| 
								 | 
							
								                                                @if (manuNo == 0)
							 | 
						|||
| 
								 | 
							
								                                                {
							 | 
						|||
| 
								 | 
							
								                                                    <RadzenText TextStyle="TextStyle.H6" TagName="TagName.H5" class="rz-mb-0">效期</RadzenText>
							 | 
						|||
| 
								 | 
							
								                                                }
							 | 
						|||
| 
								 | 
							
								                                                <RadzenText TextStyle="TextStyle.Body2">@(manuInfo.EffDate)</RadzenText>
							 | 
						|||
| 
								 | 
							
								                                            </RadzenColumn>
							 | 
						|||
| 
								 | 
							
								                                            <RadzenColumn Size="12" SizeMD="6" SizeLG="2">
							 | 
						|||
| 
								 | 
							
								                                                @if (manuNo == 0)
							 | 
						|||
| 
								 | 
							
								                                                {
							 | 
						|||
| 
								 | 
							
								                                                    <RadzenText TextStyle="TextStyle.H6" TagName="TagName.H5" class="rz-mb-0">库存</RadzenText>
							 | 
						|||
| 
								 | 
							
								                                                }
							 | 
						|||
| 
								 | 
							
								                                                <RadzenText TextStyle="TextStyle.Body2">@(manuInfo.Quantity)</RadzenText>
							 | 
						|||
| 
								 | 
							
								                                            </RadzenColumn>
							 | 
						|||
| 
								 | 
							
								                                            <RadzenColumn Size="12" SizeLG="2" class="rz-p-4">
							 | 
						|||
| 
								 | 
							
								                                                <RadzenButton Text="替换药品" Style="width: 100%" Click="@(() => replaceClick(manuInfo))" />
							 | 
						|||
| 
								 | 
							
								                                            </RadzenColumn>
							 | 
						|||
| 
								 | 
							
								                                            <RadzenColumn Size="12" SizeLG="2" class="rz-p-4">
							 | 
						|||
| 
								 | 
							
								                                                <RadzenButton Text="移出药品" Style="width: 100%" Click="@(() => removeClick(manuInfo))" />
							 | 
						|||
| 
								 | 
							
								                                            </RadzenColumn>
							 | 
						|||
| 
								 | 
							
								                                        </RadzenRow>
							 | 
						|||
| 
								 | 
							
								                                    }
							 | 
						|||
| 
								 | 
							
								                                    else
							 | 
						|||
| 
								 | 
							
								                                    {
							 | 
						|||
| 
								 | 
							
								                                        <RadzenRow Gap="0">
							 | 
						|||
| 
								 | 
							
								                                            <RadzenColumn Size="12" SizeMD="6" SizeLG="2">
							 | 
						|||
| 
								 | 
							
								                                                <RadzenText TextStyle="TextStyle.H6" TagName="TagName.H5" class="rz-mb-0">未绑定批次</RadzenText>
							 | 
						|||
| 
								 | 
							
								                                            </RadzenColumn>
							 | 
						|||
| 
								 | 
							
								                                        </RadzenRow>
							 | 
						|||
| 
								 | 
							
								                                    }
							 | 
						|||
| 
								 | 
							
								                                </RadzenColumn>
							 | 
						|||
| 
								 | 
							
								                            }
							 | 
						|||
| 
								 | 
							
								                        }
							 | 
						|||
| 
								 | 
							
								                    </RadzenRow>
							 | 
						|||
| 
								 | 
							
								                </RadzenCard>
							 | 
						|||
| 
								 | 
							
								            </Template>
							 | 
						|||
| 
								 | 
							
								        </RadzenDataList>
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								    </div>
							 | 
						|||
| 
								 | 
							
								</RadzenStack>
							 | 
						|||
| 
								 | 
							
								@code {
							 | 
						|||
| 
								 | 
							
								    @inject IOrderInfoDao orderInfoDao;
							 | 
						|||
| 
								 | 
							
								    @inject IChannelListDao channelListDao;
							 | 
						|||
| 
								 | 
							
								    @inject DialogService dialogService;
							 | 
						|||
| 
								 | 
							
								    @inject Microsoft.Extensions.Options.IOptions<Pojo.Config.SettingConfig> setting;
							 | 
						|||
| 
								 | 
							
								    @inject NotificationService _message
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								    private IEnumerable<PlanDetails>? _forecasts;
							 | 
						|||
| 
								 | 
							
								    bool allowRowSelectOnRowClick = true;
							 | 
						|||
| 
								 | 
							
								    // IEnumerable<DrugManuNo> drugManuNos;
							 | 
						|||
| 
								 | 
							
								    // IList<DrugManuNo> selectedDrugManuNos;
							 | 
						|||
| 
								 | 
							
								    RadzenDataList<PlanDetails> grid;
							 | 
						|||
| 
								 | 
							
								    // RadzenDataGrid<DrugManuNo> gridManuNo;
							 | 
						|||
| 
								 | 
							
								    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 channelListDao.GetBoxDrugInfo(drawerNo, args.Top, args.Skip);
							 | 
						|||
| 
								 | 
							
								        // Update the Data property
							 | 
						|||
| 
								 | 
							
								        _forecasts = result.Desserts;
							 | 
						|||
| 
								 | 
							
								        // Update the count
							 | 
						|||
| 
								 | 
							
								        count = result.TotalDesserts;
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        isLoading = false;
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        DrawerNos = await orderInfoDao.GetDrawerNum(setting.Value.boxMachineId);
							 | 
						|||
| 
								 | 
							
								    }
							 | 
						|||
| 
								 | 
							
								    //替换按钮
							 | 
						|||
| 
								 | 
							
								    async Task replaceClick(ChannelStock cs)
							 | 
						|||
| 
								 | 
							
								    {
							 | 
						|||
| 
								 | 
							
								        if (cs.Quantity > 0)
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            var b = await dialogService.OpenAsync<BoxReplace>(
							 | 
						|||
| 
								 | 
							
								                   $"{cs.DrawerNo}号药箱替换药品详情",
							 | 
						|||
| 
								 | 
							
								                 new Dictionary<string, object>() { { "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<BoxRemoveDialog>(
							 | 
						|||
| 
								 | 
							
								                   $"{cs.DrawerNo}号药箱替换药品详情",
							 | 
						|||
| 
								 | 
							
								                 new Dictionary<string, object>() { { "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 }
							 | 
						|||
| 
								 | 
							
								        );
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								    }
							 | 
						|||
| 
								 | 
							
								}
							 |