去掉portUtil中无关信息

This commit is contained in:
maqiao 2024-11-29 15:26:38 +08:00
parent c333cd9e5d
commit 3e2a666159
13 changed files with 1684 additions and 3124 deletions

View File

@ -170,7 +170,7 @@ namespace DM_Weight
//交接柜补药
containerRegistry.RegisterForNavigation<AdditionWindow, AdditionWindowViewModel>();
//核对处方
containerRegistry.RegisterForNavigation<CheckOrderWindow, CheckOrderWindowViewModel>();
//containerRegistry.RegisterForNavigation<CheckOrderWindow, CheckOrderWindowViewModel>();
//管理员根据药箱进行核对处方
containerRegistry.RegisterForNavigation<CheckOrderNewWindow, CheckOrderNewWindowViewModel>();
//麻醉师核对其名下单子

File diff suppressed because it is too large Load Diff

View File

@ -43,11 +43,13 @@ namespace DM_Weight.ViewModels
IDialogService _dialogService;
IEventAggregator _eventAggregator;
private PortUtil _portUtil;
public AdditionWindowViewModel(IDialogService dialogService, IEventAggregator eventAggregator)
public AdditionWindowViewModel(IDialogService dialogService, IEventAggregator eventAggregator, PortUtil portUtil)
{
_dialogService = dialogService;
_eventAggregator = eventAggregator;
_portUtil = portUtil;
}
public bool IsNavigationTarget(NavigationContext navigationContext)
{
@ -83,8 +85,14 @@ namespace DM_Weight.ViewModels
selectedStock = ChannelStocks.FindAll(cs => cs.ChannelLst.IsSelected).ToList();
if (selectedStock != null && selectedStock.Count > 0)
{
int drawerNo = 0;
for (int i = 0; i < selectedStock.Count; i++)
{
if (!(drawerNo == selectedStock[i].DrawerNo))
{
drawerNo = selectedStock[i].DrawerNo;
_portUtil.SpeakAsync($"正在打开{selectedStock[i].DrawerNo}号药箱");
}
ModbusHelper.GetInstance().OpenBoxDoor(selectedStock[i].DrawerNo - 1);
Thread.Sleep(100);
}

View File

@ -523,7 +523,7 @@ namespace DM_Weight.ViewModels
OrderInfo oi = confirmData[i];
//更新处方状态
if (oi.DmStatus == 0)
if (oi.DmStatus == 1)
{
SqlSugarHelper.Db.Updateable(new OrderInfo()
{

View File

@ -1,476 +0,0 @@
using DM_Weight.Models;
using DM_Weight.msg;
using DM_Weight.Port;
using DM_Weight.util;
using DM_Weight.Views;
using log4net;
using log4net.Repository.Hierarchy;
using Prism.Commands;
using Prism.Events;
using Prism.Mvvm;
using Prism.Regions;
using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Configuration;
using System.Drawing.Printing;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Data;
namespace DM_Weight.ViewModels
{
public class CheckOrderWindowViewModel : BindableBase,INavigationAware, IRegionMemberLifetime
{
//private int _pageNum = 1;
//public int PageNum
//{
// get => _pageNum;
// set
// {
// SetProperty(ref _pageNum, value);
// RequestData();
// }
//}
//private int _pageCount = 1;
//public int PageCount
//{
// get => _pageCount;
// set
// {
// SetProperty(ref _pageCount, value);
// }
//}
//private int _pageSize = 8;
//public int PageSize
//{
// get => _pageSize;
// set
// {
// SetProperty(ref _pageSize, value);
// }
//}
//private int _totalCount = 0;
//public int TotalCount
//{
// get => _totalCount;
// set
// {
// SetProperty(ref _totalCount, value);
// }
//}
private readonly ILog logger = LogManager.GetLogger(typeof(CheckOrderWindowViewModel));
private int _status=0;
public int Status { get => _status; set => SetProperty(ref _status, value); }
private bool _btnEnable=true;
public bool BtnEnable { get => _btnEnable;set=>SetProperty(ref _btnEnable, value); }
//抽屉号列表
public static List<int> iList = new List<int>();
//第几个抽屉号
public static int iNumber = 1;
private List<OrderDetail> orderDetailList=new();
public List<OrderDetail> OrderDetailList
{
get=> orderDetailList;
set=>SetProperty(ref orderDetailList, value);
}
private string _orderDate = DateTime.Now.ToString("yyyy-MM-dd");
/// <summary>
/// 查询条件 处方日期
/// </summary>
public string OrderDate
{
get { return _orderDate; }
set
{
if (!String.IsNullOrEmpty(value))
{
SetProperty(ref _orderDate, DateTime.Parse(value).ToString("yyyy-MM-dd"));
}
else
{
SetProperty(ref _orderDate, value);
}
RequestData();
}
}
private PortUtil _portUtil;
IEventAggregator _eventAggregator;
public CheckOrderWindowViewModel(PortUtil portUtil, IEventAggregator eventAggregator)
{
_portUtil = portUtil;
_eventAggregator = eventAggregator;
}
public bool KeepAlive => false;
public bool IsNavigationTarget(NavigationContext navigationContext)
{
return true;
}
public void OnNavigatedFrom(NavigationContext navigationContext)
{
// 取消消息订阅
_eventAggregator.GetEvent<PortUtilEvent>().Unsubscribe(DoMyPrismEvent);
}
public void OnNavigatedTo(NavigationContext navigationContext)
{
RequestData();
_eventAggregator.GetEvent<PortUtilEvent>().Subscribe(DoMyPrismEvent);
}
public DelegateCommand Query
{
get => new DelegateCommand(()=> { RequestData(); });
}
public void RequestData()
{
OrderDetailList.Clear();
//int totalCount = 0;
List<OrderDetail> queryData = SqlSugarHelper.Db.Queryable<OrderDetail>()
.Includes<OrderInfo>(od => od._OrderInfo)
.Includes<DrugInfo>(od => od.DrugInfo)
.WhereIF(OrderDate != null, od => od._OrderInfo.RecvDate.ToString("yyyy-MM-dd") == OrderDate)
.WhereIF(!String.IsNullOrEmpty(ConfigurationManager.AppSettings["storage"]), od => od._OrderInfo.Pharmacy == ConfigurationManager.AppSettings["storage"])
.Where(od => od._OrderInfo.DmStatus == 0)
.Where(od => od._OrderInfo.HisDispFlag == 0)
.Where(od => od._OrderInfo.CancelFlag == 0)
//.Where(od=>od._OrderInfo.OrderNo== "202312219183416")
.Where(od=>od._OrderInfo.DoctorCode== HomeWindowViewModel.Operator.UserBarcode)
.OrderBy(od => od.OrderId)
.ToList();
//.ToPageList(PageNum, PageSize, ref totalCount);
ICollectionView vw = CollectionViewSource.GetDefaultView(queryData);
vw.GroupDescriptions.Add(new PropertyGroupDescription("_OrderInfo"));
OrderDetailList = queryData;
//TotalCount = totalCount;
//PageCount = (int)Math.Ceiling((double)TotalCount / PageSize);
}
//核对确认
public DelegateCommand ConfirmCommand
{
get => new DelegateCommand(() =>
{
ConfirmAction();
});
}
private void ConfirmAction()
{
//打开当前用户下的药箱
iList = SqlSugarHelper.Db.Queryable<ChannelList>().Where(cl => cl.MachineId == "DM5")
.Where(cl => cl.BelongUser == HomeWindowViewModel.Operator.UserName)
.Select(cl => cl.DrawerNo).ToList();
if (iList.Count > 0)
{
_portUtil.SpeakAsync("正在打开药箱");
_portUtil.DrawerNo = iList[iNumber];
iNumber++;
Status = 1;
_portUtil.OpenBox();
}
}
void DoMyPrismEvent(DeviceMsg msg)
{
switch (msg.EventType)
{
// 药箱打开
case EventType.DRAWEROPEN:
BtnEnable = false;
//记录开药箱日志
SqlSugarHelper.Db.Insertable(new MachineRecord()
{
MachineId = "DM5",
DrawerNo = _portUtil.DrawerNo,
Operator = HomeWindowViewModel.Operator?.Id,
OperationTime = DateTime.Now,
Type = 55,
InvoiceId = "药箱打开",
}).ExecuteCommand();
if (iNumber < iList.Count)
{
_portUtil.DrawerNo = iList[iNumber];
iNumber++;
if (Status == 1)
{
Status = 2;
}
_portUtil.OpenBox();
}
else
{
iNumber = 0;
_portUtil.GetBoxStatus();
}
break;
// 药箱关闭
case EventType.DRAWERCLOSE:
//记录药箱操作日志
SqlSugarHelper.Db.Insertable(new MachineRecord()
{
MachineId = "DM5",
DrawerNo = _portUtil.DrawerNo,
Operator = HomeWindowViewModel.Operator?.Id,
OperationTime = DateTime.Now,
Type = 55,
InvoiceId = "药箱关闭",
}).ExecuteCommand();
if (Status == 2)
{
Status = 3;
}
BtnEnable = true;
_portUtil.Operate = false;
//减库存,生成操作记录
SaveDate();
break;
// 打开失败
case EventType.OPENERROR:
AlertMsg alertMsg = new AlertMsg
{
Message = msg.Message,
Type = MsgType.ERROR
};
_eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
BtnEnable = true;
Status = 0;
_portUtil.Operate = false;
//记录药箱操作日志
SqlSugarHelper.Db.Insertable(new MachineRecord()
{
MachineId = "DM5",
DrawerNo = _portUtil.DrawerNo,
Operator = HomeWindowViewModel.Operator?.Id,
OperationTime = DateTime.Now,
Type = 55,
InvoiceId = "药箱打开失败",
}).ExecuteCommand();
_portUtil.Operate = false;
break;
}
}
//减库存,生成操作记录
private void SaveDate()
{
var confirmData = OrderDetailList.Where(od => od._OrderInfo.ItemIsChecked == true).ToList();
if(confirmData.Count > 0 )
{
var f = SqlSugarHelper.Db.UseTran(() =>
{
string empChannelStock=string.Empty;
for (int i = 0; i < confirmData.Count; i++)
{
OrderDetail od = confirmData[i];
//更新处方状态
if(od._OrderInfo.DmStatus==0)
{
SqlSugarHelper.Db.Updateable(new OrderInfo()
{
DmStatus = 1,
OrderNo = od.OrderNo
}).UpdateColumns(it => new { it.DmStatus }).WhereColumns(it => new { it.OrderNo }).ExecuteCommand();
SqlSugarHelper.Db.Insertable(new OrderFinish()
{
OrderNo = od.OrderNo,
PatientId = od._OrderInfo.PatientId,
Pharmacy = od._OrderInfo.Pharmacy,
State = 1,
Operator = HomeWindowViewModel.Operator?.Nickname,
});
}
Expression<Func<ChannelStock, bool>> updateExp = it => it.ManuNo == od.SetManuNo && it.EffDate == od.SetEffDate;
ChannelStock cs = SqlSugarHelper.Db.Queryable<ChannelStock>().Where(cs =>cs.DrugId==od.DrugId && cs.ManuNo == od.SetManuNo && cs.EffDate == od.SetEffDate && cs.MachineId.Equals(ConfigurationManager.AppSettings["machineId"] ?? "DM3")).First();
if(cs==null)
{
empChannelStock += $"{od.OrderNo},{od.DrugId},{od.SetManuNo},{od.SetEffDate}";
continue;
}
cs.Quantity = cs.Quantity - od.Quantity;
// 更新数据 库存信息
SqlSugarHelper.Db.Updateable(cs).UpdateColumns(it => new { it.Quantity }).ExecuteCommand();
if (cs != null)
{
SqlSugarHelper.Db.Insertable(new MachineRecord()
{
MachineId = ConfigurationManager.AppSettings["machineId"].ToString(),
DrawerNo = cs.DrawerNo,
ColNo = cs.ColNo,
DrugId = cs.DrugId,
ManuNo = cs.ManuNo,
EffDate = !String.IsNullOrEmpty(cs.EffDate) ? DateTime.ParseExact(cs.EffDate, "yyyy-MM-dd", System.Globalization.CultureInfo.CurrentCulture) : null,
Operator = HomeWindowViewModel.Operator?.Id,
Reviewer = HomeWindowViewModel.Reviewer?.Id,
OperationTime = DateTime.Now,
Quantity = od.Quantity,
Type = 2,
InvoiceId = od.OrderNo
//, StockQuantity = nowChannels.Sum(it => it.Quantity)
}).ExecuteCommand();
}
//保存账册
int iInsertResult = SqlSugarHelper.Db.Insertable(new AccountBookG2()
{
DrugId = od.DrugId,
Type = 2,
Department = od._OrderInfo.DeptName,
OrderNo = od.OrderNo,
ManuNo = cs.ManuNo,
EffDate = cs.EffDate,
OutQuantity = od.Quantity,
UserId1 = HomeWindowViewModel.Operator?.Id,
UserId2 = HomeWindowViewModel.Reviewer?.Id,
MachineId = ConfigurationManager.AppSettings["machineId"].ToString(),
CreateDate = DateTime.Now.ToString("yyyy-MM-dd"),
CreateTime = DateTime.Now,
InvoiceNo = od.OrderNo
}).ExecuteCommand();
//修改凌晨生成的日结存与总结存数据
AccountBookG2 accountBookG2Day = SqlSugarHelper.Db.Queryable<AccountBookG2>()
.Where(ab => ab.MachineId.Equals(ConfigurationManager.AppSettings["machineId"].ToString()))
.Where(ab => ab.Type == 3)
.Where(ab => ab.DrugId == od.DrugId)
.Where(ab => ab.ManuNo == cs.ManuNo)
.Where(ab => ab.CreateDate == DateTime.Now.ToString("yyyy-MM-dd")).First();
if (accountBookG2Day != null)
{
accountBookG2Day.ManuStock = accountBookG2Day.ManuStock - od.Quantity;
SqlSugarHelper.Db.Updateable(accountBookG2Day).ExecuteCommand();
}
else
{
//生成日结存时可能没有该库位的绑定信息,需要写入日结存
int iDayResult = SqlSugarHelper.Db.Insertable(new AccountBookG2()
{
DrugId = od.DrugId,
Type = 3,
ManuNo = cs.ManuNo,
EffDate = cs.EffDate,
YQuantity = 0,
ManuStock = od.Quantity,
TotalStock = od.Quantity,
UserId1 = HomeWindowViewModel.Operator?.Id,
UserId2 = HomeWindowViewModel.Reviewer?.Id,
MachineId = ConfigurationManager.AppSettings["machineId"].ToString(),
CreateDate = DateTime.Now.ToString("yyyy-MM-dd"),
InvoiceNo = "日结存"
}).ExecuteCommand();
if (iDayResult <= 0)
{
logger.Info($"未写入日结存数据{od.DrugId}-{cs.ManuNo}-{cs.EffDate}-{cs.Quantity}");
}
}
//修改凌晨生成的日结存与总结存数据
AccountBookG2 accountBookG2Total = SqlSugarHelper.Db.Queryable<AccountBookG2>()
.Where(ab => ab.MachineId.Equals(ConfigurationManager.AppSettings["machineId"].ToString()))
.Where(ab => ab.Type == 4)
.Where(ab => ab.DrugId == od.DrugId)
.Where(ab => ab.CreateDate == DateTime.Now.ToString("yyyy-MM-dd")).First();
if (accountBookG2Total != null)
{
accountBookG2Total.TotalStock = accountBookG2Total.TotalStock - od.Quantity;
SqlSugarHelper.Db.Updateable(accountBookG2Total).ExecuteCommand();
}
else
{
//生成总结存时可能没有该库位的绑定信息,需要写入总结存
int iTotalResult = SqlSugarHelper.Db.Insertable(new AccountBookG2()
{
DrugId = od.DrugId,
Type = 4,
YQuantity = 0,
ManuStock = od.Quantity,
TotalStock = od.Quantity,
UserId1 = HomeWindowViewModel.Operator?.Id,
UserId2 = HomeWindowViewModel.Reviewer?.Id,
MachineId = ConfigurationManager.AppSettings["machineId"].ToString(),
CreateDate = DateTime.Now.ToString("yyyy-MM-dd"),
InvoiceNo = "总结存"
}).ExecuteCommand();
if (iTotalResult <= 0)
{
logger.Info($"未写入总结存数据{od.DrugId}-{od.Quantity}");
}
}
}
if(!string.IsNullOrEmpty(empChannelStock))
{
AlertMsg alertMsg = new AlertMsg
{
Message = $"所选处方对应药品批次效期无库存{empChannelStock}",
Type = MsgType.ERROR,
};
_eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
logger.Info($"所选处方对应药品批次效期无库存{empChannelStock}");
}
return true;
});
if (f.Data)
{
RequestData();
AlertMsg alertMsg = new AlertMsg
{
Message = "所选处方已核对完成",
Type = MsgType.SUCCESS,
};
_eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
}
if (!f.IsSuccess)
{
AlertMsg alertMsg = new AlertMsg
{
Message = "处方核对失败!",
Type = MsgType.ERROR,
};
_eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
}
Status = 0;
}
else
{
AlertMsg alertMsg = new AlertMsg
{
Message = "请勾选要核对的处方数据",
Type = MsgType.ERROR
};
_eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
}
}
}
}

View File

@ -1,326 +0,0 @@
using log4net;
using Prism.Commands;
using Prism.Events;
using Prism.Mvvm;
using Prism.Regions;
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Linq;
using System.Speech.Synthesis;
using System.Text;
using System.Threading.Tasks;
using DM_Weight.Models;
using DM_Weight.msg;
using DM_Weight.Port;
using DM_Weight.util;
namespace DM_Weight.ViewModels
{
public class CheckStockWindowViewModel : BindableBase, IConfirmNavigationRequest, IRegionMemberLifetime
{
private readonly ILog logger = LogManager.GetLogger(typeof(CheckStockWindowViewModel));
private List<ChannelStock> _channelStocks = new();
public List<ChannelStock> ChannelStocks
{
get => _channelStocks;
set => SetProperty(ref _channelStocks, value);
}
private static readonly DateTime Jan1st1970 = new DateTime
(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);
private PortUtil _portUtil;
IEventAggregator _eventAggregator;
public CheckStockWindowViewModel(PortUtil portUtil, IEventAggregator eventAggregator)
{
_portUtil = portUtil;
_eventAggregator = eventAggregator;
}
void DoMyPrismEvent(DeviceMsg msg)
{
if (msg.WindowName == "CheckStockWindow")
{
switch (msg.EventType)
{
// 抽屉打开
case EventType.DRAWEROPEN:
if (Status == 1)
{
Status = 2;
}
break;
// 抽屉关闭
case EventType.DRAWERCLOSE:
if (Status == 2)
{
Status = 3;
}
break;
// 数量变化
case EventType.UPDATEQUANTITY:
if (Status == 2)
{
logger.Info($"抽屉【{DrawerNo}】库位药品数量【{msg.Quantitys}】");
}
break;
// 打开失败
case EventType.OPENERROR:
AlertMsg alertMsg = new AlertMsg
{
Message = msg.Message,
Type = MsgType.ERROR,
};
_eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
Status = 0;
break;
}
}
}
private int _status;
public int Status { get => _status; set => SetProperty(ref _status, value); }
private int _drawerNo = 1;
public int DrawerNo
{
get => _drawerNo;
set => SetProperty(ref _drawerNo, value);
}
private bool _is8Drawer = true;
public bool Is8Drawer { get => _is8Drawer; set => SetProperty(ref _is8Drawer, value); }
private bool _is16Drawer = false;
public bool Is16Drawer { get => _is16Drawer; set => SetProperty(ref _is16Drawer, value); }
private bool _is17Drawer = false;
public bool Is17Drawer { get => _is17Drawer; set => SetProperty(ref _is17Drawer, value); }
public DelegateCommand<string> UpdateDrawerNo
{
get => new DelegateCommand<string>((DrawerNo) =>
{
this.DrawerNo = Convert.ToInt32(DrawerNo);
RequestData();
}, (DrawerNo) => Status == 0
);
}
public DelegateCommand OpenDrawer
{
get => new DelegateCommand(() =>
{
Status = 1;
_portUtil.SpeakAsync("正在打开" + DrawerNo + "号抽屉");
List<ChannelStock> singleChannels = ChannelStocks.FindAll(it => it.BoardType != 1);
_portUtil.WindowName = "CheckStockWindow";
_portUtil.Operate = true;
_portUtil.BoardType = singleChannels.Count > 0 ? singleChannels[0].BoardType : 1;
_portUtil.ColNos = singleChannels.Select(it => it.ColNo).ToArray();
_portUtil.DrawerNo = DrawerNo;
_portUtil.Start();
}, () => Status == 0).ObservesProperty(() => Status);
}
private bool _isFinishClick = false;
// 完成按钮
public DelegateCommand TakeFinish
{
get => new DelegateCommand(() =>
{
_isFinishClick = true;
List<ChannelStock> record = ChannelStocks.FindAll(it => it.Quantity != it.CheckQuantity).ToList();
if (record.Count > 0)
{
string InvoiceId = "CHECK_" + CurrentTimeMillis();
var f = SqlSugarHelper.Db.UseTran(() =>
{
for (int i = 0; i < record.Count; i++)
{
ChannelStock it = record[i];
// 更新数据 库存信息
SqlSugarHelper.Db.Updateable(new ChannelStock()
{
Quantity = it.CheckQuantity,
ManuNo = it.ManuNo,
EffDate = it.EffDate,
Id = it.Id,
}).UpdateColumns(it => new { it.Quantity, it.ManuNo, it.EffDate }).ExecuteCommand();
// 获取更新完库存后的药品库存
List<ChannelStock> nowChannels = SqlSugarHelper.Db.Queryable<ChannelStock>()
.Where(cs => cs.MachineId.Equals(it.MachineId))
.Where(cs => cs.DrugId.Equals(it.DrugId))
.Where(cs => cs.DrawerType == 1)
.ToList();
// 保存数据 盘点记录
SqlSugarHelper.Db.Insertable(new MachineRecord()
{
MachineId = it.MachineId,
DrawerNo = it.DrawerNo,
ColNo = it.ColNo,
DrugId = it.DrugId,
ManuNo = it.ManuNo,
EffDate = !String.IsNullOrEmpty(it.EffDate) ? DateTime.ParseExact(it.EffDate, "yyyy-MM-dd", System.Globalization.CultureInfo.CurrentCulture) : null,
Operator = HomeWindowViewModel.Operator?.Id,
Reviewer = HomeWindowViewModel.Reviewer?.Id,
OperationTime = DateTime.Now,
Quantity = it.CheckQuantity - it.Quantity,
Type = 4,
InvoiceId = InvoiceId
//,StockQuantity = nowChannels.Sum(it => it.Quantity),
//CheckQuantity = it.CheckQuantity
}).ExecuteCommand();
logger.Info($"库存盘点->库位【{it.DrawerNo}-{it.ColNo}】药品【{it.DrugInfo.DrugName}】盘点前库存【{it.Quantity}】,更改后【{it.CheckQuantity}】");
}
return true;
});
if (f.Data)
{
// 更新屏显库存
List<ChannelStock> singleChannels = record.FindAll(it => it.BoardType != 1);
if ((singleChannels.Count > 0 ? singleChannels[0].BoardType : 1) == 5)
{
singleChannels.ForEach(it =>
{
_portUtil.WriteQuantity(it.DrawerNo, it.ColNo, it.CheckQuantity);
});
}
RequestData();
AlertMsg alertMsg = new AlertMsg
{
Message = "抽屉盘点完成,库存已更新",
Type = MsgType.SUCCESS,
};
_eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
}
if (!f.IsSuccess)
{
AlertMsg alertMsg = new AlertMsg
{
Message = "抽屉盘点完成,库存更新失败!",
Type = MsgType.ERROR,
};
_eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
}
Status = 0;
_isFinishClick = false;
}
else
{
_isFinishClick = false;
AlertMsg alertMsg = new AlertMsg
{
Message = "盘点完成,库存无改变",
Type = MsgType.ERROR
};
_eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
Status = 0;
_isFinishClick = false;
}
}, () => Status == 3 && !_isFinishClick).ObservesProperty(() => Status);
}
// 取消按钮
public DelegateCommand CancleTake
{
get => new DelegateCommand(() =>
{
_portUtil.ResetData();
Status = 0;
});
}
public long CurrentTimeMillis()
{
return (long)(DateTime.UtcNow - Jan1st1970).TotalMilliseconds;
}
public bool KeepAlive => false;
public void FindDrawerCount()
{
int count = 0;
if (ConfigurationManager.AppSettings["MultiBatch"].ToString().Equals("1"))
{
count = SqlSugarHelper.Db.Queryable<ChannelList>().Where(cs => cs.DrawerType != 3)
.Where(cs => cs.MachineId.Equals(ConfigurationManager.AppSettings["machineId"] ?? "DM1")).GroupBy(cs => cs.DrawerNo).Select(cs => SqlFunc.AggregateCount(cs.DrawerNo)).Count();
}
else
{
count = SqlSugarHelper.Db.Queryable<ChannelStock>().Where(cs => cs.DrawerType != 3)
.Where(cs => cs.MachineId.Equals(ConfigurationManager.AppSettings["machineId"] ?? "DM1")).GroupBy(cs => cs.DrawerNo).Select(cs => SqlFunc.AggregateCount(cs.DrawerNo)).Count();
}
Is8Drawer = count < 9;
Is16Drawer = count >= 16;
Is17Drawer = count > 16;
}
//这个方法用于拦截请求,continuationCallback(true)就是不拦截continuationCallback(false)拦截本次操作
public void ConfirmNavigationRequest(NavigationContext navigationContext, Action<bool> continuationCallback)
{
continuationCallback(true);
}
public void RequestData()
{
List<ChannelStock> queryData = SqlSugarHelper.Db.Queryable<ChannelStock>()
.Includes(cs => cs.DrugInfo)
.Where(cs => cs.DrawerNo == DrawerNo)
.Where(cs => cs.DrugId != null)
.Where(cs => cs.MachineId.Equals(ConfigurationManager.AppSettings["machineId"] ?? "DM1"))
.OrderBy(cs => cs.ColNo)
.ToList();
ChannelStocks = queryData.Select(it => { it.CheckQuantity = it.Quantity; return it; }).ToList();
}
//接收导航传过来的参数 现在是在此处初始化了表格数据
public void OnNavigatedTo(NavigationContext navigationContext)
{
_eventAggregator.GetEvent<PortUtilEvent>().Subscribe(DoMyPrismEvent);
FindDrawerCount();
RequestData();
}
//每次导航的时候该实列用不用重新创建true是不重新创建,false是重新创建
public bool IsNavigationTarget(NavigationContext navigationContext)
{
return true;
}
//这个方法用于拦截请求
public void OnNavigatedFrom(NavigationContext navigationContext)
{
// 取消消息订阅
_eventAggregator.GetEvent<PortUtilEvent>().Unsubscribe(DoMyPrismEvent);
}
}
}

View File

@ -154,8 +154,8 @@ namespace DM_Weight.ViewModels
}
private void SelectChildNavigate(PremissionDm SelectedChildMenu)
{
if (!_portUtil.Operate)
{
//if (!_portUtil.Operate)
//{
if (SelectedChildMenu != null)
{
if (SelectedChildMenu.PremissionPath.Equals("TakeRecordWindow"))
@ -233,7 +233,7 @@ namespace DM_Weight.ViewModels
}
}
}
}
//}
}
public PremissionDm? SelectedMenu
@ -312,10 +312,10 @@ namespace DM_Weight.ViewModels
{
//SelectedMenu.Children = SelectedMenu.Children;
//SelectedChildMenu = SelectedMenu.Children[0];
if (!_portUtil.Operate)
{
//if (!_portUtil.Operate)
//{
_regionManager.RequestNavigate("ContentRegion", SelectedMenu.Children[0].PremissionPath);
}
//}
}
}
#region

View File

@ -75,14 +75,14 @@ namespace DM_Weight.ViewModels
public UserList Operator { get; set; }
public UserList Reviewer { get; set; }
public bool DrawerPortMsg
{
get => !_portUtil.drawerSerial.IsOpen;
}
public bool CanBusPortMsg
{
get => _portUtil._canBusExsit && !_portUtil.canBusSerial.IsOpen;
}
//public bool DrawerPortMsg
//{
// get => !_portUtil.drawerSerial.IsOpen;
//}
//public bool CanBusPortMsg
//{
// get => _portUtil._canBusExsit && !_portUtil.canBusSerial.IsOpen;
//}
private bool _fingerMsg= CHKFunction.HKUserId>=0;
@ -91,10 +91,10 @@ namespace DM_Weight.ViewModels
get => _fingerMsg;
set => SetProperty(ref _fingerMsg, value);
}
public bool FridgePortMsg
{
get => !_portUtil.fridgeSerial.IsOpen;
}
//public bool FridgePortMsg
//{
// get => !_portUtil.fridgeSerial.IsOpen;
//}
//温湿度
public bool WSDPortMsg
{

View File

@ -282,76 +282,7 @@ namespace DM_Weight.ViewModels
});
}
void DoMyPrismEvent(DeviceMsg msg)
{
switch (msg.EventType)
{
// 药箱打开
case EventType.DRAWEROPEN:
if (Status == 1)
{
Status = 2;
}
//记录开药箱日志
SqlSugarHelper.Db.Insertable(new MachineRecord()
{
MachineId = "DM5",
DrawerNo = _portUtil.DrawerNo,
Operator = HomeWindowViewModel.Operator?.Id,
OperationTime = DateTime.Now,
Type = 55,
InvoiceId = "药箱打开",
}).ExecuteCommand();
_portUtil.GetBoxStatus();
break;
// 药箱关闭
case EventType.DRAWERCLOSE:
//记录药箱操作日志
SqlSugarHelper.Db.Insertable(new MachineRecord()
{
MachineId = "DM5",
DrawerNo = _portUtil.DrawerNo,
Operator = HomeWindowViewModel.Operator?.Id,
OperationTime = DateTime.Now,
Type = 55,
InvoiceId = "药箱关闭",
}).ExecuteCommand();
if (Status == 2)
{
Status = 3;
}
IsEnable = true;
DrawerNo = -1;
_portUtil.Operate = false;
break;
// 打开失败
case EventType.OPENERROR:
AlertMsg alertMsg = new AlertMsg
{
Message = msg.Message,
Type = MsgType.ERROR
};
_eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
IsEnable = true;
DrawerNo = -1;
Status = 0;
//记录药箱操作日志
SqlSugarHelper.Db.Insertable(new MachineRecord()
{
MachineId = "DM5",
DrawerNo = _portUtil.DrawerNo,
Operator = HomeWindowViewModel.Operator?.Id,
OperationTime = DateTime.Now,
Type = 55,
InvoiceId = "药箱打开失败",
}).ExecuteCommand();
_portUtil.Operate = false;
break;
}
}
public DelegateCommand Query
{

View File

@ -1,207 +0,0 @@
<UserControl x:Class="DM_Weight.Views.CheckOrderWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:pagination="clr-namespace:DM_Weight.Components.pagination"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
xmlns:i="http://schemas.microsoft.com/xaml/behaviors"
xmlns:local="clr-namespace:DM_Weight.Views"
mc:Ignorable="d"
xmlns:convert="clr-namespace:DM_Weight.Converter"
xmlns:prism="http://prismlibrary.com/">
<UserControl.Resources>
<Style x:Key="st" TargetType="GridViewColumnHeader">
<Style.Setters>
<Setter Property="Height">
<Setter.Value>55</Setter.Value>
</Setter>
<Setter Property="Background">
<Setter.Value>#31ccec</Setter.Value>
</Setter>
<Setter Property="Foreground">
<Setter.Value>white</Setter.Value>
</Setter>
</Style.Setters>
</Style>
</UserControl.Resources>
<Grid>
<Grid.Resources>
<!--<CollectionViewSource x:Key="GroupedDataList" Source="{Binding OrderDetailList}">
<CollectionViewSource.GroupDescriptions>
<PropertyGroupDescription PropertyName="_OrderInfo" />
</CollectionViewSource.GroupDescriptions>
</CollectionViewSource>-->
<convert:GroupSumConverter x:Key="GroupSumConverter" />
<convert:StatusConverter x:Key="StatusConverter" />
</Grid.Resources>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Grid Margin="0 6 0 6" Grid.Row="0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="2*" />
<ColumnDefinition Width="3*" />
<ColumnDefinition Width="5*"/>
</Grid.ColumnDefinitions>
<DatePicker
Grid.Column="0"
SelectedDate="{Binding OrderDate, StringFormat=yyyy-MM-dd, TargetNullValue='',UpdateSourceTrigger=PropertyChanged}"
SelectedDateFormat="Short"
Margin="6 0 0 0"
materialDesign:HintAssist.Hint="开方日期"
Style="{StaticResource MaterialDesignOutlinedDatePicker}" />
<StackPanel Grid.Column="2" Orientation="Horizontal" HorizontalAlignment="Right">
<Button
Margin="0 0 6 0"
VerticalAlignment="Center"
Style="{StaticResource MaterialDesignOutlinedLightButton}"
ToolTip="刷新" Command="{Binding Query}">
<materialDesign:PackIcon
Kind="Refresh" />
</Button>
<Button
Margin="6 0 16 0"
VerticalAlignment="Center"
IsEnabled="{Binding BtnEnable}"
Command="{Binding ConfirmCommand}"
Content="确认"
materialDesign:ButtonProgressAssist.IsIndicatorVisible="{Binding Status, Converter={StaticResource StatusConverter}, ConverterParameter=opearBtnLoading}"
materialDesign:ButtonProgressAssist.IsIndeterminate="{Binding Status, Converter={StaticResource StatusConverter}, ConverterParameter=opearBtnLoading}"
Style="{StaticResource MaterialDesignOutlinedLightButton}"/>
</StackPanel>
</Grid>
<DataGrid
Grid.Row="1"
materialDesign:DataGridAssist.ColumnHeaderPadding="15"
ItemsSource="{Binding OrderDetailList}"
SelectedItem="SelectDrugPleaseClaim"
materialDesign:DataGridAssist.EnableEditBoxAssist="False"
IsSynchronizedWithCurrentItem="True"
materialDesign:DataGridAssist.CellPadding="13"
CanUserAddRows="False"
AutoGenerateColumns="False">
<DataGrid.Resources>
<Style TargetType="{x:Type DataGridColumnHeader}" BasedOn="{StaticResource MaterialDesignDataGridColumnHeader}">
<Setter Property="Background" Value="#31ccec" />
<Setter Property="Foreground" Value="white" />
<Setter Property="Height" Value="56" />
<Setter Property="BorderBrush" Value="white"/>
<Setter Property="BorderThickness" Value="0.6"/>
<Setter Property="HorizontalContentAlignment" Value="Center"/>
</Style>
<Style TargetType="{x:Type DataGridCell}" BasedOn="{StaticResource MaterialDesignDataGridCell}">
<Style.Triggers>
<Trigger Property="IsReadOnly" Value="True">
<Setter Property="BorderBrush" Value="Transparent" />
<Setter Property="HorizontalAlignment" Value="Left"/>
</Trigger>
</Style.Triggers>
</Style>
</DataGrid.Resources>
<!--GroupStyle to group data-->
<DataGrid.GroupStyle>
<GroupStyle>
<!--Group DataItems into DataGroup-->
<GroupStyle.ContainerStyle>
<Style TargetType="{x:Type GroupItem}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type GroupItem}">
<Expander IsExpanded="True"
materialDesign:ExpanderAssist.HeaderBackground="PaleTurquoise">
<Expander.Header >
<StackPanel Orientation="Horizontal">
<CheckBox IsChecked="{Binding Path=Name.ItemIsChecked}" FontSize="24" />
<TextBlock Text="{Binding Path=Name.OrderNo,StringFormat=处方号:{0}}" FontWeight="Bold" />
<TextBlock Text="{Binding Path=Name.PatientId,StringFormat=患者ID{0}}" FontWeight="Bold" />
<TextBlock FontWeight="Bold" Text="{Binding Path=Name.PName,StringFormat=姓名:{0}}" />
<TextBlock FontWeight="Bold" Text="{Binding Path=Name.Sex,StringFormat=性别:{0}}" />
<TextBlock FontWeight="Bold" Text="{Binding Path=Name.Age,StringFormat=年龄:{0}}" />
<TextBlock FontWeight="Bold" Text="{Binding Path=Name.IdNumber,StringFormat=身份证:{0}}" />
<TextBlock FontWeight="Bold" Text="{Binding Path=Items,Converter={StaticResource GroupSumConverter}}" />
</StackPanel>
</Expander.Header>
<ItemsPresenter/>
</Expander>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</GroupStyle.ContainerStyle>
</GroupStyle>
</DataGrid.GroupStyle>
<DataGrid.Columns>
<DataGridTextColumn Width="180"
Binding="{Binding DrugInfo.DrugName}"
Header="药品名称"
IsReadOnly="True"
ElementStyle="{StaticResource MaterialDesignDataGridTextColumnStyle}"/>
<DataGridTextColumn Width="130"
Binding="{Binding DrugInfo.DrugSpec}"
Header="规格"
IsReadOnly="True"
ElementStyle="{StaticResource MaterialDesignDataGridTextColumnStyle}"/>
<DataGridTextColumn Width="241"
Binding="{Binding DrugInfo.Manufactory}"
Header="厂家"
IsReadOnly="True"
ElementStyle="{StaticResource MaterialDesignDataGridTextColumnStyle}"/>
<DataGridTextColumn Width="241"
Binding="{Binding SetManuNo}"
Header="批次"
IsReadOnly="True"
ElementStyle="{StaticResource MaterialDesignDataGridTextColumnStyle}"/>
<DataGridTextColumn Width="241"
Binding="{Binding SetEffDate}"
Header="效期"
IsReadOnly="True"
ElementStyle="{StaticResource MaterialDesignDataGridTextColumnStyle}"/>
<DataGridTextColumn Width="241"
Binding="{Binding Quantity}"
Header="数量"
IsReadOnly="True"
ElementStyle="{StaticResource MaterialDesignDataGridTextColumnStyle}"/>
<!--<DataGridTemplateColumn Header="批次" IsReadOnly="True">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<ListBox ItemsSource="{Binding SetManuNo}" DisplayMemberPath="SetManuNo" materialDesign:ListBoxItemAssist.ShowSelection="False"></ListBox>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTemplateColumn Header="效期" IsReadOnly="True">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<ListBox ItemsSource="{Binding SetEffDate}" DisplayMemberPath="SetManuNo" materialDesign:ListBoxItemAssist.ShowSelection="False"></ListBox>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTemplateColumn Header="数量" IsReadOnly="True">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<ListBox ItemsSource="{Binding Quantity}" DisplayMemberPath="Quantity" materialDesign:ListBoxItemAssist.ShowSelection="False"></ListBox>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>-->
</DataGrid.Columns>
</DataGrid>
<!--<pagination:Pagination Grid.Row="2" Grid.ColumnSpan="3"
CurrentPage="{Binding PageNum}"
PageSize="{Binding PageSize}"
TotalPages="{Binding TotalCount}"
InfoTextIsEnabel="True"
/>-->
</Grid>
</UserControl>

View File

@ -1,28 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
namespace DM_Weight.Views
{
/// <summary>
/// CheckOrderWindow.xaml 的交互逻辑
/// </summary>
public partial class CheckOrderWindow : UserControl
{
public CheckOrderWindow()
{
InitializeComponent();
}
}
}

View File

@ -1,314 +0,0 @@
<UserControl x:Class="DM_Weight.Views.CheckStockWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:DM_Weight.Views"
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
xmlns:i="http://schemas.microsoft.com/xaml/behaviors"
xmlns:convert="clr-namespace:DM_Weight.Converter"
mc:Ignorable="d">
<UserControl.Resources>
<convert:DrawerSelectConverter x:Key="DrawerSelectConverter" />
<convert:StatusConverter x:Key="StatusConverter" />
</UserControl.Resources>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<Grid Margin="0" Grid.Column="0" Width="280" Height="570" Visibility="{Binding Is8Drawer, Converter={StaticResource BooleanToVisibilityConverter}}">
<Grid.Background>
<ImageBrush ImageSource="/Images/box.png" />
</Grid.Background>
<Grid.RowDefinitions>
<RowDefinition Height="200" />
<RowDefinition />
</Grid.RowDefinitions>
<Grid Grid.Row="1">
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
<RowDefinition />
<RowDefinition />
<RowDefinition />
<RowDefinition />
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>
<Grid.Resources>
<Style TargetType="{x:Type Button}" BasedOn="{StaticResource MaterialDesignPaperLightButton}">
<Setter Property="Foreground" Value="#00a0ea" />
<Setter Property="BorderBrush" Value="#00a0ea" />
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" Value="#d1e7f5" />
<Setter Property="BorderBrush" Value="#d1e7f5" />
</Trigger>
<DataTrigger Value="True">
<DataTrigger.Binding>
<MultiBinding Converter="{StaticResource DrawerSelectConverter}">
<Binding RelativeSource="{ RelativeSource Mode=Self }" Path="Content" />
<Binding Path="DrawerNo" />
</MultiBinding>
</DataTrigger.Binding>
<Setter Property="Background" Value="#d1e7f5" />
<Setter Property="BorderBrush" Value="#d1e7f5" />
</DataTrigger>
</Style.Triggers>
</Style>
</Grid.Resources>
<Button Grid.Row="0" Width="210" Content="1" Command="{Binding UpdateDrawerNo}" CommandParameter="1" />
<Button Grid.Row="1" Width="210" Content="2" Command="{Binding UpdateDrawerNo}" CommandParameter="2" />
<Button Grid.Row="2" Width="210" Content="3" Command="{Binding UpdateDrawerNo}" CommandParameter="3" />
<Button Grid.Row="3" Width="210" Content="4" Command="{Binding UpdateDrawerNo}" CommandParameter="4" />
<Button Grid.Row="4" Width="210" Content="5" Command="{Binding UpdateDrawerNo}" CommandParameter="5" />
<Button Grid.Row="5" Width="210" Content="6" Command="{Binding UpdateDrawerNo}" CommandParameter="6" />
<Button Grid.Row="6" Width="210" Content="7" Command="{Binding UpdateDrawerNo}" CommandParameter="7" />
<Button Grid.Row="7" Width="210" Content="8" Command="{Binding UpdateDrawerNo}" CommandParameter="8" />
</Grid>
</Grid>
<Grid Margin="0" Grid.Column="0" Width="300" Height="570" Visibility="{Binding Is16Drawer, Converter={StaticResource BooleanToVisibilityConverter}}">
<Grid.Resources>
<Style TargetType="{x:Type Button}" BasedOn="{StaticResource MaterialDesignPaperLightButton}">
<Setter Property="Foreground" Value="#00a0ea" />
<Setter Property="BorderBrush" Value="#00a0ea" />
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" Value="#d1e7f5" />
<Setter Property="BorderBrush" Value="#d1e7f5" />
</Trigger>
<DataTrigger Value="True">
<DataTrigger.Binding>
<MultiBinding Converter="{StaticResource DrawerSelectConverter}">
<Binding RelativeSource="{ RelativeSource Mode=Self }" Path="Content" />
<Binding Path="DrawerNo" />
</MultiBinding>
</DataTrigger.Binding>
<Setter Property="Background" Value="#d1e7f5" />
<Setter Property="BorderBrush" Value="#d1e7f5" />
</DataTrigger>
</Style.Triggers>
</Style>
</Grid.Resources>
<Grid.Background>
<ImageBrush ImageSource="/Images/box-16.jpg" />
</Grid.Background>
<Grid.RowDefinitions>
<RowDefinition Height="200" />
<RowDefinition />
</Grid.RowDefinitions>
<Grid Margin="10 0 0 0" Visibility="{Binding Is17Drawer, Converter={StaticResource BooleanToVisibilityConverter}}" Grid.Row="0">
<Button Width="110" Content="17" HorizontalAlignment="Left" Command="{Binding UpdateDrawerNo}" CommandParameter="17" />
</Grid>
<Grid Grid.Row="1">
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
<RowDefinition />
<RowDefinition />
<RowDefinition />
<RowDefinition />
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<Button Grid.Row="0" Grid.Column="0" Width="120" Content="1" Command="{Binding UpdateDrawerNo}" CommandParameter="1" />
<Button Grid.Row="1" Grid.Column="0" Width="120" Content="2" Command="{Binding UpdateDrawerNo}" CommandParameter="2" />
<Button Grid.Row="2" Grid.Column="0" Width="120" Content="3" Command="{Binding UpdateDrawerNo}" CommandParameter="3" />
<Button Grid.Row="3" Grid.Column="0" Width="120" Content="4" Command="{Binding UpdateDrawerNo}" CommandParameter="4" />
<Button Grid.Row="4" Grid.Column="0" Width="120" Content="5" Command="{Binding UpdateDrawerNo}" CommandParameter="5" />
<Button Grid.Row="5" Grid.Column="0" Width="120" Content="6" Command="{Binding UpdateDrawerNo}" CommandParameter="6" />
<Button Grid.Row="6" Grid.Column="0" Width="120" Content="7" Command="{Binding UpdateDrawerNo}" CommandParameter="7" />
<Button Grid.Row="7" Grid.Column="0" Width="120" Content="8" Command="{Binding UpdateDrawerNo}" CommandParameter="8" />
<Button Grid.Row="0" Grid.Column="1" Width="120" Content="9" Command="{Binding UpdateDrawerNo}" CommandParameter="9" />
<Button Grid.Row="1" Grid.Column="1" Width="120" Content="10" Command="{Binding UpdateDrawerNo}" CommandParameter="10" />
<Button Grid.Row="2" Grid.Column="1" Width="120" Content="11" Command="{Binding UpdateDrawerNo}" CommandParameter="11" />
<Button Grid.Row="3" Grid.Column="1" Width="120" Content="12" Command="{Binding UpdateDrawerNo}" CommandParameter="12" />
<Button Grid.Row="4" Grid.Column="1" Width="120" Content="13" Command="{Binding UpdateDrawerNo}" CommandParameter="13" />
<Button Grid.Row="5" Grid.Column="1" Width="120" Content="14" Command="{Binding UpdateDrawerNo}" CommandParameter="14" />
<Button Grid.Row="6" Grid.Column="1" Width="120" Content="15" Command="{Binding UpdateDrawerNo}" CommandParameter="15" />
<Button Grid.Row="7" Grid.Column="1" Width="120" Content="16" Command="{Binding UpdateDrawerNo}" CommandParameter="16" />
</Grid>
</Grid>
<Grid Grid.Column="1" Margin="6">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition />
</Grid.RowDefinitions>
<StackPanel Grid.Row="0" Orientation="Horizontal" HorizontalAlignment="Right">
<Button
Margin="0 0 3 0"
VerticalAlignment="Center"
Command="{Binding OpenDrawer}"
Visibility="{Binding Status,Converter={StaticResource StatusConverter}, ConverterParameter=opearBtnVisible}"
materialDesign:ButtonProgressAssist.IsIndicatorVisible="{Binding Status, Converter={StaticResource StatusConverter}, ConverterParameter=opearBtnLoading}"
materialDesign:ButtonProgressAssist.IsIndeterminate="{Binding Status, Converter={StaticResource StatusConverter}, ConverterParameter=opearBtnLoading}"
Style="{StaticResource MaterialDesignOutlinedLightButton}"
Content="盘点" />
<Button
Margin="0 0 3 0"
VerticalAlignment="Center"
Command="{Binding TakeFinish}"
Visibility="{Binding Status, Converter={StaticResource StatusConverter}, ConverterParameter=CompleteBtn}"
Style="{StaticResource MaterialDesignOutlinedLightButton}"
Content="完成" />
<Button
Margin="0 0 6 0"
VerticalAlignment="Center"
Command="{Binding CancleTake}"
Visibility="{Binding Status, Converter={StaticResource StatusConverter}, ConverterParameter=CancelBtn}"
Style="{StaticResource MaterialDesignOutlinedLightButton}"
Content="取消" />
</StackPanel>
<DataGrid
Padding="0 6 0 0"
Grid.Row="1"
materialDesign:DataGridAssist.ColumnHeaderPadding="15"
ItemsSource="{Binding ChannelStocks}"
materialDesign:DataGridAssist.EnableEditBoxAssist="False"
materialDesign:DataGridAssist.CellPadding="13"
SelectionUnit="Cell"
CanUserAddRows="False"
AutoGenerateColumns="False">
<DataGrid.Resources>
<Style TargetType="{x:Type DataGridColumnHeader}" BasedOn="{StaticResource MaterialDesignDataGridColumnHeader}">
<Setter Property="Background" Value="#31ccec" />
<Setter Property="Foreground" Value="white" />
<Setter Property="Height" Value="56" />
<Setter Property="BorderBrush" Value="white"/>
<Setter Property="BorderThickness" Value="0.6"/>
<Setter Property="HorizontalContentAlignment" Value="Center"/>
</Style>
<Style TargetType="{x:Type DataGridCell}" BasedOn="{StaticResource MaterialDesignDataGridCell}">
<Style.Triggers>
<Trigger Property="IsReadOnly" Value="True">
<Setter Property="BorderBrush" Value="Transparent" />
<Setter Property="HorizontalAlignment" Value="Left"/>
</Trigger>
</Style.Triggers>
</Style>
</DataGrid.Resources>
<DataGrid.Columns>
<DataGridTextColumn Width="100"
Binding="{Binding ColNo}"
Header="库位"
IsReadOnly="True"
ElementStyle="{StaticResource MaterialDesignDataGridTextColumnStyle}"/>
<DataGridTextColumn Width="130"
Binding="{Binding DrugInfo.DrugName}"
Header="药品名称"
IsReadOnly="True"
ElementStyle="{StaticResource MaterialDesignDataGridTextColumnStyle}"/>
<DataGridTextColumn Width="100"
Binding="{Binding DrugInfo.DrugSpec}"
Header="规格"
IsReadOnly="True"
ElementStyle="{StaticResource MaterialDesignDataGridTextColumnStyle}"/>
<DataGridTextColumn Width="100"
Binding="{Binding ManuNo}"
Header="批次"
IsReadOnly="True"
ElementStyle="{StaticResource MaterialDesignDataGridTextColumnStyle}"/>
<DataGridTextColumn Width="100"
Binding="{Binding EffDate}"
Header="效期"
IsReadOnly="True"
ElementStyle="{StaticResource MaterialDesignDataGridTextColumnStyle}"/>
<DataGridTextColumn Width="100"
Binding="{Binding Quantity}"
Header="库存"
IsReadOnly="True"
ElementStyle="{StaticResource MaterialDesignDataGridTextColumnStyle}"/>
<!--<DataGridTextColumn
Header="盘点数量"
ElementStyle="{StaticResource MaterialDesignDataGridTextColumnStyle}">
<DataGridTextColumn.Binding>
<Binding Path="CheckQuantity" Mode="TwoWay" UpdateSourceTrigger="PropertyChanged">
<Binding.ValidationRules>
<ExceptionValidationRule />
</Binding.ValidationRules>
</Binding>
</DataGridTextColumn.Binding>
</DataGridTextColumn>-->
<DataGridTemplateColumn Width="100"
Header="盘点数量">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<TextBox Style="{StaticResource MaterialDesignDataGridTextColumnEditingStyle}">
<TextBox.Text>
<Binding Path="CheckQuantity" Mode="TwoWay" UpdateSourceTrigger="PropertyChanged">
<Binding.ValidationRules>
<ExceptionValidationRule />
</Binding.ValidationRules>
</Binding>
</TextBox.Text>
</TextBox>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
</DataGrid.Columns>
</DataGrid>
<!--<ListView
Grid.Row="1"
ItemsSource="{Binding ChannelStocks}"
materialDesign:ListViewAssist.HeaderRowBackground="#31ccec">
<ListView.Resources>
<Style TargetType="{x:Type GridViewColumnHeader}" BasedOn="{StaticResource {x:Type GridViewColumnHeader}}">
<Setter Property="Foreground" Value="White" />
</Style>
</ListView.Resources>
<ListView.View>
<GridView>
<GridView.Columns>
<GridViewColumn
Header="库位"
DisplayMemberBinding="{Binding ColNo}"/>
<GridViewColumn
Header="药品名称"
DisplayMemberBinding="{Binding DrugInfo.DrugName}" />
<GridViewColumn
Header="规格"
DisplayMemberBinding="{Binding DrugInfo.DrugSpec}" />
<GridViewColumn
Header="批次"
DisplayMemberBinding="{Binding ManuNo}" />
<GridViewColumn
Header="效期"
DisplayMemberBinding="{Binding EffDate}" />
<GridViewColumn
Header="当前库存"
DisplayMemberBinding="{Binding Quantity}" />
<GridViewColumn
Header="盘点数量">
<GridViewColumn.CellTemplate>
<DataTemplate>
<TextBox
Width="80"
Padding="10"
Grid.Column="1"
Text="{Binding CheckQuantity}"
materialDesign:HintAssist.Hint="添加数量"
Style="{StaticResource MaterialDesignOutlinedTextBox}"/>
</DataTemplate>
</GridViewColumn.CellTemplate>
</GridViewColumn>
</GridView.Columns>
</GridView>
</ListView.View>
</ListView>-->
</Grid>
</Grid>
</UserControl>

View File

@ -1,28 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
namespace DM_Weight.Views
{
/// <summary>
/// CheckStockWindow.xaml 的交互逻辑
/// </summary>
public partial class CheckStockWindow : UserControl
{
public CheckStockWindow()
{
InitializeComponent();
}
}
}