添加录屏功能,添加可多次加药,毒麻柜无药则显示无库存或未绑定,对应的药品先不补
This commit is contained in:
parent
a5d5a4aa40
commit
e79cdae0da
|
@ -74,6 +74,7 @@
|
|||
<PackageReference Include="NModbus4.NetCore" Version="2.0.1" />
|
||||
<PackageReference Include="Polly" Version="8.4.1" />
|
||||
<PackageReference Include="Prism.Unity" Version="8.1.97" />
|
||||
<PackageReference Include="ScreenRecorderLib" Version="6.5.1" />
|
||||
<PackageReference Include="SharpPromise" Version="1.7.0" />
|
||||
<PackageReference Include="SqlSugarCore" Version="5.1.4.67" />
|
||||
<PackageReference Include="SuperSimpleTcp" Version="3.0.10" />
|
||||
|
|
|
@ -116,11 +116,11 @@ namespace DM_Weight.ViewModels
|
|||
channelList.channelStocks = new List<ChannelStock>();
|
||||
}
|
||||
channelList.channelStocks.AddRange(ChannelStocks.Where(cs => cs.DrawerNo == DrawerNoList[i]).ToList());
|
||||
if (channelList != null)
|
||||
{
|
||||
channelList.State = 1;//统一将所有的状态设置为已取药待入库
|
||||
channelLists.Add(channelList);
|
||||
}
|
||||
//if (channelList != null)
|
||||
//{
|
||||
// channelList.State = 1;//统一将所有的状态设置为已取药待入库
|
||||
channelLists.Add(channelList);
|
||||
//}
|
||||
}
|
||||
_ChannelLists = channelLists;
|
||||
}
|
||||
|
@ -149,7 +149,7 @@ namespace DM_Weight.ViewModels
|
|||
selectedStock = _ChannelList.channelStocks.ToList();
|
||||
if (selectedStock != null && selectedStock.Count > 0)
|
||||
{
|
||||
selectedStock.ForEach(cs => cs.ChannelLst.State = 2);
|
||||
//selectedStock.ForEach(cs => cs.ChannelLst.State = 2);
|
||||
|
||||
int drawerNo = -1;
|
||||
for (int i = 0; i < selectedStock.Count; i++)
|
||||
|
@ -308,17 +308,22 @@ namespace DM_Weight.ViewModels
|
|||
selectedStock.ForEach(cs =>
|
||||
{
|
||||
cs.Quantity = cs.Quantity + cs.AddToJJNum;
|
||||
cs.NeedNum = 0;
|
||||
//cs.NeedNum = 0;
|
||||
cs.AddToJJNum = 0;
|
||||
//cs.State = 0;
|
||||
});
|
||||
SqlSugarHelper.Db.Updateable(selectedStock).ExecuteCommand();
|
||||
// 更新交接柜状态为 已取药未入库
|
||||
SqlSugarHelper.Db.Updateable(new ChannelList()
|
||||
{
|
||||
State = 0
|
||||
}).UpdateColumns(it => it.State).Where(it => it.DrawerNo == _ChannelList.DrawerNo).ExecuteCommand();
|
||||
//SqlSugarHelper.Db.Updateable(new ChannelList()
|
||||
//{
|
||||
// State = 0
|
||||
//}).UpdateColumns(it => it.State).Where(it => it.DrawerNo == _ChannelList.DrawerNo).ExecuteCommand();
|
||||
for (int i = 0; i < selectedStock.Count; i++)
|
||||
{
|
||||
int iUpdateResult = SqlSugarHelper.Db.Updateable<ChannelStock>()
|
||||
.SetColumns(cs => new ChannelStock() { State = 0 })
|
||||
.Where(cs => cs.DrawerNo == selectedStock[i].DrawerNo && cs.DrugId == selectedStock[i].DrugId && cs.MachineId == selectedStock[i].MachineId)
|
||||
.ExecuteCommand();
|
||||
string InvoiceId = "AddJiaoJieFromDM_" + CurrentTimeMillis();
|
||||
// 保存记录
|
||||
SqlSugarHelper.Db.Insertable(new MachineRecord()
|
||||
|
@ -392,7 +397,7 @@ namespace DM_Weight.ViewModels
|
|||
{
|
||||
if (channelStock != null)
|
||||
{
|
||||
if (channelStock.ChannelLst.State == 1)
|
||||
if (channelStock.State == 1)
|
||||
{
|
||||
channelStock.ChannelLst.IsSelected = !channelStock.ChannelLst.IsSelected;
|
||||
}
|
||||
|
|
|
@ -316,6 +316,7 @@ namespace DM_Weight.ViewModels
|
|||
MachineId = "DM5",
|
||||
AddToJJNum = 0,
|
||||
NeedNum = baseQuantity,
|
||||
State=0
|
||||
//ManuNo=DrugManuNo.ManuNo
|
||||
}).ExecuteCommand();
|
||||
// 保存数据 入库记录
|
||||
|
|
|
@ -1074,7 +1074,7 @@ namespace DM_Weight.ViewModels
|
|||
{
|
||||
AlertMsg alertMsg = new AlertMsg
|
||||
{
|
||||
Message = $"处方{oi.OrderNo}应药品批次{oi._OrderDetail.SetManuNo}无库存,无法确认",
|
||||
Message = $"处方{oi.OrderNo}因药品批次{oi._OrderDetail.SetManuNo}无库存,无法确认",
|
||||
Type = MsgType.ERROR,
|
||||
};
|
||||
_eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
|
||||
|
|
|
@ -182,14 +182,15 @@ namespace DM_Weight.ViewModels
|
|||
EffDate = it.EffDate,
|
||||
Id = it.Id,
|
||||
NeedNum = 0,
|
||||
AddToJJNum = 0
|
||||
AddToJJNum = 0,
|
||||
State = 0,
|
||||
}).UpdateColumns(it => new { it.Quantity, it.ManuNo, it.EffDate, it.NeedNum, it.AddToJJNum }).ExecuteCommand();
|
||||
|
||||
SqlSugarHelper.Db.Updateable(new ChannelList()
|
||||
{
|
||||
State = 0,
|
||||
Id = it.Chnguid
|
||||
}).UpdateColumns(cl => new { cl.State }).ExecuteCommand();
|
||||
//SqlSugarHelper.Db.Updateable(new ChannelList()
|
||||
//{
|
||||
// State = 0,
|
||||
// Id = it.Chnguid
|
||||
//}).UpdateColumns(cl => new { cl.State }).ExecuteCommand();
|
||||
|
||||
// 保存数据 盘点记录
|
||||
SqlSugarHelper.Db.Insertable(new MachineRecord()
|
||||
|
|
|
@ -127,16 +127,16 @@ namespace DM_Weight.ViewModels
|
|||
// _eventAggregator = eventAggregator;
|
||||
//}
|
||||
|
||||
public LoginWindowViewModel(IRegionManager regionManager, IEventAggregator eventAggregator, PortUtil portUtil, FingerprintUtil fingerprintUtil,SocketHelper socketHelper)
|
||||
public LoginWindowViewModel(IRegionManager regionManager, IEventAggregator eventAggregator, PortUtil portUtil, FingerprintUtil fingerprintUtil, SocketHelper socketHelper)
|
||||
{
|
||||
_fingerprintUtil = fingerprintUtil;
|
||||
_portUtil = portUtil;
|
||||
//_chkFunction= chcFunction;
|
||||
_regionManager = regionManager;
|
||||
_eventAggregator = eventAggregator;
|
||||
_socketHelper= socketHelper;
|
||||
_socketHelper = socketHelper;
|
||||
FingerMsg = !_fingerprintUtil.bIsConnected;
|
||||
NetMsg=!_socketHelper.ConnectedStatus;
|
||||
NetMsg = !_socketHelper.ConnectedStatus;
|
||||
_eventAggregator.GetEvent<FingerprintEvent>().Subscribe(LoginEvent);
|
||||
}
|
||||
private DelegateCommand? _loginCommand;
|
||||
|
@ -277,7 +277,7 @@ _exitCommand ??= new DelegateCommand(Exit);
|
|||
keys.Add("operator", user);
|
||||
//System.Windows.Application.Current.Dispatcher.Invoke(System.Windows.Threading.DispatcherPriority.Send, new Action(() =>
|
||||
//{
|
||||
_regionManager.RequestNavigate("MainRegion", "HomeWindow", keys);
|
||||
_regionManager.RequestNavigate("MainRegion", "HomeWindow", keys);
|
||||
//}));
|
||||
}
|
||||
// 双人登录模式
|
||||
|
@ -377,6 +377,8 @@ _exitCommand ??= new DelegateCommand(Exit);
|
|||
void Exit()
|
||||
{
|
||||
//_chkFunction.HIKLoginOut();
|
||||
//清录屏进程
|
||||
_eventAggregator.GetEvent<PrintScreenEvent>().Publish(2);
|
||||
_socketHelper.SocketDisConnect();
|
||||
Process.GetCurrentProcess().Kill();
|
||||
Environment.Exit(0);
|
||||
|
@ -465,6 +467,8 @@ _exitCommand ??= new DelegateCommand(Exit);
|
|||
{
|
||||
//FingerMsg = !_fingerprintUtil.bIsConnected;
|
||||
//_eventAggregator.GetEvent<FingerprintEvent>().Subscribe(LoginEvent);
|
||||
//结束录屏
|
||||
_eventAggregator.GetEvent<PrintScreenEvent>().Publish(0);
|
||||
}
|
||||
|
||||
|
||||
|
@ -478,6 +482,10 @@ _exitCommand ??= new DelegateCommand(Exit);
|
|||
public void OnNavigatedFrom(NavigationContext navigationContext)
|
||||
{
|
||||
_eventAggregator.GetEvent<FingerprintEvent>().Unsubscribe(LoginEvent);
|
||||
#region 录屏
|
||||
//登录进来后开始录屏
|
||||
_eventAggregator.GetEvent<PrintScreenEvent>().Publish(1);
|
||||
#endregion
|
||||
}
|
||||
//手动实现调用配置的逻辑 规避修改配置文件后不起作用的问题
|
||||
public string ReadAppSetting(string key)
|
||||
|
|
|
@ -1,30 +1,40 @@
|
|||
using MaterialDesignThemes.Wpf;
|
||||
using DM_Weight.Finger;
|
||||
using DM_Weight.HIKVISION;
|
||||
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 MaterialDesignThemes.Wpf;
|
||||
using Prism.Commands;
|
||||
using Prism.Events;
|
||||
using Prism.Mvvm;
|
||||
using Prism.Regions;
|
||||
using ScreenRecorderLib;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Media;
|
||||
using DM_Weight.msg;
|
||||
using DM_Weight.Port;
|
||||
using DM_Weight.util;
|
||||
using DM_Weight.Finger;
|
||||
using DM_Weight.Views;
|
||||
using Unity;
|
||||
using DM_Weight.HIKVISION;
|
||||
using log4net.Repository.Hierarchy;
|
||||
using log4net;
|
||||
using DM_Weight.Models;
|
||||
using System.Windows;
|
||||
using System.Windows.Media;
|
||||
using Unity;
|
||||
|
||||
namespace DM_Weight.ViewModels
|
||||
{
|
||||
internal class MainWindowViewModel : BindableBase
|
||||
{
|
||||
|
||||
#region 录屏相关
|
||||
public Recorder _recorder;
|
||||
private string _outputFolder;
|
||||
private string _outputFilePath;
|
||||
public static MainWindowViewModel vm;
|
||||
#endregion
|
||||
|
||||
private string _title = "Prism App"; //标题
|
||||
|
||||
private ISnackbarMessageQueue _snackbarMessageQueue = new SnackbarMessageQueue(TimeSpan.FromSeconds(3));
|
||||
|
@ -74,9 +84,11 @@ namespace DM_Weight.ViewModels
|
|||
private PortUtil _portUtil;
|
||||
public MainWindowViewModel(IRegionManager regionManager, IUnityContainer container, IEventAggregator eventAggregator, FingerprintUtil fingerprintUtil, SocketHelper socketHelper, PortUtil portUtil)
|
||||
{
|
||||
vm = this;
|
||||
_portUtil = portUtil;
|
||||
this.eventAggregator = eventAggregator;
|
||||
this.eventAggregator.GetEvent<SnackbarEvent>().Subscribe(doMyPrismEvent2);
|
||||
this.eventAggregator.GetEvent<PrintScreenEvent>().Subscribe(PrintScreen);
|
||||
_fingerprintUtil = fingerprintUtil;
|
||||
_regionManager = regionManager;
|
||||
_container = container;
|
||||
|
@ -146,6 +158,90 @@ namespace DM_Weight.ViewModels
|
|||
SnackbarMessageQueue.Enqueue(msg.Message);
|
||||
}));
|
||||
}
|
||||
#region 录屏
|
||||
/// <summary>
|
||||
/// 录屏事件
|
||||
/// </summary>
|
||||
/// <param name="type">0停止录屏;1开始录屏;2退出软件清进程</param>
|
||||
void PrintScreen(int type)
|
||||
{
|
||||
if (type == 0)
|
||||
{
|
||||
StopPrintScreen();
|
||||
//删除7天前的录屏文件
|
||||
|
||||
if (Directory.Exists(_outputFolder))
|
||||
{
|
||||
var files = Directory.GetFiles(_outputFolder);
|
||||
foreach (var file in files)
|
||||
{
|
||||
var fileInfo = new FileInfo(file);
|
||||
if (fileInfo.CreationTime < DateTime.Now.AddDays(-7))
|
||||
{
|
||||
try
|
||||
{
|
||||
fileInfo.Delete();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
logger.Error($"删除录屏文件失败: {ex.Message}");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (type == 1)
|
||||
{
|
||||
StartPrintScreen();
|
||||
}
|
||||
else if (type == 2)
|
||||
{
|
||||
_recorder?.Dispose();
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
void StopPrintScreen()
|
||||
{
|
||||
|
||||
//退出登录结束录屏
|
||||
_recorder?.Stop();
|
||||
}
|
||||
//录屏
|
||||
void StartPrintScreen()
|
||||
{
|
||||
|
||||
// 创建输出目录
|
||||
_outputFolder = Path.Combine(AppDomain.CurrentDomain.BaseDirectory + "Log", "ScreenRecordings");
|
||||
if (!Directory.Exists(_outputFolder))
|
||||
{
|
||||
Directory.CreateDirectory(_outputFolder);
|
||||
}
|
||||
// 生成输出文件名
|
||||
string timestamp = DateTime.Now.ToString("yyyyMMdd_HHmmss");
|
||||
_outputFilePath = Path.Combine(_outputFolder, $"{timestamp}.mp4");
|
||||
|
||||
// 设置录制选项
|
||||
var options = new RecorderOptions();
|
||||
|
||||
// 创建录制器实例
|
||||
_recorder = Recorder.CreateRecorder(options);
|
||||
|
||||
// 设置事件处理
|
||||
_recorder.OnRecordingComplete += Recorder_OnRecordingComplete;
|
||||
_recorder.OnRecordingFailed += Recorder_OnRecordingFailed;
|
||||
|
||||
// 开始录制
|
||||
_recorder.Record(_outputFilePath);
|
||||
}
|
||||
//录制失败
|
||||
private void Recorder_OnRecordingFailed(object sender, RecordingFailedEventArgs e)
|
||||
{
|
||||
logger.Info($"录制失败: {e.Error}");
|
||||
}
|
||||
//录制完成
|
||||
private void Recorder_OnRecordingComplete(object sender, RecordingCompleteEventArgs e)
|
||||
{
|
||||
logger.Info($"录制完成: {e.FilePath}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -240,9 +240,21 @@
|
|||
</DataTemplate>
|
||||
</GridViewColumn.CellTemplate>
|
||||
</GridViewColumn>
|
||||
<GridViewColumn Width="100"
|
||||
DisplayMemberBinding="{Binding State,Converter={StaticResource StockStatusConverter},ConverterParameter=TextState}"
|
||||
Header="状态"/>
|
||||
<GridViewColumn Width="130"
|
||||
Header="状态">
|
||||
<GridViewColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<ListBox ItemsSource="{Binding channelStocks}" materialDesign:ListBoxItemAssist.ShowSelection="False">
|
||||
<ListBox.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<TextBlock Width="130" Text="{Binding State,Converter={StaticResource StockStatusConverter},ConverterParameter=TextState}">
|
||||
</TextBlock>
|
||||
</DataTemplate>
|
||||
</ListBox.ItemTemplate>
|
||||
</ListBox>
|
||||
</DataTemplate>
|
||||
</GridViewColumn.CellTemplate>
|
||||
</GridViewColumn>
|
||||
</GridView>
|
||||
</ListView.View>
|
||||
</ListView>
|
||||
|
|
|
@ -1,4 +1,10 @@
|
|||
using Prism.Events;
|
||||
using DM_Weight.msg;
|
||||
using DM_Weight.Port;
|
||||
using DM_Weight.util;
|
||||
using DM_Weight.ViewModels;
|
||||
using log4net;
|
||||
using log4net.Repository.Hierarchy;
|
||||
using Prism.Events;
|
||||
using Prism.Ioc;
|
||||
using Prism.Regions;
|
||||
using System;
|
||||
|
@ -16,11 +22,6 @@ using System.Windows.Media.Imaging;
|
|||
using System.Windows.Shapes;
|
||||
using Unity;
|
||||
using Unity.Lifetime;
|
||||
using DM_Weight.msg;
|
||||
using DM_Weight.util;
|
||||
using log4net.Repository.Hierarchy;
|
||||
using DM_Weight.Port;
|
||||
using log4net;
|
||||
|
||||
namespace DM_Weight.Views
|
||||
{
|
||||
|
@ -31,10 +32,12 @@ namespace DM_Weight.Views
|
|||
{
|
||||
//IRegionManager _regionManager;
|
||||
//IUnityContainer _container;
|
||||
MainWindowViewModel vms;
|
||||
private readonly ILog logger = LogManager.GetLogger(typeof(PortUtil));
|
||||
public MainWindow()
|
||||
{
|
||||
InitializeComponent();
|
||||
vms = MainWindowViewModel.vm;
|
||||
//_regionManager = regionManager;
|
||||
//_container = container;
|
||||
//System.Windows.Application.Current.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Send, new Action(() =>
|
||||
|
@ -46,6 +49,10 @@ namespace DM_Weight.Views
|
|||
//}));
|
||||
|
||||
}
|
||||
|
||||
protected override void OnClosed(EventArgs e)
|
||||
{
|
||||
vms._recorder?.Dispose();
|
||||
base.OnClosed(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
using Prism.Events;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace DM_Weight.msg
|
||||
{
|
||||
internal class PrintScreenEvent : PubSubEvent<int>
|
||||
{
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue