修改提交
This commit is contained in:
parent
7d4cd33524
commit
216ab8a916
File diff suppressed because one or more lines are too long
|
|
@ -0,0 +1,14 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace MasaBlazorApp3.DataAccess
|
||||||
|
{
|
||||||
|
public class CheckInfo<T>
|
||||||
|
{
|
||||||
|
public string StrInfo { get; set; }
|
||||||
|
public List<T> TEntity { get; set; } = new List<T>();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -17,7 +17,7 @@ namespace MasaBlazorApp3.DataAccess.Dao
|
||||||
|
|
||||||
public Task<List<ChannelList>> GetAllDrugChannelList();
|
public Task<List<ChannelList>> GetAllDrugChannelList();
|
||||||
|
|
||||||
public Task<bool> DrawerOperationFinish(List<ChannelStock> Stocks, int type);
|
public Task<bool> DrawerOperationFinish(List<ChannelStock> Stocks, int type,BoxModel boxNum,List<ChannelList> channelLists);
|
||||||
|
|
||||||
public Task<bool> UnBind(string id);
|
public Task<bool> UnBind(string id);
|
||||||
|
|
||||||
|
|
@ -68,7 +68,7 @@ namespace MasaBlazorApp3.DataAccess.Dao
|
||||||
//手术室药盒获取药盒药品及库存信息
|
//手术室药盒获取药盒药品及库存信息
|
||||||
Task<PageData<PlanDetails>> GetBoxDrugInfo(string DrawerNo, int? take, int? skip);
|
Task<PageData<PlanDetails>> GetBoxDrugInfo(string DrawerNo, int? take, int? skip);
|
||||||
//药盒移库时获取选中药盒号的药品信息
|
//药盒移库时获取选中药盒号的药品信息
|
||||||
Task<PageData<ChannelStock>> GetChannelStockByDrug(ChannelStock cs, string drawerNo, int? take, int? skip);
|
Task<PageData<ChannelStock>> GetChannelStockByDrug(ChannelStock cs, string drawerNo,int? take, int? skip);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 药盒交换药品获取所有除本药盒外的所有药盒号
|
/// 药盒交换药品获取所有除本药盒外的所有药盒号
|
||||||
|
|
@ -96,5 +96,9 @@ namespace MasaBlazorApp3.DataAccess.Dao
|
||||||
Task<List<ChannelStock>> GetChannelStockByPlan(string plan);
|
Task<List<ChannelStock>> GetChannelStockByPlan(string plan);
|
||||||
//手术室药盒获取绑定数据
|
//手术室药盒获取绑定数据
|
||||||
Task<List<ChannelList>> GetAllChannelList();
|
Task<List<ChannelList>> GetAllChannelList();
|
||||||
|
//抽屉取药向药盒加药校验药盒中是否存在该药
|
||||||
|
Task<CheckInfo<ChannelList>> CheckBoxDrugInfo(BoxModel BoxNum,List<ChannelStock> channelStockList);
|
||||||
|
//药箱中的药移入到抽屉
|
||||||
|
Task<bool> RemoveDrugToDrawerFinish(string SelectedDrawerNo, ChannelStock channelStock, int quantity);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,8 @@ namespace MasaBlazorApp3.DataAccess.Dao
|
||||||
public interface IDrugInfoDao
|
public interface IDrugInfoDao
|
||||||
{
|
{
|
||||||
Task<List<DrugInfo>> GetAllDrugAndStock();
|
Task<List<DrugInfo>> GetAllDrugAndStock();
|
||||||
|
|
||||||
|
Task<List<DrugInfo>> GetAllDrugAndStockByBox(BoxModel boxModel);
|
||||||
|
|
||||||
|
|
||||||
Task<List<DrugInfo>> GetAllDrug();
|
Task<List<DrugInfo>> GetAllDrug();
|
||||||
|
|
|
||||||
|
|
@ -10,8 +10,9 @@ namespace MasaBlazorApp3.DataAccess.Dao
|
||||||
{
|
{
|
||||||
public interface IOrderInfoDao
|
public interface IOrderInfoDao
|
||||||
{
|
{
|
||||||
public Task<PageData<OrderInfo>> GetAllOrderInfo(string OrderrNo, DateTime OrderDate, int? take, int? skip);
|
public Task<PageData<OrderInfo>> GetAllOrderInfo(string OrderrNo,DateTime OrderDate, int? take, int? skip);
|
||||||
|
//导入处方查询数据
|
||||||
|
public Task<PageData<OrderInfo>> GetAllOrderInfoForImport(string name, string OrderrNo, DateTime OrderDate, BoxModel boxModel, int? take, int? skip);
|
||||||
|
|
||||||
public Task<PageData<OrderInfo>> GetAllCanReturnOrderInfo(string OrderrNo, DateTime OrderDate, int? take, int? skip);
|
public Task<PageData<OrderInfo>> GetAllCanReturnOrderInfo(string OrderrNo, DateTime OrderDate, int? take, int? skip);
|
||||||
|
|
||||||
|
|
@ -29,16 +30,24 @@ namespace MasaBlazorApp3.DataAccess.Dao
|
||||||
//获取药盒中的用药信息
|
//获取药盒中的用药信息
|
||||||
public Task<PageData<OrderInfo>> GetAllOrderInfoByBox(int box,string OrderrNo, DateTime OrderDate, int? take, int? skip);
|
public Task<PageData<OrderInfo>> GetAllOrderInfoByBox(int box,string OrderrNo, DateTime OrderDate, int? take, int? skip);
|
||||||
//获取待处理处方中的麻醉师
|
//获取待处理处方中的麻醉师
|
||||||
public Task<PageData<OrderInfo>> GetAllOrderInfo(string Name, string OrderrNo, DateTime? OrderDate, int? take, int? skip);
|
public Task<PageData<OrderInfo>> GetAllOrderInfo(string Name, string BoxNum, string PatientName,string OrderrNo, DateTime? OrderDate, int? take, int? skip);
|
||||||
|
|
||||||
|
public Task<PageData<ChannelStock>> GetAllOrderInfoDrugByBox(BoxModel boxNum, string roomName, DateTime? OrderDate);
|
||||||
//获取麻醉师信息
|
//获取麻醉师信息
|
||||||
public Task<List<Anaesthetist>> GetAnaesthetistName();
|
public Task<List<Anaesthetist>> GetAnaesthetistName();
|
||||||
//获取麻醉师单对应的手术间号
|
//获取麻醉师单对应的手术间号
|
||||||
public Task<List<BoxModel>> GetOperationNum(string anaesthetistName);
|
public Task<List<BoxModel>> GetOperationNum(int boxColor);
|
||||||
|
//获取麻醉师单对应的手术间号(查询全部手术间已绑套餐的手术间)
|
||||||
|
public Task<List<BoxModel>> GetAllBindOperationNum();
|
||||||
//获取所有药盒号
|
//获取所有药盒号
|
||||||
public Task<List<ChannelStock>> GetDrawerNum(string machineId);
|
public Task<List<ChannelStock>> GetDrawerNum(string machineId);
|
||||||
/// 获取指定药盒号
|
/// 获取指定药盒号
|
||||||
public Task<List<BoxModel>> GetDrawerNumByOperationNum(string machineId, List<int> operationNum);
|
public Task<List<BoxModel>> GetDrawerNumByOperationNum(string machineId, List<int> operationNum);
|
||||||
//核对处方
|
//核对处方
|
||||||
public Task<bool> CheckOrderInfo(IList<OrderInfo> selectedOrderInfos, BoxModel boxModel);
|
public Task<bool> CheckOrderInfo(IList<OrderInfo> selectedOrderInfos, BoxModel boxModel);
|
||||||
|
//查询药品对应的库位 drawerType=1药品库位,其他则是回收库位
|
||||||
|
public Task<List<ChannelStock>> GetStockByDRrug(string drugId, string manuNo, int drawerType);
|
||||||
|
//核对处方通过库位下的药品
|
||||||
|
public Task<bool> CheckOrderInfoByChannelStock(IList<ChannelStock> csList, BoxModel boxModel);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -165,7 +165,7 @@ namespace MasaBlazorApp3.DataAccess.Impl
|
||||||
.ToListAsync();
|
.ToListAsync();
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<bool> DrawerOperationFinish(List<ChannelStock> Stocks, int type = 1)
|
public async Task<bool> DrawerOperationFinish(List<ChannelStock> Stocks, int type, BoxModel boxModel, List<ChannelList> channelLists)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|
@ -228,7 +228,10 @@ namespace MasaBlazorApp3.DataAccess.Impl
|
||||||
Quantity = type == 1 ? stock.AddQuantity : stock.TakeQuantity,
|
Quantity = type == 1 ? stock.AddQuantity : stock.TakeQuantity,
|
||||||
Operator = _globalStateService.Operator.Id,
|
Operator = _globalStateService.Operator.Id,
|
||||||
Reviewer = _globalStateService.Reviewer?.Id ?? _globalStateService.Operator.Id,
|
Reviewer = _globalStateService.Reviewer?.Id ?? _globalStateService.Operator.Id,
|
||||||
InvoiceId = InvoiceId
|
InvoiceId = InvoiceId,
|
||||||
|
Status = type == 1 ? 0 : (boxModel != null) ? 0 : 2,
|
||||||
|
BoxDrawer = boxModel == null ? 0 : boxModel.BoxName,
|
||||||
|
BoxColNo = boxModel == null ? 0 : boxModel.BoxNo
|
||||||
});
|
});
|
||||||
// 更新库存
|
// 更新库存
|
||||||
var stockQ = _connection.ChannelStock.Where(cs => cs.Id == stock.Id)
|
var stockQ = _connection.ChannelStock.Where(cs => cs.Id == stock.Id)
|
||||||
|
|
@ -236,7 +239,7 @@ namespace MasaBlazorApp3.DataAccess.Impl
|
||||||
// 入库时如果库存为0则有可能会修改批次效期进行保存
|
// 入库时如果库存为0则有可能会修改批次效期进行保存
|
||||||
if (type == 1 && stock.Quantity == 0 && !stock.drugManuNo.ManuNo.Equals(stock.ManuNo))
|
if (type == 1 && stock.Quantity == 0 && !stock.drugManuNo.ManuNo.Equals(stock.ManuNo))
|
||||||
{
|
{
|
||||||
stockQ = stockQ.Set(cs => cs.ManuNo, stock.drugManuNo.ManuNo).Set(cs => cs.EffDate, stock.drugManuNo.EffDate.ToString()).Set(cs => cs.Dmnguid, stock.drugManuNo.Id);
|
stockQ = stockQ.Set(cs => cs.ManuNo, stock.drugManuNo.ManuNo).Set(cs => cs.EffDate, stock.drugManuNo.EffDate?.ToString("yyyy-MM-dd")).Set(cs => cs.Dmnguid, stock.drugManuNo.Id);
|
||||||
}
|
}
|
||||||
int r = stockQ.Update();
|
int r = stockQ.Update();
|
||||||
// 获取更新完库存之后的药品库存
|
// 获取更新完库存之后的药品库存
|
||||||
|
|
@ -277,6 +280,98 @@ namespace MasaBlazorApp3.DataAccess.Impl
|
||||||
}
|
}
|
||||||
if (flag)
|
if (flag)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
if (boxModel != null)
|
||||||
|
{
|
||||||
|
//抽屉给药盒补药
|
||||||
|
var BoxChannelStock = Stocks.GroupBy(cs => new { cs.DrugId, cs.ManuNo, cs.EffDate }).Select(cs => new
|
||||||
|
{
|
||||||
|
cs.Key.DrugId,
|
||||||
|
cs.Key.ManuNo,
|
||||||
|
cs.Key.EffDate,
|
||||||
|
total = cs.Sum(it => it.TakeQuantity)
|
||||||
|
}).ToList();
|
||||||
|
foreach (var item in BoxChannelStock)
|
||||||
|
{
|
||||||
|
//查询本次加药的药盒里是否有该药品批次库存,有则累计加数量,无则insert记录
|
||||||
|
ChannelStock cs = _connection.ChannelStock.Where(cs => cs.MachineId.Equals(_setting.boxMachineId) && cs.DrawerNo == boxModel.BoxName && cs.ColNo == boxModel.BoxNo && cs.DrugId == item.DrugId && cs.ManuNo == item.ManuNo).FirstOrDefault();
|
||||||
|
if (cs != null)
|
||||||
|
{
|
||||||
|
//存在批次库存,更改数量
|
||||||
|
cs.Quantity += item.total;
|
||||||
|
int iUpdate = await _connection.UpdateAsync(cs);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//不存在批次库存,插入一条批次数据
|
||||||
|
// 保存账册
|
||||||
|
//查询新加的药是否是已绑定的套餐,是则将基数写入,不是则基数记为零
|
||||||
|
int baseQuantity = 0;
|
||||||
|
string listId = string.Empty;
|
||||||
|
ChannelStock csBase = _connection.ChannelStock.Where(cs => cs.MachineId.Equals(_setting.boxMachineId) && cs.DrawerNo == boxModel.BoxName && cs.ColNo == boxModel.BoxNo && cs.DrugId == item.DrugId).FirstOrDefault();
|
||||||
|
if (csBase != null)
|
||||||
|
{
|
||||||
|
baseQuantity = csBase.CheckQuantity;
|
||||||
|
listId = csBase.ListId;
|
||||||
|
}
|
||||||
|
int acid = _connection.InsertWithInt32Identity(new ChannelStock()
|
||||||
|
{
|
||||||
|
Id = "DM5_" + Guid.NewGuid().ToString(),
|
||||||
|
ListId = listId,
|
||||||
|
MachineId = _setting.boxMachineId,
|
||||||
|
DrugId = item.DrugId,
|
||||||
|
ManuNo = item.ManuNo,
|
||||||
|
EffDate = item.EffDate,
|
||||||
|
DrawerNo = boxModel.BoxName,
|
||||||
|
ColNo = boxModel.BoxNo,
|
||||||
|
Quantity = item.total,
|
||||||
|
BaseQuantity = baseQuantity
|
||||||
|
});
|
||||||
|
}
|
||||||
|
//将库存数加入channel_list表
|
||||||
|
ChannelList clList = _connection.ChannelList.Where(cl => cl.MachineId.Equals(_setting.boxMachineId) && cl.DrawerNo == boxModel.BoxName && cl.ColNo == boxModel.BoxNo).FirstOrDefault();
|
||||||
|
if (clList != null)
|
||||||
|
{
|
||||||
|
clList.TotalQuantity += item.total;
|
||||||
|
int iUpdate = await _connection.UpdateAsync(clList);
|
||||||
|
if (iUpdate <= 0)
|
||||||
|
{
|
||||||
|
logger.Info($"抽屉加药记录药盒{boxModel.BoxName}-{boxModel.BoxNo}总库存失败,加药数量{item.total}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//药盒中是否有未绑套餐且库存为0的数据,有则删除
|
||||||
|
_connection.ChannelStock.Where(cs => cs.MachineId.Equals(_setting.boxMachineId) && (string.IsNullOrEmpty(cs.ListId)) && cs.DrawerNo == boxModel.BoxName && cs.ColNo == boxModel.BoxNo && cs.Quantity <= 0).Delete();
|
||||||
|
//删除药盒中已绑套餐中同一药品多批次且库存为0的第一条数据
|
||||||
|
List<ChannelStock> delChannelStock = await _connection.ChannelStock.Where(cs => cs.MachineId.Equals(_setting.boxMachineId) && cs.DrawerNo == boxModel.BoxName && cs.ColNo == boxModel.BoxNo && cs.DrugId == item.DrugId).ToListAsync();
|
||||||
|
if (delChannelStock != null && delChannelStock.Count > 1)
|
||||||
|
{
|
||||||
|
//删除绑定套餐中库存为0的药的批次数据,只保留一条数据
|
||||||
|
//for (int i = 1; i < delChannelStock.Count; i++)
|
||||||
|
//{
|
||||||
|
// _connection.Delete(delChannelStock[i]);
|
||||||
|
//}
|
||||||
|
//删除绑定套餐中库存为0的药的批次数据,只保留一条数据
|
||||||
|
List<ChannelStock> del = delChannelStock.Where(c => c.Quantity <= 0).ToList();
|
||||||
|
if (del != null && del.Count > 0)
|
||||||
|
{
|
||||||
|
if (delChannelStock.Count == del.Count)
|
||||||
|
{
|
||||||
|
for (int j = 1; j < del.Count; j++)
|
||||||
|
{
|
||||||
|
_connection.ChannelStock.Where(cs => cs.Id == del[j].Id).Delete();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
for (int j = 0; j < del.Count; j++)
|
||||||
|
{
|
||||||
|
_connection.ChannelStock.Where(cs => cs.Id == del[j].Id).Delete();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
_connection.CommitTransaction();
|
_connection.CommitTransaction();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
@ -381,7 +476,7 @@ namespace MasaBlazorApp3.DataAccess.Impl
|
||||||
.LoadWith(cs => cs.Drug.Manus)
|
.LoadWith(cs => cs.Drug.Manus)
|
||||||
.Where(cs => cs.DrawerNo == DrawerNo)
|
.Where(cs => cs.DrawerNo == DrawerNo)
|
||||||
.Where(cs => cs.DrugId != String.Empty)
|
.Where(cs => cs.DrugId != String.Empty)
|
||||||
.Where(cs => cs.DrawerType == 1)
|
//.Where(cs => cs.DrawerType == 1)
|
||||||
.Where(cs => cs.MachineId == _setting.machineId);
|
.Where(cs => cs.MachineId == _setting.machineId);
|
||||||
|
|
||||||
if (Quantity > 0)
|
if (Quantity > 0)
|
||||||
|
|
@ -608,7 +703,7 @@ namespace MasaBlazorApp3.DataAccess.Impl
|
||||||
/// 手术室药盒绑定套餐
|
/// 手术室药盒绑定套餐
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public async Task<bool> BindBox(ChannelList list,Plan plan)
|
public async Task<bool> BindBox(ChannelList list, Plan plan)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|
@ -631,7 +726,7 @@ namespace MasaBlazorApp3.DataAccess.Impl
|
||||||
ListId = list.Id,
|
ListId = list.Id,
|
||||||
MachineId = list.MachineId,
|
MachineId = list.MachineId,
|
||||||
DrawerNo = list.DrawerNo,
|
DrawerNo = list.DrawerNo,
|
||||||
ColNo=list.ColNo,
|
ColNo = list.ColNo,
|
||||||
DrugId = planInfos[i].DrugId.ToString(),
|
DrugId = planInfos[i].DrugId.ToString(),
|
||||||
BaseQuantity = planInfos[i].BaseQuantity,
|
BaseQuantity = planInfos[i].BaseQuantity,
|
||||||
//BoxState = 1
|
//BoxState = 1
|
||||||
|
|
@ -708,7 +803,7 @@ namespace MasaBlazorApp3.DataAccess.Impl
|
||||||
ListId = list.Id,
|
ListId = list.Id,
|
||||||
MachineId = list.MachineId,
|
MachineId = list.MachineId,
|
||||||
DrawerNo = list.DrawerNo,
|
DrawerNo = list.DrawerNo,
|
||||||
ColNo=list.ColNo,
|
ColNo = list.ColNo,
|
||||||
DrugId = planInfos[i].DrugId.ToString(),
|
DrugId = planInfos[i].DrugId.ToString(),
|
||||||
BaseQuantity = planInfos[i].BaseQuantity,
|
BaseQuantity = planInfos[i].BaseQuantity,
|
||||||
//BoxState = 1
|
//BoxState = 1
|
||||||
|
|
@ -820,16 +915,16 @@ namespace MasaBlazorApp3.DataAccess.Impl
|
||||||
List<ChannelList> channelLists = new List<ChannelList>();
|
List<ChannelList> channelLists = new List<ChannelList>();
|
||||||
var query = _connection.ChannelStock//.AsQueryable()
|
var query = _connection.ChannelStock//.AsQueryable()
|
||||||
.Where(cs => cs.MachineId == _setting.boxMachineId)
|
.Where(cs => cs.MachineId == _setting.boxMachineId)
|
||||||
.GroupBy(cs => new { cs.DrawerNo,cs.ColNo, cs.DrugId })
|
.GroupBy(cs => new { cs.DrawerNo, cs.ColNo, cs.DrugId })
|
||||||
.Select(g => new
|
.Select(g => new
|
||||||
{
|
{
|
||||||
DrawerNo = g.Key.DrawerNo,
|
DrawerNo = g.Key.DrawerNo,
|
||||||
DrugId = g.Key.DrugId,
|
DrugId = g.Key.DrugId,
|
||||||
ColNo=g.Key.ColNo,
|
ColNo = g.Key.ColNo,
|
||||||
sumQuantity = g.Sum(cs => cs.Quantity),
|
sumQuantity = g.Sum(cs => cs.Quantity),
|
||||||
baseQuantity = g.Max(cs => cs.BaseQuantity),
|
baseQuantity = g.Max(cs => cs.BaseQuantity),
|
||||||
sumAdd=g.Sum(cs=>cs.AddToQuantity)
|
sumAdd = g.Sum(cs => cs.AddToQuantity)
|
||||||
}).Where(x => x.baseQuantity > x.sumQuantity+x.sumAdd)
|
}).Where(x => x.baseQuantity > x.sumQuantity + x.sumAdd)
|
||||||
.ToList();
|
.ToList();
|
||||||
|
|
||||||
var queryChannelStock = _connection.ChannelStock.AsQueryable()
|
var queryChannelStock = _connection.ChannelStock.AsQueryable()
|
||||||
|
|
@ -842,9 +937,9 @@ namespace MasaBlazorApp3.DataAccess.Impl
|
||||||
{
|
{
|
||||||
foreach (var item in query)
|
foreach (var item in query)
|
||||||
{
|
{
|
||||||
if (queryList[i].DrawerNo == item.DrawerNo && queryList[i].ColNo==item.ColNo)
|
if (queryList[i].DrawerNo == item.DrawerNo && queryList[i].ColNo == item.ColNo)
|
||||||
{
|
{
|
||||||
ChannelStock stock = queryChannelStock.Where(cs => cs.DrawerNo == item.DrawerNo && cs.ColNo==item.ColNo&&cs.DrugId == item.DrugId && cs.BaseQuantity > item.sumQuantity).FirstOrDefault();
|
ChannelStock stock = queryChannelStock.Where(cs => cs.DrawerNo == item.DrawerNo && cs.ColNo == item.ColNo && cs.DrugId == item.DrugId && cs.BaseQuantity > item.sumQuantity).FirstOrDefault();
|
||||||
if (stock != null)
|
if (stock != null)
|
||||||
{
|
{
|
||||||
stock.NeedQuantity = stock.BaseQuantity - item.sumQuantity;
|
stock.NeedQuantity = stock.BaseQuantity - item.sumQuantity;
|
||||||
|
|
@ -917,7 +1012,7 @@ namespace MasaBlazorApp3.DataAccess.Impl
|
||||||
List<ChannelStock> stockList = await _connection.ChannelStock
|
List<ChannelStock> stockList = await _connection.ChannelStock
|
||||||
.Where(cs => cs.MachineId == _setting.machineId && cs.DrawerType == 1 && cs.DrugId == boxCs.DrugId && cs.Quantity > 0 && cs.ManuNo != null)
|
.Where(cs => cs.MachineId == _setting.machineId && cs.DrawerType == 1 && cs.DrugId == boxCs.DrugId && cs.Quantity > 0 && cs.ManuNo != null)
|
||||||
.AsQueryable()
|
.AsQueryable()
|
||||||
.OrderBy(cs => cs.EffDate).ToListAsync();
|
.OrderBy(cs => new { cs.EffDate, cs.Quantity }).ToListAsync();
|
||||||
|
|
||||||
// 当前药品的库存总量
|
// 当前药品的库存总量
|
||||||
var total = stockList.Sum(current => current.Quantity);
|
var total = stockList.Sum(current => current.Quantity);
|
||||||
|
|
@ -990,7 +1085,6 @@ namespace MasaBlazorApp3.DataAccess.Impl
|
||||||
{
|
{
|
||||||
return tempData2;
|
return tempData2;
|
||||||
}
|
}
|
||||||
return tempData;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
|
|
@ -1052,7 +1146,7 @@ namespace MasaBlazorApp3.DataAccess.Impl
|
||||||
EffDate = !String.IsNullOrEmpty(EffDate) ? DateTime.ParseExact(EffDate, "yyyy-MM-dd", System.Globalization.CultureInfo.CurrentCulture) : null,
|
EffDate = !String.IsNullOrEmpty(EffDate) ? DateTime.ParseExact(EffDate, "yyyy-MM-dd", System.Globalization.CultureInfo.CurrentCulture) : null,
|
||||||
OperationTime = DateTime.Now,
|
OperationTime = DateTime.Now,
|
||||||
Type = 2,
|
Type = 2,
|
||||||
Status=2,//给交接柜补药不需要还药或还空瓶
|
Status = 2,//给交接柜补药不需要还药或还空瓶
|
||||||
Quantity = boxTakeVo.GetQuantity,
|
Quantity = boxTakeVo.GetQuantity,
|
||||||
Operator = _globalStateService.Operator.Id,
|
Operator = _globalStateService.Operator.Id,
|
||||||
Reviewer = _globalStateService.Reviewer?.Id ?? _globalStateService.Operator.Id,
|
Reviewer = _globalStateService.Reviewer?.Id ?? _globalStateService.Operator.Id,
|
||||||
|
|
@ -1092,7 +1186,7 @@ namespace MasaBlazorApp3.DataAccess.Impl
|
||||||
#endregion
|
#endregion
|
||||||
//查询药盒中是否有该批次药品,有则把对应数量累加,无则insert
|
//查询药盒中是否有该批次药品,有则把对应数量累加,无则insert
|
||||||
ChannelStock? BoxChannelStock = _connection.ChannelStock.AsQueryable()
|
ChannelStock? BoxChannelStock = _connection.ChannelStock.AsQueryable()
|
||||||
.Where(cs => cs.MachineId == boxTakeVo.BoxDetail.MachineId && cs.DrawerNo == boxTakeVo.BoxDetail.DrawerNo&&cs.ColNo==boxTakeVo.BoxDetail.ColNo && cs.DrugId == boxTakeVo.ChannelStock.DrugId && cs.ManuNo == boxTakeVo.ChannelStock.ManuNo && cs.EffDate == EffDate).FirstOrDefault();
|
.Where(cs => cs.MachineId.Equals(_setting.boxMachineId) && cs.DrawerNo == boxTakeVo.BoxDetail.DrawerNo && cs.ColNo == boxTakeVo.BoxDetail.ColNo && cs.DrugId == boxTakeVo.ChannelStock.DrugId && cs.ManuNo == boxTakeVo.ChannelStock.ManuNo && cs.EffDate == EffDate).FirstOrDefault();
|
||||||
int boxID = 0;
|
int boxID = 0;
|
||||||
if (BoxChannelStock != null)
|
if (BoxChannelStock != null)
|
||||||
{
|
{
|
||||||
|
|
@ -1111,7 +1205,7 @@ namespace MasaBlazorApp3.DataAccess.Impl
|
||||||
ListId = boxTakeVo.BoxDetail.ListId,
|
ListId = boxTakeVo.BoxDetail.ListId,
|
||||||
MachineId = _setting.boxMachineId,
|
MachineId = _setting.boxMachineId,
|
||||||
DrawerNo = boxTakeVo.BoxDetail.DrawerNo,
|
DrawerNo = boxTakeVo.BoxDetail.DrawerNo,
|
||||||
ColNo=boxTakeVo.BoxDetail.ColNo,
|
ColNo = boxTakeVo.BoxDetail.ColNo,
|
||||||
//AddToQuantity = boxTakeVo.Quantity,//boxTakeVo.GetQuantity,
|
//AddToQuantity = boxTakeVo.Quantity,//boxTakeVo.GetQuantity,
|
||||||
//NeedQuantity = 0,
|
//NeedQuantity = 0,
|
||||||
Quantity = boxTakeVo.GetQuantity,
|
Quantity = boxTakeVo.GetQuantity,
|
||||||
|
|
@ -1129,7 +1223,7 @@ namespace MasaBlazorApp3.DataAccess.Impl
|
||||||
{
|
{
|
||||||
MachineId = _setting.machineId,
|
MachineId = _setting.machineId,
|
||||||
DrawerNo = boxTakeVo.BoxDetail.DrawerNo,
|
DrawerNo = boxTakeVo.BoxDetail.DrawerNo,
|
||||||
ColNo=boxTakeVo.BoxDetail.ColNo,
|
ColNo = boxTakeVo.BoxDetail.ColNo,
|
||||||
DrugId = boxTakeVo.ChannelStock.DrugId,
|
DrugId = boxTakeVo.ChannelStock.DrugId,
|
||||||
ManuNo = boxTakeVo.ChannelStock.ManuNo,
|
ManuNo = boxTakeVo.ChannelStock.ManuNo,
|
||||||
EffDate = !String.IsNullOrEmpty(EffDate) ? DateTime.ParseExact(EffDate, "yyyy-MM-dd", System.Globalization.CultureInfo.CurrentCulture) : null,
|
EffDate = !String.IsNullOrEmpty(EffDate) ? DateTime.ParseExact(EffDate, "yyyy-MM-dd", System.Globalization.CultureInfo.CurrentCulture) : null,
|
||||||
|
|
@ -1139,8 +1233,8 @@ namespace MasaBlazorApp3.DataAccess.Impl
|
||||||
Operator = _globalStateService.Operator.Id,
|
Operator = _globalStateService.Operator.Id,
|
||||||
Reviewer = _globalStateService.Reviewer?.Id ?? _globalStateService.Operator.Id,
|
Reviewer = _globalStateService.Reviewer?.Id ?? _globalStateService.Operator.Id,
|
||||||
InvoiceId = boxTakeVo.ChannelStock.Id.ToString(),
|
InvoiceId = boxTakeVo.ChannelStock.Id.ToString(),
|
||||||
});
|
});
|
||||||
int delResutl = await _connection.ChannelStock.Where(cs => cs.MachineId == boxTakeVo.BoxDetail.MachineId && cs.DrugId == boxTakeVo.BoxDetail.DrugId&&cs.DrawerNo==boxTakeVo.BoxDetail.DrawerNo && cs.ColNo == boxTakeVo.BoxDetail.ColNo && cs.ManuNo == null).DeleteAsync();
|
int delResutl = await _connection.ChannelStock.Where(cs => cs.MachineId == boxTakeVo.BoxDetail.MachineId && cs.DrugId == boxTakeVo.BoxDetail.DrugId && cs.DrawerNo == boxTakeVo.BoxDetail.DrawerNo && cs.ColNo == boxTakeVo.BoxDetail.ColNo && cs.ManuNo == null).DeleteAsync();
|
||||||
if (mid > 0 && r > 0 && boxID > 0 && boxMId > 0)
|
if (mid > 0 && r > 0 && boxID > 0 && boxMId > 0)
|
||||||
{
|
{
|
||||||
if (boxTakeVo.ChannelStock.BoardType.ToString().Contains("5"))
|
if (boxTakeVo.ChannelStock.BoardType.ToString().Contains("5"))
|
||||||
|
|
@ -1254,7 +1348,7 @@ namespace MasaBlazorApp3.DataAccess.Impl
|
||||||
List<ChannelStock> csList = _connection.ChannelStock.Where(cs => cs.DrawerNo == item.DrawerNo && cs.DrugId == item.DrugId && cs.BoxState == 2).ToList();
|
List<ChannelStock> csList = _connection.ChannelStock.Where(cs => cs.DrawerNo == item.DrawerNo && cs.DrugId == item.DrugId && cs.BoxState == 2).ToList();
|
||||||
for (int i = 0; i < csList.Count; i++)
|
for (int i = 0; i < csList.Count; i++)
|
||||||
{
|
{
|
||||||
var existingItem = manuList.FirstOrDefault(item => item.DrugId == csList[i].DrugId && item.ManuNo == csList[i].ManuNo&& item.EffDate.ToString() == csList[i].EffDate);
|
var existingItem = manuList.FirstOrDefault(item => item.DrugId == csList[i].DrugId && item.ManuNo == csList[i].ManuNo && item.EffDate.ToString() == csList[i].EffDate);
|
||||||
if (existingItem != null)
|
if (existingItem != null)
|
||||||
{
|
{
|
||||||
existingItem.Quantity += csList[i].AddToQuantity;
|
existingItem.Quantity += csList[i].AddToQuantity;
|
||||||
|
|
@ -1366,12 +1460,12 @@ namespace MasaBlazorApp3.DataAccess.Impl
|
||||||
});
|
});
|
||||||
// 更新库存
|
// 更新库存
|
||||||
ChannelStock? updateChannelStock = _connection.ChannelStock.AsQueryable()
|
ChannelStock? updateChannelStock = _connection.ChannelStock.AsQueryable()
|
||||||
.Where(cs => cs.DrawerNo == boxChannelList.ChannelStocks[i].DrawerNo && cs.DrugId == boxChannelList.ChannelStocks[i].drugManuNoList[j].DrugId&&cs.ManuNo== boxChannelList.ChannelStocks[i].drugManuNoList[j].ManuNo&&cs.EffDate == EffDate)
|
.Where(cs => cs.DrawerNo == boxChannelList.ChannelStocks[i].DrawerNo && cs.DrugId == boxChannelList.ChannelStocks[i].drugManuNoList[j].DrugId && cs.ManuNo == boxChannelList.ChannelStocks[i].drugManuNoList[j].ManuNo && cs.EffDate == EffDate)
|
||||||
.FirstOrDefault();
|
.FirstOrDefault();
|
||||||
int r = 0;
|
int r = 0;
|
||||||
if (updateChannelStock != null)
|
if (updateChannelStock != null)
|
||||||
{
|
{
|
||||||
updateChannelStock.Quantity = updateChannelStock.Quantity+ boxChannelList.ChannelStocks[i].drugManuNoList[j].Quantity;
|
updateChannelStock.Quantity = updateChannelStock.Quantity + boxChannelList.ChannelStocks[i].drugManuNoList[j].Quantity;
|
||||||
updateChannelStock.AddToQuantity = 0;
|
updateChannelStock.AddToQuantity = 0;
|
||||||
updateChannelStock.NeedQuantity = 0;
|
updateChannelStock.NeedQuantity = 0;
|
||||||
updateChannelStock.BoxState = 0;
|
updateChannelStock.BoxState = 0;
|
||||||
|
|
@ -1440,7 +1534,26 @@ namespace MasaBlazorApp3.DataAccess.Impl
|
||||||
(pd, cl) => pd.PlanId.ToString() == cl.DrugId,
|
(pd, cl) => pd.PlanId.ToString() == cl.DrugId,
|
||||||
(pd, cl) => pd).Where(pd => pd.UseState == 1);
|
(pd, cl) => pd).Where(pd => pd.UseState == 1);
|
||||||
|
|
||||||
|
//查询不在套餐中的药
|
||||||
|
List<ChannelStock> outOfPlanStock = await _connection.ChannelStock
|
||||||
|
.Where(cs => cs.MachineId == _setting.boxMachineId && cs.DrawerNo.Equals(drawerNo) && cs.ColNo.Equals(colNo) && string.IsNullOrEmpty(cs.ListId))
|
||||||
|
.LoadWith(cs => cs.Drug)
|
||||||
|
.LoadWith(cs => cs.Drug.Manus)
|
||||||
|
.ToListAsync();
|
||||||
|
List<PlanDetails> outOfPlanDetailList = new();
|
||||||
|
if (outOfPlanStock != null && outOfPlanStock.Count > 0)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < outOfPlanStock.Count; i++)
|
||||||
|
{
|
||||||
|
outOfPlanDetailList.Add(new PlanDetails()
|
||||||
|
{
|
||||||
|
_DrugInfo = outOfPlanStock[i].Drug,
|
||||||
|
channelStocks = outOfPlanStock,
|
||||||
|
_ManuNo = null
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
int pagedData = await query.CountAsync();
|
int pagedData = await query.CountAsync();
|
||||||
|
|
||||||
|
|
@ -1449,8 +1562,8 @@ namespace MasaBlazorApp3.DataAccess.Impl
|
||||||
//.LoadWith(pd => cl._PlanDetails._DrugInfo)
|
//.LoadWith(pd => cl._PlanDetails._DrugInfo)
|
||||||
.OrderBy((pd) => pd.DrugId)
|
.OrderBy((pd) => pd.DrugId)
|
||||||
//.ThenBy((cl) => cl.ColNo)
|
//.ThenBy((cl) => cl.ColNo)
|
||||||
.Skip((int)skip)
|
//.Skip((int)skip)
|
||||||
.Take((int)take)
|
//.Take((int)take)
|
||||||
.ToListAsync();
|
.ToListAsync();
|
||||||
if (list != null && list.Count > 0)
|
if (list != null && list.Count > 0)
|
||||||
{
|
{
|
||||||
|
|
@ -1463,6 +1576,13 @@ namespace MasaBlazorApp3.DataAccess.Impl
|
||||||
.ToList();
|
.ToList();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (outOfPlanDetailList != null && outOfPlanDetailList.Count > 0)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < outOfPlanDetailList.Count; i++)
|
||||||
|
{
|
||||||
|
list.Add(outOfPlanDetailList[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//List<ChannelStock> list = await query
|
//List<ChannelStock> list = await query
|
||||||
// .LoadWith(cl => cl.Drug)
|
// .LoadWith(cl => cl.Drug)
|
||||||
|
|
@ -1492,35 +1612,71 @@ namespace MasaBlazorApp3.DataAccess.Impl
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
int drawerNo = 0;
|
int drawerNo = 0;
|
||||||
int colNo = 0;
|
int colNo = 0;
|
||||||
var spl = strDrawerNoCol.Split('-');
|
var spl = strDrawerNoCol.Split('-');
|
||||||
if (spl != null && spl.Count() > 0)
|
if (spl != null && spl.Count() > 0)
|
||||||
|
{
|
||||||
|
drawerNo = Convert.ToInt32(spl[0]);
|
||||||
|
if (drawerNo > 30)
|
||||||
{
|
{
|
||||||
drawerNo = Convert.ToInt32(spl[0]);
|
|
||||||
colNo = Convert.ToInt32(spl[1]);
|
colNo = Convert.ToInt32(spl[1]);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
var query = _connection.ChannelStock.AsQueryable().Where(c => c.MachineId == _setting.boxMachineId && c.DrawerNo.Equals(drawerNo) && c.ColNo.Equals(colNo) && c.DrugId.Equals(cs.DrugId) && c.ManuNo != cs.ManuNo && c.EffDate != cs.EffDate);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
int pagedData = await query.CountAsync();
|
|
||||||
|
|
||||||
List<ChannelStock> list = await query
|
|
||||||
.LoadWith(cs => cs.Drug)
|
|
||||||
.OrderBy((cs) => cs.DrugId)
|
|
||||||
.Skip((int)skip)
|
|
||||||
.Take((int)take)
|
|
||||||
.ToListAsync();
|
|
||||||
|
|
||||||
return new PageData<ChannelStock>()
|
|
||||||
{
|
{
|
||||||
|
colNo = Convert.ToInt32(spl[1] == "白" ? 1 : 2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//else if (strDrawerNoCol.Length > 0)
|
||||||
|
//{
|
||||||
|
// switch (strDrawerNoCol)
|
||||||
|
// {
|
||||||
|
// case "胃镜药盒":
|
||||||
|
// drawerNo = 31;
|
||||||
|
// colNo = 1;
|
||||||
|
// break;
|
||||||
|
// case "导管药盒":
|
||||||
|
// drawerNo = 32;
|
||||||
|
// colNo = 1;
|
||||||
|
// break;
|
||||||
|
// case "生殖药盒":
|
||||||
|
// drawerNo = 33;
|
||||||
|
// colNo = 1;
|
||||||
|
// break;
|
||||||
|
// case "妇门药盒":
|
||||||
|
// drawerNo = 34;
|
||||||
|
// colNo = 1;
|
||||||
|
// break;
|
||||||
|
// case "急诊药盒":
|
||||||
|
// drawerNo = 99;
|
||||||
|
// colNo = 1;
|
||||||
|
// break;
|
||||||
|
// case "恢复室药盒":
|
||||||
|
// drawerNo = 111;
|
||||||
|
// colNo = 1;
|
||||||
|
// break;
|
||||||
|
// }
|
||||||
|
//}
|
||||||
|
|
||||||
|
var query = _connection.ChannelStock.AsQueryable().Where(c => c.MachineId == _setting.boxMachineId && c.DrawerNo.Equals(drawerNo) && c.ColNo.Equals(colNo) && c.DrugId.Equals(cs.DrugId) && c.ManuNo != cs.ManuNo);
|
||||||
|
int pagedData = await query.CountAsync();
|
||||||
|
|
||||||
|
List<ChannelStock> list = await query
|
||||||
|
.LoadWith(cs => cs.Drug)
|
||||||
|
.OrderBy((cs) => cs.DrugId)
|
||||||
|
.Skip((int)skip)
|
||||||
|
.Take((int)take)
|
||||||
|
.ToListAsync();
|
||||||
|
|
||||||
|
return new PageData<ChannelStock>()
|
||||||
|
{
|
||||||
|
|
||||||
|
TotalDesserts = pagedData,
|
||||||
|
Desserts = list
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
TotalDesserts = pagedData,
|
|
||||||
Desserts = list
|
|
||||||
};
|
|
||||||
|
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
|
@ -1537,8 +1693,12 @@ namespace MasaBlazorApp3.DataAccess.Impl
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public async Task<string[]> GetDrawerNum(ChannelStock channelStock)
|
public async Task<string[]> GetDrawerNum(ChannelStock channelStock)
|
||||||
{
|
{
|
||||||
string[] stringArray = _connection.ChannelStock.Where(cs => cs.MachineId == channelStock.MachineId && cs.DrugId == channelStock.DrugId && cs.DrawerNo != channelStock.DrawerNo && !string.IsNullOrEmpty(cs.ManuNo) && cs.ManuNo != channelStock.ManuNo)
|
//string[] stringArray = _connection.ChannelStock.Where(cs => cs.MachineId == channelStock.MachineId && cs.DrugId == channelStock.DrugId && cs.DrawerNo != channelStock.DrawerNo && !string.IsNullOrEmpty(cs.ManuNo) && cs.ManuNo != channelStock.ManuNo)
|
||||||
.GroupBy(cs =>new { cs.DrawerNo, cs.ColNo }).Select(cs => cs.Key.DrawerNo.ToString()+"-"+cs.Key.ColNo.ToString()).ToArray();
|
// .GroupBy(cs => new { cs.DrawerNo, cs.ColNo }).Select(cs => cs.Key.DrawerNo == 99 ? "急诊药盒" : cs.Key.DrawerNo == 111 ? "恢复室药盒" : cs.Key.DrawerNo == 31 ? "胃镜药盒" : cs.Key.DrawerNo == 32 ? "导管药盒" : cs.Key.DrawerNo == 33 ? "生殖药盒" : cs.Key.DrawerNo == 34 ? "妇门药盒" : cs.Key.DrawerNo.ToString() + "-" + (cs.Key.ColNo == 1 ? "白" : "绿")).ToArray();
|
||||||
|
//return stringArray;
|
||||||
|
string[] stringArray = _connection.ChannelStock.Where(cs => cs.MachineId == channelStock.MachineId && cs.DrugId == channelStock.DrugId && !string.IsNullOrEmpty(cs.ManuNo) && cs.ManuNo != channelStock.ManuNo && (cs.DrawerNo == channelStock.DrawerNo && cs.ColNo != channelStock.ColNo || cs.DrawerNo != channelStock.DrawerNo))
|
||||||
|
.GroupBy(cs => new { cs.DrawerNo, cs.ColNo })
|
||||||
|
.Select(cs => cs.Key.DrawerNo == 99 ? "急诊药盒" : cs.Key.DrawerNo == 111 ? "恢复室药盒" : cs.Key.DrawerNo == 31 ? "胃镜药盒" : cs.Key.DrawerNo == 32 ? "导管药盒" : cs.Key.DrawerNo == 33 ? "生殖药盒" : cs.Key.DrawerNo == 34 ? "妇门药盒" : cs.Key.DrawerNo.ToString() + "-" + (cs.Key.ColNo == 1 ? "白" : "绿")).ToArray();
|
||||||
return stringArray;
|
return stringArray;
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
@ -1548,8 +1708,12 @@ namespace MasaBlazorApp3.DataAccess.Impl
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public async Task<string[]> GetDrawerNumForRemove(ChannelStock channelStock)
|
public async Task<string[]> GetDrawerNumForRemove(ChannelStock channelStock)
|
||||||
{
|
{
|
||||||
string[] stringArray = _connection.ChannelStock.Where(cs => cs.MachineId == channelStock.MachineId && cs.DrugId == channelStock.DrugId && cs.DrawerNo != channelStock.DrawerNo&&cs.ColNo!=channelStock.ColNo).GroupBy(cs => new { cs.DrawerNo, cs.ColNo }).Select(cs => cs.Key.DrawerNo.ToString()+"-"+cs.Key.ColNo.ToString()).ToArray();
|
string[] stringArray = _connection.ChannelStock.Where(cs => cs.MachineId == channelStock.MachineId && (cs.DrawerNo == channelStock.DrawerNo && cs.ColNo != channelStock.ColNo || cs.DrawerNo != channelStock.DrawerNo))
|
||||||
return stringArray;
|
.GroupBy(cs => new { cs.DrawerNo, cs.ColNo })
|
||||||
|
.Select(cs => cs.Key.DrawerNo == 99 ? "急诊药盒" : cs.Key.DrawerNo == 111 ? "恢复室药盒" : cs.Key.DrawerNo == 31 ? "胃镜药盒" : cs.Key.DrawerNo == 32 ? "导管药盒" : cs.Key.DrawerNo == 33 ? "生殖药盒" : cs.Key.DrawerNo == 34 ? "妇门药盒" : cs.Key.DrawerNo.ToString() + "-" + (cs.Key.ColNo == 1 ? "白" : "绿")).ToArray();
|
||||||
|
string[] stringDrawer = _connection.ChannelStock.Where(cs => cs.MachineId == _setting.machineId && cs.DrugId == channelStock.DrugId && cs.ManuNo == channelStock.ManuNo).Select(cs => cs.Location).ToArray();
|
||||||
|
string[] resultArr = stringArray.Concat(stringDrawer).ToArray();
|
||||||
|
return resultArr;
|
||||||
}
|
}
|
||||||
//手术室药盒交换药品完成
|
//手术室药盒交换药品完成
|
||||||
public async Task<bool> BoxReplaceFinish(ChannelStock stock, List<ChannelStock> stockList)
|
public async Task<bool> BoxReplaceFinish(ChannelStock stock, List<ChannelStock> stockList)
|
||||||
|
|
@ -1562,7 +1726,7 @@ namespace MasaBlazorApp3.DataAccess.Impl
|
||||||
{
|
{
|
||||||
//查询出药的药盒是否有该批次的药品
|
//查询出药的药盒是否有该批次的药品
|
||||||
ChannelStock replace1ChannelStock = _connection.ChannelStock.AsQueryable()
|
ChannelStock replace1ChannelStock = _connection.ChannelStock.AsQueryable()
|
||||||
.Where(cs => cs.MachineId == stockList[i].MachineId && cs.DrawerNo == stock.DrawerNo && cs.DrugId == stockList[i].DrugId && cs.ManuNo == stockList[i].ManuNo && cs.EffDate == stockList[i].EffDate)
|
.Where(cs => cs.MachineId.Equals(_setting.boxMachineId) && cs.DrawerNo == stock.DrawerNo && cs.ColNo == stock.ColNo && cs.DrugId == stockList[i].DrugId && cs.ManuNo == stockList[i].ManuNo)
|
||||||
.FirstOrDefault();
|
.FirstOrDefault();
|
||||||
if (replace1ChannelStock != null)
|
if (replace1ChannelStock != null)
|
||||||
{
|
{
|
||||||
|
|
@ -1572,22 +1736,26 @@ namespace MasaBlazorApp3.DataAccess.Impl
|
||||||
.Update();
|
.Update();
|
||||||
if (r <= 0)
|
if (r <= 0)
|
||||||
{
|
{
|
||||||
logger.Info($"更新药盒药品数量失败,药盒号:{stockList[i].DrawerNo},药品ID:{stockList[i].DrugId}");
|
logger.Info($"更新药盒药品数量失败,药盒号:{stockList[i].Location},药品ID:{stockList[i].DrugId}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
//如果没有该批次的药品,则新增一条记录
|
//如果没有该批次的药品,则新增一条批次数据
|
||||||
int mid = _connection.Insert(new ChannelStock()
|
int mid = _connection.Insert(new ChannelStock()
|
||||||
{
|
{
|
||||||
Id = Guid.NewGuid().ToString(),
|
Id = Guid.NewGuid().ToString(),
|
||||||
MachineId = stockList[i].MachineId,
|
ListId = stock.ListId,
|
||||||
|
MachineId = _setting.boxMachineId,
|
||||||
DrawerNo = stock.DrawerNo,
|
DrawerNo = stock.DrawerNo,
|
||||||
DrugId = stockList[i].DrugId,
|
ColNo = stock.ColNo,
|
||||||
|
DrugId = stock.DrugId,
|
||||||
ManuNo = stockList[i].ManuNo,
|
ManuNo = stockList[i].ManuNo,
|
||||||
EffDate = stockList[i].EffDate,
|
EffDate = stockList[i].EffDate,
|
||||||
|
DrawerType = stock.DrawerType,
|
||||||
|
BoardType = stock.BoardType,
|
||||||
Quantity = stockList[i].AddToQuantity,
|
Quantity = stockList[i].AddToQuantity,
|
||||||
BaseQuantity = stockList[i].BaseQuantity,
|
BaseQuantity = stock.BaseQuantity,
|
||||||
//BoxState = 1
|
//BoxState = 1
|
||||||
});
|
});
|
||||||
if (mid <= 0)
|
if (mid <= 0)
|
||||||
|
|
@ -1603,6 +1771,7 @@ namespace MasaBlazorApp3.DataAccess.Impl
|
||||||
{
|
{
|
||||||
MachineId = stock.MachineId,
|
MachineId = stock.MachineId,
|
||||||
DrawerNo = stock.DrawerNo,
|
DrawerNo = stock.DrawerNo,
|
||||||
|
ColNo = stock.ColNo,
|
||||||
DrugId = stock.DrugId,
|
DrugId = stock.DrugId,
|
||||||
ManuNo = stock.ManuNo,
|
ManuNo = stock.ManuNo,
|
||||||
EffDate = !String.IsNullOrEmpty(stock.EffDate) ? DateTime.ParseExact(stock.EffDate, "yyyy-MM-dd", System.Globalization.CultureInfo.CurrentCulture) : null,
|
EffDate = !String.IsNullOrEmpty(stock.EffDate) ? DateTime.ParseExact(stock.EffDate, "yyyy-MM-dd", System.Globalization.CultureInfo.CurrentCulture) : null,
|
||||||
|
|
@ -1611,7 +1780,9 @@ namespace MasaBlazorApp3.DataAccess.Impl
|
||||||
Quantity = stockList[i].AddQuantity,
|
Quantity = stockList[i].AddQuantity,
|
||||||
Operator = _globalStateService.Operator.Id,
|
Operator = _globalStateService.Operator.Id,
|
||||||
Reviewer = _globalStateService.Reviewer?.Id ?? _globalStateService.Operator.Id,
|
Reviewer = _globalStateService.Reviewer?.Id ?? _globalStateService.Operator.Id,
|
||||||
InvoiceId = stockList[i].Id.ToString(),
|
InvoiceId = $"{stock.Location}-{stock.Drug.DrugName}-{stock.ManuNo}与{stockList[i].Location}-{stockList[i].Drug.DrugName}-{stockList[i].ManuNo}交换,交换数量{stockList[i].AddQuantity}",
|
||||||
|
BoxDrawer = stockList[i].DrawerNo,
|
||||||
|
BoxColNo = stockList[i].ColNo
|
||||||
});
|
});
|
||||||
if (recordId <= 0)
|
if (recordId <= 0)
|
||||||
{
|
{
|
||||||
|
|
@ -1624,7 +1795,7 @@ namespace MasaBlazorApp3.DataAccess.Impl
|
||||||
|
|
||||||
//更新入药的药盒中的药品数量
|
//更新入药的药盒中的药品数量
|
||||||
ChannelStock replace2ChannelStock = _connection.ChannelStock.AsQueryable()
|
ChannelStock replace2ChannelStock = _connection.ChannelStock.AsQueryable()
|
||||||
.Where(cs => cs.MachineId == stockList[i].MachineId && cs.DrawerNo == stockList[i].DrawerNo && cs.DrugId == stock.DrugId && cs.ManuNo == stock.ManuNo && cs.EffDate == stock.EffDate)
|
.Where(cs => cs.MachineId.Equals(_setting.boxMachineId) && cs.DrawerNo == stockList[i].DrawerNo && cs.ColNo == stockList[i].ColNo && cs.DrugId == stock.DrugId && cs.ManuNo == stock.ManuNo)
|
||||||
.FirstOrDefault();
|
.FirstOrDefault();
|
||||||
if (replace2ChannelStock != null)
|
if (replace2ChannelStock != null)
|
||||||
{
|
{
|
||||||
|
|
@ -1645,13 +1816,15 @@ namespace MasaBlazorApp3.DataAccess.Impl
|
||||||
int mid = _connection.Insert(new ChannelStock()
|
int mid = _connection.Insert(new ChannelStock()
|
||||||
{
|
{
|
||||||
Id = Guid.NewGuid().ToString(),
|
Id = Guid.NewGuid().ToString(),
|
||||||
MachineId = stockList[i].MachineId,
|
ListId = stockList[i].ListId,
|
||||||
|
MachineId = _setting.boxMachineId,
|
||||||
DrawerNo = stockList[i].DrawerNo,
|
DrawerNo = stockList[i].DrawerNo,
|
||||||
|
ColNo = stockList[i].ColNo,
|
||||||
DrugId = stock.DrugId,
|
DrugId = stock.DrugId,
|
||||||
ManuNo = stock.ManuNo,
|
ManuNo = stock.ManuNo,
|
||||||
EffDate = stock.EffDate,
|
EffDate = stock.EffDate,
|
||||||
Quantity = stockList[i].AddQuantity,
|
Quantity = stockList[i].AddQuantity,
|
||||||
BaseQuantity = stock.BaseQuantity,
|
BaseQuantity = stockList[i].BaseQuantity,
|
||||||
//BoxState = 1
|
//BoxState = 1
|
||||||
});
|
});
|
||||||
if (mid <= 0)
|
if (mid <= 0)
|
||||||
|
|
@ -1662,27 +1835,7 @@ namespace MasaBlazorApp3.DataAccess.Impl
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
//记录操作记录
|
|
||||||
int record2Id = _connection.InsertWithInt32Identity(new MachineRecord()
|
|
||||||
{
|
|
||||||
MachineId = stockList[i].MachineId,
|
|
||||||
DrawerNo = stockList[i].DrawerNo,
|
|
||||||
DrugId = stockList[i].DrugId,
|
|
||||||
ManuNo = stockList[i].ManuNo,
|
|
||||||
EffDate = !String.IsNullOrEmpty(stockList[i].EffDate) ? DateTime.ParseExact(stockList[i].EffDate, "yyyy-MM-dd", System.Globalization.CultureInfo.CurrentCulture) : null,
|
|
||||||
OperationTime = DateTime.Now,
|
|
||||||
Type = 69, //交换
|
|
||||||
Quantity = stockList[i].AddQuantity,
|
|
||||||
Operator = _globalStateService.Operator.Id,
|
|
||||||
Reviewer = _globalStateService.Reviewer?.Id ?? _globalStateService.Operator.Id,
|
|
||||||
InvoiceId = stock.Id.ToString(),
|
|
||||||
});
|
|
||||||
if (record2Id <= 0)
|
|
||||||
{
|
|
||||||
logger.Info($"药盒{stock.DrawerNo}交换药品新增操作记录失败,药盒号:{stockList[i].DrawerNo},药品ID:{stockList[i].DrugId}");
|
|
||||||
flag = false;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
//出库药盒减数量
|
//出库药盒减数量
|
||||||
int updateQuantity = _connection.ChannelStock.Where(cs => cs.Id == stock.Id)
|
int updateQuantity = _connection.ChannelStock.Where(cs => cs.Id == stock.Id)
|
||||||
.Set(cs => cs.Quantity, stock.Quantity - stockList[i].AddQuantity)
|
.Set(cs => cs.Quantity, stock.Quantity - stockList[i].AddQuantity)
|
||||||
|
|
@ -1702,6 +1855,59 @@ namespace MasaBlazorApp3.DataAccess.Impl
|
||||||
logger.Info($"更新入库药盒药品减数量失败,药盒号:{stockList[i].DrawerNo},药品ID:{stockList[i].DrugId}"); flag = false;
|
logger.Info($"更新入库药盒药品减数量失败,药盒号:{stockList[i].DrawerNo},药品ID:{stockList[i].DrugId}"); flag = false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//删除批次库存为零的数据
|
||||||
|
//移出库位里是否有未绑套餐且库存为0的数据,有则删除
|
||||||
|
_connection.ChannelStock.Where(cs => cs.MachineId.Equals(_setting.boxMachineId) && (string.IsNullOrEmpty(cs.ListId)) && cs.DrawerNo == stock.DrawerNo && cs.ColNo == stock.ColNo && cs.Quantity <= 0).Delete();
|
||||||
|
_connection.ChannelStock.Where(cs => cs.MachineId.Equals(_setting.boxMachineId) && (string.IsNullOrEmpty(cs.ListId)) && cs.DrawerNo == stockList[i].DrawerNo && cs.ColNo == stockList[i].ColNo && cs.Quantity <= 0).Delete();
|
||||||
|
//删除绑定套餐中同一药品多批次且库存为0的第一条数据
|
||||||
|
List<ChannelStock> delChannelStock = await _connection.ChannelStock.Where(cs => cs.MachineId.Equals(_setting.boxMachineId) && cs.DrawerNo == stock.DrawerNo && cs.ColNo == stock.ColNo && cs.DrugId == stock.DrugId).ToListAsync();
|
||||||
|
if (delChannelStock != null && delChannelStock.Count > 1)
|
||||||
|
{
|
||||||
|
//删除绑定套餐中库存为0的药的批次数据,只保留一条数据
|
||||||
|
List<ChannelStock> del = delChannelStock.Where(c => c.Quantity <= 0).ToList();
|
||||||
|
if (del != null && del.Count > 0)
|
||||||
|
{
|
||||||
|
if (delChannelStock.Count == del.Count)
|
||||||
|
{
|
||||||
|
for (int j = 1; j < del.Count; j++)
|
||||||
|
{
|
||||||
|
_connection.ChannelStock.Where(cs => cs.Id == del[j].Id).Delete();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
for (int j = 0; j < del.Count; j++)
|
||||||
|
{
|
||||||
|
_connection.ChannelStock.Where(cs => cs.Id == del[j].Id).Delete();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//删除绑定套餐中同一药品多批次且库存为0的第一条数据
|
||||||
|
List<ChannelStock> listChannelStock = await _connection.ChannelStock.Where(cs => cs.MachineId.Equals(_setting.boxMachineId) && cs.DrawerNo == stockList[i].DrawerNo && cs.ColNo == stockList[i].ColNo && cs.DrugId == stockList[i].DrugId).ToListAsync();
|
||||||
|
if (listChannelStock != null && listChannelStock.Count > 1)
|
||||||
|
{
|
||||||
|
//删除绑定套餐中库存为0的药的批次数据,只保留一条数据
|
||||||
|
List<ChannelStock> del = listChannelStock.Where(c => c.Quantity <= 0).ToList();
|
||||||
|
if (del != null && del.Count > 0)
|
||||||
|
{
|
||||||
|
if (listChannelStock.Count == del.Count)
|
||||||
|
{
|
||||||
|
for (int j = 1; j < del.Count; j++)
|
||||||
|
{
|
||||||
|
_connection.ChannelStock.Where(cs => cs.Id == del[j].Id).Delete();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
for (int j = 0; j < del.Count; j++)
|
||||||
|
{
|
||||||
|
_connection.ChannelStock.Where(cs => cs.Id == del[j].Id).Delete();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (flag)
|
if (flag)
|
||||||
{
|
{
|
||||||
|
|
@ -1736,12 +1942,50 @@ namespace MasaBlazorApp3.DataAccess.Impl
|
||||||
if (selectSpl != null && selectSpl.Count() > 0)
|
if (selectSpl != null && selectSpl.Count() > 0)
|
||||||
{
|
{
|
||||||
selectDrawerNo = Convert.ToInt32(selectSpl[0]);
|
selectDrawerNo = Convert.ToInt32(selectSpl[0]);
|
||||||
selectColNo = Convert.ToInt32(selectSpl[1]);
|
selectColNo = Convert.ToInt32(selectSpl[1] == "白" ? 1 : 2);
|
||||||
|
if (selectDrawerNo > 30)
|
||||||
|
{
|
||||||
|
selectColNo = Convert.ToInt32(selectSpl[1]);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
selectColNo = Convert.ToInt32(selectSpl[1] == "白" ? 1 : 2);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
//else if (SelectedDrawerNo.Length > 0)
|
||||||
|
//{
|
||||||
|
// switch (SelectedDrawerNo)
|
||||||
|
// {
|
||||||
|
// case "胃镜药盒":
|
||||||
|
// selectDrawerNo = 31;
|
||||||
|
// selectColNo = 1;
|
||||||
|
// break;
|
||||||
|
// case "导管药盒":
|
||||||
|
// selectDrawerNo = 32;
|
||||||
|
// selectColNo = 1;
|
||||||
|
// break;
|
||||||
|
// case "生殖药盒":
|
||||||
|
// selectDrawerNo = 33;
|
||||||
|
// selectColNo = 1;
|
||||||
|
// break;
|
||||||
|
// case "妇门药盒":
|
||||||
|
// selectDrawerNo = 34;
|
||||||
|
// selectColNo = 1;
|
||||||
|
// break;
|
||||||
|
// case "急诊药盒":
|
||||||
|
// selectDrawerNo = 99;
|
||||||
|
// selectColNo = 1;
|
||||||
|
// break;
|
||||||
|
// case "恢复室药盒":
|
||||||
|
// selectDrawerNo = 111;
|
||||||
|
// selectColNo = 1;
|
||||||
|
// break;
|
||||||
|
// }
|
||||||
|
//}
|
||||||
|
|
||||||
//查询移入的药品是否有库存
|
//查询移入的药品是否有库存
|
||||||
ChannelStock inChannelStock = _connection.ChannelStock.AsQueryable()
|
ChannelStock inChannelStock = _connection.ChannelStock.AsQueryable()
|
||||||
.Where(cs => cs.MachineId == stock.MachineId && cs.DrawerNo == selectDrawerNo && cs.DrawerNo == selectColNo && cs.DrugId == stock.DrugId && cs.ManuNo == stock.ManuNo && cs.EffDate == stock.EffDate)
|
.Where(cs => cs.MachineId == stock.MachineId && cs.DrawerNo == selectDrawerNo && cs.ColNo == selectColNo && cs.DrugId == stock.DrugId && cs.ManuNo == stock.ManuNo)
|
||||||
.FirstOrDefault();
|
.FirstOrDefault();
|
||||||
if (inChannelStock != null)
|
if (inChannelStock != null)
|
||||||
{
|
{
|
||||||
|
|
@ -1758,7 +2002,7 @@ namespace MasaBlazorApp3.DataAccess.Impl
|
||||||
{
|
{
|
||||||
//如果没有该批次的药品,先查询是否有未绑批次的,有则更新批次信息,无则新增一条记录
|
//如果没有该批次的药品,先查询是否有未绑批次的,有则更新批次信息,无则新增一条记录
|
||||||
ChannelStock inDrugChannelStock = _connection.ChannelStock.AsQueryable()
|
ChannelStock inDrugChannelStock = _connection.ChannelStock.AsQueryable()
|
||||||
.Where(cs => cs.MachineId == stock.MachineId && cs.DrawerNo == selectDrawerNo && cs.DrawerNo == selectColNo && cs.DrugId == stock.DrugId)
|
.Where(cs => cs.MachineId == stock.MachineId && cs.DrawerNo == selectDrawerNo && cs.ColNo == selectColNo && cs.DrugId == stock.DrugId && cs.Quantity <= 0)
|
||||||
.FirstOrDefault();
|
.FirstOrDefault();
|
||||||
if (inDrugChannelStock != null)
|
if (inDrugChannelStock != null)
|
||||||
{
|
{
|
||||||
|
|
@ -1780,7 +2024,7 @@ namespace MasaBlazorApp3.DataAccess.Impl
|
||||||
Id = Guid.NewGuid().ToString(),
|
Id = Guid.NewGuid().ToString(),
|
||||||
MachineId = stock.MachineId,
|
MachineId = stock.MachineId,
|
||||||
DrawerNo = selectDrawerNo,
|
DrawerNo = selectDrawerNo,
|
||||||
ColNo= selectColNo,
|
ColNo = selectColNo,
|
||||||
DrugId = stock.DrugId,
|
DrugId = stock.DrugId,
|
||||||
ManuNo = stock.ManuNo,
|
ManuNo = stock.ManuNo,
|
||||||
EffDate = stock.EffDate,
|
EffDate = stock.EffDate,
|
||||||
|
|
@ -1811,19 +2055,21 @@ namespace MasaBlazorApp3.DataAccess.Impl
|
||||||
int updateTotalQuantity = 0;
|
int updateTotalQuantity = 0;
|
||||||
int updateMoveToTotalQuantity = 0;
|
int updateMoveToTotalQuantity = 0;
|
||||||
//修改总库存数
|
//修改总库存数
|
||||||
ChannelList channelList = _connection.ChannelList.Where(cl => cl.MachineId == stock.MachineId && cl.DrawerNo == stock.DrawerNo && cl.DrugId == stock.DrugId).FirstOrDefault();
|
ChannelList channelList = _connection.ChannelList.Where(cl => cl.MachineId.Equals(_setting.boxMachineId) && cl.DrawerNo == stock.DrawerNo && cl.ColNo == stock.ColNo).FirstOrDefault();
|
||||||
if (channelList != null)
|
if (channelList != null)
|
||||||
{
|
{
|
||||||
updateTotalQuantity = _connection.ChannelList.Where(cl => cl.Id == channelList.Id)
|
updateTotalQuantity = _connection.ChannelList.Where(cl => cl.Id == channelList.Id)
|
||||||
.Set(cl => cl.TotalQuantity, channelList.TotalQuantity - removeQuantity)
|
.Set(cl => cl.TotalQuantity, channelList.TotalQuantity - removeQuantity)
|
||||||
.Update();
|
.Update();
|
||||||
}
|
}
|
||||||
|
|
||||||
//修改移入药盒的总库存数
|
//修改移入药盒的总库存数
|
||||||
ChannelList moveToChannelList = _connection.ChannelList.Where(cl => cl.MachineId == stock.MachineId && cl.DrawerNo == selectDrawerNo&&cl.ColNo==selectColNo && cl.DrugId == stock.DrugId).FirstOrDefault();
|
|
||||||
|
ChannelList moveToChannelList = _connection.ChannelList.Where(cl => cl.MachineId == stock.MachineId && cl.DrawerNo == selectDrawerNo && cl.ColNo == selectColNo).FirstOrDefault();
|
||||||
if (moveToChannelList != null)
|
if (moveToChannelList != null)
|
||||||
{
|
{
|
||||||
updateTotalQuantity = _connection.ChannelList.Where(cl => cl.Id == moveToChannelList.Id)
|
updateMoveToTotalQuantity = _connection.ChannelList.Where(cl => cl.Id == moveToChannelList.Id)
|
||||||
.Set(cl => cl.TotalQuantity, channelList.TotalQuantity + removeQuantity)
|
.Set(cl => cl.TotalQuantity, moveToChannelList.TotalQuantity + removeQuantity)
|
||||||
.Update();
|
.Update();
|
||||||
}
|
}
|
||||||
if (updateTotalQuantity > 0 && updateMoveToTotalQuantity > 0)
|
if (updateTotalQuantity > 0 && updateMoveToTotalQuantity > 0)
|
||||||
|
|
@ -1843,15 +2089,17 @@ namespace MasaBlazorApp3.DataAccess.Impl
|
||||||
{
|
{
|
||||||
MachineId = stock.MachineId,
|
MachineId = stock.MachineId,
|
||||||
DrawerNo = stock.DrawerNo,
|
DrawerNo = stock.DrawerNo,
|
||||||
ColNo = selectDrawerNo,//移入的药盒号
|
ColNo = stock.ColNo,//移入的药盒号
|
||||||
DrugId = stock.DrugId,
|
DrugId = stock.DrugId,
|
||||||
ManuNo = stock.ManuNo,
|
ManuNo = stock.ManuNo,
|
||||||
EffDate = !String.IsNullOrEmpty(stock.EffDate) ? DateTime.ParseExact(stock.EffDate, "yyyy-MM-dd", System.Globalization.CultureInfo.CurrentCulture) : null,
|
EffDate = !String.IsNullOrEmpty(stock.EffDate) ? DateTime.ParseExact(stock.EffDate, "yyyy-MM-dd", System.Globalization.CultureInfo.CurrentCulture) : null,
|
||||||
OperationTime = DateTime.Now,
|
OperationTime = DateTime.Now,
|
||||||
Type = 21, //交换
|
Type = 21, //移
|
||||||
Quantity = removeQuantity,
|
Quantity = removeQuantity,
|
||||||
Operator = _globalStateService.Operator.Id,
|
Operator = _globalStateService.Operator.Id,
|
||||||
Reviewer = _globalStateService.Reviewer?.Id ?? _globalStateService.Operator.Id,
|
Reviewer = _globalStateService.Reviewer?.Id ?? _globalStateService.Operator.Id,
|
||||||
|
BoxDrawer = selectDrawerNo,
|
||||||
|
BoxColNo = selectColNo,
|
||||||
InvoiceId = stock.Id.ToString(),
|
InvoiceId = stock.Id.ToString(),
|
||||||
});
|
});
|
||||||
if (recordId <= 0)
|
if (recordId <= 0)
|
||||||
|
|
@ -1860,6 +2108,38 @@ namespace MasaBlazorApp3.DataAccess.Impl
|
||||||
flag = false;
|
flag = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
//移出库位里是否有未绑套餐且库存为0的数据,有则删除
|
||||||
|
_connection.ChannelStock.Where(cs => cs.MachineId.Equals(_setting.boxMachineId) && (string.IsNullOrEmpty(cs.ListId)) && cs.DrawerNo == selectDrawerNo && cs.ColNo == selectColNo && cs.Quantity <= 0).Delete();
|
||||||
|
_connection.ChannelStock.Where(cs => cs.MachineId.Equals(_setting.boxMachineId) && (string.IsNullOrEmpty(cs.ListId)) && cs.DrawerNo == stock.DrawerNo && cs.ColNo == stock.ColNo && cs.Quantity <= 0).Delete();
|
||||||
|
//删除绑定套餐中同一药品多批次且库存为0的第一条数据
|
||||||
|
List<ChannelStock> delChannelStock = await _connection.ChannelStock.Where(cs => cs.MachineId.Equals(_setting.boxMachineId) && cs.DrawerNo == stock.DrawerNo && cs.ColNo == stock.ColNo && cs.DrugId == stock.DrugId).ToListAsync();
|
||||||
|
if (delChannelStock != null && delChannelStock.Count > 1)
|
||||||
|
{
|
||||||
|
//删除绑定套餐中库存为0的药的批次数据,只保留一条数据
|
||||||
|
//for (int i = 1; i < delChannelStock.Count; i++)
|
||||||
|
//{
|
||||||
|
// _connection.Delete(delChannelStock[i]);
|
||||||
|
//}
|
||||||
|
//删除绑定套餐中库存为0的药的批次数据,只保留一条数据
|
||||||
|
List<ChannelStock> del = delChannelStock.Where(c => c.Quantity <= 0).ToList();
|
||||||
|
if (del != null && del.Count > 0)
|
||||||
|
{
|
||||||
|
if (delChannelStock.Count == del.Count)
|
||||||
|
{
|
||||||
|
for (int j = 1; j < del.Count; j++)
|
||||||
|
{
|
||||||
|
_connection.ChannelStock.Where(cs => cs.Id == del[j].Id).Delete();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
for (int j = 0; j < del.Count; j++)
|
||||||
|
{
|
||||||
|
_connection.ChannelStock.Where(cs => cs.Id == del[j].Id).Delete();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (flag)
|
if (flag)
|
||||||
{
|
{
|
||||||
|
|
@ -1887,7 +2167,7 @@ namespace MasaBlazorApp3.DataAccess.Impl
|
||||||
var query = _connection.ChannelList.AsQueryable();
|
var query = _connection.ChannelList.AsQueryable();
|
||||||
|
|
||||||
|
|
||||||
return await query
|
return await query
|
||||||
.Where(cl => cl.MachineId == _setting.boxMachineId)
|
.Where(cl => cl.MachineId == _setting.boxMachineId)
|
||||||
.OrderBy((cl) => cl.DrawerNo)
|
.OrderBy((cl) => cl.DrawerNo)
|
||||||
.ThenBy((cl) => cl.DrawerNo)
|
.ThenBy((cl) => cl.DrawerNo)
|
||||||
|
|
@ -1898,7 +2178,7 @@ namespace MasaBlazorApp3.DataAccess.Impl
|
||||||
public async Task<List<ChannelStock>> GetChannelStockByBox(int BoxNum)
|
public async Task<List<ChannelStock>> GetChannelStockByBox(int BoxNum)
|
||||||
{
|
{
|
||||||
var query = _connection.ChannelStock.AsQueryable()
|
var query = _connection.ChannelStock.AsQueryable()
|
||||||
.Where(cl=>cl.MachineId==_setting.boxMachineId&&cl.DrawerNo==BoxNum&&cl.Quantity>0);
|
.Where(cl => cl.MachineId == _setting.boxMachineId && cl.DrawerNo == BoxNum && cl.Quantity > 0);
|
||||||
return await query
|
return await query
|
||||||
//.Where(cl=>cl.Quantity<=0)
|
//.Where(cl=>cl.Quantity<=0)
|
||||||
.OrderBy((cl) => cl.DrawerNo)
|
.OrderBy((cl) => cl.DrawerNo)
|
||||||
|
|
@ -1909,10 +2189,10 @@ namespace MasaBlazorApp3.DataAccess.Impl
|
||||||
//根据套餐下无库存的药箱
|
//根据套餐下无库存的药箱
|
||||||
public async Task<List<ChannelStock>> GetChannelStockByPlan(string plan)
|
public async Task<List<ChannelStock>> GetChannelStockByPlan(string plan)
|
||||||
{
|
{
|
||||||
var query = await _connection.ChannelList.AsQueryable().Where(cl=>cl.MachineId==_setting.boxMachineId&&cl.DrugId== plan).Select(c=>c.DrawerNo).ToListAsync();
|
var query = await _connection.ChannelList.AsQueryable().Where(cl => cl.MachineId == _setting.boxMachineId && cl.DrugId == plan).Select(c => c.DrawerNo).ToListAsync();
|
||||||
if(query!=null&& query.Count>0)
|
if (query != null && query.Count > 0)
|
||||||
{
|
{
|
||||||
return await _connection.ChannelStock.Where(c => query.Contains(c.DrawerNo) && c.MachineId == _setting.boxMachineId&&c.Quantity<=0).ToListAsync();
|
return await _connection.ChannelStock.Where(c => query.Contains(c.DrawerNo) && c.MachineId == _setting.boxMachineId && c.Quantity <= 0).ToListAsync();
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
@ -1933,5 +2213,174 @@ namespace MasaBlazorApp3.DataAccess.Impl
|
||||||
.ToListAsync();
|
.ToListAsync();
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//抽屉取药向药盒加药校验药盒中是否存在该药
|
||||||
|
public async Task<CheckInfo<ChannelList>> CheckBoxDrugInfo(BoxModel BoxNum, List<ChannelStock> channelStockList)
|
||||||
|
{
|
||||||
|
string errorInfo = string.Empty;
|
||||||
|
int count = 0;
|
||||||
|
List<ChannelList> channelList = new List<ChannelList>();
|
||||||
|
for (int i = 0; i < channelStockList.Count; i++)
|
||||||
|
{
|
||||||
|
//ChannelList cl = _connection.ChannelList.InnerJoin
|
||||||
|
// (
|
||||||
|
// _connection.PlanDetails.Where(pd => pd.UseState == 1 && pd.DrugId == channelStockList[i].DrugId),
|
||||||
|
// (cs, pd) => cs.DrugId == pd.PlanId.ToString(),
|
||||||
|
// (cs, pd) => cs
|
||||||
|
// ).FirstOrDefault();
|
||||||
|
ChannelList cl = _connection.ChannelList.Where(cl => cl.MachineId == _setting.boxMachineId && cl.DrawerNo == BoxNum.BoxName && cl.ColNo == BoxNum.BoxNo).FirstOrDefault();
|
||||||
|
if (cl != null && !string.IsNullOrEmpty(cl.DrugId))
|
||||||
|
{
|
||||||
|
//查该库位绑定的套餐对应的药品信息
|
||||||
|
cl._PlanDetails = _connection.PlanDetails.Where(pd => pd.PlanId.ToString() == cl.DrugId && pd.DrugId == channelStockList[i].DrugId).ToList();
|
||||||
|
channelList.Add(cl);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
errorInfo += $"{channelStockList[i].Drug.DrugName}未在{(BoxNum.BoxName == 99 ? "急诊" : BoxNum.BoxName == 111 ? "恢复室" : string.Concat(BoxNum.BoxName.ToString(), (BoxNum.BoxNo == 1 ? "-白" : "-绿")))}药盒中绑定;";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return new CheckInfo<ChannelList>()
|
||||||
|
{
|
||||||
|
|
||||||
|
StrInfo = errorInfo,
|
||||||
|
TEntity = channelList
|
||||||
|
};
|
||||||
|
}
|
||||||
|
//药箱中的药移入到抽屉
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="SelectedDrawerNo">移入的抽屉</param>
|
||||||
|
/// <param name="channelStock">移出的药盒</param>
|
||||||
|
/// <param name="quantity">移出数量</param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public async Task<bool> RemoveDrugToDrawerFinish(string SelectedDrawerNo, ChannelStock stock, int removeQuantity)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
bool flag = true;
|
||||||
|
_connection.BeginTransaction();
|
||||||
|
|
||||||
|
int selectDrawerNo = 0;
|
||||||
|
int selectColNo = 0;
|
||||||
|
var selectSpl = SelectedDrawerNo.Split('-');
|
||||||
|
if (selectSpl != null && selectSpl.Count() > 0)
|
||||||
|
{
|
||||||
|
selectDrawerNo = Convert.ToInt32(selectSpl[0]);
|
||||||
|
selectColNo = Convert.ToInt32(selectSpl[1]);
|
||||||
|
}
|
||||||
|
|
||||||
|
//查询移入的药品是否有库存
|
||||||
|
ChannelStock inChannelStock = _connection.ChannelStock.AsQueryable()
|
||||||
|
.Where(cs => cs.MachineId.Equals(_setting.machineId) && cs.DrawerNo == selectDrawerNo && cs.ColNo == selectColNo && cs.DrugId == stock.DrugId && cs.ManuNo == stock.ManuNo)
|
||||||
|
.FirstOrDefault();
|
||||||
|
if (inChannelStock != null)
|
||||||
|
{
|
||||||
|
//如果有该批次的药品,则更新数量
|
||||||
|
int r = _connection.ChannelStock.Where(cs => cs.Id == inChannelStock.Id)
|
||||||
|
.Set(cs => cs.Quantity, inChannelStock.Quantity + removeQuantity)
|
||||||
|
.Update();
|
||||||
|
if (r <= 0)
|
||||||
|
{
|
||||||
|
logger.Info($"手术室药盒移出药品更新数量失败,药盒号:{SelectedDrawerNo},药品ID:{stock.DrugId}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
logger.Info($"抽屉{SelectedDrawerNo}不存在药品{stock.Drug.DrugName},批次{stock.ManuNo},无法移入");
|
||||||
|
flag = false;
|
||||||
|
}
|
||||||
|
if (flag)
|
||||||
|
{
|
||||||
|
//减本库位库存数量
|
||||||
|
int updateQuantity2 = _connection.ChannelStock.Where(cs => cs.Id == stock.Id)
|
||||||
|
.Set(cs => cs.Quantity, stock.Quantity - removeQuantity)
|
||||||
|
.Update();
|
||||||
|
if (updateQuantity2 <= 0)
|
||||||
|
{
|
||||||
|
logger.Info($"更新入库药盒药品减数量失败,药盒号:{stock.DrawerNo},药品ID:{stock.DrugId}");
|
||||||
|
flag = false;
|
||||||
|
}
|
||||||
|
if (flag)
|
||||||
|
{
|
||||||
|
//记录操作记录
|
||||||
|
int recordId = _connection.InsertWithInt32Identity(new MachineRecord()
|
||||||
|
{
|
||||||
|
MachineId = _setting.machineId,
|
||||||
|
DrawerNo = stock.DrawerNo,
|
||||||
|
ColNo = stock.ColNo,//移入的抽屉库位
|
||||||
|
BoxDrawer = selectDrawerNo,
|
||||||
|
BoxColNo = selectColNo,//移入的抽屉库位
|
||||||
|
DrugId = stock.DrugId,
|
||||||
|
ManuNo = stock.ManuNo,
|
||||||
|
EffDate = !String.IsNullOrEmpty(stock.EffDate) ? DateTime.ParseExact(stock.EffDate, "yyyy-MM-dd", System.Globalization.CultureInfo.CurrentCulture) : null,
|
||||||
|
OperationTime = DateTime.Now,
|
||||||
|
Type = 21, //交换
|
||||||
|
Quantity = removeQuantity,
|
||||||
|
Operator = _globalStateService.Operator.Id,
|
||||||
|
Reviewer = _globalStateService.Reviewer?.Id ?? _globalStateService.Operator.Id,
|
||||||
|
InvoiceId = $"药盒{stock.Location}中药品{stock.Drug.DrugName}批次{stock.ManuNo},移入抽屉{SelectedDrawerNo},数量{removeQuantity}",
|
||||||
|
});
|
||||||
|
if (recordId <= 0)
|
||||||
|
{
|
||||||
|
logger.Info($"移盒移出药品失败:药盒{stock.Location}中药品{stock.Drug.DrugName}批次{stock.ManuNo},移入抽屉{SelectedDrawerNo},数量{removeQuantity}");
|
||||||
|
flag = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//移出库位里是否有未绑套餐且库存为0的数据,有则删除
|
||||||
|
_connection.ChannelStock.Where(cs => cs.MachineId.Equals(_setting.boxMachineId) && (string.IsNullOrEmpty(cs.ListId)) && cs.DrawerNo == stock.DrawerNo && cs.ColNo == stock.ColNo && cs.Quantity <= 0).Delete();
|
||||||
|
//删除绑定套餐中同一药品多批次且库存为0的第一条数据
|
||||||
|
List<ChannelStock> delChannelStock = await _connection.ChannelStock.Where(cs => cs.MachineId.Equals(_setting.boxMachineId) && cs.DrawerNo == stock.DrawerNo && cs.ColNo == stock.ColNo && cs.DrugId == stock.DrugId).ToListAsync();
|
||||||
|
if (delChannelStock != null && delChannelStock.Count > 1)
|
||||||
|
{
|
||||||
|
//删除绑定套餐中库存为0的药的批次数据,只保留一条数据
|
||||||
|
//for (int i = 1; i < delChannelStock.Count; i++)
|
||||||
|
//{
|
||||||
|
// _connection.Delete(delChannelStock[i]);
|
||||||
|
//}
|
||||||
|
//删除绑定套餐中库存为0的药的批次数据,只保留一条数据
|
||||||
|
List<ChannelStock> del = delChannelStock.Where(c => c.Quantity <= 0).ToList();
|
||||||
|
if (del != null && del.Count > 0)
|
||||||
|
{
|
||||||
|
if (delChannelStock.Count == del.Count)
|
||||||
|
{
|
||||||
|
for (int j = 1; j < del.Count; j++)
|
||||||
|
{
|
||||||
|
_connection.ChannelStock.Where(cs => cs.Id == del[j].Id).Delete();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
for (int j = 0; j < del.Count; j++)
|
||||||
|
{
|
||||||
|
_connection.ChannelStock.Where(cs => cs.Id == del[j].Id).Delete();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (flag)
|
||||||
|
{
|
||||||
|
|
||||||
|
_connection.CommitTransaction();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_connection.RollbackTransaction();
|
||||||
|
}
|
||||||
|
return flag;
|
||||||
|
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
logger.Info($"手术室药盒移出药品异常{ex.Message}");
|
||||||
|
_connection.RollbackTransaction();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -28,9 +28,8 @@ namespace MasaBlazorApp3.DataAccess.Impl
|
||||||
{
|
{
|
||||||
var query = _connection.DrugInfo.AsQueryable();
|
var query = _connection.DrugInfo.AsQueryable();
|
||||||
|
|
||||||
|
List<DrugInfo> drugList = await query
|
||||||
return await query
|
.LoadWith(di => di.Stocks.Where(cs => cs.Quantity > 0 && (cs.MachineId == _setting.machineId)))
|
||||||
.LoadWith(di => di.Stocks.Where(cs => cs.Quantity > 0 && cs.MachineId == _setting.machineId))
|
|
||||||
.InnerJoin(
|
.InnerJoin(
|
||||||
_connection.ChannelStock.Where(cl => cl.MachineId == _setting.machineId && cl.DrawerType == 1).GroupBy(cl => cl.DrugId),
|
_connection.ChannelStock.Where(cl => cl.MachineId == _setting.machineId && cl.DrawerType == 1).GroupBy(cl => cl.DrugId),
|
||||||
(di, cl) => di.DrugId == cl.Key,
|
(di, cl) => di.DrugId == cl.Key,
|
||||||
|
|
@ -39,6 +38,48 @@ namespace MasaBlazorApp3.DataAccess.Impl
|
||||||
//.Where(cs => cs.Quantity > 0)
|
//.Where(cs => cs.Quantity > 0)
|
||||||
.OrderBy((di) => di.DrugId)
|
.OrderBy((di) => di.DrugId)
|
||||||
.ToListAsync();
|
.ToListAsync();
|
||||||
|
if(drugList!=null&&drugList.Count>0)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < drugList.Count; i++)
|
||||||
|
{
|
||||||
|
List<ChannelStock> channelStocks = _connection.ChannelStock.Where(cs => cs.MachineId.Equals(_setting.boxMachineId) && cs.DrugId == drugList[i].DrugId).OrderBy(cs=> new{ cs.DrawerNo, cs.ColNo}).ToList();
|
||||||
|
var nomalBoxStockList= channelStocks.Where(cs => cs.DrawerNo <= 30).GroupBy(cs =>new { cs.ManuNo, cs.EffDate }).Select(g => new { manuNo=g.Key.ManuNo,effdate=g.Key.EffDate,Quantity=g.Sum(k=>k.Quantity)}).ToList();
|
||||||
|
foreach (var item in nomalBoxStockList)
|
||||||
|
{
|
||||||
|
ChannelStock nomalBox = new ChannelStock() { DrugId = drugList[i].DrugId,ManuNo=item.manuNo,Quantity=item.Quantity,EffDate=item.effdate,MachineId= "DM5" };
|
||||||
|
drugList[i].Stocks.Add(nomalBox);
|
||||||
|
}
|
||||||
|
drugList[i].Stocks.AddRange(channelStocks.Where(cs=>cs.DrawerNo>30));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return drugList;
|
||||||
|
//return await query
|
||||||
|
// .LoadWith(di => di.Stocks.Where(cs => cs.Quantity > 0 && (cs.MachineId == _setting.machineId)))
|
||||||
|
// .InnerJoin(
|
||||||
|
// _connection.ChannelStock.Where(cl => cl.MachineId == _setting.machineId && cl.DrawerType == 1).GroupBy(cl => cl.DrugId),
|
||||||
|
// (di, cl) => di.DrugId == cl.Key,
|
||||||
|
// (di, cl) => di
|
||||||
|
// )
|
||||||
|
// //.Where(cs => cs.Quantity > 0)
|
||||||
|
// .OrderBy((di) => di.DrugId)
|
||||||
|
// .ToListAsync();
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<List<DrugInfo>> GetAllDrugAndStockByBox(BoxModel boxModel)
|
||||||
|
{
|
||||||
|
var query = _connection.DrugInfo.AsQueryable();
|
||||||
|
|
||||||
|
|
||||||
|
return await query
|
||||||
|
.LoadWith(di => di.Stocks.Where(cs => cs.Quantity > 0 && cs.MachineId == _setting.boxMachineId&&cs.DrawerNo==boxModel.BoxName&&cs.ColNo==boxModel.BoxNo))
|
||||||
|
.InnerJoin(
|
||||||
|
_connection.ChannelStock.Where(cl => cl.MachineId == _setting.boxMachineId && cl.DrawerNo==boxModel.BoxName&&cl.ColNo==boxModel.BoxNo).GroupBy(cl => cl.DrugId),
|
||||||
|
(di, cl) => di.DrugId == cl.Key,
|
||||||
|
(di, cl) => di
|
||||||
|
)
|
||||||
|
//.Where(cs => cs.Quantity > 0)
|
||||||
|
.OrderBy((di) => di.DrugId)
|
||||||
|
.ToListAsync();
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<PageData<DrugInfo>> GetAllDrug(string drugId, string drugName, int? take, int? skip)
|
public async Task<PageData<DrugInfo>> GetAllDrug(string drugId, string drugName, int? take, int? skip)
|
||||||
|
|
|
||||||
|
|
@ -33,89 +33,90 @@ namespace MasaBlazorApp3.DataAccess.Impl
|
||||||
}
|
}
|
||||||
public async Task<PageData<InOutInvoice>> GetAllInvoiceByType(string invoiceNo, DateTime invoiceDate, int? take, int? skip, int type = 1)
|
public async Task<PageData<InOutInvoice>> GetAllInvoiceByType(string invoiceNo, DateTime invoiceDate, int? take, int? skip, int type = 1)
|
||||||
{
|
{
|
||||||
var query2 = from cl in _connection.ChannelList.Where(c => c.MachineId == _setting.machineId)
|
//var query2 = from cl in _connection.ChannelStock.Where(c => c.MachineId == _setting.machineId)
|
||||||
group cl by cl.DrugId into temp
|
// group cl by cl.DrugId into temp
|
||||||
select new { temp.Key };
|
// select new { temp.Key };
|
||||||
var query3 = from ioi in _connection.InOutInvoice
|
//var query3 = from ioi in _connection.InOutInvoice
|
||||||
from od in query2.InnerJoin(od => od.Key == ioi.DrugId)
|
// from od in query2.InnerJoin(od => od.Key == ioi.DrugId)
|
||||||
group ioi by ioi.InvoiceNo into temp
|
// group ioi by ioi.InvoiceNo into temp
|
||||||
select new InOutInvoice{
|
// select new InOutInvoice{
|
||||||
InvoiceNo= temp.First().InvoiceNo,
|
// InvoiceNo= temp.First().InvoiceNo,
|
||||||
InPharmacyId = temp.First().InPharmacyId,
|
// InPharmacyId = temp.First().InPharmacyId,
|
||||||
OutPharmacyId = temp.First().OutPharmacyId,
|
// OutPharmacyId = temp.First().OutPharmacyId,
|
||||||
InvoiceDate = temp.First().InvoiceDate,
|
// InvoiceDate = temp.First().InvoiceDate,
|
||||||
CreateTime = temp.First().CreateTime,
|
// CreateTime = temp.First().CreateTime,
|
||||||
Type = temp.First().Type,
|
// Type = temp.First().Type,
|
||||||
CancelFlag = temp.First().CancelFlag,
|
// CancelFlag = temp.First().CancelFlag,
|
||||||
Status = temp.First().Status,
|
// Status = temp.First().Status,
|
||||||
};
|
// };
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//var query = _connection.FromSql<InOutInvoice>($@"
|
var query = _connection.FromSql<InOutInvoice>($@"
|
||||||
// SELECT ioi.invoice_no,ioi.in_pharmacy_id, ioi.out_pharmacy_id, ioi.invoice_date, ioi.create_time, ioi.type, ioi.cancel_flag, ioi.status FROM in_out_invoice ioi
|
SELECT ioi.invoice_no,ioi.in_pharmacy_id, ioi.out_pharmacy_id, ioi.invoice_date, ioi.create_time, ioi.type, ioi.cancel_flag, ioi.status FROM in_out_invoice ioi
|
||||||
// INNER JOIN (SELECT drug_id FROM channel_list WHERE machine_id = ""{_setting.machineId}"" GROUP BY drug_id) c ON c.drug_id = ioi.drug_id
|
INNER JOIN (SELECT drug_id FROM channel_stock WHERE machine_id = {_setting.machineId} GROUP BY drug_id) c ON c.drug_id = ioi.drug_id
|
||||||
// GROUP BY ioi.invoice_no");
|
GROUP BY ioi.invoice_no");
|
||||||
|
|
||||||
if (!String.IsNullOrEmpty(invoiceNo))
|
if (!String.IsNullOrEmpty(invoiceNo))
|
||||||
{
|
{
|
||||||
//query = query.Where(ioi => ioi.InvoiceNo.Contains(invoiceNo));
|
query = query.Where(ioi => ioi.InvoiceNo.Contains(invoiceNo));
|
||||||
query3 = query3.Where(ioi => ioi.InvoiceNo.Contains(invoiceNo));
|
//query3 = query3.Where(ioi => ioi.InvoiceNo.Contains(invoiceNo));
|
||||||
}
|
}
|
||||||
if(invoiceDate != DateTime.MinValue)
|
if (invoiceDate != DateTime.MinValue)
|
||||||
{
|
{
|
||||||
//query = query.Where(ioi => ioi.CreateTime.Date.Equals(invoiceDate.Date));
|
query = query.Where(ioi => Convert.ToDateTime(ioi.InvoiceDate).Date.Equals(invoiceDate.Date));
|
||||||
query3 = query3.Where(ioi => ioi.InvoiceNo.Contains(invoiceNo));
|
//query3 = query3.Where(ioi => ioi.InvoiceNo.Contains(invoiceNo));
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!String.IsNullOrEmpty(_setting.storage))
|
if (!String.IsNullOrEmpty(_setting.inPharmacyId))
|
||||||
{
|
{
|
||||||
if (type == 1)
|
if (type == 1)
|
||||||
{
|
{
|
||||||
//query = query.Where(ioi => ioi.OutPharmacyId.Equals(_setting.storage));
|
query = query.Where(ioi => ioi.InPharmacyId.Equals(_setting.inPharmacyId));
|
||||||
query3 = query3.Where(ioi => ioi.OutPharmacyId.Equals(_setting.storage));
|
//query = query.Where(ioi => ioi.OutPharmacyId.Equals(_setting.inPharmacyId));
|
||||||
|
//query3 = query3.Where(ioi => ioi.OutPharmacyId.Equals(_setting.storage));
|
||||||
}
|
}
|
||||||
// 调拨出库
|
// 调拨出库
|
||||||
else if (type == 2)
|
else if (type == 2)
|
||||||
{
|
{
|
||||||
//query = query.Where(ioi => ioi.InPharmacyId.Equals(_setting.storage));
|
query = query.Where(ioi => ioi.InPharmacyId.Equals(_setting.inPharmacyId));
|
||||||
query3 = query3.Where(ioi => ioi.OutPharmacyId.Equals(_setting.storage));
|
//query3 = query3.Where(ioi => ioi.OutPharmacyId.Equals(_setting.storage));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
// 调拨入库
|
// 调拨入库
|
||||||
if (type == 1)
|
if (type == 1)
|
||||||
{
|
{
|
||||||
//query = query.Where(ioi => (ioi.Type == 0 && ioi.Status == 2) || (ioi.Type == 1 && ioi.Status == 0));
|
query = query.Where(ioi => (ioi.Type == 2 && ioi.Status == 0));
|
||||||
query3 = query3.Where(ioi => (ioi.Type == 0 && ioi.Status == 2) || (ioi.Type == 1 && ioi.Status == 0));
|
//query3 = query3.Where(ioi => (ioi.Type == 0 && ioi.Status == 2) || (ioi.Type == 1 && ioi.Status == 0));
|
||||||
}
|
}
|
||||||
// 调拨出库
|
// 调拨出库
|
||||||
else if (type == 2)
|
else if (type == 2)
|
||||||
{
|
{
|
||||||
//query = query.Where(ioi => new int[] { 0, 2 }.Contains(ioi.Type) && ioi.Status == 0);
|
query = query.Where(ioi => new int[] { 0, 2 }.Contains(ioi.Type) && ioi.Status == 0);
|
||||||
query3 = query3.Where(ioi => new int[] { 0, 2 }.Contains(ioi.Type) && ioi.Status == 0);
|
//query3 = query3.Where(ioi => new int[] { 0, 2 }.Contains(ioi.Type) && ioi.Status == 0);
|
||||||
}
|
}
|
||||||
//query = query.Where(ioi => ioi.CancelFlag == 0);
|
query = query.Where(ioi => ioi.CancelFlag == 0);
|
||||||
//query = query.Select(ioi => new InOutInvoice()
|
query = query.Select(ioi => new InOutInvoice()
|
||||||
//{
|
{
|
||||||
// InPharmacyId = ioi.InPharmacyId,
|
InPharmacyId = ioi.InPharmacyId,
|
||||||
// OutPharmacyId = ioi.OutPharmacyId,
|
OutPharmacyId = ioi.OutPharmacyId,
|
||||||
// InvoiceDate = ioi.InvoiceDate,
|
InvoiceDate = ioi.InvoiceDate,
|
||||||
// InvoiceNo = ioi.InvoiceNo,
|
InvoiceNo = ioi.InvoiceNo,
|
||||||
// CreateTime = ioi.CreateTime,
|
CreateTime = ioi.CreateTime,
|
||||||
// Type = ioi.Type,
|
Type = ioi.Type,
|
||||||
// Status = ioi.Status,
|
Status = ioi.Status,
|
||||||
// CancelFlag = ioi.CancelFlag,
|
CancelFlag = ioi.CancelFlag,
|
||||||
//});
|
});
|
||||||
|
|
||||||
query3 = query3.Where(ioi => ioi.CancelFlag == 0);
|
//query3 = query3.Where(ioi => ioi.CancelFlag == 0);
|
||||||
List <InOutInvoice> list = await query3
|
List<InOutInvoice> list = await query
|
||||||
.OrderByDescending(ioi => ioi.CreateTime)
|
.OrderByDescending(ioi => ioi.CreateTime)
|
||||||
.Skip((int)skip)
|
.Skip((int)skip)
|
||||||
.Take((int)take)
|
.Take((int)take)
|
||||||
.ToListAsync();
|
.ToListAsync();
|
||||||
|
|
||||||
int pagedData = await query3.CountAsync();
|
int pagedData = await query.CountAsync();
|
||||||
return new PageData<InOutInvoice>()
|
return new PageData<InOutInvoice>()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
@ -140,23 +141,25 @@ namespace MasaBlazorApp3.DataAccess.Impl
|
||||||
|
|
||||||
query = query.Where(cs => cs.MachineId.Equals(_setting.machineId)).Where(cs => cs.DrawerType == 1).Where(cs => cs.DrugId.Equals(DrugId));
|
query = query.Where(cs => cs.MachineId.Equals(_setting.machineId)).Where(cs => cs.DrawerType == 1).Where(cs => cs.DrugId.Equals(DrugId));
|
||||||
|
|
||||||
|
|
||||||
if (quantity > 0)
|
if (quantity > 0)
|
||||||
{
|
{
|
||||||
query = query.Where(cs => cs.Quantity > 0);
|
query = query.Where(cs => cs.Quantity > 0);
|
||||||
if (!String.IsNullOrEmpty(manuNo))
|
if (!String.IsNullOrEmpty(manuNo) && manuNo != "X")
|
||||||
{
|
{
|
||||||
query = query.Where(cs => cs.ManuNo.Equals(manuNo));
|
query = query.Where(cs => cs.ManuNo.Equals(manuNo));
|
||||||
}
|
}
|
||||||
} else
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
if (!String.IsNullOrEmpty(manuNo))
|
if (!String.IsNullOrEmpty(manuNo) && manuNo != "X")
|
||||||
{
|
{
|
||||||
query = query.Where(cs => cs.ManuNo.Equals(manuNo) || String.IsNullOrEmpty(cs.ManuNo) || cs.Quantity == 0);
|
query = query.Where(cs => cs.ManuNo.Equals(manuNo) || String.IsNullOrEmpty(cs.ManuNo) || cs.Quantity == 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return await query.OrderBy((cs) => cs.EffDate)
|
return await query.LoadWith(cl => cl.drugManuNo)
|
||||||
|
.OrderBy((cs) => cs.EffDate)
|
||||||
.ThenBy((cs) => cs.DrawerNo)
|
.ThenBy((cs) => cs.DrawerNo)
|
||||||
.ThenBy((cs) => cs.ColNo)
|
.ThenBy((cs) => cs.ColNo)
|
||||||
.ToListAsync();
|
.ToListAsync();
|
||||||
|
|
@ -172,12 +175,12 @@ namespace MasaBlazorApp3.DataAccess.Impl
|
||||||
(ioi, key) => ioi)
|
(ioi, key) => ioi)
|
||||||
.Where(ioi => ioi.InvoiceNo.Equals(invoiceNo))
|
.Where(ioi => ioi.InvoiceNo.Equals(invoiceNo))
|
||||||
.OrderBy(ioi => ioi.DrugId);
|
.OrderBy(ioi => ioi.DrugId);
|
||||||
return await query.ToListAsync();
|
return await query.ToListAsync();
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<DrugInfo> getDrugInfoById(string DrugId)
|
public async Task<DrugInfo> getDrugInfoById(string DrugId)
|
||||||
{
|
{
|
||||||
return await _connection.DrugInfo.Where(di => di.DrugId == DrugId).FirstOrDefaultAsync();
|
return await _connection.DrugInfo.Where(di => di.DrugId == DrugId).LoadWith(di => di.Manus).FirstOrDefaultAsync();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -198,7 +201,7 @@ namespace MasaBlazorApp3.DataAccess.Impl
|
||||||
|
|
||||||
// 当前药品的库存总量
|
// 当前药品的库存总量
|
||||||
var total = stockList.Sum(cs => cs.Quantity);
|
var total = stockList.Sum(cs => cs.Quantity);
|
||||||
|
|
||||||
if (flag)
|
if (flag)
|
||||||
{
|
{
|
||||||
// 盘点库存是否足够
|
// 盘点库存是否足够
|
||||||
|
|
@ -251,6 +254,10 @@ namespace MasaBlazorApp3.DataAccess.Impl
|
||||||
List<ChannelStock> stockList = await this.GetChannelStockByDrugId(detail.DrugId, detail.DrugManuNo);
|
List<ChannelStock> stockList = await this.GetChannelStockByDrugId(detail.DrugId, detail.DrugManuNo);
|
||||||
|
|
||||||
DrugInfo Drug = await this.getDrugInfoById(detail.DrugId);
|
DrugInfo Drug = await this.getDrugInfoById(detail.DrugId);
|
||||||
|
if(Drug!=null&&stockList!=null&&stockList.Count>0)
|
||||||
|
{
|
||||||
|
stockList.ForEach(sl => sl.Drug = Drug);
|
||||||
|
}
|
||||||
|
|
||||||
// 当前药品的库存总量
|
// 当前药品的库存总量
|
||||||
var total = stockList.Aggregate(0, (current, next) => current + next.Quantity);
|
var total = stockList.Aggregate(0, (current, next) => current + next.Quantity);
|
||||||
|
|
@ -359,7 +366,7 @@ namespace MasaBlazorApp3.DataAccess.Impl
|
||||||
)
|
)
|
||||||
.Where(cs => cs.DrugId.Equals(ChannelStock.DrugId))
|
.Where(cs => cs.DrugId.Equals(ChannelStock.DrugId))
|
||||||
.ToListAsync();
|
.ToListAsync();
|
||||||
|
|
||||||
// 保存账册
|
// 保存账册
|
||||||
int acid = _connection.InsertWithInt32Identity(new AccountBook()
|
int acid = _connection.InsertWithInt32Identity(new AccountBook()
|
||||||
{
|
{
|
||||||
|
|
@ -382,7 +389,7 @@ namespace MasaBlazorApp3.DataAccess.Impl
|
||||||
//根据抽屉类型判断是否需要写标签
|
//根据抽屉类型判断是否需要写标签
|
||||||
if (ChannelStock.BoardType.ToString().Contains("5"))
|
if (ChannelStock.BoardType.ToString().Contains("5"))
|
||||||
{
|
{
|
||||||
await _portUtil.WriteQuantityMethod(ChannelStock.Quantity- ChannelStock.TakeQuantity, ChannelStock.DrawerNo, ChannelStock.ColNo);
|
await _portUtil.WriteQuantityMethod(ChannelStock.Quantity - ChannelStock.TakeQuantity, ChannelStock.DrawerNo, ChannelStock.ColNo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
@ -450,15 +457,15 @@ namespace MasaBlazorApp3.DataAccess.Impl
|
||||||
.Set(cs => cs.Quantity, ChannelStock.Quantity + ChannelStock.AddQuantity);
|
.Set(cs => cs.Quantity, ChannelStock.Quantity + ChannelStock.AddQuantity);
|
||||||
if (String.IsNullOrEmpty(ChannelStock.ManuNo) || (ChannelStock.Quantity == 0 && !ChannelStock.ManuNo.Equals(invoiceVo.Invoice.DrugManuNo)))
|
if (String.IsNullOrEmpty(ChannelStock.ManuNo) || (ChannelStock.Quantity == 0 && !ChannelStock.ManuNo.Equals(invoiceVo.Invoice.DrugManuNo)))
|
||||||
{
|
{
|
||||||
DrugManuNo drugManuNo = await GetDrugManuNo(ChannelStock.DrugId, invoiceVo.Invoice.DrugManuNo);
|
DrugManuNo drugManuNo = await GetDrugManuNo(ChannelStock.DrugId, ChannelStock.drugManuNo.ManuNo);
|
||||||
|
|
||||||
ChannelStock.Dmnguid = drugManuNo.Id;
|
ChannelStock.Dmnguid = drugManuNo.Id;
|
||||||
ChannelStock.ManuNo = drugManuNo.ManuNo;
|
ChannelStock.ManuNo = drugManuNo.ManuNo;
|
||||||
ChannelStock.EffDate = drugManuNo.EffDate.ToString();
|
ChannelStock.EffDate = drugManuNo.EffDate?.ToString("yyyy-MM-dd");
|
||||||
|
|
||||||
q = q.Set(cs => cs.Dmnguid, drugManuNo.Id)
|
q = q.Set(cs => cs.Dmnguid, ChannelStock.Dmnguid)
|
||||||
.Set(cs => cs.ManuNo, drugManuNo.ManuNo)
|
.Set(cs => cs.ManuNo, ChannelStock.ManuNo)
|
||||||
.Set(cs => cs.EffDate, drugManuNo.EffDate.ToString());
|
.Set(cs => cs.EffDate, ChannelStock.EffDate);
|
||||||
}
|
}
|
||||||
int r = q.Update();
|
int r = q.Update();
|
||||||
if (!DateTime.TryParse(ChannelStock.EffDate, out DateTime dEffDate))
|
if (!DateTime.TryParse(ChannelStock.EffDate, out DateTime dEffDate))
|
||||||
|
|
@ -509,7 +516,30 @@ namespace MasaBlazorApp3.DataAccess.Impl
|
||||||
Reviewer = _globalStateService.Reviewer?.Id ?? _globalStateService.Operator.Id,
|
Reviewer = _globalStateService.Reviewer?.Id ?? _globalStateService.Operator.Id,
|
||||||
InvoiceId = invoiceVo.Invoice.InvoiceNo,
|
InvoiceId = invoiceVo.Invoice.InvoiceNo,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
//更新回收箱库存,入库后回收箱的空瓶库存减少
|
||||||
|
//List<ChannelStock> returnChannelStockList = _connection.ChannelStock.Where(cs => cs.MachineId == _setting.machineId && cs.DrawerType == 2 && cs.DrugId == ChannelStock.DrugId && cs.Quantity > 0).OrderBy(cs => cs.Quantity).ToList();
|
||||||
|
//if (returnChannelStockList != null && returnChannelStockList.Count > 0 && returnChannelStockList.Sum(rcs => rcs.Quantity) <= ChannelStock.AddQuantity)
|
||||||
|
//{
|
||||||
|
// //空瓶数小于等于入库数量,直接清空所有回收箱中药品空瓶数
|
||||||
|
// returnChannelStockList.ForEach(rcs => rcs.Quantity = 0);
|
||||||
|
// _connection.Update(returnChannelStockList);
|
||||||
|
|
||||||
|
//}
|
||||||
|
//else if(returnChannelStockList != null && returnChannelStockList.Count > 0)
|
||||||
|
//{
|
||||||
|
// for (int rt = 0; rt < ChannelStock.AddQuantity; rt++)
|
||||||
|
// {
|
||||||
|
// int AddQuan = ChannelStock.AddQuantity;
|
||||||
|
// int StockQuan = returnChannelStockList[rt].Quantity;
|
||||||
|
// returnChannelStockList[rt].Quantity = (StockQuan - AddQuan) <= 0 ? 0 : (StockQuan - AddQuan);
|
||||||
|
// ChannelStock.AddQuantity = AddQuan - StockQuan;
|
||||||
|
|
||||||
|
// }
|
||||||
|
|
||||||
|
// _connection.Update(returnChannelStockList);
|
||||||
|
//}
|
||||||
|
|
||||||
// 获取更新完库存之后的药品库存
|
// 获取更新完库存之后的药品库存
|
||||||
List<ChannelStock> list = await _connection.ChannelStock.AsQueryable()
|
List<ChannelStock> list = await _connection.ChannelStock.AsQueryable()
|
||||||
.Where(cs => cs.MachineId.Equals(_setting.machineId))
|
.Where(cs => cs.MachineId.Equals(_setting.machineId))
|
||||||
|
|
@ -547,7 +577,7 @@ namespace MasaBlazorApp3.DataAccess.Impl
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(!flag)
|
if (!flag)
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -70,14 +70,14 @@ namespace MasaBlazorApp3.DataAccess.Impl
|
||||||
|
|
||||||
public async Task<PageData<MachineRecord>> GetCanReturnRecords(DateTime start, DateTime end, int operatorId, string drugId, int? take, int? skip)
|
public async Task<PageData<MachineRecord>> GetCanReturnRecords(DateTime start, DateTime end, int operatorId, string drugId, int? take, int? skip)
|
||||||
{
|
{
|
||||||
var query = _connection.MachineRecord.AsQueryable().Where(it => it.MachineId.Equals(_setting.machineId));
|
var query = _connection.MachineRecord.AsQueryable().Where(it => it.MachineId.Equals(_setting.machineId)&&it.InvoiceId.StartsWith("DRAWER_"));
|
||||||
if (start != null && start != DateTime.MinValue)
|
if (start != null && start != DateTime.MinValue)
|
||||||
{
|
{
|
||||||
query = query.Where(mr => mr.OperationTime > start);
|
query = query.Where(mr => mr.OperationTime > start);
|
||||||
}
|
}
|
||||||
if (end != null && end != DateTime.MinValue)
|
if (end != null && end != DateTime.MinValue)
|
||||||
{
|
{
|
||||||
query = query.Where(mr => mr.OperationTime < end);
|
query = query.Where(mr => mr.OperationTime < end.AddDays(1));
|
||||||
}
|
}
|
||||||
if (operatorId != 0)
|
if (operatorId != 0)
|
||||||
{
|
{
|
||||||
|
|
@ -102,7 +102,7 @@ namespace MasaBlazorApp3.DataAccess.Impl
|
||||||
|
|
||||||
public async Task<PageData<MachineRecord>> GetMachineRecordAsync(DateTime start, DateTime end, int operatorId, string drugId, int type, int? take, int? skip)
|
public async Task<PageData<MachineRecord>> GetMachineRecordAsync(DateTime start, DateTime end, int operatorId, string drugId, int type, int? take, int? skip)
|
||||||
{
|
{
|
||||||
var query = from mr in _connection.MachineRecord select mr;
|
var query = from mr in _connection.MachineRecord select mr ;
|
||||||
|
|
||||||
if (start != null && start != DateTime.MinValue)
|
if (start != null && start != DateTime.MinValue)
|
||||||
{
|
{
|
||||||
|
|
@ -124,15 +124,15 @@ namespace MasaBlazorApp3.DataAccess.Impl
|
||||||
{
|
{
|
||||||
query = query.Where(mr => mr.DrugId == drugId);
|
query = query.Where(mr => mr.DrugId == drugId);
|
||||||
}
|
}
|
||||||
|
query = query.OrderByDescending(mr => mr.OperationTime);
|
||||||
query =from mr in query
|
query =from mr in query
|
||||||
from dr in _connection.DrugInfo.Where(d => d.DrugId == mr.DrugId)
|
from dr in _connection.DrugInfo.Where(d => d.DrugId == mr.DrugId)
|
||||||
from us in _connection.User.Where(u => u.Id == mr.Operator)
|
from us in _connection.User.Where(u => u.Id == mr.Operator)
|
||||||
select MachineRecord.Build(mr, dr, us);
|
select MachineRecord.Build(mr, dr, us);
|
||||||
|
|
||||||
|
|
||||||
int pagedData = await query.CountAsync();
|
int pagedData = await query.CountAsync();
|
||||||
List<MachineRecord> MachineRecords = await query
|
List<MachineRecord> MachineRecords = await query
|
||||||
.OrderByDescending(mr => mr.OperationTime)
|
//.OrderByDescending(mr => mr.OperationTime)
|
||||||
.Skip((int)skip)
|
.Skip((int)skip)
|
||||||
.Take((int)take)
|
.Take((int)take)
|
||||||
.ToListAsync();
|
.ToListAsync();
|
||||||
|
|
@ -302,6 +302,26 @@ namespace MasaBlazorApp3.DataAccess.Impl
|
||||||
record.Id = record.Id;
|
record.Id = record.Id;
|
||||||
record.Status = (record.Quantity - (record.ReturnQuantity1 + record.ReturnQuantity2 + sumQuantity)) <= 0 ? 2 : 1;
|
record.Status = (record.Quantity - (record.ReturnQuantity1 + record.ReturnQuantity2 + sumQuantity)) <= 0 ? 2 : 1;
|
||||||
_connection.Update(record);
|
_connection.Update(record);
|
||||||
|
|
||||||
|
//更新药盒库存(原库存减已还药数)
|
||||||
|
if(record.BoxDrawer>0)
|
||||||
|
{
|
||||||
|
//查询药盒库位中对应的药品信息
|
||||||
|
ChannelStock csBox = _connection.ChannelStock.Where(cs => cs.MachineId.Equals(_setting.boxMachineId) && cs.DrugId == record.DrugId && cs.ManuNo == record.ManuNo && cs.DrawerNo == record.BoxDrawer && cs.ColNo == record.BoxColNo).FirstOrDefault();
|
||||||
|
if(csBox!=null)
|
||||||
|
{
|
||||||
|
csBox.Quantity = csBox.Quantity - sumQuantity;
|
||||||
|
int iUpdateBox= _connection.Update(csBox);
|
||||||
|
if(iUpdateBox<=0)
|
||||||
|
{
|
||||||
|
logger.Info("更新药品库存失败");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
logger.Info($"未查询到药品{record.DrugId}批次{record.ManuNo}在库位{record.BoxDrawer}-{record.BoxColNo}中信息");
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,7 @@ using MasaBlazorApp3.Pojo;
|
||||||
using MasaBlazorApp3.Pojo.Config;
|
using MasaBlazorApp3.Pojo.Config;
|
||||||
using MasaBlazorApp3.Pojo.Vo;
|
using MasaBlazorApp3.Pojo.Vo;
|
||||||
using MasaBlazorApp3.Port;
|
using MasaBlazorApp3.Port;
|
||||||
|
using MasaBlazorApp3.Util;
|
||||||
using Microsoft.Extensions.Options;
|
using Microsoft.Extensions.Options;
|
||||||
using Mysqlx.Crud;
|
using Mysqlx.Crud;
|
||||||
using Radzen;
|
using Radzen;
|
||||||
|
|
@ -19,8 +20,11 @@ using System.Collections.Generic;
|
||||||
using System.Data;
|
using System.Data;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Reflection.PortableExecutable;
|
using System.Reflection.PortableExecutable;
|
||||||
|
using System.Security.Permissions;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using static LinqToDB.Common.Configuration;
|
||||||
|
using static LinqToDB.Reflection.Methods.LinqToDB.Insert;
|
||||||
|
|
||||||
namespace MasaBlazorApp3.DataAccess.Impl
|
namespace MasaBlazorApp3.DataAccess.Impl
|
||||||
{
|
{
|
||||||
|
|
@ -89,6 +93,64 @@ namespace MasaBlazorApp3.DataAccess.Impl
|
||||||
Desserts = list
|
Desserts = list
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
public async Task<PageData<OrderInfo>> GetAllOrderInfoForImport(string name, string OrderrNo, DateTime OrderDate, BoxModel boxModel, int? take, int? skip)
|
||||||
|
{
|
||||||
|
|
||||||
|
//var query = _connection.OrderInfo.AsQueryable();
|
||||||
|
|
||||||
|
//query.InnerJoin<OrderDetail>((oi, od) => oi.OrderNo == od.OrderNo);
|
||||||
|
|
||||||
|
var query2 = from od in _connection.OrderDetail
|
||||||
|
from cl in _connection.ChannelStock.Where(c => c.MachineId == _setting.boxMachineId && c.DrawerNo != boxModel.BoxName && c.ColNo != boxModel.BoxNo).InnerJoin(c => c.DrugId == od.DrugId)
|
||||||
|
group od by od.OrderNo into temp
|
||||||
|
select new { temp.Key };
|
||||||
|
var query = from oi in _connection.OrderInfo
|
||||||
|
from od in query2.InnerJoin(od => od.Key == oi.OrderNo)
|
||||||
|
select oi;
|
||||||
|
if (!string.IsNullOrEmpty(name))
|
||||||
|
{
|
||||||
|
query = query.Where(oi => oi.PatientName.Equals(name));
|
||||||
|
}
|
||||||
|
if (!String.IsNullOrEmpty(OrderrNo))
|
||||||
|
{
|
||||||
|
query = query.Where(oi => oi.OrderNo.Equals(OrderrNo));
|
||||||
|
}
|
||||||
|
if (OrderDate != null && OrderDate != DateTime.MinValue)
|
||||||
|
{
|
||||||
|
query = query.Where(oi => oi.ChargeDate.Date.Equals(OrderDate.Date));
|
||||||
|
}
|
||||||
|
|
||||||
|
query = query.Where(oi => oi.Status == 0);
|
||||||
|
query = query.Where(oi => oi.HisDispFlag == 0);
|
||||||
|
query = query.Where(oi => oi.CancelFlag == 0);
|
||||||
|
|
||||||
|
|
||||||
|
int pagedData = await query.CountAsync();
|
||||||
|
|
||||||
|
List<OrderInfo> list = await query
|
||||||
|
.LoadWith(oi => oi.DetailInfo)
|
||||||
|
//.LoadWith(oi => oi.DetailInfo.Drug)
|
||||||
|
.OrderBy((oi) => oi.RecvDate)
|
||||||
|
.ThenBy((oi => oi.OrderNo))
|
||||||
|
.Skip((int)skip)
|
||||||
|
.Take((int)take)
|
||||||
|
.ToListAsync();
|
||||||
|
for (int i = 0; i < list.Count; i++)
|
||||||
|
{
|
||||||
|
if (list[i].DetailInfo != null && list[i].DetailInfo.Id > 0)
|
||||||
|
{
|
||||||
|
list[i].DetailInfo.Drug = await _connection.DrugInfo.AsQueryable().Where(d => d.DrugId == list[i].DetailInfo.DrugId).FirstOrDefaultAsync();
|
||||||
|
list[i].SelectedOrderList = new List<OrderInfo>();
|
||||||
|
list[i].SelectedOrderList.Add(list[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return new PageData<OrderInfo>()
|
||||||
|
{
|
||||||
|
TotalDesserts = pagedData,
|
||||||
|
Desserts = list
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
public async Task<List<OrderDetail>> getDetailByOrderNo(string OrderrNo)
|
public async Task<List<OrderDetail>> getDetailByOrderNo(string OrderrNo)
|
||||||
{
|
{
|
||||||
|
|
@ -703,7 +765,7 @@ namespace MasaBlazorApp3.DataAccess.Impl
|
||||||
/// <param name="take"></param>
|
/// <param name="take"></param>
|
||||||
/// <param name="skip"></param>
|
/// <param name="skip"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public async Task<PageData<OrderInfo>> GetAllOrderInfo(string Name, string OrderrNo, DateTime? OrderDate, int? take, int? skip)
|
public async Task<PageData<OrderInfo>> GetAllOrderInfo(string Name, string BoxNum, string PatientName, string OrderrNo, DateTime? OrderDate, int? take, int? skip)
|
||||||
{
|
{
|
||||||
logger.Info($"GetAllOrderInfo开始:{DateTime.Now}");
|
logger.Info($"GetAllOrderInfo开始:{DateTime.Now}");
|
||||||
var query2 = from od in _connection.OrderDetail
|
var query2 = from od in _connection.OrderDetail
|
||||||
|
|
@ -718,15 +780,22 @@ namespace MasaBlazorApp3.DataAccess.Impl
|
||||||
{
|
{
|
||||||
query = query.Where(oi => oi.anaesthetistName == Name);
|
query = query.Where(oi => oi.anaesthetistName == Name);
|
||||||
}
|
}
|
||||||
|
if (!string.IsNullOrEmpty(BoxNum) && !BoxNum.Contains("99") && !BoxNum.Contains("111"))
|
||||||
//if (!String.IsNullOrEmpty(OrderrNo))
|
{
|
||||||
//{
|
query = query.Where(oi => oi.RoomName == BoxNum);
|
||||||
// query = query.Where(oi => oi.OrderNo.Equals(OrderrNo));
|
}
|
||||||
//}
|
if (!string.IsNullOrEmpty(PatientName))
|
||||||
//if (OrderDate != null && OrderDate != DateTime.MinValue)
|
{
|
||||||
//{
|
query = query.Where(oi => oi.PatientName.Contains(PatientName));
|
||||||
// query = query.Where(oi => oi.ChargeDate.Date.Equals(((DateTime)OrderDate).Date));
|
}
|
||||||
//}
|
if (!String.IsNullOrEmpty(OrderrNo))
|
||||||
|
{
|
||||||
|
query = query.Where(oi => oi.OrderNo.Equals(OrderrNo));
|
||||||
|
}
|
||||||
|
if (OrderDate != null && OrderDate != DateTime.MinValue)
|
||||||
|
{
|
||||||
|
query = query.Where(oi => oi.ChargeDate.Date.Equals(((DateTime)OrderDate).Date));
|
||||||
|
}
|
||||||
query = query.Where(oi => oi.Status == 0);
|
query = query.Where(oi => oi.Status == 0);
|
||||||
query = query.Where(oi => oi.HisDispFlag == 0);
|
query = query.Where(oi => oi.HisDispFlag == 0);
|
||||||
query = query.Where(oi => oi.CancelFlag == 0);
|
query = query.Where(oi => oi.CancelFlag == 0);
|
||||||
|
|
@ -735,13 +804,25 @@ namespace MasaBlazorApp3.DataAccess.Impl
|
||||||
|
|
||||||
List<OrderInfo> list = await query
|
List<OrderInfo> list = await query
|
||||||
.LoadWith(oi => oi.DetailInfo)
|
.LoadWith(oi => oi.DetailInfo)
|
||||||
.OrderBy((oi) => oi.RecvDate)
|
.OrderBy((oi) => oi.DetailInfo.DrugId)
|
||||||
.ThenBy((oi => oi.OrderNo))
|
.ThenBy((oi => oi.OrderNo))
|
||||||
//.Skip((int)skip)
|
//.Skip((int)skip)
|
||||||
//.Take((int)take)
|
//.Take((int)take)
|
||||||
.ToListAsync();
|
.ToListAsync();
|
||||||
if (list != null && list.Count > 0)
|
if (list != null && list.Count > 0)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
var group = list.GroupBy(it => it.DetailInfo.DrugId)
|
||||||
|
.Select(it => new
|
||||||
|
{
|
||||||
|
drugId = it.Key,
|
||||||
|
totalQuantity = it.Sum(g => g.DetailInfo.Quantity)
|
||||||
|
});
|
||||||
|
foreach (var item in group)
|
||||||
|
{
|
||||||
|
OrderInfo oiGroup = list.Where(it => it.DetailInfo.DrugId == item.drugId).FirstOrDefault();
|
||||||
|
list.Where(it => it.OrderId == oiGroup.OrderId).ToList().ForEach(it => it.DetailInfo.TotalQuantity = item.totalQuantity);
|
||||||
|
}
|
||||||
for (int i = 0; i < list.Count; i++)
|
for (int i = 0; i < list.Count; i++)
|
||||||
{
|
{
|
||||||
if (list[i].DetailInfo != null && list[i].DetailInfo.Id > 0)
|
if (list[i].DetailInfo != null && list[i].DetailInfo.Id > 0)
|
||||||
|
|
@ -762,6 +843,103 @@ namespace MasaBlazorApp3.DataAccess.Impl
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 获取待处理处方中的麻醉师
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="OrderrNo"></param>
|
||||||
|
/// <param name="OrderDate"></param>
|
||||||
|
/// <param name="take"></param>
|
||||||
|
/// <param name="skip"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public async Task<PageData<ChannelStock>> GetAllOrderInfoDrugByBox(BoxModel boxNum, string roomName, DateTime? OrderDate)
|
||||||
|
{
|
||||||
|
List<ChannelStock> csList = await _connection.ChannelStock
|
||||||
|
.Where(cs => cs.MachineId == _setting.boxMachineId && cs.DrawerNo == boxNum.BoxName && cs.ColNo == boxNum.BoxNo && cs.Quantity > 0)
|
||||||
|
.LoadWith(cs => cs.Drug)
|
||||||
|
.ToListAsync();
|
||||||
|
if (csList != null && csList.Count > 0)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < csList.Count; i++)
|
||||||
|
{
|
||||||
|
List<OrderInfo> oiList = await _connection.OrderInfo.Where(oi => oi.RoomName == roomName && oi.Status == 0 && oi.HisDispFlag == 0 && oi.CancelFlag == 0 && oi.ChargeDate.Date.Equals(((DateTime)OrderDate).Date))
|
||||||
|
.LoadWith(oi => oi.DetailInfo).Where(oi => oi.DetailInfo.DrugId == csList[i].DrugId && oi.DetailInfo.SetManuNo == csList[i].ManuNo)
|
||||||
|
.ToListAsync();
|
||||||
|
csList[i].OrderList = oiList;
|
||||||
|
csList[i].SelectedOrderList = oiList;
|
||||||
|
csList[i].UseQuantity = oiList.Sum(oi => oi.DetailInfo.Quantity);
|
||||||
|
csList[i].OrderQuantity = oiList.Count;
|
||||||
|
csList[i].EmptyQuantity = oiList.Sum(oi => oi.DetailInfo.Quantity);
|
||||||
|
csList[i].TotalQuantity = csList.Where(c => c.DrugId == csList[i].DrugId).Sum(c => c.Quantity);
|
||||||
|
if ((String.IsNullOrEmpty(csList[i].ListId) && csList[i].Quantity > csList[i].UseQuantity) || (csList[i].Quantity > csList[i].BaseQuantity))
|
||||||
|
{
|
||||||
|
//药品未在套餐中绑定需要把药还到对应抽屉
|
||||||
|
List<ChannelStock> allDrugStock = await GetStockByDRrug(csList[i].DrugId, csList[i].ManuNo, 1);// await _connection.ChannelStock.Where(cs => cs.MachineId == _setting.machineId && cs.DrawerType == 1 && cs.DrugId == csList[i].DrugId && cs.ManuNo == csList[i].ManuNo).OrderBy(cs => cs.Quantity).ToListAsync();
|
||||||
|
if (allDrugStock != null && allDrugStock.Count > 0)
|
||||||
|
{
|
||||||
|
csList[i].DrawerChanneStockList = new();
|
||||||
|
int iReturnQuantity = csList[i].Quantity - csList[i].UseQuantity - csList[i].BaseQuantity;
|
||||||
|
for (int j = 0; j < allDrugStock.Count; j++)
|
||||||
|
{
|
||||||
|
if (allDrugStock[j].BoardType.ToString().Contains("2") && allDrugStock[j].Quantity >= 25)
|
||||||
|
continue;
|
||||||
|
if (allDrugStock[j].BoardType.ToString().Contains("2") && allDrugStock[j].Quantity + csList[i].Quantity - csList[i].UseQuantity > 25)
|
||||||
|
{
|
||||||
|
//if (iReturnQuantity <= allDrugStock.Sum(it => it.Quantity))
|
||||||
|
if (allDrugStock[j].Quantity <= 25)
|
||||||
|
{
|
||||||
|
//有空位置可以放
|
||||||
|
int canStockQuantity = 25 - allDrugStock[j].Quantity;
|
||||||
|
if (canStockQuantity > iReturnQuantity)
|
||||||
|
{
|
||||||
|
allDrugStock[j].ReturnQuantity = iReturnQuantity;
|
||||||
|
csList[i].DrawerChanneStockList.Add(allDrugStock[j]);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
allDrugStock[j].ReturnQuantity = canStockQuantity;
|
||||||
|
iReturnQuantity = iReturnQuantity - allDrugStock[j].ReturnQuantity;
|
||||||
|
csList[i].DrawerChanneStockList.Add(allDrugStock[j]);
|
||||||
|
}
|
||||||
|
//iReturnQuantity = iReturnQuantity - allDrugStock[j].ReturnQuantity;
|
||||||
|
//for (int q = 0; iReturnQuantity > 0; q++)
|
||||||
|
//{
|
||||||
|
|
||||||
|
// allDrugStock[j].ReturnQuantity = 25 - allDrugStock[q].Quantity;
|
||||||
|
// csList[i].DrawerChanneStockList.Add(allDrugStock[q]);
|
||||||
|
// iReturnQuantity = iReturnQuantity - allDrugStock[q].ReturnQuantity;
|
||||||
|
// if (iReturnQuantity <= 0)
|
||||||
|
// break;
|
||||||
|
//}
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//库位不足,有药品无库位可放
|
||||||
|
allDrugStock[j].ReturnQuantity = iReturnQuantity;
|
||||||
|
csList[i].DrawerChanneStockList.Add(allDrugStock[j]);
|
||||||
|
logger.Info($"还药品【{csList[i].Drug.DrugName}】库位不足,有药品无库位可放");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
allDrugStock[j].ReturnQuantity = iReturnQuantity;
|
||||||
|
csList[i].DrawerChanneStockList.Add(allDrugStock[j]);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
int pagedData = csList.Count;
|
||||||
|
return new PageData<ChannelStock>()
|
||||||
|
{
|
||||||
|
TotalDesserts = pagedData,
|
||||||
|
Desserts = csList.OrderBy(cs => cs.DrugId).OrderByDescending(cs => cs.UseQuantity).ToList()
|
||||||
|
};
|
||||||
|
}
|
||||||
//public List<string> GetAnaesthetistName()
|
//public List<string> GetAnaesthetistName()
|
||||||
//{
|
//{
|
||||||
// List<string> strList = new List<string>();
|
// List<string> strList = new List<string>();
|
||||||
|
|
@ -776,7 +954,7 @@ namespace MasaBlazorApp3.DataAccess.Impl
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public async Task<List<ChannelStock>> GetDrawerNum(string machineId)
|
public async Task<List<ChannelStock>> GetDrawerNum(string machineId)
|
||||||
{
|
{
|
||||||
List<ChannelStock> stockList = _connection.ChannelStock
|
List<ChannelStock> stockList = _connection.ChannelStock
|
||||||
.Where(cs => cs.MachineId == machineId)
|
.Where(cs => cs.MachineId == machineId)
|
||||||
.GroupBy(cs => new { cs.DrawerNo, cs.ColNo })
|
.GroupBy(cs => new { cs.DrawerNo, cs.ColNo })
|
||||||
.Select(g => new ChannelStock
|
.Select(g => new ChannelStock
|
||||||
|
|
@ -792,14 +970,29 @@ namespace MasaBlazorApp3.DataAccess.Impl
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="machineId"></param>
|
/// <param name="machineId"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public async Task<List<BoxModel>> GetDrawerNumByOperationNum(string machineId,List<int> operationNum)
|
public async Task<List<BoxModel>> GetDrawerNumByOperationNum(string machineId, int boxColor)
|
||||||
{
|
{
|
||||||
List<BoxModel> boxModelList = new List<BoxModel>();
|
List<BoxModel> boxModelList = new List<BoxModel>();
|
||||||
//var query = _connection.ChannelStock
|
//var query = _connection.ChannelStock
|
||||||
// .Where(cs => cs.MachineId == machineId && operationNum.Contains(cs.DrawerNo)&&cs.Quantity>0);
|
// .Where(cs => cs.MachineId == machineId && operationNum.Contains(cs.DrawerNo)&&cs.Quantity>0);
|
||||||
boxModelList = await _connection.ChannelStock
|
//boxModelList = await _connection.ChannelStock
|
||||||
.Where(cs => cs.MachineId == machineId && cs.Quantity > 0 && (operationNum.Contains(cs.DrawerNo)))
|
// .Where(cs => cs.MachineId == machineId && cs.Quantity > 0 && (operationNum.Contains(cs.DrawerNo)))
|
||||||
.Select(cs => new BoxModel { BoxName = cs.DrawerNo, BoxNo = Convert.ToInt32(cs.ColNo) }).Distinct().OrderBy(cs=>new { cs.BoxName, cs.BoxNo }).ToListAsync();
|
// .Select(cs => new BoxModel { BoxName = cs.DrawerNo, BoxNo = Convert.ToInt32(cs.ColNo) }).Distinct().OrderBy(cs=>new { cs.BoxName, cs.BoxNo }).ToListAsync();
|
||||||
|
//return boxModelList;
|
||||||
|
var query = _connection.ChannelList.Where(cs => cs.MachineId == machineId).AsQueryable();
|
||||||
|
if (boxColor > 0)
|
||||||
|
{
|
||||||
|
query.Where(cs => cs.ColNo == boxColor);
|
||||||
|
}
|
||||||
|
List<ChannelList> csList = query.OrderBy(cs => cs.DrawerNo).ToList();
|
||||||
|
if (csList != null && csList.Count > 0)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < csList.Count; i++)
|
||||||
|
{
|
||||||
|
boxModelList.Add(new BoxModel { BoxName = csList[i].DrawerNo, BoxNo = csList[i].ColNo });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return boxModelList;
|
return boxModelList;
|
||||||
}
|
}
|
||||||
//核对处方
|
//核对处方
|
||||||
|
|
@ -819,7 +1012,7 @@ namespace MasaBlazorApp3.DataAccess.Impl
|
||||||
OrderInfo oi = selectedOrderInfos[i];
|
OrderInfo oi = selectedOrderInfos[i];
|
||||||
|
|
||||||
|
|
||||||
int drawerNo =Convert.ToInt32(boxModel.BoxName);
|
int drawerNo = Convert.ToInt32(boxModel.BoxName);
|
||||||
if (oi.DetailInfo != null && oi.DetailInfo.Id > 0)
|
if (oi.DetailInfo != null && oi.DetailInfo.Id > 0)
|
||||||
{
|
{
|
||||||
//ChannelStock? cs = _connection.ChannelStock.AsQueryable()
|
//ChannelStock? cs = _connection.ChannelStock.AsQueryable()
|
||||||
|
|
@ -832,27 +1025,27 @@ namespace MasaBlazorApp3.DataAccess.Impl
|
||||||
List<ChannelStock> cs = _connection.ChannelStock.AsQueryable()
|
List<ChannelStock> cs = _connection.ChannelStock.AsQueryable()
|
||||||
.Where(cs => cs.DrugId == oi.DetailInfo.DrugId
|
.Where(cs => cs.DrugId == oi.DetailInfo.DrugId
|
||||||
&& cs.ManuNo == oi.DetailInfo.drugManuNo.ManuNo
|
&& cs.ManuNo == oi.DetailInfo.drugManuNo.ManuNo
|
||||||
&& cs.EffDate == ((DateTime)oi.DetailInfo.drugManuNo.EffDate).ToString("yyyy-MM-dd")
|
//&& cs.EffDate == ((DateTime)oi.DetailInfo.drugManuNo.EffDate).ToString("yyyy-MM-dd")
|
||||||
&& cs.MachineId.Equals(_setting.boxMachineId)
|
&& cs.MachineId.Equals(_setting.boxMachineId)
|
||||||
&& cs.DrawerNo == drawerNo&&cs.ColNo== boxModel.BoxNo).OrderBy(cs => cs.EffDate).ToList();
|
&& cs.DrawerNo == drawerNo && cs.ColNo == boxModel.BoxNo).OrderBy(cs => cs.EffDate).ToList();
|
||||||
if (cs.Count <= 0)
|
if (cs.Count <= 0)
|
||||||
{
|
{
|
||||||
logger.Info($"处方{oi.OrderNo}中药品{oi.DetailInfo.DrugId}在{drawerNo}号药盒无库存");
|
logger.Info($"处方{oi.OrderNo}中药品{oi.DetailInfo.Drug.DrugName}在{drawerNo}号药盒无库存");
|
||||||
empChannelStock += $"处方{oi.OrderNo}中药品{oi.DetailInfo.DrugId}在{drawerNo}号药盒无库存 ";
|
empChannelStock += $"处方{oi.OrderNo}中药品{oi.DetailInfo.Drug.DrugName}在{drawerNo}号药盒无库存 ";
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
int csQuantity = cs.Sum(cs => cs.Quantity);
|
int csQuantity = cs.Sum(cs => cs.Quantity);
|
||||||
if (csQuantity < oi.DetailInfo.Quantity)
|
if (csQuantity < oi.DetailInfo.Quantity)
|
||||||
{
|
{
|
||||||
logger.Info($"处方{oi.OrderNo}中药品{oi.DetailInfo.DrugId}在{drawerNo}号库存不足,需要核对数{oi.DetailInfo.Quantity},库存总数{csQuantity}");
|
logger.Info($"处方{oi.OrderNo}中药品{oi.DetailInfo.Drug.DrugName}在{drawerNo}号库存不足,需要核对数{oi.DetailInfo.Quantity},库存总数{csQuantity}");
|
||||||
empChannelStock += $"处方{oi.OrderNo}中药品{oi.DetailInfo.DrugId}在{drawerNo}号库存不足,需要核对数{oi.DetailInfo.Quantity},库存总数{csQuantity} ";
|
empChannelStock += $"处方{oi.OrderNo}中药品{oi.DetailInfo.Drug.DrugName}在{drawerNo}号库存不足,需要核对数{oi.DetailInfo.Quantity},库存总数{csQuantity} ";
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
//更新处方状态
|
//更新处方状态
|
||||||
if (oi.Status == 0)
|
if (oi.Status == 0)
|
||||||
{
|
{
|
||||||
int iUpdate = _connection.OrderInfo.Where(o => o.OrderNo == oi.OrderNo).Set(o => o.Status, 2).Update();
|
int iUpdate = _connection.OrderInfo.Where(o => o.OrderNo == oi.OrderNo).Set(o => o.Status, 2).Update();
|
||||||
int odUpdate = _connection.OrderDetail.Where(od => od.OrderNo == oi.OrderNo).Set(od => od.SetManuNo, oi.DetailInfo.drugManuNo.ManuNo).Update();
|
int odUpdate = _connection.OrderDetail.Where(od => od.OrderNo == oi.OrderNo).Set(od => od.SetManuNo, oi.DetailInfo.drugManuNo.ManuNo).Set(od => od.Quantity, oi.DetailInfo.Quantity).Update();
|
||||||
_connection.Insert(new OrderFinish()
|
_connection.Insert(new OrderFinish()
|
||||||
{
|
{
|
||||||
OrderNo = oi.OrderNo,
|
OrderNo = oi.OrderNo,
|
||||||
|
|
@ -1017,7 +1210,322 @@ namespace MasaBlazorApp3.DataAccess.Impl
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
logger.Info($"管理员{_globalStateService.Operator.NickName}结束确认手麻单");
|
logger.Info($"管理员{_globalStateService.Operator.NickName}结束确认手麻单");
|
||||||
if(!string.IsNullOrEmpty(empChannelStock))
|
if (!string.IsNullOrEmpty(empChannelStock))
|
||||||
|
{
|
||||||
|
_message.Notify(
|
||||||
|
new NotificationMessage { Severity = NotificationSeverity.Error, Summary = "提示", Detail = $"有未核对处方:{empChannelStock}", Duration = 4000 }
|
||||||
|
);
|
||||||
|
_connection.RollbackTransaction();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (bFlag)
|
||||||
|
{
|
||||||
|
_connection.CommitTransaction();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_connection.RollbackTransaction();
|
||||||
|
logger.Info($"管理员{_globalStateService.Operator.NickName}确认手麻单失败");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
_connection.RollbackTransaction();
|
||||||
|
logger.Info($"核对处方异常{ex.Message}");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
int status;
|
||||||
|
//核对处方
|
||||||
|
public async Task<bool> CheckOrderInfoByChannelStock(IList<ChannelStock> csList, BoxModel boxModel)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
_connection.BeginTransaction();
|
||||||
|
bool bFlag = true;
|
||||||
|
logger.Info($"管理员{_globalStateService.Operator.NickName}开始核对处方");
|
||||||
|
|
||||||
|
|
||||||
|
string empChannelStock = string.Empty;
|
||||||
|
|
||||||
|
for (int i = 0; i < csList.Count; i++)
|
||||||
|
{
|
||||||
|
ChannelStock channelStock = csList[i];
|
||||||
|
if (channelStock != null && channelStock.SelectedOrderList != null && channelStock.SelectedOrderList.Count > 0)
|
||||||
|
{
|
||||||
|
List<OrderInfo> oiList = channelStock.SelectedOrderList.ToList();
|
||||||
|
for (int j = 0; j < oiList.Count; j++)
|
||||||
|
{
|
||||||
|
//修改选中的处方状态
|
||||||
|
int iUpdate = _connection.OrderInfo.Where(o => o.OrderNo == oiList[j].OrderNo).Set(o => o.Status, 2).Update();
|
||||||
|
_connection.Insert(new OrderFinish()
|
||||||
|
{
|
||||||
|
OrderNo = oiList[j].OrderNo,
|
||||||
|
PatientId = oiList[j].PatientId,
|
||||||
|
Pharmacy = oiList[j].Pharmacy,
|
||||||
|
State = 1,
|
||||||
|
//WinNo = DrawerNo + 1 + "号手术间",
|
||||||
|
Operator = _globalStateService.Operator.NickName,
|
||||||
|
});
|
||||||
|
//更新库存
|
||||||
|
channelStock.Quantity = channelStock.Quantity - oiList[j].DetailInfo.Quantity;
|
||||||
|
_connection.Update(channelStock);
|
||||||
|
|
||||||
|
//更新ChannelList对应的总库存
|
||||||
|
if (!string.IsNullOrEmpty(channelStock.ListId) && channelStock.ListId != "0")
|
||||||
|
{
|
||||||
|
ChannelList? channelList = _connection.ChannelList.AsQueryable().Where(cl => cl.Id == channelStock.ListId).FirstOrDefault();
|
||||||
|
if (channelList != null)
|
||||||
|
{
|
||||||
|
channelList.TotalQuantity = channelList.TotalQuantity - oiList[j].DetailInfo.Quantity;
|
||||||
|
_connection.Update(channelList);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//记录出库记录
|
||||||
|
_connection.Insert(new MachineRecord()
|
||||||
|
{
|
||||||
|
MachineId = _setting.machineId,
|
||||||
|
DrawerNo = channelStock.DrawerNo,
|
||||||
|
ColNo = channelStock.ColNo,
|
||||||
|
DrugId = channelStock.DrugId,
|
||||||
|
ManuNo = channelStock.ManuNo,
|
||||||
|
EffDate = !String.IsNullOrEmpty(channelStock.EffDate) ? DateTime.ParseExact(channelStock.EffDate, "yyyy-MM-dd", System.Globalization.CultureInfo.CurrentCulture) : null,
|
||||||
|
Operator = _globalStateService.Operator?.Id,
|
||||||
|
Reviewer = _globalStateService.Reviewer?.Id,
|
||||||
|
OperationTime = DateTime.Now,
|
||||||
|
Quantity = oiList[j].DetailInfo.Quantity,
|
||||||
|
Type = 2,
|
||||||
|
InvoiceId = oiList[j].OrderNo
|
||||||
|
});
|
||||||
|
//保存账册
|
||||||
|
// 获取更新完库存后的药品库存
|
||||||
|
List<ChannelStock> nowChannels = _connection.ChannelStock.AsQueryable()
|
||||||
|
.Where(it => it.MachineId.Equals(_setting.machineId) || it.MachineId.Equals(_setting.boxMachineId))
|
||||||
|
.Where(it => it.DrugId.Equals(oiList[j].DetailInfo.DrugId))
|
||||||
|
.Where(it => it.ManuNo.Equals(oiList[j].DetailInfo.SetManuNo))
|
||||||
|
.Where(it => it.DrawerType == 1)
|
||||||
|
.ToList();
|
||||||
|
//查询上一条账册中的空瓶数
|
||||||
|
AccountBookG2? accountBookEmpty = _connection.AccountBookG2.AsQueryable()
|
||||||
|
.Where(ab => ab.MachineId.Equals(_setting.machineId))
|
||||||
|
.Where(ab => ab.Type == 1 || ab.Type == 2)
|
||||||
|
.Where(ab => ab.DrugId == oiList[j].DetailInfo.DrugId)
|
||||||
|
.Where(ab => ab.ManuNo == oiList[j].DetailInfo.SetManuNo).OrderByDescending(ab => ab.Id).FirstOrDefault();
|
||||||
|
//保存账册
|
||||||
|
int iInsertResult = _connection.Insert(new AccountBookG2()
|
||||||
|
{
|
||||||
|
DrugId = oiList[j].DetailInfo.DrugId,
|
||||||
|
Type = 2,
|
||||||
|
Department = oiList[j].DeptName,
|
||||||
|
OrderNo = oiList[j].OrderNo,
|
||||||
|
ManuNo = oiList[j].DetailInfo.SetManuNo,
|
||||||
|
EffDate = oiList[j].DetailInfo.SetEffDate,
|
||||||
|
OutQuantity = oiList[j].DetailInfo.Quantity,
|
||||||
|
UserId1 = _globalStateService.Operator?.Id,
|
||||||
|
UserId2 = _globalStateService.Reviewer?.Id,
|
||||||
|
MachineId = _setting.machineId,
|
||||||
|
CreateDate = DateTime.Now.ToString("yyyy-MM-dd"),
|
||||||
|
CreateTime = DateTime.Now,
|
||||||
|
InvoiceNo = oiList[j].OrderNo,
|
||||||
|
ManuStock = nowChannels.Sum(it => it.Quantity),
|
||||||
|
TotalStock = (accountBookEmpty != null ? (accountBookEmpty.TotalStock > 0 ? accountBookEmpty.TotalStock : 0) : 0) + oiList[j].DetailInfo.Quantity,
|
||||||
|
ShoushuJian = oiList[j].RoomName
|
||||||
|
});
|
||||||
|
|
||||||
|
//修改日结
|
||||||
|
//修改凌晨生成的日结存与总结存数据
|
||||||
|
AccountBookG2? accountBookG2Day = _connection.AccountBookG2.AsQueryable()
|
||||||
|
.Where(ab => ab.MachineId.Equals(_setting.machineId))
|
||||||
|
.Where(ab => ab.Type == 3)
|
||||||
|
.Where(ab => ab.DrugId == oiList[j].DetailInfo.DrugId)
|
||||||
|
.Where(ab => ab.ManuNo == oiList[j].DetailInfo.SetManuNo)
|
||||||
|
.Where(ab => ab.CreateDate == DateTime.Now.ToString("yyyy-MM-dd")).FirstOrDefault();
|
||||||
|
if (accountBookG2Day != null)
|
||||||
|
{
|
||||||
|
accountBookG2Day.ManuStock = accountBookG2Day.ManuStock - oiList[j].DetailInfo.Quantity;
|
||||||
|
_connection.Update(accountBookG2Day);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//生成日结存时可能没有该库位的绑定信息,需要写入日结存
|
||||||
|
int iDayResult = _connection.Insert(new AccountBookG2()
|
||||||
|
{
|
||||||
|
DrugId = oiList[j].DetailInfo.DrugId,
|
||||||
|
Type = 3,
|
||||||
|
ManuNo = oiList[j].DetailInfo.SetManuNo,
|
||||||
|
EffDate = oiList[j].DetailInfo.SetEffDate,
|
||||||
|
YQuantity = 0,
|
||||||
|
ManuStock = oiList[j].DetailInfo.Quantity,
|
||||||
|
TotalStock = oiList[j].DetailInfo.Quantity,
|
||||||
|
UserId1 = _globalStateService.Operator?.Id,
|
||||||
|
UserId2 = _globalStateService.Reviewer?.Id,
|
||||||
|
MachineId = _setting.machineId,
|
||||||
|
CreateDate = DateTime.Now.ToString("yyyy-MM-dd"),
|
||||||
|
InvoiceNo = "日结存"
|
||||||
|
});
|
||||||
|
if (iDayResult <= 0)
|
||||||
|
{
|
||||||
|
logger.Info($"未写入日结存数据{oiList[j].DetailInfo.DrugId}-{oiList[j].DetailInfo.SetManuNo}-{oiList[j].DetailInfo.SetEffDate}-{oiList[j].DetailInfo.Quantity}");
|
||||||
|
empChannelStock += $"未写入日结存数据{oiList[j].DetailInfo.DrugId}-{oiList[j].DetailInfo.SetManuNo}-{oiList[j].DetailInfo.SetEffDate}-{oiList[j].DetailInfo.Quantity} ";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//总结
|
||||||
|
//修改凌晨生成的日结存与总结存数据
|
||||||
|
AccountBookG2? accountBookG2Total = _connection.AccountBookG2.AsQueryable()
|
||||||
|
.Where(ab => ab.MachineId.Equals(_setting.machineId))
|
||||||
|
.Where(ab => ab.Type == 4)
|
||||||
|
.Where(ab => ab.DrugId == oiList[j].DetailInfo.DrugId)
|
||||||
|
.Where(ab => ab.CreateDate == DateTime.Now.ToString("yyyy-MM-dd")).FirstOrDefault();
|
||||||
|
if (accountBookG2Total != null)
|
||||||
|
{
|
||||||
|
accountBookG2Total.TotalStock = accountBookG2Total.TotalStock - oiList[j].DetailInfo.Quantity;// oi.DetailList[j].Quantity;
|
||||||
|
_connection.Update(accountBookG2Total);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//生成总结存时可能没有该库位的绑定信息,需要写入总结存
|
||||||
|
int iTotalResult = _connection.Insert(new AccountBookG2()
|
||||||
|
{
|
||||||
|
DrugId = oiList[j].DetailInfo.DrugId,
|
||||||
|
Type = 4,
|
||||||
|
YQuantity = 0,
|
||||||
|
ManuStock = oiList[j].DetailInfo.Quantity,
|
||||||
|
TotalStock = oiList[j].DetailInfo.Quantity,
|
||||||
|
UserId1 = _globalStateService.Operator?.Id,
|
||||||
|
UserId2 = _globalStateService.Reviewer?.Id,
|
||||||
|
MachineId = _setting.machineId,
|
||||||
|
CreateDate = DateTime.Now.ToString("yyyy-MM-dd"),
|
||||||
|
InvoiceNo = "总结存"
|
||||||
|
});
|
||||||
|
if (iTotalResult <= 0)
|
||||||
|
{
|
||||||
|
logger.Info($"未写入总结存数据{oiList[j].DetailInfo.DrugId}-{oiList[j].DetailInfo.Quantity}");
|
||||||
|
empChannelStock += $"未写入总结存数据{oiList[j].DetailInfo.DrugId}-{oiList[j].DetailInfo.Quantity} ";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//移出库位里是否有未绑套餐且库存为0的数据,有则删除
|
||||||
|
_connection.ChannelStock.Where(cs => cs.MachineId.Equals(_setting.boxMachineId) && (string.IsNullOrEmpty(cs.ListId)) && cs.DrawerNo == channelStock.DrawerNo && cs.ColNo == channelStock.ColNo && cs.Quantity <= 0).Delete();
|
||||||
|
//删除绑定套餐中同一药品多批次且库存为0的第一条数据
|
||||||
|
List<ChannelStock> delChannelStock = await _connection.ChannelStock.Where(cs => cs.MachineId.Equals(_setting.boxMachineId) && cs.DrawerNo == channelStock.DrawerNo && cs.ColNo == channelStock.ColNo && cs.DrugId == channelStock.DrugId).ToListAsync();
|
||||||
|
if (delChannelStock != null && delChannelStock.Count > 1)
|
||||||
|
{
|
||||||
|
//删除绑定套餐中库存为0的药的批次数据,只保留一条数据
|
||||||
|
List<ChannelStock> del = delChannelStock.Where(c => c.Quantity <= 0).ToList();
|
||||||
|
if (del != null && del.Count > 0)
|
||||||
|
{
|
||||||
|
if (delChannelStock.Count == del.Count)
|
||||||
|
{
|
||||||
|
for (int d = 1; d < del.Count; d++)
|
||||||
|
{
|
||||||
|
_connection.ChannelStock.Where(cs => cs.Id == del[d].Id).Delete();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
for (int d = 0; d < del.Count; d++)
|
||||||
|
{
|
||||||
|
_connection.ChannelStock.Where(cs => cs.Id == del[d].Id).Delete();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
List<OrderTakeVo> drawerNos = new();
|
||||||
|
List<ChannelStock> returnStock = new();
|
||||||
|
//if (csList.Any(c => c.DrawerChanneStockList?.Count > 0))
|
||||||
|
|
||||||
|
if (csList[i].DrawerChanneStockList != null && csList[i].DrawerChanneStockList.Count > 0)
|
||||||
|
{
|
||||||
|
List<ChannelStock> drawerChannelStockList = csList[i].DrawerChanneStockList;
|
||||||
|
for (int j = 0; j < drawerChannelStockList.Count; j++)
|
||||||
|
{
|
||||||
|
//还药将库存加入抽屉、从药盒中减库存
|
||||||
|
_connection.ChannelStock.Where(cs => cs.Id == csList[i].DrawerChanneStockList[j].Id).Set(cs => cs.Quantity, csList[i].DrawerChanneStockList[j].Quantity + csList[i].DrawerChanneStockList[j].ReturnQuantity).Update();
|
||||||
|
_connection.ChannelStock.Where(cs => cs.Id == csList[i].Id).Set(cs => cs.Quantity, csList[i].Quantity - csList[i].DrawerChanneStockList[j].ReturnQuantity).Update();
|
||||||
|
//药盒对应channel_list表总库存也要减
|
||||||
|
ChannelList clList = _connection.ChannelList.Where(cl => cl.MachineId.Equals(_setting.boxMachineId) && cl.DrawerNo == csList[i].DrawerNo && cl.ColNo == csList[i].ColNo).FirstOrDefault();
|
||||||
|
if (clList != null)
|
||||||
|
{
|
||||||
|
clList.TotalQuantity -= csList[i].DrawerChanneStockList[j].ReturnQuantity;
|
||||||
|
int iUpdate = await _connection.UpdateAsync(clList);
|
||||||
|
if (iUpdate <= 0)
|
||||||
|
{
|
||||||
|
logger.Info($"抽屉还药记录药盒{boxModel.BoxName}-{boxModel.BoxNo}总库存失败,还药数量{csList[i].DrawerChanneStockList[j].ReturnQuantity}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
MachineRecord _MachineRecord = _connection.MachineRecord
|
||||||
|
.Where(dm => dm.MachineId.Equals(_setting.boxMachineId) && dm.DrugId == csList[i].DrugId && dm.ManuNo == csList[i].ManuNo && dm.BoxDrawer == csList[i].DrawerNo && dm.ColNo == csList[i].ColNo && dm.Type == 2 && dm.Status != 2).FirstOrDefault();
|
||||||
|
if (_MachineRecord != null)
|
||||||
|
{
|
||||||
|
_MachineRecord.ReturnQuantity2 = _MachineRecord.ReturnQuantity2 + _MachineRecord.CurrentReturnQuantity;
|
||||||
|
_MachineRecord.Status = _MachineRecord.ReturnQuantity2 + _MachineRecord.ReturnQuantity1 >= _MachineRecord.Quantity ? 2 : 1;
|
||||||
|
// 更新借药数据 取药记录 设置还药数量、状态
|
||||||
|
_connection.Update(_MachineRecord);
|
||||||
|
}
|
||||||
|
//添加还药记录
|
||||||
|
int acid = _connection.InsertWithInt32Identity(new MachineRecord()
|
||||||
|
{
|
||||||
|
MachineId = _setting.boxMachineId,
|
||||||
|
DrawerNo = csList[i].DrawerChanneStockList[j].DrawerNo,
|
||||||
|
ColNo = csList[i].DrawerChanneStockList[j].ColNo,
|
||||||
|
DrugId = csList[i].DrugId,
|
||||||
|
ManuNo = csList[i].DrawerChanneStockList[j].ManuNo,
|
||||||
|
// EffDate = !String.IsNullOrEmpty(record.EffDate) ? DateTime.ParseExact(record.EffDate, "yyyy-MM-dd", System.Globalization.CultureInfo.CurrentCulture) : null,
|
||||||
|
Operator = _globalStateService.Operator?.Id,
|
||||||
|
Reviewer = _globalStateService.Reviewer?.Id,
|
||||||
|
OperationTime = DateTime.Now,
|
||||||
|
Quantity = csList[i].DrawerChanneStockList[j].ReturnQuantity,
|
||||||
|
Type = 31,
|
||||||
|
InvoiceId = csList[i].Location,
|
||||||
|
GetId = _MachineRecord?.GetId
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
if (csList[i].EmptyStock != null && csList[i].EmptyStock.ReturnQuantity > 0)
|
||||||
|
{
|
||||||
|
//还空瓶,将空瓶数量加到空瓶库位 //还药将库存加入抽屉、从药盒中减库存
|
||||||
|
_connection.ChannelStock.Where(cs => cs.Id == csList[i].EmptyStock.Id).Set(cs => cs.Quantity, csList[i].EmptyStock.Quantity + csList[i].EmptyStock.ReturnQuantity).Update();
|
||||||
|
|
||||||
|
MachineRecord _MachineRecord = _connection.MachineRecord
|
||||||
|
.Where(dm => dm.MachineId.Equals(_setting.boxMachineId) && dm.DrugId == csList[i].DrugId && dm.ManuNo == csList[i].ManuNo && dm.BoxDrawer == csList[i].DrawerNo && dm.ColNo == csList[i].ColNo && dm.Type == 2 && dm.Status != 2).FirstOrDefault();
|
||||||
|
if (_MachineRecord != null)
|
||||||
|
{
|
||||||
|
_MachineRecord.ReturnQuantity2 = _MachineRecord.ReturnQuantity2 + _MachineRecord.CurrentReturnQuantity;
|
||||||
|
_MachineRecord.Status = _MachineRecord.ReturnQuantity2 + _MachineRecord.ReturnQuantity1 >= _MachineRecord.Quantity ? 2 : 1;
|
||||||
|
// 更新借药数据 取药记录 设置还药数量、状态
|
||||||
|
_connection.Update(_MachineRecord);
|
||||||
|
}
|
||||||
|
//添加还空瓶记录
|
||||||
|
int acid = _connection.InsertWithInt32Identity(new MachineRecord()
|
||||||
|
{
|
||||||
|
MachineId = _setting.boxMachineId,
|
||||||
|
DrawerNo = csList[i].EmptyStock.DrawerNo,
|
||||||
|
ColNo = csList[i].EmptyStock.ColNo,
|
||||||
|
DrugId = csList[i].DrugId,
|
||||||
|
ManuNo = csList[i].EmptyStock.ManuNo,
|
||||||
|
// EffDate = !String.IsNullOrEmpty(record.EffDate) ? DateTime.ParseExact(record.EffDate, "yyyy-MM-dd", System.Globalization.CultureInfo.CurrentCulture) : null,
|
||||||
|
Operator = _globalStateService.Operator?.Id,
|
||||||
|
Reviewer = _globalStateService.Reviewer?.Id,
|
||||||
|
OperationTime = DateTime.Now,
|
||||||
|
Quantity = csList[i].EmptyStock.ReturnQuantity,
|
||||||
|
Type = 32,
|
||||||
|
InvoiceId = csList[i].Location,
|
||||||
|
GetId = _MachineRecord?.GetId
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//将药盒中无绑定库位的药品且库存为0的删除
|
||||||
|
_connection.ChannelStock.Where(cs => cs.MachineId.Equals(_setting.boxMachineId) && string.IsNullOrEmpty(cs.ListId) && cs.Quantity <= 0).Delete();
|
||||||
|
logger.Info($"管理员{_globalStateService.Operator.NickName}结束确认手麻单");
|
||||||
|
if (!string.IsNullOrEmpty(empChannelStock))
|
||||||
{
|
{
|
||||||
_message.Notify(
|
_message.Notify(
|
||||||
new NotificationMessage { Severity = NotificationSeverity.Error, Summary = "提示", Detail = $"有未核对处方:{empChannelStock}", Duration = 4000 }
|
new NotificationMessage { Severity = NotificationSeverity.Error, Summary = "提示", Detail = $"有未核对处方:{empChannelStock}", Duration = 4000 }
|
||||||
|
|
@ -1045,25 +1553,70 @@ namespace MasaBlazorApp3.DataAccess.Impl
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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();
|
||||||
|
}
|
||||||
public async Task<List<Anaesthetist>> GetAnaesthetistName()
|
public async Task<List<Anaesthetist>> GetAnaesthetistName()
|
||||||
{
|
{
|
||||||
List<Anaesthetist> strList = new List<Anaesthetist>();
|
List<Anaesthetist> strList = new List<Anaesthetist>();
|
||||||
strList =await _connection.OrderInfo.Where(it => it.state == 0 && it.HisDispFlag == 0 && it.CancelFlag == 0).Select(it => new Anaesthetist { Name = it.anaesthetistName }).Distinct().ToListAsync();
|
strList = await _connection.OrderInfo.Where(it => it.state == 0 && it.HisDispFlag == 0 && it.CancelFlag == 0).Select(it => new Anaesthetist { Name = it.anaesthetistName }).Distinct().ToListAsync();
|
||||||
return strList;
|
return strList;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//获取麻醉师单对应的手术间号
|
//获取麻醉师单对应的手术间号
|
||||||
public async Task<List<BoxModel>> GetOperationNum(string anaesthetistName)
|
public async Task<List<BoxModel>> GetOperationNum(int boxColor)
|
||||||
{
|
{
|
||||||
List<BoxModel> boxNumList = new List<BoxModel>();
|
List<BoxModel> boxNumList = new List<BoxModel>();
|
||||||
List<int> roomNameList = await _connection.OrderInfo
|
//List<int> roomNameList = await _connection.OrderInfo
|
||||||
.Where(it => it.state == 0 && it.HisDispFlag == 0 && it.CancelFlag == 0&&it.anaesthetistName== anaesthetistName)
|
// .Where(it => it.state == 0 && it.HisDispFlag == 0 && it.CancelFlag == 0&&it.anaesthetistName== anaesthetistName)
|
||||||
.Select(it => Convert.ToInt32(it.RoomName.Substring(6, it.RoomName.Length - 6))).Distinct().ToListAsync();
|
// .Select(it => Convert.ToInt32(it.RoomName.Substring(6, it.RoomName.Length - 6))).Distinct().ToListAsync();
|
||||||
roomNameList.Add(99);
|
//roomNameList.Add(99);
|
||||||
roomNameList.Add(111);
|
//roomNameList.Add(111);
|
||||||
boxNumList=await GetDrawerNumByOperationNum(_setting.boxMachineId, roomNameList);
|
logger.Info($"开始查询药盒{DateTime.Now}");
|
||||||
|
boxNumList = await GetDrawerNumByOperationNum(_setting.boxMachineId, boxColor);
|
||||||
|
|
||||||
|
logger.Info($"结束查询药盒{DateTime.Now}");
|
||||||
return boxNumList;
|
return boxNumList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//获取麻醉师单对应的手术间号(查询全部手术间已绑套餐的手术间)
|
||||||
|
public async Task<List<BoxModel>> GetAllBindOperationNum()
|
||||||
|
{
|
||||||
|
List<BoxModel> boxModelList = new List<BoxModel>();
|
||||||
|
boxModelList = await _connection.ChannelList
|
||||||
|
.Where(cs => cs.MachineId == _setting.boxMachineId && (!string.IsNullOrEmpty(cs.DrugId)))
|
||||||
|
.Select(cs => new BoxModel { BoxName = cs.DrawerNo, BoxNo = Convert.ToInt32(cs.ColNo) }).Distinct().OrderBy(cs => new { cs.BoxName, cs.BoxNo }).ToListAsync();
|
||||||
|
return boxModelList;
|
||||||
|
}
|
||||||
|
|
||||||
|
//查询药品对应的库位 drawerType=1药品库位,其他则是回收库位
|
||||||
|
public async Task<List<ChannelStock>> GetStockByDRrug(string drugId, string manuNo, int drawerType)
|
||||||
|
{
|
||||||
|
if (drawerType == 1)
|
||||||
|
{
|
||||||
|
return await _connection.ChannelStock.Where(cs => cs.MachineId == _setting.machineId && cs.DrawerType == drawerType && cs.DrugId == drugId && cs.ManuNo == manuNo).OrderBy(cs => cs.Quantity).ToListAsync();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return await _connection.ChannelStock.Where(cs => cs.MachineId == _setting.machineId && cs.DrawerType != 1 && cs.DrugId == drugId).OrderBy(cs => cs.Quantity).ToListAsync();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public Task<List<BoxModel>> GetDrawerNumByOperationNum(string machineId, List<int> operationNum)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@
|
||||||
|
|
||||||
<RadzenStack Gap="1rem" Orientation="Orientation.Vertical" Style="height: 100%;">
|
<RadzenStack Gap="1rem" Orientation="Orientation.Vertical" Style="height: 100%;">
|
||||||
<RadzenStack>
|
<RadzenStack>
|
||||||
@* <RadzenStack class="rz-p-4 rz-border-radius-1" Style="border: var(--rz-grid-cell-border)" Orientation="Orientation.Horizontal" Gap="1rem">
|
@* <RadzenStack class="rz-p-4 rz-border-radius-1" Style="border: var(--rz-grid-cell-border)" Orientation="Orientation.Horizontal" Gap="1rem">
|
||||||
<RadzenText TextStyle="TextStyle.Overline" Class="rz-mt-2 rz-my-0" Style="color: var(--rz-text-tertiary-color);">处方号:</RadzenText>
|
<RadzenText TextStyle="TextStyle.Overline" Class="rz-mt-2 rz-my-0" Style="color: var(--rz-text-tertiary-color);">处方号:</RadzenText>
|
||||||
<RadzenText TextStyle="TextStyle.Body1" Class="rz-text-truncate"><b>@(order?.OrderNo)</b></RadzenText>
|
<RadzenText TextStyle="TextStyle.Body1" Class="rz-text-truncate"><b>@(order?.OrderNo)</b></RadzenText>
|
||||||
<RadzenText TextStyle="TextStyle.Overline" Class="rz-mt-2 rz-my-0" Style="color: var(--rz-text-tertiary-color);">患者姓名:</RadzenText>
|
<RadzenText TextStyle="TextStyle.Overline" Class="rz-mt-2 rz-my-0" Style="color: var(--rz-text-tertiary-color);">患者姓名:</RadzenText>
|
||||||
|
|
@ -101,6 +101,8 @@
|
||||||
async Task OpenDrawer()
|
async Task OpenDrawer()
|
||||||
{
|
{
|
||||||
this.status = 1;
|
this.status = 1;
|
||||||
|
PortUtil.PowerOn();
|
||||||
|
await Task.Delay(200);
|
||||||
// 解析需要打开的抽屉列表
|
// 解析需要打开的抽屉列表
|
||||||
List<BoxTakeVo> drawerNos = this.data.GroupBy(it => it.ChannelStock.DrawerNo).Select(it => it.First()).ToList();
|
List<BoxTakeVo> drawerNos = this.data.GroupBy(it => it.ChannelStock.DrawerNo).Select(it => it.First()).ToList();
|
||||||
|
|
||||||
|
|
@ -169,7 +171,7 @@
|
||||||
new NotificationMessage { Severity = NotificationSeverity.Error, Summary = "提示", Detail = $"抽屉【{drawerNo}】打开失败,请检测硬件", Duration = 4000 }
|
new NotificationMessage { Severity = NotificationSeverity.Error, Summary = "提示", Detail = $"抽屉【{drawerNo}】打开失败,请检测硬件", Duration = 4000 }
|
||||||
);
|
);
|
||||||
logger.Info($"抽屉打开失败");
|
logger.Info($"抽屉打开失败");
|
||||||
PortUtil.AllLightOff();
|
PortUtil.PowerOff();
|
||||||
RestData();
|
RestData();
|
||||||
stop();
|
stop();
|
||||||
}
|
}
|
||||||
|
|
@ -227,8 +229,6 @@
|
||||||
if (data[i].ChannelStock.BoardType.ToString().Contains("2") && data[i].ChannelStock.DrawerNo == drawerNo)
|
if (data[i].ChannelStock.BoardType.ToString().Contains("2") && data[i].ChannelStock.DrawerNo == drawerNo)
|
||||||
{
|
{
|
||||||
|
|
||||||
//有单支抽屉则广播灭灯
|
|
||||||
PortUtil.AllLightOff();
|
|
||||||
byte[] quantity = await PortUtil.CheckQuantityByDrawer(drawerNo);
|
byte[] quantity = await PortUtil.CheckQuantityByDrawer(drawerNo);
|
||||||
orderTakeVo.AfterQuantity = quantity.Select(it => Convert.ToInt32(it)).ToArray().Skip(3).Take(9).ToArray();
|
orderTakeVo.AfterQuantity = quantity.Select(it => Convert.ToInt32(it)).ToArray().Skip(3).Take(9).ToArray();
|
||||||
logger.Info($"单支抽屉,关抽屉后检测数量【{string.Join(",", orderTakeVo.AfterQuantity)}】");
|
logger.Info($"单支抽屉,关抽屉后检测数量【{string.Join(",", orderTakeVo.AfterQuantity)}】");
|
||||||
|
|
@ -239,16 +239,19 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//有单支抽屉则广播灭灯
|
||||||
|
PortUtil.PowerOff();
|
||||||
// if (!string.IsNullOrEmpty(alertMessage))
|
// if (!string.IsNullOrEmpty(alertMessage))
|
||||||
// {
|
// {
|
||||||
// //弹出确认对话框
|
// //弹出确认对话框
|
||||||
alertMessage += "应取数与实际取出数不一致确认要保存吗?";
|
alertMessage += "应取数与实际取出数不一致确认要保存吗?";
|
||||||
// //弹出确认提示框
|
// //弹出确认提示框
|
||||||
// var confirm = await dialogService.OpenAsync<ConfirmDialog>(
|
// var confirm = await dialogService.OpenAsync<ConfirmDialog>(
|
||||||
// $"保存确认",
|
// $"保存确认",
|
||||||
// new Dictionary<string, object>() { { "confirmInfo", alertMessage } },
|
// new Dictionary<string, object>() { { "confirmInfo", alertMessage } },
|
||||||
// new DialogOptions() { Width = "45vw", Resizable = true, Draggable = true, ShowClose = false });
|
// new DialogOptions() { Width = "45vw", Resizable = true, Draggable = true, ShowClose = false });
|
||||||
logger.Info(alertMessage);
|
logger.Info(alertMessage);
|
||||||
// if (!confirm)
|
// if (!confirm)
|
||||||
// {
|
// {
|
||||||
// RestData();
|
// RestData();
|
||||||
|
|
@ -284,15 +287,17 @@
|
||||||
);
|
);
|
||||||
if (setting.Value.single.Contains(drawerNo))
|
if (setting.Value.single.Contains(drawerNo))
|
||||||
{
|
{
|
||||||
PortUtil.AllLightOff();
|
PortUtil.PowerOff();
|
||||||
}
|
}
|
||||||
stop();
|
stop();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
PortUtil.PowerOff();
|
||||||
}
|
}
|
||||||
|
|
||||||
void RestData()
|
void RestData()
|
||||||
{
|
{
|
||||||
|
PortUtil.PowerOff();
|
||||||
PortUtil.speechSynthesizer.SpeakAsyncCancelAll();
|
PortUtil.speechSynthesizer.SpeakAsyncCancelAll();
|
||||||
this.status = 0;
|
this.status = 0;
|
||||||
data.ForEach(it =>
|
data.ForEach(it =>
|
||||||
|
|
|
||||||
|
|
@ -53,7 +53,7 @@
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<div class="container-fluid">
|
<div class="container-fluid">
|
||||||
<RadzenFieldset Text="报表导出">
|
@* <RadzenFieldset Text="报表导出">
|
||||||
<RadzenStack Orientation="Orientation.Horizontal" Gap="1rem">
|
<RadzenStack Orientation="Orientation.Horizontal" Gap="1rem">
|
||||||
<RadzenRow JustifyContent="JustifyContent.End" AlignItems="AlignItems.Center">
|
<RadzenRow JustifyContent="JustifyContent.End" AlignItems="AlignItems.Center">
|
||||||
<RadzenButton @ref=button Icon="download" Text="请领登记表导出" Variant="Variant.Outlined" Click="@(args => popup.ToggleAsync(button.Element))" />
|
<RadzenButton @ref=button Icon="download" Text="请领登记表导出" Variant="Variant.Outlined" Click="@(args => popup.ToggleAsync(button.Element))" />
|
||||||
|
|
@ -78,7 +78,7 @@
|
||||||
</Popup>
|
</Popup>
|
||||||
</RadzenRow>
|
</RadzenRow>
|
||||||
</RadzenStack>
|
</RadzenStack>
|
||||||
</RadzenFieldset>
|
</RadzenFieldset> *@
|
||||||
<RadzenDataGrid @ref="grid" RowSelect="@OnRowSelect" TItem="ChannelList"
|
<RadzenDataGrid @ref="grid" RowSelect="@OnRowSelect" TItem="ChannelList"
|
||||||
RowRender="@RowRender"
|
RowRender="@RowRender"
|
||||||
EmptyText="无数据"
|
EmptyText="无数据"
|
||||||
|
|
@ -109,7 +109,13 @@
|
||||||
<Columns>
|
<Columns>
|
||||||
<RadzenDataGridColumn Frozen="true" Width="200px" Title="药盒号" Property="DrawerNo">
|
<RadzenDataGridColumn Frozen="true" Width="200px" Title="药盒号" Property="DrawerNo">
|
||||||
<Template Context="DrawerNo">
|
<Template Context="DrawerNo">
|
||||||
@(DrawerNo.DrawerNo == 99 ? "急诊药盒" : DrawerNo.DrawerNo == 111 ? "恢复室药盒" : $"{DrawerNo.DrawerNo}-{DrawerNo.ColNo}")
|
|
||||||
|
@(DrawerNo.DrawerNo == 99 ? "急诊药盒" : DrawerNo.DrawerNo == 111 ? "恢复室药盒" :
|
||||||
|
DrawerNo.DrawerNo == 31 ? "胃镜药盒" :
|
||||||
|
DrawerNo.DrawerNo == 32 ? "导管药盒" :
|
||||||
|
DrawerNo.DrawerNo == 33 ? "生殖药盒" :
|
||||||
|
DrawerNo.DrawerNo == 34 ? "妇门药盒" : $"{DrawerNo.DrawerNo}-{(DrawerNo.ColNo == 1 ? '白' : '绿')}")
|
||||||
|
@* @(DrawerNo.DrawerNo == 99 ? "急诊药盒" : DrawerNo.DrawerNo == 111 ? "恢复室药盒" : $"{DrawerNo.DrawerNo}-{(DrawerNo.ColNo==1?'白':'绿')}") *@
|
||||||
|
|
||||||
@* @($"{DrawerNo.DrawerNo}-{DrawerNo.ColNo}") *@
|
@* @($"{DrawerNo.DrawerNo}-{DrawerNo.ColNo}") *@
|
||||||
</Template>
|
</Template>
|
||||||
|
|
@ -165,7 +171,7 @@
|
||||||
async void OnRowSelect(ChannelList cl)
|
async void OnRowSelect(ChannelList cl)
|
||||||
{
|
{
|
||||||
var b = await dialogService.OpenAsync<BoxAddDetailDialog>(
|
var b = await dialogService.OpenAsync<BoxAddDetailDialog>(
|
||||||
cl.DrawerNo==99?"急诊药盒":cl.DrawerNo==111?"恢复室药盒":$"{cl.DrawerNo}-{cl.ColNo}号药盒加药",
|
cl.DrawerNo==99?"急诊药盒":cl.DrawerNo==111?"恢复室药盒":$"{cl.DrawerNo}-{(cl.ColNo==1?'白':'绿')} 药盒加药",
|
||||||
new Dictionary<string, object>() { { "boxChannelList", cl } },
|
new Dictionary<string, object>() { { "boxChannelList", cl } },
|
||||||
new DialogOptions() { Width = "85vw", Resizable = true, Draggable = true, ShowClose = false }
|
new DialogOptions() { Width = "85vw", Resizable = true, Draggable = true, ShowClose = false }
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -63,9 +63,25 @@
|
||||||
{
|
{
|
||||||
<b class="rz-pr-3">@($"恢复室药盒")</b>
|
<b class="rz-pr-3">@($"恢复室药盒")</b>
|
||||||
}
|
}
|
||||||
|
else if (channel.DrawerNo == 31)
|
||||||
|
{
|
||||||
|
<b class="rz-pr-3">@($"胃镜药盒")</b>
|
||||||
|
}
|
||||||
|
else if(channel.DrawerNo==32)
|
||||||
|
{
|
||||||
|
<b class="rz-pr-3">@($"导管药盒")</b>
|
||||||
|
}
|
||||||
|
else if (channel.DrawerNo == 33)
|
||||||
|
{
|
||||||
|
<b class="rz-pr-3">@($"生殖药盒")</b>
|
||||||
|
}
|
||||||
|
else if(channel.DrawerNo==34)
|
||||||
|
{
|
||||||
|
<b class="rz-pr-3">@($"妇门药盒")</b>
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
<b class="rz-pr-3">@($"{channel.DrawerNo}-{channel.ColNo}")</b>
|
<b class="rz-pr-3">@($"{channel.DrawerNo}-{(channel.ColNo == 1 ? '白':'绿')}")</b>
|
||||||
}
|
}
|
||||||
@* <b>号药盒</b> *@
|
@* <b>号药盒</b> *@
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@
|
||||||
<RadzenStack Gap="1rem" Orientation="Orientation.Vertical" Style="height: 100%;">
|
<RadzenStack Gap="1rem" Orientation="Orientation.Vertical" Style="height: 100%;">
|
||||||
<RadzenStack>
|
<RadzenStack>
|
||||||
<RadzenStack class="rz-p-4 rz-border-radius-1" Style="border: var(--rz-grid-cell-border)" Orientation="Orientation.Horizontal" Gap="1rem">
|
<RadzenStack class="rz-p-4 rz-border-radius-1" Style="border: var(--rz-grid-cell-border)" Orientation="Orientation.Horizontal" Gap="1rem">
|
||||||
<RadzenText Class="rz-mt-2 rz-my-0" Style="color: var(--rz-text-tertiary-color);">药名:</RadzenText>
|
@* <RadzenText Class="rz-mt-2 rz-my-0" Style="color: var(--rz-text-tertiary-color);">药名:</RadzenText>
|
||||||
<RadzenText Class="rz-text-truncate"><b>@(channelStock.Drug.DrugName)</b></RadzenText>
|
<RadzenText Class="rz-text-truncate"><b>@(channelStock.Drug.DrugName)</b></RadzenText>
|
||||||
<RadzenText Class="rz-mt-2 rz-my-0" Style="color: var(--rz-text-tertiary-color);">规格:</RadzenText>
|
<RadzenText Class="rz-mt-2 rz-my-0" Style="color: var(--rz-text-tertiary-color);">规格:</RadzenText>
|
||||||
<RadzenText TextStyle="TextStyle.Body1" Class="rz-text-truncate"><b>@(channelStock.Drug.DrugSpec)</b></RadzenText>
|
<RadzenText TextStyle="TextStyle.Body1" Class="rz-text-truncate"><b>@(channelStock.Drug.DrugSpec)</b></RadzenText>
|
||||||
|
|
@ -18,27 +18,71 @@
|
||||||
<RadzenText Class="rz-mt-2 rz-my-0" Style="color: var(--rz-text-tertiary-color);">效期:</RadzenText>
|
<RadzenText Class="rz-mt-2 rz-my-0" Style="color: var(--rz-text-tertiary-color);">效期:</RadzenText>
|
||||||
<RadzenText TextStyle="TextStyle.Body1" Class="rz-text-truncate"><b>@(channelStock.EffDate)</b></RadzenText>
|
<RadzenText TextStyle="TextStyle.Body1" Class="rz-text-truncate"><b>@(channelStock.EffDate)</b></RadzenText>
|
||||||
<RadzenText Class="rz-mt-2 rz-my-0" Style="color: var(--rz-text-tertiary-color);">库存:</RadzenText>
|
<RadzenText Class="rz-mt-2 rz-my-0" Style="color: var(--rz-text-tertiary-color);">库存:</RadzenText>
|
||||||
<RadzenText TextStyle="TextStyle.Body1" Class="rz-text-truncate"><b>@(channelStock.Quantity)</b></RadzenText>
|
<RadzenText TextStyle="TextStyle.Body1" Class="rz-text-truncate"><b>@(channelStock.Quantity)</b></RadzenText> *@
|
||||||
|
<div style="text-align: left;width:15vw">
|
||||||
|
<div class="rz-text-h6 rz-mb-0">药品名称</div>
|
||||||
|
@(channelStock.Drug.DrugName)
|
||||||
|
</div>
|
||||||
|
<div style="text-align: left;width:6vw">
|
||||||
|
<div class="rz-text-h6 rz-mb-0">规格</div>
|
||||||
|
@(channelStock.Drug.DrugSpec)
|
||||||
|
</div>
|
||||||
|
<div style="text-align: left;width:8vw;">
|
||||||
|
<div class="rz-text-h6 rz-mb-0">批次</div>
|
||||||
|
@(channelStock.ManuNo)
|
||||||
|
</div>
|
||||||
|
<div style="text-align: left;width:8vw;">
|
||||||
|
<div class="rz-text-h6 rz-mb-0">效期</div>
|
||||||
|
@(channelStock.EffDate)
|
||||||
|
</div>
|
||||||
|
<div style="text-align: left;width:4vw;">
|
||||||
|
<div class="rz-text-h6 rz-mb-0">库存</div>
|
||||||
|
@(channelStock.Quantity)
|
||||||
|
</div>
|
||||||
</RadzenStack>
|
</RadzenStack>
|
||||||
</RadzenStack>
|
</RadzenStack>
|
||||||
<RadzenStack style="align-content:center">
|
<RadzenStack style="align-content:center">
|
||||||
|
|
||||||
<RadzenStack class="rz-p-4 rz-border-radius-1" Style="border: var(--rz-grid-cell-border);align-content:center" Orientation="Orientation.Horizontal" Gap="1rem">
|
<RadzenStack class="rz-p-4 rz-border-radius-1" Style="border: var(--rz-grid-cell-border);align-content:center" Orientation="Orientation.Horizontal" Gap="1rem">
|
||||||
<RadzenText Class="rz-mt-2 rz-my-0" Style="color: var(--rz-text-tertiary-color);">移入药盒:</RadzenText>
|
<RadzenText Class="rz-mt-2 rz-my-0" Style="color: var(--rz-text-tertiary-color);">移入</RadzenText>
|
||||||
|
<RadzenDropDownDataGrid AllowVirtualization="true" Name="BoxColorList" TValue="BoxModel" Data="@BoxColorList" Value="BoxColor" Style="width: 11vw;"
|
||||||
|
ValueChanged="@((args) => OnColorChanged(args))" AllowFiltering="false"
|
||||||
|
AllowFilteringByAllStringColumns="true" TextProperty="药箱号">
|
||||||
|
<Template>
|
||||||
|
@((context as BoxModel).BoxNo == 1 ? "白" : (context as BoxModel).BoxNo == 2 ? "绿" : (context as BoxModel).BoxNo == 3 ? "非常规" : "抽屉")
|
||||||
|
</Template>
|
||||||
|
<Columns>
|
||||||
|
<RadzenDropDownDataGridColumn Property="BoxNo" Title="药箱颜色" Sortable="false" />
|
||||||
|
</Columns>
|
||||||
|
</RadzenDropDownDataGrid>
|
||||||
<RadzenDropDown @bind-Value="SelectedDrawerNo" Data="@DrawerNos" Style="display: block;" Name="DropDownChangeEvent">
|
<RadzenDropDown @bind-Value="SelectedDrawerNo" Data="@DrawerNos" Style="display: block;" Name="DropDownChangeEvent">
|
||||||
<RadzenText TextStyle="TextStyle.Subtitle2" class="mb-0">@(SelectedDrawerNo)</RadzenText>
|
<RadzenText TextStyle="TextStyle.Subtitle2" class="mb-0">@(SelectedDrawerNo)</RadzenText>
|
||||||
</RadzenDropDown>
|
</RadzenDropDown>
|
||||||
|
|
||||||
<RadzenText Class="rz-mt-2 rz-my-0" Style="color: var(--rz-text-tertiary-color);">移入数量:</RadzenText>
|
<RadzenText Class="rz-mt-2 rz-my-0" Style="color: var(--rz-text-tertiary-color);">移入数量</RadzenText>
|
||||||
|
|
||||||
<RadzenNumeric Min="0" Style="display: block" Max=@channelStock.Quantity Name="Quantity" @bind-Value="removeQuantity" />
|
<RadzenNumeric Min="0" Style="display: block" Max=@channelStock.Quantity Name="Quantity" @bind-Value="removeQuantity" />
|
||||||
</RadzenStack>
|
</RadzenStack>
|
||||||
</RadzenStack>
|
</RadzenStack>
|
||||||
<RadzenStack Orientation="Orientation.Horizontal" JustifyContent="JustifyContent.Center" Gap="0.5rem">
|
<RadzenStack Orientation="Orientation.Horizontal" JustifyContent="JustifyContent.Center" Gap="0.5rem">
|
||||||
|
@if (BoxColor.BoxNo == 4)
|
||||||
<RadzenButton Click="@Save" ButtonStyle="ButtonStyle.Success" Variant="Variant.Flat" Text="完成" Style="width: 120px" />
|
{
|
||||||
|
@if (status < 3)
|
||||||
<RadzenButton Click="@Cancel" Variant="Variant.Flat" Text="取消" Style="width: 120px" />
|
{
|
||||||
|
<RadzenButton IsBusy="@(status>0)" BusyText="加药中。。。" ButtonStyle="ButtonStyle.Warning" Variant="Variant.Flat" Shade="Shade.Light" Text="加药" Click="@OpenDrawer" Style="width: 120px" />
|
||||||
|
<RadzenButton Visible="@CancleIsEnable" Variant="Variant.Flat" Text="取消" Click="@Cancel" Style="width: 120px" />
|
||||||
|
}
|
||||||
|
@if (status == 3)
|
||||||
|
{
|
||||||
|
<RadzenButton Visible="@CompleteIsEnable" ButtonStyle="ButtonStyle.Warning" Variant="Variant.Flat" Shade="Shade.Light" Text="完成" Click="@AddFinish" Style="width: 120px" />
|
||||||
|
<RadzenButton Visible="@CancleIsEnable" Variant="Variant.Flat" Text="取消" Click="@Cancel" Style="width: 120px" />
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
<RadzenButton Click="@Save" ButtonStyle="ButtonStyle.Success" Variant="Variant.Flat" Text="完成" Style="width: 120px" />
|
||||||
|
<RadzenButton Click="@Cancel" Variant="Variant.Flat" Text="取消" Style="width: 120px" />
|
||||||
|
}
|
||||||
|
|
||||||
</RadzenStack>
|
</RadzenStack>
|
||||||
</RadzenStack>
|
</RadzenStack>
|
||||||
|
|
@ -46,22 +90,39 @@
|
||||||
@code {
|
@code {
|
||||||
@inject Radzen.DialogService dialogService;
|
@inject Radzen.DialogService dialogService;
|
||||||
@inject IChannelListDao channelListDao;
|
@inject IChannelListDao channelListDao;
|
||||||
@inject IOptions<SettingConfig> setting;
|
@inject IOptions<SettingConfig> setting
|
||||||
|
@inject IOptions<DrawerConfig> drawerSetting;
|
||||||
@inject NotificationService _message
|
@inject NotificationService _message
|
||||||
@inject PortUtil PortUtil;
|
@inject PortUtil PortUtil;
|
||||||
private readonly ILog logger = LogManager.GetLogger(typeof(OrderDetailDialog));
|
private readonly ILog logger = LogManager.GetLogger(typeof(OrderDetailDialog));
|
||||||
|
|
||||||
|
bool CompleteIsEnable = true;
|
||||||
|
bool CancleIsEnable = true;
|
||||||
|
|
||||||
int removeQuantity = 0;
|
int removeQuantity = 0;
|
||||||
int status;
|
int status;
|
||||||
|
|
||||||
|
string[] AllDrawerNos;
|
||||||
string[] DrawerNos;
|
string[] DrawerNos;
|
||||||
string SelectedDrawerNo = "1-1";
|
string SelectedDrawerNo = "1-1";
|
||||||
|
|
||||||
|
//药盒集合
|
||||||
|
List<BoxModel> BoxList = new List<BoxModel>();
|
||||||
|
//药盒颜色集合
|
||||||
|
List<BoxModel> BoxColorList = new List<BoxModel>()
|
||||||
|
{
|
||||||
|
new BoxModel{BoxNo=1,BoxName=1 },
|
||||||
|
new BoxModel{BoxNo=2 ,BoxName=1},
|
||||||
|
new BoxModel{BoxNo=3 ,BoxName=1},
|
||||||
|
new BoxModel{BoxNo=4 ,BoxName=1}
|
||||||
|
};
|
||||||
|
BoxModel BoxColor = new BoxModel { BoxNo = 1, BoxName = 1 };
|
||||||
|
BoxModel BoxNum;
|
||||||
[Parameter] public ChannelStock channelStock { get; set; }
|
[Parameter] public ChannelStock channelStock { get; set; }
|
||||||
private bool CanTakeDrug = true;
|
private bool CanTakeDrug = true;
|
||||||
|
|
||||||
// public List<BoxTakeVo> data { get; set; }
|
// public List<BoxTakeVo> data { get; set; }
|
||||||
|
|
||||||
|
|
||||||
//称重取药数量
|
//称重取药数量
|
||||||
int[] WeightFinnalQuantity { get; set; } = new int[] { 0, 0, 0, 0, 0, 0, 0, 0, 0 };
|
int[] WeightFinnalQuantity { get; set; } = new int[] { 0, 0, 0, 0, 0, 0, 0, 0, 0 };
|
||||||
|
|
@ -71,28 +132,98 @@
|
||||||
|
|
||||||
protected override async Task OnInitializedAsync()
|
protected override async Task OnInitializedAsync()
|
||||||
{
|
{
|
||||||
DrawerNos = await channelListDao.GetDrawerNumForRemove(channelStock);
|
AllDrawerNos = await channelListDao.GetDrawerNumForRemove(channelStock);
|
||||||
if (DrawerNos != null && DrawerNos.Count() > 0)
|
if (AllDrawerNos != null && AllDrawerNos.Count() > 0)
|
||||||
{
|
{
|
||||||
SelectedDrawerNo = DrawerNos[0];
|
DrawerNos = AllDrawerNos.Where(d => d.EndsWith('白')).ToArray();
|
||||||
|
if (DrawerNos != null && DrawerNos.Length > 0)
|
||||||
|
SelectedDrawerNo = DrawerNos[0];
|
||||||
// var result = await channelListDao.GetChannelStockByDrug(channelStock, SelectedDrawerNo, 8, 0);
|
// var result = await channelListDao.GetChannelStockByDrug(channelStock, SelectedDrawerNo, 8, 0);
|
||||||
// selectedDrawerData = result.Desserts;
|
// selectedDrawerData = result.Desserts;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
DrawerNos = new string[] { "无库位" };
|
||||||
|
}
|
||||||
base.OnInitializedAsync();
|
base.OnInitializedAsync();
|
||||||
}
|
}
|
||||||
|
|
||||||
void RestData()
|
// 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();
|
||||||
|
// }
|
||||||
|
|
||||||
|
private async Task OnColorChanged(object value)
|
||||||
{
|
{
|
||||||
// PortUtil.speechSynthesizer.SpeakAsyncCancelAll();
|
BoxColor = (BoxModel)value;
|
||||||
// this.status = 0;
|
if (AllDrawerNos != null && AllDrawerNos.Length > 0 && AllDrawerNos[0] != "无库位")
|
||||||
// data.ForEach(it =>
|
{
|
||||||
// {
|
if ((((BoxModel)value).BoxNo) == 3)
|
||||||
// it.Status = 0;
|
{
|
||||||
// it.BeforeQuantity = new int[9];
|
DrawerNos = AllDrawerNos.Where(d => !(d.EndsWith('白')) && !(d.EndsWith('绿')) && !(d.Contains('-'))).ToArray();
|
||||||
// it.AfterQuantity = new int[9];
|
if (DrawerNos != null && DrawerNos.Length > 0 && DrawerNos[0] != "无库位")
|
||||||
// });
|
{
|
||||||
// this.WeightFinnalQuantity = new int[9];
|
SelectedDrawerNo = DrawerNos[0];
|
||||||
// DrawerNoColNoList.Clear();
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
SelectedDrawerNo = "无库位";
|
||||||
|
}
|
||||||
|
await InvokeAsync(StateHasChanged);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if ((((BoxModel)value).BoxNo) == 1)
|
||||||
|
{
|
||||||
|
DrawerNos = AllDrawerNos.Where(d => d.EndsWith('白')).ToArray();
|
||||||
|
if (DrawerNos != null && DrawerNos.Length > 0 && DrawerNos[0] != "无库位")
|
||||||
|
{
|
||||||
|
SelectedDrawerNo = DrawerNos[0];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
SelectedDrawerNo = "无库位";
|
||||||
|
}
|
||||||
|
await InvokeAsync(StateHasChanged);
|
||||||
|
}
|
||||||
|
else if ((((BoxModel)value).BoxNo) == 2)
|
||||||
|
{
|
||||||
|
DrawerNos = AllDrawerNos.Where(d => d.EndsWith('绿')).ToArray();
|
||||||
|
if (DrawerNos != null && DrawerNos.Length > 0 && DrawerNos[0] != "无库位")
|
||||||
|
{
|
||||||
|
SelectedDrawerNo = DrawerNos[0];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
SelectedDrawerNo = "无库位";
|
||||||
|
}
|
||||||
|
await InvokeAsync(StateHasChanged);
|
||||||
|
}
|
||||||
|
else if ((((BoxModel)value).BoxNo) == 4)
|
||||||
|
{
|
||||||
|
DrawerNos = AllDrawerNos.Where(d => !(d.EndsWith('绿')) && !(d.EndsWith('白')) && d.Contains('-')).ToArray();
|
||||||
|
if (DrawerNos != null && DrawerNos.Length > 0 && DrawerNos[0] != "无库位")
|
||||||
|
{
|
||||||
|
SelectedDrawerNo = DrawerNos[0];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
SelectedDrawerNo = "无库位";
|
||||||
|
}
|
||||||
|
await InvokeAsync(StateHasChanged);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
void Cancel()
|
void Cancel()
|
||||||
{
|
{
|
||||||
|
|
@ -102,17 +233,18 @@
|
||||||
}
|
}
|
||||||
async Task Save()
|
async Task Save()
|
||||||
{
|
{
|
||||||
if (removeQuantity<=0)
|
if (removeQuantity <= 0)
|
||||||
{
|
{
|
||||||
_message.Notify(new NotificationMessage { Severity = NotificationSeverity.Error, Summary = "提示", Detail = "请输入移入数量", Duration = 4000 });
|
_message.Notify(new NotificationMessage { Severity = NotificationSeverity.Error, Summary = "提示", Detail = "请输入移入数量", Duration = 4000 });
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (string.IsNullOrEmpty(SelectedDrawerNo))
|
if (string.IsNullOrEmpty(SelectedDrawerNo) || SelectedDrawerNo == "无库位")
|
||||||
{
|
{
|
||||||
_message.Notify(new NotificationMessage { Severity = NotificationSeverity.Error, Summary = "提示", Detail = "无可移入的药盒", Duration = 4000 });
|
_message.Notify(new NotificationMessage { Severity = NotificationSeverity.Error, Summary = "提示", Detail = "无可移入的药盒", Duration = 4000 });
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var b = await channelListDao.BoxRemoveFinish(channelStock, SelectedDrawerNo,removeQuantity);
|
SelectedDrawerNo = SelectedDrawerNo == "急诊药盒" ? "99-1" : SelectedDrawerNo == "恢复室药盒" ? "111-1" : SelectedDrawerNo;
|
||||||
|
var b = await channelListDao.BoxRemoveFinish(channelStock, SelectedDrawerNo, removeQuantity);
|
||||||
if (!b)
|
if (!b)
|
||||||
{
|
{
|
||||||
_message.Notify(new NotificationMessage { Severity = NotificationSeverity.Error, Summary = "提示", Detail = $"数据保存失败", Duration = 4000 });
|
_message.Notify(new NotificationMessage { Severity = NotificationSeverity.Error, Summary = "提示", Detail = $"数据保存失败", Duration = 4000 });
|
||||||
|
|
@ -128,4 +260,139 @@
|
||||||
//重置状态
|
//重置状态
|
||||||
this.RestData();
|
this.RestData();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int drawerNo = 1;
|
||||||
|
int colNo = 1;
|
||||||
|
int[] BeforeQuantity = new int[9];
|
||||||
|
int[] AfterQuantity = new int[9];
|
||||||
|
async Task OpenDrawer()
|
||||||
|
{
|
||||||
|
this.status = 1;
|
||||||
|
PortUtil.PowerOn();
|
||||||
|
var selectSpl = SelectedDrawerNo.Split('-');
|
||||||
|
|
||||||
|
if (selectSpl != null && selectSpl.Count() > 0)
|
||||||
|
{
|
||||||
|
drawerNo = Convert.ToInt32(selectSpl[0]);
|
||||||
|
colNo = Convert.ToInt32(selectSpl[1]);
|
||||||
|
}
|
||||||
|
await Task.Delay(200);
|
||||||
|
PortUtil.DrawerNo = drawerNo;
|
||||||
|
// 根据抽屉类型来决定打开前是否需要查询数量
|
||||||
|
var promiseUtil = new PromiseUtil<object>();
|
||||||
|
await promiseUtil.taskAsyncLoop(500, null, async (data, next, stop) =>
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (this.status == 0)
|
||||||
|
{
|
||||||
|
stop();
|
||||||
|
}
|
||||||
|
// 开启抽屉
|
||||||
|
else if (this.status == 1)
|
||||||
|
{
|
||||||
|
// 判断是否为单支抽屉
|
||||||
|
if (drawerSetting.Value.single != null && drawerSetting.Value.single.Contains(this.drawerNo))
|
||||||
|
{
|
||||||
|
byte[] quantity = await PortUtil.CheckQuantityByDrawer(this.drawerNo);
|
||||||
|
BeforeQuantity = quantity.Select(it => Convert.ToInt32(it)).ToArray().Skip(3).Take(9).ToArray();
|
||||||
|
logger.Info($"单支抽屉,开抽屉前检测数量【{string.Join(",", BeforeQuantity)}】");
|
||||||
|
}
|
||||||
|
var b = await PortUtil.OpenDrawerStatus(this.drawerNo);
|
||||||
|
if (b)
|
||||||
|
{
|
||||||
|
PortUtil.speechSynthesizer.SpeakAsyncCancelAll();
|
||||||
|
PortUtil.SpeakAsync($"{drawerNo}号抽屉已经打开,请,加药");
|
||||||
|
this.status = 2;
|
||||||
|
PortUtil.Operate = true;
|
||||||
|
next();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_message.Notify(
|
||||||
|
new NotificationMessage { Severity = NotificationSeverity.Error, Summary = "提示", Detail = $"抽屉【{drawerNo}】打开失败,请检测硬件", Duration = 4000 }
|
||||||
|
);
|
||||||
|
logger.Info($"抽屉打开失败");
|
||||||
|
RestData();
|
||||||
|
PortUtil.Operate = false;
|
||||||
|
stop();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
// 检测状态
|
||||||
|
else if (this.status == 2)
|
||||||
|
{
|
||||||
|
// 查询抽屉是否为关闭状态
|
||||||
|
var b = await PortUtil.CheckDrawerStatus2(drawerNo);
|
||||||
|
// 关闭则改变状态并终止循环
|
||||||
|
if (b)
|
||||||
|
{
|
||||||
|
PortUtil.speechSynthesizer.SpeakAsyncCancelAll();
|
||||||
|
PortUtil.SpeakAsync($"加药完成,请,点击完成按钮");
|
||||||
|
this.status = 3;
|
||||||
|
PortUtil.Operate = false;
|
||||||
|
stop();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (drawerSetting.Value.single != null && drawerSetting.Value.single.Contains(this.drawerNo))
|
||||||
|
{
|
||||||
|
byte[] quantity = await PortUtil.CheckQuantityByDrawer(this.drawerNo);
|
||||||
|
AfterQuantity = quantity.Select(it => Convert.ToInt32(it)).ToArray().Skip(3).Take(9).ToArray();
|
||||||
|
logger.Info($"单支抽屉,抽屉未关检测数量【{string.Join(",", AfterQuantity)}】");
|
||||||
|
|
||||||
|
removeQuantity = this.AfterQuantity[colNo - 1] - this.BeforeQuantity[colNo - 1];
|
||||||
|
await InvokeAsync(StateHasChanged);
|
||||||
|
}
|
||||||
|
next(); // continue iteration
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
logger.Info($"抽屉加药发生错误,{e.Message}");
|
||||||
|
_message.Notify(
|
||||||
|
new NotificationMessage { Severity = NotificationSeverity.Error, Summary = "提示", Detail = $"发生错误,{e.Message}", Duration = 4000 }
|
||||||
|
);
|
||||||
|
if (drawerSetting.Value.single != null && drawerSetting.Value.single.Contains(this.drawerNo))
|
||||||
|
{
|
||||||
|
PortUtil.PowerOff();
|
||||||
|
}
|
||||||
|
RestData();
|
||||||
|
stop();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
PortUtil.PowerOff();
|
||||||
|
}
|
||||||
|
|
||||||
|
void RestData()
|
||||||
|
{
|
||||||
|
PortUtil.PowerOff();
|
||||||
|
PortUtil.speechSynthesizer.SpeakAsyncCancelAll();
|
||||||
|
this.status = 0;
|
||||||
|
// this.BeforeQuantity = new int[9];
|
||||||
|
// this.AfterQuantity = new int[9];
|
||||||
|
// currentCol = 0;
|
||||||
|
// ColNos.Clear();
|
||||||
|
}
|
||||||
|
async Task AddFinish()
|
||||||
|
{
|
||||||
|
if (removeQuantity <= 0)
|
||||||
|
{
|
||||||
|
_message.Notify(new NotificationMessage { Severity = NotificationSeverity.Error, Summary = "提示", Detail = "请输入移入数量", Duration = 4000 });
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// 保存账册、操作记录
|
||||||
|
var b = await channelListDao.RemoveDrugToDrawerFinish(SelectedDrawerNo, channelStock, removeQuantity);
|
||||||
|
if (!b)
|
||||||
|
{
|
||||||
|
_message.Notify(new NotificationMessage { Severity = NotificationSeverity.Error, Summary = "提示", Detail = $"数据保存失败", Duration = 4000 });
|
||||||
|
logger.Error($"抽屉加药保存数据库失败,数据{JsonConvert.SerializeObject(channelStock)}");
|
||||||
|
}
|
||||||
|
//重置状态
|
||||||
|
this.RestData();
|
||||||
|
// 关闭弹窗
|
||||||
|
dialogService.Close(true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -9,7 +9,7 @@
|
||||||
<RadzenStack Gap="1rem" Orientation="Orientation.Vertical" Style="height: 100%;">
|
<RadzenStack Gap="1rem" Orientation="Orientation.Vertical" Style="height: 100%;">
|
||||||
<RadzenStack>
|
<RadzenStack>
|
||||||
<RadzenStack class="rz-p-4 rz-border-radius-1" Style="border: var(--rz-grid-cell-border)" Orientation="Orientation.Horizontal" Gap="1rem">
|
<RadzenStack class="rz-p-4 rz-border-radius-1" Style="border: var(--rz-grid-cell-border)" Orientation="Orientation.Horizontal" Gap="1rem">
|
||||||
<RadzenText Class="rz-mt-2 rz-my-0" Style="color: var(--rz-text-tertiary-color);">药名:</RadzenText>
|
@*<RadzenText Class="rz-mt-2 rz-my-0" Style="color: var(--rz-text-tertiary-color);">药名:</RadzenText>
|
||||||
<RadzenText Class="rz-text-truncate"><b>@(channelStock.Drug.DrugName)</b></RadzenText>
|
<RadzenText Class="rz-text-truncate"><b>@(channelStock.Drug.DrugName)</b></RadzenText>
|
||||||
<RadzenText Class="rz-mt-2 rz-my-0" Style="color: var(--rz-text-tertiary-color);">规格:</RadzenText>
|
<RadzenText Class="rz-mt-2 rz-my-0" Style="color: var(--rz-text-tertiary-color);">规格:</RadzenText>
|
||||||
<RadzenText TextStyle="TextStyle.Body1" Class="rz-text-truncate"><b>@(channelStock.Drug.DrugSpec)</b></RadzenText>
|
<RadzenText TextStyle="TextStyle.Body1" Class="rz-text-truncate"><b>@(channelStock.Drug.DrugSpec)</b></RadzenText>
|
||||||
|
|
@ -19,38 +19,77 @@
|
||||||
<RadzenText TextStyle="TextStyle.Body1" Class="rz-text-truncate"><b>@(channelStock.EffDate)</b></RadzenText>
|
<RadzenText TextStyle="TextStyle.Body1" Class="rz-text-truncate"><b>@(channelStock.EffDate)</b></RadzenText>
|
||||||
<RadzenText Class="rz-mt-2 rz-my-0" Style="color: var(--rz-text-tertiary-color);">库存:</RadzenText>
|
<RadzenText Class="rz-mt-2 rz-my-0" Style="color: var(--rz-text-tertiary-color);">库存:</RadzenText>
|
||||||
<RadzenText TextStyle="TextStyle.Body1" Class="rz-text-truncate"><b>@(channelStock.Quantity)</b></RadzenText>
|
<RadzenText TextStyle="TextStyle.Body1" Class="rz-text-truncate"><b>@(channelStock.Quantity)</b></RadzenText>
|
||||||
<RadzenText Class="rz-mt-2 rz-my-0" Style="color: var(--rz-text-tertiary-color);">交换药盒:</RadzenText>
|
<RadzenText Class="rz-mt-2 rz-my-0" Style="color: var(--rz-text-tertiary-color);">交换药盒:</RadzenText> *@
|
||||||
<RadzenDropDown @bind-Value="SelectedDrawerNo" Data="@DrawerNos" Style="display: block;" Change="@(args => SelectedDrawerChange(args))" Name="DropDownChangeEvent">
|
<div style="text-align: left;width:15vw">
|
||||||
|
<div class="rz-text-h6 rz-mb-0">药品名称</div>
|
||||||
<RadzenText TextStyle="TextStyle.Subtitle2" class="mb-0">@(SelectedDrawerNo)</RadzenText>
|
@(channelStock.Drug.DrugName)
|
||||||
|
</div>
|
||||||
</RadzenDropDown>
|
<div style="text-align: left;width:6vw">
|
||||||
|
<div class="rz-text-h6 rz-mb-0">规格</div>
|
||||||
|
@(channelStock.Drug.DrugSpec)
|
||||||
|
</div>
|
||||||
|
<div style="text-align: left;width:8vw;">
|
||||||
|
<div class="rz-text-h6 rz-mb-0">批次</div>
|
||||||
|
@(channelStock.ManuNo)
|
||||||
|
</div>
|
||||||
|
<div style="text-align: left;width:8vw;">
|
||||||
|
<div class="rz-text-h6 rz-mb-0">效期</div>
|
||||||
|
@(channelStock.EffDate)
|
||||||
|
</div>
|
||||||
|
<div style="text-align: left;width:4vw;">
|
||||||
|
<div class="rz-text-h6 rz-mb-0">库存</div>
|
||||||
|
@(channelStock.Quantity)
|
||||||
|
</div>
|
||||||
|
<div class="rz-text-h6 rz-mb-0;width:10vw">
|
||||||
|
交换药盒
|
||||||
|
<RadzenDropDownDataGrid AllowVirtualization="true" Name="BoxColorList" TValue="BoxModel" Data="@BoxColorList" Value="BoxColor" Style="width: 8vw;"
|
||||||
|
ValueChanged="@((args) => OnColorChanged(args))" AllowFiltering="false"
|
||||||
|
AllowFilteringByAllStringColumns="true" TextProperty="药箱号">
|
||||||
|
<Template>
|
||||||
|
@((context as BoxModel).BoxNo == 1 ? "白" : (context as BoxModel).BoxNo == 2 ? "绿" : "非常规")
|
||||||
|
</Template>
|
||||||
|
<Columns>
|
||||||
|
<RadzenDropDownDataGridColumn Property="BoxNo" Title="药箱颜色" Sortable="false" />
|
||||||
|
</Columns>
|
||||||
|
</RadzenDropDownDataGrid>
|
||||||
|
<RadzenDropDown @bind-Value="SelectedDrawerNo" Data="@DrawerNos" Style="width:10vw" Change="@(args => SelectedDrawerChange(args))" Name="DropDownChangeEvent">
|
||||||
|
|
||||||
|
<RadzenText TextStyle="TextStyle.Subtitle2" class="mb-0">@(SelectedDrawerNo)</RadzenText>
|
||||||
|
|
||||||
|
</RadzenDropDown>
|
||||||
|
</div>
|
||||||
</RadzenStack>
|
</RadzenStack>
|
||||||
<RadzenDataGrid @ref="grid" Data="@selectedDrawerData" AllowAlternatingRows="true" LoadData="@LoadData" IsLoading="@isLoading" Count="@count" EmptyText="无数据"
|
<RadzenDataGrid @ref="grid" Data="@selectedDrawerData" AllowAlternatingRows="true" LoadData="@LoadData" IsLoading="@isLoading" Count="@count" EmptyText="无数据"
|
||||||
CellClick="@((DataGridCellMouseEventArgs<ChannelStock> args) => OnCellClick(args))"
|
CellClick="@((DataGridCellMouseEventArgs<ChannelStock> args) => OnCellClick(args))"
|
||||||
AllowPaging="true" PageSize="10" PagerHorizontalAlign="HorizontalAlign.Left" ShowPagingSummary="true" PagingSummaryFormat="{0}/{1} 共{2}条数据">
|
AllowPaging="true" PageSize="10" PagerHorizontalAlign="HorizontalAlign.Left" ShowPagingSummary="true" PagingSummaryFormat="{0}/{1} 共{2}条数据">
|
||||||
<Columns>
|
<Columns>
|
||||||
<RadzenDataGridColumn Property="DrawerNo" Title="药盒号">
|
<RadzenDataGridColumn Property="DrawerNo" Title="药盒号">
|
||||||
|
<Template Context="DrawerNo">
|
||||||
|
@(DrawerNo.DrawerNo == 99 ? "急诊药盒" : DrawerNo.DrawerNo == 111 ? "恢复室药盒" :
|
||||||
|
DrawerNo.DrawerNo == 31 ? "胃镜药盒" :
|
||||||
|
DrawerNo.DrawerNo == 32 ? "导管药盒" :
|
||||||
|
DrawerNo.DrawerNo == 33 ? "生殖药盒" :
|
||||||
|
DrawerNo.DrawerNo == 34 ? "妇门药盒" : $"{DrawerNo.DrawerNo}-{(DrawerNo.ColNo == 1 ? '白' : '绿')}")
|
||||||
|
</Template>
|
||||||
</RadzenDataGridColumn>
|
</RadzenDataGridColumn>
|
||||||
<RadzenDataGridColumn Property="Drug.DrugName" Title="药品" />
|
<RadzenDataGridColumn Property="Drug.DrugName" Title="药品" />
|
||||||
<RadzenDataGridColumn Property="Drug.DrugSpec" Title="规格" />
|
<RadzenDataGridColumn Property="Drug.DrugSpec" Title="规格" />
|
||||||
<RadzenDataGridColumn Property="ChannelStock.ManuNo" Title="批次" />
|
<RadzenDataGridColumn Property="ChannelStock.ManuNo" Title="批次" />
|
||||||
<RadzenDataGridColumn Property="ChannelStock.EffDate" Title="效期" />
|
<RadzenDataGridColumn Property="ChannelStock.EffDate" Title="效期" />
|
||||||
<RadzenDataGridColumn Property="Quantity" Title="库存" />
|
<RadzenDataGridColumn Property="Quantity" Title="库存" />
|
||||||
<RadzenDataGridColumn MinWidth="100px" Title="交换数量" Property="AddQuantity">
|
<RadzenDataGridColumn MinWidth="100px" Title="交换数量" Property="AddQuantity">
|
||||||
<EditTemplate Context="cs">
|
<EditTemplate Context="cs">
|
||||||
<RadzenNumeric Min="0" Style="display: block" Max=@cs.Quantity Name="Quantity" @bind-Value=@cs.AddQuantity />
|
<RadzenNumeric Min="0" Style="display: block" Max=@cs.Quantity Name="Quantity" @bind-Value=@cs.AddQuantity />
|
||||||
<RadzenNumericRangeValidator Style="position: absolute;z-index: 9999;" Min="0" Text="请填写正确的交换数量" Component="Quantity" Popup="true" />
|
<RadzenNumericRangeValidator Style="position: absolute;z-index: 9999;" Min="0" Text="请填写正确的交换数量" Component="Quantity" Popup="true" />
|
||||||
</EditTemplate>
|
</EditTemplate>
|
||||||
</RadzenDataGridColumn>
|
</RadzenDataGridColumn>
|
||||||
</Columns>
|
</Columns>
|
||||||
</RadzenDataGrid>
|
</RadzenDataGrid>
|
||||||
|
|
||||||
</RadzenStack>
|
</RadzenStack>
|
||||||
<RadzenStack Orientation="Orientation.Horizontal" JustifyContent="JustifyContent.Center" Gap="0.5rem">
|
<RadzenStack Orientation="Orientation.Horizontal" JustifyContent="JustifyContent.Center" Gap="0.5rem">
|
||||||
|
|
||||||
<RadzenButton Click="@Save" ButtonStyle="ButtonStyle.Success" Variant="Variant.Flat" Text="保存" Style="width: 120px" />
|
<RadzenButton Click="@Save" ButtonStyle="ButtonStyle.Success" Variant="Variant.Flat" Text="完成" Style="width: 120px" />
|
||||||
|
|
||||||
<RadzenButton Click="@Cancel" Variant="Variant.Flat" Text="取消" Style="width: 120px" />
|
<RadzenButton Click="@Cancel" Variant="Variant.Flat" Text="取消" Style="width: 120px" />
|
||||||
|
|
||||||
|
|
@ -58,25 +97,27 @@
|
||||||
</RadzenStack>
|
</RadzenStack>
|
||||||
|
|
||||||
@code {
|
@code {
|
||||||
@inject Radzen.DialogService dialogService;
|
@inject Radzen.DialogService dialogService;
|
||||||
@inject IChannelListDao channelListDao;
|
@inject IChannelListDao channelListDao;
|
||||||
@inject IOptions<SettingConfig> setting;
|
@inject IOptions<SettingConfig> setting;
|
||||||
|
@inject IOptions<DrawerConfig> drawerSetting;
|
||||||
@inject NotificationService _message
|
@inject NotificationService _message
|
||||||
@inject PortUtil PortUtil;
|
@inject PortUtil PortUtil;
|
||||||
private readonly ILog logger = LogManager.GetLogger(typeof(OrderDetailDialog));
|
private readonly ILog logger = LogManager.GetLogger(typeof(OrderDetailDialog));
|
||||||
|
|
||||||
|
bool CompleteIsEnable = true;
|
||||||
|
bool CancleIsEnable = true;
|
||||||
|
|
||||||
int status;
|
int status;
|
||||||
bool isLoading;
|
bool isLoading;
|
||||||
int count;
|
int count;
|
||||||
string[] DrawerNos;
|
|
||||||
string SelectedDrawerNo="";
|
|
||||||
|
|
||||||
[Parameter] public ChannelStock channelStock { get; set; }
|
[Parameter] public ChannelStock channelStock { get; set; }
|
||||||
private bool CanTakeDrug = true;
|
private bool CanTakeDrug = true;
|
||||||
|
|
||||||
// public List<BoxTakeVo> data { get; set; }
|
// public List<BoxTakeVo> data { get; set; }
|
||||||
|
|
||||||
public List<ChannelStock> selectedDrawerData{ get; set; }
|
public List<ChannelStock> selectedDrawerData { get; set; }
|
||||||
|
|
||||||
//称重取药数量
|
//称重取药数量
|
||||||
int[] WeightFinnalQuantity { get; set; } = new int[] { 0, 0, 0, 0, 0, 0, 0, 0, 0 };
|
int[] WeightFinnalQuantity { get; set; } = new int[] { 0, 0, 0, 0, 0, 0, 0, 0, 0 };
|
||||||
|
|
@ -84,36 +125,141 @@
|
||||||
//开抽屉前操作标识
|
//开抽屉前操作标识
|
||||||
List<string> DrawerNoColNoList = new List<string>();
|
List<string> DrawerNoColNoList = new List<string>();
|
||||||
|
|
||||||
|
//药盒集合
|
||||||
|
List<BoxModel> BoxList = new List<BoxModel>();
|
||||||
|
BoxModel BoxColor = new BoxModel { BoxNo = 1, BoxName = 1 };
|
||||||
|
string[] AllDrawerNos;
|
||||||
|
string[] DrawerNos;
|
||||||
|
string SelectedDrawerNo = "1-1";
|
||||||
|
//药盒颜色集合
|
||||||
|
List<BoxModel> BoxColorList = new List<BoxModel>()
|
||||||
|
{
|
||||||
|
new BoxModel{BoxNo=1,BoxName=1 },
|
||||||
|
new BoxModel{BoxNo=2 ,BoxName=1},
|
||||||
|
new BoxModel{BoxNo=3 ,BoxName=1}
|
||||||
|
};
|
||||||
protected override async Task OnInitializedAsync()
|
protected override async Task OnInitializedAsync()
|
||||||
{
|
{
|
||||||
DrawerNos = await channelListDao.GetDrawerNum(channelStock);
|
// AllDrawerNos = await channelListDao.GetDrawerNum(channelStock);
|
||||||
|
// if (AllDrawerNos != null && AllDrawerNos.Count() > 0)
|
||||||
|
// {
|
||||||
|
// if (DrawerNos == null || DrawerNos.Length <= 0)
|
||||||
|
// {
|
||||||
|
// DrawerNos = new string[] { "无库位" };
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
AllDrawerNos = await channelListDao.GetDrawerNumForRemove(channelStock);
|
||||||
|
if (AllDrawerNos != null && AllDrawerNos.Count() > 0)
|
||||||
|
{
|
||||||
|
DrawerNos = AllDrawerNos.Where(d => d.EndsWith('白')).ToArray();
|
||||||
|
if (DrawerNos != null && DrawerNos.Length > 0)
|
||||||
|
SelectedDrawerNo = DrawerNos[0];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
DrawerNos = new string[] { "无库位" };
|
||||||
|
}
|
||||||
base.OnInitializedAsync();
|
base.OnInitializedAsync();
|
||||||
}
|
}
|
||||||
async Task LoadData(LoadDataArgs args)
|
async Task LoadData(LoadDataArgs args)
|
||||||
{
|
{
|
||||||
isLoading = true;
|
isLoading = true;
|
||||||
|
|
||||||
if (DrawerNos != null && DrawerNos.Count() > 0)
|
if (DrawerNos != null && !DrawerNos.Contains("无库位") && DrawerNos.Count() > 0)
|
||||||
{
|
{
|
||||||
SelectedDrawerNo = DrawerNos[0];
|
SelectedDrawerNo = DrawerNos[0];
|
||||||
var result = await channelListDao.GetChannelStockByDrug(channelStock, SelectedDrawerNo, args.Top, args.Skip);
|
var result = await channelListDao.GetChannelStockByDrug(channelStock, SelectedDrawerNo, args.Top, args.Skip);
|
||||||
selectedDrawerData = result.Desserts;
|
selectedDrawerData = result.Desserts;
|
||||||
count = result.TotalDesserts;
|
if (selectedDrawerData != null && selectedDrawerData.Count > 0)
|
||||||
|
{
|
||||||
|
if (selectedDrawerData[0].DrawerNo <= 30)
|
||||||
|
{
|
||||||
|
if (selectedDrawerData[0].ColNo == 1)
|
||||||
|
{
|
||||||
|
BoxColor = BoxColorList[0];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
BoxColor = BoxColorList[1];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
BoxColor = BoxColorList[2];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
count = result.TotalDesserts;
|
||||||
}
|
}
|
||||||
isLoading = false;
|
isLoading = false;
|
||||||
}
|
}
|
||||||
void RestData()
|
|
||||||
|
private async Task OnColorChanged(object value)
|
||||||
{
|
{
|
||||||
// PortUtil.speechSynthesizer.SpeakAsyncCancelAll();
|
BoxColor = (BoxModel)value;
|
||||||
// this.status = 0;
|
if (AllDrawerNos != null && AllDrawerNos.Length > 0 && AllDrawerNos[0] != "无库位")
|
||||||
// data.ForEach(it =>
|
{
|
||||||
// {
|
if (BoxColor.BoxNo == 3)
|
||||||
// it.Status = 0;
|
{
|
||||||
// it.BeforeQuantity = new int[9];
|
DrawerNos = AllDrawerNos.Where(d => !(d.EndsWith('白')) && !(d.EndsWith('绿')) && !(d.Contains('-'))).ToArray();
|
||||||
// it.AfterQuantity = new int[9];
|
if (DrawerNos != null && DrawerNos.Length > 0 && DrawerNos[0] != "无库位")
|
||||||
// });
|
{
|
||||||
// this.WeightFinnalQuantity = new int[9];
|
SelectedDrawerNo = DrawerNos[0];
|
||||||
// DrawerNoColNoList.Clear();
|
await SelectedDrawerChange(SelectedDrawerNo);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
SelectedDrawerNo = "无库位";
|
||||||
|
}
|
||||||
|
await InvokeAsync(StateHasChanged);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (BoxColor.BoxNo == 1)
|
||||||
|
{
|
||||||
|
DrawerNos = AllDrawerNos.Where(d => d.EndsWith('白')).ToArray();
|
||||||
|
if (DrawerNos != null && DrawerNos.Length > 0 && DrawerNos[0] != "无库位")
|
||||||
|
{
|
||||||
|
SelectedDrawerNo = DrawerNos[0];
|
||||||
|
await SelectedDrawerChange(SelectedDrawerNo);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
SelectedDrawerNo = "无库位";
|
||||||
|
}
|
||||||
|
await InvokeAsync(StateHasChanged);
|
||||||
|
}
|
||||||
|
else if (BoxColor.BoxNo == 2)
|
||||||
|
{
|
||||||
|
DrawerNos = AllDrawerNos.Where(d => d.EndsWith('绿')).ToArray();
|
||||||
|
if (DrawerNos != null && DrawerNos.Length > 0 && DrawerNos[0] != "无库位")
|
||||||
|
{
|
||||||
|
SelectedDrawerNo = DrawerNos[0];
|
||||||
|
await SelectedDrawerChange(SelectedDrawerNo);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
SelectedDrawerNo = "无库位";
|
||||||
|
}
|
||||||
|
await InvokeAsync(StateHasChanged);
|
||||||
|
}
|
||||||
|
// else if (BoxColor.BoxNo == 4)
|
||||||
|
// {
|
||||||
|
// DrawerNos = AllDrawerNos.Where(d => !(d.EndsWith('绿')) && !(d.EndsWith('白')) && d.Contains('-')).ToArray();
|
||||||
|
// if (DrawerNos != null && DrawerNos.Length > 0 && DrawerNos[0] != "无库位")
|
||||||
|
// {
|
||||||
|
// SelectedDrawerNo = DrawerNos[0];
|
||||||
|
// await SelectedDrawerChange(SelectedDrawerNo);
|
||||||
|
// }
|
||||||
|
// else
|
||||||
|
// {
|
||||||
|
// SelectedDrawerNo = "无库位";
|
||||||
|
// }
|
||||||
|
// await InvokeAsync(StateHasChanged);
|
||||||
|
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
void Cancel()
|
void Cancel()
|
||||||
{
|
{
|
||||||
|
|
@ -123,14 +269,14 @@
|
||||||
}
|
}
|
||||||
async Task Save()
|
async Task Save()
|
||||||
{
|
{
|
||||||
if (selectedDrawerData!=null&&selectedDrawerData.Any(cl => cl.AddQuantity != 0 && cl.DrugId != null && cl.ManuNo != null))
|
if (selectedDrawerData != null && selectedDrawerData.Any(cl => cl.AddQuantity != 0 && cl.DrugId != null && cl.ManuNo != null))
|
||||||
{
|
{
|
||||||
if (selectedDrawerData.Where(cs => cs.AddQuantity != 0).Sum(cs => cs.Quantity) > channelStock.Quantity)
|
if (selectedDrawerData.Where(cs => cs.AddQuantity != 0).Sum(cs => cs.AddQuantity) > channelStock.Quantity)
|
||||||
{
|
{
|
||||||
_message.Notify(new NotificationMessage { Severity = NotificationSeverity.Warning, Summary = "提示", Detail = $"交换总数量不能大于库存", Duration = 4000 });
|
_message.Notify(new NotificationMessage { Severity = NotificationSeverity.Warning, Summary = "提示", Detail = $"交换总数量不能大于库存", Duration = 4000 });
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var b = await channelListDao.BoxReplaceFinish(channelStock,selectedDrawerData.Where(cl => cl.AddQuantity != 0).ToList());
|
var b = await channelListDao.BoxReplaceFinish(channelStock, selectedDrawerData.Where(cl => cl.AddQuantity != 0).ToList());
|
||||||
if (!b)
|
if (!b)
|
||||||
{
|
{
|
||||||
_message.Notify(new NotificationMessage { Severity = NotificationSeverity.Error, Summary = "提示", Detail = $"数据保存失败", Duration = 4000 });
|
_message.Notify(new NotificationMessage { Severity = NotificationSeverity.Error, Summary = "提示", Detail = $"数据保存失败", Duration = 4000 });
|
||||||
|
|
@ -155,6 +301,12 @@
|
||||||
|
|
||||||
async Task SelectedDrawerChange(object drawerNo)
|
async Task SelectedDrawerChange(object drawerNo)
|
||||||
{
|
{
|
||||||
|
if (drawerNo == "无库位")
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
drawerNo = drawerNo == "急诊药盒" ? "99-1" : drawerNo == "恢复室药盒" ? "111-1" : drawerNo == "胃镜药盒" ? "31-1" : drawerNo == "导管药盒" ? "32-1" : drawerNo == "生殖药盒" ? "33-1" : drawerNo == "妇门药盒" ? "34-1" : drawerNo;
|
||||||
|
|
||||||
var result = await channelListDao.GetChannelStockByDrug(channelStock, drawerNo.ToString(), 8, 0);
|
var result = await channelListDao.GetChannelStockByDrug(channelStock, drawerNo.ToString(), 8, 0);
|
||||||
selectedDrawerData = result.Desserts;
|
selectedDrawerData = result.Desserts;
|
||||||
}
|
}
|
||||||
|
|
@ -166,4 +318,15 @@
|
||||||
currentCol = args.Data.ColNo;
|
currentCol = args.Data.ColNo;
|
||||||
grid.EditRow(args.Data);
|
grid.EditRow(args.Data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void RestData()
|
||||||
|
{
|
||||||
|
PortUtil.PowerOff();
|
||||||
|
PortUtil.speechSynthesizer.SpeakAsyncCancelAll();
|
||||||
|
this.status = 0;
|
||||||
|
// this.BeforeQuantity = new int[9];
|
||||||
|
// this.AfterQuantity = new int[9];
|
||||||
|
// currentCol = 0;
|
||||||
|
// ColNos.Clear();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -2,36 +2,46 @@
|
||||||
@using MasaBlazorApp3.Pojo.Config
|
@using MasaBlazorApp3.Pojo.Config
|
||||||
|
|
||||||
<RadzenStack Orientation="Orientation.Horizontal" class="col-12 mb-4">
|
<RadzenStack Orientation="Orientation.Horizontal" class="col-12 mb-4">
|
||||||
<div class="col-2 row justify-content-center align-items-center text-center" >
|
<div class="col-2 row justify-content-center align-items-center text-center">
|
||||||
<div class="row justify-content-around align-items-center" style="height:600px;overflow:auto">
|
<div class="row justify-content-around align-items-center" style="height:600px;overflow:auto">
|
||||||
@foreach (var cs in channelStockList)
|
@foreach (var cs in channelStockList)
|
||||||
{
|
{
|
||||||
<RadzenButton class="col-12" Style="margin-bottom:5px" Click="@(() => SelectDrawer((cs.DrawerNo.ToString() + "-" + cs.ColNo.ToString())))" Text="@(cs.DrawerNo==99?"急诊室药盒":cs.DrawerNo==111?"恢复室药盒":$"{cs.DrawerNo.ToString() + "-" + cs.ColNo.ToString()}")" Disabled="@(status > 0)" Shade="Shade.Light" Variant="@(drawerNo != (cs.DrawerNo.ToString() + "-" + cs.ColNo.ToString()) ? Variant.Outlined : Variant.Flat)" />
|
<RadzenButton class="col-12" Style="margin-bottom:5px" Click="@(() => SelectDrawer((cs.DrawerNo.ToString() + "-" + cs.ColNo.ToString())))" Text="@(cs.DrawerNo==99?"急诊室药盒":cs.DrawerNo==111?"恢复室药盒":cs.DrawerNo==31?"胃镜药盒":cs.DrawerNo==32?"导管药盒":cs.DrawerNo==33?"生殖药盒":cs.DrawerNo==34?"妇门药盒":$"{cs.DrawerNo.ToString() + "-" + (cs.ColNo==1?'白':'绿')}")" Disabled="@(status > 0)" Shade="Shade.Light" Variant="@(drawerNo != (cs.DrawerNo.ToString() + "-" + cs.ColNo.ToString()) ? Variant.Outlined : Variant.Flat)" />
|
||||||
|
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-10">
|
<div class="col-10">
|
||||||
<RadzenDataList @ref="grid" LoadData="@LoadData" WrapItems="true" Count="@count" IsLoading="@isLoading" style="height:600px;overflow:auto"
|
<RadzenDataList @ref="grid" LoadData="@LoadData" WrapItems="true" Count="@count" IsLoading="@isLoading" style="height:600px;overflow:auto"
|
||||||
Data="@_forecasts" PageSize="6" AllowPaging="true" PagerHorizontalAlign="HorizontalAlign.Left"
|
Data="@_forecasts" PageSize="6" AllowPaging="false">
|
||||||
ShowPagingSummary="true" PagingSummaryFormat="{0}/{1} 共{2}条数据">
|
|
||||||
<Template Context="pd">
|
<Template Context="pd">
|
||||||
<RadzenCard Variant="Variant.Outlined" class="rz-p-0" Style="width: 100%;">
|
<RadzenCard Variant="Variant.Outlined" class="rz-p-0" Style="width: 100%;">
|
||||||
<RadzenRow Gap="0">
|
<RadzenRow Gap="0">
|
||||||
<RadzenColumn Size="2">
|
<RadzenColumn Size="10">
|
||||||
<RadzenText TextStyle="TextStyle.H6" TagName="TagName.H5" class="rz-color-on-secondary-lighter">@(pd._DrugInfo.DrugName)</RadzenText>
|
<div style="text-align: left;">
|
||||||
|
<div class="rz-text-h6 rz-mb-0">品名/规格/厂家</div>
|
||||||
|
@(pd._DrugInfo.DrugNameSpec)
|
||||||
|
</div>
|
||||||
|
@* <RadzenText TextStyle="TextStyle.H6" TagName="TagName.H5" class="rz-color-on-secondary-lighter">@(pd._DrugInfo.ToString())</RadzenText> *@
|
||||||
</RadzenColumn>
|
</RadzenColumn>
|
||||||
<RadzenColumn Size="5">
|
@* <RadzenColumn Size="5">
|
||||||
<RadzenText TextStyle="TextStyle.H6" TagName="TagName.H5" class="rz-color-on-secondary-lighter">@(pd._DrugInfo.Manufactory)</RadzenText>
|
厂家<br />
|
||||||
</RadzenColumn>
|
@(pd._DrugInfo.Manufactory)
|
||||||
<RadzenColumn Size="3">
|
</RadzenColumn> *@
|
||||||
<RadzenText TextStyle="TextStyle.H6" TagName="TagName.H5" class="rz-color-on-secondary-lighter">@(pd._DrugInfo.DrugSpec)</RadzenText>
|
@*<RadzenColumn Size="3">
|
||||||
|
规格<br />
|
||||||
|
@(pd._DrugInfo.DrugSpec)
|
||||||
|
<RadzenText TextStyle="TextStyle.H6" TagName="TagName.H5" class="rz-color-on-secondary-lighter">@(pd._DrugInfo.DrugSpec)</RadzenText>
|
||||||
|
</RadzenColumn> *@
|
||||||
|
<RadzenColumn Size="1">
|
||||||
|
<div class="rz-text-h6 rz-mb-0">基数</div>
|
||||||
|
@(pd.BaseQuantity)
|
||||||
|
@* <RadzenText TextStyle="TextStyle.H6" TagName="TagName.H5" class="rz-color-on-secondary-lighter">@(pd.BaseQuantity)</RadzenText> *@
|
||||||
</RadzenColumn>
|
</RadzenColumn>
|
||||||
<RadzenColumn Size="1">
|
<RadzenColumn Size="1">
|
||||||
<RadzenText TextStyle="TextStyle.H6" TagName="TagName.H5" class="rz-color-on-secondary-lighter">@(pd.BaseQuantity)</RadzenText>
|
<div class="rz-text-h6 rz-mb-0">库存</div>
|
||||||
</RadzenColumn>
|
@(pd.channelStocks.Sum(cs => cs.Quantity))
|
||||||
<RadzenColumn Size="1">
|
@* <RadzenText TextStyle="TextStyle.H6" TagName="TagName.H5" class="rz-color-on-secondary-lighter">@(pd.channelStocks.Sum(cs => cs.Quantity))</RadzenText> *@
|
||||||
<RadzenText TextStyle="TextStyle.H6" TagName="TagName.H5" class="rz-color-on-secondary-lighter">@(pd.channelStocks.Sum(cs => cs.Quantity))</RadzenText>
|
|
||||||
</RadzenColumn>
|
</RadzenColumn>
|
||||||
|
|
||||||
</RadzenRow>
|
</RadzenRow>
|
||||||
|
|
@ -124,7 +134,7 @@
|
||||||
int[] DrawerNos = new int[] { 1, 2, 3, 4, 5, 6, 7, 8 };
|
int[] DrawerNos = new int[] { 1, 2, 3, 4, 5, 6, 7, 8 };
|
||||||
List<ChannelStock> channelStockList = new();
|
List<ChannelStock> channelStockList = new();
|
||||||
int status = 0;
|
int status = 0;
|
||||||
string drawerNo="1-1";
|
string drawerNo = "1-1";
|
||||||
string OrderNo;
|
string OrderNo;
|
||||||
DateTime OrderDate;
|
DateTime OrderDate;
|
||||||
void SelectDrawer(string strDrawerNoColNo)
|
void SelectDrawer(string strDrawerNoColNo)
|
||||||
|
|
@ -168,8 +178,10 @@
|
||||||
{
|
{
|
||||||
if (cs.Quantity > 0)
|
if (cs.Quantity > 0)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
string message = cs.DrawerNo + "-" + (cs.ColNo == 1 ? "白" : "绿") + " 药盒替换药品详情";
|
||||||
var b = await dialogService.OpenAsync<BoxReplace>(
|
var b = await dialogService.OpenAsync<BoxReplace>(
|
||||||
$"{cs.DrawerNo}号药盒替换药品详情",
|
message,
|
||||||
new Dictionary<string, object>() { { "channelStock", cs } },
|
new Dictionary<string, object>() { { "channelStock", cs } },
|
||||||
new DialogOptions() { Width = "85vw", Resizable = true, Draggable = true, ShowClose = false }
|
new DialogOptions() { Width = "85vw", Resizable = true, Draggable = true, ShowClose = false }
|
||||||
);
|
);
|
||||||
|
|
@ -191,8 +203,9 @@
|
||||||
{
|
{
|
||||||
if (cs.Quantity > 0)
|
if (cs.Quantity > 0)
|
||||||
{
|
{
|
||||||
|
string message = cs.DrawerNo + "-" + (cs.ColNo == 1 ? "白" : "绿") + " 药盒移动药品详情";
|
||||||
var b = await dialogService.OpenAsync<BoxRemoveDialog>(
|
var b = await dialogService.OpenAsync<BoxRemoveDialog>(
|
||||||
$"{cs.DrawerNo}号药盒替换药品详情",
|
message,
|
||||||
new Dictionary<string, object>() { { "channelStock", cs } },
|
new Dictionary<string, object>() { { "channelStock", cs } },
|
||||||
new DialogOptions() { Width = "85vw", Resizable = true, Draggable = true, ShowClose = false }
|
new DialogOptions() { Width = "85vw", Resizable = true, Draggable = true, ShowClose = false }
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,234 @@
|
||||||
|
@page "/Box/BoxStockAAA"
|
||||||
|
@using MasaBlazorApp3.Pojo.Config
|
||||||
|
|
||||||
|
<RadzenStack Orientation="Orientation.Horizontal" class="col-12 mb-4">
|
||||||
|
<div class="col-2 row justify-content-center align-items-center text-center">
|
||||||
|
<div class="row justify-content-around align-items-center" style="height:600px;overflow:auto">
|
||||||
|
@foreach (var cs in channelStockList)
|
||||||
|
{
|
||||||
|
<RadzenButton class="col-12" Style="margin-bottom:5px" Click="@(() => SelectDrawer((cs.DrawerNo.ToString() + "-" + cs.ColNo.ToString())))" Text="@(cs.DrawerNo==99?"急诊室药盒":cs.DrawerNo==111?"恢复室药盒":cs.DrawerNo==31?"胃镜药盒":cs.DrawerNo==32?"导管药盒":cs.DrawerNo==33?"生殖药盒":cs.DrawerNo==34?"妇门药盒":$"{cs.DrawerNo.ToString() + "-" + (cs.ColNo==1?'白':'绿')}")" Disabled="@(status > 0)" Shade="Shade.Light" Variant="@(drawerNo != (cs.DrawerNo.ToString() + "-" + cs.ColNo.ToString()) ? Variant.Outlined : Variant.Flat)" />
|
||||||
|
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-10">
|
||||||
|
<RadzenDataGrid @ref="grid"
|
||||||
|
IsLoading="@isLoading"
|
||||||
|
RowRender="@RowRender"
|
||||||
|
EmptyText="无数据"
|
||||||
|
Data="@_forecasts"
|
||||||
|
AllowColumnResize="true" AllowAlternatingRows="false"
|
||||||
|
SelectionMode="DataGridSelectionMode.Single"
|
||||||
|
ExpandMode="DataGridExpandMode.Single">
|
||||||
|
<Template Context="di">
|
||||||
|
<RadzenDataGrid Data="@di.Stocks" EmptyText="无数据">
|
||||||
|
<Columns>
|
||||||
|
@* <RadzenDataGridColumn Title="库位" Property="DrawerNo">
|
||||||
|
<Template Context="s">
|
||||||
|
@s.DrawerNo - @s.ColNo
|
||||||
|
</Template>
|
||||||
|
</RadzenDataGridColumn> *@
|
||||||
|
|
||||||
|
<RadzenDataGridColumn Title="批次" Property="ManuNo"></RadzenDataGridColumn>
|
||||||
|
<RadzenDataGridColumn Title="效期" Property="EffDate">
|
||||||
|
<Template Context="s">
|
||||||
|
@{
|
||||||
|
DateTime dateTime;
|
||||||
|
bool success = DateTime.TryParse(s.EffDate, out dateTime);
|
||||||
|
@s.EffDate
|
||||||
|
}
|
||||||
|
</Template>
|
||||||
|
</RadzenDataGridColumn>
|
||||||
|
<RadzenDataGridColumn Title="数量" Property="Quantity">
|
||||||
|
</RadzenDataGridColumn>
|
||||||
|
</Columns>
|
||||||
|
</RadzenDataGrid>
|
||||||
|
</Template>
|
||||||
|
<Columns>
|
||||||
|
<RadzenDataGridColumn Frozen="true" Width="200px" Title="药品名称" Property="DrugName"></RadzenDataGridColumn>
|
||||||
|
<RadzenDataGridColumn Title="规格" Property="DrugSpec"></RadzenDataGridColumn>
|
||||||
|
<RadzenDataGridColumn Title="基数" Property="BoxBaseQuantity">
|
||||||
|
<Template Context="s">
|
||||||
|
@s.BoxBaseQuantity
|
||||||
|
</Template>
|
||||||
|
</RadzenDataGridColumn>
|
||||||
|
<RadzenDataGridColumn Title="总库存" Property="BoxBaseQuantity">
|
||||||
|
<Template Context="s">
|
||||||
|
@s.StockQuantity
|
||||||
|
</Template>
|
||||||
|
</RadzenDataGridColumn>
|
||||||
|
</Columns>
|
||||||
|
</RadzenDataGrid>
|
||||||
|
</div>
|
||||||
|
</RadzenStack>
|
||||||
|
@code {
|
||||||
|
@inject IOrderInfoDao orderInfoDao;
|
||||||
|
@inject IChannelListDao channelListDao;
|
||||||
|
@inject DialogService dialogService;
|
||||||
|
@inject Microsoft.Extensions.Options.IOptions<Pojo.Config.SettingConfig> setting;
|
||||||
|
@inject NotificationService _message
|
||||||
|
|
||||||
|
@inject IDrugInfoDao drugInfoDao;
|
||||||
|
|
||||||
|
private IEnumerable<DrugInfo>? _forecasts;
|
||||||
|
bool allowRowSelectOnRowClick = true;
|
||||||
|
// IEnumerable<DrugManuNo> drugManuNos;
|
||||||
|
// IList<DrugManuNo> selectedDrugManuNos;
|
||||||
|
|
||||||
|
RadzenDataGrid<DrugInfo> grid;
|
||||||
|
// RadzenDataGrid<DrugManuNo> gridManuNo;
|
||||||
|
bool isLoading;
|
||||||
|
int count;
|
||||||
|
int[] DrawerNos = new int[] { 1, 2, 3, 4, 5, 6, 7, 8 };
|
||||||
|
List<ChannelStock> 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<DrugInfo> 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<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 }
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,212 @@
|
||||||
|
@page "/Box/BoxStockAA"
|
||||||
|
@using MasaBlazorApp3.Pojo.Config
|
||||||
|
|
||||||
|
<RadzenStack Orientation="Orientation.Horizontal" class="col-12 mb-4">
|
||||||
|
<div class="col-2 row justify-content-center align-items-center text-center">
|
||||||
|
<div class="row justify-content-around align-items-center" style="height:600px;overflow:auto">
|
||||||
|
@foreach (var cs in channelStockList)
|
||||||
|
{
|
||||||
|
<RadzenButton class="col-12" Style="margin-bottom:5px" Click="@(() => SelectDrawer((cs.DrawerNo.ToString() + "-" + cs.ColNo.ToString())))" Text="@(cs.DrawerNo==99?"急诊室药盒":cs.DrawerNo==111?"恢复室药盒":cs.DrawerNo==31?"胃镜药盒":cs.DrawerNo==32?"导管药盒":cs.DrawerNo==33?"生殖药盒":cs.DrawerNo==34?"妇门药盒":$"{cs.DrawerNo.ToString() + "-" + (cs.ColNo==1?'白':'绿')}")" Disabled="@(status > 0)" Shade="Shade.Light" Variant="@(drawerNo != (cs.DrawerNo.ToString() + "-" + cs.ColNo.ToString()) ? Variant.Outlined : Variant.Flat)" />
|
||||||
|
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-10">
|
||||||
|
<RadzenDataList @ref="grid" LoadData="@LoadData" WrapItems="true" Count="@count" IsLoading="@isLoading" style="height:600px;overflow:auto"
|
||||||
|
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%;">
|
||||||
|
<RadzenRow Gap="0">
|
||||||
|
<RadzenColumn Size="2">
|
||||||
|
<RadzenText TextStyle="TextStyle.H6" TagName="TagName.H5" class="rz-color-on-secondary-lighter">@(pd._DrugInfo.DrugName)</RadzenText>
|
||||||
|
</RadzenColumn>
|
||||||
|
<RadzenColumn Size="5">
|
||||||
|
<RadzenText TextStyle="TextStyle.H6" TagName="TagName.H5" class="rz-color-on-secondary-lighter">@(pd._DrugInfo.Manufactory)</RadzenText>
|
||||||
|
</RadzenColumn>
|
||||||
|
<RadzenColumn Size="3">
|
||||||
|
<RadzenText TextStyle="TextStyle.H6" TagName="TagName.H5" class="rz-color-on-secondary-lighter">@(pd._DrugInfo.DrugSpec)</RadzenText>
|
||||||
|
</RadzenColumn>
|
||||||
|
<RadzenColumn Size="1">
|
||||||
|
<RadzenText TextStyle="TextStyle.H6" TagName="TagName.H5" class="rz-color-on-secondary-lighter">@(pd.BaseQuantity)</RadzenText>
|
||||||
|
</RadzenColumn>
|
||||||
|
<RadzenColumn Size="1">
|
||||||
|
<RadzenText TextStyle="TextStyle.H6" TagName="TagName.H5" class="rz-color-on-secondary-lighter">@(pd.channelStocks.Sum(cs => cs.Quantity))</RadzenText>
|
||||||
|
</RadzenColumn>
|
||||||
|
|
||||||
|
</RadzenRow>
|
||||||
|
@* <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;
|
||||||
|
}
|
||||||
|
<RadzenRow Gap="0">
|
||||||
|
<RadzenColumn Size="12">
|
||||||
|
@if (manuInfo != null && manuInfo.ManuNo != null)
|
||||||
|
{
|
||||||
|
<RadzenRow Gap="0">
|
||||||
|
<RadzenColumn Size="3">
|
||||||
|
@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="3">
|
||||||
|
@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="1">
|
||||||
|
@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="2">
|
||||||
|
<RadzenText style="margin-top:5px;"></RadzenText>
|
||||||
|
<RadzenButton Text="替换药品" Style="margin:1px" Click="@(() => replaceClick(manuInfo))" />
|
||||||
|
</RadzenColumn>
|
||||||
|
<RadzenColumn Size="2">
|
||||||
|
<RadzenText style="margin-top:5px;"></RadzenText>
|
||||||
|
<RadzenButton Text="移出药品" Click="@(() => removeClick(manuInfo))" />
|
||||||
|
</RadzenColumn>
|
||||||
|
|
||||||
|
</RadzenRow>
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
<RadzenRow Gap="0">
|
||||||
|
<RadzenColumn Size="5">
|
||||||
|
<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 };
|
||||||
|
List<ChannelStock> channelStockList = new();
|
||||||
|
int status = 0;
|
||||||
|
string drawerNo = "1-1";
|
||||||
|
string OrderNo;
|
||||||
|
DateTime OrderDate;
|
||||||
|
void SelectDrawer(string strDrawerNoColNo)
|
||||||
|
{
|
||||||
|
this.drawerNo = strDrawerNoColNo;
|
||||||
|
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;
|
||||||
|
|
||||||
|
channelStockList = 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 }
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
@page "/Box/Check"
|
@page "/Box/CheckAAA"
|
||||||
@using MasaBlazorApp3.Pojo.Config
|
@using MasaBlazorApp3.Pojo.Config
|
||||||
@using MasaBlazorApp3.Report
|
@using MasaBlazorApp3.Report
|
||||||
@using Microsoft.Extensions.Options
|
@using Microsoft.Extensions.Options
|
||||||
|
|
@ -17,6 +17,12 @@
|
||||||
box-shadow: var(--rz-panel-shadow);
|
box-shadow: var(--rz-panel-shadow);
|
||||||
border-radius: var(--rz-border-radius);
|
border-radius: var(--rz-border-radius);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.rz-grid-table {
|
||||||
|
position: relative;
|
||||||
|
border-collapse: separate;
|
||||||
|
border-spacing: 0;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<RadzenStack Orientation="Orientation.Horizontal">
|
<RadzenStack Orientation="Orientation.Horizontal">
|
||||||
|
|
@ -39,13 +45,13 @@
|
||||||
</div>
|
</div>
|
||||||
</div> *@
|
</div> *@
|
||||||
<div class="col-12">
|
<div class="col-12">
|
||||||
<form onsubmit="@(() => grid.Reload())">
|
<form onsubmit="@(() => {firstLod=0;grid.Reload();})">
|
||||||
<RadzenFieldset Text="查询">
|
<RadzenFieldset Text="查询">
|
||||||
@* <RadzenStack Orientation="Orientation.Horizontal" Gap="1rem"> *@
|
@* <RadzenStack Orientation="Orientation.Horizontal" Gap="1rem"> *@
|
||||||
<RadzenRow AlignItems="AlignItems.Center">
|
<RadzenRow AlignItems="AlignItems.Center">
|
||||||
<RadzenColumn Size="6">
|
<RadzenColumn Size="6">
|
||||||
<RadzenLabel Text="麻醉医师" Component="NamesList" />
|
<RadzenLabel Text="麻醉医师" Component="NamesList" Style="width: 20%;" />
|
||||||
<RadzenDropDownDataGrid AllowVirtualization="true" Name="NamesList" TValue="Anaesthetist" Data="@NamesList" @bind-Value="Name"
|
<RadzenDropDownDataGrid AllowVirtualization="true" Name="NamesList" TValue="Anaesthetist" Data="@NamesList" @bind-Value="NameInfo"
|
||||||
Style="width:100%; display: block;" AllowFilteringByAllStringColumns="true" TextProperty="Name">
|
Style="width:100%; display: block;" AllowFilteringByAllStringColumns="true" TextProperty="Name">
|
||||||
<Columns>
|
<Columns>
|
||||||
<RadzenDropDownDataGridColumn Property="Name" Title="麻醉医师" Sortable="false" />
|
<RadzenDropDownDataGridColumn Property="Name" Title="麻醉医师" Sortable="false" />
|
||||||
|
|
@ -53,13 +59,19 @@
|
||||||
</RadzenDropDownDataGrid>
|
</RadzenDropDownDataGrid>
|
||||||
</RadzenColumn>
|
</RadzenColumn>
|
||||||
|
|
||||||
<RadzenColumn Size="6" Style="margin-top:0.5rem">
|
<RadzenColumn Size="6">
|
||||||
<RadzenLabel Text="核对药箱" Component="BoxList" />
|
<RadzenLabel Text="核对药箱" Component="BoxList" />
|
||||||
|
@* <RadzenDropDownDataGrid AllowVirtualization="true" Name="BoxColorList" TValue="Anaesthetist" Data="@BoxColorList" @bind-Value="BoxColor" Style="width: 100%;"
|
||||||
|
AllowFilteringByAllStringColumns="true" TextProperty="Name">
|
||||||
|
<Columns>
|
||||||
|
<RadzenDropDownDataGridColumn Property="Name" Title="药盒颜色" Sortable="false" />
|
||||||
|
</Columns>
|
||||||
|
</RadzenDropDownDataGrid> *@
|
||||||
<RadzenDropDownDataGrid AllowVirtualization="true" Name="BoxList" TValue="BoxModel" Data="@BoxList" @bind-Value="BoxNum" Style="width: 100%;"
|
<RadzenDropDownDataGrid AllowVirtualization="true" Name="BoxList" TValue="BoxModel" Data="@BoxList" @bind-Value="BoxNum" Style="width: 100%;"
|
||||||
AllowFilteringByAllStringColumns="true" TextProperty="药箱号">
|
AllowFilteringByAllStringColumns="true" TextProperty="药箱号">
|
||||||
<Template>
|
<Template>
|
||||||
|
|
||||||
@((context as BoxModel).BoxName == 99 ? "急诊药盒" : (context as BoxModel).BoxName == 111 ? "恢复室药盒" : (context as BoxModel).BoxName + "-" + (context as BoxModel).BoxNo)
|
@((context as BoxModel).BoxName == 99 ? "急诊药盒" : (context as BoxModel).BoxName == 111 ? "恢复室药盒" : (context as BoxModel).BoxName + "-" + ((context as BoxModel).BoxNo == 1 ? "白" : "绿"))
|
||||||
|
|
||||||
@* @((context as BoxModel).BoxName + "-" + (context as BoxModel).BoxNo) *@
|
@* @((context as BoxModel).BoxName + "-" + (context as BoxModel).BoxNo) *@
|
||||||
|
|
||||||
|
|
@ -82,32 +94,39 @@
|
||||||
<RadzenDatePicker DateFormat="yyyy-MM-dd" CurrentDateChanged="@OnCurrentDateChanged" AllowClear @bind-Value="OrderDate" Style="width: 100%;" Name="OrderDate" />
|
<RadzenDatePicker DateFormat="yyyy-MM-dd" CurrentDateChanged="@OnCurrentDateChanged" AllowClear @bind-Value="OrderDate" Style="width: 100%;" Name="OrderDate" />
|
||||||
</RadzenColumn>
|
</RadzenColumn>
|
||||||
</RadzenRow>
|
</RadzenRow>
|
||||||
<RadzenRow AlignItems="AlignItems.Center" Style="margin-top:2vh;margin-left:48vh;">
|
<RadzenRow AlignItems="AlignItems.Center">
|
||||||
|
<RadzenColumn Size="6">
|
||||||
|
|
||||||
<RadzenButton Size="ButtonSize.Medium" ButtonType="ButtonType.Submit" IsBusy="isLoading" Icon="search" Text="查询" />
|
<RadzenLabel Text="患者姓名" Component="PatientName" />
|
||||||
<RadzenButton Size="ButtonSize.Medium" Click="reloadGrid" IsBusy="isLoading" Icon="refresh" Text="重置" ButtonStyle="ButtonStyle.Warning" />
|
<RadzenTextBox @bind-Value="PatientName" Style="width: 100%;" Name="PatientName"></RadzenTextBox>
|
||||||
<RadzenButton Size="ButtonSize.Medium" Click="Confirm" ButtonType="ButtonType.Button" IsBusy="isLoading" Icon="check_circle" Text="确认" />
|
|
||||||
<RadzenButton Icon="download" @ref=button Text="麻醉药品使用登记本导出" Variant="Variant.Outlined" Click="@(args => popup.ToggleAsync(button.Element))" />
|
|
||||||
<Popup @ref=popup Lazy=true class="my-popup">
|
|
||||||
<RadzenStack Orientation="Orientation.Vertical" Gap="1rem" class="rz-h-100 rz-p-4">
|
|
||||||
<RadzenFieldset Text="条件选择">
|
|
||||||
<RadzenStack Orientation="Orientation.Horizontal" Gap="1rem">
|
|
||||||
<RadzenRow AlignItems="AlignItems.Center">
|
|
||||||
<RadzenColumn Size="6">
|
|
||||||
<RadzenLabel Text="处方时间" Component="PortOrderDate" />
|
|
||||||
</RadzenColumn>
|
|
||||||
<RadzenColumn Size="6">
|
|
||||||
<RadzenDatePicker DateFormat="yyyy-MM-dd" CurrentDateChanged="@OnCurrentPortDateChanged" @bind-Value="PortOrderDate" Style="width: 100%;" Name="PortOrderDate" />
|
|
||||||
</RadzenColumn>
|
|
||||||
</RadzenRow>
|
|
||||||
|
|
||||||
<RadzenRow JustifyContent="JustifyContent.End" AlignItems="AlignItems.Center">
|
</RadzenColumn>
|
||||||
<RadzenButton Icon="download" Text="导出" Variant="Variant.Outlined" Click="StockExport" />
|
<RadzenColumn Size="6" Style="margin-top:2px">
|
||||||
</RadzenRow>
|
<RadzenButton Size="ButtonSize.Medium" ButtonType="ButtonType.Submit" IsBusy="isLoading" Icon="search" Text="查询" />
|
||||||
</RadzenStack>
|
<RadzenButton Size="ButtonSize.Medium" Click="reloadGrid" IsBusy="isLoading" Icon="refresh" Text="重置" ButtonStyle="ButtonStyle.Warning" />
|
||||||
</RadzenFieldset>
|
<RadzenButton Size="ButtonSize.Medium" Click="Confirm" ButtonType="ButtonType.Button" IsBusy="isLoading" Icon="check_circle" Text="确认" />
|
||||||
</RadzenStack>
|
<RadzenButton Style="margin-top:2px" Icon="download" @ref=button Text="麻醉药品使用登记本导出" Variant="Variant.Outlined" Click="@(args => popup.ToggleAsync(button.Element))" />
|
||||||
</Popup>
|
<Popup @ref=popup Lazy=true class="my-popup">
|
||||||
|
<RadzenStack Orientation="Orientation.Vertical" Gap="1rem" class="rz-h-100 rz-p-4">
|
||||||
|
<RadzenFieldset Text="条件选择">
|
||||||
|
<RadzenStack Orientation="Orientation.Horizontal" Gap="1rem">
|
||||||
|
<RadzenRow AlignItems="AlignItems.Center">
|
||||||
|
<RadzenColumn Size="6">
|
||||||
|
<RadzenLabel Text="处方时间" Component="PortOrderDate" />
|
||||||
|
</RadzenColumn>
|
||||||
|
<RadzenColumn Size="6">
|
||||||
|
<RadzenDatePicker DateFormat="yyyy-MM-dd" CurrentDateChanged="@OnCurrentPortDateChanged" @bind-Value="PortOrderDate" Style="width: 100%;" Name="PortOrderDate" />
|
||||||
|
</RadzenColumn>
|
||||||
|
</RadzenRow>
|
||||||
|
|
||||||
|
<RadzenRow JustifyContent="JustifyContent.End" AlignItems="AlignItems.Center">
|
||||||
|
<RadzenButton Icon="download" Text="导出" Variant="Variant.Outlined" Click="StockExport" />
|
||||||
|
</RadzenRow>
|
||||||
|
</RadzenStack>
|
||||||
|
</RadzenFieldset>
|
||||||
|
</RadzenStack>
|
||||||
|
</Popup>
|
||||||
|
</RadzenColumn>
|
||||||
</RadzenRow>
|
</RadzenRow>
|
||||||
@* </RadzenStack> *@
|
@* </RadzenStack> *@
|
||||||
</RadzenFieldset>
|
</RadzenFieldset>
|
||||||
|
|
@ -146,38 +165,40 @@
|
||||||
</Popup> *@
|
</Popup> *@
|
||||||
</RadzenStack>
|
</RadzenStack>
|
||||||
</form>
|
</form>
|
||||||
<RadzenDataGrid @ref="grid" AllowRowSelectOnRowClick="@allowRowSelectOnRowClick" AllowFiltering="true" LoadData="@LoadData"
|
<div Style="width:936px;height:50vh;overflow:auto">
|
||||||
FilterPopupRenderMode="PopupRenderMode.OnDemand" FilterCaseSensitivity="FilterCaseSensitivity.CaseInsensitive"
|
<RadzenDataGrid @ref="grid" AllowRowSelectOnRowClick="@allowRowSelectOnRowClick" AllowFiltering="true" LoadData="@LoadData" Style="width:955px;overflow:auto" Groupable="true"
|
||||||
Data="@orderInfos" ColumnWidth="200px" IsLoading="@isLoading" Count="@count" EmptyText="无数据"
|
FilterPopupRenderMode="PopupRenderMode.OnDemand" FilterCaseSensitivity="FilterCaseSensitivity.CaseInsensitive"
|
||||||
SelectionMode="DataGridSelectionMode.Multiple" @bind-Value=@selectedOrderInfos
|
Data="@orderInfos" IsLoading="@isLoading" Count="@count" EmptyText="无数据"
|
||||||
CellClick="@((DataGridCellMouseEventArgs<OrderInfo> args) => OnCellClick(args))"
|
SelectionMode="DataGridSelectionMode.Multiple" @bind-Value=@selectedOrderInfos
|
||||||
AllowPaging="true" PageSize="10" PagerHorizontalAlign="HorizontalAlign.Left" ShowPagingSummary="true" PagingSummaryFormat="{0}/{1} 共{2}条数据">
|
CellClick="@((DataGridCellMouseEventArgs<OrderInfo> args) => OnCellClick(args))"
|
||||||
<Columns>
|
AllowPaging="false">
|
||||||
<RadzenDataGridColumn Sortable="false" Filterable="false" Width="2rem">
|
<Columns>
|
||||||
<HeaderTemplate>
|
<RadzenDataGridColumn Sortable="false" Filterable="false" Width="2rem">
|
||||||
<RadzenCheckBox TabIndex="-1" TriState="false" TValue="bool?" InputAttributes="@(new Dictionary<string, object>() { { "aria-label", "Select all items" } })"
|
@* <HeaderTemplate>
|
||||||
Value="@(selectedOrderInfos == null || selectedOrderInfos?.Any() != true ? false : !orderInfos.All(i => selectedOrderInfos.Contains(i)) ? null : orderInfos.Any(i => selectedOrderInfos.Contains(i)))"
|
<RadzenCheckBox TabIndex="-1" TriState="false" TValue="bool?" InputAttributes="@(new Dictionary<string, object>() { { "aria-label", "Select all items" } })"
|
||||||
Change="@(args => selectedOrderInfos = args == true ? orderInfos.ToList() : null)" />
|
Value="@(selectedOrderInfos == null || selectedOrderInfos?.Any() != true ? false : !orderInfos.All(i => selectedOrderInfos.Contains(i)) ? null : orderInfos.Any(i => selectedOrderInfos.Contains(i)))"
|
||||||
</HeaderTemplate>
|
Change="@(args => OnCheckSeleced(args))" />
|
||||||
<Template Context="data">
|
</HeaderTemplate> *@
|
||||||
<RadzenCheckBox TabIndex="-1" TriState="false" Value="@(selectedOrderInfos != null && selectedOrderInfos.Contains(data))" InputAttributes="@(new Dictionary<string, object>() { { "aria-label", "Select item" } })"
|
<Template Context="data">
|
||||||
TValue="bool" Change="@(args => { if (!allowRowSelectOnRowClick) { grid.SelectRow(data); } })" />
|
<RadzenCheckBox TabIndex="-1" TriState="false" Value="@data.ItemIsChecked" InputAttributes="@(new Dictionary<string, object>() { { "aria-label", "Select item" } })"
|
||||||
</Template>
|
TValue="bool" Change="@(args => { if (!allowRowSelectOnRowClick) { grid.SelectRow(data); } })" />
|
||||||
</RadzenDataGridColumn>
|
</Template>
|
||||||
<RadzenDataGridColumn Property="PatientName" Title="姓名" Sortable="false" Filterable="false" Width="3rem" />
|
</RadzenDataGridColumn>
|
||||||
<RadzenDataGridColumn Property="Sex" Title="性别" Sortable="false" Filterable="false" Width="2rem" />
|
<RadzenDataGridColumn Property="anaesthetistName" Title="麻醉医师" Sortable="false" Filterable="false" Width="50px" />
|
||||||
<RadzenDataGridColumn Property="OrderNo" Title="单号" Sortable="false" Filterable="false" Width="3rem" />
|
<RadzenDataGridColumn Property="PatientName" Title="姓名" Sortable="false" Filterable="false" Width="50px" />
|
||||||
<RadzenDataGridColumn Property="ChargeDate" Title="处方时间" Sortable="false" Filterable="false" Width="5rem" />
|
<RadzenDataGridColumn Property="Sex" Title="性别" Sortable="false" Filterable="false" Width="30px" />
|
||||||
<RadzenDataGridColumn Property="DetailInfo.Drug.DrugName" Title="药品名称" FormatString="{0:d}" Sortable="false" Filterable="false" Width="8rem" />
|
<RadzenDataGridColumn Property="OrderNo" Title="单号" Sortable="false" Filterable="false" Width="70px" />
|
||||||
@* <Template Context="DetailInfo">
|
<RadzenDataGridColumn Property="ChargeDate" Title="处方时间" Sortable="false" Filterable="false" Width="80px" />
|
||||||
|
<RadzenDataGridColumn Property="DetailInfo.Drug.DrugName" Title="药品名称" FormatString="{0:d}" Sortable="false" Filterable="false" Width="80px" />
|
||||||
|
@* <Template Context="DetailInfo">
|
||||||
@for (int i = 0; i < DetailList.DetailList.Count; i++)
|
@for (int i = 0; i < DetailList.DetailList.Count; i++)
|
||||||
{
|
{
|
||||||
OrderDetail orderDetail = DetailList.DetailList[i]; *@
|
OrderDetail orderDetail = DetailList.DetailList[i]; *@
|
||||||
@* <RadzenText TextStyle="TextStyle.Subtitle2" class="rz-mb-0">@DetailInfo.Drug.DrugName</RadzenText>
|
@* <RadzenText TextStyle="TextStyle.Subtitle2" class="rz-mb-0">@DetailInfo.Drug.DrugName</RadzenText>
|
||||||
}
|
}
|
||||||
</Template>
|
</Template>
|
||||||
</RadzenDataGridColumn>*@
|
</RadzenDataGridColumn>*@
|
||||||
@* <RadzenDataGridColumn Property="Detail.SetManuNo" Title="药品批次" Sortable="false" Filterable="false" Width="8rem">
|
@* <RadzenDataGridColumn Property="Detail.SetManuNo" Title="药品批次" Sortable="false" Filterable="false" Width="8rem">
|
||||||
<Template Context="DetailList">
|
<Template Context="DetailList">
|
||||||
@for (int i = 0; i < DetailList.DetailList.Count; i++)
|
@for (int i = 0; i < DetailList.DetailList.Count; i++)
|
||||||
{
|
{
|
||||||
|
|
@ -186,8 +207,8 @@
|
||||||
}
|
}
|
||||||
</Template>
|
</Template>
|
||||||
</RadzenDataGridColumn> *@
|
</RadzenDataGridColumn> *@
|
||||||
<RadzenDataGridColumn Title="批次" Property="DetailInfo.SetManuNo" Filterable="false" Width="4rem">
|
<RadzenDataGridColumn Title="批次" Property="DetailInfo.SetManuNo" Filterable="false" Width="100px">
|
||||||
@* <Template Context="DetailInfo">
|
@* <Template Context="DetailInfo">
|
||||||
<RadzenText TextStyle="TextStyle.Subtitle2" class="mb-0">@DetailInfo.DetailInfo.SetManuNo</RadzenText>
|
<RadzenText TextStyle="TextStyle.Subtitle2" class="mb-0">@DetailInfo.DetailInfo.SetManuNo</RadzenText>
|
||||||
|
|
||||||
@if (DetailInfo.DetailInfo.SetManuNo != null )
|
@if (DetailInfo.DetailInfo.SetManuNo != null )
|
||||||
|
|
@ -197,23 +218,9 @@
|
||||||
</RadzenText>
|
</RadzenText>
|
||||||
}
|
}
|
||||||
</Template> *@
|
</Template> *@
|
||||||
<EditTemplate Context="DetailInfo">
|
<EditTemplate Context="DetailInfo">
|
||||||
<RadzenDropDown TValue="DrugManuNo" Name="ManuNo" @bind-Value="DetailInfo.DetailInfo.drugManuNo" Data="DetailInfo.DetailInfo.Drug.Manus" Style="width:100%; display: block;">
|
<RadzenDropDown TValue="DrugManuNo" Name="ManuNo" @bind-Value="DetailInfo.DetailInfo.drugManuNo" Data="DetailInfo.DetailInfo.Drug.Manus" Style="width:100%; display: block;">
|
||||||
<Template>
|
<Template>
|
||||||
<RadzenText TextStyle="TextStyle.Subtitle2" class="mb-0">@((context as DrugManuNo)?.ManuNo)</RadzenText>
|
|
||||||
@if ((context as DrugManuNo).EffDate != null && (context as DrugManuNo).EffDate.ToString().Length > 10)
|
|
||||||
{
|
|
||||||
|
|
||||||
<RadzenText TextStyle="TextStyle.Caption">@((context as DrugManuNo).EffDate.ToString().Substring(0, 10))</RadzenText>
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
|
|
||||||
<RadzenText TextStyle="TextStyle.Caption">@((context as DrugManuNo)?.EffDate)</RadzenText>
|
|
||||||
}
|
|
||||||
</Template>
|
|
||||||
<ValueTemplate>
|
|
||||||
<RadzenStack Orientation="Orientation.Horizontal">
|
|
||||||
<RadzenText TextStyle="TextStyle.Subtitle2" class="mb-0">@((context as DrugManuNo)?.ManuNo)</RadzenText>
|
<RadzenText TextStyle="TextStyle.Subtitle2" class="mb-0">@((context as DrugManuNo)?.ManuNo)</RadzenText>
|
||||||
@if ((context as DrugManuNo).EffDate != null && (context as DrugManuNo).EffDate.ToString().Length > 10)
|
@if ((context as DrugManuNo).EffDate != null && (context as DrugManuNo).EffDate.ToString().Length > 10)
|
||||||
{
|
{
|
||||||
|
|
@ -225,23 +232,36 @@
|
||||||
|
|
||||||
<RadzenText TextStyle="TextStyle.Caption">@((context as DrugManuNo)?.EffDate)</RadzenText>
|
<RadzenText TextStyle="TextStyle.Caption">@((context as DrugManuNo)?.EffDate)</RadzenText>
|
||||||
}
|
}
|
||||||
</RadzenStack>
|
</Template>
|
||||||
</ValueTemplate>
|
<ValueTemplate>
|
||||||
</RadzenDropDown>
|
<RadzenStack Orientation="Orientation.Horizontal">
|
||||||
<RadzenRequiredValidator Text="请选择批次" Component="ManuNo" Popup="true" />
|
<RadzenText TextStyle="TextStyle.Subtitle2" class="mb-0">@((context as DrugManuNo)?.ManuNo)</RadzenText>
|
||||||
</EditTemplate>
|
@if ((context as DrugManuNo).EffDate != null && (context as DrugManuNo).EffDate.ToString().Length > 10)
|
||||||
</RadzenDataGridColumn>
|
{
|
||||||
<RadzenDataGridColumn Property="DetailInfo.Quantity" Title="数量" Sortable="false" Filterable="false" Width="2rem" />
|
|
||||||
@* <Template Context="DetailInfo">
|
<RadzenText TextStyle="TextStyle.Caption">@((context as DrugManuNo).EffDate.ToString().Substring(0, 10))</RadzenText>
|
||||||
@for (int i = 0; i < DetailList.DetailList.Count; i++)
|
}
|
||||||
{
|
else
|
||||||
OrderDetail orderDetail = DetailList.DetailList[i];
|
{
|
||||||
<RadzenText TextStyle="TextStyle.Subtitle2" class="rz-mb-0">@orderDetail.Quantity</RadzenText>
|
|
||||||
}
|
<RadzenText TextStyle="TextStyle.Caption">@((context as DrugManuNo)?.EffDate)</RadzenText>
|
||||||
</Template>
|
}
|
||||||
</RadzenDataGridColumn> *@
|
</RadzenStack>
|
||||||
</Columns>
|
</ValueTemplate>
|
||||||
</RadzenDataGrid>
|
</RadzenDropDown>
|
||||||
|
<RadzenRequiredValidator Text="请选择批次" Component="ManuNo" Popup="true" />
|
||||||
|
</EditTemplate>
|
||||||
|
</RadzenDataGridColumn>
|
||||||
|
<RadzenDataGridColumn Property="DetailInfo.Quantity" Title="数量" Filterable="false" Width="50px">
|
||||||
|
<EditTemplate Context="DetailInfo">
|
||||||
|
<RadzenNumeric Min="0" Style="display: block" Name="Quantity" @bind-Value=@DetailInfo.DetailInfo.Quantity />
|
||||||
|
<RadzenNumericRangeValidator Style="position: absolute;z-index: 9999;" Min="0" Text="请填写正确的添加数量" Component="Quantity" Popup="true" />
|
||||||
|
</EditTemplate>
|
||||||
|
</RadzenDataGridColumn>
|
||||||
|
<RadzenDataGridColumn Property="DetailInfo.TotalQuantity" Title="合计" Filterable="false" Width="50px" />
|
||||||
|
</Columns>
|
||||||
|
</RadzenDataGrid>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</RadzenStack>
|
</RadzenStack>
|
||||||
@code {
|
@code {
|
||||||
|
|
@ -259,19 +279,32 @@
|
||||||
RadzenDataGrid<OrderInfo> grid;
|
RadzenDataGrid<OrderInfo> grid;
|
||||||
//麻醉师集合
|
//麻醉师集合
|
||||||
List<Anaesthetist> NamesList = new List<Anaesthetist>();
|
List<Anaesthetist> NamesList = new List<Anaesthetist>();
|
||||||
Anaesthetist Name;
|
Anaesthetist NameInfo;
|
||||||
//麻醉师集合
|
Anaesthetist BoxColor;
|
||||||
|
//药盒集合
|
||||||
List<BoxModel> BoxList = new List<BoxModel>();
|
List<BoxModel> BoxList = new List<BoxModel>();
|
||||||
|
//药盒颜色集合
|
||||||
|
List<Anaesthetist> BoxColorList = new List<Anaesthetist>();
|
||||||
BoxModel BoxNum;
|
BoxModel BoxNum;
|
||||||
bool isLoading;
|
bool isLoading;
|
||||||
int count;
|
int count;
|
||||||
int[] DrawerNos = new int[] { 1, 2, 3, 4, 5, 6, 7, 8 };
|
int[] DrawerNos = new int[] { 1, 2, 3, 4, 5, 6, 7, 8 };
|
||||||
int status = 0;
|
int status = 0;
|
||||||
string OrderNo;
|
string OrderNo;
|
||||||
|
string PatientName;
|
||||||
DateTime? OrderDate = null;
|
DateTime? OrderDate = null;
|
||||||
DateTime PortOrderDate = DateTime.Now;
|
DateTime PortOrderDate = DateTime.Now;
|
||||||
Popup popup;
|
Popup popup;
|
||||||
RadzenButton button;
|
RadzenButton button;
|
||||||
|
//第一次加载不执行LoadData方法
|
||||||
|
int firstLod = 1;
|
||||||
|
void OnCheckSeleced(object dete)
|
||||||
|
{
|
||||||
|
if (orderInfos != null)
|
||||||
|
{
|
||||||
|
orderInfos.ToList().ForEach(it => it.ItemIsChecked = true);
|
||||||
|
}
|
||||||
|
}
|
||||||
void OnCurrentDateChanged(DateTime args)
|
void OnCurrentDateChanged(DateTime args)
|
||||||
{
|
{
|
||||||
OrderDate = new DateTime(args.Year, args.Month, args.Day);
|
OrderDate = new DateTime(args.Year, args.Month, args.Day);
|
||||||
|
|
@ -280,11 +313,22 @@
|
||||||
{
|
{
|
||||||
PortOrderDate = new DateTime(args.Year, args.Month, args.Day);
|
PortOrderDate = new DateTime(args.Year, args.Month, args.Day);
|
||||||
}
|
}
|
||||||
|
// async Task OnColorChange(object value)
|
||||||
|
// {
|
||||||
|
// Anaesthetist v = value as Anaesthetist;
|
||||||
|
// if (v.Id != BoxColor.Id)
|
||||||
|
// {
|
||||||
|
// BoxList = await orderInfoDao.GetOperationNum(BoxColor.Id);// await orderInfoDao.GetDrawerNumByOperationNum(setting.Value.boxMachineId, roomNameList); //roomNameList.Select(it => new BoxModel { BoxName = it, BoxNo = Convert.ToInt32(it.Substring(it.Length - 2, 2)) }).ToList();
|
||||||
|
|
||||||
|
// BoxNum = BoxList.FirstOrDefault();
|
||||||
|
// }
|
||||||
|
// }
|
||||||
//重置
|
//重置
|
||||||
async Task reloadGrid()
|
async Task reloadGrid()
|
||||||
{
|
{
|
||||||
OrderNo = "";
|
OrderNo = "";
|
||||||
OrderDate = DateTime.MinValue;
|
OrderDate = DateTime.MinValue;
|
||||||
|
firstLod = 1;
|
||||||
await grid.Reload();
|
await grid.Reload();
|
||||||
}
|
}
|
||||||
void OnCellClick(DataGridCellMouseEventArgs<OrderInfo> args)
|
void OnCellClick(DataGridCellMouseEventArgs<OrderInfo> args)
|
||||||
|
|
@ -297,6 +341,7 @@
|
||||||
{
|
{
|
||||||
args.Data.DetailInfo.drugManuNo = args.Data.DetailInfo.Drug.Manus.FirstOrDefault();
|
args.Data.DetailInfo.drugManuNo = args.Data.DetailInfo.Drug.Manus.FirstOrDefault();
|
||||||
}
|
}
|
||||||
|
args.Data.ItemIsChecked = !args.Data.ItemIsChecked;
|
||||||
grid.EditRow(args.Data);
|
grid.EditRow(args.Data);
|
||||||
}
|
}
|
||||||
//确认
|
//确认
|
||||||
|
|
@ -316,20 +361,30 @@
|
||||||
);
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (selectedOrderInfos.Any(it => it.DetailInfo.drugManuNo == null))
|
if (selectedOrderInfos.Any(it => it.DetailInfo.drugManuNo == null && (string.IsNullOrEmpty(it.DetailInfo.SetManuNo))))
|
||||||
{
|
{
|
||||||
_message.Notify(
|
_message.Notify(
|
||||||
new NotificationMessage { Severity = NotificationSeverity.Error, Summary = "提示", Detail = $"请选择批次信息", Duration = 4000 }
|
new NotificationMessage { Severity = NotificationSeverity.Error, Summary = "提示", Detail = $"请选择批次信息", Duration = 4000 }
|
||||||
);
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
selectedOrderInfos.Where(oi => oi.DetailInfo.drugManuNo != null && !string.IsNullOrEmpty(oi.DetailInfo.drugManuNo.ManuNo)).ToList().ForEach(oi => oi.DetailInfo.SetManuNo = oi.DetailInfo.drugManuNo.ManuNo);
|
||||||
|
selectedOrderInfos.Where(oi => !string.IsNullOrEmpty(oi.DetailInfo.SetManuNo)).ToList().ForEach(oi => oi.DetailInfo.drugManuNo = new() { ManuNo = oi.DetailInfo.SetManuNo });
|
||||||
|
//弹出药品合计信息,确认无误后进行核对,取消则不核对
|
||||||
|
//弹出确认提示框
|
||||||
|
// var b = await dialogService.OpenAsync<CheckOrderConfirmDialog>(
|
||||||
|
// $"核对确认",
|
||||||
|
// new Dictionary<string, object>() { { "selectedOrderInfos", selectedOrderInfos } },
|
||||||
|
// new DialogOptions() { Width = "80vw", Resizable = true, Draggable = true, ShowClose = false });
|
||||||
|
// if (b)
|
||||||
|
// {
|
||||||
bool bResult = await orderInfoDao.CheckOrderInfo(selectedOrderInfos, BoxNum);
|
bool bResult = await orderInfoDao.CheckOrderInfo(selectedOrderInfos, BoxNum);
|
||||||
if (bResult)
|
if (bResult)
|
||||||
{
|
{
|
||||||
_message.Notify(
|
_message.Notify(
|
||||||
new NotificationMessage { Severity = NotificationSeverity.Success, Summary = "提示", Detail = $"处方已核对完成", Duration = 4000 }
|
new NotificationMessage { Severity = NotificationSeverity.Success, Summary = "提示", Detail = $"处方已核对完成", Duration = 4000 }
|
||||||
);
|
);
|
||||||
await GetInitialDate();
|
//await GetInitialDate();
|
||||||
await grid.Reload();
|
await grid.Reload();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
@ -338,95 +393,102 @@
|
||||||
new NotificationMessage { Severity = NotificationSeverity.Error, Summary = "提示", Detail = $"处方已核对失败", Duration = 4000 }
|
new NotificationMessage { Severity = NotificationSeverity.Error, Summary = "提示", Detail = $"处方已核对失败", Duration = 4000 }
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
PageData<OrderInfo> result;
|
PageData<OrderInfo> result;
|
||||||
protected override async Task OnInitializedAsync()
|
protected override async Task OnInitializedAsync()
|
||||||
{
|
{
|
||||||
await GetInitialDate();
|
BoxColorList = setting.Value.boxColor.Split(',').Select(it => new Anaesthetist { Name = it,Id=it=="白"?1:2 }).ToList();
|
||||||
await base.OnInitializedAsync();
|
BoxColor = BoxColorList.FirstOrDefault();
|
||||||
}
|
NamesList = setting.Value.anaesthetist_name.Split(',').Select(it => new Anaesthetist { Name = it }).ToList();
|
||||||
async Task GetInitialDate()
|
NameInfo = NamesList.FirstOrDefault();
|
||||||
{
|
BoxList = await orderInfoDao.GetOperationNum(0);// await orderInfoDao.GetDrawerNumByOperationNum(setting.Value.boxMachineId, roomNameList); //roomNameList.Select(it => new BoxModel { BoxName = it, BoxNo = Convert.ToInt32(it.Substring(it.Length - 2, 2)) }).ToList();
|
||||||
|
|
||||||
// List<string> nameList = result.Desserts.Select(it => it.anaesthetistName).Distinct().ToList();
|
|
||||||
NamesList = await orderInfoDao.GetAnaesthetistName();// nameList.Select(it => new Anaesthetist { Name = it }).ToList();
|
|
||||||
Name = NamesList.FirstOrDefault();
|
|
||||||
|
|
||||||
// List<int> roomNameList = await orderInfoDao.Select(it => Convert.ToInt32(it.RoomName.Substring(6, it.RoomName.Length - 6))).Distinct().ToList();
|
|
||||||
BoxList = await orderInfoDao.GetOperationNum(Name.Name);// await orderInfoDao.GetDrawerNumByOperationNum(setting.Value.boxMachineId, roomNameList); //roomNameList.Select(it => new BoxModel { BoxName = it, BoxNo = Convert.ToInt32(it.Substring(it.Length - 2, 2)) }).ToList();
|
|
||||||
|
|
||||||
BoxNum = BoxList.FirstOrDefault();
|
BoxNum = BoxList.FirstOrDefault();
|
||||||
|
|
||||||
result = await orderInfoDao.GetAllOrderInfo(Name.Name, null, null, null, null);
|
//await GetInitialDate();
|
||||||
|
await base.OnInitializedAsync();
|
||||||
}
|
}
|
||||||
async Task LoadData(LoadDataArgs args)
|
async Task LoadData(LoadDataArgs args)
|
||||||
{
|
{
|
||||||
logger.Info($"LoadData开始:{DateTime.Now}-{result != null}");
|
if (firstLod == 1)
|
||||||
if (result != null)
|
|
||||||
{
|
{
|
||||||
isLoading = true;
|
|
||||||
orderInfos = result.Desserts;
|
|
||||||
// Update the count
|
|
||||||
count = result.TotalDesserts;
|
|
||||||
logger.Info($"LoadData:{DateTime.Now},{orderInfos.Count()}");
|
|
||||||
// Update the Data property
|
|
||||||
if (Name != null)
|
|
||||||
{
|
|
||||||
orderInfos = orderInfos.Where(it => it.anaesthetistName == Name.Name);
|
|
||||||
logger.Info($"LoadData:{DateTime.Now},{orderInfos.Count()},Name{Name.Name}");
|
|
||||||
count = orderInfos.Count();
|
|
||||||
}
|
|
||||||
if (OrderDate != null && OrderDate != DateTime.MinValue)
|
|
||||||
{
|
|
||||||
orderInfos = orderInfos.Where(it => it.ChargeDate.Date == OrderDate.Value.Date);
|
|
||||||
|
|
||||||
logger.Info($"LoadData:{DateTime.Now},{orderInfos.Count()}");
|
|
||||||
// Update the count
|
|
||||||
count = orderInfos.Count();
|
|
||||||
}
|
|
||||||
if (!string.IsNullOrEmpty(OrderNo))
|
|
||||||
{
|
|
||||||
orderInfos = orderInfos.Where(it => it.OrderNo.Contains(OrderNo));
|
|
||||||
|
|
||||||
logger.Info($"LoadData:{DateTime.Now},{orderInfos.Count()}-OrderNo{OrderNo}");
|
|
||||||
// Update the count
|
|
||||||
count = orderInfos.Count();
|
|
||||||
}
|
|
||||||
if (Name != null && OrderDate != null && OrderDate != DateTime.MinValue && !string.IsNullOrEmpty(OrderNo))
|
|
||||||
{
|
|
||||||
orderInfos = orderInfos.Where(it => it.anaesthetistName == Name.Name && it.ChargeDate.Date == OrderDate.Value.Date && it.OrderNo.Contains(OrderNo));
|
|
||||||
|
|
||||||
logger.Info($"LoadData:{DateTime.Now},{orderInfos.Count()}");
|
|
||||||
// Update the count
|
|
||||||
count = orderInfos.Count();
|
|
||||||
}
|
|
||||||
if (BoxNum != null&&BoxNum.BoxName!=99&&BoxNum.BoxName!=111)
|
|
||||||
{
|
|
||||||
string roomName = setting.Value.roomName + BoxNum.BoxName.ToString().PadLeft(2, '0');
|
|
||||||
|
|
||||||
orderInfos = orderInfos.Where(it => it.RoomName == roomName);
|
|
||||||
|
|
||||||
logger.Info($"LoadData:{DateTime.Now},{orderInfos.Count()};roomName{roomName}");
|
|
||||||
count = orderInfos.Count();
|
|
||||||
}
|
|
||||||
|
|
||||||
logger.Info($"LoadData结束:{DateTime.Now},{orderInfos.Count()}");
|
|
||||||
|
|
||||||
orderInfos = orderInfos.Skip(args.Skip.Value).Take(args.Top.Value).ToList();
|
|
||||||
|
|
||||||
logger.Info($"LoadData结束:{DateTime.Now},{orderInfos.Count()} -{args.Skip.Value}-{args.Top.Value}");
|
|
||||||
|
|
||||||
await InvokeAsync(StateHasChanged);
|
|
||||||
//查找该麻醉师对应的手术室
|
|
||||||
//List<string> roomNameList = orderInfos.Select(it => it.RoomName).Distinct().ToList();
|
|
||||||
// List<int> roomNameList = orderInfos.Select(it => Convert.ToInt32(it.RoomName.Substring(6, it.RoomName.Length - 6))).Distinct().ToList();
|
|
||||||
// BoxList = await orderInfoDao.GetDrawerNumByOperationNum(setting.Value.boxMachineId, roomNameList); //roomNameList.Select(it => new BoxModel { BoxName = it, BoxNo = Convert.ToInt32(it.Substring(it.Length - 2, 2)) }).ToList();
|
|
||||||
|
|
||||||
// BoxNum = BoxList.FirstOrDefault();
|
|
||||||
|
|
||||||
isLoading = false;
|
|
||||||
|
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
// BoxList=BoxList.Where(bl => bl.BoxNo == BoxColor.Id).ToList();
|
||||||
|
// BoxNum = BoxList.FirstOrDefault();
|
||||||
|
string? anaesthetistName = NameInfo.Name == "未选择" ? null : NameInfo.Name;
|
||||||
|
string? roomName = BoxNum == null ? "" : setting.Value.roomName + BoxNum.BoxName.ToString().PadLeft(2, '0');
|
||||||
|
result = await orderInfoDao.GetAllOrderInfo(anaesthetistName, roomName, PatientName, OrderNo, OrderDate, args.Top, args.Skip);
|
||||||
|
isLoading = true;
|
||||||
|
orderInfos = result.Desserts;
|
||||||
|
count = result.TotalDesserts;
|
||||||
|
// if (result != null)
|
||||||
|
// {
|
||||||
|
// isLoading = true;
|
||||||
|
// orderInfos = result.Desserts;
|
||||||
|
// // Update the count
|
||||||
|
// count = result.TotalDesserts;
|
||||||
|
// logger.Info($"LoadData:{DateTime.Now},{orderInfos.Count()}");
|
||||||
|
// // Update the Data property
|
||||||
|
// if (Name != null)
|
||||||
|
// {
|
||||||
|
// orderInfos = orderInfos.Where(it => it.anaesthetistName == Name.Name);
|
||||||
|
// logger.Info($"LoadData:{DateTime.Now},{orderInfos.Count()},Name{Name.Name}");
|
||||||
|
// count = orderInfos.Count();
|
||||||
|
// }
|
||||||
|
// if (OrderDate != null && OrderDate != DateTime.MinValue)
|
||||||
|
// {
|
||||||
|
// orderInfos = orderInfos.Where(it => it.ChargeDate.Date >= OrderDate.Value.Date);
|
||||||
|
|
||||||
|
// logger.Info($"LoadData:{DateTime.Now},{orderInfos.Count()}");
|
||||||
|
// // Update the count
|
||||||
|
// count = orderInfos.Count();
|
||||||
|
// }
|
||||||
|
// if (!string.IsNullOrEmpty(OrderNo))
|
||||||
|
// {
|
||||||
|
// orderInfos = orderInfos.Where(it => it.OrderNo.Contains(OrderNo));
|
||||||
|
|
||||||
|
// logger.Info($"LoadData:{DateTime.Now},{orderInfos.Count()}-OrderNo{OrderNo}");
|
||||||
|
// // Update the count
|
||||||
|
// count = orderInfos.Count();
|
||||||
|
// }
|
||||||
|
// if (Name != null && OrderDate != null && OrderDate != DateTime.MinValue && !string.IsNullOrEmpty(OrderNo))
|
||||||
|
// {
|
||||||
|
// orderInfos = orderInfos.Where(it => it.anaesthetistName == Name.Name && it.ChargeDate.Date == OrderDate.Value.Date && it.OrderNo.Contains(OrderNo));
|
||||||
|
|
||||||
|
// logger.Info($"LoadData:{DateTime.Now},{orderInfos.Count()}");
|
||||||
|
// // Update the count
|
||||||
|
// count = orderInfos.Count();
|
||||||
|
// }
|
||||||
|
// if (BoxNum != null&&BoxNum.BoxName!=99&&BoxNum.BoxName!=111)
|
||||||
|
// {
|
||||||
|
// string roomName = setting.Value.roomName + BoxNum.BoxName.ToString().PadLeft(2, '0');
|
||||||
|
|
||||||
|
// orderInfos = orderInfos.Where(it => it.RoomName == roomName);
|
||||||
|
|
||||||
|
// logger.Info($"LoadData:{DateTime.Now},{orderInfos.Count()};roomName{roomName}");
|
||||||
|
// count = orderInfos.Count();
|
||||||
|
// }
|
||||||
|
|
||||||
|
// logger.Info($"LoadData结束:{DateTime.Now},{orderInfos.Count()}");
|
||||||
|
|
||||||
|
// orderInfos = orderInfos.Skip(args.Skip.Value).Take(args.Top.Value).ToList();
|
||||||
|
|
||||||
|
// logger.Info($"LoadData结束:{DateTime.Now},{orderInfos.Count()} -{args.Skip.Value}-{args.Top.Value}");
|
||||||
|
|
||||||
|
// await InvokeAsync(StateHasChanged);
|
||||||
|
// //查找该麻醉师对应的手术室
|
||||||
|
// //List<string> roomNameList = orderInfos.Select(it => it.RoomName).Distinct().ToList();
|
||||||
|
// // List<int> roomNameList = orderInfos.Select(it => Convert.ToInt32(it.RoomName.Substring(6, it.RoomName.Length - 6))).Distinct().ToList();
|
||||||
|
// // BoxList = await orderInfoDao.GetDrawerNumByOperationNum(setting.Value.boxMachineId, roomNameList); //roomNameList.Select(it => new BoxModel { BoxName = it, BoxNo = Convert.ToInt32(it.Substring(it.Length - 2, 2)) }).ToList();
|
||||||
|
|
||||||
|
// // BoxNum = BoxList.FirstOrDefault();
|
||||||
|
|
||||||
|
isLoading = false;
|
||||||
|
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
//麻醉药品使用登记本导出
|
//麻醉药品使用登记本导出
|
||||||
async Task StockExport()
|
async Task StockExport()
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,358 @@
|
||||||
|
@using MasaBlazorApp3.Pojo.Config
|
||||||
|
@using MasaBlazorApp3.Util
|
||||||
|
@using MasaBlazorApp3.Pojo.Vo;
|
||||||
|
@using Microsoft.Extensions.Options
|
||||||
|
@using log4net;
|
||||||
|
|
||||||
|
<RadzenStack>
|
||||||
|
|
||||||
|
<div Style="width:100%;height:70vh;overflow:auto">
|
||||||
|
|
||||||
|
@* <RadzenListBox AllowClear="true" @bind-Value=@listBoxSelectedcsList Style="width:50vw;overflow:auto" AllowFiltering="false"
|
||||||
|
Data=@csList>
|
||||||
|
<Template Context="contextDate">
|
||||||
|
<RadzenStack Orientation="Orientation.Horizontal">
|
||||||
|
<RadzenText Style="width:20vw;text-align:left">@contextDate.Drug.DrugName</RadzenText>
|
||||||
|
<RadzenText Style="width:10vw">@contextDate.ManuNo</RadzenText>
|
||||||
|
<RadzenStack Gap="10" Style="text-align:right">
|
||||||
|
<div style="text-align: center;">
|
||||||
|
@if (contextDate.ReturnDrawerChanneStock != null && contextDate.ReturnDrawerChanneStock.ReturnQuantity>0)
|
||||||
|
{
|
||||||
|
<div style="text-align: center;">
|
||||||
|
还药库位【@contextDate.ReturnDrawerChanneStock?.DrawerNo】还药数【contextDate.ReturnDrawerChanneStock?.ReturnQuantity】< br />
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
@if (contextDate.OrderList.fore > 0)
|
||||||
|
{
|
||||||
|
<div style="text-align: center;">
|
||||||
|
空瓶库位【@contextDate.EmptyStock】空瓶数【@contextDate.EmptyQuantity】< br />
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
</RadzenStack>
|
||||||
|
<RadzenStack Gap="10" Style="text-align:right">
|
||||||
|
<div style="text-align: center;">
|
||||||
|
基数【@contextDate.BaseQuantity】<br />
|
||||||
|
库存数【@contextDate.Quantity】<br />
|
||||||
|
用药数【@contextDate.UseQuantity】<br />
|
||||||
|
处方数【@contextDate.OrderQuantity】<br />
|
||||||
|
空瓶数【@contextDate.EmptyQuantity】<br />
|
||||||
|
</div>
|
||||||
|
</RadzenStack>
|
||||||
|
</RadzenStack>
|
||||||
|
</Template>
|
||||||
|
</RadzenListBox> *@
|
||||||
|
|
||||||
|
<RadzenListBox AllowClear="true" @bind-Value=@listBoxSelectedcsList Style="width:100%;overflow:auto" AllowFiltering="false" TValue="ChannelStock"
|
||||||
|
Data=@csList>
|
||||||
|
<Template>
|
||||||
|
<RadzenStack Orientation="Orientation.Horizontal">
|
||||||
|
<RadzenText Style="width:20vw;text-align:left">@((context as ChannelStock).Drug.ToString())</RadzenText>
|
||||||
|
<RadzenText Style="width:10vw">@((context as ChannelStock).ManuNo)</RadzenText>
|
||||||
|
<RadzenStack Gap="10" Style="text-align:right">
|
||||||
|
<div style="text-align: center;">
|
||||||
|
@if (((context as ChannelStock).DrawerChanneStockList) != null && ((context as ChannelStock).DrawerChanneStockList.Count) > 0)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < (context as ChannelStock).DrawerChanneStockList.Count; i++)
|
||||||
|
{
|
||||||
|
<div style="text-align: center;">
|
||||||
|
还药品库位【@((context as ChannelStock).DrawerChanneStockList[i].Location)】还药数【@((context as ChannelStock).DrawerChanneStockList[i].ReturnQuantity)】
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@if ((context as ChannelStock).EmptyQuantity > 0)
|
||||||
|
{
|
||||||
|
<div style="text-align: center;">
|
||||||
|
还空瓶库位【@((context as ChannelStock).EmptyStock.Location)】空瓶数【@((context as ChannelStock).EmptyStock.ReturnQuantity)】
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
</RadzenStack>
|
||||||
|
<RadzenStack Gap="10" Style="text-align:right">
|
||||||
|
<div style="text-align: center;">
|
||||||
|
基数【@((context as ChannelStock).BaseQuantity)】<br />
|
||||||
|
@* 总库存【@((context as ChannelStock).TotalQuantity)】<br /> *@
|
||||||
|
库存数【@((context as ChannelStock).Quantity)】<br />
|
||||||
|
用药数【@((context as ChannelStock).UseQuantity)】<br />
|
||||||
|
处方数【@((context as ChannelStock).OrderQuantity)】<br />
|
||||||
|
空瓶数【@((context as ChannelStock).EmptyQuantity)】<br />
|
||||||
|
</div>
|
||||||
|
</RadzenStack>
|
||||||
|
</RadzenStack>
|
||||||
|
</Template>
|
||||||
|
</RadzenListBox>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<RadzenStack Orientation="Orientation.Horizontal" JustifyContent="JustifyContent.Center" Gap="0.5rem">
|
||||||
|
@* <RadzenButton Click="@ConfirmOK" ButtonStyle="ButtonStyle.Success" Variant="Variant.Flat" Text="归还" Style="width: 120px" />
|
||||||
|
|
||||||
|
<RadzenButton Click="@((args) => dialogService.Close(false))" Variant="Variant.Flat" Text="取消" Style="width: 120px" /> *@
|
||||||
|
@if (status < 2)
|
||||||
|
{
|
||||||
|
<RadzenButton Click="@OpenDrawer" IsBusy="status > 0" BusyText="归还中。。。" ButtonStyle="ButtonStyle.Warning" Variant="Variant.Flat" Text="归还" Style="width: 120px" />
|
||||||
|
}
|
||||||
|
@if (status == 2)
|
||||||
|
{
|
||||||
|
<RadzenButton Click="@TakeFinish" ButtonStyle="ButtonStyle.Success" Variant="Variant.Flat" Text="完成" Style="width: 120px" />
|
||||||
|
}
|
||||||
|
@if (status <= 2)
|
||||||
|
{
|
||||||
|
<RadzenButton Click="@Cancel" Variant="Variant.Flat" Text="取消" Style="width: 120px" />
|
||||||
|
}
|
||||||
|
|
||||||
|
</RadzenStack>
|
||||||
|
</RadzenStack>
|
||||||
|
|
||||||
|
@code {
|
||||||
|
@inject Radzen.DialogService dialogService;
|
||||||
|
@inject IOptions<DrawerConfig> setting;
|
||||||
|
@inject PortUtil PortUtil;
|
||||||
|
@inject NotificationService _message;
|
||||||
|
@inject IOrderInfoDao orderInfoDao;
|
||||||
|
[Parameter] public IList<ChannelStock> csList { get; set; }
|
||||||
|
List<OrderDetail> orderDetailList = new();
|
||||||
|
ChannelStock listBoxSelectedcsList = new();
|
||||||
|
private readonly ILog logger = LogManager.GetLogger(typeof(OrderDetailDialog));
|
||||||
|
int status;
|
||||||
|
|
||||||
|
List<OrderTakeVo> data = new();
|
||||||
|
//计数取药数量
|
||||||
|
int[] WeightFinnalQuantity { get; set; } = new int[] { 0, 0, 0, 0, 0, 0, 0, 0, 0 };
|
||||||
|
// //取药数量小于库存
|
||||||
|
// tempData.Add(new OrderTakeVo()
|
||||||
|
// {
|
||||||
|
// Drug = detail.Drug,
|
||||||
|
// OrderDetail = detail,
|
||||||
|
// ChannelStock = stock,
|
||||||
|
// StockQuantity = total,
|
||||||
|
// Quantity = Quantity,
|
||||||
|
// });
|
||||||
|
protected override async Task OnInitializedAsync()
|
||||||
|
{
|
||||||
|
for (int i = 0; i < csList.Count; i++)
|
||||||
|
{
|
||||||
|
if (csList[i].EmptyStock != null && csList[i].EmptyStock.ReturnQuantity > 0)
|
||||||
|
{
|
||||||
|
data.Add(new OrderTakeVo()
|
||||||
|
{
|
||||||
|
ChannelStock = csList[i].EmptyStock
|
||||||
|
});
|
||||||
|
}
|
||||||
|
if (csList[i].DrawerChanneStockList != null && csList[i].DrawerChanneStockList.Count > 0)
|
||||||
|
{
|
||||||
|
for (int j = 0; j < csList[i].DrawerChanneStockList.Count; j++)
|
||||||
|
{
|
||||||
|
data.Add(new OrderTakeVo()
|
||||||
|
{
|
||||||
|
ChannelStock = csList[i].DrawerChanneStockList[j]
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
base.OnInitializedAsync();
|
||||||
|
}
|
||||||
|
// async Task ConfirmOK()
|
||||||
|
// {
|
||||||
|
// // 关闭弹窗
|
||||||
|
// dialogService.Close(true);
|
||||||
|
// }
|
||||||
|
async Task OpenDrawer()
|
||||||
|
{
|
||||||
|
this.status = 1;
|
||||||
|
PortUtil.PowerOn();
|
||||||
|
await Task.Delay(200);
|
||||||
|
// 解析需要打开的抽屉列表
|
||||||
|
List<OrderTakeVo> drawerNos = this.data.GroupBy(it => it.ChannelStock.DrawerNo).Select(it => it.First()).ToList();
|
||||||
|
|
||||||
|
// 根据抽屉类型来决定打开前是否需要查询数量
|
||||||
|
var promiseUtil = new PromiseUtil<int>();
|
||||||
|
|
||||||
|
await promiseUtil.taskAsyncLoop(500, 0, async (options, next, stop) =>
|
||||||
|
{
|
||||||
|
var orderTakeVo = drawerNos[options._data];
|
||||||
|
var drawerNo = orderTakeVo.ChannelStock.DrawerNo;
|
||||||
|
var drawerType = orderTakeVo.ChannelStock.DrawerType;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (this.status == 0)
|
||||||
|
{
|
||||||
|
stop();
|
||||||
|
}
|
||||||
|
// 开启抽屉
|
||||||
|
else if (this.status == 1)
|
||||||
|
{
|
||||||
|
if (orderTakeVo.Status == 0)
|
||||||
|
{
|
||||||
|
// 判断是否为单支抽屉
|
||||||
|
if (setting.Value.single.Contains(drawerNo))
|
||||||
|
{
|
||||||
|
byte[] quantity = await PortUtil.CheckQuantityByDrawer(drawerNo);
|
||||||
|
orderTakeVo.BeforeQuantity = quantity.Select(it => Convert.ToInt32(it)).ToArray().Skip(3).Take(9).ToArray();
|
||||||
|
logger.Info($"单支抽屉,开抽屉前检测数量【{string.Join(",", orderTakeVo.BeforeQuantity)}】");
|
||||||
|
|
||||||
|
await PortUtil.HasLightOnByCol(drawerNo, data.Where(ot => ot.ChannelStock.DrawerNo == drawerNo).Select(ot => ot.ChannelStock.ColNo).ToArray());
|
||||||
|
}
|
||||||
|
var b = await PortUtil.OpenDrawerStatus(drawerNo);
|
||||||
|
if (b)
|
||||||
|
{
|
||||||
|
PortUtil.speechSynthesizer.SpeakAsyncCancelAll();
|
||||||
|
if (drawerType==1)
|
||||||
|
{
|
||||||
|
PortUtil.SpeakAsync($"{drawerNo}号抽屉已经打开,请,环药");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
PortUtil.SpeakAsync($"{drawerNo}号抽屉已经打开,请,环空瓶");
|
||||||
|
}
|
||||||
|
orderTakeVo.Status = 1;
|
||||||
|
next();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_message.Notify(
|
||||||
|
new NotificationMessage { Severity = NotificationSeverity.Error, Summary = "提示", Detail = $"抽屉【{drawerNo}】打开失败,请检测硬件", Duration = 4000 }
|
||||||
|
);
|
||||||
|
logger.Info($"抽屉打开失败");
|
||||||
|
PortUtil.PowerOff();
|
||||||
|
RestData();
|
||||||
|
stop();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 检测状态
|
||||||
|
else if (orderTakeVo.Status == 1)
|
||||||
|
{
|
||||||
|
// 查询抽屉是否为关闭状态
|
||||||
|
var b = await PortUtil.CheckDrawerStatus2(drawerNo);
|
||||||
|
// 关闭则改变状态并终止循环
|
||||||
|
if (b)
|
||||||
|
{
|
||||||
|
|
||||||
|
data.ForEach(cl =>
|
||||||
|
{
|
||||||
|
if (cl.ChannelStock.DrawerNo == drawerNo)
|
||||||
|
{
|
||||||
|
cl.GetQuantity = cl.Quantity;
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
orderTakeVo.Status = 2;
|
||||||
|
PortUtil.PowerOff();
|
||||||
|
if (options._data == drawerNos.Count - 1)
|
||||||
|
{
|
||||||
|
PortUtil.speechSynthesizer.SpeakAsyncCancelAll();
|
||||||
|
PortUtil.SpeakAsync($"抽屉关闭,请,点击完成按钮进行确认");
|
||||||
|
this.status = 2;
|
||||||
|
string alertMessage = string.Empty;
|
||||||
|
//检查是否称重抽屉,核对实际取出数量是否与应取数量一致,不一致则弹出提示
|
||||||
|
for (int i = 0; i < data.Count; i++)
|
||||||
|
{
|
||||||
|
|
||||||
|
if (data[i].ChannelStock.BoardType.ToString().Contains("2"))
|
||||||
|
{
|
||||||
|
byte[] quantity = await PortUtil.CheckQuantityByDrawer(drawerNo);
|
||||||
|
orderTakeVo.AfterQuantity = quantity.Select(it => Convert.ToInt32(it)).ToArray().Skip(3).Take(9).ToArray();
|
||||||
|
logger.Info($"单支抽屉,关抽屉后检测数量【{string.Join(",", orderTakeVo.AfterQuantity)}】");
|
||||||
|
WeightFinnalQuantity[data[i].ChannelStock.ColNo - 1] = orderTakeVo.BeforeQuantity[data[i].ChannelStock.ColNo - 1] - orderTakeVo.AfterQuantity[data[i].ChannelStock.ColNo - 1];
|
||||||
|
if (data[i].Quantity != WeightFinnalQuantity[data[i].ChannelStock.ColNo - 1])
|
||||||
|
{
|
||||||
|
alertMessage += $"{data[i].Drug.DrugName}应取数量【{orderTakeVo.Quantity}】,实际取出数量【{WeightFinnalQuantity[data[i].ChannelStock.ColNo - 1]}】";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!string.IsNullOrEmpty(alertMessage))
|
||||||
|
{
|
||||||
|
//弹出确认对话框
|
||||||
|
alertMessage += "应取数与实际取出数不一致确认要保存吗?";
|
||||||
|
//弹出确认提示框
|
||||||
|
var confirm = await dialogService.OpenAsync<ConfirmDialog>(
|
||||||
|
$"保存确认",
|
||||||
|
new Dictionary<string, object>() { { "confirmInfo", alertMessage } },
|
||||||
|
new DialogOptions() { Width = "45vw", Resizable = true, Draggable = true, ShowClose = false });
|
||||||
|
logger.Info(alertMessage);
|
||||||
|
if (!confirm)
|
||||||
|
{
|
||||||
|
RestData();
|
||||||
|
logger.Info("取消保存");
|
||||||
|
// 关闭弹窗
|
||||||
|
dialogService.Close(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
stop();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
options._data += 1;
|
||||||
|
next();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
next(); // continue iteration
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
RestData();
|
||||||
|
logger.Info($"处方取药发生错误,{e.Message}");
|
||||||
|
_message.Notify(
|
||||||
|
new NotificationMessage { Severity = NotificationSeverity.Error, Summary = "提示", Detail = $"发生错误,{e.Message}", Duration = 4000 }
|
||||||
|
);
|
||||||
|
if (setting.Value.single.Contains(drawerNo))
|
||||||
|
{
|
||||||
|
PortUtil.PowerOff();
|
||||||
|
}
|
||||||
|
stop();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
PortUtil.PowerOff();
|
||||||
|
}
|
||||||
|
|
||||||
|
void RestData()
|
||||||
|
{
|
||||||
|
PortUtil.PowerOff();
|
||||||
|
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];
|
||||||
|
}
|
||||||
|
void Cancel()
|
||||||
|
{
|
||||||
|
RestData();
|
||||||
|
// 关闭弹窗
|
||||||
|
dialogService.Close(false);
|
||||||
|
}
|
||||||
|
async Task TakeFinish()
|
||||||
|
{
|
||||||
|
|
||||||
|
// 保存账册、操作记录
|
||||||
|
bool bResult = await orderInfoDao.CheckOrderInfoByChannelStock(csList.ToList(), null);
|
||||||
|
if (bResult)
|
||||||
|
{
|
||||||
|
_message.Notify(
|
||||||
|
new NotificationMessage { Severity = NotificationSeverity.Success, Summary = "提示", Detail = $"处方已核对完成", Duration = 4000 }
|
||||||
|
);
|
||||||
|
// 关闭弹窗
|
||||||
|
dialogService.Close(true);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_message.Notify(
|
||||||
|
new NotificationMessage { Severity = NotificationSeverity.Error, Summary = "提示", Detail = $"处方核对失败", Duration = 4000 }
|
||||||
|
);
|
||||||
|
}
|
||||||
|
//重置状态
|
||||||
|
this.RestData();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,253 @@
|
||||||
|
@page "/Box/OrderImport"
|
||||||
|
@using MasaBlazorApp3.Pojo.Config
|
||||||
|
@using MasaBlazorApp3.Report
|
||||||
|
@using Microsoft.Extensions.Options
|
||||||
|
@using Radzen.Blazor.Rendering
|
||||||
|
@using log4net;
|
||||||
|
|
||||||
|
<style>
|
||||||
|
.rz-grid-table {
|
||||||
|
position: relative;
|
||||||
|
border-collapse: separate;
|
||||||
|
border-spacing: 0;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<RadzenStack Orientation="Orientation.Horizontal">
|
||||||
|
<div class="col-12">
|
||||||
|
<form onsubmit="@(() => {grid.Reload();})">
|
||||||
|
<RadzenFieldset Text="查询">
|
||||||
|
<RadzenRow AlignItems="AlignItems.Center">
|
||||||
|
<RadzenColumn Size="6">
|
||||||
|
|
||||||
|
<RadzenLabel Text="处方号" Component="OrderNo" />
|
||||||
|
<RadzenTextBox @bind-Value="OrderNo" Style="width: 100%;" Name="OrderNo"></RadzenTextBox>
|
||||||
|
|
||||||
|
</RadzenColumn>
|
||||||
|
<RadzenColumn Size="6" Style="margin-top:0.5rem">
|
||||||
|
<RadzenLabel Text="处方时间" Component="OrderDate" />
|
||||||
|
<RadzenDatePicker DateFormat="yyyy-MM-dd" CurrentDateChanged="@OnCurrentDateChanged" @bind-Value="OrderDate" Style="width: 100%;" Name="OrderDate" />
|
||||||
|
</RadzenColumn>
|
||||||
|
</RadzenRow>
|
||||||
|
<RadzenRow AlignItems="AlignItems.Center">
|
||||||
|
<RadzenColumn Size="6">
|
||||||
|
|
||||||
|
<RadzenLabel Text="患者姓名" Component="PatientName" />
|
||||||
|
<RadzenTextBox @bind-Value="PatientName" Style="width: 100%;" Name="PatientName"></RadzenTextBox>
|
||||||
|
|
||||||
|
</RadzenColumn>
|
||||||
|
<RadzenColumn Size="6" Style="margin-top:4vh">
|
||||||
|
<RadzenButton Size="ButtonSize.Medium" ButtonType="ButtonType.Submit" IsBusy="isLoading" Icon="search" Text="查询" />
|
||||||
|
<RadzenButton Size="ButtonSize.Medium" Click="Confirm" ButtonType="ButtonType.Button" ButtonStyle="ButtonStyle.Warning" IsBusy="isLoading" Icon="input" Text="导入" />
|
||||||
|
<RadzenButton Click="@((args) => dialogService.Close(false))" Variant="Variant.Flat" ButtonStyle="ButtonStyle.Secondary" Text="取消" />
|
||||||
|
</RadzenColumn>
|
||||||
|
</RadzenRow>
|
||||||
|
</RadzenFieldset>
|
||||||
|
</form>
|
||||||
|
<div Style="width:75vw;height:50vh;overflow:auto">
|
||||||
|
<RadzenDataGrid @ref="grid" AllowRowSelectOnRowClick="@allowRowSelectOnRowClick" AllowFiltering="true" LoadData="@LoadData" Style="width:75vw;overflow:auto" Groupable="true"
|
||||||
|
FilterPopupRenderMode="PopupRenderMode.OnDemand" FilterCaseSensitivity="FilterCaseSensitivity.CaseInsensitive"
|
||||||
|
Data="@orderInfos" IsLoading="@isLoading" Count="@count" EmptyText="无数据"
|
||||||
|
SelectionMode="DataGridSelectionMode.Multiple"
|
||||||
|
@bind-Value="@(selectedOrderInfos)"
|
||||||
|
CellClick="@((DataGridCellMouseEventArgs<OrderInfo> args) => OnCellClick(args))"
|
||||||
|
AllowPaging="false">
|
||||||
|
<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 => OnCheckSeleced(args))" />
|
||||||
|
</HeaderTemplate>
|
||||||
|
<Template Context="data">
|
||||||
|
<RadzenCheckBox TabIndex="-1" TriState="false" Value="@data.ItemIsChecked" InputAttributes="@(new Dictionary<string, object>() { { "aria-label", "Select item" } })"
|
||||||
|
TValue="bool" Change="@(args => { if (!allowRowSelectOnRowClick) { grid.SelectRow(data); } })" />
|
||||||
|
</Template> *@
|
||||||
|
<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" />
|
||||||
|
</Template>
|
||||||
|
</RadzenDataGridColumn>
|
||||||
|
<RadzenDataGridColumn Property="anaesthetistName" Title="麻醉医师" Sortable="false" Filterable="false" Width="8vw" />
|
||||||
|
<RadzenDataGridColumn Property="PatientName" Title="姓名" Sortable="false" Filterable="false" Width="8vw" />
|
||||||
|
<RadzenDataGridColumn Property="Sex" Title="性别" Sortable="false" Filterable="false" Width="6vw" />
|
||||||
|
<RadzenDataGridColumn Property="OrderNo" Title="单号" Sortable="false" Filterable="false" Width="13vw" />
|
||||||
|
@* <RadzenDataGridColumn Property="ChargeDate" Title="处方时间" Sortable="false" Filterable="false" Width="10vw" /> *@
|
||||||
|
<RadzenDataGridColumn Property="DetailInfo.Drug.DrugName" Title="药品名称" FormatString="{0:d}" Sortable="false" Filterable="false" Width="20vw" />
|
||||||
|
@* <Template Context="DetailInfo">
|
||||||
|
@for (int i = 0; i < DetailList.DetailList.Count; i++)
|
||||||
|
{
|
||||||
|
OrderDetail orderDetail = DetailList.DetailList[i]; *@
|
||||||
|
@* <RadzenText TextStyle="TextStyle.Subtitle2" class="rz-mb-0">@DetailInfo.Drug.DrugName</RadzenText>
|
||||||
|
}
|
||||||
|
</Template>
|
||||||
|
</RadzenDataGridColumn>*@
|
||||||
|
@* <RadzenDataGridColumn Property="Detail.SetManuNo" Title="药品批次" Sortable="false" Filterable="false" Width="8rem">
|
||||||
|
<Template Context="DetailList">
|
||||||
|
@for (int i = 0; i < DetailList.DetailList.Count; i++)
|
||||||
|
{
|
||||||
|
OrderDetail orderDetail = DetailList.DetailList[i];
|
||||||
|
<RadzenText TextStyle="TextStyle.Subtitle2" class="rz-mb-0">@orderDetail.SetManuNo</RadzenText>
|
||||||
|
}
|
||||||
|
</Template>
|
||||||
|
</RadzenDataGridColumn> *@
|
||||||
|
<RadzenDataGridColumn Title="批次" Property="DetailInfo.SetManuNo" Filterable="false" Width="18vw">
|
||||||
|
<Template Context="DetailInfo">
|
||||||
|
<RadzenText TextStyle="TextStyle.Subtitle2" class="mb-0">@DetailInfo.DetailInfo.SetManuNo</RadzenText>
|
||||||
|
|
||||||
|
@if (DetailInfo.DetailInfo.SetManuNo != null)
|
||||||
|
{
|
||||||
|
<RadzenText TextStyle="TextStyle.Caption">
|
||||||
|
@DetailInfo.DetailInfo.SetManuNo
|
||||||
|
</RadzenText>
|
||||||
|
}
|
||||||
|
</Template>
|
||||||
|
@* <EditTemplate Context="DetailInfo">
|
||||||
|
<RadzenDropDown TValue="DrugManuNo" Name="ManuNo" @bind-Value="DetailInfo.DetailInfo.drugManuNo" Data="DetailInfo.DetailInfo.Drug.Manus" Style="width:100%; display: block;">
|
||||||
|
<Template>
|
||||||
|
<RadzenText TextStyle="TextStyle.Subtitle2" class="mb-0">@((context as DrugManuNo)?.ManuNo)</RadzenText>
|
||||||
|
@if ((context as DrugManuNo).EffDate != null && (context as DrugManuNo).EffDate.ToString().Length > 10)
|
||||||
|
{
|
||||||
|
|
||||||
|
<RadzenText TextStyle="TextStyle.Caption">@((context as DrugManuNo).EffDate.ToString().Substring(0, 10))</RadzenText>
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
|
||||||
|
<RadzenText TextStyle="TextStyle.Caption">@((context as DrugManuNo)?.EffDate)</RadzenText>
|
||||||
|
}
|
||||||
|
</Template>
|
||||||
|
<ValueTemplate>
|
||||||
|
<RadzenStack Orientation="Orientation.Horizontal">
|
||||||
|
<RadzenText TextStyle="TextStyle.Subtitle2" class="mb-0">@((context as DrugManuNo)?.ManuNo)</RadzenText>
|
||||||
|
@if ((context as DrugManuNo).EffDate != null && (context as DrugManuNo).EffDate.ToString().Length > 10)
|
||||||
|
{
|
||||||
|
|
||||||
|
<RadzenText TextStyle="TextStyle.Caption">@((context as DrugManuNo).EffDate.ToString().Substring(0, 10))</RadzenText>
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
|
||||||
|
<RadzenText TextStyle="TextStyle.Caption">@((context as DrugManuNo)?.EffDate)</RadzenText>
|
||||||
|
}
|
||||||
|
</RadzenStack>
|
||||||
|
</ValueTemplate>
|
||||||
|
</RadzenDropDown>
|
||||||
|
<RadzenRequiredValidator Text="请选择批次" Component="ManuNo" Popup="true" />
|
||||||
|
</EditTemplate> *@
|
||||||
|
</RadzenDataGridColumn>
|
||||||
|
<RadzenDataGridColumn Property="DetailInfo.Quantity" Title="数量" Filterable="false" Width="6vw">
|
||||||
|
@* <EditTemplate Context="DetailInfo">
|
||||||
|
<RadzenNumeric Min="0" Style="display: block" Name="Quantity" @bind-Value=@DetailInfo.DetailInfo.Quantity />
|
||||||
|
<RadzenNumericRangeValidator Style="position: absolute;z-index: 9999;" Min="0" Text="请填写正确的添加数量" Component="Quantity" Popup="true" />
|
||||||
|
</EditTemplate> *@
|
||||||
|
</RadzenDataGridColumn>
|
||||||
|
</Columns>
|
||||||
|
</RadzenDataGrid>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</RadzenStack>
|
||||||
|
@code {
|
||||||
|
|
||||||
|
private readonly ILog logger = LogManager.GetLogger(typeof(CheckOrder));
|
||||||
|
@inject IOrderInfoDao orderInfoDao;
|
||||||
|
@inject DialogService dialogService;
|
||||||
|
@inject Microsoft.Extensions.Options.IOptions<Pojo.Config.SettingConfig> setting;
|
||||||
|
@inject NotificationService _message;
|
||||||
|
@inject IReportDataDao reportDataDao;
|
||||||
|
@inject IOptions<SettingConfig> setting;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
[Parameter] public BoxModel boxModel { get; set; }
|
||||||
|
|
||||||
|
bool allowRowSelectOnRowClick = true;
|
||||||
|
IEnumerable<OrderInfo> orderInfos;
|
||||||
|
IList<OrderInfo> selectedOrderInfos = new List<OrderInfo>();
|
||||||
|
RadzenDataGrid<OrderInfo> grid;
|
||||||
|
//麻醉师集合
|
||||||
|
List<Anaesthetist> NamesList = new List<Anaesthetist>();
|
||||||
|
Anaesthetist NameInfo;
|
||||||
|
Anaesthetist BoxColor;
|
||||||
|
//药盒集合
|
||||||
|
List<BoxModel> BoxList = new List<BoxModel>();
|
||||||
|
//药盒颜色集合
|
||||||
|
List<Anaesthetist> BoxColorList = new List<Anaesthetist>();
|
||||||
|
BoxModel BoxNum;
|
||||||
|
bool isLoading;
|
||||||
|
int count;
|
||||||
|
int[] DrawerNos = new int[] { 1, 2, 3, 4, 5, 6, 7, 8 };
|
||||||
|
int status = 0;
|
||||||
|
string OrderNo;
|
||||||
|
string PatientName;
|
||||||
|
DateTime OrderDate = DateTime.Now;
|
||||||
|
DateTime PortOrderDate = DateTime.Now;
|
||||||
|
Popup popup;
|
||||||
|
RadzenButton button;
|
||||||
|
//第一次加载不执行LoadData方法
|
||||||
|
// int firstLod = 1;
|
||||||
|
void OnCheckSeleced(object dete)
|
||||||
|
{
|
||||||
|
if (orderInfos != null)
|
||||||
|
{
|
||||||
|
orderInfos.ToList().ForEach(it => it.ItemIsChecked = true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
void OnCurrentDateChanged(DateTime args)
|
||||||
|
{
|
||||||
|
OrderDate = new DateTime(args.Year, args.Month, args.Day);
|
||||||
|
}
|
||||||
|
void OnCellClick(DataGridCellMouseEventArgs<OrderInfo> args)
|
||||||
|
{
|
||||||
|
if (args.Data.DetailInfo.SetManuNo != null)
|
||||||
|
{
|
||||||
|
args.Data.DetailInfo.drugManuNo = args.Data.DetailInfo.Drug.Manus.Where(m => m.ManuNo == args.Data.DetailInfo.SetManuNo).FirstOrDefault();
|
||||||
|
}
|
||||||
|
if (args.Data.DetailInfo.drugManuNo == null)
|
||||||
|
{
|
||||||
|
args.Data.DetailInfo.drugManuNo = args.Data.DetailInfo.Drug.Manus.FirstOrDefault();
|
||||||
|
}
|
||||||
|
args.Data.ItemIsChecked = !args.Data.ItemIsChecked;
|
||||||
|
grid.EditRow(args.Data);
|
||||||
|
}
|
||||||
|
//确认
|
||||||
|
async Task Confirm()
|
||||||
|
{
|
||||||
|
if (selectedOrderInfos == null || selectedOrderInfos.Count<=0)
|
||||||
|
{
|
||||||
|
_message.Notify(
|
||||||
|
new NotificationMessage { Severity = NotificationSeverity.Error, Summary = "提示", Detail = $"请选择处方", Duration = 4000 }
|
||||||
|
);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// 关闭弹窗selectedOrderInfos
|
||||||
|
dialogService.Close(selectedOrderInfos);
|
||||||
|
|
||||||
|
}
|
||||||
|
PageData<OrderInfo> result;
|
||||||
|
protected override async Task OnInitializedAsync()
|
||||||
|
{
|
||||||
|
await base.OnInitializedAsync();
|
||||||
|
}
|
||||||
|
async Task LoadData(LoadDataArgs args)
|
||||||
|
{
|
||||||
|
// if (firstLod == 1)
|
||||||
|
if (boxModel != null && boxModel.BoxName > 0)
|
||||||
|
{
|
||||||
|
//查询除本药箱外的处方信息
|
||||||
|
result = await orderInfoDao.GetAllOrderInfoForImport(PatientName, OrderNo, OrderDate, boxModel, args.Top, args.Skip);
|
||||||
|
orderInfos = result.Desserts;
|
||||||
|
selectedOrderInfos = orderInfos.ToList();
|
||||||
|
count = result.TotalDesserts;
|
||||||
|
isLoading = true;
|
||||||
|
}
|
||||||
|
isLoading = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,574 @@
|
||||||
|
@page "/Box/Check"
|
||||||
|
@using MasaBlazorApp3.Pojo.Config
|
||||||
|
@using MasaBlazorApp3.Report
|
||||||
|
@using Microsoft.Extensions.Options
|
||||||
|
@using Radzen.Blazor.Rendering
|
||||||
|
@using log4net;
|
||||||
|
|
||||||
|
<style>
|
||||||
|
.my-popup {
|
||||||
|
display: none;
|
||||||
|
position: absolute;
|
||||||
|
overflow: auto;
|
||||||
|
/* height: 360px; */
|
||||||
|
width: 900px;
|
||||||
|
border: var(--rz-panel-border);
|
||||||
|
background-color: var(--rz-panel-background-color);
|
||||||
|
box-shadow: var(--rz-panel-shadow);
|
||||||
|
border-radius: var(--rz-border-radius);
|
||||||
|
}
|
||||||
|
|
||||||
|
.rz-grid-table {
|
||||||
|
position: relative;
|
||||||
|
border-collapse: separate;
|
||||||
|
border-spacing: 0;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
||||||
|
@* <RadzenStack Orientation="Orientation.Horizontal"> *@
|
||||||
|
<div class="col-12" style="margin-bottom:5px;">
|
||||||
|
@* <RadzenStack Orientation="Orientation.Horizontal" Gap="1rem"> *@
|
||||||
|
<RadzenRow AlignItems="AlignItems.Center">
|
||||||
|
<RadzenColumn Size="12">
|
||||||
|
<RadzenLabel Text="核对药箱" Component="BoxList" />
|
||||||
|
<RadzenDropDownDataGrid AllowVirtualization="true" Name="BoxColorList" TValue="BoxModel" Data="@BoxColorList" Value="BoxColor" Style="width: 8vw;"
|
||||||
|
ValueChanged="@((args) => OnColorChanged(args))" AllowFiltering="false"
|
||||||
|
AllowFilteringByAllStringColumns="true" TextProperty="药箱号">
|
||||||
|
<Template>
|
||||||
|
@((context as BoxModel).BoxNo == 1 ? "白" : (context as BoxModel).BoxNo == 3 ? "非常规" : "绿")
|
||||||
|
</Template>
|
||||||
|
<Columns>
|
||||||
|
<RadzenDropDownDataGridColumn Property="BoxNo" Title="药箱颜色" Sortable="false" />
|
||||||
|
</Columns>
|
||||||
|
</RadzenDropDownDataGrid>
|
||||||
|
<RadzenDropDownDataGrid AllowVirtualization="true" Name="BoxList" TValue="BoxModel" Data="@BoxList" Value="BoxNum" Style="width: 10vw;"
|
||||||
|
ValueChanged="@((args) => OnBoxChanged(args))" AllowFilteringByAllStringColumns="true" TextProperty="药箱号">
|
||||||
|
<Template>
|
||||||
|
|
||||||
|
@((context as BoxModel).BoxName == 99 ? "急诊药盒" : (context as BoxModel).BoxName == 111 ? "恢复室药盒" :
|
||||||
|
(context as BoxModel).BoxName == 31 ? "胃镜药盒" :
|
||||||
|
(context as BoxModel).BoxName == 32 ? "导管药盒" :
|
||||||
|
(context as BoxModel).BoxName == 33 ? "生殖药盒" :
|
||||||
|
(context as BoxModel).BoxName == 34 ? "妇门药盒" : (context as BoxModel).BoxName + "-" + ((context as BoxModel).BoxNo == 1 ? "白" : "绿"))
|
||||||
|
|
||||||
|
@* @((context as BoxModel).BoxName + "-" + (context as BoxModel).BoxNo) *@
|
||||||
|
|
||||||
|
</Template>
|
||||||
|
<Columns>
|
||||||
|
<RadzenDropDownDataGridColumn Property="BoxName" Title="药箱号" Sortable="false" />
|
||||||
|
</Columns>
|
||||||
|
</RadzenDropDownDataGrid>
|
||||||
|
<RadzenLabel Text="处方时间" Component="OrderDate" />
|
||||||
|
<RadzenDatePicker DateFormat="yyyy-MM-dd" CurrentDateChanged="@OnCurrentDateChanged" @bind-Value="OrderDate" Style="width: 15vw;" Name="OrderDate" />
|
||||||
|
@* <RadzenButton Size="ButtonSize.Medium" Click="Search" IsBusy="isLoading" Icon="search" Text="查询" /> *@
|
||||||
|
<RadzenButton Size="ButtonSize.Medium" Click="Confirm" ButtonType="ButtonType.Button" ButtonStyle="ButtonStyle.Success" IsBusy="isLoading" Icon="check_circle" Text="确认" />
|
||||||
|
<RadzenButton Size="ButtonSize.Medium" Click="AddOrderMethod" ButtonType="ButtonType.Button" IsBusy="isLoading" ButtonStyle="ButtonStyle.Warning" Icon="input" Text="导入" />
|
||||||
|
<RadzenButton Style="margin-top:2px" Icon="download" @ref=button Text="麻醉药品使用登记本导出" Variant="Variant.Outlined" Click="@(args => popup.ToggleAsync(button.Element))" />
|
||||||
|
<Popup @ref=popup Lazy=true class="my-popup">
|
||||||
|
<RadzenStack Orientation="Orientation.Vertical" Gap="1rem" class="rz-h-100 rz-p-4">
|
||||||
|
<RadzenFieldset Text="条件选择">
|
||||||
|
<RadzenStack Orientation="Orientation.Horizontal" Gap="1rem">
|
||||||
|
<RadzenRow AlignItems="AlignItems.Center">
|
||||||
|
<RadzenColumn Size="6">
|
||||||
|
<RadzenLabel Text="处方时间" Component="PortOrderDate" />
|
||||||
|
</RadzenColumn>
|
||||||
|
<RadzenColumn Size="6">
|
||||||
|
<RadzenDatePicker DateFormat="yyyy-MM-dd" CurrentDateChanged="@OnCurrentPortDateChanged" @bind-Value="PortOrderDate" Style="width: 100%;" Name="PortOrderDate" />
|
||||||
|
</RadzenColumn>
|
||||||
|
</RadzenRow>
|
||||||
|
|
||||||
|
<RadzenRow JustifyContent="JustifyContent.End" AlignItems="AlignItems.Center">
|
||||||
|
<RadzenButton Icon="download" Text="导出" Variant="Variant.Outlined" Click="StockExport" />
|
||||||
|
</RadzenRow>
|
||||||
|
</RadzenStack>
|
||||||
|
</RadzenFieldset>
|
||||||
|
</RadzenStack>
|
||||||
|
</Popup>
|
||||||
|
</RadzenColumn>
|
||||||
|
</RadzenRow>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<RadzenStack Orientation="Orientation.Horizontal">
|
||||||
|
<div Style="width:55vw;overflow:auto">
|
||||||
|
@* <RadzenDataGrid @ref="grid" AllowRowSelectOnRowClick="@allowRowSelectOnRowClick" AllowFiltering="true" LoadData="@LoadData" Style="width:50vw;overflow:auto"
|
||||||
|
FilterPopupRenderMode="PopupRenderMode.OnDemand" FilterCaseSensitivity="FilterCaseSensitivity.CaseInsensitive"
|
||||||
|
Data="@csList" IsLoading="@isLoading" Count="@count" EmptyText="无数据"
|
||||||
|
SelectionMode="DataGridSelectionMode.Multiple" @bind-Value=@selectedcsList
|
||||||
|
CellClick="@((DataGridCellMouseEventArgs<ChannelStock> args) => OnDrugCellClick(args))"
|
||||||
|
AllowPaging="false">
|
||||||
|
<Columns>
|
||||||
|
<RadzenDataGridColumn Property="Drug.DrugName" Title="药品名称" FormatString="{0:d}" Sortable="false" Filterable="false" Width="2vw" />
|
||||||
|
<RadzenDataGridColumn Title="批次" Property="ManuNo" Filterable="false" Width="2vw">
|
||||||
|
</RadzenDataGridColumn>
|
||||||
|
<RadzenDataGridColumn Property="DetailInfo.Quantity" Title="合计" Filterable="false" Width="3vw">
|
||||||
|
<Template Context="contextDate">
|
||||||
|
<div style="text-align: center;">
|
||||||
|
库存量【@contextDate.Quantity】<br />
|
||||||
|
用药量【@contextDate.UseQuantity】<br />
|
||||||
|
处方数【@contextDate.OrderQuantity】
|
||||||
|
</div>
|
||||||
|
</Template>
|
||||||
|
</RadzenDataGridColumn>
|
||||||
|
</Columns>
|
||||||
|
</RadzenDataGrid> *@
|
||||||
|
|
||||||
|
<RadzenListBox AllowClear="true" @bind-Value=@listBoxSelectedcsList Style="width:45vw;height:70vh;overflow:auto" AllowFiltering="false" TValue="ChannelStock"
|
||||||
|
LoadData=@LoadData Data=@csList>
|
||||||
|
<Template>
|
||||||
|
<RadzenStack Orientation="Orientation.Horizontal">
|
||||||
|
<RadzenText Style="width:15vw;text-align:left">@((context as ChannelStock).Drug.DrugName)</RadzenText>
|
||||||
|
<RadzenText Style="width:10vw">@((context as ChannelStock).ManuNo)</RadzenText>
|
||||||
|
<RadzenStack Gap="10" Style="text-align:right">
|
||||||
|
<div style="text-align: center;">
|
||||||
|
基数【@((context as ChannelStock).BaseQuantity)】<br />
|
||||||
|
@* 总库存【@((context as ChannelStock).TotalQuantity)】<br /> *@
|
||||||
|
库存数【@((context as ChannelStock).Quantity)】<br />
|
||||||
|
用药数【@((context as ChannelStock).SelectedOrderList.Aggregate(0, (a, b) => a + b.DetailInfo.Quantity))】<br />
|
||||||
|
处方数【@((context as ChannelStock).SelectedOrderList.Count)】
|
||||||
|
</div>
|
||||||
|
</RadzenStack>
|
||||||
|
</RadzenStack>
|
||||||
|
</Template>
|
||||||
|
</RadzenListBox>
|
||||||
|
</div>
|
||||||
|
<div Style="width:75vw;overflow:auto;box-shadow: 2px 2px 5px rgba(0, 0, 0, 0.3); ">
|
||||||
|
@if ((listBoxSelectedcsList != null && string.IsNullOrEmpty(listBoxSelectedcsList.ListId) && listBoxSelectedcsList.Quantity > listBoxSelectedcsList.UseQuantity) || (listBoxSelectedcsList.Quantity > listBoxSelectedcsList.BaseQuantity))
|
||||||
|
{
|
||||||
|
//ListId为空则是没有在套餐里的药,库存量大于使用量时需要把药还到抽屉里
|
||||||
|
//列出需要还到抽屉里的药品的抽屉库位
|
||||||
|
@* <RadzenRow AlignItems="AlignItems.Center" Style="margin:1vw;">
|
||||||
|
<RadzenColumn Size="12">
|
||||||
|
<RadzenLabel Text="库位" Component="DrawerList" />
|
||||||
|
<RadzenDropDownDataGrid AllowVirtualization="true" Name="DrawerList" TValue="ChannelStock" @bind-Value="@listBoxSelectedcsList.ReturnDrawerChanneStock" Data="@(listBoxSelectedcsList?.DrawerChanneStockList)"
|
||||||
|
Style="width:20vw;" AllowFilteringByAllStringColumns="true" TextProperty="Location">
|
||||||
|
<Columns>
|
||||||
|
<RadzenDropDownDataGridColumn Property="Location" Title="库位" Sortable="false" />
|
||||||
|
<RadzenDropDownDataGridColumn Property="Quantity" Title="库存" Sortable="false" />
|
||||||
|
</Columns>
|
||||||
|
</RadzenDropDownDataGrid>
|
||||||
|
<RadzenLabel Text="还药数" Component="ReturnQuantity" />
|
||||||
|
<RadzenNumeric Min="0" Name="ReturnQuantity" TValue="int" @bind-Value=@listBoxSelectedcsList.ReturnQuantity Style="width:5vw;" />
|
||||||
|
<RadzenNumericRangeValidator Min="0" Max=@listBoxSelectedcsList.Quantity Text="请填写正确的还药数量" Component="ReturnQuantity" Popup="true" />
|
||||||
|
|
||||||
|
</RadzenColumn>
|
||||||
|
</RadzenRow>
|
||||||
|
<RadzenRow AlignItems="AlignItems.Center" Style="margin:1vw;">
|
||||||
|
<RadzenColumn Size="12">*@
|
||||||
|
@if (listBoxSelectedcsList?.DrawerChanneStockList != null)
|
||||||
|
{
|
||||||
|
<RadzenListBox AllowClear="true" @bind-Value=@returnList AllowFiltering="false" TValue="ChannelStock" Style="width:70vw;overflow:auto"
|
||||||
|
Data=@(listBoxSelectedcsList?.DrawerChanneStockList)>
|
||||||
|
<Template>
|
||||||
|
<RadzenStack Orientation="Orientation.Horizontal">
|
||||||
|
<RadzenText Style="width:20vw;text-align:left">还药库位@((context as ChannelStock).Location)</RadzenText>
|
||||||
|
<RadzenText Style="width:10vw">还药数@((context as ChannelStock).ReturnQuantity)</RadzenText>
|
||||||
|
</RadzenStack>
|
||||||
|
</Template>
|
||||||
|
</RadzenListBox>
|
||||||
|
}
|
||||||
|
@* </RadzenColumn>
|
||||||
|
</RadzenRow> *@
|
||||||
|
}
|
||||||
|
|
||||||
|
<RadzenDataGrid Style="width:55vw;height:70vh;overflow:auto"
|
||||||
|
FilterPopupRenderMode="PopupRenderMode.OnDemand" FilterCaseSensitivity="FilterCaseSensitivity.CaseInsensitive"
|
||||||
|
Data="@(listBoxSelectedcsList?.OrderList)" EmptyText="无处方数据"
|
||||||
|
@bind-Value="@(listBoxSelectedcsList.SelectedOrderList)"
|
||||||
|
SelectionMode="DataGridSelectionMode.Multiple"
|
||||||
|
AllowRowSelectOnRowClick="true"
|
||||||
|
AllowPaging="false">
|
||||||
|
<Columns>
|
||||||
|
<RadzenDataGridColumn Sortable="false" Filterable="false" Width="1rem">
|
||||||
|
@* <HeaderTemplate>
|
||||||
|
<RadzenCheckBox TabIndex="-1" TriState="false" TValue="bool?" InputAttributes="@(new Dictionary<string, object>() { { "aria-label", "Select all items" } })"
|
||||||
|
Value="@(listBoxSelectedcsList?.OrderList!=null&&(bool)listBoxSelectedcsList?.OrderList.Any(oi=>oi. ItemIsChecked))"
|
||||||
|
Change="@(args => ChangeHeaderCheckBox(args))" />
|
||||||
|
</HeaderTemplate>
|
||||||
|
<Template Context="data">
|
||||||
|
<RadzenCheckBox TabIndex="-1" TriState="false" Value="@data.ItemIsChecked" InputAttributes="@(new Dictionary<string, object>() { { "aria-label", "Select item" } })"
|
||||||
|
TValue="bool" Change="@(args => { data.ItemIsChecked=!data.ItemIsChecked;})" />
|
||||||
|
</Template> *@
|
||||||
|
<HeaderTemplate>
|
||||||
|
<RadzenCheckBox TabIndex="-1" TriState="false" TValue="bool?" InputAttributes="@(new Dictionary<string, object>() { { "aria-label", "Select all items" } })"
|
||||||
|
Value="@(listBoxSelectedcsList?.SelectedOrderList==null || listBoxSelectedcsList?.SelectedOrderList.Any() !=true? false: !(bool)listBoxSelectedcsList?.OrderList.All(i => (bool)(listBoxSelectedcsList?.SelectedOrderList.Contains(i)))?null:listBoxSelectedcsList?.OrderList.Any(i => (bool)listBoxSelectedcsList?.SelectedOrderList.Contains(i)))"
|
||||||
|
Change="@(args =>listBoxSelectedcsList.SelectedOrderList = args == true ? listBoxSelectedcsList?.OrderList.ToList():new List<OrderInfo>())" />
|
||||||
|
</HeaderTemplate>
|
||||||
|
<Template Context="data">
|
||||||
|
<RadzenCheckBox TabIndex="-1" TriState="false" Value="@(listBoxSelectedcsList.SelectedOrderList.Contains(data))" InputAttributes="@(new Dictionary<string, object>() { { "aria-label", "Select item" } })"
|
||||||
|
TValue="bool" />
|
||||||
|
</Template>
|
||||||
|
</RadzenDataGridColumn>
|
||||||
|
<RadzenDataGridColumn Property="OrderNo" Title="处方号" Sortable="false" Filterable="false" Width="5vw" />
|
||||||
|
<RadzenDataGridColumn Property="anaesthetistName" Title="医师" Sortable="false" Filterable="false" Width="3vw" />
|
||||||
|
<RadzenDataGridColumn Property="PatientName" Title="患者" Sortable="false" Filterable="false" Width="3vw" />
|
||||||
|
<RadzenDataGridColumn Property="Sex" Title="性别" Sortable="false" Filterable="false" Width="2vw" />
|
||||||
|
<RadzenDataGridColumn Property="DetailInfo.Quantity" Title="数量" Sortable="false" Filterable="false" Width="2vw" />
|
||||||
|
</Columns>
|
||||||
|
</RadzenDataGrid>
|
||||||
|
</div>
|
||||||
|
</RadzenStack>
|
||||||
|
@* </RadzenStack> *@
|
||||||
|
@code {
|
||||||
|
private readonly ILog logger = LogManager.GetLogger(typeof(CheckOrder));
|
||||||
|
@inject IOrderInfoDao orderInfoDao;
|
||||||
|
@inject DialogService dialogService;
|
||||||
|
@inject Microsoft.Extensions.Options.IOptions<Pojo.Config.SettingConfig> setting;
|
||||||
|
@inject NotificationService _message;
|
||||||
|
@inject IReportDataDao reportDataDao;
|
||||||
|
@inject IOptions<SettingConfig> setting;
|
||||||
|
//bool allowRowSelectOnRowClick = true;
|
||||||
|
IEnumerable<ChannelStock> csList;
|
||||||
|
IList<ChannelStock> selectedcsList;
|
||||||
|
ChannelStock listBoxSelectedcsList = new();
|
||||||
|
ChannelStock returnList = new();
|
||||||
|
IEnumerable<OrderInfo> orderList;
|
||||||
|
IList<OrderInfo> selectedOrderList;
|
||||||
|
RadzenListBox<ChannelStock> listBox;
|
||||||
|
RadzenDataGrid<OrderInfo> gridOrder;
|
||||||
|
|
||||||
|
//麻醉师集合
|
||||||
|
List<Anaesthetist> NamesList = new List<Anaesthetist>();
|
||||||
|
Anaesthetist NameInfo;
|
||||||
|
BoxModel BoxColor;
|
||||||
|
//全部药盒集合
|
||||||
|
List<BoxModel> AllBoxList = new List<BoxModel>();
|
||||||
|
//药盒集合
|
||||||
|
List<BoxModel> BoxList = new List<BoxModel>();
|
||||||
|
//药盒颜色集合
|
||||||
|
List<BoxModel> BoxColorList = new List<BoxModel>()
|
||||||
|
{
|
||||||
|
new BoxModel{BoxNo=1,BoxName=1 },
|
||||||
|
new BoxModel{BoxNo=2 ,BoxName=1},
|
||||||
|
new BoxModel{BoxNo=3 ,BoxName=1}
|
||||||
|
};
|
||||||
|
BoxModel BoxNum;
|
||||||
|
bool isLoading;
|
||||||
|
int count;
|
||||||
|
int[] DrawerNos = new int[] { 1, 2, 3, 4, 5, 6, 7, 8 };
|
||||||
|
int status = 0;
|
||||||
|
string OrderNo;
|
||||||
|
string PatientName;
|
||||||
|
DateTime? OrderDate = DateTime.Now;
|
||||||
|
DateTime PortOrderDate = DateTime.Now;
|
||||||
|
Popup popup;
|
||||||
|
RadzenButton button;
|
||||||
|
private async Task OnColorChanged(object value)
|
||||||
|
{
|
||||||
|
if ((((BoxModel)value).BoxNo) == 3)
|
||||||
|
{
|
||||||
|
BoxList = AllBoxList.Where(bl => bl.BoxName > 30).ToList();
|
||||||
|
BoxNum = BoxList.FirstOrDefault();
|
||||||
|
await InvokeAsync(StateHasChanged);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
BoxList = AllBoxList.Where(bl => bl.BoxNo == ((BoxModel)value).BoxNo && bl.BoxName <= 30).ToList();
|
||||||
|
BoxNum = BoxList.FirstOrDefault();
|
||||||
|
}
|
||||||
|
await LoadData(null);
|
||||||
|
|
||||||
|
}
|
||||||
|
//药箱选中修改
|
||||||
|
private async Task OnBoxChanged(object value)
|
||||||
|
{
|
||||||
|
// BoxList = BoxList.Where(bl => bl.BoxNo == ((BoxModel)value).BoxNo && bl.BoxName == ((BoxModel)value).BoxName).ToList();
|
||||||
|
BoxNum = (BoxModel)value;
|
||||||
|
|
||||||
|
await LoadData(null);
|
||||||
|
}
|
||||||
|
bool? boolHeader = true;
|
||||||
|
//全选/反选
|
||||||
|
void ChangeHeaderCheckBox(bool? args)
|
||||||
|
{
|
||||||
|
if (args != null)
|
||||||
|
{
|
||||||
|
boolHeader = args;
|
||||||
|
listBoxSelectedcsList?.OrderList.ToList().ForEach(it => it.ItemIsChecked = (bool)args);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
void OnCheckSeleced(object dete)
|
||||||
|
{
|
||||||
|
//listBoxSelectedcsList?.OrderList.ToList().Where(it => it.OrderNo == (OrderInfo as (dete).))(oi => oi.ItemIsChecked = true));
|
||||||
|
}
|
||||||
|
//日期修改
|
||||||
|
async Task OnCurrentDateChanged(DateTime args)
|
||||||
|
{
|
||||||
|
OrderDate = new DateTime(args.Year, args.Month, args.Day);
|
||||||
|
|
||||||
|
await LoadData(null);
|
||||||
|
}
|
||||||
|
void OnCurrentPortDateChanged(DateTime args)
|
||||||
|
{
|
||||||
|
PortOrderDate = new DateTime(args.Year, args.Month, args.Day);
|
||||||
|
}
|
||||||
|
void OnDrugCellClick(DataGridCellMouseEventArgs<ChannelStock> args)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
void OnCellClick(DataGridCellMouseEventArgs<OrderInfo> args)
|
||||||
|
{
|
||||||
|
if (args.Data.DetailInfo.SetManuNo != null)
|
||||||
|
{
|
||||||
|
args.Data.DetailInfo.drugManuNo = args.Data.DetailInfo.Drug.Manus.Where(m => m.ManuNo == args.Data.DetailInfo.SetManuNo).FirstOrDefault();
|
||||||
|
}
|
||||||
|
if (args.Data.DetailInfo.drugManuNo == null)
|
||||||
|
{
|
||||||
|
args.Data.DetailInfo.drugManuNo = args.Data.DetailInfo.Drug.Manus.FirstOrDefault();
|
||||||
|
}
|
||||||
|
args.Data.ItemIsChecked = !args.Data.ItemIsChecked;
|
||||||
|
// gridOrder.EditRow(args.Data);
|
||||||
|
}
|
||||||
|
//查询
|
||||||
|
async Task Search()
|
||||||
|
{
|
||||||
|
await LoadData(null);
|
||||||
|
}
|
||||||
|
//确认
|
||||||
|
async Task Confirm()
|
||||||
|
{
|
||||||
|
csList = csList.ToList();
|
||||||
|
List<ChannelStock> checkChannelStock = new();
|
||||||
|
string errMessage = string.Empty;
|
||||||
|
foreach (var item in csList)
|
||||||
|
{
|
||||||
|
if (item.SelectedOrderList.Aggregate(0, (a, b) => a + b.DetailInfo.Quantity)>item.Quantity)
|
||||||
|
{
|
||||||
|
_message.Notify(
|
||||||
|
new NotificationMessage { Severity = NotificationSeverity.Error, Summary = "提示", Detail = $"用药数不可大于库存数,请仔细核对!", Duration = 4000 }
|
||||||
|
);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
int i = 0;
|
||||||
|
if (item.OrderList != null && item.SelectedOrderList.Count > 0)
|
||||||
|
{
|
||||||
|
item.UseQuantity = item.SelectedOrderList.Sum(oi => oi.DetailInfo.Quantity);
|
||||||
|
item.OrderQuantity = item.SelectedOrderList.Count;
|
||||||
|
// checkChannelStock.Add(item);
|
||||||
|
i = 1;
|
||||||
|
}
|
||||||
|
if (item.DrawerChanneStockList != null && item.DrawerChanneStockList.Any(d => d.ReturnQuantity > 0))
|
||||||
|
{
|
||||||
|
//还药数量:使用量==库存?还0 :库存>基数? (库存数-使用数)>基数? 还 库存数-使用数:0;
|
||||||
|
item.ReturnQuantity =
|
||||||
|
(item.UseQuantity == item.Quantity) ? 0 :
|
||||||
|
(item.Quantity <= item.BaseQuantity) ? 0 :
|
||||||
|
((item.Quantity - item.UseQuantity) > item.BaseQuantity) ?
|
||||||
|
(item.Quantity - item.UseQuantity - item.BaseQuantity) : 0;
|
||||||
|
//还药库位
|
||||||
|
if (item.ReturnQuantity > 0)
|
||||||
|
{
|
||||||
|
//药品未在套餐中绑定需要把药还到对应抽屉
|
||||||
|
List<ChannelStock> allDrugStock = await orderInfoDao.GetStockByDRrug(item.DrugId, item.ManuNo, 1);// await _connection.ChannelStock.Where(cs => cs.MachineId == _setting.machineId && cs.DrawerType == 1 && cs.DrugId == csList[i].DrugId && cs.ManuNo == csList[i].ManuNo).OrderBy(cs => cs.Quantity).ToListAsync();
|
||||||
|
if (allDrugStock != null && allDrugStock.Count > 0)
|
||||||
|
{
|
||||||
|
item.DrawerChanneStockList = new();
|
||||||
|
int iReturnQuantity = item.Quantity - item.UseQuantity - item.BaseQuantity;
|
||||||
|
for (int j = 0; j < allDrugStock.Count; j++)
|
||||||
|
{
|
||||||
|
if (allDrugStock[j].BoardType.ToString().Contains("2") && allDrugStock[j].Quantity >= 25)
|
||||||
|
continue;
|
||||||
|
if (allDrugStock[j].BoardType.ToString().Contains("2") && allDrugStock[j].Quantity + item.Quantity - item.UseQuantity > 25)
|
||||||
|
{
|
||||||
|
if (iReturnQuantity <= allDrugStock.Sum(it => it.Quantity))
|
||||||
|
{
|
||||||
|
for (int q = 0; iReturnQuantity > 0; q++)
|
||||||
|
{
|
||||||
|
|
||||||
|
allDrugStock[j].ReturnQuantity = 25 - allDrugStock[q].Quantity;
|
||||||
|
item.DrawerChanneStockList.Add(allDrugStock[q]);
|
||||||
|
iReturnQuantity = iReturnQuantity - allDrugStock[q].ReturnQuantity;
|
||||||
|
if (iReturnQuantity <= 0)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//库位不足,有药品无库位可放
|
||||||
|
allDrugStock[j].ReturnQuantity = iReturnQuantity;
|
||||||
|
item.DrawerChanneStockList.Add(allDrugStock[j]);
|
||||||
|
logger.Info($"还药品【{item.Drug.DrugName}】库位不足,有药品无库位可放");
|
||||||
|
errMessage += $"库位不足,药品【{item.Drug.DrugName}】无库位可放";
|
||||||
|
_message.Notify(
|
||||||
|
new NotificationMessage { Severity = NotificationSeverity.Error, Summary = "提示", Detail = errMessage, Duration = 4000 }
|
||||||
|
);
|
||||||
|
break; ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
allDrugStock[j].ReturnQuantity = iReturnQuantity;
|
||||||
|
item.DrawerChanneStockList.Add(allDrugStock[j]);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// checkChannelStock.Add(item);
|
||||||
|
i = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
//还空瓶数
|
||||||
|
item.EmptyQuantity = item.SelectedOrderList.Sum(oi => oi.DetailInfo.Quantity);
|
||||||
|
if (item.EmptyQuantity > 0)
|
||||||
|
{
|
||||||
|
//还空瓶库位
|
||||||
|
//查询还空瓶库位
|
||||||
|
//checkChannelStock[i].EmptyStock;
|
||||||
|
|
||||||
|
List<ChannelStock> allDrugStock = await orderInfoDao.GetStockByDRrug(item.DrugId, item.ManuNo, 2);// await _connection.ChannelStock.Where(cs => cs.MachineId == _setting.machineId && cs.DrawerType == 1 && cs.DrugId == csList[i].DrugId && cs.ManuNo == csList[i].ManuNo).OrderBy(cs => cs.Quantity).ToListAsync();
|
||||||
|
if (allDrugStock.Count > 0)
|
||||||
|
{
|
||||||
|
item.EmptyStock = allDrugStock.FirstOrDefault();
|
||||||
|
item.EmptyStock.ReturnQuantity = item.EmptyQuantity;
|
||||||
|
i = 1;
|
||||||
|
}
|
||||||
|
// checkChannelStock.Add(item);
|
||||||
|
}
|
||||||
|
if (i == 1)
|
||||||
|
{
|
||||||
|
checkChannelStock.Add(item);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (errMessage.Length > 0)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (checkChannelStock == null || checkChannelStock.Count <= 0)
|
||||||
|
{
|
||||||
|
_message.Notify(
|
||||||
|
new NotificationMessage { Severity = NotificationSeverity.Error, Summary = "提示", Detail = $"无可操作的数据", Duration = 4000 }
|
||||||
|
);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// //弹出确认提示框
|
||||||
|
var b = await dialogService.OpenAsync<CheckOrderConfirmDialog>(
|
||||||
|
$"核对确认",
|
||||||
|
new Dictionary<string, object>() { { "csList", checkChannelStock } },
|
||||||
|
new DialogOptions() { Width = "90vw", Resizable = true, Draggable = true, ShowClose = false });
|
||||||
|
// if (b)
|
||||||
|
// {
|
||||||
|
// bool bResult = await orderInfoDao.CheckOrderInfoByChannelStock(csList.ToList(), BoxNum);
|
||||||
|
// if (bResult)
|
||||||
|
// {
|
||||||
|
// _message.Notify(
|
||||||
|
// new NotificationMessage { Severity = NotificationSeverity.Success, Summary = "提示", Detail = $"处方已核对完成", Duration = 4000 }
|
||||||
|
// );
|
||||||
|
// await LoadData(null);
|
||||||
|
// }
|
||||||
|
// else
|
||||||
|
// {
|
||||||
|
// _message.Notify(
|
||||||
|
// new NotificationMessage { Severity = NotificationSeverity.Error, Summary = "提示", Detail = $"处方已核对失败", Duration = 4000 }
|
||||||
|
// );
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
if (b)
|
||||||
|
{
|
||||||
|
LoadData(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
//导处方
|
||||||
|
async Task AddOrderMethod()
|
||||||
|
{
|
||||||
|
var b = await dialogService.OpenAsync<CheckOrderImportDialog>(
|
||||||
|
$"导入处方信息",
|
||||||
|
new Dictionary<string, object>() { { "boxModel", BoxNum } },
|
||||||
|
new DialogOptions() { Width = "80vw", Resizable = true, Draggable = true, ShowClose = false });
|
||||||
|
if (b != null)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
|
||||||
|
List<OrderInfo> importOrderInfo = b;
|
||||||
|
if (importOrderInfo.Count > 0)
|
||||||
|
{
|
||||||
|
string errorMessage = string.Empty;
|
||||||
|
for (int i = 0; i < importOrderInfo.Count; i++)
|
||||||
|
{
|
||||||
|
if (!(bool)listBoxSelectedcsList?.OrderList.Contains(importOrderInfo[i]))
|
||||||
|
{
|
||||||
|
if (csList.Where(c => c.DrugId == importOrderInfo[i].DetailInfo.DrugId && c.ManuNo == importOrderInfo[i].DetailInfo.SetManuNo).FirstOrDefault() == null)
|
||||||
|
{
|
||||||
|
errorMessage += $"处方{importOrderInfo[i].OrderNo}导入失败,药品{importOrderInfo[i].DetailInfo.Drug.DrugName}不存在或批次{importOrderInfo[i].DetailInfo.SetManuNo}不存在";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
csList.Where(c => c.DrugId == importOrderInfo[i].DetailInfo.DrugId && c.ManuNo == importOrderInfo[i].DetailInfo.SetManuNo).FirstOrDefault()?.SelectedOrderList.Add(importOrderInfo[i]);
|
||||||
|
//csList.Where(c => c.DrugId == importOrderInfo[i].DetailInfo.DrugId && c.ManuNo == importOrderInfo[i].DetailInfo.SetManuNo).FirstOrDefault()?.OrderList.Add(importOrderInfo[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
csList = csList;
|
||||||
|
}
|
||||||
|
if (!string.IsNullOrEmpty(errorMessage))
|
||||||
|
{
|
||||||
|
_message.Notify(
|
||||||
|
new NotificationMessage { Severity = NotificationSeverity.Error, Summary = "提示", Detail = errorMessage, Duration = 4000 }
|
||||||
|
);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
StateHasChanged(); // 刷新UI
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
PageData<ChannelStock> result;
|
||||||
|
protected override async Task OnInitializedAsync()
|
||||||
|
{
|
||||||
|
BoxColor = BoxColorList.FirstOrDefault();
|
||||||
|
AllBoxList = await orderInfoDao.GetOperationNum(0);
|
||||||
|
BoxList = AllBoxList.Where(bl => bl.BoxNo == BoxColor.BoxNo && bl.BoxName <= 30).ToList();
|
||||||
|
BoxNum = AllBoxList.FirstOrDefault();
|
||||||
|
await base.OnInitializedAsync();
|
||||||
|
}
|
||||||
|
async Task LoadData(LoadDataArgs args)
|
||||||
|
{
|
||||||
|
string? roomName = BoxNum == null ? "" : setting.Value.roomName + BoxNum.BoxName.ToString().PadLeft(2, '0');
|
||||||
|
result = await orderInfoDao.GetAllOrderInfoDrugByBox(BoxNum, roomName, OrderDate);
|
||||||
|
isLoading = true;
|
||||||
|
csList = result.Desserts;
|
||||||
|
if (csList != null && csList.Count() > 0)
|
||||||
|
{
|
||||||
|
listBoxSelectedcsList = csList.ElementAt(0);
|
||||||
|
}
|
||||||
|
count = result.TotalDesserts;
|
||||||
|
isLoading = false;
|
||||||
|
StateHasChanged(); // 刷新UI
|
||||||
|
}
|
||||||
|
//麻醉药品使用登记本导出
|
||||||
|
async Task StockExport()
|
||||||
|
{
|
||||||
|
if (PortOrderDate == DateTime.MinValue)
|
||||||
|
{
|
||||||
|
_message.Notify(
|
||||||
|
new NotificationMessage { Severity = NotificationSeverity.Error, Summary = "提示", Detail = $"请选择处方时间再导出", Duration = 4000 }
|
||||||
|
);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
PageData<ReportUsageDateInfo> pageData = await reportDataDao.GetOrderInfoData(PortOrderDate);
|
||||||
|
GridReportUtil.PrintReport("Usage_Temp.grf", pageData);
|
||||||
|
}
|
||||||
|
// 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;
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,77 @@
|
||||||
|
@page "/Box/CheckDDD"
|
||||||
|
@using Radzen.Blazor
|
||||||
|
@using System.ComponentModel
|
||||||
|
|
||||||
|
<style>
|
||||||
|
|
||||||
|
.total-footer {
|
||||||
|
font-weight: 600;
|
||||||
|
color: var(--rz-secondary);
|
||||||
|
padding: 8px 12px;
|
||||||
|
background-color: var(--rz-base-100);
|
||||||
|
border-top: 2px solid var(--rz-border-default);
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
@* <RadzenDataGrid @ref="grid" Data="@summaryData" TItem="dynamic"
|
||||||
|
AllowPaging="true" PageSize="5">
|
||||||
|
<Columns>
|
||||||
|
<RadzenDataGridColumn Title="商品品类" Property="Category" Width="200px" />
|
||||||
|
<RadzenDataGridColumn Title="销售总量" TextAlign="TextAlign.Right">
|
||||||
|
<Template Context="group">
|
||||||
|
<span class="font-bold">@group.TotalQuantity.ToString("N0")</span>
|
||||||
|
</Template>
|
||||||
|
<FooterTemplate>
|
||||||
|
<div class="total-footer">
|
||||||
|
全品类合计: @orders.Sum(o => o.Quantity).ToString("N0")
|
||||||
|
</div>
|
||||||
|
</FooterTemplate>
|
||||||
|
</RadzenDataGridColumn>
|
||||||
|
</Columns>
|
||||||
|
</RadzenDataGrid> *@
|
||||||
|
|
||||||
|
@code {
|
||||||
|
RadzenDataGrid<dynamic> grid;
|
||||||
|
List<Order> orders = new();
|
||||||
|
IEnumerable<dynamic> summaryData;
|
||||||
|
|
||||||
|
protected override void OnInitialized()
|
||||||
|
{
|
||||||
|
// 模拟数据
|
||||||
|
orders = new List<Order> {
|
||||||
|
new Order { Category = "电子产品", Quantity = 15 },
|
||||||
|
new Order { Category = "电子产品", Quantity = 8 },
|
||||||
|
new Order { Category = "家居用品", Quantity = 23 }
|
||||||
|
};
|
||||||
|
|
||||||
|
CalculateSummary();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CalculateSummary()
|
||||||
|
{
|
||||||
|
summaryData = orders
|
||||||
|
.GroupBy(o => o.Category)
|
||||||
|
.Select(g => new
|
||||||
|
{
|
||||||
|
Category = g.Key,
|
||||||
|
TotalQuantity = g.Sum(x => x.Quantity)
|
||||||
|
}).ToList();
|
||||||
|
}
|
||||||
|
|
||||||
|
public class Order : INotifyPropertyChanged
|
||||||
|
{
|
||||||
|
public event PropertyChangedEventHandler PropertyChanged;
|
||||||
|
|
||||||
|
public string Category { get; set; }
|
||||||
|
private int _quantity;
|
||||||
|
public int Quantity
|
||||||
|
{
|
||||||
|
get => _quantity;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
_quantity = value;
|
||||||
|
PropertyChanged?.Invoke(this,
|
||||||
|
new PropertyChangedEventArgs(nameof(Quantity)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
@using log4net;
|
@using log4net;
|
||||||
<style>
|
<style>
|
||||||
.rz-custom-header {
|
.rz-custom-header {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
<RadzenStack Orientation="Orientation.Horizontal">
|
<RadzenStack Orientation="Orientation.Horizontal">
|
||||||
|
|
@ -42,15 +42,15 @@
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
<RadzenDataGrid @ref="grid" Style="overflow:auto"
|
<RadzenDataGrid @ref="grid" Style="width:66vw; overflow:auto"
|
||||||
LoadData="@LoadData"
|
LoadData="@LoadData"
|
||||||
IsLoading="@isLoading"
|
IsLoading="@isLoading"
|
||||||
Count="@count"
|
Count="@count"
|
||||||
EmptyText="无数据"
|
EmptyText="无数据"
|
||||||
Data="@channels"
|
Data="@channels"
|
||||||
AllowColumnResize="true" AllowAlternatingRows="false"
|
AllowColumnResize="true" AllowAlternatingRows="false"
|
||||||
CellClick="@((DataGridCellMouseEventArgs<ChannelStock> args) => OnCellClick(args))"
|
CellClick="@((DataGridCellMouseEventArgs<ChannelStock> args) => OnCellClick(args))"
|
||||||
AllowPaging="true" PageSize="10" PagerHorizontalAlign="HorizontalAlign.Left" ShowPagingSummary="true" PagingSummaryFormat="{0}/{1} 共{2}条数据">
|
AllowPaging="true" PageSize="10" PagerHorizontalAlign="HorizontalAlign.Left" ShowPagingSummary="true" PagingSummaryFormat="{0}/{1} 共{2}条数据">
|
||||||
<HeaderTemplate>
|
<HeaderTemplate>
|
||||||
<RadzenRow JustifyContent="JustifyContent.End">
|
<RadzenRow JustifyContent="JustifyContent.End">
|
||||||
@if (status < 3)
|
@if (status < 3)
|
||||||
|
|
@ -68,29 +68,30 @@
|
||||||
</RadzenRow>
|
</RadzenRow>
|
||||||
</HeaderTemplate>
|
</HeaderTemplate>
|
||||||
<Columns>
|
<Columns>
|
||||||
<RadzenDataGridColumn Width="70px" Title="库位" Property="ColNo"></RadzenDataGridColumn>
|
<RadzenDataGridColumn Width="4vw" Title="库位" Property="ColNo"></RadzenDataGridColumn>
|
||||||
<RadzenDataGridColumn Width="130px" Title="药品名称" Property="Drug.DrugName">
|
<RadzenDataGridColumn Width="15vw" Title="药品名称" Property="Drug.DrugName">
|
||||||
<Template Context="channel">
|
<Template Context="channel">
|
||||||
<RadzenText TextStyle="TextStyle.Subtitle2" class="mb-0">@channel.Drug?.DrugName</RadzenText>
|
<RadzenText TextStyle="TextStyle.Subtitle2" class="mb-0">@channel.Drug?.DrugName</RadzenText>
|
||||||
<RadzenText TextStyle="TextStyle.Caption">@channel.Drug?.DrugSpec</RadzenText>
|
<RadzenText TextStyle="TextStyle.Caption">@channel.Drug?.DrugSpec</RadzenText>
|
||||||
</Template>
|
</Template>
|
||||||
</RadzenDataGridColumn>
|
</RadzenDataGridColumn>
|
||||||
<RadzenDataGridColumn Width="110px" Title="批次" Property="ManuNo">
|
<RadzenDataGridColumn Width="15vw" Title="批次" Property="ManuNo">
|
||||||
<Template Context="channel">
|
<Template Context="channel">
|
||||||
<RadzenText TextStyle="TextStyle.Subtitle2" class="mb-0">@channel.drugManuNo?.ManuNo</RadzenText>
|
@* <RadzenText TextStyle="TextStyle.Subtitle2" class="mb-0">@channel.drugManuNo?.ManuNo</RadzenText> *@
|
||||||
|
<RadzenText TextStyle="TextStyle.Subtitle2" class="mb-0">@channel.ManuNo</RadzenText>
|
||||||
|
|
||||||
@if (channel.drugManuNo != null && channel.drugManuNo.EffDate.ToString().Length > 10)
|
@* @if (channel.drugManuNo != null && channel.drugManuNo.EffDate.ToString().Length > 10)
|
||||||
{
|
{
|
||||||
<RadzenText TextStyle="TextStyle.Caption">
|
<RadzenText TextStyle="TextStyle.Caption">
|
||||||
@channel.drugManuNo.EffDate.ToString().Substring(0, 10)
|
@channel.drugManuNo.EffDate.ToString().Substring(0, 10)
|
||||||
</RadzenText>
|
</RadzenText>
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{ *@
|
||||||
<RadzenText TextStyle="TextStyle.Caption">
|
<RadzenText TextStyle="TextStyle.Caption">
|
||||||
@channel.drugManuNo?.EffDate
|
@channel.EffDate
|
||||||
</RadzenText>
|
</RadzenText>
|
||||||
}
|
@* } *@
|
||||||
</Template>
|
</Template>
|
||||||
<EditTemplate Context="channel">
|
<EditTemplate Context="channel">
|
||||||
|
|
||||||
|
|
@ -136,12 +137,17 @@
|
||||||
}
|
}
|
||||||
</EditTemplate>
|
</EditTemplate>
|
||||||
</RadzenDataGridColumn>
|
</RadzenDataGridColumn>
|
||||||
<RadzenDataGridColumn Title="库存" Width="60px" Property="Quantity">
|
<RadzenDataGridColumn Title="库存" Width="10vw" Property="Quantity">
|
||||||
<Template Context="cs">
|
<Template Context="cs">
|
||||||
<RadzenButton ButtonStyle="ButtonStyle.Info" Variant="Variant.Flat" Shade="Shade.Lighter" class="m-1" Text="@cs.Quantity.ToString()" />
|
<RadzenButton ButtonStyle="ButtonStyle.Info" Variant="Variant.Flat" Shade="Shade.Lighter" class="m-1" Text="@cs.Quantity.ToString()" />
|
||||||
</Template>
|
</Template>
|
||||||
</RadzenDataGridColumn>
|
</RadzenDataGridColumn>
|
||||||
<RadzenDataGridColumn MinWidth="100px" Title="加药数量" Property="AddQuantity">
|
<RadzenDataGridColumn MinWidth="15vw" Title="加药数量" Property="AddQuantity">
|
||||||
|
<HeaderTemplate>
|
||||||
|
<div style="text-align: center;">
|
||||||
|
加药<br>数量
|
||||||
|
</div>
|
||||||
|
</HeaderTemplate>
|
||||||
<EditTemplate Context="cs">
|
<EditTemplate Context="cs">
|
||||||
@if (cs.BoardType.ToString().Contains("2") || cs.BoardType.ToString().Contains("3"))
|
@if (cs.BoardType.ToString().Contains("2") || cs.BoardType.ToString().Contains("3"))
|
||||||
{
|
{
|
||||||
|
|
@ -197,8 +203,10 @@
|
||||||
}
|
}
|
||||||
async Task OpenDrawer()
|
async Task OpenDrawer()
|
||||||
{
|
{
|
||||||
PortUtil.DrawerNo = this.drawerNo;
|
|
||||||
this.status = 1;
|
this.status = 1;
|
||||||
|
PortUtil.PowerOn();
|
||||||
|
await Task.Delay(200);
|
||||||
|
PortUtil.DrawerNo = this.drawerNo;
|
||||||
// 根据抽屉类型来决定打开前是否需要查询数量
|
// 根据抽屉类型来决定打开前是否需要查询数量
|
||||||
var promiseUtil = new PromiseUtil<object>();
|
var promiseUtil = new PromiseUtil<object>();
|
||||||
await promiseUtil.taskAsyncLoop(500, null, async (data, next, stop) =>
|
await promiseUtil.taskAsyncLoop(500, null, async (data, next, stop) =>
|
||||||
|
|
@ -338,16 +346,18 @@
|
||||||
);
|
);
|
||||||
if (setting.Value.single != null && setting.Value.single.Contains(this.drawerNo))
|
if (setting.Value.single != null && setting.Value.single.Contains(this.drawerNo))
|
||||||
{
|
{
|
||||||
PortUtil.AllLightOff();
|
PortUtil.PowerOff();
|
||||||
}
|
}
|
||||||
RestData();
|
RestData();
|
||||||
stop();
|
stop();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
PortUtil.PowerOff();
|
||||||
}
|
}
|
||||||
|
|
||||||
void RestData()
|
void RestData()
|
||||||
{
|
{
|
||||||
|
PortUtil.PowerOff();
|
||||||
PortUtil.speechSynthesizer.SpeakAsyncCancelAll();
|
PortUtil.speechSynthesizer.SpeakAsyncCancelAll();
|
||||||
this.status = 0;
|
this.status = 0;
|
||||||
this.BeforeQuantity = new int[9];
|
this.BeforeQuantity = new int[9];
|
||||||
|
|
@ -445,7 +455,7 @@
|
||||||
if (channels.Any(cl => cl.AddQuantity != 0 && cl.DrugId != null && cl.drugManuNo != null))
|
if (channels.Any(cl => cl.AddQuantity != 0 && cl.DrugId != null && cl.drugManuNo != null))
|
||||||
{
|
{
|
||||||
// 保存账册、操作记录
|
// 保存账册、操作记录
|
||||||
var b = await channelListDao.DrawerOperationFinish(channels.Where(cl => cl.AddQuantity != 0).ToList(), 1);
|
var b = await channelListDao.DrawerOperationFinish(channels.Where(cl => cl.AddQuantity != 0).ToList(), 1,null,null);
|
||||||
if (!b)
|
if (!b)
|
||||||
{
|
{
|
||||||
_message.Notify(new NotificationMessage { Severity = NotificationSeverity.Error, Summary = "提示", Detail = $"数据保存失败", Duration = 4000 });
|
_message.Notify(new NotificationMessage { Severity = NotificationSeverity.Error, Summary = "提示", Detail = $"数据保存失败", Duration = 4000 });
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
@using log4net;
|
@using log4net;
|
||||||
<style>
|
<style>
|
||||||
.rz-custom-header {
|
.rz-custom-header {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
<RadzenStack Orientation="Orientation.Horizontal">
|
<RadzenStack Orientation="Orientation.Horizontal">
|
||||||
|
|
@ -17,14 +17,8 @@
|
||||||
<div class="row justify-content-around align-items-center" style="margin-top: 220px; height: 430px;">
|
<div class="row justify-content-around align-items-center" style="margin-top: 220px; height: 430px;">
|
||||||
@foreach (int i in DrawerNos)
|
@foreach (int i in DrawerNos)
|
||||||
{
|
{
|
||||||
if (setting.Value.returnDrawer != null && setting.Value.returnDrawer.Contains(i))
|
<RadzenButton class="col-5" Click="@(() => SelectDrawer(i))" Text="@i.ToString()" Disabled="@(status > 0)" Shade="Shade.Light" Variant="@(drawerNo !=i ? Variant.Outlined : Variant.Flat)" />
|
||||||
{
|
|
||||||
<RadzenButton class="col-5" Click="@(() => SelectDrawer(i))" Text="@i.ToString()" Disabled="true" Shade="Shade.Light" Variant="@(drawerNo !=i ? Variant.Outlined : Variant.Flat)" Style="background-color: #d3d3d3;" />
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
<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>
|
</div>
|
||||||
|
|
@ -42,23 +36,65 @@
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
<RadzenDataGrid @ref="grid" Style="overflow:auto"
|
<RadzenDataGrid @ref="grid" Style="width:66vw; overflow:auto"
|
||||||
LoadData="@LoadData"
|
LoadData="@LoadData"
|
||||||
IsLoading="@isLoading"
|
IsLoading="@isLoading"
|
||||||
Count="@count"
|
Count="@count"
|
||||||
EmptyText="无数据"
|
EmptyText="无数据"
|
||||||
Data="@channels"
|
Data="@channels"
|
||||||
AllowColumnResize="true" AllowAlternatingRows="false"
|
AllowColumnResize="true" AllowAlternatingRows="false"
|
||||||
CellClick="@((DataGridCellMouseEventArgs<ChannelStock> args) => OnCellClick(args))"
|
CellClick="@((DataGridCellMouseEventArgs<ChannelStock> args) => OnCellClick(args))"
|
||||||
AllowPaging="true" PageSize="10" PagerHorizontalAlign="HorizontalAlign.Left" ShowPagingSummary="true" PagingSummaryFormat="{0}/{1} 共{2}条数据">
|
AllowPaging="true" PageSize="10" PagerHorizontalAlign="HorizontalAlign.Left" ShowPagingSummary="true" PagingSummaryFormat="{0}/{1} 共{2}条数据">
|
||||||
<HeaderTemplate>
|
<HeaderTemplate>
|
||||||
<RadzenRow JustifyContent="JustifyContent.End">
|
<RadzenRow JustifyContent="JustifyContent.End">
|
||||||
@if (status < 3)
|
@if (status < 3)
|
||||||
{
|
{
|
||||||
<RadzenButton IsBusy="@(status>0)" BusyText="取药中。。。" ButtonStyle="ButtonStyle.Warning" Variant="Variant.Flat" Shade="Shade.Light" Text="取药" Click="@OpenDrawer" />
|
if (setting.Value.returnDrawer != null && setting.Value.returnDrawer.Contains(drawerNo))
|
||||||
|
{
|
||||||
|
|
||||||
|
<RadzenButton IsBusy="@(status>0)" BusyText="取空瓶中。。。" ButtonStyle="ButtonStyle.Warning" Variant="Variant.Flat" Shade="Shade.Light" Text="取空瓶" Click="@OpenDrawer" />
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
<RadzenButton IsBusy="@(status>0)" BusyText="取药中。。。" ButtonStyle="ButtonStyle.Warning" Variant="Variant.Flat" Shade="Shade.Light" Text="取药" Click="@OpenDrawer" />
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@if (status == 3)
|
@if (status == 3)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
if (setting.Value.returnDrawer != null && setting.Value.returnDrawer.Contains(drawerNo))
|
||||||
|
{ }
|
||||||
|
else
|
||||||
|
{
|
||||||
|
<RadzenLabel Text="入库药箱" Component="BoxList" />
|
||||||
|
<RadzenDropDownDataGrid AllowVirtualization="true" Name="BoxColorList" TValue="BoxModel" Data="@BoxColorList" Value="BoxColor" Style="width: 7vw;"
|
||||||
|
ValueChanged="@((args) => OnColorChanged(args))" AllowFiltering="false"
|
||||||
|
AllowFilteringByAllStringColumns="true" TextProperty="药箱号">
|
||||||
|
<Template>
|
||||||
|
@((context as BoxModel).BoxNo == 1 ? "白" : (context as BoxModel).BoxNo == 3 ? "非常规" : "绿")
|
||||||
|
</Template>
|
||||||
|
<Columns>
|
||||||
|
<RadzenDropDownDataGridColumn Property="BoxNo" Title="药箱颜色" Sortable="false" />
|
||||||
|
</Columns>
|
||||||
|
</RadzenDropDownDataGrid>
|
||||||
|
<RadzenDropDownDataGrid AllowVirtualization="true" Name="BoxList" TValue="BoxModel" Data="@BoxList" Value="BoxNum" Style="width: 15vw;"
|
||||||
|
ValueChanged="@((args) => OnBoxChanged(args))" AllowFilteringByAllStringColumns="true" TextProperty="药箱号">
|
||||||
|
<Template>
|
||||||
|
|
||||||
|
@(
|
||||||
|
(context as BoxModel).BoxName == 99 ? "急诊药盒" : (context as BoxModel).BoxName == 111 ? "恢复室药盒" :
|
||||||
|
(context as BoxModel).BoxName == 31 ? "胃镜药盒" :
|
||||||
|
(context as BoxModel).BoxName == 32 ? "导管药盒" :
|
||||||
|
(context as BoxModel).BoxName == 33 ? "生殖药盒" :
|
||||||
|
(context as BoxModel).BoxName == 34 ? "妇门药盒" : (context as BoxModel).BoxName + "-" + ((context as BoxModel).BoxNo == 1 ? "白" : "绿")
|
||||||
|
)
|
||||||
|
|
||||||
|
</Template>
|
||||||
|
<Columns>
|
||||||
|
<RadzenDropDownDataGridColumn Property="BoxName" Title="药箱号" Sortable="false" />
|
||||||
|
</Columns>
|
||||||
|
</RadzenDropDownDataGrid>
|
||||||
|
}
|
||||||
<RadzenButton Visible="@CompleteIsEnable" ButtonStyle="ButtonStyle.Warning" Variant="Variant.Flat" Shade="Shade.Light" Text="完成" Click="@TakeFinish" />
|
<RadzenButton Visible="@CompleteIsEnable" ButtonStyle="ButtonStyle.Warning" Variant="Variant.Flat" Shade="Shade.Light" Text="完成" Click="@TakeFinish" />
|
||||||
}
|
}
|
||||||
@if (status > 0 && status <= 3)
|
@if (status > 0 && status <= 3)
|
||||||
|
|
@ -68,25 +104,30 @@
|
||||||
</RadzenRow>
|
</RadzenRow>
|
||||||
</HeaderTemplate>
|
</HeaderTemplate>
|
||||||
<Columns>
|
<Columns>
|
||||||
<RadzenDataGridColumn Width="70px" Title="库位" Property="ColNo"></RadzenDataGridColumn>
|
<RadzenDataGridColumn Width="4vw" Title="库位" Property="ColNo"></RadzenDataGridColumn>
|
||||||
<RadzenDataGridColumn Width="130px" Title="药品名称" Property="Drug.DrugName">
|
<RadzenDataGridColumn Width="15vw" Title="药品名称" Property="Drug.DrugName">
|
||||||
<Template Context="channel">
|
<Template Context="channel">
|
||||||
<RadzenText TextStyle="TextStyle.Subtitle2" class="mb-0">@channel.Drug?.DrugName</RadzenText>
|
<RadzenText TextStyle="TextStyle.Subtitle2" class="mb-0">@channel.Drug?.DrugName</RadzenText>
|
||||||
<RadzenText TextStyle="TextStyle.Caption">@channel.Drug?.DrugSpec</RadzenText>
|
<RadzenText TextStyle="TextStyle.Caption">@channel.Drug?.DrugSpec</RadzenText>
|
||||||
</Template>
|
</Template>
|
||||||
</RadzenDataGridColumn>
|
</RadzenDataGridColumn>
|
||||||
<RadzenDataGridColumn Width="110px" Title="批次" Property="ManuNo">
|
<RadzenDataGridColumn Width="15vw" Title="批次" Property="ManuNo">
|
||||||
<Template Context="channel">
|
<Template Context="channel">
|
||||||
<RadzenText TextStyle="TextStyle.Subtitle2" class="mb-0">@channel.ManuNo</RadzenText>
|
<RadzenText TextStyle="TextStyle.Subtitle2" class="mb-0">@channel.ManuNo</RadzenText>
|
||||||
<RadzenText TextStyle="TextStyle.Caption">@channel.EffDate</RadzenText>
|
<RadzenText TextStyle="TextStyle.Caption">@channel.EffDate</RadzenText>
|
||||||
</Template>
|
</Template>
|
||||||
</RadzenDataGridColumn>
|
</RadzenDataGridColumn>
|
||||||
<RadzenDataGridColumn Title="库存" Width="60px" Property="Quantity">
|
<RadzenDataGridColumn Title="库存" Width="10vw" Property="Quantity">
|
||||||
<Template Context="channel">
|
<Template Context="channel">
|
||||||
<RadzenButton ButtonStyle="ButtonStyle.Info" Size="ButtonSize.Medium" Variant="Variant.Flat" Shade="Shade.Lighter" class="m-1" Text="@channel.Quantity.ToString()" />
|
<RadzenButton ButtonStyle="ButtonStyle.Info" Size="ButtonSize.Medium" Variant="Variant.Flat" Shade="Shade.Lighter" class="m-1" Text="@channel.Quantity.ToString()" />
|
||||||
</Template>
|
</Template>
|
||||||
</RadzenDataGridColumn>
|
</RadzenDataGridColumn>
|
||||||
<RadzenDataGridColumn MinWidth="100px" Title="取药数量" Property="TakeQuantity">
|
<RadzenDataGridColumn MinWidth="15vw" Title="取药数量" Property="TakeQuantity">
|
||||||
|
<HeaderTemplate>
|
||||||
|
<div style="text-align: center;">
|
||||||
|
取药<br>数量
|
||||||
|
</div>
|
||||||
|
</HeaderTemplate>
|
||||||
<EditTemplate Context="channel">
|
<EditTemplate Context="channel">
|
||||||
@if (channel.BoardType.ToString().Contains("2") || channel.BoardType.ToString().Contains("3"))
|
@if (channel.BoardType.ToString().Contains("2") || channel.BoardType.ToString().Contains("3"))
|
||||||
{
|
{
|
||||||
|
|
@ -109,6 +150,8 @@
|
||||||
@inject PortUtil PortUtil;
|
@inject PortUtil PortUtil;
|
||||||
@inject NotificationService _message
|
@inject NotificationService _message
|
||||||
@inject IOptions<DrawerConfig> setting;
|
@inject IOptions<DrawerConfig> setting;
|
||||||
|
|
||||||
|
@inject IOrderInfoDao orderInfoDao;
|
||||||
int status = 0;
|
int status = 0;
|
||||||
int drawerNo = 1;
|
int drawerNo = 1;
|
||||||
RadzenDataGrid<ChannelStock> grid;
|
RadzenDataGrid<ChannelStock> grid;
|
||||||
|
|
@ -125,12 +168,33 @@
|
||||||
bool CompleteIsEnable = true;
|
bool CompleteIsEnable = true;
|
||||||
bool CancleIsEnable = true;
|
bool CancleIsEnable = true;
|
||||||
|
|
||||||
private readonly ILog logger = LogManager.GetLogger(typeof(DrawerTake));
|
BoxModel BoxNum;
|
||||||
|
|
||||||
|
|
||||||
|
BoxModel BoxColor;
|
||||||
|
//全部药盒集合
|
||||||
|
List<BoxModel> AllBoxList = new List<BoxModel>();
|
||||||
|
//药盒集合
|
||||||
|
List<BoxModel> BoxList = new List<BoxModel>();
|
||||||
|
//药盒颜色集合
|
||||||
|
List<BoxModel> BoxColorList = new List<BoxModel>()
|
||||||
|
{
|
||||||
|
new BoxModel{BoxNo=1,BoxName=1 },
|
||||||
|
new BoxModel{BoxNo=2 ,BoxName=1},
|
||||||
|
new BoxModel{BoxNo=3 ,BoxName=1}
|
||||||
|
};
|
||||||
|
private readonly ILog logger = LogManager.GetLogger(typeof(DrawerTake));
|
||||||
|
protected override async Task OnInitializedAsync()
|
||||||
|
{
|
||||||
|
BoxColor = BoxColorList.FirstOrDefault();
|
||||||
|
AllBoxList = await orderInfoDao.GetOperationNum(0);
|
||||||
|
BoxList = AllBoxList.Where(bl => bl.BoxNo == BoxColor.BoxNo && bl.BoxName <= 30).ToList();
|
||||||
|
BoxNum = AllBoxList.FirstOrDefault();
|
||||||
|
await base.OnInitializedAsync();
|
||||||
|
}
|
||||||
async Task LoadData(LoadDataArgs args)
|
async Task LoadData(LoadDataArgs args)
|
||||||
{
|
{
|
||||||
isLoading = true;
|
isLoading = true;
|
||||||
|
|
||||||
// var result = await channelListDao.GetChannelStockByDrawerNo(drawerNo, 1);
|
// var result = await channelListDao.GetChannelStockByDrawerNo(drawerNo, 1);
|
||||||
var result = await channelListDao.GetChannelStockByDrawerNoWithDrawers(drawerNo, 1);
|
var result = await channelListDao.GetChannelStockByDrawerNoWithDrawers(drawerNo, 1);
|
||||||
DrawerNos = result.DrawerArray;
|
DrawerNos = result.DrawerArray;
|
||||||
|
|
@ -142,10 +206,32 @@
|
||||||
|
|
||||||
isLoading = false;
|
isLoading = false;
|
||||||
}
|
}
|
||||||
|
private async Task OnColorChanged(object value)
|
||||||
|
{
|
||||||
|
if ((((BoxModel)value).BoxNo) == 3)
|
||||||
|
{
|
||||||
|
BoxList = AllBoxList.Where(bl => bl.BoxName > 30).ToList();
|
||||||
|
BoxNum = BoxList.FirstOrDefault();
|
||||||
|
await InvokeAsync(StateHasChanged);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
BoxList = AllBoxList.Where(bl => bl.BoxNo == ((BoxModel)value).BoxNo && bl.BoxName <= 30).ToList();
|
||||||
|
BoxNum = BoxList.FirstOrDefault();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//药箱选中修改
|
||||||
|
private async Task OnBoxChanged(object value)
|
||||||
|
{
|
||||||
|
// BoxList = BoxList.Where(bl => bl.BoxNo == ((BoxModel)value).BoxNo && bl.BoxName == ((BoxModel)value).BoxName).ToList();
|
||||||
|
BoxNum = (BoxModel)value;
|
||||||
|
}
|
||||||
async Task OpenDrawer()
|
async Task OpenDrawer()
|
||||||
{
|
{
|
||||||
PortUtil.DrawerNo = this.drawerNo;
|
|
||||||
this.status = 1;
|
this.status = 1;
|
||||||
|
PortUtil.PowerOn();
|
||||||
|
await Task.Delay(200);
|
||||||
|
PortUtil.DrawerNo = this.drawerNo;
|
||||||
// 根据抽屉类型来决定打开前是否需要查询数量
|
// 根据抽屉类型来决定打开前是否需要查询数量
|
||||||
var promiseUtil = new PromiseUtil<object>();
|
var promiseUtil = new PromiseUtil<object>();
|
||||||
await promiseUtil.taskAsyncLoop(500, null, async (data, next, stop) =>
|
await promiseUtil.taskAsyncLoop(500, null, async (data, next, stop) =>
|
||||||
|
|
@ -171,7 +257,15 @@
|
||||||
if (b)
|
if (b)
|
||||||
{
|
{
|
||||||
PortUtil.speechSynthesizer.SpeakAsyncCancelAll();
|
PortUtil.speechSynthesizer.SpeakAsyncCancelAll();
|
||||||
PortUtil.SpeakAsync($"{drawerNo}号抽屉已经打开,请,取药");
|
|
||||||
|
if (setting.Value.returnDrawer != null && setting.Value.returnDrawer.Contains(drawerNo))
|
||||||
|
{
|
||||||
|
PortUtil.SpeakAsync($"{drawerNo}号抽屉已经打开,请,取空瓶");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
PortUtil.SpeakAsync($"{drawerNo}号抽屉已经打开,请,取药");
|
||||||
|
}
|
||||||
PortUtil.Operate = true;
|
PortUtil.Operate = true;
|
||||||
this.status = 2;
|
this.status = 2;
|
||||||
next();
|
next();
|
||||||
|
|
@ -196,7 +290,15 @@
|
||||||
if (b)
|
if (b)
|
||||||
{
|
{
|
||||||
PortUtil.speechSynthesizer.SpeakAsyncCancelAll();
|
PortUtil.speechSynthesizer.SpeakAsyncCancelAll();
|
||||||
|
if (setting.Value.returnDrawer != null && setting.Value.returnDrawer.Contains(drawerNo))
|
||||||
|
{
|
||||||
|
|
||||||
|
PortUtil.SpeakAsync($"取空瓶完成,请核对或录入正确的取出数量");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
PortUtil.SpeakAsync($"取药完成,请核对或录入正确的取出数量");
|
PortUtil.SpeakAsync($"取药完成,请核对或录入正确的取出数量");
|
||||||
|
}
|
||||||
// 判断是否为称重抽屉
|
// 判断是否为称重抽屉
|
||||||
if (setting.Value.weigh != null && setting.Value.weigh.Contains(this.drawerNo))
|
if (setting.Value.weigh != null && setting.Value.weigh.Contains(this.drawerNo))
|
||||||
{
|
{
|
||||||
|
|
@ -281,12 +383,13 @@
|
||||||
);
|
);
|
||||||
if (setting.Value.single.Contains(this.drawerNo))
|
if (setting.Value.single.Contains(this.drawerNo))
|
||||||
{
|
{
|
||||||
PortUtil.AllLightOff();
|
PortUtil.PowerOff();
|
||||||
}
|
}
|
||||||
RestData();
|
RestData();
|
||||||
stop();
|
stop();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
PortUtil.PowerOff();
|
||||||
}
|
}
|
||||||
//关闭抽屉后获取称重稳定数量
|
//关闭抽屉后获取称重稳定数量
|
||||||
public async Task GetWeightQuantity()
|
public async Task GetWeightQuantity()
|
||||||
|
|
@ -384,6 +487,7 @@
|
||||||
}
|
}
|
||||||
void RestData()
|
void RestData()
|
||||||
{
|
{
|
||||||
|
PortUtil.PowerOff();
|
||||||
PortUtil.speechSynthesizer.SpeakAsyncCancelAll();
|
PortUtil.speechSynthesizer.SpeakAsyncCancelAll();
|
||||||
this.status = 0;
|
this.status = 0;
|
||||||
this.BeforeQuantity = new int[9];
|
this.BeforeQuantity = new int[9];
|
||||||
|
|
@ -398,9 +502,24 @@
|
||||||
{
|
{
|
||||||
if (channels.Any(cl => cl.TakeQuantity != 0))
|
if (channels.Any(cl => cl.TakeQuantity != 0))
|
||||||
{
|
{
|
||||||
|
CheckInfo<ChannelList> checkInfo = null;
|
||||||
|
// if(BoxNum!=null&&BoxNum.BoxNo!=0)
|
||||||
|
// {
|
||||||
|
// //查询本次加药的药盒里是否有绑该药,有则正常入库,无则提示无绑定不可添加
|
||||||
|
// checkInfo = await channelListDao.CheckBoxDrugInfo(BoxNum, channels.Where(cl => cl.TakeQuantity != 0).ToList());
|
||||||
|
// if (!string.IsNullOrEmpty(checkInfo.StrInfo))
|
||||||
|
// {
|
||||||
|
// _message.Notify(new NotificationMessage { Severity = NotificationSeverity.Error, Summary = "提示", Detail = $"该药盒中未绑定该批次药品无法添加", Duration = 4000 });
|
||||||
|
// logger.Error($"该药盒中未绑定该批次药品无法添加,数据{JsonConvert.SerializeObject(channels)}");
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
if (setting.Value.returnDrawer != null && setting.Value.returnDrawer.Contains(drawerNo))
|
||||||
|
{
|
||||||
|
BoxNum = null;
|
||||||
|
}
|
||||||
// 保存账册、操作记录
|
// 保存账册、操作记录
|
||||||
var b = await channelListDao.DrawerOperationFinish(channels.Where(cl => cl.TakeQuantity != 0).ToList(), 2);
|
var b = await channelListDao.DrawerOperationFinish(channels.Where(cl => cl.TakeQuantity != 0).ToList(), 2, BoxNum, null);
|
||||||
if (!b)
|
if (!b)
|
||||||
{
|
{
|
||||||
_message.Notify(new NotificationMessage { Severity = NotificationSeverity.Error, Summary = "提示", Detail = $"数据保存失败", Duration = 4000 });
|
_message.Notify(new NotificationMessage { Severity = NotificationSeverity.Error, Summary = "提示", Detail = $"数据保存失败", Duration = 4000 });
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
@page "/stock/drug"
|
@page "/stock/drug"
|
||||||
<style>
|
<style>
|
||||||
.rz-custom-header {
|
.rz-custom-header {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
|
|
@ -42,15 +42,15 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="col-6 mb-4" style="height:55vh;overflow:auto;">
|
<div class="col-6 mb-4" style="height:55vh;overflow:auto;">
|
||||||
<RadzenDataGrid @ref="grid"
|
<RadzenDataGrid @ref="grid"
|
||||||
LoadData="@LoadData"
|
LoadData="@LoadData"
|
||||||
@bind-Value="@SelectedDrugs"
|
@bind-Value="@SelectedDrugs"
|
||||||
IsLoading="@isLoading"
|
IsLoading="@isLoading"
|
||||||
Count="@count"
|
Count="@count"
|
||||||
EmptyText="无数据"
|
EmptyText="无数据"
|
||||||
Data="@_forecasts"
|
Data="@_forecasts"
|
||||||
AllowColumnResize="true" AllowAlternatingRows="false"
|
AllowColumnResize="true" AllowAlternatingRows="false"
|
||||||
SelectionMode="DataGridSelectionMode.Single" RowUpdate="@((DrugInfo di)=>{OnDrugUpdateRow(di);})" RowCreate="@((DrugInfo di)=>{OnDrugCreateRow(di);})"
|
SelectionMode="DataGridSelectionMode.Single" RowUpdate="@((DrugInfo di)=>{OnDrugUpdateRow(di);})" RowCreate="@((DrugInfo di)=>{OnDrugCreateRow(di);})"
|
||||||
AllowPaging="true" PageSize="5" PagerHorizontalAlign="HorizontalAlign.Left" ColumnWidth="100px" ShowPagingSummary="true" PagingSummaryFormat="{0}/{1} 共{2}条数据">
|
AllowPaging="true" PageSize="5" PagerHorizontalAlign="HorizontalAlign.Left" ColumnWidth="100px" ShowPagingSummary="true" PagingSummaryFormat="{0}/{1} 共{2}条数据">
|
||||||
<Columns>
|
<Columns>
|
||||||
<RadzenDataGridColumn Title="编码" Property="DrugId">
|
<RadzenDataGridColumn Title="编码" Property="DrugId">
|
||||||
<EditTemplate Context="drugInfo">
|
<EditTemplate Context="drugInfo">
|
||||||
|
|
@ -61,19 +61,19 @@
|
||||||
<RadzenDataGridColumn Width="200px" Title="药品名称" Property="DrugName">
|
<RadzenDataGridColumn Width="200px" Title="药品名称" Property="DrugName">
|
||||||
<EditTemplate Context="drugInfo">
|
<EditTemplate Context="drugInfo">
|
||||||
<RadzenTextBox Name="DrugName" @bind-Value="drugInfo.DrugName" Style="width:100%;display:block;" />
|
<RadzenTextBox Name="DrugName" @bind-Value="drugInfo.DrugName" Style="width:100%;display:block;" />
|
||||||
<RadzenRequiredValidator Text="请填写药品名称" Component="DrugName" Popup="true"/>
|
<RadzenRequiredValidator Text="请填写药品名称" Component="DrugName" Popup="true" />
|
||||||
</EditTemplate>
|
</EditTemplate>
|
||||||
</RadzenDataGridColumn>
|
</RadzenDataGridColumn>
|
||||||
<RadzenDataGridColumn Title="规格" Property="DrugSpec">
|
<RadzenDataGridColumn Title="规格" Property="DrugSpec">
|
||||||
<EditTemplate Context="drugInfo">
|
<EditTemplate Context="drugInfo">
|
||||||
<RadzenTextBox Name="DrugSpec" @bind-Value="drugInfo.DrugSpec" Style="width:100%;display:block;" />
|
<RadzenTextBox Name="DrugSpec" @bind-Value="drugInfo.DrugSpec" Style="width:100%;display:block;" />
|
||||||
<RadzenRequiredValidator Text="请填写规格" Component="DrugSpec" Popup="true"/>
|
<RadzenRequiredValidator Text="请填写规格" Component="DrugSpec" Popup="true" />
|
||||||
</EditTemplate>
|
</EditTemplate>
|
||||||
</RadzenDataGridColumn>
|
</RadzenDataGridColumn>
|
||||||
<RadzenDataGridColumn Width="150px" Title="厂家" Property="Manufactory">
|
<RadzenDataGridColumn Width="150px" Title="厂家" Property="Manufactory">
|
||||||
<EditTemplate Context="drugInfo">
|
<EditTemplate Context="drugInfo">
|
||||||
<RadzenTextBox Name="Manufactory" @bind-Value="drugInfo.Manufactory" Style="width:100%;display:block;" />
|
<RadzenTextBox Name="Manufactory" @bind-Value="drugInfo.Manufactory" Style="width:100%;display:block;" />
|
||||||
<RadzenRequiredValidator Text="请填写厂家" Component="Manufactory" Popup="true"/>
|
<RadzenRequiredValidator Text="请填写厂家" Component="Manufactory" Popup="true" />
|
||||||
</EditTemplate>
|
</EditTemplate>
|
||||||
</RadzenDataGridColumn>
|
</RadzenDataGridColumn>
|
||||||
<RadzenDataGridColumn Title="导出使用报表" Property="PackH">
|
<RadzenDataGridColumn Title="导出使用报表" Property="PackH">
|
||||||
|
|
@ -107,52 +107,55 @@
|
||||||
</RadzenCard> *@
|
</RadzenCard> *@
|
||||||
@if (SelectedDrugs.Count > 0)
|
@if (SelectedDrugs.Count > 0)
|
||||||
{
|
{
|
||||||
<RadzenDataGrid @ref="ManusGrid" EmptyText="无数据"
|
|
||||||
Data="@(SelectedDrugs.FirstOrDefault()?.Manus)"
|
<div class="col-6 mb-4" style="height:55vh;width:550px;overflow:auto;">
|
||||||
RowUpdate="@((DrugManuNo dm) => { OnUpdateRow(dm); })" RowCreate="@((DrugManuNo dm) => { OnCreateRow(dm); })"
|
<RadzenDataGrid @ref="ManusGrid" EmptyText="无数据" ColumnWidth="100px" Style="width:445px"
|
||||||
AllowColumnResize="true" AllowAlternatingRows="false">
|
Data="@(SelectedDrugs.FirstOrDefault()?.Manus)"
|
||||||
@* <HeaderTemplate>
|
RowUpdate="@((DrugManuNo dm) => { OnUpdateRow(dm); })" RowCreate="@((DrugManuNo dm) => { OnCreateRow(dm); })"
|
||||||
|
AllowColumnResize="true" AllowAlternatingRows="false">
|
||||||
|
@* <HeaderTemplate>
|
||||||
<RadzenRow JustifyContent="JustifyContent.End" AlignItems="AlignItems.Center">
|
<RadzenRow JustifyContent="JustifyContent.End" AlignItems="AlignItems.Center">
|
||||||
<RadzenButton Icon="download" Text="添加" Variant="Variant.Outlined" />
|
<RadzenButton Icon="download" Text="添加" Variant="Variant.Outlined" />
|
||||||
</RadzenRow>
|
</RadzenRow>
|
||||||
</HeaderTemplate> *@
|
</HeaderTemplate> *@
|
||||||
<Columns>
|
<Columns>
|
||||||
<RadzenDataGridColumn Title="序号" Property="index">
|
<RadzenDataGridColumn Title="序号" Property="index" Width="25px" Visible=false>
|
||||||
<Template Context="data">
|
<Template Context="data">
|
||||||
@(SelectedDrugs.FirstOrDefault()?.Manus.IndexOf(data) + 1)
|
@(SelectedDrugs.FirstOrDefault()?.Manus.IndexOf(data) + 1)
|
||||||
</Template>
|
</Template>
|
||||||
</RadzenDataGridColumn>
|
</RadzenDataGridColumn>
|
||||||
<RadzenDataGridColumn Title="批次" Property="ManuNo">
|
<RadzenDataGridColumn Title="批次" Property="ManuNo" Width="150px">
|
||||||
<EditTemplate Context="drugManuNo">
|
<EditTemplate Context="drugManuNo">
|
||||||
<RadzenTextBox Name="ManuNo" @bind-Value="drugManuNo.ManuNo" Style="width:100%; display: block;" />
|
<RadzenTextBox Name="ManuNo" @bind-Value="drugManuNo.ManuNo" Style="width:100%; display: block;" />
|
||||||
<RadzenRequiredValidator Text="请填写批次" Component="ManuNo" Popup="true" />
|
<RadzenRequiredValidator Text="请填写批次" Component="ManuNo" Popup="true" />
|
||||||
</EditTemplate>
|
</EditTemplate>
|
||||||
</RadzenDataGridColumn>
|
</RadzenDataGridColumn>
|
||||||
<RadzenDataGridColumn Title="效期" Property="EffDate">
|
<RadzenDataGridColumn Title="效期" Property="EffDate" Width="150px">
|
||||||
<EditTemplate Context="drugManuNo">
|
<EditTemplate Context="drugManuNo">
|
||||||
<RadzenDatePicker DateFormat="yyyy-MM-dd" @bind-Value="drugManuNo.EffDate" Style="width: 100%;" Name="EffDate" />
|
<RadzenDatePicker DateFormat="yyyy-MM-dd" @bind-Value="drugManuNo.EffDate" Style="width: 100%;" Name="EffDate" />
|
||||||
<RadzenRequiredValidator Text="请填写效期" Component="EffDate" Popup="true" />
|
<RadzenRequiredValidator Text="请填写效期" Component="EffDate" Popup="true" />
|
||||||
</EditTemplate>
|
</EditTemplate>
|
||||||
</RadzenDataGridColumn>
|
</RadzenDataGridColumn>
|
||||||
|
|
||||||
<RadzenDataGridColumn Context="drugManuNo" Title="操作" Filterable="false" Sortable="false" TextAlign="TextAlign.Left" Frozen="true" FrozenPosition="FrozenColumnPosition.Right">
|
<RadzenDataGridColumn Context="drugManuNo" Title="操作" Width="160px" Filterable="false" Sortable="false" TextAlign="TextAlign.Left" Frozen="true" FrozenPosition="FrozenColumnPosition.Right">
|
||||||
<Template Context="drugManuNo">
|
<Template Context="drugManuNo">
|
||||||
<RadzenButton Icon="edit" ButtonStyle="ButtonStyle.Light" Variant="Variant.Flat" Size="ButtonSize.Medium" Click="@(args => EditRow(drugManuNo))" @onclick:stopPropagation="true">
|
<RadzenButton Icon="edit" ButtonStyle="ButtonStyle.Light" Variant="Variant.Flat" Size="ButtonSize.Medium" Click="@(args => EditRow(drugManuNo))" @onclick:stopPropagation="true">
|
||||||
</RadzenButton>
|
</RadzenButton>
|
||||||
<RadzenButton ButtonStyle="ButtonStyle.Danger" Icon="delete" Variant="Variant.Flat" Shade="Shade.Lighter" Size="ButtonSize.Medium" class="my-1 ms-1" Click="@(args => DeleteRow(drugManuNo))" @onclick:stopPropagation="true">
|
<RadzenButton ButtonStyle="ButtonStyle.Danger" Icon="delete" Variant="Variant.Flat" Shade="Shade.Lighter" Size="ButtonSize.Medium" class="my-1 ms-1" Click="@(args => DeleteRow(drugManuNo))" @onclick:stopPropagation="true">
|
||||||
</RadzenButton>
|
</RadzenButton>
|
||||||
</Template>
|
</Template>
|
||||||
<EditTemplate Context="drugManuNo">
|
<EditTemplate Context="drugManuNo">
|
||||||
<RadzenButton Icon="check" ButtonStyle="ButtonStyle.Success" Variant="Variant.Flat" Size="ButtonSize.Medium" Click="@((args) => SaveRow(drugManuNo))" aria-label="Save">
|
<RadzenButton Icon="check" ButtonStyle="ButtonStyle.Success" Variant="Variant.Flat" Size="ButtonSize.Medium" Click="@((args) => SaveRow(drugManuNo))" aria-label="Save">
|
||||||
</RadzenButton>
|
</RadzenButton>
|
||||||
<RadzenButton Icon="close" ButtonStyle="ButtonStyle.Light" Variant="Variant.Flat" Size="ButtonSize.Medium" class="my-1 ms-1" Click="@((args) => CancelEdit(drugManuNo))" aria-label="Cancel">
|
<RadzenButton Icon="close" ButtonStyle="ButtonStyle.Light" Variant="Variant.Flat" Size="ButtonSize.Medium" class="my-1 ms-1" Click="@((args) => CancelEdit(drugManuNo))" aria-label="Cancel">
|
||||||
</RadzenButton>
|
</RadzenButton>
|
||||||
<RadzenButton ButtonStyle="ButtonStyle.Danger" Icon="delete" Variant="Variant.Flat" Shade="Shade.Lighter" Size="ButtonSize.Medium" class="my-1 ms-1" Click="@(args => DeleteRow(drugManuNo))" aria-label="Delete">
|
<RadzenButton ButtonStyle="ButtonStyle.Danger" Icon="delete" Variant="Variant.Flat" Shade="Shade.Lighter" Size="ButtonSize.Medium" class="my-1 ms-1" Click="@(args => DeleteRow(drugManuNo))" aria-label="Delete">
|
||||||
</RadzenButton>
|
</RadzenButton>
|
||||||
</EditTemplate>
|
</EditTemplate>
|
||||||
</RadzenDataGridColumn>
|
</RadzenDataGridColumn>
|
||||||
</Columns>
|
</Columns>
|
||||||
</RadzenDataGrid>
|
</RadzenDataGrid>
|
||||||
|
</div>
|
||||||
<div style="margin-top:5px">
|
<div style="margin-top:5px">
|
||||||
<RadzenButton Size="ButtonSize.Medium" ButtonStyle="ButtonStyle.Success" Icon="add_circle_outline" Click="@InsertRow" Text="新增批次" />
|
<RadzenButton Size="ButtonSize.Medium" ButtonStyle="ButtonStyle.Success" Icon="add_circle_outline" Click="@InsertRow" Text="新增批次" />
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -250,14 +253,14 @@
|
||||||
async Task DeleteDrugRow(DrugInfo drugInfo)
|
async Task DeleteDrugRow(DrugInfo drugInfo)
|
||||||
{
|
{
|
||||||
Reset();
|
Reset();
|
||||||
if(!string.IsNullOrEmpty(drugInfo.DrugId))
|
if (!string.IsNullOrEmpty(drugInfo.DrugId))
|
||||||
{
|
{
|
||||||
//弹出确认提示框
|
//弹出确认提示框
|
||||||
var b = await dialogService.OpenAsync<ConfirmDialog>(
|
var b = await dialogService.OpenAsync<ConfirmDialog>(
|
||||||
$"删除确认",
|
$"删除确认",
|
||||||
new Dictionary<string, object>() { { "confirmInfo", "确认要删除药品:"+drugInfo.DrugName+"吗?" } },
|
new Dictionary<string, object>() { { "confirmInfo", "确认要删除药品:" + drugInfo.DrugName + "吗?" } },
|
||||||
new DialogOptions() { Width = "45vw", Resizable = true, Draggable = true, ShowClose = false });
|
new DialogOptions() { Width = "45vw", Resizable = true, Draggable = true, ShowClose = false });
|
||||||
if(b)
|
if (b)
|
||||||
{
|
{
|
||||||
// 数据库删除
|
// 数据库删除
|
||||||
drugInfoDao.DeleteDrugInfo(drugInfo.DrugId);
|
drugInfoDao.DeleteDrugInfo(drugInfo.DrugId);
|
||||||
|
|
@ -293,8 +296,8 @@
|
||||||
|
|
||||||
void CancelEdit(DrugManuNo drugManuNo)
|
void CancelEdit(DrugManuNo drugManuNo)
|
||||||
{
|
{
|
||||||
Reset(drugManuNo);
|
// Reset(drugManuNo);
|
||||||
SelectedDrugs.FirstOrDefault().Manus.Remove(drugManuNo);
|
// SelectedDrugs.FirstOrDefault().Manus.Remove(drugManuNo);
|
||||||
ManusGrid.CancelEditRow(drugManuNo);
|
ManusGrid.CancelEditRow(drugManuNo);
|
||||||
ManusGrid.Reload();
|
ManusGrid.Reload();
|
||||||
}
|
}
|
||||||
|
|
@ -306,12 +309,12 @@
|
||||||
if (SelectedDrugs.FirstOrDefault().Manus.Contains(drugManuNo))
|
if (SelectedDrugs.FirstOrDefault().Manus.Contains(drugManuNo))
|
||||||
{
|
{
|
||||||
//弹出确认提示框
|
//弹出确认提示框
|
||||||
var b = await dialogService.OpenAsync<ConfirmDialog>(
|
var b = await dialogService.OpenAsync<ConfirmDialog>(
|
||||||
$"确认删除",
|
$"确认删除",
|
||||||
new Dictionary<string, object>() { { "confirmInfo", "确认要删除批次:"+drugManuNo.ManuNo+"吗?" } },
|
new Dictionary<string, object>() { { "confirmInfo", "确认要删除批次:" + drugManuNo.ManuNo + "吗?" } },
|
||||||
new DialogOptions() { Width = "45vw", Resizable = true, Draggable = true, ShowClose = false }
|
new DialogOptions() { Width = "45vw", Resizable = true, Draggable = true, ShowClose = false }
|
||||||
);
|
);
|
||||||
if(b)
|
if (b)
|
||||||
{
|
{
|
||||||
SelectedDrugs.FirstOrDefault().Manus.Remove(drugManuNo);
|
SelectedDrugs.FirstOrDefault().Manus.Remove(drugManuNo);
|
||||||
// 数据库删除
|
// 数据库删除
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@
|
||||||
<div class="container-fluid">
|
<div class="container-fluid">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-12 mb-4">
|
<div class="col-12 mb-4">
|
||||||
|
|
||||||
<form onsubmit="@(() => grid.Reload())">
|
<form onsubmit="@(() => grid.Reload())">
|
||||||
<RadzenFieldset Text="²éѯ">
|
<RadzenFieldset Text="²éѯ">
|
||||||
<RadzenStack Orientation="Orientation.Horizontal" Gap="1rem">
|
<RadzenStack Orientation="Orientation.Horizontal" Gap="1rem">
|
||||||
|
|
@ -24,10 +24,10 @@
|
||||||
<RadzenDatePicker DateFormat="yyyy-MM-dd" CurrentDateChanged="@OnCurrentDateChanged" @bind-Value="InvoiceDate" Style="width: 100%;" Name="InvoiceDate" />
|
<RadzenDatePicker DateFormat="yyyy-MM-dd" CurrentDateChanged="@OnCurrentDateChanged" @bind-Value="InvoiceDate" Style="width: 100%;" Name="InvoiceDate" />
|
||||||
</RadzenColumn>
|
</RadzenColumn>
|
||||||
</RadzenRow>
|
</RadzenRow>
|
||||||
|
|
||||||
<RadzenRow AlignItems="AlignItems.Center">
|
<RadzenRow AlignItems="AlignItems.Center">
|
||||||
<RadzenColumn Size="12">
|
<RadzenColumn Size="12">
|
||||||
<RadzenButton Size="ButtonSize.Large" ButtonType="ButtonType.Submit" IsBusy="isLoading" Icon="search" Text="查询" />
|
<RadzenButton Size="ButtonSize.Large" ButtonType="ButtonType.Submit" IsBusy="isLoading" Icon="search" Text="查询" />
|
||||||
<RadzenButton Size="ButtonSize.Large" Click="reloadGrid" IsBusy="isLoading" Icon="refresh" Text="ÖØÖÃ" ButtonStyle="ButtonStyle.Warning" />
|
<RadzenButton Size="ButtonSize.Large" Click="reloadGrid" IsBusy="isLoading" Icon="refresh" Text="ÖØÖÃ" ButtonStyle="ButtonStyle.Warning" />
|
||||||
</RadzenColumn>
|
</RadzenColumn>
|
||||||
</RadzenRow>
|
</RadzenRow>
|
||||||
|
|
@ -37,23 +37,31 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="col-12 mb-4">
|
<div class="col-12 mb-4">
|
||||||
|
|
||||||
<RadzenDataGrid @ref="grid"
|
<RadzenDataGrid @ref="grid"
|
||||||
LoadData="@LoadData"
|
LoadData="@LoadData"
|
||||||
RowSelect="@((InOutInvoice oi) => { InvoiceSelected(oi); })"
|
RowSelect="@((InOutInvoice oi) => { InvoiceSelected(oi); })"
|
||||||
IsLoading="@isLoading"
|
IsLoading="@isLoading"
|
||||||
Count="@count"
|
Count="@count"
|
||||||
EmptyText="无数据"
|
EmptyText="无数据"
|
||||||
Data="@_forecasts"
|
Data="@_forecasts"
|
||||||
AllowColumnResize="true" AllowAlternatingRows="false"
|
AllowColumnResize="true" AllowAlternatingRows="false"
|
||||||
SelectionMode="DataGridSelectionMode.Single"
|
SelectionMode="DataGridSelectionMode.Single"
|
||||||
AllowPaging="true" PageSize="10" PagerHorizontalAlign="HorizontalAlign.Left" ShowPagingSummary="true" PagingSummaryFormat="{0}/{1} 共{2}条数据">
|
AllowPaging="true" PageSize="10" PagerHorizontalAlign="HorizontalAlign.Left" ShowPagingSummary="true" PagingSummaryFormat="{0}/{1} 共{2}条数据">
|
||||||
<Columns>
|
<Columns>
|
||||||
<RadzenDataGridColumn Frozen="true" Title="单据号" Property="InvoiceNo"></RadzenDataGridColumn>
|
<RadzenDataGridColumn Frozen="true" Title="单据号" Property="InvoiceNo"></RadzenDataGridColumn>
|
||||||
<RadzenDataGridColumn Width="170px" Title="时间" Property="InvoiceDate"></RadzenDataGridColumn>
|
<RadzenDataGridColumn Width="170px" Title="时间" Property="InvoiceDate"></RadzenDataGridColumn>
|
||||||
<RadzenDataGridColumn Title="请领药房" Property="InPharmacyId"></RadzenDataGridColumn>
|
<RadzenDataGridColumn Title="请领药房" Property="InPharmacyId">
|
||||||
<RadzenDataGridColumn Title="出库药房" Property="OutPharmacyId"></RadzenDataGridColumn>
|
<Template Context="InPharmacyId">
|
||||||
</Columns>
|
@(InPharmacyId.InPharmacyId == "0623" ? "麻醉科" : InPharmacyId.InPharmacyId)
|
||||||
</RadzenDataGrid>
|
</Template>
|
||||||
|
</RadzenDataGridColumn>
|
||||||
|
<RadzenDataGridColumn Title="出库药房" Property="OutPharmacyId">
|
||||||
|
<Template Context="OutPharmacyId">
|
||||||
|
@(OutPharmacyId.OutPharmacyId == "070103" ? "药剂科" : OutPharmacyId.OutPharmacyId)
|
||||||
|
</Template>
|
||||||
|
</RadzenDataGridColumn>
|
||||||
|
</Columns>
|
||||||
|
</RadzenDataGrid>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -66,7 +74,7 @@
|
||||||
int count;
|
int count;
|
||||||
private IEnumerable<InOutInvoice>? _forecasts;
|
private IEnumerable<InOutInvoice>? _forecasts;
|
||||||
string InvoiceNo;
|
string InvoiceNo;
|
||||||
DateTime InvoiceDate = DateTime.MinValue;
|
DateTime InvoiceDate = DateTime.Now;
|
||||||
|
|
||||||
void OnCurrentDateChanged(DateTime args)
|
void OnCurrentDateChanged(DateTime args)
|
||||||
{
|
{
|
||||||
|
|
@ -107,7 +115,7 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -17,22 +17,76 @@
|
||||||
<RadzenStack>
|
<RadzenStack>
|
||||||
|
|
||||||
<RadzenDataGrid @ref="grid" Data="@data" ExpandMode="DataGridExpandMode.Multiple"
|
<RadzenDataGrid @ref="grid" Data="@data" ExpandMode="DataGridExpandMode.Multiple"
|
||||||
RowRender="@RowRender"
|
RowRender="@RowRender"
|
||||||
EmptyText="无数据" AllowAlternatingRows="false">
|
EmptyText="无数据" AllowAlternatingRows="false">
|
||||||
|
|
||||||
<Template Context="di">
|
<Template Context="di">
|
||||||
<RadzenDataGrid Data="@di.ChannelStocks" EmptyText="无数据" @ref="di.Grid"
|
<RadzenDataGrid Data="@di.ChannelStocks" EmptyText="无数据" @ref="di.Grid"
|
||||||
CellClick="@((DataGridCellMouseEventArgs<ChannelStock> args) => OnCellClick(args, di.Grid))">
|
CellClick="@((DataGridCellMouseEventArgs<ChannelStock> args) => OnCellClick(args, di.Grid))">
|
||||||
<Columns>
|
<Columns>
|
||||||
<RadzenDataGridColumn Title="库位" Property="DrawerNo">
|
<RadzenDataGridColumn Title="库位" Property="DrawerNo" Width="6vw">
|
||||||
<Template Context="s">
|
<Template Context="s">
|
||||||
@s.DrawerNo - @s.ColNo
|
@s.DrawerNo - @s.ColNo
|
||||||
</Template>
|
</Template>
|
||||||
</RadzenDataGridColumn>
|
</RadzenDataGridColumn>
|
||||||
<RadzenDataGridColumn Title="库存" Property="Quantity"></RadzenDataGridColumn>
|
<RadzenDataGridColumn Title="库存" Property="Quantity" Width="6vw"></RadzenDataGridColumn>
|
||||||
@* <RadzenDataGridColumn Title="批次" Property="ManuNo"></RadzenDataGridColumn>
|
@* <RadzenDataGridColumn Title="批次" Property="ManuNo"></RadzenDataGridColumn>
|
||||||
<RadzenDataGridColumn Title="效期" Property="EffDate"></RadzenDataGridColumn> *@
|
<RadzenDataGridColumn Title="效期" Property="EffDate"></RadzenDataGridColumn> *@
|
||||||
<RadzenDataGridColumn Title="入库数量" Property="AddQuantity">
|
<RadzenDataGridColumn Title="批次" Property="ManuNo" Filterable="false" Width="25vw">
|
||||||
|
<Template Context="ManuNo">
|
||||||
|
<RadzenText TextStyle="TextStyle.Subtitle2" class="mb-0">@ManuNo.ManuNo</RadzenText>
|
||||||
|
|
||||||
|
@if (ManuNo.Quantity > 0)
|
||||||
|
{
|
||||||
|
<RadzenText TextStyle="TextStyle.Caption">
|
||||||
|
@ManuNo.ManuNo
|
||||||
|
</RadzenText>
|
||||||
|
}
|
||||||
|
</Template>
|
||||||
|
<EditTemplate Context="channel">
|
||||||
|
@if (channel.Quantity == 0 && !String.IsNullOrEmpty(channel.DrugId))
|
||||||
|
{
|
||||||
|
<RadzenDropDown TValue="DrugManuNo" Name="ManuNo" @bind-Value="channel.drugManuNo" Data="@channel.Drug?.Manus" Style="width:100%; display: block;">
|
||||||
|
<Template>
|
||||||
|
<RadzenText TextStyle="TextStyle.Subtitle2" class="mb-0">@((context as DrugManuNo)?.ManuNo)</RadzenText>
|
||||||
|
@if ((context as DrugManuNo).EffDate != null && (context as DrugManuNo).EffDate.ToString().Length > 10)
|
||||||
|
{
|
||||||
|
|
||||||
|
<RadzenText TextStyle="TextStyle.Caption">@((context as DrugManuNo).EffDate.ToString().Substring(0, 10))</RadzenText>
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
|
||||||
|
<RadzenText TextStyle="TextStyle.Caption">@((context as DrugManuNo)?.EffDate)</RadzenText>
|
||||||
|
}
|
||||||
|
</Template>
|
||||||
|
<ValueTemplate>
|
||||||
|
<RadzenStack Orientation="Orientation.Horizontal">
|
||||||
|
<RadzenText TextStyle="TextStyle.Subtitle2" class="mb-0">@((context as DrugManuNo)?.ManuNo)</RadzenText>
|
||||||
|
@if ((context as DrugManuNo).EffDate != null && (context as DrugManuNo).EffDate.ToString().Length > 10)
|
||||||
|
{
|
||||||
|
|
||||||
|
<RadzenText TextStyle="TextStyle.Caption">@((context as DrugManuNo).EffDate.ToString().Substring(0, 10))</RadzenText>
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
|
||||||
|
<RadzenText TextStyle="TextStyle.Caption">@((context as DrugManuNo)?.EffDate)</RadzenText>
|
||||||
|
}
|
||||||
|
</RadzenStack>
|
||||||
|
</ValueTemplate>
|
||||||
|
</RadzenDropDown>
|
||||||
|
<RadzenRequiredValidator Text="请选择批次" Component="ManuNo" Popup="true" />
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
|
||||||
|
<RadzenText TextStyle="TextStyle.Subtitle2" class="mb-0">@channel.drugManuNo?.ManuNo</RadzenText>
|
||||||
|
<RadzenText TextStyle="TextStyle.Caption">@channel.drugManuNo?.EffDate</RadzenText>
|
||||||
|
}
|
||||||
|
</EditTemplate>
|
||||||
|
</RadzenDataGridColumn>
|
||||||
|
<RadzenDataGridColumn Title="入库数" Property="AddQuantity" Width="6vw">
|
||||||
<EditTemplate Context="cs">
|
<EditTemplate Context="cs">
|
||||||
<RadzenNumeric Disabled="status > 0" Style="display: block" Min="0" Max="@di.Quantity" Name="Quantity" @bind-Value=@cs.AddQuantity />
|
<RadzenNumeric Disabled="status > 0" Style="display: block" Min="0" Max="@di.Quantity" Name="Quantity" @bind-Value=@cs.AddQuantity />
|
||||||
<RadzenNumericRangeValidator Style="position: absolute;z-index: 9999;" Min="0" Max="@di.Quantity" Text="请填写正确的添加数量" Component="Quantity" />
|
<RadzenNumericRangeValidator Style="position: absolute;z-index: 9999;" Min="0" Max="@di.Quantity" Text="请填写正确的添加数量" Component="Quantity" />
|
||||||
|
|
@ -43,12 +97,16 @@
|
||||||
</RadzenDataGrid>
|
</RadzenDataGrid>
|
||||||
</Template>
|
</Template>
|
||||||
<Columns>
|
<Columns>
|
||||||
<RadzenDataGridColumn Property="Drug.DrugName" Title="药品" />
|
<RadzenDataGridColumn Property="Drug.DrugName" Title="药品" Width="25vw" />
|
||||||
<RadzenDataGridColumn Property="Drug.DrugSpec" Title="规格" />
|
<RadzenDataGridColumn Property="Drug.DrugSpec" Title="规格" Width="6vw" />
|
||||||
<RadzenDataGridColumn Property="Invoice.DrugManuNo" Title="批次" />
|
<RadzenDataGridColumn Property="Invoice.DrugManuNo" Title="批次" Width="10vw">
|
||||||
<RadzenDataGridColumn Property="Invoice.EffDate" Title="效期" />
|
<Template Context="ManuNo">
|
||||||
<RadzenDataGridColumn Property="Quantity" Title="请领数量" />
|
@(ManuNo.Invoice.DrugManuNo == "X" ? "无" : ManuNo.Invoice.DrugManuNo)
|
||||||
<RadzenDataGridColumn Property="StockQuantity" Title="总库存" />
|
</Template>
|
||||||
|
</RadzenDataGridColumn>
|
||||||
|
<RadzenDataGridColumn Property="Invoice.EffDate" Title="效期" Width="6vw" />
|
||||||
|
<RadzenDataGridColumn Property="Quantity" Title="请领数量" Width="6vw" />
|
||||||
|
<RadzenDataGridColumn Property="StockQuantity" Title="总库存" Width="6vw" />
|
||||||
</Columns>
|
</Columns>
|
||||||
</RadzenDataGrid>
|
</RadzenDataGrid>
|
||||||
|
|
||||||
|
|
@ -58,15 +116,15 @@
|
||||||
<RadzenStack Orientation="Orientation.Horizontal" JustifyContent="JustifyContent.Center" Gap="0.5rem">
|
<RadzenStack Orientation="Orientation.Horizontal" JustifyContent="JustifyContent.Center" Gap="0.5rem">
|
||||||
@if (status < 2)
|
@if (status < 2)
|
||||||
{
|
{
|
||||||
<RadzenButton Click="@StartAdd" Disabled="!CanTakeDrug" IsBusy="status > 0" BusyText="加药中。。。" ButtonStyle="ButtonStyle.Warning" Variant="Variant.Flat" Text="加药" Style="width: 120px" />
|
<RadzenButton Click="@StartAdd" Disabled="!CanTakeDrug" IsBusy="@(status>0)" BusyText="加药中。。。" ButtonStyle="ButtonStyle.Warning" Variant="Variant.Flat" Text="加药" Style="width: 120px" />
|
||||||
}
|
}
|
||||||
@if (status == 2)
|
@if (status == 2)
|
||||||
{
|
{
|
||||||
<RadzenButton Click="@AddFinish" ButtonStyle="ButtonStyle.Success" Variant="Variant.Flat" Text="完成" Style="width: 120px" />
|
<RadzenButton Click="@AddFinish" ButtonStyle="ButtonStyle.Success" Variant="Variant.Flat" Text="完成" Style="width: 120px" />
|
||||||
}
|
}
|
||||||
@if (status < 2)
|
@if (status < 2)
|
||||||
{
|
{
|
||||||
<RadzenButton Click="@((args) => CancelOpera())" Variant="Variant.Flat" Text="取消" Style="width: 120px" />
|
<RadzenButton Click="@((args) => CancelOpera())" Variant="Variant.Flat" Text="取消" Style="width: 120px" />
|
||||||
}
|
}
|
||||||
</RadzenStack>
|
</RadzenStack>
|
||||||
</RadzenStack>
|
</RadzenStack>
|
||||||
|
|
@ -122,6 +180,8 @@
|
||||||
async Task OpenDrawer()
|
async Task OpenDrawer()
|
||||||
{
|
{
|
||||||
this.status = 1;
|
this.status = 1;
|
||||||
|
PortUtil.PowerOn();
|
||||||
|
await Task.Delay(200);
|
||||||
// 解析需要打开的抽屉列表
|
// 解析需要打开的抽屉列表
|
||||||
List<ChannelStock> channels = new();
|
List<ChannelStock> channels = new();
|
||||||
for (int i = 0; i < data.Count; i++)
|
for (int i = 0; i < data.Count; i++)
|
||||||
|
|
@ -195,7 +255,7 @@
|
||||||
new NotificationMessage { Severity = NotificationSeverity.Error, Summary = "提示", Detail = $"抽屉【{drawerNo}】打开失败,请检测硬件", Duration = 4000 }
|
new NotificationMessage { Severity = NotificationSeverity.Error, Summary = "提示", Detail = $"抽屉【{drawerNo}】打开失败,请检测硬件", Duration = 4000 }
|
||||||
);
|
);
|
||||||
logger.Info($"抽屉打开失败");
|
logger.Info($"抽屉打开失败");
|
||||||
PortUtil.AllLightOff();
|
PortUtil.PowerOff();
|
||||||
RestData();
|
RestData();
|
||||||
stop();
|
stop();
|
||||||
}
|
}
|
||||||
|
|
@ -211,7 +271,7 @@
|
||||||
options._data = 0;
|
options._data = 0;
|
||||||
if (setting.Value.single.Contains(drawerNo))
|
if (setting.Value.single.Contains(drawerNo))
|
||||||
{
|
{
|
||||||
PortUtil.AllLightOff();
|
PortUtil.PowerOff();
|
||||||
}
|
}
|
||||||
if (index == drawerNos.Count - 1)
|
if (index == drawerNos.Count - 1)
|
||||||
{
|
{
|
||||||
|
|
@ -276,7 +336,7 @@
|
||||||
{
|
{
|
||||||
RestData();
|
RestData();
|
||||||
logger.Info("取消保存");
|
logger.Info("取消保存");
|
||||||
cancelFlag = true;
|
cancelFlag = true;
|
||||||
// 关闭弹窗
|
// 关闭弹窗
|
||||||
dialogService.Close(false);
|
dialogService.Close(false);
|
||||||
break;
|
break;
|
||||||
|
|
@ -335,14 +395,16 @@
|
||||||
);
|
);
|
||||||
if (setting.Value.single.Contains(drawerNo))
|
if (setting.Value.single.Contains(drawerNo))
|
||||||
{
|
{
|
||||||
PortUtil.AllLightOff();
|
PortUtil.PowerOff();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
PortUtil.PowerOff();
|
||||||
}
|
}
|
||||||
|
|
||||||
void RestData()
|
void RestData()
|
||||||
{
|
{
|
||||||
|
PortUtil.PowerOff();
|
||||||
this.status = 0;
|
this.status = 0;
|
||||||
_flagList.Clear();
|
_flagList.Clear();
|
||||||
this.ColNos.Clear();
|
this.ColNos.Clear();
|
||||||
|
|
|
||||||
|
|
@ -220,7 +220,7 @@
|
||||||
new NotificationMessage { Severity = NotificationSeverity.Error, Summary = "提示", Detail = $"抽屉【{drawerNo}】打开失败,请检测硬件", Duration = 4000 }
|
new NotificationMessage { Severity = NotificationSeverity.Error, Summary = "提示", Detail = $"抽屉【{drawerNo}】打开失败,请检测硬件", Duration = 4000 }
|
||||||
);
|
);
|
||||||
logger.Info($"抽屉打开失败");
|
logger.Info($"抽屉打开失败");
|
||||||
PortUtil.AllLightOff();
|
PortUtil.PowerOff();
|
||||||
RestData();
|
RestData();
|
||||||
stop();
|
stop();
|
||||||
}
|
}
|
||||||
|
|
@ -236,7 +236,7 @@
|
||||||
options._data = 0;
|
options._data = 0;
|
||||||
if (setting.Value.single.Contains(drawerNo))
|
if (setting.Value.single.Contains(drawerNo))
|
||||||
{
|
{
|
||||||
PortUtil.AllLightOff();
|
PortUtil.PowerOff();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (index == drawerNos.Count - 1)
|
if (index == drawerNos.Count - 1)
|
||||||
|
|
@ -365,7 +365,7 @@
|
||||||
);
|
);
|
||||||
if (setting.Value.single.Contains(drawerNo))
|
if (setting.Value.single.Contains(drawerNo))
|
||||||
{
|
{
|
||||||
PortUtil.AllLightOff();
|
PortUtil.PowerOff();
|
||||||
}
|
}
|
||||||
stop();
|
stop();
|
||||||
}
|
}
|
||||||
|
|
@ -374,6 +374,7 @@
|
||||||
|
|
||||||
void RestData()
|
void RestData()
|
||||||
{
|
{
|
||||||
|
PortUtil.PowerOff();
|
||||||
PortUtil.speechSynthesizer.SpeakAsyncCancelAll();
|
PortUtil.speechSynthesizer.SpeakAsyncCancelAll();
|
||||||
this.status = 0;
|
this.status = 0;
|
||||||
this.BeforeQuantity = new int[9];
|
this.BeforeQuantity = new int[9];
|
||||||
|
|
|
||||||
|
|
@ -102,6 +102,8 @@
|
||||||
async Task OpenDrawer()
|
async Task OpenDrawer()
|
||||||
{
|
{
|
||||||
this.status = 1;
|
this.status = 1;
|
||||||
|
PortUtil.PowerOn();
|
||||||
|
await Task.Delay(200);
|
||||||
// 解析需要打开的抽屉列表
|
// 解析需要打开的抽屉列表
|
||||||
List<OrderTakeVo> drawerNos = this.data.GroupBy(it => it.ChannelStock.DrawerNo).Select(it => it.First()).ToList();
|
List<OrderTakeVo> drawerNos = this.data.GroupBy(it => it.ChannelStock.DrawerNo).Select(it => it.First()).ToList();
|
||||||
|
|
||||||
|
|
@ -170,7 +172,7 @@
|
||||||
new NotificationMessage { Severity = NotificationSeverity.Error, Summary = "提示", Detail = $"抽屉【{drawerNo}】打开失败,请检测硬件", Duration = 4000 }
|
new NotificationMessage { Severity = NotificationSeverity.Error, Summary = "提示", Detail = $"抽屉【{drawerNo}】打开失败,请检测硬件", Duration = 4000 }
|
||||||
);
|
);
|
||||||
logger.Info($"抽屉打开失败");
|
logger.Info($"抽屉打开失败");
|
||||||
PortUtil.AllLightOff();
|
PortUtil.PowerOff();
|
||||||
RestData();
|
RestData();
|
||||||
stop();
|
stop();
|
||||||
}
|
}
|
||||||
|
|
@ -193,7 +195,7 @@
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
orderTakeVo.Status = 2;
|
orderTakeVo.Status = 2;
|
||||||
PortUtil.AllLightOff();
|
PortUtil.PowerOff();
|
||||||
if (options._data == drawerNos.Count - 1)
|
if (options._data == drawerNos.Count - 1)
|
||||||
{
|
{
|
||||||
PortUtil.speechSynthesizer.SpeakAsyncCancelAll();
|
PortUtil.speechSynthesizer.SpeakAsyncCancelAll();
|
||||||
|
|
@ -277,15 +279,18 @@
|
||||||
);
|
);
|
||||||
if (setting.Value.single.Contains(drawerNo))
|
if (setting.Value.single.Contains(drawerNo))
|
||||||
{
|
{
|
||||||
PortUtil.AllLightOff();
|
PortUtil.PowerOff();
|
||||||
}
|
}
|
||||||
stop();
|
stop();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
PortUtil.PowerOff();
|
||||||
}
|
}
|
||||||
|
|
||||||
void RestData()
|
void RestData()
|
||||||
{
|
{
|
||||||
|
PortUtil.PowerOff();
|
||||||
PortUtil.speechSynthesizer.SpeakAsyncCancelAll();
|
PortUtil.speechSynthesizer.SpeakAsyncCancelAll();
|
||||||
this.status = 0;
|
this.status = 0;
|
||||||
data.ForEach(it =>
|
data.ForEach(it =>
|
||||||
|
|
|
||||||
|
|
@ -168,7 +168,7 @@
|
||||||
new NotificationMessage { Severity = NotificationSeverity.Error, Summary = "提示", Detail = $"抽屉【{drawerNo}】打开失败,请检测硬件", Duration = 4000 }
|
new NotificationMessage { Severity = NotificationSeverity.Error, Summary = "提示", Detail = $"抽屉【{drawerNo}】打开失败,请检测硬件", Duration = 4000 }
|
||||||
);
|
);
|
||||||
logger.Info($"处方退药抽屉【{drawerNo}】打开失败");
|
logger.Info($"处方退药抽屉【{drawerNo}】打开失败");
|
||||||
PortUtil.AllLightOff();
|
PortUtil.PowerOff();
|
||||||
RestData();
|
RestData();
|
||||||
stop();
|
stop();
|
||||||
}
|
}
|
||||||
|
|
@ -184,7 +184,7 @@
|
||||||
options._data = 0;
|
options._data = 0;
|
||||||
if (setting.Value.single.Contains(drawerNo))
|
if (setting.Value.single.Contains(drawerNo))
|
||||||
{
|
{
|
||||||
PortUtil.AllLightOff();
|
PortUtil.PowerOff();
|
||||||
}
|
}
|
||||||
if (index == drawerNos.Count - 1)
|
if (index == drawerNos.Count - 1)
|
||||||
{
|
{
|
||||||
|
|
@ -232,7 +232,7 @@
|
||||||
);
|
);
|
||||||
if (setting.Value.single.Contains(drawerNo))
|
if (setting.Value.single.Contains(drawerNo))
|
||||||
{
|
{
|
||||||
PortUtil.AllLightOff();
|
PortUtil.PowerOff();
|
||||||
}
|
}
|
||||||
stop();
|
stop();
|
||||||
}
|
}
|
||||||
|
|
@ -241,6 +241,7 @@
|
||||||
|
|
||||||
void RestData()
|
void RestData()
|
||||||
{
|
{
|
||||||
|
PortUtil.PowerOff();
|
||||||
PortUtil.speechSynthesizer.SpeakAsyncCancelAll();
|
PortUtil.speechSynthesizer.SpeakAsyncCancelAll();
|
||||||
this.status = 0;
|
this.status = 0;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@
|
||||||
<div class="container-fluid">
|
<div class="container-fluid">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-12 mb-4">
|
<div class="col-12 mb-4">
|
||||||
|
|
||||||
<form onsubmit="@(() => grid.Reload())">
|
<form onsubmit="@(() => grid.Reload())">
|
||||||
<RadzenFieldset Text="²éѯ">
|
<RadzenFieldset Text="²éѯ">
|
||||||
<RadzenStack Orientation="Orientation.Horizontal" Gap="1rem">
|
<RadzenStack Orientation="Orientation.Horizontal" Gap="1rem">
|
||||||
|
|
@ -18,7 +18,7 @@
|
||||||
<RadzenLabel Text="¿ªÊ¼Ê±¼ä" Component="Start" />
|
<RadzenLabel Text="¿ªÊ¼Ê±¼ä" Component="Start" />
|
||||||
</RadzenColumn>
|
</RadzenColumn>
|
||||||
<RadzenColumn Size="8">
|
<RadzenColumn Size="8">
|
||||||
<RadzenDatePicker DateFormat="yyyy-MM-dd" @bind-Value="start" Style="width: 100%;" Name="Start" />
|
<RadzenDatePicker DateFormat="yyyy-MM-dd" @bind-Value="start" Style="width: 100%;" Name="Start" />
|
||||||
</RadzenColumn>
|
</RadzenColumn>
|
||||||
</RadzenRow>
|
</RadzenRow>
|
||||||
<RadzenRow AlignItems="AlignItems.Center">
|
<RadzenRow AlignItems="AlignItems.Center">
|
||||||
|
|
@ -29,7 +29,7 @@
|
||||||
<RadzenDatePicker DateFormat="yyyy-MM-dd" @bind-Value="end" Style="width: 100%;" Name="End" />
|
<RadzenDatePicker DateFormat="yyyy-MM-dd" @bind-Value="end" Style="width: 100%;" Name="End" />
|
||||||
</RadzenColumn>
|
</RadzenColumn>
|
||||||
</RadzenRow>
|
</RadzenRow>
|
||||||
|
|
||||||
<RadzenRow AlignItems="AlignItems.Center">
|
<RadzenRow AlignItems="AlignItems.Center">
|
||||||
<RadzenColumn Size="12">
|
<RadzenColumn Size="12">
|
||||||
<RadzenButton Size="ButtonSize.Large" ButtonType="ButtonType.Submit" IsBusy="isLoading" Icon="search" Text="²éѯ" />
|
<RadzenButton Size="ButtonSize.Large" ButtonType="ButtonType.Submit" IsBusy="isLoading" Icon="search" Text="²éѯ" />
|
||||||
|
|
@ -40,48 +40,95 @@
|
||||||
</RadzenFieldset>
|
</RadzenFieldset>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-12 mb-4">
|
<div class="col-12 mb-4" style="height:50vh;overflow:auto">
|
||||||
|
|
||||||
<RadzenDataGrid @ref="grid"
|
<RadzenDataGrid @ref="grid" Style="height:48vh;"
|
||||||
LoadData="@LoadData"
|
LoadData="@LoadData"
|
||||||
IsLoading="@isLoading"
|
IsLoading="@isLoading"
|
||||||
Count="@count"
|
Count="@count"
|
||||||
EmptyText="无数据"
|
EmptyText="无数据"
|
||||||
Data="@_forecasts"
|
Data="@_forecasts"
|
||||||
AllowColumnResize="true" AllowAlternatingRows="false"
|
AllowColumnResize="true" AllowAlternatingRows="false"
|
||||||
AllowRowSelectOnRowClick="true"
|
AllowRowSelectOnRowClick="true"
|
||||||
CellClick="@((DataGridCellMouseEventArgs<MachineRecord> args) => OnCellClick(args))"
|
CellClick="@((DataGridCellMouseEventArgs<MachineRecord> args) => OnCellClick(args))"
|
||||||
AllowPaging="true" PageSize="8" PagerHorizontalAlign="HorizontalAlign.Left" ShowPagingSummary="true" PagingSummaryFormat="{0}/{1} 共{2}条数据">
|
AllowPaging="true" PageSize="8" PagerHorizontalAlign="HorizontalAlign.Left" ShowPagingSummary="true" PagingSummaryFormat="{0}/{1} 共{2}条数据">
|
||||||
<HeaderTemplate>
|
<HeaderTemplate>
|
||||||
<RadzenRow JustifyContent="JustifyContent.End">
|
<RadzenRow JustifyContent="JustifyContent.End">
|
||||||
<RadzenButton ButtonStyle="ButtonStyle.Warning" Disabled="_forecasts == null || !_forecasts.Any(mr => mr.CurrentReturnQuantity > 0)" Variant="Variant.Outlined" Shade="Shade.Light" Text="归还" Click="@OpenReturnDialog" />
|
<RadzenButton ButtonStyle="ButtonStyle.Warning" Disabled="_forecasts == null || !_forecasts.Any(mr => mr.CurrentReturnQuantity > 0)" Variant="Variant.Outlined" Shade="Shade.Light" Text="归还" Click="@OpenReturnDialog" />
|
||||||
</RadzenRow>
|
</RadzenRow>
|
||||||
</HeaderTemplate>
|
</HeaderTemplate>
|
||||||
<Columns>
|
<Columns>
|
||||||
<RadzenDataGridColumn Frozen="true" Title="操作人" Property="OperatorUser.NickName"></RadzenDataGridColumn>
|
<RadzenDataGridColumn Frozen="true" Title="操作人" Property="OperatorUser.NickName"></RadzenDataGridColumn>
|
||||||
<RadzenDataGridColumn Width="170px" Title="操作时间" Property="OperationTime"></RadzenDataGridColumn>
|
<RadzenDataGridColumn Width="170px" Title="操作时间" Property="OperationTime"></RadzenDataGridColumn>
|
||||||
<RadzenDataGridColumn Width="200px" Title="药品名称" Property="Drug.DrugName">
|
<RadzenDataGridColumn Width="200px" Title="药品名称" Property="Drug.DrugName">
|
||||||
<Template Context="mr">
|
<Template Context="mr">
|
||||||
<RadzenText TextStyle="TextStyle.Subtitle2" class="mb-0">@mr.Drug?.DrugName</RadzenText>
|
<RadzenText TextStyle="TextStyle.Subtitle2" class="mb-0">@mr.Drug?.DrugName</RadzenText>
|
||||||
<RadzenText TextStyle="TextStyle.Caption">@mr.Drug?.DrugSpec</RadzenText>
|
<RadzenText TextStyle="TextStyle.Caption">@mr.Drug?.DrugSpec</RadzenText>
|
||||||
</Template>
|
</Template>
|
||||||
</RadzenDataGridColumn>
|
</RadzenDataGridColumn>
|
||||||
<RadzenDataGridColumn Title="批次" Property="ManuNo">
|
<RadzenDataGridColumn Width="60px" Title="药盒" Property="OperationTime">
|
||||||
<Template Context="mr">
|
<Template Context="mr">
|
||||||
<RadzenText TextStyle="TextStyle.Subtitle2" class="mb-0">@mr.ManuNo</RadzenText>
|
|
||||||
<RadzenText TextStyle="TextStyle.Caption"> @mr.EffDate?.ToString("yyyy-MM-dd")</RadzenText>
|
@if (mr.BoxDrawer > 0)
|
||||||
</Template>
|
{
|
||||||
</RadzenDataGridColumn>
|
if (mr.DrawerNo == 99)
|
||||||
<RadzenDataGridColumn Title="借出数量" Property="Quantity"></RadzenDataGridColumn>
|
{
|
||||||
<RadzenDataGridColumn Title="已还药品" Property="ReturnQuantity1"></RadzenDataGridColumn>
|
<b class="rz-pr-3">@($"急诊药盒")</b>
|
||||||
<RadzenDataGridColumn Title="已还空瓶" Property="ReturnQuantity2"></RadzenDataGridColumn>
|
}
|
||||||
<RadzenDataGridColumn Title="本次归还" Property="CurrentReturnQuantity">
|
else if (mr.DrawerNo == 111)
|
||||||
<EditTemplate Context="mr">
|
{
|
||||||
<RadzenNumeric Min="0" Style="display: block" Max="@(mr.Quantity - mr.ReturnQuantity1 - mr.ReturnQuantity2)" Name="Quantity" @bind-Value=@mr.CurrentReturnQuantity />
|
<b class="rz-pr-3">@($"恢复室药盒")</b>
|
||||||
</EditTemplate>
|
}
|
||||||
</RadzenDataGridColumn>
|
else
|
||||||
</Columns>
|
{
|
||||||
</RadzenDataGrid>
|
<b class="rz-pr-3">@($"{mr.DrawerNo}-{(mr.ColNo == 1 ? '白' : '绿')}")</b>
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
<b class="rz-pr-3">无</b>
|
||||||
|
}
|
||||||
|
</Template>
|
||||||
|
</RadzenDataGridColumn>
|
||||||
|
<RadzenDataGridColumn Title="批次" 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="借出数量" Property="Quantity">
|
||||||
|
<HeaderTemplate>
|
||||||
|
<div style="text-align: center;">
|
||||||
|
借出<br>数量
|
||||||
|
</div>
|
||||||
|
</HeaderTemplate>
|
||||||
|
</RadzenDataGridColumn>
|
||||||
|
<RadzenDataGridColumn Title="已还药品" Property="ReturnQuantity1">
|
||||||
|
<HeaderTemplate>
|
||||||
|
<div style="text-align: center;">
|
||||||
|
已还<br>药品
|
||||||
|
</div>
|
||||||
|
</HeaderTemplate>
|
||||||
|
</RadzenDataGridColumn>
|
||||||
|
<RadzenDataGridColumn Title="已还空瓶" Property="ReturnQuantity2">
|
||||||
|
<HeaderTemplate>
|
||||||
|
<div style="text-align: center;">
|
||||||
|
已还<br>空瓶
|
||||||
|
</div>
|
||||||
|
</HeaderTemplate>
|
||||||
|
</RadzenDataGridColumn>
|
||||||
|
<RadzenDataGridColumn Title="本次归还" Property="CurrentReturnQuantity" Width="90px">
|
||||||
|
<HeaderTemplate>
|
||||||
|
<div style="text-align: center;">
|
||||||
|
本次<br>归还
|
||||||
|
</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>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -7,55 +7,61 @@
|
||||||
@using log4net;
|
@using log4net;
|
||||||
|
|
||||||
<RadzenStack Gap="1rem" Orientation="Orientation.Vertical" JustifyContent="JustifyContent.SpaceBetween" Style="height: 100%;">
|
<RadzenStack Gap="1rem" Orientation="Orientation.Vertical" JustifyContent="JustifyContent.SpaceBetween" Style="height: 100%;">
|
||||||
|
|
||||||
<RadzenStack>
|
<RadzenStack>
|
||||||
|
|
||||||
<RadzenDataGrid @ref="grid" Data="@data" ExpandMode="DataGridExpandMode.Multiple"
|
|
||||||
RowRender="@RowRender"
|
|
||||||
EmptyText="无数据" AllowAlternatingRows="false">
|
|
||||||
|
|
||||||
<Template Context="di">
|
<RadzenDataGrid @ref="grid" Data="@data" ExpandMode="DataGridExpandMode.Multiple"
|
||||||
<RadzenDataGrid Data="@di.ChannelStocks" EmptyText="无数据" @ref="di.Grid"
|
RowRender="@RowRender"
|
||||||
CellClick="@((DataGridCellMouseEventArgs<ChannelStock> args) => OnCellClick(args, di.Grid))">
|
EmptyText="无数据" AllowAlternatingRows="false">
|
||||||
<Columns>
|
|
||||||
<RadzenDataGridColumn Title="库位" Property="DrawerNo">
|
<Template Context="di">
|
||||||
<Template Context="s">
|
<RadzenDataGrid Data="@di.ChannelStocks" EmptyText="无数据" @ref="di.Grid"
|
||||||
@s.DrawerNo - @s.ColNo
|
CellClick="@((DataGridCellMouseEventArgs<ChannelStock> args) => OnCellClick(args, di.Grid))">
|
||||||
</Template>
|
<Columns>
|
||||||
</RadzenDataGridColumn>
|
<RadzenDataGridColumn Title="库位" Property="DrawerNo">
|
||||||
<RadzenDataGridColumn Title="库存" Property="Quantity"></RadzenDataGridColumn>
|
<Template Context="s">
|
||||||
@* <RadzenDataGridColumn Title="批次" Property="ManuNo"></RadzenDataGridColumn>
|
@s.DrawerNo - @s.ColNo
|
||||||
|
</Template>
|
||||||
|
</RadzenDataGridColumn>
|
||||||
|
<RadzenDataGridColumn Title="库存" Property="Quantity"></RadzenDataGridColumn>
|
||||||
|
@* <RadzenDataGridColumn Title="批次" Property="ManuNo"></RadzenDataGridColumn>
|
||||||
<RadzenDataGridColumn Title="效期" Property="EffDate"></RadzenDataGridColumn> *@
|
<RadzenDataGridColumn Title="效期" Property="EffDate"></RadzenDataGridColumn> *@
|
||||||
<RadzenDataGridColumn Title="入库数量" Property="ReturnQuantity">
|
<RadzenDataGridColumn Title="入库数量" Property="ReturnQuantity">
|
||||||
<EditTemplate Context="cs">
|
<EditTemplate Context="cs">
|
||||||
<RadzenNumeric Disabled="status > 0" Style="display: block" Min="0" Max="@di.Quantity" Name="Quantity" @bind-Value=@cs.ReturnQuantity />
|
<RadzenNumeric Disabled="status > 0" Style="display: block" Min="0" Max="@di.Quantity" Name="Quantity" @bind-Value=@cs.ReturnQuantity />
|
||||||
<RadzenNumericRangeValidator Style="position: absolute;z-index: 9999;" Min="0" Max="@di.Quantity" Text="请填写正确的添加数量" Component="Quantity" />
|
<RadzenNumericRangeValidator Style="position: absolute;z-index: 9999;" Min="0" Max="@di.Quantity" Text="请填写正确的添加数量" Component="Quantity" />
|
||||||
<RadzenCustomValidator Validator="@(() => di.ChannelStocks.Sum(cs2 => cs2.ReturnQuantity) == di.Quantity)" Component="Quantity" Text="入库总量应等于请领数量" Style="position: absolute;z-index: 9999;" />
|
<RadzenCustomValidator Validator="@(() => di.ChannelStocks.Sum(cs2 => cs2.ReturnQuantity) == di.Quantity)" Component="Quantity" Text="入库总量应等于还药总数" Style="position: absolute;z-index: 9999;" />
|
||||||
</EditTemplate>
|
</EditTemplate>
|
||||||
</RadzenDataGridColumn>
|
</RadzenDataGridColumn>
|
||||||
</Columns>
|
</Columns>
|
||||||
</RadzenDataGrid>
|
</RadzenDataGrid>
|
||||||
</Template>
|
</Template>
|
||||||
<Columns>
|
<Columns>
|
||||||
<RadzenDataGridColumn Property="Drug.DrugName" Title="药品" />
|
<RadzenDataGridColumn Property="Drug.DrugName" Title="药品" />
|
||||||
<RadzenDataGridColumn Property="Drug.DrugSpec" Title="规格" />
|
<RadzenDataGridColumn Property="Drug.DrugSpec" Title="规格" />
|
||||||
<RadzenDataGridColumn Property="ManuNo" Title="批次">
|
<RadzenDataGridColumn Property="ManuNo" Title="批次">
|
||||||
<Template Context="ov">
|
<Template Context="ov">
|
||||||
@ov.data.First().ManuNo
|
@ov.data.First().ManuNo
|
||||||
</Template>
|
</Template>
|
||||||
</RadzenDataGridColumn>
|
</RadzenDataGridColumn>
|
||||||
<RadzenDataGridColumn Property="EffDate" Title="效期">
|
<RadzenDataGridColumn Property="EffDate" Title="效期">
|
||||||
<Template Context="ov">
|
<Template Context="ov">
|
||||||
@ov.data.First().EffDate
|
@ov.data.First().EffDate
|
||||||
</Template>
|
</Template>
|
||||||
</RadzenDataGridColumn>
|
</RadzenDataGridColumn>
|
||||||
<RadzenDataGridColumn Property="Quantity" Title="请领数量" />
|
<RadzenDataGridColumn Property="Quantity" Title="还药总数">
|
||||||
<RadzenDataGridColumn Property="StockQuantity" Title="总库存" />
|
<HeaderTemplate>
|
||||||
</Columns>
|
<div style="text-align: center;">
|
||||||
</RadzenDataGrid>
|
还药<br>总数
|
||||||
|
</div>
|
||||||
|
</HeaderTemplate>
|
||||||
|
</RadzenDataGridColumn>
|
||||||
|
<RadzenDataGridColumn Property="StockQuantity" Title="总库存" />
|
||||||
|
</Columns>
|
||||||
|
</RadzenDataGrid>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</RadzenStack>
|
</RadzenStack>
|
||||||
<RadzenStack Orientation="Orientation.Horizontal" JustifyContent="JustifyContent.Center" Gap="0.5rem">
|
<RadzenStack Orientation="Orientation.Horizontal" JustifyContent="JustifyContent.Center" Gap="0.5rem">
|
||||||
@if (status < 2)
|
@if (status < 2)
|
||||||
|
|
@ -84,7 +90,7 @@
|
||||||
|
|
||||||
|
|
||||||
private readonly ILog logger = LogManager.GetLogger(typeof(InvoiceAddDialog));
|
private readonly ILog logger = LogManager.GetLogger(typeof(InvoiceAddDialog));
|
||||||
|
|
||||||
[Parameter] public List<MachineRecord> records { get; set; }
|
[Parameter] public List<MachineRecord> records { get; set; }
|
||||||
private bool CanTakeDrug = true;
|
private bool CanTakeDrug = true;
|
||||||
int status = 0;
|
int status = 0;
|
||||||
|
|
@ -93,16 +99,17 @@
|
||||||
|
|
||||||
async Task StartAdd()
|
async Task StartAdd()
|
||||||
{
|
{
|
||||||
if(data.Any(it => it.Quantity != it.ChannelStocks.Sum(cs => cs.ReturnQuantity)))
|
if (data.Any(it => it.Quantity != it.ChannelStocks.Sum(cs => cs.ReturnQuantity)))
|
||||||
{
|
{
|
||||||
_message.Notify(
|
_message.Notify(
|
||||||
new NotificationMessage { Severity = NotificationSeverity.Error, Summary = "提示", Detail = $"请填写正确的入库数量!", Duration = 4000 }
|
new NotificationMessage { Severity = NotificationSeverity.Error, Summary = "提示", Detail = $"请填写正确的入库数量!", Duration = 4000 }
|
||||||
);
|
);
|
||||||
|
|
||||||
} else
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
await OpenDrawer();
|
await OpenDrawer();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async Task CancelOpera()
|
async Task CancelOpera()
|
||||||
|
|
@ -116,6 +123,8 @@
|
||||||
async Task OpenDrawer()
|
async Task OpenDrawer()
|
||||||
{
|
{
|
||||||
this.status = 1;
|
this.status = 1;
|
||||||
|
PortUtil.PowerOn();
|
||||||
|
await Task.Delay(200);
|
||||||
// 解析需要打开的抽屉列表
|
// 解析需要打开的抽屉列表
|
||||||
List<ChannelStock> channels = new();
|
List<ChannelStock> channels = new();
|
||||||
for (int i = 0; i < data.Count; i++)
|
for (int i = 0; i < data.Count; i++)
|
||||||
|
|
@ -158,7 +167,7 @@
|
||||||
byte[] quantity = await PortUtil.CheckQuantityByDrawer(drawerNo);
|
byte[] quantity = await PortUtil.CheckQuantityByDrawer(drawerNo);
|
||||||
BeforeQuantity = quantity.Select(it => Convert.ToInt32(it)).ToArray().Skip(3).Take(9).ToArray();
|
BeforeQuantity = quantity.Select(it => Convert.ToInt32(it)).ToArray().Skip(3).Take(9).ToArray();
|
||||||
logger.Info($"单支抽屉【{drawerNo}】,开抽屉前检测数量【{string.Join(",", BeforeQuantity)}】");
|
logger.Info($"单支抽屉【{drawerNo}】,开抽屉前检测数量【{string.Join(",", BeforeQuantity)}】");
|
||||||
var colNo=data.Select(ot => ot.ChannelStocks.Where(cs => cs.DrawerNo == drawerNo).Select(cs => cs.ColNo));
|
var colNo = data.Select(ot => ot.ChannelStocks.Where(cs => cs.DrawerNo == drawerNo).Select(cs => cs.ColNo));
|
||||||
await PortUtil.NoLightOnByCol(drawerNo, colNo.SelectMany(x => x).ToArray());
|
await PortUtil.NoLightOnByCol(drawerNo, colNo.SelectMany(x => x).ToArray());
|
||||||
}
|
}
|
||||||
var b = await PortUtil.OpenDrawerStatus(drawerNo);
|
var b = await PortUtil.OpenDrawerStatus(drawerNo);
|
||||||
|
|
@ -175,7 +184,7 @@
|
||||||
new NotificationMessage { Severity = NotificationSeverity.Error, Summary = "提示", Detail = $"抽屉【{drawerNo}】打开失败,请检测硬件", Duration = 4000 }
|
new NotificationMessage { Severity = NotificationSeverity.Error, Summary = "提示", Detail = $"抽屉【{drawerNo}】打开失败,请检测硬件", Duration = 4000 }
|
||||||
);
|
);
|
||||||
logger.Info($"抽屉打开失败");
|
logger.Info($"抽屉打开失败");
|
||||||
PortUtil.AllLightOff();
|
PortUtil.PowerOff();
|
||||||
RestData();
|
RestData();
|
||||||
stop();
|
stop();
|
||||||
}
|
}
|
||||||
|
|
@ -191,7 +200,7 @@
|
||||||
options._data = 0;
|
options._data = 0;
|
||||||
if (setting.Value.single.Contains(drawerNo))
|
if (setting.Value.single.Contains(drawerNo))
|
||||||
{
|
{
|
||||||
PortUtil.AllLightOff();
|
PortUtil.PowerOff();
|
||||||
}
|
}
|
||||||
if (index == drawerNos.Count - 1)
|
if (index == drawerNos.Count - 1)
|
||||||
{
|
{
|
||||||
|
|
@ -216,11 +225,14 @@
|
||||||
|
|
||||||
data.ForEach(cl =>
|
data.ForEach(cl =>
|
||||||
{
|
{
|
||||||
|
// cl.ChannelStocks.Where(cs => cs.DrawerNo == drawerNo).ToList().ForEach(cs =>
|
||||||
|
// {
|
||||||
|
// logger.Info($"单支抽屉【{drawerNo}】,应加药品数量【{cs.AddQuantity}】,现实加药数量【{AfterQuantity[cs.ColNo - 1] - BeforeQuantity[cs.ColNo - 1]}】");
|
||||||
|
// });
|
||||||
cl.ChannelStocks.Where(cs => cs.DrawerNo == drawerNo).ToList().ForEach(cs =>
|
cl.ChannelStocks.Where(cs => cs.DrawerNo == drawerNo).ToList().ForEach(cs =>
|
||||||
{
|
{
|
||||||
logger.Info($"单支抽屉【{drawerNo}】,应加药品数量【{cs.AddQuantity}】,现实取数量【{AfterQuantity[cs.ColNo - 1] - BeforeQuantity[cs.ColNo - 1]}】");
|
cl.ReturnQuantity = AfterQuantity[cs.ColNo - 1] - BeforeQuantity[cs.ColNo - 1];
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
next(); // continue iteration
|
next(); // continue iteration
|
||||||
|
|
@ -239,15 +251,17 @@
|
||||||
);
|
);
|
||||||
if (setting.Value.single.Contains(drawerNo))
|
if (setting.Value.single.Contains(drawerNo))
|
||||||
{
|
{
|
||||||
PortUtil.AllLightOff();
|
PortUtil.PowerOff();
|
||||||
}
|
}
|
||||||
stop();
|
stop();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
PortUtil.PowerOff();
|
||||||
}
|
}
|
||||||
|
|
||||||
void RestData()
|
void RestData()
|
||||||
{
|
{
|
||||||
|
PortUtil.PowerOff();
|
||||||
this.status = 0;
|
this.status = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -119,7 +119,7 @@
|
||||||
var b = await dialogService.OpenAsync<RecordReturnEmptyDialog>(
|
var b = await dialogService.OpenAsync<RecordReturnEmptyDialog>(
|
||||||
$"归还空瓶",
|
$"归还空瓶",
|
||||||
new Dictionary<string, object>() { { "records", list } },
|
new Dictionary<string, object>() { { "records", list } },
|
||||||
new DialogOptions() { Width = "85vw",Height="130vh", Resizable = true, Draggable = true, ShowClose = false }
|
new DialogOptions() { Width = "85vw", Resizable = true, Draggable = true, ShowClose = false }
|
||||||
);
|
);
|
||||||
if (b)
|
if (b)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -22,58 +22,58 @@
|
||||||
</RadzenStack>
|
</RadzenStack>
|
||||||
</RadzenStack>
|
</RadzenStack>
|
||||||
</RadzenFieldset>
|
</RadzenFieldset>
|
||||||
<div Style="height:vh;overflow:auto;">
|
<div Style="height:50vh;overflow:auto;">
|
||||||
<RadzenDataGrid @ref="grid"
|
<RadzenDataGrid @ref="grid"
|
||||||
LoadData="@LoadData"
|
LoadData="@LoadData"
|
||||||
IsLoading="@isLoading"
|
IsLoading="@isLoading"
|
||||||
Count="@count"
|
Count="@count"
|
||||||
EmptyText="无数据"
|
EmptyText="无数据"
|
||||||
Data="@_returnEmptys"
|
Data="@_returnEmptys"
|
||||||
AllowColumnResize="true" AllowAlternatingRows="false"
|
AllowColumnResize="true" AllowAlternatingRows="false"
|
||||||
AllowRowSelectOnRowClick="true"
|
AllowRowSelectOnRowClick="true"
|
||||||
CellClick="@((DataGridCellMouseEventArgs<MachineRecord> args) => OnCellClick(args))"
|
CellClick="@((DataGridCellMouseEventArgs<MachineRecord> args) => OnCellClick(args))"
|
||||||
AllowPaging="false" PagerHorizontalAlign="HorizontalAlign.Left" ShowPagingSummary="true" PagingSummaryFormat="{0}/{1} 共{2}条数据">
|
AllowPaging="false" PagerHorizontalAlign="HorizontalAlign.Left" ShowPagingSummary="true" PagingSummaryFormat="{0}/{1} 共{2}条数据">
|
||||||
<Columns>
|
<Columns>
|
||||||
<RadzenDataGridColumn Width="60px" Sortable="false" Filterable="false">
|
<RadzenDataGridColumn Width="60px" Sortable="false" Filterable="false">
|
||||||
<HeaderTemplate>
|
<HeaderTemplate>
|
||||||
选择
|
选择
|
||||||
</HeaderTemplate>
|
</HeaderTemplate>
|
||||||
<Template Context="LoadData">
|
<Template Context="LoadData">
|
||||||
<RadzenCheckBox TriState="false" Value="@LoadData.IsSelected" InputAttributes="@(new Dictionary<string,object>(){ { "aria-label", "Select item" }})"
|
<RadzenCheckBox TriState="false" Value="@LoadData.IsSelected" InputAttributes="@(new Dictionary<string,object>(){ { "aria-label", "Select item" }})"
|
||||||
TValue="bool" />
|
TValue="bool" />
|
||||||
</Template>
|
</Template>
|
||||||
</RadzenDataGridColumn>
|
</RadzenDataGridColumn>
|
||||||
<RadzenDataGridColumn Frozen="true" Title="操作人" Property="OperatorUser.NickName"></RadzenDataGridColumn>
|
<RadzenDataGridColumn Frozen="true" Title="操作人" Property="OperatorUser.NickName"></RadzenDataGridColumn>
|
||||||
<RadzenDataGridColumn Width="170px" Title="操作时间" Property="OperationTime"></RadzenDataGridColumn>
|
<RadzenDataGridColumn Width="170px" Title="操作时间" Property="OperationTime"></RadzenDataGridColumn>
|
||||||
<RadzenDataGridColumn Title="批次" Property="ManuNo">
|
<RadzenDataGridColumn Title="批次" Property="ManuNo">
|
||||||
<Template Context="mr">
|
<Template Context="mr">
|
||||||
<RadzenText TextStyle="TextStyle.Subtitle2" class="mb-0">@mr.ManuNo</RadzenText>
|
<RadzenText TextStyle="TextStyle.Subtitle2" class="mb-0">@mr.ManuNo</RadzenText>
|
||||||
<RadzenText TextStyle="TextStyle.Caption"> @mr.EffDate?.ToString("yyyy-MM-dd")</RadzenText>
|
<RadzenText TextStyle="TextStyle.Caption"> @mr.EffDate?.ToString("yyyy-MM-dd")</RadzenText>
|
||||||
</Template>
|
</Template>
|
||||||
</RadzenDataGridColumn>
|
</RadzenDataGridColumn>
|
||||||
<RadzenDataGridColumn Title="数量" Property="Quantity"></RadzenDataGridColumn>
|
<RadzenDataGridColumn Title="数量" Property="Quantity"></RadzenDataGridColumn>
|
||||||
<RadzenDataGridColumn Title="已还药品" Property="ReturnQuantity1"></RadzenDataGridColumn>
|
<RadzenDataGridColumn Title="已还药品" Property="ReturnQuantity1"></RadzenDataGridColumn>
|
||||||
<RadzenDataGridColumn Title="已还空瓶" Property="ReturnQuantity2"></RadzenDataGridColumn>
|
<RadzenDataGridColumn Title="已还空瓶" Property="ReturnQuantity2"></RadzenDataGridColumn>
|
||||||
<RadzenDataGridColumn Title="本次归还" Property="CurrentReturnQuantity">
|
<RadzenDataGridColumn Title="本次归还" Property="CurrentReturnQuantity">
|
||||||
<EditTemplate Context="mr">
|
<EditTemplate Context="mr">
|
||||||
<RadzenNumeric Min="0" Style="display: block" Max="@(mr.Quantity - mr.ReturnQuantity1 - mr.ReturnQuantity2)" Name="Quantity" @bind-Value=@mr.CurrentReturnQuantity />
|
<RadzenNumeric Min="0" Style="display: block" Max="@(mr.Quantity - mr.ReturnQuantity1 - mr.ReturnQuantity2)" Name="Quantity" @bind-Value=@mr.CurrentReturnQuantity />
|
||||||
</EditTemplate>
|
</EditTemplate>
|
||||||
</RadzenDataGridColumn>
|
</RadzenDataGridColumn>
|
||||||
</Columns>
|
</Columns>
|
||||||
</RadzenDataGrid>
|
</RadzenDataGrid>
|
||||||
</div>
|
</div>
|
||||||
<RadzenStack Orientation="Orientation.Horizontal" JustifyContent="JustifyContent.Center" Gap="0.5rem" Style="margin-top:15px;">
|
<RadzenStack Orientation="Orientation.Horizontal" JustifyContent="JustifyContent.Center" Gap="0.5rem" Style="margin-top:15px;">
|
||||||
@if (status < 2)
|
@if (status < 2)
|
||||||
{
|
{
|
||||||
<RadzenButton Click="@StartAdd" IsBusy="status > 0" BusyText="还空瓶中。。。" ButtonStyle="ButtonStyle.Warning" Variant="Variant.Flat" Text="归还" Style="width: 120px" />
|
<RadzenButton Click="@StartAdd" IsBusy="status > 0" BusyText="还空瓶中。。。" ButtonStyle="ButtonStyle.Warning" Variant="Variant.Flat" Text="归还" Style="width: 120px" />
|
||||||
}
|
}
|
||||||
@if (status == 2)
|
@if (status == 2)
|
||||||
{
|
{
|
||||||
<RadzenButton Click="@AddFinish" ButtonStyle="ButtonStyle.Success" Variant="Variant.Flat" Text="完成" Style="width: 120px" />
|
<RadzenButton Click="@AddFinish" ButtonStyle="ButtonStyle.Success" Variant="Variant.Flat" Text="完成" Style="width: 120px" />
|
||||||
}
|
}
|
||||||
@if (status < 2)
|
@if (status < 2)
|
||||||
{
|
{
|
||||||
<RadzenButton Click="@((args) => CancelOpera())" Variant="Variant.Flat" Text="取消" Style="width: 120px" />
|
<RadzenButton Click="@((args) => CancelOpera())" Variant="Variant.Flat" Text="取消" Style="width: 120px" />
|
||||||
}
|
}
|
||||||
</RadzenStack>
|
</RadzenStack>
|
||||||
@code
|
@code
|
||||||
|
|
@ -169,6 +169,8 @@
|
||||||
async Task OpenDrawer()
|
async Task OpenDrawer()
|
||||||
{
|
{
|
||||||
this.status = 1;
|
this.status = 1;
|
||||||
|
PortUtil.PowerOn();
|
||||||
|
await Task.Delay(200);
|
||||||
// 解析需要打开的抽屉列表
|
// 解析需要打开的抽屉列表
|
||||||
|
|
||||||
int drawerNo = records.DrawerNo;
|
int drawerNo = records.DrawerNo;
|
||||||
|
|
@ -215,7 +217,7 @@
|
||||||
new NotificationMessage { Severity = NotificationSeverity.Error, Summary = "提示", Detail = $"抽屉【{drawerNo}】打开失败,请检测硬件", Duration = 4000 }
|
new NotificationMessage { Severity = NotificationSeverity.Error, Summary = "提示", Detail = $"抽屉【{drawerNo}】打开失败,请检测硬件", Duration = 4000 }
|
||||||
);
|
);
|
||||||
logger.Info($"抽屉打开失败");
|
logger.Info($"抽屉打开失败");
|
||||||
PortUtil.AllLightOff();
|
PortUtil.PowerOff();
|
||||||
RestData();
|
RestData();
|
||||||
stop();
|
stop();
|
||||||
}
|
}
|
||||||
|
|
@ -231,7 +233,7 @@
|
||||||
options._data = 0;
|
options._data = 0;
|
||||||
if (setting.Value.single.Contains(drawerNo))
|
if (setting.Value.single.Contains(drawerNo))
|
||||||
{
|
{
|
||||||
PortUtil.AllLightOff();
|
PortUtil.PowerOff();
|
||||||
}
|
}
|
||||||
PortUtil.speechSynthesizer.SpeakAsyncCancelAll();
|
PortUtil.speechSynthesizer.SpeakAsyncCancelAll();
|
||||||
PortUtil.SpeakAsync($"加药完成,请,点击完成按钮进行确认");
|
PortUtil.SpeakAsync($"加药完成,请,点击完成按钮进行确认");
|
||||||
|
|
@ -271,15 +273,17 @@
|
||||||
);
|
);
|
||||||
if (setting.Value.single.Contains(drawerNo))
|
if (setting.Value.single.Contains(drawerNo))
|
||||||
{
|
{
|
||||||
PortUtil.AllLightOff();
|
PortUtil.PowerOff();
|
||||||
}
|
}
|
||||||
stop();
|
stop();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
PortUtil.PowerOff();
|
||||||
}
|
}
|
||||||
|
|
||||||
void RestData()
|
void RestData()
|
||||||
{
|
{
|
||||||
|
PortUtil.PowerOff();
|
||||||
this.status = 0;
|
this.status = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -169,7 +169,7 @@
|
||||||
new NotificationMessage { Severity = NotificationSeverity.Error, Summary = "提示", Detail = $"抽屉【{drawerNo}】打开失败,请检测硬件", Duration = 4000 }
|
new NotificationMessage { Severity = NotificationSeverity.Error, Summary = "提示", Detail = $"抽屉【{drawerNo}】打开失败,请检测硬件", Duration = 4000 }
|
||||||
);
|
);
|
||||||
logger.Info($"抽屉打开失败");
|
logger.Info($"抽屉打开失败");
|
||||||
PortUtil.AllLightOff();
|
PortUtil.PowerOff();
|
||||||
RestData();
|
RestData();
|
||||||
stop();
|
stop();
|
||||||
}
|
}
|
||||||
|
|
@ -193,7 +193,7 @@
|
||||||
});
|
});
|
||||||
PortUtil.Operate = false;
|
PortUtil.Operate = false;
|
||||||
orderTakeVo.Status = 2;
|
orderTakeVo.Status = 2;
|
||||||
PortUtil.AllLightOff();
|
PortUtil.PowerOff();
|
||||||
if (options._data == drawerNos.Count - 1)
|
if (options._data == drawerNos.Count - 1)
|
||||||
{
|
{
|
||||||
PortUtil.speechSynthesizer.SpeakAsyncCancelAll();
|
PortUtil.speechSynthesizer.SpeakAsyncCancelAll();
|
||||||
|
|
@ -291,7 +291,7 @@
|
||||||
);
|
);
|
||||||
if (setting.Value.single.Contains(drawerNo))
|
if (setting.Value.single.Contains(drawerNo))
|
||||||
{
|
{
|
||||||
PortUtil.AllLightOff();
|
PortUtil.PowerOff();
|
||||||
}
|
}
|
||||||
stop();
|
stop();
|
||||||
}
|
}
|
||||||
|
|
@ -304,6 +304,7 @@
|
||||||
}
|
}
|
||||||
void RestData()
|
void RestData()
|
||||||
{
|
{
|
||||||
|
PortUtil.PowerOff();
|
||||||
PortUtil.speechSynthesizer.SpeakAsyncCancelAll();
|
PortUtil.speechSynthesizer.SpeakAsyncCancelAll();
|
||||||
this.status = 0;
|
this.status = 0;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
.rz-custom-header {
|
.rz-custom-header {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
<RadzenStack Orientation="Orientation.Horizontal">
|
<RadzenStack Orientation="Orientation.Horizontal">
|
||||||
|
|
@ -31,14 +31,14 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<RadzenDataGrid @ref="grid"
|
<RadzenDataGrid @ref="grid"
|
||||||
LoadData="@LoadData"
|
LoadData="@LoadData"
|
||||||
IsLoading="@isLoading"
|
IsLoading="@isLoading"
|
||||||
Count="@count"
|
Count="@count"
|
||||||
EmptyText="无数据"
|
EmptyText="无数据"
|
||||||
Data="@channels"
|
Data="@channels"
|
||||||
AllowColumnResize="true" AllowAlternatingRows="false"
|
AllowColumnResize="true" AllowAlternatingRows="false"
|
||||||
CellClick="@((DataGridCellMouseEventArgs<ChannelStock> args) => OnCellClick(args))"
|
CellClick="@((DataGridCellMouseEventArgs<ChannelStock> args) => OnCellClick(args))"
|
||||||
AllowPaging="true" PageSize="10" PagerHorizontalAlign="HorizontalAlign.Left" ShowPagingSummary="true" PagingSummaryFormat="{0}/{1} 共{2}条数据">
|
AllowPaging="true" PageSize="10" PagerHorizontalAlign="HorizontalAlign.Left" ShowPagingSummary="true" PagingSummaryFormat="{0}/{1} 共{2}条数据">
|
||||||
<HeaderTemplate>
|
<HeaderTemplate>
|
||||||
<RadzenRow JustifyContent="JustifyContent.End">
|
<RadzenRow JustifyContent="JustifyContent.End">
|
||||||
@if (status < 3)
|
@if (status < 3)
|
||||||
|
|
@ -157,6 +157,8 @@
|
||||||
async Task OpenDrawer()
|
async Task OpenDrawer()
|
||||||
{
|
{
|
||||||
this.status = 1;
|
this.status = 1;
|
||||||
|
PortUtil.PowerOn();
|
||||||
|
await Task.Delay(200);
|
||||||
// 根据抽屉类型来决定打开前是否需要查询数量
|
// 根据抽屉类型来决定打开前是否需要查询数量
|
||||||
var promiseUtil = new PromiseUtil<object>();
|
var promiseUtil = new PromiseUtil<object>();
|
||||||
await promiseUtil.taskAsyncLoop(500, null, async (data, next, stop) =>
|
await promiseUtil.taskAsyncLoop(500, null, async (data, next, stop) =>
|
||||||
|
|
@ -236,16 +238,18 @@
|
||||||
);
|
);
|
||||||
if (setting.Value.single.Contains(this.drawerNo))
|
if (setting.Value.single.Contains(this.drawerNo))
|
||||||
{
|
{
|
||||||
PortUtil.AllLightOff();
|
PortUtil.PowerOff();
|
||||||
}
|
}
|
||||||
RestData();
|
RestData();
|
||||||
stop();
|
stop();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
PortUtil.PowerOff();
|
||||||
}
|
}
|
||||||
|
|
||||||
void RestData()
|
void RestData()
|
||||||
{
|
{
|
||||||
|
PortUtil.PowerOff();
|
||||||
PortUtil.speechSynthesizer.SpeakAsyncCancelAll();
|
PortUtil.speechSynthesizer.SpeakAsyncCancelAll();
|
||||||
this.status = 0;
|
this.status = 0;
|
||||||
this.BeforeQuantity = new int[9];
|
this.BeforeQuantity = new int[9];
|
||||||
|
|
|
||||||
|
|
@ -3,124 +3,61 @@
|
||||||
@using Radzen.Blazor.Rendering
|
@using Radzen.Blazor.Rendering
|
||||||
<style>
|
<style>
|
||||||
@@keyframes shake {
|
@@keyframes shake {
|
||||||
0% {
|
0% {
|
||||||
opacity: 1;
|
opacity: 1;
|
||||||
color: red;
|
color: red;
|
||||||
}
|
}
|
||||||
|
|
||||||
25% {
|
25% {
|
||||||
opacity: 1;
|
opacity: 1;
|
||||||
color: orange;
|
color: orange;
|
||||||
}
|
}
|
||||||
|
|
||||||
50% {
|
50% {
|
||||||
opacity: 0;
|
opacity: 0;
|
||||||
color: yellow;
|
color: yellow;
|
||||||
}
|
}
|
||||||
|
|
||||||
75% {
|
75% {
|
||||||
opacity: 1;
|
opacity: 1;
|
||||||
color: crimson;
|
color: crimson;
|
||||||
}
|
}
|
||||||
|
|
||||||
100% {
|
100% {
|
||||||
opacity: 1;
|
opacity: 1;
|
||||||
color: red;
|
color: red;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.rz-custom-header {
|
.rz-custom-header {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
.shaky-text {
|
.shaky-text {
|
||||||
animation: shake 2s infinite ease-in-out;
|
animation: shake 2s infinite ease-in-out;
|
||||||
/* 你可以根据需要调整动画的持续时间和迭代次数 */
|
/* 你可以根据需要调整动画的持续时间和迭代次数 */
|
||||||
transition: color 0.5s linear,opacity 0.5s linear;
|
transition: color 0.5s linear,opacity 0.5s linear;
|
||||||
}
|
}
|
||||||
|
|
||||||
.my-popup {
|
.my-popup {
|
||||||
display: none;
|
display: none;
|
||||||
position:absolute;
|
position: absolute;
|
||||||
overflow: auto;
|
overflow: auto;
|
||||||
/* height: 360px; */
|
/* height: 360px; */
|
||||||
width: 900px;
|
width: 900px;
|
||||||
border: var(--rz-panel-border);
|
border: var(--rz-panel-border);
|
||||||
background-color: var(--rz-panel-background-color);
|
background-color: var(--rz-panel-background-color);
|
||||||
box-shadow: var(--rz-panel-shadow);
|
box-shadow: var(--rz-panel-shadow);
|
||||||
border-radius: var(--rz-border-radius);
|
border-radius: var(--rz-border-radius);
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
<div class="col-12 mb-4">
|
<div class="col-12 mb-4">
|
||||||
|
|
||||||
<form onsubmit="@(() => grid.Reload())">
|
@* <form onsubmit="@(() => grid.Reload())">
|
||||||
<RadzenFieldset Text="报表导出">
|
<RadzenFieldset Text="报表导出">
|
||||||
<RadzenStack Orientation="Orientation.Horizontal" Gap="1rem">
|
<RadzenStack Orientation="Orientation.Horizontal" Gap="1rem">
|
||||||
@*<RadzenRow AlignItems="AlignItems.Center">
|
|
||||||
<RadzenColumn Size="4">
|
|
||||||
<RadzenLabel Text="开始时间" Component="Start" />
|
|
||||||
</RadzenColumn>
|
|
||||||
<RadzenColumn Size="8">
|
|
||||||
<RadzenDatePicker DateFormat="yyyy-MM-dd HH:mm:ss" ShowTime="true" @bind-Value="start" Style="width: 100%;" Name="Start" />
|
|
||||||
</RadzenColumn>
|
|
||||||
</RadzenRow>
|
|
||||||
<RadzenRow AlignItems="AlignItems.Center">
|
|
||||||
<RadzenColumn Size="4">
|
|
||||||
<RadzenLabel Text="结束时间" Component="End" />
|
|
||||||
</RadzenColumn>
|
|
||||||
<RadzenColumn Size="8">
|
|
||||||
<RadzenDatePicker DateFormat="yyyy-MM-dd HH:mm:ss" ShowTime="true" @bind-Value="end" Style="width: 100%;" Name="End" />
|
|
||||||
</RadzenColumn>
|
|
||||||
</RadzenRow>
|
|
||||||
<RadzenRow AlignItems="AlignItems.Center">
|
|
||||||
<RadzenColumn Size="6">
|
|
||||||
<RadzenLabel Text="药品名称/拼音码/编码" Component="drug" />
|
|
||||||
</RadzenColumn>
|
|
||||||
<RadzenColumn Size="6">
|
|
||||||
<RadzenAutoComplete Name="drug" Multiline="true" @bind-Value=@drugName Data=@drugInfo TextProperty="@nameof(DrugInfo.DrugNameSpecManufactory)"
|
|
||||||
Style="width: 100%;" InputAttributes="@(new Dictionary<string, object>() { { "aria-label", "drugInfo" } })" />
|
|
||||||
</RadzenColumn>
|
|
||||||
</RadzenRow>
|
|
||||||
|
|
||||||
<RadzenRow AlignItems="AlignItems.Center">
|
|
||||||
<RadzenColumn Size="12">
|
|
||||||
<RadzenButton Size="ButtonSize.Large" ButtonType="ButtonType.Submit" IsBusy="isLoading" Icon="search" Text="查询" />
|
|
||||||
<RadzenButton Size="ButtonSize.Large" Click="reloadGrid" IsBusy="isLoading" Icon="refresh" Text="重置" ButtonStyle="ButtonStyle.Warning" />
|
|
||||||
</RadzenColumn>
|
|
||||||
</RadzenRow>
|
|
||||||
<RadzenRow JustifyContent="JustifyContent.End" AlignItems="AlignItems.Center">
|
<RadzenRow JustifyContent="JustifyContent.End" AlignItems="AlignItems.Center">
|
||||||
<RadzenButton Icon="download" Text="库存导出" Variant="Variant.Outlined" Click="StockExport" />
|
<RadzenButton @ref=button Icon="download" Text="专用账册导出" Variant="Variant.Outlined" Click="@(args => popup2.ToggleAsync(button.Element))" />
|
||||||
<RadzenButton Icon="download" Text="专用账册导出" Variant="Variant.Outlined" Click="AccountBookExport" />
|
|
||||||
</RadzenRow>*@
|
|
||||||
<RadzenRow JustifyContent="JustifyContent.End" AlignItems="AlignItems.Center">
|
|
||||||
@* <RadzenButton @ref=button Icon="download" Text="库存导出" Variant="Variant.Outlined" Click="@(args => popup.ToggleAsync(button.Element))" /> *@
|
|
||||||
<RadzenButton @ref=button Icon="download" Text="专用账册导出" Variant="Variant.Outlined" Click="@(args => popup2.ToggleAsync(button.Element))" />
|
|
||||||
|
|
||||||
@* <Popup @ref=popup Lazy=true class="my-popup">
|
|
||||||
<RadzenStack Orientation="Orientation.Vertical" Gap="1rem" class="rz-h-100 rz-p-4">
|
|
||||||
<RadzenFieldset Text="条件选择" >
|
|
||||||
<RadzenStack Orientation="Orientation.Horizontal" Gap="1rem" >
|
|
||||||
<RadzenRow AlignItems="AlignItems.Center">
|
|
||||||
<RadzenColumn Size="6">
|
|
||||||
<RadzenLabel Text="药品名称/拼音码/编码" Component="drug" />
|
|
||||||
</RadzenColumn>
|
|
||||||
<RadzenColumn Size="6">
|
|
||||||
<RadzenAutoComplete Name="drug" Multiline="true" @bind-Value=@drugName Data=@drugInfo TextProperty="@nameof(DrugInfo.DrugNameSpecManufactory)"
|
|
||||||
Style="width: 100%;" InputAttributes="@(new Dictionary<string, object>() { { "aria-label", "drugInfo" } })" />
|
|
||||||
</RadzenColumn>
|
|
||||||
</RadzenRow>
|
|
||||||
|
|
||||||
<RadzenRow AlignItems="AlignItems.Center">
|
|
||||||
<RadzenColumn Size="12">
|
|
||||||
<RadzenButton Size="ButtonSize.Large" Click="reloadGrid" IsBusy="isLoading" Icon="refresh" Text="重置" ButtonStyle="ButtonStyle.Warning" />
|
|
||||||
</RadzenColumn>
|
|
||||||
</RadzenRow>
|
|
||||||
<RadzenRow JustifyContent="JustifyContent.End" AlignItems="AlignItems.Center">
|
|
||||||
<RadzenButton Icon="download" Text="导出" Variant="Variant.Outlined" Click="StockExport" />
|
|
||||||
</RadzenRow>
|
|
||||||
</RadzenStack>
|
|
||||||
</RadzenFieldset>
|
|
||||||
</RadzenStack>
|
|
||||||
</Popup> *@
|
|
||||||
<Popup @ref=popup2 Lazy=true class="my-popup">
|
<Popup @ref=popup2 Lazy=true class="my-popup">
|
||||||
<RadzenStack Orientation="Orientation.Vertical" Gap="1rem" class="rz-h-100 rz-p-4">
|
<RadzenStack Orientation="Orientation.Vertical" Gap="1rem" class="rz-h-100 rz-p-4">
|
||||||
<RadzenFieldset Text="条件选择">
|
<RadzenFieldset Text="条件选择">
|
||||||
|
|
@ -170,18 +107,18 @@
|
||||||
</RadzenRow>
|
</RadzenRow>
|
||||||
</RadzenStack>
|
</RadzenStack>
|
||||||
</RadzenFieldset>
|
</RadzenFieldset>
|
||||||
</form>
|
</form> *@
|
||||||
</div>
|
</div>
|
||||||
<div class="col-12 mb-4">
|
<div class="col-12 mb-4">
|
||||||
|
|
||||||
<RadzenDataGrid @ref="grid"
|
<RadzenDataGrid @ref="grid"
|
||||||
IsLoading="@isLoading"
|
IsLoading="@isLoading"
|
||||||
RowRender="@RowRender"
|
RowRender="@RowRender"
|
||||||
EmptyText="无数据"
|
EmptyText="无数据"
|
||||||
Data="@_forecasts"
|
Data="@_forecasts"
|
||||||
AllowColumnResize="true" AllowAlternatingRows="false"
|
AllowColumnResize="true" AllowAlternatingRows="false"
|
||||||
SelectionMode="DataGridSelectionMode.Single"
|
SelectionMode="DataGridSelectionMode.Single"
|
||||||
ExpandMode="DataGridExpandMode.Multiple">
|
ExpandMode="DataGridExpandMode.Single">
|
||||||
@* <HeaderTemplate>
|
@* <HeaderTemplate>
|
||||||
<RadzenRow JustifyContent="JustifyContent.End" AlignItems="AlignItems.Center">
|
<RadzenRow JustifyContent="JustifyContent.End" AlignItems="AlignItems.Center">
|
||||||
<RadzenButton Icon="download" Text="库存导出" Variant="Variant.Outlined" Click="StockExport" />
|
<RadzenButton Icon="download" Text="库存导出" Variant="Variant.Outlined" Click="StockExport" />
|
||||||
|
|
@ -193,7 +130,39 @@
|
||||||
<Columns>
|
<Columns>
|
||||||
<RadzenDataGridColumn Title="库位" Property="DrawerNo">
|
<RadzenDataGridColumn Title="库位" Property="DrawerNo">
|
||||||
<Template Context="s">
|
<Template Context="s">
|
||||||
@s.DrawerNo - @s.ColNo
|
@if (s.MachineId == "DM5")
|
||||||
|
{
|
||||||
|
switch (s.DrawerNo)
|
||||||
|
{
|
||||||
|
case 99:
|
||||||
|
@("急诊药盒")
|
||||||
|
break;
|
||||||
|
case 111:
|
||||||
|
@("恢复室药盒")
|
||||||
|
break;
|
||||||
|
case 31:
|
||||||
|
@("胃镜药盒")
|
||||||
|
break;
|
||||||
|
case 32:
|
||||||
|
@("导管药盒")
|
||||||
|
break;
|
||||||
|
case 33:
|
||||||
|
@("生殖药盒")
|
||||||
|
break;
|
||||||
|
case 34:
|
||||||
|
@("妇门药盒")
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
@* @($"{s.DrawerNo}-{(s.ColNo == 1 ? '白' : '绿')}") *@
|
||||||
|
@("常规神外药盒")
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
@($"{s.DrawerNo}-{s.ColNo}")
|
||||||
|
}
|
||||||
</Template>
|
</Template>
|
||||||
</RadzenDataGridColumn>
|
</RadzenDataGridColumn>
|
||||||
<RadzenDataGridColumn Title="数量" Property="Quantity">
|
<RadzenDataGridColumn Title="数量" Property="Quantity">
|
||||||
|
|
@ -212,7 +181,7 @@
|
||||||
// }
|
// }
|
||||||
// else
|
// else
|
||||||
//{
|
//{
|
||||||
@s.EffDate
|
@s.EffDate
|
||||||
//}
|
//}
|
||||||
}
|
}
|
||||||
</Template>
|
</Template>
|
||||||
|
|
@ -225,7 +194,7 @@
|
||||||
<RadzenDataGridColumn Title="规格" Property="DrugSpec"></RadzenDataGridColumn>
|
<RadzenDataGridColumn Title="规格" Property="DrugSpec"></RadzenDataGridColumn>
|
||||||
<RadzenDataGridColumn Title="总库存" Property="StockQuantity">
|
<RadzenDataGridColumn Title="总库存" Property="StockQuantity">
|
||||||
<Template Context="s">
|
<Template Context="s">
|
||||||
@* @if (s.StockQuantity < 10)
|
@* @if (s.StockQuantity < 10)
|
||||||
{
|
{
|
||||||
@s.StockQuantity
|
@s.StockQuantity
|
||||||
|
|
||||||
|
|
@ -233,7 +202,7 @@
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ *@
|
{ *@
|
||||||
@s.StockQuantity
|
@s.StockQuantity
|
||||||
@* } *@
|
@* } *@
|
||||||
</Template>
|
</Template>
|
||||||
</RadzenDataGridColumn>
|
</RadzenDataGridColumn>
|
||||||
|
|
@ -255,7 +224,7 @@
|
||||||
|
|
||||||
string drugName;
|
string drugName;
|
||||||
RadzenButton button;
|
RadzenButton button;
|
||||||
|
|
||||||
Popup popup2;
|
Popup popup2;
|
||||||
IEnumerable<DrugInfo> drugInfo;
|
IEnumerable<DrugInfo> drugInfo;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -12,6 +12,8 @@ namespace MasaBlazorApp3.Pojo
|
||||||
public int BoxNo { get; set; }
|
public int BoxNo { get; set; }
|
||||||
//药箱号
|
//药箱号
|
||||||
public int BoxName { get; set; }
|
public int BoxName { get; set; }
|
||||||
public string 药箱号 { get; set; } = "药箱号";
|
public string 药箱号 {
|
||||||
|
get => BoxName + "-" + BoxNo;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -57,6 +57,6 @@ namespace MasaBlazorApp3.Pojo
|
||||||
public bool IsChecked{get;set;} = false;
|
public bool IsChecked{get;set;} = false;
|
||||||
//手术室药盒中的库存总数
|
//手术室药盒中的库存总数
|
||||||
[Column(IsColumn = false)]
|
[Column(IsColumn = false)]
|
||||||
public bool BoxDisabled {get;set;} = false;
|
public bool BoxDisabled {get;set;} = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -27,6 +27,9 @@ namespace MasaBlazorApp3.Pojo
|
||||||
|
|
||||||
[Column("quantity")]
|
[Column("quantity")]
|
||||||
public int Quantity { get; set; }
|
public int Quantity { get; set; }
|
||||||
|
|
||||||
|
[Column(IsColumn =false)]
|
||||||
|
public int TotalQuantity { get; set; }
|
||||||
|
|
||||||
//药盒DrawerType为非1时表示不在库
|
//药盒DrawerType为非1时表示不在库
|
||||||
[Column("drawer_type")]
|
[Column("drawer_type")]
|
||||||
|
|
@ -54,7 +57,7 @@ namespace MasaBlazorApp3.Pojo
|
||||||
public int AddQuantity { get; set; } = 0;
|
public int AddQuantity { get; set; } = 0;
|
||||||
|
|
||||||
[Column(IsColumn = false)]
|
[Column(IsColumn = false)]
|
||||||
public int ReturnQuantity { get; set; }
|
public int ReturnQuantity { get; set; } = 0;
|
||||||
|
|
||||||
[Column("dmnguid")]
|
[Column("dmnguid")]
|
||||||
public string Dmnguid { get; set; }
|
public string Dmnguid { get; set; }
|
||||||
|
|
@ -94,5 +97,29 @@ namespace MasaBlazorApp3.Pojo
|
||||||
public int BoxState { get; set; }
|
public int BoxState { get; set; }
|
||||||
[Column("fill_time")]
|
[Column("fill_time")]
|
||||||
public DateTime FillTime { get; set; }
|
public DateTime FillTime { get; set; }
|
||||||
|
//药盒中药品对应的处方信息
|
||||||
|
[Column(IsColumn =false)]
|
||||||
|
public List<OrderInfo> OrderList { get; set; }
|
||||||
|
//药盒中药品对应的选中的处方信息
|
||||||
|
[Column(IsColumn =false)]
|
||||||
|
public IList<OrderInfo> SelectedOrderList { get; set; }
|
||||||
|
//还空瓶库位
|
||||||
|
[Column(IsColumn = false)]
|
||||||
|
public ChannelStock EmptyStock { get; set; }
|
||||||
|
//还空瓶数
|
||||||
|
[Column(IsColumn = false)]
|
||||||
|
public int EmptyQuantity { get; set; } = 0;
|
||||||
|
//用药数
|
||||||
|
[Column(IsColumn =false)]
|
||||||
|
public int UseQuantity { get; set; }
|
||||||
|
//处方数
|
||||||
|
[Column(IsColumn =false)]
|
||||||
|
public int OrderQuantity { get; set; }
|
||||||
|
//药盒中未绑套餐的药所在抽屉库位
|
||||||
|
[Column(IsColumn =false)]
|
||||||
|
public List<ChannelStock> DrawerChanneStockList { get; set; }
|
||||||
|
//药盒中未绑套餐的药所在抽屉库位
|
||||||
|
[Column(IsColumn = false)]
|
||||||
|
public ChannelStock ReturnDrawerChanneStock { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,8 @@ namespace MasaBlazorApp3.Pojo.Config
|
||||||
{
|
{
|
||||||
public string machineId { get; set; }
|
public string machineId { get; set; }
|
||||||
public string storage { get; set; }
|
public string storage { get; set; }
|
||||||
|
//调拨入库时的in_Pharmacy_Id字段值与storage不一致不确定是传错了还是就两个值先加上这个配置
|
||||||
|
public string inPharmacyId { get; set; }
|
||||||
public int loginMode { get; set; }
|
public int loginMode { get; set; }
|
||||||
public bool opFirst { get; set; }
|
public bool opFirst { get; set; }
|
||||||
//自动退出登录时间,单位秒(0不自动退出)
|
//自动退出登录时间,单位秒(0不自动退出)
|
||||||
|
|
@ -18,6 +20,9 @@ namespace MasaBlazorApp3.Pojo.Config
|
||||||
public string boxMachineId { get; set; }
|
public string boxMachineId { get; set; }
|
||||||
//手术室名称
|
//手术室名称
|
||||||
public string roomName { get; set; }
|
public string roomName { get; set; }
|
||||||
|
//麻醉医师姓名
|
||||||
|
public string anaesthetist_name { get; set; }
|
||||||
|
public string boxColor { get; set; }
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -54,7 +54,13 @@ namespace MasaBlazorApp3.Pojo
|
||||||
[Column(IsColumn = false)]
|
[Column(IsColumn = false)]
|
||||||
public int StockQuantity
|
public int StockQuantity
|
||||||
{
|
{
|
||||||
get { return Stocks.Aggregate(0, (current, next) => current + next.Quantity); ; }
|
get { return Stocks.Aggregate(0, (current, next) => current + next.Quantity); }
|
||||||
|
}
|
||||||
|
//药盒基数
|
||||||
|
[Column(IsColumn = false)]
|
||||||
|
public int BoxBaseQuantity
|
||||||
|
{
|
||||||
|
get { return Stocks.Aggregate(0, (current, next) => current+next.BaseQuantity);}
|
||||||
}
|
}
|
||||||
|
|
||||||
public override bool Equals(object o)
|
public override bool Equals(object o)
|
||||||
|
|
@ -69,6 +75,15 @@ namespace MasaBlazorApp3.Pojo
|
||||||
return $"名称: {DrugName},规格:{DrugSpec}";
|
return $"名称: {DrugName},规格:{DrugSpec}";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Column(IsColumn = false)]
|
||||||
|
public string DrugNameSpec
|
||||||
|
{
|
||||||
|
get => DrugName + " ; " + DrugSpec + ";"+ Manufactory;
|
||||||
|
}
|
||||||
|
|
||||||
|
[Column(IsColumn =false)]
|
||||||
|
public string set_manu_no { get; set; }
|
||||||
|
[Column(IsColumn =false)]
|
||||||
|
public string set_eff_Date { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -156,5 +156,15 @@ namespace MasaBlazorApp3.Pojo
|
||||||
}
|
}
|
||||||
return machineRecord;
|
return machineRecord;
|
||||||
}
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 药盒号
|
||||||
|
///</summary>
|
||||||
|
[Column("Box_Drawer")]
|
||||||
|
public int? BoxDrawer { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 药盒号
|
||||||
|
///</summary>
|
||||||
|
[Column("Box_ColNo")]
|
||||||
|
public int? BoxColNo { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -135,8 +135,16 @@ namespace MasaBlazorApp3.Pojo
|
||||||
///</summary>
|
///</summary>
|
||||||
[Column("use_dosage")]
|
[Column("use_dosage")]
|
||||||
public string UseDosage { get; set; }
|
public string UseDosage { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// 默认值: NULL
|
||||||
|
///</summary>
|
||||||
|
[Column(IsColumn = false)]
|
||||||
|
public int? TotalQuantity { get; set; } = null;
|
||||||
|
|
||||||
[LinqToDB.Mapping.Association(ThisKey = nameof(SetManuNo), OtherKey = nameof(DrugManuNo.ManuNo))]
|
[LinqToDB.Mapping.Association(ThisKey = nameof(SetManuNo), OtherKey = nameof(DrugManuNo.ManuNo))]
|
||||||
public DrugManuNo? drugManuNo { get; set; }
|
public DrugManuNo? drugManuNo { get; set; }
|
||||||
|
[Column(IsColumn =false)]
|
||||||
|
public string DrugName { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -164,8 +164,13 @@ namespace MasaBlazorApp3.Pojo
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 是否选中
|
/// 是否选中
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Column(IsColumn =false)]
|
[Column(IsColumn = false)]
|
||||||
public bool ItemIsChecked { get; set; }
|
public bool ItemIsChecked { get; set; } = true;
|
||||||
|
/// <summary>
|
||||||
|
/// 是否全先中
|
||||||
|
/// </summary>
|
||||||
|
[Column(IsColumn = false)]
|
||||||
|
public bool AllItemIsChecked { get; set; } = true;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 麻醉师
|
/// 麻醉师
|
||||||
|
|
@ -177,5 +182,8 @@ namespace MasaBlazorApp3.Pojo
|
||||||
///</summary>
|
///</summary>
|
||||||
[Column("op_room_name")]
|
[Column("op_room_name")]
|
||||||
public string RoomName { get; set; }
|
public string RoomName { get; set; }
|
||||||
|
//药盒中药品对应的选中的处方信息
|
||||||
|
[Column(IsColumn = false)]
|
||||||
|
public IList<OrderInfo> SelectedOrderList { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -34,30 +34,30 @@ namespace MasaBlazorApp3.Pojo
|
||||||
PremissionPath = "take"
|
PremissionPath = "take"
|
||||||
};
|
};
|
||||||
|
|
||||||
q.AddChild(new Premission()
|
//q.AddChild(new Premission()
|
||||||
{
|
//{
|
||||||
Id = 11,
|
// Id = 11,
|
||||||
PremissionName = "处方取药",
|
// PremissionName = "处方取药",
|
||||||
PremissionPath = "/take/order"
|
// PremissionPath = "/take/order"
|
||||||
});
|
//});
|
||||||
q.AddChild(new Premission()
|
//q.AddChild(new Premission()
|
||||||
{
|
//{
|
||||||
Id = 12,
|
// Id = 12,
|
||||||
PremissionName = "调拨取药",
|
// PremissionName = "调拨取药",
|
||||||
PremissionPath = "/take/invoice"
|
// PremissionPath = "/take/invoice"
|
||||||
});
|
//});
|
||||||
q.AddChild(new Premission()
|
q.AddChild(new Premission()
|
||||||
{
|
{
|
||||||
Id = 13,
|
Id = 13,
|
||||||
PremissionName = "抽屉取药",
|
PremissionName = "抽屉取药",
|
||||||
PremissionPath = "/take/drawer"
|
PremissionPath = "/take/drawer"
|
||||||
});
|
});
|
||||||
q.AddChild(new Premission()
|
//q.AddChild(new Premission()
|
||||||
{
|
//{
|
||||||
Id = 14,
|
// Id = 14,
|
||||||
PremissionName = "自选取药",
|
// PremissionName = "自选取药",
|
||||||
PremissionPath = "/take/self"
|
// PremissionPath = "/take/self"
|
||||||
});
|
//});
|
||||||
q.AddChild(new Premission()
|
q.AddChild(new Premission()
|
||||||
{
|
{
|
||||||
Id = 15,
|
Id = 15,
|
||||||
|
|
@ -108,18 +108,18 @@ namespace MasaBlazorApp3.Pojo
|
||||||
// PremissionName = "归还药品(处方)",
|
// PremissionName = "归还药品(处方)",
|
||||||
// PremissionPath = "/return/order"
|
// PremissionPath = "/return/order"
|
||||||
//});
|
//});
|
||||||
h.AddChild(new Premission()
|
//h.AddChild(new Premission()
|
||||||
{
|
//{
|
||||||
Id = 32,
|
// Id = 32,
|
||||||
PremissionName = "归还药品(记录)",
|
// PremissionName = "归还药品(记录)",
|
||||||
PremissionPath = "/return/byRecord"
|
// PremissionPath = "/return/byRecord"
|
||||||
});
|
//});
|
||||||
h.AddChild(new Premission()
|
//h.AddChild(new Premission()
|
||||||
{
|
//{
|
||||||
Id = 33,
|
// Id = 33,
|
||||||
PremissionName = "归还空瓶",
|
// PremissionName = "归还空瓶",
|
||||||
PremissionPath = "/return/empty"
|
// PremissionPath = "/return/empty"
|
||||||
});
|
//});
|
||||||
h.AddChild(new Premission()
|
h.AddChild(new Premission()
|
||||||
{
|
{
|
||||||
Id = 34,
|
Id = 34,
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,13 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace MasaBlazorApp3.Pojo
|
||||||
|
{
|
||||||
|
public class ReturnChannelStock
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -487,6 +487,39 @@ namespace MasaBlazorApp3.Port
|
||||||
canBusSerial.Write(buffer, 0, 8);
|
canBusSerial.Write(buffer, 0, 8);
|
||||||
canBusSerialTwo.Write(buffer, 0, 8);
|
canBusSerialTwo.Write(buffer, 0, 8);
|
||||||
}
|
}
|
||||||
|
//单支板通电
|
||||||
|
public void PowerOn()
|
||||||
|
{
|
||||||
|
if (_portConfig.StorageCan == 2)
|
||||||
|
{
|
||||||
|
canBusSerial.DiscardInBuffer();
|
||||||
|
byte[] buffer = new byte[] { 0xaa, 0x01, 0x05, 0x07, 0x01, 0x00, 0x00, 0xee };
|
||||||
|
canBusSerial.Write(buffer, 0, 8);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
canBusSerialTwo.DiscardInBuffer();
|
||||||
|
byte[] buffer = new byte[] { 0xaa, 0x01, 0x05, 0x07, 0x01, 0x00, 0x00, 0xee };
|
||||||
|
canBusSerialTwo.Write(buffer, 0, 8);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//单支板断电
|
||||||
|
public void PowerOff()
|
||||||
|
{
|
||||||
|
if (_portConfig.StorageCan == 2)
|
||||||
|
{
|
||||||
|
canBusSerial.DiscardInBuffer();
|
||||||
|
byte[] buffer = new byte[] { 0xaa, 0x01, 0x05, 0x07, 0x00, 0x00, 0x00, 0xee };
|
||||||
|
canBusSerial.Write(buffer, 0, 8);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
canBusSerialTwo.DiscardInBuffer();
|
||||||
|
byte[] buffer = new byte[] { 0xaa, 0x01, 0x05, 0x07, 0x00, 0x00, 0x00, 0xee };
|
||||||
|
canBusSerialTwo.Write(buffer, 0, 8);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region 药盒操作
|
#region 药盒操作
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
"connectionStrings": "server=127.0.0.1;port=3306;database=zbzq;userid=root;password=root;Charset=utf8mb4;",
|
"connectionStrings": "server=127.0.0.1;port=3306;database=zbzq20250908;userid=root;password=root;Charset=utf8mb4;",
|
||||||
"finger": {
|
"finger": {
|
||||||
"ip": "192.168.50.59",
|
"ip": "192.168.50.59",
|
||||||
"port": 4370,
|
"port": 4370,
|
||||||
|
|
@ -11,12 +11,15 @@
|
||||||
//. 药房代码: 武昌 07010323 麻醉科小药柜 8个抽屉
|
//. 药房代码: 武昌 07010323 麻醉科小药柜 8个抽屉
|
||||||
// 汉口 "07010363" "麻醉科 16个抽屉",
|
// 汉口 "07010363" "麻醉科 16个抽屉",
|
||||||
"storage": "07010323",
|
"storage": "07010323",
|
||||||
|
"inPharmacyId": "062303",
|
||||||
"roomName": "麻醉科手术室",
|
"roomName": "麻醉科手术室",
|
||||||
"loginMode": 1,
|
"loginMode": 1,
|
||||||
"opFirst": true,
|
"opFirst": true,
|
||||||
//自动退出登录时间,单位秒(0不自动退出)
|
//自动退出登录时间,单位秒(0不自动退出)
|
||||||
"autoOutLog": 0,
|
"autoOutLog": 0,
|
||||||
"boxMachineId": "DM5"
|
"boxMachineId": "DM5",
|
||||||
|
"anaesthetist_name": "未选择,杨俊哲,周丹,刘方,罗丁,陈晓龙,杜金菊,季楠,王彩红,凌娜佳,汪宏,谈世刚,罗中兵,郭慧,廖家涛,殷国江,李坤,周翔,秦明哲,王庆利,张燕辉,姜佳佳,宋晓阳,胡晓",
|
||||||
|
"boxColor": "白,绿"
|
||||||
},
|
},
|
||||||
"port": {
|
"port": {
|
||||||
"drawerPortPath": "COM10",
|
"drawerPortPath": "COM10",
|
||||||
|
|
@ -39,7 +42,7 @@
|
||||||
"weigh": [ 4 ],
|
"weigh": [ 4 ],
|
||||||
"box": [ 4 ],
|
"box": [ 4 ],
|
||||||
"label": [ 4 ],
|
"label": [ 4 ],
|
||||||
"returnDrawer": [2,4,6,8,10,12,14,16]
|
"returnDrawer": [12,14]
|
||||||
},
|
},
|
||||||
"fridge": {
|
"fridge": {
|
||||||
//冰箱温度区间
|
//冰箱温度区间
|
||||||
|
|
|
||||||
Binary file not shown.
|
|
@ -0,0 +1,31 @@
|
||||||
|
中部战区项目
|
||||||
|
一、软件相关
|
||||||
|
1)药盒修改,涉及绑定药合、药盒核对、药盒加药、药盒库存中的库位由原来的1、2修改为白、绿。
|
||||||
|
2)药品核对添加药品合计页面。
|
||||||
|
3)药品核对添加患者姓名查询,列表页添加麻醉医师字段列。
|
||||||
|
4)抽屉取药添加向药盒加药,还药时直接从药盒中还。
|
||||||
|
5)开抽屉报警已关掉,想要加到软件里自行设置开启与关闭。
|
||||||
|
6)回收空瓶二类药直接清空回收数量、一类药品需要根据单支中取出数量进行清空安瓿数量
|
||||||
|
(因有的空安瓿放进去取不出建议他们直接将空安瓿放到普通抽屉中,如果他们仍要用单支做回收这边希望我们设计一个取空安瓿的取药器)。
|
||||||
|
7)针对空安瓿回收流程还需要修改,如果用单支回收他们希望自动计数(放入、取出)。
|
||||||
|
8)部分页面按这边老师的使用习惯做调整。
|
||||||
|
|
||||||
|
二、硬件相关
|
||||||
|
单支板抽屉修改
|
||||||
|
1.原来的横向排列改为竖向排列(现场项目经理说暂时先不要答应)
|
||||||
|
2.除15、16号抽屉外其余均要加单支(待定)
|
||||||
|
3.建议设计空安瓿取药器取出较小的空安瓿(加高也需要自己手拿怕掉碎渣不好清理)
|
||||||
|
|
||||||
|
三、接口相关
|
||||||
|
1.接口同步过来的数据处方里大部分没有批次信息,但是医院老师说已经填了,而且他们打印出来的处方上是有批次信息的,但是写到我们数据里批次字段是空的。
|
||||||
|
2.处方数据部分有部分没有,导致周五核对的时候无法核对。
|
||||||
|
|
||||||
|
现状:1)已经把毒麻柜推到医院备药间,药品信息已经全部录入,按照老师要求将对应库位绑定好,并放入药品。
|
||||||
|
2)已对备药间的三位老师讲述系统操作流程及各页面功能。
|
||||||
|
待完成:1)周五放好药后有些药的批次更新比较频繁,老师要调整现在已经绑定到抽屉里的药,周一会按他们新给我药品信息做调整。
|
||||||
|
2)周一信息科会配合一起看周五没有过来的处方数据问题。
|
||||||
|
3)抽屉加药、药盒放药,要走初始数据。按新的放药信息将药放入药盒,初始流程这边老师让自己走。包括核对处方,及全流程试用。
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Loading…
Reference in New Issue