登录系统录像机开始录像,退出系统停止录像
This commit is contained in:
parent
55dbe8185a
commit
e3054d0d28
|
@ -16,7 +16,7 @@
|
|||
<!--2023/7/13 药房代码 有则写无则空 -->
|
||||
<add key="storage" value="" />
|
||||
<!-- 登录模式 1单人登录2双人登录 -->
|
||||
<add key="loginMode" value="2" />
|
||||
<add key="loginMode" value="1" />
|
||||
<!-- 登录顺序,指定先登录的人的名称有效值,只有在登录模式等于2时才会生效; 发药人:【operator】审核人:【reviewer】 -->
|
||||
<add key="firstLogin" value="operator" />
|
||||
<!-- 按处方还药或者按取药记录还药 1:处方(ReturnDrugWindow2)2:药品(ReturnDrugWindow)-->
|
||||
|
@ -60,7 +60,16 @@
|
|||
<add key="MultiOrder" value="1"/>
|
||||
<!-- 多批次抽屉加药 0:不启用 1:启用
|
||||
启用channel_list记录库位信息 -->
|
||||
<add key="MultiBatch" value="0"/>
|
||||
<add key="MultiBatch" value="1"/>
|
||||
|
||||
<!--海康威视IP-->
|
||||
<add key="HIKIP" value="192.168.1.15"/>
|
||||
<!--海康威视端口-->
|
||||
<add key="HIKPort" value="8000"/>
|
||||
<!--海康威视用户名-->
|
||||
<add key="HIKUser" value="admin"/>
|
||||
<!--海康威视密码-->
|
||||
<add key="HIKPassword" value="HKC123456"/>
|
||||
|
||||
</appSettings>
|
||||
</configuration>
|
|
@ -23,6 +23,7 @@ using log4net;
|
|||
using System.Windows.Interop;
|
||||
using System.Windows.Threading;
|
||||
using System.Timers;
|
||||
using DM_Weight.HIKVISION;
|
||||
|
||||
namespace DM_Weight
|
||||
{
|
||||
|
@ -92,9 +93,11 @@ namespace DM_Weight
|
|||
// 串口工具
|
||||
containerRegistry.RegisterSingleton<PortUtil>();
|
||||
// 指纹机工具
|
||||
//containerRegistry.RegisterSingleton<FingerprintUtil>();
|
||||
containerRegistry.RegisterSingleton<FingerprintUtil>();
|
||||
// 组态屏工具
|
||||
containerRegistry.RegisterSingleton<ScreenUtil>();
|
||||
// 录像机
|
||||
containerRegistry.RegisterSingleton<CHKFunction>();
|
||||
|
||||
containerRegistry.Register<IDialogService, MaterialDialogService>();
|
||||
|
||||
|
|
|
@ -0,0 +1,35 @@
|
|||
using DM_Weight.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Data;
|
||||
|
||||
namespace DM_Weight.Converter
|
||||
{
|
||||
public class TotalCountConverter : IValueConverter
|
||||
{
|
||||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
var total = 0;
|
||||
// DataGrid分组后对应的组及组内元素CollectionViewGroup.Items 类型是ReadOnlyObservableCollection<object>
|
||||
if (value is List<ChannelStock> items)
|
||||
{
|
||||
foreach (var item in items)
|
||||
{
|
||||
var de = item as ChannelStock;
|
||||
total += de.Quantity;
|
||||
}
|
||||
}
|
||||
return total;
|
||||
}
|
||||
|
||||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -119,4 +119,8 @@
|
|||
</Page>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Folder Include="HIKVISION\" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
|
|
@ -161,8 +161,16 @@ namespace DM_Weight.Finger
|
|||
bool result = false;
|
||||
// 取消其他操作
|
||||
bool res2 = axCZKEM1.CancelOperation();
|
||||
// 删除源指纹
|
||||
bool res = axCZKEM1.DelUserTmp(machineNumber, Id, FingerIndex);
|
||||
if (machineType == 1)
|
||||
{
|
||||
// 删除源指纹
|
||||
bool res = axCZKEM1.DelUserTmp(machineNumber, Id, FingerIndex);
|
||||
}
|
||||
else
|
||||
{
|
||||
// 删除源指纹
|
||||
bool res = axCZKEM1.SSR_DelUserTmp(machineNumber, Id.ToString(), FingerIndex);
|
||||
}
|
||||
// 添加新指纹
|
||||
result = axCZKEM1.StartEnrollEx(Id.ToString(), FingerIndex, 3);
|
||||
return result;
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,166 @@
|
|||
using DM_Weight.util;
|
||||
using PreviewDemo;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows;
|
||||
|
||||
namespace DM_Weight.HIKVISION
|
||||
{
|
||||
public class CHKFunction
|
||||
{
|
||||
private bool m_bInitSDK = false;
|
||||
|
||||
private Int32 m_lRealHandle = -1;
|
||||
public static int HKUserId = -1;
|
||||
private uint iLastErr = 0;
|
||||
private string str;
|
||||
|
||||
public CHCNetSDK.NET_DVR_USER_LOGIN_INFO struLogInfo;
|
||||
public CHCNetSDK.NET_DVR_DEVICEINFO_V40 DeviceInfo;
|
||||
|
||||
|
||||
private System.ComponentModel.Container components = null;
|
||||
|
||||
public CHKFunction()
|
||||
{
|
||||
HIKInit();
|
||||
HIKLogin();
|
||||
}
|
||||
|
||||
public bool HIKInit()
|
||||
{
|
||||
m_bInitSDK = CHCNetSDK.NET_DVR_Init();
|
||||
if (m_bInitSDK == false)
|
||||
{
|
||||
//MessageBox.Show("NET_DVR_Init error!");
|
||||
//return;
|
||||
}
|
||||
else
|
||||
{
|
||||
//保存SDK日志 To save the SDK log
|
||||
CHCNetSDK.NET_DVR_SetLogToFile(3, "C:\\SdkLog\\", true);
|
||||
}
|
||||
return m_bInitSDK;
|
||||
}
|
||||
|
||||
public int HIKLogin()
|
||||
{
|
||||
string ip= ReadApp.ReadAppSetting("HIKIP");
|
||||
string port=ReadApp.ReadAppSetting("HIKPort");
|
||||
string userName= ReadApp.ReadAppSetting("HIKUser");
|
||||
string password= ReadApp.ReadAppSetting("HIKPassword");
|
||||
if (HKUserId < 0)
|
||||
{
|
||||
|
||||
struLogInfo = new CHCNetSDK.NET_DVR_USER_LOGIN_INFO();
|
||||
|
||||
//设备IP地址或者域名
|
||||
byte[] byIP = System.Text.Encoding.Default.GetBytes(ip);
|
||||
struLogInfo.sDeviceAddress = new byte[129];
|
||||
byIP.CopyTo(struLogInfo.sDeviceAddress, 0);
|
||||
|
||||
//设备用户名
|
||||
byte[] byUserName = System.Text.Encoding.Default.GetBytes(userName);
|
||||
struLogInfo.sUserName = new byte[64];
|
||||
byUserName.CopyTo(struLogInfo.sUserName, 0);
|
||||
|
||||
//设备密码
|
||||
byte[] byPassword = System.Text.Encoding.Default.GetBytes(password);
|
||||
struLogInfo.sPassword = new byte[64];
|
||||
byPassword.CopyTo(struLogInfo.sPassword, 0);
|
||||
|
||||
struLogInfo.wPort = ushort.Parse(port);//设备服务端口号
|
||||
|
||||
//if (LoginCallBack == null)
|
||||
//{
|
||||
// LoginCallBack = new CHCNetSDK.LOGINRESULTCALLBACK(cbLoginCallBack);//注册回调函数
|
||||
//}
|
||||
//struLogInfo.cbLoginResult = LoginCallBack;
|
||||
struLogInfo.bUseAsynLogin = false; //是否异步登录:0- 否,1- 是
|
||||
|
||||
DeviceInfo = new CHCNetSDK.NET_DVR_DEVICEINFO_V40();
|
||||
|
||||
//登录设备 Login the device
|
||||
HKUserId = CHCNetSDK.NET_DVR_Login_V40(ref struLogInfo, ref DeviceInfo);
|
||||
if (HKUserId < 0)
|
||||
{
|
||||
iLastErr = CHCNetSDK.NET_DVR_GetLastError();
|
||||
str = "NET_DVR_Login_V40 failed, error code= " + iLastErr; //登录失败,输出错误号
|
||||
MessageBox.Show(str);
|
||||
}
|
||||
else
|
||||
{
|
||||
//登录成功
|
||||
//MessageBox.Show("Login Success!");
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
//注销登录 Logout the device
|
||||
if (m_lRealHandle >= 0)
|
||||
{
|
||||
//MessageBox.Show("Please stop live view firstly");
|
||||
}
|
||||
|
||||
if (!CHCNetSDK.NET_DVR_Logout(HKUserId))
|
||||
{
|
||||
iLastErr = CHCNetSDK.NET_DVR_GetLastError();
|
||||
str = "NET_DVR_Logout failed, error code= " + iLastErr;
|
||||
}
|
||||
HKUserId = -1;
|
||||
}
|
||||
return HKUserId;
|
||||
}
|
||||
|
||||
public void HIKLoginOut()
|
||||
{
|
||||
if (m_lRealHandle >= 0)
|
||||
{
|
||||
CHCNetSDK.NET_DVR_StopRealPlay(m_lRealHandle);
|
||||
}
|
||||
if (HKUserId >= 0)
|
||||
{
|
||||
CHCNetSDK.NET_DVR_Logout(HKUserId);
|
||||
}
|
||||
if (m_bInitSDK == true)
|
||||
{
|
||||
CHCNetSDK.NET_DVR_Cleanup();
|
||||
}
|
||||
}
|
||||
|
||||
public bool HIKStartDVRRecord()
|
||||
{
|
||||
bool isStart= CHCNetSDK.NET_DVR_StartDVRRecord(HKUserId, 0xffff, 0);
|
||||
return isStart;
|
||||
}
|
||||
public bool HIKStopDVRRecord()
|
||||
{
|
||||
bool isStart = CHCNetSDK.NET_DVR_StopDVRRecord(HKUserId, 0xffff);
|
||||
return isStart;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 清理所有正在使用的资源。
|
||||
/// </summary>
|
||||
public void Dispose()
|
||||
{
|
||||
if (m_lRealHandle >= 0)
|
||||
{
|
||||
CHCNetSDK.NET_DVR_StopRealPlay(m_lRealHandle);
|
||||
}
|
||||
if (HKUserId >= 0)
|
||||
{
|
||||
CHCNetSDK.NET_DVR_Logout(HKUserId);
|
||||
}
|
||||
if (m_bInitSDK == true)
|
||||
{
|
||||
CHCNetSDK.NET_DVR_Cleanup();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -539,7 +539,7 @@ namespace DM_Weight.Port
|
|||
_eventAggregator.GetEvent<PortUtilEvent>().Publish(new util.DeviceMsg()
|
||||
{
|
||||
EventType = util.EventType.DRAWERCLOSE,
|
||||
WindowName = WindowName,
|
||||
WindowName = _WindowName,
|
||||
});
|
||||
logger.Info($"储物箱关闭");
|
||||
}
|
||||
|
|
|
@ -22,6 +22,7 @@ using Unity;
|
|||
using System.Windows.Threading;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using DM_Weight.msg;
|
||||
using DM_Weight.HIKVISION;
|
||||
|
||||
namespace DM_Weight.ViewModels
|
||||
{
|
||||
|
@ -156,6 +157,8 @@ namespace DM_Weight.ViewModels
|
|||
SelectedMenu = viewName.SelectedItem as PremissionDm;
|
||||
if (SelectedMenu.PremissionName == "退出")
|
||||
{
|
||||
|
||||
_chkFunction.HIKStopDVRRecord();
|
||||
logger.Info($"用户【{Operator?.Nickname}】退出登录");
|
||||
Operator = null;
|
||||
Reviewer = null;
|
||||
|
@ -183,14 +186,16 @@ namespace DM_Weight.ViewModels
|
|||
public bool Is16Drawer { get => _is16Drawer; set => SetProperty(ref _is16Drawer, value); }
|
||||
public bool KeepAlive => false;
|
||||
private PortUtil _portUtil;
|
||||
private CHKFunction _chkFunction;
|
||||
IEventAggregator _eventAggregator;
|
||||
public HomeWindowViewModel(IRegionManager iRegionManager, PortUtil portUtil, IDialogService dialogService, IUnityContainer container, IEventAggregator eventAggregator)
|
||||
public HomeWindowViewModel(IRegionManager iRegionManager, PortUtil portUtil, IDialogService dialogService, IUnityContainer container, IEventAggregator eventAggregator,CHKFunction cHKFunction)
|
||||
{
|
||||
_portUtil = portUtil;
|
||||
_regionManager = iRegionManager;
|
||||
_dialogService = dialogService;
|
||||
_container = container;
|
||||
this._eventAggregator = eventAggregator;
|
||||
_chkFunction= cHKFunction;
|
||||
}
|
||||
|
||||
public DelegateCommand<string> OpenFingerDialog
|
||||
|
@ -267,6 +272,7 @@ namespace DM_Weight.ViewModels
|
|||
//接收导航传过来的参数
|
||||
public void OnNavigatedTo(NavigationContext navigationContext)
|
||||
{
|
||||
_portUtil.dateTime = DateTime.Now;
|
||||
//取出user
|
||||
UserList = navigationContext.Parameters.GetValue<UserList>("operator");
|
||||
Operator = UserList;
|
||||
|
@ -316,6 +322,7 @@ namespace DM_Weight.ViewModels
|
|||
if ((DateTime.Now - _portUtil.dateTime).TotalSeconds > autoExit && CheckComputerFreeState.GetLastInputTime() > autoExit)
|
||||
{
|
||||
logger.Info($"设备30秒内无人操作,用户【{Operator?.Nickname}】自动退出登录");
|
||||
_chkFunction.HIKStopDVRRecord();
|
||||
Operator = null;
|
||||
Reviewer = null;
|
||||
Application.Current.Dispatcher.Invoke(() =>
|
||||
|
@ -328,6 +335,7 @@ namespace DM_Weight.ViewModels
|
|||
};
|
||||
timer.Start();
|
||||
}
|
||||
_chkFunction.HIKStartDVRRecord();
|
||||
}
|
||||
|
||||
//每次导航的时候,该实列用不用重新创建,true是不重新创建,false是重新创建
|
||||
|
|
|
@ -24,6 +24,7 @@ using System.Collections.ObjectModel;
|
|||
using Microsoft.Win32;
|
||||
using System.Xml;
|
||||
using System.Diagnostics;
|
||||
using DM_Weight.HIKVISION;
|
||||
|
||||
namespace DM_Weight.ViewModels
|
||||
{
|
||||
|
@ -55,6 +56,7 @@ namespace DM_Weight.ViewModels
|
|||
private FingerprintUtil _fingerprintUtil;
|
||||
|
||||
private PortUtil _portUtil;
|
||||
private CHKFunction _chkFunction;
|
||||
|
||||
public Boolean LoginBtnEnable { get { return _loginBtnEnable; } set { SetProperty(ref _loginBtnEnable, value); } }
|
||||
public string Password { get { return password; } set { SetProperty(ref password, value); } }
|
||||
|
@ -87,10 +89,11 @@ namespace DM_Weight.ViewModels
|
|||
// _regionManager = regionManager;
|
||||
// _eventAggregator = eventAggregator;
|
||||
//}
|
||||
public LoginWindowViewModel(IRegionManager regionManager, IEventAggregator eventAggregator, PortUtil portUtil)
|
||||
public LoginWindowViewModel(IRegionManager regionManager, IEventAggregator eventAggregator, PortUtil portUtil, CHKFunction chcFunction)
|
||||
{
|
||||
//_fingerprintUtil = fingerprintUtil;
|
||||
_portUtil = portUtil;
|
||||
_chkFunction= chcFunction;
|
||||
_regionManager = regionManager;
|
||||
_eventAggregator = eventAggregator;
|
||||
}
|
||||
|
@ -286,7 +289,7 @@ _exitCommand ??= new DelegateCommand(Exit);
|
|||
|
||||
void Exit()
|
||||
{
|
||||
|
||||
_chkFunction.Dispose();
|
||||
Process.GetCurrentProcess().Kill();
|
||||
Environment.Exit(0);
|
||||
}
|
||||
|
|
|
@ -15,6 +15,7 @@ using DM_Weight.util;
|
|||
using DM_Weight.Finger;
|
||||
using DM_Weight.Views;
|
||||
using Unity;
|
||||
using DM_Weight.HIKVISION;
|
||||
|
||||
namespace DM_Weight.ViewModels
|
||||
{
|
||||
|
@ -62,7 +63,8 @@ namespace DM_Weight.ViewModels
|
|||
private FingerprintUtil _fingerprintUtil;
|
||||
IRegionManager _regionManager;
|
||||
IUnityContainer _container;
|
||||
public MainWindowViewModel(IRegionManager regionManager, IUnityContainer container, IEventAggregator eventAggregator, FingerprintUtil fingerprintUtil, ScreenUtil screenUtil)
|
||||
private CHKFunction _cHKFunction;
|
||||
public MainWindowViewModel(IRegionManager regionManager, IUnityContainer container, IEventAggregator eventAggregator, FingerprintUtil fingerprintUtil, ScreenUtil screenUtil, CHKFunction cHKFunction)
|
||||
{
|
||||
//_portUtil = portUtil;
|
||||
this.eventAggregator = eventAggregator;
|
||||
|
@ -71,6 +73,7 @@ namespace DM_Weight.ViewModels
|
|||
_fingerprintUtil = fingerprintUtil;
|
||||
_regionManager = regionManager;
|
||||
_container = container;
|
||||
_cHKFunction = cHKFunction;
|
||||
System.Windows.Application.Current.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Send, new Action(() =>
|
||||
{
|
||||
|
||||
|
|
|
@ -162,26 +162,49 @@ namespace DM_Weight.ViewModels
|
|||
continuationCallback(true);
|
||||
}
|
||||
|
||||
private List<DrugInfo>? _drugs = new();
|
||||
|
||||
public List<DrugInfo>? Drugs
|
||||
{
|
||||
get => _drugs;
|
||||
set => SetProperty(ref _drugs, value);
|
||||
}
|
||||
private DrugInfo? _drug;
|
||||
|
||||
public DrugInfo? Drug
|
||||
{
|
||||
get => _drug;
|
||||
set => SetProperty(ref _drug, value);
|
||||
}
|
||||
public void RequestData()
|
||||
{
|
||||
ChannelStocks.Clear();
|
||||
List<ChannelStock> q = SqlSugarHelper.Db.Queryable<ChannelStock>()
|
||||
.Includes<DrugInfo>(cs => cs.DrugInfo)
|
||||
.Where(cs => cs.DrawerType == 1)
|
||||
.Where(cs =>cs.DrugId != null)
|
||||
.Where(cs => cs.MachineId.Equals(ConfigurationManager.AppSettings["machineId"] ?? "DM1"))
|
||||
|
||||
.WhereIF(!String.IsNullOrEmpty(SearchValue),cs => cs.DrugInfo.DrugName == SearchValue)
|
||||
.OrderBy(cs => cs.DrugId)
|
||||
.OrderBy(cs => cs.DrawerNo)
|
||||
.OrderBy(cs => cs.ColNo)
|
||||
.ToList();
|
||||
//ChannelStocks.Clear();
|
||||
//List<ChannelStock> q = SqlSugarHelper.Db.Queryable<ChannelStock>()
|
||||
// .Includes<DrugInfo>(cs => cs.DrugInfo)
|
||||
// .Where(cs => cs.DrawerType == 1)
|
||||
// .Where(cs =>cs.DrugId != null)
|
||||
// .Where(cs => cs.MachineId.Equals(ConfigurationManager.AppSettings["machineId"] ?? "DM1"))
|
||||
|
||||
// .WhereIF(!String.IsNullOrEmpty(SearchValue),cs => cs.DrugInfo.DrugName == SearchValue)
|
||||
// .OrderBy(cs => cs.DrugId)
|
||||
// .OrderBy(cs => cs.DrawerNo)
|
||||
// .OrderBy(cs => cs.ColNo)
|
||||
// .ToList();
|
||||
|
||||
//ICollectionView vw = CollectionViewSource.GetDefaultView(q);
|
||||
//vw.GroupDescriptions.Add(new PropertyGroupDescription("DrugInfo"));
|
||||
//ChannelStocks = q;
|
||||
|
||||
ChannelStocks.Clear();
|
||||
|
||||
List<DrugInfo> q = SqlSugarHelper.Db.Queryable<DrugInfo>()
|
||||
.Includes<ChannelStock>(di => di.channelStocks.Where(cs => cs.DrawerType == 1).Where(cs => cs.MachineId.Equals(ConfigurationManager.AppSettings["machineId"] ?? "DM1") && cs.DrugId != null).OrderBy(cs => cs.DrawerNo).OrderBy(cs => cs.ColNo).ToList())
|
||||
.WhereIF(!String.IsNullOrEmpty(SearchValue), di => di.DrugName == SearchValue)
|
||||
.Where(di => di.channelStocks.Any(cs => cs.MachineId.Equals(ConfigurationManager.AppSettings["machineId"] ?? "DM1") && cs.DrugId != null))
|
||||
.OrderBy(cs => cs.DrugId)
|
||||
.ToList();
|
||||
Drugs = q;
|
||||
|
||||
ICollectionView vw = CollectionViewSource.GetDefaultView(q);
|
||||
vw.GroupDescriptions.Add(new PropertyGroupDescription("DrugInfo"));
|
||||
ChannelStocks = q;
|
||||
|
||||
}
|
||||
|
||||
//接收导航传过来的参数 现在是在此处初始化了表格数据
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
<Grid>
|
||||
<Grid.Resources>
|
||||
<convert:GroupSumConverter x:Key="GroupSumConverter" />
|
||||
<convert:TotalCountConverter x:Key="TotalCountConverter" />
|
||||
</Grid.Resources>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
|
@ -40,7 +41,7 @@
|
|||
Style="{StaticResource MaterialDesignOutlinedTextBox}"/>
|
||||
|
||||
<StackPanel Grid.Column="2" Orientation="Horizontal" HorizontalAlignment="Right">
|
||||
|
||||
|
||||
<Button
|
||||
Style="{StaticResource MaterialDesignOutlinedLightButton}"
|
||||
ToolTip="库存导出"
|
||||
|
@ -67,8 +68,8 @@
|
|||
<DataGrid
|
||||
Grid.Row="1"
|
||||
materialDesign:DataGridAssist.ColumnHeaderPadding="15"
|
||||
ItemsSource="{Binding ChannelStocks}"
|
||||
SelectedItem="SelectedChannel"
|
||||
ItemsSource="{Binding Drugs}"
|
||||
SelectedItem="Drug"
|
||||
materialDesign:DataGridAssist.EnableEditBoxAssist="False"
|
||||
IsSynchronizedWithCurrentItem="True"
|
||||
materialDesign:DataGridAssist.CellPadding="13"
|
||||
|
@ -83,20 +84,38 @@
|
|||
<Setter Property="BorderThickness" Value="0.6"/>
|
||||
<Setter Property="HorizontalContentAlignment" Value="Center"/>
|
||||
</Style>
|
||||
<Style TargetType="{x:Type DataGridCell}" BasedOn="{StaticResource MaterialDesignDataGridCell}">
|
||||
<!--<Style TargetType="{x:Type DataGridCell}" BasedOn="{StaticResource MaterialDesignDataGridCell}">
|
||||
<Style.Triggers>
|
||||
<Trigger Property="IsReadOnly" Value="True">
|
||||
<Setter Property="BorderBrush" Value="Transparent" />
|
||||
<Setter Property="HorizontalAlignment" Value="Left"/>
|
||||
<Setter Property="HorizontalAlignment" Value="Center"/>
|
||||
</Trigger>
|
||||
</Style.Triggers>
|
||||
<Setter Property="HorizontalAlignment" Value="Center"/>
|
||||
</Style>-->
|
||||
<Style TargetType="DataGridCell">
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="DataGridCell">
|
||||
<TextBlock TextAlignment="Center" VerticalAlignment="Center" >
|
||||
<ContentPresenter Margin="13" />
|
||||
</TextBlock>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
<Style.Triggers>
|
||||
<Trigger Property="IsSelected" Value="True">
|
||||
<Setter Property="Foreground" Value="Black"/>
|
||||
<Setter Property="BorderBrush" Value="Transparent" />
|
||||
</Trigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</DataGrid.Resources>
|
||||
<!--GroupStyle to group data-->
|
||||
<DataGrid.GroupStyle>
|
||||
<GroupStyle>
|
||||
<!--Group DataItems into DataGroup-->
|
||||
<GroupStyle.ContainerStyle>
|
||||
<!--<DataGrid.GroupStyle>
|
||||
<GroupStyle>-->
|
||||
<!--Group DataItems into DataGroup-->
|
||||
<!--<GroupStyle.ContainerStyle>
|
||||
<Style TargetType="{x:Type GroupItem}">
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
|
@ -123,8 +142,42 @@
|
|||
</GroupStyle.ContainerStyle>
|
||||
|
||||
</GroupStyle>
|
||||
</DataGrid.GroupStyle>
|
||||
</DataGrid.GroupStyle>-->
|
||||
<DataGrid.Columns>
|
||||
<DataGridTextColumn IsReadOnly="True" Header="药品" Binding="{Binding DrugName}"/>
|
||||
<DataGridTextColumn IsReadOnly="True" Header="规格" Binding="{Binding DrugSpec}"/>
|
||||
<DataGridTextColumn IsReadOnly="True" Header="总库存" Binding="{Binding Path=channelStocks,Converter={StaticResource TotalCountConverter}}"/>
|
||||
|
||||
<DataGridTemplateColumn Header="库位" IsReadOnly="True">
|
||||
<DataGridTemplateColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<ListBox ItemsSource="{Binding channelStocks}" DisplayMemberPath="Location" materialDesign:ListBoxItemAssist.ShowSelection="False"></ListBox>
|
||||
</DataTemplate>
|
||||
</DataGridTemplateColumn.CellTemplate>
|
||||
</DataGridTemplateColumn>
|
||||
<DataGridTemplateColumn Header="批次" IsReadOnly="True">
|
||||
<DataGridTemplateColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<ListBox ItemsSource="{Binding channelStocks}" DisplayMemberPath="ManuNo" materialDesign:ListBoxItemAssist.ShowSelection="False"></ListBox>
|
||||
</DataTemplate>
|
||||
</DataGridTemplateColumn.CellTemplate>
|
||||
</DataGridTemplateColumn>
|
||||
<DataGridTemplateColumn Header="效期" IsReadOnly="True">
|
||||
<DataGridTemplateColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<ListBox ItemsSource="{Binding channelStocks}" DisplayMemberPath="EffDate" materialDesign:ListBoxItemAssist.ShowSelection="False"></ListBox>
|
||||
</DataTemplate>
|
||||
</DataGridTemplateColumn.CellTemplate>
|
||||
</DataGridTemplateColumn>
|
||||
<DataGridTemplateColumn Header="库存" IsReadOnly="True">
|
||||
<DataGridTemplateColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<ListBox ItemsSource="{Binding channelStocks}" DisplayMemberPath="Quantity" materialDesign:ListBoxItemAssist.ShowSelection="False"></ListBox>
|
||||
</DataTemplate>
|
||||
</DataGridTemplateColumn.CellTemplate>
|
||||
</DataGridTemplateColumn>
|
||||
</DataGrid.Columns>
|
||||
<!--<DataGrid.Columns>
|
||||
<DataGridTextColumn Width="250"
|
||||
Binding="{Binding Location}"
|
||||
Header="库位"
|
||||
|
@ -145,8 +198,8 @@
|
|||
Header="库存"
|
||||
IsReadOnly="True"
|
||||
ElementStyle="{StaticResource MaterialDesignDataGridTextColumnStyle}"/>
|
||||
</DataGrid.Columns>-->
|
||||
|
||||
</DataGrid.Columns>
|
||||
</DataGrid>
|
||||
<!--<ListView Grid.Row="1"
|
||||
ItemsSource="{Binding DrugList}"
|
||||
|
|
|
@ -0,0 +1,23 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Xml;
|
||||
|
||||
namespace DM_Weight.util
|
||||
{
|
||||
internal class ReadApp
|
||||
{
|
||||
//手动实现调用配置的逻辑 规避修改配置文件后不起作用的问题
|
||||
public static string ReadAppSetting(string key)
|
||||
{
|
||||
string xPath = "/configuration/appSettings//add[@key='" + key + "']";
|
||||
XmlDocument doc = new XmlDocument();
|
||||
string exeFileName = System.Reflection.Assembly.GetExecutingAssembly().GetName().Name;
|
||||
doc.Load(exeFileName + ".dll.config");
|
||||
XmlNode node = doc.SelectSingleNode(xPath);
|
||||
return node.Attributes["value"].Value.ToString();
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue