添加项目文件。

This commit is contained in:
maqiao 2025-07-28 15:29:09 +08:00
parent ddac941c8a
commit fdcf866120
98 changed files with 31268 additions and 0 deletions

View File

@ -0,0 +1,13 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0-windows</TargetFramework>
<Nullable>enable</Nullable>
<UseWPF>true</UseWPF>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Xaml.Behaviors.Wpf" Version="1.1.39" />
</ItemGroup>
</Project>

View File

@ -0,0 +1,75 @@
using Microsoft.Xaml.Behaviors;
using System.Collections.ObjectModel;
using System.Windows;
using System.Windows.Controls;
namespace DM_Weight.Commons.ValidatRules
{
public class ValidationErrorMappingBehavior : Behavior<FrameworkElement>
{
#region Properties
public static readonly DependencyProperty ValidationErrorsProperty =
DependencyProperty.Register("ValidationErrors", typeof(ObservableCollection<ValidationError>),
typeof(ValidationErrorMappingBehavior), new PropertyMetadata(new ObservableCollection<ValidationError>()));
public ObservableCollection<ValidationError> ValidationErrors
{
get { return (ObservableCollection<ValidationError>)this.GetValue(ValidationErrorsProperty); }
set { this.SetValue(ValidationErrorsProperty, value); }
}
public static readonly DependencyProperty HasValidationErrorProperty = DependencyProperty.Register("HasValidationError",
typeof(bool), typeof(ValidationErrorMappingBehavior), new PropertyMetadata(false));
public bool HasValidationError
{
get { return (bool)this.GetValue(HasValidationErrorProperty); }
set { this.SetValue(HasValidationErrorProperty, value); }
}
#endregion
#region Constructors
public ValidationErrorMappingBehavior()
: base()
{ }
#endregion
#region Events & Event Methods
private void Validation_Error(object sender, ValidationErrorEventArgs e)
{
if (e.Action == ValidationErrorEventAction.Added)
{
this.ValidationErrors.Add(e.Error);
}
else
{
this.ValidationErrors.Remove(e.Error);
}
this.HasValidationError = this.ValidationErrors.Count > 0;
}
#endregion
#region Support Methods
protected override void OnAttached()
{
base.OnAttached();
Validation.AddErrorHandler(this.AssociatedObject, Validation_Error);
}
protected override void OnDetaching()
{
base.OnDetaching();
Validation.RemoveErrorHandler(this.AssociatedObject, Validation_Error);
}
#endregion
}
}

51
DM_Weight.sln Normal file
View File

@ -0,0 +1,51 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.3.32922.545
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DM_Weight", "DM_Weight\DM_Weight.csproj", "{439FA76B-F874-40DB-BAF2-E3647CD55B10}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DM_Weight.Commons", "DM_Weight.Commons\DM_Weight.Commons.csproj", "{7F9FA18B-5C28-476E-97D4-B5504B8DEB9B}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Debug|x64 = Debug|x64
Debug|x86 = Debug|x86
Release|Any CPU = Release|Any CPU
Release|x64 = Release|x64
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{439FA76B-F874-40DB-BAF2-E3647CD55B10}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{439FA76B-F874-40DB-BAF2-E3647CD55B10}.Debug|Any CPU.Build.0 = Debug|Any CPU
{439FA76B-F874-40DB-BAF2-E3647CD55B10}.Debug|x64.ActiveCfg = Debug|x64
{439FA76B-F874-40DB-BAF2-E3647CD55B10}.Debug|x64.Build.0 = Debug|x64
{439FA76B-F874-40DB-BAF2-E3647CD55B10}.Debug|x86.ActiveCfg = Debug|x86
{439FA76B-F874-40DB-BAF2-E3647CD55B10}.Debug|x86.Build.0 = Debug|x86
{439FA76B-F874-40DB-BAF2-E3647CD55B10}.Release|Any CPU.ActiveCfg = Release|Any CPU
{439FA76B-F874-40DB-BAF2-E3647CD55B10}.Release|Any CPU.Build.0 = Release|Any CPU
{439FA76B-F874-40DB-BAF2-E3647CD55B10}.Release|x64.ActiveCfg = Release|Any CPU
{439FA76B-F874-40DB-BAF2-E3647CD55B10}.Release|x64.Build.0 = Release|Any CPU
{439FA76B-F874-40DB-BAF2-E3647CD55B10}.Release|x86.ActiveCfg = Debug|x86
{439FA76B-F874-40DB-BAF2-E3647CD55B10}.Release|x86.Build.0 = Debug|x86
{7F9FA18B-5C28-476E-97D4-B5504B8DEB9B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{7F9FA18B-5C28-476E-97D4-B5504B8DEB9B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7F9FA18B-5C28-476E-97D4-B5504B8DEB9B}.Debug|x64.ActiveCfg = Debug|Any CPU
{7F9FA18B-5C28-476E-97D4-B5504B8DEB9B}.Debug|x64.Build.0 = Debug|Any CPU
{7F9FA18B-5C28-476E-97D4-B5504B8DEB9B}.Debug|x86.ActiveCfg = Debug|Any CPU
{7F9FA18B-5C28-476E-97D4-B5504B8DEB9B}.Debug|x86.Build.0 = Debug|Any CPU
{7F9FA18B-5C28-476E-97D4-B5504B8DEB9B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{7F9FA18B-5C28-476E-97D4-B5504B8DEB9B}.Release|Any CPU.Build.0 = Release|Any CPU
{7F9FA18B-5C28-476E-97D4-B5504B8DEB9B}.Release|x64.ActiveCfg = Release|Any CPU
{7F9FA18B-5C28-476E-97D4-B5504B8DEB9B}.Release|x64.Build.0 = Release|Any CPU
{7F9FA18B-5C28-476E-97D4-B5504B8DEB9B}.Release|x86.ActiveCfg = Release|Any CPU
{7F9FA18B-5C28-476E-97D4-B5504B8DEB9B}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {E50E8179-1102-41F1-92F5-2905C75898A6}
EndGlobalSection
EndGlobal

120
DM_Weight/App.config Normal file
View File

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<connectionStrings>
<!-- 数据库连接字符串 -->
<!--<add name="database" connectionString="server=127.0.0.1;database=wpf_dm_program;userid=root;password=qq1223" />-->
<add name="database" connectionString="server=127.0.0.1;port=3306;database=xiangtan_mazuike_xx;userid=root;password=root" />
</connectionStrings>
<!--<runtime>
--><!--配置之后Appdomain.CurrentDomain.UnhandledException 事件的 IsTerminating 就变成了 false 啦!也就是说,程序并不会因为这次的异常而崩溃退出。--><!--
<legacyUnhandledExceptionPolicy enabled="1"/>
</runtime>-->
<appSettings>
<!-- 设备id -->
<add key="machineId" value="DM3" />
<!--交接柜设备id-->
<add key="jj_machineId" value="DM5" />
<!--请领药库-->
<add key="colloctedId" value="住院,DM2,门诊,DM22" />
<!-- 供应单位 -->
<add key="supplierDept" value="药库" />
<!-- 领用部门 -->
<add key="receiveDept" value="麻精药房" />
<!--部门-->
<add key="department" value="急诊药房"/>
<!--登录人 0全部用户可登录1仅当班人、审核人可登录-->
<add key="loginUser" value="0"/>
<!--2023/7/13 药房代码 有则写无则空 -->
<add key="storage" value="" />
<!-- 登录模式 1单人登录2双人登录 -->
<add key="loginMode" value="1" />
<!-- 登录顺序,指定先登录的人的名称有效值只有在登录模式等于2时才会生效 发药人【operator】审核人【reviewer】 -->
<add key="firstLogin" value="operator" />
<!-- 按处方还药或者按取药记录还药 1:处方ReturnDrugWindow22药品ReturnDrugWindow-->
<add key="returnDrugMode" value="1" />
<!-- 自动退出时间单位秒为0时不自动退出 -->
<add key="autoExit" value="0"/>
<!-- 无操作退出录像时间单位秒为0时不退出录像 -->
<add key="stopRecord" value="180"/>
<add key="gridConnectionString" value="MYSQL; Database=xiangtan_mazuike_xx; Password=root; Port=3306; Server=127.0.0.1; User=root;"/>
<!-- 查询处方是orderNo还是orderGroupNo -->
<add key="OrderNoName" value="orderNo" />
<!-- 后门耗材板地址 没有则填写0-->
<add key="DoorAddr" value="1" />
<!-- 是否有can总线串口-->
<add key="CanBusExsit" value="true" />
<!-- 单支抽屉储物箱有则写地址无则为0-->
<add key="StorageBoxAddr" value="1" />
<!-- 抽屉串口使用的协议232或者485 -->
<add key="DrawerProtocol" value="485" />
<!-- 抽屉串口的串口号 -->
<add key="DrawerPortPath" value="COM3" />
<!-- can总线串口的串口号 -->
<add key="CanBusPortPath" value="COM11" />
<!-- 条码枪串口的串口号 -->
<add key="ScanCodePortPath" value="COM8" />
<!--是否有冰箱抽屉0无1有一个2两个-->
<add key="hasFridge" value="0"/>
<!-- 冰箱的串口号 -->
<add key="FridgePortPath" value="COM7" />
<!--冰箱抽屉温度区间-->
<add key="temperatureRange" value="2-8"/>
<!--冰箱抽屉温度-->
<add key="temperatureValue" value="3.2"/>
<!--温度查询定时执行时间-->
<add key="Interval" value="60000"/>
<!--冰箱状态1关闭0打开-->
<add key="FridgeState" value="0"/>
<!--报警状态1关闭0打开-->
<add key="AlarmState" value="0"/>
<!--冰箱2抽屉温度区间-->
<add key="temperatureRange2" value="2-8"/>
<!--冰箱2状态1关闭0打开-->
<add key="FridgeState2" value="0"/>
<!--冰箱2报警状态1关闭0打开-->
<add key="AlarmState2" value="0"/>
<!-- 抽屉串口的串口号 --><!--
<add key="DrawerPortPath" value="COM11" />
--><!-- can总线串口的串口号 --><!--
<add key="CanBusPortPath" value="COM12" />
--><!-- 条码枪串口的串口号 --><!--
<add key="ScanPortPath" value="COM7" />-->
<!-- 指纹机类型 1无屏幕2有屏幕 -->
<add key="machineType" value="2"/>
<!-- 指纹机号码 -->
<add key="machineNumber" value="1"/>
<!-- 指纹机ip -->
<add key="fingerIp" value="192.168.50.201"/>
<!-- 多处方取药 0:不启用 1启用-->
<add key="MultiOrder" value="1"/>
<!-- 多批次抽屉加药 0:不启用 1启用
启用channel_list记录库位信息 -->
<add key="MultiBatch" value="0"/>
<!--海康威视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>

19
DM_Weight/App.xaml Normal file
View File

@ -0,0 +1,19 @@
<prism:PrismApplication x:Class="DM_Weight.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:d1p1="http://schemas.openxmlformats.org/markup-compatibility/2006"
d1p1:Ignorable="d"
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
xmlns:local="clr-namespace:DM_Weight"
xmlns:prism="http://prismlibrary.com/">
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<materialDesign:BundledTheme BaseTheme="Light" PrimaryColor="Indigo" SecondaryColor="Cyan" />
<ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.Defaults.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>
</prism:PrismApplication>

264
DM_Weight/App.xaml.cs Normal file
View File

@ -0,0 +1,264 @@

using DM_Weight.util.TabTip;
using DM_Weight.util;
using DM_Weight.ViewModels;
using DM_Weight.Views.Dialog;
using DM_Weight.Views;
using log4net.Config;
using Prism.Ioc;
using Prism.Services.Dialogs;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Configuration;
using System.Data;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using Prism.Unity;
using log4net;
using System.Windows.Interop;
using System.Windows.Threading;
using System.Timers;
using DM_Weight.HIKVISION;
namespace DM_Weight
{
/// <summary>
/// Interaction logic for App.xaml
/// </summary>
public partial class App : PrismApplication
{
private readonly ILog logger = LogManager.GetLogger(typeof(App));
public App()
{
TabTipAutomation.IgnoreHardwareKeyboard = HardwareKeyboardIgnoreOptions.IgnoreAll;
TabTipAutomation.BindTo<TextBox>();
TabTipAutomation.BindTo<PasswordBox>();
}
protected override Window CreateShell()
{
//UI线程未捕获异常处理事件
this.DispatcherUnhandledException += OnDispatcherUnhandledException;
//Task线程内未捕获异常处理事件
TaskScheduler.UnobservedTaskException += OnUnobservedTaskException;
//多线程异常
AppDomain.CurrentDomain.UnhandledException += OnUnhandledException;
return Container.Resolve<MainWindow>();
}
void OnDispatcherUnhandledException(object sender, System.Windows.Threading.DispatcherUnhandledExceptionEventArgs e)
{
logger.Error($"发生错误:{e.Exception.Message}");
e.Handled = true;
}
void OnUnobservedTaskException(object sender, UnobservedTaskExceptionEventArgs e)
{
foreach (Exception item in e.Exception.InnerExceptions)
{
logger.Error($"异常类型:{item.GetType()}{Environment.NewLine}来自:{item.Source}{Environment.NewLine}异常内容:{item.Message}");
}
//将异常标识为已经观察到
e.SetObserved();
}
void OnUnhandledException(object sender, UnhandledExceptionEventArgs e)
{
logger.Error($"Unhandled exception.{e.ToString()}");
}
protected override void InitializeShell(Window shell)
{
base.InitializeShell(shell);
}
protected override void RegisterTypes(IContainerRegistry containerRegistry)
{
//日期加时间页面
containerRegistry.RegisterDialog<DatetimeDialog>();
containerRegistry.RegisterForNavigation<DatetimeDialog, DatetimeDialogViewModel>();
// 注入日志
XmlConfigurator.ConfigureAndWatch(new FileInfo(AppDomain.CurrentDomain.BaseDirectory + "log4net.config"));
//containerRegistry.RegisterInstance<ILog>(LogManager.GetLogger(""));
// 串口工具
//containerRegistry.RegisterSingleton<PortUtil>();
// 指纹机工具
//containerRegistry.RegisterSingleton<FingerprintUtil>();
// 组态屏工具
//containerRegistry.RegisterSingleton<ScreenUtil>();
// 录像机
//containerRegistry.RegisterSingleton<CHKFunction>();
containerRegistry.Register<IDialogService, MaterialDialogService>();
// 主窗口
containerRegistry.Register<MainWindow>();
containerRegistry.RegisterForNavigation<MainWindow, MainWindowViewModel>();
// 分页
//containerRegistry.Register<Pagination>();
//containerRegistry.Register<PaginationViewModel>();
// 登录页面
containerRegistry.RegisterForNavigation<LoginWindow, LoginWindowViewModel>();
// 布局页面
containerRegistry.RegisterForNavigation<HomeWindow, HomeWindowViewModel>();
// 录入指纹模态框
//containerRegistry.RegisterDialog<FingerprintDialog>();
//containerRegistry.RegisterForNavigation<FingerprintDialog, FingerprintDialogViewModel>();
#region
////交接柜补药
//containerRegistry.RegisterForNavigation<AddToJiaoJieWindow, AddToJiaoJieWindowViewModel>();
////交接柜补药页面弹窗
//containerRegistry.RegisterDialog<AddToJiaoJieDialog>();
//containerRegistry.RegisterForNavigation<AddToJiaoJieDialog, AddToJiaoJieDialogViewModel>();
//// 处方取药页面
//containerRegistry.RegisterForNavigation<OrderTakeDrugWindow, OrderTakeDrugWindowViewModel>();
//// 处方取药模态框
//containerRegistry.RegisterDialog<OrderTakeDialog>();
//containerRegistry.RegisterForNavigation<OrderTakeDialog, OrderTakeDialogViewModel>();
//// 调拨取药页面
//containerRegistry.RegisterForNavigation<InvoiceOutWindow, InvoiceOutWindowViewModel>();
//// 调拨取药模态框
//containerRegistry.RegisterDialog<InvoiceTakeDialog>();
//containerRegistry.RegisterForNavigation<InvoiceTakeDialog, InvoiceTakeDialogViewModel>();
//// 抽屉取药页面
//containerRegistry.RegisterForNavigation<DrawerTakeDrugWindow, DrawerTakeDrugWindowViewModel>();
//// 自选取药模态框
//containerRegistry.RegisterDialog<SelfTakeDialog>();
//containerRegistry.RegisterForNavigation<SelfTakeDialog, SelfTakeDialogViewModel>();
//// 自选取药页面
//containerRegistry.RegisterForNavigation<SelfTakeDrugWindow, SelfTakeDrugWindowViewModel>();
////多处方取药
//containerRegistry.RegisterForNavigation<MultiOrderTakeDrugWindow, MultiOrderTakeDrugWindowViewModel>();
//containerRegistry.RegisterDialog<MultiOrderTakeDialog>();
//containerRegistry.RegisterForNavigation<MultiOrderTakeDialog,MultiOrderTakeDialogViewModel>();
#endregion
#region
// 自选加药页面
//containerRegistry.RegisterForNavigation<SelfAddWindow, SelfAddWindowViewModel>();
//// 调拨加药页面
//containerRegistry.RegisterForNavigation<InvoiceInWindow, InvoiceInWindowViewModel>();
//// 调拨取药模态框
//containerRegistry.RegisterDialog<InvoiceAddDialog>();
//containerRegistry.RegisterForNavigation<InvoiceAddDialog, InvoiceAddDialogViewModel>();
//// 抽屉加药页面
//containerRegistry.RegisterForNavigation<DrawerAddDrugWindow, DrawerAddDrugWindowViewModel>();
//// 自选加药模态框
//containerRegistry.RegisterDialog<SelfAddDialog>();
//containerRegistry.RegisterForNavigation<SelfAddDialog, SelfAddDialogViewModel>();
////多批次抽屉加药
//containerRegistry.RegisterForNavigation<AddDrugControl, AddDrugControlViewModel>();
////药品请领
//containerRegistry.RegisterForNavigation<CollectDrugWindow, CollectDrugWindowViewModel>();
//// 药品请领模态框
//containerRegistry.RegisterDialog<CollectDrugDialog>();
//containerRegistry.RegisterForNavigation<CollectDrugDialog, CollectDrugDialogViewModel>();
////请领列表
//containerRegistry.RegisterForNavigation<ApplyListWindow, ApplyListWindowViewModel>();
////请领入库
//containerRegistry.RegisterForNavigation<ApplyInStockWindow, ApplyInStockWindowViewModel>();
#endregion
#region
// 还药页面
//containerRegistry.RegisterForNavigation<ReturnDrugWindow, ReturnDrugWindowViewModel>();
//// 按记录归还药品模态框
//containerRegistry.RegisterDialog<ReturnDrugDialog>();
//containerRegistry.RegisterForNavigation<ReturnDrugDialog, ReturnDrugDialogViewModel>();
//// 还药页面2
//containerRegistry.RegisterForNavigation<ReturnDrugWindow2, ReturnDrugWindow2ViewModel>();
//// 按处方归还药品模态框
//containerRegistry.RegisterDialog<OrderReturnDialog>();
//containerRegistry.RegisterForNavigation<OrderReturnDialog, OrderReturnDialogViewModel>();
//// 还空瓶页面
//containerRegistry.RegisterForNavigation<ReturnEmptyWindow, ReturnEmptyWindowViewModel>();
//// 归还空瓶模态框
//containerRegistry.RegisterDialog<ReturnEmptyDialog>();
//containerRegistry.RegisterForNavigation<ReturnEmptyDialog, ReturnEmptyDialogViewModel>();
//// 空瓶销毁模态框
//containerRegistry.RegisterDialog<DestoryEmptyDialog>();
//containerRegistry.RegisterForNavigation<DestoryEmptyDialog, DestoryEmptyDialogViewModel>();
#endregion
#region
// 库存列表页面
//containerRegistry.RegisterForNavigation<StockListWindow, StockListWindowViewModel>();
//// 库位绑定模态框
//containerRegistry.RegisterDialog<BindingChannelDialog>();
//containerRegistry.RegisterForNavigation<BindingChannelDialog, BindingChannelDialogViewModel>();
////同一药品多批次库位绑定
//containerRegistry.RegisterForNavigation<BindingChannelNewDialog, BindingChannelNewDialogViewModel>();
//// 库存盘点页面
//containerRegistry.RegisterForNavigation<CheckStockWindow, CheckStockWindowViewModel>();
//// 药品列表页面
//containerRegistry.RegisterForNavigation<DrugListWindow, DrugListWindowViewModel>();
////交接班记录
//containerRegistry.RegisterForNavigation<ChangeShiftsListWindow, ChangeShiftsListWindowViewModel>();
////交接班弹窗
//containerRegistry.RegisterDialog<ChangeShiftsDialog>();
//containerRegistry.RegisterForNavigation<ChangeShiftsDialog, ChangeShiftsDialogViewModel>();
containerRegistry.RegisterForNavigation<AccountWindow,AccountWindowViewModel>();
containerRegistry.RegisterForNavigation<AccountWindowForDrug, AccountWindowForDrugViewModel>();
#endregion
#region
// 用户管理页面
//containerRegistry.RegisterForNavigation<UserManagerWindow, UserManagerWindowViewModel>();
//// 编辑用户模态框
//containerRegistry.RegisterDialog<EditUserDialog>();
//containerRegistry.RegisterForNavigation<EditUserDialog, EditUserDialogViewModel>();
//// 角色管理页面
//containerRegistry.RegisterForNavigation<RoleManagerWindow, RoleManagerWindowViewModel>();
//// 系统设置
//containerRegistry.RegisterForNavigation<SettingWindow, SettingWindowViewModel>();
//// 调试页面
//containerRegistry.RegisterForNavigation<DebugWindow, DebugWindowViewModel>();
////主设置页面
//containerRegistry.RegisterForNavigation<SettingMainWindow, SettingMainWindowViewModel>();
////两个冰箱抽屉设置页面
//containerRegistry.RegisterForNavigation<FridgeWindow, FridgeWindowViewModel>();
////只有一个冰箱抽屉设置页面
//containerRegistry.RegisterForNavigation<FridgeOnlyWindow, FridgeOnlyWindowViewModel>();
#endregion
// 设备记录页面
//containerRegistry.RegisterForNavigation<MachineRecordWindow, MachineRecordWindowViewModel>();
//containerRegistry.RegisterForNavigation<ShowMessageDialog, ShowMessageDialogViewModel>();
}
}
}

10
DM_Weight/AssemblyInfo.cs Normal file
View File

@ -0,0 +1,10 @@
using System.Windows;
[assembly: ThemeInfo(
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
//(used if a resource is not found in the page,
// or application resource dictionaries)
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
//(used if a resource is not found in the page,
// app, or any theme specific resource dictionaries)
)]

View File

@ -0,0 +1,42 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DM_Weight.Common
{
public class CRC16MODBUS
{
/// Name: CRC-16/MODBUS x16+x15+x2+1
/// Poly: 0x8005
/// Init: 0xFFFF
/// Refin: true
/// Refout: true
/// Xorout: 0x0000
///******************************添加数据CRC16MODBUS校验位*******************************************
public static byte[] CrcModBus(byte[] buffer, int start = 0, int len = 0)
{
if (buffer == null || buffer.Length == 0) return null;
if (start < 0) return null;
if (len == 0) len = buffer.Length - start;
int length = start + len;
if (length > buffer.Length) return null;
ushort crc = 0xFFFF;// Initial value
for (int i = start; i < length; i++)
{
crc ^= buffer[i];
for (int j = 0; j < 8; j++)
{
if ((crc & 1) > 0)
crc = (ushort)((crc >> 1) ^ 0xA001);// 0xA001 = reverse 0x8005
else
crc = (ushort)(crc >> 1);
}
}
byte[] ret = BitConverter.GetBytes(crc);
//Array.Reverse(ret);
return ret;
}
}
}

View File

@ -0,0 +1,31 @@
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Xml;
namespace DM_Weight.Common
{
public class CommonClass
{
//手动实现调用配置的逻辑 规避修改配置文件后不起作用的问题
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;
}
public static void SaveAppSetting(string key,string value)
{
Configuration _configuration = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
_configuration.AppSettings.Settings[key].Value = value;
_configuration.Save();
ConfigurationManager.RefreshSection(key);
}
}
}

View File

@ -0,0 +1,24 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DM_Weight.Common
{
public class PrismManager
{
///// <summary>
///// 主页面区域,主要呈现登录页及登录后页面
///// </summary>
//public static readonly string MainViewRegionName = "MainContent";
/// <summary>
/// 设置菜单页面跳转,主要呈现设置下子菜单
/// </summary>
public static readonly string SettingViewRegionName = "SettingViewContent";
///// <summary>
///// 主页面各菜单页
///// </summary>
//public static readonly string HomeViewRegionName = "HomeViewContent";
}
}

View File

@ -0,0 +1,61 @@
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Controls;
using System.Windows.Data;
namespace DM_Weight.Common
{
//设置冰箱温度规则
public class TemperatureRangeRule : ValidationRule
{
//冰箱温度设置区间为取自配置文件2~8度
public override ValidationResult Validate(object value, CultureInfo cultureInfo)
{
bool flag = false;
string tips = string.Empty;
try
{
string[] rang = value.ToString().Split('-');
if (rang.Length >= 2)
{
bool bSRange = int.TryParse(rang[0], out int sRange);
bool bERange = int.TryParse(rang[1], out int eRange);
if (bSRange && bERange)
{
if ((sRange < 2 || eRange > 8||sRange>8||eRange<2))
{
tips = "温度区间设置2-8度请检查输入";
return new ValidationResult(flag, tips);
}
else
{
flag = true;
}
}
else
{
tips = "请输入正确的数值";
return new ValidationResult(flag, tips);
}
}
else
{
tips = "请输入正确的数值";
return new ValidationResult(flag, tips);
}
return new ValidationResult(flag, tips);
}
catch (Exception ex)
{
tips = $"校验异常{ex.ToString()}";
return new ValidationResult(flag, tips);
}
}
}
}

View File

@ -0,0 +1,43 @@
<UserControl x:Class="DM_Weight.Components.pagination.Pagination"
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.Components.pagination"
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes">
<Grid>
<StackPanel Margin="0 6 20 6" HorizontalAlignment="Right" Orientation="Horizontal">
<TextBlock x:Name="InfoBlock" Padding="0 0 6 0" VerticalAlignment="Center" />
<Button
ToolTip="首页"
Style="{StaticResource MaterialDesignIconForegroundButton}"
Command="{x:Static local:Pagination.FirstCommand}"
Name="First"
Content="{materialDesign:PackIcon PageFirst}" />
<Button
ToolTip="上一页"
Style="{StaticResource MaterialDesignIconForegroundButton}"
Command="{x:Static local:Pagination.PrevCommand}"
Name="Prve"
Content="{materialDesign:PackIcon ChevronLeft}"/>
<TextBlock x:Name="CurrentPageText" Padding="6 0 6 0" VerticalAlignment="Center" />
<Button
ToolTip="下一页"
Style="{StaticResource MaterialDesignIconForegroundButton}"
Command="{x:Static local:Pagination.NextCommand}"
Name="Next"
Content="{materialDesign:PackIcon ChevronRight}"/>
<Button
ToolTip="末页"
Style="{StaticResource MaterialDesignIconForegroundButton}"
Command="{x:Static local:Pagination.EndCommand}"
Name="End"
Content="{materialDesign:PackIcon PageLast}" />
</StackPanel>
</Grid>
</UserControl>

View File

@ -0,0 +1,265 @@
using NetTaste;
using Prism.Commands;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Reflection;
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.Components.pagination
{
/// <summary>
/// Pagination.xaml 的交互逻辑
/// </summary>
public partial class Pagination : UserControl
{
public Pagination()
{
InitializeComponent();
ResetInfoText();
ResetCurrentPageText();
}
static Pagination()
{
InitializeCommands();
}
private static readonly Type _typeofSelf = typeof(Pagination);
private static void InitializeCommands()
{
FirstCommand = new RoutedCommand("First", _typeofSelf);
PrevCommand = new RoutedCommand("Prev", _typeofSelf);
NextCommand = new RoutedCommand("Next", _typeofSelf);
EndCommand = new RoutedCommand("End", _typeofSelf);
CommandManager.RegisterClassCommandBinding(_typeofSelf,
new CommandBinding(FirstCommand, OnFirstComman, OnCanFirstComman));
CommandManager.RegisterClassCommandBinding(_typeofSelf,
new CommandBinding(PrevCommand, OnPrevCommand, OnCanPrevCommand));
CommandManager.RegisterClassCommandBinding(_typeofSelf,
new CommandBinding(NextCommand, OnNextCommand, OnCanNextCommand));
CommandManager.RegisterClassCommandBinding(_typeofSelf,
new CommandBinding(EndCommand, OnEndCommand, OnCanEndCommand));
}
public static RoutedCommand FirstCommand { get; private set; }
private static void OnFirstComman(object sender, RoutedEventArgs e)
{
var ctrl = sender as Pagination;
ctrl.CurrentPage = 1;
}
private static void OnCanFirstComman(object sender, CanExecuteRoutedEventArgs e)
{
var ctrl = sender as Pagination;
e.CanExecute = ctrl.CurrentPage > 1;
}
public static RoutedCommand PrevCommand { get; private set; }
private static void OnPrevCommand(object sender, RoutedEventArgs e)
{
var ctrl = sender as Pagination;
ctrl.CurrentPage--;
}
private static void OnCanPrevCommand(object sender, CanExecuteRoutedEventArgs e)
{
var ctrl = sender as Pagination;
e.CanExecute = ctrl.CurrentPage > 1;
}
public static RoutedCommand NextCommand { get; private set; }
private static void OnNextCommand(object sender, RoutedEventArgs e)
{
var ctrl = sender as Pagination;
ctrl.CurrentPage++;
}
private static void OnCanNextCommand(object sender, CanExecuteRoutedEventArgs e)
{
var ctrl = sender as Pagination;
e.CanExecute = ctrl.CurrentPage < ctrl.PageCount;
}
public static RoutedCommand EndCommand { get; private set; }
private static void OnEndCommand(object sender, RoutedEventArgs e)
{
var ctrl = sender as Pagination;
ctrl.CurrentPage = ctrl.PageCount;
}
private static void OnCanEndCommand(object sender, CanExecuteRoutedEventArgs e)
{
var ctrl = sender as Pagination;
e.CanExecute = ctrl.CurrentPage < ctrl.PageCount;
}
// 默认当前页码
public static int DefaultCurrentPage = 1;
// 默认总条数
public static int DefaultTotalPages = 0;
// 默认每页条数列表
public static List<int> DefaultPageSizeList = new List<int> { 10, 20, 50, 100 };
// 是否显示页码条数信息
public static bool DefaultInfoTextIsEnabel = true;
// 默认每页条数
public static int DefaultPageSize = 10;
public static readonly DependencyProperty CurrentPageProperty = DependencyProperty
.Register("CurrentPage",
typeof(int),
typeof(Pagination),
new FrameworkPropertyMetadata(DefaultCurrentPage, FrameworkPropertyMetadataOptions.BindsTwoWayByDefault));
public static readonly DependencyProperty PageSizeProperty = DependencyProperty
.Register("PageSize",
typeof(int),
typeof(Pagination),
new FrameworkPropertyMetadata(DefaultPageSize, FrameworkPropertyMetadataOptions.BindsTwoWayByDefault));
public static readonly DependencyProperty TotalPagesProperty = DependencyProperty
.Register("TotalPages",
typeof(int),
typeof(Pagination),
new FrameworkPropertyMetadata(DefaultTotalPages, FrameworkPropertyMetadataOptions.BindsTwoWayByDefault, new PropertyChangedCallback(OnItemsSourceChanged)));
public static readonly DependencyProperty InfoTextIsEnabelProperty = DependencyProperty
.Register("InfoTextIsEnabel",
typeof(bool),
typeof(Pagination),
new FrameworkPropertyMetadata(DefaultInfoTextIsEnabel, FrameworkPropertyMetadataOptions.BindsTwoWayByDefault));
private static void OnItemsSourceChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
Pagination p = (Pagination)d;
p.ResetInfoText();
}
[Bindable(true)]
[Category("Appearance")]
public int CurrentPage
{
get { return (int)GetValue(CurrentPageProperty); }
set
{
SetValue(CurrentPageProperty, value);
if (InfoTextIsEnabel)
{
ResetInfoText();
}
ResetCurrentPageText();
}
}
//private static void OnCurrentPageChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
//{
// Pagination p = d as Pagination;
// if (p != null)
// {
// Console.WriteLine(e.NewValue);
// }
//}
[Bindable(true)]
[Category("Appearance")]
public int PageSize
{
get { return (int)GetValue(PageSizeProperty); }
set
{
SetValue(PageSizeProperty, value);
if (InfoTextIsEnabel)
{
ResetInfoText();
}
ResetCurrentPageText();
}
}
[Bindable(true)]
[Category("Appearance")]
public int TotalPages
{
get { return (int)GetValue(TotalPagesProperty); }
set
{
SetValue(TotalPagesProperty, value);
if (InfoTextIsEnabel)
{
ResetInfoText();
}
ResetCurrentPageText();
}
}
public bool InfoTextIsEnabel
{
get { return (bool)GetValue(InfoTextIsEnabelProperty); }
set { SetValue(InfoTextIsEnabelProperty, value); }
}
public int PageCount
{
get => (int)Math.Ceiling((double)TotalPages / PageSize);
}
public void ResetInfoText()
{
this.Dispatcher.BeginInvoke(() =>
{
if (InfoTextIsEnabel)
{
if (TotalPages <= PageSize)
{
this.InfoBlock.Text = $"1-{TotalPages}/{TotalPages}";
if (TotalPages == 0)
{
this.InfoBlock.Text = $"0-{TotalPages}/{TotalPages}";
}
} else
{
this.InfoBlock.Text = ((CurrentPage - 1) * PageSize + 1) + "-" + (CurrentPage * PageSize > TotalPages ? TotalPages : CurrentPage * PageSize) + "/" + TotalPages;
}
} else
{
this.InfoBlock.Visibility = Visibility.Visible;
}
});
}
public void ResetCurrentPageText()
{
this.Dispatcher.BeginInvoke(() =>
{
this.CurrentPageText.Text = CurrentPage + "";
});
}
}
}

View File

@ -0,0 +1,81 @@
using Prism.Commands;
using Prism.Mvvm;
using Prism.Regions;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
namespace DM_Weight.Components.pagination
{
public class PaginationViewModel: BindableBase, IRegionMemberLifetime
{
public static readonly DependencyProperty PageSizeProperty = DependencyProperty
.Register("CurrentPage",
typeof(int),
typeof(Pagination),
new FrameworkPropertyMetadata(10));
// 每页条数
private int _pageSize = 10;
// 当前页码
private int _currentPage = 1;
// 总条数
private int _totalPages = 0;
public int PageSize { get=> _pageSize; set => SetProperty(ref _pageSize, value); }
public int CurrentPage { get => _currentPage; set => SetProperty(ref _currentPage, value); }
public int TotalPages { get => _totalPages; set => SetProperty(ref _totalPages, value); }
// 总页数
public int PageCount
{
get => (int)Math.Ceiling((double)TotalPages/ PageSize);
}
public string InfoText
{
get => ((CurrentPage - 1) * PageSize + 1) + "-" + (CurrentPage * PageSize > TotalPages ? TotalPages : CurrentPage * PageSize) + "/" + TotalPages;
}
public bool KeepAlive => false;
public DelegateCommand ToFirst
{
get => new(() =>
{
CurrentPage = 1;
});
}
public DelegateCommand ToPrve
{
get => new(() =>
{
CurrentPage -= 1;
});
}
public DelegateCommand ToNext
{
get => new(() =>
{
CurrentPage += 1;
});
}
public DelegateCommand ToEnd
{
get => new(() =>
{
CurrentPage = PageCount;
});
}
}
}

144
DM_Weight/DM_Weight.csproj Normal file
View File

@ -0,0 +1,144 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net6.0-windows</TargetFramework>
<Nullable>enable</Nullable>
<UseWPF>true</UseWPF>
<PackageIcon></PackageIcon>
<Product>毒麻管理程序</Product>
<ApplicationIcon>Images\favicon.ico</ApplicationIcon>
<Platforms>AnyCPU;x86;x64</Platforms>
</PropertyGroup>
<ItemGroup>
<None Remove="Images\body-bg.jpg" />
<None Remove="Images\box-16.jpg" />
<None Remove="Images\box.png" />
<None Remove="Images\favicon.ico" />
<None Remove="Images\finger-bg-r.png" />
<None Remove="Images\logo.png" />
<None Remove="Images\TbExit.png" />
<None Remove="Images\TbJiay.png" />
<None Remove="Images\TbKuc.png" />
<None Remove="Images\TbQyao.png" />
<None Remove="Images\TbSet.png" />
<None Remove="Images\TbTuiy.png" />
</ItemGroup>
<ItemGroup>
<COMReference Include="zkemkeeper">
<WrapperTool>tlbimp</WrapperTool>
<VersionMinor>0</VersionMinor>
<VersionMajor>1</VersionMajor>
<Guid>fe9ded34-e159-408e-8490-b720a5e632c7</Guid>
<Lcid>0</Lcid>
<Isolated>false</Isolated>
<EmbedInteropTypes>False</EmbedInteropTypes>
</COMReference>
<COMReference Include="gregn6Lib">
<WrapperTool>tlbimp</WrapperTool>
<VersionMinor>0</VersionMinor>
<VersionMajor>6</VersionMajor>
<Guid>4018f953-1bfe-441e-8a04-dc8ba1ff060e</Guid>
<Lcid>0</Lcid>
<Isolated>false</Isolated>
<EmbedInteropTypes>False</EmbedInteropTypes>
</COMReference>
</ItemGroup>
<ItemGroup>
<Content Include="Images\favicon.ico" />
</ItemGroup>
<ItemGroup>
<Resource Include="Images\body-bg.jpg" />
<Resource Include="Images\box-16.jpg" />
<Resource Include="Images\box.png" />
<Resource Include="Images\favicon.ico" />
<Resource Include="Images\finger-bg-r.png" />
<Resource Include="Images\logo.png" />
<Resource Include="Images\TbExit.png" />
<Resource Include="Images\TbJiay.png" />
<Resource Include="Images\TbKuc.png" />
<Resource Include="Images\TbQyao.png" />
<Resource Include="Images\TbSet.png" />
<Resource Include="Images\TbTuiy.png" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="log4net" Version="2.0.15" />
<PackageReference Include="MaterialDesignThemes" Version="4.8.0" />
<PackageReference Include="Microsoft.Xaml.Behaviors.Wpf" Version="1.1.39" />
<PackageReference Include="Prism.Unity" Version="8.1.97" />
<PackageReference Include="SqlSugarCore" Version="5.1.4.67" />
<PackageReference Include="SuperSimpleTcp" Version="3.0.10" />
<PackageReference Include="System.Drawing.Common" Version="7.0.0" />
<PackageReference Include="System.IO.Ports" Version="7.0.0" />
<PackageReference Include="System.Management" Version="7.0.1" />
<PackageReference Include="System.Reactive" Version="5.0.0" />
<PackageReference Include="System.Speech" Version="7.0.0" />
<PackageReference Include="System.Text.Encoding.CodePages" Version="7.0.0" />
</ItemGroup>
<ItemGroup>
<ApplicationDefinition Update="App.xaml">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</ApplicationDefinition>
</ItemGroup>
<ItemGroup>
<None Update="App.config">
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
</None>
<None Update="log4net.config">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="ReportTemp\account_book_new.grf">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="ReportTemp\account_book_temp.grf">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="ReportTemp\account_use_temp.grf">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="ReportTemp\changeShifts_temp.grf">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="ReportTemp\machine_log_check.grf">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="ReportTemp\machine_log_return.grf">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="ReportTemp\machine_log_add.grf">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="ReportTemp\machine_log_take.grf">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="ReportTemp\orderUse_template.grf">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="ReportTemp\ReturnEmptyDistory_template.grf">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="ReportTemp\stock_template.grf">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup>
<ItemGroup>
<Folder Include="Converter\" />
<Folder Include="CustomAttribute\" />
<Folder Include="Finger\" />
<Folder Include="HIKVISION\" />
<Folder Include="Port\" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\DM_Weight.Commons\DM_Weight.Commons.csproj" />
</ItemGroup>
</Project>

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,191 @@
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;
using log4net;
using System.Runtime.InteropServices;
namespace DM_Weight.HIKVISION
{
public class CHKFunction
{
private readonly ILog logger = LogManager.GetLogger(typeof(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;
public CHCNetSDK.NET_DVR_TIME m_struTimeCfg;
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;
logger.Info("NET_DVR_Init error!");
}
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; //登录失败,输出错误号
logger.Info(str);
}
else
{
//登录成功
//MessageBox.Show("Login Success!");
logger.Info("Login Success!");
}
}
else
{
//注销登录 Logout the device
if (m_lRealHandle >= 0)
{
//MessageBox.Show("Please stop live view firstly");
logger.Info("Please stop live view firstly");
}
if (!CHCNetSDK.NET_DVR_Logout(HKUserId))
{
iLastErr = CHCNetSDK.NET_DVR_GetLastError();
str = "NET_DVR_Logout failed, error code= " + iLastErr;
logger.Info(str);
}
HKUserId = -1;
}
return HKUserId;
}
public void HIKLoginOut()
{
if (m_lRealHandle >= 0)
{
bool stopRealPlay = CHCNetSDK.NET_DVR_StopRealPlay(m_lRealHandle);
logger.Info($"录像机NET_DVR_StopRealPlay接口返回{stopRealPlay}");
}
if (HKUserId >= 0)
{
bool logout = CHCNetSDK.NET_DVR_Logout(HKUserId);
logger.Info($"录像机NET_DVR_Logout接口返回{logout}");
}
if (m_bInitSDK == true)
{
bool cleanUp = CHCNetSDK.NET_DVR_Cleanup();
logger.Info($"录像机NET_DVR_Cleanup接口返回{cleanUp}");
}
}
public bool HIKStartDVRRecord()
{
bool isStart = CHCNetSDK.NET_DVR_StartDVRRecord(HKUserId, 0xffff, 0);
logger.Info($"录像机NET_DVR_StartDVRRecord接口返回{isStart}");
return isStart;
}
public bool HIKStopDVRRecord()
{
bool isStop = CHCNetSDK.NET_DVR_StopDVRRecord(HKUserId, 0xffff);
logger.Info($"录像机NET_DVR_StopDVRRecord接口返回{isStop}");
return isStop;
}
public void HIK_DVR_TIME()
{
UInt32 dwReturn = 0;
Int32 nSize = Marshal.SizeOf(m_struTimeCfg);
IntPtr ptrTimeCfg = Marshal.AllocHGlobal(nSize);
Marshal.StructureToPtr(m_struTimeCfg, ptrTimeCfg, false);
if (CHCNetSDK.NET_DVR_GetDVRConfig(HKUserId, CHCNetSDK.NET_DVR_GET_TIMECFG, -1, ptrTimeCfg, (UInt32)nSize, ref dwReturn))
{
m_struTimeCfg = (CHCNetSDK.NET_DVR_TIME)Marshal.PtrToStructure(ptrTimeCfg, typeof(CHCNetSDK.NET_DVR_TIME));
logger.Info($"录像机时间接口{Convert.ToString(m_struTimeCfg.dwYear)}- {Convert.ToString(m_struTimeCfg.dwMonth)}- {Convert.ToString(m_struTimeCfg.dwDay)}- {Convert.ToString(m_struTimeCfg.dwHour)}- {Convert.ToString(m_struTimeCfg.dwMinute)}- {Convert.ToString(m_struTimeCfg.dwSecond)}");
}
}
/// <summary>
/// 清理所有正在使用的资源。
/// </summary>
//public void Dispose()
//{
// if (m_lRealHandle >= 0)
// {
// bool stopRealPlay= CHCNetSDK.NET_DVR_StopRealPlay(m_lRealHandle);
// }
// if (HKUserId >= 0)
// {
// CHCNetSDK.NET_DVR_Logout(HKUserId);
// }
// if (m_bInitSDK == true)
// {
// CHCNetSDK.NET_DVR_Cleanup();
// }
//}
}
}

BIN
DM_Weight/Images/TbExit.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.5 KiB

BIN
DM_Weight/Images/TbJiay.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.4 KiB

BIN
DM_Weight/Images/TbKuc.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

BIN
DM_Weight/Images/TbQyao.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.6 KiB

BIN
DM_Weight/Images/TbSet.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.4 KiB

BIN
DM_Weight/Images/TbTuiy.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

BIN
DM_Weight/Images/box-16.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

BIN
DM_Weight/Images/box.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 264 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 53 KiB

BIN
DM_Weight/Images/logo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

View File

@ -0,0 +1,220 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Prism.Mvvm;
using SqlSugar;
namespace DM_Weight.Models
{
/// <summary>
///
///</summary>
[SugarTable("channel_stock")]
public class ChannelStock : BindableBase
{
/// <summary>
///
///</summary>
[SugarColumn(ColumnName = "chsguid", IsPrimaryKey = true)]
//[SugarColumn(ColumnName = "id", IsPrimaryKey = true)]
public string Id { get; set; }
[SugarColumn(ColumnName = "chnguid")]
public string Chnguid { get; set; }
/// <summary>
///
/// 默认值: NULL
///</summary>
[SugarColumn(ColumnName = "machine_id")]
public string MachineId { get; set; }
/// <summary>
///
/// 默认值: NULL
///</summary>
[SugarColumn(ColumnName = "row_no")]
public int DrawerNo { get; set; }
/// <summary>
///
/// 默认值: NULL
///</summary>
[SugarColumn(ColumnName = "col_no")]
public int ColNo { get; set; }
/// <summary>
///
/// 默认值: NULL
///</summary>
[SugarColumn(ColumnName = "pos_no")]
public int PosNo { get; set; }
/// <summary>
///
/// 默认值: NULL
///</summary>
[SugarColumn(ColumnName = "drug_id")]
public string DrugId { get; set; }
/// <summary>
///
/// 默认值: NULL
///</summary>
[SugarColumn(ColumnName = "manu_no")]
public string ManuNo { get; set; }
/// <summary>
///
/// 默认值: NULL
///</summary>
[SugarColumn(ColumnName = "eff_date")]
public string EffDate { get; set; }
/// <summary>
///
/// 默认值: NULL
///</summary>
[SugarColumn(ColumnName = "quantity")]
public int Quantity { get; set; }
/// <summary>
///
/// 默认值: 1
///</summary>
[SugarColumn(ColumnName = "drawer_type")]
public int DrawerType { get; set; }
/// <summary>
///
/// 默认值: 1
///</summary>
[SugarColumn(ColumnName = "board_type")]
public int BoardType { get; set; }
private int? _state = 0;
/// <summary>
///
/// 默认值: 1用于标识毒麻柜是否给交接柜补药0未补1已补
///</summary>
[SugarColumn(ColumnName = "state")]
public int? State
{
get => _state;
set { SetProperty(ref _state, value); }
}
[SugarColumn(IsIgnore = true)]
public bool IsSelected { get; set; }
[SugarColumn(IsIgnore = true)]
public string Location
{
get => DrawerNo + "-" + ColNo;
}
private int _addQuantity = 0;
[SugarColumn(IsIgnore = true)]
public int AddQuantity
{
get => _addQuantity;
set
{
SetProperty(ref _addQuantity, value);
}
}
private int _takeQuantity = 0;
[SugarColumn(IsIgnore = true)]
public int TakeQuantity
{
get => _takeQuantity;
set
{
if (value > Quantity)
{
throw new ArgumentException("取药数量不能大于库存");
}
SetProperty(ref _takeQuantity, value);
}
}
//private string _tipMessage=string.Empty;
//[SugarColumn(IsIgnore = true)]
//public string TipMessage
//{
// get => _tipMessage;
// set
// {
// SetProperty(ref _tipMessage, value);
// }
//}
private int _returnQuantity = 0;
[SugarColumn(IsIgnore = true)]
public int ReturnQuantity
{
get => _returnQuantity;
set
{
SetProperty(ref _returnQuantity, value);
}
}
private int _checkQuantity = 0;
[SugarColumn(IsIgnore = true)]
public int CheckQuantity
{
get => _checkQuantity;
set
{
if (value < 0)
{
throw new ArgumentException("盘点数量不能是负数");
}
SetProperty(ref _checkQuantity, value);
}
}
/// <summary>
/// 药品基数
/// </summary>
private int _baseQuantity = 0;
[SugarColumn(ColumnName = "Check_Quantity")]
public int BaseQuantity
{
get => _baseQuantity;
set
{
SetProperty(ref _baseQuantity, value);
}
}
[SugarColumn(IsIgnore = true)]
public int? CanReturnQuantity { get; set; }
[Navigate(NavigateType.ManyToOne, nameof(DrugId))]
public DrugInfo DrugInfo { get; set; }
[SugarColumn(IsIgnore = true)]
public int process { get; set; } = 0;
[SugarColumn(IsIgnore = true)]
public DrugManuNo? drugManuNo { get; set; }
//private ChannelList? _channelList;
//[Navigate(NavigateType.ManyToOne, nameof(Chnguid))]
//public ChannelList ChannelLst { get => _channelList; set => SetProperty(ref _channelList, value); }
//[SugarColumn(IsIgnore = true)]
//public DrugPleaseClaim PleaseClaim { get; set; }
//dm_machine_record表id值
[SugarColumn(IsIgnore = true)]
public int? MachineRecordId { get; set; }
[SugarColumn(IsIgnore =true)]
public string OrderNos { get; set; }
//交接柜加药数量
[SugarColumn(ColumnName = "col_no1")]
public int AddToJJNum { get; set; }
//需要加药数量
[SugarColumn(ColumnName = "col_no2")]
public int NeedNum { get; set; }
}
}

View File

@ -0,0 +1,31 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Prism.Mvvm;
using SqlSugar;
namespace DM_Weight.Models
{
/// <summary>
/// 药品基数表
/// </summary>
[SugarTable("drug_base")]
public class DrugBase:BindableBase
{
private int _baseId = 0;
[SugarColumn(ColumnName = "baseid", IsPrimaryKey = true)]
public int BaseId { get=> _baseId; set { SetProperty(ref _baseId, value); } }
private string _drugId;
[SugarColumn(ColumnName = "drugid")]
public string DrugId { get => _drugId; set { SetProperty(ref _drugId, value); } }
private string _machineId = "";
[SugarColumn(ColumnName = "machine_id")]
public string MachineId { get => _machineId; set { SetProperty(ref _machineId, value); } }
private int _baseQuantity = 0;
[SugarColumn(ColumnName = "baseQuantity")]
public int BaseQuantity { get=>_baseQuantity; set{ SetProperty(ref _baseQuantity, value); } }
}
}

View File

@ -0,0 +1,108 @@
using Prism.Mvvm;
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("drug_info")]
public class DrugInfo : BindableBase
{
/// <summary>
///
///</summary>
//[SugarColumn(ColumnName = "pharmacy")]
//public string Pharmacy { get; set; }
/// <summary>
/// ҩƷID
///</summary>
[SugarColumn(ColumnName = "drug_id", IsPrimaryKey = true)]
public string DrugId { get; set; }
/// <summary>
/// ƴ
///</summary>
[SugarColumn(ColumnName = "py_code")]
public string PyCode { get; set; }
/// <summary>
///
///</summary>
//[SugarColumn(ColumnName = "BD_code")]
//public string BdCode { get; set; }
/// <summary>
/// ҩƷ
///</summary>
[SugarColumn(ColumnName = "drug_barcode")]
public string DrugBarcode { get; set; }
/// <summary>
/// ҩƷ<D2A9><C6B7><EFBFBD><EFBFBD>
///</summary>
[SugarColumn(ColumnName = "drug_name")]
public string DrugName { get; set; }
/// <summary>
///
///</summary>
[SugarColumn(ColumnName = "drug_brand_name")]
public string DrugBrandname { get; set; }
/// <summary>
/// ҩƷ<D2A9><C6B7><EFBFBD>
///</summary>
[SugarColumn(ColumnName = "drug_spec")]
public string DrugSpec { get; set; }
/// <summary>
/// <20><><EFBFBD><EFBFBD>
///</summary>
[SugarColumn(ColumnName = "dosage")]
public string Dosage { get; set; }
/// <summary>
/// <20><>װ<EFBFBD><D7B0>λ
///</summary>
[SugarColumn(ColumnName = "pack_unit")]
public string PackUnit { get; set; }
/// <summary>
/// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
///</summary>
[SugarColumn(ColumnName = "manufactory")]
public string Manufactory { get; set; }
/// <summary>
/// <20><><EFBFBD>ҩ<EFBFBD><D2A9>
///</summary>
[SugarColumn(ColumnName = "max_stock")]
public int? MaxStock { get; set; }
/// <summary>
/// 药品类型
/// </summary>
[SugarColumn(ColumnName = "drug_type")]
public string DrugType { get; set; }
//[SugarColumn(IsIgnore=true)]
[Navigate(NavigateType.OneToMany, nameof(ChannelStock.DrugId), nameof(DrugId))]//BookA表中的studenId
public List<ChannelStock> channelStocks { get; set; }
[Navigate(NavigateType.OneToMany, nameof(DrugManuNo.DrugId))]//BookA表中的studenId
public List<DrugManuNo>? DrugManuNos { get; set; }
[SugarColumn(IsIgnore = true)]
public int? StockQuantity { get; set; }
private DrugBase _base;
[Navigate(NavigateType.OneToOne, nameof(DrugBase.DrugId), nameof(DrugId))]
public DrugBase drugBase
{
get => _base;
set { SetProperty(ref _base, value); }
}
[SugarColumn(IsIgnore = true)]
public string drug_name_spec { get; set; }
}
}

View File

@ -0,0 +1,35 @@
using Prism.Mvvm;
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DM_Weight.Models
{
[SugarTable("drug_manu_no")]
public class DrugManuNo : BindableBase
{
private string _id;
[SugarColumn(ColumnName = "dmnguid", IsPrimaryKey = true)]
public string Id { get => _id; set => SetProperty(ref _id, value); }
private string _drugId;
[SugarColumn(ColumnName = "drug_id")]
public string DrugId { get => _drugId; set => SetProperty(ref _drugId, value); }
private string _manuNo;
[SugarColumn(ColumnName = "manu_no")]
public string ManuNo { get => _manuNo; set => SetProperty(ref _manuNo, value); }
private string _manuDate;
[SugarColumn(ColumnName = "manu_date")]
public string ManuDate { get => _manuDate; set => SetProperty(ref _manuDate, value); }
private string _effDate;
[SugarColumn(ColumnName = "eff_date")]
public string EffDate { get => _effDate; set => SetProperty(ref _effDate, value); }
}
}

View File

@ -0,0 +1,35 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using SqlSugar;
namespace DM_Weight.Models
{
/// <summary>
///
///</summary>
[Serializable]
public class PremissionDm
{
/// <summary>
/// 主键
///</summary>
public int Id { get; set; }
/// <summary>
/// 菜单名
///</summary>
public string PremissionName { get; set; }
/// <summary>
/// 菜单路径
///</summary>
public string PremissionPath { get; set; }
/// <summary>
/// 图片source
///</summary>
public string PremissionImage { get; set; }
public ObservableCollection<PremissionDm>? Children { get; set; }
}
}

View File

@ -0,0 +1,40 @@
using System;
using System.Collections.Generic;
using System.Linq;
using SqlSugar;
namespace DM_Weight.Models
{
/// <summary>
///
///</summary>
[SugarTable("role")]
public class RoleDm
{
/// <summary>
///
///</summary>
[SugarColumn(ColumnName="id" ,IsPrimaryKey = true ,IsIdentity = true )]
public int? Id { get; set; }
/// <summary>
///
///</summary>
[SugarColumn(ColumnName="role_name" )]
public string RoleName { get; set; }
/// <summary>
///
///</summary>
//[SugarColumn(ColumnName="role_des" )]
//public string RoleDes { get; set; }
/// <summary>
///
///</summary>
///[SugarColumn(ColumnName="permissions" )]
[SugarColumn(ColumnName = "permissions", ColumnDataType = "varchar(4000)" /*可以设置类型*/, IsJson = true)]//必填
public List<PremissionDm> Permissions { get; set; }
/// <summary>
///
///</summary>
[SugarColumn(ColumnName="machine_id" )]
public string MachineId { get; set; }
}
}

View File

@ -0,0 +1,77 @@
using System;
using System.Collections.Generic;
using System.Linq;
using SqlSugar;
namespace DM_Weight.Models
{
/// <summary>
///
///</summary>
[SugarTable("user_list")]
public class UserList
{
/// <summary>
///
///</summary>
[SugarColumn(ColumnName="id" ,IsPrimaryKey = true ,IsIdentity = true )]
public int Id { get; set; }
/// <summary>
///
///</summary>
[SugarColumn(ColumnName="user_id" )]
public string UserName { get; set; }
/// <summary>
///
///</summary>
[SugarColumn(ColumnName="user_name" )]
public string Nickname { get; set; }
/// <summary>
///
///</summary>
[SugarColumn(ColumnName="pass_word" )]
public string PassWord { get; set; }
/// <summary>
///
///</summary>
[SugarColumn(ColumnName="user_barcode" )]
public string UserBarcode { get; set; }
/// <summary>
///
///</summary>
//[SugarColumn(ColumnName="status" )]
//public int? Status { get; set; }
/// <summary>
///
///</summary>
[SugarColumn(ColumnName="machine_role_id" )]
public int? RoleId { get; set; }
[Navigate(NavigateType.ManyToOne, nameof(RoleId))]
public RoleDm? Role { get; set; }
/// <summary>
///
///</summary>
//[SugarColumn(ColumnName="user_card" )]
// public string UserCard { get; set; }
/// <summary>
///
///</summary>
[SugarColumn(ColumnName="machine_id" )]
public string MachineId { get; set; }
/// <summary>
///
///</summary>
[SugarColumn(ColumnName="sign" )]
public byte[] Sign { get; set; }
public override string ToString()
{
return "userList = [UserName:" + Nickname + ", UserId:" + UserName + "]";
}
}
}

View File

@ -0,0 +1,428 @@
using gregn6Lib;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using DM_Weight.Models;
using System.Configuration;
using DM_Weight.util;
using System.Diagnostics;
namespace DM_Weight.Report
{
public class GridReportUtil
{
// 定义Grid++Report报表主对象
public static GridppReport Report = new GridppReport();
public static string gridConnectionString = ConfigurationManager.AppSettings["gridConnectionString"];
/**
*
* tempname:
* data:
*/
public static void PrintReport(string tempname, object data)
{
// 定义Grid++Report报表主对象
GridppReport Report = new GridppReport();
// 加载模板文件
Report.LoadFromFile(new FileInfo(AppDomain.CurrentDomain.BaseDirectory) + "ReportTemp//" + tempname);
string s = JsonConvert.SerializeObject(data);
// 加载数据
Report.LoadDataFromXML(JsonConvert.SerializeObject(data));
Report.PrintPreview(true);
}
public static void PrintReportStock()
{
// 定义Grid++Report报表主对象
GridppReport Report = new GridppReport();
//Report.Initialize += new _IGridppReportEvents_InitializeEventHandler(() =>
//{
// Report.ParameterByName("machine_id").Value = (ConfigurationManager.AppSettings["machineId"] ?? "DM1");
//});
string machine_id = (ConfigurationManager.AppSettings["machineId"] ?? "DM1");
string SQL = $@"SELECT cl.`row_no` AS drawerNo,cl.`col_no` AS colNo,cl.`quantity` AS quantity,cl.`manu_no` AS manuNo,cl.`eff_date` AS effDate,
di.`drug_name` AS drugName,di.`drug_spec` AS drugSpec,di.`pack_unit` AS packUnit,di.`manufactory` AS manuFactory,di.`max_stock` AS baseQuantity,
cl.`drug_id` AS drugId FROM channel_stock cl INNER JOIN drug_info di ON di.`drug_id` = cl.`drug_id` WHERE cl.`machine_id` = '{machine_id}' AND cl.`drawer_type` = 1 ORDER BY cl.`drug_id`";
// 加载模板文件
Report.LoadFromFile(new FileInfo(AppDomain.CurrentDomain.BaseDirectory) + "ReportTemp//" + "stock_template.grf");
Report.DetailGrid.Recordset.ConnectionString = gridConnectionString;
Report.DetailGrid.Recordset.QuerySQL = SQL;
Report.PrintPreview(true);
}
public static void PrintReportAccountBook(DateTime? startDate, DateTime? endDate)
{
DateTime? p_startDate = startDate ?? Convert.ToDateTime("2010-1-1");
DateTime? p_endDate = endDate ?? DateTime.Now.AddDays(1);
string p_machine_id = (ConfigurationManager.AppSettings["machineId"] ?? "DM1");
// 定义Grid++Report报表主对象
GridppReport Report = new GridppReport();
// 加载模板文件
Report.LoadFromFile(new FileInfo(AppDomain.CurrentDomain.BaseDirectory) + "ReportTemp//" + "account_book_temp.grf");
string SQL = string.Empty;
Report.DetailGrid.Recordset.ConnectionString = gridConnectionString;
//Report.Initialize += new _IGridppReportEvents_InitializeEventHandler(() =>
//{
// Report.ParameterByName("machine_id").Value = (ConfigurationManager.AppSettings["machineId"] ?? "DM1");
// Report.ParameterByName("startDate").Value = startDate ?? Convert.ToDateTime("2010-1-1");
// Report.ParameterByName("endDate").Value = endDate ?? DateTime.Now.AddDays(1);
//});
//Report.DetailGrid.Recordset.QuerySQL = SQL;
SQL = $@"SELECT mr.`stock_quantity` AS `stockQuantity`, IF(mr.`type` IN (1, 31), mr.`quantity`, IF(mr.`type` = 4 AND mr.`quantity` > 0, mr.`quantity`, 0))
AS `inQuantity`, IF(mr.`type` = 2, mr.`quantity`, IF(mr.`type` = 4 AND mr.`quantity` < 0, (0 - mr.`quantity`), 0)) AS `outQuantity`,
mr.`operation_time` AS `operationTime`, mr.`invoice_id` AS `invoiceId`, di.`drug_name` AS `drugName`, di.`drug_id` AS `drugId`,
di.`drug_spec` AS `drugSpec`, di.`pack_unit` AS `packUnit`, di.`dosage` AS `dosage`, di.`manufactory` AS `manufactory`,
mr.`manu_no` AS `manuNo`, mr.`eff_date` AS `effDate`, u1.`user_name` AS `operatorName`, u2.`user_name` AS `reviewerName` FROM
dm_machine_record mr LEFT JOIN drug_info di ON mr.`drug_id` = di.`drug_id` LEFT JOIN user_list u1 ON mr.`operator` = u1.`id`
LEFT JOIN user_list u2 ON mr.`reviewer` = u2.`id` WHERE mr.`machine_id` = '{p_machine_id}' AND mr.`operation_time` > '{p_startDate}'
AND mr.`operation_time` < '{p_endDate}' ORDER BY mr.`drug_id`, mr.`operation_time`, mr.`id`";
Report.DetailGrid.Recordset.QuerySQL = SQL;
Report.PrintPreview(true);
}
public static void PrintReportAccountBook(DateTime? startDate, DateTime? endDate, int type, string drug_id)
{
// 定义Grid++Report报表主对象
GridppReport Report = new GridppReport();
// 加载模板文件
Report.LoadFromFile(new FileInfo(AppDomain.CurrentDomain.BaseDirectory) + "ReportTemp//" + "account_book_temp.grf");
Report.DetailGrid.Recordset.ConnectionString = gridConnectionString;
DateTime? p_startDate = startDate ?? Convert.ToDateTime("2010-1-1");
DateTime? p_endDate = endDate ?? DateTime.Now.AddDays(1);
string p_machine_id = (ConfigurationManager.AppSettings["machineId"] ?? "DM1");
string SQL = $@" SELECT ac.create_date as operationTime, ac.TYPE,
if(ac.type in(1,2),0,ac.yesterday_quantity) as YQuantity,if(ac.type in(3,4),0,ac.add_quantity) as inQuantity,if(ac.type in(3,4),0,ac.out_quantity) as outQuantity,
if(ac.type in(1,2),0,ac.manu_stock) as ManuStock,ac.total_stock AS stockQuantity, -- if(ac.type in(1,2),0,ac.total_stock) as TotalStock,
ac.invoice_no as invoiceId, ac.manu_no as manuNo,ac.eff_date as effDate,di.drug_id,di.drug_name as DrugName,di.drug_spec as DrugSpec,di.manufactory as manufactory,di.pack_unit AS packUnit,di.dosage,u1.user_name as operatorName,u2.user_name as reviewerName
FROM account_book_g2 ac left join drug_info di on ac.drug_id=di.drug_id left join user_list u1 on ac.user_id1=u1.id left join user_list u2 on ac.user_id2=u2.id
WHERE ac.machine_id='{p_machine_id}' and create_time>'{p_startDate}' AND create_time<'{p_endDate}' ";
if (!string.IsNullOrEmpty(drug_id))
{
SQL += " AND ac.drug_id='" + drug_id + "' ";
}
if (type > 0)
{
if (type == 1)
{
SQL += " WHERE AddQuantity>0 ";
}
if (type == 2)
{
SQL += " WHERE OutQuantity>0 ";
}
if (type == 3)
{
SQL += " WHERE type=3 ";
}
if (type == 4)
{
SQL += " WHERE type=4 ";
}
}
SQL += " ORDER BY di.drug_id,ac.create_date desc";
Report.DetailGrid.Recordset.QuerySQL = SQL;
Report.PrintPreview(true);
//string filePath = AppDomain.CurrentDomain.BaseDirectory + "ReportTemp//" + "account_book_temp.pdf";
//if (File.Exists(filePath))
//{
// try
// {
// File.Delete(filePath);
// }
// catch (Exception ex)
// {
// FindAndKillProcess();
// }
//}
//Report.ExportDirect(GRExportType.gretPDF, filePath, false, true);
}
public static void PrintReportMechineRecord(int type, DateTime? startDate, DateTime? endDate)
{
// 定义Grid++Report报表主对象
GridppReport Report = new GridppReport();
DateTime? p_startDate = startDate ?? Convert.ToDateTime("2010-1-1");
DateTime? p_endDate = endDate ?? DateTime.Now.AddDays(1);
string p_machine_id = (ConfigurationManager.AppSettings["machineId"] ?? "DM1");
string SQL = string.Empty;
//Report.Initialize += new _IGridppReportEvents_InitializeEventHandler(() =>
//{
// Report.ParameterByName("machine_id").Value = (ConfigurationManager.AppSettings["machineId"] ?? "DM1");
// Report.ParameterByName("startDate").Value = startDate??DateTime.Now.AddYears(-10);
// Report.ParameterByName("endDate").Value = endDate??DateTime.Now.AddDays(1);
//});
// 加载模板文件
if (type == 1)
{
Report.LoadFromFile(new FileInfo(AppDomain.CurrentDomain.BaseDirectory) + "ReportTemp//" + "machine_log_add.grf");
SQL = $@"SELECT dmr.`drawer_no` AS drawerNo,dmr.`col_no` AS colNo,dmr.`type` AS `type`,dmr.`quantity` AS quantity,
dmr.`manu_no` AS manuNo,dmr.`eff_date` AS effDate,dmr.`operation_time` AS operationTime,
di.`drug_name` AS drugName,di.`drug_spec` AS drugSpec,di.`pack_unit` AS packUnit,
di.`manufactory` AS manuFactory,di.`max_stock` AS baseQuantity,dmr.`drug_id` AS drugId,
ul.`user_name` AS nickname FROM dm_machine_record dmr LEFT JOIN drug_info di ON di.`drug_id` = dmr.`drug_id`
LEFT JOIN user_list ul ON ul.`id` = dmr.`Operator` WHERE dmr.`type` = 1 AND dmr.`machine_id` = '{p_machine_id}'
AND dmr.`operation_time` > '{p_startDate}' AND dmr.`operation_time` < '{p_endDate}'";
}
else if (type == 2)
{
Report.LoadFromFile(new FileInfo(AppDomain.CurrentDomain.BaseDirectory) + "ReportTemp//" + "machine_log_take.grf");
SQL = $@" SELECT dmr.`drawer_no` AS drawerNo,dmr.`col_no` AS colNo,dmr.`type` AS `type`,dmr.`quantity` AS quantity,
dmr.`manu_no` AS manuNo,dmr.`eff_date` AS effDate,dmr.`operation_time` AS operationTime,
di.`drug_name` AS drugName,di.`drug_spec` AS drugSpec,di.`pack_unit` AS packUnit,
di.`manufactory` AS manuFactory,di.`max_stock` AS baseQuantity,dmr.`drug_id` AS drugId,
ul.`user_name` AS nickname FROM dm_machine_record dmr LEFT JOIN drug_info di ON di.`drug_id` = dmr.`drug_id`
LEFT JOIN user_list ul ON ul.`id` = dmr.`Operator` WHERE dmr.`type` = 2
AND dmr.`machine_id` ='{p_machine_id}' AND dmr.`operation_time` > '{p_startDate}'
AND dmr.`operation_time` < '{p_endDate}'";
}
else if (type == 3)
{
Report.LoadFromFile(new FileInfo(AppDomain.CurrentDomain.BaseDirectory) + "ReportTemp//" + "machine_log_return.grf");
SQL = $@" SELECT dmr.`drawer_no` AS drawerNo,dmr.`col_no` AS colNo,dmr.`type` AS `type`,
CONCAT(dmr.`quantity`,IF(dmr.`type`=32,""()"","""")) AS quantity,dmr.`manu_no` AS manuNo,
dmr.`eff_date` AS effDate,dmr.`operation_time` AS operationTime,di.`drug_name` AS drugName,
di.`drug_spec` AS drugSpec,di.`pack_unit` AS packUnit,
di.`manufactory` AS manuFactory,di.`max_stock` AS baseQuantity,
dmr.`drug_id` AS drugId,ul.`user_name` AS nickname FROM dm_machine_record dmr
LEFT JOIN drug_info di ON di.`drug_id` = dmr.`drug_id` LEFT JOIN user_list ul ON ul.`id` = dmr.`Operator`
WHERE dmr.`type` in (31, 32) AND dmr.`machine_id` = '{p_machine_id}' AND dmr.`operation_time` > '{p_startDate}'
AND dmr.`operation_time` < '{p_endDate}'";
}
else
{
Report.LoadFromFile(new FileInfo(AppDomain.CurrentDomain.BaseDirectory) + "ReportTemp//" + "machine_log_check.grf");
SQL = $@" SELECT dmr.`drawer_no` AS drawerNo,dmr.`col_no` AS colNo,dmr.`type` AS `type`,dmr.`quantity` AS quantity,
dmr.`manu_no` AS manuNo,dmr.`eff_date` AS effDate,dmr.`operation_time` AS operationTime,
di.`drug_name` AS drugName,di.`drug_spec` AS drugSpec,di.`pack_unit` AS packUnit,
di.`manufactory` AS manuFactory,di.`max_stock` AS baseQuantity,dmr.`drug_id` AS drugId,
ul.`user_name` AS nickname FROM dm_machine_record dmr LEFT JOIN drug_info di ON di.`drug_id` = dmr.`drug_id`
LEFT JOIN user_list ul ON ul.`id` = dmr.`Operator` WHERE dmr.`type` = 4
AND dmr.`machine_id` = '{p_machine_id}' AND dmr.`operation_time` > '{p_startDate}'
AND dmr.`operation_time` < '{p_endDate}'";
}
Report.DetailGrid.Recordset.ConnectionString = gridConnectionString;
Report.DetailGrid.Recordset.QuerySQL = SQL;
Report.PrintPreview(true);
}
//交接班记录报表
public static void PrintChangeShiftsReport(DateTime? startDate, DateTime? endDate)
{
DateTime? p_startDate = startDate ?? Convert.ToDateTime("2010-1-1");
DateTime? p_endDate = endDate ?? DateTime.Now.AddDays(1);
string p_machine_id = (ConfigurationManager.AppSettings["machineId"] ?? "DM1");
// 定义Grid++Report报表主对象
GridppReport Report = new GridppReport();
// 加载模板文件
Report.LoadFromFile(new FileInfo(AppDomain.CurrentDomain.BaseDirectory) + "ReportTemp//" + "changeShifts_temp.grf");
string SQL = string.Empty;
Report.DetailGrid.Recordset.ConnectionString = gridConnectionString;
Report.Initialize += new _IGridppReportEvents_InitializeEventHandler(() =>
{
Report.ParameterByName("machine_id").Value = (ConfigurationManager.AppSettings["machineId"] ?? "DM1");
Report.ParameterByName("startDate").Value = startDate ?? Convert.ToDateTime("2010-1-1");
Report.ParameterByName("endDate").Value = endDate ?? DateTime.Now.AddDays(1);
});
SQL = $@"SELECT opt_date,drug_name,drug_spec,beforenum,getnum,usenum,manu_no,surplus,CONCAT(fromoperator,' ',fromreviewer) as fromoperator,
CONCAT(tooperator,' ',toreviewer) as tooperator
from `hkc_shiftsreport` WHERE `machineid` = '{p_machine_id}' AND `opt_date` > '{p_startDate}'
AND opt_date < '{p_endDate}' ORDER BY opt_date";
Report.DetailGrid.Recordset.QuerySQL = SQL;
//Report.PrintPreview(true);
string filePath = AppDomain.CurrentDomain.BaseDirectory + "ReportTemp//" + "changeShifts_temp.pdf";
if (File.Exists(filePath))
{
try
{
File.Delete(filePath);
}
catch (Exception ex)
{
FindAndKillProcess();
}
}
Report.ExportDirect(GRExportType.gretPDF, filePath, false, true);
}
public static bool FindAndKillProcess()
{
foreach (Process clsProcess in Process.GetProcesses())
{
if (clsProcess.ProcessName.Contains("wps") || clsProcess.ProcessName.Contains("msedge"))
{
clsProcess.Kill();
//return true;
}
}
//process not found, return false
return false;
}
/// <summary>
/// 空安瓿回收销毁报表
/// </summary>
/// <param name="startDate"></param>
/// <param name="endDate"></param>
public static void PrintEmptyDestoryReport(DateTime? startDate, DateTime? endDate)
{
// 定义Grid++Report报表主对象
GridppReport Report = new GridppReport();
DateTime? p_startDate = startDate ?? Convert.ToDateTime("2010-1-1");
DateTime? p_endDate = endDate ?? DateTime.Now.AddDays(1);
string p_machine_id = (ConfigurationManager.AppSettings["machineId"] ?? "DM1");
string SQL = string.Empty;
Report.LoadFromFile(new FileInfo(AppDomain.CurrentDomain.BaseDirectory) + "ReportTemp//" + "ReturnEmptyDistory_template.grf");
SQL = $@"
SELECT di.drug_id, di.drug_name as drugName,di.dosage,di.drug_spec as drugSpec,di.big_unit,oi.Order_Date, CONCAT(oi.p_name,'/',oi.dept_name) as userDeptName,
od.Quantity,mr.Manu_No,ul.user_name as retuenUser,u2.user_name as returnReviewer,u3.User_name as distoryUser,u4.User_name as distoryRevierer,(od.Quantity-mr.return_quantity2) as needReturnEmptyCount
from order_info oi inner join order_detail od on oi.order_no=od.order_no
inner join (SELECT id as mrId,manu_no,invoice_id,id,operator,reviewer, sum(return_quantity2) as return_quantity2 FROM dm_machine_record where type=2 and machine_id='{ConfigurationManager.AppSettings["machineId"] ?? "DM3"}' GROUP BY invoice_id) mr on oi.order_no=mr.invoice_id
INNER JOIN drug_info di on od.drug_id=di.drug_id
LEFT JOIN (SELECT manu_no,invoice_id,id,operator,reviewer,get_id from dm_machine_record where type=32 and machine_id='{ConfigurationManager.AppSettings["machineId"] ?? "DM3"}') re on re.get_id=mr.id
LEFT JOIN (SELECT recordId,operatorid,reviewerid,machine_id FROM destory_detail WHERE machine_id='{ConfigurationManager.AppSettings["machineId"] ?? "DM3"}') ddl on re.id=ddl.recordId
-- LEFT JOIN (SELECT User_name,machine_id,id FROM user_list WHERE machine_id='{ConfigurationManager.AppSettings["machineId"] ?? "DM3"}') ul0 on mr.operator=ul0.id
-- LEFT JOIN (SELECT User_name,machine_id,id FROM user_list WHERE machine_id='{ConfigurationManager.AppSettings["machineId"] ?? "DM3"}') ul00 on re.reviewer=ul00.id
LEFT JOIN (SELECT User_name,machine_id,id FROM user_list WHERE machine_id='{ConfigurationManager.AppSettings["machineId"] ?? "DM3"}') ul on re.operator=ul.id
LEFT JOIN (SELECT User_name,machine_id,id FROM user_list WHERE machine_id='{ConfigurationManager.AppSettings["machineId"] ?? "DM3"}') u2 on re.reviewer=u2.id
LEFT JOIN (SELECT User_name,machine_id,id FROM user_list WHERE machine_id='{ConfigurationManager.AppSettings["machineId"] ?? "DM3"}') u3 on ddl.operatorid=u3.id
LEFT JOIN (SELECT User_name,machine_id,id FROM user_list WHERE machine_id='{ConfigurationManager.AppSettings["machineId"] ?? "DM3"}') u4 on ddl.reviewerid=u4.id
WHERE
oi.Pharmacy='{ConfigurationManager.AppSettings["storage"] ?? ""}' and oi.Order_Date>'{startDate}' and oi.Order_Date<'{endDate}' GROUP BY Order_Date";
Report.DetailGrid.Recordset.ConnectionString = gridConnectionString;
Report.DetailGrid.Recordset.QuerySQL = SQL;
Report.PrintPreview(true);
}
/// <summary>
/// 发药登记表
/// </summary>
/// <param name="startDate"></param>
/// <param name="endDate"></param>
public static void OrderUseReport(DateTime? startDate,DateTime? endDate, string drug_id)
{
// 定义Grid++Report报表主对象
GridppReport Report = new GridppReport();
DateTime? p_startDate = startDate ?? Convert.ToDateTime("2010-1-1");
DateTime? p_endDate = endDate ?? DateTime.Now.AddDays(1);
string p_machine_id = (ConfigurationManager.AppSettings["machineId"] ?? "DM1");
string SQL = string.Empty;
Report.LoadFromFile(new FileInfo(AppDomain.CurrentDomain.BaseDirectory) + "ReportTemp//" + "orderUse_template.grf");
SQL = $@"
SELECT oi.p_name,oi.age,oi.sex,oi.id_number,oi.patientno,oi.disease,od.drug_id,oi.doctor_name,oi.order_no,oi.order_date,
dmr.id,dmr.`drawer_no` AS drawerNo,dmr.`col_no` AS colNo,dmr.`type` AS `type`,dmr.`quantity` AS quantity,
dmr.`manu_no` AS manuNo,dmr.`eff_date` AS effDate,dmr.`operation_time` AS operationTime,
di.`drug_name` AS drugName,di.`drug_spec` AS drugSpec,di.`pack_unit` AS packUnit,
di.`manufactory` AS manuFactory,di.`max_stock` AS baseQuantity,dmr.`drug_id` AS drugId,
ul.`user_name` AS nickname,U2.`user_name` AS reviewNickname FROM dm_machine_record dmr
INNER JOIN ORDER_INFO oi on dmr.invoice_id=oi.order_no
INNER JOIN order_detail od on oi.order_no=od.order_no and oi.order_id=od.order_id
LEFT JOIN drug_info di ON di.`drug_id` = dmr.`drug_id`
LEFT JOIN (select id,user_name from user_list where machine_id='{ConfigurationManager.AppSettings["machineId"] ?? "DM3"}') ul ON ul.`id` = dmr.`Operator`
LEFT JOIN (select id,user_name from user_list where machine_id='{ConfigurationManager.AppSettings["machineId"] ?? "DM3"}') U2 ON U2.ID=dmr.reviewer
WHERE dmr.`type` = 2 and oi.Pharmacy='{ConfigurationManager.AppSettings["storage"] ?? ""}'
AND dmr.`machine_id` ='{ConfigurationManager.AppSettings["machineId"] ?? "DM3"}' AND oi.`order_date` > '{startDate}'
AND oi.`order_date` < '{endDate}'";
if (!string.IsNullOrEmpty(drug_id))
{
SQL += " AND ac.drug_id='" + drug_id + "' ";
}
Report.DetailGrid.Recordset.ConnectionString = gridConnectionString;
Report.DetailGrid.Recordset.QuerySQL = SQL;
Report.PrintPreview(true);
}
/// <summary>
/// 使用登记册
/// 能按麻醉师名字、时间结合起来查找
/// </summary>
public static void UserAccount(DateTime? startDate,DateTime? endDate,string Name,string box)
{
// 定义Grid++Report报表主对象
GridppReport Report = new GridppReport();
DateTime? p_startDate = startDate ?? Convert.ToDateTime("2010-1-1");
DateTime? p_endDate = endDate ?? DateTime.Now.AddDays(1);
string p_machine_id = (ConfigurationManager.AppSettings["machineId"] ?? "DM1");
string SQL = string.Empty;
Report.LoadFromFile(new FileInfo(AppDomain.CurrentDomain.BaseDirectory) + "ReportTemp//" + "account_use_temp.grf");
SQL = $@"
SELECT re.create_time as OptDate, di.drug_name as DrugName,di.Drug_spec as DrugSpec,dt.Set_manu_no as ManuNo,re.patient_name as PName,
CONCAT(use_dose,dose_unit) as UDose,CONCAT(residual_dose,dose_unit) as ReDose,if(residual_dose>0,'是','否') as Disposal,
re.anaesthetist_name as AName,re.operator_name as OName,re.supervisor_name as CName,of.operator as EmpRecive,'' as EmpMedicRecive,re.disposal_time as DisposalTime,SUBSTRING_INDEX(of.win_no, '号', 1) as WinNo,re.card_no as cardNo
from surgical_residual re inner join drug_info di on re.drug_id=di.drug_id inner join hkc_order_finish of on re.order_no=of.order_no and of.state=2 left join order_detail_sm dt on re.order_no=dt.order_no
where re.create_time > '{startDate}' and re.create_time< '{endDate}'";
if (!string.IsNullOrEmpty(Name))
{
SQL += " AND re.anaesthetist_name='" + Name + "' ";
}
if(!string.IsNullOrEmpty(box))
{
SQL+= " AND of.win_no='" + box + "' ";
}
SQL += " ORDER BY re.create_time";
Report.DetailGrid.Recordset.ConnectionString = gridConnectionString;
Report.DetailGrid.Recordset.QuerySQL = SQL;
Report.PrintPreview(true);
}
public static void PrintReportAccountBook(DateTime? startDate, DateTime? endDate, string drug_id)
{
// 定义Grid++Report报表主对象
GridppReport Report = new GridppReport();
// 加载模板文件
Report.LoadFromFile(new FileInfo(AppDomain.CurrentDomain.BaseDirectory) + "ReportTemp//" + "account_book_new.grf");
Report.DetailGrid.Recordset.ConnectionString = gridConnectionString;
DateTime? p_startDate = startDate ?? Convert.ToDateTime("2010-1-1");
DateTime? p_endDate = endDate ?? DateTime.Now.AddDays(1);
string p_machine_id = (ConfigurationManager.AppSettings["machineId"] ?? "DM1");
string SQL = $@" select ab.drug_id, ab.type,
di.drug_name AS DrugName,di.Drug_spec AS DrugSpec,di.big_unit AS BigUnit,di.small_unit AS SmallUnit,
DATE_FORMAT(ab.create_date,'%Y/%m/%d') AS YearMD,ab.manu_no AS ManuNo,DATE_FORMAT(ab.eff_date,'%Y%m%d') AS effDate,IF(ab.type=1,ab.add_quantity,'') AS InQuantity,ab.shoushuJian AS shoushuJian,
re.Patient_name AS PName,re.sex AS Sex,re.age AS Age,re.use_dose AS UseDose,re.residual_dose AS ResidualDose,re.create_time AS DiposalTime
,re.operator_name, ab.manu_stock AS Stock,ab.total_stock AS empty,ab.total_stock,UL.User_name AS SendUser,
IF(ab.type=1,UL.User_name,UL2.User_name) AS InCheckUser,
re.supervisor_name AS CheckUser,ab.manu_stock,ab.total_stock,ab.user_id1,ab.user_id2,ab.out_Quantity
,DB.BASEQUANTITY AS BaseQuantity,re.card_no AS ZYH,oi.dept_name AS KS,re.anaesthetist_name AS YS,
IF(ab.`type`=1,'',UL.User_name) AS emptyUser,
(SELECT sum(quantity) from channel_stock cs where cs.drug_id=ab.drug_id and cs.manu_no=ab.manu_no and cs.machine_id in('DM3','DM5')) AS CurrentStock
from account_book_g2 ab inner join drug_info di on ab.drug_id=di.Drug_ID
LEFT JOIN DRUG_BASE DB ON di.DRUG_ID=DB.DRUGID AND DB.MACHINE_ID='DM3'
LEFT JOIN order_info_sm oi on ab.invoice_no=oi.order_no
LEFT JOIN user_list UL ON ab.user_id1=UL.ID
LEFT JOIN user_list UL2 ON ab.user_id2=UL.ID
LEFT JOIN surgical_residual re on ab.invoice_no=re.order_no WHERE ab.machine_id='DM3' and ab.type in(1,2) and
ab.create_time>'{p_startDate}' AND ab.create_time<'{p_endDate}' ";
if (!string.IsNullOrEmpty(drug_id))
{
SQL += " AND ab.drug_id='" + drug_id + "' ";
}
SQL += " ORDER BY ab.create_date asc,ab.drug_id,ab.Manu_No,ab.id ";
Report.DetailGrid.Recordset.QuerySQL = SQL;
Report.PrintPreview(true);
}
}
}

View File

@ -0,0 +1,432 @@
{
"Version":"6.3.0.1",
"Font":{
"Name":"宋体",
"Size":105000,
"Weight":400,
"Charset":134
},
"Printer":{
"Oriention":"Landscape"
},
"DetailGrid":{
"CenterView":true,
"PrintAdaptMethod":"ResizeToFit",
"AppendBlankRow":true,
"Recordset":{
"QuerySQL":"SELECT \r\n cl.`row_no` AS drawerNo,\r\n cl.`col_no` AS colNo,\r\n cl.`quantity` AS quantity,\r\n cl.`manu_no` AS manuNo,\r\n cl.`eff_date` AS effDate,\r\n di.`drug_name` AS drugName,\r\n di.`drug_spec` AS drugSpec,\r\n di.`pack_unit` AS packUnit,\r\n di.`manufactory` AS manuFactory,\r\n di.`max_stock` AS baseQuantity,\r\n cl.`drug_id` AS drugId\r\nFROM\r\n channel_stock cl\r\nINNER JOIN drug_info di ON di.`drug_id` = cl.`drug_id`\r\nWHERE cl.`machine_id` = :machine_id\r\n AND cl.`drawer_type` = 1\r\n ORDER BY cl.`drug_id`",
"Field":[
{
"Name":"Order_Date"
},
{
"Name":"userDeptName",
"Format":"0"
},
{
"Name":"drugName"
},
{
"Name":"Quantity",
"Type":"Integer"
},
{
"Name":"Manu_No"
},
{
"Name":"retuenUser"
},
{
"Name":"returnReviewer",
"Type":"Integer"
},
{
"Name":"distoryUser"
},
{
"Name":"distoryRevierer"
},
{
"Name":"drugSpec"
},
{
"Name":"dosage"
},
{
"Name":"big_unit"
},
{
"Name":"drug_id"
},
{
"Name":"needReturnEmptyCount"
}
]
},
"Column":[
{
"Name":"日期",
"Width":3.175
},
{
"Name":"科室/患者",
"Width":5.3975
},
{
"Name":"Dept_Name",
"Width":1.61396
},
{
"Name":"批号",
"Width":2.98979
},
{
"Name":"空安瓿回收人",
"Width":2.98979
},
{
"Name":"空安瓿交回人",
"Width":2.99
},
{
"Name":"数量",
"Width":2
},
{
"Name":"空安瓿销毁执行人",
"Width":2.98979
},
{
"Name":"空安瓿销毁审核人",
"Width":2.99
}
],
"ColumnContent":{
"Height":0.79375,
"ColumnContentCell":[
{
"Column":"日期",
"TextAlign":"MiddleCenter",
"DataField":"Order_Date"
},
{
"Column":"科室/患者",
"TextAlign":"MiddleCenter",
"DataField":"userDeptName"
},
{
"Column":"Dept_Name",
"TextAlign":"MiddleCenter",
"DataField":"Quantity"
},
{
"Column":"批号",
"DataField":"Manu_No"
},
{
"Column":"空安瓿回收人",
"DataField":"retuenUser"
},
{
"Column":"空安瓿交回人",
"TextAlign":"MiddleCenter",
"DataField":"returnReviewer"
},
{
"Column":"数量",
"TextAlign":"MiddleCenter",
"DataField":"distoryUser"
},
{
"Column":"空安瓿销毁执行人",
"DataField":"distoryRevierer"
},
{
"Column":"空安瓿销毁审核人",
"DataField":"needReturnEmptyCount"
}
]
},
"ColumnTitle":{
"Height":1.7,
"RepeatStyle":"OnGroupHeaderPage",
"ColumnTitleCell":[
{
"GroupTitle":false,
"Column":"日期",
"Font":{
"Name":"宋体",
"Size":142500,
"Bold":true,
"Charset":134
},
"TextAlign":"MiddleCenter",
"Text":"日期"
},
{
"GroupTitle":false,
"Column":"科室/患者",
"Font":{
"Name":"宋体",
"Size":142500,
"Bold":true,
"Charset":134
},
"TextAlign":"MiddleCenter",
"Text":"科室/患者"
},
{
"GroupTitle":false,
"Column":"Dept_Name",
"Font":{
"Name":"宋体",
"Size":142500,
"Bold":true,
"Charset":134
},
"TextAlign":"MiddleCenter",
"Text":"数量"
},
{
"GroupTitle":false,
"Column":"批号",
"Font":{
"Name":"宋体",
"Size":142500,
"Bold":true,
"Charset":134
},
"TextAlign":"MiddleCenter",
"Text":"批号"
},
{
"GroupTitle":false,
"Column":"空安瓿回收人",
"Font":{
"Name":"宋体",
"Size":142500,
"Bold":true,
"Charset":134
},
"TextAlign":"MiddleCenter",
"Text":"空安瓿\r\n回收人"
},
{
"GroupTitle":false,
"Column":"空安瓿交回人",
"Font":{
"Name":"宋体",
"Size":142500,
"Bold":true,
"Charset":134
},
"TextAlign":"MiddleCenter",
"Text":"空安瓿\r\n交回人"
},
{
"GroupTitle":false,
"Column":"数量",
"Font":{
"Name":"宋体",
"Size":142500,
"Bold":true,
"Charset":134
},
"TextAlign":"MiddleCenter",
"Text":"空安瓿\r\n销毁\r\n执行人"
},
{
"GroupTitle":false,
"Column":"空安瓿销毁执行人",
"Font":{
"Name":"宋体",
"Size":142500,
"Bold":true,
"Charset":134
},
"TextAlign":"MiddleCenter",
"Text":"空安瓿\r\n销毁\r\n审核人"
},
{
"GroupTitle":false,
"Column":"空安瓿销毁审核人",
"Font":{
"Name":"宋体",
"Size":142500,
"Bold":true,
"Charset":134
},
"TextAlign":"MiddleCenter",
"Text":"待回收\r\n空安瓿\r\n数量"
}
]
},
"Group":[
{
"Name":"Group1",
"ByFields":"drug_id",
"GroupHeader":{
"PrintGridBorder":false,
"RepeatOnPage":true,
"Control":[
{
"Type":"StaticBox",
"Name":"StaticBox16",
"Top":0.0529167,
"Width":1.19063,
"Height":0.978958,
"Font":{
"Name":"宋体",
"Size":105000,
"Bold":true,
"Charset":134
},
"Text":"品名:"
},
{
"Type":"FieldBox",
"Name":"FieldBox7",
"Left":1.16417,
"Top":0.0529167,
"Width":5.63563,
"Height":0.978958,
"Font":{
"Name":"宋体",
"Size":105000,
"Bold":true,
"Charset":134
},
"DataField":"drugName"
},
{
"Type":"StaticBox",
"Name":"StaticBox17",
"Left":6.93208,
"Top":0.0529167,
"Width":1.11125,
"Height":0.978958,
"Font":{
"Name":"宋体",
"Size":105000,
"Bold":true,
"Charset":134
},
"Text":"剂型:"
},
{
"Type":"FieldBox",
"Name":"FieldBox8",
"Left":8.01688,
"Top":0.0529167,
"Width":3.175,
"Height":0.978958,
"Font":{
"Name":"宋体",
"Size":105000,
"Bold":true,
"Charset":134
},
"DataField":"dosage"
},
{
"Type":"StaticBox",
"Name":"StaticBox18",
"Left":11.5888,
"Top":0.0529167,
"Width":1.21708,
"Height":0.978958,
"Font":{
"Name":"宋体",
"Size":105000,
"Bold":true,
"Charset":134
},
"Text":"规格:"
},
{
"Type":"FieldBox",
"Name":"FieldBox10",
"Left":16.5365,
"Top":0.0529167,
"Width":2.83104,
"Height":0.978958,
"Font":{
"Name":"宋体",
"Size":105000,
"Bold":true,
"Charset":134
},
"DataField":"drugSpec"
},
{
"Type":"StaticBox",
"Name":"StaticBox20",
"Left":19.7379,
"Top":0.0529167,
"Width":2.01083,
"Height":0.978958,
"Font":{
"Name":"宋体",
"Size":105000,
"Bold":true,
"Charset":134
},
"Text":"单位:"
},
{
"Type":"FieldBox",
"Name":"FieldBox11",
"Left":21.7223,
"Top":0.05,
"Width":5.92667,
"Height":0.978958,
"Font":{
"Name":"宋体",
"Size":105000,
"Bold":true,
"Charset":134
},
"DataField":"big_unit"
}
],
"NewPageColumn":"Before"
},
"GroupFooter":{
"Height":0.635
}
}
]
},
"Parameter":[
{
"Name":"machine_id",
"Value":"DM1"
}
],
"ReportHeader":[
{
"Name":"ReportHeader1",
"Height":2.40771,
"Control":[
{
"Type":"StaticBox",
"Name":"StaticBox1",
"Center":"Horizontal",
"Left":8.99583,
"Top":0.608542,
"Width":9.18104,
"Height":1.21708,
"Font":{
"Name":"宋体",
"Size":217500,
"Bold":true,
"Charset":134
},
"TextAlign":"MiddleCenter",
"Text":"回收销毁记录"
}
],
"RepeatOnPage":true
}
]
}

View File

@ -0,0 +1,712 @@
{
"Version":"6.8.1.1",
"Font":{
"Name":"宋体",
"Size":105000,
"Weight":400,
"Charset":134
},
"Printer":{
"Oriention":"Landscape",
"TopMargin":0.3175,
"RightMargin":1,
"BottomMargin":0.3969
},
"DetailGrid":{
"CenterView":true,
"Recordset":{
"QuerySQL":"SELECT \r\n dmr.`drawer_no` AS drawerNo,\r\n dmr.`col_no` AS colNo,\r\n dmr.`type` AS `type`,\r\n CONCAT(dmr.`quantity`,IF(dmr.`type`=32,\"(空瓶)\",\"\")) AS quantity,\r\n dmr.`manu_no` AS manuNo,\r\n dmr.`eff_date` AS effDate,\r\n dmr.`operation_time` AS operationTime,\r\n di.`drug_name` AS drugName,\r\n di.`drug_spec` AS drugSpec,\r\n di.`pack_unit` AS packUnit,\r\n di.`manufactory` AS manuFactory,\r\n di.`max_stock` AS baseQuantity,\r\n dmr.`drug_id` AS drugId,\r\n ul.`user_name` AS nickname\r\nFROM\r\n dm_machine_record dmr\r\nLEFT JOIN drug_info di ON di.`drug_id` = dmr.`drug_id`\r\nLEFT JOIN user_list ul ON ul.`id` = dmr.`Operator`\r\nWHERE dmr.`type` in (31, 32)\r\n AND dmr.`machine_id` = :machine_id\r\n AND dmr.`operation_time` > :startDate\r\n AND dmr.`operation_time` < :endDate",
"Field":[
{
"Name":"药品名称",
"DBFieldName":"DrugName"
},
{
"Name":"日期",
"DBFieldName":"YearMD"
},
{
"Name":"批号",
"DBFieldName":"ManuNo"
},
{
"Name":"效期",
"Format":"yyyy/MM/dd",
"DBFieldName":"effDate"
},
{
"Name":"领入",
"DBFieldName":"InQuantity"
},
{
"Name":"规格",
"DBFieldName":"DrugSpec"
},
{
"Name":"大单位",
"DBFieldName":"BigUnit"
},
{
"Name":"小单位",
"DBFieldName":"SmallUnit"
},
{
"Name":"基数",
"DBFieldName":"BaseQuantity"
},
{
"Name":"手术间",
"DBFieldName":"shoushuJian"
},
{
"Name":"患者姓名",
"DBFieldName":"PName"
},
{
"Name":"性别",
"DBFieldName":"Sex"
},
{
"Name":"年龄",
"DBFieldName":"Age"
},
{
"Name":"住院号",
"DBFieldName":"ZYH"
},
{
"Name":"科室",
"DBFieldName":"KS"
},
{
"Name":"使用剂量",
"DBFieldName":"UseDose"
},
{
"Name":"剩余剂量",
"DBFieldName":"ResidualDose"
},
{
"Name":"余液处理时间",
"DBFieldName":"DiposalTime"
},
{
"Name":"医师",
"DBFieldName":"YS"
},
{
"Name":"复核人",
"DBFieldName":"CheckUser"
},
{
"Name":"实物",
"DBFieldName":"Stock"
},
{
"Name":"空瓶",
"DBFieldName":"empty"
},
{
"Name":"发药人",
"DBFieldName":"SendUser"
},
{
"Name":"领药人",
"DBFieldName":"InUser"
},
{
"Name":"领药复核人",
"DBFieldName":"InCheckUser"
},
{
"Name":"空瓶回收人",
"DBFieldName":"emptyUser"
},
{
"Name":"批次库存",
"DBFieldName":"CurrentStock"
}
]
},
"Column":[
{
"Name":"日期",
"Width":2.77813
},
{
"Name":"批次",
"Width":2.19604
},
{
"Name":"有效期",
"Width":2.77813
},
{
"Name":"领入",
"Width":0.820208
},
{
"Name":"手术间",
"Width":0.79375
},
{
"Name":"患者姓名",
"Width":1.61396
},
{
"Name":"性别",
"Width":1.00542
},
{
"Name":"年龄",
"Width":0.79375
},
{
"Name":"住院号",
"Width":1.5875
},
{
"Name":"科室",
"Width":2.2225
},
{
"Name":"使用剂量",
"Width":1.82563
},
{
"Name":"剩余剂量",
"Width":1.5875
},
{
"Name":"余液处理时间",
"Width":2.59292
},
{
"Name":"医师",
"Width":1.5875
},
{
"Name":"复核人",
"Width":1.79917
},
{
"Name":"空瓶回收人",
"Width":1.5875
},
{
"Name":"Column7",
"Width":1.61396
},
{
"Name":"实物",
"Width":1.40229
},
{
"Name":"空瓶",
"Width":1.19063
},
{
"Name":"发药人",
"Width":1.79917
},
{
"Name":"Column2",
"Width":1.79917
},
{
"Name":"Column8",
"Width":1.79917
}
],
"ColumnContent":{
"Height":2.01083,
"ColumnContentCell":[
{
"Column":"日期",
"TextAlign":"MiddleCenter",
"DataField":"日期"
},
{
"Column":"批次",
"TextAlign":"MiddleCenter",
"DataField":"批号"
},
{
"Column":"有效期",
"TextAlign":"MiddleCenter",
"DataField":"效期"
},
{
"Column":"领入",
"TextAlign":"MiddleCenter",
"DataField":"领入"
},
{
"Column":"手术间",
"TextAlign":"MiddleCenter",
"DataField":"手术间"
},
{
"Column":"患者姓名",
"TextAlign":"MiddleCenter",
"DataField":"患者姓名"
},
{
"Column":"性别",
"TextAlign":"MiddleCenter",
"DataField":"性别"
},
{
"Column":"年龄",
"DataField":"年龄"
},
{
"Column":"住院号",
"DataField":"住院号"
},
{
"Column":"科室",
"DataField":"科室"
},
{
"Column":"使用剂量",
"DataField":"使用剂量"
},
{
"Column":"剩余剂量",
"DataField":"剩余剂量"
},
{
"Column":"余液处理时间",
"DataField":"余液处理时间"
},
{
"Column":"医师",
"DataField":"医师"
},
{
"Column":"复核人",
"DataField":"复核人"
},
{
"Column":"空瓶回收人",
"DataField":"空瓶回收人"
},
{
"Column":"Column7"
},
{
"Column":"实物",
"DataField":"实物"
},
{
"Column":"空瓶",
"DataField":"空瓶"
},
{
"Column":"发药人",
"DataField":"发药人"
},
{
"Column":"Column2",
"DataField":"领药复核人"
},
{
"Column":"Column8",
"DataField":"批次库存"
}
]
},
"ColumnTitle":{
"Height":2.59292,
"RepeatStyle":"OnPage",
"ColumnTitleCell":[
{
"GroupTitle":false,
"Column":"日期",
"Font":{
"Name":"宋体",
"Size":120000,
"Bold":true,
"Charset":134
},
"TextAlign":"MiddleCenter",
"Text":"日期"
},
{
"GroupTitle":false,
"Column":"批次",
"Font":{
"Name":"宋体",
"Size":120000,
"Bold":true,
"Charset":134
},
"TextAlign":"MiddleCenter",
"Text":"批号"
},
{
"GroupTitle":false,
"Column":"有效期",
"Font":{
"Name":"宋体",
"Size":120000,
"Bold":true,
"Charset":134
},
"TextAlign":"MiddleCenter",
"Text":"有效期"
},
{
"GroupTitle":false,
"Column":"领入",
"Font":{
"Name":"宋体",
"Size":120000,
"Bold":true,
"Charset":134
},
"TextAlign":"MiddleCenter",
"Text":"领\r\n入"
},
{
"GroupTitle":true,
"Name":"Column1",
"ColumnTitleCell":[
{
"GroupTitle":false,
"Column":"手术间",
"Font":{
"Name":"宋体",
"Size":120000,
"Bold":true,
"Charset":134
},
"TextAlign":"MiddleCenter",
"Text":"手\r\n术\r\n间"
},
{
"GroupTitle":false,
"Column":"患者姓名",
"Font":{
"Name":"宋体",
"Size":120000,
"Bold":true,
"Charset":134
},
"TextAlign":"MiddleCenter",
"Text":"患者\r\n姓名"
},
{
"GroupTitle":false,
"Column":"性别",
"Font":{
"Name":"宋体",
"Size":120000,
"Bold":true,
"Charset":134
},
"TextAlign":"MiddleCenter",
"Text":"性\r\n别"
},
{
"GroupTitle":false,
"Column":"年龄",
"Font":{
"Name":"宋体",
"Size":120000,
"Bold":true,
"Charset":134
},
"TextAlign":"MiddleCenter",
"Text":"年\r\n龄"
},
{
"GroupTitle":false,
"Column":"住院号",
"Font":{
"Name":"宋体",
"Size":120000,
"Bold":true,
"Charset":134
},
"TextAlign":"MiddleCenter",
"Text":"住院号"
},
{
"GroupTitle":false,
"Column":"科室",
"Font":{
"Name":"宋体",
"Size":120000,
"Bold":true,
"Charset":134
},
"TextAlign":"MiddleCenter",
"Text":"科室"
},
{
"GroupTitle":false,
"Column":"使用剂量",
"Font":{
"Name":"宋体",
"Size":120000,
"Bold":true,
"Charset":134
},
"TextAlign":"MiddleCenter",
"Text":"使用\r\n剂量"
},
{
"GroupTitle":false,
"Column":"剩余剂量",
"Font":{
"Name":"宋体",
"Size":120000,
"Bold":true,
"Charset":134
},
"TextAlign":"MiddleCenter",
"Text":"剩余\r\n剂量"
},
{
"GroupTitle":false,
"Column":"余液处理时间",
"Font":{
"Name":"宋体",
"Size":120000,
"Bold":true,
"Charset":134
},
"TextAlign":"MiddleCenter",
"Text":"余液\r\n处理\r\n时间"
},
{
"GroupTitle":false,
"Column":"医师",
"Font":{
"Name":"宋体",
"Size":120000,
"Bold":true,
"Charset":134
},
"TextAlign":"MiddleCenter",
"Text":"医师"
},
{
"GroupTitle":false,
"Column":"复核人",
"Font":{
"Name":"宋体",
"Size":120000,
"Bold":true,
"Charset":134
},
"TextAlign":"MiddleCenter",
"Text":"复核人"
}
],
"Font":{
"Name":"宋体",
"Size":120000,
"Bold":true,
"Charset":134
},
"TextAlign":"MiddleCenter",
"Text":"使用"
},
{
"GroupTitle":true,
"Name":"Column6",
"ColumnTitleCell":[
{
"GroupTitle":false,
"Column":"空瓶回收人",
"Font":{
"Name":"宋体",
"Size":120000,
"Bold":true,
"Charset":134
},
"TextAlign":"MiddleCenter",
"Text":"回收人"
},
{
"GroupTitle":false,
"Column":"Column7",
"Font":{
"Name":"宋体",
"Size":120000,
"Bold":true,
"Charset":134
},
"TextAlign":"MiddleCenter",
"Text":"药房\r\n回收人"
}
],
"Font":{
"Name":"宋体",
"Size":120000,
"Bold":true,
"Charset":134
},
"TextAlign":"MiddleCenter",
"Text":"空瓶回收"
},
{
"GroupTitle":true,
"Name":"Column3",
"ColumnTitleCell":[
{
"GroupTitle":false,
"Column":"实物",
"Font":{
"Name":"宋体",
"Size":120000,
"Bold":true,
"Charset":134
},
"TextAlign":"MiddleCenter",
"Text":"实物"
},
{
"GroupTitle":false,
"Column":"空瓶",
"Font":{
"Name":"宋体",
"Size":120000,
"Bold":true,
"Charset":134
},
"TextAlign":"MiddleCenter",
"Text":"空瓶"
}
],
"Font":{
"Name":"宋体",
"Size":120000,
"Bold":true,
"Charset":134
},
"TextAlign":"MiddleCenter",
"Text":"结存数"
},
{
"GroupTitle":false,
"Column":"发药人",
"Font":{
"Name":"宋体",
"Size":120000,
"Bold":true,
"Charset":134
},
"TextAlign":"MiddleCenter",
"Text":"发药人"
},
{
"GroupTitle":true,
"Name":"Column5",
"ColumnTitleCell":[
{
"GroupTitle":false,
"Column":"Column2",
"Font":{
"Name":"宋体",
"Size":120000,
"Bold":true,
"Charset":134
},
"TextAlign":"MiddleCenter",
"Text":"复核人"
}
],
"Font":{
"Name":"宋体",
"Size":120000,
"Bold":true,
"Charset":134
},
"TextAlign":"MiddleCenter",
"Text":"领药人"
},
{
"GroupTitle":false,
"Column":"Column8",
"Font":{
"Name":"宋体",
"Size":120000,
"Bold":true,
"Charset":134
},
"TextAlign":"MiddleCenter",
"Text":"批次\r\n库存"
}
]
}
},
"PageHeader":{
"Height":0
},
"Parameter":[
{
"Name":"startDate",
"DataType":"DateTime",
"Format":"yyyy-MM-dd hh:mm:ss",
"Value":"2023/1/1"
},
{
"Name":"endDate",
"DataType":"DateTime",
"Format":"yyyy-MM-dd hh:mm:ss",
"Value":"2023/4/28 23:59:59"
},
{
"Name":"machine_id",
"Value":"DM1"
}
],
"ReportHeader":[
{
"Name":"ReportHeader1",
"Height":1.5875,
"Control":[
{
"Type":"MemoBox",
"Name":"MemoBox2",
"Dock":"Fill",
"Font":{
"Name":"宋体",
"Size":217500,
"Bold":true,
"Charset":134
},
"TextAlign":"MiddleCenter",
"Text":"湘谭县人民医院麻醉药品、精神药品专用账册、使用登记册(手术室)"
}
],
"RepeatOnPage":true
},
{
"Name":"ReportHeader2",
"Height":1.00542,
"Control":[
{
"Type":"MemoBox",
"Name":"MemoBox3",
"Dock":"Fill",
"Border":{
"Styles":"[DrawLeft|DrawTop|DrawRight]"
},
"Font":{
"Name":"宋体",
"Size":120000,
"Bold":true,
"Charset":134
},
"Text":"药品名称:[#药品名称#] 规格:[#规格#] 单位:[#大单位#] 基数:[#基数#]"
}
],
"RepeatOnPage":true
}
]
}

View File

@ -0,0 +1,618 @@
{
"Version":"6.8.1.1",
"Font":{
"Name":"宋体",
"Size":105000,
"Weight":400,
"Charset":134
},
"Printer":{
"Oriention":"Landscape",
"LeftMargin":1,
"TopMargin":1.42875,
"RightMargin":1,
"BottomMargin":1.8
},
"DetailGrid":{
"CenterView":true,
"AppendBlankRow":true,
"Recordset":{
"Field":[
{
"Name":"日期",
"Type":"DateTime",
"Format":"M/d",
"DBFieldName":"operationTime"
},
{
"Name":"操作类型",
"DBFieldName":"type"
},
{
"Name":"批号",
"DBFieldName":"manuNo"
},
{
"Name":"上次批次结存",
"Type":"Integer",
"DBFieldName":"beforeManuQuan"
},
{
"Name":"入库数量",
"Type":"Integer",
"DBFieldName":"inQuantity"
},
{
"Name":"出库数量",
"Type":"Integer",
"DBFieldName":"outQuantity"
},
{
"Name":"批号结存",
"Type":"Integer",
"DBFieldName":"manuQuantity"
},
{
"Name":"总结存",
"Type":"Integer",
"DBFieldName":"stockQuantity"
},
{
"Name":"收/发药人",
"DBFieldName":"operatorName"
},
{
"Name":"复核人",
"DBFieldName":"reviewerName"
},
{
"Name":"药品名称",
"DBFieldName":"drugName"
},
{
"Name":"规格",
"DBFieldName":"drugSpec"
},
{
"Name":"单位",
"DBFieldName":"bigUnit"
},
{
"Name":"剂型",
"DBFieldName":"dosage"
},
{
"Name":"厂家",
"DBFieldName":"manuFactory"
},
{
"Name":"有效期",
"Type":"DateTime",
"Format":"yy/M/d",
"DBFieldName":"effDate"
},
{
"Name":"sign1",
"Type":"Binary"
},
{
"Name":"sign2",
"Type":"Binary"
},
{
"Name":"drugId",
"DBFieldName":"drug_Id"
},
{
"Name":"凭证号",
"DBFieldName":"invoiceId"
},
{
"Name":"供应单位",
"DBFieldName":"supplierDept"
},
{
"Name":"领用部门",
"DBFieldName":"receiveDept"
}
]
},
"Column":[
{
"Name":"日期",
"Width":1.77271
},
{
"Name":"凭证号",
"Width":2.19604
},
{
"Name":"批号",
"Width":3.99521
},
{
"Name":"有效期",
"Width":2.43417
},
{
"Name":"入库数量",
"Width":1.79917
},
{
"Name":"出库数量",
"Width":1.79917
},
{
"Name":"Column4",
"Width":1.98438
},
{
"Name":"收/发药人",
"Width":2.80458
},
{
"Name":"复核人",
"Width":2.80458
},
{
"Name":"Column2",
"Width":2.35479
},
{
"Name":"Column3",
"Width":2.38125
}
],
"ColumnContent":{
"Height":0.85,
"ColumnContentCell":[
{
"Column":"日期",
"WordWrap":true,
"TextAlign":"MiddleCenter",
"ShrinkFontToFit":true,
"DataField":"日期"
},
{
"Column":"凭证号",
"DataField":"凭证号"
},
{
"Column":"批号",
"TextAlign":"MiddleCenter",
"DataField":"批号"
},
{
"Column":"有效期",
"TextAlign":"MiddleCenter",
"DataField":"有效期"
},
{
"Column":"入库数量",
"TextAlign":"MiddleCenter",
"DataField":"入库数量"
},
{
"Column":"出库数量",
"TextAlign":"MiddleCenter",
"DataField":"出库数量"
},
{
"Column":"Column4",
"TextAlign":"MiddleCenter",
"DataField":"总结存"
},
{
"Column":"收/发药人",
"FreeCell":true,
"Control":[
{
"Type":"FieldBox",
"Name":"FieldBox12",
"Dock":"Fill",
"TextAlign":"MiddleCenter",
"DataField":"收/发药人"
}
]
},
{
"Column":"复核人",
"FreeCell":true,
"Control":[
{
"Type":"FieldBox",
"Name":"FieldBox13",
"Dock":"Fill",
"TextAlign":"MiddleCenter",
"DataField":"复核人"
}
]
},
{
"Column":"Column2",
"FreeCell":true,
"Control":[
{
"Type":"FieldBox",
"Name":"FieldBox14",
"Dock":"Fill",
"TextAlign":"MiddleCenter",
"DataField":"供应单位"
}
]
},
{
"Column":"Column3",
"FreeCell":true,
"Control":[
{
"Type":"FieldBox",
"Name":"FieldBox15",
"Dock":"Fill",
"TextAlign":"MiddleCenter",
"DataField":"领用部门"
}
]
}
]
},
"ColumnTitle":{
"Height":1.19063,
"RepeatStyle":"OnGroupHeaderPage",
"ColumnTitleCell":[
{
"GroupTitle":false,
"Column":"日期",
"Font":{
"Name":"宋体",
"Size":105000,
"Bold":true,
"Charset":134
},
"TextAlign":"MiddleCenter",
"Text":"日期"
},
{
"GroupTitle":false,
"Column":"凭证号",
"Font":{
"Name":"宋体",
"Size":105000,
"Bold":true,
"Charset":134
},
"TextAlign":"MiddleCenter",
"Text":"凭证号"
},
{
"GroupTitle":false,
"Column":"批号",
"Font":{
"Name":"宋体",
"Size":105000,
"Bold":true,
"Charset":134
},
"TextAlign":"MiddleCenter",
"Text":"批号"
},
{
"GroupTitle":false,
"Column":"有效期",
"Font":{
"Name":"宋体",
"Size":105000,
"Bold":true,
"Charset":134
},
"TextAlign":"MiddleCenter",
"Text":"有效\r\n期"
},
{
"GroupTitle":false,
"Column":"入库数量",
"Font":{
"Name":"宋体",
"Size":105000,
"Bold":true,
"Charset":134
},
"TextAlign":"MiddleCenter",
"Text":"借入\r\n数量"
},
{
"GroupTitle":false,
"Column":"出库数量",
"Font":{
"Name":"宋体",
"Size":105000,
"Bold":true,
"Charset":134
},
"TextAlign":"MiddleCenter",
"Text":"发出\r\n数量"
},
{
"GroupTitle":false,
"Column":"Column4",
"Font":{
"Name":"宋体",
"Size":105000,
"Bold":true,
"Charset":134
},
"TextAlign":"MiddleCenter",
"Text":"总结存"
},
{
"GroupTitle":false,
"Column":"收/发药人",
"Font":{
"Name":"宋体",
"Size":105000,
"Bold":true,
"Charset":134
},
"TextAlign":"MiddleCenter",
"Text":"发药人"
},
{
"GroupTitle":false,
"Column":"复核人",
"Font":{
"Name":"宋体",
"Size":105000,
"Bold":true,
"Charset":134
},
"TextAlign":"MiddleCenter",
"Text":"复核人"
},
{
"GroupTitle":false,
"Column":"Column2",
"Font":{
"Name":"宋体",
"Size":105000,
"Bold":true,
"Charset":134
},
"TextAlign":"MiddleCenter",
"Text":"供应单位"
},
{
"GroupTitle":false,
"Column":"Column3",
"Font":{
"Name":"宋体",
"Size":105000,
"Bold":true,
"Charset":134
},
"TextAlign":"MiddleCenter",
"Text":"领用部门"
}
]
},
"Group":[
{
"Name":"Group1",
"ByFields":"drugId",
"GroupHeader":{
"NewPage":"Before",
"PrintGridBorder":false,
"RepeatOnPage":true,
"Control":[
{
"Type":"StaticBox",
"Name":"StaticBox15",
"Left":28.3898,
"Top":0.238125,
"Width":2.01083,
"Height":0.79375,
"Text":"生产厂家:"
},
{
"Type":"MemoBox",
"Name":"MemoBox11",
"Left":30.3742,
"Top":0.211667,
"Width":5.3975,
"Height":0.79375,
"Text":"[#manuFactory#]"
},
{
"Type":"StaticBox",
"Name":"StaticBox16",
"Top":0.0529167,
"Width":1.19063,
"Height":0.978958,
"Font":{
"Name":"宋体",
"Size":105000,
"Bold":true,
"Charset":134
},
"Text":"品名:"
},
{
"Type":"FieldBox",
"Name":"FieldBox7",
"Left":1.16417,
"Top":0.0529167,
"Width":5.63563,
"Height":0.978958,
"Font":{
"Name":"宋体",
"Size":105000,
"Bold":true,
"Charset":134
},
"DataField":"药品名称"
},
{
"Type":"StaticBox",
"Name":"StaticBox17",
"Left":6.93208,
"Top":0.0529167,
"Width":1.11125,
"Height":0.978958,
"Font":{
"Name":"宋体",
"Size":105000,
"Bold":true,
"Charset":134
},
"Text":"规格:"
},
{
"Type":"FieldBox",
"Name":"FieldBox8",
"Left":8.01688,
"Top":0.0529167,
"Width":3.175,
"Height":0.978958,
"Font":{
"Name":"宋体",
"Size":105000,
"Bold":true,
"Charset":134
},
"DataField":"规格"
},
{
"Type":"StaticBox",
"Name":"StaticBox18",
"Left":11.5888,
"Top":0.0529167,
"Width":1.21708,
"Height":0.978958,
"Font":{
"Name":"宋体",
"Size":105000,
"Bold":true,
"Charset":134
},
"Text":"单位:"
},
{
"Type":"FieldBox",
"Name":"FieldBox9",
"Left":12.7794,
"Top":0.0529167,
"Width":1.87854,
"Height":0.978958,
"Font":{
"Name":"宋体",
"Size":105000,
"Bold":true,
"Charset":134
},
"DataField":"单位"
},
{
"Type":"StaticBox",
"Name":"StaticBox19",
"Left":15.3988,
"Top":0.0529167,
"Width":1.16417,
"Height":0.978958,
"Font":{
"Name":"宋体",
"Size":105000,
"Bold":true,
"Charset":134
},
"Text":"剂型:"
},
{
"Type":"FieldBox",
"Name":"FieldBox10",
"Left":16.5365,
"Top":0.0529167,
"Width":2.83104,
"Height":0.978958,
"Font":{
"Name":"宋体",
"Size":105000,
"Bold":true,
"Charset":134
},
"DataField":"剂型"
},
{
"Type":"StaticBox",
"Name":"StaticBox20",
"Left":19.7379,
"Top":0.0529167,
"Width":2.01083,
"Height":0.978958,
"Font":{
"Name":"宋体",
"Size":105000,
"Bold":true,
"Charset":134
},
"Text":"生产厂家:"
},
{
"Type":"FieldBox",
"Name":"FieldBox11",
"Left":21.7223,
"Top":0.05,
"Width":5.92667,
"Height":0.978958,
"Font":{
"Name":"宋体",
"Size":105000,
"Bold":true,
"Charset":134
},
"DataField":"厂家"
}
],
"NewPageColumn":"Before"
},
"GroupFooter":{
"Visible":false
}
}
]
},
"Parameter":[
{
"Name":"machine_id"
},
{
"Name":"startDate",
"DataType":"DateTime"
},
{
"Name":"endDate",
"DataType":"DateTime"
}
],
"ReportHeader":[
{
"Name":"ReportHeader1",
"Height":1.79917,
"Control":[
{
"Type":"MemoBox",
"Name":"MemoBox1",
"Dock":"Fill",
"Center":"Both",
"Font":{
"Name":"宋体",
"Size":262500,
"Bold":true,
"Charset":134
},
"TextAlign":"MiddleCenter",
"Text":"麻醉、精神药品逐笔专用账册"
}
],
"RepeatOnPage":true
}
]
}

View File

@ -0,0 +1,506 @@
{
"Version":"6.8.1.1",
"Font":{
"Name":"宋体",
"Size":105000,
"Weight":400,
"Charset":134
},
"Printer":{
"Oriention":"Landscape",
"LeftMargin":1,
"TopMargin":1.42875,
"RightMargin":1,
"BottomMargin":1.8
},
"DetailGrid":{
"CenterView":true,
"AppendBlankRow":true,
"Recordset":{
"Field":[
{
"Name":"日期",
"Type":"DateTime",
"Format":"M/d",
"DBFieldName":"OptDate"
},
{
"Name":"品名",
"DBFieldName":"DrugName"
},
{
"Name":"规格",
"DBFieldName":"DrugSpec"
},
{
"Name":"批号",
"DBFieldName":"ManuNo"
},
{
"Name":"床号",
"DBFieldName":"BedNum"
},
{
"Name":"病人姓名",
"DBFieldName":"PName"
},
{
"Name":"使用剂量",
"DBFieldName":"UDose"
},
{
"Name":"剩余剂量",
"DBFieldName":"ReDose"
},
{
"Name":"处理",
"DBFieldName":"Disposal"
},
{
"Name":"医师",
"DBFieldName":"AName"
},
{
"Name":"执行者",
"DBFieldName":"OName"
},
{
"Name":"核对者",
"DBFieldName":"CName"
},
{
"Name":"空安瓿批号",
"DBFieldName":"ManuNo"
},
{
"Name":"空安瓿回收者",
"DBFieldName":"EmpRecive"
},
{
"Name":"空安瓿药房接收者",
"DBFieldName":"EmpMedicRecive"
},
{
"Name":"手术间",
"DBFieldName":"WinNo"
},
{
"Name":"余液处置时间",
"DBFieldName":"DisposalTime"
},
{
"Name":"住院号",
"DBFieldName":"cardNo"
}
]
},
"Column":[
{
"Name":"日期",
"Width":1.77271
},
{
"Name":"品名",
"Width":3.41313
},
{
"Name":"规格",
"Width":2.35479
},
{
"Name":"批号",
"Width":2.83104
},
{
"Name":"手术间",
"Width":1.00542
},
{
"Name":"住院号",
"Width":2.35479
},
{
"Name":"病人姓名",
"Width":1.79917
},
{
"Name":"使用剂量",
"Width":1.79917
},
{
"Name":"剩余剂量",
"Width":1.98438
},
{
"Name":"余液处置时间",
"Width":3.22792
},
{
"Name":"处理",
"Width":2.35479
},
{
"Name":"医师",
"Width":1.79917
},
{
"Name":"执行者",
"Width":1.61396
},
{
"Name":"核对者",
"Width":1.5875
},
{
"Name":"空安瓿批号",
"Width":2.8575
},
{
"Name":"空安瓿回收者",
"Width":2.19604
},
{
"Name":"空安瓿药房接收者",
"Width":1.61396,
"Visible":false
}
],
"ColumnContent":{
"Height":0.85,
"ColumnContentCell":[
{
"Column":"日期",
"WordWrap":true,
"TextAlign":"MiddleCenter",
"ShrinkFontToFit":true,
"DataField":"日期"
},
{
"Column":"品名",
"TextAlign":"MiddleCenter",
"DataField":"品名"
},
{
"Column":"规格",
"TextAlign":"MiddleCenter",
"DataField":"规格"
},
{
"Column":"批号",
"TextAlign":"MiddleCenter",
"DataField":"批号"
},
{
"Column":"手术间",
"TextAlign":"MiddleCenter",
"DataField":"手术间"
},
{
"Column":"住院号",
"TextAlign":"MiddleCenter",
"DataField":"住院号"
},
{
"Column":"病人姓名",
"TextAlign":"MiddleCenter",
"DataField":"病人姓名"
},
{
"Column":"使用剂量",
"TextAlign":"MiddleCenter",
"DataField":"使用剂量"
},
{
"Column":"剩余剂量",
"TextAlign":"MiddleCenter",
"DataField":"剩余剂量"
},
{
"Column":"余液处置时间",
"DataField":"余液处置时间"
},
{
"Column":"处理",
"TextAlign":"MiddleCenter",
"DataField":"处理"
},
{
"Column":"医师",
"TextAlign":"MiddleCenter",
"DataField":"医师"
},
{
"Column":"执行者",
"TextAlign":"MiddleCenter",
"DataField":"执行者"
},
{
"Column":"核对者",
"TextAlign":"MiddleCenter",
"DataField":"核对者"
},
{
"Column":"空安瓿批号",
"TextAlign":"MiddleCenter",
"DataField":"批号"
},
{
"Column":"空安瓿回收者",
"TextAlign":"MiddleCenter",
"DataField":"空安瓿回收者"
},
{
"Column":"空安瓿药房接收者",
"TextAlign":"MiddleCenter",
"DataField":"空安瓿药房接收者"
}
]
},
"ColumnTitle":{
"Height":2.98979,
"RepeatStyle":"OnPage",
"ColumnTitleCell":[
{
"GroupTitle":false,
"Column":"日期",
"Font":{
"Name":"宋体",
"Size":105000,
"Bold":true,
"Charset":134
},
"TextAlign":"MiddleCenter",
"Text":"日期"
},
{
"GroupTitle":false,
"Column":"品名",
"Font":{
"Name":"宋体",
"Size":105000,
"Bold":true,
"Charset":134
},
"TextAlign":"MiddleCenter",
"Text":"品名"
},
{
"GroupTitle":false,
"Column":"规格",
"Font":{
"Name":"宋体",
"Size":105000,
"Bold":true,
"Charset":134
},
"TextAlign":"MiddleCenter",
"Text":"规格"
},
{
"GroupTitle":false,
"Column":"批号",
"Font":{
"Name":"宋体",
"Size":105000,
"Bold":true,
"Charset":134
},
"TextAlign":"MiddleCenter",
"Text":"批号"
},
{
"GroupTitle":false,
"Column":"手术间",
"Font":{
"Name":"宋体",
"Size":105000,
"Bold":true,
"Charset":134
},
"TextAlign":"MiddleCenter",
"Text":"手\r\n术\r\n间"
},
{
"GroupTitle":false,
"Column":"住院号",
"Font":{
"Name":"宋体",
"Size":105000,
"Bold":true,
"Charset":134
},
"TextAlign":"MiddleCenter",
"Text":"住院号"
},
{
"GroupTitle":false,
"Column":"病人姓名",
"Font":{
"Name":"宋体",
"Size":105000,
"Bold":true,
"Charset":134
},
"TextAlign":"MiddleCenter",
"Text":"病人\r\n姓名"
},
{
"GroupTitle":false,
"Column":"使用剂量",
"Font":{
"Name":"宋体",
"Size":105000,
"Bold":true,
"Charset":134
},
"TextAlign":"MiddleCenter",
"Text":"使用\r\n剂量"
},
{
"GroupTitle":false,
"Column":"剩余剂量",
"Font":{
"Name":"宋体",
"Size":105000,
"Bold":true,
"Charset":134
},
"TextAlign":"MiddleCenter",
"Text":"剩余\r\n剂量"
},
{
"GroupTitle":false,
"Column":"余液处置时间",
"Font":{
"Name":"宋体",
"Size":105000,
"Bold":true,
"Charset":134
},
"TextAlign":"MiddleCenter",
"Text":"余液处置\r\n时间"
},
{
"GroupTitle":false,
"Column":"处理",
"Font":{
"Name":"宋体",
"Size":105000,
"Bold":true,
"Charset":134
},
"TextAlign":"MiddleCenter",
"Text":"剩余剂量\r\n是否双人\r\n在监控下\r\n用棉球或\r\n敷料作介质\r\n稀释后\r\n作医疗\r\n废物处理"
},
{
"GroupTitle":false,
"Column":"医师",
"Font":{
"Name":"宋体",
"Size":105000,
"Bold":true,
"Charset":134
},
"TextAlign":"MiddleCenter",
"Text":"医师"
},
{
"GroupTitle":false,
"Column":"执行者",
"Font":{
"Name":"宋体",
"Size":105000,
"Bold":true,
"Charset":134
},
"TextAlign":"MiddleCenter",
"Text":"执行者"
},
{
"GroupTitle":false,
"Column":"核对者",
"Font":{
"Name":"宋体",
"Size":105000,
"Bold":true,
"Charset":134
},
"TextAlign":"MiddleCenter",
"Text":"核对者"
},
{
"GroupTitle":false,
"Column":"空安瓿批号",
"Font":{
"Name":"宋体",
"Size":105000,
"Bold":true,
"Charset":134
},
"TextAlign":"MiddleCenter",
"Text":"空安瓿\r\n批号"
},
{
"GroupTitle":false,
"Column":"空安瓿回收者",
"Font":{
"Name":"宋体",
"Size":105000,
"Bold":true,
"Charset":134
},
"TextAlign":"MiddleCenter",
"Text":"空安瓿\r\n回收者"
},
{
"GroupTitle":false,
"Column":"空安瓿药房接收者",
"Font":{
"Name":"宋体",
"Size":105000,
"Bold":true,
"Charset":134
},
"TextAlign":"MiddleCenter",
"Text":"空安瓿\r\n药房\r\n接收者"
}
]
}
},
"Parameter":[
{
"Name":"machine_id"
},
{
"Name":"startDate",
"DataType":"DateTime"
},
{
"Name":"endDate",
"DataType":"DateTime"
}
],
"ReportHeader":[
{
"Name":"ReportHeader1",
"Height":1.79917,
"Control":[
{
"Type":"MemoBox",
"Name":"MemoBox1",
"Dock":"Fill",
"Center":"Both",
"Font":{
"Name":"宋体",
"Size":262500,
"Bold":true,
"Charset":134
},
"TextAlign":"MiddleCenter",
"Text":"麻醉药品、精神药品使用登记册"
}
],
"RepeatOnPage":true
}
]
}

View File

@ -0,0 +1,345 @@
{
"Version":"6.3.0.1",
"Font":{
"Name":"宋体",
"Size":105000,
"Weight":400,
"Charset":134
},
"Printer":{
"Oriention":"Landscape",
"LeftMargin":1,
"TopMargin":1.4287,
"RightMargin":1,
"BottomMargin":1.8
},
"DetailGrid":{
"CenterView":true,
"Recordset":{
"Field":[
{
"Name":"日期",
"Type":"DateTime",
"Format":"yyyy/MM/dd",
"DBFieldName":"opt_date"
},
{
"Name":"品名",
"DBFieldName":"drug_name"
},
{
"Name":"规格",
"DBFieldName":"drug_spec"
},
{
"Name":"上班结存数",
"Type":"Integer",
"DBFieldName":"beforenum"
},
{
"Name":"领用数",
"Type":"Integer",
"DBFieldName":"getnum"
},
{
"Name":"消耗数",
"Type":"Integer",
"DBFieldName":"usenum"
},
{
"Name":"批号",
"DBFieldName":"manu_no"
},
{
"Name":"余",
"Type":"Integer",
"DBFieldName":"surplus"
},
{
"Name":"交班人",
"DBFieldName":"fromoperator"
},
{
"Name":"接班人",
"DBFieldName":"tooperator"
}
]
},
"Column":[
{
"Name":"日期",
"Width":2.56646
},
{
"Name":"品名",
"Width":4.60375
},
{
"Name":"规格",
"Width":2.59292
},
{
"Name":"上班结存数",
"Width":1.4
},
{
"Name":"领用数",
"Width":1.4
},
{
"Name":"消耗数",
"Width":1.4
},
{
"Name":"批号",
"Width":1.98438
},
{
"Name":"余",
"Width":0.608542
},
{
"Name":"交班人",
"Width":2.80458
},
{
"Name":"接班人",
"Width":2.35479
}
],
"ColumnContent":{
"Height":0.85,
"ColumnContentCell":[
{
"Column":"日期",
"TextAlign":"MiddleCenter",
"DataField":"日期"
},
{
"Column":"品名",
"DataField":"品名"
},
{
"Column":"规格",
"TextAlign":"MiddleCenter",
"DataField":"规格"
},
{
"Column":"上班结存数",
"TextAlign":"MiddleCenter",
"DataField":"上班结存数"
},
{
"Column":"领用数",
"TextAlign":"MiddleCenter",
"DataField":"领用数"
},
{
"Column":"消耗数",
"TextAlign":"MiddleCenter",
"DataField":"消耗数"
},
{
"Column":"批号",
"TextAlign":"MiddleCenter",
"DataField":"批号"
},
{
"Column":"余",
"TextAlign":"MiddleCenter",
"DataField":"余"
},
{
"Column":"交班人",
"TextAlign":"MiddleCenter",
"DataField":"交班人"
},
{
"Column":"接班人",
"TextAlign":"MiddleCenter",
"DataField":"接班人"
}
]
},
"ColumnTitle":{
"Height":1.00542,
"RepeatStyle":"OnPage",
"ColumnTitleCell":[
{
"GroupTitle":false,
"Column":"日期",
"Font":{
"Name":"宋体",
"Size":105000,
"Bold":true,
"Charset":134
},
"TextAlign":"MiddleCenter",
"Text":"日期"
},
{
"GroupTitle":false,
"Column":"品名",
"Font":{
"Name":"宋体",
"Size":105000,
"Bold":true,
"Charset":134
},
"TextAlign":"MiddleCenter",
"Text":"品名"
},
{
"GroupTitle":false,
"Column":"规格",
"Font":{
"Name":"宋体",
"Size":105000,
"Bold":true,
"Charset":134
},
"TextAlign":"MiddleCenter",
"Text":"规格"
},
{
"GroupTitle":false,
"Column":"上班结存数",
"Font":{
"Name":"宋体",
"Size":105000,
"Bold":true,
"Charset":134
},
"WordWrap":true,
"TextAlign":"MiddleCenter",
"Text":"上班\r\n结存数"
},
{
"GroupTitle":false,
"Column":"领用数",
"Font":{
"Name":"宋体",
"Size":105000,
"Bold":true,
"Charset":134
},
"WordWrap":true,
"TextAlign":"MiddleCenter",
"Text":"领用数"
},
{
"GroupTitle":false,
"Column":"消耗数",
"Font":{
"Name":"宋体",
"Size":105000,
"Bold":true,
"Charset":134
},
"WordWrap":true,
"TextAlign":"MiddleCenter",
"Text":"消耗数"
},
{
"GroupTitle":false,
"Column":"批号",
"Font":{
"Name":"宋体",
"Size":105000,
"Bold":true,
"Charset":134
},
"TextAlign":"MiddleCenter",
"Text":"批号"
},
{
"GroupTitle":false,
"Column":"余",
"Font":{
"Name":"宋体",
"Size":105000,
"Bold":true,
"Charset":134
},
"TextAlign":"MiddleCenter",
"Text":"余"
},
{
"GroupTitle":false,
"Column":"交班人",
"Font":{
"Name":"宋体",
"Size":105000,
"Bold":true,
"Charset":134
},
"TextAlign":"MiddleCenter",
"Text":"交班人"
},
{
"GroupTitle":false,
"Column":"接班人",
"Font":{
"Name":"宋体",
"Size":105000,
"Bold":true,
"Charset":134
},
"TextAlign":"MiddleCenter",
"Text":"接班人"
}
]
},
"Group":[
{
"Name":"Group1",
"ByFields":"日期",
"GroupHeader":{
"Height":0,
"PrintGridBorder":false,
"NewPageColumn":"Before"
},
"GroupFooter":{
"Visible":false,
"PrintGridBorder":false
}
}
]
},
"Parameter":[
{
"Name":"machine_id"
},
{
"Name":"startDate",
"DataType":"DateTime"
},
{
"Name":"endDate",
"DataType":"DateTime"
}
],
"ReportHeader":[
{
"Name":"ReportHeader1",
"Height":1.79917,
"Control":[
{
"Type":"MemoBox",
"Name":"MemoBox1",
"Dock":"Fill",
"Center":"Both",
"Font":{
"Name":"宋体",
"Size":262500,
"Bold":true,
"Charset":134
},
"TextAlign":"MiddleCenter",
"Text":"交接班记录"
}
],
"RepeatOnPage":true
}
]
}

View File

@ -0,0 +1,283 @@
{
"Version":"6.3.0.1",
"Font":{
"Name":"宋体",
"Size":105000,
"Weight":400,
"Charset":134
},
"Printer":{
"LeftMargin":0.3175,
"TopMargin":0.899583,
"RightMargin":0.396875
},
"DetailGrid":{
"CenterView":true,
"AppendBlankRow":true,
"Recordset":{
"QuerySQL":"SELECT \r\n dmr.`drawer_no` AS drawerNo,\r\n dmr.`col_no` AS colNo,\r\n dmr.`type` AS `type`,\r\n dmr.`quantity` AS quantity,\r\n dmr.`manu_no` AS manuNo,\r\n dmr.`eff_date` AS effDate,\r\n dmr.`operation_time` AS operationTime,\r\n di.`drug_name` AS drugName,\r\n di.`drug_spec` AS drugSpec,\r\n di.`pack_unit` AS packUnit,\r\n di.`manufactory` AS manuFactory,\r\n di.`max_stock` AS baseQuantity,\r\n dmr.`drug_id` AS drugId,\r\n ul.`user_name` AS nickname\r\nFROM\r\n dm_machine_record dmr\r\nLEFT JOIN drug_info di ON di.`drug_id` = dmr.`drug_id`\r\nLEFT JOIN user_list ul ON ul.`id` = dmr.`Operator`\r\nWHERE dmr.`type` = 1 \r\n AND dmr.`machine_id` = :machine_id\r\n AND dmr.`operation_time` > :startDate\r\n AND dmr.`operation_time` < :endDate",
"Field":[
{
"Name":"操作人",
"DBFieldName":"Nickname"
},
{
"Name":"时间",
"Type":"DateTime",
"Format":"yyyy/MM/dd HH:mm:ss",
"DBFieldName":"operationTime"
},
{
"Name":"药品名称",
"DBFieldName":"DrugName"
},
{
"Name":"数量",
"DBFieldName":"quantity"
},
{
"Name":"批次",
"DBFieldName":"manuNo"
},
{
"Name":"效期",
"Type":"DateTime",
"Format":"yyyy/MM/dd",
"DBFieldName":"effDate"
},
{
"Name":"库位",
"DBFieldName":"drawerNo"
},
{
"Name":"colNo"
},
{
"Name":"type2",
"Type":"Integer",
"DBFieldName":"type"
}
]
},
"Column":[
{
"Name":"操作人",
"Width":2.38125
},
{
"Name":"时间",
"Width":3.78354
},
{
"Name":"药品名称",
"Width":4.63021
},
{
"Name":"数量",
"Width":1.98438
},
{
"Name":"批次",
"Width":2.61938
},
{
"Name":"效期",
"Width":2.38125
},
{
"Name":"库位",
"Width":2.59292
}
],
"ColumnContent":{
"Height":1.00542,
"ColumnContentCell":[
{
"Column":"操作人",
"TextAlign":"MiddleCenter",
"DataField":"操作人"
},
{
"Column":"时间",
"TextAlign":"MiddleCenter",
"DataField":"时间"
},
{
"Column":"药品名称",
"TextAlign":"MiddleCenter",
"DataField":"药品名称"
},
{
"Column":"数量",
"TextAlign":"MiddleCenter",
"DataField":"数量"
},
{
"Column":"批次",
"TextAlign":"MiddleCenter",
"DataField":"批次"
},
{
"Column":"效期",
"TextAlign":"MiddleCenter",
"DataField":"效期"
},
{
"Column":"库位",
"FreeCell":true,
"Control":[
{
"Type":"FieldBox",
"Name":"FieldBox1",
"Left":9.60438,
"Top":-2.16958,
"Width":2.80458,
"Height":0.661458
},
{
"Type":"MemoBox",
"Name":"MemoBox1",
"Dock":"Fill",
"Center":"Both",
"TextAlign":"MiddleCenter",
"Text":"[#库位#] - [#colNo#]"
}
]
}
]
},
"ColumnTitle":{
"Height":1.40229,
"RepeatStyle":"OnPage",
"ColumnTitleCell":[
{
"GroupTitle":false,
"Column":"操作人",
"Font":{
"Name":"宋体",
"Size":120000,
"Bold":true,
"Charset":134
},
"TextAlign":"MiddleCenter",
"Text":"操作人"
},
{
"GroupTitle":false,
"Column":"时间",
"Font":{
"Name":"宋体",
"Size":120000,
"Bold":true,
"Charset":134
},
"TextAlign":"MiddleCenter",
"Text":"时间"
},
{
"GroupTitle":false,
"Column":"药品名称",
"Font":{
"Name":"宋体",
"Size":120000,
"Bold":true,
"Charset":134
},
"TextAlign":"MiddleCenter",
"Text":"药品名称"
},
{
"GroupTitle":false,
"Column":"数量",
"Font":{
"Name":"宋体",
"Size":120000,
"Bold":true,
"Charset":134
},
"TextAlign":"MiddleCenter",
"Text":"数量"
},
{
"GroupTitle":false,
"Column":"批次",
"Font":{
"Name":"宋体",
"Size":120000,
"Bold":true,
"Charset":134
},
"TextAlign":"MiddleCenter",
"Text":"批次"
},
{
"GroupTitle":false,
"Column":"效期",
"Font":{
"Name":"宋体",
"Size":120000,
"Bold":true,
"Charset":134
},
"TextAlign":"MiddleCenter",
"Text":"效期"
},
{
"GroupTitle":false,
"Column":"库位",
"Font":{
"Name":"宋体",
"Size":120000,
"Bold":true,
"Charset":134
},
"TextAlign":"MiddleCenter",
"Text":"库位"
}
]
}
},
"Parameter":[
{
"Name":"startDate",
"DataType":"DateTime",
"Format":"yyyy-MM-dd hh:mm:ss",
"Value":"2023/1/1"
},
{
"Name":"endDate",
"DataType":"DateTime",
"Format":"yyyy-MM-dd hh:mm:ss",
"Value":"2023/4/28 23:59:59"
},
{
"Name":"machine_id",
"Value":"DM1"
}
],
"ReportHeader":[
{
"Name":"ReportHeader1",
"Height":1.79917,
"Control":[
{
"Type":"MemoBox",
"Name":"MemoBox2",
"Left":7.59354,
"Top":0.211667,
"Width":5.60917,
"Height":1.19063,
"Font":{
"Name":"宋体",
"Size":217500,
"Bold":true,
"Charset":134
},
"TextAlign":"MiddleCenter",
"Text":"入库记录"
}
],
"RepeatOnPage":true
}
]
}

View File

@ -0,0 +1,283 @@
{
"Version":"6.3.0.1",
"Font":{
"Name":"宋体",
"Size":105000,
"Weight":400,
"Charset":134
},
"Printer":{
"LeftMargin":0.3175,
"TopMargin":0.899583,
"RightMargin":0.396875
},
"DetailGrid":{
"CenterView":true,
"AppendBlankRow":true,
"Recordset":{
"QuerySQL":"SELECT \r\n dmr.`drawer_no` AS drawerNo,\r\n dmr.`col_no` AS colNo,\r\n dmr.`type` AS `type`,\r\n dmr.`quantity` AS quantity,\r\n dmr.`manu_no` AS manuNo,\r\n dmr.`eff_date` AS effDate,\r\n dmr.`operation_time` AS operationTime,\r\n di.`drug_name` AS drugName,\r\n di.`drug_spec` AS drugSpec,\r\n di.`pack_unit` AS packUnit,\r\n di.`manufactory` AS manuFactory,\r\n di.`max_stock` AS baseQuantity,\r\n dmr.`drug_id` AS drugId,\r\n ul.`user_name` AS nickname\r\nFROM\r\n dm_machine_record dmr\r\nLEFT JOIN drug_info di ON di.`drug_id` = dmr.`drug_id`\r\nLEFT JOIN user_list ul ON ul.`id` = dmr.`Operator`\r\nWHERE dmr.`type` = 4 \r\n AND dmr.`machine_id` = :machine_id\r\n AND dmr.`operation_time` > :startDate\r\n AND dmr.`operation_time` < :endDate",
"Field":[
{
"Name":"操作人",
"DBFieldName":"Nickname"
},
{
"Name":"时间",
"Type":"DateTime",
"Format":"yyyy/MM/dd HH:mm:ss",
"DBFieldName":"operationTime"
},
{
"Name":"药品名称",
"DBFieldName":"DrugName"
},
{
"Name":"数量",
"DBFieldName":"quantity"
},
{
"Name":"批次",
"DBFieldName":"manuNo"
},
{
"Name":"效期",
"Type":"DateTime",
"Format":"yyyy/MM/dd",
"DBFieldName":"effDate"
},
{
"Name":"库位",
"DBFieldName":"drawerNo"
},
{
"Name":"colNo"
},
{
"Name":"type2",
"Type":"Integer",
"DBFieldName":"type"
}
]
},
"Column":[
{
"Name":"操作人",
"Width":2.38125
},
{
"Name":"时间",
"Width":3.78354
},
{
"Name":"药品名称",
"Width":4.63021
},
{
"Name":"数量",
"Width":1.98438
},
{
"Name":"批次",
"Width":2.61938
},
{
"Name":"效期",
"Width":2.38125
},
{
"Name":"库位",
"Width":2.59292
}
],
"ColumnContent":{
"Height":1.00542,
"ColumnContentCell":[
{
"Column":"操作人",
"TextAlign":"MiddleCenter",
"DataField":"操作人"
},
{
"Column":"时间",
"TextAlign":"MiddleCenter",
"DataField":"时间"
},
{
"Column":"药品名称",
"TextAlign":"MiddleCenter",
"DataField":"药品名称"
},
{
"Column":"数量",
"TextAlign":"MiddleCenter",
"DataField":"数量"
},
{
"Column":"批次",
"TextAlign":"MiddleCenter",
"DataField":"批次"
},
{
"Column":"效期",
"TextAlign":"MiddleCenter",
"DataField":"效期"
},
{
"Column":"库位",
"FreeCell":true,
"Control":[
{
"Type":"FieldBox",
"Name":"FieldBox1",
"Left":9.60438,
"Top":-2.16958,
"Width":2.80458,
"Height":0.661458
},
{
"Type":"MemoBox",
"Name":"MemoBox1",
"Dock":"Fill",
"Center":"Both",
"TextAlign":"MiddleCenter",
"Text":"[#库位#] - [#colNo#]"
}
]
}
]
},
"ColumnTitle":{
"Height":1.40229,
"RepeatStyle":"OnPage",
"ColumnTitleCell":[
{
"GroupTitle":false,
"Column":"操作人",
"Font":{
"Name":"宋体",
"Size":120000,
"Bold":true,
"Charset":134
},
"TextAlign":"MiddleCenter",
"Text":"操作人"
},
{
"GroupTitle":false,
"Column":"时间",
"Font":{
"Name":"宋体",
"Size":120000,
"Bold":true,
"Charset":134
},
"TextAlign":"MiddleCenter",
"Text":"时间"
},
{
"GroupTitle":false,
"Column":"药品名称",
"Font":{
"Name":"宋体",
"Size":120000,
"Bold":true,
"Charset":134
},
"TextAlign":"MiddleCenter",
"Text":"药品名称"
},
{
"GroupTitle":false,
"Column":"数量",
"Font":{
"Name":"宋体",
"Size":120000,
"Bold":true,
"Charset":134
},
"TextAlign":"MiddleCenter",
"Text":"数量"
},
{
"GroupTitle":false,
"Column":"批次",
"Font":{
"Name":"宋体",
"Size":120000,
"Bold":true,
"Charset":134
},
"TextAlign":"MiddleCenter",
"Text":"批次"
},
{
"GroupTitle":false,
"Column":"效期",
"Font":{
"Name":"宋体",
"Size":120000,
"Bold":true,
"Charset":134
},
"TextAlign":"MiddleCenter",
"Text":"效期"
},
{
"GroupTitle":false,
"Column":"库位",
"Font":{
"Name":"宋体",
"Size":120000,
"Bold":true,
"Charset":134
},
"TextAlign":"MiddleCenter",
"Text":"库位"
}
]
}
},
"Parameter":[
{
"Name":"startDate",
"DataType":"DateTime",
"Format":"yyyy-MM-dd hh:mm:ss",
"Value":"2023/1/1"
},
{
"Name":"endDate",
"DataType":"DateTime",
"Format":"yyyy-MM-dd hh:mm:ss",
"Value":"2023/4/28 23:59:59"
},
{
"Name":"machine_id",
"Value":"DM1"
}
],
"ReportHeader":[
{
"Name":"ReportHeader1",
"Height":1.79917,
"Control":[
{
"Type":"MemoBox",
"Name":"MemoBox2",
"Left":7.59354,
"Top":0.211667,
"Width":5.60917,
"Height":1.19063,
"Font":{
"Name":"宋体",
"Size":217500,
"Bold":true,
"Charset":134
},
"TextAlign":"MiddleCenter",
"Text":"盘点记录"
}
],
"RepeatOnPage":true
}
]
}

View File

@ -0,0 +1,283 @@
{
"Version":"6.3.0.1",
"Font":{
"Name":"宋体",
"Size":105000,
"Weight":400,
"Charset":134
},
"Printer":{
"LeftMargin":0.3175,
"TopMargin":0.899583,
"RightMargin":0.396875
},
"DetailGrid":{
"CenterView":true,
"AppendBlankRow":true,
"Recordset":{
"QuerySQL":"SELECT \r\n dmr.`drawer_no` AS drawerNo,\r\n dmr.`col_no` AS colNo,\r\n dmr.`type` AS `type`,\r\n CONCAT(dmr.`quantity`,IF(dmr.`type`=32,\"(空瓶)\",\"\")) AS quantity,\r\n dmr.`manu_no` AS manuNo,\r\n dmr.`eff_date` AS effDate,\r\n dmr.`operation_time` AS operationTime,\r\n di.`drug_name` AS drugName,\r\n di.`drug_spec` AS drugSpec,\r\n di.`pack_unit` AS packUnit,\r\n di.`manufactory` AS manuFactory,\r\n di.`max_stock` AS baseQuantity,\r\n dmr.`drug_id` AS drugId,\r\n ul.`user_name` AS nickname\r\nFROM\r\n dm_machine_record dmr\r\nLEFT JOIN drug_info di ON di.`drug_id` = dmr.`drug_id`\r\nLEFT JOIN user_list ul ON ul.`id` = dmr.`Operator`\r\nWHERE dmr.`type` in (31, 32)\r\n AND dmr.`machine_id` = :machine_id\r\n AND dmr.`operation_time` > :startDate\r\n AND dmr.`operation_time` < :endDate",
"Field":[
{
"Name":"操作人",
"DBFieldName":"Nickname"
},
{
"Name":"时间",
"Type":"DateTime",
"Format":"yyyy/MM/dd HH:mm:ss",
"DBFieldName":"operationTime"
},
{
"Name":"药品名称",
"DBFieldName":"DrugName"
},
{
"Name":"数量",
"DBFieldName":"quantity"
},
{
"Name":"批次",
"DBFieldName":"manuNo"
},
{
"Name":"效期",
"Type":"DateTime",
"Format":"yyyy/MM/dd",
"DBFieldName":"effDate"
},
{
"Name":"库位",
"DBFieldName":"drawerNo"
},
{
"Name":"colNo"
},
{
"Name":"type2",
"Type":"Integer",
"DBFieldName":"type"
}
]
},
"Column":[
{
"Name":"操作人",
"Width":2.38125
},
{
"Name":"时间",
"Width":3.78354
},
{
"Name":"药品名称",
"Width":4.63021
},
{
"Name":"数量",
"Width":1.98438
},
{
"Name":"批次",
"Width":2.61938
},
{
"Name":"效期",
"Width":2.38125
},
{
"Name":"库位",
"Width":2.59292
}
],
"ColumnContent":{
"Height":1.00542,
"ColumnContentCell":[
{
"Column":"操作人",
"TextAlign":"MiddleCenter",
"DataField":"操作人"
},
{
"Column":"时间",
"TextAlign":"MiddleCenter",
"DataField":"时间"
},
{
"Column":"药品名称",
"TextAlign":"MiddleCenter",
"DataField":"药品名称"
},
{
"Column":"数量",
"TextAlign":"MiddleCenter",
"DataField":"数量"
},
{
"Column":"批次",
"TextAlign":"MiddleCenter",
"DataField":"批次"
},
{
"Column":"效期",
"TextAlign":"MiddleCenter",
"DataField":"效期"
},
{
"Column":"库位",
"FreeCell":true,
"Control":[
{
"Type":"FieldBox",
"Name":"FieldBox1",
"Left":9.60438,
"Top":-2.16958,
"Width":2.80458,
"Height":0.661458
},
{
"Type":"MemoBox",
"Name":"MemoBox1",
"Dock":"Fill",
"Center":"Both",
"TextAlign":"MiddleCenter",
"Text":"[#库位#] - [#colNo#]"
}
]
}
]
},
"ColumnTitle":{
"Height":1.40229,
"RepeatStyle":"OnPage",
"ColumnTitleCell":[
{
"GroupTitle":false,
"Column":"操作人",
"Font":{
"Name":"宋体",
"Size":120000,
"Bold":true,
"Charset":134
},
"TextAlign":"MiddleCenter",
"Text":"操作人"
},
{
"GroupTitle":false,
"Column":"时间",
"Font":{
"Name":"宋体",
"Size":120000,
"Bold":true,
"Charset":134
},
"TextAlign":"MiddleCenter",
"Text":"时间"
},
{
"GroupTitle":false,
"Column":"药品名称",
"Font":{
"Name":"宋体",
"Size":120000,
"Bold":true,
"Charset":134
},
"TextAlign":"MiddleCenter",
"Text":"药品名称"
},
{
"GroupTitle":false,
"Column":"数量",
"Font":{
"Name":"宋体",
"Size":120000,
"Bold":true,
"Charset":134
},
"TextAlign":"MiddleCenter",
"Text":"数量"
},
{
"GroupTitle":false,
"Column":"批次",
"Font":{
"Name":"宋体",
"Size":120000,
"Bold":true,
"Charset":134
},
"TextAlign":"MiddleCenter",
"Text":"批次"
},
{
"GroupTitle":false,
"Column":"效期",
"Font":{
"Name":"宋体",
"Size":120000,
"Bold":true,
"Charset":134
},
"TextAlign":"MiddleCenter",
"Text":"效期"
},
{
"GroupTitle":false,
"Column":"库位",
"Font":{
"Name":"宋体",
"Size":120000,
"Bold":true,
"Charset":134
},
"TextAlign":"MiddleCenter",
"Text":"库位"
}
]
}
},
"Parameter":[
{
"Name":"startDate",
"DataType":"DateTime",
"Format":"yyyy-MM-dd hh:mm:ss",
"Value":"2023/1/1"
},
{
"Name":"endDate",
"DataType":"DateTime",
"Format":"yyyy-MM-dd hh:mm:ss",
"Value":"2023/4/28 23:59:59"
},
{
"Name":"machine_id",
"Value":"DM1"
}
],
"ReportHeader":[
{
"Name":"ReportHeader1",
"Height":1.79917,
"Control":[
{
"Type":"MemoBox",
"Name":"MemoBox2",
"Left":7.59354,
"Top":0.211667,
"Width":5.60917,
"Height":1.19063,
"Font":{
"Name":"宋体",
"Size":217500,
"Bold":true,
"Charset":134
},
"TextAlign":"MiddleCenter",
"Text":"归还记录"
}
],
"RepeatOnPage":true
}
]
}

View File

@ -0,0 +1,283 @@
{
"Version":"6.3.0.1",
"Font":{
"Name":"宋体",
"Size":105000,
"Weight":400,
"Charset":134
},
"Printer":{
"LeftMargin":0.3175,
"TopMargin":0.899583,
"RightMargin":0.396875
},
"DetailGrid":{
"CenterView":true,
"AppendBlankRow":true,
"Recordset":{
"QuerySQL":"SELECT \r\n dmr.`drawer_no` AS drawerNo,\r\n dmr.`col_no` AS colNo,\r\n dmr.`type` AS `type`,\r\n dmr.`quantity` AS quantity,\r\n dmr.`manu_no` AS manuNo,\r\n dmr.`eff_date` AS effDate,\r\n dmr.`operation_time` AS operationTime,\r\n di.`drug_name` AS drugName,\r\n di.`drug_spec` AS drugSpec,\r\n di.`pack_unit` AS packUnit,\r\n di.`manufactory` AS manuFactory,\r\n di.`max_stock` AS baseQuantity,\r\n dmr.`drug_id` AS drugId,\r\n ul.`user_name` AS nickname\r\nFROM\r\n dm_machine_record dmr\r\nLEFT JOIN drug_info di ON di.`drug_id` = dmr.`drug_id`\r\nLEFT JOIN user_list ul ON ul.`id` = dmr.`Operator`\r\nWHERE dmr.`type` = 2 \r\n AND dmr.`machine_id` = :machine_id\r\n AND dmr.`operation_time` > :startDate\r\n AND dmr.`operation_time` < :endDate",
"Field":[
{
"Name":"操作人",
"DBFieldName":"Nickname"
},
{
"Name":"时间",
"Type":"DateTime",
"Format":"yyyy/MM/dd HH:mm:ss",
"DBFieldName":"operationTime"
},
{
"Name":"药品名称",
"DBFieldName":"DrugName"
},
{
"Name":"数量",
"DBFieldName":"quantity"
},
{
"Name":"批次",
"DBFieldName":"manuNo"
},
{
"Name":"效期",
"Type":"DateTime",
"Format":"yyyy/MM/dd",
"DBFieldName":"effDate"
},
{
"Name":"库位",
"DBFieldName":"drawerNo"
},
{
"Name":"colNo"
},
{
"Name":"type2",
"Type":"Integer",
"DBFieldName":"type"
}
]
},
"Column":[
{
"Name":"操作人",
"Width":2.38125
},
{
"Name":"时间",
"Width":3.78354
},
{
"Name":"药品名称",
"Width":4.63021
},
{
"Name":"数量",
"Width":1.98438
},
{
"Name":"批次",
"Width":2.61938
},
{
"Name":"效期",
"Width":2.38125
},
{
"Name":"库位",
"Width":2.59292
}
],
"ColumnContent":{
"Height":1.00542,
"ColumnContentCell":[
{
"Column":"操作人",
"TextAlign":"MiddleCenter",
"DataField":"操作人"
},
{
"Column":"时间",
"TextAlign":"MiddleCenter",
"DataField":"时间"
},
{
"Column":"药品名称",
"TextAlign":"MiddleCenter",
"DataField":"药品名称"
},
{
"Column":"数量",
"TextAlign":"MiddleCenter",
"DataField":"数量"
},
{
"Column":"批次",
"TextAlign":"MiddleCenter",
"DataField":"批次"
},
{
"Column":"效期",
"TextAlign":"MiddleCenter",
"DataField":"效期"
},
{
"Column":"库位",
"FreeCell":true,
"Control":[
{
"Type":"FieldBox",
"Name":"FieldBox1",
"Left":9.60438,
"Top":-2.16958,
"Width":2.80458,
"Height":0.661458
},
{
"Type":"MemoBox",
"Name":"MemoBox1",
"Dock":"Fill",
"Center":"Both",
"TextAlign":"MiddleCenter",
"Text":"[#库位#] - [#colNo#]"
}
]
}
]
},
"ColumnTitle":{
"Height":1.40229,
"RepeatStyle":"OnPage",
"ColumnTitleCell":[
{
"GroupTitle":false,
"Column":"操作人",
"Font":{
"Name":"宋体",
"Size":120000,
"Bold":true,
"Charset":134
},
"TextAlign":"MiddleCenter",
"Text":"操作人"
},
{
"GroupTitle":false,
"Column":"时间",
"Font":{
"Name":"宋体",
"Size":120000,
"Bold":true,
"Charset":134
},
"TextAlign":"MiddleCenter",
"Text":"时间"
},
{
"GroupTitle":false,
"Column":"药品名称",
"Font":{
"Name":"宋体",
"Size":120000,
"Bold":true,
"Charset":134
},
"TextAlign":"MiddleCenter",
"Text":"药品名称"
},
{
"GroupTitle":false,
"Column":"数量",
"Font":{
"Name":"宋体",
"Size":120000,
"Bold":true,
"Charset":134
},
"TextAlign":"MiddleCenter",
"Text":"数量"
},
{
"GroupTitle":false,
"Column":"批次",
"Font":{
"Name":"宋体",
"Size":120000,
"Bold":true,
"Charset":134
},
"TextAlign":"MiddleCenter",
"Text":"批次"
},
{
"GroupTitle":false,
"Column":"效期",
"Font":{
"Name":"宋体",
"Size":120000,
"Bold":true,
"Charset":134
},
"TextAlign":"MiddleCenter",
"Text":"效期"
},
{
"GroupTitle":false,
"Column":"库位",
"Font":{
"Name":"宋体",
"Size":120000,
"Bold":true,
"Charset":134
},
"TextAlign":"MiddleCenter",
"Text":"库位"
}
]
}
},
"Parameter":[
{
"Name":"startDate",
"DataType":"DateTime",
"Format":"yyyy-MM-dd hh:mm:ss",
"Value":"2023/1/1"
},
{
"Name":"endDate",
"DataType":"DateTime",
"Format":"yyyy-MM-dd hh:mm:ss",
"Value":"2023/4/28 23:59:59"
},
{
"Name":"machine_id",
"Value":"DM1"
}
],
"ReportHeader":[
{
"Name":"ReportHeader1",
"Height":1.79917,
"Control":[
{
"Type":"MemoBox",
"Name":"MemoBox2",
"Left":7.59354,
"Top":0.211667,
"Width":5.60917,
"Height":1.19063,
"Font":{
"Name":"宋体",
"Size":217500,
"Bold":true,
"Charset":134
},
"TextAlign":"MiddleCenter",
"Text":"出库记录"
}
],
"RepeatOnPage":true
}
]
}

View File

@ -0,0 +1,633 @@
{
"Version":"6.3.0.1",
"Font":{
"Name":"宋体",
"Size":105000,
"Weight":400,
"Charset":134
},
"Printer":{
"Oriention":"Landscape",
"TopMargin":0.3175,
"RightMargin":0.8996,
"BottomMargin":0.3969
},
"DetailGrid":{
"CenterView":true,
"AppendBlankRow":true,
"Recordset":{
"QuerySQL":"SELECT \r\n dmr.`drawer_no` AS drawerNo,\r\n dmr.`col_no` AS colNo,\r\n dmr.`type` AS `type`,\r\n dmr.`quantity` AS quantity,\r\n dmr.`manu_no` AS manuNo,\r\n dmr.`eff_date` AS effDate,\r\n dmr.`operation_time` AS operationTime,\r\n di.`drug_name` AS drugName,\r\n di.`drug_spec` AS drugSpec,\r\n di.`pack_unit` AS packUnit,\r\n di.`manufactory` AS manuFactory,\r\n di.`max_stock` AS baseQuantity,\r\n dmr.`drug_id` AS drugId,\r\n ul.`user_name` AS nickname\r\nFROM\r\n dm_machine_record dmr\r\nLEFT JOIN drug_info di ON di.`drug_id` = dmr.`drug_id`\r\nLEFT JOIN user_list ul ON ul.`id` = dmr.`Operator`\r\nWHERE dmr.`type` = 2 \r\n AND dmr.`machine_id` = :machine_id\r\n AND dmr.`operation_time` > :startDate\r\n AND dmr.`operation_time` < :endDate",
"Field":[
{
"Name":"患者姓名",
"DBFieldName":"p_name"
},
{
"Name":"性别",
"DBFieldName":"sex"
},
{
"Name":"年龄",
"Type":"Integer",
"DBFieldName":"age"
},
{
"Name":"身份证号",
"DBFieldName":"id_number"
},
{
"Name":"病历号",
"DBFieldName":"patientno"
},
{
"Name":"疾病名称",
"Format":"yyyy/MM/dd",
"DBFieldName":"disease"
},
{
"Name":"药品ID",
"DBFieldName":"drugId"
},
{
"Name":"数量",
"Type":"Integer",
"DBFieldName":"quantity"
},
{
"Name":"处方医生",
"DBFieldName":"doctor_name"
},
{
"Name":"处方编号",
"DBFieldName":"order_no"
},
{
"Name":"处方日期",
"DBFieldName":"order_date"
},
{
"Name":"发药人",
"DBFieldName":"nickname"
},
{
"Name":"复核人",
"DBFieldName":"reviewNickname"
},
{
"Name":"批号",
"DBFieldName":"manuNo"
},
{
"Name":"麻醉卡号"
},
{
"Name":"代办人姓名"
},
{
"Name":"代办人身份证号"
},
{
"Name":"编号"
},
{
"Name":"药品名称",
"DBFieldName":"drugName"
},
{
"Name":"规格",
"DBFieldName":"drugSpec"
},
{
"Name":"单位",
"DBFieldName":"packUnit"
}
]
},
"Column":[
{
"Name":"患者姓名",
"Width":2.38125
},
{
"Name":"性别",
"Width":1.00542
},
{
"Name":"年龄",
"Width":0.978958
},
{
"Name":"身份证号",
"Width":5.00063
},
{
"Name":"病历号",
"Width":2.77813
},
{
"Name":"疾病名称",
"Width":3.01625
},
{
"Name":"药品ID",
"Width":2.59292
},
{
"Name":"数量",
"Width":1.69333
},
{
"Name":"处方医生",
"Width":2.32833
},
{
"Name":"处方编号",
"Width":2.80458
},
{
"Name":"发药人",
"Width":3.20146
},
{
"Name":"复核人",
"Width":1.69333
},
{
"Name":"批号",
"Width":1.69333
},
{
"Name":"麻醉卡号",
"Width":3.59833
},
{
"Name":"代办人姓名",
"Width":1.69333
},
{
"Name":"代办人身份证号",
"Width":1.69333
},
{
"Name":"Column10",
"Width":2.14313
},
{
"Name":"Column11",
"Width":1.69333
}
],
"ColumnContent":{
"Height":1.00542,
"ColumnContentCell":[
{
"Column":"患者姓名",
"TextAlign":"MiddleCenter",
"DataField":"患者姓名"
},
{
"Column":"性别",
"TextAlign":"MiddleCenter",
"DataField":"性别"
},
{
"Column":"年龄",
"TextAlign":"MiddleCenter",
"DataField":"年龄"
},
{
"Column":"身份证号",
"TextAlign":"MiddleCenter",
"DataField":"身份证号"
},
{
"Column":"病历号",
"TextAlign":"MiddleCenter",
"DataField":"病历号"
},
{
"Column":"疾病名称",
"TextAlign":"MiddleCenter",
"DataField":"疾病名称"
},
{
"Column":"药品ID",
"DataField":"药品ID"
},
{
"Column":"数量",
"DataField":"数量"
},
{
"Column":"处方医生",
"DataField":"处方医生"
},
{
"Column":"处方编号",
"DataField":"处方编号"
},
{
"Column":"发药人",
"DataField":"处方日期"
},
{
"Column":"复核人",
"DataField":"发药人"
},
{
"Column":"批号",
"DataField":"复核人"
},
{
"Column":"麻醉卡号",
"DataField":"批号"
},
{
"Column":"代办人姓名",
"DataField":"麻醉卡号"
},
{
"Column":"代办人身份证号",
"DataField":"代办人姓名"
},
{
"Column":"Column10",
"DataField":"代办人身份证号"
},
{
"Column":"Column11"
}
]
},
"ColumnTitle":{
"Height":1.40229,
"RepeatStyle":"OnGroupHeaderPage",
"ColumnTitleCell":[
{
"GroupTitle":false,
"Column":"患者姓名",
"Font":{
"Name":"宋体",
"Size":120000,
"Bold":true,
"Charset":134
},
"TextAlign":"MiddleCenter",
"Text":"患者\r\n姓名"
},
{
"GroupTitle":false,
"Column":"性别",
"Font":{
"Name":"宋体",
"Size":120000,
"Bold":true,
"Charset":134
},
"TextAlign":"MiddleCenter",
"Text":"性\r\n别"
},
{
"GroupTitle":false,
"Column":"年龄",
"Font":{
"Name":"宋体",
"Size":120000,
"Bold":true,
"Charset":134
},
"TextAlign":"MiddleCenter",
"Text":"年\r\n龄"
},
{
"GroupTitle":false,
"Column":"身份证号",
"Font":{
"Name":"宋体",
"Size":120000,
"Bold":true,
"Charset":134
},
"TextAlign":"MiddleCenter",
"Text":"身份证号"
},
{
"GroupTitle":false,
"Column":"病历号",
"Font":{
"Name":"宋体",
"Size":120000,
"Bold":true,
"Charset":134
},
"TextAlign":"MiddleCenter",
"Text":"病历号"
},
{
"GroupTitle":false,
"Column":"疾病名称",
"Font":{
"Name":"宋体",
"Size":120000,
"Bold":true,
"Charset":134
},
"TextAlign":"MiddleCenter",
"Text":"疾病名称"
},
{
"GroupTitle":false,
"Column":"药品ID",
"Font":{
"Name":"宋体",
"Size":120000,
"Bold":true,
"Charset":134
},
"TextAlign":"MiddleCenter",
"Text":"药品ID"
},
{
"GroupTitle":false,
"Column":"数量",
"Font":{
"Name":"宋体",
"Size":120000,
"Bold":true,
"Charset":134
},
"TextAlign":"MiddleCenter",
"Text":"数\r\n量"
},
{
"GroupTitle":false,
"Column":"处方医生",
"Font":{
"Name":"宋体",
"Size":120000,
"Bold":true,
"Charset":134
},
"TextAlign":"MiddleCenter",
"Text":"处方\r\n医生"
},
{
"GroupTitle":false,
"Column":"处方编号",
"Font":{
"Name":"宋体",
"Size":120000,
"Bold":true,
"Charset":134
},
"TextAlign":"MiddleCenter",
"Text":"处方编号"
},
{
"GroupTitle":false,
"Column":"发药人",
"Font":{
"Name":"宋体",
"Size":120000,
"Bold":true,
"Charset":134
},
"TextAlign":"MiddleCenter",
"Text":"处方日期"
},
{
"GroupTitle":false,
"Column":"复核人",
"Font":{
"Name":"宋体",
"Size":120000,
"Bold":true,
"Charset":134
},
"TextAlign":"MiddleCenter",
"Text":"发药人"
},
{
"GroupTitle":false,
"Column":"批号",
"Font":{
"Name":"宋体",
"Size":120000,
"Bold":true,
"Charset":134
},
"TextAlign":"MiddleCenter",
"Text":"复核人"
},
{
"GroupTitle":false,
"Column":"麻醉卡号",
"Font":{
"Name":"宋体",
"Size":120000,
"Bold":true,
"Charset":134
},
"TextAlign":"MiddleCenter",
"Text":"批号"
},
{
"GroupTitle":false,
"Column":"代办人姓名",
"Font":{
"Name":"宋体",
"Size":120000,
"Bold":true,
"Charset":134
},
"TextAlign":"MiddleCenter",
"Text":"麻醉卡号"
},
{
"GroupTitle":false,
"Column":"代办人身份证号",
"Font":{
"Name":"宋体",
"Size":120000,
"Bold":true,
"Charset":134
},
"TextAlign":"MiddleCenter",
"Text":"代办人\r\n姓名"
},
{
"GroupTitle":false,
"Column":"Column10",
"Font":{
"Name":"宋体",
"Size":120000,
"Bold":true,
"Charset":134
},
"TextAlign":"MiddleCenter",
"Text":"代办人\r\n身份证"
},
{
"GroupTitle":false,
"Column":"Column11",
"Font":{
"Name":"宋体",
"Size":120000,
"Bold":true,
"Charset":134
},
"TextAlign":"MiddleCenter",
"Text":"编号"
}
]
},
"Group":[
{
"Name":"Group1",
"ByFields":"药品ID",
"GroupHeader":{
"PrintGridBorder":false,
"RepeatOnPage":true,
"Control":[
{
"Type":"StaticBox",
"Name":"StaticBox16",
"Top":0.0529167,
"Width":1.19063,
"Height":0.978958,
"Font":{
"Name":"宋体",
"Size":105000,
"Bold":true,
"Charset":134
},
"Text":"药品名称:"
},
{
"Type":"FieldBox",
"Name":"FieldBox7",
"Left":1.16417,
"Top":0.0529167,
"Width":5.63563,
"Height":0.978958,
"Font":{
"Name":"宋体",
"Size":105000,
"Bold":true,
"Charset":134
},
"DataField":"药品名称"
},
{
"Type":"StaticBox",
"Name":"StaticBox17",
"Left":6.93208,
"Top":0.0529167,
"Width":1.11125,
"Height":0.978958,
"Font":{
"Name":"宋体",
"Size":105000,
"Bold":true,
"Charset":134
},
"Text":"规格:"
},
{
"Type":"FieldBox",
"Name":"FieldBox8",
"Left":8.01688,
"Top":0.0529167,
"Width":3.175,
"Height":0.978958,
"Font":{
"Name":"宋体",
"Size":105000,
"Bold":true,
"Charset":134
},
"DataField":"规格"
},
{
"Type":"StaticBox",
"Name":"StaticBox15",
"Left":11.59,
"Top":0.05,
"Width":2.01083,
"Height":0.79375,
"Font":{
"Name":"宋体",
"Size":105000,
"Bold":true,
"Charset":134
},
"Text":"单位:"
},
{
"Type":"FieldBox",
"Name":"FieldBox9",
"Left":12.78,
"Top":0.05,
"Width":1.88,
"Height":0.98,
"Font":{
"Name":"宋体",
"Size":105000,
"Bold":true,
"Charset":134
},
"DataField":"单位"
}
],
"NewPageColumn":"Before"
},
"GroupFooter":{
"Height":0.635
}
}
]
},
"Parameter":[
{
"Name":"startDate",
"DataType":"DateTime",
"Format":"yyyy-MM-dd hh:mm:ss",
"Value":"2023/1/1"
},
{
"Name":"endDate",
"DataType":"DateTime",
"Format":"yyyy-MM-dd hh:mm:ss",
"Value":"2023/4/28 23:59:59"
},
{
"Name":"machine_id",
"Value":"DM1"
}
],
"ReportHeader":[
{
"Name":"ReportHeader1",
"Height":1.79917,
"Control":[
{
"Type":"MemoBox",
"Name":"MemoBox2",
"Left":7.59354,
"Top":0.211667,
"Width":5.60917,
"Height":1.19063,
"Font":{
"Name":"宋体",
"Size":217500,
"Bold":true,
"Charset":134
},
"TextAlign":"MiddleCenter",
"Text":"发药登记表"
}
],
"RepeatOnPage":true
}
]
}

View File

@ -0,0 +1,346 @@
{
"Version":"6.3.0.1",
"Font":{
"Name":"宋体",
"Size":105000,
"Weight":400,
"Charset":134
},
"Printer":{
"Oriention":"Landscape"
},
"DetailGrid":{
"CenterView":true,
"PrintAdaptMethod":"ResizeToFit",
"AppendBlankRow":true,
"Recordset":{
"QuerySQL":"SELECT \r\n cl.`row_no` AS drawerNo,\r\n cl.`col_no` AS colNo,\r\n cl.`quantity` AS quantity,\r\n cl.`manu_no` AS manuNo,\r\n cl.`eff_date` AS effDate,\r\n di.`drug_name` AS drugName,\r\n di.`drug_spec` AS drugSpec,\r\n di.`pack_unit` AS packUnit,\r\n di.`manufactory` AS manuFactory,\r\n di.`max_stock` AS baseQuantity,\r\n cl.`drug_id` AS drugId\r\nFROM\r\n channel_stock cl\r\nINNER JOIN drug_info di ON di.`drug_id` = cl.`drug_id`\r\nWHERE cl.`machine_id` = :machine_id\r\n AND cl.`drawer_type` = 1\r\n ORDER BY cl.`drug_id`",
"Field":[
{
"Name":"drugName"
},
{
"Name":"drugSpec"
},
{
"Name":"manuFactory"
},
{
"Name":"quantityCount"
},
{
"Name":"manuNo"
},
{
"Name":"effDate"
},
{
"Name":"quantity",
"Type":"Integer",
"Format":"0"
},
{
"Name":"drawerNo"
},
{
"Name":"drugId"
},
{
"Name":"baseQuantity",
"Type":"Integer"
}
]
},
"Column":[
{
"Name":"drugName",
"Width":5.37104
},
{
"Name":"drugSpec"
},
{
"Name":"manuFactory",
"Width":4.60375
},
{
"Name":"Column1"
},
{
"Name":"quantityCount",
"Width":2.59292
},
{
"Name":"manuNo"
},
{
"Name":"effDate"
},
{
"Name":"quantity",
"Width":2.43417
}
],
"ColumnContent":{
"Height":0.79375,
"ColumnContentCell":[
{
"Column":"drugName",
"TextAlign":"MiddleCenter",
"DataField":"drugName"
},
{
"Column":"drugSpec",
"TextAlign":"MiddleCenter",
"DataField":"drugSpec"
},
{
"Column":"manuFactory",
"TextAlign":"MiddleCenter",
"DataField":"manuFactory"
},
{
"Column":"Column1",
"FreeCell":true
},
{
"Column":"quantityCount",
"FreeCell":true
},
{
"Column":"manuNo",
"TextAlign":"MiddleCenter",
"DataField":"manuNo"
},
{
"Column":"effDate",
"TextAlign":"MiddleCenter",
"DataField":"effDate"
},
{
"Column":"quantity",
"TextAlign":"MiddleCenter",
"DataField":"quantity"
}
]
},
"ColumnTitle":{
"Height":1.19063,
"RepeatStyle":"OnPage",
"ColumnTitleCell":[
{
"GroupTitle":false,
"Column":"drugName",
"Font":{
"Name":"宋体",
"Size":142500,
"Bold":true,
"Charset":134
},
"TextAlign":"MiddleCenter",
"Text":"药品名称"
},
{
"GroupTitle":false,
"Column":"drugSpec",
"Font":{
"Name":"宋体",
"Size":142500,
"Bold":true,
"Charset":134
},
"TextAlign":"MiddleCenter",
"Text":"规格"
},
{
"GroupTitle":false,
"Column":"manuFactory",
"Font":{
"Name":"宋体",
"Size":142500,
"Bold":true,
"Charset":134
},
"TextAlign":"MiddleCenter",
"Text":"厂家"
},
{
"GroupTitle":false,
"Column":"Column1",
"Font":{
"Name":"宋体",
"Size":142500,
"Bold":true,
"Charset":134
},
"TextAlign":"MiddleCenter",
"Text":"基数"
},
{
"GroupTitle":false,
"Column":"quantityCount",
"Font":{
"Name":"宋体",
"Size":142500,
"Bold":true,
"Charset":134
},
"TextAlign":"MiddleCenter",
"Text":"总库存"
},
{
"GroupTitle":false,
"Column":"manuNo",
"Font":{
"Name":"宋体",
"Size":142500,
"Bold":true,
"Charset":134
},
"TextAlign":"MiddleCenter",
"Text":"批次"
},
{
"GroupTitle":false,
"Column":"effDate",
"Font":{
"Name":"宋体",
"Size":142500,
"Bold":true,
"Charset":134
},
"TextAlign":"MiddleCenter",
"Text":"效期"
},
{
"GroupTitle":false,
"Column":"quantity",
"Font":{
"Name":"宋体",
"Size":142500,
"Bold":true,
"Charset":134
},
"TextAlign":"MiddleCenter",
"Text":"数量"
}
]
},
"Group":[
{
"Name":"drugId",
"ByFields":"drugId",
"GroupHeader":{
"Visible":false,
"Height":0.79375,
"RepeatOnPage":true,
"OccupyColumn":true,
"IncludeFooter":true,
"OccupiedColumns":"drugName;drugSpec;manuFactory;quantityCount;Column1",
"VAlign":"Middle"
},
"GroupFooter":{
"Visible":false,
"Height":0.396875
}
},
{
"Name":"Group1",
"ByFields":"drugId",
"GroupHeader":{
"Control":[
{
"Type":"MemoBox",
"Name":"MemoBox3",
"AlignColumn":"drugName",
"Width":5.3975,
"Height":1.19063,
"TextAlign":"MiddleCenter",
"Text":"[#drugName#]"
},
{
"Type":"MemoBox",
"Name":"MemoBox4",
"AlignColumn":"drugSpec",
"Left":5.37104,
"Width":3.01625,
"Height":1.19063,
"TextAlign":"MiddleCenter",
"Text":"[#drugSpec#]"
},
{
"Type":"MemoBox",
"Name":"MemoBox5",
"AlignColumn":"manuFactory",
"Left":8.36083,
"Width":4.63021,
"Height":1.19063,
"TextAlign":"MiddleCenter",
"Text":"[#manuFactory#]"
},
{
"Type":"MemoBox",
"Name":"MemoBox6",
"AlignColumn":"Column1",
"Left":12.9646,
"Width":3.01625,
"Height":1.19063,
"TextAlign":"MiddleCenter",
"Text":"[#baseQuantity#]"
},
{
"Type":"SummaryBox",
"Name":"SummaryBox1",
"AlignColumn":"quantityCount",
"Left":15.9544,
"Width":2.61938,
"Height":1.19063,
"TextAlign":"MiddleCenter",
"DataField":"quantity",
"Format":"0"
}
],
"OccupyColumn":true,
"SameAsColumn":false,
"OccupiedColumns":"Column1;drugName;drugSpec;manuFactory;quantityCount",
"VAlign":"Middle"
},
"GroupFooter":{
"Visible":false
}
}
]
},
"Parameter":[
{
"Name":"machine_id",
"Value":"DM1"
}
],
"ReportHeader":[
{
"Name":"ReportHeader1",
"Height":2.40771,
"Control":[
{
"Type":"StaticBox",
"Name":"StaticBox1",
"Center":"Horizontal",
"Left":8.89,
"Top":0.608542,
"Width":9.18104,
"Height":1.21708,
"Font":{
"Name":"宋体",
"Size":217500,
"Bold":true,
"Charset":134
},
"TextAlign":"MiddleCenter",
"Text":"毒麻药品库存信息"
}
],
"RepeatOnPage":true
}
]
}

View File

@ -0,0 +1,20 @@
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Controls;
namespace DM_Weight.Validation
{
public class NotEmptyValidationRule : ValidationRule
{
public override ValidationResult Validate(object value, CultureInfo cultureInfo)
{
return string.IsNullOrWhiteSpace((value ?? "").ToString())
? new ValidationResult(false, "字段不能为空")
: ValidationResult.ValidResult;
}
}
}

View File

@ -0,0 +1,159 @@
using DM_Weight.msg;
using DM_Weight.Report;
using DM_Weight.util;
using Prism.Commands;
using Prism.Events;
using Prism.Mvvm;
using Prism.Regions;
using System;
using System.Collections.Generic;
using System.Linq;
using DM_Weight.Models;
using Prism.Services.Dialogs;
using System.Threading.Tasks;
namespace DM_Weight.ViewModels
{
public class AccountWindowForDrugViewModel : BindableBase, INavigationAware, IRegionMemberLifetime
{
public static AccountWindowForDrugViewModel vm;
private DateTime? _startDate = DateTime.Now;
public DateTime? StartDate
{
get => _startDate;
set
{
SetProperty(ref _startDate, value);
}
}
private DateTime? _endDate = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, 23, 59, 59);
public DateTime? EndDate
{
get => _endDate;
set
{
SetProperty(ref _endDate, value);
}
}
IEventAggregator _eventAggregator;
IDialogService _dialogService;
public AccountWindowForDrugViewModel(IEventAggregator eventAggregator, IDialogService dialogService)
{
_eventAggregator = eventAggregator;
_dialogService = dialogService;
vm = this;
}
/// <summary>
/// 导出账册
/// </summary>
public DelegateCommand DownloadAccountBook
{
get => new DelegateCommand(() =>
{
if (DrugInfo == null || string.IsNullOrEmpty(DrugInfo.DrugId))
{
AlertMsg alertMsg = new AlertMsg
{
Message = $"请选择药品!",
Type = MsgType.ERROR,
};
_eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
return;
}
GridReportUtil.PrintReportAccountBook(StartDate, EndDate, DrugInfo.DrugId);
});
}
public bool KeepAlive => false;
public bool IsNavigationTarget(NavigationContext navigationContext)
{
return true;
}
public void OnNavigatedFrom(NavigationContext navigationContext)
{
}
public void OnNavigatedTo(NavigationContext navigationContext)
{
//药品信息
GetAllDrugInfos();
}
/// <summary>
/// 药品
/// </summary>
private List<DrugInfo>? _drugInfos;
public List<DrugInfo>? DrugInfos
{
get => _drugInfos;
set => SetProperty(ref _drugInfos, value);
}
private DrugInfo? _drugInfo;
public DrugInfo? DrugInfo
{
get => _drugInfo;
set
{
SetProperty(ref _drugInfo, value);
}
}
private void GetAllDrugInfos()
{
var list = SqlSugarHelper.Db.Queryable<DrugInfo>().Includes<DrugManuNo>(di => di.DrugManuNos).OrderBy(di => di.DrugId).ToList();
DrugInfos = list;
DrugInfo = list[0];
}
public void UpdateComboBoxItems(string text)
{
string str = @"SELECT d.drug_id,d.py_code,d.drug_barcode,d.drug_name,d.drug_brand_name,d.drug_spec,d.dosage,d.pack_unit,
d.manufactory,d.max_stock,CONCAT(drug_name,' ',drug_spec)as DrugName FROM `drug_info` d";
if (string.IsNullOrEmpty(text))
{
DrugInfos = SqlSugarHelper.Db.SqlQueryable<DrugInfo>(str).OrderBy(di => di.DrugName).OrderBy(di => di.DrugId).ToList();
return;
}
if (DrugInfos != null)
{
DrugInfos.Clear();
}
DrugInfos = SqlSugarHelper.Db.SqlQueryable<DrugInfo>(str).Where(di => di.DrugName.Contains(text) || di.PyCode.Contains(text)).OrderBy(di => di.DrugName).OrderBy(di => di.DrugId).ToList();
}
public DelegateCommand<string> SelectTimeAction
{
get => new DelegateCommand<string>(async (s) =>
{
// 此处延时1毫秒等待页面渲染
await Task.Delay(TimeSpan.FromMilliseconds(1));
DialogParameters dialogParameters = new DialogParameters();
dialogParameters.Add("DateTime", StartDate);
dialogParameters.Add("Type", s);
DialogServiceExtensions.ShowDialogHost(_dialogService, "DatetimeDialog", dialogParameters, DoDialogResult, "RootDialog");
});
}
private void DoDialogResult(IDialogResult dialogResult)
{
// 委托 被动执行 被子窗口执行
// dialogResult 第一方面可以拿到任意参数 第二方面 可判断关闭状态
if (dialogResult.Result == ButtonResult.OK)
{
if (dialogResult.Parameters.GetValue<string?>("Type").Equals("1"))
{
StartDate = dialogResult.Parameters.GetValue<DateTime?>("DateTime");
}
else
{
EndDate = dialogResult.Parameters.GetValue<DateTime?>("DateTime");
}
}
//MessageBox.Show("返回值:" + dialogResult.Result.ToString());
}
}
}

View File

@ -0,0 +1,147 @@
using DM_Weight.Models;
using DM_Weight.msg;
using DM_Weight.Report;
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.Tasks;
using System.Windows.Media;
namespace DM_Weight.ViewModels
{
public class AccountWindowViewModel : BindableBase, INavigationAware, IRegionMemberLifetime
{
private DateTime? _startDate = DateTime.Now;
public DateTime? StartDate
{
get => _startDate;
set
{
SetProperty(ref _startDate, value);
}
}
private DateTime? _endDate = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, 23, 59, 59);
public DateTime? EndDate
{
get => _endDate;
set
{
SetProperty(ref _endDate, value);
}
}
private string _name;
public string Name { get => _name; set { SetProperty(ref _name, value); } }
private static readonly DateTime Jan1st1970 = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);
/// <summary>
/// 麻醉医师姓名
/// </summary>
private List<UserList> _UserInfos;
public List<UserList> UserInfos
{
get => _UserInfos;
set { SetProperty(ref _UserInfos, value); }
}
private UserList _User;
public UserList User
{
get => _User;
set { SetProperty(ref _User, value); }
}
private static List<string> boxDefine =
new List<string> { "1号手术间", "2号手术间", "3号手术间", "4号手术间", "5号手术间", "6号手术间", "7号手术间", "8号手术间", "9号手术间", "10号手术间", "11号手术间", "12号手术间", "13号手术间", "14号手术间", "15号手术间", "16号手术间", "17号手术间", "18号手术间" };
private List<string> _Boxs = boxDefine;
public List<string> Boxs
{
get => _Boxs;
set { SetProperty(ref _Boxs, value); }
}
private string _Box;
public string Box
{
get => _Box;
set { SetProperty(ref _Box, value); }
}
IDialogService _dialogService;
public AccountWindowViewModel(IDialogService dialogService)
{
_dialogService = dialogService;
}
public long CurrentTimeMillis()
{
return (long)(DateTime.UtcNow - Jan1st1970).TotalMilliseconds;
}
public void OnNavigatedTo(NavigationContext navigationContext)
{
//绑定用户信息
UserInfos = SqlSugarHelper.Db.Queryable<UserList>()
.Where(ul => ul.MachineId.Equals(ConfigurationManager.AppSettings["machineId"] ?? "DM5")).ToList();
}
public bool IsNavigationTarget(NavigationContext navigationContext)
{
return true;
}
public void OnNavigatedFrom(NavigationContext navigationContext)
{
}
/// <summary>
/// 导出账册
/// </summary>
public DelegateCommand DownloadAccountBook
{
get => new DelegateCommand(() =>
{
GridReportUtil.UserAccount(StartDate, EndDate, User == null ? "" : User.Nickname, Box);
});
}
public DelegateCommand<string> SelectTimeAction
{
get => new DelegateCommand<string>(async (s) =>
{
// 此处延时1毫秒等待页面渲染
await Task.Delay(TimeSpan.FromMilliseconds(1));
DialogParameters dialogParameters = new DialogParameters();
dialogParameters.Add("DateTime", StartDate);
dialogParameters.Add("Type", s);
DialogServiceExtensions.ShowDialogHost(_dialogService, "DatetimeDialog", dialogParameters, DoDialogResult, "RootDialog");
});
}
private void DoDialogResult(IDialogResult dialogResult)
{
// 委托 被动执行 被子窗口执行
// dialogResult 第一方面可以拿到任意参数 第二方面 可判断关闭状态
if (dialogResult.Result == ButtonResult.OK)
{
if (dialogResult.Parameters.GetValue<string?>("Type").Equals("1"))
{
StartDate = dialogResult.Parameters.GetValue<DateTime?>("DateTime");
}
else
{
EndDate = dialogResult.Parameters.GetValue<DateTime?>("DateTime");
}
}
//MessageBox.Show("返回值:" + dialogResult.Result.ToString());
}
public bool KeepAlive => true;
}
}

View File

@ -0,0 +1,73 @@
using DM_Weight.Models;
using DM_Weight.msg;
using Prism.Commands;
using Prism.Mvvm;
using Prism.Services.Dialogs;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DM_Weight.ViewModels
{
internal class DatetimeDialogViewModel : BindableBase, IDialogAware
{
public string Title => throw new NotImplementedException();
public event Action<IDialogResult> RequestClose;
private DateTime? _date = new DateTime();
public DateTime? Date
{
get => _date;
set
{
SetProperty(ref _date, value);
}
}
private DateTime? _time = new DateTime();
public DateTime? Time
{
get => _time;
set
{
SetProperty(ref _time, value);
}
}
public bool CanCloseDialog()
{
return true;
}
public void OnDialogClosed()
{
}
string typeS;
public void OnDialogOpened(IDialogParameters parameters)
{
DateTime o = parameters.GetValue<DateTime>("DateTime");
typeS = parameters.GetValue<string>("Type");
Date = o;
Time = o;
}
public DelegateCommand CloseAction
{
get => new DelegateCommand(() =>
{
var datetime=new DateTime(Date?.Year ?? DateTime.Now.Year, Date?.Month ?? DateTime.Now.Month, Date?.Day ?? DateTime.Now.Day,
Time?.Hour ?? DateTime.Now.Hour, Time?.Minute ?? DateTime.Now.Minute, Time?.Second ?? DateTime.Now.Second);
var result = new DialogResult(ButtonResult.OK, new DialogParameters
{
{ "DateTime", datetime },
{"Type",typeS }
});
RequestClose?.Invoke(result);
});
}
}
}

View File

@ -0,0 +1,292 @@
using log4net;
using Prism.Commands;
using Prism.Events;
using Prism.Mvvm;
using Prism.Regions;
using Prism.Services.Dialogs;
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using DM_Weight.Models;
using DM_Weight.util;
using DM_Weight.Views;
using System.Timers;
using Unity;
using System.Windows.Threading;
using Newtonsoft.Json.Linq;
using DM_Weight.msg;
using DM_Weight.HIKVISION;
using System.Threading;
using MaterialDesignThemes.Wpf;
using System.Windows.Media;
using System.Collections.ObjectModel;
namespace DM_Weight.ViewModels
{
public class HomeWindowViewModel : BindableBase, IConfirmNavigationRequest, IRegionMemberLifetime
{
private readonly ILog logger = LogManager.GetLogger(typeof(HomeWindowViewModel));
private readonly IDialogService _dialogService;
private UserList? _userList;
private UserList? _userList2;
private SolidColorBrush _colorBrush;
public SolidColorBrush SnackbarBackground
{
get => _colorBrush;
set => SetProperty(ref _colorBrush, value);
}
private ISnackbarMessageQueue _snackbarMessageQueue = new SnackbarMessageQueue(TimeSpan.FromSeconds(3));
public ISnackbarMessageQueue SnackbarMessageQueue
{
get => _snackbarMessageQueue;
set => SetProperty(ref _snackbarMessageQueue, value);
}
private int loginMode = Convert.ToInt32(ConfigurationManager.AppSettings["loginMode"]?.ToString() ?? "1");
public bool MultiLogin
{
get => loginMode == 2;
}
private PremissionDm? _selectedMenu;
private PremissionDm? _selectedChildMenu;
private List<PremissionDm>? _premissionDmList;
public PremissionDm? SelectedChildMenu
{
get { return _selectedChildMenu; }
set
{
SetProperty(ref _selectedChildMenu, value);
}
}
public PremissionDm? SelectedMenu
{
get { return _selectedMenu; }
set
{
SetProperty(ref _selectedMenu, value);
}
}
private DelegateCommand _selectionCommon;
public DelegateCommand SelectionCommon
{
get => _selectionCommon ?? (_selectionCommon = new DelegateCommand(SelectionMethod));
}
private void SelectionMethod()
{
logger.Info("开始进入父菜单");
if (SelectedMenu != null && SelectedMenu.PremissionName == "退出")
{
logger.Info($"用户【{Operator?.Nickname}】退出登录");
Operator = null;
Reviewer = null;
System.Windows.Application.Current.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Send, new Action(() =>
{
_regionManager.RequestNavigate("MainRegion", "LoginWindow");
}));
//_regionManager.RequestNavigate("MainRegion", "BeforeLogin");
}
else
{
//SelectedMenu.Children = SelectedMenu.Children;
//SelectedChildMenu = SelectedMenu.Children[0];
//_regionManager.RequestNavigate("ContentRegion", SelectedMenu.Children[0].PremissionPath);
}
logger.Info("结束父菜单");
}
#region
#endregion
public List<PremissionDm> PremissionDmList { get { return _premissionDmList; } set { SetProperty(ref _premissionDmList, value); } }
public UserList UserList { get { return _userList; } set { SetProperty(ref _userList, value); } }
public UserList UserList2 { get { return _userList2; } set { SetProperty(ref _userList2, value); } }
public static UserList? Operator;
public static UserList? Reviewer;
IRegionManager _regionManager;
IUnityContainer _container;
private bool _is16Drawer;
public bool Is16Drawer { get => _is16Drawer; set => SetProperty(ref _is16Drawer, value); }
public bool KeepAlive => false;
//private CHKFunction _chkFunction;
IEventAggregator _eventAggregator;
public HomeWindowViewModel(IRegionManager iRegionManager, IDialogService dialogService, IUnityContainer container, IEventAggregator eventAggregator)
{
_regionManager = iRegionManager;
_dialogService = dialogService;
_container = container;
this._eventAggregator = eventAggregator;
//_chkFunction = cHKFunction;
}
public DelegateCommand<string> OpenFingerDialog
{
get => new DelegateCommand<string>((string Type) =>
{
DialogParameters dialogParameters = new DialogParameters();
dialogParameters.Add("User", Type.Equals("Operator") ? Operator : Reviewer);
DialogServiceExtensions.ShowDialogHost(_dialogService, "FingerprintDialog", dialogParameters, DoDialogResult, "RootDialog");
});
}
//public DelegateCommand<string> OpenEditPasswordDialog
//{
// get => new DelegateCommand<string>((string Type) =>
// {
// DialogParameters dialogParameters = new DialogParameters();
// dialogParameters.Add("EditPass", true);
// dialogParameters.Add("User", Type.Equals("Operator") ? Operator : Reviewer);
// DialogServiceExtensions.ShowDialogHost(_dialogService, "EditUserDialog", dialogParameters, DoDialogResult, "RootDialog");
// });
//}
private void DoDialogResult(IDialogResult dialogResult)
{
// 委托 被动执行 被子窗口执行
// dialogResult 第一方面可以拿到任意参数 第二方面 可判断关闭状态
if (dialogResult.Result == ButtonResult.OK)
{
}
}
/// <summary>
/// 查看冰箱温度
/// </summary>
//public DelegateCommand CheckWDCommand { get => new DelegateCommand(CheckAction); }
//private void CheckAction()
//{
//GetWD();
//}
#region
private DelegateCommand _selectionChildCommon;
public DelegateCommand SelectionChildCommon
{
get => _selectionChildCommon ?? (_selectionChildCommon = new DelegateCommand(SelectionChildMethod));
}
private void SelectionChildMethod()
{
SelectChildNavigate(SelectedChildMenu);
}
private void SelectChildNavigate(PremissionDm SelectedChildMenu)
{
if (SelectedChildMenu != null)
{
_regionManager.RequestNavigate("ContentRegion", SelectedChildMenu.PremissionPath);
}
}
#endregion
//这个方法用于拦截请求,continuationCallback(true)就是不拦截continuationCallback(false)拦截本次操作
public void ConfirmNavigationRequest(NavigationContext navigationContext, Action<bool> continuationCallback)
{
continuationCallback(true);
}
//接收导航传过来的参数
public void OnNavigatedTo(NavigationContext navigationContext)
{
//取出user
UserList = navigationContext.Parameters.GetValue<UserList>("operator");
Operator = UserList;
logger.Info($"发药人【{Operator.Nickname}】登录");
if (navigationContext.Parameters.ContainsKey("reviewer"))
{
UserList2 = navigationContext.Parameters.GetValue<UserList>("reviewer");
Reviewer = UserList2;
logger.Info($"审核人【{Reviewer.Nickname}】登录");
}
PremissionDm child = new PremissionDm { Id = 46, PremissionName = "账册", PremissionPath = "AccountWindow" };
PremissionDm child2 = new PremissionDm { Id = 47, PremissionName = "药品专用账本", PremissionPath = "AccountWindowForDrug" };
ObservableCollection<PremissionDm> childrenList = new ObservableCollection<PremissionDm>();
childrenList.Add(child);
childrenList.Add(child2);
List<PremissionDm> premissions = new List<PremissionDm>()
{
new PremissionDm{Id=1,PremissionName="使用账册",PremissionPath="",PremissionImage="/Images/TbKuc.png",Children=childrenList},
new PremissionDm{Id=1,PremissionName="退出",PremissionPath="",PremissionImage="/Images/TbExit.png",Children=childrenList}
};
if (premissions.Count <= 0)
{
Operator = null;
Reviewer = null;
Application.Current.Dispatcher.Invoke(() =>
{
_regionManager.RequestNavigate("MainRegion", "LoginWindow");
});
AlertMsg alertMsg = new AlertMsg
{
Message = $"用户{UserList.Nickname}或还未设置权限,请联系管理员",
Type = MsgType.ERROR
};
_eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
return;
}
//SqlSugarHelper.Db.SqlQueryable<PremissionDm>(sql)
//.ToTree(pd => pd.Children, pd => pd.ParentId, 0);
PremissionDmList = premissions;
SelectedMenu = premissions[0];
SelectedChildMenu = premissions[0].Children[0];
_regionManager.RequestNavigate("ContentRegion", "AccountWindow");
int autoExit = Convert.ToInt32(ConfigurationManager.AppSettings["autoExit"] ?? "0");
int stopRecord = Convert.ToInt32(ConfigurationManager.AppSettings["stopRecord"] ?? "0");
if (autoExit > 0)
{
System.Timers.Timer timer = new System.Timers.Timer();
timer.Interval = 1000;
timer.Elapsed += (sender, e) =>
{
// 30秒内无人操作鼠标键盘
if (CheckComputerFreeState.GetLastInputTime() > autoExit)
{
logger.Info($"设备30秒内无人操作用户【{Operator?.Nickname}】自动退出登录");
//_chkFunction.HIKStopDVRRecord();
Operator = null;
Reviewer = null;
Application.Current.Dispatcher.Invoke(() =>
{
_regionManager.RequestNavigate("MainRegion", "LoginWindow");
timer.Stop();
});
}
};
timer.Start();
}
}
//每次导航的时候该实列用不用重新创建true是不重新创建,false是重新创建
public bool IsNavigationTarget(NavigationContext navigationContext)
{
return true;
}
//这个方法用于拦截请求
public void OnNavigatedFrom(NavigationContext navigationContext)
{
}
}
}

View File

@ -0,0 +1,337 @@
using log4net;
using log4net.Core;
using log4net.Repository.Hierarchy;
using Prism.Commands;
using Prism.Events;
using Prism.Ioc;
using Prism.Mvvm;
using Prism.Regions;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Configuration;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using DM_Weight.Models;
using DM_Weight.msg;
using DM_Weight.util;
using DM_Weight.Views;
using System.Collections.ObjectModel;
using Microsoft.Win32;
using System.Xml;
using System.Diagnostics;
using DM_Weight.HIKVISION;
using System.Security.AccessControl;
namespace DM_Weight.ViewModels
{
public class LoginWindowViewModel : BindableBase, IRegionMemberLifetime, IConfirmNavigationRequest
{
private readonly ILog logger = LogManager.GetLogger(typeof(LoginWindowViewModel));
private string username;
private string password;
private Boolean _loginBtnEnable = true;
IRegionManager _regionManager;
IEventAggregator _eventAggregator;
private int loginMode = Convert.ToInt32(ConfigurationManager.AppSettings["loginMode"]?.ToString() ?? "1");
private string firstLogin = ConfigurationManager.AppSettings["firstLogin"]?.ToString() ?? "operator";
public bool SingleLogin
{
get => ReadAppSetting("loginMode") == "1";
//get => loginMode == 1;
}
public bool MultiLogin
{
//get => loginMode == 2;
get => ReadAppSetting("loginMode") == "2";
}
public string LoginUserCheck
{
get => ReadAppSetting("loginUser");
}
//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); } }
public string Username { get { return username; } set { SetProperty(ref username, value); } }
public UserList Operator { get; set; }
public UserList Reviewer { get; set; }
private bool _fingerMsg;
public bool FingerMsg
{
get => _fingerMsg;
set => SetProperty(ref _fingerMsg, value);
}
//public bool FridgePortMsg
//{
// get => !_portUtil.fridgeSerial.IsOpen;
//}
//录像机登录状态
//private bool _hikMsg;
//public bool HIKMsg
//{
// get=>_hikMsg;
// set=>SetProperty(ref _hikMsg, value);
//}
//public LoginWindowViewModel(IRegionManager regionManager, IEventAggregator eventAggregator, PortUtil portUtil, FingerprintUtil fingerprintUtil)
//{
// _fingerprintUtil = fingerprintUtil;
// _portUtil = portUtil;
// _regionManager = regionManager;
// _eventAggregator = eventAggregator;
//}
public LoginWindowViewModel(IRegionManager regionManager, IEventAggregator eventAggregator)
{
//_chkFunction= chcFunction;
_regionManager = regionManager;
_eventAggregator = eventAggregator;
}
private DelegateCommand? _loginCommand;
private DelegateCommand? _exitCommand;
public DelegateCommand LoginCommand =>
_loginCommand ??= new DelegateCommand(Login);
public DelegateCommand ExitCommand =>
_exitCommand ??= new DelegateCommand(Exit);
public bool KeepAlive => false;
void Login()
{
LoginBtnEnable = false;
if (!string.IsNullOrEmpty(Username) && !string.IsNullOrEmpty(Password))
{
if (Username.Equals("hkcadmin") && Password.Equals("hkc123"))
{
ObservableCollection<PremissionDm> defaultAll = null;// RoleManagerWindowViewModel.defaultAll;
PremissionDm[] a = new PremissionDm[defaultAll.Count];
Array.Copy(defaultAll.ToArray(), 0, a, 0, defaultAll.Count);
a[4].Children.Add(new PremissionDm()
{
Id = 54,
PremissionName = "调试页面",
PremissionPath = "DebugWindow",
});
//添加参数,键值对格式
keys.Add("operator", new UserList()
{
UserName = Username,
Nickname = "华康测试账号",
Id = 9999,
Role = new RoleDm()
{
Id = 9999,
RoleName = "hkcadmin",
Permissions = a.ToList()
},
});
_regionManager.RequestNavigate("MainRegion", "HomeWindow", keys);
}
else
{
UserList userList = SqlSugarHelper.Db.Queryable<UserList>()
.Includes<RoleDm>(u => u.Role)
.First(u => u.UserName == username && ConfigurationManager.AppSettings["machineId"].ToString().Equals(u.MachineId));
if (userList == null)
{
AlertMsg alertMsg = new AlertMsg
{
Message = "无此用户",
Type = MsgType.ERROR
};
_eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
Username = "";
Password = "";
}
else if (userList.Role == null|| userList.Role.Permissions.Count<=0)
{
AlertMsg alertMsg = new AlertMsg
{
Message = "用户还未设置权限,请联系管理员",
Type = MsgType.ERROR
};
_eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
Username = "";
Password = "";
}
else
{
if (userList.PassWord == MD5.GetMD5Hash(Password))
{
SetUser(userList);
}
else
{
AlertMsg alertMsg = new AlertMsg
{
Message = "密码错误",
Type = MsgType.ERROR
};
_eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
Password = "";
}
}
}
}
else
{
AlertMsg alertMsg = new AlertMsg
{
Message = "请输入账号或密码",
Type = MsgType.ERROR
};
_eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
}
LoginBtnEnable = true;
}
private NavigationParameters keys = new NavigationParameters();
void SetUser(UserList user)
{
// 单人登录模式
if (SingleLogin)
{
//添加参数,键值对格式
keys.Add("operator", user);
//System.Windows.Application.Current.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Send, new Action(() =>
//{
_regionManager.RequestNavigate("MainRegion", "HomeWindow", keys);
//}));
}
// 双人登录模式
else
{
// 如果已经录入了发药人,已经有一个用户登录
if (keys.ContainsKey("operator"))
{
if (keys.GetValue<UserList>("operator").Id != user.Id)
{
keys.Add("reviewer", user);
Reviewer = user;
RaisePropertyChanged("Reviewer");
//System.Windows.Application.Current.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Send, new Action(() =>
//{
_regionManager.RequestNavigate("MainRegion", "HomeWindow", keys);
//}));
}
else
{
AlertMsg alertMsg = new AlertMsg
{
Message = "该发药人账号已登录,请输入不同账号",
Type = MsgType.ERROR
};
_eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
}
}
// 如果已经录入了审核人, 已经有一个用户登录
else if (keys.ContainsKey("reviewer"))
{
if (keys.GetValue<UserList>("reviewer").Id != user.Id)
{
keys.Add("operator", user);
Operator = user;
RaisePropertyChanged("Operator");
//System.Windows.Application.Current.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Send, new Action(() =>
//{
_regionManager.RequestNavigate("MainRegion", "HomeWindow", keys);
//}));
}
else
{
AlertMsg alertMsg = new AlertMsg
{
Message = "该审核人账号已登录,请输入不同账号",
Type = MsgType.ERROR
};
_eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
}
}
// 第一个用户登录
else
{
if (firstLogin.Equals("operator"))
{
keys.Add("operator", user);
Operator = user;
RaisePropertyChanged("Operator");
}
else
{
keys.Add("reviewer", user);
Reviewer = user;
RaisePropertyChanged("Reviewer");
}
Username = string.Empty;
Password =string.Empty;
}
}
}
void Exit()
{
//_chkFunction.HIKLoginOut();
Process.GetCurrentProcess().Kill();
Environment.Exit(0);
}
//这个方法用于拦截请求,continuationCallback(true)就是不拦截continuationCallback(false)拦截本次操作
public void ConfirmNavigationRequest(NavigationContext navigationContext, Action<bool> continuationCallback)
{
continuationCallback(true);
}
//接收导航传过来的参数 现在是在此处初始化了表格数据
public void OnNavigatedTo(NavigationContext navigationContext)
{
}
//每次导航的时候该实列用不用重新创建true是不重新创建,false是重新创建
public bool IsNavigationTarget(NavigationContext navigationContext)
{
return true;
}
//这个方法用于拦截请求
public void OnNavigatedFrom(NavigationContext navigationContext)
{
}
//手动实现调用配置的逻辑 规避修改配置文件后不起作用的问题
public 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();
}
}
}

View File

@ -0,0 +1,101 @@
using MaterialDesignThemes.Wpf;
using Prism.Commands;
using Prism.Events;
using Prism.Mvvm;
using Prism.Regions;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Media;
using DM_Weight.msg;
using DM_Weight.util;
using DM_Weight.Views;
using Unity;
using DM_Weight.HIKVISION;
namespace DM_Weight.ViewModels
{
internal class MainWindowViewModel : BindableBase
{
private string _title = "Prism App"; //标题
private ISnackbarMessageQueue _snackbarMessageQueue = new SnackbarMessageQueue(TimeSpan.FromSeconds(3));
private SolidColorBrush _colorBrush;
//private PortUtil _portUtil;
//private ScreenUtil _screenUtil;
public SolidColorBrush Background
{
get => _colorBrush;
set => SetProperty(ref _colorBrush, value);
}
public ISnackbarMessageQueue SnackbarMessageQueue
{
get => _snackbarMessageQueue;
set => SetProperty(ref _snackbarMessageQueue, value);
}
public string Title
{
get { return _title; }
set { SetProperty(ref _title, value); }
}
IEventAggregator eventAggregator;
//public MainWindowViewModel(IEventAggregator eventAggregator, PortUtil portUtil, ScreenUtil screenUtil)
//{
// _portUtil = portUtil;
// this.eventAggregator = eventAggregator;
// this.eventAggregator.GetEvent<SnackbarEvent>().Subscribe(doMyPrismEvent2);
// _screenUtil = screenUtil;
//}
//private FingerprintUtil _fingerprintUtil;
IRegionManager _regionManager;
IUnityContainer _container;
//private CHKFunction _cHKFunction;
public MainWindowViewModel(IRegionManager regionManager, IUnityContainer container, IEventAggregator eventAggregator)
{
//_portUtil = portUtil;
this.eventAggregator = eventAggregator;
this.eventAggregator.GetEvent<SnackbarEvent>().Subscribe(doMyPrismEvent2);
//_fingerprintUtil = fingerprintUtil;
_regionManager = regionManager;
_container = container;
//_cHKFunction = cHKFunction;
//System.Windows.Application.Current.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Send, new Action(() =>
//{
_container.RegisterType<object, LoginWindow>("LoginWindow");
_regionManager.RegisterViewWithRegion("MainRegion", "LoginWindow");
//}));
}
void doMyPrismEvent2(AlertMsg msg)
{
switch (msg.Type)
{
case MsgType.INFO:
this.Background = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#00e676"));
break;
case MsgType.ERROR:
this.Background = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#b71c1c"));
break;
default:
this.Background = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#00e676"));
break;
}
SnackbarMessageQueue.Enqueue(msg.Message);
}
}
}

View File

@ -0,0 +1,111 @@
<UserControl x:Class="DM_Weight.Views.AccountWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:DM_Weight.Views"
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
xmlns:pagination="clr-namespace:DM_Weight.Components.pagination"
xmlns:i="http://schemas.microsoft.com/xaml/behaviors"
xmlns:prism="http://prismlibrary.com/"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800">
<UserControl.Resources>
<Style x:Key="FieldIcon" TargetType="materialDesign:PackIcon">
<Setter Property="DockPanel.Dock" Value="Right" />
<Setter Property="VerticalAlignment" Value="Center" />
</Style>
<Style x:Key="FieldDockPanel" TargetType="DockPanel">
<Setter Property="Margin" Value="0,0,8,16" />
<Setter Property="VerticalAlignment" Value="Bottom" />
</Style>
</UserControl.Resources>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Grid Margin="0 6 0 6" Grid.Row="0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="9*" />
<ColumnDefinition Width="2*"/>
</Grid.ColumnDefinitions>
<StackPanel Grid.Row="0" Orientation="Horizontal" HorizontalAlignment="Left">
<DockPanel Style="{StaticResource FieldDockPanel}">
<TextBox Style="{StaticResource MaterialDesignOutlinedTextBox}" x:Name="startDataBox" materialDesign:HintAssist.Hint="开始时间"
Text="{Binding StartDate,StringFormat='yyyy-MM-dd HH:mm:ss'}" Margin="6 0 0 0" >
</TextBox>
<Button
Style="{StaticResource MaterialDesignIconForegroundButton}" Command="{Binding SelectTimeAction}" CommandParameter="1" >
<materialDesign:PackIcon Width="40" Height="40" Kind="CalendarRange" Style="{StaticResource FieldIcon}" Foreground="{Binding ElementName=startDataBox, Path=BorderBrush}"/>
</Button>
</DockPanel>
<DockPanel Style="{StaticResource FieldDockPanel}">
<TextBox Style="{StaticResource MaterialDesignOutlinedTextBox}" x:Name="endDataBox" materialDesign:HintAssist.Hint="结束时间"
Text="{Binding EndDate,StringFormat='yyyy-MM-dd HH:mm:ss'}" Margin="6 0 0 0" >
</TextBox>
<Button
Style="{StaticResource MaterialDesignIconForegroundButton}" Command="{Binding SelectTimeAction}" CommandParameter="2" >
<materialDesign:PackIcon Width="40" Height="40" Kind="CalendarRange" Style="{StaticResource FieldIcon}" Foreground="{Binding ElementName=endDataBox, Path=BorderBrush}"/>
</Button>
</DockPanel>
<!--<DatePicker
SelectedDate="{Binding StartDate, TargetNullValue=''}"
Margin="6 0 0 0"
materialDesign:HintAssist.Hint="开始时间"
Style="{StaticResource MaterialDesignOutlinedDatePicker}"
/>
<DatePicker
SelectedDate="{Binding EndDate}"
Margin="6 0 0 0"
materialDesign:HintAssist.Hint="结束时间"
Style="{StaticResource MaterialDesignOutlinedDatePicker}"
/>-->
<!--<ComboBox
Margin="12 20 0 0"
Grid.Column="2"
materialDesign:HintAssist.Hint="麻醉师"
IsEditable="True"
ItemsSource="{Binding DrugInfos}"
SelectedItem="{Binding DrugInfo}"
DisplayMemberPath="DrugName"
/>-->
<ComboBox Width="130"
Margin="16 0 6 0"
Grid.Column="2"
materialDesign:HintAssist.Hint="麻醉医师姓名"
ItemsSource="{Binding UserInfos}"
SelectedItem="{Binding User}"
DisplayMemberPath="Nickname" IsEditable="True" IsTextSearchEnabled="False"/>
<ComboBox Width="130"
Margin="16 0 6 0"
Grid.Column="2"
materialDesign:HintAssist.Hint="手术间"
ItemsSource="{Binding Boxs}"
SelectedItem="{Binding Box}"
IsEditable="True" IsTextSearchEnabled="False"/>
</StackPanel>
<StackPanel Grid.Column="1" Orientation="Horizontal" HorizontalAlignment="Right">
<Button
Margin="0 0 13 0"
VerticalAlignment="Center"
Style="{StaticResource MaterialDesignOutlinedLightButton}"
ToolTip="导出" Command="{Binding DownloadAccountBook}">
<StackPanel Orientation="Horizontal">
<materialDesign:PackIcon Kind="download" />
<TextBlock Text="导出账册" />
</StackPanel>
</Button>
</StackPanel>
</Grid>
</Grid>
</UserControl>

View File

@ -0,0 +1,29 @@
using DM_Weight.ViewModels;
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>
/// AccountWindow.xaml 的交互逻辑
/// </summary>
public partial class AccountWindow : UserControl
{
public AccountWindow()
{
InitializeComponent();
}
}
}

View File

@ -0,0 +1,87 @@
<UserControl x:Class="DM_Weight.Views.AccountWindowForDrug"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:DM_Weight.Views"
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
xmlns:pagination="clr-namespace:DM_Weight.Components.pagination"
xmlns:i="http://schemas.microsoft.com/xaml/behaviors"
xmlns:prism="http://prismlibrary.com/"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800" Loaded="UserControl_Loaded">
<UserControl.Resources>
<Style TargetType="{x:Type TextBox}" BasedOn="{StaticResource MaterialDesignTextBox}">
<Setter Property="Margin" Value="0,8" />
<Setter Property="VerticalAlignment" Value="Center" />
</Style>
<Style x:Key="FieldIcon" TargetType="materialDesign:PackIcon">
<Setter Property="DockPanel.Dock" Value="Right" />
<Setter Property="VerticalAlignment" Value="Center" />
</Style>
<Style x:Key="FieldDockPanel" TargetType="DockPanel">
<Setter Property="Margin" Value="0,0,8,16" />
<Setter Property="VerticalAlignment" Value="Bottom" />
</Style>
</UserControl.Resources>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Grid Margin="0 6 0 6" Grid.Row="0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="8*" />
<ColumnDefinition Width="2*" />
</Grid.ColumnDefinitions>
<StackPanel Grid.Row="0" Orientation="Horizontal" HorizontalAlignment="Left">
<DockPanel Style="{StaticResource FieldDockPanel}">
<TextBox Style="{StaticResource MaterialDesignOutlinedTextBox}" x:Name="startDataBox" materialDesign:HintAssist.Hint="开始时间"
Text="{Binding StartDate,StringFormat='yyyy-MM-dd HH:mm:ss'}" Margin="6 0 0 0" >
</TextBox>
<Button
Style="{StaticResource MaterialDesignIconForegroundButton}" Command="{Binding SelectTimeAction}" CommandParameter="1" >
<materialDesign:PackIcon Width="40" Height="40" Kind="CalendarRange" Style="{StaticResource FieldIcon}" Foreground="{Binding ElementName=startDataBox, Path=BorderBrush}"/>
</Button>
</DockPanel>
<DockPanel Style="{StaticResource FieldDockPanel}">
<TextBox Style="{StaticResource MaterialDesignOutlinedTextBox}" x:Name="endDataBox" materialDesign:HintAssist.Hint="结束时间"
Text="{Binding EndDate,StringFormat='yyyy-MM-dd HH:mm:ss'}" Margin="6 0 0 0" >
</TextBox>
<Button
Style="{StaticResource MaterialDesignIconForegroundButton}" Command="{Binding SelectTimeAction}" CommandParameter="2" >
<materialDesign:PackIcon Width="40" Height="40" Kind="CalendarRange" Style="{StaticResource FieldIcon}" Foreground="{Binding ElementName=endDataBox, Path=BorderBrush}"/>
</Button>
</DockPanel>
<ComboBox
Margin="0 0 6 0"
materialDesign:HintAssist.Hint="药品名称/拼音码/药品编码"
ItemsSource="{Binding DrugInfos}"
SelectedItem="{Binding DrugInfo}"
DisplayMemberPath="DrugName" IsEditable="True" IsTextSearchEnabled="False" KeyUp="ComboBox_KeyUp"
/>
</StackPanel>
<StackPanel Grid.Column="1" Orientation="Horizontal" HorizontalAlignment="Right">
<Button
Margin="0 0 13 0"
VerticalAlignment="Center"
Style="{StaticResource MaterialDesignOutlinedLightButton}"
ToolTip="导出" Command="{Binding DownloadAccountBook}">
<StackPanel Orientation="Horizontal">
<materialDesign:PackIcon Kind="download" />
<TextBlock Text="导出账册" />
</StackPanel>
</Button>
</StackPanel>
</Grid>
</Grid>
</UserControl>

View File

@ -0,0 +1,52 @@
using DM_Weight.ViewModels;
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>
/// AccountWindowForDrug.xaml 的交互逻辑
/// </summary>
public partial class AccountWindowForDrug : UserControl
{
AccountWindowForDrugViewModel vms;
public AccountWindowForDrug()
{
InitializeComponent();
}
/// <summary>
/// 药品名称下拉框
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void ComboBox_KeyUp(object sender, KeyEventArgs e)
{
ComboBox comboBox = sender as ComboBox;
vms.UpdateComboBoxItems(comboBox.Text);
if (this.vms.DrugInfos.Count > 0)
{
comboBox.IsDropDownOpen = true;
}
TextBox textBox = (TextBox)comboBox.Template.FindName("PART_EditableTextBox", comboBox);
textBox.SelectionStart = textBox.Text.Length;
}
private void UserControl_Loaded(object sender, RoutedEventArgs e)
{
vms = AccountWindowForDrugViewModel.vm;
}
}
}

View File

@ -0,0 +1,35 @@
<UserControl x:Class="DM_Weight.Views.Dialog.DatetimeDialog"
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:system="clr-namespace:System;assembly=mscorlib"
xmlns:prism="http://prismlibrary.com/"
prism:ViewModelLocator.AutoWireViewModel="True"
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800">
<Grid>
<Grid Margin="-1">
<Grid.RowDefinitions>
<RowDefinition Height="*" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<StackPanel Grid.Row="0" Orientation="Horizontal">
<Calendar x:Name="CombinedCalendar" SelectedDate="{Binding Date}" Margin="-1 -4 -1 0" />
<materialDesign:Clock Time="{Binding Time}" x:Name="CombinedClock" DisplayAutomation="CycleWithSeconds" Is24Hours="True" />
</StackPanel>
<StackPanel Grid.Row="1" Margin="8" HorizontalAlignment="Right" Orientation="Horizontal">
<Button Style="{StaticResource MaterialDesignFlatButton}" Command="{Binding CloseAction}" CommandParameter="1" Content="确认" Cursor="" />
<Button Style="{StaticResource MaterialDesignFlatButton}" Command="{x:Static materialDesign:DialogHost.CloseDialogCommand}" Content="取消">
<Button.CommandParameter>
<system:Boolean xmlns:system="clr-namespace:System;assembly=mscorlib">
False
</system:Boolean>
</Button.CommandParameter>
</Button>
</StackPanel>
</Grid>
</Grid>
</UserControl>

View File

@ -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>
/// DatetimeDialog.xaml 的交互逻辑
/// </summary>
public partial class DatetimeDialog : UserControl
{
public DatetimeDialog()
{
InitializeComponent();
}
}
}

View File

@ -0,0 +1,23 @@
<UserControl x:Class="DM_Weight.Views.Dialog.ShowMessageDialog"
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"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="auto"/>
<RowDefinition/>
<RowDefinition Height="auto"/>
</Grid.RowDefinitions>
<TextBlock Padding="5" d:Text="温馨提示" FontSize="14"
Text="{Binding Title}" Style="{StaticResource MaterialDesignCaptionTextBlock}"/>
<TextBlock Grid.Row="1" Padding="15,0" HorizontalAlignment="Center" VerticalAlignment="Center"
Text="{Binding Msg}" FontSize="18" Margin="5" FontWeight="Bold"/>
<StackPanel Grid.Row="2" Margin="10" HorizontalAlignment="Center" Orientation="Horizontal">
<Button Command="{Binding SaveCommand}" Content="确认"/>
</StackPanel>
</Grid>
</UserControl>

View File

@ -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>
/// ShowMessageDialog.xaml 的交互逻辑
/// </summary>
public partial class ShowMessageDialog : UserControl
{
public ShowMessageDialog()
{
InitializeComponent();
}
}
}

View File

@ -0,0 +1,155 @@
<!--布局界面-->
<UserControl x:Class="DM_Weight.Views.HomeWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
TextElement.Foreground="{DynamicResource MaterialDesignBody}"
TextElement.FontWeight="Regular"
TextElement.FontSize="13"
TextOptions.TextFormattingMode="Ideal"
TextOptions.TextRenderingMode="Auto"
xmlns:prism="http://prismlibrary.com/"
FontFamily="{DynamicResource MaterialDesignFont}"
xmlns:i="http://schemas.microsoft.com/xaml/behaviors"
mc:Ignorable="d" Cursor="Hand">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"></RowDefinition>
<!--<RowDefinition Height="Auto"></RowDefinition>-->
<RowDefinition></RowDefinition>
<RowDefinition Height="Auto"></RowDefinition>
</Grid.RowDefinitions>
<Grid Background="#00bcd4">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<!--<Image Grid.Column="0" Margin="30 0 30 0" HorizontalAlignment="Left" Width="Auto" Height="26" Source="/Images/logo.png" />-->
<TextBlock Text="麻精药品管理系统" Grid.Column="0" Margin="30 0 30 0" HorizontalAlignment="Left" Width="Auto" Height="26" Foreground="White" FontSize="20" FontWeight="Bold" />
<ListBox Name="ListBoxName" Grid.Column="1" SelectedItem="{Binding SelectedMenu}" ItemsSource="{Binding PremissionDmList}" HorizontalAlignment="Right">
<i:Interaction.Triggers>
<i:EventTrigger EventName="SelectionChanged">
<!--<i:InvokeCommandAction Command="{Binding SelectionCommon}" CommandParameter="{Binding ElementName=ListBoxName}"/>-->
<i:InvokeCommandAction Command="{Binding SelectionCommon}"/>
</i:EventTrigger>
</i:Interaction.Triggers>
<ListBox.ItemsPanel>
<ItemsPanelTemplate>
<WrapPanel Orientation="Horizontal" IsItemsHost="True"/>
</ItemsPanelTemplate>
</ListBox.ItemsPanel>
<ListBox.ItemTemplate>
<DataTemplate>
<StackPanel Width="64" Height="64" >
<Image Width="48" Height="48" Source="{ Binding PremissionImage }" />
<TextBlock Foreground="{DynamicResource MaterialDesignPaper}" HorizontalAlignment="Center" FontSize="15" Text="{Binding PremissionName}" />
</StackPanel>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</Grid>
<!--<Grid Grid.Row="1">
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition/>
<ColumnDefinition/>
<ColumnDefinition/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<Button Content="取药" Grid.Column="0" Command="{Binding TakeCommand}" />
<Button Content="加药" Grid.Column="1" Command="{Binding AddCommand}"/>
<Button Content="还药" Grid.Column="2" Command="{Binding ReturnCommand}"/>
<Button Content="库存管理" Grid.Column="3" Command="{Binding StockCommand}"/>
<Button Content="系统设置" Grid.Column="4" Command="{Binding SettingCommand}"/>
</Grid>-->
<Grid Grid.Row="1" Margin="8,6,8,6">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<materialDesign:Card Grid.Row="0" Grid.ColumnSpan="2">
<ListBox ItemsSource="{Binding SelectedMenu.Children}" SelectedItem="{ Binding SelectedChildMenu }" HorizontalAlignment="left" Cursor="Hand">
<i:Interaction.Triggers>
<i:EventTrigger EventName="SelectionChanged">
<i:InvokeCommandAction Command="{Binding SelectionChildCommon}"/>
</i:EventTrigger>
</i:Interaction.Triggers>
<ListBox.ItemsPanel>
<ItemsPanelTemplate>
<WrapPanel Orientation="Horizontal" IsItemsHost="True"/>
</ItemsPanelTemplate>
</ListBox.ItemsPanel>
<ListBox.ItemTemplate>
<DataTemplate>
<Border Padding="0,0,5,0" BorderThickness="0 0 1 0" BorderBrush="#31ccec">
<TextBlock FontWeight="Black" FontSize="14" FontFamily="楷书" Padding="4" Text="{Binding PremissionName}" />
</Border>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</materialDesign:Card>
<materialDesign:Card Grid.Row="1" Margin="0 8 0 8" Grid.ColumnSpan="2">
<ScrollViewer HorizontalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="Disabled" Focusable="True">
<ContentControl prism:RegionManager.RegionName="ContentRegion" />
</ScrollViewer>
</materialDesign:Card>
</Grid>
<Grid Background="#2196f3" Grid.Row="2">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="70*"/>
<ColumnDefinition Width="70*"/>
<ColumnDefinition Width="270*"/>
</Grid.ColumnDefinitions>
<Menu Grid.Column="0">
<MenuItem
Foreground="White"
Header="{Binding UserList.Nickname}">
<!--<MenuItem
Command="{Binding OpenFingerDialog}"
CommandParameter="Operator"
Foreground="{DynamicResource MaterialDesignLightForeground}"
Header="录制指纹" />-->
<!--<MenuItem
Command="{Binding OpenEditPasswordDialog}"
CommandParameter="Operator"
Foreground="{DynamicResource MaterialDesignLightForeground}"
Header="修改密码" />-->
</MenuItem>
</Menu>
<Menu Grid.Column="1" Visibility="{Binding MultiLogin, Converter={StaticResource BooleanToVisibilityConverter}}">
<MenuItem
Foreground="White"
Header="{Binding UserList2.Nickname}">
<!--<MenuItem
Command="{Binding OpenFingerDialog}"
CommandParameter="Reviewer"
Foreground="{DynamicResource MaterialDesignLightForeground}"
Header="录制指纹" />-->
<!--<MenuItem
Command="{Binding OpenEditPasswordDialog}"
CommandParameter="Reviewer"
Foreground="{DynamicResource MaterialDesignLightForeground}"
Header="修改密码" />-->
</MenuItem>
</Menu>
<!--<Grid Grid.Column="2">
<StackPanel Margin="6" Orientation="Horizontal" HorizontalAlignment="Right">
<Button Content="储物箱" Command="{Binding OpenRecoverCommand}" Visibility="{Binding Is16Drawer, Converter={StaticResource BooleanToVisibilityConverter}}" Style="{StaticResource MaterialDesignFlatSecondaryLightButton}" />
</StackPanel>
</Grid>-->
</Grid>
</Grid>
</UserControl>

View File

@ -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>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class HomeWindow : UserControl
{
public HomeWindow()
{
InitializeComponent();
}
}
}

View File

@ -0,0 +1,205 @@
<!--登录界面-->
<UserControl x:Class="DM_Weight.Views.LoginWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
TextElement.Foreground="{DynamicResource MaterialDesignBody}"
TextElement.FontWeight="Regular"
TextElement.FontSize="13"
TextOptions.TextFormattingMode="Ideal"
TextOptions.TextRenderingMode="Auto"
FontFamily="{DynamicResource MaterialDesignFont}"
xmlns:i="http://schemas.microsoft.com/xaml/behaviors"
mc:Ignorable="d">
<UserControl.Background>
<ImageBrush ImageSource="/Images/body-bg.jpg" Stretch="Fill"/>
</UserControl.Background>
<Grid>
<!--<i:Interaction.Triggers>
<i:KeyTrigger Key="Enter">
<i:InvokeCommandAction Command="{Binding LoginCommand}" />
</i:KeyTrigger>
</i:Interaction.Triggers>-->
<Grid.RowDefinitions >
<RowDefinition Height="2*"></RowDefinition>
<RowDefinition Height="*"></RowDefinition>
<RowDefinition Height="6*"></RowDefinition>
<RowDefinition Height="3*"></RowDefinition>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="17*"/>
<ColumnDefinition Width="66*"/>
<ColumnDefinition Width="17*"/>
</Grid.ColumnDefinitions>
<materialDesign:Card Margin="16" Grid.Row="2" Grid.Column="1">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="7*"/>
<ColumnDefinition Width="5*"/>
</Grid.ColumnDefinitions>
<Grid Grid.Column="0">
<Grid.RowDefinitions >
<RowDefinition Height="*"></RowDefinition>
<RowDefinition Height="2*"></RowDefinition>
<RowDefinition Height="2*"></RowDefinition>
<RowDefinition Height="7*"></RowDefinition>
</Grid.RowDefinitions>
<TextBlock
Grid.Row="1"
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="28"
Foreground="#31ccec"
FontWeight="Bold"
Text="欢迎登录毒麻药品管理系统">
</TextBlock>
<TextBlock
Grid.Row="2"
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="14"
Foreground="#31ccec"
FontWeight="Bold"
Text="登录方式1账号密码登录">
</TextBlock>
<Grid Grid.Row="3" >
<Grid.RowDefinitions >
<RowDefinition Height="*"></RowDefinition>
<RowDefinition Height="*"></RowDefinition>
<RowDefinition Height="*"></RowDefinition>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="4*"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<TextBox
Grid.Row="0"
Grid.Column="1"
x:Name="account"
Text="{Binding Username, UpdateSourceTrigger=PropertyChanged}"
Style="{StaticResource MaterialDesignOutlinedTextBox}"
VerticalAlignment="Top"
AcceptsReturn="False"
TextWrapping="Wrap"
materialDesign:HintAssist.Hint="账号" />
<PasswordBox
Grid.Row="1"
Grid.Column="1"
x:Name="PasswordBox"
materialDesign:PasswordBoxAssist.Password="{Binding Password, UpdateSourceTrigger=PropertyChanged, Mode=TwoWay}"
Style="{StaticResource MaterialDesignOutlinedPasswordBox}"
VerticalAlignment="Top"
materialDesign:HintAssist.Hint="密码" />
<StackPanel Grid.Row="2"
Grid.Column="1">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"></ColumnDefinition>
<ColumnDefinition Width="2*"></ColumnDefinition>
<ColumnDefinition Width="*"></ColumnDefinition>
<ColumnDefinition Width="2*"></ColumnDefinition>
<ColumnDefinition Width="*"></ColumnDefinition>
</Grid.ColumnDefinitions>
<Button
Grid.Column="1"
Style="{StaticResource MaterialDesignRaisedButton}"
materialDesign:ButtonAssist.CornerRadius="5"
Command="{ Binding LoginCommand }"
Background="#42a5f5"
BorderBrush="#42a5f5" Cursor="Hand" IsDefault="True" Content="登录"/>
<Button
Grid.Column="3"
Style="{StaticResource MaterialDesignRaisedLightButton}"
Background="#7986cb"
BorderBrush="#7986cb"
materialDesign:ButtonAssist.CornerRadius="5" Cursor="Hand" IsCancel="true"
Command="{ Binding ExitCommand }" >
<TextBlock Foreground="{DynamicResource MaterialDesignPaper}" Text="退出" />
</Button>
</Grid>
</StackPanel>
</Grid>
</Grid>
<Grid Grid.Column="1">
<Grid.Background>
<ImageBrush ImageSource="/Images/finger-bg-r.png" Stretch="Fill"/>
</Grid.Background>
<Grid.RowDefinitions>
<RowDefinition Height="3*"></RowDefinition>
<RowDefinition Height="2*"></RowDefinition>
<RowDefinition Height="7*"></RowDefinition>
</Grid.RowDefinitions>
<StackPanel Grid.Row="0"></StackPanel>
<!--<TextBlock
Grid.Row="1"
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="14"
FontWeight="Bold"
Foreground="{DynamicResource MaterialDesignPaper}"
Text="登录方式2屏幕外右侧指纹登录">
</TextBlock>-->
<!--<StackPanel Grid.Row="2"></StackPanel>
<StackPanel Grid.Row="3" Visibility="{Binding SingleLogin, Converter={StaticResource BooleanToVisibilityConverter}}">
<materialDesign:PackIcon
Kind="Fingerprint"
Foreground="{DynamicResource MaterialDesignPaper}"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Width="75"
Height="75"
/>
</StackPanel>-->
<Grid Grid.Row="2" Visibility="{Binding MultiLogin, Converter={StaticResource BooleanToVisibilityConverter}}">
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<TextBlock Grid.Row="0"
FontSize="14"
FontWeight="Bold"
Foreground="{DynamicResource MaterialDesignPaper}"
Grid.Column="1" Text="发药人:" />
<TextBlock
FontSize="14"
FontWeight="Bold"
Foreground="{DynamicResource MaterialDesignPaper}"
Grid.Row="0" Grid.Column="2" Text="{Binding Operator.Nickname}" />
<TextBlock
FontSize="14"
FontWeight="Bold"
Foreground="{DynamicResource MaterialDesignPaper}"
Grid.Row="1" Grid.Column="1" Text="审核人:" />
<TextBlock
FontSize="14"
FontWeight="Bold"
Foreground="{DynamicResource MaterialDesignPaper}"
Grid.Row="1" Grid.Column="2" Text="{Binding Reviewer.Nickname}" />
</Grid>
</Grid>
</Grid>
</materialDesign:Card>
<!--<StackPanel Orientation="Vertical" Grid.Row="4" Grid.Column="2">
<TextBlock Visibility="{Binding DrawerPortMsg, Converter={StaticResource BooleanToVisibilityConverter}}" Text="抽屉串口连接失败" />
<TextBlock Visibility="{Binding CanBusPortMsg, Converter={StaticResource BooleanToVisibilityConverter}}" Text="can总线串口连接失败" />
<TextBlock Visibility="{Binding FingerMsg, Converter={StaticResource BooleanToVisibilityConverter}}" Text="指纹机连接失败" />
--><!--<TextBlock Visibility="{Binding HIKMsg, Converter={StaticResource BooleanToVisibilityConverter}}" Text="录像机登录失败" />-->
<!--<TextBlock Visibility="{Binding FridgePortMsg, Converter={StaticResource BooleanToVisibilityConverter}}" Text="冰箱串口连接失败" />--><!--
</StackPanel>-->
</Grid>
</UserControl>

View File

@ -0,0 +1,37 @@
using MaterialDesignColors;
using Prism.Events;
using Prism.Ioc;
using Prism.Regions;
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.Shapes;
using DM_Weight.msg;
using DM_Weight.util;
using DM_Weight.ViewModels;
namespace DM_Weight.Views
{
/// <summary>
/// LoginWindow.xaml 的交互逻辑
/// </summary>
public partial class LoginWindow : UserControl
{
public LoginWindow()
{
InitializeComponent();
}
}
}

View File

@ -0,0 +1,40 @@
<!--主窗口-->
<Window x:Class="DM_Weight.Views.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
TextElement.Foreground="{DynamicResource MaterialDesignBody}"
TextElement.FontWeight="Regular"
TextElement.FontSize="13"
TextOptions.TextFormattingMode="Ideal"
TextOptions.TextRenderingMode="Auto"
ResizeMode="NoResize"
Background="#eceff1"
FontFamily="{DynamicResource MaterialDesignFont}"
mc:Ignorable="d"
xmlns:prism="http://prismlibrary.com/"
WindowStartupLocation="CenterScreen"
Topmost="False"
prism:ViewModelLocator.AutoWireViewModel="True"
Title="主窗口" Height="768" Width="1024" WindowStyle="None" WindowState="Maximized">
<WindowChrome.WindowChrome>
<WindowChrome CornerRadius="4" GlassFrameThickness="1" />
</WindowChrome.WindowChrome>
<materialDesign:DialogHost
DialogMargin="0"
Identifier="RootDialog"
DialogTheme="Inherit"
SnackbarMessageQueue="{Binding ElementName=SnackbarThree, Path=MessageQueue}">
<Grid>
<ContentControl prism:RegionManager.RegionName="MainRegion"/>
<materialDesign:Snackbar
x:Name="SnackbarThree"
Background="{Binding Background}"
MessageQueue="{Binding SnackbarMessageQueue}"/>
</Grid>
</materialDesign:DialogHost>
</Window>

View File

@ -0,0 +1,47 @@
using Prism.Events;
using Prism.Ioc;
using Prism.Regions;
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.Shapes;
using Unity;
using Unity.Lifetime;
using DM_Weight.msg;
using DM_Weight.util;
namespace DM_Weight.Views
{
/// <summary>
/// MainWindow.xaml 的交互逻辑
/// </summary>
public partial class MainWindow : Window
{
//IRegionManager _regionManager;
//IUnityContainer _container;
public MainWindow()
{
InitializeComponent();
//_regionManager = regionManager;
//_container = container;
//System.Windows.Application.Current.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Send, new Action(() =>
//{
// _container.RegisterType<object, LoginWindow>("LoginWindow");
// _regionManager.RequestNavigate("MainRegion", "LoginWindow");
//}));
}
}
}

BIN
DM_Weight/favicon.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 264 KiB

53
DM_Weight/log4net.config Normal file
View File

@ -0,0 +1,53 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net"/>
</configSections>
<log4net>
<!-- 文件存储日志配置 -->
<appender name="RollingLogFileAppender" type="log4net.Appender.RollingFileAppender">
<!--日志路径(可修改) .\\当前目录-->
<param name= "File" value= ".\\Log\\"/>
<!--是否是向文件中追加日志-->
<param name= "AppendToFile" value= "true"/>
<!--log保留天数-->
<param name= "MaxSizeRollBackups" value= "10"/>
<!--日志文件名是否是固定不变的-->
<param name= "StaticLogFileName" value= "false"/>
<!--日志文件名格式为:2008-08-31.log-->
<param name= "DatePattern" value= "yyyy-MM-dd&quot;.log&quot;"/>
<!--日志根据日期滚动-->
<param name= "RollingStyle" value= "Date"/>
<layout type="log4net.Layout.PatternLayout">
<param name="ConversionPattern" value="%d [%t] %-5p %c - %m%n %loggername" />
</layout>
</appender>
<!--指定日记记录方式,以滚动文件的方式(文件记录)-->
<appender name="FileAppender" type="log4net.Appender.RollingFileAppender">
<!--日志路径-->
<param name= "File" value= ".\\Log\\"/>
<!--是否是向文件中追加日志-->
<param name= "AppendToFile" value= "true"/>
<!--log保留天数-->
<param name= "MaxSizeRollBackups" value= "10"/>
<!--每个文件最大1M-->
<param name="maximumFileSize" value="1MB" />
<!--日志文件名是否是固定不变的-->
<param name= "StaticLogFileName" value= "false"/>
<!--日志文件名格式为:2008-08-31.log-->
<param name= "DatePattern" value= "yyyy-MM-dd&quot;.log&quot;"/>
<!--日志根据日期滚动-->
<param name= "RollingStyle" value= "Date"/>
<!--布局-->
<layout type="log4net.Layout.PatternLayout">
<param name="ConversionPattern" value="%n记录时间%d{yyyy-MM-dd HH:mm:ss fff} 线程名:[%t] 级别:%p 类名:%c 信息:%m%n" />
<param name="Header" value="----------------------------------------------------------- "/>
</layout>
</appender>
<root>
<level value="info" />
<appender-ref ref="FileAppender" />
</root>
</log4net>
</configuration>

View File

@ -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
{
public class LoginOutEvent : PubSubEvent
{
}
}

View File

@ -0,0 +1,14 @@
using Prism.Events;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using DM_Weight.util;
namespace DM_Weight.msg
{
internal class SnackbarEvent: PubSubEvent<AlertMsg>
{
}
}

View File

@ -0,0 +1,14 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DM_Weight.select
{
public class OrderTakeSelect
{
public string? Code { get; set; }
public string? Name { get; set; }
}
}

View File

@ -0,0 +1,19 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DM_Weight.util
{
internal class AlertMsg
{
private MsgType _type = MsgType.INFO;
private string _message = "";
public MsgType Type { get => _type; set => _type = value; }
public string Message { get => _message; set => _message = value; }
}
}

View File

@ -0,0 +1,18 @@
using System.Windows;
namespace DM_Weight.util
{
public class BindingProxy : Freezable
{
protected override Freezable CreateInstanceCore() => new BindingProxy();
public object? Data
{
get => GetValue(DataProperty);
set => SetValue(DataProperty, value);
}
public static readonly DependencyProperty DataProperty =
DependencyProperty.Register("Data", typeof(object), typeof(BindingProxy), new UIPropertyMetadata(null));
}
}

View File

@ -0,0 +1,53 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
namespace DM_Weight.util
{
public class CheckComputerFreeState
{
/// <summary>
/// 创建结构体用于返回捕获时间
/// </summary>
[StructLayout(LayoutKind.Sequential)]
struct LASTINPUTINFO
{
/// <summary>
/// 设置结构体块容量
/// </summary>
[MarshalAs(UnmanagedType.U4)]
public int cbSize;
/// <summary>
/// 抓获的时间
/// </summary>
[MarshalAs(UnmanagedType.U4)]
public uint dwTime;
}
[DllImport("user32.dll")]
private static extern bool GetLastInputInfo(ref LASTINPUTINFO plii);
/// <summary>
/// 获取键盘和鼠标没有操作的时间
/// </summary>
/// <returns>用户上次使用系统到现在的时间间隔,单位为秒</returns>
public static long GetLastInputTime()
{
LASTINPUTINFO vLastInputInfo = new LASTINPUTINFO();
vLastInputInfo.cbSize = Marshal.SizeOf(vLastInputInfo);
if (!GetLastInputInfo(ref vLastInputInfo))
{
return 0;
}
else
{
var count = (Environment.TickCount & Int32.MaxValue) - (long)vLastInputInfo.dwTime;
var icount = count / 1000;
return icount;
}
}
}
}

View File

@ -0,0 +1,33 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DM_Weight.util
{
public class DeviceMsg
{
private string _windowName;
private int _drawerNo;
private EventType _eventType;
private int[] _quantitys;
private string code;
private string _message;
public string WindowName { get { return _windowName; } set { _windowName = value; } }
public int DrawerNo { get { return _drawerNo; } set { _drawerNo = value; } }
public EventType EventType { get { return _eventType; } set { _eventType = value; } }
public int[] Quantitys { get { return _quantitys; } set { _quantitys = value; } }
public string Code { get { return code; } set { code = value; } }
public string Message { get { return _message; } set { _message = value; } }
}
public enum EventType
{
DRAWEROPEN = 1, DRAWERCLOSE = 2, UPDATEQUANTITY = 3, OPENERROR = 4, CODESCAN = 5
}
}

View File

@ -0,0 +1,55 @@
using Prism.Services.Dialogs;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DM_Weight.util
{
public static class DialogServiceExtensions
{
/// <summary>
/// Shows a modal dialog using a <see cref="MaterialDesignThemes.Wpf.DialogHost"/>.
/// </summary>
/// <param name="dialogService"></param>
/// <param name="name">The name of the dialog to show.</param>
/// <param name="parameters">The parameters to pass to the dialog.</param>
/// <param name="callback">The action to perform when the dialog is closed.</param>
/// <exception cref="NullReferenceException">Thrown when the dialog service is not a MaterialDialogService</exception>
public static void ShowDialogHost(this IDialogService dialogService, string name, IDialogParameters parameters, Action<IDialogResult> callback)
{
if (!(dialogService is MaterialDialogService materialDialogService))
throw new NullReferenceException("DialogService must be a MaterialDialogService");
materialDialogService.ShowDialogHost(name, parameters, callback);
}
/// <summary>
/// Shows a modal dialog using a <see cref="MaterialDesignThemes.Wpf.DialogHost"/>.
/// </summary>
/// <param name="dialogService"></param>
/// <param name="name">The name of the dialog to show.</param>
/// <param name="parameters">The parameters to pass to the dialog.</param>
/// <param name="callback">The action to perform when the dialog is closed.</param>
/// <param name="windowName">The name of the <see cref="MaterialDesignThemes.Wpf.DialogHost"/> that will contain the dialog control</param>
/// <exception cref="NullReferenceException">Thrown when the dialog service is not a MaterialDialogService</exception>
public static void ShowDialogHost(this IDialogService dialogService, string name,
IDialogParameters parameters, Action<IDialogResult> callback, string windowName)
{
if (!(dialogService is MaterialDialogService materialDialogService))
throw new NullReferenceException("DialogService must be a MaterialDialogService");
materialDialogService.ShowDialogHost(name, windowName, parameters, callback);
}
public static void ShowDialogHost(this IDialogService dialogService, string name, IDialogParameters parameters, string windowName)
{
if (!(dialogService is MaterialDialogService materialDialogService))
throw new NullReferenceException("DialogService must be a MaterialDialogService");
materialDialogService.ShowDialogHost(name, parameters, windowName);
}
}
}

View File

@ -0,0 +1,25 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DM_Weight.util
{
public class FingerprintMsg
{
public string Message { get; set; }
public string Username { get; set; }
public string Password { get; set; }
public int Id { get; set; }
public int VerifyMethod { get; set; }
public string CardNumber { get; set; }
public int FingerIndex { get; set; }
public bool Result { get; set; }
public override string? ToString()
{
return $"Message: {Message}, Username: {Username}, Password: {Password}, Id: {Id}, VerifyMethod: {VerifyMethod}, CardNumber: {CardNumber}, FingerIndex: {FingerIndex}, Result: {Result}";
}
}
}

View File

@ -0,0 +1,70 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Controls;
using System.Windows.Threading;
using System.Windows;
namespace DM_Weight.util
{
public static class GridViewExtensions
{
#region IsContentCentered
[Category("Common")]
[AttachedPropertyBrowsableForType(typeof(GridViewColumn))]
public static bool GetIsContentCentered(GridViewColumn gridViewColumn)
{
return (bool)gridViewColumn.GetValue(IsContentCenteredProperty);
}
public static void SetIsContentCentered(GridViewColumn gridViewColumn, bool value)
{
gridViewColumn.SetValue(IsContentCenteredProperty, value);
}
public static readonly DependencyProperty IsContentCenteredProperty =
DependencyProperty.RegisterAttached(
"IsContentCentered",
typeof(bool), // type
typeof(GridViewExtensions), // containing type
new PropertyMetadata(default(bool), OnIsContentCenteredChanged)
);
private static void OnIsContentCenteredChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
OnIsContentCenteredChanged((GridViewColumn)d, (bool)e.NewValue);
}
private static void OnIsContentCenteredChanged(GridViewColumn gridViewColumn, bool isContentCentered)
{
if (isContentCentered == false) { return; }
// must wait a bit otherwise GridViewColumn.DisplayMemberBinding will not yet be initialized,
new DispatcherTimer(TimeSpan.FromMilliseconds(100), DispatcherPriority.Normal, OnColumnLoaded, gridViewColumn.Dispatcher)
{
Tag = gridViewColumn
}.Start();
}
static void OnColumnLoaded(object sender, EventArgs e)
{
var timer = (DispatcherTimer)sender;
timer.Stop();
var gridViewColumn = (GridViewColumn)timer.Tag;
if (gridViewColumn.DisplayMemberBinding == null)
{
throw new Exception("Only allowed with DisplayMemberBinding.");
}
var textBlockFactory = new FrameworkElementFactory(typeof(TextBlock));
textBlockFactory.SetBinding(TextBlock.TextProperty, gridViewColumn.DisplayMemberBinding);
textBlockFactory.SetValue(TextBlock.TextAlignmentProperty, TextAlignment.Center);
var cellTemplate = new DataTemplate { VisualTree = textBlockFactory };
gridViewColumn.DisplayMemberBinding = null; // must null, otherwise CellTemplate won't be recognized
gridViewColumn.CellTemplate = cellTemplate;
}
#endregion IsContentCentered
}
}

34
DM_Weight/util/MD5.cs Normal file
View File

@ -0,0 +1,34 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Security.Cryptography;
namespace DM_Weight.util
{
public class MD5
{
public static string GetMD5Hash(string password)
{
//就是比string往后一直加要好的优化容器
StringBuilder sb = new StringBuilder();
using (MD5CryptoServiceProvider md5 = new MD5CryptoServiceProvider())
{
//将输入字符串转换为字节数组并计算哈希。
byte[] data = md5.ComputeHash(Encoding.UTF8.GetBytes(password));
//X为 十六进制 X都是大写 x都为小写
//2为 每次都是两位数
//假设有两个数10和26正常情况十六进制显示0xA、0x1A这样看起来不整齐为了好看可以指定"X2"这样显示出来就是0x0A、0x1A。
//遍历哈希数据的每个字节
//并将每个字符串格式化为十六进制字符串。
int length = data.Length;
for (int i = 0; i < length; i++)
sb.Append(data[i].ToString("x2"));
}
return sb.ToString();
}
}
}

View File

@ -0,0 +1,159 @@
using MaterialDesignThemes.Wpf;
using Prism.Ioc;
using Prism.Mvvm;
using Prism.Services.Dialogs;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Interop;
using System.Windows.Threading;
using System.Windows;
namespace DM_Weight.util
{
internal class MaterialDialogService : DialogService
{
private readonly IContainerExtension _containerExtension;
public MaterialDialogService(IContainerExtension containerExtension) : base(containerExtension)
{
_containerExtension = containerExtension;
}
public void ShowDialogHost(string name, IDialogParameters parameters, Action<IDialogResult> callback) =>
ShowDialogHost(name, null, parameters, callback);
public void ShowDialogHost(string name, string dialogHostName, IDialogParameters parameters, Action<IDialogResult> callback)
{
if (parameters == null)
parameters = new DialogParameters();
var content = _containerExtension.Resolve<object>(name);
if (!(content is FrameworkElement dialogContent))
{
throw new NullReferenceException("A dialog's content must be a FrameworkElement");
}
AutowireViewModel(dialogContent);
if (!(dialogContent.DataContext is IDialogAware dialogAware))
{
throw new ArgumentException("A dialog's ViewModel must implement IDialogAware interface");
}
var openedEventHandler = new DialogOpenedEventHandler((sender, args) =>
{
dialogAware.OnDialogOpened(parameters);
});
var closedEventHandler = new DialogClosedEventHandler((sender, args) =>
{
dialogAware.OnDialogClosed();
});
dialogAware.RequestClose += res =>
{
if (DialogHost.IsDialogOpen(dialogHostName))
{
callback(res);
DialogHost.Close(dialogHostName);
}
};
var dispatcherFrame = new DispatcherFrame();
if (dialogHostName == null)
{
_ = DialogHost.Show(dialogContent, openedEventHandler, null, closedEventHandler)
.ContinueWith(_ => dispatcherFrame.Continue = false); ;
}
else
{
_ = DialogHost.Show(dialogContent, dialogHostName, openedEventHandler, null, closedEventHandler)
.ContinueWith(_ => dispatcherFrame.Continue = false);
}
try
{
// tell users we're going modal
ComponentDispatcher.PushModal();
Dispatcher.PushFrame(dispatcherFrame);
}
finally
{
// tell users we're going non-modal
ComponentDispatcher.PopModal();
}
dialogAware.RequestClose -= callback;
}
private static void AutowireViewModel(object viewOrViewModel)
{
if (viewOrViewModel is FrameworkElement view && view.DataContext is null && ViewModelLocator.GetAutoWireViewModel(view) is null)
{
ViewModelLocator.SetAutoWireViewModel(view, true);
}
}
public void ShowDialogHost(string name, IDialogParameters parameters, string dialogHostName)
{
var content = _containerExtension.Resolve<object>(name);
if (!(content is FrameworkElement dialogContent))
{
throw new NullReferenceException("A dialog's content must be a FrameworkElement");
}
AutowireViewModel(dialogContent);
if (!(dialogContent.DataContext is IDialogAware dialogAware))
{
throw new ArgumentException("A dialog's ViewModel must implement IDialogAware interface");
}
var openedEventHandler = new DialogOpenedEventHandler((sender, args) =>
{
dialogAware.OnDialogOpened(parameters);
});
var closedEventHandler = new DialogClosedEventHandler((sender, args) =>
{
dialogAware.OnDialogClosed();
});
dialogAware.RequestClose += res =>
{
if (DialogHost.IsDialogOpen(dialogHostName))
{
DialogHost.Close(dialogHostName);
}
};
var dispatcherFrame = new DispatcherFrame();
if (dialogHostName == null)
{
_ = DialogHost.Show(dialogContent, openedEventHandler, null, closedEventHandler)
.ContinueWith(_ => dispatcherFrame.Continue = false); ;
}
else
{
_ = DialogHost.Show(dialogContent, dialogHostName, openedEventHandler, null, closedEventHandler)
.ContinueWith(_ => dispatcherFrame.Continue = false);
}
try
{
// tell users we're going modal
ComponentDispatcher.PushModal();
Dispatcher.PushFrame(dispatcherFrame);
}
finally
{
// tell users we're going non-modal
ComponentDispatcher.PopModal();
}
}
}
}

16
DM_Weight/util/MsgType.cs Normal file
View File

@ -0,0 +1,16 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DM_Weight.util
{
enum MsgType
{
ERROR = 1,
INFO = 2,
SUCCESS = 3,
WARING = 4
}
}

23
DM_Weight/util/ReadApp.cs Normal file
View File

@ -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();
}
}
}

View File

@ -0,0 +1,26 @@
using System;
using System.Configuration;
using SqlSugar;
namespace DM_Weight.util
{
public class SqlSugarHelper
{
public static SqlSugarScope Db = new SqlSugarScope(new ConnectionConfig()
{
ConnectionString = ConfigurationManager.ConnectionStrings["database"].ToString(),
DbType = DbType.MySql,
IsAutoCloseConnection = true
},
db =>
{
db.Aop.OnLogExecuting = (sql, pars) =>
{
Console.WriteLine(sql);
};
}
);
}
}

View File

@ -0,0 +1,328 @@
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Windows;
using System.Windows.Interop;
using System.Windows.Media;
using System.Windows.Media.Animation;
using Point = System.Windows.Point;
namespace DM_Weight.util.TabTip
{
internal static class AnimationHelper
{
private static readonly Dictionary<FrameworkElement, Storyboard> MoveRootVisualStoryboards = new Dictionary<FrameworkElement, Storyboard>();
private static Point GetCurrentUIElementPoint(Visual element) => element.PointToScreen(new Point(0, 0)).ToPointInLogicalUnits(element);
internal static event Action<Exception> ExceptionCatched;
private static Rectangle ToRectangleInLogicalUnits(this Rectangle rectangleToConvert, DependencyObject element)
{
const float logicalUnitDpi = 96.0f;
// ReSharper disable once AssignNullToNotNullAttribute
IntPtr windowHandle = new WindowInteropHelper(Window.GetWindow(element)).EnsureHandle();
using (Graphics graphics = Graphics.FromHwnd(windowHandle))
return Rectangle.FromLTRB(
left: (int) (rectangleToConvert.Left * logicalUnitDpi / graphics.DpiX),
top: (int) (rectangleToConvert.Top * logicalUnitDpi / graphics.DpiY),
right: (int) (rectangleToConvert.Right * logicalUnitDpi / graphics.DpiX),
bottom: (int) (rectangleToConvert.Bottom * logicalUnitDpi / graphics.DpiY));
}
private static Point ToPointInLogicalUnits(this Point point, DependencyObject element)
{
const float logicalUnitDpi = 96.0f;
// ReSharper disable once AssignNullToNotNullAttribute
IntPtr windowHandle = new WindowInteropHelper(Window.GetWindow(element)).EnsureHandle();
using (Graphics graphics = Graphics.FromHwnd(windowHandle))
return new Point(x: point.X * logicalUnitDpi / graphics.DpiX, y: point.Y * logicalUnitDpi / graphics.DpiY);
}
// ReSharper disable once UnusedMember.Local
private static Point GetCurrentUIElementPointRelativeToRoot(UIElement element)
{
return element.TransformToAncestor(GetRootVisualForAnimation(element)).Transform(new Point(0, 0));
}
private static Rectangle GetUIElementRect(UIElement element)
{
Rect rect = element.RenderTransform.TransformBounds(new Rect(GetCurrentUIElementPoint(element), element.RenderSize));
return Rectangle.FromLTRB(
left: (int)rect.Left,
top: (int)rect.Top,
right: (int)rect.Right,
bottom: (int)rect.Bottom);
}
private static Rectangle GetCurrentScreenBounds(DependencyObject element) =>
new Screen(Window.GetWindow(element)).Bounds.ToRectangleInLogicalUnits(element);
private static Rectangle GetWorkAreaWithTabTipOpened(DependencyObject element)
{
Rectangle workAreaWithTabTipClosed = GetWorkAreaWithTabTipClosed(element);
int tabTipRectangleTop = TabTip.GetWouldBeTabTipRectangle().ToRectangleInLogicalUnits(element).Top;
int bottom = (tabTipRectangleTop == 0) ? workAreaWithTabTipClosed.Bottom / 2 : tabTipRectangleTop; // in case TabTip is not yet opened
return Rectangle.FromLTRB(
left: workAreaWithTabTipClosed.Left,
top: workAreaWithTabTipClosed.Top,
right: workAreaWithTabTipClosed.Right,
bottom: bottom);
}
private static Rectangle GetWorkAreaWithTabTipClosed(DependencyObject element)
{
Rectangle currentScreenBounds = GetCurrentScreenBounds(element);
Taskbar taskbar = new Taskbar();
Rectangle taskbarBounds = taskbar.Bounds.ToRectangleInLogicalUnits(element);
switch (taskbar.Position)
{
case TaskbarPosition.Bottom:
return Rectangle.FromLTRB(
left: currentScreenBounds.Left,
top: currentScreenBounds.Top,
right: currentScreenBounds.Right,
bottom: taskbarBounds.Top);
case TaskbarPosition.Top:
return Rectangle.FromLTRB(
left: currentScreenBounds.Left,
top: taskbarBounds.Bottom,
right: currentScreenBounds.Right,
bottom: currentScreenBounds.Bottom);
default:
return currentScreenBounds;
}
}
// ReSharper disable once UnusedMember.Local
private static bool IsUIElementInWorkAreaWithTabTipOpened(UIElement element)
{
return GetWorkAreaWithTabTipOpened(element).Contains(GetUIElementRect(element));
}
// ReSharper disable once UnusedMember.Local
private static bool IsUIElementInWorkArea(UIElement element, Rectangle workAreaRectangle)
{
return workAreaRectangle.Contains(GetUIElementRect(element));
}
private static FrameworkElement GetRootVisualForAnimation(DependencyObject element)
{
Window rootWindow = Window.GetWindow(element);
if (rootWindow?.WindowState != WindowState.Maximized)
return rootWindow;
else
return VisualTreeHelper.GetChild(rootWindow, 0) as FrameworkElement;
}
private static double GetYOffsetToMoveUIElementInToWorkArea(Rectangle uiElementRectangle, Rectangle workAreaRectangle)
{
const double noOffset = 0;
const int paddingTop = 30;
const int paddingBottom = 10;
if (uiElementRectangle.Top >= workAreaRectangle.Top &&
uiElementRectangle.Bottom <= workAreaRectangle.Bottom) // UIElement is in work area
return noOffset;
if (uiElementRectangle.Top < workAreaRectangle.Top) // Top of UIElement higher than work area
return workAreaRectangle.Top - uiElementRectangle.Top + paddingTop; // positive value to move down
else // Botom of UIElement lower than work area
{
int offset = workAreaRectangle.Bottom - uiElementRectangle.Bottom - paddingBottom; // negative value to move up
if (uiElementRectangle.Top > (workAreaRectangle.Top - offset)) // will Top of UIElement be in work area if offset applied?
return offset; // negative value to move up
else
return workAreaRectangle.Top - uiElementRectangle.Top + paddingTop; // negative value to move up, but only to the point, where top
// of UIElement is just below top bound of work area
}
}
private static Storyboard GetOrCreateMoveRootVisualStoryboard(FrameworkElement visualRoot)
{
if (MoveRootVisualStoryboards.ContainsKey(visualRoot))
return MoveRootVisualStoryboards[visualRoot];
else
return CreateMoveRootVisualStoryboard(visualRoot);
}
private static Storyboard CreateMoveRootVisualStoryboard(FrameworkElement visualRoot)
{
Storyboard moveRootVisualStoryboard = new Storyboard
{
Duration = new Duration(TimeSpan.FromSeconds(0.35))
};
DoubleAnimation moveAnimation = new DoubleAnimation
{
EasingFunction = new CircleEase {EasingMode = EasingMode.EaseOut},
Duration = new Duration(TimeSpan.FromSeconds(0.35)),
FillBehavior = (visualRoot is Window) ? FillBehavior.Stop : FillBehavior.HoldEnd
};
moveRootVisualStoryboard.Children.Add(moveAnimation);
if (!(visualRoot is Window))
visualRoot.RenderTransform = new TranslateTransform();
Storyboard.SetTarget(moveAnimation, visualRoot);
Storyboard.SetTargetProperty(
element: moveAnimation,
path: (visualRoot is Window) ? new PropertyPath("Top") : new PropertyPath("(UIElement.RenderTransform).(TranslateTransform.Y)"));
MoveRootVisualStoryboards.Add(visualRoot, moveRootVisualStoryboard);
SubscribeToWindowStateChangedToMoveRootVisual(visualRoot);
return moveRootVisualStoryboard;
}
private static void SubscribeToWindowStateChangedToMoveRootVisual(FrameworkElement visualRoot)
{
// ReSharper disable once CanBeReplacedWithTryCastAndCheckForNull
if (visualRoot is Window)
{
Window window = (Window)visualRoot;
window.StateChanged += (sender, args) =>
{
if (window.WindowState == WindowState.Normal)
MoveRootVisualBy(
rootVisual: window,
moveBy: GetYOffsetToMoveUIElementInToWorkArea(
uiElementRectangle: GetWindowRectangle(window),
workAreaRectangle: GetWorkAreaWithTabTipClosed(window)));
};
}
else
{
Window window = Window.GetWindow(visualRoot);
if (window != null)
window.StateChanged += (sender, args) =>
{
if (window.WindowState == WindowState.Normal)
MoveRootVisualTo(visualRoot, 0);
};
}
}
private static void MoveRootVisualBy(FrameworkElement rootVisual, double moveBy)
{
if (moveBy == 0)
return;
Storyboard moveRootVisualStoryboard = GetOrCreateMoveRootVisualStoryboard(rootVisual);
DoubleAnimation doubleAnimation = moveRootVisualStoryboard.Children.First() as DoubleAnimation;
if (doubleAnimation != null)
{
Window window = rootVisual as Window;
if (window != null)
{
doubleAnimation.From = window.Top;
doubleAnimation.To = window.Top + moveBy;
}
else
{
doubleAnimation.From = doubleAnimation.To ?? 0;
doubleAnimation.To = (doubleAnimation.To ?? 0) + moveBy;
}
}
moveRootVisualStoryboard.Begin();
}
private static void MoveRootVisualTo(FrameworkElement rootVisual, double moveTo)
{
Storyboard moveRootVisualStoryboard = GetOrCreateMoveRootVisualStoryboard(rootVisual);
DoubleAnimation doubleAnimation = moveRootVisualStoryboard.Children.First() as DoubleAnimation;
if (doubleAnimation != null)
{
Window window = rootVisual as Window;
if (window != null)
{
doubleAnimation.From = window.Top;
doubleAnimation.To = moveTo;
}
else
{
doubleAnimation.From = doubleAnimation.To ?? 0;
doubleAnimation.To = moveTo;
}
}
moveRootVisualStoryboard.Begin();
}
internal static void GetUIElementInToWorkAreaWithTabTipOpened(UIElement element)
{
try
{
FrameworkElement rootVisualForAnimation = GetRootVisualForAnimation(element);
Rectangle workAreaWithTabTipOpened = GetWorkAreaWithTabTipOpened(element);
Rectangle uiElementRectangle;
Window window = rootVisualForAnimation as Window;
if (window != null && workAreaWithTabTipOpened.Height >= window.Height)
uiElementRectangle = GetWindowRectangle(window);
else
uiElementRectangle = GetUIElementRect(element);
MoveRootVisualBy(
rootVisual: rootVisualForAnimation,
moveBy: GetYOffsetToMoveUIElementInToWorkArea(
uiElementRectangle: uiElementRectangle,
workAreaRectangle: workAreaWithTabTipOpened));
}
catch (Exception ex)
{
ExceptionCatched?.Invoke(ex);
}
}
private static Rectangle GetWindowRectangle(Window window)
{
return Rectangle.FromLTRB(
left: (int)window.Left,
top: (int)window.Top,
right: (int)(window.Left + window.Width),
bottom: (int)(window.Top + window.Height));
}
internal static void GetEverythingInToWorkAreaWithTabTipClosed()
{
try
{
foreach (KeyValuePair<FrameworkElement, Storyboard> moveRootVisualStoryboard in MoveRootVisualStoryboards)
{
Window window = moveRootVisualStoryboard.Key as Window;
// if window exist also check if it has not been closed
if (window != null && new WindowInteropHelper(window).Handle != IntPtr.Zero)
MoveRootVisualBy(
rootVisual: window,
moveBy: GetYOffsetToMoveUIElementInToWorkArea(
uiElementRectangle: GetWindowRectangle(window),
workAreaRectangle: GetWorkAreaWithTabTipClosed(window)));
else
MoveRootVisualTo(rootVisual: moveRootVisualStoryboard.Key, moveTo: 0);
}
}
catch (Exception ex)
{
ExceptionCatched?.Invoke(ex);
}
}
}
}

View File

@ -0,0 +1,40 @@
using Microsoft.Win32;
namespace DM_Weight.util.TabTip
{
internal enum OSVersion
{
Undefined,
Win7,
Win8Or81,
Win10
}
internal static class EnvironmentEx
{
private static OSVersion OSVersion = OSVersion.Undefined;
internal static OSVersion GetOSVersion()
{
if (OSVersion != OSVersion.Undefined)
return OSVersion;
string OSName = GetOSName();
if (OSName.Contains("7"))
OSVersion = OSVersion.Win7;
else if (OSName.Contains("8"))
OSVersion = OSVersion.Win8Or81;
else if (OSName.Contains("10"))
OSVersion = OSVersion.Win10;
return OSVersion;
}
private static string GetOSName()
{
RegistryKey rk = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Microsoft\Windows NT\CurrentVersion");
if (rk == null) return "";
return (string) rk.GetValue("ProductName");
}
}
}

View File

@ -0,0 +1,111 @@
using System.Collections.Generic;
using System.Linq;
using System.Management;
using System.Threading.Tasks;
namespace DM_Weight.util.TabTip
{
public enum HardwareKeyboardIgnoreOptions
{
/// <summary>
/// Do not ignore any keyboard.
/// </summary>
DoNotIgnore,
/// <summary>
/// Ignore keyboard, if there is only one, and it's description
/// can be found in ListOfKeyboardsToIgnore.
/// </summary>
IgnoreIfSingleInstanceOnList,
/// <summary>
/// Ignore keyboard, if there is only one.
/// </summary>
IgnoreIfSingleInstance,
/// <summary>
/// Ignore all keyboards for which the description
/// can be found in ListOfKeyboardsToIgnore
/// </summary>
IgnoreIfOnList,
/// <summary>
/// Ignore all keyboards
/// </summary>
IgnoreAll
}
internal static class HardwareKeyboard
{
private static bool? _isConnected;
/// <summary>
/// Checks if Hardware Keyboard is Connected
/// </summary>
/// <returns></returns>
internal static async Task<bool> IsConnectedAsync()
{
Task<bool> KeyboardConnectedCheckTask = Task.Run(() =>
{
SelectQuery SelectKeyboardsQuery = new SelectQuery("Win32_Keyboard");
using (ManagementObjectSearcher Searcher = new ManagementObjectSearcher(SelectKeyboardsQuery))
using (ManagementObjectCollection Keyboards = Searcher.Get())
{
if (Keyboards.Count == 0)
return false;
switch (IgnoreOptions)
{
case HardwareKeyboardIgnoreOptions.IgnoreAll:
return false;
case HardwareKeyboardIgnoreOptions.DoNotIgnore:
return Keyboards.Count > 0;
case HardwareKeyboardIgnoreOptions.IgnoreIfSingleInstance:
return Keyboards.Count > 1;
case HardwareKeyboardIgnoreOptions.IgnoreIfSingleInstanceOnList:
return (Keyboards.Count > 1) ||
(Keyboards.Count == 1 &&
!IsIgnoredKeyboard(Keyboards.Cast<ManagementBaseObject>().First()));
case HardwareKeyboardIgnoreOptions.IgnoreIfOnList:
return Keyboards.Cast<ManagementBaseObject>().Any(k => !IsIgnoredKeyboard(k));
default:
return true;
}
}
});
#pragma warning disable 4014
KeyboardConnectedCheckTask.ContinueWith(t => _isConnected = t.Result);
#pragma warning restore 4014
if (_isConnected != null)
return _isConnected.Value;
else
return await KeyboardConnectedCheckTask;
}
private static bool IsIgnoredKeyboard(ManagementBaseObject keyboard)
{
string description = keyboard.Properties.Cast<PropertyData>()
.Where(k => k.Name == "Description")
.Select(k => k.Value)
.First()
.ToString();
return ListOfKeyboardsToIgnore.Contains(description);
}
internal static HardwareKeyboardIgnoreOptions IgnoreOptions = HardwareKeyboardIgnoreOptions.DoNotIgnore;
/// <summary>
/// Description of keyboards to ignore if there is only one instance of given keyboard.
/// If you want to ignore some ghost keyboard, add it's description to this list
/// </summary>
internal static List<string> ListOfKeyboardsToIgnore { get; } = new List<string>();
}
}

View File

@ -0,0 +1,26 @@
using System;
using System.Reactive.Linq;
namespace DM_Weight.util.TabTip
{
internal static class PoolingTimer
{
private static bool Pooling;
internal static void PoolUntilTrue(Func<bool> PoolingFunc, Action Callback, TimeSpan dueTime, TimeSpan period)
{
if (Pooling) return;
Pooling = true;
Observable.Timer(dueTime, period)
.Select(_ => PoolingFunc())
.TakeWhile(stop => stop != true)
.Where(stop => stop == true)
.Finally(() => Pooling = false)
.Subscribe(
onNext: _ => { },
onCompleted: Callback);
}
}
}

View File

@ -0,0 +1,101 @@
using System;
using System.Drawing;
using System.Runtime.InteropServices;
using System.Windows;
using System.Windows.Interop;
namespace DM_Weight.util.TabTip
{
internal class Screen
{
public Rectangle Bounds { get; }
public Screen(Window window)
{
IntPtr windowHandle = window != null ? new WindowInteropHelper(window).Handle : IntPtr.Zero;
IntPtr monitor = window != null ? NativeMethods.MonitorFromWindow(windowHandle, NativeMethods.MONITOR_DEFAULTTONEAREST) : NativeMethods.MonitorFromPoint(new NativeMethods.POINT(0, 0), NativeMethods.MonitorOptions.MONITOR_DEFAULTTOPRIMARY);
NativeMethods.NativeMonitorInfo monitorInfo = new NativeMethods.NativeMonitorInfo();
NativeMethods.GetMonitorInfo(monitor, monitorInfo);
Bounds = Rectangle.FromLTRB(monitorInfo.Monitor.Left, monitorInfo.Monitor.Top, monitorInfo.Monitor.Right, monitorInfo.Monitor.Bottom);
}
private static class NativeMethods
{
public const Int32 MONITOR_DEFAULTTONEAREST = 0x00000002;
[DllImport("user32.dll")]
public static extern IntPtr MonitorFromWindow(IntPtr handle, Int32 flags);
[DllImport("user32.dll")]
public static extern bool GetMonitorInfo(IntPtr hMonitor, NativeMonitorInfo lpmi);
[Serializable, StructLayout(LayoutKind.Sequential)]
public struct NativeRectangle
{
public readonly int Left;
public readonly int Top;
public readonly int Right;
public readonly int Bottom;
}
[StructLayout(LayoutKind.Sequential)]
public struct POINT
{
public int X;
public int Y;
public POINT(int x, int y)
{
this.X = x;
this.Y = y;
}
public POINT(System.Drawing.Point pt) : this(pt.X, pt.Y) { }
public static implicit operator System.Drawing.Point(POINT p)
{
return new System.Drawing.Point(p.X, p.Y);
}
public static implicit operator POINT(System.Drawing.Point p)
{
return new POINT(p.X, p.Y);
}
}
[DllImport("user32.dll", SetLastError = true)]
internal static extern IntPtr MonitorFromPoint(POINT pt, MonitorOptions dwFlags);
internal enum MonitorOptions : uint
{
MONITOR_DEFAULTTONULL = 0x00000000,
MONITOR_DEFAULTTOPRIMARY = 0x00000001,
MONITOR_DEFAULTTONEAREST = 0x00000002
}
#pragma warning disable 169
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)]
public sealed class NativeMonitorInfo
{
// ReSharper disable once UnusedMember.Local
public Int32 Size = Marshal.SizeOf(typeof(NativeMonitorInfo));
#pragma warning disable 649
public NativeRectangle Monitor;
#pragma warning restore 649
public NativeRectangle Work;
public Int32 Flags;
}
#pragma warning restore 169
}
}
}

View File

@ -0,0 +1,166 @@
using System;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.Drawing;
using System.Runtime.InteropServices;
using System.Threading.Tasks;
using Microsoft.Win32;
namespace DM_Weight.util.TabTip
{
public static class TabTip
{
private const string TabTipWindowClassName = "IPTip_Main_Window";
private const string TabTipExecPath = @"C:\Program Files\Common Files\microsoft shared\ink\TabTip.exe";
private const string TabTipRegistryKeyName = @"HKEY_CURRENT_USER\Software\Microsoft\TabletTip\1.7";
[DllImport("user32.dll")]
private static extern int SendMessage(int hWnd, uint msg, int wParam, int lParam);
[DllImport("user32.dll")]
private static extern IntPtr FindWindow(String sClassName, String sAppName);
[DllImport("user32.dll")]
[return: MarshalAs(UnmanagedType.Bool)]
private static extern bool GetWindowRect(HandleRef hWnd, out RECT lpRect);
[StructLayout(LayoutKind.Sequential)]
private struct RECT
{
public readonly int Left; // x position of upper-left corner
public readonly int Top; // y position of upper-left corner
public readonly int Right; // x position of lower-right corner
public readonly int Bottom; // y position of lower-right corner
}
[DllImport("user32.dll", SetLastError = true)]
private static extern UInt32 GetWindowLong(IntPtr hWnd, int nIndex);
/// <summary>
/// Signals that TabTip was closed after it was opened
/// with a call to StartPoolingForTabTipClosedEvent method
/// </summary>
internal static event Action Closed;
private static IntPtr GetTabTipWindowHandle() => FindWindow(TabTipWindowClassName, null);
internal static void OpenUndockedAndStartPoolingForClosedEvent()
{
OpenUndocked();
StartPoolingForTabTipClosedEvent();
}
/// <summary>
/// Open TabTip
/// </summary>
public static void Open()
{
if (EnvironmentEx.GetOSVersion() == OSVersion.Win10)
EnableTabTipOpenInDesctopModeOnWin10();
Process.Start(new ProcessStartInfo(TabTipExecPath) { UseShellExecute = true});
}
private static void EnableTabTipOpenInDesctopModeOnWin10()
{
const string TabTipAutoInvokeKey = "EnableDesktopModeAutoInvoke";
int EnableDesktopModeAutoInvoke = (int) (Registry.GetValue(TabTipRegistryKeyName, TabTipAutoInvokeKey, -1) ?? -1);
if (EnableDesktopModeAutoInvoke != 1)
Registry.SetValue(TabTipRegistryKeyName, TabTipAutoInvokeKey, 1);
}
/// <summary>
/// Open TabTip in undocked state
/// </summary>
public static void OpenUndocked()
{
const string TabTipDockedKey = "EdgeTargetDockedState";
const string TabTipProcessName = "TabTip";
int docked = (int) (Registry.GetValue(TabTipRegistryKeyName, TabTipDockedKey, 1) ?? 1);
if (docked == 1)
{
Registry.SetValue(TabTipRegistryKeyName, TabTipDockedKey, 0);
foreach (Process tabTipProcess in Process.GetProcessesByName(TabTipProcessName))
tabTipProcess.Kill();
}
Open();
}
/// <summary>
/// Close TabTip
/// </summary>
public static void Close()
{
const int WM_SYSCOMMAND = 274;
const int SC_CLOSE = 61536;
SendMessage(GetTabTipWindowHandle().ToInt32(), WM_SYSCOMMAND, SC_CLOSE, 0);
}
private static void StartPoolingForTabTipClosedEvent()
{
PoolingTimer.PoolUntilTrue(
PoolingFunc: TabTipClosed,
Callback: () => Closed?.Invoke(),
dueTime: TimeSpan.FromMilliseconds(700),
period: TimeSpan.FromMilliseconds(50));
}
private static bool TabTipClosed()
{
const int GWL_STYLE = -16; // Specifies we wish to retrieve window styles.
const uint KeyboardClosedStyle = 2617245696;
IntPtr KeyboardWnd = GetTabTipWindowHandle();
return (KeyboardWnd.ToInt32() == 0 || GetWindowLong(KeyboardWnd, GWL_STYLE) == KeyboardClosedStyle);
}
// ReSharper disable once UnusedMember.Local
private static bool IsTabTipProcessRunning => GetTabTipWindowHandle() != IntPtr.Zero;
/// <summary>
/// Gets TabTip Window Rectangle
/// </summary>
/// <returns></returns>
[SuppressMessage("ReSharper", "ConvertIfStatementToReturnStatement")]
public static Rectangle GetTabTipRectangle()
{
if (TabTipClosed())
return new Rectangle();
return GetWouldBeTabTipRectangle();
}
private static Rectangle previousTabTipRectangle;
/// <summary>
/// Gets Window Rectangle which would be occupied by TabTip if TabTip was opened.
/// </summary>
/// <returns></returns>
[SuppressMessage("ReSharper", "ConvertIfStatementToReturnStatement")]
internal static Rectangle GetWouldBeTabTipRectangle()
{
RECT rect;
if (!GetWindowRect(new HandleRef(null, GetTabTipWindowHandle()), out rect))
{
if (previousTabTipRectangle.Equals(new Rectangle())) //in case TabTip was closed and previousTabTipRectangle was not set
Task.Delay(TimeSpan.FromSeconds(1)).ContinueWith(TryGetTabTipRectangleToСache);
return previousTabTipRectangle;
}
Rectangle wouldBeTabTipRectangle = new Rectangle(x: rect.Left, y: rect.Top, width: rect.Right - rect.Left + 1, height: rect.Bottom - rect.Top + 1);
previousTabTipRectangle = wouldBeTabTipRectangle;
return wouldBeTabTipRectangle;
}
private static void TryGetTabTipRectangleToСache(Task task)
{
RECT rect;
if (GetWindowRect(new HandleRef(null, GetTabTipWindowHandle()), out rect))
previousTabTipRectangle = new Rectangle(x: rect.Left, y: rect.Top, width: rect.Right - rect.Left + 1, height: rect.Bottom - rect.Top + 1);
}
}
}

View File

@ -0,0 +1,121 @@
using System;
using System.Collections.Generic;
using System.Reactive.Concurrency;
using System.Reactive.Linq;
using System.Reactive.Subjects;
using System.Windows;
namespace DM_Weight.util.TabTip
{
public static class TabTipAutomation
{
static TabTipAutomation()
{
if (EnvironmentEx.GetOSVersion() == OSVersion.Win7)
return;
TabTip.Closed += () => TabTipClosedSubject.OnNext(true);
AutomateTabTipOpen(FocusSubject.AsObservable());
AutomateTabTipClose(FocusSubject.AsObservable(), TabTipClosedSubject);
AnimationHelper.ExceptionCatched += exception => ExceptionCatched?.Invoke(exception);
}
private static readonly Subject<Tuple<UIElement, bool>> FocusSubject = new Subject<Tuple<UIElement, bool>>();
private static readonly Subject<bool> TabTipClosedSubject = new Subject<bool>();
private static readonly List<Type> BindedUIElements = new List<Type>();
/// <summary>
/// By default TabTip automation happens only when no keyboard is connected to device.
/// Change IgnoreHardwareKeyboard if you want to automate
/// TabTip even if keyboard is connected.
/// </summary>
public static HardwareKeyboardIgnoreOptions IgnoreHardwareKeyboard
{
get { return HardwareKeyboard.IgnoreOptions; }
set { HardwareKeyboard.IgnoreOptions = value; }
}
/// <summary>
/// Subscribe to this event if you want to know about exceptions (errors) in this library
/// </summary>
public static event Action<Exception> ExceptionCatched;
/// <summary>
/// Description of keyboards to ignore if there is only one instance of given keyboard.
/// If you want to ignore some ghost keyboard, add it's description to this list
/// </summary>
public static List<string> ListOfHardwareKeyboardsToIgnoreIfSingleInstance => HardwareKeyboard.ListOfKeyboardsToIgnore;
/// <summary>
/// Description of keyboards to ignore.
/// If you want to ignore some ghost keyboard, add it's description to this list
/// </summary>
public static List<string> ListOfKeyboardsToIgnore => HardwareKeyboard.ListOfKeyboardsToIgnore;
private static void AutomateTabTipClose(IObservable<Tuple<UIElement, bool>> focusObservable, Subject<bool> tabTipClosedSubject)
{
focusObservable
.ObserveOn(Scheduler.Default)
.Where(_ => IgnoreHardwareKeyboard == HardwareKeyboardIgnoreOptions.IgnoreAll || !HardwareKeyboard.IsConnectedAsync().Result)
.Throttle(TimeSpan.FromMilliseconds(100)) // Close only if no other UIElement got focus in 100 ms
.Where(tuple => tuple.Item2 == false)
.Do(_ => TabTip.Close())
.Subscribe(_ => tabTipClosedSubject.OnNext(true));
tabTipClosedSubject
.Subscribe(_ => AnimationHelper.GetEverythingInToWorkAreaWithTabTipClosed());
}
private static void AutomateTabTipOpen(IObservable<Tuple<UIElement, bool>> focusObservable)
{
focusObservable
.ObserveOn(Scheduler.Default)
.Where(_ => IgnoreHardwareKeyboard == HardwareKeyboardIgnoreOptions.IgnoreAll || !HardwareKeyboard.IsConnectedAsync().Result)
.Where(tuple => tuple.Item2 == true)
.Do(_ => TabTip.OpenUndockedAndStartPoolingForClosedEvent())
.Subscribe(tuple => AnimationHelper.GetUIElementInToWorkAreaWithTabTipOpened(tuple.Item1));
}
/// <summary>
/// Automate TabTip for given UIElement.
/// Keyboard opens on GotFocusEvent or TouchDownEvent (if focused already)
/// and closes on LostFocusEvent.
/// </summary>
/// <typeparam name="T"></typeparam>
public static void BindTo<T>() where T : UIElement
{
if (EnvironmentEx.GetOSVersion() == OSVersion.Win7)
return;
if (BindedUIElements.Contains(typeof(T)))
return;
EventManager.RegisterClassHandler(
classType: typeof(T),
routedEvent: UIElement.TouchDownEvent,
handler: new RoutedEventHandler((s, e) =>
{
if (((UIElement)s).IsFocused)
FocusSubject.OnNext(new Tuple<UIElement, bool>((UIElement)s, true));
}),
handledEventsToo: true);
EventManager.RegisterClassHandler(
classType: typeof(T),
routedEvent: UIElement.GotFocusEvent,
handler: new RoutedEventHandler((s, e) => FocusSubject.OnNext(new Tuple<UIElement, bool>((UIElement) s, true))),
handledEventsToo: true);
EventManager.RegisterClassHandler(
classType: typeof(T),
routedEvent: UIElement.LostFocusEvent,
handler: new RoutedEventHandler((s, e) => FocusSubject.OnNext(new Tuple<UIElement, bool>((UIElement) s, false))),
handledEventsToo: true);
BindedUIElements.Add(typeof(T));
}
}
}

View File

@ -0,0 +1,132 @@
using System;
using System.Drawing;
using System.Runtime.InteropServices;
namespace DM_Weight.util.TabTip
{
internal enum TaskbarPosition
{
Unknown = -1,
Left,
Top,
Right,
Bottom,
}
internal sealed class Taskbar
{
private const string ClassName = "Shell_TrayWnd";
public Rectangle Bounds { get; }
public TaskbarPosition Position
{
get;
private set;
}
public Point Location => Bounds.Location;
public Size Size => Bounds.Size;
//Always returns false under Windows 7
public bool AlwaysOnTop
{
get;
private set;
}
public bool AutoHide
{
get;
private set;
}
public Taskbar()
{
IntPtr taskbarHandle = User32.FindWindow(ClassName, null);
APPBARDATA data = new APPBARDATA
{
cbSize = (uint) Marshal.SizeOf(typeof (APPBARDATA)),
hWnd = taskbarHandle
};
IntPtr result = Shell32.SHAppBarMessage(ABM.GetTaskbarPos, ref data);
if (result != IntPtr.Zero)
{
Position = (TaskbarPosition) data.uEdge;
Bounds = Rectangle.FromLTRB(data.rc.left, data.rc.top, data.rc.right, data.rc.bottom);
data.cbSize = (uint) Marshal.SizeOf(typeof(APPBARDATA));
result = Shell32.SHAppBarMessage(ABM.GetState, ref data);
int state = result.ToInt32();
AlwaysOnTop = (state & ABS.AlwaysOnTop) == ABS.AlwaysOnTop;
AutoHide = (state & ABS.Autohide) == ABS.Autohide;
}
else
{
Position = TaskbarPosition.Unknown;
}
}
private enum ABM : uint
{
New = 0x00000000,
Remove = 0x00000001,
QueryPos = 0x00000002,
SetPos = 0x00000003,
GetState = 0x00000004,
GetTaskbarPos = 0x00000005,
Activate = 0x00000006,
GetAutoHideBar = 0x00000007,
SetAutoHideBar = 0x00000008,
WindowPosChanged = 0x00000009,
SetState = 0x0000000A,
}
private enum ABE : uint
{
Left = 0,
Top = 1,
Right = 2,
Bottom = 3
}
private static class ABS
{
public const int Autohide = 0x0000001;
public const int AlwaysOnTop = 0x0000002;
}
private static class Shell32
{
[DllImport("shell32.dll", SetLastError = true)]
public static extern IntPtr SHAppBarMessage(ABM dwMessage, [In] ref APPBARDATA pData);
}
private static class User32
{
[DllImport("user32.dll", SetLastError = true)]
public static extern IntPtr FindWindow(string lpClassName, string lpWindowName);
}
[StructLayout(LayoutKind.Sequential)]
private struct APPBARDATA
{
public uint cbSize;
public IntPtr hWnd;
public uint uCallbackMessage;
public ABE uEdge;
public RECT rc;
public int lParam;
}
[StructLayout(LayoutKind.Sequential)]
private struct RECT
{
public int left;
public int top;
public int right;
public int bottom;
}
}
}

View File

@ -0,0 +1,41 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using System.Threading.Tasks;
namespace DM_Weight.util
{
public static class TransExpV2<TIn, TOut>
{
private static readonly Func<TIn, TOut> cache = GetFunc();
private static Func<TIn, TOut> GetFunc()
{
ParameterExpression parameterExpression = Expression.Parameter(typeof(TIn), "p");
List<MemberBinding> memberBindingList = new List<MemberBinding>();
foreach (var item in typeof(TOut).GetProperties())
{
if (!item.CanWrite)
continue;
MemberExpression property = Expression.Property(parameterExpression, typeof(TIn).GetProperty(item.Name));
MemberBinding memberBinding = Expression.Bind(item, property);
memberBindingList.Add(memberBinding);
}
MemberInitExpression memberInitExpression = Expression.MemberInit(Expression.New(typeof(TOut)), memberBindingList.ToArray());
Expression<Func<TIn, TOut>> lambda = Expression.Lambda<Func<TIn, TOut>>(memberInitExpression, new ParameterExpression[] { parameterExpression });
return lambda.Compile();
}
public static TOut Trans(TIn tIn)
{
return cache(tIn);
}
}
}

View File

@ -0,0 +1,23 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0-windows</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<IsPackable>false</IsPackable>
<IsTestProject>true</IsTestProject>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.5.0" />
<PackageReference Include="MSTest.TestAdapter" Version="2.2.10" />
<PackageReference Include="MSTest.TestFramework" Version="2.2.10" />
<PackageReference Include="coverlet.collector" Version="3.2.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\DM_Weight\DM_Weight.csproj" />
</ItemGroup>
</Project>

View File

@ -0,0 +1,12 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DM_WeightTests.Port
{
internal class ScreenUtilTests
{
}
}

1
说明.txt Normal file
View File

@ -0,0 +1 @@
2麻醉科手术室共8个抽屉其中4个抽屉为九分区管控式抽屉无按钮、取药进行亮灯提示剩下4个抽屉每个抽屉面板上方有3个电子标签有按钮、取药进行亮灯提示显示对应储药区的药品名称、数量、批次等信息。计数回收毒麻药品固定在华康毒麻柜侧面抽屉式。一套有3个回收口最多回收3种空瓶。