Compare commits
	
		
			No commits in common. "216ab8a9161b38ed0494a03753cdd845b38cc02b" and "9712c1e30c11f92d03475c268ec839640794c06b" have entirely different histories.
		
	
	
		
			216ab8a916
			...
			9712c1e30c
		
	
		
							
								
								
									
										10739
									
								
								1-2华康毒麻药品柜系统操作手册.doc
								
								
								
								
							
							
						
						
									
										10739
									
								
								1-2华康毒麻药品柜系统操作手册.doc
								
								
								
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							| 
						 | 
					@ -1,14 +0,0 @@
 | 
				
			||||||
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,BoxModel boxNum,List<ChannelList> channelLists);
 | 
					        public Task<bool> DrawerOperationFinish(List<ChannelStock> Stocks, int type);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        public Task<bool> UnBind(string id);
 | 
					        public Task<bool> UnBind(string id);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -96,9 +96,5 @@ 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);
 | 
					 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -11,8 +11,6 @@ namespace MasaBlazorApp3.DataAccess.Dao
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        Task<List<DrugInfo>> GetAllDrugAndStock();
 | 
					        Task<List<DrugInfo>> GetAllDrugAndStock();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        Task<List<DrugInfo>> GetAllDrugAndStockByBox(BoxModel boxModel);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
        Task<List<DrugInfo>> GetAllDrug();
 | 
					        Task<List<DrugInfo>> GetAllDrug();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -11,8 +11,7 @@ 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);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -30,24 +29,12 @@ 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 BoxNum, string PatientName,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<ChannelStock>> GetAllOrderInfoDrugByBox(BoxModel boxNum, string roomName, DateTime? OrderDate);
 | 
					 | 
				
			||||||
        //获取麻醉师信息
 | 
					 | 
				
			||||||
        public Task<List<Anaesthetist>> GetAnaesthetistName();
 | 
					 | 
				
			||||||
        //获取麻醉师单对应的手术间号
 | 
					 | 
				
			||||||
        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, int DrawerNo);
 | 
				
			||||||
        //查询药品对应的库位 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, BoxModel boxModel, List<ChannelList> channelLists)
 | 
					        public async Task<bool> DrawerOperationFinish(List<ChannelStock> Stocks, int type = 1)
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            try
 | 
					            try
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
| 
						 | 
					@ -228,10 +228,7 @@ 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)
 | 
				
			||||||
| 
						 | 
					@ -239,7 +236,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("yyyy-MM-dd")).Set(cs => cs.Dmnguid, stock.drugManuNo.Id);
 | 
					                        stockQ = stockQ.Set(cs => cs.ManuNo, stock.drugManuNo.ManuNo).Set(cs => cs.EffDate, stock.drugManuNo.EffDate.ToString()).Set(cs => cs.Dmnguid, stock.drugManuNo.Id);
 | 
				
			||||||
                    }
 | 
					                    }
 | 
				
			||||||
                    int r = stockQ.Update();
 | 
					                    int r = stockQ.Update();
 | 
				
			||||||
                    // 获取更新完库存之后的药品库存
 | 
					                    // 获取更新完库存之后的药品库存
 | 
				
			||||||
| 
						 | 
					@ -280,98 +277,6 @@ 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
 | 
				
			||||||
| 
						 | 
					@ -476,7 +381,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)
 | 
				
			||||||
| 
						 | 
					@ -1012,7 +917,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 => new { cs.EffDate, cs.Quantity }).ToListAsync();
 | 
					                        .OrderBy(cs => cs.EffDate).ToListAsync();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                    // 当前药品的库存总量
 | 
					                    // 当前药品的库存总量
 | 
				
			||||||
                    var total = stockList.Sum(current => current.Quantity);
 | 
					                    var total = stockList.Sum(current => current.Quantity);
 | 
				
			||||||
| 
						 | 
					@ -1070,21 +975,13 @@ namespace MasaBlazorApp3.DataAccess.Impl
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
                if (flag)
 | 
					                if (flag)
 | 
				
			||||||
                {
 | 
					                {
 | 
				
			||||||
                    tempData.Sort((s1, s3) =>
 | 
					 | 
				
			||||||
                    {
 | 
					 | 
				
			||||||
                        int i = s1.ChannelStock.DrawerNo.CompareTo(s3.ChannelStock.DrawerNo);
 | 
					 | 
				
			||||||
                        if (i == 0)
 | 
					 | 
				
			||||||
                        {
 | 
					 | 
				
			||||||
                            return s1.ChannelStock.ColNo.CompareTo(s3.ChannelStock.ColNo);
 | 
					 | 
				
			||||||
                        }
 | 
					 | 
				
			||||||
                        return i;
 | 
					 | 
				
			||||||
                    });
 | 
					 | 
				
			||||||
                    return tempData;
 | 
					                    return tempData;
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
                else
 | 
					                else
 | 
				
			||||||
                {
 | 
					                {
 | 
				
			||||||
                    return tempData2;
 | 
					                    return tempData2;
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
 | 
					                return tempData;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
            catch (Exception ex)
 | 
					            catch (Exception ex)
 | 
				
			||||||
| 
						 | 
					@ -1146,7 +1043,6 @@ 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,//给交接柜补药不需要还药或还空瓶
 | 
					 | 
				
			||||||
                        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,
 | 
				
			||||||
| 
						 | 
					@ -1186,7 +1082,7 @@ namespace MasaBlazorApp3.DataAccess.Impl
 | 
				
			||||||
                    #endregion
 | 
					                    #endregion
 | 
				
			||||||
                    //查询药盒中是否有该批次药品,有则把对应数量累加,无则insert
 | 
					                    //查询药盒中是否有该批次药品,有则把对应数量累加,无则insert
 | 
				
			||||||
                    ChannelStock? BoxChannelStock = _connection.ChannelStock.AsQueryable()
 | 
					                    ChannelStock? BoxChannelStock = _connection.ChannelStock.AsQueryable()
 | 
				
			||||||
                        .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();
 | 
					                        .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();
 | 
				
			||||||
                    int boxID = 0;
 | 
					                    int boxID = 0;
 | 
				
			||||||
                    if (BoxChannelStock != null)
 | 
					                    if (BoxChannelStock != null)
 | 
				
			||||||
                    {
 | 
					                    {
 | 
				
			||||||
| 
						 | 
					@ -1534,26 +1430,7 @@ 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();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1562,8 +1439,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)
 | 
				
			||||||
                {
 | 
					                {
 | 
				
			||||||
| 
						 | 
					@ -1576,13 +1453,6 @@ 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)
 | 
				
			||||||
| 
						 | 
					@ -1618,47 +1488,13 @@ namespace MasaBlazorApp3.DataAccess.Impl
 | 
				
			||||||
                    if (spl != null && spl.Count() > 0)
 | 
					                    if (spl != null && spl.Count() > 0)
 | 
				
			||||||
                    {
 | 
					                    {
 | 
				
			||||||
                        drawerNo = Convert.ToInt32(spl[0]);
 | 
					                        drawerNo = Convert.ToInt32(spl[0]);
 | 
				
			||||||
                    if (drawerNo > 30)
 | 
					 | 
				
			||||||
                    {
 | 
					 | 
				
			||||||
                        colNo = Convert.ToInt32(spl[1]);
 | 
					                        colNo = Convert.ToInt32(spl[1]);
 | 
				
			||||||
                    }
 | 
					                    }
 | 
				
			||||||
                    else
 | 
					 | 
				
			||||||
                    {
 | 
					 | 
				
			||||||
                        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);
 | 
					                    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();
 | 
					                    int pagedData = await query.CountAsync();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                    List<ChannelStock> list = await query
 | 
					                    List<ChannelStock> list = await query
 | 
				
			||||||
| 
						 | 
					@ -1675,8 +1511,6 @@ namespace MasaBlazorApp3.DataAccess.Impl
 | 
				
			||||||
                        Desserts = list
 | 
					                        Desserts = list
 | 
				
			||||||
                    };
 | 
					                    };
 | 
				
			||||||
                
 | 
					                
 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
            catch (Exception ex)
 | 
					            catch (Exception ex)
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
| 
						 | 
					@ -1693,12 +1527,8 @@ 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 == 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();
 | 
					                .GroupBy(cs =>new { cs.DrawerNo, cs.ColNo }).Select(cs => cs.Key.DrawerNo.ToString()+"-"+cs.Key.ColNo.ToString()).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>
 | 
				
			||||||
| 
						 | 
					@ -1708,12 +1538,8 @@ 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.DrawerNo == channelStock.DrawerNo && cs.ColNo != channelStock.ColNo || cs.DrawerNo != channelStock.DrawerNo))
 | 
					            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();
 | 
				
			||||||
                .GroupBy(cs => new { cs.DrawerNo, cs.ColNo })
 | 
					            return stringArray;
 | 
				
			||||||
                .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)
 | 
				
			||||||
| 
						 | 
					@ -1726,7 +1552,7 @@ namespace MasaBlazorApp3.DataAccess.Impl
 | 
				
			||||||
                {
 | 
					                {
 | 
				
			||||||
                    //查询出药的药盒是否有该批次的药品
 | 
					                    //查询出药的药盒是否有该批次的药品
 | 
				
			||||||
                    ChannelStock replace1ChannelStock = _connection.ChannelStock.AsQueryable()
 | 
					                    ChannelStock replace1ChannelStock = _connection.ChannelStock.AsQueryable()
 | 
				
			||||||
                        .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)
 | 
					                        .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)
 | 
				
			||||||
                        .FirstOrDefault();
 | 
					                        .FirstOrDefault();
 | 
				
			||||||
                    if (replace1ChannelStock != null)
 | 
					                    if (replace1ChannelStock != null)
 | 
				
			||||||
                    {
 | 
					                    {
 | 
				
			||||||
| 
						 | 
					@ -1736,26 +1562,22 @@ namespace MasaBlazorApp3.DataAccess.Impl
 | 
				
			||||||
                            .Update();
 | 
					                            .Update();
 | 
				
			||||||
                        if (r <= 0)
 | 
					                        if (r <= 0)
 | 
				
			||||||
                        {
 | 
					                        {
 | 
				
			||||||
                            logger.Info($"更新药盒药品数量失败,药盒号:{stockList[i].Location},药品ID:{stockList[i].DrugId}");
 | 
					                            logger.Info($"更新药盒药品数量失败,药盒号:{stockList[i].DrawerNo},药品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(),
 | 
				
			||||||
                            ListId = stock.ListId,
 | 
					                            MachineId = stockList[i].MachineId,
 | 
				
			||||||
                            MachineId = _setting.boxMachineId,
 | 
					 | 
				
			||||||
                            DrawerNo = stock.DrawerNo,
 | 
					                            DrawerNo = stock.DrawerNo,
 | 
				
			||||||
                            ColNo = stock.ColNo,
 | 
					                            DrugId = stockList[i].DrugId,
 | 
				
			||||||
                            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 = stock.BaseQuantity,
 | 
					                            BaseQuantity = stockList[i].BaseQuantity,
 | 
				
			||||||
                            //BoxState = 1
 | 
					                            //BoxState = 1
 | 
				
			||||||
                        });
 | 
					                        });
 | 
				
			||||||
                        if (mid <= 0)
 | 
					                        if (mid <= 0)
 | 
				
			||||||
| 
						 | 
					@ -1771,7 +1593,6 @@ 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,
 | 
				
			||||||
| 
						 | 
					@ -1780,9 +1601,7 @@ 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 = $"{stock.Location}-{stock.Drug.DrugName}-{stock.ManuNo}与{stockList[i].Location}-{stockList[i].Drug.DrugName}-{stockList[i].ManuNo}交换,交换数量{stockList[i].AddQuantity}",
 | 
					                        InvoiceId = stockList[i].Id.ToString(),
 | 
				
			||||||
                        BoxDrawer = stockList[i].DrawerNo,
 | 
					 | 
				
			||||||
                        BoxColNo = stockList[i].ColNo
 | 
					 | 
				
			||||||
                    });
 | 
					                    });
 | 
				
			||||||
                    if (recordId <= 0)
 | 
					                    if (recordId <= 0)
 | 
				
			||||||
                    {
 | 
					                    {
 | 
				
			||||||
| 
						 | 
					@ -1795,7 +1614,7 @@ namespace MasaBlazorApp3.DataAccess.Impl
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                    //更新入药的药盒中的药品数量
 | 
					                    //更新入药的药盒中的药品数量
 | 
				
			||||||
                    ChannelStock replace2ChannelStock = _connection.ChannelStock.AsQueryable()
 | 
					                    ChannelStock replace2ChannelStock = _connection.ChannelStock.AsQueryable()
 | 
				
			||||||
                         .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)
 | 
					                         .Where(cs => cs.MachineId == stockList[i].MachineId && cs.DrawerNo == stockList[i].DrawerNo && cs.DrugId == stock.DrugId && cs.ManuNo == stock.ManuNo && cs.EffDate == stock.EffDate)
 | 
				
			||||||
                         .FirstOrDefault();
 | 
					                         .FirstOrDefault();
 | 
				
			||||||
                    if (replace2ChannelStock != null)
 | 
					                    if (replace2ChannelStock != null)
 | 
				
			||||||
                    {
 | 
					                    {
 | 
				
			||||||
| 
						 | 
					@ -1816,15 +1635,13 @@ namespace MasaBlazorApp3.DataAccess.Impl
 | 
				
			||||||
                        int mid = _connection.Insert(new ChannelStock()
 | 
					                        int mid = _connection.Insert(new ChannelStock()
 | 
				
			||||||
                        {
 | 
					                        {
 | 
				
			||||||
                            Id = Guid.NewGuid().ToString(),
 | 
					                            Id = Guid.NewGuid().ToString(),
 | 
				
			||||||
                            ListId = stockList[i].ListId,
 | 
					                            MachineId = stockList[i].MachineId,
 | 
				
			||||||
                            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 = stockList[i].BaseQuantity,
 | 
					                            BaseQuantity = stock.BaseQuantity,
 | 
				
			||||||
                            //BoxState = 1
 | 
					                            //BoxState = 1
 | 
				
			||||||
                        });
 | 
					                        });
 | 
				
			||||||
                        if (mid <= 0)
 | 
					                        if (mid <= 0)
 | 
				
			||||||
| 
						 | 
					@ -1835,7 +1652,27 @@ 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)
 | 
				
			||||||
| 
						 | 
					@ -1855,59 +1692,6 @@ 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)
 | 
				
			||||||
                {
 | 
					                {
 | 
				
			||||||
| 
						 | 
					@ -1942,50 +1726,12 @@ 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] == "白" ? 1 : 2);
 | 
					 | 
				
			||||||
                    if (selectDrawerNo > 30)
 | 
					 | 
				
			||||||
                    {
 | 
					 | 
				
			||||||
                    selectColNo = Convert.ToInt32(selectSpl[1]);
 | 
					                    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.ColNo == selectColNo && cs.DrugId == stock.DrugId && cs.ManuNo == stock.ManuNo)
 | 
					                       .Where(cs => cs.MachineId == stock.MachineId && cs.DrawerNo == selectDrawerNo && cs.DrawerNo == selectColNo && cs.DrugId == stock.DrugId && cs.ManuNo == stock.ManuNo && cs.EffDate == stock.EffDate)
 | 
				
			||||||
                       .FirstOrDefault();
 | 
					                       .FirstOrDefault();
 | 
				
			||||||
                if (inChannelStock != null)
 | 
					                if (inChannelStock != null)
 | 
				
			||||||
                {
 | 
					                {
 | 
				
			||||||
| 
						 | 
					@ -2002,7 +1748,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.ColNo == selectColNo && cs.DrugId == stock.DrugId && cs.Quantity <= 0)
 | 
					                      .Where(cs => cs.MachineId == stock.MachineId && cs.DrawerNo == selectDrawerNo && cs.DrawerNo == selectColNo && cs.DrugId == stock.DrugId)
 | 
				
			||||||
                      .FirstOrDefault();
 | 
					                      .FirstOrDefault();
 | 
				
			||||||
                    if (inDrugChannelStock != null)
 | 
					                    if (inDrugChannelStock != null)
 | 
				
			||||||
                    {
 | 
					                    {
 | 
				
			||||||
| 
						 | 
					@ -2055,21 +1801,19 @@ namespace MasaBlazorApp3.DataAccess.Impl
 | 
				
			||||||
                        int updateTotalQuantity = 0;
 | 
					                        int updateTotalQuantity = 0;
 | 
				
			||||||
                        int updateMoveToTotalQuantity = 0;
 | 
					                        int updateMoveToTotalQuantity = 0;
 | 
				
			||||||
                        //修改总库存数
 | 
					                        //修改总库存数
 | 
				
			||||||
                        ChannelList channelList = _connection.ChannelList.Where(cl => cl.MachineId.Equals(_setting.boxMachineId) && cl.DrawerNo == stock.DrawerNo && cl.ColNo == stock.ColNo).FirstOrDefault();
 | 
					                        ChannelList channelList = _connection.ChannelList.Where(cl => cl.MachineId == stock.MachineId && cl.DrawerNo == stock.DrawerNo && cl.DrugId == stock.DrugId).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)
 | 
				
			||||||
                        {
 | 
					                        {
 | 
				
			||||||
                            updateMoveToTotalQuantity = _connection.ChannelList.Where(cl => cl.Id == moveToChannelList.Id)
 | 
					                            updateTotalQuantity = _connection.ChannelList.Where(cl => cl.Id == moveToChannelList.Id)
 | 
				
			||||||
                                .Set(cl => cl.TotalQuantity, moveToChannelList.TotalQuantity + removeQuantity)
 | 
					                                .Set(cl => cl.TotalQuantity, channelList.TotalQuantity + removeQuantity)
 | 
				
			||||||
                                .Update();
 | 
					                                .Update();
 | 
				
			||||||
                        }
 | 
					                        }
 | 
				
			||||||
                        if (updateTotalQuantity > 0 && updateMoveToTotalQuantity > 0)
 | 
					                        if (updateTotalQuantity > 0 && updateMoveToTotalQuantity > 0)
 | 
				
			||||||
| 
						 | 
					@ -2089,17 +1833,15 @@ namespace MasaBlazorApp3.DataAccess.Impl
 | 
				
			||||||
                        {
 | 
					                        {
 | 
				
			||||||
                            MachineId = stock.MachineId,
 | 
					                            MachineId = stock.MachineId,
 | 
				
			||||||
                            DrawerNo = stock.DrawerNo,
 | 
					                            DrawerNo = stock.DrawerNo,
 | 
				
			||||||
                            ColNo = stock.ColNo,//移入的药盒号
 | 
					                            ColNo = selectDrawerNo,//移入的药盒号
 | 
				
			||||||
                            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)
 | 
				
			||||||
| 
						 | 
					@ -2108,38 +1850,6 @@ 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)
 | 
				
			||||||
                {
 | 
					                {
 | 
				
			||||||
| 
						 | 
					@ -2213,174 +1923,5 @@ 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,52 +28,11 @@ namespace MasaBlazorApp3.DataAccess.Impl
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            var query = _connection.DrugInfo.AsQueryable();
 | 
					            var query = _connection.DrugInfo.AsQueryable();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            List<DrugInfo> drugList = 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();
 | 
					 | 
				
			||||||
            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
 | 
					            return await query
 | 
				
			||||||
                .LoadWith(di => di.Stocks.Where(cs => cs.Quantity > 0 && cs.MachineId == _setting.boxMachineId&&cs.DrawerNo==boxModel.BoxName&&cs.ColNo==boxModel.BoxNo))
 | 
					                .LoadWith(di => di.Stocks.Where(cs => cs.Quantity > 0 && cs.MachineId == _setting.machineId))
 | 
				
			||||||
                .InnerJoin(
 | 
					                .InnerJoin(
 | 
				
			||||||
                    _connection.ChannelStock.Where(cl => cl.MachineId == _setting.boxMachineId && cl.DrawerNo==boxModel.BoxName&&cl.ColNo==boxModel.BoxNo).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,
 | 
				
			||||||
                    (di, cl) => di
 | 
					                    (di, cl) => di
 | 
				
			||||||
                )
 | 
					                )
 | 
				
			||||||
| 
						 | 
					@ -160,7 +119,6 @@ namespace MasaBlazorApp3.DataAccess.Impl
 | 
				
			||||||
                    .Where(di => di.DrugId == drugInfo.DrugId)
 | 
					                    .Where(di => di.DrugId == drugInfo.DrugId)
 | 
				
			||||||
                    .Set(di => di.DrugName, drugInfo.DrugName)
 | 
					                    .Set(di => di.DrugName, drugInfo.DrugName)
 | 
				
			||||||
                    .Set(di => di.DrugSpec, drugInfo.DrugSpec)
 | 
					                    .Set(di => di.DrugSpec, drugInfo.DrugSpec)
 | 
				
			||||||
                    .Set(di=>di.PackH,drugInfo.PackH)
 | 
					 | 
				
			||||||
                    .Set(di => di.Manufactory, drugInfo.Manufactory);
 | 
					                    .Set(di => di.Manufactory, drugInfo.Manufactory);
 | 
				
			||||||
                return statement.Update() > 0;
 | 
					                return statement.Update() > 0;
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -33,90 +33,89 @@ 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.ChannelStock.Where(c => c.MachineId == _setting.machineId)
 | 
					            var query2 = from cl in _connection.ChannelList.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_stock WHERE machine_id = {_setting.machineId} GROUP BY drug_id) c ON c.drug_id = ioi.drug_id
 | 
					            //    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
 | 
				
			||||||
                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 => Convert.ToDateTime(ioi.InvoiceDate).Date.Equals(invoiceDate.Date));
 | 
					                //query = query.Where(ioi => ioi.CreateTime.Date.Equals(invoiceDate.Date));
 | 
				
			||||||
                //query3 = query3.Where(ioi => ioi.InvoiceNo.Contains(invoiceNo));
 | 
					                query3 = query3.Where(ioi => ioi.InvoiceNo.Contains(invoiceNo));
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            if (!String.IsNullOrEmpty(_setting.inPharmacyId))
 | 
					            if(!String.IsNullOrEmpty(_setting.storage))
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
                if (type == 1)
 | 
					                if (type == 1)
 | 
				
			||||||
                {
 | 
					                {
 | 
				
			||||||
                    query = query.Where(ioi => ioi.InPharmacyId.Equals(_setting.inPharmacyId));
 | 
					                    //query = query.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));
 | 
				
			||||||
                    //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.inPharmacyId));
 | 
					                    //query = query.Where(ioi => ioi.InPharmacyId.Equals(_setting.storage));
 | 
				
			||||||
                    //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 == 2 && ioi.Status == 0));
 | 
					                //query = query.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));
 | 
					                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 query
 | 
					            List <InOutInvoice> list = await query3
 | 
				
			||||||
                .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 query.CountAsync();
 | 
					            int pagedData = await query3.CountAsync();
 | 
				
			||||||
            return new PageData<InOutInvoice>()
 | 
					            return new PageData<InOutInvoice>()
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -145,21 +144,19 @@ namespace MasaBlazorApp3.DataAccess.Impl
 | 
				
			||||||
            if (quantity > 0)
 | 
					            if (quantity > 0)
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
                query = query.Where(cs => cs.Quantity > 0);
 | 
					                query = query.Where(cs => cs.Quantity > 0);
 | 
				
			||||||
                if (!String.IsNullOrEmpty(manuNo) && manuNo != "X")
 | 
					                if (!String.IsNullOrEmpty(manuNo))
 | 
				
			||||||
                {
 | 
					                {
 | 
				
			||||||
                    query = query.Where(cs => cs.ManuNo.Equals(manuNo));
 | 
					                    query = query.Where(cs => cs.ManuNo.Equals(manuNo));
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
            }
 | 
					            } else
 | 
				
			||||||
            else
 | 
					 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
                if (!String.IsNullOrEmpty(manuNo) && manuNo != "X")
 | 
					                if (!String.IsNullOrEmpty(manuNo))
 | 
				
			||||||
                {
 | 
					                {
 | 
				
			||||||
                    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.LoadWith(cl => cl.drugManuNo)
 | 
					            return await query.OrderBy((cs) => cs.EffDate)
 | 
				
			||||||
                        .OrderBy((cs) => cs.EffDate)
 | 
					 | 
				
			||||||
                        .ThenBy((cs) => cs.DrawerNo)
 | 
					                        .ThenBy((cs) => cs.DrawerNo)
 | 
				
			||||||
                        .ThenBy((cs) => cs.ColNo)
 | 
					                        .ThenBy((cs) => cs.ColNo)
 | 
				
			||||||
                        .ToListAsync();
 | 
					                        .ToListAsync();
 | 
				
			||||||
| 
						 | 
					@ -180,7 +177,7 @@ namespace MasaBlazorApp3.DataAccess.Impl
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        public async Task<DrugInfo> getDrugInfoById(string DrugId)
 | 
					        public async Task<DrugInfo> getDrugInfoById(string DrugId)
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            return await _connection.DrugInfo.Where(di => di.DrugId == DrugId).LoadWith(di => di.Manus).FirstOrDefaultAsync();
 | 
					            return await _connection.DrugInfo.Where(di => di.DrugId == DrugId).FirstOrDefaultAsync();
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -254,10 +251,6 @@ 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);
 | 
				
			||||||
| 
						 | 
					@ -457,15 +450,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, ChannelStock.drugManuNo.ManuNo);
 | 
					                            DrugManuNo drugManuNo = await GetDrugManuNo(ChannelStock.DrugId, invoiceVo.Invoice.DrugManuNo);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                            ChannelStock.Dmnguid = drugManuNo.Id;
 | 
					                            ChannelStock.Dmnguid = drugManuNo.Id;
 | 
				
			||||||
                            ChannelStock.ManuNo = drugManuNo.ManuNo;
 | 
					                            ChannelStock.ManuNo = drugManuNo.ManuNo;
 | 
				
			||||||
                            ChannelStock.EffDate = drugManuNo.EffDate?.ToString("yyyy-MM-dd");
 | 
					                            ChannelStock.EffDate = drugManuNo.EffDate.ToString();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                            q = q.Set(cs => cs.Dmnguid, ChannelStock.Dmnguid)
 | 
					                            q = q.Set(cs => cs.Dmnguid, drugManuNo.Id)
 | 
				
			||||||
                                .Set(cs => cs.ManuNo, ChannelStock.ManuNo)
 | 
					                                .Set(cs => cs.ManuNo, drugManuNo.ManuNo)
 | 
				
			||||||
                                .Set(cs => cs.EffDate, ChannelStock.EffDate);
 | 
					                                .Set(cs => cs.EffDate, drugManuNo.EffDate.ToString());
 | 
				
			||||||
                        }
 | 
					                        }
 | 
				
			||||||
                        int r = q.Update();
 | 
					                        int r = q.Update();
 | 
				
			||||||
                        if (!DateTime.TryParse(ChannelStock.EffDate, out DateTime dEffDate))
 | 
					                        if (!DateTime.TryParse(ChannelStock.EffDate, out DateTime dEffDate))
 | 
				
			||||||
| 
						 | 
					@ -517,29 +510,6 @@ namespace MasaBlazorApp3.DataAccess.Impl
 | 
				
			||||||
                            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))
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -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)&&it.InvoiceId.StartsWith("DRAWER_"));
 | 
					            var query = _connection.MachineRecord.AsQueryable().Where(it => it.MachineId.Equals(_setting.machineId));
 | 
				
			||||||
            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.AddDays(1));
 | 
					                query = query.Where(mr => mr.OperationTime < end);
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
            if (operatorId != 0)
 | 
					            if (operatorId != 0)
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
| 
						 | 
					@ -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();
 | 
				
			||||||
| 
						 | 
					@ -300,28 +300,8 @@ namespace MasaBlazorApp3.DataAccess.Impl
 | 
				
			||||||
                            {
 | 
					                            {
 | 
				
			||||||
                                record.ReturnQuantity1 = record.ReturnQuantity1 + record.CurrentReturnQuantity;
 | 
					                                record.ReturnQuantity1 = record.ReturnQuantity1 + record.CurrentReturnQuantity;
 | 
				
			||||||
                                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}中信息");
 | 
					 | 
				
			||||||
                                    }
 | 
					 | 
				
			||||||
                                }
 | 
					 | 
				
			||||||
                            }
 | 
					                            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                        }
 | 
					                        }
 | 
				
			||||||
| 
						 | 
					@ -421,7 +401,7 @@ namespace MasaBlazorApp3.DataAccess.Impl
 | 
				
			||||||
                        Operator = _MachineRecord.Operator,
 | 
					                        Operator = _MachineRecord.Operator,
 | 
				
			||||||
                        OperationTime = DateTime.Now,
 | 
					                        OperationTime = DateTime.Now,
 | 
				
			||||||
                        Quantity = _MachineRecord.CurrentReturnQuantity,
 | 
					                        Quantity = _MachineRecord.CurrentReturnQuantity,
 | 
				
			||||||
                        Type = 32,
 | 
					                        Type = 31,
 | 
				
			||||||
                        InvoiceId = _MachineRecord.InvoiceId,
 | 
					                        InvoiceId = _MachineRecord.InvoiceId,
 | 
				
			||||||
                        GetId = _MachineRecord.GetId
 | 
					                        GetId = _MachineRecord.GetId
 | 
				
			||||||
                    });
 | 
					                    });
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -9,7 +9,6 @@ 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,12 +18,8 @@ using System.Collections;
 | 
				
			||||||
using System.Collections.Generic;
 | 
					using System.Collections.Generic;
 | 
				
			||||||
using System.Data;
 | 
					using System.Data;
 | 
				
			||||||
using System.Linq;
 | 
					using System.Linq;
 | 
				
			||||||
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
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
| 
						 | 
					@ -93,64 +88,6 @@ 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)
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
| 
						 | 
					@ -765,9 +702,8 @@ 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 BoxNum, string PatientName, string OrderrNo, DateTime? OrderDate, int? take, int? skip)
 | 
					        public async Task<PageData<OrderInfo>> GetAllOrderInfo(string Name, string OrderrNo, DateTime? OrderDate, int? take, int? skip)
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            logger.Info($"GetAllOrderInfo开始:{DateTime.Now}");
 | 
					 | 
				
			||||||
            var query2 = from od in _connection.OrderDetail
 | 
					            var query2 = from od in _connection.OrderDetail
 | 
				
			||||||
                         from cl in _connection.ChannelStock.Where(c => c.MachineId == _setting.boxMachineId).InnerJoin(c => c.DrugId == od.DrugId)
 | 
					                         from cl in _connection.ChannelStock.Where(c => c.MachineId == _setting.boxMachineId).InnerJoin(c => c.DrugId == od.DrugId)
 | 
				
			||||||
                         group od by od.OrderNo into temp
 | 
					                         group od by od.OrderNo into temp
 | 
				
			||||||
| 
						 | 
					@ -780,14 +716,7 @@ 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"))
 | 
					
 | 
				
			||||||
            {
 | 
					 | 
				
			||||||
                query = query.Where(oi => oi.RoomName == BoxNum);
 | 
					 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
            if (!string.IsNullOrEmpty(PatientName))
 | 
					 | 
				
			||||||
            {
 | 
					 | 
				
			||||||
                query = query.Where(oi => oi.PatientName.Contains(PatientName));
 | 
					 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
            if (!String.IsNullOrEmpty(OrderrNo))
 | 
					            if (!String.IsNullOrEmpty(OrderrNo))
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
                query = query.Where(oi => oi.OrderNo.Equals(OrderrNo));
 | 
					                query = query.Where(oi => oi.OrderNo.Equals(OrderrNo));
 | 
				
			||||||
| 
						 | 
					@ -804,25 +733,13 @@ 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.DetailInfo.DrugId)
 | 
					                .OrderBy((oi) => oi.RecvDate)
 | 
				
			||||||
                .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)
 | 
				
			||||||
| 
						 | 
					@ -835,119 +752,13 @@ namespace MasaBlazorApp3.DataAccess.Impl
 | 
				
			||||||
                    }
 | 
					                    }
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
            logger.Info($"GetAllOrderInfo结束:{DateTime.Now}");
 | 
					 | 
				
			||||||
            return new PageData<OrderInfo>()
 | 
					            return new PageData<OrderInfo>()
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
                TotalDesserts = pagedData,
 | 
					                TotalDesserts = pagedData,
 | 
				
			||||||
                Desserts = list
 | 
					                Desserts = list
 | 
				
			||||||
            };
 | 
					            };
 | 
				
			||||||
 | 
					 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        /// <summary>
 | 
					        /// <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()
 | 
					 | 
				
			||||||
        //{
 | 
					 | 
				
			||||||
        //    List<string> strList = new List<string>();
 | 
					 | 
				
			||||||
        //    strList = _connection.OrderInfo.Where(it=>it.state==0&&it.HisDispFlag==0&&it.CancelFlag==0).Select(it => it.anaesthetistName).Distinct().ToList();
 | 
					 | 
				
			||||||
        //    return strList;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        //}
 | 
					 | 
				
			||||||
        /// <summary>
 | 
					 | 
				
			||||||
        /// 获取所有药盒号
 | 
					        /// 获取所有药盒号
 | 
				
			||||||
        /// </summary>
 | 
					        /// </summary>
 | 
				
			||||||
        /// <param name="machineId"></param>
 | 
					        /// <param name="machineId"></param>
 | 
				
			||||||
| 
						 | 
					@ -970,33 +781,16 @@ 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, int boxColor)
 | 
					        public async Task<List<BoxModel>> GetDrawerNumByOperationNum(string machineId,List<int> operationNum)
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            List<BoxModel> boxModelList = new List<BoxModel>();
 | 
					            List<BoxModel> boxModelList = new List<BoxModel>();
 | 
				
			||||||
            //var query = _connection.ChannelStock
 | 
					            boxModelList =await _connection.ChannelStock
 | 
				
			||||||
            //    .Where(cs => cs.MachineId == machineId && operationNum.Contains(cs.DrawerNo)&&cs.Quantity>0);
 | 
					                .Where(cs => cs.MachineId == machineId&& operationNum.Contains(cs.DrawerNo))
 | 
				
			||||||
            //boxModelList = await _connection.ChannelStock
 | 
					                .Select(cs => new BoxModel { BoxName = cs.DrawerNo.ToString(), BoxNo = Convert.ToInt32(cs.ColNo) }).ToListAsync();
 | 
				
			||||||
            //    .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();
 | 
					 | 
				
			||||||
            //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;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        //核对处方
 | 
					        //核对处方
 | 
				
			||||||
        public async Task<bool> CheckOrderInfo(IList<OrderInfo> selectedOrderInfos, BoxModel boxModel)
 | 
					        public async Task<bool> CheckOrderInfo(IList<OrderInfo> selectedOrderInfos, BoxModel DrawerNo)
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            try
 | 
					            try
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
| 
						 | 
					@ -1012,7 +806,7 @@ namespace MasaBlazorApp3.DataAccess.Impl
 | 
				
			||||||
                    OrderInfo oi = selectedOrderInfos[i];
 | 
					                    OrderInfo oi = selectedOrderInfos[i];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                    int drawerNo = Convert.ToInt32(boxModel.BoxName);
 | 
					                    int drawerNo = DrawerNo.BoxNo;
 | 
				
			||||||
                    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()
 | 
				
			||||||
| 
						 | 
					@ -1025,27 +819,26 @@ 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==DrawerNo.BoxNo).OrderBy(cs => cs.EffDate).ToList();
 | 
				
			||||||
                        if (cs.Count <= 0)
 | 
					                        if (cs.Count <= 0)
 | 
				
			||||||
                        {
 | 
					                        {
 | 
				
			||||||
                            logger.Info($"处方{oi.OrderNo}中药品{oi.DetailInfo.Drug.DrugName}在{drawerNo}号药盒无库存");
 | 
					                            logger.Info($"处方{oi.OrderNo}中药品{oi.DetailInfo.DrugId}在{drawerNo}号药盒无库存");
 | 
				
			||||||
                            empChannelStock += $"处方{oi.OrderNo}中药品{oi.DetailInfo.Drug.DrugName}在{drawerNo}号药盒无库存 ";
 | 
					                            empChannelStock += $"处方{oi.OrderNo}中药品{oi.DetailInfo.DrugId}在{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.Drug.DrugName}在{drawerNo}号库存不足,需要核对数{oi.DetailInfo.Quantity},库存总数{csQuantity}");
 | 
					                            logger.Info($"处方{oi.OrderNo}中药品{oi.DetailInfo.DrugId}在{drawerNo}号库存不足,需要核对数{oi.DetailInfo.Quantity},库存总数{csQuantity}");
 | 
				
			||||||
                            empChannelStock += $"处方{oi.OrderNo}中药品{oi.DetailInfo.Drug.DrugName}在{drawerNo}号库存不足,需要核对数{oi.DetailInfo.Quantity},库存总数{csQuantity} ";
 | 
					                            empChannelStock += $"处方{oi.OrderNo}中药品{oi.DetailInfo.DrugId}在{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).Set(od => od.Quantity, oi.DetailInfo.Quantity).Update();
 | 
					 | 
				
			||||||
                            _connection.Insert(new OrderFinish()
 | 
					                            _connection.Insert(new OrderFinish()
 | 
				
			||||||
                            {
 | 
					                            {
 | 
				
			||||||
                                OrderNo = oi.OrderNo,
 | 
					                                OrderNo = oi.OrderNo,
 | 
				
			||||||
| 
						 | 
					@ -1215,323 +1008,6 @@ namespace MasaBlazorApp3.DataAccess.Impl
 | 
				
			||||||
                    _message.Notify(
 | 
					                    _message.Notify(
 | 
				
			||||||
                          new NotificationMessage { Severity = NotificationSeverity.Error, Summary = "提示", Detail = $"有未核对处方:{empChannelStock}", Duration = 4000 }
 | 
					                          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(
 | 
					 | 
				
			||||||
                          new NotificationMessage { Severity = NotificationSeverity.Error, Summary = "提示", Detail = $"有未核对处方:{empChannelStock}", Duration = 4000 }
 | 
					 | 
				
			||||||
                      );
 | 
					 | 
				
			||||||
                    _connection.RollbackTransaction();
 | 
					 | 
				
			||||||
                    return false;
 | 
					 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
                if (bFlag)
 | 
					                if (bFlag)
 | 
				
			||||||
                {
 | 
					                {
 | 
				
			||||||
| 
						 | 
					@ -1553,68 +1029,7 @@ namespace MasaBlazorApp3.DataAccess.Impl
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        void RestData()
 | 
					        public Task<bool> CheckOrderInfo(IList<OrderInfo> selectedOrderInfos, int DrawerNo)
 | 
				
			||||||
        {
 | 
					 | 
				
			||||||
            //    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()
 | 
					 | 
				
			||||||
        {
 | 
					 | 
				
			||||||
            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();
 | 
					 | 
				
			||||||
            return strList;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        //获取麻醉师单对应的手术间号
 | 
					 | 
				
			||||||
        public async Task<List<BoxModel>> GetOperationNum(int boxColor)
 | 
					 | 
				
			||||||
        {
 | 
					 | 
				
			||||||
            List<BoxModel> boxNumList = new List<BoxModel>();
 | 
					 | 
				
			||||||
            //List<int> roomNameList = await _connection.OrderInfo
 | 
					 | 
				
			||||||
            //    .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();
 | 
					 | 
				
			||||||
            //roomNameList.Add(99);
 | 
					 | 
				
			||||||
            //roomNameList.Add(111);
 | 
					 | 
				
			||||||
            logger.Info($"开始查询药盒{DateTime.Now}");
 | 
					 | 
				
			||||||
            boxNumList = await GetDrawerNumByOperationNum(_setting.boxMachineId, boxColor);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            logger.Info($"结束查询药盒{DateTime.Now}");
 | 
					 | 
				
			||||||
            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();
 | 
					            throw new NotImplementedException();
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -109,10 +109,10 @@ namespace MasaBlazorApp3.DataAccess.Impl
 | 
				
			||||||
            List<ReportUsageDateInfo> accountList = new List<ReportUsageDateInfo>();
 | 
					            List<ReportUsageDateInfo> accountList = new List<ReportUsageDateInfo>();
 | 
				
			||||||
            int pagedData = 0;
 | 
					            int pagedData = 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            string SQL = $@"SELECT oi.charge_Date as portdate, od.drug_id as DrugId,1 as ShouShuJian,'' as ZhuMa,'' as FuMa,oi.patient_id as IDNumber,oi.p_name as PName,oi.disease as Diagnose,
 | 
					            string SQL = $@"SELECT oi.Order_date as portdate, od.drug_id as DrugId,1 as ShouShuJian,'' as ZhuMa,'' as FuMa,oi.patient_id as IDNumber,oi.p_name as PName,oi.disease as Diagnose,
 | 
				
			||||||
                           CONCAT(di.drug_name,' ',di.drug_spec)  as DrugName,od.set_manu_No as ManuNo,od.use_dosage as UsageDosage,'' as CanYeLiang,'' as CanYeChuZhi,'' as UseUserName,'' as CheckUserName
 | 
					                           CONCAT(di.drug_name,' ',di.drug_spec)  as DrugName,od.set_manu_No as ManuNo,od.use_dosage as UsageDosage,'' as CanYeLiang,'' as CanYeChuZhi,'' as UseUserName,'' as CheckUserName
 | 
				
			||||||
                            from order_info oi inner join order_detail od on oi.order_no=od.order_no inner join drug_info di on od.drug_id=di.drug_id
 | 
					                            from order_info oi inner join order_detail od on oi.order_no=od.order_no inner join drug_info di on od.drug_id=di.drug_id
 | 
				
			||||||
                            WHERE DATE_FORMAT(oi.charge_Date,'%Y-%m-%d')='{searchDate?.ToString("yyyy-MM-dd")}' and oi.dm_status=2 and oi.cancel_flag=0 and oi.his_disp_flag=0 and di.pack_h=1";
 | 
					                            WHERE DATE_FORMAT(oi.Order_date,'%Y-%m-%d')='{searchDate?.ToString("yyyy-MM-dd")}' and oi.dm_status=2 and oi.cancel_flag=0 and oi.his_disp_flag=0 and di.pack_h=1";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -101,8 +101,6 @@
 | 
				
			||||||
    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();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -171,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.PowerOff();
 | 
					                            PortUtil.AllLightOff();
 | 
				
			||||||
                            RestData();
 | 
					                            RestData();
 | 
				
			||||||
                            stop();
 | 
					                            stop();
 | 
				
			||||||
                        }
 | 
					                        }
 | 
				
			||||||
| 
						 | 
					@ -194,11 +192,11 @@
 | 
				
			||||||
                                }
 | 
					                                }
 | 
				
			||||||
                            });
 | 
					                            });
 | 
				
			||||||
                            orderTakeVo.Status = 2;
 | 
					                            orderTakeVo.Status = 2;
 | 
				
			||||||
                            // if (data.Any(it => it.ChannelStock.BoardType.ToString().Contains("2")))
 | 
					                            if (data.Any(it => it.ChannelStock.BoardType == 2))
 | 
				
			||||||
                            // {
 | 
					                            {
 | 
				
			||||||
                            //     //有单支抽屉则广播灭灯
 | 
					                                //有单支抽屉则广播灭灯
 | 
				
			||||||
                            //     PortUtil.AllLightOff();
 | 
					                                PortUtil.AllLightOff();
 | 
				
			||||||
                            // }
 | 
					                            }
 | 
				
			||||||
                            if (options._data == drawerNos.Count - 1)
 | 
					                            if (options._data == drawerNos.Count - 1)
 | 
				
			||||||
                            {
 | 
					                            {
 | 
				
			||||||
                                PortUtil.speechSynthesizer.SpeakAsyncCancelAll();
 | 
					                                PortUtil.speechSynthesizer.SpeakAsyncCancelAll();
 | 
				
			||||||
| 
						 | 
					@ -226,9 +224,8 @@
 | 
				
			||||||
                                        await Task.Delay(200);
 | 
					                                        await Task.Delay(200);
 | 
				
			||||||
                                    }
 | 
					                                    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                                    if (data[i].ChannelStock.BoardType.ToString().Contains("2") && data[i].ChannelStock.DrawerNo == drawerNo)
 | 
					                                    if (data[i].ChannelStock.BoardType.ToString().Contains("2"))
 | 
				
			||||||
                                    {
 | 
					                                    {
 | 
				
			||||||
 | 
					 | 
				
			||||||
                                        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,27 +236,24 @@
 | 
				
			||||||
                                        }
 | 
					                                        }
 | 
				
			||||||
                                    }
 | 
					                                    }
 | 
				
			||||||
                                }
 | 
					                                }
 | 
				
			||||||
 | 
					                                if (!string.IsNullOrEmpty(alertMessage))
 | 
				
			||||||
                                //有单支抽屉则广播灭灯
 | 
					                                {
 | 
				
			||||||
                                PortUtil.PowerOff();
 | 
					                                    //弹出确认对话框
 | 
				
			||||||
                                // 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();
 | 
				
			||||||
                                //         logger.Info("取消保存");
 | 
					                                        logger.Info("取消保存");
 | 
				
			||||||
                                //         // 关闭弹窗
 | 
					                                        // 关闭弹窗
 | 
				
			||||||
                                //         dialogService.Close(false);
 | 
					                                        dialogService.Close(false);
 | 
				
			||||||
                                //     }
 | 
					                                    }
 | 
				
			||||||
                                // }
 | 
					                                }
 | 
				
			||||||
                                stop();
 | 
					                                stop();
 | 
				
			||||||
                            }
 | 
					                            }
 | 
				
			||||||
                            else
 | 
					                            else
 | 
				
			||||||
| 
						 | 
					@ -287,17 +281,15 @@
 | 
				
			||||||
            );
 | 
					            );
 | 
				
			||||||
                if (setting.Value.single.Contains(drawerNo))
 | 
					                if (setting.Value.single.Contains(drawerNo))
 | 
				
			||||||
                {
 | 
					                {
 | 
				
			||||||
                    PortUtil.PowerOff();
 | 
					                    PortUtil.AllLightOff();
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
                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,15 +109,7 @@
 | 
				
			||||||
        <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}-{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}") *@
 | 
					 | 
				
			||||||
                </Template>
 | 
					                </Template>
 | 
				
			||||||
            </RadzenDataGridColumn>
 | 
					            </RadzenDataGridColumn>
 | 
				
			||||||
            <RadzenDataGridColumn Title="总库存" Property="TotalQuantity"></RadzenDataGridColumn>
 | 
					            <RadzenDataGridColumn Title="总库存" Property="TotalQuantity"></RadzenDataGridColumn>
 | 
				
			||||||
| 
						 | 
					@ -171,7 +163,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==1?'白':'绿')} 药盒加药",
 | 
					               $"{cl.DrawerNo}号药盒加药",
 | 
				
			||||||
             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 }
 | 
				
			||||||
       );
 | 
					       );
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -2,7 +2,7 @@
 | 
				
			||||||
 | 
					
 | 
				
			||||||
<style>
 | 
					<style>
 | 
				
			||||||
    .mycol {
 | 
					    .mycol {
 | 
				
			||||||
    width: calc(100%/8);
 | 
					        width: calc(100%/7);
 | 
				
			||||||
        margin: 4px !important;
 | 
					        margin: 4px !important;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
</style>
 | 
					</style>
 | 
				
			||||||
| 
						 | 
					@ -50,39 +50,12 @@
 | 
				
			||||||
    <div class="row">
 | 
					    <div class="row">
 | 
				
			||||||
        <div class="col-12 mb-4">
 | 
					        <div class="col-12 mb-4">
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            <RadzenDataList @ref="grid" LoadData="@LoadData" WrapItems="true" Count="@count" IsLoading="@isLoading" Data="@_forecasts" PageSize="56" style="height:61vh; overflow:auto">
 | 
					            <RadzenDataList @ref="grid" LoadData="@LoadData" WrapItems="true" Count="@count" IsLoading="@isLoading" Data="@_forecasts" PageSize="54" style="height:61vh; overflow:auto">
 | 
				
			||||||
                <Template Context="channel">
 | 
					                <Template Context="channel">
 | 
				
			||||||
                    <RadzenCard class="mycol" onclick="@(() => CardClick(channel))">
 | 
					                    <RadzenCard class="mycol" onclick="@(() => CardClick(channel))">
 | 
				
			||||||
                        <RadzenRow>
 | 
					                        <RadzenRow>
 | 
				
			||||||
                            <RadzenColumn Size="8" Class="rz-text-truncate">
 | 
					                            <RadzenColumn Size="8" Class="rz-text-truncate">
 | 
				
			||||||
                                @if (channel.DrawerNo == 99)
 | 
					                                <b class="rz-pr-3">@($"{channel.DrawerNo}-{channel.ColNo}")</b>
 | 
				
			||||||
                                {
 | 
					 | 
				
			||||||
                                    <b class="rz-pr-3">@($"急诊药盒")</b>
 | 
					 | 
				
			||||||
                                }
 | 
					 | 
				
			||||||
                                else if(channel.DrawerNo==111)
 | 
					 | 
				
			||||||
                                {
 | 
					 | 
				
			||||||
                                    <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
 | 
					 | 
				
			||||||
                                {
 | 
					 | 
				
			||||||
                                    <b class="rz-pr-3">@($"{channel.DrawerNo}-{(channel.ColNo == 1 ? '白':'绿')}")</b>
 | 
					 | 
				
			||||||
                                }
 | 
					 | 
				
			||||||
                               @*  <b>号药盒</b> *@
 | 
					                               @*  <b>号药盒</b> *@
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                            </RadzenColumn>
 | 
					                            </RadzenColumn>
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -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,71 +18,27 @@
 | 
				
			||||||
            <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)
 | 
					
 | 
				
			||||||
        {
 | 
					 | 
				
			||||||
            @if (status < 3)
 | 
					 | 
				
			||||||
            {
 | 
					 | 
				
			||||||
                <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="@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" />
 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    </RadzenStack>
 | 
					    </RadzenStack>
 | 
				
			||||||
</RadzenStack>
 | 
					</RadzenStack>
 | 
				
			||||||
| 
						 | 
					@ -90,34 +46,17 @@
 | 
				
			||||||
@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;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -132,24 +71,18 @@
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    protected override async Task OnInitializedAsync()
 | 
					    protected override async Task OnInitializedAsync()
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        AllDrawerNos = await channelListDao.GetDrawerNumForRemove(channelStock);
 | 
					        DrawerNos = await channelListDao.GetDrawerNumForRemove(channelStock);
 | 
				
			||||||
        if (AllDrawerNos != null && AllDrawerNos.Count() > 0)
 | 
					        if (DrawerNos != null && DrawerNos.Count() > 0)
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            DrawerNos = AllDrawerNos.Where(d => d.EndsWith('白')).ToArray();
 | 
					 | 
				
			||||||
            if (DrawerNos != null && DrawerNos.Length > 0)
 | 
					 | 
				
			||||||
            SelectedDrawerNo = DrawerNos[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();
 | 
					        // PortUtil.speechSynthesizer.SpeakAsyncCancelAll();
 | 
				
			||||||
        // this.status = 0;
 | 
					        // this.status = 0;
 | 
				
			||||||
        // data.ForEach(it =>
 | 
					        // data.ForEach(it =>
 | 
				
			||||||
| 
						 | 
					@ -160,70 +93,6 @@
 | 
				
			||||||
        // });
 | 
					        // });
 | 
				
			||||||
        // this.WeightFinnalQuantity = new int[9];
 | 
					        // this.WeightFinnalQuantity = new int[9];
 | 
				
			||||||
        // DrawerNoColNoList.Clear();
 | 
					        // DrawerNoColNoList.Clear();
 | 
				
			||||||
    // }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    private async Task OnColorChanged(object value)
 | 
					 | 
				
			||||||
    {
 | 
					 | 
				
			||||||
        BoxColor = (BoxModel)value;
 | 
					 | 
				
			||||||
        if (AllDrawerNos != null && AllDrawerNos.Length > 0 && AllDrawerNos[0] != "无库位")
 | 
					 | 
				
			||||||
        {
 | 
					 | 
				
			||||||
            if ((((BoxModel)value).BoxNo) == 3)
 | 
					 | 
				
			||||||
            {
 | 
					 | 
				
			||||||
                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);
 | 
					 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
            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()
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
| 
						 | 
					@ -238,12 +107,11 @@
 | 
				
			||||||
            _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) || SelectedDrawerNo == "无库位")
 | 
					        if (string.IsNullOrEmpty(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;            
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        SelectedDrawerNo = SelectedDrawerNo == "急诊药盒" ? "99-1" : SelectedDrawerNo == "恢复室药盒" ? "111-1" : SelectedDrawerNo;
 | 
					 | 
				
			||||||
        var b = await channelListDao.BoxRemoveFinish(channelStock, SelectedDrawerNo,removeQuantity);
 | 
					        var b = await channelListDao.BoxRemoveFinish(channelStock, SelectedDrawerNo,removeQuantity);
 | 
				
			||||||
        if (!b)
 | 
					        if (!b)
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
| 
						 | 
					@ -260,139 +128,4 @@
 | 
				
			||||||
        //重置状态
 | 
					        //重置状态
 | 
				
			||||||
        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,58 +19,19 @@
 | 
				
			||||||
            <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>
 | 
				
			||||||
            <div style="text-align: left;width:15vw">
 | 
					            <RadzenDropDown @bind-Value="SelectedDrawerNo" Data="@DrawerNos" Style="display: block;" Change="@(args => SelectedDrawerChange(args))" Name="DropDownChangeEvent">
 | 
				
			||||||
                <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>
 | 
					 | 
				
			||||||
            <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>
 | 
					                    <RadzenText TextStyle="TextStyle.Subtitle2" class="mb-0">@(SelectedDrawerNo)</RadzenText>
 | 
				
			||||||
           
 | 
					           
 | 
				
			||||||
            </RadzenDropDown>
 | 
					            </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="规格" />
 | 
				
			||||||
| 
						 | 
					@ -89,7 +50,7 @@
 | 
				
			||||||
    </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" />
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -100,17 +61,15 @@
 | 
				
			||||||
@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;
 | 
				
			||||||
| 
						 | 
					@ -125,141 +84,36 @@
 | 
				
			||||||
    //开抽屉前操作标识
 | 
					    //开抽屉前操作标识
 | 
				
			||||||
    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()
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        // AllDrawerNos = await channelListDao.GetDrawerNum(channelStock);
 | 
					        DrawerNos = 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.Contains("无库位") && DrawerNos.Count() > 0)
 | 
					        if (DrawerNos != null && 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;
 | 
				
			||||||
            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;
 | 
					        count = result.TotalDesserts;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        isLoading = false;
 | 
					        isLoading = false;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					    void RestData()
 | 
				
			||||||
    private async Task OnColorChanged(object value)
 | 
					 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        BoxColor = (BoxModel)value;
 | 
					        // PortUtil.speechSynthesizer.SpeakAsyncCancelAll();
 | 
				
			||||||
        if (AllDrawerNos != null && AllDrawerNos.Length > 0 && AllDrawerNos[0] != "无库位")
 | 
					        // this.status = 0;
 | 
				
			||||||
        {
 | 
					        // data.ForEach(it =>
 | 
				
			||||||
            if (BoxColor.BoxNo == 3)
 | 
					 | 
				
			||||||
            {
 | 
					 | 
				
			||||||
                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);
 | 
					 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
            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();
 | 
					        //     it.Status = 0;
 | 
				
			||||||
                //     if (DrawerNos != null && DrawerNos.Length > 0 && DrawerNos[0] != "无库位")
 | 
					        //     it.BeforeQuantity = new int[9];
 | 
				
			||||||
                //     {
 | 
					        //     it.AfterQuantity = new int[9];
 | 
				
			||||||
                //         SelectedDrawerNo = DrawerNos[0];
 | 
					        // });
 | 
				
			||||||
                //         await SelectedDrawerChange(SelectedDrawerNo);
 | 
					        // this.WeightFinnalQuantity = new int[9];
 | 
				
			||||||
                //     }
 | 
					        // DrawerNoColNoList.Clear();
 | 
				
			||||||
                //     else
 | 
					 | 
				
			||||||
                //     {
 | 
					 | 
				
			||||||
                //         SelectedDrawerNo = "无库位";
 | 
					 | 
				
			||||||
                //     }
 | 
					 | 
				
			||||||
                //     await InvokeAsync(StateHasChanged);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                // }
 | 
					 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    void Cancel()
 | 
					    void Cancel()
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
| 
						 | 
					@ -271,7 +125,7 @@
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        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.AddQuantity) > channelStock.Quantity)
 | 
					            if (selectedDrawerData.Where(cs => cs.AddQuantity != 0).Sum(cs => cs.Quantity) > 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;
 | 
				
			||||||
| 
						 | 
					@ -301,12 +155,6 @@
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    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;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
| 
						 | 
					@ -318,15 +166,4 @@
 | 
				
			||||||
        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();
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					@ -6,42 +6,32 @@
 | 
				
			||||||
        <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==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)" />
 | 
					                <RadzenButton class="col-12" Style="margin-bottom:5px" Click="@(() => SelectDrawer((cs.DrawerNo.ToString() + "-" + cs.ColNo.ToString())))" Text="@($"{cs.DrawerNo.ToString() + "-" + cs.ColNo.ToString()}")" 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="false">
 | 
					                        Data="@_forecasts" PageSize="6" AllowPaging="true" PagerHorizontalAlign="HorizontalAlign.Left"
 | 
				
			||||||
 | 
					                        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="10">
 | 
					                        <RadzenColumn Size="2">
 | 
				
			||||||
                            <div style="text-align: left;">
 | 
					                            <RadzenText TextStyle="TextStyle.H6" TagName="TagName.H5" class="rz-color-on-secondary-lighter">@(pd._DrugInfo.DrugName)</RadzenText>
 | 
				
			||||||
                                <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">
 | 
				
			||||||
                            厂家<br />
 | 
					                            <RadzenText TextStyle="TextStyle.H6" TagName="TagName.H5" class="rz-color-on-secondary-lighter">@(pd._DrugInfo.Manufactory)</RadzenText>
 | 
				
			||||||
                            @(pd._DrugInfo.Manufactory) 
 | 
					                        </RadzenColumn>
 | 
				
			||||||
                        </RadzenColumn> *@
 | 
					                        <RadzenColumn Size="3">
 | 
				
			||||||
                        @*<RadzenColumn Size="3">
 | 
					 | 
				
			||||||
                            规格<br />
 | 
					 | 
				
			||||||
                            @(pd._DrugInfo.DrugSpec)
 | 
					 | 
				
			||||||
                            <RadzenText TextStyle="TextStyle.H6" TagName="TagName.H5" class="rz-color-on-secondary-lighter">@(pd._DrugInfo.DrugSpec)</RadzenText>
 | 
					                            <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">
 | 
				
			||||||
                            <div class="rz-text-h6 rz-mb-0">库存</div>
 | 
					                            <RadzenText TextStyle="TextStyle.H6" TagName="TagName.H5" class="rz-color-on-secondary-lighter">@(pd.BaseQuantity)</RadzenText>
 | 
				
			||||||
                            @(pd.channelStocks.Sum(cs => cs.Quantity))
 | 
					                        </RadzenColumn>
 | 
				
			||||||
                            @* <RadzenText TextStyle="TextStyle.H6" TagName="TagName.H5" class="rz-color-on-secondary-lighter">@(pd.channelStocks.Sum(cs => cs.Quantity))</RadzenText> *@
 | 
					                        <RadzenColumn Size="1">
 | 
				
			||||||
 | 
					                            <RadzenText TextStyle="TextStyle.H6" TagName="TagName.H5" class="rz-color-on-secondary-lighter">@(pd.channelStocks.Sum(cs => cs.Quantity))</RadzenText>
 | 
				
			||||||
                        </RadzenColumn>
 | 
					                        </RadzenColumn>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                    </RadzenRow>
 | 
					                    </RadzenRow>
 | 
				
			||||||
| 
						 | 
					@ -178,10 +168,8 @@
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        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>(
 | 
				
			||||||
                 message,
 | 
					                   $"{cs.DrawerNo}号药盒替换药品详情",
 | 
				
			||||||
                 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 }
 | 
				
			||||||
           );
 | 
					           );
 | 
				
			||||||
| 
						 | 
					@ -203,9 +191,8 @@
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        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>(
 | 
				
			||||||
                message,
 | 
					                   $"{cs.DrawerNo}号药盒替换药品详情",
 | 
				
			||||||
                 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 }
 | 
				
			||||||
           );
 | 
					           );
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,234 +0,0 @@
 | 
				
			||||||
@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 }
 | 
					 | 
				
			||||||
        );
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
| 
						 | 
					@ -1,212 +0,0 @@
 | 
				
			||||||
@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,9 +1,7 @@
 | 
				
			||||||
@page "/Box/CheckAAA"
 | 
					@page "/Box/Check"
 | 
				
			||||||
@using MasaBlazorApp3.Pojo.Config
 | 
					@using MasaBlazorApp3.Pojo.Config
 | 
				
			||||||
@using MasaBlazorApp3.Report
 | 
					@using MasaBlazorApp3.Report
 | 
				
			||||||
@using Microsoft.Extensions.Options
 | 
					 | 
				
			||||||
@using Radzen.Blazor.Rendering
 | 
					@using Radzen.Blazor.Rendering
 | 
				
			||||||
@using log4net;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
<style>
 | 
					<style>
 | 
				
			||||||
    .my-popup {
 | 
					    .my-popup {
 | 
				
			||||||
| 
						 | 
					@ -17,12 +15,6 @@
 | 
				
			||||||
        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">
 | 
				
			||||||
| 
						 | 
					@ -45,103 +37,51 @@
 | 
				
			||||||
        </div>
 | 
					        </div>
 | 
				
			||||||
    </div> *@
 | 
					    </div> *@
 | 
				
			||||||
    <div class="col-12">
 | 
					    <div class="col-12">
 | 
				
			||||||
        <form onsubmit="@(() => {firstLod=0;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">
 | 
					                <RadzenRow AlignItems="AlignItems.Center">
 | 
				
			||||||
                    <RadzenColumn Size="6">
 | 
					                    <RadzenColumn Size="6">
 | 
				
			||||||
                        <RadzenLabel Text="麻醉医师" Component="NamesList" Style="width: 20%;" />
 | 
					                        <RadzenLabel Text="麻醉师" Component="NamesList" />
 | 
				
			||||||
                        <RadzenDropDownDataGrid AllowVirtualization="true" Name="NamesList" TValue="Anaesthetist" Data="@NamesList" @bind-Value="NameInfo"
 | 
					                        <RadzenDropDownDataGrid AllowVirtualization="true" Name="NamesList" TValue="Anaesthetist" Data="@NamesList" @bind-Value="Name"
 | 
				
			||||||
                                                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" />
 | 
				
			||||||
                            </Columns>
 | 
					                            </Columns>
 | 
				
			||||||
                        </RadzenDropDownDataGrid>
 | 
					                        </RadzenDropDownDataGrid>
 | 
				
			||||||
                    </RadzenColumn>
 | 
					                    </RadzenColumn>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                    <RadzenColumn Size="6">
 | 
					                    <RadzenColumn Size="6">
 | 
				
			||||||
                        <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%;"
 | 
					 | 
				
			||||||
                        AllowFilteringByAllStringColumns="true" TextProperty="药箱号">
 | 
					 | 
				
			||||||
                            <Template>
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                                @((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) *@
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                            </Template>
 | 
					 | 
				
			||||||
                            <Columns>
 | 
					 | 
				
			||||||
                                <RadzenDropDownDataGridColumn Property="BoxName" Title="药箱号" Sortable="false" />
 | 
					 | 
				
			||||||
                            </Columns>
 | 
					 | 
				
			||||||
                        </RadzenDropDownDataGrid>
 | 
					 | 
				
			||||||
                    </RadzenColumn>
 | 
					 | 
				
			||||||
                </RadzenRow>
 | 
					 | 
				
			||||||
                <RadzenRow AlignItems="AlignItems.Center">
 | 
					 | 
				
			||||||
                    <RadzenColumn Size="6">
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                        <RadzenLabel Text="处方号" Component="OrderNo" />
 | 
					                        <RadzenLabel Text="处方号" Component="OrderNo" />
 | 
				
			||||||
                        <RadzenTextBox @bind-Value="OrderNo" Style="width: 100%;" Name="OrderNo"></RadzenTextBox>
 | 
					                        <RadzenTextBox @bind-Value="OrderNo" Style="width: 100%;" Name="OrderNo"></RadzenTextBox>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                    </RadzenColumn>
 | 
					                    </RadzenColumn>
 | 
				
			||||||
                    <RadzenColumn Size="6" Style="margin-top:0.5rem">
 | 
					                </RadzenRow>
 | 
				
			||||||
 | 
					                <RadzenRow AlignItems="AlignItems.Center">
 | 
				
			||||||
 | 
					                    <RadzenColumn Size="6">
 | 
				
			||||||
                        <RadzenLabel Text="处方时间" Component="OrderDate" />
 | 
					                        <RadzenLabel Text="处方时间" Component="OrderDate" />
 | 
				
			||||||
                        <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>
 | 
					                    <RadzenColumn Size="6" Style="margin-top:0.5rem">
 | 
				
			||||||
                <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:2px">
 | 
					 | 
				
			||||||
                        <RadzenButton Size="ButtonSize.Medium" ButtonType="ButtonType.Submit" IsBusy="isLoading" Icon="search" Text="查询" />
 | 
					                        <RadzenButton Size="ButtonSize.Medium" ButtonType="ButtonType.Submit" IsBusy="isLoading" Icon="search" Text="查询" />
 | 
				
			||||||
                        <RadzenButton Size="ButtonSize.Medium" Click="reloadGrid" IsBusy="isLoading" Icon="refresh" Text="重置" ButtonStyle="ButtonStyle.Warning" />
 | 
					                        <RadzenButton Size="ButtonSize.Medium" Click="reloadGrid" IsBusy="isLoading" Icon="refresh" Text="重置" ButtonStyle="ButtonStyle.Warning" />
 | 
				
			||||||
                        <RadzenButton Size="ButtonSize.Medium" Click="Confirm" ButtonType="ButtonType.Button" IsBusy="isLoading" Icon="check_circle" 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>
 | 
					                    </RadzenColumn>
 | 
				
			||||||
                </RadzenRow>
 | 
					                </RadzenRow>
 | 
				
			||||||
                @* </RadzenStack> *@
 | 
					                @* </RadzenStack> *@
 | 
				
			||||||
            </RadzenFieldset>
 | 
					            </RadzenFieldset>
 | 
				
			||||||
            <RadzenStack Orientation="Orientation.Horizontal" Gap="1rem" Style="margin:0.5rem">
 | 
					            <RadzenStack Orientation="Orientation.Horizontal" Gap="1rem" Style="margin:0.5rem">
 | 
				
			||||||
                @*   <RadzenLabel Text="核对药箱" Component="BoxList" Style="margin:0.5rem" />
 | 
					                <RadzenLabel Text="核对药箱" Component="BoxList" Style="margin:0.5rem" />
 | 
				
			||||||
                <RadzenDropDownDataGrid AllowVirtualization="true" Name="BoxList" TValue="BoxModel" Data="@BoxList" @bind-Value="BoxNum"
 | 
					                <RadzenDropDownDataGrid AllowVirtualization="true" Name="BoxList" TValue="BoxModel" Data="@BoxList" @bind-Value="BoxNum"
 | 
				
			||||||
                                        AllowFilteringByAllStringColumns="true" TextProperty="药箱号">
 | 
					                                        AllowFilteringByAllStringColumns="true" TextProperty="BoxName">
 | 
				
			||||||
                    <Template>
 | 
					                    <Template>
 | 
				
			||||||
                        @((context as BoxModel).BoxName + "-" + (context as BoxModel).BoxNo)
 | 
					                        @((context as BoxModel).BoxName + "-" + (context as BoxModel).BoxNo)
 | 
				
			||||||
                    </Template>
 | 
					                    </Template>
 | 
				
			||||||
                    <Columns>
 | 
					                    <Columns>
 | 
				
			||||||
                        <RadzenDropDownDataGridColumn Property="BoxName" Title="药箱号" Sortable="false" />
 | 
					                        <RadzenDropDownDataGridColumn Property="BoxName" Title="药箱号" Sortable="false" />
 | 
				
			||||||
                    </Columns>
 | 
					                    </Columns>
 | 
				
			||||||
                </RadzenDropDownDataGrid> *@
 | 
					                </RadzenDropDownDataGrid>
 | 
				
			||||||
                @*  <RadzenButton Size="ButtonSize.Medium" Click="Confirm" ButtonType="ButtonType.Button" IsBusy="isLoading" Icon="check_circle" Text="确认" />
 | 
					                <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))" />
 | 
					                <RadzenButton Icon="download" @ref=button Text="麻醉药品使用登记本导出" Variant="Variant.Outlined" Click="@(args => popup.ToggleAsync(button.Element))" />
 | 
				
			||||||
                <Popup @ref=popup Lazy=true class="my-popup">
 | 
					                <Popup @ref=popup 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">
 | 
				
			||||||
| 
						 | 
					@ -162,34 +102,31 @@
 | 
				
			||||||
                            </RadzenStack>
 | 
					                            </RadzenStack>
 | 
				
			||||||
                        </RadzenFieldset>
 | 
					                        </RadzenFieldset>
 | 
				
			||||||
                    </RadzenStack>
 | 
					                    </RadzenStack>
 | 
				
			||||||
                </Popup> *@
 | 
					                </Popup>
 | 
				
			||||||
            </RadzenStack>
 | 
					            </RadzenStack>
 | 
				
			||||||
        </form>
 | 
					        </form>
 | 
				
			||||||
        <div Style="width:936px;height:50vh;overflow:auto">
 | 
					        <RadzenDataGrid @ref="grid" AllowRowSelectOnRowClick="@allowRowSelectOnRowClick" AllowFiltering="true" LoadData="@LoadData"
 | 
				
			||||||
            <RadzenDataGrid @ref="grid" AllowRowSelectOnRowClick="@allowRowSelectOnRowClick" AllowFiltering="true" LoadData="@LoadData" Style="width:955px;overflow:auto" Groupable="true" 
 | 
					 | 
				
			||||||
                        FilterPopupRenderMode="PopupRenderMode.OnDemand" FilterCaseSensitivity="FilterCaseSensitivity.CaseInsensitive"
 | 
					                        FilterPopupRenderMode="PopupRenderMode.OnDemand" FilterCaseSensitivity="FilterCaseSensitivity.CaseInsensitive"
 | 
				
			||||||
            Data="@orderInfos" IsLoading="@isLoading" Count="@count" EmptyText="无数据"
 | 
					                        Data="@orderInfos" ColumnWidth="200px" IsLoading="@isLoading" Count="@count" EmptyText="无数据"
 | 
				
			||||||
                        SelectionMode="DataGridSelectionMode.Multiple" @bind-Value=@selectedOrderInfos
 | 
					                        SelectionMode="DataGridSelectionMode.Multiple" @bind-Value=@selectedOrderInfos
 | 
				
			||||||
                        CellClick="@((DataGridCellMouseEventArgs<OrderInfo> args) => OnCellClick(args))"
 | 
					                        CellClick="@((DataGridCellMouseEventArgs<OrderInfo> args) => OnCellClick(args))"
 | 
				
			||||||
            AllowPaging="false">
 | 
					                        AllowPaging="true" PageSize="10" PagerHorizontalAlign="HorizontalAlign.Left" ShowPagingSummary="true" PagingSummaryFormat="{0}/{1} 共{2}条数据">
 | 
				
			||||||
            <Columns>
 | 
					            <Columns>
 | 
				
			||||||
                    <RadzenDataGridColumn Sortable="false" Filterable="false" Width="2rem">
 | 
					                <RadzenDataGridColumn Sortable="false" Filterable="false" Width="4rem">
 | 
				
			||||||
                        @*  <HeaderTemplate>
 | 
					                    <HeaderTemplate>
 | 
				
			||||||
                        <RadzenCheckBox TabIndex="-1" TriState="false" TValue="bool?" InputAttributes="@(new Dictionary<string, object>() { { "aria-label", "Select all items" } })"
 | 
					                        <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)))"
 | 
					                                        Value="@(selectedOrderInfos == null || selectedOrderInfos?.Any() != true ? false : !orderInfos.All(i => selectedOrderInfos.Contains(i)) ? null : orderInfos.Any(i => selectedOrderInfos.Contains(i)))"
 | 
				
			||||||
                            Change="@(args => OnCheckSeleced(args))" />
 | 
					                                        Change="@(args => selectedOrderInfos = args == true ? orderInfos.ToList() : null)" />
 | 
				
			||||||
                        </HeaderTemplate> *@
 | 
					                    </HeaderTemplate>
 | 
				
			||||||
                    <Template Context="data">
 | 
					                    <Template Context="data">
 | 
				
			||||||
                            <RadzenCheckBox TabIndex="-1" TriState="false" Value="@data.ItemIsChecked" InputAttributes="@(new Dictionary<string, object>() { { "aria-label", "Select item" } })"
 | 
					                        <RadzenCheckBox TabIndex="-1" TriState="false" Value="@(selectedOrderInfos != null && selectedOrderInfos.Contains(data))" InputAttributes="@(new Dictionary<string, object>() { { "aria-label", "Select item" } })"
 | 
				
			||||||
                                        TValue="bool" Change="@(args => { if (!allowRowSelectOnRowClick) { grid.SelectRow(data); } })" />
 | 
					                                        TValue="bool" Change="@(args => { if (!allowRowSelectOnRowClick) { grid.SelectRow(data); } })" />
 | 
				
			||||||
                    </Template>
 | 
					                    </Template>
 | 
				
			||||||
                </RadzenDataGridColumn>
 | 
					                </RadzenDataGridColumn>
 | 
				
			||||||
                    <RadzenDataGridColumn Property="anaesthetistName" Title="麻醉医师" Sortable="false" Filterable="false" Width="50px" />
 | 
					                <RadzenDataGridColumn Property="PatientName" Title="姓名" Sortable="false" Filterable="false" Width="4rem" />
 | 
				
			||||||
                    <RadzenDataGridColumn Property="PatientName" Title="姓名" Sortable="false" Filterable="false" Width="50px" />
 | 
					                <RadzenDataGridColumn Property="Sex" Title="性别" Sortable="false" Filterable="false" Width="2rem" />
 | 
				
			||||||
                    <RadzenDataGridColumn Property="Sex" Title="性别" Sortable="false" Filterable="false" Width="30px" />
 | 
					                <RadzenDataGridColumn Property="OrderNo" Title="单号" Sortable="false" Filterable="false" Width="8rem" />
 | 
				
			||||||
                    <RadzenDataGridColumn Property="OrderNo" Title="单号" Sortable="false" Filterable="false" Width="70px" />
 | 
					                <RadzenDataGridColumn Property="DetailInfo.Drug.DrugName" Title="药品名称" FormatString="{0:d}" Sortable="false" Filterable="false" Width="8rem" />
 | 
				
			||||||
                    <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">
 | 
					                @* <Template Context="DetailInfo">
 | 
				
			||||||
                       @for (int i = 0; i < DetailList.DetailList.Count; i++)
 | 
					                       @for (int i = 0; i < DetailList.DetailList.Count; i++)
 | 
				
			||||||
                        {
 | 
					                        {
 | 
				
			||||||
| 
						 | 
					@ -207,7 +144,7 @@
 | 
				
			||||||
                        }
 | 
					                        }
 | 
				
			||||||
                    </Template>
 | 
					                    </Template>
 | 
				
			||||||
                </RadzenDataGridColumn> *@
 | 
					                </RadzenDataGridColumn> *@
 | 
				
			||||||
                    <RadzenDataGridColumn Title="批次" Property="DetailInfo.SetManuNo" Filterable="false" Width="100px">
 | 
					                <RadzenDataGridColumn Width="110px" Title="批次" Property="DetailInfo.SetManuNo">
 | 
				
			||||||
                    @*            <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>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -252,59 +189,45 @@
 | 
				
			||||||
                        <RadzenRequiredValidator Text="请选择批次" Component="ManuNo" Popup="true" />
 | 
					                        <RadzenRequiredValidator Text="请选择批次" Component="ManuNo" Popup="true" />
 | 
				
			||||||
                    </EditTemplate>
 | 
					                    </EditTemplate>
 | 
				
			||||||
                </RadzenDataGridColumn>
 | 
					                </RadzenDataGridColumn>
 | 
				
			||||||
                    <RadzenDataGridColumn Property="DetailInfo.Quantity" Title="数量" Filterable="false" Width="50px">
 | 
					                <RadzenDataGridColumn Property="DetailInfo.Quantity" Title="数量" Sortable="false" Filterable="false" Width="2rem" />
 | 
				
			||||||
                        <EditTemplate Context="DetailInfo">
 | 
					                @*  <Template Context="DetailInfo">
 | 
				
			||||||
                            <RadzenNumeric Min="0" Style="display: block" Name="Quantity" @bind-Value=@DetailInfo.DetailInfo.Quantity />
 | 
					                       @for (int i = 0; i < DetailList.DetailList.Count; i++)
 | 
				
			||||||
                            <RadzenNumericRangeValidator Style="position: absolute;z-index: 9999;" Min="0" Text="请填写正确的添加数量" Component="Quantity" Popup="true" />
 | 
					                        {
 | 
				
			||||||
                        </EditTemplate>
 | 
					                            OrderDetail orderDetail = DetailList.DetailList[i];
 | 
				
			||||||
                    </RadzenDataGridColumn>
 | 
					                            <RadzenText TextStyle="TextStyle.Subtitle2" class="rz-mb-0">@orderDetail.Quantity</RadzenText>
 | 
				
			||||||
                    <RadzenDataGridColumn Property="DetailInfo.TotalQuantity" Title="合计" Filterable="false" Width="50px" />
 | 
					                        }
 | 
				
			||||||
 | 
					                    </Template>
 | 
				
			||||||
 | 
					                </RadzenDataGridColumn> *@
 | 
				
			||||||
            </Columns>
 | 
					            </Columns>
 | 
				
			||||||
        </RadzenDataGrid>
 | 
					        </RadzenDataGrid>
 | 
				
			||||||
    </div>
 | 
					    </div>
 | 
				
			||||||
    </div>
 | 
					 | 
				
			||||||
</RadzenStack>
 | 
					</RadzenStack>
 | 
				
			||||||
@code {
 | 
					@code {
 | 
				
			||||||
 | 
					 | 
				
			||||||
    private readonly ILog logger = LogManager.GetLogger(typeof(CheckOrder));
 | 
					 | 
				
			||||||
    @inject IOrderInfoDao orderInfoDao;
 | 
					    @inject IOrderInfoDao orderInfoDao;
 | 
				
			||||||
    @inject DialogService dialogService;
 | 
					    @inject DialogService dialogService;
 | 
				
			||||||
    @inject Microsoft.Extensions.Options.IOptions<Pojo.Config.SettingConfig> setting;
 | 
					    @inject Microsoft.Extensions.Options.IOptions<Pojo.Config.SettingConfig> setting;
 | 
				
			||||||
    @inject NotificationService _message;
 | 
					    @inject NotificationService _message;
 | 
				
			||||||
    @inject IReportDataDao reportDataDao;
 | 
					    @inject IReportDataDao reportDataDao;
 | 
				
			||||||
    @inject IOptions<SettingConfig> setting;
 | 
					
 | 
				
			||||||
    bool allowRowSelectOnRowClick = true;
 | 
					    bool allowRowSelectOnRowClick = true;
 | 
				
			||||||
    IEnumerable<OrderInfo> orderInfos;
 | 
					    IEnumerable<OrderInfo> orderInfos;
 | 
				
			||||||
    IList<OrderInfo> selectedOrderInfos;
 | 
					    IList<OrderInfo> selectedOrderInfos;
 | 
				
			||||||
    RadzenDataGrid<OrderInfo> grid;
 | 
					    RadzenDataGrid<OrderInfo> grid;
 | 
				
			||||||
    //麻醉师集合
 | 
					    //麻醉师集合
 | 
				
			||||||
    List<Anaesthetist> NamesList = new List<Anaesthetist>();
 | 
					    List<Anaesthetist> NamesList = new List<Anaesthetist>();
 | 
				
			||||||
    Anaesthetist NameInfo;
 | 
					    Anaesthetist Name;
 | 
				
			||||||
    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);
 | 
				
			||||||
| 
						 | 
					@ -313,22 +236,11 @@
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        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)
 | 
				
			||||||
| 
						 | 
					@ -341,7 +253,6 @@
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            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);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    //确认
 | 
					    //确认
 | 
				
			||||||
| 
						 | 
					@ -361,134 +272,86 @@
 | 
				
			||||||
              );
 | 
					              );
 | 
				
			||||||
            return;
 | 
					            return;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        if (selectedOrderInfos.Any(it => it.DetailInfo.drugManuNo == null && (string.IsNullOrEmpty(it.DetailInfo.SetManuNo))))
 | 
					        if (selectedOrderInfos.Any(it => it.DetailInfo.drugManuNo == null))
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            _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);
 | 
					        // bool bResult = await orderInfoDao.CheckOrderInfo(selectedOrderInfos, BoxNum);
 | 
				
			||||||
        selectedOrderInfos.Where(oi => !string.IsNullOrEmpty(oi.DetailInfo.SetManuNo)).ToList().ForEach(oi => oi.DetailInfo.drugManuNo = new() { ManuNo = oi.DetailInfo.SetManuNo });
 | 
					        // if (bResult)
 | 
				
			||||||
        //弹出药品合计信息,确认无误后进行核对,取消则不核对
 | 
					 | 
				
			||||||
        //弹出确认提示框
 | 
					 | 
				
			||||||
        // 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);
 | 
					        //     _message.Notify(
 | 
				
			||||||
        if (bResult)
 | 
					        //                     new NotificationMessage { Severity = NotificationSeverity.Success, Summary = "提示", Detail = $"处方已核对完成", Duration = 4000 }
 | 
				
			||||||
        {
 | 
					        //                 );
 | 
				
			||||||
            _message.Notify(
 | 
					 | 
				
			||||||
                            new NotificationMessage { Severity = NotificationSeverity.Success, Summary = "提示", Detail = $"处方已核对完成", Duration = 4000 }
 | 
					 | 
				
			||||||
                        );
 | 
					 | 
				
			||||||
        //     await GetInitialDate();
 | 
					        //     await GetInitialDate();
 | 
				
			||||||
            await grid.Reload();
 | 
					        //     await grid.Reload();
 | 
				
			||||||
        }
 | 
					        // }
 | 
				
			||||||
        else
 | 
					        // else
 | 
				
			||||||
        {
 | 
					        // {
 | 
				
			||||||
            _message.Notify(
 | 
					        //     _message.Notify(
 | 
				
			||||||
                          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()
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        BoxColorList = setting.Value.boxColor.Split(',').Select(it => new Anaesthetist { Name = it,Id=it=="白"?1:2 }).ToList();
 | 
					        await GetInitialDate();
 | 
				
			||||||
        BoxColor = BoxColorList.FirstOrDefault();
 | 
					 | 
				
			||||||
        NamesList = setting.Value.anaesthetist_name.Split(',').Select(it => new Anaesthetist { Name = it }).ToList();
 | 
					 | 
				
			||||||
        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();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        BoxNum = BoxList.FirstOrDefault();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        //await GetInitialDate();
 | 
					 | 
				
			||||||
        await base.OnInitializedAsync();
 | 
					        await base.OnInitializedAsync();
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					    async Task GetInitialDate()
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					         result = await orderInfoDao.GetAllOrderInfo(null, null, null, null, null);
 | 
				
			||||||
 | 
					        List<string> nameList = result.Desserts.Select(it => it.anaesthetistName).Distinct().ToList();
 | 
				
			||||||
 | 
					        NamesList = nameList.Select(it => new Anaesthetist { Name = it }).ToList();
 | 
				
			||||||
 | 
					        Name = NamesList.FirstOrDefault();        
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
    async Task LoadData(LoadDataArgs args)
 | 
					    async Task LoadData(LoadDataArgs args)
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        if (firstLod == 1)
 | 
					        if (result != null)
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
 | 
					 | 
				
			||||||
            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;
 | 
					            isLoading = true;
 | 
				
			||||||
            orderInfos = result.Desserts;
 | 
					            orderInfos = result.Desserts;
 | 
				
			||||||
 | 
					            // Update the count
 | 
				
			||||||
            count = result.TotalDesserts;
 | 
					            count = result.TotalDesserts;
 | 
				
			||||||
        // if (result != null)
 | 
					            // Update the Data property
 | 
				
			||||||
        // {
 | 
					            if (Name != null)
 | 
				
			||||||
        //     isLoading = true;
 | 
					            {
 | 
				
			||||||
        //     orderInfos = result.Desserts;
 | 
					                orderInfos = orderInfos.Where(it => it.anaesthetistName == Name.Name);
 | 
				
			||||||
        //     // Update the count
 | 
					                count = orderInfos.Count();
 | 
				
			||||||
        //     count = result.TotalDesserts;
 | 
					            }
 | 
				
			||||||
        //     logger.Info($"LoadData:{DateTime.Now},{orderInfos.Count()}");
 | 
					            if(OrderDate != null && OrderDate != DateTime.MinValue)
 | 
				
			||||||
        //     // Update the Data property
 | 
					            {
 | 
				
			||||||
        //     if (Name != null)
 | 
					                orderInfos = orderInfos.Where(it => it.ChargeDate.Date == OrderDate.Value.Date);
 | 
				
			||||||
        //     {
 | 
					                // Update the count
 | 
				
			||||||
        //         orderInfos = orderInfos.Where(it => it.anaesthetistName == Name.Name);
 | 
					                count = orderInfos.Count();
 | 
				
			||||||
        //         logger.Info($"LoadData:{DateTime.Now},{orderInfos.Count()},Name{Name.Name}");
 | 
					            }
 | 
				
			||||||
        //         count = orderInfos.Count();
 | 
					            if(!string.IsNullOrEmpty(OrderNo))
 | 
				
			||||||
        //     }
 | 
					            {
 | 
				
			||||||
        //     if (OrderDate != null && OrderDate != DateTime.MinValue)
 | 
					                orderInfos = orderInfos.Where(it => it.OrderNo.Contains(OrderNo));
 | 
				
			||||||
        //     {
 | 
					                // Update the count
 | 
				
			||||||
        //         orderInfos = orderInfos.Where(it => it.ChargeDate.Date >= OrderDate.Value.Date);
 | 
					                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));
 | 
				
			||||||
 | 
					                // Update the count
 | 
				
			||||||
 | 
					                count = orderInfos.Count();
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					            orderInfos = orderInfos.Skip(args.Skip.Value).Take(args.Top.Value).ToList();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        //         logger.Info($"LoadData:{DateTime.Now},{orderInfos.Count()}");
 | 
					            //查找该麻醉师对应的手术室
 | 
				
			||||||
        //         // Update the count
 | 
					            //List<string> roomNameList = orderInfos.Select(it => it.RoomName).Distinct().ToList();
 | 
				
			||||||
        //         count = orderInfos.Count();
 | 
					            List<int> roomNameList = orderInfos.Select(it => Convert.ToInt32(it.RoomName.Substring(6, it.RoomName.Length - 6))).Distinct().ToList();
 | 
				
			||||||
        //     }
 | 
					            BoxList = await orderInfoDao.GetDrawerNumByOperationNum(setting.Value.machineId, roomNameList); //roomNameList.Select(it => new BoxModel { BoxName = it, BoxNo = Convert.ToInt32(it.Substring(it.Length - 2, 2)) }).ToList();
 | 
				
			||||||
        //     if (!string.IsNullOrEmpty(OrderNo))
 | 
					 | 
				
			||||||
        //     {
 | 
					 | 
				
			||||||
        //         orderInfos = orderInfos.Where(it => it.OrderNo.Contains(OrderNo));
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
        //         logger.Info($"LoadData:{DateTime.Now},{orderInfos.Count()}-OrderNo{OrderNo}");
 | 
					            BoxNum = BoxList.FirstOrDefault();
 | 
				
			||||||
        //         // 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;
 | 
					            isLoading = false;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        // }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    //麻醉药品使用登记本导出
 | 
					    //麻醉药品使用登记本导出
 | 
				
			||||||
    async Task StockExport()
 | 
					    async Task StockExport()
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,358 +0,0 @@
 | 
				
			||||||
@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();
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
| 
						 | 
					@ -1,253 +0,0 @@
 | 
				
			||||||
@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;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
| 
						 | 
					@ -1,574 +0,0 @@
 | 
				
			||||||
@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;
 | 
					 | 
				
			||||||
    // }
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
| 
						 | 
					@ -1,77 +0,0 @@
 | 
				
			||||||
@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)));
 | 
					 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
| 
						 | 
					@ -16,15 +16,9 @@
 | 
				
			||||||
            <div class="col-12 row justify-content-center align-items-center text-center" style="background: url('/images/box-16.jpg')  no-repeat; background-size: 100% 100%; width: 380px; height:650px">
 | 
					            <div class="col-12 row justify-content-center align-items-center text-center" style="background: url('/images/box-16.jpg')  no-repeat; background-size: 100% 100%; width: 380px; height:650px">
 | 
				
			||||||
                <div class="row justify-content-around align-items-center" style="margin-top: 220px; height: 430px;">
 | 
					                <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="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)" />
 | 
					                        <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,7 +36,7 @@
 | 
				
			||||||
            </div>
 | 
					            </div>
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    </div>
 | 
					    </div>
 | 
				
			||||||
    <RadzenDataGrid @ref="grid" Style="width:66vw; overflow:auto"
 | 
					    <RadzenDataGrid @ref="grid" Style="overflow:auto"
 | 
				
			||||||
    LoadData="@LoadData"
 | 
					    LoadData="@LoadData"
 | 
				
			||||||
    IsLoading="@isLoading"
 | 
					    IsLoading="@isLoading"
 | 
				
			||||||
    Count="@count"
 | 
					    Count="@count"
 | 
				
			||||||
| 
						 | 
					@ -68,30 +62,29 @@
 | 
				
			||||||
            </RadzenRow>
 | 
					            </RadzenRow>
 | 
				
			||||||
        </HeaderTemplate>
 | 
					        </HeaderTemplate>
 | 
				
			||||||
        <Columns>
 | 
					        <Columns>
 | 
				
			||||||
            <RadzenDataGridColumn Width="4vw" Title="库位" Property="ColNo"></RadzenDataGridColumn>
 | 
					            <RadzenDataGridColumn Width="70px" Title="库位" Property="ColNo"></RadzenDataGridColumn>
 | 
				
			||||||
            <RadzenDataGridColumn Width="15vw" Title="药品名称" Property="Drug.DrugName">
 | 
					            <RadzenDataGridColumn Width="130px" 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="15vw" Title="批次" Property="ManuNo">
 | 
					            <RadzenDataGridColumn Width="110px" 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.EffDate
 | 
					                            @channel.drugManuNo?.EffDate
 | 
				
			||||||
                        </RadzenText>
 | 
					                        </RadzenText>
 | 
				
			||||||
                    @* } *@
 | 
					                    }
 | 
				
			||||||
                </Template>
 | 
					                </Template>
 | 
				
			||||||
                <EditTemplate Context="channel">
 | 
					                <EditTemplate Context="channel">
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -137,17 +130,12 @@
 | 
				
			||||||
                    }
 | 
					                    }
 | 
				
			||||||
                </EditTemplate>
 | 
					                </EditTemplate>
 | 
				
			||||||
            </RadzenDataGridColumn>
 | 
					            </RadzenDataGridColumn>
 | 
				
			||||||
            <RadzenDataGridColumn Title="库存" Width="10vw" Property="Quantity">
 | 
					            <RadzenDataGridColumn Title="库存" Width="60px" 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="15vw" Title="加药数量" Property="AddQuantity">
 | 
					            <RadzenDataGridColumn MinWidth="100px" 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"))
 | 
				
			||||||
                    {
 | 
					                    {
 | 
				
			||||||
| 
						 | 
					@ -203,10 +191,8 @@
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    async Task OpenDrawer()
 | 
					    async Task OpenDrawer()
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        this.status = 1;
 | 
					 | 
				
			||||||
        PortUtil.PowerOn();
 | 
					 | 
				
			||||||
        await Task.Delay(200);
 | 
					 | 
				
			||||||
        PortUtil.DrawerNo = this.drawerNo;
 | 
					        PortUtil.DrawerNo = this.drawerNo;
 | 
				
			||||||
 | 
					        this.status = 1;
 | 
				
			||||||
        // 根据抽屉类型来决定打开前是否需要查询数量
 | 
					        // 根据抽屉类型来决定打开前是否需要查询数量
 | 
				
			||||||
        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) =>
 | 
				
			||||||
| 
						 | 
					@ -346,18 +332,16 @@
 | 
				
			||||||
                );
 | 
					                );
 | 
				
			||||||
                if (setting.Value.single != null && setting.Value.single.Contains(this.drawerNo))
 | 
					                if (setting.Value.single != null && setting.Value.single.Contains(this.drawerNo))
 | 
				
			||||||
                {
 | 
					                {
 | 
				
			||||||
                    PortUtil.PowerOff();
 | 
					                    PortUtil.AllLightOff();
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
                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];
 | 
				
			||||||
| 
						 | 
					@ -455,7 +439,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,null,null);
 | 
					            var b = await channelListDao.DrawerOperationFinish(channels.Where(cl => cl.AddQuantity != 0).ToList(), 1);
 | 
				
			||||||
            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 });
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -36,7 +36,7 @@
 | 
				
			||||||
            </div>
 | 
					            </div>
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    </div>
 | 
					    </div>
 | 
				
			||||||
    <RadzenDataGrid @ref="grid" Style="width:66vw; overflow:auto"
 | 
					    <RadzenDataGrid @ref="grid" Style="overflow:auto"
 | 
				
			||||||
                    LoadData="@LoadData"
 | 
					                    LoadData="@LoadData"
 | 
				
			||||||
                    IsLoading="@isLoading"
 | 
					                    IsLoading="@isLoading"
 | 
				
			||||||
                    Count="@count"
 | 
					                    Count="@count"
 | 
				
			||||||
| 
						 | 
					@ -48,53 +48,11 @@
 | 
				
			||||||
        <HeaderTemplate>
 | 
					        <HeaderTemplate>
 | 
				
			||||||
            <RadzenRow JustifyContent="JustifyContent.End">
 | 
					            <RadzenRow JustifyContent="JustifyContent.End">
 | 
				
			||||||
                @if (status < 3)
 | 
					                @if (status < 3)
 | 
				
			||||||
                {
 | 
					 | 
				
			||||||
                    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" />
 | 
					                    <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)
 | 
				
			||||||
| 
						 | 
					@ -104,30 +62,25 @@
 | 
				
			||||||
            </RadzenRow>
 | 
					            </RadzenRow>
 | 
				
			||||||
        </HeaderTemplate>
 | 
					        </HeaderTemplate>
 | 
				
			||||||
        <Columns>
 | 
					        <Columns>
 | 
				
			||||||
            <RadzenDataGridColumn Width="4vw" Title="库位" Property="ColNo"></RadzenDataGridColumn>
 | 
					            <RadzenDataGridColumn  Width="70px" Title="库位" Property="ColNo"></RadzenDataGridColumn>
 | 
				
			||||||
            <RadzenDataGridColumn Width="15vw" Title="药品名称" Property="Drug.DrugName">
 | 
					            <RadzenDataGridColumn  Width="130px" 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="15vw" Title="批次" Property="ManuNo">
 | 
					            <RadzenDataGridColumn Width="110px" 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="10vw" Property="Quantity">
 | 
					            <RadzenDataGridColumn Title="库存" Width="60px" 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="15vw" Title="取药数量" Property="TakeQuantity">
 | 
					            <RadzenDataGridColumn MinWidth="100px" 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"))
 | 
				
			||||||
                    {
 | 
					                    {
 | 
				
			||||||
| 
						 | 
					@ -150,8 +103,6 @@
 | 
				
			||||||
    @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;
 | 
				
			||||||
| 
						 | 
					@ -168,33 +119,12 @@
 | 
				
			||||||
    bool CompleteIsEnable = true;
 | 
					    bool CompleteIsEnable = true;
 | 
				
			||||||
    bool CancleIsEnable = true;
 | 
					    bool CancleIsEnable = true;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    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));
 | 
					    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;
 | 
				
			||||||
| 
						 | 
					@ -206,32 +136,10 @@
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        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()
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        this.status = 1;
 | 
					 | 
				
			||||||
        PortUtil.PowerOn();
 | 
					 | 
				
			||||||
        await Task.Delay(200);
 | 
					 | 
				
			||||||
        PortUtil.DrawerNo = this.drawerNo;
 | 
					        PortUtil.DrawerNo = this.drawerNo;
 | 
				
			||||||
 | 
					        this.status = 1;
 | 
				
			||||||
        // 根据抽屉类型来决定打开前是否需要查询数量
 | 
					        // 根据抽屉类型来决定打开前是否需要查询数量
 | 
				
			||||||
        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) =>
 | 
				
			||||||
| 
						 | 
					@ -257,15 +165,7 @@
 | 
				
			||||||
                    if (b)
 | 
					                    if (b)
 | 
				
			||||||
                    {
 | 
					                    {
 | 
				
			||||||
                        PortUtil.speechSynthesizer.SpeakAsyncCancelAll();
 | 
					                        PortUtil.speechSynthesizer.SpeakAsyncCancelAll();
 | 
				
			||||||
 | 
					 | 
				
			||||||
                        if (setting.Value.returnDrawer != null && setting.Value.returnDrawer.Contains(drawerNo))
 | 
					 | 
				
			||||||
                        {
 | 
					 | 
				
			||||||
                            PortUtil.SpeakAsync($"{drawerNo}号抽屉已经打开,请,取空瓶");
 | 
					 | 
				
			||||||
                        }
 | 
					 | 
				
			||||||
                        else
 | 
					 | 
				
			||||||
                        {
 | 
					 | 
				
			||||||
                        PortUtil.SpeakAsync($"{drawerNo}号抽屉已经打开,请,取药");
 | 
					                        PortUtil.SpeakAsync($"{drawerNo}号抽屉已经打开,请,取药");
 | 
				
			||||||
                        }
 | 
					 | 
				
			||||||
                        PortUtil.Operate = true;
 | 
					                        PortUtil.Operate = true;
 | 
				
			||||||
                        this.status = 2;
 | 
					                        this.status = 2;
 | 
				
			||||||
                        next();
 | 
					                        next();
 | 
				
			||||||
| 
						 | 
					@ -290,15 +190,7 @@
 | 
				
			||||||
                    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))
 | 
				
			||||||
                        {
 | 
					                        {
 | 
				
			||||||
| 
						 | 
					@ -383,13 +275,12 @@
 | 
				
			||||||
                );
 | 
					                );
 | 
				
			||||||
                if (setting.Value.single.Contains(this.drawerNo))
 | 
					                if (setting.Value.single.Contains(this.drawerNo))
 | 
				
			||||||
                {
 | 
					                {
 | 
				
			||||||
                    PortUtil.PowerOff();
 | 
					                    PortUtil.AllLightOff();
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
                RestData();
 | 
					                RestData();
 | 
				
			||||||
                stop();
 | 
					                stop();
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
        PortUtil.PowerOff();
 | 
					 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    //关闭抽屉后获取称重稳定数量
 | 
					    //关闭抽屉后获取称重稳定数量
 | 
				
			||||||
    public async Task GetWeightQuantity()
 | 
					    public async Task GetWeightQuantity()
 | 
				
			||||||
| 
						 | 
					@ -487,7 +378,6 @@
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    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];
 | 
				
			||||||
| 
						 | 
					@ -502,24 +392,9 @@
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        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, BoxNum, null);
 | 
					            var b = await channelListDao.DrawerOperationFinish(channels.Where(cl => cl.TakeQuantity != 0).ToList(), 2);
 | 
				
			||||||
            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 });
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -40,7 +40,7 @@
 | 
				
			||||||
                </RadzenFieldset>
 | 
					                </RadzenFieldset>
 | 
				
			||||||
            </form>
 | 
					            </form>
 | 
				
			||||||
        </div>
 | 
					        </div>
 | 
				
			||||||
        <div class="col-6  mb-4" style="height:55vh;overflow:auto;">
 | 
					        <div class="col-6  mb-4">
 | 
				
			||||||
            <RadzenDataGrid @ref="grid"
 | 
					            <RadzenDataGrid @ref="grid"
 | 
				
			||||||
            LoadData="@LoadData"
 | 
					            LoadData="@LoadData"
 | 
				
			||||||
            @bind-Value="@SelectedDrugs"
 | 
					            @bind-Value="@SelectedDrugs"
 | 
				
			||||||
| 
						 | 
					@ -50,9 +50,9 @@
 | 
				
			||||||
            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="10" PagerHorizontalAlign="HorizontalAlign.Left" ColumnWidth="100px" ShowPagingSummary="true" PagingSummaryFormat="{0}/{1} 共{2}条数据">
 | 
				
			||||||
                <Columns>
 | 
					                <Columns>
 | 
				
			||||||
                    <RadzenDataGridColumn Title="编码" Property="DrugId">
 | 
					                    <RadzenDataGridColumn Frozen="true" Title="编码" Property="DrugId">
 | 
				
			||||||
                        <EditTemplate Context="drugInfo">
 | 
					                        <EditTemplate Context="drugInfo">
 | 
				
			||||||
                            <RadzenTextBox Name="DrugId" @bind-Value="drugInfo.DrugId" Style="width:100%; display: block;" />
 | 
					                            <RadzenTextBox Name="DrugId" @bind-Value="drugInfo.DrugId" Style="width:100%; display: block;" />
 | 
				
			||||||
                            <RadzenRequiredValidator Text="请填写编码" Component="DrugId" Popup="true" />
 | 
					                            <RadzenRequiredValidator Text="请填写编码" Component="DrugId" Popup="true" />
 | 
				
			||||||
| 
						 | 
					@ -70,17 +70,12 @@
 | 
				
			||||||
                            <RadzenRequiredValidator Text="请填写规格" Component="DrugSpec" Popup="true"/>
 | 
					                            <RadzenRequiredValidator Text="请填写规格" Component="DrugSpec" Popup="true"/>
 | 
				
			||||||
                        </EditTemplate>
 | 
					                        </EditTemplate>
 | 
				
			||||||
                    </RadzenDataGridColumn>
 | 
					                    </RadzenDataGridColumn>
 | 
				
			||||||
                    <RadzenDataGridColumn Width="150px" Title="厂家" Property="Manufactory">
 | 
					                    <RadzenDataGridColumn  Width="200px"  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">
 | 
					 | 
				
			||||||
                        <EditTemplate Context="drugInfo">
 | 
					 | 
				
			||||||
                            <RadzenTextBox Name="PackH" @bind-Value="drugInfo.PackH" Style="width:100%;display:block;" />
 | 
					 | 
				
			||||||
                        </EditTemplate>
 | 
					 | 
				
			||||||
                    </RadzenDataGridColumn>
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
                    <RadzenDataGridColumn Context="drugInfo" Title="操作" Filterable="false" Sortable="false" TextAlign="TextAlign.Left" Frozen="true" FrozenPosition="FrozenColumnPosition.Right">
 | 
					                    <RadzenDataGridColumn Context="drugInfo" Title="操作" Filterable="false" Sortable="false" TextAlign="TextAlign.Left" Frozen="true" FrozenPosition="FrozenColumnPosition.Right">
 | 
				
			||||||
                        <Template Context="drugInfo">
 | 
					                        <Template Context="drugInfo">
 | 
				
			||||||
| 
						 | 
					@ -107,9 +102,7 @@
 | 
				
			||||||
            </RadzenCard> *@
 | 
					            </RadzenCard> *@
 | 
				
			||||||
            @if (SelectedDrugs.Count > 0)
 | 
					            @if (SelectedDrugs.Count > 0)
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
 | 
					                <RadzenDataGrid @ref="ManusGrid" EmptyText="无数据"
 | 
				
			||||||
                <div class="col-6  mb-4" style="height:55vh;width:550px;overflow:auto;">
 | 
					 | 
				
			||||||
                    <RadzenDataGrid @ref="ManusGrid" EmptyText="无数据"  ColumnWidth="100px" Style="width:445px"
 | 
					 | 
				
			||||||
                Data="@(SelectedDrugs.FirstOrDefault()?.Manus)"
 | 
					                Data="@(SelectedDrugs.FirstOrDefault()?.Manus)"
 | 
				
			||||||
                RowUpdate="@((DrugManuNo dm) => { OnUpdateRow(dm); })" RowCreate="@((DrugManuNo dm) => { OnCreateRow(dm); })"
 | 
					                RowUpdate="@((DrugManuNo dm) => { OnUpdateRow(dm); })" RowCreate="@((DrugManuNo dm) => { OnCreateRow(dm); })"
 | 
				
			||||||
                AllowColumnResize="true" AllowAlternatingRows="false">
 | 
					                AllowColumnResize="true" AllowAlternatingRows="false">
 | 
				
			||||||
| 
						 | 
					@ -119,25 +112,25 @@
 | 
				
			||||||
                        </RadzenRow>
 | 
					                        </RadzenRow>
 | 
				
			||||||
                    </HeaderTemplate> *@
 | 
					                    </HeaderTemplate> *@
 | 
				
			||||||
                    <Columns>
 | 
					                    <Columns>
 | 
				
			||||||
                            <RadzenDataGridColumn Title="序号" Property="index" Width="25px" Visible=false>
 | 
					                        <RadzenDataGridColumn Title="序号" Property="index">
 | 
				
			||||||
                            <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" Width="150px">
 | 
					                        <RadzenDataGridColumn Title="批次" Property="ManuNo">
 | 
				
			||||||
                            <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" Width="150px">
 | 
					                        <RadzenDataGridColumn Title="效期" Property="EffDate">
 | 
				
			||||||
                            <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="操作" Width="160px" Filterable="false" Sortable="false" TextAlign="TextAlign.Left" Frozen="true" FrozenPosition="FrozenColumnPosition.Right">
 | 
					                        <RadzenDataGridColumn Context="drugManuNo" Title="操作" 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>
 | 
				
			||||||
| 
						 | 
					@ -155,7 +148,6 @@
 | 
				
			||||||
                        </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>
 | 
				
			||||||
| 
						 | 
					@ -296,8 +288,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();
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -50,16 +50,8 @@
 | 
				
			||||||
                    <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 Title="请领药房" Property="InPharmacyId"></RadzenDataGridColumn>
 | 
				
			||||||
                        <Template Context="InPharmacyId">
 | 
					                        <RadzenDataGridColumn Title="出库药房" Property="OutPharmacyId"></RadzenDataGridColumn>
 | 
				
			||||||
                            @(InPharmacyId.InPharmacyId == "0623" ? "麻醉科" : InPharmacyId.InPharmacyId)
 | 
					 | 
				
			||||||
                        </Template>
 | 
					 | 
				
			||||||
                    </RadzenDataGridColumn>
 | 
					 | 
				
			||||||
                    <RadzenDataGridColumn Title="出库药房" Property="OutPharmacyId">
 | 
					 | 
				
			||||||
                        <Template Context="OutPharmacyId">
 | 
					 | 
				
			||||||
                            @(OutPharmacyId.OutPharmacyId == "070103" ? "药剂科" : OutPharmacyId.OutPharmacyId)
 | 
					 | 
				
			||||||
                        </Template>
 | 
					 | 
				
			||||||
                    </RadzenDataGridColumn>
 | 
					 | 
				
			||||||
                    </Columns>
 | 
					                    </Columns>
 | 
				
			||||||
                </RadzenDataGrid>
 | 
					                </RadzenDataGrid>
 | 
				
			||||||
        </div>
 | 
					        </div>
 | 
				
			||||||
| 
						 | 
					@ -74,7 +66,7 @@
 | 
				
			||||||
    int count;
 | 
					    int count;
 | 
				
			||||||
    private IEnumerable<InOutInvoice>? _forecasts;
 | 
					    private IEnumerable<InOutInvoice>? _forecasts;
 | 
				
			||||||
    string InvoiceNo;
 | 
					    string InvoiceNo;
 | 
				
			||||||
    DateTime InvoiceDate = DateTime.Now;
 | 
					    DateTime InvoiceDate = DateTime.MinValue;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    void OnCurrentDateChanged(DateTime args)
 | 
					    void OnCurrentDateChanged(DateTime args)
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -24,69 +24,15 @@
 | 
				
			||||||
                <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" Width="6vw">
 | 
					                        <RadzenDataGridColumn Title="库位" Property="DrawerNo">
 | 
				
			||||||
                            <Template Context="s">
 | 
					                            <Template Context="s">
 | 
				
			||||||
                                @s.DrawerNo - @s.ColNo
 | 
					                                @s.DrawerNo - @s.ColNo
 | 
				
			||||||
                            </Template>
 | 
					                            </Template>
 | 
				
			||||||
                        </RadzenDataGridColumn>
 | 
					                        </RadzenDataGridColumn>
 | 
				
			||||||
                        <RadzenDataGridColumn Title="库存" Property="Quantity" Width="6vw"></RadzenDataGridColumn>
 | 
					                        <RadzenDataGridColumn Title="库存" Property="Quantity"></RadzenDataGridColumn>
 | 
				
			||||||
                        @* <RadzenDataGridColumn Title="批次" Property="ManuNo"></RadzenDataGridColumn>
 | 
					                        @* <RadzenDataGridColumn Title="批次" Property="ManuNo"></RadzenDataGridColumn>
 | 
				
			||||||
                            <RadzenDataGridColumn Title="效期" Property="EffDate"></RadzenDataGridColumn> *@
 | 
					                            <RadzenDataGridColumn Title="效期" Property="EffDate"></RadzenDataGridColumn> *@
 | 
				
			||||||
                        <RadzenDataGridColumn Title="批次" Property="ManuNo" Filterable="false" Width="25vw">
 | 
					                        <RadzenDataGridColumn Title="入库数量" Property="AddQuantity">
 | 
				
			||||||
                            <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" />
 | 
				
			||||||
| 
						 | 
					@ -97,16 +43,12 @@
 | 
				
			||||||
                </RadzenDataGrid>
 | 
					                </RadzenDataGrid>
 | 
				
			||||||
            </Template>
 | 
					            </Template>
 | 
				
			||||||
            <Columns>
 | 
					            <Columns>
 | 
				
			||||||
                <RadzenDataGridColumn Property="Drug.DrugName" Title="药品" Width="25vw" />
 | 
					                <RadzenDataGridColumn Property="Drug.DrugName" Title="药品" />
 | 
				
			||||||
                <RadzenDataGridColumn Property="Drug.DrugSpec" Title="规格" Width="6vw" />
 | 
					                <RadzenDataGridColumn Property="Drug.DrugSpec" Title="规格" />
 | 
				
			||||||
                <RadzenDataGridColumn Property="Invoice.DrugManuNo" Title="批次" Width="10vw">
 | 
					                <RadzenDataGridColumn Property="Invoice.DrugManuNo" Title="批次" />
 | 
				
			||||||
                    <Template Context="ManuNo">
 | 
					                <RadzenDataGridColumn Property="Invoice.EffDate" Title="效期" />
 | 
				
			||||||
                        @(ManuNo.Invoice.DrugManuNo == "X" ? "无" : ManuNo.Invoice.DrugManuNo)
 | 
					                <RadzenDataGridColumn Property="Quantity" Title="请领数量" />
 | 
				
			||||||
                    </Template>
 | 
					                <RadzenDataGridColumn Property="StockQuantity" Title="总库存" />
 | 
				
			||||||
                </RadzenDataGridColumn>
 | 
					 | 
				
			||||||
                <RadzenDataGridColumn Property="Invoice.EffDate" Title="效期" Width="6vw" />
 | 
					 | 
				
			||||||
                <RadzenDataGridColumn Property="Quantity" Title="请领数量" Width="6vw" />
 | 
					 | 
				
			||||||
                <RadzenDataGridColumn Property="StockQuantity" Title="总库存" Width="6vw" />
 | 
					 | 
				
			||||||
            </Columns>
 | 
					            </Columns>
 | 
				
			||||||
        </RadzenDataGrid>
 | 
					        </RadzenDataGrid>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -116,7 +58,7 @@
 | 
				
			||||||
    <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)
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
| 
						 | 
					@ -180,8 +122,6 @@
 | 
				
			||||||
    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++)
 | 
				
			||||||
| 
						 | 
					@ -255,7 +195,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.PowerOff();
 | 
					                            PortUtil.AllLightOff();
 | 
				
			||||||
                            RestData();
 | 
					                            RestData();
 | 
				
			||||||
                            stop();
 | 
					                            stop();
 | 
				
			||||||
                        }
 | 
					                        }
 | 
				
			||||||
| 
						 | 
					@ -271,7 +211,7 @@
 | 
				
			||||||
                            options._data = 0;
 | 
					                            options._data = 0;
 | 
				
			||||||
                            if (setting.Value.single.Contains(drawerNo))
 | 
					                            if (setting.Value.single.Contains(drawerNo))
 | 
				
			||||||
                            {
 | 
					                            {
 | 
				
			||||||
                                PortUtil.PowerOff();
 | 
					                                PortUtil.AllLightOff();
 | 
				
			||||||
                            }
 | 
					                            }
 | 
				
			||||||
                            if (index == drawerNos.Count - 1)
 | 
					                            if (index == drawerNos.Count - 1)
 | 
				
			||||||
                            {
 | 
					                            {
 | 
				
			||||||
| 
						 | 
					@ -395,16 +335,14 @@
 | 
				
			||||||
            );
 | 
					            );
 | 
				
			||||||
                if (setting.Value.single.Contains(drawerNo))
 | 
					                if (setting.Value.single.Contains(drawerNo))
 | 
				
			||||||
                {
 | 
					                {
 | 
				
			||||||
                    PortUtil.PowerOff();
 | 
					                    PortUtil.AllLightOff();
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
        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.PowerOff();
 | 
					                            PortUtil.AllLightOff();
 | 
				
			||||||
                            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.PowerOff();
 | 
					                                PortUtil.AllLightOff();
 | 
				
			||||||
                            }
 | 
					                            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                            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.PowerOff();
 | 
					                    PortUtil.AllLightOff();
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
                stop();
 | 
					                stop();
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
| 
						 | 
					@ -374,7 +374,6 @@
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    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,8 +102,6 @@
 | 
				
			||||||
    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();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -172,7 +170,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.PowerOff();
 | 
					                            PortUtil.AllLightOff();
 | 
				
			||||||
                            RestData();
 | 
					                            RestData();
 | 
				
			||||||
                            stop();
 | 
					                            stop();
 | 
				
			||||||
                        }
 | 
					                        }
 | 
				
			||||||
| 
						 | 
					@ -195,7 +193,7 @@
 | 
				
			||||||
                                }
 | 
					                                }
 | 
				
			||||||
                            });
 | 
					                            });
 | 
				
			||||||
                            orderTakeVo.Status = 2;
 | 
					                            orderTakeVo.Status = 2;
 | 
				
			||||||
                            PortUtil.PowerOff();
 | 
					                            PortUtil.AllLightOff();
 | 
				
			||||||
                            if (options._data == drawerNos.Count - 1)
 | 
					                            if (options._data == drawerNos.Count - 1)
 | 
				
			||||||
                            {
 | 
					                            {
 | 
				
			||||||
                                PortUtil.speechSynthesizer.SpeakAsyncCancelAll();
 | 
					                                PortUtil.speechSynthesizer.SpeakAsyncCancelAll();
 | 
				
			||||||
| 
						 | 
					@ -279,18 +277,15 @@
 | 
				
			||||||
            );
 | 
					            );
 | 
				
			||||||
                if (setting.Value.single.Contains(drawerNo))
 | 
					                if (setting.Value.single.Contains(drawerNo))
 | 
				
			||||||
                {
 | 
					                {
 | 
				
			||||||
                    PortUtil.PowerOff();
 | 
					                    PortUtil.AllLightOff();
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
                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.PowerOff();
 | 
					                        PortUtil.AllLightOff();
 | 
				
			||||||
                        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.PowerOff();
 | 
					                            PortUtil.AllLightOff();
 | 
				
			||||||
                        }
 | 
					                        }
 | 
				
			||||||
                        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.PowerOff();
 | 
					                PortUtil.AllLightOff();
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
            stop();
 | 
					            stop();
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
| 
						 | 
					@ -241,7 +241,6 @@
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    void RestData()
 | 
					    void RestData()
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        PortUtil.PowerOff();
 | 
					 | 
				
			||||||
        PortUtil.speechSynthesizer.SpeakAsyncCancelAll();
 | 
					        PortUtil.speechSynthesizer.SpeakAsyncCancelAll();
 | 
				
			||||||
        this.status = 0;
 | 
					        this.status = 0;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -40,9 +40,9 @@
 | 
				
			||||||
                </RadzenFieldset>
 | 
					                </RadzenFieldset>
 | 
				
			||||||
            </form>
 | 
					            </form>
 | 
				
			||||||
        </div>
 | 
					        </div>
 | 
				
			||||||
        <div class="col-12 mb-4" style="height:50vh;overflow:auto">
 | 
					        <div class="col-12 mb-4">
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            <RadzenDataGrid @ref="grid" Style="height:48vh;"
 | 
					                <RadzenDataGrid @ref="grid"
 | 
				
			||||||
                    LoadData="@LoadData"
 | 
					                    LoadData="@LoadData"
 | 
				
			||||||
                    IsLoading="@isLoading"
 | 
					                    IsLoading="@isLoading"
 | 
				
			||||||
                    Count="@count"
 | 
					                    Count="@count"
 | 
				
			||||||
| 
						 | 
					@ -66,63 +66,16 @@
 | 
				
			||||||
                                <RadzenText TextStyle="TextStyle.Caption">@mr.Drug?.DrugSpec</RadzenText>
 | 
					                                <RadzenText TextStyle="TextStyle.Caption">@mr.Drug?.DrugSpec</RadzenText>
 | 
				
			||||||
                            </Template>
 | 
					                            </Template>
 | 
				
			||||||
                        </RadzenDataGridColumn>
 | 
					                        </RadzenDataGridColumn>
 | 
				
			||||||
                    <RadzenDataGridColumn Width="60px" Title="药盒" Property="OperationTime">
 | 
					                        <RadzenDataGridColumn Title="批次" Property="ManuNo">
 | 
				
			||||||
                        <Template Context="mr">
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                            @if (mr.BoxDrawer > 0)
 | 
					 | 
				
			||||||
                            {
 | 
					 | 
				
			||||||
                                if (mr.DrawerNo == 99)
 | 
					 | 
				
			||||||
                                {
 | 
					 | 
				
			||||||
                                    <b class="rz-pr-3">@($"急诊药盒")</b>
 | 
					 | 
				
			||||||
                                }
 | 
					 | 
				
			||||||
                                else if (mr.DrawerNo == 111)
 | 
					 | 
				
			||||||
                                {
 | 
					 | 
				
			||||||
                                    <b class="rz-pr-3">@($"恢复室药盒")</b>
 | 
					 | 
				
			||||||
                                }
 | 
					 | 
				
			||||||
                                else
 | 
					 | 
				
			||||||
                                {
 | 
					 | 
				
			||||||
                                    <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">
 | 
					                            <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 Title="借出数量" Property="Quantity"></RadzenDataGridColumn>
 | 
				
			||||||
                        <HeaderTemplate>
 | 
					                        <RadzenDataGridColumn Title="已还药品" Property="ReturnQuantity1"></RadzenDataGridColumn>
 | 
				
			||||||
                            <div style="text-align: center;">
 | 
					                        <RadzenDataGridColumn Title="已还空瓶" Property="ReturnQuantity2"></RadzenDataGridColumn>
 | 
				
			||||||
                                借出<br>数量
 | 
					                        <RadzenDataGridColumn Title="本次归还" Property="CurrentReturnQuantity">
 | 
				
			||||||
                            </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">
 | 
					                            <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>
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -30,7 +30,7 @@
 | 
				
			||||||
                                <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>
 | 
				
			||||||
| 
						 | 
					@ -49,13 +49,7 @@
 | 
				
			||||||
                            @ov.data.First().EffDate
 | 
					                            @ov.data.First().EffDate
 | 
				
			||||||
                        </Template>
 | 
					                        </Template>
 | 
				
			||||||
                    </RadzenDataGridColumn>
 | 
					                    </RadzenDataGridColumn>
 | 
				
			||||||
                <RadzenDataGridColumn Property="Quantity" Title="还药总数">
 | 
					                    <RadzenDataGridColumn Property="Quantity" Title="请领数量" />
 | 
				
			||||||
                    <HeaderTemplate>
 | 
					 | 
				
			||||||
                        <div style="text-align: center;">
 | 
					 | 
				
			||||||
                            还药<br>总数
 | 
					 | 
				
			||||||
                        </div>
 | 
					 | 
				
			||||||
                    </HeaderTemplate>
 | 
					 | 
				
			||||||
                </RadzenDataGridColumn>
 | 
					 | 
				
			||||||
                    <RadzenDataGridColumn Property="StockQuantity" Title="总库存" />
 | 
					                    <RadzenDataGridColumn Property="StockQuantity" Title="总库存" />
 | 
				
			||||||
                </Columns>
 | 
					                </Columns>
 | 
				
			||||||
            </RadzenDataGrid>
 | 
					            </RadzenDataGrid>
 | 
				
			||||||
| 
						 | 
					@ -105,8 +99,7 @@
 | 
				
			||||||
                new NotificationMessage { Severity = NotificationSeverity.Error, Summary = "提示", Detail = $"请填写正确的入库数量!", Duration = 4000 }
 | 
					                new NotificationMessage { Severity = NotificationSeverity.Error, Summary = "提示", Detail = $"请填写正确的入库数量!", Duration = 4000 }
 | 
				
			||||||
            );
 | 
					            );
 | 
				
			||||||
            
 | 
					            
 | 
				
			||||||
        }
 | 
					        } else
 | 
				
			||||||
        else
 | 
					 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            await OpenDrawer();
 | 
					            await OpenDrawer();
 | 
				
			||||||
        } 
 | 
					        } 
 | 
				
			||||||
| 
						 | 
					@ -123,8 +116,6 @@
 | 
				
			||||||
    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++)
 | 
				
			||||||
| 
						 | 
					@ -184,7 +175,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.PowerOff();
 | 
					                            PortUtil.AllLightOff();
 | 
				
			||||||
                            RestData();
 | 
					                            RestData();
 | 
				
			||||||
                            stop();
 | 
					                            stop();
 | 
				
			||||||
                        }
 | 
					                        }
 | 
				
			||||||
| 
						 | 
					@ -200,7 +191,7 @@
 | 
				
			||||||
                            options._data = 0;
 | 
					                            options._data = 0;
 | 
				
			||||||
                            if (setting.Value.single.Contains(drawerNo))
 | 
					                            if (setting.Value.single.Contains(drawerNo))
 | 
				
			||||||
                            {
 | 
					                            {
 | 
				
			||||||
                                PortUtil.PowerOff();
 | 
					                                PortUtil.AllLightOff();
 | 
				
			||||||
                            }
 | 
					                            }
 | 
				
			||||||
                            if (index == drawerNos.Count - 1)
 | 
					                            if (index == drawerNos.Count - 1)
 | 
				
			||||||
                            {
 | 
					                            {
 | 
				
			||||||
| 
						 | 
					@ -225,14 +216,11 @@
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                                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 =>
 | 
				
			||||||
                                    {
 | 
					                                    {
 | 
				
			||||||
                                        cl.ReturnQuantity = AfterQuantity[cs.ColNo - 1] - BeforeQuantity[cs.ColNo - 1];
 | 
					                                        logger.Info($"单支抽屉【{drawerNo}】,应加药品数量【{cs.AddQuantity}】,现实取数量【{AfterQuantity[cs.ColNo - 1] - BeforeQuantity[cs.ColNo - 1]}】");
 | 
				
			||||||
                                    });
 | 
					                                    });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                                });
 | 
					                                });
 | 
				
			||||||
                            }
 | 
					                            }
 | 
				
			||||||
                            next(); // continue iteration
 | 
					                            next(); // continue iteration
 | 
				
			||||||
| 
						 | 
					@ -251,17 +239,15 @@
 | 
				
			||||||
                );
 | 
					                );
 | 
				
			||||||
                if (setting.Value.single.Contains(drawerNo))
 | 
					                if (setting.Value.single.Contains(drawerNo))
 | 
				
			||||||
                {
 | 
					                {
 | 
				
			||||||
                    PortUtil.PowerOff();
 | 
					                    PortUtil.AllLightOff();
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
                stop();
 | 
					                stop();
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
        PortUtil.PowerOff();
 | 
					 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    void RestData()
 | 
					    void RestData()
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        PortUtil.PowerOff();
 | 
					 | 
				
			||||||
        this.status = 0;
 | 
					        this.status = 0;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -22,7 +22,7 @@
 | 
				
			||||||
        </RadzenStack>
 | 
					        </RadzenStack>
 | 
				
			||||||
    </RadzenStack>
 | 
					    </RadzenStack>
 | 
				
			||||||
</RadzenFieldset>
 | 
					</RadzenFieldset>
 | 
				
			||||||
<div  Style="height:50vh;overflow:auto;">
 | 
					
 | 
				
			||||||
<RadzenDataGrid @ref="grid"
 | 
					<RadzenDataGrid @ref="grid"
 | 
				
			||||||
                LoadData="@LoadData"
 | 
					                LoadData="@LoadData"
 | 
				
			||||||
                IsLoading="@isLoading"
 | 
					                IsLoading="@isLoading"
 | 
				
			||||||
| 
						 | 
					@ -32,7 +32,7 @@
 | 
				
			||||||
                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="true" PageSize="8" 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>
 | 
				
			||||||
| 
						 | 
					@ -61,7 +61,7 @@
 | 
				
			||||||
        </RadzenDataGridColumn>
 | 
					        </RadzenDataGridColumn>
 | 
				
			||||||
    </Columns>
 | 
					    </Columns>
 | 
				
			||||||
</RadzenDataGrid>
 | 
					</RadzenDataGrid>
 | 
				
			||||||
</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)
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
| 
						 | 
					@ -169,8 +169,6 @@
 | 
				
			||||||
    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;
 | 
				
			||||||
| 
						 | 
					@ -217,7 +215,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.PowerOff();
 | 
					                            PortUtil.AllLightOff();
 | 
				
			||||||
                            RestData();
 | 
					                            RestData();
 | 
				
			||||||
                            stop();
 | 
					                            stop();
 | 
				
			||||||
                        }
 | 
					                        }
 | 
				
			||||||
| 
						 | 
					@ -233,7 +231,7 @@
 | 
				
			||||||
                            options._data = 0;
 | 
					                            options._data = 0;
 | 
				
			||||||
                            if (setting.Value.single.Contains(drawerNo))
 | 
					                            if (setting.Value.single.Contains(drawerNo))
 | 
				
			||||||
                            {
 | 
					                            {
 | 
				
			||||||
                                PortUtil.PowerOff();
 | 
					                                PortUtil.AllLightOff();
 | 
				
			||||||
                            }
 | 
					                            }
 | 
				
			||||||
                            PortUtil.speechSynthesizer.SpeakAsyncCancelAll();
 | 
					                            PortUtil.speechSynthesizer.SpeakAsyncCancelAll();
 | 
				
			||||||
                            PortUtil.SpeakAsync($"加药完成,请,点击完成按钮进行确认");
 | 
					                            PortUtil.SpeakAsync($"加药完成,请,点击完成按钮进行确认");
 | 
				
			||||||
| 
						 | 
					@ -273,17 +271,15 @@
 | 
				
			||||||
                );
 | 
					                );
 | 
				
			||||||
                if (setting.Value.single.Contains(drawerNo))
 | 
					                if (setting.Value.single.Contains(drawerNo))
 | 
				
			||||||
                {
 | 
					                {
 | 
				
			||||||
                    PortUtil.PowerOff();
 | 
					                    PortUtil.AllLightOff();
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
                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.PowerOff();
 | 
					                            PortUtil.AllLightOff();
 | 
				
			||||||
                            RestData();
 | 
					                            RestData();
 | 
				
			||||||
                            stop();
 | 
					                            stop();
 | 
				
			||||||
                        }
 | 
					                        }
 | 
				
			||||||
| 
						 | 
					@ -193,7 +193,7 @@
 | 
				
			||||||
                            });
 | 
					                            });
 | 
				
			||||||
                            PortUtil.Operate = false;
 | 
					                            PortUtil.Operate = false;
 | 
				
			||||||
                            orderTakeVo.Status = 2;
 | 
					                            orderTakeVo.Status = 2;
 | 
				
			||||||
                            PortUtil.PowerOff();
 | 
					                            PortUtil.AllLightOff();
 | 
				
			||||||
                            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.PowerOff();
 | 
					                    PortUtil.AllLightOff();
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
                stop();
 | 
					                stop();
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
| 
						 | 
					@ -304,7 +304,6 @@
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    void RestData()
 | 
					    void RestData()
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        PortUtil.PowerOff();
 | 
					 | 
				
			||||||
        PortUtil.speechSynthesizer.SpeakAsyncCancelAll();
 | 
					        PortUtil.speechSynthesizer.SpeakAsyncCancelAll();
 | 
				
			||||||
        this.status = 0;
 | 
					        this.status = 0;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -16,15 +16,9 @@
 | 
				
			||||||
            @* <RadzenStack AlignItems="AlignItems.Center" JustifyContent="JustifyContent.Center" Orientation="Orientation.Vertical" Style="margin-top: 220px"> *@
 | 
					            @* <RadzenStack AlignItems="AlignItems.Center" JustifyContent="JustifyContent.Center" Orientation="Orientation.Vertical" Style="margin-top: 220px"> *@
 | 
				
			||||||
            <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="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)" />
 | 
					                    <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>
 | 
				
			||||||
            @* </RadzenStack> *@
 | 
					            @* </RadzenStack> *@
 | 
				
			||||||
| 
						 | 
					@ -157,8 +151,6 @@
 | 
				
			||||||
    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) =>
 | 
				
			||||||
| 
						 | 
					@ -238,18 +230,16 @@
 | 
				
			||||||
                );
 | 
					                );
 | 
				
			||||||
                if (setting.Value.single.Contains(this.drawerNo))
 | 
					                if (setting.Value.single.Contains(this.drawerNo))
 | 
				
			||||||
                {
 | 
					                {
 | 
				
			||||||
                    PortUtil.PowerOff();
 | 
					                    PortUtil.AllLightOff();
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
                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];
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -38,7 +38,6 @@
 | 
				
			||||||
        /* 你可以根据需要调整动画的持续时间和迭代次数 */
 | 
					        /* 你可以根据需要调整动画的持续时间和迭代次数 */
 | 
				
			||||||
        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;
 | 
				
			||||||
| 
						 | 
					@ -53,11 +52,75 @@
 | 
				
			||||||
</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 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))" />
 | 
					                    <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="条件选择">
 | 
				
			||||||
| 
						 | 
					@ -107,7 +170,7 @@
 | 
				
			||||||
                </RadzenRow>
 | 
					                </RadzenRow>
 | 
				
			||||||
            </RadzenStack>
 | 
					            </RadzenStack>
 | 
				
			||||||
        </RadzenFieldset>
 | 
					        </RadzenFieldset>
 | 
				
			||||||
    </form> *@
 | 
					    </form>
 | 
				
			||||||
</div>
 | 
					</div>
 | 
				
			||||||
<div class="col-12 mb-4">
 | 
					<div class="col-12 mb-4">
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -118,7 +181,7 @@
 | 
				
			||||||
                    Data="@_forecasts"
 | 
					                    Data="@_forecasts"
 | 
				
			||||||
                    AllowColumnResize="true" AllowAlternatingRows="false"
 | 
					                    AllowColumnResize="true" AllowAlternatingRows="false"
 | 
				
			||||||
                    SelectionMode="DataGridSelectionMode.Single"
 | 
					                    SelectionMode="DataGridSelectionMode.Single"
 | 
				
			||||||
    ExpandMode="DataGridExpandMode.Single">
 | 
					                    ExpandMode="DataGridExpandMode.Multiple">
 | 
				
			||||||
        @* <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" />
 | 
				
			||||||
| 
						 | 
					@ -130,39 +193,7 @@
 | 
				
			||||||
                <Columns>
 | 
					                <Columns>
 | 
				
			||||||
                    <RadzenDataGridColumn Title="库位" Property="DrawerNo">
 | 
					                    <RadzenDataGridColumn Title="库位" Property="DrawerNo">
 | 
				
			||||||
                        <Template Context="s">
 | 
					                        <Template Context="s">
 | 
				
			||||||
                            @if (s.MachineId == "DM5")
 | 
					                            @s.DrawerNo - @s.ColNo
 | 
				
			||||||
                            {
 | 
					 | 
				
			||||||
                                switch (s.DrawerNo)
 | 
					 | 
				
			||||||
                                {
 | 
					 | 
				
			||||||
                                    case 99:
 | 
					 | 
				
			||||||
                                        @("선閭浪분")
 | 
					 | 
				
			||||||
                                        break;
 | 
					 | 
				
			||||||
                                    case 111:
 | 
					 | 
				
			||||||
                                        @("뿟릿杆浪분")
 | 
					 | 
				
			||||||
                                        break;
 | 
					 | 
				
			||||||
                                    case 31:
 | 
					 | 
				
			||||||
                                        @("罐쓸浪분")
 | 
					 | 
				
			||||||
                                        break;
 | 
					 | 
				
			||||||
                                    case 32:
 | 
					 | 
				
			||||||
                                        @("돔밗浪분")
 | 
					 | 
				
			||||||
                                        break;
 | 
					 | 
				
			||||||
                                    case 33:
 | 
					 | 
				
			||||||
                                        @("<22>簾浪분")
 | 
					 | 
				
			||||||
                                        break;
 | 
					 | 
				
			||||||
                                    case 34:
 | 
					 | 
				
			||||||
                                        @("맘쳔浪분")                                        
 | 
					 | 
				
			||||||
                                        break;
 | 
					 | 
				
			||||||
                                    default:
 | 
					 | 
				
			||||||
                                        @* @($"{s.DrawerNo}-{(s.ColNo == 1 ? '겜' : '쫄')}") *@
 | 
					 | 
				
			||||||
                                        @("끽방<EB81BD>棍浪분")
 | 
					 | 
				
			||||||
                                        break;
 | 
					 | 
				
			||||||
                                }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                            }
 | 
					 | 
				
			||||||
                            else
 | 
					 | 
				
			||||||
                            {
 | 
					 | 
				
			||||||
                                @($"{s.DrawerNo}-{s.ColNo}")
 | 
					 | 
				
			||||||
                            }
 | 
					 | 
				
			||||||
                        </Template>
 | 
					                        </Template>
 | 
				
			||||||
                    </RadzenDataGridColumn>
 | 
					                    </RadzenDataGridColumn>
 | 
				
			||||||
                    <RadzenDataGridColumn Title="数量" Property="Quantity">
 | 
					                    <RadzenDataGridColumn Title="数量" Property="Quantity">
 | 
				
			||||||
| 
						 | 
					@ -173,16 +204,16 @@
 | 
				
			||||||
                            @{
 | 
					                            @{
 | 
				
			||||||
                                DateTime dateTime;
 | 
					                                DateTime dateTime;
 | 
				
			||||||
                                bool success = DateTime.TryParse(s.EffDate, out dateTime);
 | 
					                                bool success = DateTime.TryParse(s.EffDate, out dateTime);
 | 
				
			||||||
                                // if (success && dateTime <= DateTime.Now.AddMonths(3))
 | 
					                                if (success && dateTime <= DateTime.Now.AddMonths(3))
 | 
				
			||||||
                                // {
 | 
					                                {
 | 
				
			||||||
                                //     @s.EffDate
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                                //     <p class="shaky-text">쐤槻퍅浪틔!</p>
 | 
					 | 
				
			||||||
                                // }
 | 
					 | 
				
			||||||
                                // else
 | 
					 | 
				
			||||||
                                //{
 | 
					 | 
				
			||||||
                                    @s.EffDate
 | 
					                                    @s.EffDate
 | 
				
			||||||
                                //}
 | 
					
 | 
				
			||||||
 | 
					                                    <p class="shaky-text">近效期药品!</p>
 | 
				
			||||||
 | 
					                                }
 | 
				
			||||||
 | 
					                                else
 | 
				
			||||||
 | 
					                                {
 | 
				
			||||||
 | 
					                                    @s.EffDate
 | 
				
			||||||
 | 
					                                }
 | 
				
			||||||
                            }
 | 
					                            }
 | 
				
			||||||
                        </Template>
 | 
					                        </Template>
 | 
				
			||||||
                    </RadzenDataGridColumn>
 | 
					                    </RadzenDataGridColumn>
 | 
				
			||||||
| 
						 | 
					@ -194,16 +225,16 @@
 | 
				
			||||||
            <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
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                        <p class="shaky-text">库存预警!</p>
 | 
					                        <p class="shaky-text">库存预警!</p>
 | 
				
			||||||
                    }
 | 
					                    }
 | 
				
			||||||
                    else
 | 
					                    else
 | 
				
			||||||
                    { *@
 | 
					                    {
 | 
				
			||||||
                        @s.StockQuantity
 | 
					                        @s.StockQuantity
 | 
				
			||||||
                    @* } *@
 | 
					                    }
 | 
				
			||||||
                </Template>
 | 
					                </Template>
 | 
				
			||||||
            </RadzenDataGridColumn>
 | 
					            </RadzenDataGridColumn>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -8,12 +8,7 @@ namespace MasaBlazorApp3.Pojo
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    public class BoxModel
 | 
					    public class BoxModel
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        //库位号
 | 
					 | 
				
			||||||
        public int BoxNo { get; set; }
 | 
					        public int BoxNo { get; set; }
 | 
				
			||||||
        //药箱号
 | 
					        public string BoxName { get; set; }
 | 
				
			||||||
        public int BoxName { get; set; }
 | 
					 | 
				
			||||||
        public string 药箱号 {
 | 
					 | 
				
			||||||
            get => BoxName + "-" + BoxNo;
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -28,9 +28,6 @@ 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")]
 | 
				
			||||||
        public int DrawerType { get; set; }
 | 
					        public int DrawerType { get; set; }
 | 
				
			||||||
| 
						 | 
					@ -57,7 +54,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; } = 0;
 | 
					        public int ReturnQuantity { get; set; }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        [Column("dmnguid")]
 | 
					        [Column("dmnguid")]
 | 
				
			||||||
        public string Dmnguid { get; set; }
 | 
					        public string Dmnguid { get; set; }
 | 
				
			||||||
| 
						 | 
					@ -97,29 +94,5 @@ 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; }
 | 
					 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -12,7 +12,6 @@ namespace MasaBlazorApp3.Pojo.Config
 | 
				
			||||||
        public int[] weigh { get; set; }
 | 
					        public int[] weigh { get; set; }
 | 
				
			||||||
        public int[] box { get; set; }
 | 
					        public int[] box { get; set; }
 | 
				
			||||||
        public int[] label { get; set; }
 | 
					        public int[] label { get; set; }
 | 
				
			||||||
        public int[] returnDrawer { get; set; }
 | 
					 | 
				
			||||||
     
 | 
					     
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -10,19 +10,12 @@ 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不自动退出)
 | 
				
			||||||
        public int autoOutLog { get; set; }
 | 
					        public int autoOutLog { get; set; }
 | 
				
			||||||
        //手术室药盒的设备id
 | 
					        //手术室药盒的设备id
 | 
				
			||||||
        public string boxMachineId { get; set; }
 | 
					        public string boxMachineId { get; set; }
 | 
				
			||||||
        //手术室名称
 | 
					 | 
				
			||||||
        public string roomName { get; set; }
 | 
					 | 
				
			||||||
        //麻醉医师姓名
 | 
					 | 
				
			||||||
        public string anaesthetist_name { get; set; } 
 | 
					 | 
				
			||||||
        public string boxColor { get; set; }
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -32,8 +32,6 @@ namespace MasaBlazorApp3.Pojo
 | 
				
			||||||
        public string PackUnit { get; set; }
 | 
					        public string PackUnit { get; set; }
 | 
				
			||||||
        [Column("py_code")]
 | 
					        [Column("py_code")]
 | 
				
			||||||
        public string PyCode { get; set; }
 | 
					        public string PyCode { get; set; }
 | 
				
			||||||
        [Column("pack_h")]
 | 
					 | 
				
			||||||
        public string PackH { get; set; }
 | 
					 | 
				
			||||||
        //用于标识“手术室患者麻醉药品使用登记本”报表中是否导出该药品 1导出0不导
 | 
					        //用于标识“手术室患者麻醉药品使用登记本”报表中是否导出该药品 1导出0不导
 | 
				
			||||||
        //[Column("pack_h")]
 | 
					        //[Column("pack_h")]
 | 
				
			||||||
        //public int ReportType { get; set; }
 | 
					        //public int ReportType { get; set; }
 | 
				
			||||||
| 
						 | 
					@ -54,13 +52,7 @@ 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)
 | 
				
			||||||
| 
						 | 
					@ -75,15 +67,6 @@ 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,15 +156,5 @@ 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,16 +135,8 @@ 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; }
 | 
					 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					@ -165,12 +165,7 @@ namespace MasaBlazorApp3.Pojo
 | 
				
			||||||
        /// 是否选中
 | 
					        /// 是否选中
 | 
				
			||||||
        /// </summary>
 | 
					        /// </summary>
 | 
				
			||||||
        [Column(IsColumn =false)]
 | 
					        [Column(IsColumn =false)]
 | 
				
			||||||
        public bool ItemIsChecked { get; set; } = true;
 | 
					        public bool ItemIsChecked { get; set; }
 | 
				
			||||||
        /// <summary>
 | 
					 | 
				
			||||||
        /// 是否全先中
 | 
					 | 
				
			||||||
        /// </summary>
 | 
					 | 
				
			||||||
        [Column(IsColumn = false)]
 | 
					 | 
				
			||||||
        public bool AllItemIsChecked { get; set; } = true;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
        /// <summary>
 | 
					        /// <summary>
 | 
				
			||||||
        ///  麻醉师
 | 
					        ///  麻醉师
 | 
				
			||||||
| 
						 | 
					@ -182,8 +177,5 @@ 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,
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,13 +0,0 @@
 | 
				
			||||||
using System;
 | 
					 | 
				
			||||||
using System.Collections.Generic;
 | 
					 | 
				
			||||||
using System.Linq;
 | 
					 | 
				
			||||||
using System.Text;
 | 
					 | 
				
			||||||
using System.Threading.Tasks;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
namespace MasaBlazorApp3.Pojo
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
    public class ReturnChannelStock
 | 
					 | 
				
			||||||
    {
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
| 
						 | 
					@ -19,7 +19,6 @@ using MasaBlazorApp3.Pojo.Config;
 | 
				
			||||||
using Microsoft.Extensions.Options;
 | 
					using Microsoft.Extensions.Options;
 | 
				
			||||||
using LinqToDB.Common;
 | 
					using LinqToDB.Common;
 | 
				
			||||||
using MasaBlazorApp3.Util;
 | 
					using MasaBlazorApp3.Util;
 | 
				
			||||||
using Microsoft.Extensions.Logging;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
namespace MasaBlazorApp3.Port
 | 
					namespace MasaBlazorApp3.Port
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
| 
						 | 
					@ -410,22 +409,8 @@ namespace MasaBlazorApp3.Port
 | 
				
			||||||
        // 以抽屉为单位灭灯
 | 
					        // 以抽屉为单位灭灯
 | 
				
			||||||
        public void LightOffByDrawer(int DrawerNo)
 | 
					        public void LightOffByDrawer(int DrawerNo)
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            SerialPort serialPort = canBusSerial;
 | 
					 | 
				
			||||||
            int channelDrawerNo = DrawerNo;
 | 
					 | 
				
			||||||
            if (_portConfig.totalDrawerCount > 8)
 | 
					 | 
				
			||||||
            {
 | 
					 | 
				
			||||||
                if (DrawerNo % 2 == 0)
 | 
					 | 
				
			||||||
                {
 | 
					 | 
				
			||||||
                    channelDrawerNo = DrawerNo / 2;
 | 
					 | 
				
			||||||
                }
 | 
					 | 
				
			||||||
                else
 | 
					 | 
				
			||||||
                {
 | 
					 | 
				
			||||||
                    serialPort = canBusSerialTwo;
 | 
					 | 
				
			||||||
                    channelDrawerNo = (DrawerNo + 1) / 2;
 | 
					 | 
				
			||||||
                }
 | 
					 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
            byte[] buffer = new byte[] { 0xaa, (byte)(0xf0 + DrawerNo), 0x06, 0x00, 0x00, 0x00, 0x00, 0xee };
 | 
					            byte[] buffer = new byte[] { 0xaa, (byte)(0xf0 + DrawerNo), 0x06, 0x00, 0x00, 0x00, 0x00, 0xee };
 | 
				
			||||||
            serialPort.Write(buffer, 0, 8);
 | 
					            canBusSerial.Write(buffer, 0, 8);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        // 以单支板为单位有药位置亮灯
 | 
					        // 以单支板为单位有药位置亮灯
 | 
				
			||||||
        public async Task HasLightOnByCol(int DrawerNo, int[] ColNos)
 | 
					        public async Task HasLightOnByCol(int DrawerNo, int[] ColNos)
 | 
				
			||||||
| 
						 | 
					@ -449,8 +434,7 @@ namespace MasaBlazorApp3.Port
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                var channel = Convert.ToInt32((channelDrawerNo * 10 + ColNos[i]).ToString(), 16);
 | 
					                var channel = Convert.ToInt32((channelDrawerNo * 10 + ColNos[i]).ToString(), 16);
 | 
				
			||||||
                byte[] buffer = new byte[] { 0xaa, (byte)channel, 0x0a, 0x00, 0x00, 0x00, 0x00, 0xee };
 | 
					                byte[] buffer = new byte[] { 0xaa, (byte)channel, 0x0a, 0x00, 0x00, 0x00, 0x00, 0xee };
 | 
				
			||||||
                serialPort.Write(buffer, 0, 8);
 | 
					                canBusSerial.Write(buffer, 0, 8);
 | 
				
			||||||
                logger.Info($"{serialPort}串口{DrawerNo}号{channelDrawerNo}抽屉{string.Join(',',ColNos)}库位有药位置亮灯发送指令:{Convert.ToHexString(buffer)}");
 | 
					 | 
				
			||||||
                await Task.Delay(TimeSpan.FromMilliseconds(20));
 | 
					                await Task.Delay(TimeSpan.FromMilliseconds(20));
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -485,40 +469,6 @@ namespace MasaBlazorApp3.Port
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            byte[] buffer = new byte[] { 0xaa, 0xff, 0x07, 0x00, 0x00, 0x00, 0x00, 0xee };
 | 
					            byte[] buffer = new byte[] { 0xaa, 0xff, 0x07, 0x00, 0x00, 0x00, 0x00, 0xee };
 | 
				
			||||||
            canBusSerial.Write(buffer, 0, 8);
 | 
					            canBusSerial.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
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -304,8 +304,7 @@
 | 
				
			||||||
			"HCrossFields":"DrugId",
 | 
								"HCrossFields":"DrugId",
 | 
				
			||||||
			"VCrossFields":"ID号",
 | 
								"VCrossFields":"ID号",
 | 
				
			||||||
			"ListCols":6,
 | 
								"ListCols":6,
 | 
				
			||||||
			"TotalCols":3,
 | 
								"TotalCols":3
 | 
				
			||||||
			"TotalExcludeColumns":"残液处置方式;使用人签名;复核人签名"
 | 
					 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	},
 | 
						},
 | 
				
			||||||
	"Parameter":[
 | 
						"Parameter":[
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,5 +1,5 @@
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  "connectionStrings": "server=127.0.0.1;port=3306;database=zbzq20250908;userid=root;password=root;Charset=utf8mb4;",
 | 
					  "connectionStrings": "server=127.0.0.1;port=3306;database=zbzq;userid=root;password=qq1223;Charset=utf8mb4;",
 | 
				
			||||||
  "finger": {
 | 
					  "finger": {
 | 
				
			||||||
    "ip": "192.168.50.59",
 | 
					    "ip": "192.168.50.59",
 | 
				
			||||||
    "port": 4370,
 | 
					    "port": 4370,
 | 
				
			||||||
| 
						 | 
					@ -11,18 +11,14 @@
 | 
				
			||||||
    //. 药房代码:      武昌  07010323  麻醉科小药柜 8个抽屉     
 | 
					    //. 药房代码:      武昌  07010323  麻醉科小药柜 8个抽屉     
 | 
				
			||||||
    //                  汉口  "07010363" "麻醉科 16个抽屉",
 | 
					    //                  汉口  "07010363" "麻醉科 16个抽屉",
 | 
				
			||||||
    "storage": "07010323",
 | 
					    "storage": "07010323",
 | 
				
			||||||
    "inPharmacyId": "062303",
 | 
					 | 
				
			||||||
    "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": "COM2",
 | 
				
			||||||
    "drawerProtocol": 485,
 | 
					    "drawerProtocol": 485,
 | 
				
			||||||
    "scanCodePortPath": "COM1",
 | 
					    "scanCodePortPath": "COM1",
 | 
				
			||||||
    "canBusExsit": true,
 | 
					    "canBusExsit": true,
 | 
				
			||||||
| 
						 | 
					@ -31,7 +27,7 @@
 | 
				
			||||||
    "canBusTwoExsit": true,
 | 
					    "canBusTwoExsit": true,
 | 
				
			||||||
    "StorageCan": 1,
 | 
					    "StorageCan": 1,
 | 
				
			||||||
    //第二个can总线端口
 | 
					    //第二个can总线端口
 | 
				
			||||||
    "canBusPortPathTwo": "COM11",
 | 
					    "canBusPortPathTwo": "COM31",
 | 
				
			||||||
    "doorAddr": 0,
 | 
					    "doorAddr": 0,
 | 
				
			||||||
    "storageBoxAddr": 0,
 | 
					    "storageBoxAddr": 0,
 | 
				
			||||||
    "fridgePortExist": false,
 | 
					    "fridgePortExist": false,
 | 
				
			||||||
| 
						 | 
					@ -41,8 +37,7 @@
 | 
				
			||||||
    "single": [ 1 ],
 | 
					    "single": [ 1 ],
 | 
				
			||||||
    "weigh": [ 4 ],
 | 
					    "weigh": [ 4 ],
 | 
				
			||||||
    "box": [ 4 ],
 | 
					    "box": [ 4 ],
 | 
				
			||||||
    "label": [ 4 ],
 | 
					    "label": [ 4 ]
 | 
				
			||||||
    "returnDrawer": [12,14]
 | 
					 | 
				
			||||||
  },
 | 
					  },
 | 
				
			||||||
  "fridge": {
 | 
					  "fridge": {
 | 
				
			||||||
    //冰箱温度区间
 | 
					    //冰箱温度区间
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,54 +0,0 @@
 | 
				
			||||||
INSERT into channel_list(chnguid,machine_id,row_no,col_no) values('DM5_CHANNEL_11','DM5',1,1);
 | 
					 | 
				
			||||||
INSERT into channel_list(chnguid,machine_id,row_no,col_no) values('DM5_CHANNEL_12','DM5',1,2);
 | 
					 | 
				
			||||||
INSERT into channel_list(chnguid,machine_id,row_no,col_no) values('DM5_CHANNEL_21','DM5',2,1);
 | 
					 | 
				
			||||||
INSERT into channel_list(chnguid,machine_id,row_no,col_no) values('DM5_CHANNEL_22','DM5',2,2);
 | 
					 | 
				
			||||||
INSERT into channel_list(chnguid,machine_id,row_no,col_no) values('DM5_CHANNEL_31','DM5',3,1);
 | 
					 | 
				
			||||||
INSERT into channel_list(chnguid,machine_id,row_no,col_no) values('DM5_CHANNEL_32','DM5',3,2);
 | 
					 | 
				
			||||||
INSERT into channel_list(chnguid,machine_id,row_no,col_no) values('DM5_CHANNEL_41','DM5',4,1);
 | 
					 | 
				
			||||||
INSERT into channel_list(chnguid,machine_id,row_no,col_no) values('DM5_CHANNEL_42','DM5',4,2);
 | 
					 | 
				
			||||||
INSERT into channel_list(chnguid,machine_id,row_no,col_no) values('DM5_CHANNEL_51','DM5',5,1);
 | 
					 | 
				
			||||||
INSERT into channel_list(chnguid,machine_id,row_no,col_no) values('DM5_CHANNEL_52','DM5',5,2);
 | 
					 | 
				
			||||||
INSERT into channel_list(chnguid,machine_id,row_no,col_no) values('DM5_CHANNEL_61','DM5',6,1);
 | 
					 | 
				
			||||||
INSERT into channel_list(chnguid,machine_id,row_no,col_no) values('DM5_CHANNEL_62','DM5',6,2);
 | 
					 | 
				
			||||||
INSERT into channel_list(chnguid,machine_id,row_no,col_no) values('DM5_CHANNEL_71','DM5',7,1);
 | 
					 | 
				
			||||||
INSERT into channel_list(chnguid,machine_id,row_no,col_no) values('DM5_CHANNEL_72','DM5',7,2);
 | 
					 | 
				
			||||||
INSERT into channel_list(chnguid,machine_id,row_no,col_no) values('DM5_CHANNEL_81','DM5',8,1);
 | 
					 | 
				
			||||||
INSERT into channel_list(chnguid,machine_id,row_no,col_no) values('DM5_CHANNEL_82','DM5',8,2);
 | 
					 | 
				
			||||||
INSERT into channel_list(chnguid,machine_id,row_no,col_no) values('DM5_CHANNEL_91','DM5',9,1);
 | 
					 | 
				
			||||||
INSERT into channel_list(chnguid,machine_id,row_no,col_no) values('DM5_CHANNEL_92','DM5',9,2);
 | 
					 | 
				
			||||||
INSERT into channel_list(chnguid,machine_id,row_no,col_no) values('DM5_CHANNEL_101','DM5',10,1);
 | 
					 | 
				
			||||||
INSERT into channel_list(chnguid,machine_id,row_no,col_no) values('DM5_CHANNEL_102','DM5',10,2);
 | 
					 | 
				
			||||||
INSERT into channel_list(chnguid,machine_id,row_no,col_no) values('DM5_CHANNEL_111','DM5',11,1);
 | 
					 | 
				
			||||||
INSERT into channel_list(chnguid,machine_id,row_no,col_no) values('DM5_CHANNEL_112','DM5',11,2);
 | 
					 | 
				
			||||||
INSERT into channel_list(chnguid,machine_id,row_no,col_no) values('DM5_CHANNEL_121','DM5',12,1);
 | 
					 | 
				
			||||||
INSERT into channel_list(chnguid,machine_id,row_no,col_no) values('DM5_CHANNEL_122','DM5',12,2);
 | 
					 | 
				
			||||||
INSERT into channel_list(chnguid,machine_id,row_no,col_no) values('DM5_CHANNEL_131','DM5',13,1);
 | 
					 | 
				
			||||||
INSERT into channel_list(chnguid,machine_id,row_no,col_no) values('DM5_CHANNEL_132','DM5',13,2);
 | 
					 | 
				
			||||||
INSERT into channel_list(chnguid,machine_id,row_no,col_no) values('DM5_CHANNEL_141','DM5',14,1);
 | 
					 | 
				
			||||||
INSERT into channel_list(chnguid,machine_id,row_no,col_no) values('DM5_CHANNEL_142','DM5',14,2);
 | 
					 | 
				
			||||||
INSERT into channel_list(chnguid,machine_id,row_no,col_no) values('DM5_CHANNEL_151','DM5',15,1);
 | 
					 | 
				
			||||||
INSERT into channel_list(chnguid,machine_id,row_no,col_no) values('DM5_CHANNEL_152','DM5',15,2);
 | 
					 | 
				
			||||||
INSERT into channel_list(chnguid,machine_id,row_no,col_no) values('DM5_CHANNEL_161','DM5',16,1);
 | 
					 | 
				
			||||||
INSERT into channel_list(chnguid,machine_id,row_no,col_no) values('DM5_CHANNEL_162','DM5',16,2);
 | 
					 | 
				
			||||||
INSERT into channel_list(chnguid,machine_id,row_no,col_no) values('DM5_CHANNEL_171','DM5',17,1);
 | 
					 | 
				
			||||||
INSERT into channel_list(chnguid,machine_id,row_no,col_no) values('DM5_CHANNEL_172','DM5',17,2);
 | 
					 | 
				
			||||||
INSERT into channel_list(chnguid,machine_id,row_no,col_no) values('DM5_CHANNEL_181','DM5',18,1);
 | 
					 | 
				
			||||||
INSERT into channel_list(chnguid,machine_id,row_no,col_no) values('DM5_CHANNEL_182','DM5',18,2);
 | 
					 | 
				
			||||||
INSERT into channel_list(chnguid,machine_id,row_no,col_no) values('DM5_CHANNEL_191','DM5',19,1);
 | 
					 | 
				
			||||||
INSERT into channel_list(chnguid,machine_id,row_no,col_no) values('DM5_CHANNEL_192','DM5',19,2);
 | 
					 | 
				
			||||||
INSERT into channel_list(chnguid,machine_id,row_no,col_no) values('DM5_CHANNEL_201','DM5',20,1);
 | 
					 | 
				
			||||||
INSERT into channel_list(chnguid,machine_id,row_no,col_no) values('DM5_CHANNEL_202','DM5',20,2);
 | 
					 | 
				
			||||||
INSERT into channel_list(chnguid,machine_id,row_no,col_no) values('DM5_CHANNEL_211','DM5',21,1);
 | 
					 | 
				
			||||||
INSERT into channel_list(chnguid,machine_id,row_no,col_no) values('DM5_CHANNEL_212','DM5',21,2);
 | 
					 | 
				
			||||||
INSERT into channel_list(chnguid,machine_id,row_no,col_no) values('DM5_CHANNEL_221','DM5',22,1);
 | 
					 | 
				
			||||||
INSERT into channel_list(chnguid,machine_id,row_no,col_no) values('DM5_CHANNEL_222','DM5',22,2);
 | 
					 | 
				
			||||||
INSERT into channel_list(chnguid,machine_id,row_no,col_no) values('DM5_CHANNEL_231','DM5',23,1);
 | 
					 | 
				
			||||||
INSERT into channel_list(chnguid,machine_id,row_no,col_no) values('DM5_CHANNEL_232','DM5',23,2);
 | 
					 | 
				
			||||||
INSERT into channel_list(chnguid,machine_id,row_no,col_no) values('DM5_CHANNEL_241','DM5',24,1);
 | 
					 | 
				
			||||||
INSERT into channel_list(chnguid,machine_id,row_no,col_no) values('DM5_CHANNEL_242','DM5',24,2);
 | 
					 | 
				
			||||||
INSERT into channel_list(chnguid,machine_id,row_no,col_no) values('DM5_CHANNEL_251','DM5',25,1);
 | 
					 | 
				
			||||||
INSERT into channel_list(chnguid,machine_id,row_no,col_no) values('DM5_CHANNEL_252','DM5',25,2);
 | 
					 | 
				
			||||||
INSERT into channel_list(chnguid,machine_id,row_no,col_no) values('DM5_CHANNEL_261','DM5',26,1);
 | 
					 | 
				
			||||||
INSERT into channel_list(chnguid,machine_id,row_no,col_no) values('DM5_CHANNEL_271','DM5',27,1);
 | 
					 | 
				
			||||||
INSERT into channel_list(chnguid,machine_id,row_no,col_no) values('DM5_CHANNEL_281','DM5',28,1);
 | 
					 | 
				
			||||||
INSERT into channel_list(chnguid,machine_id,row_no,col_no) values('DM5_CHANNEL_291','DM5',29,1);
 | 
					 | 
				
			||||||
										
											Binary file not shown.
										
									
								
							| 
						 | 
					@ -1,31 +0,0 @@
 | 
				
			||||||
中部战区项目
 | 
					 | 
				
			||||||
一、软件相关
 | 
					 | 
				
			||||||
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