diff --git a/DM_Weight.Commons/DM_Weight.Commons.csproj b/DM_Weight.Commons/DM_Weight.Commons.csproj
new file mode 100644
index 0000000..467963e
--- /dev/null
+++ b/DM_Weight.Commons/DM_Weight.Commons.csproj
@@ -0,0 +1,13 @@
+
+
+
+ net6.0-windows
+ enable
+ true
+
+
+
+
+
+
+
diff --git a/DM_Weight.Commons/ValidatRules/ValidationErrorMappingBehavior.cs b/DM_Weight.Commons/ValidatRules/ValidationErrorMappingBehavior.cs
new file mode 100644
index 0000000..fce3c87
--- /dev/null
+++ b/DM_Weight.Commons/ValidatRules/ValidationErrorMappingBehavior.cs
@@ -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
+ {
+ #region Properties
+
+ public static readonly DependencyProperty ValidationErrorsProperty =
+ DependencyProperty.Register("ValidationErrors", typeof(ObservableCollection),
+ typeof(ValidationErrorMappingBehavior), new PropertyMetadata(new ObservableCollection()));
+
+ public ObservableCollection ValidationErrors
+ {
+ get { return (ObservableCollection)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
+ }
+}
diff --git a/DM_Weight.sln b/DM_Weight.sln
new file mode 100644
index 0000000..1e50fcf
--- /dev/null
+++ b/DM_Weight.sln
@@ -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("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "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 = Debug|Any CPU
+ {439FA76B-F874-40DB-BAF2-E3647CD55B10}.Release|Any CPU.Build.0 = Debug|Any CPU
+ {439FA76B-F874-40DB-BAF2-E3647CD55B10}.Release|x64.ActiveCfg = Release|x64
+ {439FA76B-F874-40DB-BAF2-E3647CD55B10}.Release|x64.Build.0 = Release|x64
+ {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
diff --git a/DM_Weight/App.config b/DM_Weight/App.config
new file mode 100644
index 0000000..3969b3e
--- /dev/null
+++ b/DM_Weight/App.config
@@ -0,0 +1,129 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/DM_Weight/App.xaml b/DM_Weight/App.xaml
new file mode 100644
index 0000000..704fc50
--- /dev/null
+++ b/DM_Weight/App.xaml
@@ -0,0 +1,19 @@
+
+
+
+
+
+
+
+
+
+
+
diff --git a/DM_Weight/App.xaml.cs b/DM_Weight/App.xaml.cs
new file mode 100644
index 0000000..f1d140d
--- /dev/null
+++ b/DM_Weight/App.xaml.cs
@@ -0,0 +1,338 @@
+using DM_Weight.Finger;
+using DM_Weight.Port;
+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.IO;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Controls;
+using Prism.Unity;
+using log4net;
+using System.Runtime.InteropServices;
+using System.Diagnostics;
+
+namespace DM_Weight
+{
+ ///
+ /// Interaction logic for App.xaml
+ ///
+ public partial class App : PrismApplication
+ {
+ private readonly ILog logger = LogManager.GetLogger(typeof(App));
+ public App()
+ {
+ TabTipAutomation.IgnoreHardwareKeyboard = HardwareKeyboardIgnoreOptions.IgnoreAll;
+ TabTipAutomation.BindTo();
+ TabTipAutomation.BindTo();
+ }
+
+
+
+ protected override Window CreateShell()
+ {
+ logger.Info("进入APP-CreateShell");
+ //UI线程未捕获异常处理事件
+ this.DispatcherUnhandledException += OnDispatcherUnhandledException;
+ //Task线程内未捕获异常处理事件
+ TaskScheduler.UnobservedTaskException += OnUnobservedTaskException;
+ //多线程异常
+ AppDomain.CurrentDomain.UnhandledException += OnUnhandledException;
+
+ logger.Info("进入APP-CreateShell-2");
+ return Container.Resolve();
+ }
+
+ 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)
+ {
+
+ logger.Info("进入APP-RegisterTypes");
+ // 注入日志
+ XmlConfigurator.ConfigureAndWatch(new FileInfo(AppDomain.CurrentDomain.BaseDirectory + "log4net.config"));
+ //containerRegistry.RegisterInstance(LogManager.GetLogger(""));
+
+ // 串口工具
+ containerRegistry.RegisterSingleton();
+ containerRegistry.RegisterSingleton();
+ // 指纹机工具
+ containerRegistry.RegisterSingleton();
+ // 组态屏工具
+ //containerRegistry.RegisterSingleton();
+ // 录像机
+ //containerRegistry.RegisterSingleton();
+
+ containerRegistry.Register();
+
+ // 主窗口
+ containerRegistry.Register();
+ containerRegistry.RegisterForNavigation();
+
+ // 分页
+ //containerRegistry.Register();
+ //containerRegistry.Register();
+
+ // 登录页面
+ containerRegistry.RegisterForNavigation();
+
+ // 布局页面
+ containerRegistry.RegisterForNavigation();
+
+ // 录入指纹模态框
+ containerRegistry.RegisterDialog();
+ containerRegistry.RegisterForNavigation();
+
+
+ #region 取药
+ // 处方取药页面
+ //containerRegistry.RegisterForNavigation();
+
+
+ //containerRegistry.RegisterForNavigation();
+ //containerRegistry.RegisterForNavigation();
+ //containerRegistry.RegisterForNavigation();
+ ////交接柜补药
+ //containerRegistry.RegisterForNavigation();
+
+ // 处方取药模态框
+ //containerRegistry.RegisterDialog();
+ //containerRegistry.RegisterForNavigation();
+ //// 调拨取药页面
+ //containerRegistry.RegisterForNavigation();
+ //// 调拨取药模态框
+ //containerRegistry.RegisterDialog();
+ //containerRegistry.RegisterForNavigation();
+ //// 抽屉取药页面
+ //containerRegistry.RegisterForNavigation();
+ //// 自选取药模态框
+ //containerRegistry.RegisterDialog();
+ //containerRegistry.RegisterForNavigation();
+ //// 自选取药页面
+ //containerRegistry.RegisterForNavigation();
+
+ ////多处方取药
+ //containerRegistry.RegisterForNavigation();
+ //containerRegistry.RegisterDialog();
+ //containerRegistry.RegisterForNavigation();
+
+ ////手术排程
+ //containerRegistry.RegisterForNavigation();
+ //containerRegistry.RegisterDialog();
+ //containerRegistry.RegisterForNavigation();
+ //containerRegistry.RegisterDialog();
+ //containerRegistry.RegisterForNavigation();
+ //开药箱
+ containerRegistry.RegisterForNavigation();
+ containerRegistry.RegisterForNavigation();
+ //交接柜补药
+ containerRegistry.RegisterForNavigation();
+ //核对处方
+ //containerRegistry.RegisterForNavigation();
+ //管理员根据药箱进行核对处方
+ containerRegistry.RegisterForNavigation();
+ //麻醉师核对其名下单子
+ containerRegistry.RegisterForNavigation();
+
+
+
+ #endregion
+
+ //#region 加药
+ // 自选加药页面
+ //containerRegistry.RegisterForNavigation();
+ //// 调拨加药页面
+ //containerRegistry.RegisterForNavigation();
+
+ //// 调拨取药模态框
+ //containerRegistry.RegisterDialog();
+ //containerRegistry.RegisterForNavigation();
+ //// 抽屉加药页面
+ //containerRegistry.RegisterForNavigation();
+ //// 自选加药模态框
+ //containerRegistry.RegisterDialog();
+ //containerRegistry.RegisterForNavigation();
+ ////多批次抽屉加药
+ //containerRegistry.RegisterForNavigation();
+ ////药品请领
+ //containerRegistry.RegisterForNavigation();
+ //// 药品请领模态框
+ //containerRegistry.RegisterDialog();
+ //containerRegistry.RegisterForNavigation();
+
+ ////请领列表
+ //containerRegistry.RegisterForNavigation();
+ ////请领入库
+ //containerRegistry.RegisterForNavigation();
+
+ //#endregion
+
+ //#region 还药
+ //// 还药页面
+ //containerRegistry.RegisterForNavigation();
+ //// 按记录归还药品模态框
+ //containerRegistry.RegisterDialog();
+ //containerRegistry.RegisterForNavigation();
+
+ //// 还药页面2
+ //containerRegistry.RegisterForNavigation();
+ //// 按处方归还药品模态框
+ //containerRegistry.RegisterDialog();
+ //containerRegistry.RegisterForNavigation();
+ //// 还空瓶页面
+ //containerRegistry.RegisterForNavigation();
+
+ ////空瓶销毁页面
+ //containerRegistry.RegisterForNavigation();
+
+ //// 归还空瓶模态框
+ //containerRegistry.RegisterDialog();
+ //containerRegistry.RegisterForNavigation();
+ //// 空瓶销毁模态框
+ //containerRegistry.RegisterDialog();
+ //containerRegistry.RegisterForNavigation();
+
+
+ //#endregion
+
+ //#region 库存管理
+ //// 库存列表页面
+ //containerRegistry.RegisterForNavigation();
+ //// 库位绑定模态框
+ //containerRegistry.RegisterDialog();
+ //containerRegistry.RegisterForNavigation();
+ ////同一药品多批次库位绑定
+ //containerRegistry.RegisterForNavigation();
+ //// 库存盘点页面
+ //containerRegistry.RegisterForNavigation();
+ //// 药品列表页面
+ //containerRegistry.RegisterForNavigation();
+
+ ////交接班记录
+ //containerRegistry.RegisterForNavigation();
+ ////交接班弹窗
+ //containerRegistry.RegisterDialog();
+ //containerRegistry.RegisterForNavigation();
+
+ //containerRegistry.RegisterForNavigation();
+ //#endregion
+
+ #region 系统设置
+ // 用户管理页面
+ containerRegistry.RegisterForNavigation();
+ // 编辑用户模态框
+ containerRegistry.RegisterDialog();
+ containerRegistry.RegisterForNavigation();
+ containerRegistry.RegisterDialog();
+ containerRegistry.RegisterForNavigation();
+ // 角色管理页面
+ containerRegistry.RegisterForNavigation();
+ // 系统设置
+ containerRegistry.RegisterForNavigation();
+ // 调试页面
+ //containerRegistry.RegisterForNavigation();
+ //主设置页面
+ containerRegistry.RegisterForNavigation();
+ //两个冰箱抽屉设置页面
+ //containerRegistry.RegisterForNavigation();
+ ////只有一个冰箱抽屉设置页面
+ //containerRegistry.RegisterForNavigation();
+ //药箱绑定
+ containerRegistry.RegisterForNavigation();
+ //药箱设置
+ containerRegistry.RegisterForNavigation();
+
+ //操作记录
+ containerRegistry.RegisterForNavigation();
+ //温湿度记录
+ containerRegistry.RegisterForNavigation();
+
+ containerRegistry.RegisterForNavigation();
+ containerRegistry.RegisterDialog();
+ containerRegistry.RegisterForNavigation();
+ #endregion
+
+ // 设备记录页面
+ //containerRegistry.RegisterForNavigation();
+
+ containerRegistry.RegisterForNavigation();
+
+ logger.Info("结束APP-RegisterTypes");
+
+ }
+
+ private void PrismApplication_Startup(object sender, StartupEventArgs e)
+ {
+ //获取欲启动程序名
+ string processName = System.Diagnostics.Process.GetCurrentProcess().ProcessName;
+ logger.Info($"欲启动程序名:{processName}");
+ //检查程序是否已经启动,已经启动则显示提示退出程序
+ if (System.Diagnostics.Process.GetProcessesByName(processName).Length > 1)
+ {
+
+ logger.Info($"系统在运行!");
+ //系统在运行
+ RaiseOtherProcess();
+ Application.Current.Shutdown();
+ return;
+ }
+ }
+ private static void RaiseOtherProcess()
+ {
+ Process proc = Process.GetCurrentProcess();
+ foreach (Process otherProc in Process.GetProcessesByName(Process.GetCurrentProcess().ProcessName))
+ {
+ if (proc.Id != otherProc.Id)
+ {
+ IntPtr hWnd = otherProc.MainWindowHandle;
+ if (IsIconic(hWnd))
+ {
+ ShowWindowAsync(hWnd, 9);
+ }
+ SetForegroundWindow(hWnd);
+ break;
+ }
+ }
+ }
+ [DllImport("user32.dll")]
+ private static extern bool SetForegroundWindow(IntPtr hWnd);
+ [DllImport("user32.dll")]
+ private static extern bool ShowWindowAsync(IntPtr hWnd, int nCmdShow);
+ [DllImport("user32.dll")]
+ private static extern bool IsIconic(IntPtr hWnd);
+ }
+}
diff --git a/DM_Weight/AssemblyInfo.cs b/DM_Weight/AssemblyInfo.cs
new file mode 100644
index 0000000..8b5504e
--- /dev/null
+++ b/DM_Weight/AssemblyInfo.cs
@@ -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)
+)]
diff --git a/DM_Weight/Common/CRC16MODBUS.cs b/DM_Weight/Common/CRC16MODBUS.cs
new file mode 100644
index 0000000..6384cf7
--- /dev/null
+++ b/DM_Weight/Common/CRC16MODBUS.cs
@@ -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;
+ }
+ }
+}
diff --git a/DM_Weight/Common/CommonClass.cs b/DM_Weight/Common/CommonClass.cs
new file mode 100644
index 0000000..daf7730
--- /dev/null
+++ b/DM_Weight/Common/CommonClass.cs
@@ -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);
+ }
+ }
+}
diff --git a/DM_Weight/Common/PrismManager.cs b/DM_Weight/Common/PrismManager.cs
new file mode 100644
index 0000000..459848b
--- /dev/null
+++ b/DM_Weight/Common/PrismManager.cs
@@ -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
+ {
+ /////
+ ///// 主页面区域,主要呈现登录页及登录后页面
+ /////
+ //public static readonly string MainViewRegionName = "MainContent";
+ ///
+ /// 设置菜单页面跳转,主要呈现设置下子菜单
+ ///
+ public static readonly string SettingViewRegionName = "SettingViewContent";
+ /////
+ ///// 主页面各菜单页
+ /////
+ //public static readonly string HomeViewRegionName = "HomeViewContent";
+ }
+}
diff --git a/DM_Weight/Common/TemperatureRangeRule.cs b/DM_Weight/Common/TemperatureRangeRule.cs
new file mode 100644
index 0000000..111c8b2
--- /dev/null
+++ b/DM_Weight/Common/TemperatureRangeRule.cs
@@ -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);
+ }
+ }
+ }
+}
diff --git a/DM_Weight/Components/pagination/Pagination.xaml b/DM_Weight/Components/pagination/Pagination.xaml
new file mode 100644
index 0000000..8b3eee6
--- /dev/null
+++ b/DM_Weight/Components/pagination/Pagination.xaml
@@ -0,0 +1,43 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/DM_Weight/Components/pagination/Pagination.xaml.cs b/DM_Weight/Components/pagination/Pagination.xaml.cs
new file mode 100644
index 0000000..3b404f6
--- /dev/null
+++ b/DM_Weight/Components/pagination/Pagination.xaml.cs
@@ -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
+{
+ ///
+ /// Pagination.xaml 的交互逻辑
+ ///
+ 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 DefaultPageSizeList = new List { 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 + "";
+ });
+
+ }
+
+ }
+}
diff --git a/DM_Weight/Components/pagination/PaginationViewModel.cs b/DM_Weight/Components/pagination/PaginationViewModel.cs
new file mode 100644
index 0000000..00a7f0b
--- /dev/null
+++ b/DM_Weight/Components/pagination/PaginationViewModel.cs
@@ -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;
+ });
+ }
+
+
+ }
+}
diff --git a/DM_Weight/Converter/AddUnitConverter.cs b/DM_Weight/Converter/AddUnitConverter.cs
new file mode 100644
index 0000000..ba3eea9
--- /dev/null
+++ b/DM_Weight/Converter/AddUnitConverter.cs
@@ -0,0 +1,31 @@
+using DM_Weight.Models;
+using DM_Weight.util;
+using System;
+using System.Collections.Generic;
+using System.Globalization;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Data;
+
+namespace DM_Weight.Converter
+{
+ public class AddUnitConverter : IValueConverter
+ {
+ public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
+ {
+ int val = int.Parse(value.ToString());
+ if (val <= 0)
+ {
+ return "";
+ }
+ string userName = SqlSugarHelper.Db.Queryable().Where(ul => ul.Id == val).Select(ul => new { ul.Nickname }).First().Nickname;
+ return userName;
+ }
+
+ public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
+ {
+ throw new NotImplementedException();
+ }
+ }
+}
diff --git a/DM_Weight/Converter/ApplyListConverter.cs b/DM_Weight/Converter/ApplyListConverter.cs
new file mode 100644
index 0000000..042d543
--- /dev/null
+++ b/DM_Weight/Converter/ApplyListConverter.cs
@@ -0,0 +1,91 @@
+using DM_Weight.Models;
+using DM_Weight.util;
+using System;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.Configuration;
+using System.Globalization;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Data;
+
+namespace DM_Weight.Converter
+{
+ ///
+ /// 请领列表页面状态转换
+ ///
+ public class ApplyListConverter : IValueConverter
+ {
+
+ public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
+ {
+ //用户名
+ if (parameter.ToString().Equals("UserId"))
+ {
+ int val = int.Parse(value.ToString());
+ if (val <= 0)
+ {
+ return "";
+ }
+ string userName = SqlSugarHelper.Db.Queryable().Where(ul => ul.Id == val).Select(ul => new { ul.Nickname }).First().Nickname;
+ return userName;
+ }
+ //请领单状态
+ if (parameter.ToString().Equals("PleaseStatus"))
+ {
+ int val = int.Parse(value.ToString());
+ string retStr = "状态:";
+ switch (val)
+ {
+ case 0:
+ return retStr + "已创建";
+ case 1:
+ return retStr + "审核通过";
+ case 2:
+ return retStr + "已出库";
+ case 3:
+ return retStr + "已入库";
+ default:
+ return retStr + "状态未知";
+ }
+ }
+ //处方状态
+ if (parameter.ToString().Equals("OrderStatus"))
+ {
+ int val = int.Parse(value.ToString());
+ switch (val)
+ {
+ case 0:
+ return "已申请";
+ case 1:
+ return "已接收";
+ case 2:
+ return "已退回";
+ default:
+ return "状态未知";
+ }
+ }
+ //请领药库
+ if (parameter.ToString().Equals("machineId"))
+ {
+ string val = value.ToString();
+ string[] colloctedId = ConfigurationManager.AppSettings["colloctedId"].Split(',');
+ if (Array.IndexOf(colloctedId, val)>0)
+ {
+ return colloctedId[Array.IndexOf(colloctedId, val) - 1].ToString();
+ }
+ else
+ {
+ return "未知";
+ }
+ }
+ return "";
+ }
+
+ public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
+ {
+ throw new NotImplementedException();
+ }
+ }
+}
diff --git a/DM_Weight/Converter/BoardTypeConverter.cs b/DM_Weight/Converter/BoardTypeConverter.cs
new file mode 100644
index 0000000..54e5382
--- /dev/null
+++ b/DM_Weight/Converter/BoardTypeConverter.cs
@@ -0,0 +1,106 @@
+using System;
+using System.Collections.Generic;
+using System.Globalization;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Data;
+
+namespace DM_Weight.Converter
+{
+ public class BoardTypeConverter : IMultiValueConverter
+ {
+ public object Convert(object[] value, Type targetType, object parameter, CultureInfo culture)
+ {
+ int BoardType = int.Parse(value[0].ToString());
+ int DrawerType = int.Parse(value[1].ToString());
+ switch (BoardType)
+ {
+ case 1:
+ if (DrawerType == 1)
+ {
+ return "物理隔断";
+ }
+ else if(DrawerType == 2)
+ {
+ return "内置回收";
+ }
+ else
+ {
+ return "外置回收";
+ }
+ case 2:
+ if (DrawerType == 1)
+ {
+ return "单支计数";
+ }
+ else if (DrawerType == 2)
+ {
+ return "计数回收(内置)";
+ }
+ else
+ {
+ return "计数回收(外置)";
+ }
+ case 3:
+ if (DrawerType == 1)
+ {
+ return "管控药盒";
+ }
+ else if (DrawerType == 2)
+ {
+ return "药盒回收(内置)";
+ }
+ else
+ {
+ return "外置回收";
+ }
+ case 4:
+ if (DrawerType == 1)
+ {
+ return "储物箱";
+ }
+ else if (DrawerType == 2)
+ {
+ return "内置回收";
+ }
+ else
+ {
+ return "外置回收";
+ }
+ case 5:
+ if (DrawerType == 1)
+ {
+ return "智能显示";
+ }
+ else if (DrawerType == 2)
+ {
+ return "内置回收";
+ }
+ else
+ {
+ return "外置回收";
+ }
+ case 6:
+ if (DrawerType == 1)
+ {
+ return "称重计数";
+ }
+ else if (DrawerType == 2)
+ {
+ return "称重回收(内置)";
+ }
+ else
+ {
+ return "计数回收(外置)";
+ }
+ }
+ return "";
+ }
+
+ public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture)
+ {
+ throw new NotImplementedException();
+ }
+ }
+}
diff --git a/DM_Weight/Converter/BoxNumConverter.cs b/DM_Weight/Converter/BoxNumConverter.cs
new file mode 100644
index 0000000..6143068
--- /dev/null
+++ b/DM_Weight/Converter/BoxNumConverter.cs
@@ -0,0 +1,31 @@
+using SqlSugar.Extensions;
+using System;
+using System.Collections.Generic;
+using System.Globalization;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Data;
+
+namespace DM_Weight.Converter
+{
+ class BoxNumConverter : IValueConverter
+ {
+ public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
+ {
+ if(parameter==null)
+ {
+ return value.ObjToBool();
+ }
+ string str=value.ToString();
+ return !(str == parameter.ToString());
+ }
+
+ public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
+ {
+ throw new NotImplementedException();
+
+ }
+ }
+}
diff --git a/DM_Weight/Converter/DrawerSelectConverter.cs b/DM_Weight/Converter/DrawerSelectConverter.cs
new file mode 100644
index 0000000..c87c7d2
--- /dev/null
+++ b/DM_Weight/Converter/DrawerSelectConverter.cs
@@ -0,0 +1,88 @@
+using System;
+using System.Collections.Generic;
+using System.Globalization;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Data;
+
+namespace DM_Weight.Converter
+{
+ internal class DrawerSelectConverter : IMultiValueConverter
+ {
+ public object Convert(object[] value, Type targetType, object parameter, CultureInfo culture)
+ {
+ //int iLength = value[0].ToString().Length;
+ int iLength = value[0].ToString().IndexOf("号手术间");
+ string StrButtonDrawerNo =value[0].ToString().Substring(0, iLength);
+ int ButtonDrawerNo = -1;
+ switch (StrButtonDrawerNo)
+ {
+ case "一":
+ ButtonDrawerNo = 0;
+ break;
+ case "二":
+ ButtonDrawerNo = 1;
+ break;
+ case "三":
+ ButtonDrawerNo = 2;
+ break;
+ case "四":
+ ButtonDrawerNo = 3;
+ break;
+ case "五":
+ ButtonDrawerNo = 4;
+ break;
+ case "六":
+ ButtonDrawerNo = 5;
+ break;
+ case "七":
+ ButtonDrawerNo = 6;
+ break;
+ case "八":
+ ButtonDrawerNo = 7;
+ break;
+ case "九":
+ ButtonDrawerNo = 8;
+ break;
+ case "十":
+ ButtonDrawerNo = 9;
+ break;
+ case "十一":
+ ButtonDrawerNo = 10;
+ break;
+ case "十二":
+ ButtonDrawerNo = 11;
+ break;
+ case "十三":
+ ButtonDrawerNo = 12;
+ break;
+ case "十四":
+ ButtonDrawerNo = 13;
+ break;
+ case "十五":
+ ButtonDrawerNo = 14;
+ break;
+ case "十六":
+ ButtonDrawerNo = 15;
+ break;
+ case "十七":
+ ButtonDrawerNo = 16;
+ break;
+ case "十八":
+ ButtonDrawerNo = 17;
+ break;
+ default:
+ break;
+ }
+ int SelectedDrawerNo = int.Parse(value[1].ToString());
+ return ButtonDrawerNo == SelectedDrawerNo;
+ }
+
+ public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture)
+ {
+ throw new NotImplementedException();
+ }
+ }
+}
diff --git a/DM_Weight/Converter/ForeColorConverter.cs b/DM_Weight/Converter/ForeColorConverter.cs
new file mode 100644
index 0000000..5c0ea45
--- /dev/null
+++ b/DM_Weight/Converter/ForeColorConverter.cs
@@ -0,0 +1,30 @@
+using System;
+using System.Collections.Generic;
+using System.Globalization;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Data;
+
+namespace DM_Weight.Converter
+{
+ public class ForeColorConverter : IValueConverter
+ {
+ public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
+ {
+ if ((bool)value)
+ {
+ return "#3ECFED";
+ }
+ else
+ {
+ return "#808080";
+ }
+ }
+
+ public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
+ {
+ throw new NotImplementedException();
+ }
+ }
+}
diff --git a/DM_Weight/Converter/GroupSumConverter.cs b/DM_Weight/Converter/GroupSumConverter.cs
new file mode 100644
index 0000000..a328392
--- /dev/null
+++ b/DM_Weight/Converter/GroupSumConverter.cs
@@ -0,0 +1,40 @@
+using System;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.Globalization;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Data;
+using DM_Weight.Models;
+
+namespace DM_Weight.Converter
+{
+ public class GroupSumConverter : IValueConverter
+ {
+ #region 分组组内求和
+
+ public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
+ {
+ var total = 0;
+ // DataGrid分组后对应的组及组内元素CollectionViewGroup.Items 类型是ReadOnlyObservableCollection