@page "/Box/BoxRemove"
@using MasaBlazorApp3.Pojo.Config;
@using MasaBlazorApp3.Pojo.Vo;
@using MasaBlazorApp3.Util;
@using Microsoft.Extensions.Options;
@using Newtonsoft.Json;
@using log4net;
药名:
@(channelStock.Drug.DrugName)
规格:
@(channelStock.Drug.DrugSpec)
批次:
@(channelStock.ManuNo)
效期:
@(channelStock.EffDate)
库存:
@(channelStock.Quantity)
移入药箱:
@(SelectedDrawerNo)
移入数量:
@code {
@inject Radzen.DialogService dialogService;
@inject IChannelListDao channelListDao;
@inject IOptions setting;
@inject NotificationService _message
@inject PortUtil PortUtil;
private readonly ILog logger = LogManager.GetLogger(typeof(OrderDetailDialog));
int removeQuantity;
int status;
int[] DrawerNos;
int SelectedDrawerNo = 0;
[Parameter] public ChannelStock channelStock { get; set; }
private bool CanTakeDrug = true;
// public List data { get; set; }
//称重取药数量
int[] WeightFinnalQuantity { get; set; } = new int[] { 0, 0, 0, 0, 0, 0, 0, 0, 0 };
//开抽屉前操作标识
List DrawerNoColNoList = new List();
protected override async Task OnInitializedAsync()
{
DrawerNos = await channelListDao.GetDrawerNumForRemove(channelStock);
if (DrawerNos != null && DrawerNos.Count() > 0)
{
SelectedDrawerNo = DrawerNos[0];
// var result = await channelListDao.GetChannelStockByDrug(channelStock, SelectedDrawerNo, 8, 0);
// selectedDrawerData = result.Desserts;
}
base.OnInitializedAsync();
}
void RestData()
{
// PortUtil.speechSynthesizer.SpeakAsyncCancelAll();
// this.status = 0;
// data.ForEach(it =>
// {
// it.Status = 0;
// it.BeforeQuantity = new int[9];
// it.AfterQuantity = new int[9];
// });
// this.WeightFinnalQuantity = new int[9];
// DrawerNoColNoList.Clear();
}
void Cancel()
{
RestData();
// 关闭弹窗
dialogService.Close(false);
}
async Task Save()
{
if (removeQuantity<=0)
{
_message.Notify(new NotificationMessage { Severity = NotificationSeverity.Error, Summary = "提示", Detail = "请输入移入数量", Duration = 4000 });
return;
}
if (SelectedDrawerNo<=0)
{
_message.Notify(new NotificationMessage { Severity = NotificationSeverity.Error, Summary = "提示", Detail = "无可移入的药箱", Duration = 4000 });
return;
}
var b = await channelListDao.BoxRemoveFinish(channelStock, SelectedDrawerNo,removeQuantity);
if (!b)
{
_message.Notify(new NotificationMessage { Severity = NotificationSeverity.Error, Summary = "提示", Detail = $"数据保存失败", Duration = 4000 });
logger.Error($"药箱移出保存数据失败,数据{JsonConvert.SerializeObject(channelStock)}");
}
else
{
_message.Notify(new NotificationMessage { Severity = NotificationSeverity.Success, Summary = "提示", Detail = $"交换完成", Duration = 4000 });
// 关闭弹窗
dialogService.Close(true);
}
//重置状态
this.RestData();
}
}