添加药品移动至其药箱、替换其他药箱药品
This commit is contained in:
parent
39ad688a43
commit
e6b300ed00
|
|
@ -293,6 +293,13 @@ namespace DM_Weight
|
||||||
containerRegistry.RegisterForNavigation<CheckStockWindow, CheckStockWindowViewModel>();
|
containerRegistry.RegisterForNavigation<CheckStockWindow, CheckStockWindowViewModel>();
|
||||||
containerRegistry.RegisterDialog<ConfirmDialog>();
|
containerRegistry.RegisterDialog<ConfirmDialog>();
|
||||||
containerRegistry.RegisterForNavigation<ConfirmDialog, ConfirmDialogViewModel>();
|
containerRegistry.RegisterForNavigation<ConfirmDialog, ConfirmDialogViewModel>();
|
||||||
|
|
||||||
|
//药品转移药箱
|
||||||
|
containerRegistry.RegisterForNavigation<ExchangeWindow, ExchangeWindowViewModel>();
|
||||||
|
containerRegistry.RegisterForNavigation<ExchangeDialog, ExchangeDialogViewModel>();
|
||||||
|
containerRegistry.RegisterForNavigation<RemoveDialog, RemoveDialogViewModel>();
|
||||||
|
containerRegistry.RegisterDialog<ExchangeDialog>();
|
||||||
|
containerRegistry.RegisterDialog<RemoveDialog>();
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
// 设备记录页面
|
// 设备记录页面
|
||||||
|
|
|
||||||
|
|
@ -210,7 +210,7 @@ namespace DM_Weight.Models
|
||||||
[SugarColumn(ColumnName = "drug_manu_no")]
|
[SugarColumn(ColumnName = "drug_manu_no")]
|
||||||
public string DrugSpec { get=> _drugSpec;set=>SetProperty(ref _drugSpec, value); }
|
public string DrugSpec { get=> _drugSpec;set=>SetProperty(ref _drugSpec, value); }
|
||||||
|
|
||||||
|
//药箱对应药品基数
|
||||||
[SugarColumn(ColumnName = "Stock_Quantity")]
|
[SugarColumn(ColumnName = "Stock_Quantity")]
|
||||||
public int BaseQuantity
|
public int BaseQuantity
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -73,7 +73,7 @@ namespace DM_Weight.Models
|
||||||
[SugarColumn(ColumnName = "eff_date")]
|
[SugarColumn(ColumnName = "eff_date")]
|
||||||
public DateTime? EffDate { get; set; }
|
public DateTime? EffDate { get; set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 出库入库类型(1入库2出库31还药32还空瓶)
|
/// 出库入库类型(1入库2出库31还药32还空瓶,21药箱移出移入,69药箱替换)
|
||||||
///</summary>
|
///</summary>
|
||||||
[SugarColumn(ColumnName = "type")]
|
[SugarColumn(ColumnName = "type")]
|
||||||
public int Type { get; set; }
|
public int Type { get; set; }
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,39 @@
|
||||||
|
using SqlSugar;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace DM_Weight.Models
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 药箱药品移动记录表
|
||||||
|
/// </summary>
|
||||||
|
[SugarTable("move_channel_stock")]
|
||||||
|
public class MoveChannelStock
|
||||||
|
{
|
||||||
|
//[SugarColumn(ColumnName ="id",IsPrimaryKey =true)]
|
||||||
|
//public int Id { get; set; }
|
||||||
|
[SugarColumn(ColumnName = "machine_id")]
|
||||||
|
public string MachineId{get;set;}
|
||||||
|
[SugarColumn(ColumnName = "drug_id")]
|
||||||
|
public string DrugId { get; set; }
|
||||||
|
[SugarColumn(ColumnName = "quantity")]
|
||||||
|
public int Quantity { get; set; }
|
||||||
|
[SugarColumn(ColumnName = "From_manu_no")]
|
||||||
|
public string FromManuNo { get; set; }
|
||||||
|
[SugarColumn(ColumnName = "operator")]
|
||||||
|
public int? Operator { get; set; }
|
||||||
|
[SugarColumn(ColumnName = "reviewer")]
|
||||||
|
public int? Reviewer { get; set; }
|
||||||
|
[SugarColumn(ColumnName = "type")]
|
||||||
|
public int Type { get; set; }
|
||||||
|
[SugarColumn(ColumnName = "FromDrawer")]
|
||||||
|
public int FromDrawer { get; set; }
|
||||||
|
[SugarColumn(ColumnName = "ToDrawer")]
|
||||||
|
public int ToDrawer { get; set; }
|
||||||
|
[SugarColumn(ColumnName = "To_manu_no")]
|
||||||
|
public string ToManuNo { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -1050,6 +1050,33 @@ namespace DM_Weight.ViewModels
|
||||||
//更新处方状态
|
//更新处方状态
|
||||||
if (oi.DmStatus == 0)
|
if (oi.DmStatus == 0)
|
||||||
{
|
{
|
||||||
|
//查询该药箱是否有该批次的药品,没有则无法确认(避免管理进行确认时确认不过去)
|
||||||
|
if(oi.OrderDetailList!=null)
|
||||||
|
{
|
||||||
|
for (int j = 0; j < oi.OrderDetailList.Count; j++)
|
||||||
|
{
|
||||||
|
oi._OrderDetail = oi.OrderDetailList[j];
|
||||||
|
int drawerNo = DrawerNo + 1;
|
||||||
|
ChannelStock cs = SqlSugarHelper.Db.Queryable<ChannelStock>()
|
||||||
|
.Where(cs => cs.DrugId == oi._OrderDetail.DrugId
|
||||||
|
&& cs.ManuNo == oi._OrderDetail.SetManuNo
|
||||||
|
&& cs.MachineId.Equals(ConfigurationManager.AppSettings["machineId"] ?? "DM5")
|
||||||
|
&& cs.DrawerNo == drawerNo).First();
|
||||||
|
if (cs == null)
|
||||||
|
{
|
||||||
|
AlertMsg alertMsg = new AlertMsg
|
||||||
|
{
|
||||||
|
Message = $"处方{oi.OrderNo}应药品批次{oi._OrderDetail.SetManuNo}无库存,无法确认",
|
||||||
|
Type = MsgType.ERROR,
|
||||||
|
};
|
||||||
|
_eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
SqlSugarHelper.Db.Updateable(new OrderInfo()
|
SqlSugarHelper.Db.Updateable(new OrderInfo()
|
||||||
{
|
{
|
||||||
DmStatus = 1,
|
DmStatus = 1,
|
||||||
|
|
|
||||||
|
|
@ -56,6 +56,12 @@ namespace DM_Weight.ViewModels
|
||||||
get => _channelStocks;
|
get => _channelStocks;
|
||||||
set => SetProperty(ref _channelStocks, value);
|
set => SetProperty(ref _channelStocks, value);
|
||||||
}
|
}
|
||||||
|
private ChannelStock _channelStock;
|
||||||
|
public ChannelStock _ChannelStock
|
||||||
|
{
|
||||||
|
get => _channelStock;
|
||||||
|
set => SetProperty(ref _channelStock, value);
|
||||||
|
}
|
||||||
private bool _isEnable = true;
|
private bool _isEnable = true;
|
||||||
public bool IsEnable { get => _isEnable; set => SetProperty(ref _isEnable, value); }
|
public bool IsEnable { get => _isEnable; set => SetProperty(ref _isEnable, value); }
|
||||||
private int _status = 0;
|
private int _status = 0;
|
||||||
|
|
@ -244,5 +250,16 @@ namespace DM_Weight.ViewModels
|
||||||
{
|
{
|
||||||
get => new DelegateCommand(RequestData);
|
get => new DelegateCommand(RequestData);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public DelegateCommand RowSelected
|
||||||
|
{
|
||||||
|
get => new DelegateCommand(() =>
|
||||||
|
{
|
||||||
|
if (_channelStock != null)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,470 @@
|
||||||
|
using Common.Logging;
|
||||||
|
using DM_Weight.Models;
|
||||||
|
using DM_Weight.msg;
|
||||||
|
using DM_Weight.Port;
|
||||||
|
using DM_Weight.select;
|
||||||
|
using DM_Weight.util;
|
||||||
|
using Prism.Commands;
|
||||||
|
using Prism.Events;
|
||||||
|
using Prism.Mvvm;
|
||||||
|
using Prism.Regions;
|
||||||
|
using Prism.Services.Dialogs;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace DM_Weight.ViewModels
|
||||||
|
{
|
||||||
|
public class ExchangeDialogViewModel : BindableBase, IDialogAware, IRegionMemberLifetime
|
||||||
|
{
|
||||||
|
private readonly ILog logger = LogManager.GetLogger(typeof(RemoveDialogViewModel));
|
||||||
|
public string Title => "替换药品";
|
||||||
|
|
||||||
|
public event Action<IDialogResult> RequestClose;
|
||||||
|
|
||||||
|
private static readonly DateTime Jan1st1970 = new DateTime
|
||||||
|
(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);
|
||||||
|
|
||||||
|
IEventAggregator _eventAggregator;
|
||||||
|
|
||||||
|
private List<ChannelStock> _channelStocks = new();
|
||||||
|
public List<ChannelStock> _ChannelStocks
|
||||||
|
{
|
||||||
|
get => _channelStocks;
|
||||||
|
set { SetProperty(ref _channelStocks, value); }
|
||||||
|
}
|
||||||
|
|
||||||
|
private ChannelStock _csStock;
|
||||||
|
public ChannelStock _ChannelStock
|
||||||
|
{
|
||||||
|
get { return _csStock; }
|
||||||
|
set { SetProperty(ref _csStock, value); }
|
||||||
|
}
|
||||||
|
SocketHelper _socketHelper;
|
||||||
|
public ExchangeDialogViewModel(IEventAggregator eventAggregator, SocketHelper socketHelper)
|
||||||
|
{
|
||||||
|
_eventAggregator = eventAggregator;
|
||||||
|
_socketHelper = socketHelper;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private int _status = 0;
|
||||||
|
|
||||||
|
public int Status
|
||||||
|
{
|
||||||
|
get => _status; set => SetProperty(ref _status, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static List<OrderTakeSelect> StaticSelects = new List<OrderTakeSelect>()
|
||||||
|
{
|
||||||
|
new OrderTakeSelect{Name="一号手术间",Code="1"},
|
||||||
|
new OrderTakeSelect{Name="二号手术间",Code="2"},
|
||||||
|
new OrderTakeSelect{Name="三号手术间",Code="3"},
|
||||||
|
new OrderTakeSelect{Name="四号手术间",Code="4"},
|
||||||
|
new OrderTakeSelect{Name="五号手术间",Code="5"},
|
||||||
|
new OrderTakeSelect{Name="六号手术间",Code="6"},
|
||||||
|
new OrderTakeSelect{Name="七号手术间",Code="7"},
|
||||||
|
new OrderTakeSelect{Name="八号手术间",Code="8"},
|
||||||
|
new OrderTakeSelect{Name="九号手术间",Code="9"},
|
||||||
|
new OrderTakeSelect{Name="十号手术间",Code="10"},
|
||||||
|
new OrderTakeSelect{Name="十一号手术间",Code="11"},
|
||||||
|
new OrderTakeSelect{Name="十二号手术间",Code="12"},
|
||||||
|
new OrderTakeSelect{Name="十三号手术间",Code="13"},
|
||||||
|
new OrderTakeSelect{Name="十四号手术间",Code="14"},
|
||||||
|
new OrderTakeSelect{Name="十五号手术间",Code="15"},
|
||||||
|
new OrderTakeSelect{Name="十六号手术间",Code="16"},
|
||||||
|
new OrderTakeSelect{Name="十七号手术间",Code="17"},
|
||||||
|
new OrderTakeSelect{Name="十八号手术间",Code="18"},
|
||||||
|
};
|
||||||
|
|
||||||
|
private List<OrderTakeSelect> _selects = StaticSelects;
|
||||||
|
|
||||||
|
public List<OrderTakeSelect> Selects
|
||||||
|
{
|
||||||
|
get { return _selects; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
SetProperty(ref _selects, value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private OrderTakeSelect _selectedItem = StaticSelects[0];
|
||||||
|
public OrderTakeSelect SelectedItem
|
||||||
|
{
|
||||||
|
get => _selectedItem;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
RequestData(value.Code);
|
||||||
|
SetProperty(ref _selectedItem, value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//去掉移出的药箱号
|
||||||
|
private OrderTakeSelect _removeItem = new();
|
||||||
|
public OrderTakeSelect RemoveItem
|
||||||
|
{
|
||||||
|
get => _removeItem;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
SetProperty(ref _removeItem, value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool CanCloseDialog()
|
||||||
|
{
|
||||||
|
return Status == 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void OnDialogClosed()
|
||||||
|
{
|
||||||
|
Selects.Insert(_ChannelStock.DrawerNo - 1, RemoveItem);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void OnDialogOpened(IDialogParameters parameters)
|
||||||
|
{
|
||||||
|
ChannelStock _csStock = parameters.GetValue<ChannelStock>("csStock");
|
||||||
|
_ChannelStock = _csStock;
|
||||||
|
RemoveItem = Selects[_ChannelStock.DrawerNo - 1];
|
||||||
|
Selects.Remove(RemoveItem);
|
||||||
|
|
||||||
|
//RequestData();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void RequestData(string code)
|
||||||
|
{
|
||||||
|
_ChannelStocks = SqlSugarHelper.Db.Queryable<ChannelStock>()
|
||||||
|
.Where(cl => cl.MachineId == "DM5")
|
||||||
|
.WhereIF(!string.IsNullOrEmpty(code), cl => cl.DrawerNo == Convert.ToInt32(code))
|
||||||
|
.Where(cl => cl.DrawerType == 1)
|
||||||
|
.Where(cl => cl.DrugId == _ChannelStock.DrugId && cl.ManuNo != _ChannelStock.ManuNo)
|
||||||
|
.Includes<DrugInfo>(cs => cs.DrugInfo)
|
||||||
|
.ToList();
|
||||||
|
}
|
||||||
|
//开药盒
|
||||||
|
public DelegateCommand OpenDrawer
|
||||||
|
{
|
||||||
|
get => new DelegateCommand(async () =>
|
||||||
|
{
|
||||||
|
if (SelectedItem.Code != null)
|
||||||
|
{
|
||||||
|
await OpenBox();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
AlertMsg alertMsg = new AlertMsg
|
||||||
|
{
|
||||||
|
Message = "请选择要替换的药箱!",
|
||||||
|
Type = MsgType.ERROR,
|
||||||
|
};
|
||||||
|
_eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
|
||||||
|
}
|
||||||
|
|
||||||
|
}, () => Status == 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task OpenBox()
|
||||||
|
{
|
||||||
|
if (_socketHelper.OpenStatus)
|
||||||
|
{
|
||||||
|
_socketHelper.speechSynthesizer.SpeakAsyncCancelAll();
|
||||||
|
_socketHelper.speechSynthesizer.Resume();
|
||||||
|
_socketHelper.SpeakAsync("请关闭手术间后再打开");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
MachineRecord machineRecord = new MachineRecord();
|
||||||
|
machineRecord.MachineId = "DM5";
|
||||||
|
machineRecord.DrawerNo = Convert.ToInt32(SelectedItem.Code);
|
||||||
|
machineRecord.Operator = HomeWindowViewModel.Operator?.Id;
|
||||||
|
machineRecord.OperationTime = DateTime.Now;
|
||||||
|
machineRecord.Type = 55;
|
||||||
|
machineRecord.InvoiceId = $"打开{Convert.ToInt32(SelectedItem.Code)}号手术间";
|
||||||
|
|
||||||
|
|
||||||
|
if (Convert.ToInt32(SelectedItem.Code) > 0)
|
||||||
|
{
|
||||||
|
Status = 1;
|
||||||
|
_socketHelper.speechSynthesizer.SpeakAsyncCancelAll();
|
||||||
|
_socketHelper.speechSynthesizer.Resume();
|
||||||
|
_socketHelper.SpeakAsync($"正在打开{SelectedItem.Code}号手术间");
|
||||||
|
logger.Info($"正在打开{SelectedItem.Code}号手术间");
|
||||||
|
//记录开药箱日志
|
||||||
|
SqlSugarHelper.Db.Insertable(machineRecord).ExecuteCommand();
|
||||||
|
try
|
||||||
|
{
|
||||||
|
_socketHelper.SendMessage(new MyBaseMessage() { lockNo = (short)(Convert.ToInt32(SelectedItem.Code) - 1) });
|
||||||
|
_socketHelper.dateTime = DateTime.Now;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
AlertMsg alertMsg = new AlertMsg
|
||||||
|
{
|
||||||
|
Message = $"网口连接异常,正在重试{ex.Message}",
|
||||||
|
Type = MsgType.ERROR,
|
||||||
|
};
|
||||||
|
_eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
|
||||||
|
logger.Info($"网口连接异常,正在重试{ex.Message}");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
_socketHelper.OpenStatus = true;
|
||||||
|
//记录药箱打开时间
|
||||||
|
ChannelList channelList = SqlSugarHelper.Db.Queryable<ChannelList>().Where(cl => cl.MachineId == "DM5" && cl.DrawerNo == _ChannelStock.DrawerNo).First();
|
||||||
|
if (channelList != null && (channelList.EffDate is null || Convert.ToDateTime(channelList.EffDate).ToString("yyyy-MM-dd") != DateTime.Now.ToString("yyyy-MM-dd")))
|
||||||
|
{
|
||||||
|
|
||||||
|
channelList.EffDate = DateTime.Now.ToString();
|
||||||
|
SqlSugarHelper.Db.Updateable(channelList).UpdateColumns(it => new { it.EffDate }).ExecuteCommand();
|
||||||
|
}
|
||||||
|
Thread.Sleep(200);
|
||||||
|
int iException = 0;
|
||||||
|
await new PromiseUtil<int>().taskAsyncLoop(500, 0, async (options, next, stop) =>
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (_socketHelper.OpenStatus)
|
||||||
|
{
|
||||||
|
_socketHelper.SendMessage(new MyBaseMessage() { lockNo = 0x33, functionCode = 4, delay = 2 });
|
||||||
|
if (_socketHelper.OpenStatus)
|
||||||
|
{
|
||||||
|
next();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_socketHelper.IsMultiThread = false;
|
||||||
|
_socketHelper.dateTime = DateTime.Now;
|
||||||
|
Status = 0;
|
||||||
|
stop();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_socketHelper.IsMultiThread = false;
|
||||||
|
_socketHelper.dateTime = DateTime.Now;
|
||||||
|
Status = 0;
|
||||||
|
stop();
|
||||||
|
}
|
||||||
|
iException = 0;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
iException++;
|
||||||
|
if (iException >= 3)
|
||||||
|
{
|
||||||
|
_socketHelper.OpenStatus = false;
|
||||||
|
}
|
||||||
|
AlertMsg alertMsg = new AlertMsg
|
||||||
|
{
|
||||||
|
Message = $"网口连接异常,正在重试{ex.Message}",
|
||||||
|
Type = MsgType.ERROR,
|
||||||
|
};
|
||||||
|
_eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
|
||||||
|
logger.Info($"网口连接异常,正在重试{ex.Message}");
|
||||||
|
next();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private bool _isFinishClick = false;
|
||||||
|
|
||||||
|
public bool IsFinishClick { get => _isFinishClick; set => SetProperty(ref _isFinishClick, value); }
|
||||||
|
// 完成按钮
|
||||||
|
public DelegateCommand FinishCommand
|
||||||
|
{
|
||||||
|
get => new DelegateCommand(() =>
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
List<ChannelStock> saveChannelStock = _ChannelStocks.Where(cs => cs.TakeQuantity > 0).ToList();
|
||||||
|
if (saveChannelStock == null || saveChannelStock.Count <= 0)
|
||||||
|
{
|
||||||
|
AlertMsg alertMsg = new AlertMsg
|
||||||
|
{
|
||||||
|
Message = "请填写要交换药品的交换数量",
|
||||||
|
Type = MsgType.ERROR,
|
||||||
|
};
|
||||||
|
_eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
int sumQuantity = saveChannelStock.Sum(cs => cs.TakeQuantity);
|
||||||
|
if (sumQuantity > _ChannelStock.Quantity)
|
||||||
|
{
|
||||||
|
AlertMsg alertMsg = new AlertMsg
|
||||||
|
{
|
||||||
|
Message = "交换总数不能大于库存",
|
||||||
|
Type = MsgType.ERROR,
|
||||||
|
};
|
||||||
|
_eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
IsFinishClick = true;
|
||||||
|
var f = SqlSugarHelper.Db.UseTran(() =>
|
||||||
|
{
|
||||||
|
for (int i = 0; i < saveChannelStock.Count; i++)
|
||||||
|
{
|
||||||
|
ChannelStock currentChannelStock = saveChannelStock[i];
|
||||||
|
if (currentChannelStock.Quantity < currentChannelStock.TakeQuantity)
|
||||||
|
{
|
||||||
|
AlertMsg alertMsg = new AlertMsg
|
||||||
|
{
|
||||||
|
Message = $"药品{currentChannelStock.DrugInfo.DrugName}交换数量不能大于库存",
|
||||||
|
Type = MsgType.ERROR,
|
||||||
|
};
|
||||||
|
_eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
string csId = Guid.NewGuid().ToString();
|
||||||
|
//查询【出药】的药箱中是否有该批次药品
|
||||||
|
ChannelStock ReplaceChannelStockList = SqlSugarHelper.Db.Queryable<ChannelStock>()
|
||||||
|
.Where(cs => cs.MachineId.Equals(_ChannelStock.MachineId))
|
||||||
|
.Where(cs => cs.DrawerNo == _ChannelStock.DrawerNo)
|
||||||
|
.Where(cs => cs.DrugId.Equals(currentChannelStock.DrugId))
|
||||||
|
.Where(cs => cs.ManuNo.Equals(currentChannelStock.ManuNo))
|
||||||
|
.First();
|
||||||
|
//修改已替换的药品批次数量(现库存数-已替换总数)
|
||||||
|
_ChannelStock.Quantity = _ChannelStock.Quantity - sumQuantity;
|
||||||
|
SqlSugarHelper.Db.Updateable(_ChannelStock).UpdateColumns(it => new { it.Quantity }).ExecuteCommand();
|
||||||
|
|
||||||
|
if (ReplaceChannelStockList != null)
|
||||||
|
{
|
||||||
|
//有该批次药品则更新
|
||||||
|
csId = ReplaceChannelStockList.Id;
|
||||||
|
ReplaceChannelStockList.Quantity = ReplaceChannelStockList.Quantity + currentChannelStock.TakeQuantity;
|
||||||
|
SqlSugarHelper.Db.Updateable(ReplaceChannelStockList).UpdateColumns(it => new { it.Quantity }).ExecuteCommand();
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//没有该批次药品则插入
|
||||||
|
SqlSugarHelper.Db.Insertable(new ChannelStock()
|
||||||
|
{
|
||||||
|
MachineId = _ChannelStock.MachineId,
|
||||||
|
DrawerNo = _ChannelStock.DrawerNo,
|
||||||
|
DrugId = _ChannelStock.DrugId,
|
||||||
|
ManuNo = currentChannelStock.ManuNo,
|
||||||
|
Quantity = currentChannelStock.TakeQuantity,
|
||||||
|
DrawerType = 1,
|
||||||
|
Chnguid = _ChannelStock.Chnguid,
|
||||||
|
Id = csId,
|
||||||
|
}).ExecuteCommand();
|
||||||
|
}
|
||||||
|
|
||||||
|
// 保存数据 替换药记录
|
||||||
|
SqlSugarHelper.Db.Insertable(new MoveChannelStock()
|
||||||
|
{
|
||||||
|
MachineId = _ChannelStock.MachineId,
|
||||||
|
FromDrawer = _ChannelStock.DrawerNo,
|
||||||
|
ToDrawer = currentChannelStock.DrawerNo,
|
||||||
|
DrugId = _ChannelStock.DrugId,
|
||||||
|
FromManuNo = _ChannelStock.ManuNo,
|
||||||
|
ToManuNo = currentChannelStock.ManuNo,
|
||||||
|
Operator = HomeWindowViewModel.Operator?.Id,
|
||||||
|
Reviewer = HomeWindowViewModel.Reviewer?.Id,
|
||||||
|
Quantity = currentChannelStock.TakeQuantity,
|
||||||
|
Type = 69,
|
||||||
|
}).ExecuteCommand();
|
||||||
|
|
||||||
|
//查询【入药】的药箱中是否有该批次药品
|
||||||
|
ChannelStock Replace2ChannelStockList = SqlSugarHelper.Db.Queryable<ChannelStock>()
|
||||||
|
.Where(cs => cs.MachineId.Equals(_ChannelStock.MachineId))
|
||||||
|
.Where(cs => cs.DrawerNo == currentChannelStock.DrawerNo)
|
||||||
|
.Where(cs => cs.DrugId.Equals(_ChannelStock.DrugId))
|
||||||
|
.Where(cs => cs.ManuNo.Equals(_ChannelStock.ManuNo))
|
||||||
|
.First();
|
||||||
|
//修改替换的药品批次数量(现库存数-已替换总数)
|
||||||
|
currentChannelStock.Quantity = currentChannelStock.Quantity - currentChannelStock.TakeQuantity;
|
||||||
|
SqlSugarHelper.Db.Updateable(currentChannelStock).UpdateColumns(it => new { it.Quantity }).ExecuteCommand();
|
||||||
|
|
||||||
|
if (Replace2ChannelStockList!=null)
|
||||||
|
{
|
||||||
|
//有该批次药品则更新库存
|
||||||
|
Replace2ChannelStockList.Quantity = Replace2ChannelStockList.Quantity + currentChannelStock.TakeQuantity;
|
||||||
|
SqlSugarHelper.Db.Updateable(Replace2ChannelStockList).UpdateColumns(it => new { it.Quantity }).ExecuteCommand();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//没有该批次药品则插入
|
||||||
|
SqlSugarHelper.Db.Insertable(new ChannelStock()
|
||||||
|
{
|
||||||
|
MachineId = _ChannelStock.MachineId,
|
||||||
|
DrawerNo = _ChannelStock.DrawerNo,
|
||||||
|
DrugId = _ChannelStock.DrugId,
|
||||||
|
ManuNo = _ChannelStock.ManuNo,
|
||||||
|
Quantity = currentChannelStock.TakeQuantity,
|
||||||
|
DrawerType = 1,
|
||||||
|
Chnguid = currentChannelStock.Chnguid,
|
||||||
|
Id = csId,
|
||||||
|
}).ExecuteCommand();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
});
|
||||||
|
if (f.Data)
|
||||||
|
{
|
||||||
|
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;
|
||||||
|
RequestClose?.Invoke(new DialogResult(ButtonResult.OK));
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
AlertMsg alertMsg = new AlertMsg
|
||||||
|
{
|
||||||
|
Message = "替换药品异常",
|
||||||
|
Type = MsgType.ERROR,
|
||||||
|
};
|
||||||
|
_eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
|
||||||
|
}
|
||||||
|
}, () => !IsFinishClick);
|
||||||
|
}
|
||||||
|
|
||||||
|
public long CurrentTimeMillis()
|
||||||
|
{
|
||||||
|
return (long)(DateTime.UtcNow - Jan1st1970).TotalMilliseconds;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 取消按钮
|
||||||
|
public DelegateCommand CancleCommand
|
||||||
|
{
|
||||||
|
get => new DelegateCommand(() =>
|
||||||
|
{
|
||||||
|
IsFinishClick = false;
|
||||||
|
Status = 0;
|
||||||
|
// 关闭当前窗口
|
||||||
|
RequestClose?.Invoke(new DialogResult(ButtonResult.Cancel));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public DelegateCommand BtnCloseCommand
|
||||||
|
{
|
||||||
|
get => new DelegateCommand(() =>
|
||||||
|
{
|
||||||
|
// 关闭当前窗口
|
||||||
|
RequestClose?.Invoke(new DialogResult(ButtonResult.Cancel));
|
||||||
|
}, () => Status == 0).ObservesProperty(() => Status);
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool KeepAlive => false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,251 @@
|
||||||
|
using Common.Logging;
|
||||||
|
using DM_Weight.Models;
|
||||||
|
using DM_Weight.msg;
|
||||||
|
using DM_Weight.Port;
|
||||||
|
using DM_Weight.util;
|
||||||
|
using Prism.Commands;
|
||||||
|
using Prism.Events;
|
||||||
|
using Prism.Mvvm;
|
||||||
|
using Prism.Regions;
|
||||||
|
using Prism.Services.Dialogs;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Configuration;
|
||||||
|
using System.Drawing.Printing;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace DM_Weight.ViewModels
|
||||||
|
{
|
||||||
|
public class ExchangeWindowViewModel : BindableBase, INavigationAware, IRegionMemberLifetime
|
||||||
|
{
|
||||||
|
public bool KeepAlive => false;
|
||||||
|
|
||||||
|
private readonly ILog logger = LogManager.GetLogger(typeof(CheckOrderNewWindowViewModel));
|
||||||
|
|
||||||
|
private List<ChannelStock> _channelStocks=new List<ChannelStock>();
|
||||||
|
public List<ChannelStock> _ChannelStocks
|
||||||
|
{
|
||||||
|
get => _channelStocks;
|
||||||
|
set=>SetProperty(ref _channelStocks, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
private ChannelStock _selectedChannelStock=new ChannelStock();
|
||||||
|
public ChannelStock _ChannelStock
|
||||||
|
{
|
||||||
|
get=>_selectedChannelStock;
|
||||||
|
set=>SetProperty(ref _selectedChannelStock, value);
|
||||||
|
}
|
||||||
|
//所选药箱号
|
||||||
|
private int _drawerNo = -1;
|
||||||
|
|
||||||
|
public int DrawerNo
|
||||||
|
{
|
||||||
|
get => _drawerNo;
|
||||||
|
set => SetProperty(ref _drawerNo, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
IDialogService _dialogService;
|
||||||
|
SocketHelper _socketHelper;
|
||||||
|
IEventAggregator _eventAggregator;
|
||||||
|
public ExchangeWindowViewModel(IEventAggregator eventAggregator, IDialogService DialogService, SocketHelper socketHelper)
|
||||||
|
{
|
||||||
|
_dialogService = DialogService;
|
||||||
|
_socketHelper = socketHelper;
|
||||||
|
_eventAggregator = eventAggregator;
|
||||||
|
}
|
||||||
|
public DelegateCommand<string> UpdateDrawerNo
|
||||||
|
{
|
||||||
|
get => new DelegateCommand<string>(OpenBoxAction);
|
||||||
|
}
|
||||||
|
public async void OpenBoxAction(string strDrawerNo)
|
||||||
|
{
|
||||||
|
if (_socketHelper.OpenStatus)
|
||||||
|
{
|
||||||
|
_socketHelper.speechSynthesizer.SpeakAsyncCancelAll();
|
||||||
|
_socketHelper.speechSynthesizer.Resume();
|
||||||
|
_socketHelper.SpeakAsync("请关闭手术间后再打开");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
DrawerNo = Convert.ToInt32(strDrawerNo);
|
||||||
|
MachineRecord machineRecord = new MachineRecord();
|
||||||
|
machineRecord.MachineId = "DM5";
|
||||||
|
machineRecord.DrawerNo = DrawerNo;
|
||||||
|
machineRecord.Operator = HomeWindowViewModel.Operator?.Id;
|
||||||
|
machineRecord.OperationTime = DateTime.Now;
|
||||||
|
machineRecord.Type = 55;
|
||||||
|
machineRecord.InvoiceId = $"打开{DrawerNo}号手术间";
|
||||||
|
|
||||||
|
|
||||||
|
if (DrawerNo > 0)
|
||||||
|
{
|
||||||
|
RequestData();
|
||||||
|
_socketHelper.speechSynthesizer.SpeakAsyncCancelAll();
|
||||||
|
_socketHelper.speechSynthesizer.Resume();
|
||||||
|
_socketHelper.SpeakAsync($"正在打开{DrawerNo+1}号手术间");
|
||||||
|
logger.Info($"正在打开{DrawerNo+1}号手术间");
|
||||||
|
//记录开药箱日志
|
||||||
|
SqlSugarHelper.Db.Insertable(machineRecord).ExecuteCommand();
|
||||||
|
try
|
||||||
|
{
|
||||||
|
_socketHelper.SendMessage(new MyBaseMessage() { lockNo = (short)(DrawerNo - 1) });
|
||||||
|
_socketHelper.dateTime = DateTime.Now;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
AlertMsg alertMsg = new AlertMsg
|
||||||
|
{
|
||||||
|
Message = $"网口连接异常,正在重试{ex.Message}",
|
||||||
|
Type = MsgType.ERROR,
|
||||||
|
};
|
||||||
|
_eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
|
||||||
|
logger.Info($"网口连接异常,正在重试{ex.Message}");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
_socketHelper.OpenStatus = true;
|
||||||
|
//记录药箱打开时间
|
||||||
|
ChannelList channelList = SqlSugarHelper.Db.Queryable<ChannelList>().Where(cl => cl.MachineId == "DM5" && cl.DrawerNo == DrawerNo).First();
|
||||||
|
if (channelList != null && (channelList.EffDate is null || Convert.ToDateTime(channelList.EffDate).ToString("yyyy-MM-dd") != DateTime.Now.ToString("yyyy-MM-dd")))
|
||||||
|
{
|
||||||
|
|
||||||
|
channelList.EffDate = DateTime.Now.ToString();
|
||||||
|
SqlSugarHelper.Db.Updateable(channelList).UpdateColumns(it => new { it.EffDate }).ExecuteCommand();
|
||||||
|
}
|
||||||
|
Thread.Sleep(200);
|
||||||
|
int iException = 0;
|
||||||
|
await new PromiseUtil<int>().taskAsyncLoop(500, 0, async (options, next, stop) =>
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (_socketHelper.OpenStatus)
|
||||||
|
{
|
||||||
|
_socketHelper.SendMessage(new MyBaseMessage() { lockNo = 0x33, functionCode = 4, delay = 2 });
|
||||||
|
|
||||||
|
if (_socketHelper.OpenStatus)
|
||||||
|
{
|
||||||
|
next();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_socketHelper.IsMultiThread = false;
|
||||||
|
_socketHelper.dateTime = DateTime.Now;
|
||||||
|
stop();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_socketHelper.IsMultiThread = false;
|
||||||
|
_socketHelper.dateTime = DateTime.Now;
|
||||||
|
stop();
|
||||||
|
}
|
||||||
|
iException = 0;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
iException++;
|
||||||
|
if (iException >= 3)
|
||||||
|
{
|
||||||
|
_socketHelper.OpenStatus = false;
|
||||||
|
}
|
||||||
|
AlertMsg alertMsg = new AlertMsg
|
||||||
|
{
|
||||||
|
Message = $"网口连接异常,正在重试{ex.Message}",
|
||||||
|
Type = MsgType.ERROR,
|
||||||
|
};
|
||||||
|
_eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
|
||||||
|
logger.Info($"网口连接异常,正在重试{ex.Message}");
|
||||||
|
next();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void RequestData()
|
||||||
|
{
|
||||||
|
List<ChannelStock> queryData = SqlSugarHelper.Db.Queryable<ChannelStock>()
|
||||||
|
.Includes(cs => cs.DrugInfo)
|
||||||
|
.Where(cs => cs.DrawerNo == DrawerNo + 1)
|
||||||
|
.Where(cs => cs.DrugId != null)
|
||||||
|
.Where(cs => cs.MachineId.Equals(ConfigurationManager.AppSettings["machineId"] ?? "DM5"))
|
||||||
|
.OrderBy(cs => cs.DrugId)
|
||||||
|
.ToList();
|
||||||
|
_ChannelStocks = queryData.Select(it => { it.CheckQuantity = it.Quantity; return it; }).ToList();
|
||||||
|
}
|
||||||
|
public bool IsNavigationTarget(NavigationContext navigationContext)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void OnNavigatedFrom(NavigationContext navigationContext)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public void OnNavigatedTo(NavigationContext navigationContext)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public DelegateCommand ExchangeCommand
|
||||||
|
{
|
||||||
|
get =>new DelegateCommand(Exchange);
|
||||||
|
}
|
||||||
|
//替换
|
||||||
|
private async void Exchange()
|
||||||
|
{
|
||||||
|
if (_ChannelStock == null)
|
||||||
|
{
|
||||||
|
logger.Error("请选择要交换的药品");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (_ChannelStock.DrugInfo == null)
|
||||||
|
{
|
||||||
|
logger.Error("请选<E8AFB7><E98089>要交换的药品");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// 此处延时1毫秒,等待页面渲染
|
||||||
|
await Task.Delay(TimeSpan.FromMilliseconds(1));
|
||||||
|
//选中药箱号下的所有药品id
|
||||||
|
DialogParameters dialogParameters = new DialogParameters();
|
||||||
|
dialogParameters.Add("csStock", _ChannelStock);
|
||||||
|
DialogServiceExtensions.ShowDialogHost(_dialogService, "ExchangeDialog", dialogParameters, DoDialogResult, "RootDialog");
|
||||||
|
}
|
||||||
|
//移出
|
||||||
|
public DelegateCommand RemoveCommand
|
||||||
|
{
|
||||||
|
get => new DelegateCommand(Remove);
|
||||||
|
}
|
||||||
|
private async void Remove()
|
||||||
|
{
|
||||||
|
// 此处延时1毫秒,等待页面渲染
|
||||||
|
await Task.Delay(TimeSpan.FromMilliseconds(1));
|
||||||
|
//选中药箱号下的所有药品id
|
||||||
|
DialogParameters dialogParameters = new DialogParameters();
|
||||||
|
dialogParameters.Add("csStock", _ChannelStock);
|
||||||
|
DialogServiceExtensions.ShowDialogHost(_dialogService, "RemoveDialog", dialogParameters, DoDialogResult, "RootDialog");
|
||||||
|
}
|
||||||
|
private void DoDialogResult(IDialogResult dialogResult)
|
||||||
|
{
|
||||||
|
RequestData();
|
||||||
|
}
|
||||||
|
|
||||||
|
private DelegateCommand _rowSelected;
|
||||||
|
|
||||||
|
public DelegateCommand RowSelected => _rowSelected ??= new DelegateCommand(OpenOrderDialog);
|
||||||
|
public async void OpenOrderDialog()
|
||||||
|
{
|
||||||
|
//if (_ChannelStock != null)
|
||||||
|
//{
|
||||||
|
// // 此处延时1毫秒,等待页面渲染
|
||||||
|
// await Task.Delay(TimeSpan.FromMilliseconds(1));
|
||||||
|
// //选中药箱号下的所有药品id
|
||||||
|
// DialogParameters dialogParameters = new DialogParameters();
|
||||||
|
// dialogParameters.Add("_ChannelStock", _ChannelList.channelStocks);
|
||||||
|
// DialogServiceExtensions.ShowDialogHost(_dialogService, "AddToJiaoJieDialog", dialogParameters, DoDialogResult, "RootDialog");
|
||||||
|
|
||||||
|
//}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,438 @@
|
||||||
|
using Common.Logging;
|
||||||
|
using DM_Weight.Models;
|
||||||
|
using DM_Weight.msg;
|
||||||
|
using DM_Weight.Port;
|
||||||
|
using DM_Weight.select;
|
||||||
|
using DM_Weight.util;
|
||||||
|
using Prism.Commands;
|
||||||
|
using Prism.Events;
|
||||||
|
using Prism.Mvvm;
|
||||||
|
using Prism.Regions;
|
||||||
|
using Prism.Services.Dialogs;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Configuration;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace DM_Weight.ViewModels
|
||||||
|
{
|
||||||
|
public class RemoveDialogViewModel : BindableBase, IDialogAware, IRegionMemberLifetime
|
||||||
|
{
|
||||||
|
private readonly ILog logger = LogManager.GetLogger(typeof(RemoveDialogViewModel));
|
||||||
|
public string Title => "药品移出药箱";
|
||||||
|
|
||||||
|
public event Action<IDialogResult> RequestClose;
|
||||||
|
|
||||||
|
private static readonly DateTime Jan1st1970 = new DateTime
|
||||||
|
(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);
|
||||||
|
|
||||||
|
IEventAggregator _eventAggregator;
|
||||||
|
|
||||||
|
private ChannelStock _csStock;
|
||||||
|
public ChannelStock _ChannelStock
|
||||||
|
{
|
||||||
|
get { return _csStock; }
|
||||||
|
set { SetProperty(ref _csStock, value); }
|
||||||
|
}
|
||||||
|
SocketHelper _socketHelper;
|
||||||
|
public RemoveDialogViewModel(IEventAggregator eventAggregator, SocketHelper socketHelper)
|
||||||
|
{
|
||||||
|
_eventAggregator = eventAggregator;
|
||||||
|
_socketHelper = socketHelper;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private int _status = 0;
|
||||||
|
|
||||||
|
public int Status
|
||||||
|
{
|
||||||
|
get => _status; set => SetProperty(ref _status, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static List<OrderTakeSelect> StaticSelects = new List<OrderTakeSelect>()
|
||||||
|
{
|
||||||
|
new OrderTakeSelect{Name="一号手术间",Code="1"},
|
||||||
|
new OrderTakeSelect{Name="二号手术间",Code="2"},
|
||||||
|
new OrderTakeSelect{Name="三号手术间",Code="3"},
|
||||||
|
new OrderTakeSelect{Name="四号手术间",Code="4"},
|
||||||
|
new OrderTakeSelect{Name="五号手术间",Code="5"},
|
||||||
|
new OrderTakeSelect{Name="六号手术间",Code="6"},
|
||||||
|
new OrderTakeSelect{Name="七号手术间",Code="7"},
|
||||||
|
new OrderTakeSelect{Name="八号手术间",Code="8"},
|
||||||
|
new OrderTakeSelect{Name="九号手术间",Code="9"},
|
||||||
|
new OrderTakeSelect{Name="十号手术间",Code="10"},
|
||||||
|
new OrderTakeSelect{Name="十一号手术间",Code="11"},
|
||||||
|
new OrderTakeSelect{Name="十二号手术间",Code="12"},
|
||||||
|
new OrderTakeSelect{Name="十三号手术间",Code="13"},
|
||||||
|
new OrderTakeSelect{Name="十四号手术间",Code="14"},
|
||||||
|
new OrderTakeSelect{Name="十五号手术间",Code="15"},
|
||||||
|
new OrderTakeSelect{Name="十六号手术间",Code="16"},
|
||||||
|
new OrderTakeSelect{Name="十七号手术间",Code="17"},
|
||||||
|
new OrderTakeSelect{Name="十八号手术间",Code="18"},
|
||||||
|
};
|
||||||
|
|
||||||
|
private List<OrderTakeSelect> _selects = StaticSelects;
|
||||||
|
|
||||||
|
public List<OrderTakeSelect> Selects
|
||||||
|
{
|
||||||
|
get { return _selects; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
SetProperty(ref _selects, value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private OrderTakeSelect _selectedItem = StaticSelects[0];
|
||||||
|
public OrderTakeSelect SelectedItem
|
||||||
|
{
|
||||||
|
get => _selectedItem;
|
||||||
|
set => SetProperty(ref _selectedItem, value);
|
||||||
|
}
|
||||||
|
//去掉移出的药箱号
|
||||||
|
private OrderTakeSelect _removeItem = new();
|
||||||
|
public OrderTakeSelect RemoveItem
|
||||||
|
{
|
||||||
|
get => _removeItem;
|
||||||
|
set => SetProperty(ref _removeItem, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
private int _removeQuantity;
|
||||||
|
|
||||||
|
public int RemoveQuantity
|
||||||
|
{
|
||||||
|
get => _removeQuantity;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (value < 0)
|
||||||
|
{
|
||||||
|
throw new ArgumentException("移入数量不能是负数");
|
||||||
|
}
|
||||||
|
if (value > _ChannelStock.Quantity)
|
||||||
|
{
|
||||||
|
throw new ArgumentException("移入数量超出库存数");
|
||||||
|
}
|
||||||
|
SetProperty(ref _removeQuantity, value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public bool CanCloseDialog()
|
||||||
|
{
|
||||||
|
return Status == 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void OnDialogClosed()
|
||||||
|
{
|
||||||
|
Selects.Insert(_ChannelStock.DrawerNo - 1, RemoveItem);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void OnDialogOpened(IDialogParameters parameters)
|
||||||
|
{
|
||||||
|
ChannelStock _csStock = parameters.GetValue<ChannelStock>("csStock");
|
||||||
|
_ChannelStock = _csStock;
|
||||||
|
RemoveItem = Selects[_ChannelStock.DrawerNo - 1];
|
||||||
|
Selects.Remove(RemoveItem);
|
||||||
|
RemoveQuantity = _ChannelStock.Quantity;
|
||||||
|
|
||||||
|
RequestData();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void RequestData()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
//开药盒
|
||||||
|
public DelegateCommand OpenDrawer
|
||||||
|
{
|
||||||
|
get => new DelegateCommand(async () =>
|
||||||
|
{
|
||||||
|
if (SelectedItem != null)
|
||||||
|
{
|
||||||
|
await OpenBox();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
AlertMsg alertMsg = new AlertMsg
|
||||||
|
{
|
||||||
|
Message = "请选择要移入的药箱!",
|
||||||
|
Type = MsgType.ERROR,
|
||||||
|
};
|
||||||
|
_eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
|
||||||
|
}
|
||||||
|
|
||||||
|
}, () => Status == 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task OpenBox()
|
||||||
|
{
|
||||||
|
if (_socketHelper.OpenStatus)
|
||||||
|
{
|
||||||
|
_socketHelper.speechSynthesizer.SpeakAsyncCancelAll();
|
||||||
|
_socketHelper.speechSynthesizer.Resume();
|
||||||
|
_socketHelper.SpeakAsync("请关闭手术间后再打开");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
MachineRecord machineRecord = new MachineRecord();
|
||||||
|
machineRecord.MachineId = "DM5";
|
||||||
|
machineRecord.DrawerNo = Convert.ToInt32(SelectedItem.Code);
|
||||||
|
machineRecord.Operator = HomeWindowViewModel.Operator?.Id;
|
||||||
|
machineRecord.OperationTime = DateTime.Now;
|
||||||
|
machineRecord.Type = 55;
|
||||||
|
machineRecord.InvoiceId = $"打开{Convert.ToInt32(SelectedItem.Code)}号手术间";
|
||||||
|
|
||||||
|
|
||||||
|
if (Convert.ToInt32(SelectedItem.Code) > 0)
|
||||||
|
{
|
||||||
|
RequestData();
|
||||||
|
Status = 1;
|
||||||
|
_socketHelper.speechSynthesizer.SpeakAsyncCancelAll();
|
||||||
|
_socketHelper.speechSynthesizer.Resume();
|
||||||
|
_socketHelper.SpeakAsync($"正在打开{SelectedItem.Code}号手术间");
|
||||||
|
logger.Info($"正在打开{SelectedItem.Code}号手术间");
|
||||||
|
//记录开药箱日志
|
||||||
|
SqlSugarHelper.Db.Insertable(machineRecord).ExecuteCommand();
|
||||||
|
try
|
||||||
|
{
|
||||||
|
_socketHelper.SendMessage(new MyBaseMessage() { lockNo = (short)(Convert.ToInt32(SelectedItem.Code) - 1) });
|
||||||
|
_socketHelper.dateTime = DateTime.Now;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
AlertMsg alertMsg = new AlertMsg
|
||||||
|
{
|
||||||
|
Message = $"网口连接异常,正在重试{ex.Message}",
|
||||||
|
Type = MsgType.ERROR,
|
||||||
|
};
|
||||||
|
_eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
|
||||||
|
logger.Info($"网口连接异常,正在重试{ex.Message}");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
_socketHelper.OpenStatus = true;
|
||||||
|
//记录药箱打开时间
|
||||||
|
ChannelList channelList = SqlSugarHelper.Db.Queryable<ChannelList>().Where(cl => cl.MachineId == "DM5" && cl.DrawerNo == _ChannelStock.DrawerNo).First();
|
||||||
|
if (channelList != null && (channelList.EffDate is null || Convert.ToDateTime(channelList.EffDate).ToString("yyyy-MM-dd") != DateTime.Now.ToString("yyyy-MM-dd")))
|
||||||
|
{
|
||||||
|
|
||||||
|
channelList.EffDate = DateTime.Now.ToString();
|
||||||
|
SqlSugarHelper.Db.Updateable(channelList).UpdateColumns(it => new { it.EffDate }).ExecuteCommand();
|
||||||
|
}
|
||||||
|
Thread.Sleep(200);
|
||||||
|
int iException = 0;
|
||||||
|
await new PromiseUtil<int>().taskAsyncLoop(500, 0, async (options, next, stop) =>
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (_socketHelper.OpenStatus)
|
||||||
|
{
|
||||||
|
_socketHelper.SendMessage(new MyBaseMessage() { lockNo = 0x33, functionCode = 4, delay = 2 });
|
||||||
|
if (_socketHelper.OpenStatus)
|
||||||
|
{
|
||||||
|
next();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_socketHelper.IsMultiThread = false;
|
||||||
|
_socketHelper.dateTime = DateTime.Now;
|
||||||
|
Status = 0;
|
||||||
|
stop();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_socketHelper.IsMultiThread = false;
|
||||||
|
_socketHelper.dateTime = DateTime.Now;
|
||||||
|
Status = 0;
|
||||||
|
stop();
|
||||||
|
}
|
||||||
|
iException = 0;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
iException++;
|
||||||
|
if (iException >= 3)
|
||||||
|
{
|
||||||
|
_socketHelper.OpenStatus = false;
|
||||||
|
}
|
||||||
|
AlertMsg alertMsg = new AlertMsg
|
||||||
|
{
|
||||||
|
Message = $"网口连接异常,正在重试{ex.Message}",
|
||||||
|
Type = MsgType.ERROR,
|
||||||
|
};
|
||||||
|
_eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
|
||||||
|
logger.Info($"网口连接异常,正在重试{ex.Message}");
|
||||||
|
next();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private bool _isFinishClick = false;
|
||||||
|
|
||||||
|
public bool IsFinishClick { get => _isFinishClick; set => SetProperty(ref _isFinishClick, value); }
|
||||||
|
// 完成按钮
|
||||||
|
public DelegateCommand FinishCommand
|
||||||
|
{
|
||||||
|
get => new DelegateCommand(() =>
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
IsFinishClick = true;
|
||||||
|
var f = SqlSugarHelper.Db.UseTran(() =>
|
||||||
|
{
|
||||||
|
//查询要移入的药箱中是否有该药品
|
||||||
|
List<ChannelStock> RemoveChannelStockList = SqlSugarHelper.Db.Queryable<ChannelStock>()
|
||||||
|
.Where(cs => cs.MachineId.Equals(_ChannelStock.MachineId))
|
||||||
|
.Where(cs => cs.DrawerNo == Convert.ToInt32(SelectedItem.Code))
|
||||||
|
.Where(cs => cs.DrugId.Equals(_ChannelStock.DrugId))
|
||||||
|
//.Where(cs => cs.ManuNo.Equals(_ChannelStock.ManuNo))
|
||||||
|
.ToList();
|
||||||
|
ChannelList channelList = SqlSugarHelper.Db.Queryable<ChannelList>()
|
||||||
|
.Where(cl => cl.MachineId.Equals(_ChannelStock.MachineId))
|
||||||
|
.Where(cs => cs.DrawerNo == Convert.ToInt32(SelectedItem.Code))
|
||||||
|
.Where(cs => cs.DrugId.Equals(_ChannelStock.DrugId)).First();
|
||||||
|
if (RemoveChannelStockList != null&& RemoveChannelStockList.Count>0&& channelList!=null&&!string.IsNullOrEmpty(channelList.Id))
|
||||||
|
{
|
||||||
|
//查询药品总数(移入后是否超基数)
|
||||||
|
|
||||||
|
int sumQuantity = RemoveChannelStockList.Sum(rs => rs.Quantity);
|
||||||
|
if (sumQuantity + RemoveQuantity > channelList.BaseQuantity)
|
||||||
|
{
|
||||||
|
AlertMsg alertMsg = new AlertMsg
|
||||||
|
{
|
||||||
|
Message = "移入数量超出药箱基数,请重新选择",
|
||||||
|
Type = MsgType.ERROR,
|
||||||
|
};
|
||||||
|
_eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
//减当前药箱的数量,添加需要加药数量
|
||||||
|
_ChannelStock.Quantity = _ChannelStock.Quantity - RemoveQuantity;
|
||||||
|
_ChannelStock.NeedNum = RemoveQuantity;
|
||||||
|
SqlSugarHelper.Db.Updateable(_ChannelStock).UpdateColumns(it => new { it.Quantity,it.NeedNum }).ExecuteCommand();
|
||||||
|
|
||||||
|
string csId = Guid.NewGuid().ToString();
|
||||||
|
//查询要移动的药箱是否有该批次
|
||||||
|
ChannelStock removeChannelStock = RemoveChannelStockList.Where(it => it.ManuNo == _ChannelStock.ManuNo).First();
|
||||||
|
//有该药品且有该批次
|
||||||
|
if (removeChannelStock != null)
|
||||||
|
{
|
||||||
|
csId = removeChannelStock.Id;
|
||||||
|
removeChannelStock.Quantity = removeChannelStock.Quantity + RemoveQuantity;
|
||||||
|
SqlSugarHelper.Db.Updateable(removeChannelStock).UpdateColumns(it => new { it.Quantity }).ExecuteCommand();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//有该药品但没有该批次
|
||||||
|
SqlSugarHelper.Db.Insertable(new ChannelStock()
|
||||||
|
{
|
||||||
|
MachineId = _ChannelStock.MachineId,
|
||||||
|
DrawerNo = Convert.ToInt32(SelectedItem.Code),
|
||||||
|
ColNo = _ChannelStock.ColNo,
|
||||||
|
DrugId = _ChannelStock.DrugId,
|
||||||
|
ManuNo = _ChannelStock.ManuNo,
|
||||||
|
Quantity = RemoveQuantity,
|
||||||
|
DrawerType = 1,
|
||||||
|
Chnguid = _ChannelStock.Chnguid,
|
||||||
|
Id = csId,
|
||||||
|
}).ExecuteCommand();
|
||||||
|
}
|
||||||
|
|
||||||
|
// 保存数据 药品移出记录
|
||||||
|
SqlSugarHelper.Db.Insertable(new MachineRecord()
|
||||||
|
{
|
||||||
|
MachineId = _ChannelStock.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 = HomeWindowViewModel.Operator?.Id,
|
||||||
|
OperationTime = DateTime.Now,
|
||||||
|
Quantity = RemoveQuantity,
|
||||||
|
Type = 21,
|
||||||
|
InvoiceId = _ChannelStock.Id,
|
||||||
|
DepartmentId = csId //要移入的药箱的channelStock的id
|
||||||
|
}).ExecuteCommand();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//没有绑定该药品
|
||||||
|
AlertMsg alertMsg = new AlertMsg
|
||||||
|
{
|
||||||
|
Message = "药箱没有绑定该药品,请先绑定",
|
||||||
|
Type = MsgType.ERROR,
|
||||||
|
};
|
||||||
|
_eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
});
|
||||||
|
if (f.Data)
|
||||||
|
{
|
||||||
|
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;
|
||||||
|
RequestClose?.Invoke(new DialogResult(ButtonResult.OK));
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
AlertMsg alertMsg = new AlertMsg
|
||||||
|
{
|
||||||
|
Message = $"操作异常!{ex.Message}",
|
||||||
|
Type = MsgType.ERROR,
|
||||||
|
};
|
||||||
|
_eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
|
||||||
|
}
|
||||||
|
|
||||||
|
}, () => !IsFinishClick && RemoveQuantity > 0).ObservesProperty(() => IsFinishClick).ObservesProperty(() => RemoveQuantity);
|
||||||
|
}
|
||||||
|
|
||||||
|
public long CurrentTimeMillis()
|
||||||
|
{
|
||||||
|
return (long)(DateTime.UtcNow - Jan1st1970).TotalMilliseconds;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 取消按钮
|
||||||
|
public DelegateCommand CancleCommand
|
||||||
|
{
|
||||||
|
get => new DelegateCommand(() =>
|
||||||
|
{
|
||||||
|
IsFinishClick = false;
|
||||||
|
Status = 0;
|
||||||
|
// 关闭当前窗口
|
||||||
|
RequestClose?.Invoke(new DialogResult(ButtonResult.Cancel));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public DelegateCommand BtnCloseCommand
|
||||||
|
{
|
||||||
|
get => new DelegateCommand(() =>
|
||||||
|
{
|
||||||
|
// 关闭当前窗口
|
||||||
|
RequestClose?.Invoke(new DialogResult(ButtonResult.Cancel));
|
||||||
|
}, () => Status == 0).ObservesProperty(() => Status);
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool KeepAlive => false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -526,6 +526,12 @@ namespace DM_Weight.ViewModels
|
||||||
PremissionName = "盘点",
|
PremissionName = "盘点",
|
||||||
PremissionPath = "CheckStockWindow",
|
PremissionPath = "CheckStockWindow",
|
||||||
};
|
};
|
||||||
|
PremissionDm sysset5 = new PremissionDm
|
||||||
|
{
|
||||||
|
Id = 58,
|
||||||
|
PremissionName = "药箱药品调整",
|
||||||
|
PremissionPath = "ExchangeWindow",
|
||||||
|
};
|
||||||
syssetChild.Add(sysset1);
|
syssetChild.Add(sysset1);
|
||||||
syssetChild.Add(sysset2);
|
syssetChild.Add(sysset2);
|
||||||
syssetChild.Add(syssetLogin);
|
syssetChild.Add(syssetLogin);
|
||||||
|
|
@ -534,6 +540,7 @@ namespace DM_Weight.ViewModels
|
||||||
syssetChild.Add(wSDRecord);
|
syssetChild.Add(wSDRecord);
|
||||||
syssetChild.Add(sysset3);
|
syssetChild.Add(sysset3);
|
||||||
syssetChild.Add(sysset4);
|
syssetChild.Add(sysset4);
|
||||||
|
syssetChild.Add(sysset5);
|
||||||
sysset.Children = syssetChild;
|
sysset.Children = syssetChild;
|
||||||
defaultAll.Add(sysset);
|
defaultAll.Add(sysset);
|
||||||
#endregion
|
#endregion
|
||||||
|
|
|
||||||
|
|
@ -194,11 +194,11 @@
|
||||||
<Setter Property="Foreground" Value="White" />
|
<Setter Property="Foreground" Value="White" />
|
||||||
</Style>
|
</Style>
|
||||||
</ListView.Resources>
|
</ListView.Resources>
|
||||||
<i:Interaction.Triggers>
|
<!--<i:Interaction.Triggers>
|
||||||
<i:EventTrigger EventName="SelectionChanged">
|
<i:EventTrigger EventName="SelectionChanged">
|
||||||
<i:InvokeCommandAction Command="{Binding RowSelected}" />
|
<i:InvokeCommandAction Command="{Binding RowSelected}" />
|
||||||
</i:EventTrigger>
|
</i:EventTrigger>
|
||||||
</i:Interaction.Triggers>
|
</i:Interaction.Triggers>-->
|
||||||
<ListView.View>
|
<ListView.View>
|
||||||
<GridView ColumnHeaderContainerStyle="{StaticResource st}">
|
<GridView ColumnHeaderContainerStyle="{StaticResource st}">
|
||||||
<GridViewColumn Width="80"
|
<GridViewColumn Width="80"
|
||||||
|
|
|
||||||
|
|
@ -113,7 +113,7 @@
|
||||||
</Grid.RowDefinitions>
|
</Grid.RowDefinitions>
|
||||||
<StackPanel HorizontalAlignment="Right" Orientation="Horizontal" Grid.ColumnSpan="2">
|
<StackPanel HorizontalAlignment="Right" Orientation="Horizontal" Grid.ColumnSpan="2">
|
||||||
<Button Margin="6 0 6 6"
|
<Button Margin="6 0 6 6"
|
||||||
Content="保存"
|
Content="保存修改"
|
||||||
Command="{Binding SaveCommand}"
|
Command="{Binding SaveCommand}"
|
||||||
Style="{StaticResource MaterialDesignOutlinedLightButton}" />
|
Style="{StaticResource MaterialDesignOutlinedLightButton}" />
|
||||||
<Button
|
<Button
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,235 @@
|
||||||
|
<UserControl x:Class="DM_Weight.Views.Dialog.ExchangeDialog"
|
||||||
|
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.Dialog"
|
||||||
|
xmlns:prism="http://prismlibrary.com/"
|
||||||
|
xmlns:i="http://schemas.microsoft.com/xaml/behaviors"
|
||||||
|
prism:ViewModelLocator.AutoWireViewModel="True"
|
||||||
|
xmlns:convert="clr-namespace:DM_Weight.Converter"
|
||||||
|
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
|
||||||
|
MinWidth="880"
|
||||||
|
Width="Auto"
|
||||||
|
Height="Auto"
|
||||||
|
mc:Ignorable="d" >
|
||||||
|
|
||||||
|
<UserControl.Resources>
|
||||||
|
<convert:StatusConverter x:Key="StatusConverter" />
|
||||||
|
<convert:InputQuantityConverter x:Key="InputQuantityConverter" />
|
||||||
|
<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>
|
||||||
|
<materialDesign:Card Padding="0">
|
||||||
|
<Grid>
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="Auto" />
|
||||||
|
<RowDefinition Height="50" />
|
||||||
|
<RowDefinition Height="200" />
|
||||||
|
<RowDefinition Height="Auto" />
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
<Grid Background="#03a9f4" Grid.Row="0">
|
||||||
|
<TextBlock VerticalAlignment="Center" Foreground="{DynamicResource PrimaryHueDarkForegroundBrush}" Margin="16 4 16 4" Style="{StaticResource MaterialDesignHeadline5TextBlock}" Text="{Binding Title}" />
|
||||||
|
<Button
|
||||||
|
Style="{StaticResource MaterialDesignIconForegroundButton}"
|
||||||
|
Foreground="{DynamicResource PrimaryHueDarkForegroundBrush}"
|
||||||
|
HorizontalAlignment="Right"
|
||||||
|
Command="{Binding BtnCloseCommand}"
|
||||||
|
IsEnabled="{Binding Status, Converter={StaticResource StatusConverter}, ConverterParameter=CloseBtn}"
|
||||||
|
ToolTip="关闭"
|
||||||
|
>
|
||||||
|
<materialDesign:PackIcon Kind="Close" Width="34" Height="34" />
|
||||||
|
</Button>
|
||||||
|
</Grid>
|
||||||
|
<Grid Grid.Row="1">
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="2*" />
|
||||||
|
<ColumnDefinition Width="3*" />
|
||||||
|
<ColumnDefinition Width="2*" />
|
||||||
|
<ColumnDefinition Width="*" />
|
||||||
|
<ColumnDefinition Width="*" />
|
||||||
|
<ColumnDefinition Width="*" />
|
||||||
|
<ColumnDefinition Width="2*" />
|
||||||
|
<ColumnDefinition Width="2*" />
|
||||||
|
<ColumnDefinition Width="3*" />
|
||||||
|
<ColumnDefinition Width="*" />
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
|
||||||
|
<TextBlock
|
||||||
|
Grid.Column="0"
|
||||||
|
Margin="16 0 16 8"
|
||||||
|
VerticalAlignment="Center"
|
||||||
|
HorizontalAlignment="Right"
|
||||||
|
Style="{StaticResource MaterialDesignBody2TextBlock}"
|
||||||
|
Text="药品:" />
|
||||||
|
<TextBlock
|
||||||
|
Grid.Column="1"
|
||||||
|
Margin="16 0 16 8"
|
||||||
|
VerticalAlignment="Center"
|
||||||
|
HorizontalAlignment="Left"
|
||||||
|
Style="{StaticResource MaterialDesignBody2TextBlock}"
|
||||||
|
Text="{Binding _ChannelStock.DrugInfo.DrugName}" />
|
||||||
|
<TextBlock
|
||||||
|
Grid.Column="2"
|
||||||
|
Margin="16 0 16 8"
|
||||||
|
VerticalAlignment="Center"
|
||||||
|
HorizontalAlignment="Right"
|
||||||
|
Style="{StaticResource MaterialDesignBody2TextBlock}"
|
||||||
|
Text="规格:" />
|
||||||
|
<TextBlock
|
||||||
|
Grid.Column="3"
|
||||||
|
Margin="16 0 16 8"
|
||||||
|
VerticalAlignment="Center"
|
||||||
|
HorizontalAlignment="Left"
|
||||||
|
Style="{StaticResource MaterialDesignBody2TextBlock}"
|
||||||
|
Text="{Binding _ChannelStock.DrugInfo.DrugSpec}" />
|
||||||
|
<TextBlock
|
||||||
|
Grid.Column="4"
|
||||||
|
Margin="16 0 16 8"
|
||||||
|
VerticalAlignment="Center"
|
||||||
|
HorizontalAlignment="Right"
|
||||||
|
Style="{StaticResource MaterialDesignBody2TextBlock}"
|
||||||
|
Text="批次:" />
|
||||||
|
<TextBlock
|
||||||
|
Grid.Column="5"
|
||||||
|
Margin="16 0 16 8"
|
||||||
|
VerticalAlignment="Center"
|
||||||
|
HorizontalAlignment="Left"
|
||||||
|
Style="{StaticResource MaterialDesignBody2TextBlock}"
|
||||||
|
Text="{Binding _ChannelStock.ManuNo}" />
|
||||||
|
<TextBlock
|
||||||
|
Grid.Column="6"
|
||||||
|
Margin="16 0 16 8"
|
||||||
|
VerticalAlignment="Center"
|
||||||
|
HorizontalAlignment="Right"
|
||||||
|
Style="{StaticResource MaterialDesignBody2TextBlock}"
|
||||||
|
Text="库存:" />
|
||||||
|
<TextBlock
|
||||||
|
Grid.Column="7"
|
||||||
|
Margin="16 0 16 8"
|
||||||
|
VerticalAlignment="Center"
|
||||||
|
HorizontalAlignment="Left"
|
||||||
|
Style="{StaticResource MaterialDesignBody2TextBlock}"
|
||||||
|
Text="{Binding _ChannelStock.Quantity}" />
|
||||||
|
|
||||||
|
<ComboBox
|
||||||
|
Grid.Column="8"
|
||||||
|
Margin="6 0 0 0"
|
||||||
|
Style="{StaticResource MaterialDesignOutlinedComboBox}"
|
||||||
|
SelectedItem="{Binding SelectedItem}"
|
||||||
|
DisplayMemberPath="Name"
|
||||||
|
ItemsSource="{Binding Selects}"
|
||||||
|
/>
|
||||||
|
</Grid>
|
||||||
|
<ListView
|
||||||
|
Grid.Row="2"
|
||||||
|
ItemsSource="{Binding _ChannelStocks}"
|
||||||
|
materialDesign:ListViewAssist.HeaderRowBackground="#31ccec"
|
||||||
|
materialDesign:DataGridAssist.ColumnHeaderPadding="10"
|
||||||
|
materialDesign:ListViewAssist.ListViewItemPadding="13">
|
||||||
|
<ListView.Resources>
|
||||||
|
<Style TargetType="{x:Type GridViewColumnHeader}" BasedOn="{StaticResource {x:Type GridViewColumnHeader}}">
|
||||||
|
<Setter Property="Foreground" Value="White" />
|
||||||
|
</Style>
|
||||||
|
<Style TargetType="ScrollViewer">
|
||||||
|
<Setter Property="HorizontalScrollBarVisibility" Value="Visible"/>
|
||||||
|
<Setter Property="VerticalScrollBarVisibility" Value="Visible"/>
|
||||||
|
</Style>
|
||||||
|
</ListView.Resources>
|
||||||
|
<!--<i:Interaction.Triggers>
|
||||||
|
<i:EventTrigger EventName="SelectionChanged">
|
||||||
|
<i:InvokeCommandAction Command="{Binding RowSelected}" />
|
||||||
|
</i:EventTrigger>
|
||||||
|
</i:Interaction.Triggers>-->
|
||||||
|
<ListView.View>
|
||||||
|
<GridView ColumnHeaderContainerStyle="{StaticResource st}">
|
||||||
|
<!--<GridViewColumn Header="选择" Width="100">
|
||||||
|
<GridViewColumn.CellTemplate>
|
||||||
|
<DataTemplate>
|
||||||
|
<CheckBox IsChecked="{Binding IsSelected}"/>
|
||||||
|
</DataTemplate>
|
||||||
|
</GridViewColumn.CellTemplate>
|
||||||
|
</GridViewColumn>-->
|
||||||
|
<GridViewColumn Width="80"
|
||||||
|
Header="药箱号"
|
||||||
|
DisplayMemberBinding="{Binding DrawerNo}"/>
|
||||||
|
<GridViewColumn Width="150"
|
||||||
|
Header="药品"
|
||||||
|
DisplayMemberBinding="{Binding DrugInfo.DrugName}"/>
|
||||||
|
<GridViewColumn Width="150"
|
||||||
|
DisplayMemberBinding="{Binding DrugInfo.DrugSpec}"
|
||||||
|
Header="规格"/>
|
||||||
|
<GridViewColumn Width="150"
|
||||||
|
DisplayMemberBinding="{Binding ManuNo}"
|
||||||
|
Header="批次"/>
|
||||||
|
<GridViewColumn Width="80"
|
||||||
|
DisplayMemberBinding="{Binding Quantity}"
|
||||||
|
Header="库存"/>
|
||||||
|
<GridViewColumn Width="80" Header="交换数量">
|
||||||
|
<GridViewColumn.CellTemplate>
|
||||||
|
<DataTemplate>
|
||||||
|
<TextBox Width="80" Style="{StaticResource MaterialDesignDataGridTextColumnEditingStyle}">
|
||||||
|
<TextBox.Text>
|
||||||
|
<Binding Path="TakeQuantity" Mode="TwoWay" UpdateSourceTrigger="PropertyChanged">
|
||||||
|
<Binding.ValidationRules>
|
||||||
|
<ExceptionValidationRule />
|
||||||
|
</Binding.ValidationRules>
|
||||||
|
</Binding>
|
||||||
|
</TextBox.Text>
|
||||||
|
</TextBox>
|
||||||
|
</DataTemplate>
|
||||||
|
</GridViewColumn.CellTemplate>
|
||||||
|
</GridViewColumn>
|
||||||
|
</GridView>
|
||||||
|
</ListView.View>
|
||||||
|
</ListView>
|
||||||
|
|
||||||
|
<Grid Grid.Row="3">
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition />
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition />
|
||||||
|
<ColumnDefinition/>
|
||||||
|
<ColumnDefinition />
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<StackPanel Orientation="Horizontal" Grid.Row="0" Grid.Column="1" HorizontalAlignment="Center" Margin="6">
|
||||||
|
|
||||||
|
<Button
|
||||||
|
Margin="2"
|
||||||
|
Style="{StaticResource MaterialDesignRaisedAccentButton}"
|
||||||
|
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}"
|
||||||
|
Content="开药箱"
|
||||||
|
Command="{Binding OpenDrawer}">
|
||||||
|
</Button>
|
||||||
|
<Button
|
||||||
|
Margin="2"
|
||||||
|
Style="{StaticResource MaterialDesignRaisedAccentButton}"
|
||||||
|
Content="完成"
|
||||||
|
Command="{Binding FinishCommand}"/>
|
||||||
|
<Button
|
||||||
|
Margin="2"
|
||||||
|
Style="{StaticResource MaterialDesignRaisedButton}"
|
||||||
|
Background="Orange"
|
||||||
|
BorderBrush="Orange"
|
||||||
|
Content="取消"
|
||||||
|
Command="{Binding CancleCommand}" />
|
||||||
|
</StackPanel>
|
||||||
|
|
||||||
|
</Grid>
|
||||||
|
</Grid>
|
||||||
|
</materialDesign:Card>
|
||||||
|
</UserControl>
|
||||||
|
|
@ -0,0 +1,28 @@
|
||||||
|
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.Dialog
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// ExchangeDialog.xaml 的交互逻辑
|
||||||
|
/// </summary>
|
||||||
|
public partial class ExchangeDialog : UserControl
|
||||||
|
{
|
||||||
|
public ExchangeDialog()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,185 @@
|
||||||
|
<UserControl x:Class="DM_Weight.Views.Dialog.RemoveDialog"
|
||||||
|
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.Dialog"
|
||||||
|
xmlns:prism="http://prismlibrary.com/"
|
||||||
|
prism:ViewModelLocator.AutoWireViewModel="True"
|
||||||
|
xmlns:convert="clr-namespace:DM_Weight.Converter"
|
||||||
|
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
|
||||||
|
MinWidth="880"
|
||||||
|
Width="Auto"
|
||||||
|
Height="Auto"
|
||||||
|
mc:Ignorable="d" >
|
||||||
|
|
||||||
|
<UserControl.Resources>
|
||||||
|
<convert:StatusConverter x:Key="StatusConverter" />
|
||||||
|
<convert:InputQuantityConverter x:Key="InputQuantityConverter" />
|
||||||
|
<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>
|
||||||
|
<materialDesign:Card Padding="0">
|
||||||
|
<Grid>
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="Auto" />
|
||||||
|
<RowDefinition Height="50" />
|
||||||
|
<RowDefinition Height="Auto" />
|
||||||
|
<RowDefinition Height="10" />
|
||||||
|
<RowDefinition Height="Auto" />
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
<Grid Background="#03a9f4" Grid.Row="0">
|
||||||
|
<TextBlock VerticalAlignment="Center" Foreground="{DynamicResource PrimaryHueDarkForegroundBrush}" Margin="16 4 16 4" Style="{StaticResource MaterialDesignHeadline5TextBlock}" Text="{Binding Title}" />
|
||||||
|
<Button
|
||||||
|
Style="{StaticResource MaterialDesignIconForegroundButton}"
|
||||||
|
Foreground="{DynamicResource PrimaryHueDarkForegroundBrush}"
|
||||||
|
HorizontalAlignment="Right"
|
||||||
|
Command="{Binding BtnCloseCommand}"
|
||||||
|
ToolTip="关闭">
|
||||||
|
<materialDesign:PackIcon Kind="Close" Width="34" Height="34" />
|
||||||
|
</Button>
|
||||||
|
</Grid>
|
||||||
|
<Grid Grid.Row="1">
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition/>
|
||||||
|
<ColumnDefinition/>
|
||||||
|
<ColumnDefinition/>
|
||||||
|
<ColumnDefinition/>
|
||||||
|
<ColumnDefinition/>
|
||||||
|
<ColumnDefinition/>
|
||||||
|
<ColumnDefinition/>
|
||||||
|
<ColumnDefinition/>
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
|
||||||
|
<TextBlock
|
||||||
|
Grid.Column="0"
|
||||||
|
Margin="16 0 16 8"
|
||||||
|
VerticalAlignment="Center"
|
||||||
|
HorizontalAlignment="Right"
|
||||||
|
Style="{StaticResource MaterialDesignBody2TextBlock}"
|
||||||
|
Text="药品:" />
|
||||||
|
<TextBlock
|
||||||
|
Grid.Column="1"
|
||||||
|
Margin="16 0 16 8"
|
||||||
|
VerticalAlignment="Center"
|
||||||
|
HorizontalAlignment="Left"
|
||||||
|
Style="{StaticResource MaterialDesignBody2TextBlock}"
|
||||||
|
Text="{Binding _ChannelStock.DrugInfo.DrugName}" />
|
||||||
|
<TextBlock
|
||||||
|
Grid.Column="2"
|
||||||
|
Margin="16 0 16 8"
|
||||||
|
VerticalAlignment="Center"
|
||||||
|
HorizontalAlignment="Right"
|
||||||
|
Style="{StaticResource MaterialDesignBody2TextBlock}"
|
||||||
|
Text="规格:" />
|
||||||
|
<TextBlock
|
||||||
|
Grid.Column="3"
|
||||||
|
Margin="16 0 16 8"
|
||||||
|
VerticalAlignment="Center"
|
||||||
|
HorizontalAlignment="Left"
|
||||||
|
Style="{StaticResource MaterialDesignBody2TextBlock}"
|
||||||
|
Text="{Binding _ChannelStock.DrugInfo.DrugSpec}" />
|
||||||
|
<TextBlock
|
||||||
|
Grid.Column="4"
|
||||||
|
Margin="16 0 16 8"
|
||||||
|
VerticalAlignment="Center"
|
||||||
|
HorizontalAlignment="Right"
|
||||||
|
Style="{StaticResource MaterialDesignBody2TextBlock}"
|
||||||
|
Text="批次:" />
|
||||||
|
<TextBlock
|
||||||
|
Grid.Column="5"
|
||||||
|
Margin="16 0 16 8"
|
||||||
|
VerticalAlignment="Center"
|
||||||
|
HorizontalAlignment="Left"
|
||||||
|
Style="{StaticResource MaterialDesignBody2TextBlock}"
|
||||||
|
Text="{Binding _ChannelStock.ManuNo}" />
|
||||||
|
<TextBlock
|
||||||
|
Grid.Column="6"
|
||||||
|
Margin="16 0 16 8"
|
||||||
|
VerticalAlignment="Center"
|
||||||
|
HorizontalAlignment="Right"
|
||||||
|
Style="{StaticResource MaterialDesignBody2TextBlock}"
|
||||||
|
Text="库存:" />
|
||||||
|
<TextBlock
|
||||||
|
Grid.Column="7"
|
||||||
|
Margin="16 0 16 8"
|
||||||
|
VerticalAlignment="Center"
|
||||||
|
HorizontalAlignment="Left"
|
||||||
|
Style="{StaticResource MaterialDesignBody2TextBlock}"
|
||||||
|
Text="{Binding _ChannelStock.Quantity}" />
|
||||||
|
</Grid>
|
||||||
|
<Grid Grid.Row="2">
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="2*" />
|
||||||
|
<ColumnDefinition Width="3*" />
|
||||||
|
<ColumnDefinition Width="2*" />
|
||||||
|
<ColumnDefinition Width="*" />
|
||||||
|
<ColumnDefinition Width="2*" />
|
||||||
|
<ColumnDefinition Width="2*" />
|
||||||
|
<ColumnDefinition Width="3*" />
|
||||||
|
<ColumnDefinition Width="*" />
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<ComboBox
|
||||||
|
Grid.Column="1" Grid.ColumnSpan="2"
|
||||||
|
Margin="6 0 0 0"
|
||||||
|
Style="{StaticResource MaterialDesignOutlinedComboBox}"
|
||||||
|
SelectedItem="{Binding SelectedItem}"
|
||||||
|
DisplayMemberPath="Name"
|
||||||
|
ItemsSource="{Binding Selects}"
|
||||||
|
/>
|
||||||
|
<TextBox
|
||||||
|
Grid.Column="4" Grid.ColumnSpan="2"
|
||||||
|
Text="{Binding RemoveQuantity}"
|
||||||
|
materialDesign:HintAssist.Hint="移入数量"
|
||||||
|
Margin="6 0 0 0"
|
||||||
|
Style="{StaticResource MaterialDesignOutlinedTextBox}"/>
|
||||||
|
</Grid>
|
||||||
|
|
||||||
|
<Grid Grid.Row="4">
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition />
|
||||||
|
<RowDefinition />
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition />
|
||||||
|
<ColumnDefinition />
|
||||||
|
<ColumnDefinition />
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<StackPanel Orientation="Horizontal" Grid.Row="1" Grid.Column="1" HorizontalAlignment="Center" Margin="6">
|
||||||
|
|
||||||
|
<Button
|
||||||
|
Margin="2"
|
||||||
|
Style="{StaticResource MaterialDesignRaisedAccentButton}"
|
||||||
|
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}"
|
||||||
|
Content="开药箱"
|
||||||
|
Command="{Binding OpenDrawer}">
|
||||||
|
</Button>
|
||||||
|
<Button
|
||||||
|
Margin="2" Style="{StaticResource MaterialDesignRaisedAccentButton}"
|
||||||
|
Content="完成"
|
||||||
|
Command="{Binding FinishCommand}"/>
|
||||||
|
<Button
|
||||||
|
Margin="2" Style="{StaticResource MaterialDesignRaisedButton}"
|
||||||
|
Background="Orange"
|
||||||
|
BorderBrush="Orange"
|
||||||
|
Content="取消"
|
||||||
|
Command="{Binding CancleCommand}" Cursor="Hand" />
|
||||||
|
</StackPanel>
|
||||||
|
|
||||||
|
</Grid>
|
||||||
|
</Grid>
|
||||||
|
</materialDesign:Card>
|
||||||
|
</UserControl>
|
||||||
|
|
@ -0,0 +1,28 @@
|
||||||
|
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.Dialog
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// RemoveDialog.xaml 的交互逻辑
|
||||||
|
/// </summary>
|
||||||
|
public partial class RemoveDialog : UserControl
|
||||||
|
{
|
||||||
|
public RemoveDialog()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,151 @@
|
||||||
|
<UserControl x:Class="DM_Weight.Views.ExchangeWindow"
|
||||||
|
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:i="http://schemas.microsoft.com/xaml/behaviors"
|
||||||
|
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
|
||||||
|
xmlns:convert="clr-namespace:DM_Weight.Converter"
|
||||||
|
xmlns:prism="http://prismlibrary.com/"
|
||||||
|
mc:Ignorable="d"
|
||||||
|
d:DesignHeight="450" d:DesignWidth="800">
|
||||||
|
<UserControl.Resources>
|
||||||
|
<convert:DrawerSelectConverter x:Key="DrawerSelectConverter" />
|
||||||
|
<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.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="Auto" />
|
||||||
|
<ColumnDefinition Width="15*" />
|
||||||
|
<ColumnDefinition />
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<Grid Margin="6" Grid.Column="0" >
|
||||||
|
<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>
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition />
|
||||||
|
<RowDefinition />
|
||||||
|
<RowDefinition />
|
||||||
|
<RowDefinition />
|
||||||
|
<RowDefinition />
|
||||||
|
<RowDefinition />
|
||||||
|
<RowDefinition />
|
||||||
|
<RowDefinition />
|
||||||
|
<RowDefinition />
|
||||||
|
<!--<RowDefinition />-->
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition />
|
||||||
|
<ColumnDefinition />
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
|
||||||
|
<Button Margin="0 0 3 0" Grid.Row="0" Grid.Column="0" Width="120" Content="一号手术间" Command="{Binding UpdateDrawerNo}" CommandParameter="0" />
|
||||||
|
<Button Margin="0 0 3 0" Grid.Row="1" Grid.Column="0" Width="120" Content="二号手术间" Command="{Binding UpdateDrawerNo}" CommandParameter="1" />
|
||||||
|
<Button Margin="0 0 3 0" Grid.Row="2" Grid.Column="0" Width="120" Content="三号手术间" Command="{Binding UpdateDrawerNo}" CommandParameter="2" />
|
||||||
|
<Button Margin="0 0 3 0" Grid.Row="3" Grid.Column="0" Width="120" Content="四号手术间" Command="{Binding UpdateDrawerNo}" CommandParameter="3" />
|
||||||
|
<Button Margin="0 0 3 0" Grid.Row="4" Grid.Column="0" Width="120" Content="五号手术间" Command="{Binding UpdateDrawerNo}" CommandParameter="4" />
|
||||||
|
<Button Margin="0 0 3 0" Grid.Row="5" Grid.Column="0" Width="120" Content="六号手术间" Command="{Binding UpdateDrawerNo}" CommandParameter="5" />
|
||||||
|
<Button Margin="0 0 3 0" Grid.Row="6" Grid.Column="0" Width="120" Content="七号手术间" Command="{Binding UpdateDrawerNo}" CommandParameter="6" />
|
||||||
|
<Button Margin="0 0 3 0" Grid.Row="7" Grid.Column="0" Width="120" Content="八号手术间" Command="{Binding UpdateDrawerNo}" CommandParameter="7" />
|
||||||
|
|
||||||
|
<Button Margin="0 0 3 0" Grid.Row="8" Grid.Column="0" Width="120" Content="九号手术间" Command="{Binding UpdateDrawerNo}" CommandParameter="8" />
|
||||||
|
<Button Margin="0 0 3 0" Grid.Row="0" Grid.Column="1" Width="120" Content="十号手术间" Command="{Binding UpdateDrawerNo}" CommandParameter="9" />
|
||||||
|
<Button Margin="0 0 3 0" Grid.Row="1" Grid.Column="1" Width="120" Content="十一号手术间" Command="{Binding UpdateDrawerNo}" CommandParameter="10" />
|
||||||
|
<Button Margin="0 0 3 0" Grid.Row="2" Grid.Column="1" Width="120" Content="十二号手术间" Command="{Binding UpdateDrawerNo}" CommandParameter="11" />
|
||||||
|
<Button Margin="0 0 3 0" Grid.Row="3" Grid.Column="1" Width="120" Content="十三号手术间" Command="{Binding UpdateDrawerNo}" CommandParameter="12" />
|
||||||
|
<Button Margin="0 0 3 0" Grid.Row="4" Grid.Column="1" Width="120" Content="十四号手术间" Command="{Binding UpdateDrawerNo}" CommandParameter="13" />
|
||||||
|
<Button Margin="0 0 3 0" Grid.Row="5" Grid.Column="1" Width="120" Content="十五号手术间" Command="{Binding UpdateDrawerNo}" CommandParameter="14" />
|
||||||
|
<Button Margin="0 0 3 0" Grid.Row="6" Grid.Column="1" Width="120" Content="十六号手术间" Command="{Binding UpdateDrawerNo}" CommandParameter="15" />
|
||||||
|
<Button Margin="0 0 3 0" Grid.Row="7" Grid.Column="1" Width="120" Content="十七号手术间" Command="{Binding UpdateDrawerNo}" CommandParameter="16" />
|
||||||
|
<Button Margin="0 0 3 0" Grid.Row="8" Grid.Column="1" Width="120" Content="十八号手术间" Command="{Binding UpdateDrawerNo}" CommandParameter="17" />
|
||||||
|
<!--<Button Grid.Row="8" Grid.Column="1" Width="120" Content="19号药箱" Command="{Binding UpdateDrawerNo}" CommandParameter="19" />
|
||||||
|
<Button Grid.Row="9" Grid.Column="1" Width="120" Content="20号药箱" Command="{Binding UpdateDrawerNo}" CommandParameter="20" />-->
|
||||||
|
|
||||||
|
</Grid>
|
||||||
|
</Grid>
|
||||||
|
<Grid Grid.Column="1" Margin="6">
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="Auto" />
|
||||||
|
<RowDefinition Height="Auto" />
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
<StackPanel HorizontalAlignment="Right" Orientation="Horizontal" Grid.ColumnSpan="2">
|
||||||
|
<Button Margin="6 0 6 6"
|
||||||
|
Content="替换药品"
|
||||||
|
Command="{Binding ExchangeCommand}"
|
||||||
|
Style="{StaticResource MaterialDesignOutlinedLightButton}" />
|
||||||
|
<Button
|
||||||
|
Margin="0 0 6 6"
|
||||||
|
Style="{StaticResource MaterialDesignOutlinedLightButton}"
|
||||||
|
Content="移出药品"
|
||||||
|
Command="{Binding RemoveCommand}"/>
|
||||||
|
</StackPanel>
|
||||||
|
<ListView Grid.ColumnSpan="2"
|
||||||
|
Padding="0 6 0 0" Grid.Row="1"
|
||||||
|
ItemsSource="{Binding _ChannelStocks, UpdateSourceTrigger=PropertyChanged, Mode=TwoWay}"
|
||||||
|
SelectedItem="{Binding _ChannelStock}"
|
||||||
|
materialDesign:ListViewAssist.HeaderRowBackground="#31ccec"
|
||||||
|
materialDesign:DataGridAssist.ColumnHeaderPadding="10"
|
||||||
|
materialDesign:ListViewAssist.ListViewItemPadding="13">
|
||||||
|
<ListView.Resources>
|
||||||
|
<Style TargetType="{x:Type GridViewColumnHeader}" BasedOn="{StaticResource {x:Type GridViewColumnHeader}}">
|
||||||
|
<Setter Property="Foreground" Value="White" />
|
||||||
|
</Style>
|
||||||
|
</ListView.Resources>
|
||||||
|
<!--<i:Interaction.Triggers>
|
||||||
|
<i:EventTrigger EventName="SelectionChanged">
|
||||||
|
<i:InvokeCommandAction Command="{Binding RowSelected}" />
|
||||||
|
</i:EventTrigger>
|
||||||
|
</i:Interaction.Triggers>-->
|
||||||
|
<ListView.View>
|
||||||
|
<GridView ColumnHeaderContainerStyle="{StaticResource st}">
|
||||||
|
<GridViewColumn Header="药品名称" Width="150" DisplayMemberBinding="{Binding DrugInfo.DrugName}"/>
|
||||||
|
|
||||||
|
<GridViewColumn Header="规格" Width="150" DisplayMemberBinding="{Binding DrugInfo.DrugSpec}"/>
|
||||||
|
|
||||||
|
<GridViewColumn Header="批次" Width="100" DisplayMemberBinding="{Binding ManuNo}"/>
|
||||||
|
|
||||||
|
<GridViewColumn Header="库存" Width="100" DisplayMemberBinding="{Binding Quantity}"/>
|
||||||
|
|
||||||
|
</GridView>
|
||||||
|
</ListView.View>
|
||||||
|
</ListView>
|
||||||
|
<!--<materialDesign:Snackbar
|
||||||
|
Background="{Binding SnackbarBackground}"
|
||||||
|
MessageQueue="{Binding SnackbarMessageQueue}"/>-->
|
||||||
|
</Grid>
|
||||||
|
</Grid>
|
||||||
|
</UserControl>
|
||||||
|
|
@ -0,0 +1,28 @@
|
||||||
|
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>
|
||||||
|
/// ExchangeWindow.xaml 的交互逻辑
|
||||||
|
/// </summary>
|
||||||
|
public partial class ExchangeWindow : UserControl
|
||||||
|
{
|
||||||
|
public ExchangeWindow()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue