Compare commits
	
		
			45 Commits
		
	
	
		
			master
			...
			XiangTan_Ji
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 
							
							
								
								 | 
						66075e96e2 | 
							 | 
					|
| 
							
							
								
								 | 
						9083f525d6 | 
							 | 
					|
| 
							
							
								
								 | 
						8558386d81 | 
							 | 
					|
| 
							
							
								
								 | 
						0ae19f5f44 | 
							 | 
					|
| 
							
							
								
								 | 
						6cb18541ab | 
							 | 
					|
| 
							
							
								
								 | 
						47ff174544 | 
							 | 
					|
| 
							
							
								
								 | 
						150da75771 | 
							 | 
					|
| 
							
							
								
								 | 
						abae0a0d61 | 
							 | 
					|
| 
							
							
								
								 | 
						4768ff39f3 | 
							 | 
					|
| 
							
							
								
								 | 
						7fc43565d0 | 
							 | 
					|
| 
							
							
								
								 | 
						c38bfd09dc | 
							 | 
					|
| 
							
							
								
								 | 
						95ba43ae7e | 
							 | 
					|
| 
							
							
								
								 | 
						5269c94399 | 
							 | 
					|
| 
							
							
								
								 | 
						804643d035 | 
							 | 
					|
| 
							
							
								
								 | 
						7c69b1dee2 | 
							 | 
					|
| 
							
							
								
								 | 
						e346203c96 | 
							 | 
					|
| 
							
							
								
								 | 
						9539e2b96c | 
							 | 
					|
| 
							
							
								
								 | 
						f207c264d4 | 
							 | 
					|
| 
							
							
								
								 | 
						a3eb3a702f | 
							 | 
					|
| 
							
							
								
								 | 
						5f021e8a3d | 
							 | 
					|
| 
							
							
								
								 | 
						99e99ae3b7 | 
							 | 
					|
| 
							
							
								
								 | 
						59bafb0b61 | 
							 | 
					|
| 
							
							
								
								 | 
						70988ee45f | 
							 | 
					|
| 
							
							
								
								 | 
						f0bd040f95 | 
							 | 
					|
| 
							
							
								
								 | 
						344c70eec2 | 
							 | 
					|
| 
							
							
								
								 | 
						7027494352 | 
							 | 
					|
| 
							
							
								
								 | 
						58174569e9 | 
							 | 
					|
| 
							
							
								
								 | 
						baf0747a74 | 
							 | 
					|
| 
							
							
								
								 | 
						f824236252 | 
							 | 
					|
| 
							
							
								
								 | 
						5682e11660 | 
							 | 
					|
| 
							
							
								
								 | 
						97287feb39 | 
							 | 
					|
| 
							
							
								
								 | 
						b7a395871d | 
							 | 
					|
| 
							
							
								
								 | 
						465b21a32c | 
							 | 
					|
| 
							
							
								
								 | 
						948f91212c | 
							 | 
					|
| 
							
							
								
								 | 
						091be0ac37 | 
							 | 
					|
| 
							
							
								
								 | 
						c93ecbfb51 | 
							 | 
					|
| 
							
							
								
								 | 
						aa660eb5c0 | 
							 | 
					|
| 
							
							
								
								 | 
						433d01ab24 | 
							 | 
					|
| 
							
							
								
								 | 
						042a587afb | 
							 | 
					|
| 
							
							
								
								 | 
						abf30e2da0 | 
							 | 
					|
| 
							
							
								
								 | 
						ba1bd98164 | 
							 | 
					|
| 
							
							
								
								 | 
						ae6744b47f | 
							 | 
					|
| 
							
							
								
								 | 
						9eeae56e0e | 
							 | 
					|
| 
							
							
								
								 | 
						46c767b3d0 | 
							 | 
					|
| 
							
							
								
								 | 
						65cd5f2460 | 
							 | 
					
| 
						 | 
				
			
			@ -361,3 +361,4 @@ MigrationBackup/
 | 
			
		|||
 | 
			
		||||
# Fody - auto-generated XML schema
 | 
			
		||||
FodyWeavers.xsd
 | 
			
		||||
/湘乡冰箱005温控器-Modbus-V2.0.docx
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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>
 | 
			
		||||
| 
						 | 
				
			
			@ -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
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -5,16 +5,42 @@ 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}.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}.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
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -3,18 +3,33 @@
 | 
			
		|||
	<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=hkcdb;userid=root;password=root" />
 | 
			
		||||
		<add name="database" connectionString="server=192.168.50.84;port=3306;database=xiangtan_mazuike_xx;userid=root;password=root" />
 | 
			
		||||
	</connectionStrings>
 | 
			
		||||
	<!--<runtime>
 | 
			
		||||
		--><!--配置之后,Appdomain.CurrentDomain.UnhandledException 事件的 IsTerminating 就变成了 false 啦!也就是说,程序并不会因为这次的异常而崩溃退出。--><!--
 | 
			
		||||
		-->
 | 
			
		||||
	<!--配置之后,Appdomain.CurrentDomain.UnhandledException 事件的 IsTerminating 就变成了 false 啦!也就是说,程序并不会因为这次的异常而崩溃退出。-->
 | 
			
		||||
	<!--
 | 
			
		||||
		<legacyUnhandledExceptionPolicy enabled="1"/>
 | 
			
		||||
	</runtime>-->
 | 
			
		||||
	<appSettings>
 | 
			
		||||
 | 
			
		||||
		<!-- 设备id -->
 | 
			
		||||
		<add key="machineId" value="DM1" />
 | 
			
		||||
		<!--请领药库-->
 | 
			
		||||
		<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="" />
 | 
			
		||||
		<add key="storage" value="4" />
 | 
			
		||||
		<!-- 登录模式 1单人登录2双人登录 -->
 | 
			
		||||
		<add key="loginMode" value="1" />
 | 
			
		||||
		<!-- 登录顺序,指定先登录的人的名称有效值,只有在登录模式等于2时才会生效; 发药人:【operator】审核人:【reviewer】 -->
 | 
			
		||||
| 
						 | 
				
			
			@ -22,9 +37,12 @@
 | 
			
		|||
		<!-- 按处方还药或者按取药记录还药 1:处方(ReturnDrugWindow2)2:药品(ReturnDrugWindow)-->
 | 
			
		||||
		<add key="returnDrugMode" value="1" />
 | 
			
		||||
		<!-- 自动退出时间,单位秒,为0时不自动退出 -->
 | 
			
		||||
		<add key="autoExit" value="0"/>
 | 
			
		||||
		<add key="autoExit" value="10"/>
 | 
			
		||||
 | 
			
		||||
		<add key="gridConnectionString" value="MYSQL; Database=hkcdb; Password=root; Port=3306; Server=127.0.0.1; User=root;"/>
 | 
			
		||||
		<!-- 无操作退出录像时间,单位秒,为0时不退出录像 -->
 | 
			
		||||
		<add key="stopRecord" value="180"/>
 | 
			
		||||
 | 
			
		||||
		<add key="gridConnectionString" value="MYSQL; Database=xiangtan_mazuike_xx; Password=root; Port=3306; Server=192.168.50.84; User=root;"/>
 | 
			
		||||
		<!-- 查询处方是orderNo还是orderGroupNo -->
 | 
			
		||||
		<add key="OrderNoName" value="orderNo" />
 | 
			
		||||
		<!-- 后门耗材板地址 没有则填写0-->
 | 
			
		||||
| 
						 | 
				
			
			@ -36,16 +54,37 @@
 | 
			
		|||
		<!-- 抽屉串口使用的协议232或者485 -->
 | 
			
		||||
		<add key="DrawerProtocol" value="485" />
 | 
			
		||||
		<!-- 抽屉串口的串口号 -->
 | 
			
		||||
		<add key="DrawerPortPath" value="COM3" />
 | 
			
		||||
		<add key="DrawerPortPath" value="COM1" />
 | 
			
		||||
		<!-- can总线串口的串口号 -->
 | 
			
		||||
		<add key="CanBusPortPath" value="COM3" />
 | 
			
		||||
		<add key="CanBusPortPath" value="COM11" />
 | 
			
		||||
		<!-- 条码枪串口的串口号 -->
 | 
			
		||||
		<add key="ScanCodePortPath" value="COM8" />
 | 
			
		||||
		<!-- 抽屉串口的串口号 --><!--
 | 
			
		||||
		<!-- 冰箱的串口号 -->
 | 
			
		||||
		<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"/>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		<!-- 抽屉串口的串口号 -->
 | 
			
		||||
		<!--
 | 
			
		||||
		<add key="DrawerPortPath" value="COM11" />
 | 
			
		||||
		--><!-- can总线串口的串口号 --><!--
 | 
			
		||||
		-->
 | 
			
		||||
		<!-- can总线串口的串口号 -->
 | 
			
		||||
		<!--
 | 
			
		||||
		<add key="CanBusPortPath" value="COM12" />
 | 
			
		||||
		--><!-- 条码枪串口的串口号 --><!--
 | 
			
		||||
		-->
 | 
			
		||||
		<!-- 条码枪串口的串口号 -->
 | 
			
		||||
		<!--
 | 
			
		||||
		<add key="ScanPortPath" value="COM7" />-->
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -54,13 +93,13 @@
 | 
			
		|||
		<!-- 指纹机号码 -->
 | 
			
		||||
		<add  key="machineNumber" value="1"/>
 | 
			
		||||
		<!-- 指纹机ip -->
 | 
			
		||||
		<add  key="fingerIp" value="192.168.1.201"/>
 | 
			
		||||
		<add  key="fingerIp" value="192.168.50.201"/>
 | 
			
		||||
 | 
			
		||||
		<!-- 多处方取药 0:不启用 1:启用-->
 | 
			
		||||
		<add  key="MultiOrder" value="1"/>
 | 
			
		||||
		<!-- 多批次抽屉加药 0:不启用 1:启用
 | 
			
		||||
		     启用channel_list记录库位信息 -->
 | 
			
		||||
		<add  key="MultiBatch" value="1"/>
 | 
			
		||||
		<add  key="MultiBatch" value="0"/>
 | 
			
		||||
 | 
			
		||||
		<!--海康威视IP-->
 | 
			
		||||
		<add key="HIKIP" value="192.168.1.15"/>
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -32,6 +32,7 @@ namespace DM_Weight
 | 
			
		|||
    /// </summary>
 | 
			
		||||
    public partial class App : PrismApplication
 | 
			
		||||
    {
 | 
			
		||||
        public static bool DbConnectionFail { get; set; } = false;
 | 
			
		||||
        private readonly ILog logger = LogManager.GetLogger(typeof(App));
 | 
			
		||||
        public App()
 | 
			
		||||
        {
 | 
			
		||||
| 
						 | 
				
			
			@ -58,6 +59,11 @@ namespace DM_Weight
 | 
			
		|||
        {
 | 
			
		||||
            logger.Error($"发生错误:{e.Exception.Message}");
 | 
			
		||||
            e.Handled = true;
 | 
			
		||||
            if (e.Exception.Message.Contains("连接数据库过程中发生错误"))
 | 
			
		||||
            {
 | 
			
		||||
                DbConnectionFail = true;
 | 
			
		||||
                Container.Resolve<MainWindow>();
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        void OnUnobservedTaskException(object sender, UnobservedTaskExceptionEventArgs e)
 | 
			
		||||
| 
						 | 
				
			
			@ -97,7 +103,7 @@ namespace DM_Weight
 | 
			
		|||
            // 组态屏工具
 | 
			
		||||
            containerRegistry.RegisterSingleton<ScreenUtil>();
 | 
			
		||||
            // 录像机
 | 
			
		||||
            containerRegistry.RegisterSingleton<CHKFunction>();
 | 
			
		||||
            //containerRegistry.RegisterSingleton<CHKFunction>();
 | 
			
		||||
 | 
			
		||||
            containerRegistry.Register<IDialogService, MaterialDialogService>();
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -162,6 +168,19 @@ namespace DM_Weight
 | 
			
		|||
            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 还药
 | 
			
		||||
| 
						 | 
				
			
			@ -181,6 +200,9 @@ namespace DM_Weight
 | 
			
		|||
            // 归还空瓶模态框
 | 
			
		||||
            containerRegistry.RegisterDialog<ReturnEmptyDialog>();
 | 
			
		||||
            containerRegistry.RegisterForNavigation<ReturnEmptyDialog, ReturnEmptyDialogViewModel>();
 | 
			
		||||
            // 空瓶销毁模态框
 | 
			
		||||
            containerRegistry.RegisterDialog<DestoryEmptyDialog>();
 | 
			
		||||
            containerRegistry.RegisterForNavigation<DestoryEmptyDialog, DestoryEmptyDialogViewModel>();
 | 
			
		||||
            #endregion
 | 
			
		||||
 | 
			
		||||
            #region 库存管理
 | 
			
		||||
| 
						 | 
				
			
			@ -196,6 +218,13 @@ namespace DM_Weight
 | 
			
		|||
            // 药品列表页面
 | 
			
		||||
            containerRegistry.RegisterForNavigation<DrugListWindow, DrugListWindowViewModel>();
 | 
			
		||||
 | 
			
		||||
            //交接班记录
 | 
			
		||||
            containerRegistry.RegisterForNavigation<ChangeShiftsListWindow, ChangeShiftsListWindowViewModel>();
 | 
			
		||||
            //交接班弹窗
 | 
			
		||||
            containerRegistry.RegisterDialog<ChangeShiftsDialog>();
 | 
			
		||||
            containerRegistry.RegisterForNavigation<ChangeShiftsDialog, ChangeShiftsDialogViewModel>();
 | 
			
		||||
 | 
			
		||||
            containerRegistry.RegisterForNavigation<AccountWindow,AccountWindowViewModel>();
 | 
			
		||||
            #endregion
 | 
			
		||||
 | 
			
		||||
            #region 系统设置
 | 
			
		||||
| 
						 | 
				
			
			@ -210,6 +239,10 @@ namespace DM_Weight
 | 
			
		|||
            containerRegistry.RegisterForNavigation<SettingWindow, SettingWindowViewModel>();
 | 
			
		||||
            // 调试页面
 | 
			
		||||
            containerRegistry.RegisterForNavigation<DebugWindow, DebugWindowViewModel>();
 | 
			
		||||
            //主设置页面
 | 
			
		||||
            //containerRegistry.RegisterForNavigation<SettingMainWindow, SettingMainWindowViewModel>();
 | 
			
		||||
            ////冰箱抽屉设置页面
 | 
			
		||||
            //containerRegistry.RegisterForNavigation<FridgeWindow, FridgeWindowViewModel>();
 | 
			
		||||
 | 
			
		||||
            #endregion
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -218,6 +251,8 @@ namespace DM_Weight
 | 
			
		|||
 | 
			
		||||
            containerRegistry.RegisterForNavigation<ShowMessageDialog, ShowMessageDialogViewModel>();
 | 
			
		||||
 | 
			
		||||
            //紧急开锁页面
 | 
			
		||||
            containerRegistry.RegisterForNavigation<EmergencyWindow, EmergencyWindowViewModel>();
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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;
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -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);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -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";
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -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)
 | 
			
		||||
                        {
 | 
			
		||||
                            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);
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -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
 | 
			
		||||
{
 | 
			
		||||
    /// <summary>
 | 
			
		||||
    /// 请领列表页面状态转换
 | 
			
		||||
    /// </summary>
 | 
			
		||||
    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<UserList>().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();
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -55,6 +55,19 @@ namespace DM_Weight.Converter
 | 
			
		|||
                    {
 | 
			
		||||
                        return "外置回收";
 | 
			
		||||
                    }
 | 
			
		||||
                case 35:
 | 
			
		||||
                    if (DrawerType == 1)
 | 
			
		||||
                    {
 | 
			
		||||
                        return "管控药盒带屏幕";
 | 
			
		||||
                    }
 | 
			
		||||
                    else if (DrawerType == 2)
 | 
			
		||||
                    {
 | 
			
		||||
                        return "药盒带屏幕回收(内置)";
 | 
			
		||||
                    }
 | 
			
		||||
                    else
 | 
			
		||||
                    {
 | 
			
		||||
                        return "外置回收";
 | 
			
		||||
                    }
 | 
			
		||||
                case 4:
 | 
			
		||||
                    if (DrawerType == 1)
 | 
			
		||||
                    {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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();
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,32 @@
 | 
			
		|||
using System;
 | 
			
		||||
using System.Collections.Generic;
 | 
			
		||||
using System.Globalization;
 | 
			
		||||
using System.Linq;
 | 
			
		||||
using System.Text;
 | 
			
		||||
using System.Threading.Tasks;
 | 
			
		||||
using System.Windows.Data;
 | 
			
		||||
using System.Windows;
 | 
			
		||||
 | 
			
		||||
namespace DM_Weight.Converter
 | 
			
		||||
{
 | 
			
		||||
    internal class OpenBoxConverter : IValueConverter
 | 
			
		||||
    {
 | 
			
		||||
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
 | 
			
		||||
        {
 | 
			
		||||
            bool status = bool.Parse(value.ToString());
 | 
			
		||||
            if (status)
 | 
			
		||||
            {
 | 
			
		||||
                return Visibility.Visible;
 | 
			
		||||
            }
 | 
			
		||||
            else
 | 
			
		||||
            {
 | 
			
		||||
                return Visibility.Collapsed;
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
 | 
			
		||||
        {
 | 
			
		||||
            throw new NotImplementedException();
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -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 ShiftsStateConverter : IValueConverter
 | 
			
		||||
    {
 | 
			
		||||
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
 | 
			
		||||
        {
 | 
			
		||||
            if (value.ToString().Equals("1"))
 | 
			
		||||
            {
 | 
			
		||||
                return "已交班";
 | 
			
		||||
            }
 | 
			
		||||
            else
 | 
			
		||||
            {
 | 
			
		||||
                return "未交班";
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
 | 
			
		||||
        {
 | 
			
		||||
            throw new NotImplementedException();
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -64,7 +64,7 @@ namespace DM_Weight.Converter
 | 
			
		|||
            //取消
 | 
			
		||||
            if (parameter.ToString().Equals("CancelBtn"))
 | 
			
		||||
            {
 | 
			
		||||
                if (status > 0)
 | 
			
		||||
                if (status ==3)
 | 
			
		||||
                {
 | 
			
		||||
                    return Visibility.Visible;
 | 
			
		||||
                }
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,127 +0,0 @@
 | 
			
		|||
<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>
 | 
			
		||||
  </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="SharpPromise" Version="1.7.0" />
 | 
			
		||||
    <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_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\stock_template.grf">
 | 
			
		||||
      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
 | 
			
		||||
    </None>
 | 
			
		||||
  </ItemGroup>
 | 
			
		||||
 | 
			
		||||
  <ItemGroup>
 | 
			
		||||
    <Page Update="Views\Dialog\InvoiceTakeDialog.xaml">
 | 
			
		||||
      <XamlRuntime>$(DefaultXamlRuntime)</XamlRuntime>
 | 
			
		||||
    </Page>
 | 
			
		||||
  </ItemGroup>
 | 
			
		||||
 | 
			
		||||
  <ItemGroup>
 | 
			
		||||
    <Folder Include="HIKVISION\" />
 | 
			
		||||
  </ItemGroup>
 | 
			
		||||
 | 
			
		||||
</Project>
 | 
			
		||||
| 
						 | 
				
			
			@ -8,6 +8,7 @@
 | 
			
		|||
    <PackageIcon></PackageIcon>
 | 
			
		||||
    <Product>毒麻管理程序</Product>
 | 
			
		||||
    <ApplicationIcon>Images\favicon.ico</ApplicationIcon>
 | 
			
		||||
    <Platforms>AnyCPU;x86;x64</Platforms>
 | 
			
		||||
  </PropertyGroup>
 | 
			
		||||
 | 
			
		||||
	<ItemGroup>
 | 
			
		||||
| 
						 | 
				
			
			@ -97,6 +98,15 @@
 | 
			
		|||
    <None Update="ReportTemp\account_book_temp.grf">
 | 
			
		||||
      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
 | 
			
		||||
    </None>
 | 
			
		||||
    <None Update="ReportTemp\account_book_temp1.grf">
 | 
			
		||||
      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
 | 
			
		||||
    </None>
 | 
			
		||||
    <None Update="ReportTemp\account_book_temp_new.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>
 | 
			
		||||
| 
						 | 
				
			
			@ -109,6 +119,12 @@
 | 
			
		|||
    <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>
 | 
			
		||||
| 
						 | 
				
			
			@ -124,4 +140,8 @@
 | 
			
		|||
    <Folder Include="HIKVISION\" />
 | 
			
		||||
  </ItemGroup>
 | 
			
		||||
 | 
			
		||||
  <ItemGroup>
 | 
			
		||||
    <ProjectReference Include="..\DM_Weight.Commons\DM_Weight.Commons.csproj" />
 | 
			
		||||
  </ItemGroup>
 | 
			
		||||
 | 
			
		||||
</Project>
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -32,10 +32,10 @@ namespace DM_Weight.Finger
 | 
			
		|||
        {
 | 
			
		||||
            _eventAggregator = eventAggregator;
 | 
			
		||||
            logger.Info($"进入构造器,开始连接指纹机");
 | 
			
		||||
            Task.Run(() =>
 | 
			
		||||
           {
 | 
			
		||||
           // Task.Run(() =>
 | 
			
		||||
           //{
 | 
			
		||||
               ConnectionMain();
 | 
			
		||||
           });
 | 
			
		||||
           //});
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public void ConnectionMain()
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -9,6 +9,7 @@ using System.Windows.Controls;
 | 
			
		|||
using System.Windows;
 | 
			
		||||
using DM_Weight.Port;
 | 
			
		||||
using log4net;
 | 
			
		||||
using System.Runtime.InteropServices;
 | 
			
		||||
 | 
			
		||||
namespace DM_Weight.HIKVISION
 | 
			
		||||
{
 | 
			
		||||
| 
						 | 
				
			
			@ -24,6 +25,7 @@ namespace DM_Weight.HIKVISION
 | 
			
		|||
 | 
			
		||||
        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;
 | 
			
		||||
| 
						 | 
				
			
			@ -53,10 +55,10 @@ namespace DM_Weight.HIKVISION
 | 
			
		|||
 | 
			
		||||
        public int HIKLogin()
 | 
			
		||||
        {
 | 
			
		||||
            string ip= ReadApp.ReadAppSetting("HIKIP");
 | 
			
		||||
            string port=ReadApp.ReadAppSetting("HIKPort");
 | 
			
		||||
            string userName= ReadApp.ReadAppSetting("HIKUser");
 | 
			
		||||
            string password= ReadApp.ReadAppSetting("HIKPassword");
 | 
			
		||||
            string ip = ReadApp.ReadAppSetting("HIKIP");
 | 
			
		||||
            string port = ReadApp.ReadAppSetting("HIKPort");
 | 
			
		||||
            string userName = ReadApp.ReadAppSetting("HIKUser");
 | 
			
		||||
            string password = ReadApp.ReadAppSetting("HIKPassword");
 | 
			
		||||
            if (HKUserId < 0)
 | 
			
		||||
            {
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -128,24 +130,24 @@ namespace DM_Weight.HIKVISION
 | 
			
		|||
        {
 | 
			
		||||
            if (m_lRealHandle >= 0)
 | 
			
		||||
            {
 | 
			
		||||
               bool stopRealPlay=  CHCNetSDK.NET_DVR_StopRealPlay(m_lRealHandle);
 | 
			
		||||
                bool stopRealPlay = CHCNetSDK.NET_DVR_StopRealPlay(m_lRealHandle);
 | 
			
		||||
                logger.Info($"录像机NET_DVR_StopRealPlay接口返回{stopRealPlay}");
 | 
			
		||||
            }
 | 
			
		||||
            if (HKUserId >= 0)
 | 
			
		||||
            {
 | 
			
		||||
                bool logout= CHCNetSDK.NET_DVR_Logout(HKUserId);
 | 
			
		||||
                bool logout = CHCNetSDK.NET_DVR_Logout(HKUserId);
 | 
			
		||||
                logger.Info($"录像机NET_DVR_Logout接口返回{logout}");
 | 
			
		||||
            }
 | 
			
		||||
            if (m_bInitSDK == true)
 | 
			
		||||
            {
 | 
			
		||||
                bool cleanUp= CHCNetSDK.NET_DVR_Cleanup();
 | 
			
		||||
                bool cleanUp = CHCNetSDK.NET_DVR_Cleanup();
 | 
			
		||||
                logger.Info($"录像机NET_DVR_Cleanup接口返回{cleanUp}");
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public bool HIKStartDVRRecord()
 | 
			
		||||
        {
 | 
			
		||||
            bool isStart= CHCNetSDK.NET_DVR_StartDVRRecord(HKUserId, 0xffff, 0);
 | 
			
		||||
            bool isStart = CHCNetSDK.NET_DVR_StartDVRRecord(HKUserId, 0xffff, 0);
 | 
			
		||||
            logger.Info($"录像机NET_DVR_StartDVRRecord接口返回{isStart}");
 | 
			
		||||
            return isStart;
 | 
			
		||||
        }
 | 
			
		||||
| 
						 | 
				
			
			@ -155,7 +157,19 @@ namespace DM_Weight.HIKVISION
 | 
			
		|||
            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>
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -0,0 +1,152 @@
 | 
			
		|||
using SqlSugar;
 | 
			
		||||
using System;
 | 
			
		||||
using System.Collections.Generic;
 | 
			
		||||
using System.Linq;
 | 
			
		||||
using System.Text;
 | 
			
		||||
using System.Threading.Tasks;
 | 
			
		||||
 | 
			
		||||
namespace DM_Weight.Models
 | 
			
		||||
{
 | 
			
		||||
    [SugarTable("account_book_g2")]
 | 
			
		||||
    public class AccountBookG2
 | 
			
		||||
    {
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// 主键
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        [SugarColumn(ColumnName = "id",IsPrimaryKey =true)]
 | 
			
		||||
        public int Id { get; set; }
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// 药品id
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        [SugarColumn(ColumnName = "drug_id")]
 | 
			
		||||
        public string DrugId { get; set; }
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// 1领入2发出3日结4总结5转结
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        [SugarColumn(ColumnName = "type")]
 | 
			
		||||
        public int Type { get; set; }
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// 科室
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        [SugarColumn(ColumnName = "department")]
 | 
			
		||||
        public string Department { get; set; }
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// 设备内记录凭证
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        [SugarColumn(ColumnName = "invoice_no")] 
 | 
			
		||||
        public string InvoiceNo { get; set; }
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// 处方号或凭证号
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        [SugarColumn(ColumnName = "order_no")]
 | 
			
		||||
        public string OrderNo { get; set; }
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// 批次
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        [SugarColumn(ColumnName = "manu_no")]
 | 
			
		||||
        public string ManuNo { get; set; }
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// 效期
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        [SugarColumn(ColumnName = "eff_date")]
 | 
			
		||||
        public string EffDate { get; set; }
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// 上日结存
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        [SugarColumn(ColumnName = "yesterday_quantity")]
 | 
			
		||||
        public int YQuantity { get; set; }
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// 收入
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        [SugarColumn(ColumnName = "add_quantity")]
 | 
			
		||||
        public int AddQuantity { get; set; }
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// 发出
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        [SugarColumn(ColumnName = "out_quantity")]
 | 
			
		||||
        public int OutQuantity { get; set; }
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// 批次结存
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        [SugarColumn(ColumnName = "manu_stock")]
 | 
			
		||||
        public int ManuStock { get; set; }
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// 总结存
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        [SugarColumn(ColumnName = "total_stock")]
 | 
			
		||||
        public int TotalStock { get; set; }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        ///  发药领药人id
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        [SugarColumn(ColumnName = "user_id1")]
 | 
			
		||||
        public int? UserId1 { get; set; }
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// 复核人id
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        [SugarColumn(ColumnName = "user_id2")]
 | 
			
		||||
        public int? UserId2 { get; set; }
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// 设备id
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        [SugarColumn(ColumnName = "machine_id")]
 | 
			
		||||
        public string MachineId { get; set; }
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// 日期
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        [SugarColumn(ColumnName = "create_date")]
 | 
			
		||||
        public string CreateDate { get; set; }
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// 插入更新时间(当前时间戳)
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        [SugarColumn(ColumnName = "create_time")]
 | 
			
		||||
        public DateTime CreateTime { get; set; }
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// 药品名称
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        [SugarColumn(IsIgnore = true)]
 | 
			
		||||
        public string DrugName { get; set; }
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// 规格
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        [SugarColumn(IsIgnore =true)]
 | 
			
		||||
        public string DrugSpec { get; set; }
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// 厂家
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        [SugarColumn(IsIgnore =true)]
 | 
			
		||||
        public string Manufactory { get; set; }
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// 发药人
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        [SugarColumn(IsIgnore =true)]
 | 
			
		||||
        public string OperatorName { get; set; }
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// 复核人
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        [SugarColumn(IsIgnore =true)]
 | 
			
		||||
        public string ReviewerName { get;set; }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,23 @@
 | 
			
		|||
using System;
 | 
			
		||||
using System.Collections.Generic;
 | 
			
		||||
using System.Linq;
 | 
			
		||||
using System.Text;
 | 
			
		||||
using System.Threading.Tasks;
 | 
			
		||||
 | 
			
		||||
namespace DM_Weight.Models
 | 
			
		||||
{
 | 
			
		||||
    /// <summary>
 | 
			
		||||
    /// 账册类型
 | 
			
		||||
    /// </summary>
 | 
			
		||||
    public class AccountType
 | 
			
		||||
    {
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// 账册类型名称
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        public string AccountTypeName { get; set; }
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// 账册类型值
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        public int AccountTypeValue { get; set; }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -186,7 +186,7 @@ namespace DM_Weight.Models
 | 
			
		|||
        public ChannelList ChannelLst { get => _channelList; set => SetProperty(ref _channelList, value); }
 | 
			
		||||
 | 
			
		||||
        [SugarColumn(IsIgnore = true)]
 | 
			
		||||
        public int DrawerState { get; set; } = 0;
 | 
			
		||||
        public DrugPleaseClaim PleaseClaim { get; set; }
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,118 @@
 | 
			
		|||
using System;
 | 
			
		||||
using System.Collections.Generic;
 | 
			
		||||
using System.Linq;
 | 
			
		||||
using System.Text;
 | 
			
		||||
using System.Threading.Tasks;
 | 
			
		||||
using System.Windows.Controls;
 | 
			
		||||
using SqlSugar;
 | 
			
		||||
 | 
			
		||||
namespace DM_Weight.Models
 | 
			
		||||
{
 | 
			
		||||
    /// <summary>
 | 
			
		||||
    /// 处方、请领单中间表
 | 
			
		||||
    /// </summary>
 | 
			
		||||
    [SugarTable("order_apply")]
 | 
			
		||||
    public class CollectDrug
 | 
			
		||||
    {
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// 是否选择
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        [SugarColumn(IsIgnore =true)]
 | 
			
		||||
        public bool IsSelected { get; set; }
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// 主键
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        [SugarColumn(ColumnName = "Applyid")]
 | 
			
		||||
        public int Applyid { get; set; }
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// 药品请领单号
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        [SugarColumn(ColumnName = "Drug_plase_id")]
 | 
			
		||||
        public string DrugPleaseClaimId { get; set; }
 | 
			
		||||
        /// 处方
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        [SugarColumn(ColumnName = "OrderNo")]
 | 
			
		||||
        public string OrderNo { get; set; }
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// 药品ID
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        [SugarColumn(ColumnName = "Drug_Id")]
 | 
			
		||||
        public string DrugId { get; set; }
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// 患者ID
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        [SugarColumn(IsIgnore =true)]
 | 
			
		||||
        public string PatientId { get; set; }
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// 姓名
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        [SugarColumn(IsIgnore = true)]
 | 
			
		||||
        public string PName { get; set; }
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// 性别
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        [SugarColumn(IsIgnore = true)]
 | 
			
		||||
        public string Sex { get; set; }
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// 年龄
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        [SugarColumn(IsIgnore = true)] 
 | 
			
		||||
        public string Age { get; set; }
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// 身份证号
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        [SugarColumn(IsIgnore = true)] 
 | 
			
		||||
        public string IdNumber { get; set; }
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// 科室
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        [SugarColumn(IsIgnore = true)] 
 | 
			
		||||
        public string DeptName { get; set; }
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// 药品名称
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        [SugarColumn(IsIgnore = true)] 
 | 
			
		||||
        public string DrugName { get;set; }
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// 规格
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        [SugarColumn(IsIgnore = true)] 
 | 
			
		||||
        public string DrugSpec { get; set; }
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// 厂家
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        [SugarColumn(IsIgnore = true)] 
 | 
			
		||||
        public string Manufactory { get; set; }
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// 数量
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        [SugarColumn(ColumnName = "Quantity")]
 | 
			
		||||
        public int Quantity { get; set; }
 | 
			
		||||
 | 
			
		||||
        [SugarColumn(ColumnName = "Createdate")]
 | 
			
		||||
        public DateTime Createdate { get; set; }
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// 状态
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        [SugarColumn(ColumnName = "Status")] 
 | 
			
		||||
        public int Status { get; set; }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
        [SugarColumn(ColumnName = "Machine_id")] 
 | 
			
		||||
        public string MachineId { get; set; }
 | 
			
		||||
 | 
			
		||||
        [SugarColumn(ColumnName = "Current_Machine_id")]
 | 
			
		||||
        public string CurrentMachineId { get; set; }
 | 
			
		||||
 | 
			
		||||
        [Navigate(NavigateType.OneToOne, nameof(DrugId))]
 | 
			
		||||
        public DrugInfo drugInfo { get; set; }
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// 请领表
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        [Navigate(NavigateType.ManyToOne, nameof(DrugPleaseClaimId))]
 | 
			
		||||
        public DrugPleaseClaim drugPleaseClaim { get; set; }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,36 @@
 | 
			
		|||
using System;
 | 
			
		||||
using System.Collections.Generic;
 | 
			
		||||
using System.Linq;
 | 
			
		||||
using System.Text;
 | 
			
		||||
using System.Threading.Tasks;
 | 
			
		||||
using SqlSugar;
 | 
			
		||||
 | 
			
		||||
namespace DM_Weight.Models
 | 
			
		||||
{
 | 
			
		||||
    [SugarTable("destory_detail")]
 | 
			
		||||
    public class DestoryDetail
 | 
			
		||||
    {
 | 
			
		||||
        [SugarColumn(ColumnName = "id", IsPrimaryKey = true)]
 | 
			
		||||
        public int ID { get; set; }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
        [SugarColumn(ColumnName = "operatorid")]
 | 
			
		||||
        public int? Operatorid { get; set; }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
        [SugarColumn(ColumnName = "reviewerid")]
 | 
			
		||||
        public int? Reviewerid { get; set; }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
        [SugarColumn(ColumnName = "recordId")]
 | 
			
		||||
        public int RecordId { get; set; }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
        [SugarColumn(ColumnName = "orderId")]
 | 
			
		||||
        public int OrderId { get; set; }
 | 
			
		||||
 | 
			
		||||
        [SugarColumn(ColumnName = "machine_id")]
 | 
			
		||||
        public string MachineId { get; set; }
 | 
			
		||||
            
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -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); } }
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -1,6 +1,8 @@
 | 
			
		|||
using System;
 | 
			
		||||
using System.Collections.Generic;
 | 
			
		||||
using System.Linq;
 | 
			
		||||
using System.Security.Policy;
 | 
			
		||||
using Prism.Mvvm;
 | 
			
		||||
using SqlSugar;
 | 
			
		||||
namespace DM_Weight.Models
 | 
			
		||||
{
 | 
			
		||||
| 
						 | 
				
			
			@ -8,7 +10,7 @@ namespace DM_Weight.Models
 | 
			
		|||
    /// 
 | 
			
		||||
    ///</summary>
 | 
			
		||||
    [SugarTable("drug_info")]
 | 
			
		||||
    public class DrugInfo
 | 
			
		||||
    public class DrugInfo:BindableBase
 | 
			
		||||
    {
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        ///  
 | 
			
		||||
| 
						 | 
				
			
			@ -19,7 +21,7 @@ namespace DM_Weight.Models
 | 
			
		|||
        /// ҩƷID 
 | 
			
		||||
        ///</summary>
 | 
			
		||||
        [SugarColumn(ColumnName = "drug_id", IsPrimaryKey = true)]
 | 
			
		||||
        public long DrugId { get; set; }
 | 
			
		||||
        public string DrugId { get; set; }
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// ƴ 
 | 
			
		||||
        ///</summary>
 | 
			
		||||
| 
						 | 
				
			
			@ -81,5 +83,16 @@ namespace DM_Weight.Models
 | 
			
		|||
        [SugarColumn(IsIgnore = true)]
 | 
			
		||||
        public int? StockQuantity { get; set; }
 | 
			
		||||
 | 
			
		||||
        private DrugBase _base;
 | 
			
		||||
        [Navigate(NavigateType.OneToOne, nameof(DrugBase.DrugId), nameof(DrugId),whereSql:" machine_id='DM1'")]
 | 
			
		||||
        public DrugBase drugBase
 | 
			
		||||
        {
 | 
			
		||||
            get=> _base;
 | 
			
		||||
            set { SetProperty(ref _base, value); }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        [SugarColumn(IsIgnore = true)]
 | 
			
		||||
        public string drug_name_spec { get; set; }
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -0,0 +1,129 @@
 | 
			
		|||
using System;
 | 
			
		||||
using System.Collections.Generic;
 | 
			
		||||
using System.Linq;
 | 
			
		||||
using System.Text;
 | 
			
		||||
using System.Threading.Tasks;
 | 
			
		||||
using SqlSugar;
 | 
			
		||||
 | 
			
		||||
namespace DM_Weight.Models
 | 
			
		||||
{
 | 
			
		||||
    /// <summary>
 | 
			
		||||
    /// 请领申请表
 | 
			
		||||
    /// </summary>
 | 
			
		||||
    [SugarTable("drug_please_claim")]
 | 
			
		||||
    public class DrugPleaseClaim
 | 
			
		||||
    {
 | 
			
		||||
        [SugarColumn(ColumnName = "id")]
 | 
			
		||||
        public int Id { get; set; }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
        [SugarColumn(ColumnName = "drug_id")]
 | 
			
		||||
        public string DrugId { get; set; }
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// 请领数量
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        [SugarColumn(ColumnName = "get_quantity")]
 | 
			
		||||
        public int GetQuantity { get; set; }
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// 交处方张数
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        [SugarColumn(ColumnName = "return_prescription_quantity")]
 | 
			
		||||
        public int ReturnPrQuantity { get; set; }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// 处方用量
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        [SugarColumn(ColumnName = "prescription_quantity")]
 | 
			
		||||
        public int PrescriptionQuantity { get; set; }
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// 空瓶数量
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        [SugarColumn(ColumnName = "empties_quantity")]
 | 
			
		||||
        public int EmptiesQuantity { get; set; }
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// 实发数
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        [SugarColumn(ColumnName = "issue_quantity")]
 | 
			
		||||
        public int IssueQuantity { get; set; }
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// 批次(多条)
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        [SugarColumn(ColumnName = "drug_manu_no")]
 | 
			
		||||
        public string DrugManuNo { get; set; }
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// 备注1
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        [SugarColumn(ColumnName = "notes_nn")]
 | 
			
		||||
        public string NotesNN { get; set; }
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// 备注2
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        [SugarColumn(ColumnName = "notes_n")]
 | 
			
		||||
        public string NotesN { get;set; }
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// 32:三级向二级请领;23:二级向三级退;
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        [SugarColumn(ColumnName = "type")]
 | 
			
		||||
        public int Type { get; set; }
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// 0:创建完成;1:二级已授权;2:一级已查阅;3:已关联His
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        [SugarColumn(ColumnName = "state")]
 | 
			
		||||
        public int State { get; set; }
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// 凭证号
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        [SugarColumn(ColumnName = "voucher")]
 | 
			
		||||
        public string Voucher { get; set; }
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// 机器id
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        [SugarColumn(ColumnName = "machine_id")]
 | 
			
		||||
        public string MachineId { get; set; }
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// 创建时间
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        [SugarColumn(ColumnName = "do_date")]
 | 
			
		||||
        public DateTime DoDate { get; set; }
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// 申请人
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        [SugarColumn(ColumnName = "apply_user")]
 | 
			
		||||
        public int ApplyUser { get; set; }
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// 复核人
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        [SugarColumn(ColumnName = "exp_user")]
 | 
			
		||||
        public int ReviewUser { get; set; }
 | 
			
		||||
 | 
			
		||||
        [SugarColumn(ColumnName = "please_no", IsPrimaryKey = true)]
 | 
			
		||||
        public string PleaseNo { get; set; }
 | 
			
		||||
 | 
			
		||||
        [SugarColumn(ColumnName = "department")]
 | 
			
		||||
        public string Department { get; set; }
 | 
			
		||||
 | 
			
		||||
        [SugarColumn(ColumnName = "totalQuantity")]
 | 
			
		||||
        public int TotalQuantity { get; set; }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
        //[Navigate(NavigateType.ManyToMany, nameof(PleaseNo))]
 | 
			
		||||
        //public CollectDrug collectDrug { get; set; }]
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
        [Navigate(NavigateType.OneToOne, nameof(DrugId))]
 | 
			
		||||
        public DrugInfo DrugInfo { get; set; }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,25 @@
 | 
			
		|||
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>
 | 
			
		||||
    ///  drug_please_claim表中drug_manu_no字段值对应映射
 | 
			
		||||
    /// </summary>
 | 
			
		||||
    public class DrugPleaseManuNo
 | 
			
		||||
    {
 | 
			
		||||
        public string DrugId { get; set; }
 | 
			
		||||
 | 
			
		||||
        public string ManuNo { get; set; }
 | 
			
		||||
 | 
			
		||||
        public string EffDate { get; set;}
 | 
			
		||||
        
 | 
			
		||||
        public int Quantity { get; set; }
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,20 @@
 | 
			
		|||
using System;
 | 
			
		||||
using System.Collections.Generic;
 | 
			
		||||
using System.Linq;
 | 
			
		||||
using System.Text;
 | 
			
		||||
using System.Threading.Tasks;
 | 
			
		||||
 | 
			
		||||
namespace DM_Weight.Models
 | 
			
		||||
{
 | 
			
		||||
    public class DrugPleaseState
 | 
			
		||||
    {
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// 药品请领状态名
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        public string StateName { get; set; }
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        ///  药品请领状态值
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        public int StateValue { get; set; }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,45 @@
 | 
			
		|||
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("hkc_changeshifts")]
 | 
			
		||||
    public class HkcChangeShifts : BindableBase
 | 
			
		||||
    {
 | 
			
		||||
        [SugarColumn(ColumnName = "id", IsPrimaryKey = true)]
 | 
			
		||||
        public int Id { get; set; }
 | 
			
		||||
 | 
			
		||||
        [SugarColumn(ColumnName = "optDate")]
 | 
			
		||||
        public DateTime? OptDate { get; set; }
 | 
			
		||||
 | 
			
		||||
        [SugarColumn(ColumnName = "FromOperator")]
 | 
			
		||||
        public string FromOperator { get; set; }
 | 
			
		||||
 | 
			
		||||
        [SugarColumn(ColumnName = "FromRviewer")]
 | 
			
		||||
        public string FromRviewer { get; set; }
 | 
			
		||||
 | 
			
		||||
        [SugarColumn(ColumnName = "ToOperator")]
 | 
			
		||||
        public string ToOperator { get; set; }
 | 
			
		||||
 | 
			
		||||
        [SugarColumn(ColumnName = "ToReviewer")]
 | 
			
		||||
        public string ToReviewer { get; set; }
 | 
			
		||||
 | 
			
		||||
        [SugarColumn(ColumnName = "ToDate")]
 | 
			
		||||
        public DateTime? ToDate { get; set; }
 | 
			
		||||
 | 
			
		||||
        [SugarColumn(ColumnName = "State")]
 | 
			
		||||
        public string State { get; set; }
 | 
			
		||||
 | 
			
		||||
        [SugarColumn(ColumnName = "optState")]
 | 
			
		||||
        public string OptState { get; set; }
 | 
			
		||||
 | 
			
		||||
        [SugarColumn(ColumnName = "machine_id")]
 | 
			
		||||
        public string Machineid { get; set; }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -36,11 +36,11 @@ namespace DM_Weight.Models
 | 
			
		|||
        public int Quantity { get; set; }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
        [SugarColumn(ColumnName = "stock_quantity")]
 | 
			
		||||
        public int? StockQuantity { get; set; }
 | 
			
		||||
        //[SugarColumn(ColumnName = "stock_quantity")]
 | 
			
		||||
        //public int? StockQuantity { get; set; }
 | 
			
		||||
 | 
			
		||||
        [SugarColumn(ColumnName = "check_quantity")]
 | 
			
		||||
        public int? CheckQuantity { get; set; }
 | 
			
		||||
        //[SugarColumn(ColumnName = "check_quantity")]
 | 
			
		||||
        //public int? CheckQuantity { get; set; }
 | 
			
		||||
        
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// 批号 
 | 
			
		||||
| 
						 | 
				
			
			@ -126,6 +126,19 @@ namespace DM_Weight.Models
 | 
			
		|||
        [SugarColumn(ColumnName = "is_destroy", IsOnlyIgnoreInsert = true)]
 | 
			
		||||
        public int? IsDestroy { get; set; }      
 | 
			
		||||
        
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// 销毁操作人 
 | 
			
		||||
        /// 默认值: 0
 | 
			
		||||
        ///</summary>
 | 
			
		||||
        [SugarColumn(ColumnName = "take_user", IsOnlyIgnoreInsert = true)]
 | 
			
		||||
        public string TakeUser { get; set; }
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// 销毁审核人 
 | 
			
		||||
        /// 默认值: 0
 | 
			
		||||
        ///</summary>
 | 
			
		||||
        [SugarColumn(ColumnName = "fuzeren", IsOnlyIgnoreInsert = true)]
 | 
			
		||||
        public string DestoryReviewerUser { get; set; }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
        [SugarColumn(IsIgnore = true)]
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -177,6 +177,13 @@ namespace DM_Weight.Models
 | 
			
		|||
        ///</summary>
 | 
			
		||||
        [SugarColumn(ColumnName = "costs")]
 | 
			
		||||
        public decimal? Costs { get; set; }
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// 药品请领状态(0未请领;1已请领)
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        [SugarColumn(ColumnName = "apply_status")]
 | 
			
		||||
        public int ApplyStatus { get;set; }
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        ///  
 | 
			
		||||
        /// 默认值: NULL
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,32 +0,0 @@
 | 
			
		|||
using System;
 | 
			
		||||
using System.Collections.Generic;
 | 
			
		||||
using System.Linq;
 | 
			
		||||
using System.Text;
 | 
			
		||||
using System.Threading.Tasks;
 | 
			
		||||
 | 
			
		||||
namespace DM_Weight.Models
 | 
			
		||||
{
 | 
			
		||||
    public class OrderTakeVo
 | 
			
		||||
    {
 | 
			
		||||
        public DrugInfo Drug { get; set; }
 | 
			
		||||
 | 
			
		||||
        public OrderDetail OrderDetail { get; set; }
 | 
			
		||||
 | 
			
		||||
        public ChannelStock ChannelStock { get; set; }
 | 
			
		||||
 | 
			
		||||
        public int StockQuantity { get; set; }
 | 
			
		||||
 | 
			
		||||
        public int Quantity { get; set; }
 | 
			
		||||
 | 
			
		||||
        public int GetQuantity { get; set; } = 0;
 | 
			
		||||
 | 
			
		||||
        public int Status { get; set; } = 0;
 | 
			
		||||
 | 
			
		||||
        public int[] BeforeQuantity { get; set; } = new int[] { 0, 0, 0, 0, 0, 0, 0, 0, 0 };
 | 
			
		||||
 | 
			
		||||
        public int[] AfterQuantity { get; set; } = new int[] { 0, 0, 0, 0, 0, 0, 0, 0, 0 };
 | 
			
		||||
 | 
			
		||||
        public int AddQuantity { get; set; } = 0;
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,56 @@
 | 
			
		|||
using SqlSugar;
 | 
			
		||||
using System;
 | 
			
		||||
using System.Collections.Generic;
 | 
			
		||||
using System.Linq;
 | 
			
		||||
using System.Text;
 | 
			
		||||
using System.Threading.Tasks;
 | 
			
		||||
 | 
			
		||||
namespace DM_Weight.Models
 | 
			
		||||
{
 | 
			
		||||
    [SugarTable("SettingPage")]
 | 
			
		||||
    public class SettingPage
 | 
			
		||||
    {
 | 
			
		||||
        [SugarColumn(ColumnName = "Id", IsPrimaryKey = true)]
 | 
			
		||||
        public string Id { get; set; }
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// 页面名称
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        [SugarColumn(ColumnName = "Name")]
 | 
			
		||||
        public string Name { get; set; }
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// 页面连接
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        [SugarColumn(ColumnName = "Url")]
 | 
			
		||||
        public string Url { get; set; }
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        ///可用标志
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        [SugarColumn(ColumnName = "Flag")]
 | 
			
		||||
        public string Flag { get; set; }
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// view名称
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        [SugarColumn(ColumnName = "ViewName")]
 | 
			
		||||
        public string ViewName { get; set; }
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// 图标名称
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        [SugarColumn(ColumnName = "IconName")]
 | 
			
		||||
        public string Icon { get; set; }
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// 层级
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        [SugarColumn(ColumnName = "Level")]
 | 
			
		||||
        public int Level { get; set; }
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// 父级id
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        [SugarColumn(ColumnName = "Parentid")]
 | 
			
		||||
        public int Parentid { get; set; }
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// 0可用1不可用
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        [SugarColumn(ColumnName = "State")]
 | 
			
		||||
        public int State { get; set; }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,55 @@
 | 
			
		|||
using SqlSugar;
 | 
			
		||||
using System;
 | 
			
		||||
using System.Collections.Generic;
 | 
			
		||||
using System.Linq;
 | 
			
		||||
using System.Text;
 | 
			
		||||
using System.Threading.Tasks;
 | 
			
		||||
 | 
			
		||||
namespace DM_Weight.Models
 | 
			
		||||
{
 | 
			
		||||
    [SugarTable("hkc_shiftsreport")]
 | 
			
		||||
    public class ShiftsReport
 | 
			
		||||
    {
 | 
			
		||||
        [SugarColumn(ColumnName = "id", IsPrimaryKey = true)]
 | 
			
		||||
        public int Id { get; set; }
 | 
			
		||||
 | 
			
		||||
        [SugarColumn(ColumnName = "drug_name")]
 | 
			
		||||
        public string DrugName { get; set; }
 | 
			
		||||
 | 
			
		||||
        [SugarColumn(ColumnName = "drug_spec")]
 | 
			
		||||
        public string DrugSpec { get; set; }
 | 
			
		||||
 | 
			
		||||
        [SugarColumn(ColumnName = "beforeNum")]
 | 
			
		||||
        public int? BeforeNum { get; set; }
 | 
			
		||||
 | 
			
		||||
        [SugarColumn(ColumnName = "getNum")]
 | 
			
		||||
        public int? GetNum { get; set; }
 | 
			
		||||
 | 
			
		||||
        [SugarColumn(ColumnName = "useNum")]
 | 
			
		||||
        public int? UseNum { get; set; }
 | 
			
		||||
 | 
			
		||||
        [SugarColumn(ColumnName = "manu_no")]
 | 
			
		||||
        public string ManuNo { get; set; }
 | 
			
		||||
 | 
			
		||||
        [SugarColumn(ColumnName = "surplus")]
 | 
			
		||||
        public int? Surplus { get; set; }
 | 
			
		||||
 | 
			
		||||
        [SugarColumn(ColumnName = "opt_Date")]
 | 
			
		||||
        public DateTime OptDate { get; set; }
 | 
			
		||||
 | 
			
		||||
        [SugarColumn(ColumnName = "FromOperator")]
 | 
			
		||||
        public string FromOperator { get; set; }
 | 
			
		||||
 | 
			
		||||
        [SugarColumn(ColumnName = "FromReviewer")]
 | 
			
		||||
        public string FromReviewer { get; set; }
 | 
			
		||||
 | 
			
		||||
        [SugarColumn(ColumnName = "ToOperator")]
 | 
			
		||||
        public string ToOperator { get; set; }
 | 
			
		||||
 | 
			
		||||
        [SugarColumn(ColumnName = "ToReviewer")]
 | 
			
		||||
        public string ToReviewer { get; set; }
 | 
			
		||||
 | 
			
		||||
        [SugarColumn(ColumnName = "machineId")]
 | 
			
		||||
        public string MachineId { get; set; }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -23,6 +23,10 @@ using Unity;
 | 
			
		|||
using DM_Weight.msg;
 | 
			
		||||
using DM_Weight.Views;
 | 
			
		||||
using System.Reflection;
 | 
			
		||||
using DM_Weight.HIKVISION;
 | 
			
		||||
using PreviewDemo;
 | 
			
		||||
using System.Runtime.InteropServices;
 | 
			
		||||
using DM_Weight.Common;
 | 
			
		||||
 | 
			
		||||
namespace DM_Weight.Port
 | 
			
		||||
{
 | 
			
		||||
| 
						 | 
				
			
			@ -37,6 +41,9 @@ namespace DM_Weight.Port
 | 
			
		|||
        // 条码枪串口
 | 
			
		||||
        public SerialPort scanCodeSerial;
 | 
			
		||||
 | 
			
		||||
        // 冰箱串口
 | 
			
		||||
        public SerialPort fridgeSerial;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
        // 抽屉串口协议232 | 485
 | 
			
		||||
        private int _drawerProtocol = Convert.ToInt32(ConfigurationManager.AppSettings["DrawerProtocol"]);
 | 
			
		||||
| 
						 | 
				
			
			@ -71,14 +78,16 @@ namespace DM_Weight.Port
 | 
			
		|||
        private int[] AfterQuantity { get; set; } = new int[] { };
 | 
			
		||||
 | 
			
		||||
        // 整体流程状态
 | 
			
		||||
        public int statue { get; set; } = 0;
 | 
			
		||||
        private int statue { get; set; } = 0;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
        // 是否正在操作中
 | 
			
		||||
        public bool Operate { get; set; }
 | 
			
		||||
        
 | 
			
		||||
        public DateTime dateTime { get; set; } = DateTime.Now;
 | 
			
		||||
        //冰箱是否正在操作中
 | 
			
		||||
        public bool FridgeOperate { get; set; }
 | 
			
		||||
 | 
			
		||||
        public DateTime dateTime { get; set; } = DateTime.Now;
 | 
			
		||||
 | 
			
		||||
        public async void ResetData()
 | 
			
		||||
        {
 | 
			
		||||
| 
						 | 
				
			
			@ -120,9 +129,12 @@ namespace DM_Weight.Port
 | 
			
		|||
 | 
			
		||||
        public async void Start()
 | 
			
		||||
        {
 | 
			
		||||
 | 
			
		||||
            logger.Info($"进行抽屉操作抽屉号【{DrawerNo}】类型【{BoardType}】库位【{string.Join(",", ColNos)}】窗口【{WindowName}】");
 | 
			
		||||
            Operate = true;
 | 
			
		||||
 | 
			
		||||
            //开始录像
 | 
			
		||||
            //_chkFunction.HIKStartDVRRecord();
 | 
			
		||||
            logger.Info($"时间:{DateTime.Now}");
 | 
			
		||||
            try
 | 
			
		||||
            {
 | 
			
		||||
                // 储物箱直接开
 | 
			
		||||
| 
						 | 
				
			
			@ -250,6 +262,12 @@ namespace DM_Weight.Port
 | 
			
		|||
                                // 药盒指示灯使能
 | 
			
		||||
                                await BoxLockLightOn();
 | 
			
		||||
                            }
 | 
			
		||||
                            // 药盒
 | 
			
		||||
                            if (BoardType == 35)
 | 
			
		||||
                            {
 | 
			
		||||
                                // 药盒带屏幕
 | 
			
		||||
                                await OpenBox();
 | 
			
		||||
                            }
 | 
			
		||||
                            if (BoardType == 6)
 | 
			
		||||
                            {
 | 
			
		||||
                                // 药盒指示灯使能
 | 
			
		||||
| 
						 | 
				
			
			@ -574,7 +592,7 @@ namespace DM_Weight.Port
 | 
			
		|||
 | 
			
		||||
 | 
			
		||||
        private readonly IEventAggregator _eventAggregator;
 | 
			
		||||
 | 
			
		||||
        //private CHKFunction _chkFunction;
 | 
			
		||||
        public PortUtil(IEventAggregator eventAggregator)
 | 
			
		||||
        {
 | 
			
		||||
            _eventAggregator = eventAggregator;
 | 
			
		||||
| 
						 | 
				
			
			@ -612,6 +630,20 @@ namespace DM_Weight.Port
 | 
			
		|||
            {
 | 
			
		||||
                logger.Error("条码枪串口打开错误" + e.Message);
 | 
			
		||||
            }
 | 
			
		||||
            #region 湘潭毒麻柜无冰箱
 | 
			
		||||
            //try
 | 
			
		||||
            //{
 | 
			
		||||
            //    string FridgePortPath = ConfigurationManager.AppSettings["FridgePortPath"];
 | 
			
		||||
            //    logger.Info($"打开冰箱串口【{FridgePortPath}】");
 | 
			
		||||
            //    fridgeSerial = new SerialPort(FridgePortPath, 9600, Parity.None, 8);
 | 
			
		||||
            //    fridgeSerial.Open();
 | 
			
		||||
            //    logger.Info($"冰箱串口打开结果【{fridgeSerial.IsOpen}】");
 | 
			
		||||
            //}
 | 
			
		||||
            //catch (Exception e)
 | 
			
		||||
            //{
 | 
			
		||||
            //    logger.Error("冰箱串口打开错误" + e.Message);
 | 
			
		||||
            //}
 | 
			
		||||
            #endregion
 | 
			
		||||
            if (_canBusExsit)
 | 
			
		||||
            {
 | 
			
		||||
                try
 | 
			
		||||
| 
						 | 
				
			
			@ -628,7 +660,7 @@ namespace DM_Weight.Port
 | 
			
		|||
                }
 | 
			
		||||
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            //_chkFunction = chkFunction;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -696,7 +728,7 @@ namespace DM_Weight.Port
 | 
			
		|||
            return await GetBufferByPort(drawerSerial, 11);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public bool DrawerState(int[] r)
 | 
			
		||||
        private bool DrawerState(int[] r)
 | 
			
		||||
        {
 | 
			
		||||
            int index = DrawerNo > 8 ? DrawerNo - 7 : DrawerNo + 1;
 | 
			
		||||
            return r[index] == 0;
 | 
			
		||||
| 
						 | 
				
			
			@ -769,7 +801,7 @@ namespace DM_Weight.Port
 | 
			
		|||
            canBusSerial.Write(buffer, 0, 8);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public int[] CheckStorageStatus(int[] data)
 | 
			
		||||
        private int[] CheckStorageStatus(int[] data)
 | 
			
		||||
        {
 | 
			
		||||
            int a = data[0];
 | 
			
		||||
            int b = data[1];
 | 
			
		||||
| 
						 | 
				
			
			@ -937,7 +969,45 @@ namespace DM_Weight.Port
 | 
			
		|||
            canBusSerial.Write(buffer, 0, 8);
 | 
			
		||||
        }
 | 
			
		||||
        #endregion
 | 
			
		||||
        #region  药盒操作
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// 打开药盒
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        /// <param name="ColNo"></param>
 | 
			
		||||
        /// <returns></returns>
 | 
			
		||||
        public async Task OpenBox()
 | 
			
		||||
        {
 | 
			
		||||
            for (int i = 0; i < ColNos.Length; i++)
 | 
			
		||||
            {
 | 
			
		||||
                int ColNo = ColNos[i];
 | 
			
		||||
                int[] iNum = new int[] { 4, 2, 1 };
 | 
			
		||||
                var colNo2 = ColNo % 3 > 0 ? (ColNo % 3) - 1 : 2;
 | 
			
		||||
                var bColNo = iNum[colNo2];
 | 
			
		||||
                decimal decolNO = (decimal)ColNo;
 | 
			
		||||
                var channel = Convert.ToInt32((DrawerNo * 10 + Math.Ceiling(decolNO / 3)).ToString(), 16);
 | 
			
		||||
                byte[] buffer = new byte[] { 0xaa, (byte)channel, 5, (byte)bColNo, 0x00, 0x00, 0x00, 0xee };
 | 
			
		||||
                //byte[] buffer = new byte[] { 0xaa, 0x11, 0x05,0x01, 0x00,0x00,0x00,0xee};
 | 
			
		||||
                logger.Info($"{Convert.ToHexString(buffer)}");
 | 
			
		||||
                canBusSerial.Write(buffer, 0, 8);
 | 
			
		||||
                await Task.Delay(800);
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
        }
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// 查询药盒状态
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        /// <param name="text"></param>
 | 
			
		||||
        /// <returns></returns>
 | 
			
		||||
        public async Task<byte[]> OpenBoxState(int ColNo)
 | 
			
		||||
        {
 | 
			
		||||
            decimal deColNo = (decimal)ColNo;
 | 
			
		||||
            var channel = Convert.ToInt32((DrawerNo * 10 + Math.Ceiling(deColNo / 3)).ToString(), 16);
 | 
			
		||||
            byte[] buffer = new byte[] { 0xaa, (byte)channel, 2, 0, 0, 0, 0, 0xee };
 | 
			
		||||
            canBusSerial.Write(buffer, 0, 8);
 | 
			
		||||
            return await GetBufferByPort(canBusSerial, 8);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        #endregion
 | 
			
		||||
        private string trim(string text)
 | 
			
		||||
        {
 | 
			
		||||
            //此处使用了转义字符如:\',\",\\,分别表示单引号,双引号,反斜杠
 | 
			
		||||
| 
						 | 
				
			
			@ -1071,7 +1141,84 @@ namespace DM_Weight.Port
 | 
			
		|||
 | 
			
		||||
 | 
			
		||||
        #endregion
 | 
			
		||||
        #region 标签显示屏
 | 
			
		||||
        //清屏
 | 
			
		||||
        public void ClearContentMethod(int drawerNo, int colNo)
 | 
			
		||||
        {
 | 
			
		||||
            decimal deColNo = colNo;
 | 
			
		||||
            //var channel = drawerNo * 10 + Math.Ceiling(deColNo / 3);
 | 
			
		||||
            int[] iNum = new int[] { 3, 2, 1 };
 | 
			
		||||
            var colNo2 = colNo % 3 > 0 ? (colNo % 3) - 1 : 2;
 | 
			
		||||
            var bColNo = Convert.ToInt32((iNum[colNo2] + 10).ToString(), 16);
 | 
			
		||||
            //var index = Convert.ToInt32(((colNo % 3 == 0 ? 3 : colNo % 3)+10).ToString(),16);
 | 
			
		||||
            int channel = Convert.ToInt32((drawerNo * 10 + Math.Ceiling((decimal)colNo / 3)).ToString(), 16);
 | 
			
		||||
            byte[] buffer = new byte[] { 0xaa, (byte)channel, 0x09, (byte)bColNo, 0, 0, 0, 0xee };
 | 
			
		||||
            canBusSerial.Write(buffer, 0, 8);
 | 
			
		||||
            logger.Info($"清屏指令:{Convert.ToHexString(buffer)}");
 | 
			
		||||
        }
 | 
			
		||||
        //刷新内容
 | 
			
		||||
        public async Task ShowContentMethod(int drawerNo, int colNo)
 | 
			
		||||
        {
 | 
			
		||||
            int channel = Convert.ToInt32((drawerNo * 10 + Math.Ceiling((decimal)colNo / 3)).ToString(), 16);
 | 
			
		||||
            byte[] buffer = new byte[] { 0xaa, (byte)channel, 0x0c, 0x00, 0x00, 0x00, 0x00, 0xee };
 | 
			
		||||
            logger.Info($"刷新内容指令:{Convert.ToHexString(buffer)}");
 | 
			
		||||
            canBusSerial.Write(buffer, 0, 8);
 | 
			
		||||
        }
 | 
			
		||||
        // 基础数据写入方法
 | 
			
		||||
        public async Task WriteChannelInfoMethod(int type, string content, int drawerNo, int colNo)
 | 
			
		||||
        {
 | 
			
		||||
            try
 | 
			
		||||
            {
 | 
			
		||||
                canBusSerial.DiscardInBuffer();
 | 
			
		||||
                Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);
 | 
			
		||||
                byte[] contentBuf = Encoding.GetEncoding("gb2312").GetBytes(trim(content));
 | 
			
		||||
                if (content.Length > 10)
 | 
			
		||||
                {
 | 
			
		||||
                    content = content.Substring(0, 10);
 | 
			
		||||
                }
 | 
			
		||||
                int channel = Convert.ToInt32((drawerNo * 10 + Math.Ceiling((decimal)colNo / 3)).ToString(), 16);
 | 
			
		||||
                int[] iNum = new int[] { 3, 2, 1 };
 | 
			
		||||
                var colNo2 = colNo % 3 > 0 ? (colNo % 3) - 1 : 2;
 | 
			
		||||
                var bColNo = iNum[colNo2] + 160;
 | 
			
		||||
                //var index = (colNo % 3 == 0 ? 3 : colNo % 3)+160;
 | 
			
		||||
                if (contentBuf.Length % 2 != 0)
 | 
			
		||||
                {
 | 
			
		||||
                    Array.Resize(ref contentBuf, contentBuf.Length + 1);
 | 
			
		||||
                }
 | 
			
		||||
                byte[] buffer = new byte[] { 0xaa, (byte)channel, (byte)bColNo, (byte)type, 0, 0, 0, 0xee };
 | 
			
		||||
                canBusSerial.Write(buffer, 0, 8);
 | 
			
		||||
                logger.Info($"开始写标签指令:{Convert.ToHexString(buffer)}");
 | 
			
		||||
                await Task.Delay(30);
 | 
			
		||||
                buffer[4] = 1;
 | 
			
		||||
                for (int i = 0; i < contentBuf.Length; i += 2)
 | 
			
		||||
                {
 | 
			
		||||
                    buffer[5] = contentBuf[i];
 | 
			
		||||
                    buffer[6] = contentBuf[i + 1];
 | 
			
		||||
                    canBusSerial.Write(buffer, 0, 8);
 | 
			
		||||
                    logger.Info($"写标签指令:{Convert.ToHexString(buffer)}");
 | 
			
		||||
                    await Task.Delay(30);
 | 
			
		||||
                }
 | 
			
		||||
                buffer[4] = 2;
 | 
			
		||||
                buffer[5] = 0;
 | 
			
		||||
                buffer[6] = 0;
 | 
			
		||||
                canBusSerial.Write(buffer, 0, 8);
 | 
			
		||||
                logger.Info($"结束写标签指令:{Convert.ToHexString(buffer)}");
 | 
			
		||||
                await Task.Delay(30);
 | 
			
		||||
 | 
			
		||||
            }
 | 
			
		||||
            catch (Exception ex)
 | 
			
		||||
            {
 | 
			
		||||
                _eventAggregator.GetEvent<PortUtilEvent>().Publish(new util.DeviceMsg()
 | 
			
		||||
                {
 | 
			
		||||
                    EventType = util.EventType.OPENERROR,
 | 
			
		||||
                    WindowName = WindowName,
 | 
			
		||||
                    Message = $"2.4寸汉显屏异常{ex.Message}"
 | 
			
		||||
                });
 | 
			
		||||
                logger.Info($"2.4寸汉显屏异常:ex:{ex.Message}");
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        #endregion
 | 
			
		||||
        #region 回收箱操作
 | 
			
		||||
        // 打开回收箱
 | 
			
		||||
        public async Task<byte[]> OpenRecover()
 | 
			
		||||
| 
						 | 
				
			
			@ -1289,7 +1436,306 @@ namespace DM_Weight.Port
 | 
			
		|||
            }
 | 
			
		||||
            
 | 
			
		||||
        }
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// 冰箱使能
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        /// <returns></returns>
 | 
			
		||||
        public async Task FridegOpen()
 | 
			
		||||
        {
 | 
			
		||||
            try
 | 
			
		||||
            {
 | 
			
		||||
                fridgeSerial.DiscardInBuffer();
 | 
			
		||||
                byte[] buffer = new byte[] { 0x01, 0x06, 0x10, 0xD4, 0x00, 0x01, 0x0C, 0xF2 };
 | 
			
		||||
                //byte[] buffer = new byte[] { 0x01, 0x06, 0x10, 0xD4, 0x00, 0x01 };
 | 
			
		||||
                ////获取数组CRC校验码
 | 
			
		||||
                //byte[] byteDate = CRC16MODBUS.CrcModBus(buffer);
 | 
			
		||||
                ////Array.Reverse(byteDate);
 | 
			
		||||
                //int dataLength = buffer.Length;
 | 
			
		||||
                //Array.Resize(ref buffer, dataLength + byteDate.Length);
 | 
			
		||||
                //for (int i = 0; i < byteDate.Length; i++)
 | 
			
		||||
                //{
 | 
			
		||||
                //    buffer[dataLength + i] = byteDate[i];
 | 
			
		||||
                //}
 | 
			
		||||
                logger.Info($"冰箱使能【{Convert.ToHexString(buffer)}】");
 | 
			
		||||
                fridgeSerial.Write(buffer, 0, 8);
 | 
			
		||||
                await Task.Delay(80);
 | 
			
		||||
            }
 | 
			
		||||
            catch (Exception ex)
 | 
			
		||||
            {
 | 
			
		||||
                logger.Info($"冰箱使能发生异常:ex:{ex.Message}");
 | 
			
		||||
            }
 | 
			
		||||
            FridgeOperate = false;
 | 
			
		||||
        }
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// 冰箱失能
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        /// <returns></returns>
 | 
			
		||||
        public async Task FridgeOff()
 | 
			
		||||
        {
 | 
			
		||||
            try
 | 
			
		||||
            {
 | 
			
		||||
                fridgeSerial.DiscardInBuffer();
 | 
			
		||||
                byte[] buffer = new byte[] { 0x01, 0x06, 0x10, 0xD4, 0x00, 0x00, 0xCD, 0x32 };
 | 
			
		||||
                //byte[] buffer = new byte[] { 0x01, 0x06, 0x10, 0xD4, 0x00, 0x01 };
 | 
			
		||||
                ////获取数组CRC校验码
 | 
			
		||||
                //byte[] byteDate = CRC16MODBUS.CrcModBus(buffer);
 | 
			
		||||
                ////Array.Reverse(byteDate);
 | 
			
		||||
                //int dataLength = buffer.Length;
 | 
			
		||||
                //Array.Resize(ref buffer, dataLength + byteDate.Length);
 | 
			
		||||
                //for (int i = 0; i < byteDate.Length; i++)
 | 
			
		||||
                //{
 | 
			
		||||
                //    buffer[dataLength + i] = byteDate[i];
 | 
			
		||||
                //}
 | 
			
		||||
                logger.Info($"冰箱失能【{Convert.ToHexString(buffer)}】");
 | 
			
		||||
                fridgeSerial.Write(buffer, 0, 8);
 | 
			
		||||
                await Task.Delay(80);
 | 
			
		||||
            }
 | 
			
		||||
            catch (Exception ex)
 | 
			
		||||
            {
 | 
			
		||||
                logger.Info($"冰箱失能发生异常:ex:{ex.Message}");
 | 
			
		||||
            }
 | 
			
		||||
            FridgeOperate = false;
 | 
			
		||||
        }
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// 冰箱报警使能
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        /// <returns></returns>
 | 
			
		||||
        public async Task FridgeAlarmOn()
 | 
			
		||||
        {
 | 
			
		||||
            try
 | 
			
		||||
            {
 | 
			
		||||
                fridgeSerial.DiscardInBuffer();
 | 
			
		||||
                byte[] buffer = new byte[] { 0x01, 0x06, 0x10, 0xD5, 0x00, 0x01, 0x5D, 0x32 };
 | 
			
		||||
                //byte[] buffer = new byte[] { 0x01, 0x06, 0x10, 0xD5, 0x00, 0x01 };
 | 
			
		||||
                ////获取数组CRC校验码
 | 
			
		||||
                //byte[] byteDate = CRC16MODBUS.CrcModBus(buffer);
 | 
			
		||||
                ////Array.Reverse(byteDate);
 | 
			
		||||
                //int dataLength = buffer.Length;
 | 
			
		||||
                //Array.Resize(ref buffer, dataLength + byteDate.Length);
 | 
			
		||||
                //for (int i = 0; i < byteDate.Length; i++)
 | 
			
		||||
                //{
 | 
			
		||||
                //    buffer[dataLength + i] = byteDate[i];
 | 
			
		||||
                //}
 | 
			
		||||
                logger.Info($"冰箱报警使能【{Convert.ToHexString(buffer)}】");
 | 
			
		||||
                fridgeSerial.Write(buffer, 0, 8);
 | 
			
		||||
                await Task.Delay(80);
 | 
			
		||||
            }
 | 
			
		||||
            catch (Exception ex)
 | 
			
		||||
            {
 | 
			
		||||
                logger.Info($"冰箱报警使能发生异常:ex:{ex.Message}");
 | 
			
		||||
            }
 | 
			
		||||
            FridgeOperate = false;
 | 
			
		||||
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// 冰箱报警失能
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        /// <returns></returns>
 | 
			
		||||
        public async Task FridgeAlarmOff()
 | 
			
		||||
        {
 | 
			
		||||
            try
 | 
			
		||||
            {
 | 
			
		||||
                fridgeSerial.DiscardInBuffer();
 | 
			
		||||
                byte[] buffer = new byte[] { 0x01, 0x06, 0x10, 0xD5, 0x00, 0x00, 0x9C, 0xF2 };
 | 
			
		||||
                //byte[] buffer = new byte[] { 0x01, 0x06, 0x10, 0xD5, 0x00, 0x00 };
 | 
			
		||||
                ////获取数组CRC校验码
 | 
			
		||||
                //byte[] byteDate = CRC16MODBUS.CrcModBus(buffer);
 | 
			
		||||
                ////Array.Reverse(byteDate);
 | 
			
		||||
                //int dataLength = buffer.Length;
 | 
			
		||||
                //Array.Resize(ref buffer, dataLength + byteDate.Length);
 | 
			
		||||
                //for (int i = 0; i < byteDate.Length; i++)
 | 
			
		||||
                //{
 | 
			
		||||
                //    buffer[dataLength + i] = byteDate[i];
 | 
			
		||||
                //}
 | 
			
		||||
                logger.Info($"冰箱报警失能【{Convert.ToHexString(buffer)}】");
 | 
			
		||||
                fridgeSerial.Write(buffer, 0, 8);
 | 
			
		||||
                await Task.Delay(80);
 | 
			
		||||
            }
 | 
			
		||||
            catch (Exception ex)
 | 
			
		||||
            {
 | 
			
		||||
                logger.Info($"冰箱报警失能发生异常:ex:{ex.Message}");
 | 
			
		||||
            }
 | 
			
		||||
            FridgeOperate = false;
 | 
			
		||||
        }
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// 冰箱温度设定最小
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        /// <returns></returns>
 | 
			
		||||
        public async Task FridgeMinSetting(float min)
 | 
			
		||||
        {
 | 
			
		||||
            try
 | 
			
		||||
            {
 | 
			
		||||
 | 
			
		||||
                int iMix = Convert.ToInt32(min * 10);
 | 
			
		||||
                fridgeSerial.DiscardInBuffer();
 | 
			
		||||
                //byte[] bufferMin = new byte[] { 0x01, 0x06, 0x10, 0xC9, 0x00, 0x15, 0x9C, 0xFB };
 | 
			
		||||
                byte[] bufferMin = new byte[] { 0x01, 0x06, 0x10, 0xC9, 0x00, (byte)(iMix & 0xff) };
 | 
			
		||||
                //获取数组CRC校验码
 | 
			
		||||
                byte[] byteDate = CRC16MODBUS.CrcModBus(bufferMin);
 | 
			
		||||
                //Array.Reverse(byteDate);
 | 
			
		||||
                int dataLength = bufferMin.Length;
 | 
			
		||||
                Array.Resize(ref bufferMin, dataLength + byteDate.Length);
 | 
			
		||||
                for (int i = 0; i < byteDate.Length; i++)
 | 
			
		||||
                {
 | 
			
		||||
                    bufferMin[dataLength + i] = byteDate[i];
 | 
			
		||||
                }
 | 
			
		||||
                logger.Info($"冰箱温度设定Min:【{Convert.ToHexString(bufferMin)}】");
 | 
			
		||||
                fridgeSerial.Write(bufferMin, 0, 8);
 | 
			
		||||
            }
 | 
			
		||||
            catch (Exception ex)
 | 
			
		||||
            {
 | 
			
		||||
                logger.Info($"获取冰箱温度发生异常:ex:{ex.Message}");
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// 冰箱温度设定最大
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        /// <returns></returns>
 | 
			
		||||
        public async Task FridgeMaxSetting(float max)
 | 
			
		||||
        {
 | 
			
		||||
            try
 | 
			
		||||
            {
 | 
			
		||||
                int iMax = Convert.ToInt32(max * 10);
 | 
			
		||||
                fridgeSerial.DiscardInBuffer();
 | 
			
		||||
                //byte[] bufferMin = new byte[] { 0x01, 0x06, 0x10, 0xC9, 0x00, 0x15, 0x9C, 0xFB };
 | 
			
		||||
                byte[] bufferMax = new byte[] { 0x01, 0x06, 0x10, 0xC8, 0x00, (byte)(iMax & 0xff) };
 | 
			
		||||
                //获取数组CRC校验码
 | 
			
		||||
                byte[] byteDate = CRC16MODBUS.CrcModBus(bufferMax);
 | 
			
		||||
                //Array.Reverse(byteDate);
 | 
			
		||||
                int dataLength = bufferMax.Length;
 | 
			
		||||
                Array.Resize(ref bufferMax, dataLength + byteDate.Length);
 | 
			
		||||
                for (int i = 0; i < byteDate.Length; i++)
 | 
			
		||||
                {
 | 
			
		||||
                    bufferMax[dataLength + i] = byteDate[i];
 | 
			
		||||
                }
 | 
			
		||||
                logger.Info($"冰箱温度设定Max:【{Convert.ToHexString(bufferMax)}】");
 | 
			
		||||
                fridgeSerial.Write(bufferMax, 0, 8);
 | 
			
		||||
            }
 | 
			
		||||
            catch (Exception ex)
 | 
			
		||||
            {
 | 
			
		||||
                logger.Info($"获取冰箱温度发生异常:ex:{ex.Message}");
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// 获取冰箱温度
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        /// <returns></returns>
 | 
			
		||||
        public async Task<float> GetFridgeTemperature()
 | 
			
		||||
        {
 | 
			
		||||
            float temperature = 0.0f;
 | 
			
		||||
            try
 | 
			
		||||
            {
 | 
			
		||||
                fridgeSerial.DiscardInBuffer();
 | 
			
		||||
 | 
			
		||||
                byte[] buffer = new byte[] { 0x01, 0x03, 0x10, 0x02, 0x00, 0x01, 0x21, 0x0A };
 | 
			
		||||
                //byte[] buffer = new byte[] { 0x01, 0x03, 0x10, 0x02, 0x00, 0x01 };
 | 
			
		||||
 | 
			
		||||
                ////获取数组CRC校验码
 | 
			
		||||
                //byte[] byteDate = CRC16MODBUS.CrcModBus(buffer);
 | 
			
		||||
                ////Array.Reverse(byteDate);
 | 
			
		||||
                //int dataLength = buffer.Length;
 | 
			
		||||
                //Array.Resize(ref buffer, dataLength + byteDate.Length);
 | 
			
		||||
                //for (int i = 0; i < byteDate.Length; i++)
 | 
			
		||||
                //{
 | 
			
		||||
                //    buffer[dataLength + i] = byteDate[i];
 | 
			
		||||
                //}
 | 
			
		||||
 | 
			
		||||
                logger.Info($"获取冰箱温度【{Convert.ToHexString(buffer)}】");
 | 
			
		||||
                fridgeSerial.Write(buffer, 0, 8);
 | 
			
		||||
 | 
			
		||||
                byte[] retByte = await GetBufferByPort(fridgeSerial, 7);
 | 
			
		||||
 | 
			
		||||
                logger.Info($"获取冰箱温度返回【{Convert.ToHexString(retByte)}】");
 | 
			
		||||
 | 
			
		||||
                if (retByte != null && retByte.Length >= 7)
 | 
			
		||||
                {
 | 
			
		||||
                    var hight = retByte[3];
 | 
			
		||||
                    var low = retByte[4];
 | 
			
		||||
                    int iHight = Convert.ToInt32(hight << 8);
 | 
			
		||||
                    int iLow = Convert.ToInt32(retByte[4]);
 | 
			
		||||
                    temperature = Convert.ToSingle(iHight + iLow) / 10;
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
            catch (Exception ex)
 | 
			
		||||
            {
 | 
			
		||||
 | 
			
		||||
                logger.Info($"获取冰箱温度发生异常:ex:{ex.Message}");
 | 
			
		||||
            }
 | 
			
		||||
            return temperature;
 | 
			
		||||
        }
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// 设置冰箱温度
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        /// <returns></returns>
 | 
			
		||||
        public async Task<float> SetFridgeTemperature(float temperature)
 | 
			
		||||
        {
 | 
			
		||||
            int tpt = (int)temperature * 10;
 | 
			
		||||
            byte Temperature = (byte)(tpt & 0xff);
 | 
			
		||||
            try
 | 
			
		||||
            {
 | 
			
		||||
                //if (!FridgeOperate)
 | 
			
		||||
                {
 | 
			
		||||
                    fridgeSerial.DiscardInBuffer();
 | 
			
		||||
 | 
			
		||||
                    //byte[] buffer = new byte[] { 0x01, 0x03, 0x10, 0x02, 0x00, 0x01, 0x21,0x0A };
 | 
			
		||||
                    byte[] buffer = new byte[] { 0x01, 0x06, 0x10, 0x02, 0x00, (byte)Temperature };
 | 
			
		||||
 | 
			
		||||
                    //获取数组CRC校验码
 | 
			
		||||
                    byte[] byteDate = CRC16MODBUS.CrcModBus(buffer);
 | 
			
		||||
                    //Array.Reverse(byteDate);
 | 
			
		||||
                    int dataLength = buffer.Length;
 | 
			
		||||
                    Array.Resize(ref buffer, dataLength + byteDate.Length);
 | 
			
		||||
                    for (int i = 0; i < byteDate.Length; i++)
 | 
			
		||||
                    {
 | 
			
		||||
                        buffer[dataLength + i] = byteDate[i];
 | 
			
		||||
                    }
 | 
			
		||||
                    logger.Info($"设置冰箱温度【{Convert.ToHexString(buffer)}】");
 | 
			
		||||
                    fridgeSerial.Write(buffer, 0, 8);
 | 
			
		||||
 | 
			
		||||
                    await GetBufferByPort(fridgeSerial, 8);
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
            catch (Exception ex)
 | 
			
		||||
            {
 | 
			
		||||
 | 
			
		||||
                logger.Info($"获取冰箱温度发生异常:ex:{ex.Message}");
 | 
			
		||||
            }
 | 
			
		||||
            return temperature;
 | 
			
		||||
        }
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// 冰箱延迟报警
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        /// <returns></returns>
 | 
			
		||||
        public async Task FridgeDelayWarm()
 | 
			
		||||
        {
 | 
			
		||||
            try
 | 
			
		||||
            {
 | 
			
		||||
                //if (!FridgeOperate)
 | 
			
		||||
                {
 | 
			
		||||
                    fridgeSerial.DiscardInBuffer();
 | 
			
		||||
                    byte[] buffer = new byte[] { 0x01, 0x06, 0x10, 0xCD, 0x00, 0x01, 0xDD, 0x35 };
 | 
			
		||||
                    //byte[] buffer = new byte[] { 0x01, 0x06, 0x10, 0xCD, 0x00, 0x01 };
 | 
			
		||||
                    ////获取数组CRC校验码
 | 
			
		||||
                    //byte[] byteDate = CRC16MODBUS.CrcModBus(buffer);
 | 
			
		||||
                    ////Array.Reverse(byteDate);
 | 
			
		||||
                    //int dataLength = buffer.Length;
 | 
			
		||||
                    //Array.Resize(ref buffer, dataLength + byteDate.Length);
 | 
			
		||||
                    //for (int i = 0; i < byteDate.Length; i++)
 | 
			
		||||
                    //{
 | 
			
		||||
                    //    buffer[dataLength + i] = byteDate[i];
 | 
			
		||||
                    //}
 | 
			
		||||
                    logger.Info($"冰箱延迟报警【{Convert.ToHexString(buffer)}】");
 | 
			
		||||
                    fridgeSerial.Write(buffer, 0, 8);
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
            catch (Exception ex)
 | 
			
		||||
            {
 | 
			
		||||
 | 
			
		||||
                logger.Info($"获取冰箱温度发生异常:ex:{ex.Message}");
 | 
			
		||||
            }
 | 
			
		||||
            //FridgeOperate = false;
 | 
			
		||||
        }
 | 
			
		||||
        #endregion
 | 
			
		||||
        #endregion
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -9,6 +9,7 @@ using System.Threading.Tasks;
 | 
			
		|||
using DM_Weight.Models;
 | 
			
		||||
using System.Configuration;
 | 
			
		||||
using DM_Weight.util;
 | 
			
		||||
using System.Diagnostics;
 | 
			
		||||
 | 
			
		||||
namespace DM_Weight.Report
 | 
			
		||||
{
 | 
			
		||||
| 
						 | 
				
			
			@ -43,7 +44,7 @@ namespace DM_Weight.Report
 | 
			
		|||
            //{
 | 
			
		||||
            //    Report.ParameterByName("machine_id").Value = (ConfigurationManager.AppSettings["machineId"] ?? "DM1");
 | 
			
		||||
            //});
 | 
			
		||||
            string machine_id=(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`";
 | 
			
		||||
| 
						 | 
				
			
			@ -57,7 +58,7 @@ namespace DM_Weight.Report
 | 
			
		|||
        {
 | 
			
		||||
            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 p_machine_id = (ConfigurationManager.AppSettings["machineId"] ?? "DM1");
 | 
			
		||||
            // 定义Grid++Report报表主对象
 | 
			
		||||
            GridppReport Report = new GridppReport();
 | 
			
		||||
            // 加载模板文件
 | 
			
		||||
| 
						 | 
				
			
			@ -82,7 +83,65 @@ namespace DM_Weight.Report
 | 
			
		|||
            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报表主对象
 | 
			
		||||
| 
						 | 
				
			
			@ -148,7 +207,7 @@ namespace DM_Weight.Report
 | 
			
		|||
            }
 | 
			
		||||
 | 
			
		||||
            Report.DetailGrid.Recordset.ConnectionString = gridConnectionString;
 | 
			
		||||
            Report.DetailGrid.Recordset.QuerySQL= SQL;
 | 
			
		||||
            Report.DetailGrid.Recordset.QuerySQL = SQL;
 | 
			
		||||
 | 
			
		||||
            Report.PrintPreview(true);
 | 
			
		||||
        }
 | 
			
		||||
| 
						 | 
				
			
			@ -171,5 +230,255 @@ namespace DM_Weight.Report
 | 
			
		|||
            Report.ParameterByName("type").AsInteger = 1;
 | 
			
		||||
            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,di.drug_id2,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>
 | 
			
		||||
        /// <param name="startDate"></param>
 | 
			
		||||
        /// <param name="endDate"></param>
 | 
			
		||||
        /// <param name="type"></param>
 | 
			
		||||
        /// <param name="drug_id"></param>
 | 
			
		||||
        public static void PrintReportAccountBookForDrug(DateTime? startDate, DateTime? endDate, string drug_id)
 | 
			
		||||
        {
 | 
			
		||||
            // 定义Grid++Report报表主对象
 | 
			
		||||
            GridppReport Report = new GridppReport();
 | 
			
		||||
            // 加载模板文件
 | 
			
		||||
            Report.LoadFromFile(new FileInfo(AppDomain.CurrentDomain.BaseDirectory) + "ReportTemp//" + "account_book_temp1.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_time as operationTime, IF(ac.INVOICE_NO='日结','',ac.INVOICE_NO) invoiceNo,
 | 
			
		||||
                         ac.manu_no as manuNo,ac.eff_date as effDate,ac.add_quantity inQuantity,ac.manu_stock as manuQuantity,ac.department as dept,ac.out_quantity as outQuantity,ac.total_stock as totalQuantity,IF(ac.INVOICE_NO='日结',ac.INVOICE_NO,'') as rj,
 | 
			
		||||
	                     di.drug_id2 as drugId,di.drug_name as drugName,di.drug_spec as drugSpec,di.manufactory as manufactory,di.big_unit as bigUnit,u1.user_name as operatorName,u2.user_name as reviewerName,db.baseQuantity
 | 
			
		||||
	                     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 LEFT JOIN DRUG_BASE db on di.drug_id=db.drugid and db.machine_id='{p_machine_id}'
 | 
			
		||||
 		                    WHERE ac.machine_id='{p_machine_id}' and create_time>'{p_startDate}' AND create_time<'{p_endDate}' AND TYPE IN(1,2,3) ";
 | 
			
		||||
            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_time";
 | 
			
		||||
 | 
			
		||||
            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);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// 处方专用账册
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        /// <param name="startDate"></param>
 | 
			
		||||
        /// <param name="endDate"></param>
 | 
			
		||||
        /// <param name="type"></param>
 | 
			
		||||
        /// <param name="drug_id"></param>
 | 
			
		||||
        public static void PrintReportAccountBookForOrder(DateTime? startDate, DateTime? endDate, string drug_id)
 | 
			
		||||
        {
 | 
			
		||||
            // 定义Grid++Report报表主对象
 | 
			
		||||
            GridppReport Report = new GridppReport();
 | 
			
		||||
            // 加载模板文件
 | 
			
		||||
            Report.LoadFromFile(new FileInfo(AppDomain.CurrentDomain.BaseDirectory) + "ReportTemp//" + "account_book_temp_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 ac.create_time as operationTime, ac.manu_no as manuNo,
 | 
			
		||||
	                     ac.eff_date as effDate,ac.department as dept,oi.p_name as pName,oi.sex as sex,oi.age as age,oi.id_number as idNumber,
 | 
			
		||||
                         oi.patient_id as zyh,'' mkh,oi.disease as disease,ac.out_quantity as outQuantity,od.empty_bottle_batch as ftph,oi.doctor_name as doctorName,oi.order_no as orderNo,od.empty_bottle_submitter kptjr,
 | 
			
		||||
	                    di.drug_id as drugId,di.drug_name as drugName,di.drug_spec as drugSpec,di.big_unit AS bigUnit,u1.user_name as operatorName,u2.user_name as reviewerName,db.baseQuantity
 | 
			
		||||
	                     FROM account_book_g2 ac inner join order_info oi on ac.invoice_no=oi.order_no inner join order_detail od on oi.order_no=od.order_no 
 | 
			
		||||
                   left join drug_info di on ac.drug_id=di.drug_id left join drug_base db on di.drug_id=db.DrugId and db.machine_id='DM1' 
 | 
			
		||||
                         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 + "' ";
 | 
			
		||||
            }
 | 
			
		||||
            SQL += " ORDER BY di.drug_id,ac.create_time";
 | 
			
		||||
 | 
			
		||||
            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);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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
 | 
			
		||||
		}
 | 
			
		||||
	]
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -1,5 +1,5 @@
 | 
			
		|||
{
 | 
			
		||||
	"Version":"6.3.0.1",
 | 
			
		||||
	"Version":"6.8.1.1",
 | 
			
		||||
	"Font":{
 | 
			
		||||
		"Name":"宋体",
 | 
			
		||||
		"Size":105000,
 | 
			
		||||
| 
						 | 
				
			
			@ -75,7 +75,7 @@
 | 
			
		|||
				},
 | 
			
		||||
				{
 | 
			
		||||
					"Name":"单位",
 | 
			
		||||
					"DBFieldName":"packUnit"
 | 
			
		||||
					"DBFieldName":"bigUnit"
 | 
			
		||||
				},
 | 
			
		||||
				{
 | 
			
		||||
					"Name":"剂型",
 | 
			
		||||
| 
						 | 
				
			
			@ -100,10 +100,20 @@
 | 
			
		|||
					"Type":"Binary"
 | 
			
		||||
				},
 | 
			
		||||
				{
 | 
			
		||||
					"Name":"drugId"
 | 
			
		||||
					"Name":"drugId",
 | 
			
		||||
					"DBFieldName":"drug_Id"
 | 
			
		||||
				},
 | 
			
		||||
				{
 | 
			
		||||
					"Name":"Field1"
 | 
			
		||||
					"Name":"凭证号",
 | 
			
		||||
					"DBFieldName":"invoiceId"
 | 
			
		||||
				},
 | 
			
		||||
				{
 | 
			
		||||
					"Name":"供应单位",
 | 
			
		||||
					"DBFieldName":"supplierDept"
 | 
			
		||||
				},
 | 
			
		||||
				{
 | 
			
		||||
					"Name":"领用部门",
 | 
			
		||||
					"DBFieldName":"receiveDept"
 | 
			
		||||
				}
 | 
			
		||||
			]
 | 
			
		||||
		},
 | 
			
		||||
| 
						 | 
				
			
			@ -113,7 +123,7 @@
 | 
			
		|||
				"Width":1.77271
 | 
			
		||||
			},
 | 
			
		||||
			{
 | 
			
		||||
				"Name":"操作类型",
 | 
			
		||||
				"Name":"凭证号",
 | 
			
		||||
				"Width":2.19604
 | 
			
		||||
			},
 | 
			
		||||
			{
 | 
			
		||||
| 
						 | 
				
			
			@ -158,20 +168,14 @@
 | 
			
		|||
			"ColumnContentCell":[
 | 
			
		||||
				{
 | 
			
		||||
					"Column":"日期",
 | 
			
		||||
					"WordWrap":true,
 | 
			
		||||
					"TextAlign":"MiddleCenter",
 | 
			
		||||
					"ShrinkFontToFit":true,
 | 
			
		||||
					"DataField":"日期"
 | 
			
		||||
				},
 | 
			
		||||
				{
 | 
			
		||||
					"Column":"操作类型",
 | 
			
		||||
					"FreeCell":true,
 | 
			
		||||
					"Control":[
 | 
			
		||||
						{
 | 
			
		||||
							"Type":"StaticBox",
 | 
			
		||||
							"Name":"StaticBox10",
 | 
			
		||||
							"Dock":"Fill",
 | 
			
		||||
							"TextAlign":"MiddleCenter"
 | 
			
		||||
						}
 | 
			
		||||
					]
 | 
			
		||||
					"Column":"凭证号",
 | 
			
		||||
					"DataField":"凭证号"
 | 
			
		||||
				},
 | 
			
		||||
				{
 | 
			
		||||
					"Column":"批号",
 | 
			
		||||
| 
						 | 
				
			
			@ -229,11 +233,11 @@
 | 
			
		|||
					"FreeCell":true,
 | 
			
		||||
					"Control":[
 | 
			
		||||
						{
 | 
			
		||||
							"Type":"StaticBox",
 | 
			
		||||
							"Name":"StaticBox6",
 | 
			
		||||
							"Type":"FieldBox",
 | 
			
		||||
							"Name":"FieldBox14",
 | 
			
		||||
							"Dock":"Fill",
 | 
			
		||||
							"TextAlign":"MiddleCenter",
 | 
			
		||||
							"Text":"药库"
 | 
			
		||||
							"DataField":"供应单位"
 | 
			
		||||
						}
 | 
			
		||||
					]
 | 
			
		||||
				},
 | 
			
		||||
| 
						 | 
				
			
			@ -242,11 +246,11 @@
 | 
			
		|||
					"FreeCell":true,
 | 
			
		||||
					"Control":[
 | 
			
		||||
						{
 | 
			
		||||
							"Type":"StaticBox",
 | 
			
		||||
							"Name":"StaticBox7",
 | 
			
		||||
							"Type":"FieldBox",
 | 
			
		||||
							"Name":"FieldBox15",
 | 
			
		||||
							"Dock":"Fill",
 | 
			
		||||
							"TextAlign":"MiddleCenter",
 | 
			
		||||
							"Text":"门诊药房"
 | 
			
		||||
							"DataField":"领用部门"
 | 
			
		||||
						}
 | 
			
		||||
					]
 | 
			
		||||
				}
 | 
			
		||||
| 
						 | 
				
			
			@ -270,7 +274,7 @@
 | 
			
		|||
				},
 | 
			
		||||
				{
 | 
			
		||||
					"GroupTitle":false,
 | 
			
		||||
					"Column":"操作类型",
 | 
			
		||||
					"Column":"凭证号",
 | 
			
		||||
					"Font":{
 | 
			
		||||
						"Name":"宋体",
 | 
			
		||||
						"Size":105000,
 | 
			
		||||
| 
						 | 
				
			
			@ -395,6 +399,7 @@
 | 
			
		|||
				"Name":"Group1",
 | 
			
		||||
				"ByFields":"drugId",
 | 
			
		||||
				"GroupHeader":{
 | 
			
		||||
					"NewPage":"Before",
 | 
			
		||||
					"PrintGridBorder":false,
 | 
			
		||||
					"RepeatOnPage":true,
 | 
			
		||||
					"Control":[
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -0,0 +1,669 @@
 | 
			
		|||
{
 | 
			
		||||
	"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":"yy/MM/dd HH:mm:ss",
 | 
			
		||||
					"DBFieldName":"operationTime"
 | 
			
		||||
				},
 | 
			
		||||
				{
 | 
			
		||||
					"Name":"凭证号",
 | 
			
		||||
					"DBFieldName":"invoiceNo"
 | 
			
		||||
				},
 | 
			
		||||
				{
 | 
			
		||||
					"Name":"批号",
 | 
			
		||||
					"DBFieldName":"manuNo"
 | 
			
		||||
				},
 | 
			
		||||
				{
 | 
			
		||||
					"Name":"有效期",
 | 
			
		||||
					"Type":"DateTime",
 | 
			
		||||
					"Format":"yy/M/d",
 | 
			
		||||
					"DBFieldName":"effDate"
 | 
			
		||||
				},
 | 
			
		||||
				{
 | 
			
		||||
					"Name":"厂家",
 | 
			
		||||
					"DBFieldName":"manufactory"
 | 
			
		||||
				},
 | 
			
		||||
				{
 | 
			
		||||
					"Name":"日结",
 | 
			
		||||
					"DBFieldName":"rj"
 | 
			
		||||
				},
 | 
			
		||||
				{
 | 
			
		||||
					"Name":"领入",
 | 
			
		||||
					"Type":"Integer",
 | 
			
		||||
					"DBFieldName":"inQuantity"
 | 
			
		||||
				},
 | 
			
		||||
				{
 | 
			
		||||
					"Name":"科室",
 | 
			
		||||
					"DBFieldName":"dept"
 | 
			
		||||
				},
 | 
			
		||||
				{
 | 
			
		||||
					"Name":"发出",
 | 
			
		||||
					"Type":"Integer",
 | 
			
		||||
					"DBFieldName":"outQuantity"
 | 
			
		||||
				},
 | 
			
		||||
				{
 | 
			
		||||
					"Name":"批号结存",
 | 
			
		||||
					"Type":"Integer",
 | 
			
		||||
					"DBFieldName":"manuQuantity"
 | 
			
		||||
				},
 | 
			
		||||
				{
 | 
			
		||||
					"Name":"总结存",
 | 
			
		||||
					"Type":"Integer",
 | 
			
		||||
					"DBFieldName":"totalQuantity"
 | 
			
		||||
				},
 | 
			
		||||
				{
 | 
			
		||||
					"Name":"发药人",
 | 
			
		||||
					"DBFieldName":"operatorName"
 | 
			
		||||
				},
 | 
			
		||||
				{
 | 
			
		||||
					"Name":"复核人",
 | 
			
		||||
					"DBFieldName":"reviewerName"
 | 
			
		||||
				},
 | 
			
		||||
				{
 | 
			
		||||
					"Name":"药品名称",
 | 
			
		||||
					"DBFieldName":"drugName"
 | 
			
		||||
				},
 | 
			
		||||
				{
 | 
			
		||||
					"Name":"规格",
 | 
			
		||||
					"DBFieldName":"drugSpec"
 | 
			
		||||
				},
 | 
			
		||||
				{
 | 
			
		||||
					"Name":"单位",
 | 
			
		||||
					"DBFieldName":"bigUnit"
 | 
			
		||||
				},
 | 
			
		||||
				{
 | 
			
		||||
					"Name":"基数",
 | 
			
		||||
					"DBFieldName":"baseQuantity"
 | 
			
		||||
				},
 | 
			
		||||
				{
 | 
			
		||||
					"Name":"drugId"
 | 
			
		||||
				}
 | 
			
		||||
			]
 | 
			
		||||
		},
 | 
			
		||||
		"Column":[
 | 
			
		||||
			{
 | 
			
		||||
				"Name":"日期",
 | 
			
		||||
				"Width":1.77271
 | 
			
		||||
			},
 | 
			
		||||
			{
 | 
			
		||||
				"Name":"凭证号",
 | 
			
		||||
				"Width":2.80458
 | 
			
		||||
			},
 | 
			
		||||
			{
 | 
			
		||||
				"Name":"批号",
 | 
			
		||||
				"Width":3.99521
 | 
			
		||||
			},
 | 
			
		||||
			{
 | 
			
		||||
				"Name":"有效期",
 | 
			
		||||
				"Width":2.43417
 | 
			
		||||
			},
 | 
			
		||||
			{
 | 
			
		||||
				"Name":"生产厂家"
 | 
			
		||||
			},
 | 
			
		||||
			{
 | 
			
		||||
				"Name":"日结",
 | 
			
		||||
				"Width":0.978958
 | 
			
		||||
			},
 | 
			
		||||
			{
 | 
			
		||||
				"Name":"领入",
 | 
			
		||||
				"Width":0.79375
 | 
			
		||||
			},
 | 
			
		||||
			{
 | 
			
		||||
				"Name":"科室"
 | 
			
		||||
			},
 | 
			
		||||
			{
 | 
			
		||||
				"Name":"发出",
 | 
			
		||||
				"Width":0.820208
 | 
			
		||||
			},
 | 
			
		||||
			{
 | 
			
		||||
				"Name":"批号结存",
 | 
			
		||||
				"Width":1.19063
 | 
			
		||||
			},
 | 
			
		||||
			{
 | 
			
		||||
				"Name":"总结存",
 | 
			
		||||
				"Width":1.00542
 | 
			
		||||
			},
 | 
			
		||||
			{
 | 
			
		||||
				"Name":"发药人",
 | 
			
		||||
				"Width":1.40229
 | 
			
		||||
			},
 | 
			
		||||
			{
 | 
			
		||||
				"Name":"复核人",
 | 
			
		||||
				"Width":1.40229
 | 
			
		||||
			}
 | 
			
		||||
		],
 | 
			
		||||
		"ColumnContent":{
 | 
			
		||||
			"Height":0.79375,
 | 
			
		||||
			"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":"批号结存",
 | 
			
		||||
					"TextAlign":"MiddleCenter",
 | 
			
		||||
					"DataField":"批号结存"
 | 
			
		||||
				},
 | 
			
		||||
				{
 | 
			
		||||
					"Column":"总结存",
 | 
			
		||||
					"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":"复核人"
 | 
			
		||||
						}
 | 
			
		||||
					]
 | 
			
		||||
				}
 | 
			
		||||
			]
 | 
			
		||||
		},
 | 
			
		||||
		"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":"有效期"
 | 
			
		||||
				},
 | 
			
		||||
				{
 | 
			
		||||
					"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":"发出"
 | 
			
		||||
				},
 | 
			
		||||
				{
 | 
			
		||||
					"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
 | 
			
		||||
					},
 | 
			
		||||
					"FreeCell":true,
 | 
			
		||||
					"Control":[
 | 
			
		||||
						{
 | 
			
		||||
							"Type":"StaticBox",
 | 
			
		||||
							"Name":"日结人",
 | 
			
		||||
							"Top":0.61,
 | 
			
		||||
							"Width":1.40229,
 | 
			
		||||
							"Height":0.5,
 | 
			
		||||
							"TextAlign":"MiddleCenter",
 | 
			
		||||
							"Text":"日结人"
 | 
			
		||||
						},
 | 
			
		||||
						{
 | 
			
		||||
							"Type":"StaticBox",
 | 
			
		||||
							"Name":"发药人",
 | 
			
		||||
							"Width":1.40229,
 | 
			
		||||
							"Height":0.582083,
 | 
			
		||||
							"Border":{
 | 
			
		||||
								"Styles":"[DrawBottom]"
 | 
			
		||||
							},
 | 
			
		||||
							"TextAlign":"MiddleCenter",
 | 
			
		||||
							"Text":"发药人"
 | 
			
		||||
						}
 | 
			
		||||
					]
 | 
			
		||||
				},
 | 
			
		||||
				{
 | 
			
		||||
					"GroupTitle":false,
 | 
			
		||||
					"Column":"复核人",
 | 
			
		||||
					"Font":{
 | 
			
		||||
						"Name":"宋体",
 | 
			
		||||
						"Size":105000,
 | 
			
		||||
						"Bold":true,
 | 
			
		||||
						"Charset":134
 | 
			
		||||
					},
 | 
			
		||||
					"FreeCell":true,
 | 
			
		||||
					"Control":[
 | 
			
		||||
						{
 | 
			
		||||
							"Type":"StaticBox",
 | 
			
		||||
							"Name":"复核人",
 | 
			
		||||
							"Width":1.40229,
 | 
			
		||||
							"Height":0.58,
 | 
			
		||||
							"Border":{
 | 
			
		||||
								"Styles":"[DrawBottom]"
 | 
			
		||||
							},
 | 
			
		||||
							"TextAlign":"MiddleCenter",
 | 
			
		||||
							"Text":"复核人"
 | 
			
		||||
						},
 | 
			
		||||
						{
 | 
			
		||||
							"Type":"StaticBox",
 | 
			
		||||
							"Name":"交接人",
 | 
			
		||||
							"Top":0.608542,
 | 
			
		||||
							"Width":1.5875,
 | 
			
		||||
							"Height":0.5,
 | 
			
		||||
							"TextAlign":"MiddleCenter",
 | 
			
		||||
							"Text":"交接人"
 | 
			
		||||
						}
 | 
			
		||||
					]
 | 
			
		||||
				}
 | 
			
		||||
			]
 | 
			
		||||
		},
 | 
			
		||||
		"Group":[
 | 
			
		||||
			{
 | 
			
		||||
				"Name":"Group1",
 | 
			
		||||
				"ByFields":"drugId",
 | 
			
		||||
				"GroupHeader":{
 | 
			
		||||
					"NewPage":"Before",
 | 
			
		||||
					"PrintGridBorder":false,
 | 
			
		||||
					"RepeatOnPage":true,
 | 
			
		||||
					"Control":[
 | 
			
		||||
						{
 | 
			
		||||
							"Type":"StaticBox",
 | 
			
		||||
							"Name":"StaticBox18",
 | 
			
		||||
							"Left":11.27,
 | 
			
		||||
							"Width":1.22,
 | 
			
		||||
							"Height":1.19,
 | 
			
		||||
							"Border":{
 | 
			
		||||
								"Styles":"[DrawTop]"
 | 
			
		||||
							},
 | 
			
		||||
							"Font":{
 | 
			
		||||
								"Name":"宋体",
 | 
			
		||||
								"Size":105000,
 | 
			
		||||
								"Bold":true,
 | 
			
		||||
								"Charset":134
 | 
			
		||||
							},
 | 
			
		||||
							"Text":"单位:"
 | 
			
		||||
						},
 | 
			
		||||
						{
 | 
			
		||||
							"Type":"FieldBox",
 | 
			
		||||
							"Name":"FieldBox9",
 | 
			
		||||
							"Left":12.49,
 | 
			
		||||
							"Width":3.28,
 | 
			
		||||
							"Height":1.19,
 | 
			
		||||
							"Border":{
 | 
			
		||||
								"Styles":"[DrawTop]"
 | 
			
		||||
							},
 | 
			
		||||
							"Font":{
 | 
			
		||||
								"Name":"宋体",
 | 
			
		||||
								"Size":105000,
 | 
			
		||||
								"Bold":true,
 | 
			
		||||
								"Charset":134
 | 
			
		||||
							},
 | 
			
		||||
							"DataField":"单位"
 | 
			
		||||
						},
 | 
			
		||||
						{
 | 
			
		||||
							"Type":"StaticBox",
 | 
			
		||||
							"Name":"StaticBox20",
 | 
			
		||||
							"Left":15.77,
 | 
			
		||||
							"Width":1.82563,
 | 
			
		||||
							"Height":1.19,
 | 
			
		||||
							"Border":{
 | 
			
		||||
								"Styles":"[DrawTop]"
 | 
			
		||||
							},
 | 
			
		||||
							"Font":{
 | 
			
		||||
								"Name":"宋体",
 | 
			
		||||
								"Size":105000,
 | 
			
		||||
								"Bold":true,
 | 
			
		||||
								"Charset":134
 | 
			
		||||
							},
 | 
			
		||||
							"Text":"基数:"
 | 
			
		||||
						},
 | 
			
		||||
						{
 | 
			
		||||
							"Type":"FieldBox",
 | 
			
		||||
							"Name":"FieldBox11",
 | 
			
		||||
							"Left":17.5948,
 | 
			
		||||
							"Width":1.61396,
 | 
			
		||||
							"Height":1.19,
 | 
			
		||||
							"Border":{
 | 
			
		||||
								"Styles":"[DrawTop]"
 | 
			
		||||
							},
 | 
			
		||||
							"Font":{
 | 
			
		||||
								"Name":"宋体",
 | 
			
		||||
								"Size":105000,
 | 
			
		||||
								"Bold":true,
 | 
			
		||||
								"Charset":134
 | 
			
		||||
							},
 | 
			
		||||
							"DataField":"基数"
 | 
			
		||||
						},
 | 
			
		||||
						{
 | 
			
		||||
							"Type":"StaticBox",
 | 
			
		||||
							"Name":"StaticBox16",
 | 
			
		||||
							"Dock":"Left",
 | 
			
		||||
							"Width":2.2,
 | 
			
		||||
							"Border":{
 | 
			
		||||
								"Styles":"[DrawLeft|DrawTop]"
 | 
			
		||||
							},
 | 
			
		||||
							"Font":{
 | 
			
		||||
								"Name":"宋体",
 | 
			
		||||
								"Size":105000,
 | 
			
		||||
								"Bold":true,
 | 
			
		||||
								"Charset":134
 | 
			
		||||
							},
 | 
			
		||||
							"Text":"药品名称:"
 | 
			
		||||
						},
 | 
			
		||||
						{
 | 
			
		||||
							"Type":"StaticBox",
 | 
			
		||||
							"Name":"StaticBox17",
 | 
			
		||||
							"Left":6.99,
 | 
			
		||||
							"Width":1.11,
 | 
			
		||||
							"Height":1.19,
 | 
			
		||||
							"Border":{
 | 
			
		||||
								"Styles":"[DrawTop]"
 | 
			
		||||
							},
 | 
			
		||||
							"Font":{
 | 
			
		||||
								"Name":"宋体",
 | 
			
		||||
								"Size":105000,
 | 
			
		||||
								"Bold":true,
 | 
			
		||||
								"Charset":134
 | 
			
		||||
							},
 | 
			
		||||
							"Text":"规格:"
 | 
			
		||||
						},
 | 
			
		||||
						{
 | 
			
		||||
							"Type":"FieldBox",
 | 
			
		||||
							"Name":"FieldBox7",
 | 
			
		||||
							"Dock":"Left",
 | 
			
		||||
							"Left":2.2,
 | 
			
		||||
							"Width":4.79,
 | 
			
		||||
							"Border":{
 | 
			
		||||
								"Styles":"[DrawTop]"
 | 
			
		||||
							},
 | 
			
		||||
							"Font":{
 | 
			
		||||
								"Name":"宋体",
 | 
			
		||||
								"Size":105000,
 | 
			
		||||
								"Bold":true,
 | 
			
		||||
								"Charset":134
 | 
			
		||||
							},
 | 
			
		||||
							"DataField":"药品名称"
 | 
			
		||||
						},
 | 
			
		||||
						{
 | 
			
		||||
							"Type":"FieldBox",
 | 
			
		||||
							"Name":"FieldBox8",
 | 
			
		||||
							"Left":8.1,
 | 
			
		||||
							"Width":3.17,
 | 
			
		||||
							"Height":1.19,
 | 
			
		||||
							"Border":{
 | 
			
		||||
								"Styles":"[DrawTop]"
 | 
			
		||||
							},
 | 
			
		||||
							"Font":{
 | 
			
		||||
								"Name":"宋体",
 | 
			
		||||
								"Size":105000,
 | 
			
		||||
								"Bold":true,
 | 
			
		||||
								"Charset":134
 | 
			
		||||
							},
 | 
			
		||||
							"DataField":"规格"
 | 
			
		||||
						},
 | 
			
		||||
						{
 | 
			
		||||
							"Type":"StaticBox",
 | 
			
		||||
							"Name":"药品ID:",
 | 
			
		||||
							"Left":19.2088,
 | 
			
		||||
							"Width":1.98438,
 | 
			
		||||
							"Height":1.19,
 | 
			
		||||
							"Border":{
 | 
			
		||||
								"Styles":"[DrawTop]"
 | 
			
		||||
							},
 | 
			
		||||
							"Font":{
 | 
			
		||||
								"Name":"宋体",
 | 
			
		||||
								"Size":105000,
 | 
			
		||||
								"Bold":true,
 | 
			
		||||
								"Charset":134
 | 
			
		||||
							},
 | 
			
		||||
							"Text":"药品ID:"
 | 
			
		||||
						},
 | 
			
		||||
						{
 | 
			
		||||
							"Type":"FieldBox",
 | 
			
		||||
							"Name":"FieldBox14",
 | 
			
		||||
							"Dock":"Right",
 | 
			
		||||
							"Left":21.1931,
 | 
			
		||||
							"Width":3.41313,
 | 
			
		||||
							"Border":{
 | 
			
		||||
								"Styles":"[DrawTop|DrawRight]"
 | 
			
		||||
							},
 | 
			
		||||
							"Font":{
 | 
			
		||||
								"Name":"宋体",
 | 
			
		||||
								"Size":105000,
 | 
			
		||||
								"Bold":true,
 | 
			
		||||
								"Charset":134
 | 
			
		||||
							},
 | 
			
		||||
							"DataField":"drugId"
 | 
			
		||||
						}
 | 
			
		||||
					],
 | 
			
		||||
					"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
 | 
			
		||||
		}
 | 
			
		||||
	]
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,774 @@
 | 
			
		|||
{
 | 
			
		||||
	"Version":"6.8.1.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,
 | 
			
		||||
		"AppendBlankRow":true,
 | 
			
		||||
		"Recordset":{
 | 
			
		||||
			"Field":[
 | 
			
		||||
				{
 | 
			
		||||
					"Name":"日期",
 | 
			
		||||
					"Type":"DateTime",
 | 
			
		||||
					"Format":"yyyy/MM/dd HH:mm:ss",
 | 
			
		||||
					"DBFieldName":"operationTime"
 | 
			
		||||
				},
 | 
			
		||||
				{
 | 
			
		||||
					"Name":"药品名称",
 | 
			
		||||
					"DBFieldName":"drugName"
 | 
			
		||||
				},
 | 
			
		||||
				{
 | 
			
		||||
					"Name":"规格",
 | 
			
		||||
					"DBFieldName":"drugSpec"
 | 
			
		||||
				},
 | 
			
		||||
				{
 | 
			
		||||
					"Name":"单位",
 | 
			
		||||
					"DBFieldName":"bigUnit"
 | 
			
		||||
				},
 | 
			
		||||
				{
 | 
			
		||||
					"Name":"基数",
 | 
			
		||||
					"DBFieldName":"baseQuantity"
 | 
			
		||||
				},
 | 
			
		||||
				{
 | 
			
		||||
					"Name":"批号",
 | 
			
		||||
					"DBFieldName":"manuNo"
 | 
			
		||||
				},
 | 
			
		||||
				{
 | 
			
		||||
					"Name":"有效期",
 | 
			
		||||
					"Type":"DateTime",
 | 
			
		||||
					"Format":"yy/M/d",
 | 
			
		||||
					"DBFieldName":"effDate"
 | 
			
		||||
				},
 | 
			
		||||
				{
 | 
			
		||||
					"Name":"科室",
 | 
			
		||||
					"DBFieldName":"dept"
 | 
			
		||||
				},
 | 
			
		||||
				{
 | 
			
		||||
					"Name":"患者姓名",
 | 
			
		||||
					"DBFieldName":"pName"
 | 
			
		||||
				},
 | 
			
		||||
				{
 | 
			
		||||
					"Name":"性别",
 | 
			
		||||
					"DBFieldName":"sex"
 | 
			
		||||
				},
 | 
			
		||||
				{
 | 
			
		||||
					"Name":"年龄",
 | 
			
		||||
					"DBFieldName":"age"
 | 
			
		||||
				},
 | 
			
		||||
				{
 | 
			
		||||
					"Name":"身份证号",
 | 
			
		||||
					"DBFieldName":"idNumber"
 | 
			
		||||
				},
 | 
			
		||||
				{
 | 
			
		||||
					"Name":"住院号",
 | 
			
		||||
					"DBFieldName":"zyh"
 | 
			
		||||
				},
 | 
			
		||||
				{
 | 
			
		||||
					"Name":"麻卡号",
 | 
			
		||||
					"DBFieldName":"mkh"
 | 
			
		||||
				},
 | 
			
		||||
				{
 | 
			
		||||
					"Name":"疾病名称",
 | 
			
		||||
					"DBFieldName":"disease"
 | 
			
		||||
				},
 | 
			
		||||
				{
 | 
			
		||||
					"Name":"数量",
 | 
			
		||||
					"DBFieldName":"outQuantity"
 | 
			
		||||
				},
 | 
			
		||||
				{
 | 
			
		||||
					"Name":"废贴批号",
 | 
			
		||||
					"DBFieldName":"ftph"
 | 
			
		||||
				},
 | 
			
		||||
				{
 | 
			
		||||
					"Name":"医师",
 | 
			
		||||
					"DBFieldName":"doctorName"
 | 
			
		||||
				},
 | 
			
		||||
				{
 | 
			
		||||
					"Name":"处方编号",
 | 
			
		||||
					"DBFieldName":"orderNo"
 | 
			
		||||
				},
 | 
			
		||||
				{
 | 
			
		||||
					"Name":"空瓶提交人",
 | 
			
		||||
					"DBFieldName":"kptjr"
 | 
			
		||||
				},
 | 
			
		||||
				{
 | 
			
		||||
					"Name":"空瓶回收人",
 | 
			
		||||
					"DBFieldName":"operatorName"
 | 
			
		||||
				},
 | 
			
		||||
				{
 | 
			
		||||
					"Name":"空瓶毁形人",
 | 
			
		||||
					"DBFieldName":"reviewerName"
 | 
			
		||||
				},
 | 
			
		||||
				{
 | 
			
		||||
					"Name":"药品ID",
 | 
			
		||||
					"DBFieldName":"drugId"
 | 
			
		||||
				}
 | 
			
		||||
			]
 | 
			
		||||
		},
 | 
			
		||||
		"Column":[
 | 
			
		||||
			{
 | 
			
		||||
				"Name":"日期",
 | 
			
		||||
				"Width":1.77271
 | 
			
		||||
			},
 | 
			
		||||
			{
 | 
			
		||||
				"Name":"批号",
 | 
			
		||||
				"Width":2.01083,
 | 
			
		||||
				"Visible":false
 | 
			
		||||
			},
 | 
			
		||||
			{
 | 
			
		||||
				"Name":"效期",
 | 
			
		||||
				"Width":1.61396,
 | 
			
		||||
				"Visible":false
 | 
			
		||||
			},
 | 
			
		||||
			{
 | 
			
		||||
				"Name":"科室",
 | 
			
		||||
				"Visible":false
 | 
			
		||||
			},
 | 
			
		||||
			{
 | 
			
		||||
				"Name":"患者姓名",
 | 
			
		||||
				"Width":1.5875
 | 
			
		||||
			},
 | 
			
		||||
			{
 | 
			
		||||
				"Name":"性别",
 | 
			
		||||
				"Width":1.40229
 | 
			
		||||
			},
 | 
			
		||||
			{
 | 
			
		||||
				"Name":"年龄",
 | 
			
		||||
				"Width":1.40229
 | 
			
		||||
			},
 | 
			
		||||
			{
 | 
			
		||||
				"Name":"身份证号"
 | 
			
		||||
			},
 | 
			
		||||
			{
 | 
			
		||||
				"Name":"门诊/住院号"
 | 
			
		||||
			},
 | 
			
		||||
			{
 | 
			
		||||
				"Name":"专用病历号(麻卡号)",
 | 
			
		||||
				"Visible":false
 | 
			
		||||
			},
 | 
			
		||||
			{
 | 
			
		||||
				"Name":"疾病名称"
 | 
			
		||||
			},
 | 
			
		||||
			{
 | 
			
		||||
				"Name":"数量",
 | 
			
		||||
				"Width":1.05833
 | 
			
		||||
			},
 | 
			
		||||
			{
 | 
			
		||||
				"Name":"回收空瓶废贴批号"
 | 
			
		||||
			},
 | 
			
		||||
			{
 | 
			
		||||
				"Name":"医师",
 | 
			
		||||
				"Width":1.79917
 | 
			
		||||
			},
 | 
			
		||||
			{
 | 
			
		||||
				"Name":"处方编号"
 | 
			
		||||
			},
 | 
			
		||||
			{
 | 
			
		||||
				"Name":"空瓶提交人",
 | 
			
		||||
				"Width":1.82563
 | 
			
		||||
			},
 | 
			
		||||
			{
 | 
			
		||||
				"Name":"空瓶回收人",
 | 
			
		||||
				"Width":1.37583
 | 
			
		||||
			},
 | 
			
		||||
			{
 | 
			
		||||
				"Name":"空瓶毁形人",
 | 
			
		||||
				"Width":1.79917
 | 
			
		||||
			}
 | 
			
		||||
		],
 | 
			
		||||
		"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":"专用病历号(麻卡号)",
 | 
			
		||||
					"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":"空瓶毁形人",
 | 
			
		||||
					"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":"科室"
 | 
			
		||||
				},
 | 
			
		||||
				{
 | 
			
		||||
					"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":"性别"
 | 
			
		||||
				},
 | 
			
		||||
				{
 | 
			
		||||
					"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号(麻卡\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":"回收空\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":"空瓶提\r\n交人"
 | 
			
		||||
				},
 | 
			
		||||
				{
 | 
			
		||||
					"GroupTitle":false,
 | 
			
		||||
					"Column":"空瓶回收人",
 | 
			
		||||
					"Font":{
 | 
			
		||||
						"Name":"宋体",
 | 
			
		||||
						"Size":105000,
 | 
			
		||||
						"Bold":true,
 | 
			
		||||
						"Charset":134
 | 
			
		||||
					},
 | 
			
		||||
					"FreeCell":true,
 | 
			
		||||
					"Control":[
 | 
			
		||||
						{
 | 
			
		||||
							"Type":"StaticBox",
 | 
			
		||||
							"Name":"发药人",
 | 
			
		||||
							"Width":1.5,
 | 
			
		||||
							"Height":0.5,
 | 
			
		||||
							"Border":{
 | 
			
		||||
								"Styles":"[DrawBottom]"
 | 
			
		||||
							},
 | 
			
		||||
							"TextAlign":"MiddleCenter",
 | 
			
		||||
							"Text":"发药人"
 | 
			
		||||
						},
 | 
			
		||||
						{
 | 
			
		||||
							"Type":"StaticBox",
 | 
			
		||||
							"Name":"StaticBox21",
 | 
			
		||||
							"Top":0.5,
 | 
			
		||||
							"Width":1.5875,
 | 
			
		||||
							"Height":0.582083,
 | 
			
		||||
							"TextAlign":"MiddleCenter",
 | 
			
		||||
							"Text":"空瓶回\r\n收人"
 | 
			
		||||
						}
 | 
			
		||||
					]
 | 
			
		||||
				},
 | 
			
		||||
				{
 | 
			
		||||
					"GroupTitle":false,
 | 
			
		||||
					"Column":"空瓶毁形人",
 | 
			
		||||
					"Font":{
 | 
			
		||||
						"Name":"宋体",
 | 
			
		||||
						"Size":105000,
 | 
			
		||||
						"Bold":true,
 | 
			
		||||
						"Charset":134
 | 
			
		||||
					},
 | 
			
		||||
					"FreeCell":true,
 | 
			
		||||
					"Control":[
 | 
			
		||||
						{
 | 
			
		||||
							"Type":"StaticBox",
 | 
			
		||||
							"Name":"复核人",
 | 
			
		||||
							"Width":1.5,
 | 
			
		||||
							"Height":0.5,
 | 
			
		||||
							"Border":{
 | 
			
		||||
								"Styles":"[DrawBottom]"
 | 
			
		||||
							},
 | 
			
		||||
							"TextAlign":"MiddleCenter",
 | 
			
		||||
							"Text":"复核人"
 | 
			
		||||
						},
 | 
			
		||||
						{
 | 
			
		||||
							"Type":"StaticBox",
 | 
			
		||||
							"Name":"StaticBox22",
 | 
			
		||||
							"Top":0.5,
 | 
			
		||||
							"Width":1.5875,
 | 
			
		||||
							"Height":0.687917,
 | 
			
		||||
							"TextAlign":"MiddleCenter",
 | 
			
		||||
							"Text":"空瓶毁\r\n形人"
 | 
			
		||||
						}
 | 
			
		||||
					]
 | 
			
		||||
				}
 | 
			
		||||
			]
 | 
			
		||||
		},
 | 
			
		||||
		"Group":[
 | 
			
		||||
			{
 | 
			
		||||
				"Name":"Group1",
 | 
			
		||||
				"ByFields":"药品ID",
 | 
			
		||||
				"GroupHeader":{
 | 
			
		||||
					"NewPage":"Before",
 | 
			
		||||
					"PrintGridBorder":false,
 | 
			
		||||
					"RepeatOnPage":true,
 | 
			
		||||
					"Control":[
 | 
			
		||||
						{
 | 
			
		||||
							"Type":"StaticBox",
 | 
			
		||||
							"Name":"StaticBox16",
 | 
			
		||||
							"Dock":"Left",
 | 
			
		||||
							"Width":2.19604,
 | 
			
		||||
							"Border":{
 | 
			
		||||
								"Styles":"[DrawLeft|DrawTop]"
 | 
			
		||||
							},
 | 
			
		||||
							"Font":{
 | 
			
		||||
								"Name":"宋体",
 | 
			
		||||
								"Size":105000,
 | 
			
		||||
								"Bold":true,
 | 
			
		||||
								"Charset":134
 | 
			
		||||
							},
 | 
			
		||||
							"Text":"药品名称:"
 | 
			
		||||
						},
 | 
			
		||||
						{
 | 
			
		||||
							"Type":"FieldBox",
 | 
			
		||||
							"Name":"FieldBox7",
 | 
			
		||||
							"Dock":"Left",
 | 
			
		||||
							"Left":2.19604,
 | 
			
		||||
							"Width":4.78896,
 | 
			
		||||
							"Border":{
 | 
			
		||||
								"Styles":"[DrawTop]"
 | 
			
		||||
							},
 | 
			
		||||
							"Font":{
 | 
			
		||||
								"Name":"宋体",
 | 
			
		||||
								"Size":105000,
 | 
			
		||||
								"Bold":true,
 | 
			
		||||
								"Charset":134
 | 
			
		||||
							},
 | 
			
		||||
							"DataField":"药品名称"
 | 
			
		||||
						},
 | 
			
		||||
						{
 | 
			
		||||
							"Type":"StaticBox",
 | 
			
		||||
							"Name":"StaticBox17",
 | 
			
		||||
							"Dock":"Left",
 | 
			
		||||
							"Left":6.985,
 | 
			
		||||
							"Width":1.11125,
 | 
			
		||||
							"Border":{
 | 
			
		||||
								"Styles":"[DrawTop]"
 | 
			
		||||
							},
 | 
			
		||||
							"Font":{
 | 
			
		||||
								"Name":"宋体",
 | 
			
		||||
								"Size":105000,
 | 
			
		||||
								"Bold":true,
 | 
			
		||||
								"Charset":134
 | 
			
		||||
							},
 | 
			
		||||
							"Text":"规格:"
 | 
			
		||||
						},
 | 
			
		||||
						{
 | 
			
		||||
							"Type":"FieldBox",
 | 
			
		||||
							"Name":"FieldBox8",
 | 
			
		||||
							"Dock":"Left",
 | 
			
		||||
							"Left":8.09625,
 | 
			
		||||
							"Width":3.175,
 | 
			
		||||
							"Border":{
 | 
			
		||||
								"Styles":"[DrawTop]"
 | 
			
		||||
							},
 | 
			
		||||
							"Font":{
 | 
			
		||||
								"Name":"宋体",
 | 
			
		||||
								"Size":105000,
 | 
			
		||||
								"Bold":true,
 | 
			
		||||
								"Charset":134
 | 
			
		||||
							},
 | 
			
		||||
							"DataField":"规格"
 | 
			
		||||
						},
 | 
			
		||||
						{
 | 
			
		||||
							"Type":"StaticBox",
 | 
			
		||||
							"Name":"StaticBox18",
 | 
			
		||||
							"Dock":"Left",
 | 
			
		||||
							"Left":11.2713,
 | 
			
		||||
							"Width":1.21708,
 | 
			
		||||
							"Border":{
 | 
			
		||||
								"Styles":"[DrawTop]"
 | 
			
		||||
							},
 | 
			
		||||
							"Font":{
 | 
			
		||||
								"Name":"宋体",
 | 
			
		||||
								"Size":105000,
 | 
			
		||||
								"Bold":true,
 | 
			
		||||
								"Charset":134
 | 
			
		||||
							},
 | 
			
		||||
							"Text":"单位:"
 | 
			
		||||
						},
 | 
			
		||||
						{
 | 
			
		||||
							"Type":"FieldBox",
 | 
			
		||||
							"Name":"FieldBox9",
 | 
			
		||||
							"Dock":"Left",
 | 
			
		||||
							"Left":12.4883,
 | 
			
		||||
							"Width":3.28083,
 | 
			
		||||
							"Border":{
 | 
			
		||||
								"Styles":"[DrawTop]"
 | 
			
		||||
							},
 | 
			
		||||
							"Font":{
 | 
			
		||||
								"Name":"宋体",
 | 
			
		||||
								"Size":105000,
 | 
			
		||||
								"Bold":true,
 | 
			
		||||
								"Charset":134
 | 
			
		||||
							},
 | 
			
		||||
							"DataField":"单位"
 | 
			
		||||
						},
 | 
			
		||||
						{
 | 
			
		||||
							"Type":"StaticBox",
 | 
			
		||||
							"Name":"StaticBox19",
 | 
			
		||||
							"Left":15.7692,
 | 
			
		||||
							"Width":3.43958,
 | 
			
		||||
							"Height":1.19063,
 | 
			
		||||
							"Border":{
 | 
			
		||||
								"Styles":"[DrawTop]"
 | 
			
		||||
							},
 | 
			
		||||
							"Font":{
 | 
			
		||||
								"Name":"宋体",
 | 
			
		||||
								"Size":105000,
 | 
			
		||||
								"Bold":true,
 | 
			
		||||
								"Charset":134
 | 
			
		||||
							},
 | 
			
		||||
							"Text":"基数:"
 | 
			
		||||
						},
 | 
			
		||||
						{
 | 
			
		||||
							"Type":"FieldBox",
 | 
			
		||||
							"Name":"FieldBox10",
 | 
			
		||||
							"Left":18.9971,
 | 
			
		||||
							"Width":5.00063,
 | 
			
		||||
							"Height":1.19063,
 | 
			
		||||
							"Border":{
 | 
			
		||||
								"Styles":"[DrawTop]"
 | 
			
		||||
							},
 | 
			
		||||
							"Font":{
 | 
			
		||||
								"Name":"宋体",
 | 
			
		||||
								"Size":105000,
 | 
			
		||||
								"Bold":true,
 | 
			
		||||
								"Charset":134
 | 
			
		||||
							},
 | 
			
		||||
							"DataField":"基数"
 | 
			
		||||
						},
 | 
			
		||||
						{
 | 
			
		||||
							"Type":"FieldBox",
 | 
			
		||||
							"Name":"FieldBox11",
 | 
			
		||||
							"Dock":"Right",
 | 
			
		||||
							"Left":36.4067,
 | 
			
		||||
							"Width":2.19604,
 | 
			
		||||
							"Border":{
 | 
			
		||||
								"Styles":"[DrawTop|DrawRight]"
 | 
			
		||||
							},
 | 
			
		||||
							"Font":{
 | 
			
		||||
								"Name":"宋体",
 | 
			
		||||
								"Size":105000,
 | 
			
		||||
								"Bold":true,
 | 
			
		||||
								"Charset":134
 | 
			
		||||
							},
 | 
			
		||||
							"DataField":"药品ID"
 | 
			
		||||
						},
 | 
			
		||||
						{
 | 
			
		||||
							"Type":"StaticBox",
 | 
			
		||||
							"Name":"StaticBox20",
 | 
			
		||||
							"Left":24,
 | 
			
		||||
							"Width":5.0006,
 | 
			
		||||
							"Height":1.1906,
 | 
			
		||||
							"Border":{
 | 
			
		||||
								"Styles":"[DrawTop]"
 | 
			
		||||
							},
 | 
			
		||||
							"Font":{
 | 
			
		||||
								"Name":"宋体",
 | 
			
		||||
								"Size":105000,
 | 
			
		||||
								"Bold":true,
 | 
			
		||||
								"Charset":134
 | 
			
		||||
							},
 | 
			
		||||
							"Text":"药品ID:"
 | 
			
		||||
						}
 | 
			
		||||
					],
 | 
			
		||||
					"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
 | 
			
		||||
		}
 | 
			
		||||
	]
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -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
 | 
			
		||||
		}
 | 
			
		||||
	]
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -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
 | 
			
		||||
		}
 | 
			
		||||
	]
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,374 @@
 | 
			
		|||
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 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
 | 
			
		||||
    {
 | 
			
		||||
        public static AccountWindowViewModel vm;
 | 
			
		||||
        //private int _pageNum = 1;
 | 
			
		||||
        //public int PageNum
 | 
			
		||||
        //{
 | 
			
		||||
        //    get => _pageNum;
 | 
			
		||||
        //    set
 | 
			
		||||
        //    {
 | 
			
		||||
        //        SetProperty(ref _pageNum, value);
 | 
			
		||||
        //        RequestData();
 | 
			
		||||
        //    }
 | 
			
		||||
        //}
 | 
			
		||||
 | 
			
		||||
        //private int _pageCount = 1;
 | 
			
		||||
        //public int PageCount
 | 
			
		||||
        //{
 | 
			
		||||
        //    get => _pageCount;
 | 
			
		||||
        //    set
 | 
			
		||||
        //    {
 | 
			
		||||
        //        SetProperty(ref _pageCount, value);
 | 
			
		||||
        //    }
 | 
			
		||||
        //}
 | 
			
		||||
 | 
			
		||||
        //private int _pageSize = 8;
 | 
			
		||||
        //public int PageSize
 | 
			
		||||
        //{
 | 
			
		||||
        //    get => _pageSize;
 | 
			
		||||
        //    set
 | 
			
		||||
        //    {
 | 
			
		||||
        //        SetProperty(ref _pageSize, value);
 | 
			
		||||
        //    }
 | 
			
		||||
        //}
 | 
			
		||||
 | 
			
		||||
        //private int _totalCount = 0;
 | 
			
		||||
        //public int TotalCount
 | 
			
		||||
        //{
 | 
			
		||||
        //    get => _totalCount;
 | 
			
		||||
        //    set
 | 
			
		||||
        //    {
 | 
			
		||||
        //        SetProperty(ref _totalCount, value);
 | 
			
		||||
        //    }
 | 
			
		||||
        //}
 | 
			
		||||
        private DateTime? _startDate = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day);
 | 
			
		||||
 | 
			
		||||
        private DateTime? nowDate = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day);
 | 
			
		||||
 | 
			
		||||
        public DateTime? StartDate
 | 
			
		||||
        {
 | 
			
		||||
            get => _startDate;
 | 
			
		||||
            set
 | 
			
		||||
            {
 | 
			
		||||
                if (value != null)
 | 
			
		||||
                {
 | 
			
		||||
                    SetProperty(ref _startDate, new DateTime(value?.Year ?? 0, value?.Month ?? 0, value?.Day ?? 0));
 | 
			
		||||
                }
 | 
			
		||||
                else
 | 
			
		||||
                {
 | 
			
		||||
                    SetProperty(ref _startDate, value);
 | 
			
		||||
                }
 | 
			
		||||
                RequestData();
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        private DateTime? _endDate = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, 23, 59, 59);
 | 
			
		||||
 | 
			
		||||
        public DateTime? EndDate
 | 
			
		||||
        {
 | 
			
		||||
            get => _endDate;
 | 
			
		||||
            set
 | 
			
		||||
            {
 | 
			
		||||
                if (value != null)
 | 
			
		||||
                {
 | 
			
		||||
                    TimeSpan ershisi = new TimeSpan(23, 59, 59);
 | 
			
		||||
                    SetProperty(ref _endDate, new DateTime(value?.Year ?? 0, value?.Month ?? 0, value?.Day ?? 0, 23, 59, 59));
 | 
			
		||||
                }
 | 
			
		||||
                else
 | 
			
		||||
                {
 | 
			
		||||
                    SetProperty(ref _endDate, value);
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
                RequestData();
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        private static readonly DateTime Jan1st1970 = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// 账册
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        private List<AccountBookG2> _accountList = new();
 | 
			
		||||
 | 
			
		||||
        public List<AccountBookG2> AccountList
 | 
			
		||||
        {
 | 
			
		||||
            get => _accountList;
 | 
			
		||||
            set => SetProperty(ref _accountList, value);
 | 
			
		||||
        }
 | 
			
		||||
        /// <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);
 | 
			
		||||
                //if (_drugInfo != null)
 | 
			
		||||
                //{
 | 
			
		||||
                //DrugManuNos = _drugInfo.DrugManuNos.OrderByDescending(dm => dm.ManuNo).ToList();
 | 
			
		||||
                //}
 | 
			
		||||
                RequestData();
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// 账册类型1入2出3总结存
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        private List<AccountType> _accountTypeList = new List<AccountType>() {
 | 
			
		||||
                new AccountType
 | 
			
		||||
                {
 | 
			
		||||
                    AccountTypeName="借入",
 | 
			
		||||
                    AccountTypeValue=1
 | 
			
		||||
                },
 | 
			
		||||
                new AccountType
 | 
			
		||||
                {
 | 
			
		||||
                    AccountTypeName="发出",
 | 
			
		||||
                    AccountTypeValue=2
 | 
			
		||||
                },
 | 
			
		||||
                new AccountType
 | 
			
		||||
                {
 | 
			
		||||
                    AccountTypeName="日结存",
 | 
			
		||||
                    AccountTypeValue=3
 | 
			
		||||
                },
 | 
			
		||||
                new AccountType
 | 
			
		||||
                {
 | 
			
		||||
                    AccountTypeName="总结存",
 | 
			
		||||
                    AccountTypeValue=4
 | 
			
		||||
                }
 | 
			
		||||
        };
 | 
			
		||||
        public List<AccountType>? AccountTypeList
 | 
			
		||||
        {
 | 
			
		||||
            get => _accountTypeList;
 | 
			
		||||
            set
 | 
			
		||||
            {
 | 
			
		||||
                SetProperty(ref _accountTypeList, value);
 | 
			
		||||
                RequestData();
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        private AccountType? _accountType;
 | 
			
		||||
        public AccountType AccountType
 | 
			
		||||
        {
 | 
			
		||||
            get => _accountType;
 | 
			
		||||
            set
 | 
			
		||||
            {
 | 
			
		||||
                SetProperty(ref _accountType, value);
 | 
			
		||||
                RequestData();
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        //MachineRecordService _machineRecordService;
 | 
			
		||||
        IEventAggregator _eventAggregator;
 | 
			
		||||
        ////private SqlSugarScope SqlSugarHelper.Db;
 | 
			
		||||
        public AccountWindowViewModel(IEventAggregator eventAggregator)
 | 
			
		||||
        {
 | 
			
		||||
            //_machineRecordService = machineRecord;
 | 
			
		||||
            ////this.SqlSugarHelper.Db = sqlSugarScope;
 | 
			
		||||
            _eventAggregator = eventAggregator;
 | 
			
		||||
            vm = this;
 | 
			
		||||
        }
 | 
			
		||||
        void RequestData()
 | 
			
		||||
        {
 | 
			
		||||
            int totalCount = 0;
 | 
			
		||||
            AccountList = ReportAccountBook(StartDate, EndDate, AccountType == null ? 0 : AccountType.AccountTypeValue, DrugInfo == null ? "" : DrugInfo.DrugId.ToString() ?? "");
 | 
			
		||||
            //for (int i = 0; i < accountList.Count; i++)
 | 
			
		||||
            //{
 | 
			
		||||
            //    if (accountList[i].DrugInfo is null)
 | 
			
		||||
            //    {
 | 
			
		||||
            //        DrugInfo drug= new DrugInfo();
 | 
			
		||||
            //        drug.DrugId = accountList[i].DrugId;
 | 
			
		||||
            //        drug.DrugName = accountList[i].DrugName;
 | 
			
		||||
            //        drug.DrugSpec = accountList[i].DrugSpec;
 | 
			
		||||
            //        drug.Dosage= accountList[i].Dosage;
 | 
			
		||||
            //        drug.PackUnit= accountList[i].PackUnit;
 | 
			
		||||
            //        drug.Manufactory= accountList[i].Manufactory;
 | 
			
		||||
            //        accountList[i].DrugInfo= drug;
 | 
			
		||||
            //    }
 | 
			
		||||
            //}
 | 
			
		||||
            //ICollectionView vw = CollectionViewSource.GetDefaultView(accountList);
 | 
			
		||||
            //vw.GroupDescriptions.Add(new PropertyGroupDescription("DrugInfo"));
 | 
			
		||||
 | 
			
		||||
        }
 | 
			
		||||
        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 long CurrentTimeMillis()
 | 
			
		||||
        {
 | 
			
		||||
            return (long)(DateTime.UtcNow - Jan1st1970).TotalMilliseconds;
 | 
			
		||||
        }
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// 导出发药登记表
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        public DelegateCommand DownloadOrderUser
 | 
			
		||||
        {
 | 
			
		||||
            get => new DelegateCommand(() =>
 | 
			
		||||
            {
 | 
			
		||||
                GridReportUtil.OrderUseReport(StartDate, EndDate, DrugInfo == null ? "" : DrugInfo.DrugId.ToString() ?? "");
 | 
			
		||||
            });
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// 导出账册
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        public DelegateCommand DownloadAccountBook
 | 
			
		||||
        {
 | 
			
		||||
            get => new DelegateCommand(() =>
 | 
			
		||||
            {
 | 
			
		||||
                GridReportUtil.PrintReportAccountBook(StartDate, EndDate, AccountType == null ? 0 : AccountType.AccountTypeValue, DrugInfo == null ? "" : DrugInfo.DrugId.ToString() ?? "");
 | 
			
		||||
 | 
			
		||||
            });
 | 
			
		||||
        }
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// 刷新
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        public DelegateCommand Query
 | 
			
		||||
        {
 | 
			
		||||
            get => new DelegateCommand(() =>
 | 
			
		||||
            {
 | 
			
		||||
                RequestData();
 | 
			
		||||
            });
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public bool KeepAlive => true;
 | 
			
		||||
 | 
			
		||||
        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 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) || di.DrugId.Contains(text)).OrderBy(di => di.DrugName).OrderBy(di => di.DrugId).ToList();
 | 
			
		||||
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public void OnNavigatedTo(NavigationContext navigationContext)
 | 
			
		||||
        {
 | 
			
		||||
            //药品信息
 | 
			
		||||
            GetAllDrugInfos();
 | 
			
		||||
            //查询表格数据
 | 
			
		||||
            RequestData();
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public bool IsNavigationTarget(NavigationContext navigationContext)
 | 
			
		||||
        {
 | 
			
		||||
            return true;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public void OnNavigatedFrom(NavigationContext navigationContext)
 | 
			
		||||
        {
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        private List<AccountBookG2> ReportAccountBook(DateTime? startDate, DateTime? endDate, int type, string drug_id = "")
 | 
			
		||||
        {
 | 
			
		||||
            DateTime? p_startDate = startDate ?? Convert.ToDateTime("2010-1-1");
 | 
			
		||||
            DateTime? p_endDate = endDate ?? DateTime.Now.AddDays(1);
 | 
			
		||||
            string p_machine_id = (ConfigurationManager.AppSettings["machineId"] ?? "DM3");
 | 
			
		||||
            string SQL = $@" SELECT ac.create_date as CreateDate, 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 AddQuantity,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, -- if(ac.type in(1,2),0,ac.total_stock) as TotalStock,
 | 
			
		||||
	                     ac.invoice_no as InvoiceNo, 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,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 += " AND ac.add_quantity>0 ";
 | 
			
		||||
                }
 | 
			
		||||
                if (type == 2)
 | 
			
		||||
                {
 | 
			
		||||
                    SQL += " AND ac.out_quantity>0 ";
 | 
			
		||||
                }
 | 
			
		||||
                if (type == 3)
 | 
			
		||||
                {
 | 
			
		||||
                    SQL += " AND type=3 ";
 | 
			
		||||
                }
 | 
			
		||||
                if (type == 4)
 | 
			
		||||
                {
 | 
			
		||||
                    SQL += " AND type=4  ";
 | 
			
		||||
                }
 | 
			
		||||
                SQL += " ORDER BY ac.create_date desc,ac.drug_id";
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
            //ChannelStocks = q.Select(it => { it.CheckQuantity = it.Quantity; return it; }).ToList();
 | 
			
		||||
 | 
			
		||||
            List<AccountBookG2> accountList = SqlSugarHelper.Db.SqlQueryable<AccountBookG2>(SQL)
 | 
			
		||||
                                                                       //.AddParameters(new
 | 
			
		||||
                                                                       //{
 | 
			
		||||
                                                                       //    machineId = ConfigurationManager.AppSettings["machineId"] ?? "DM1"
 | 
			
		||||
                                                                       //})
 | 
			
		||||
                                                                       //.Select(it => new { o = new AccountModel(), i = new DrugInfo() })
 | 
			
		||||
                                                                       //.Select(it=>new AccountModel())
 | 
			
		||||
                                                                       //.Select("*") //让上面一行不生成sql
 | 
			
		||||
                                                                       .ToList();
 | 
			
		||||
 | 
			
		||||
            //List<AccountModel> accountList=new List<AccountModel>();
 | 
			
		||||
            return accountList;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// 导出药品专用账册
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        public DelegateCommand DownloadAccountBookForDrug
 | 
			
		||||
        {
 | 
			
		||||
            get => new DelegateCommand(() =>
 | 
			
		||||
            {
 | 
			
		||||
                GridReportUtil.PrintReportAccountBookForDrug(StartDate, EndDate, DrugInfo == null ? "" : DrugInfo.DrugId.ToString() ?? "");
 | 
			
		||||
 | 
			
		||||
            });
 | 
			
		||||
        }
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// 导出处方专用账册
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        public DelegateCommand DownloadAccountBookForOrder
 | 
			
		||||
        {
 | 
			
		||||
            get => new DelegateCommand(() =>
 | 
			
		||||
            {
 | 
			
		||||
                GridReportUtil.PrintReportAccountBookForOrder(StartDate, EndDate,  DrugInfo == null ? "" : DrugInfo.DrugId.ToString() ?? "");
 | 
			
		||||
 | 
			
		||||
            });
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -300,8 +300,8 @@ namespace DM_Weight.ViewModels
 | 
			
		|||
                                    OperationTime = DateTime.Now,
 | 
			
		||||
                                    Quantity = it.AddQuantity,
 | 
			
		||||
                                    Type = 1,
 | 
			
		||||
                                    InvoiceId = InvoiceId,
 | 
			
		||||
                                    StockQuantity = nowChannels.Sum(it => it.Quantity)
 | 
			
		||||
                                    InvoiceId = InvoiceId
 | 
			
		||||
                                    //,StockQuantity = nowChannels.Sum(it => it.Quantity)
 | 
			
		||||
                                }).ExecuteCommand();
 | 
			
		||||
                            }
 | 
			
		||||
                            return true;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -0,0 +1,862 @@
 | 
			
		|||
using DM_Weight.Models;
 | 
			
		||||
using DM_Weight.msg;
 | 
			
		||||
using DM_Weight.Port;
 | 
			
		||||
using DM_Weight.select;
 | 
			
		||||
using DM_Weight.util;
 | 
			
		||||
using log4net;
 | 
			
		||||
using MySqlConnector;
 | 
			
		||||
using Newtonsoft.Json;
 | 
			
		||||
using Newtonsoft.Json.Linq;
 | 
			
		||||
using Prism.Commands;
 | 
			
		||||
using Prism.Events;
 | 
			
		||||
using Prism.Mvvm;
 | 
			
		||||
using Prism.Regions;
 | 
			
		||||
using Prism.Services.Dialogs;
 | 
			
		||||
using System;
 | 
			
		||||
using System.Collections.Generic;
 | 
			
		||||
using System.ComponentModel;
 | 
			
		||||
using System.Configuration;
 | 
			
		||||
using System.Drawing.Printing;
 | 
			
		||||
using System.Linq;
 | 
			
		||||
using System.Text;
 | 
			
		||||
using System.Threading;
 | 
			
		||||
using System.Threading.Tasks;
 | 
			
		||||
using System.Windows.Data;
 | 
			
		||||
using Unity;
 | 
			
		||||
 | 
			
		||||
namespace DM_Weight.ViewModels
 | 
			
		||||
{
 | 
			
		||||
    public class ApplyInStockWindowViewModel : BindableBase, IConfirmNavigationRequest, IRegionMemberLifetime
 | 
			
		||||
    {
 | 
			
		||||
        private List<DrugPleaseClaim> _drugPleaseClaimList = new();
 | 
			
		||||
 | 
			
		||||
        public List<DrugPleaseClaim> _DrugPleaseClaimList { get { return _drugPleaseClaimList; } set { SetProperty(ref _drugPleaseClaimList, value); } }
 | 
			
		||||
 | 
			
		||||
        private DrugPleaseClaim? selectDrugPleaseClaim;
 | 
			
		||||
 | 
			
		||||
        public DrugPleaseClaim? SelectDrugPleaseClaim
 | 
			
		||||
        {
 | 
			
		||||
            get { return selectDrugPleaseClaim; }
 | 
			
		||||
            set
 | 
			
		||||
            {
 | 
			
		||||
                SetProperty(ref selectDrugPleaseClaim, value);
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        public static List<OrderTakeSelect> StaticOrderTakeSelects = new()
 | 
			
		||||
        {
 | 
			
		||||
            new OrderTakeSelect
 | 
			
		||||
            {
 | 
			
		||||
                Code = "drugPleaseNo",
 | 
			
		||||
                Name = "请领单号"
 | 
			
		||||
            }
 | 
			
		||||
        };
 | 
			
		||||
 | 
			
		||||
        private List<OrderTakeSelect> _orderTakeSelects = StaticOrderTakeSelects;
 | 
			
		||||
 | 
			
		||||
        public List<OrderTakeSelect> OrderTakeSelects
 | 
			
		||||
        {
 | 
			
		||||
            get { return _orderTakeSelects; }
 | 
			
		||||
            set
 | 
			
		||||
            {
 | 
			
		||||
                SetProperty(ref _orderTakeSelects, value);
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        private OrderTakeSelect _selectedItem = StaticOrderTakeSelects[0];
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// 查询条件 查询字段
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        public OrderTakeSelect SelectedItem
 | 
			
		||||
        {
 | 
			
		||||
            get { return _selectedItem; }
 | 
			
		||||
            set
 | 
			
		||||
            {
 | 
			
		||||
                SetProperty(ref _selectedItem, value);
 | 
			
		||||
                RequestData();
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        private string _orderDate = DateTime.Now.ToString("yyyy-MM-dd");
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// 查询条件  处方日期
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        public string OrderDate
 | 
			
		||||
        {
 | 
			
		||||
            get { return _orderDate; }
 | 
			
		||||
            set
 | 
			
		||||
            {
 | 
			
		||||
                if (!String.IsNullOrEmpty(value))
 | 
			
		||||
                {
 | 
			
		||||
                    SetProperty(ref _orderDate, DateTime.Parse(value).ToString("yyyy-MM-dd"));
 | 
			
		||||
                }
 | 
			
		||||
                else
 | 
			
		||||
                {
 | 
			
		||||
                    SetProperty(ref _orderDate, value);
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
                RequestData();
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        private string? _searchValue;
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// 查询条件 查询字段值
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        public string? SearchValue
 | 
			
		||||
        {
 | 
			
		||||
            get { return _searchValue; }
 | 
			
		||||
            set
 | 
			
		||||
            {
 | 
			
		||||
                SetProperty(ref _searchValue, value);
 | 
			
		||||
                RequestData();
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        private List<ChannelStock> _channelStocks = new();
 | 
			
		||||
 | 
			
		||||
        public List<ChannelStock> ChannelStocks { get { return _channelStocks; } set { SetProperty(ref _channelStocks, value); } }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
        private List<ChannelStock> _addChannels = new();
 | 
			
		||||
 | 
			
		||||
        public List<ChannelStock> AddChannels { get { return _addChannels; } set { SetProperty(ref _addChannels, value); } }
 | 
			
		||||
        private readonly ILog logger = LogManager.GetLogger(typeof(InvoiceInWindowViewModel));
 | 
			
		||||
        private int _pageNum = 1;
 | 
			
		||||
        public int PageNum
 | 
			
		||||
        {
 | 
			
		||||
            get => _pageNum;
 | 
			
		||||
            set
 | 
			
		||||
            {
 | 
			
		||||
                SetProperty(ref _pageNum, value);
 | 
			
		||||
                RequestData();
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        private int _pageCount = 1;
 | 
			
		||||
        public int PageCount
 | 
			
		||||
        {
 | 
			
		||||
            get => _pageCount;
 | 
			
		||||
            set
 | 
			
		||||
            {
 | 
			
		||||
                SetProperty(ref _pageCount, value);
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        private int _pageSize = 8;
 | 
			
		||||
        public int PageSize
 | 
			
		||||
        {
 | 
			
		||||
            get => _pageSize;
 | 
			
		||||
            set
 | 
			
		||||
            {
 | 
			
		||||
                SetProperty(ref _pageSize, value);
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        private int _totalCount = 0;
 | 
			
		||||
        public int TotalCount
 | 
			
		||||
        {
 | 
			
		||||
            get => _totalCount;
 | 
			
		||||
            set
 | 
			
		||||
            {
 | 
			
		||||
                SetProperty(ref _totalCount, value);
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        private int _status = 0;
 | 
			
		||||
 | 
			
		||||
        public int Status { get => _status; set => SetProperty(ref _status, value); }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
        IDialogService _dialogService;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
        IEventAggregator _eventAggregator;
 | 
			
		||||
        private PortUtil _portUtil;
 | 
			
		||||
        public ApplyInStockWindowViewModel(PortUtil portUtil, IDialogService DialogService, IEventAggregator eventAggregator)
 | 
			
		||||
        {
 | 
			
		||||
            _dialogService = DialogService;
 | 
			
		||||
            _eventAggregator = eventAggregator;
 | 
			
		||||
            _portUtil = portUtil;
 | 
			
		||||
        }
 | 
			
		||||
        private IEnumerable<IGrouping<int, ChannelStock>> enumerable;
 | 
			
		||||
        private IEnumerator<IGrouping<int, ChannelStock>> enumerator;
 | 
			
		||||
        private string WindowName = "ApplyInStockWindowViewModel";
 | 
			
		||||
        void DoMyPrismEvent(DeviceMsg msg)
 | 
			
		||||
        {
 | 
			
		||||
 | 
			
		||||
            if (msg.WindowName.Equals(WindowName))
 | 
			
		||||
            {
 | 
			
		||||
                IGrouping<int, ChannelStock> grouping = enumerator.Current;
 | 
			
		||||
                int DrawerNo = grouping.Key;
 | 
			
		||||
                List<ChannelStock> channelStocks = grouping.ToList();
 | 
			
		||||
 | 
			
		||||
                switch (msg.EventType)
 | 
			
		||||
                {
 | 
			
		||||
                    // 抽屉打开
 | 
			
		||||
                    case EventType.DRAWEROPEN:
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
                        if (Status == 1)
 | 
			
		||||
                        {
 | 
			
		||||
                            if (channelStocks[0].process == 1)
 | 
			
		||||
                            {
 | 
			
		||||
                                channelStocks.ForEach(it => it.process = 2);
 | 
			
		||||
                            }
 | 
			
		||||
                        }
 | 
			
		||||
 | 
			
		||||
                        break;
 | 
			
		||||
                    // 抽屉关闭
 | 
			
		||||
                    case EventType.DRAWERCLOSE:
 | 
			
		||||
                        if (Status == 1)
 | 
			
		||||
                        {
 | 
			
		||||
                            if (channelStocks[0].process == 2)
 | 
			
		||||
                            {
 | 
			
		||||
                                channelStocks.ForEach(it => it.process = 3);
 | 
			
		||||
                            }
 | 
			
		||||
                            IGrouping<int, ChannelStock> groupingBefore = enumerator.Current;
 | 
			
		||||
                            int DrawerNoBefore = groupingBefore.Key;
 | 
			
		||||
                            if (enumerator.MoveNext())
 | 
			
		||||
                            {
 | 
			
		||||
                                IGrouping<int, ChannelStock> groupingAfter = enumerator.Current;
 | 
			
		||||
                                int DrawerNoAfter = groupingAfter.Key;
 | 
			
		||||
                                if (DrawerNoBefore < 9 && DrawerNoAfter > 8)
 | 
			
		||||
                                {
 | 
			
		||||
                                    Thread.Sleep(50);
 | 
			
		||||
                                }
 | 
			
		||||
                                OpenOneByOne();
 | 
			
		||||
                            }
 | 
			
		||||
                            // 已经全部取出
 | 
			
		||||
                            else
 | 
			
		||||
                            {
 | 
			
		||||
                                Status = 3;
 | 
			
		||||
                            }
 | 
			
		||||
                        }
 | 
			
		||||
                        break;
 | 
			
		||||
                    // 数量变化
 | 
			
		||||
                    case EventType.UPDATEQUANTITY:
 | 
			
		||||
                        if (Status == 1)
 | 
			
		||||
                        {
 | 
			
		||||
 | 
			
		||||
                            logger.Info($"抽屉【{DrawerNo}】库位药品数量【{msg.Quantitys}】");
 | 
			
		||||
                        }
 | 
			
		||||
                        break;
 | 
			
		||||
                    // 打开失败
 | 
			
		||||
                    case EventType.OPENERROR:
 | 
			
		||||
                        AlertMsg alertMsg = new AlertMsg
 | 
			
		||||
                        {
 | 
			
		||||
                            Message = msg.Message,
 | 
			
		||||
                            Type = MsgType.ERROR,
 | 
			
		||||
                        };
 | 
			
		||||
                        _eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
 | 
			
		||||
                        Status = 0;
 | 
			
		||||
                        break;
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
        }
 | 
			
		||||
        private async void OpenOneByOne()
 | 
			
		||||
        {
 | 
			
		||||
            IGrouping<int, ChannelStock> grouping = enumerator.Current;
 | 
			
		||||
            int DrawerNo = grouping.Key;
 | 
			
		||||
            List<ChannelStock> channelStocks = grouping.ToList();
 | 
			
		||||
            channelStocks.ForEach(it => it.process = 1);
 | 
			
		||||
            _portUtil.SpeakAsync("正在打开" + DrawerNo + "号抽屉");
 | 
			
		||||
            List<ChannelStock> singleChannels = new List<ChannelStock>();
 | 
			
		||||
            for (int i = 0; i < channelStocks.Count; i++)
 | 
			
		||||
            {
 | 
			
		||||
                ChannelStock copy = TransExpV2<ChannelStock, ChannelStock>.Trans(channelStocks[i]);
 | 
			
		||||
                singleChannels.Add(copy);
 | 
			
		||||
            }
 | 
			
		||||
            singleChannels = singleChannels.GroupBy(it => new
 | 
			
		||||
            {
 | 
			
		||||
                it.DrawerNo,
 | 
			
		||||
                it.ColNo
 | 
			
		||||
            }).Select(it =>
 | 
			
		||||
            {
 | 
			
		||||
                var ret = it.First();
 | 
			
		||||
                ret.Quantity = it.Sum(itx => itx.Quantity);
 | 
			
		||||
                ret.AddQuantity = it.Sum(itx => itx.AddQuantity);
 | 
			
		||||
                return ret;
 | 
			
		||||
            }).ToList().FindAll(it => it.BoardType != 1);
 | 
			
		||||
 | 
			
		||||
            _portUtil.WindowName = WindowName;
 | 
			
		||||
            _portUtil.BoardType = singleChannels.Count > 0 ? singleChannels[0].BoardType : 1;
 | 
			
		||||
            _portUtil.ColNos = singleChannels.Select(it => it.ColNo).ToArray();
 | 
			
		||||
            //_portUtil.Stocks = singleChannels.Select(it => it.Quantity).ToArray();
 | 
			
		||||
            _portUtil.DrawerNo = DrawerNo;
 | 
			
		||||
 | 
			
		||||
            if ((singleChannels.Count > 0 ? singleChannels[0].BoardType : 1) == 5)
 | 
			
		||||
            {
 | 
			
		||||
                List<ChannelStock> ChannelLst = new List<ChannelStock>();
 | 
			
		||||
                for (int i = 0; i < channelStocks.Count; i++)
 | 
			
		||||
                {
 | 
			
		||||
                    ChannelStock copy = TransExpV2<ChannelStock, ChannelStock>.Trans(channelStocks[i]);
 | 
			
		||||
                    singleChannels.Add(copy);
 | 
			
		||||
                }
 | 
			
		||||
                ChannelLst = ChannelLst.Where(it => it.BoardType != 1)
 | 
			
		||||
                                                                        .GroupBy(it => it.ColNo)
 | 
			
		||||
                                                                        .Select(it =>
 | 
			
		||||
                                                                        {
 | 
			
		||||
                                                                            var ret = it.First();
 | 
			
		||||
                                                                            ret.Quantity = it.Sum(itx => itx.Quantity);
 | 
			
		||||
                                                                            ret.AddQuantity = it.Sum(itx => itx.AddQuantity);
 | 
			
		||||
                                                                            return ret;
 | 
			
		||||
                                                                        }).ToList();
 | 
			
		||||
                // 发送加药数量
 | 
			
		||||
                singleChannels.ForEach(it =>
 | 
			
		||||
                {
 | 
			
		||||
                    _portUtil.TakeQuantity(DrawerNo, it.ColNo, it.AddQuantity, it.Quantity + it.AddQuantity);
 | 
			
		||||
                });
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            if ((singleChannels.Count > 0 ? singleChannels[0].BoardType : 1) == 6)
 | 
			
		||||
            {
 | 
			
		||||
                for (int i = 0; i < singleChannels.Count; i++)
 | 
			
		||||
                {
 | 
			
		||||
                    ChannelStock it = singleChannels[i];
 | 
			
		||||
                    _portUtil.ClearCount(it.DrawerNo, it.ColNo);
 | 
			
		||||
                    await Task.Delay(50);
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            _portUtil.Start();
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        private DelegateCommand _rowSelected;
 | 
			
		||||
 | 
			
		||||
        public DelegateCommand RowSelected => _rowSelected ??= new DelegateCommand(GetChannelByInvoice);
 | 
			
		||||
        public void GetChannelByInvoice()
 | 
			
		||||
        {
 | 
			
		||||
            ChannelStocks.Clear();
 | 
			
		||||
            //InOutInvoices.Clear();
 | 
			
		||||
            List<ChannelStock> csList = new List<ChannelStock>();
 | 
			
		||||
            if (SelectDrugPleaseClaim != null)
 | 
			
		||||
            {
 | 
			
		||||
                if (SelectDrugPleaseClaim.GetQuantity == 1)
 | 
			
		||||
                {
 | 
			
		||||
                    if (SelectDrugPleaseClaim.DrugManuNo is null)
 | 
			
		||||
                    {
 | 
			
		||||
                        AlertMsg alertMsg = new AlertMsg
 | 
			
		||||
                        {
 | 
			
		||||
                            Message = "药品没有批次效期信息!",
 | 
			
		||||
                            Type = MsgType.ERROR,
 | 
			
		||||
                        };
 | 
			
		||||
                        _eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
 | 
			
		||||
                        return;
 | 
			
		||||
                    }
 | 
			
		||||
                    //请领单里只有一种药
 | 
			
		||||
                    List<DrugPleaseManuNo> drugManuInfoList = JsonConvert.DeserializeObject<List<DrugPleaseManuNo>>(SelectDrugPleaseClaim.DrugManuNo);
 | 
			
		||||
                    drugManuInfoList.ForEach(dm => dm.DrugId = SelectDrugPleaseClaim.DrugId);
 | 
			
		||||
                    for (int i = 0; i < drugManuInfoList.Count; i++)
 | 
			
		||||
                    {
 | 
			
		||||
                        DrugPleaseManuNo drugPleaseManuNo = drugManuInfoList[i];
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
                        ChannelStock q = SqlSugarHelper.Db.Queryable<ChannelStock>()
 | 
			
		||||
                        .Includes<DrugInfo>(cs => cs.DrugInfo)
 | 
			
		||||
                        .WhereIF(!string.IsNullOrEmpty(drugPleaseManuNo.EffDate), cs => cs.EffDate.Equals(drugPleaseManuNo.EffDate))
 | 
			
		||||
                        .WhereIF(!string.IsNullOrEmpty(drugPleaseManuNo.ManuNo), cs => cs.ManuNo.Equals(drugPleaseManuNo.ManuNo))
 | 
			
		||||
                        .Where(cs => cs.DrugId == drugPleaseManuNo.DrugId)
 | 
			
		||||
                        .Where(cs => cs.DrawerType == 1)
 | 
			
		||||
                        .Where(cs => cs.MachineId.Equals(ConfigurationManager.AppSettings["machineId"] ?? "DM3"))
 | 
			
		||||
                        .OrderBy(cs => cs.DrugId)
 | 
			
		||||
                        .OrderBy(cs => cs.DrawerNo)
 | 
			
		||||
                        .OrderBy(cs => cs.ColNo)
 | 
			
		||||
                        .First();
 | 
			
		||||
                        if (q != null)
 | 
			
		||||
                        {
 | 
			
		||||
                            q.AddQuantity = drugPleaseManuNo.Quantity;
 | 
			
		||||
                        }
 | 
			
		||||
                        else
 | 
			
		||||
                        {
 | 
			
		||||
                            AlertMsg alertMsg = new AlertMsg
 | 
			
		||||
                            {
 | 
			
		||||
                                Message = "药品没有绑定库位信息!",
 | 
			
		||||
                                Type = MsgType.ERROR,
 | 
			
		||||
                            };
 | 
			
		||||
                            _eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
 | 
			
		||||
                            return;
 | 
			
		||||
                        }
 | 
			
		||||
 | 
			
		||||
                        csList.Add(q);
 | 
			
		||||
                    }
 | 
			
		||||
 | 
			
		||||
                }
 | 
			
		||||
                else
 | 
			
		||||
                {
 | 
			
		||||
                    //请领单里有多种药
 | 
			
		||||
                    List<DrugPleaseClaim> pleaseClaimList = SqlSugarHelper.Db.Queryable<DrugPleaseClaim>().Includes<DrugInfo>(dpc => dpc.DrugInfo).Where(dpc => dpc.PleaseNo == SelectDrugPleaseClaim.PleaseNo).ToList();
 | 
			
		||||
                    if (pleaseClaimList != null)
 | 
			
		||||
                    {
 | 
			
		||||
                        foreach (DrugPleaseClaim item in pleaseClaimList)
 | 
			
		||||
                        {
 | 
			
		||||
                            List<DrugPleaseManuNo> drugManuInfoList = JsonConvert.DeserializeObject<List<DrugPleaseManuNo>>(item.DrugManuNo);
 | 
			
		||||
                            drugManuInfoList.ForEach(dm => dm.DrugId = item.DrugId);
 | 
			
		||||
                            for (int i = 0; i < drugManuInfoList.Count; i++)
 | 
			
		||||
                            {
 | 
			
		||||
                                DrugPleaseManuNo drugPleaseManuNo = drugManuInfoList[i];
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
                                List<ChannelStock>? q = SqlSugarHelper.Db.Queryable<ChannelStock>()
 | 
			
		||||
                                .Includes<DrugInfo>(cs => cs.DrugInfo)
 | 
			
		||||
                                .Where(cs => cs.DrugId != null)
 | 
			
		||||
                                .WhereIF(!string.IsNullOrEmpty(drugPleaseManuNo.EffDate), cs => cs.EffDate.Equals(drugPleaseManuNo.EffDate))
 | 
			
		||||
                                .WhereIF(!string.IsNullOrEmpty(drugPleaseManuNo.ManuNo), cs => cs.ManuNo.Equals(drugPleaseManuNo.ManuNo))
 | 
			
		||||
                                .Where(cs => cs.DrugId == drugPleaseManuNo.DrugId)
 | 
			
		||||
                                .Where(cs => cs.DrawerType == 1)
 | 
			
		||||
                                .Where(cs => cs.MachineId.Equals(ConfigurationManager.AppSettings["machineId"] ?? "DM3"))
 | 
			
		||||
                                .OrderBy(cs => cs.DrugId)
 | 
			
		||||
                                .OrderBy(cs => cs.DrawerNo)
 | 
			
		||||
                                .OrderBy(cs => cs.ColNo)
 | 
			
		||||
                                .ToList();
 | 
			
		||||
                                if (q != null)
 | 
			
		||||
                                {
 | 
			
		||||
                                    q[0].AddQuantity = drugPleaseManuNo.Quantity;
 | 
			
		||||
                                    q.ForEach(csq => csq.PleaseClaim = item);
 | 
			
		||||
 | 
			
		||||
                                    csList.AddRange(q);
 | 
			
		||||
                                }
 | 
			
		||||
                            }
 | 
			
		||||
                        }
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
            ICollectionView vw = CollectionViewSource.GetDefaultView(csList);
 | 
			
		||||
            vw.GroupDescriptions.Add(new PropertyGroupDescription("PleaseClaim"));
 | 
			
		||||
            ChannelStocks = csList;
 | 
			
		||||
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public bool KeepAlive => false;
 | 
			
		||||
 | 
			
		||||
        public void ConfirmNavigationRequest(NavigationContext navigationContext, Action<bool> continuationCallback)
 | 
			
		||||
        {
 | 
			
		||||
            continuationCallback(true);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public bool IsNavigationTarget(NavigationContext navigationContext)
 | 
			
		||||
        {
 | 
			
		||||
            return true;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public void OnNavigatedFrom(NavigationContext navigationContext)
 | 
			
		||||
        {
 | 
			
		||||
            _eventAggregator.GetEvent<PortUtilEvent>().Unsubscribe(DoMyPrismEvent);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public void OnNavigatedTo(NavigationContext navigationContext)
 | 
			
		||||
        {
 | 
			
		||||
            _eventAggregator.GetEvent<PortUtilEvent>().Subscribe(DoMyPrismEvent);
 | 
			
		||||
            RequestData();
 | 
			
		||||
        }
 | 
			
		||||
        public void RequestData()
 | 
			
		||||
        {
 | 
			
		||||
            _DrugPleaseClaimList.Clear();
 | 
			
		||||
            int totalCount = 0;
 | 
			
		||||
 | 
			
		||||
            var sb = new StringBuilder();
 | 
			
		||||
            sb.Append("SELECT i.please_no,i.do_date,i.totalQuantity,count(1) as get_quantity,drug_manu_no,machine_id,i.drug_id from drug_please_claim i inner join ");
 | 
			
		||||
            sb.Append(" ( select c.drug_id as drug_id from channel_stock c where c.machine_id = 'DM3' group by c.drug_id ) di  on di.drug_id = i.drug_id WHERE state=@State and type=@Type ");
 | 
			
		||||
 | 
			
		||||
            if (OrderDate != null)
 | 
			
		||||
            {
 | 
			
		||||
                sb.Append(" and i.do_date = @CreateTime ");
 | 
			
		||||
            }
 | 
			
		||||
            if (!String.IsNullOrEmpty(SearchValue))
 | 
			
		||||
            {
 | 
			
		||||
                sb.Append(" and i.please_no = @please_no ");
 | 
			
		||||
            }
 | 
			
		||||
            if (!String.IsNullOrEmpty(ConfigurationManager.AppSettings["department"]))
 | 
			
		||||
            {
 | 
			
		||||
                sb.Append(" and i.department = @department ");
 | 
			
		||||
            }
 | 
			
		||||
            sb.Append("  GROUP BY i.please_no");
 | 
			
		||||
            sb.Append(" order by i.do_date ");
 | 
			
		||||
            _DrugPleaseClaimList = SqlSugarHelper.Db.SqlQueryable<dynamic>(sb.ToString())
 | 
			
		||||
                .AddParameters(new
 | 
			
		||||
                {
 | 
			
		||||
                    State = 2,
 | 
			
		||||
                    Type = 32,
 | 
			
		||||
                    CreateTime = OrderDate,
 | 
			
		||||
                    please_no = SearchValue,
 | 
			
		||||
                    department = ConfigurationManager.AppSettings["department"]
 | 
			
		||||
                })
 | 
			
		||||
            .Select(it => new DrugPleaseClaim())
 | 
			
		||||
                .Select("*")
 | 
			
		||||
                .ToPageList(PageNum, PageSize, ref totalCount);
 | 
			
		||||
 | 
			
		||||
            TotalCount = totalCount;
 | 
			
		||||
            PageCount = (int)Math.Ceiling((double)TotalCount / PageSize);
 | 
			
		||||
        }
 | 
			
		||||
        public DelegateCommand OpenInvoiceAdd
 | 
			
		||||
        {
 | 
			
		||||
            get => new DelegateCommand(() =>
 | 
			
		||||
            {
 | 
			
		||||
                bool flag = true;
 | 
			
		||||
 | 
			
		||||
                AddChannels = ChannelStocks.FindAll(it => it.AddQuantity != 0);
 | 
			
		||||
 | 
			
		||||
                enumerable = AddChannels.GroupBy(cs => cs.DrawerNo, cs => cs);
 | 
			
		||||
                enumerator = enumerable.GetEnumerator();
 | 
			
		||||
                OpenDrawer(AddChannels);
 | 
			
		||||
            }, () => SelectDrugPleaseClaim != null).ObservesProperty(() => SelectDrugPleaseClaim);
 | 
			
		||||
        }
 | 
			
		||||
        private void OpenDrawer(List<ChannelStock> AddChannels)
 | 
			
		||||
        {
 | 
			
		||||
            if (Status == 0)
 | 
			
		||||
            {
 | 
			
		||||
                if (AddChannels == null || AddChannels.Count <= 0)
 | 
			
		||||
                {
 | 
			
		||||
                    AlertMsg alertMsg = new AlertMsg
 | 
			
		||||
                    {
 | 
			
		||||
                        Message = "请输入入库数量",
 | 
			
		||||
                        Type = MsgType.ERROR,
 | 
			
		||||
                    };
 | 
			
		||||
                    _eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
 | 
			
		||||
                    return;
 | 
			
		||||
                }
 | 
			
		||||
                int totalNum = AddChannels.Sum(add => add.AddQuantity);
 | 
			
		||||
                //if (totalNum != SelectedInvoice.Quantity)
 | 
			
		||||
                //{
 | 
			
		||||
                //    AlertMsg alertMsg = new AlertMsg
 | 
			
		||||
                //    {
 | 
			
		||||
                //        Message = "各批次添加数量要与调拨单药品总数一致!",
 | 
			
		||||
                //        Type = MsgType.ERROR,
 | 
			
		||||
                //    };
 | 
			
		||||
                //    _eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
 | 
			
		||||
                //    return;
 | 
			
		||||
                //}
 | 
			
		||||
                enumerator.MoveNext();
 | 
			
		||||
                Status = 1;
 | 
			
		||||
                OpenOneByOne();
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        public DelegateCommand QueryCommand
 | 
			
		||||
        {
 | 
			
		||||
            get => new DelegateCommand(() =>
 | 
			
		||||
            {
 | 
			
		||||
                RequestData();
 | 
			
		||||
            });
 | 
			
		||||
        }
 | 
			
		||||
        private bool _isFinishClick = false;
 | 
			
		||||
        public DelegateCommand TakeFinish { get => new DelegateCommand(TakeFinishAction); }
 | 
			
		||||
 | 
			
		||||
        private async void TakeFinishAction()
 | 
			
		||||
        {
 | 
			
		||||
            if (!_isFinishClick)
 | 
			
		||||
            {
 | 
			
		||||
                _isFinishClick = true;
 | 
			
		||||
                List<ChannelStock> record = ChannelStocks.ToList();
 | 
			
		||||
                string InvoiceId = SelectDrugPleaseClaim.PleaseNo;
 | 
			
		||||
                var f = SqlSugarHelper.Db.UseTran(() =>
 | 
			
		||||
                {
 | 
			
		||||
                    SqlSugarHelper.Db.Updateable(new DrugPleaseClaim()
 | 
			
		||||
                    {
 | 
			
		||||
                        State = 3,
 | 
			
		||||
                        PleaseNo = SelectDrugPleaseClaim.PleaseNo
 | 
			
		||||
                    }).UpdateColumns(it => new { it.State }).WhereColumns(it => new { it.PleaseNo }).ExecuteCommand();
 | 
			
		||||
 | 
			
		||||
                    for (int i = 0; i < record.Count; i++)
 | 
			
		||||
                    {
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
                        ChannelStock it = record[i];
 | 
			
		||||
                        if (it.BoardType == 6 && it.PosNo == 0)
 | 
			
		||||
                        {
 | 
			
		||||
                            _portUtil.SetNumCount(it.DrawerNo, it.ColNo, it.AddQuantity);
 | 
			
		||||
                        }
 | 
			
		||||
                        if (it.Id != null)
 | 
			
		||||
                        {
 | 
			
		||||
                            // 更新数据 库存信息
 | 
			
		||||
                            SqlSugarHelper.Db.Updateable(new ChannelStock()
 | 
			
		||||
                            {
 | 
			
		||||
                                Quantity = it.Quantity + it.AddQuantity,
 | 
			
		||||
                                ManuNo = it.ManuNo,
 | 
			
		||||
                                EffDate = it.EffDate,
 | 
			
		||||
                                Id = it.Id,
 | 
			
		||||
                            }).UpdateColumns(it => new { it.Quantity, it.ManuNo, it.EffDate }).ExecuteCommand();
 | 
			
		||||
                        }
 | 
			
		||||
                        //else
 | 
			
		||||
                        //{
 | 
			
		||||
                        //    //如果批号重复则不让添加
 | 
			
		||||
                        //    List<ChannelStock> csCount = SqlSugarHelper.Db.Queryable<ChannelStock>().Where(cs => cs.DrawerNo == it.DrawerNo && cs.ColNo == it.ColNo && cs.ManuNo == it.ManuNo && cs.MachineId.Equals(ConfigurationManager.AppSettings["machineId"] ?? "DM1") && cs.Quantity > 0).ToList();
 | 
			
		||||
                        //    if (csCount.Count > 0)
 | 
			
		||||
                        //    {
 | 
			
		||||
                        //        //repeatList.Add(it.ManuNo);
 | 
			
		||||
                        //        //stockRepeats.Add(it);
 | 
			
		||||
                        //        continue;
 | 
			
		||||
                        //    }
 | 
			
		||||
                        //    //查询现有库位中是否有库存为0的记录,如果有直接update
 | 
			
		||||
                        //    ChannelStock recordHistory = SqlSugarHelper.Db.Queryable<ChannelStock>().Where(cs => cs.DrawerNo == it.DrawerNo && cs.ColNo == it.ColNo && cs.MachineId.Equals(ConfigurationManager.AppSettings["machineId"] ?? "DM1") && cs.Quantity <= 0).First();
 | 
			
		||||
                        //    if (recordHistory != null && recordHistory.Id != null)
 | 
			
		||||
                        //    {
 | 
			
		||||
                        //        SqlSugarHelper.Db.Updateable<ChannelStock>().SetColumns(item => new ChannelStock()
 | 
			
		||||
                        //        {
 | 
			
		||||
                        //            Quantity = it.AddQuantity,
 | 
			
		||||
                        //            ManuNo = it.ManuNo,
 | 
			
		||||
                        //            EffDate = it.EffDate
 | 
			
		||||
                        //        }).Where(item => item.Id == recordHistory.Id).ExecuteCommand();
 | 
			
		||||
                        //    }
 | 
			
		||||
                        //    else
 | 
			
		||||
                        //    {
 | 
			
		||||
                        //        // 更新数据 库存信息
 | 
			
		||||
                        //        SqlSugarHelper.Db.Insertable(new ChannelStock()
 | 
			
		||||
                        //        {
 | 
			
		||||
                        //            Quantity = it.AddQuantity,
 | 
			
		||||
                        //            Chnguid = it.Chnguid,
 | 
			
		||||
                        //            ManuNo = it.ManuNo,
 | 
			
		||||
                        //            EffDate = it.EffDate,
 | 
			
		||||
                        //            DrawerNo = it.DrawerNo,
 | 
			
		||||
                        //            ColNo = it.ColNo,
 | 
			
		||||
                        //            DrugId = it.DrugId,
 | 
			
		||||
                        //            DrawerType = it.DrawerType,
 | 
			
		||||
                        //            BoardType = it.BoardType,
 | 
			
		||||
                        //            Id = Guid.NewGuid().ToString(),
 | 
			
		||||
                        //            MachineId = ConfigurationManager.AppSettings["machineId"] ?? "DM1"
 | 
			
		||||
                        //        }).ExecuteCommand();
 | 
			
		||||
                        //    }
 | 
			
		||||
                        //}
 | 
			
		||||
                        // 获取更新完库存后的药品库存
 | 
			
		||||
                        List<ChannelStock> nowChannels = SqlSugarHelper.Db.Queryable<ChannelStock>()
 | 
			
		||||
                            .Where(cs => cs.MachineId.Equals(it.MachineId))
 | 
			
		||||
                            .Where(cs => cs.DrugId.Equals(it.DrugId))
 | 
			
		||||
                            .Where(cs => cs.DrawerType == 1)
 | 
			
		||||
                            .ToList();
 | 
			
		||||
 | 
			
		||||
                      
 | 
			
		||||
                        // 保存数据 出/入库记录
 | 
			
		||||
                        SqlSugarHelper.Db.Insertable(new MachineRecord()
 | 
			
		||||
                        {
 | 
			
		||||
                            MachineId = it.MachineId,
 | 
			
		||||
                            DrawerNo = it.DrawerNo,
 | 
			
		||||
                            ColNo = it.ColNo,
 | 
			
		||||
                            DrugId = it.DrugId,
 | 
			
		||||
                            ManuNo = it.ManuNo,
 | 
			
		||||
                            EffDate = !String.IsNullOrEmpty(it.EffDate) ? DateTime.ParseExact(it.EffDate, "yyyy-MM-dd", System.Globalization.CultureInfo.CurrentCulture) : null,
 | 
			
		||||
                            Operator = HomeWindowViewModel.Operator?.Id,
 | 
			
		||||
                            Reviewer = HomeWindowViewModel.Reviewer?.Id,
 | 
			
		||||
                            OperationTime = DateTime.Now,
 | 
			
		||||
                            Quantity = it.AddQuantity,
 | 
			
		||||
                            Type = 1,
 | 
			
		||||
                            InvoiceId = InvoiceId,
 | 
			
		||||
                            //StockQuantity = nowChannels.Sum(it => it.Quantity),
 | 
			
		||||
                            //ManunoQuantity = nowChannels.FindAll(it2 => it2.ManuNo == it.ManuNo).Sum(it => it.Quantity),
 | 
			
		||||
                            //SupplierDept = SelectedInvoice.PharmacyName1 ?? ConfigurationManager.AppSettings["supplierDept"].ToString(),
 | 
			
		||||
                            //ReceiveDept = SelectedInvoice.PharmacyName2 ?? ConfigurationManager.AppSettings["receiveDept"].ToString()
 | 
			
		||||
                        }).ExecuteCommand();
 | 
			
		||||
 | 
			
		||||
                        int iIndex = Array.IndexOf(ConfigurationManager.AppSettings["colloctedId"].Split(','), SelectDrugPleaseClaim.MachineId.ToString());
 | 
			
		||||
                        string dept = ConfigurationManager.AppSettings["colloctedId"].Split(',')[iIndex - 1].ToString();
 | 
			
		||||
 | 
			
		||||
                        //保存账册
 | 
			
		||||
                        int iInsertResult = SqlSugarHelper.Db.Insertable(new AccountBookG2()
 | 
			
		||||
                        {
 | 
			
		||||
 | 
			
		||||
                            DrugId = it.DrugId,
 | 
			
		||||
                            Type = 1,
 | 
			
		||||
                            Department = dept,
 | 
			
		||||
                            OrderNo = SelectDrugPleaseClaim.PleaseNo,
 | 
			
		||||
                            ManuNo = it.ManuNo,
 | 
			
		||||
                            EffDate = it.EffDate,
 | 
			
		||||
                            AddQuantity = it.AddQuantity,
 | 
			
		||||
                            UserId1 = HomeWindowViewModel.Operator?.Id,
 | 
			
		||||
                            UserId2 = HomeWindowViewModel.Reviewer?.Id,
 | 
			
		||||
                            MachineId = ConfigurationManager.AppSettings["machineId"].ToString(),
 | 
			
		||||
                            CreateDate = DateTime.Now.ToString("yyyy-MM-dd"),
 | 
			
		||||
                            CreateTime = DateTime.Now,
 | 
			
		||||
                            InvoiceNo = SelectDrugPleaseClaim.PleaseNo,
 | 
			
		||||
                            TotalStock = nowChannels.Sum(itx => itx.Quantity),
 | 
			
		||||
                            ManuStock = nowChannels.Where(itx => itx.ManuNo == it.ManuNo && itx.EffDate == it.EffDate).Sum(itx => itx.Quantity)
 | 
			
		||||
 | 
			
		||||
                        }).ExecuteCommand();
 | 
			
		||||
                        //修改凌晨生成的日结存与总结存数据
 | 
			
		||||
                        AccountBookG2 accountBookG2Day = SqlSugarHelper.Db.Queryable<AccountBookG2>()
 | 
			
		||||
                        .Where(ab => ab.MachineId.Equals(it.MachineId))
 | 
			
		||||
                        .Where(ab => ab.Type == 3)
 | 
			
		||||
                        .Where(ab => ab.DrugId ==it.DrugId)
 | 
			
		||||
                        .Where(ab => ab.ManuNo == it.ManuNo)
 | 
			
		||||
                        .Where(ab => ab.CreateDate == DateTime.Now.ToString("yyyy-MM-dd")).First();
 | 
			
		||||
                        if (accountBookG2Day != null)
 | 
			
		||||
                        {
 | 
			
		||||
                            accountBookG2Day.AddQuantity = accountBookG2Day.AddQuantity + it.AddQuantity;
 | 
			
		||||
                            accountBookG2Day.ManuStock = nowChannels.Where(itx => itx.ManuNo == it.ManuNo && itx.EffDate == it.EffDate).Sum(itx => itx.Quantity);
 | 
			
		||||
                            accountBookG2Day.TotalStock=nowChannels.Sum(itx => itx.Quantity);
 | 
			
		||||
                            SqlSugarHelper.Db.Updateable(accountBookG2Day).ExecuteCommand();
 | 
			
		||||
                        }
 | 
			
		||||
                        else
 | 
			
		||||
                        {
 | 
			
		||||
                            //生成日结存时可能没有该库位的绑定信息,需要写入日结存
 | 
			
		||||
                            int iDayResult = SqlSugarHelper.Db.Insertable(new AccountBookG2()
 | 
			
		||||
                            {
 | 
			
		||||
                                DrugId = it.DrugId,
 | 
			
		||||
                                Type = 3,
 | 
			
		||||
                                ManuNo = it.ManuNo,
 | 
			
		||||
                                EffDate = it.EffDate,
 | 
			
		||||
                                YQuantity = 0,
 | 
			
		||||
                                UserId1 = HomeWindowViewModel.Operator?.Id,
 | 
			
		||||
                                UserId2 = HomeWindowViewModel.Reviewer?.Id,
 | 
			
		||||
                                MachineId = ConfigurationManager.AppSettings["machineId"].ToString(),
 | 
			
		||||
                                CreateDate = DateTime.Now.ToString("yyyy-MM-dd"),
 | 
			
		||||
                                InvoiceNo = "日结存",
 | 
			
		||||
                                TotalStock = nowChannels.Sum(itx => itx.Quantity),
 | 
			
		||||
                                ManuStock = nowChannels.Where(itx => itx.ManuNo == it.ManuNo && itx.EffDate == it.EffDate).Sum(itx => itx.Quantity),
 | 
			
		||||
                                AddQuantity = it.AddQuantity,
 | 
			
		||||
                                Department= dept
 | 
			
		||||
                            }).ExecuteCommand();
 | 
			
		||||
                            if (iDayResult <= 0)
 | 
			
		||||
                            {
 | 
			
		||||
                                logger.Info($"未写入日结存数据{it.DrugId}-{it.ManuNo}-{it.EffDate}-{it.AddQuantity}");
 | 
			
		||||
                            }
 | 
			
		||||
                        }
 | 
			
		||||
                        //修改凌晨生成的日结存与总结存数据
 | 
			
		||||
                        AccountBookG2 accountBookG2Total = SqlSugarHelper.Db.Queryable<AccountBookG2>()
 | 
			
		||||
                        .Where(ab => ab.MachineId.Equals(it.MachineId))
 | 
			
		||||
                        .Where(ab => ab.Type == 4)
 | 
			
		||||
                        .Where(ab => ab.DrugId == it.DrugId)
 | 
			
		||||
                        .Where(ab => ab.CreateDate == DateTime.Now.ToString("yyyy-MM-dd")).First();
 | 
			
		||||
                        if (accountBookG2Total != null)
 | 
			
		||||
                        {
 | 
			
		||||
                            accountBookG2Total.AddQuantity = accountBookG2Total.AddQuantity + it.AddQuantity;
 | 
			
		||||
                            accountBookG2Total.TotalStock = nowChannels.Sum(itx => itx.Quantity);
 | 
			
		||||
                            accountBookG2Total.ManuStock = nowChannels.Where(itx => itx.ManuNo == it.ManuNo && itx.EffDate == it.EffDate).Sum(itx => itx.Quantity);
 | 
			
		||||
                            SqlSugarHelper.Db.Updateable(accountBookG2Total).ExecuteCommand();
 | 
			
		||||
                        }
 | 
			
		||||
                        else
 | 
			
		||||
                        {
 | 
			
		||||
                            //生成总结存时可能没有该库位的绑定信息,需要写入总结存
 | 
			
		||||
                            int iTotalResult = SqlSugarHelper.Db.Insertable(new AccountBookG2()
 | 
			
		||||
                            {
 | 
			
		||||
                                DrugId = it.DrugId,
 | 
			
		||||
                                Type = 4,
 | 
			
		||||
                                YQuantity = 0,
 | 
			
		||||
                                UserId1 = HomeWindowViewModel.Operator?.Id,
 | 
			
		||||
                                UserId2 = HomeWindowViewModel.Reviewer?.Id,
 | 
			
		||||
                                MachineId = ConfigurationManager.AppSettings["machineId"].ToString(),
 | 
			
		||||
                                CreateDate = DateTime.Now.ToString("yyyy-MM-dd"),
 | 
			
		||||
                                InvoiceNo = "总结存",
 | 
			
		||||
                                Department= dept,
 | 
			
		||||
                                AddQuantity = it.AddQuantity,
 | 
			
		||||
                                ManuStock=nowChannels.Where(itx => itx.ManuNo == it.ManuNo && itx.EffDate == it.EffDate).Sum(itx => itx.Quantity),
 | 
			
		||||
                                TotalStock = nowChannels.Sum(itx => itx.Quantity),
 | 
			
		||||
                            }).ExecuteCommand();
 | 
			
		||||
                            if (iTotalResult <= 0)
 | 
			
		||||
                            {
 | 
			
		||||
                                logger.Info($"未写入总结存数据{it.DrugId}-{it.AddQuantity}");
 | 
			
		||||
                            }
 | 
			
		||||
                        }
 | 
			
		||||
                    }
 | 
			
		||||
 | 
			
		||||
                    return true;
 | 
			
		||||
                });
 | 
			
		||||
                if (f.Data)
 | 
			
		||||
                {
 | 
			
		||||
                    // 更新屏显库存
 | 
			
		||||
                    //List<ChannelStock> singleChannels = record.FindAll(it => it.BoardType != 1);
 | 
			
		||||
                    List<ChannelStock> singleChannels = record.Where(it => it.BoardType == 5)
 | 
			
		||||
                                                                    .GroupBy(it => new { it.DrawerNo, it.ColNo })
 | 
			
		||||
                                                                    .Select(it =>
 | 
			
		||||
                                                                    {
 | 
			
		||||
                                                                        var ret = it.First();
 | 
			
		||||
                                                                        //ret.Quantity = it.Sum(itx => itx.Quantity);
 | 
			
		||||
                                                                        //ret.AddQuantity = it.Sum(itx => itx.AddQuantity);
 | 
			
		||||
                                                                        return ret;
 | 
			
		||||
                                                                    })
 | 
			
		||||
                                                                    .ToList();
 | 
			
		||||
                    if (singleChannels != null && singleChannels.Count > 0)
 | 
			
		||||
                    {
 | 
			
		||||
                        for (int i = 0; i < singleChannels.Count; i++)
 | 
			
		||||
                        {
 | 
			
		||||
                            //if (singleChannels[i].BoardType == 5)
 | 
			
		||||
                            //{
 | 
			
		||||
                            List<ChannelStock> channelStockEffDate = SqlSugarHelper.Db.Queryable<ChannelStock>()
 | 
			
		||||
                                                                .Where(cs => cs.MachineId == singleChannels[i].MachineId)
 | 
			
		||||
                                                                .Where(cs => cs.DrawerNo == singleChannels[i].DrawerNo)
 | 
			
		||||
                                                                .Where(cs => cs.ColNo == singleChannels[i].ColNo)
 | 
			
		||||
                                                                .Where(cs => cs.Quantity > 0)
 | 
			
		||||
                                                                .OrderBy(cs => cs.EffDate).ToList();
 | 
			
		||||
                            int totalQuantity = channelStockEffDate.Sum(it => it.Quantity);
 | 
			
		||||
 | 
			
		||||
                            //将库位多批次的总库存数更新标签
 | 
			
		||||
                            _portUtil.WriteQuantity(channelStockEffDate[0].DrawerNo, channelStockEffDate[0].ColNo, totalQuantity);
 | 
			
		||||
                            Thread.Sleep(200);
 | 
			
		||||
                            _portUtil.WriteChannelInfo(6, channelStockEffDate[0].EffDate == null ? "" : channelStockEffDate[0].EffDate, channelStockEffDate[0].DrawerNo, channelStockEffDate[0].ColNo);
 | 
			
		||||
                            Thread.Sleep(200);
 | 
			
		||||
                            _portUtil.WriteChannelInfo(5, channelStockEffDate[0].ManuNo, channelStockEffDate[0].DrawerNo, channelStockEffDate[0].ColNo);
 | 
			
		||||
                            Thread.Sleep(200);
 | 
			
		||||
                            _portUtil.ShowContent(channelStockEffDate[0].DrawerNo, channelStockEffDate[0].ColNo);
 | 
			
		||||
                            //}
 | 
			
		||||
                        }
 | 
			
		||||
                    }
 | 
			
		||||
                    List<ChannelStock> singleChannelsBoxSmart = record.Where(it => it.BoardType == 35)
 | 
			
		||||
                                                                    .GroupBy(it => new { it.DrawerNo, it.ColNo })
 | 
			
		||||
                                                                    .Select(it =>
 | 
			
		||||
                                                                    {
 | 
			
		||||
                                                                        var ret = it.First();
 | 
			
		||||
                                                                        //ret.Quantity = it.Sum(itx => itx.Quantity);
 | 
			
		||||
                                                                        //ret.AddQuantity = it.Sum(itx => itx.AddQuantity);
 | 
			
		||||
                                                                        return ret;
 | 
			
		||||
                                                                    })
 | 
			
		||||
                                                                    .ToList();
 | 
			
		||||
 | 
			
		||||
                    if (singleChannelsBoxSmart != null && singleChannelsBoxSmart.Count > 0)
 | 
			
		||||
                    {
 | 
			
		||||
                        for (int i = 0; i < singleChannelsBoxSmart.Count; i++)
 | 
			
		||||
                        {
 | 
			
		||||
                            List<ChannelStock> channelStockEffDate = SqlSugarHelper.Db.Queryable<ChannelStock>()
 | 
			
		||||
                                                                .Where(cs => cs.MachineId == singleChannelsBoxSmart[i].MachineId)
 | 
			
		||||
                                                                .Where(cs => cs.DrawerNo == singleChannelsBoxSmart[i].DrawerNo)
 | 
			
		||||
                                                                .Where(cs => cs.ColNo == singleChannelsBoxSmart[i].ColNo)
 | 
			
		||||
                                                                .Where(cs => cs.Quantity > 0)
 | 
			
		||||
                                                                .OrderBy(cs => cs.EffDate).ToList();
 | 
			
		||||
                            int totalQuantity = channelStockEffDate.Sum(it => it.Quantity);
 | 
			
		||||
 | 
			
		||||
                            //将库位多批次的总库存数更新标签
 | 
			
		||||
 | 
			
		||||
                            await Task.Delay(200);
 | 
			
		||||
                            await _portUtil.WriteChannelInfoMethod(2, totalQuantity.ToString(), channelStockEffDate[0].DrawerNo, channelStockEffDate[0].ColNo);
 | 
			
		||||
                            await Task.Delay(200);
 | 
			
		||||
                            await _portUtil.WriteChannelInfoMethod(5, channelStockEffDate[0].EffDate, channelStockEffDate[0].DrawerNo, channelStockEffDate[0].ColNo);
 | 
			
		||||
                            await Task.Delay(200);
 | 
			
		||||
                            await _portUtil.WriteChannelInfoMethod(6, channelStockEffDate[0].ManuNo, channelStockEffDate[0].DrawerNo, channelStockEffDate[0].ColNo);
 | 
			
		||||
                            await Task.Delay(200);
 | 
			
		||||
                            await _portUtil.ShowContentMethod(channelStockEffDate[0].DrawerNo, channelStockEffDate[0].ColNo);
 | 
			
		||||
                        }
 | 
			
		||||
                    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
                    AlertMsg alertMsg = new AlertMsg
 | 
			
		||||
                    {
 | 
			
		||||
                        Message = "操作完成,库存已更新",
 | 
			
		||||
                        Type = MsgType.SUCCESS,
 | 
			
		||||
                    };
 | 
			
		||||
                    _eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
 | 
			
		||||
                }
 | 
			
		||||
                if (!f.IsSuccess)
 | 
			
		||||
                {
 | 
			
		||||
                    logger.Info($"调拨入库,库存更新失败!{f.ErrorMessage}");
 | 
			
		||||
                    AlertMsg alertMsg = new AlertMsg
 | 
			
		||||
                    {
 | 
			
		||||
                        Message = "库存更新失败!",
 | 
			
		||||
                        Type = MsgType.ERROR,
 | 
			
		||||
                    };
 | 
			
		||||
                    _eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
 | 
			
		||||
                }
 | 
			
		||||
                Status = 0;
 | 
			
		||||
                _isFinishClick = false;
 | 
			
		||||
 | 
			
		||||
            }
 | 
			
		||||
            RequestData();
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
        public DelegateCommand CancleTake { get => new DelegateCommand(CancelTakeAction); }
 | 
			
		||||
 | 
			
		||||
        private void CancelTakeAction()
 | 
			
		||||
        {
 | 
			
		||||
            RequestData();
 | 
			
		||||
            Status = 0;
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,185 @@
 | 
			
		|||
using DM_Weight.Models;
 | 
			
		||||
using DM_Weight.select;
 | 
			
		||||
using DM_Weight.util;
 | 
			
		||||
using Prism.Commands;
 | 
			
		||||
using Prism.Mvvm;
 | 
			
		||||
using Prism.Regions;
 | 
			
		||||
using System;
 | 
			
		||||
using System.Collections.Generic;
 | 
			
		||||
using System.Configuration;
 | 
			
		||||
using System.Linq;
 | 
			
		||||
using System.Text;
 | 
			
		||||
using System.Threading.Tasks;
 | 
			
		||||
 | 
			
		||||
namespace DM_Weight.ViewModels
 | 
			
		||||
{
 | 
			
		||||
    public class ApplyListWindowViewModel : BindableBase, INavigationAware
 | 
			
		||||
    {
 | 
			
		||||
        public static List<OrderTakeSelect> StaticSelects = new()
 | 
			
		||||
        {
 | 
			
		||||
            new OrderTakeSelect
 | 
			
		||||
            {
 | 
			
		||||
                Code = "DrugName",
 | 
			
		||||
                Name = "药品名称"
 | 
			
		||||
            },
 | 
			
		||||
            new OrderTakeSelect
 | 
			
		||||
            {
 | 
			
		||||
                Code = "PyCode",
 | 
			
		||||
                Name = "拼音码"
 | 
			
		||||
            },
 | 
			
		||||
            new OrderTakeSelect
 | 
			
		||||
            {
 | 
			
		||||
                Code = "DrugBarcode",
 | 
			
		||||
                Name = "药品条码"
 | 
			
		||||
            },
 | 
			
		||||
            new OrderTakeSelect
 | 
			
		||||
            {
 | 
			
		||||
                Code = "DrugId",
 | 
			
		||||
                Name = "药品编码"
 | 
			
		||||
            }
 | 
			
		||||
        };
 | 
			
		||||
 | 
			
		||||
        private List<OrderTakeSelect> _selects = StaticSelects;
 | 
			
		||||
 | 
			
		||||
        public List<OrderTakeSelect> Selects
 | 
			
		||||
        {
 | 
			
		||||
            get { return _selects; }
 | 
			
		||||
            set
 | 
			
		||||
            {
 | 
			
		||||
                SetProperty(ref _selects, value);
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        private OrderTakeSelect _selectedItem = StaticSelects[0];
 | 
			
		||||
 | 
			
		||||
        private string? _searchValue;
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// 查询条件 查询字段值
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        public string? SearchValue
 | 
			
		||||
        {
 | 
			
		||||
            get { return _searchValue; }
 | 
			
		||||
            set
 | 
			
		||||
            {
 | 
			
		||||
                SetProperty(ref _searchValue, value);
 | 
			
		||||
                RequestData();
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// 查询条件 查询字段
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        public OrderTakeSelect SelectedItem
 | 
			
		||||
        {
 | 
			
		||||
            get { return _selectedItem; }
 | 
			
		||||
            set
 | 
			
		||||
            {
 | 
			
		||||
                SetProperty(ref _selectedItem, value);
 | 
			
		||||
                RequestData();
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// 请领单状态
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        private List<DrugPleaseState> _drugPleaseStateList = new List<DrugPleaseState>() {
 | 
			
		||||
                new DrugPleaseState
 | 
			
		||||
                {
 | 
			
		||||
                    StateName="已创建",
 | 
			
		||||
                    StateValue=0
 | 
			
		||||
                },
 | 
			
		||||
                new DrugPleaseState
 | 
			
		||||
                {
 | 
			
		||||
                    StateName="审核通过",
 | 
			
		||||
                    StateValue=1
 | 
			
		||||
                },
 | 
			
		||||
                new DrugPleaseState
 | 
			
		||||
                {
 | 
			
		||||
                    StateName="已出库",
 | 
			
		||||
                    StateValue=2
 | 
			
		||||
                },
 | 
			
		||||
                new DrugPleaseState
 | 
			
		||||
                {
 | 
			
		||||
                    StateName="已入库",
 | 
			
		||||
                    StateValue=3
 | 
			
		||||
                }
 | 
			
		||||
        };
 | 
			
		||||
        public List<DrugPleaseState>? DrugPleaseStateList
 | 
			
		||||
        {
 | 
			
		||||
            get => _drugPleaseStateList;
 | 
			
		||||
            set
 | 
			
		||||
            {
 | 
			
		||||
                SetProperty(ref _drugPleaseStateList, value);
 | 
			
		||||
                RequestData();
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        private DrugPleaseState? _drugPleaseState;
 | 
			
		||||
        public DrugPleaseState _DrugPleaseState
 | 
			
		||||
        {
 | 
			
		||||
            get => _drugPleaseState;
 | 
			
		||||
            set
 | 
			
		||||
            {
 | 
			
		||||
                SetProperty(ref _drugPleaseState, value);
 | 
			
		||||
                RequestData();
 | 
			
		||||
            }
 | 
			
		||||
        } 
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// 处方、请领中间表
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        private List<CollectDrug> _collectDrugLst;
 | 
			
		||||
        public List<CollectDrug> CollectDrugLst
 | 
			
		||||
        {
 | 
			
		||||
            get => _collectDrugLst; set { SetProperty(ref _collectDrugLst, value); }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        private CollectDrug _selectCollectDrug;
 | 
			
		||||
        public CollectDrug SelectCollectDrug { get => _selectCollectDrug; set { SetProperty(ref _selectCollectDrug, value); } }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
        private void RequestData()
 | 
			
		||||
        {
 | 
			
		||||
            if (CollectDrugLst != null)
 | 
			
		||||
            {
 | 
			
		||||
                CollectDrugLst.Clear();
 | 
			
		||||
            }
 | 
			
		||||
            CollectDrugLst = SqlSugarHelper.Db.Queryable<CollectDrug>()
 | 
			
		||||
                           .Includes<DrugPleaseClaim>(cd => cd.drugPleaseClaim)
 | 
			
		||||
                           .Includes<DrugInfo>(cd => cd.drugInfo)
 | 
			
		||||
                           .InnerJoin<DrugPleaseClaim>((cd, dp) => cd.DrugPleaseClaimId == dp.PleaseNo)
 | 
			
		||||
                           .Where(cd => cd.MachineId.Equals(ConfigurationManager.AppSettings["machineId"] ?? "DM3"))
 | 
			
		||||
                           .WhereIF(!String.IsNullOrEmpty(SearchValue) && SelectedItem.Code.Equals("DrugId"), (cd) => cd.drugInfo.DrugId.ToString() == SearchValue)
 | 
			
		||||
                           .WhereIF(!String.IsNullOrEmpty(SearchValue) && SelectedItem.Code.Equals("DrugName"), (cd) => cd.drugInfo.DrugName.Contains(SearchValue))
 | 
			
		||||
                           .WhereIF(!String.IsNullOrEmpty(SearchValue) && SelectedItem.Code.Equals("PyCode"), (cd) => cd.drugInfo.PyCode.Contains(SearchValue))
 | 
			
		||||
                           .WhereIF(!String.IsNullOrEmpty(SearchValue) && SelectedItem.Code.Equals("DrugBarcode"), (cd) => cd.drugInfo.DrugBarcode.Contains(SearchValue))
 | 
			
		||||
                           .WhereIF((_DrugPleaseState != null && _DrugPleaseState.StateValue >= 0), (cd, dp) => dp.State == _DrugPleaseState.StateValue)
 | 
			
		||||
                           .GroupBy(cd => cd.Applyid)
 | 
			
		||||
                           .OrderByDescending(cd => cd.Createdate)
 | 
			
		||||
                           .OrderByDescending(cd => cd.DrugId)
 | 
			
		||||
                           .ToList();
 | 
			
		||||
 | 
			
		||||
        }
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// 刷新
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        public DelegateCommand Query
 | 
			
		||||
        {
 | 
			
		||||
            get => new DelegateCommand(() =>
 | 
			
		||||
            {
 | 
			
		||||
                RequestData();
 | 
			
		||||
            });
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
        public void OnNavigatedTo(NavigationContext navigationContext)
 | 
			
		||||
        {
 | 
			
		||||
            RequestData();
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public bool IsNavigationTarget(NavigationContext navigationContext)
 | 
			
		||||
        {
 | 
			
		||||
            return true;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public void OnNavigatedFrom(NavigationContext navigationContext)
 | 
			
		||||
        {
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -165,8 +165,10 @@ namespace DM_Weight.ViewModels
 | 
			
		|||
 | 
			
		||||
        private void GetAllDrugInfos()
 | 
			
		||||
        {
 | 
			
		||||
            var list = SqlSugarHelper.Db.Queryable<DrugInfo>().Includes<DrugManuNo>(di => di.DrugManuNos).OrderBy(di => di.DrugId).ToList();
 | 
			
		||||
            DrugInfos = list;
 | 
			
		||||
            //var list = SqlSugarHelper.Db.Queryable<DrugInfo>().Includes<DrugManuNo>(di => di.DrugManuNos).OrderBy(di => di.DrugId).ToList();
 | 
			
		||||
            //DrugInfos = list;
 | 
			
		||||
            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,' / ',manufactory) as drug_name_spec FROM `drug_info` d";
 | 
			
		||||
            DrugInfos = SqlSugarHelper.Db.SqlQueryable<DrugInfo>(str).OrderBy(di => di.DrugName).OrderBy(di => di.DrugId).ToList();
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        private void GetChannelsByDrawerNo()
 | 
			
		||||
| 
						 | 
				
			
			@ -241,7 +243,21 @@ namespace DM_Weight.ViewModels
 | 
			
		|||
                                    _portUtil.ShowContent(item.DrawerNo, item.ColNo);
 | 
			
		||||
                                }
 | 
			
		||||
                                //_screenUtil.SetStockInfo(item, 1);
 | 
			
		||||
 | 
			
		||||
                                if (item.BoardType == 35)
 | 
			
		||||
                                {
 | 
			
		||||
                                    _portUtil.WindowName = "BindingChannelDialog";
 | 
			
		||||
                                    await _portUtil.WriteChannelInfoMethod(1, DrugInfo.DrugName, item.DrawerNo, item.ColNo);
 | 
			
		||||
                                    await Task.Delay(200);
 | 
			
		||||
                                    await _portUtil.WriteChannelInfoMethod(3, DrugInfo.DrugSpec, item.DrawerNo, item.ColNo);
 | 
			
		||||
                                    await Task.Delay(200);
 | 
			
		||||
                                    await _portUtil.WriteChannelInfoMethod(4, DrugInfo.Manufactory, item.DrawerNo, item.ColNo);
 | 
			
		||||
                                    await Task.Delay(200);
 | 
			
		||||
                                    await _portUtil.WriteChannelInfoMethod(5, item.EffDate, item.DrawerNo, item.ColNo);
 | 
			
		||||
                                    await Task.Delay(200);
 | 
			
		||||
                                    await _portUtil.WriteChannelInfoMethod(6, item.ManuNo, item.DrawerNo, item.ColNo);
 | 
			
		||||
                                    await Task.Delay(200);
 | 
			
		||||
                                    await _portUtil.ShowContentMethod(item.DrawerNo, item.ColNo);
 | 
			
		||||
                                }
 | 
			
		||||
                            }
 | 
			
		||||
                            else
 | 
			
		||||
                            {
 | 
			
		||||
| 
						 | 
				
			
			@ -280,7 +296,7 @@ namespace DM_Weight.ViewModels
 | 
			
		|||
                                item.DrugId = DrugInfo.DrugId.ToString();
 | 
			
		||||
                                item.ManuNo = DrugManuNo.ManuNo;
 | 
			
		||||
                                item.DrugInfo = DrugInfo;
 | 
			
		||||
                                item.EffDate = String.Format("{0:yyyy-MM-dd}", DrugManuNo.EffDate);
 | 
			
		||||
                                item.EffDate = String.Format("{0:yyyy-MM-dd}", DrugManuNo.EffDate).Substring(0, 10);
 | 
			
		||||
                                SqlSugarHelper.Db.Updateable(item).UpdateColumns(it => new { it.DrugId, it.ManuNo, it.EffDate, it.PosNo }).ExecuteCommand();
 | 
			
		||||
 | 
			
		||||
                                if (item.BoardType == 5)
 | 
			
		||||
| 
						 | 
				
			
			@ -299,6 +315,21 @@ namespace DM_Weight.ViewModels
 | 
			
		|||
                                    await Task.Delay(200);
 | 
			
		||||
                                    _portUtil.ShowContent(item.DrawerNo, item.ColNo);
 | 
			
		||||
                                }
 | 
			
		||||
                                if (item.BoardType == 35)
 | 
			
		||||
                                {
 | 
			
		||||
                                    _portUtil.WindowName = "BindingChannelDialog";
 | 
			
		||||
                                    await _portUtil.WriteChannelInfoMethod(1, DrugInfo.DrugName, item.DrawerNo, item.ColNo);
 | 
			
		||||
                                    await Task.Delay(200);
 | 
			
		||||
                                    await _portUtil.WriteChannelInfoMethod(3, DrugInfo.DrugSpec, item.DrawerNo, item.ColNo);
 | 
			
		||||
                                    await Task.Delay(200);
 | 
			
		||||
                                    await _portUtil.WriteChannelInfoMethod(4, DrugInfo.Manufactory, item.DrawerNo, item.ColNo);
 | 
			
		||||
                                    await Task.Delay(200);
 | 
			
		||||
                                    await _portUtil.WriteChannelInfoMethod(5, item.EffDate, item.DrawerNo, item.ColNo);
 | 
			
		||||
                                    await Task.Delay(200);
 | 
			
		||||
                                    await _portUtil.WriteChannelInfoMethod(6, item.ManuNo, item.DrawerNo, item.ColNo);
 | 
			
		||||
                                    await Task.Delay(200);
 | 
			
		||||
                                    await _portUtil.ShowContentMethod(item.DrawerNo, item.ColNo);
 | 
			
		||||
                                }
 | 
			
		||||
                                //_screenUtil.SetStockInfo(item, 1);
 | 
			
		||||
                            });
 | 
			
		||||
                            GetChannelsByDrawerNo();
 | 
			
		||||
| 
						 | 
				
			
			@ -340,6 +371,13 @@ namespace DM_Weight.ViewModels
 | 
			
		|||
                            await Task.Delay(200);
 | 
			
		||||
                            _portUtil.ShowContent(item.DrawerNo, item.ColNo);
 | 
			
		||||
                        }
 | 
			
		||||
                        if (item.BoardType == 35)
 | 
			
		||||
                        {
 | 
			
		||||
                            _portUtil.ClearContentMethod(item.DrawerNo, item.ColNo);
 | 
			
		||||
                            await Task.Delay(300);
 | 
			
		||||
                            _portUtil.ShowContentMethod(item.DrawerNo, item.ColNo);
 | 
			
		||||
                        }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
                        //_screenUtil.SetStockInfo(item, 1);
 | 
			
		||||
                    });
 | 
			
		||||
| 
						 | 
				
			
			@ -391,7 +429,7 @@ namespace DM_Weight.ViewModels
 | 
			
		|||
        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 drug_name_spec FROM `drug_info` d";
 | 
			
		||||
                        d.manufactory,d.max_stock,CONCAT(drug_name,' / ',drug_spec,' / ',manufactory) as drug_name_spec FROM `drug_info` d";
 | 
			
		||||
            if(string.IsNullOrEmpty(text))
 | 
			
		||||
            {
 | 
			
		||||
                DrugInfos = SqlSugarHelper.Db.SqlQueryable<DrugInfo>(str).OrderBy(di => di.DrugName).OrderBy(di => di.DrugId).ToList();
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -208,9 +208,11 @@ namespace DM_Weight.ViewModels
 | 
			
		|||
 | 
			
		||||
        private void GetAllDrugInfos()
 | 
			
		||||
        {
 | 
			
		||||
            var list = SqlSugarHelper.Db.Queryable<DrugInfo>().Includes<DrugManuNo>(di => di.DrugManuNos).OrderBy(di => di.DrugId).ToList();
 | 
			
		||||
            DrugInfos = list;
 | 
			
		||||
            //var list = SqlSugarHelper.Db.Queryable<DrugInfo>().Includes<DrugManuNo>(di => di.DrugManuNos).OrderBy(di => di.DrugId).ToList();
 | 
			
		||||
            //DrugInfos = list;
 | 
			
		||||
            //DrugInfos_PY = list;
 | 
			
		||||
            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,' / ',manufactory) as drug_name_spec FROM `drug_info` d";
 | 
			
		||||
            DrugInfos = SqlSugarHelper.Db.SqlQueryable<DrugInfo>(str).OrderBy(di => di.DrugName).OrderBy(di => di.DrugId).ToList();
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        private void GetChannelsByDrawerNo()
 | 
			
		||||
| 
						 | 
				
			
			@ -270,8 +272,8 @@ namespace DM_Weight.ViewModels
 | 
			
		|||
                                    item.PosNo = 0;
 | 
			
		||||
                                }
 | 
			
		||||
                                item.DrugId = DrugInfo.DrugId.ToString();
 | 
			
		||||
                                item.DrugSpec= DrugInfo.DrugSpec.ToString();
 | 
			
		||||
                                SqlSugarHelper.Db.Updateable(item).UpdateColumns(it => new { it.DrugId, it.PosNo,it.DrugSpec }).ExecuteCommand();
 | 
			
		||||
                                item.DrugSpec = DrugInfo.DrugSpec.ToString();
 | 
			
		||||
                                SqlSugarHelper.Db.Updateable(item).UpdateColumns(it => new { it.DrugId, it.PosNo, it.DrugSpec }).ExecuteCommand();
 | 
			
		||||
                                GetChannelsByDrawerNo();
 | 
			
		||||
 | 
			
		||||
                                if (item.BoardType == 5)
 | 
			
		||||
| 
						 | 
				
			
			@ -290,6 +292,15 @@ namespace DM_Weight.ViewModels
 | 
			
		|||
                                    //await Task.Delay(200);
 | 
			
		||||
                                    _portUtil.ShowContent(item.DrawerNo, item.ColNo);
 | 
			
		||||
                                }
 | 
			
		||||
                                if (item.BoardType == 35)
 | 
			
		||||
                                {
 | 
			
		||||
                                    _portUtil.WindowName = "BindingChannelDialog";
 | 
			
		||||
                                    await _portUtil.WriteChannelInfoMethod(1, DrugInfo.DrugName, item.DrawerNo, item.ColNo);
 | 
			
		||||
                                    await Task.Delay(200);
 | 
			
		||||
                                    await _portUtil.WriteChannelInfoMethod(3, DrugInfo.DrugSpec, item.DrawerNo, item.ColNo);
 | 
			
		||||
                                    await Task.Delay(200);
 | 
			
		||||
                                    await _portUtil.ShowContentMethod(item.DrawerNo, item.ColNo);
 | 
			
		||||
                                }
 | 
			
		||||
                                //_screenUtil.SetStockInfo(item, 1);
 | 
			
		||||
 | 
			
		||||
                            }
 | 
			
		||||
| 
						 | 
				
			
			@ -323,8 +334,8 @@ namespace DM_Weight.ViewModels
 | 
			
		|||
                        for (int i = 0; i < SelectChannels.Count; i++)
 | 
			
		||||
                        {
 | 
			
		||||
                            var item = SelectChannels[i];
 | 
			
		||||
                            var channelStock = SqlSugarHelper.Db.Queryable<ChannelStock>().Where(cs => cs.Chnguid == item.Id&&cs.Quantity>0).ToList();
 | 
			
		||||
                            if(channelStock.Count>0)
 | 
			
		||||
                            var channelStock = SqlSugarHelper.Db.Queryable<ChannelStock>().Where(cs => cs.Chnguid == item.Id && cs.Quantity > 0).ToList();
 | 
			
		||||
                            if (channelStock.Count > 0)
 | 
			
		||||
                            {
 | 
			
		||||
                                //有库存,不能解绑
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -342,7 +353,7 @@ namespace DM_Weight.ViewModels
 | 
			
		|||
                            item.Drug = DrugInfo;
 | 
			
		||||
                            item.DrugSpec = DrugInfo.DrugSpec.ToString();
 | 
			
		||||
                            //item.EffDate = String.Format("{0:yyyy-MM-dd}", DrugManuNo.EffDate);
 | 
			
		||||
                            SqlSugarHelper.Db.Updateable(item).UpdateColumns(it => new { it.DrugId, it.PosNo,it.DrugSpec }).ExecuteCommand();
 | 
			
		||||
                            SqlSugarHelper.Db.Updateable(item).UpdateColumns(it => new { it.DrugId, it.PosNo, it.DrugSpec }).ExecuteCommand();
 | 
			
		||||
 | 
			
		||||
                            if (item.BoardType == 5)
 | 
			
		||||
                            {
 | 
			
		||||
| 
						 | 
				
			
			@ -365,8 +376,17 @@ namespace DM_Weight.ViewModels
 | 
			
		|||
                                //Thread.Sleep(200);
 | 
			
		||||
                                _portUtil.ShowContent(item.DrawerNo, item.ColNo);
 | 
			
		||||
                            }
 | 
			
		||||
                            if (item.BoardType == 35)
 | 
			
		||||
                            {
 | 
			
		||||
                                _portUtil.WindowName = "BindingChannelDialog";
 | 
			
		||||
                                await _portUtil.WriteChannelInfoMethod(1, DrugInfo.DrugName, item.DrawerNo, item.ColNo);
 | 
			
		||||
                                await Task.Delay(200);
 | 
			
		||||
                                await _portUtil.WriteChannelInfoMethod(3, DrugInfo.DrugSpec, item.DrawerNo, item.ColNo);
 | 
			
		||||
                                await Task.Delay(200);
 | 
			
		||||
                                await _portUtil.ShowContentMethod(item.DrawerNo, item.ColNo);
 | 
			
		||||
                                //_portUtil.ClearContentMethod(item.DrawerNo, item.ColNo);
 | 
			
		||||
                            }
 | 
			
		||||
                        }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
                        GetChannelsByDrawerNo();
 | 
			
		||||
                    }
 | 
			
		||||
| 
						 | 
				
			
			@ -410,7 +430,7 @@ namespace DM_Weight.ViewModels
 | 
			
		|||
                        //item.EffDate = null;
 | 
			
		||||
                        item.Drug = null;
 | 
			
		||||
                        item.DrugSpec = null;
 | 
			
		||||
                        SqlSugarHelper.Db.Updateable(item).UpdateColumns(it => new { it.DrugId,it.DrugSpec }).ExecuteCommand();
 | 
			
		||||
                        SqlSugarHelper.Db.Updateable(item).UpdateColumns(it => new { it.DrugId, it.DrugSpec }).ExecuteCommand();
 | 
			
		||||
                        if (item.BoardType == 5)
 | 
			
		||||
                        {
 | 
			
		||||
                            // 清除显示屏库位信息
 | 
			
		||||
| 
						 | 
				
			
			@ -418,6 +438,12 @@ namespace DM_Weight.ViewModels
 | 
			
		|||
                            await Task.Delay(200);
 | 
			
		||||
                            _portUtil.ShowContent(item.DrawerNo, item.ColNo);
 | 
			
		||||
                        }
 | 
			
		||||
                        if (item.BoardType == 35)
 | 
			
		||||
                        {
 | 
			
		||||
                            _portUtil.ClearContentMethod(item.DrawerNo, item.ColNo);
 | 
			
		||||
                            await Task.Delay(300);
 | 
			
		||||
                            _portUtil.ShowContentMethod(item.DrawerNo, item.ColNo);
 | 
			
		||||
                        }
 | 
			
		||||
 | 
			
		||||
                        //_screenUtil.SetStockInfo(item, 1);
 | 
			
		||||
                    });
 | 
			
		||||
| 
						 | 
				
			
			@ -468,7 +494,7 @@ namespace DM_Weight.ViewModels
 | 
			
		|||
        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 drug_name_spec FROM `drug_info` d";
 | 
			
		||||
                        d.manufactory,d.max_stock,CONCAT(drug_name,' / ',drug_spec,' / ',manufactory) as drug_name_spec FROM `drug_info` d";
 | 
			
		||||
            if (string.IsNullOrEmpty(text))
 | 
			
		||||
            {
 | 
			
		||||
                DrugInfos = SqlSugarHelper.Db.SqlQueryable<DrugInfo>(str).OrderBy(di => di.DrugName).OrderBy(di => di.DrugId).ToList();
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -0,0 +1,656 @@
 | 
			
		|||
using DM_Weight.Models;
 | 
			
		||||
using DM_Weight.msg;
 | 
			
		||||
using DM_Weight.util;
 | 
			
		||||
using log4net;
 | 
			
		||||
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.Xml;
 | 
			
		||||
 | 
			
		||||
namespace DM_Weight.ViewModels
 | 
			
		||||
{
 | 
			
		||||
    public class ChangeShiftsDialogViewModel : BindableBase, IDialogAware, IRegionMemberLifetime
 | 
			
		||||
    {
 | 
			
		||||
        public string Title => "交接班";
 | 
			
		||||
 | 
			
		||||
        public bool KeepAlive => true;
 | 
			
		||||
        //交班人 发药人
 | 
			
		||||
        public UserList Operator { get; set; }
 | 
			
		||||
        private bool _operatorLogin = false;
 | 
			
		||||
        public bool OperatorLogin
 | 
			
		||||
        {
 | 
			
		||||
            get => _operatorLogin;
 | 
			
		||||
            set { SetProperty(ref _operatorLogin, value); }
 | 
			
		||||
        }
 | 
			
		||||
        //private _brushesOperator = Brushes.Green;
 | 
			
		||||
        //public System.Drawing.Brush BrushesOperator
 | 
			
		||||
        //{
 | 
			
		||||
        //    get=> _brushesOperator;
 | 
			
		||||
        //    set { SetProperty(ref _brushesOperator, value);}
 | 
			
		||||
        //}
 | 
			
		||||
        //交班人 审核人
 | 
			
		||||
        public UserList Reviewer { get; set; }
 | 
			
		||||
        private bool _reviewerLogin = false;
 | 
			
		||||
        public bool ReviewerLogin
 | 
			
		||||
        {
 | 
			
		||||
            get => _reviewerLogin;
 | 
			
		||||
            set
 | 
			
		||||
            {
 | 
			
		||||
                SetProperty(ref _reviewerLogin, value);
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        //private System.Drawing.Brush _brushesReviewer=Brushes.Green;
 | 
			
		||||
        //public System.Drawing.Brush BrushesReviewer
 | 
			
		||||
        //{
 | 
			
		||||
        //    get=> _brushesReviewer;
 | 
			
		||||
        //    set
 | 
			
		||||
        //    {
 | 
			
		||||
        //        SetProperty(ref _brushesReviewer, value);
 | 
			
		||||
        //    }
 | 
			
		||||
        //}
 | 
			
		||||
 | 
			
		||||
        //接班人 发药人
 | 
			
		||||
        public UserList JieOperator { get; set; }
 | 
			
		||||
        //接班人 审核人
 | 
			
		||||
        public UserList JieReviewer { get; set; }
 | 
			
		||||
 | 
			
		||||
        //当前操作人
 | 
			
		||||
        public UserList CurrentUser { get; set; }
 | 
			
		||||
        //双人登录还是单人登录
 | 
			
		||||
        private int loginMode = Convert.ToInt32(ConfigurationManager.AppSettings["loginMode"]?.ToString() ?? "1");
 | 
			
		||||
        //第一个登录的是发药人还是接班人
 | 
			
		||||
        private string firstLogin = ConfigurationManager.AppSettings["firstLogin"]?.ToString() ?? "operator";
 | 
			
		||||
        //验证按钮可用状态
 | 
			
		||||
        private bool _jiaoBanOk = true;
 | 
			
		||||
        public bool JiaoBanOk
 | 
			
		||||
        {
 | 
			
		||||
            get => _jiaoBanOk;
 | 
			
		||||
            set { SetProperty(ref _jiaoBanOk, value); }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        private NavigationParameters keys = new NavigationParameters();
 | 
			
		||||
 | 
			
		||||
        public bool SingleLogin
 | 
			
		||||
        {
 | 
			
		||||
            get => ReadAppSetting("loginMode") == "1";
 | 
			
		||||
            //get => loginMode == 1;
 | 
			
		||||
        }
 | 
			
		||||
        public bool MultiLogin
 | 
			
		||||
        {
 | 
			
		||||
            //get => loginMode == 2;
 | 
			
		||||
            get => ReadAppSetting("loginMode") == "2";
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        //private PortUtil _portUtil;
 | 
			
		||||
        private Boolean _loginBtnEnable = true;
 | 
			
		||||
        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); } }
 | 
			
		||||
        private readonly ILog logger = LogManager.GetLogger(typeof(LoginWindowViewModel));
 | 
			
		||||
 | 
			
		||||
        private string username;
 | 
			
		||||
        private string password;
 | 
			
		||||
 | 
			
		||||
        private bool _fingerMsg;
 | 
			
		||||
 | 
			
		||||
        public bool FingerMsg
 | 
			
		||||
        {
 | 
			
		||||
            get => _fingerMsg;
 | 
			
		||||
            set => SetProperty(ref _fingerMsg, value);
 | 
			
		||||
        }
 | 
			
		||||
        public event Action<IDialogResult> RequestClose;
 | 
			
		||||
 | 
			
		||||
        public DelegateCommand BtnCloseCommand
 | 
			
		||||
        {
 | 
			
		||||
            get => new DelegateCommand(() =>
 | 
			
		||||
            {
 | 
			
		||||
                // 关闭当前窗口
 | 
			
		||||
                RequestClose?.Invoke(new DialogResult(ButtonResult.Cancel));
 | 
			
		||||
            });
 | 
			
		||||
        }
 | 
			
		||||
        //确认交接
 | 
			
		||||
        public DelegateCommand ShiftsCommand => new DelegateCommand(ShiftsAction);
 | 
			
		||||
        private void ShiftsAction()
 | 
			
		||||
        {
 | 
			
		||||
            if (Operator != null && !OperatorLogin)
 | 
			
		||||
            {
 | 
			
		||||
                AlertMsg alertMsg = new AlertMsg
 | 
			
		||||
                {
 | 
			
		||||
                    Message = "交班发药人需要系统验证!",
 | 
			
		||||
                    Type = MsgType.ERROR,
 | 
			
		||||
                };
 | 
			
		||||
                _eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
 | 
			
		||||
                return;
 | 
			
		||||
            }
 | 
			
		||||
            if (Reviewer != null && !ReviewerLogin)
 | 
			
		||||
            {
 | 
			
		||||
                AlertMsg alertMsg = new AlertMsg
 | 
			
		||||
                {
 | 
			
		||||
                    Message = "交班审核人需要系统验证!",
 | 
			
		||||
                    Type = MsgType.ERROR,
 | 
			
		||||
                };
 | 
			
		||||
                _eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
 | 
			
		||||
                return;
 | 
			
		||||
            }
 | 
			
		||||
            if (JieOperator == null && JieReviewer == null)
 | 
			
		||||
            {
 | 
			
		||||
                AlertMsg alertMsg = new AlertMsg
 | 
			
		||||
                {
 | 
			
		||||
                    Message = "接班发药人或审核需要系统验证!",
 | 
			
		||||
                    Type = MsgType.ERROR,
 | 
			
		||||
                };
 | 
			
		||||
                _eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
 | 
			
		||||
                return;
 | 
			
		||||
            }
 | 
			
		||||
            //1验证交班人与接班人是否都已登录验证2写交接信息
 | 
			
		||||
            //if ((Operator != null || Reviewer != null) && (JieOperator != null || JieReviewer != null))
 | 
			
		||||
            //{
 | 
			
		||||
            DateTime dt = DateTime.Now;
 | 
			
		||||
            //保存交接班信息(查询当前值班人的最后一条交接班信息(如有则修改状态,没有则插入一条)并写入一条接班人信息)
 | 
			
		||||
            //var f = SqlSugarHelper.Db.UseTran(() =>
 | 
			
		||||
            var f = SqlSugarHelper.Db.UseTran(() =>
 | 
			
		||||
            {
 | 
			
		||||
                List<HkcChangeShifts> listHkcChangeShifts = SqlSugarHelper.Db.Queryable<HkcChangeShifts>()
 | 
			
		||||
                  .Where(cs => cs.State == "0")
 | 
			
		||||
                  .WhereIF(Operator != null && !string.IsNullOrEmpty(Operator.UserName), cs => cs.FromOperator == Operator.UserName)
 | 
			
		||||
                  .WhereIF(Reviewer != null && !string.IsNullOrEmpty(Reviewer.UserName), cs => cs.FromRviewer == Reviewer.UserName)
 | 
			
		||||
                  .OrderByDescending(cs => cs.OptState)
 | 
			
		||||
                  .ToList();
 | 
			
		||||
 | 
			
		||||
                if (listHkcChangeShifts != null && listHkcChangeShifts.Count > 0)
 | 
			
		||||
                {
 | 
			
		||||
                    //存在则修改,不存在则插入一条
 | 
			
		||||
                    SqlSugarHelper.Db.Updateable(new HkcChangeShifts()
 | 
			
		||||
                    {
 | 
			
		||||
                        Id = listHkcChangeShifts[0].Id,
 | 
			
		||||
                        ToOperator = JieOperator == null ? "" : JieOperator.UserName,
 | 
			
		||||
                        ToReviewer = JieReviewer == null ? "" : JieReviewer.UserName,
 | 
			
		||||
                        State = "1",
 | 
			
		||||
                        ToDate = dt
 | 
			
		||||
                    }).UpdateColumns(it => new { it.ToOperator, it.ToReviewer, it.State, it.ToDate }).WhereColumns(it => new { it.Id }).ExecuteCommand();
 | 
			
		||||
                }
 | 
			
		||||
                else
 | 
			
		||||
                {
 | 
			
		||||
                    SqlSugarHelper.Db.Insertable(new HkcChangeShifts()
 | 
			
		||||
                    {
 | 
			
		||||
                        FromOperator = Operator == null ? "" : Operator.UserName,
 | 
			
		||||
                        FromRviewer = Reviewer == null ? "" : Reviewer.UserName,
 | 
			
		||||
                        ToOperator = JieOperator == null ? "" : JieOperator.UserName,
 | 
			
		||||
                        ToReviewer = JieReviewer == null ? "" : JieReviewer.UserName,
 | 
			
		||||
                        State = "1",
 | 
			
		||||
                        OptState = "0",
 | 
			
		||||
                        OptDate = dt,
 | 
			
		||||
                        Machineid = ConfigurationManager.AppSettings["machineId"] ?? "DM1"
 | 
			
		||||
                    }).ExecuteCommand();
 | 
			
		||||
 | 
			
		||||
                }
 | 
			
		||||
                SqlSugarHelper.Db.Insertable(new HkcChangeShifts()
 | 
			
		||||
                {
 | 
			
		||||
                    FromOperator = JieOperator == null ? "" : JieOperator.UserName,
 | 
			
		||||
                    FromRviewer = JieReviewer == null ? "" : JieReviewer.UserName,
 | 
			
		||||
                    State = "0",
 | 
			
		||||
                    OptState = "0",
 | 
			
		||||
                    OptDate = dt,
 | 
			
		||||
                    //ToDate = dt,
 | 
			
		||||
                    Machineid = ConfigurationManager.AppSettings["machineId"] ?? "DM1"
 | 
			
		||||
                }).ExecuteCommand();
 | 
			
		||||
 | 
			
		||||
                //插入交接班报表数据信息
 | 
			
		||||
                string strSql = @"SELECT drug.drug_name,drug.DRUG_SPEC,c.manu_no,d.useNum,d.getNum,sum(quantity) as surplus,
 | 
			
		||||
                                    (SELECT d2.manu_stock FROM account_book_g2 d2 WHERE d2.drug_id = c.`drug_id`  and d2.manu_no=c.manu_no  AND d2.create_date  < @beforeDate
 | 
			
		||||
                                    ORDER BY d2.create_date DESC,d2.id DESC LIMIT 1) AS beforeNum
 | 
			
		||||
                                    from channel_stock		c LEFT JOIN drug_info drug on c.drug_id=drug.drug_id left JOIN	(SELECT drug_id,manu_no,
 | 
			
		||||
                                    SUM(IF(d1.`type` = 1, d1.quantity, 0)) AS getNum,SUM(IF(d1.`type` = 2, d1.quantity, 0)) AS useNum FROM dm_machine_record d1
 | 
			
		||||
                                    WHERE d1.`type` IN (1, 2) AND d1.`operation_time` >= @startDate and d1.`operation_time` <=@endDate and d1.machine_id=@machineId GROUP BY d1.Drug_ID ,d1.manu_no) d
 | 
			
		||||
                                    on c.drug_id=d.drug_id and c.manu_no=d.manu_no WHERE c.machine_id=@machineId and c.drug_id is not NULL GROUP BY c.Drug_ID ,c.manu_no
 | 
			
		||||
                                    UNION
 | 
			
		||||
                                    SELECT drug.drug_name,drug.DRUG_SPEC,d.manu_no,d.useNum,d.getNum,sum(quantity) as surplus,(SELECT  d2.manu_stock FROM account_book_g2 d2 WHERE d2.drug_id = d.`drug_id`  and d2.manu_no=d.manu_no  AND d2.create_date < @beforeDate
 | 
			
		||||
                                    ORDER BY d2.create_date DESC,d2.id DESC LIMIT 1) AS beforeNum from (SELECT drug_id,manu_no, SUM(IF(d1.`type` = 1, d1.quantity, 0)) AS getNum,SUM(IF(d1.`type` = 2, d1.quantity, 0)) AS useNum FROM dm_machine_record d1 
 | 
			
		||||
                                     WHERE d1.`type` IN (1, 2) AND d1.`operation_time` >= @startDate and d1.`operation_time` <=@endDate and d1.machine_id=@machineId GROUP BY d1.Drug_ID ,d1.manu_no) d	
 | 
			
		||||
                                    LEFT JOIN drug_info drug on d.drug_id=drug.drug_id left JOIN		 channel_stock		c on c.drug_id=d.drug_id and c.manu_no=d.manu_no AND c.machine_id=@machineId GROUP BY d.Drug_ID ,d.manu_no ";
 | 
			
		||||
                List<ShiftsReport> shiftsReports = SqlSugarHelper.Db.SqlQueryable<dynamic>(strSql)
 | 
			
		||||
                 .AddParameters(new
 | 
			
		||||
                 {
 | 
			
		||||
                     machineId = ConfigurationManager.AppSettings["machineId"] ?? "DM1",
 | 
			
		||||
                     beforeDate = listHkcChangeShifts[0].OptDate,
 | 
			
		||||
                     startDate = listHkcChangeShifts[0].OptDate,
 | 
			
		||||
                     endDate = dt
 | 
			
		||||
                 })
 | 
			
		||||
                .Select(it => new ShiftsReport())
 | 
			
		||||
                .ToList();
 | 
			
		||||
                if (shiftsReports != null && shiftsReports.Count > 0)
 | 
			
		||||
                {
 | 
			
		||||
                    for (int i = 0; i < shiftsReports.Count; i++)
 | 
			
		||||
                    {
 | 
			
		||||
 | 
			
		||||
                        SqlSugarHelper.Db.Insertable(new ShiftsReport()
 | 
			
		||||
                        {
 | 
			
		||||
                            OptDate = dt,
 | 
			
		||||
                            DrugName = shiftsReports[i].DrugName,
 | 
			
		||||
                            DrugSpec = shiftsReports[i].DrugSpec,
 | 
			
		||||
                            BeforeNum = shiftsReports[i].BeforeNum ?? 0,
 | 
			
		||||
                            GetNum = shiftsReports[i].GetNum ?? 0,
 | 
			
		||||
                            UseNum = shiftsReports[i].UseNum ?? 0,
 | 
			
		||||
                            ManuNo = shiftsReports[i].ManuNo,
 | 
			
		||||
                            Surplus = shiftsReports[i].Surplus ?? 0,
 | 
			
		||||
                            FromOperator = Operator == null ? "" : Operator.Nickname,
 | 
			
		||||
                            FromReviewer = Reviewer == null ? "" : Reviewer.Nickname,
 | 
			
		||||
                            ToOperator = JieOperator == null ? "" : JieOperator.Nickname,
 | 
			
		||||
                            ToReviewer = JieReviewer == null ? "" : JieReviewer.Nickname,
 | 
			
		||||
                            MachineId = ConfigurationManager.AppSettings["machineId"] ?? "DM1"
 | 
			
		||||
                        }).ExecuteCommand();
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
                return true;
 | 
			
		||||
            });
 | 
			
		||||
            if (f.Data)
 | 
			
		||||
            {
 | 
			
		||||
                AlertMsg alertMsg = new AlertMsg
 | 
			
		||||
                {
 | 
			
		||||
                    Message = "交接班操作完成!",
 | 
			
		||||
                    Type = MsgType.SUCCESS,
 | 
			
		||||
                };
 | 
			
		||||
                _eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
 | 
			
		||||
                // 关闭当前窗口
 | 
			
		||||
                RequestClose?.Invoke(new DialogResult(ButtonResult.Cancel));
 | 
			
		||||
            }
 | 
			
		||||
            if (!f.IsSuccess)
 | 
			
		||||
            {
 | 
			
		||||
                AlertMsg alertMsg = new AlertMsg
 | 
			
		||||
                {
 | 
			
		||||
                    Message = "交接班操作失败!",
 | 
			
		||||
                    Type = MsgType.ERROR,
 | 
			
		||||
                };
 | 
			
		||||
                _eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
 | 
			
		||||
            }
 | 
			
		||||
            //}
 | 
			
		||||
            //else
 | 
			
		||||
            //{
 | 
			
		||||
            //    AlertMsg alertMsg = new AlertMsg
 | 
			
		||||
            //    {
 | 
			
		||||
            //        Message = "交接班需要交班人与接班人全部系统验证!",
 | 
			
		||||
            //        Type = MsgType.ERROR,
 | 
			
		||||
            //    };
 | 
			
		||||
            //    _eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
 | 
			
		||||
            //}
 | 
			
		||||
        }
 | 
			
		||||
        //用户名密码登录
 | 
			
		||||
        public DelegateCommand LoginCommand => new DelegateCommand(LoginAction);
 | 
			
		||||
 | 
			
		||||
        //清空
 | 
			
		||||
        public DelegateCommand ClearCommand => new DelegateCommand(ClearAction);
 | 
			
		||||
        private void ClearAction()
 | 
			
		||||
        {
 | 
			
		||||
            Username = string.Empty;
 | 
			
		||||
            Password = string.Empty;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        private void LoginAction()
 | 
			
		||||
        {
 | 
			
		||||
            Login();
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        void Login()
 | 
			
		||||
        {
 | 
			
		||||
            LoginBtnEnable = false;
 | 
			
		||||
            if (!string.IsNullOrEmpty(Username) && !string.IsNullOrEmpty(Password))
 | 
			
		||||
            {
 | 
			
		||||
                UserList userList = SqlSugarHelper.Db.Queryable<UserList>()
 | 
			
		||||
                                    .Includes<RoleDm>(u => u.Role)
 | 
			
		||||
                                   .InnerJoin<RoleDm>((u, r) => u.RoleId == r.Id)
 | 
			
		||||
                                   .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 = string.Empty;
 | 
			
		||||
                    Password = string.Empty;
 | 
			
		||||
                }
 | 
			
		||||
                else if (userList.Role == null)
 | 
			
		||||
                {
 | 
			
		||||
                    AlertMsg alertMsg = new AlertMsg
 | 
			
		||||
                    {
 | 
			
		||||
                        Message = "用户还未设置权限,请联系管理员",
 | 
			
		||||
                        Type = MsgType.ERROR
 | 
			
		||||
                    };
 | 
			
		||||
                    _eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
 | 
			
		||||
                    Username = string.Empty;
 | 
			
		||||
                    Password = string.Empty;
 | 
			
		||||
                }
 | 
			
		||||
                else
 | 
			
		||||
                {
 | 
			
		||||
                    if (userList.PassWord == MD5.GetMD5Hash(Password))
 | 
			
		||||
                    {
 | 
			
		||||
                        Username = string.Empty;
 | 
			
		||||
                        Password = string.Empty;
 | 
			
		||||
                        HkcChangeShifts changeOperator = GetOperator();
 | 
			
		||||
                        if (changeOperator != null)
 | 
			
		||||
                        {
 | 
			
		||||
 | 
			
		||||
                            if (userList.UserName == changeOperator.FromOperator&&!OperatorLogin)
 | 
			
		||||
                            {
 | 
			
		||||
 | 
			
		||||
                                Operator = userList;
 | 
			
		||||
                                RaisePropertyChanged("Operator");
 | 
			
		||||
                                //交班人的发药人登录
 | 
			
		||||
                                OperatorLogin = true;
 | 
			
		||||
                                if (((Reviewer != null && ReviewerLogin) || (Reviewer == null)) && JieOperator != null && JieReviewer != null)
 | 
			
		||||
                                { JiaoBanOk = false; }
 | 
			
		||||
                            }
 | 
			
		||||
                            else if (userList.UserName == changeOperator.FromRviewer&&!ReviewerLogin)
 | 
			
		||||
                            {
 | 
			
		||||
                                //交班人的审核人登录
 | 
			
		||||
                                Reviewer = userList;
 | 
			
		||||
                                RaisePropertyChanged("Reviewer");
 | 
			
		||||
                                ReviewerLogin = true;
 | 
			
		||||
                                if (((Operator != null && OperatorLogin) || (Operator == null)) && JieOperator != null && JieReviewer != null)
 | 
			
		||||
                                { JiaoBanOk = false; }
 | 
			
		||||
                            }
 | 
			
		||||
                            else
 | 
			
		||||
                            {
 | 
			
		||||
                                if (keys.ContainsKey("operator"))
 | 
			
		||||
                                {
 | 
			
		||||
                                    //if (userList.UserName == (JieOperator == null ? "" : JieOperator.UserName))
 | 
			
		||||
                                    //{
 | 
			
		||||
                                    //    AlertMsg alertMsg = new AlertMsg
 | 
			
		||||
                                    //    {
 | 
			
		||||
                                    //        Message = "接班发药人不能与审核人相同",
 | 
			
		||||
                                    //        Type = MsgType.ERROR
 | 
			
		||||
                                    //    };
 | 
			
		||||
                                    //    _eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
 | 
			
		||||
                                    //}
 | 
			
		||||
                                    //else
 | 
			
		||||
                                    {
 | 
			
		||||
                                        keys.Add("reviewer", userList);
 | 
			
		||||
                                        JieReviewer = userList;
 | 
			
		||||
                                        RaisePropertyChanged("JieReviewer");
 | 
			
		||||
                                        if (((Operator != null && OperatorLogin) || (Operator == null)) && ((Reviewer != null && ReviewerLogin) || (Reviewer == null)) && JieOperator != null)
 | 
			
		||||
                                        { JiaoBanOk = false; }
 | 
			
		||||
                                    }
 | 
			
		||||
                                }
 | 
			
		||||
                                else
 | 
			
		||||
                                {
 | 
			
		||||
                                    //if (userList.UserName == (JieReviewer == null ? "" : JieReviewer.UserName))
 | 
			
		||||
                                    //{
 | 
			
		||||
                                    //    AlertMsg alertMsg = new AlertMsg
 | 
			
		||||
                                    //    {
 | 
			
		||||
                                    //        Message = "接班发药人不能与审核人相同",
 | 
			
		||||
                                    //        Type = MsgType.ERROR
 | 
			
		||||
                                    //    };
 | 
			
		||||
                                    //    _eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
 | 
			
		||||
                                    //}
 | 
			
		||||
                                    //else
 | 
			
		||||
                                    {
 | 
			
		||||
                                        keys.Add("operator", userList);
 | 
			
		||||
                                        JieOperator = userList;
 | 
			
		||||
                                        RaisePropertyChanged("JieOperator");
 | 
			
		||||
                                        if (((Operator != null && OperatorLogin) || (Operator == null)) && ((Reviewer != null && ReviewerLogin) || (Reviewer == null)) && JieReviewer != null)
 | 
			
		||||
                                        { JiaoBanOk = false; }
 | 
			
		||||
                                    }
 | 
			
		||||
                                }
 | 
			
		||||
                            }
 | 
			
		||||
                        }
 | 
			
		||||
                    }
 | 
			
		||||
                    else
 | 
			
		||||
                    {
 | 
			
		||||
                        AlertMsg alertMsg = new AlertMsg
 | 
			
		||||
                        {
 | 
			
		||||
                            Message = "密码错误",
 | 
			
		||||
                            Type = MsgType.ERROR
 | 
			
		||||
                        };
 | 
			
		||||
                        _eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
 | 
			
		||||
                        Password = string.Empty;
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
            }
 | 
			
		||||
            else
 | 
			
		||||
            {
 | 
			
		||||
                AlertMsg alertMsg = new AlertMsg
 | 
			
		||||
                {
 | 
			
		||||
                    Message = "请输入账号或密码",
 | 
			
		||||
                    Type = MsgType.ERROR
 | 
			
		||||
                };
 | 
			
		||||
                _eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
 | 
			
		||||
            }
 | 
			
		||||
            LoginBtnEnable = true;
 | 
			
		||||
        }
 | 
			
		||||
        //void SetUser(UserList user)
 | 
			
		||||
        //{
 | 
			
		||||
        //    // 双人登录模式
 | 
			
		||||
        //    {
 | 
			
		||||
        //        // 如果已经录入了发药人,已经有一个用户登录
 | 
			
		||||
        //        if (keys.ContainsKey("operator"))
 | 
			
		||||
        //        {
 | 
			
		||||
        //            if (keys.GetValue<UserList>("operator").Id != user.Id)
 | 
			
		||||
        //            {
 | 
			
		||||
        //                keys.Add("reviewer", user);
 | 
			
		||||
        //                JieReviewer = user;
 | 
			
		||||
        //                RaisePropertyChanged("JieReviewer");
 | 
			
		||||
        //            }
 | 
			
		||||
        //            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);
 | 
			
		||||
        //                JieOperator = user;
 | 
			
		||||
        //                RaisePropertyChanged("JieOperator");
 | 
			
		||||
        //            }
 | 
			
		||||
        //            else
 | 
			
		||||
        //            {
 | 
			
		||||
        //                AlertMsg alertMsg = new AlertMsg
 | 
			
		||||
        //                {
 | 
			
		||||
        //                    Message = "该审核人账号已登录,请输入不同账号",
 | 
			
		||||
        //                    Type = MsgType.ERROR
 | 
			
		||||
        //                };
 | 
			
		||||
        //                _eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
 | 
			
		||||
        //            }
 | 
			
		||||
        //        }
 | 
			
		||||
        //        // 第一个用户登录
 | 
			
		||||
        //        else
 | 
			
		||||
        //        {
 | 
			
		||||
        //            if (firstLogin.Equals("operator"))
 | 
			
		||||
        //            {
 | 
			
		||||
        //                keys.Add("operator", user);
 | 
			
		||||
        //                JieOperator = user;
 | 
			
		||||
        //                RaisePropertyChanged("JieOperator");
 | 
			
		||||
        //            }
 | 
			
		||||
        //            else
 | 
			
		||||
        //            {
 | 
			
		||||
        //                keys.Add("reviewer", user);
 | 
			
		||||
        //                JieReviewer = user;
 | 
			
		||||
        //                RaisePropertyChanged("JieReviewer");
 | 
			
		||||
        //            }
 | 
			
		||||
        //        }
 | 
			
		||||
        //    }
 | 
			
		||||
        //}
 | 
			
		||||
        void ChangeShiftsLoginEvent(FingerprintMsg msg)
 | 
			
		||||
        {
 | 
			
		||||
            logger.Info(msg.ToString());
 | 
			
		||||
            if (msg.Message.Equals("CONNECT"))
 | 
			
		||||
            {
 | 
			
		||||
                FingerMsg = !msg.Result;
 | 
			
		||||
            }
 | 
			
		||||
            if (LoginBtnEnable)
 | 
			
		||||
            {
 | 
			
		||||
                if (msg.Message.Equals("LOGIN"))
 | 
			
		||||
                {
 | 
			
		||||
                    UserList userList = SqlSugarHelper.Db.Queryable<UserList>()
 | 
			
		||||
                    .Includes<RoleDm>(u => u.Role)
 | 
			
		||||
                    .First(u => u.Id == msg.Id);
 | 
			
		||||
 | 
			
		||||
                    if (userList == null)
 | 
			
		||||
                    {
 | 
			
		||||
                        AlertMsg alertMsg = new AlertMsg
 | 
			
		||||
                        {
 | 
			
		||||
                            Message = "无此用户",
 | 
			
		||||
                            Type = MsgType.ERROR
 | 
			
		||||
                        };
 | 
			
		||||
                        _eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
 | 
			
		||||
                        //Username = "";
 | 
			
		||||
                        //Password = "";
 | 
			
		||||
                    }
 | 
			
		||||
                    else if (userList.Role == null)
 | 
			
		||||
                    {
 | 
			
		||||
                        AlertMsg alertMsg = new AlertMsg
 | 
			
		||||
                        {
 | 
			
		||||
                            Message = "用户还未设置权限,请联系管理员",
 | 
			
		||||
                            Type = MsgType.ERROR
 | 
			
		||||
                        };
 | 
			
		||||
                        _eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
 | 
			
		||||
                        //Username = "";
 | 
			
		||||
                        //Password = "";
 | 
			
		||||
                    }
 | 
			
		||||
                    else
 | 
			
		||||
                    {
 | 
			
		||||
                        HkcChangeShifts changeOperator = GetOperator();
 | 
			
		||||
                        if (changeOperator != null)
 | 
			
		||||
                        {
 | 
			
		||||
                            if (userList.UserName == changeOperator.FromOperator)
 | 
			
		||||
                            {
 | 
			
		||||
                                Operator = userList;
 | 
			
		||||
                                RaisePropertyChanged("Operator");
 | 
			
		||||
                                //交班人的发药人登录
 | 
			
		||||
                                OperatorLogin = true;
 | 
			
		||||
                                if (((Reviewer != null && ReviewerLogin) || (Reviewer == null)) && JieOperator != null && JieReviewer != null)
 | 
			
		||||
                                { JiaoBanOk = false; }
 | 
			
		||||
 | 
			
		||||
                            }
 | 
			
		||||
                            else if (userList.UserName == changeOperator.FromRviewer)
 | 
			
		||||
                            {
 | 
			
		||||
                                //交班人的审核人登录
 | 
			
		||||
                                Reviewer = userList;
 | 
			
		||||
                                RaisePropertyChanged("Reviewer");
 | 
			
		||||
                                ReviewerLogin = true;
 | 
			
		||||
                                if (((Operator != null && OperatorLogin) || (Operator == null)) && JieOperator != null && JieReviewer != null)
 | 
			
		||||
                                { JiaoBanOk = false; }
 | 
			
		||||
                            }
 | 
			
		||||
                            else
 | 
			
		||||
                            {
 | 
			
		||||
                                if (keys.ContainsKey("operator"))
 | 
			
		||||
                                {
 | 
			
		||||
                                    //if (userList.UserName == (JieOperator == null ? "" : JieOperator.UserName))
 | 
			
		||||
                                    //{
 | 
			
		||||
                                    //    AlertMsg alertMsg = new AlertMsg
 | 
			
		||||
                                    //    {
 | 
			
		||||
                                    //        Message = "接班发药人不能与审核人相同",
 | 
			
		||||
                                    //        Type = MsgType.ERROR
 | 
			
		||||
                                    //    };
 | 
			
		||||
                                    //    _eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
 | 
			
		||||
                                    //}
 | 
			
		||||
                                    //else
 | 
			
		||||
                                    {
 | 
			
		||||
                                        keys.Add("reviewer", userList);
 | 
			
		||||
                                        JieReviewer = userList;
 | 
			
		||||
                                        RaisePropertyChanged("JieReviewer");
 | 
			
		||||
                                        if (((Operator != null && OperatorLogin) || (Operator == null)) && ((Reviewer != null && ReviewerLogin) || (Reviewer == null)) && JieOperator != null)
 | 
			
		||||
                                        { JiaoBanOk = false; }
 | 
			
		||||
 | 
			
		||||
                                    }
 | 
			
		||||
                                }
 | 
			
		||||
                                else
 | 
			
		||||
                                {
 | 
			
		||||
                                        //if (userList.UserName == (JieReviewer == null ? "" : JieReviewer.UserName))
 | 
			
		||||
                                        //{
 | 
			
		||||
                                        //    AlertMsg alertMsg = new AlertMsg
 | 
			
		||||
                                        //    {
 | 
			
		||||
                                        //        Message = "接班发药人不能与审核人相同",
 | 
			
		||||
                                        //        Type = MsgType.ERROR
 | 
			
		||||
                                        //    };
 | 
			
		||||
                                        //    _eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
 | 
			
		||||
                                        //}
 | 
			
		||||
                                        //else
 | 
			
		||||
                                    {
 | 
			
		||||
                                        keys.Add("operator", userList);
 | 
			
		||||
                                        JieOperator = userList;
 | 
			
		||||
                                        RaisePropertyChanged("JieOperator");
 | 
			
		||||
                                        if (((Operator != null && OperatorLogin) || (Operator == null)) && ((Reviewer != null && ReviewerLogin) || (Reviewer == null)) && JieReviewer != null)
 | 
			
		||||
                                        { JiaoBanOk = false; }
 | 
			
		||||
                                    }
 | 
			
		||||
                                }
 | 
			
		||||
                            }
 | 
			
		||||
                        }
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
        }
 | 
			
		||||
        IEventAggregator _eventAggregator;
 | 
			
		||||
        ////private SqlSugarScope SqlSugarHelper.Db;
 | 
			
		||||
        public ChangeShiftsDialogViewModel(IEventAggregator eventAggregator)
 | 
			
		||||
        {
 | 
			
		||||
            _eventAggregator = eventAggregator;
 | 
			
		||||
            ////this.SqlSugarHelper.Db = sqlSugarScope;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public bool CanCloseDialog()
 | 
			
		||||
        {
 | 
			
		||||
            return true;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public void OnDialogClosed()
 | 
			
		||||
        {
 | 
			
		||||
            _eventAggregator.GetEvent<FingerprintEvent>().Unsubscribe(ChangeShiftsLoginEvent);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public void OnDialogOpened(IDialogParameters parameters)
 | 
			
		||||
        {
 | 
			
		||||
            HkcChangeShifts changeOperator = GetOperator();
 | 
			
		||||
            if (changeOperator != null)
 | 
			
		||||
            {
 | 
			
		||||
                Operator = SqlSugarHelper.Db.Queryable<UserList>().Where(u => u.MachineId.Equals(ConfigurationManager.AppSettings["machineId"] ?? "DM1")).Single(u => u.UserName == changeOperator.FromOperator);
 | 
			
		||||
                Reviewer = SqlSugarHelper.Db.Queryable<UserList>().Where(u => u.MachineId.Equals(ConfigurationManager.AppSettings["machineId"] ?? "DM1")).Single(u => u.UserName == changeOperator.FromRviewer);
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            FingerMsg = false;// !_fingerprintUtil.bIsConnected;
 | 
			
		||||
            _eventAggregator.GetEvent<FingerprintEvent>().Subscribe(ChangeShiftsLoginEvent);
 | 
			
		||||
        }
 | 
			
		||||
        //查询值班人信息
 | 
			
		||||
        private HkcChangeShifts GetOperator()
 | 
			
		||||
        {
 | 
			
		||||
            //查询发药人及审核人
 | 
			
		||||
            HkcChangeShifts changeOperator = SqlSugarHelper.Db.Queryable<HkcChangeShifts>().Single(change => change.State == "0");
 | 
			
		||||
            //if (changeOperator != null)
 | 
			
		||||
            //{
 | 
			
		||||
            //    Operator = SqlSugarHelper.Db.Queryable<UserList>().Single(u => u.UserName == changeOperator.FromOperator);
 | 
			
		||||
            //    Reviewer = SqlSugarHelper.Db.Queryable<UserList>().Single(u => u.UserName == changeOperator.ToOperator);
 | 
			
		||||
            //}
 | 
			
		||||
            return changeOperator;
 | 
			
		||||
        }
 | 
			
		||||
        //手动实现调用配置的逻辑 规避修改配置文件后不起作用的问题
 | 
			
		||||
        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();
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,190 @@
 | 
			
		|||
using DM_Weight.Models;
 | 
			
		||||
using DM_Weight.msg;
 | 
			
		||||
using DM_Weight.Port;
 | 
			
		||||
using DM_Weight.Report;
 | 
			
		||||
using DM_Weight.util;
 | 
			
		||||
using log4net;
 | 
			
		||||
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;
 | 
			
		||||
 | 
			
		||||
namespace DM_Weight.ViewModels
 | 
			
		||||
{
 | 
			
		||||
    public class ChangeShiftsListWindowViewModel : BindableBase, IConfirmNavigationRequest, IRegionMemberLifetime
 | 
			
		||||
    {
 | 
			
		||||
        private int _pageNum = 1;
 | 
			
		||||
        public int PageNum
 | 
			
		||||
        {
 | 
			
		||||
            get => _pageNum;
 | 
			
		||||
            set
 | 
			
		||||
            {
 | 
			
		||||
                SetProperty(ref _pageNum, value);
 | 
			
		||||
                RequestData();
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        private int _pageCount = 1;
 | 
			
		||||
        public int PageCount
 | 
			
		||||
        {
 | 
			
		||||
            get => _pageCount;
 | 
			
		||||
            set
 | 
			
		||||
            {
 | 
			
		||||
                SetProperty(ref _pageCount, value);
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        private int _pageSize = 8;
 | 
			
		||||
        public int PageSize
 | 
			
		||||
        {
 | 
			
		||||
            get => _pageSize;
 | 
			
		||||
            set
 | 
			
		||||
            {
 | 
			
		||||
                SetProperty(ref _pageSize, value);
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        private int _totalCount = 0;
 | 
			
		||||
        public int TotalCount
 | 
			
		||||
        {
 | 
			
		||||
            get => _totalCount;
 | 
			
		||||
            set
 | 
			
		||||
            {
 | 
			
		||||
                SetProperty(ref _totalCount, value);
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        private DateTime? _startDate = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day);
 | 
			
		||||
 | 
			
		||||
        public DateTime? StartDate
 | 
			
		||||
        {
 | 
			
		||||
            get => _startDate;
 | 
			
		||||
            set
 | 
			
		||||
            {
 | 
			
		||||
                if (value != null)
 | 
			
		||||
                {
 | 
			
		||||
                    SetProperty(ref _startDate, new DateTime(value?.Year ?? 0, value?.Month ?? 0, value?.Day ?? 0));
 | 
			
		||||
                }
 | 
			
		||||
                else
 | 
			
		||||
                {
 | 
			
		||||
                    SetProperty(ref _startDate, value);
 | 
			
		||||
                }
 | 
			
		||||
                RequestData();
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        private DateTime? _endDate = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, 23, 59, 59);
 | 
			
		||||
 | 
			
		||||
        public DateTime? EndDate
 | 
			
		||||
        {
 | 
			
		||||
            get => _endDate;
 | 
			
		||||
            set
 | 
			
		||||
            {
 | 
			
		||||
                if (value != null)
 | 
			
		||||
                {
 | 
			
		||||
                    TimeSpan ershisi = new TimeSpan(23, 59, 59);
 | 
			
		||||
                    SetProperty(ref _endDate, new DateTime(value?.Year ?? 0, value?.Month ?? 0, value?.Day ?? 0, 23, 59, 59));
 | 
			
		||||
                }
 | 
			
		||||
                else
 | 
			
		||||
                {
 | 
			
		||||
                    SetProperty(ref _endDate, value);
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
                RequestData();
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        private List<HkcChangeShifts>? hkcChangeShifts;
 | 
			
		||||
 | 
			
		||||
        public List<HkcChangeShifts>? HkcChangeShifts
 | 
			
		||||
        {
 | 
			
		||||
            get { return hkcChangeShifts; }
 | 
			
		||||
            set { SetProperty(ref hkcChangeShifts, value); }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public bool KeepAlive => true;
 | 
			
		||||
        IDialogService _dialogService;
 | 
			
		||||
 | 
			
		||||
        //交接班
 | 
			
		||||
        public DelegateCommand ShiftsCommand => new DelegateCommand(ShiftsAction);
 | 
			
		||||
        private void ShiftsAction()
 | 
			
		||||
        {
 | 
			
		||||
            DialogParameters dialogParameters = new DialogParameters();
 | 
			
		||||
            DialogServiceExtensions.ShowDialogHost(_dialogService, "ChangeShiftsDialog", dialogParameters, DoDialogResult, "RootDialog");
 | 
			
		||||
        }
 | 
			
		||||
        private void DoDialogResult(IDialogResult dialogResult)
 | 
			
		||||
        {
 | 
			
		||||
            RequestData();
 | 
			
		||||
        }
 | 
			
		||||
        //导出报表
 | 
			
		||||
        public DelegateCommand Download => new DelegateCommand(DownloadAction);
 | 
			
		||||
        private void DownloadAction()
 | 
			
		||||
        {
 | 
			
		||||
            GridReportUtil.PrintChangeShiftsReport(StartDate, EndDate);
 | 
			
		||||
        }
 | 
			
		||||
        ////private SqlSugarScope SqlSugarHelper.Db;
 | 
			
		||||
        public ChangeShiftsListWindowViewModel(IDialogService dialogService)
 | 
			
		||||
        {
 | 
			
		||||
            _dialogService = dialogService;
 | 
			
		||||
            ////this.SqlSugarHelper.Db = sqlSugarScope;
 | 
			
		||||
        }
 | 
			
		||||
        void RequestData()
 | 
			
		||||
        {
 | 
			
		||||
            int totalCount = 0;
 | 
			
		||||
            string machineId = ConfigurationManager.AppSettings["machineId"] ?? "DM1";
 | 
			
		||||
            string sqlStr = @"SELECT c.id,c.OptDate,u.User_Name as fromoperator,u2.User_Name fromrviewer,u3.User_Name as tooperator,u4.User_Name as toreviewer,
 | 
			
		||||
                            c.todate,c.State from hkc_changeshifts c LEFT JOIN user_list u on c.fromoperator=u.user_id 
 | 
			
		||||
                            LEFT JOIN user_list u2 on c.fromrviewer=u2.user_id  LEFT JOIN user_list u3 on c.tooperator=u3.user_id  
 | 
			
		||||
                            left join user_list u4 on c.toreviewer=u4.user_id where c.machine_id=@machineId ";
 | 
			
		||||
            if (StartDate != null)
 | 
			
		||||
            {
 | 
			
		||||
                sqlStr += " and c.optdate>=@starOptDate ";
 | 
			
		||||
            }
 | 
			
		||||
            if (EndDate != null)
 | 
			
		||||
            {
 | 
			
		||||
                sqlStr += " and c.optdate<=@endOptDate ";
 | 
			
		||||
            }
 | 
			
		||||
            sqlStr += " group by c.id";
 | 
			
		||||
            HkcChangeShifts = SqlSugarHelper.Db.SqlQueryable<dynamic>(sqlStr)
 | 
			
		||||
                .AddParameters(new
 | 
			
		||||
                {
 | 
			
		||||
                    machineId = machineId,
 | 
			
		||||
                    starOptDate = StartDate,
 | 
			
		||||
                    endOptDate = EndDate
 | 
			
		||||
                })
 | 
			
		||||
                .Select(it => new HkcChangeShifts())
 | 
			
		||||
                //.Select("*")
 | 
			
		||||
                .ToPageList(PageNum, PageSize, ref totalCount);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
            TotalCount = totalCount;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public DelegateCommand Query => new DelegateCommand(RequestData);
 | 
			
		||||
 | 
			
		||||
        public void ConfirmNavigationRequest(NavigationContext navigationContext, Action<bool> continuationCallback)
 | 
			
		||||
        {
 | 
			
		||||
            continuationCallback(true);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public void OnNavigatedTo(NavigationContext navigationContext)
 | 
			
		||||
        {
 | 
			
		||||
            //查询表格数据
 | 
			
		||||
            RequestData();
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public bool IsNavigationTarget(NavigationContext navigationContext)
 | 
			
		||||
        {
 | 
			
		||||
            return true;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public void OnNavigatedFrom(NavigationContext navigationContext)
 | 
			
		||||
        {
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -141,7 +141,7 @@ namespace DM_Weight.ViewModels
 | 
			
		|||
        // 完成按钮
 | 
			
		||||
        public DelegateCommand TakeFinish
 | 
			
		||||
        {
 | 
			
		||||
            get => new DelegateCommand(() =>
 | 
			
		||||
            get => new DelegateCommand(async() =>
 | 
			
		||||
            {
 | 
			
		||||
                _isFinishClick = true;
 | 
			
		||||
                List<ChannelStock> record = ChannelStocks.FindAll(it => it.Quantity != it.CheckQuantity).ToList();
 | 
			
		||||
| 
						 | 
				
			
			@ -185,9 +185,9 @@ namespace DM_Weight.ViewModels
 | 
			
		|||
                                OperationTime = DateTime.Now,
 | 
			
		||||
                                Quantity =  it.CheckQuantity - it.Quantity,
 | 
			
		||||
                                Type = 4,
 | 
			
		||||
                                InvoiceId = InvoiceId,
 | 
			
		||||
                                StockQuantity = nowChannels.Sum(it => it.Quantity),
 | 
			
		||||
                                CheckQuantity = it.CheckQuantity
 | 
			
		||||
                                InvoiceId = InvoiceId
 | 
			
		||||
                                //,StockQuantity = nowChannels.Sum(it => it.Quantity),
 | 
			
		||||
                                //CheckQuantity = it.CheckQuantity
 | 
			
		||||
                            }).ExecuteCommand();
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -206,7 +206,16 @@ namespace DM_Weight.ViewModels
 | 
			
		|||
                                _portUtil.WriteQuantity(it.DrawerNo, it.ColNo, it.CheckQuantity);
 | 
			
		||||
                            });
 | 
			
		||||
                        }
 | 
			
		||||
 | 
			
		||||
                        if ((singleChannels.Count > 0 ? singleChannels[0].BoardType : 1) == 35)
 | 
			
		||||
                        {
 | 
			
		||||
                            for (int i = 0; i < singleChannels.Count; i++)
 | 
			
		||||
                            {
 | 
			
		||||
                                await Task.Delay(200);
 | 
			
		||||
                                await _portUtil.WriteChannelInfoMethod(2, (singleChannels[i].CheckQuantity).ToString(), singleChannels[i].DrawerNo, singleChannels[i].ColNo);
 | 
			
		||||
                                await Task.Delay(200);
 | 
			
		||||
                                await _portUtil.ShowContentMethod(singleChannels[i].DrawerNo, singleChannels[i].ColNo);
 | 
			
		||||
                            }
 | 
			
		||||
                        }
 | 
			
		||||
                        RequestData();
 | 
			
		||||
                        AlertMsg alertMsg = new AlertMsg
 | 
			
		||||
                        {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -0,0 +1,230 @@
 | 
			
		|||
using DM_Weight.Models;
 | 
			
		||||
using DM_Weight.msg;
 | 
			
		||||
using DM_Weight.select;
 | 
			
		||||
using DM_Weight.util;
 | 
			
		||||
using Prism.Commands;
 | 
			
		||||
using Prism.Events;
 | 
			
		||||
using Prism.Mvvm;
 | 
			
		||||
using Prism.Services.Dialogs;
 | 
			
		||||
using System;
 | 
			
		||||
using System.Collections.Generic;
 | 
			
		||||
using System.Configuration;
 | 
			
		||||
using System.Linq;
 | 
			
		||||
using System.Reflection.PortableExecutable;
 | 
			
		||||
using System.Text;
 | 
			
		||||
using System.Threading.Tasks;
 | 
			
		||||
 | 
			
		||||
namespace DM_Weight.ViewModels
 | 
			
		||||
{
 | 
			
		||||
    public class CollectDrugDialogViewModel : BindableBase, IDialogAware
 | 
			
		||||
    {
 | 
			
		||||
        public string Title => "请领申请确认";
 | 
			
		||||
 | 
			
		||||
        //请领数量
 | 
			
		||||
        private int _quantityCount;
 | 
			
		||||
        public int QuantityCount { get { return _quantityCount; } set { SetProperty(ref _quantityCount, value); } }
 | 
			
		||||
 | 
			
		||||
        //交处方张数
 | 
			
		||||
        private int _orderCount;
 | 
			
		||||
        public int OrderCount { get { return _orderCount; } set { SetProperty(ref _orderCount, value); } }
 | 
			
		||||
 | 
			
		||||
        //空瓶数量
 | 
			
		||||
        //private int _emptyCount;
 | 
			
		||||
        //public int EmptyCount { get { return _emptyCount; } set { SetProperty(ref _emptyCount, value); } }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
        static string[] strColloctedId=ConfigurationManager.AppSettings["colloctedId"].Split(',');
 | 
			
		||||
 | 
			
		||||
        public static List<OrderTakeSelect> StaticSelects = new()
 | 
			
		||||
        {
 | 
			
		||||
            new OrderTakeSelect
 | 
			
		||||
            {
 | 
			
		||||
                Code = strColloctedId[1] is null?"":strColloctedId[1],
 | 
			
		||||
                Name = strColloctedId[0]is null?"":strColloctedId[0]
 | 
			
		||||
            },
 | 
			
		||||
            new OrderTakeSelect
 | 
			
		||||
            {
 | 
			
		||||
                Code =  strColloctedId[1] is null?"":strColloctedId[3],
 | 
			
		||||
                Name = strColloctedId[0]is null?"":strColloctedId[2]
 | 
			
		||||
            } 
 | 
			
		||||
        };
 | 
			
		||||
 | 
			
		||||
        private List<OrderTakeSelect> _selects = StaticSelects;
 | 
			
		||||
 | 
			
		||||
        public List<OrderTakeSelect> Selects
 | 
			
		||||
        {
 | 
			
		||||
            get { return _selects; }
 | 
			
		||||
            set
 | 
			
		||||
            {
 | 
			
		||||
                SetProperty(ref _selects, value);
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        private OrderTakeSelect _selectedItem = StaticSelects[0];
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// 查询条件 查询字段
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        public OrderTakeSelect SelectedItem
 | 
			
		||||
        {
 | 
			
		||||
            get { return _selectedItem; }
 | 
			
		||||
            set
 | 
			
		||||
            {
 | 
			
		||||
                SetProperty(ref _selectedItem, value);
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
        private List<CollectDrug> _beforeGroupcollectDrugList;
 | 
			
		||||
        public List<CollectDrug> BeforeGroupCollectDrugList
 | 
			
		||||
        {
 | 
			
		||||
            get { return _beforeGroupcollectDrugList; }
 | 
			
		||||
            set { SetProperty(ref _beforeGroupcollectDrugList, value); }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        private List<CollectDrug> _collectDrugList;
 | 
			
		||||
        public List<CollectDrug> CollectDrugList
 | 
			
		||||
        {
 | 
			
		||||
            get { return _collectDrugList; }
 | 
			
		||||
            set { SetProperty(ref _collectDrugList, value); }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        IEventAggregator _eventAggregator;
 | 
			
		||||
        public CollectDrugDialogViewModel(IEventAggregator eventAggregator)
 | 
			
		||||
        {
 | 
			
		||||
            _eventAggregator = eventAggregator;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public event Action<IDialogResult> RequestClose;
 | 
			
		||||
 | 
			
		||||
        public bool CanCloseDialog()
 | 
			
		||||
        {
 | 
			
		||||
            return true;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public void OnDialogClosed()
 | 
			
		||||
        {
 | 
			
		||||
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public void OnDialogOpened(IDialogParameters parameters)
 | 
			
		||||
        {
 | 
			
		||||
            BeforeGroupCollectDrugList = parameters.GetValue<List<CollectDrug>>("ApplyDrug");
 | 
			
		||||
 | 
			
		||||
            QuantityCount = BeforeGroupCollectDrugList.Sum(ap => ap.Quantity);
 | 
			
		||||
            OrderCount = BeforeGroupCollectDrugList.Count;
 | 
			
		||||
 | 
			
		||||
            CollectDrugList = BeforeGroupCollectDrugList.GroupBy(cd => cd.DrugId).Select(cd => new CollectDrug
 | 
			
		||||
            {
 | 
			
		||||
                DrugName = cd.Aggregate("", (Ccurrent, collectdrug) => collectdrug.DrugName),
 | 
			
		||||
                Quantity = cd.Sum(cd => cd.Quantity),
 | 
			
		||||
                DrugSpec = cd.Max(cd => cd.DrugSpec),
 | 
			
		||||
                Manufactory = cd.Max(cd => cd.Manufactory),
 | 
			
		||||
                DrugId=cd.Max(cd=>cd.DrugId)
 | 
			
		||||
            }).ToList();
 | 
			
		||||
 | 
			
		||||
            //EmptyCount = 0;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
        }
 | 
			
		||||
        public DelegateCommand CreateApply
 | 
			
		||||
        {
 | 
			
		||||
            get => new DelegateCommand(CreateApplyMethod);
 | 
			
		||||
        }
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// 生成请领单
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        public void CreateApplyMethod()
 | 
			
		||||
        {
 | 
			
		||||
            var f = SqlSugarHelper.Db.UseTran(() =>
 | 
			
		||||
            {
 | 
			
		||||
                string pleaseNo = DateTime.Now.ToString("yyyyMMddHHmmss");
 | 
			
		||||
                if (CollectDrugList != null && CollectDrugList.Count > 0)
 | 
			
		||||
                {
 | 
			
		||||
                    for (int d = 0; d < CollectDrugList.Count; d++)
 | 
			
		||||
                    {
 | 
			
		||||
                        CollectDrug groupDrug= CollectDrugList[d];
 | 
			
		||||
                        //保存请领申请表
 | 
			
		||||
                        SqlSugarHelper.Db.Insertable(new DrugPleaseClaim()
 | 
			
		||||
                        {
 | 
			
		||||
                            GetQuantity = groupDrug.Quantity,// QuantityCount,
 | 
			
		||||
                            ReturnPrQuantity = OrderCount,
 | 
			
		||||
                            Type = 32,
 | 
			
		||||
                            State = 0,
 | 
			
		||||
                            MachineId = SelectedItem.Code,
 | 
			
		||||
                            ApplyUser = HomeWindowViewModel.Operator.Id,
 | 
			
		||||
                            ReviewUser = HomeWindowViewModel.Reviewer == null ? 0 : HomeWindowViewModel.Reviewer.Id,
 | 
			
		||||
                            DoDate = DateTime.Now,
 | 
			
		||||
                            Department = ConfigurationManager.AppSettings["department"].ToString(),
 | 
			
		||||
 | 
			
		||||
                            PleaseNo = pleaseNo,
 | 
			
		||||
                            DrugId = groupDrug.DrugId,
 | 
			
		||||
                            TotalQuantity= QuantityCount
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
                        }).ExecuteCommand();
 | 
			
		||||
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
                for (int i = 0; i < BeforeGroupCollectDrugList.Count; i++)
 | 
			
		||||
                {
 | 
			
		||||
                    CollectDrug collectDrug = BeforeGroupCollectDrugList[i];
 | 
			
		||||
 | 
			
		||||
                    //修改处方表里的 药品请领状态(0未请领;1已请领)
 | 
			
		||||
                    SqlSugarHelper.Db.Updateable(new OrderInfo()
 | 
			
		||||
                    {
 | 
			
		||||
                        ApplyStatus = 1,
 | 
			
		||||
                        OrderNo = collectDrug.OrderNo
 | 
			
		||||
                    }).UpdateColumns(it => new { it.ApplyStatus }).Where(it => it.OrderNo == collectDrug.OrderNo).ExecuteCommand();
 | 
			
		||||
 | 
			
		||||
                    //保存处方、请领申请中间表
 | 
			
		||||
                    SqlSugarHelper.Db.Insertable(new CollectDrug()
 | 
			
		||||
                    {
 | 
			
		||||
                        DrugPleaseClaimId = pleaseNo,
 | 
			
		||||
                        OrderNo = collectDrug.OrderNo,
 | 
			
		||||
                        DrugId = collectDrug.DrugId,
 | 
			
		||||
                        Createdate = DateTime.Now,
 | 
			
		||||
                        Status = 0,
 | 
			
		||||
                        MachineId = ConfigurationManager.AppSettings["machineId"].ToString(),
 | 
			
		||||
                        CurrentMachineId = ConfigurationManager.AppSettings["machineId"].ToString(),
 | 
			
		||||
                        //ConfigurationManager.AppSettings["colloctedId"].ToString(),
 | 
			
		||||
                        Quantity = collectDrug.Quantity
 | 
			
		||||
                    }).ExecuteCommand();
 | 
			
		||||
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
            });
 | 
			
		||||
            if (f.IsSuccess)
 | 
			
		||||
            {
 | 
			
		||||
                AlertMsg alertMsg = new AlertMsg
 | 
			
		||||
                {
 | 
			
		||||
                    Message = "请领单已生成!",
 | 
			
		||||
                    Type = MsgType.SUCCESS,
 | 
			
		||||
                };
 | 
			
		||||
                _eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
 | 
			
		||||
            }
 | 
			
		||||
            else
 | 
			
		||||
            {
 | 
			
		||||
                AlertMsg alertMsg = new AlertMsg
 | 
			
		||||
                {
 | 
			
		||||
                    Message = "请领单生成失败!",
 | 
			
		||||
                    Type = MsgType.ERROR,
 | 
			
		||||
                };
 | 
			
		||||
                _eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
 | 
			
		||||
                return;
 | 
			
		||||
            }
 | 
			
		||||
            RequestClose?.Invoke(new DialogResult(ButtonResult.OK));
 | 
			
		||||
        }
 | 
			
		||||
        public DelegateCommand BtnCloseCommand
 | 
			
		||||
        {
 | 
			
		||||
            get => new DelegateCommand(() =>
 | 
			
		||||
            {
 | 
			
		||||
                //DialogParameters parameters = new DialogParameters();
 | 
			
		||||
                //parameters.Add("",);
 | 
			
		||||
                // 关闭当前窗口
 | 
			
		||||
                RequestClose?.Invoke(new DialogResult(ButtonResult.Cancel));
 | 
			
		||||
            });
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,291 @@
 | 
			
		|||
using DM_Weight.Models;
 | 
			
		||||
using DM_Weight.msg;
 | 
			
		||||
using DM_Weight.select;
 | 
			
		||||
using DM_Weight.util;
 | 
			
		||||
using Prism.Commands;
 | 
			
		||||
using Prism.Events;
 | 
			
		||||
using Prism.Mvvm;
 | 
			
		||||
using Prism.Regions;
 | 
			
		||||
using Prism.Services.Dialogs;
 | 
			
		||||
using System;
 | 
			
		||||
using System.Collections.Generic;
 | 
			
		||||
using System.Configuration;
 | 
			
		||||
using System.Drawing.Printing;
 | 
			
		||||
using System.Linq;
 | 
			
		||||
using System.Reactive.Joins;
 | 
			
		||||
using System.Text;
 | 
			
		||||
using System.Threading.Channels;
 | 
			
		||||
using System.Threading.Tasks;
 | 
			
		||||
using System.Windows.Controls;
 | 
			
		||||
 | 
			
		||||
namespace DM_Weight.ViewModels
 | 
			
		||||
{
 | 
			
		||||
    public class CollectDrugWindowViewModel : BindableBase,INavigationAware,IRegionMemberLifetime
 | 
			
		||||
    {
 | 
			
		||||
        private int _pageNum = 1;
 | 
			
		||||
        public int PageNum
 | 
			
		||||
        {
 | 
			
		||||
            get => _pageNum;
 | 
			
		||||
            set
 | 
			
		||||
            {
 | 
			
		||||
                SetProperty(ref _pageNum, value);
 | 
			
		||||
                RequestData();
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        private int _pageCount = 1;
 | 
			
		||||
        public int PageCount
 | 
			
		||||
        {
 | 
			
		||||
            get => _pageCount;
 | 
			
		||||
            set
 | 
			
		||||
            {
 | 
			
		||||
                SetProperty(ref _pageCount, value);
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        private int _pageSize = 8;
 | 
			
		||||
        public int PageSize
 | 
			
		||||
        {
 | 
			
		||||
            get => _pageSize;
 | 
			
		||||
            set
 | 
			
		||||
            {
 | 
			
		||||
                SetProperty(ref _pageSize, value);
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        private int _totalCount = 0;
 | 
			
		||||
        public int TotalCount
 | 
			
		||||
        {
 | 
			
		||||
            get => _totalCount;
 | 
			
		||||
            set
 | 
			
		||||
            {
 | 
			
		||||
                SetProperty(ref _totalCount, value);
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        public static List<OrderTakeSelect> StaticSelects = new()
 | 
			
		||||
        {
 | 
			
		||||
            new OrderTakeSelect
 | 
			
		||||
            {
 | 
			
		||||
                Code = "DrugName",
 | 
			
		||||
                Name = "药品名称"
 | 
			
		||||
            },
 | 
			
		||||
            new OrderTakeSelect
 | 
			
		||||
            {
 | 
			
		||||
                Code = "PyCode",
 | 
			
		||||
                Name = "拼音码"
 | 
			
		||||
            },
 | 
			
		||||
            new OrderTakeSelect
 | 
			
		||||
            {
 | 
			
		||||
                Code = "DrugBarcode",
 | 
			
		||||
                Name = "药品条码"
 | 
			
		||||
            },
 | 
			
		||||
            new OrderTakeSelect
 | 
			
		||||
            {
 | 
			
		||||
                Code = "DrugId",
 | 
			
		||||
                Name = "药品编码"
 | 
			
		||||
            }
 | 
			
		||||
        };
 | 
			
		||||
 | 
			
		||||
        private List<OrderTakeSelect> _selects = StaticSelects;
 | 
			
		||||
 | 
			
		||||
        public List<OrderTakeSelect> Selects
 | 
			
		||||
        {
 | 
			
		||||
            get { return _selects; }
 | 
			
		||||
            set
 | 
			
		||||
            {
 | 
			
		||||
                SetProperty(ref _selects, value);
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        private List<CollectDrug> _collectDrugs = new();
 | 
			
		||||
 | 
			
		||||
        public List<CollectDrug> CollectDrugs { get { return _collectDrugs; } set { SetProperty(ref _collectDrugs, value); } }
 | 
			
		||||
 | 
			
		||||
        private CollectDrug _selectCollectDrugs;
 | 
			
		||||
        public CollectDrug selectCollectDrug { get { return _selectCollectDrugs; } set { SetProperty(ref _selectCollectDrugs, value); } }
 | 
			
		||||
 | 
			
		||||
        private OrderTakeSelect _selectedItem = StaticSelects[0];
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// 查询条件 查询字段
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        public OrderTakeSelect SelectedItem
 | 
			
		||||
        {
 | 
			
		||||
            get { return _selectedItem; }
 | 
			
		||||
            set
 | 
			
		||||
            {
 | 
			
		||||
                SetProperty(ref _selectedItem, value);
 | 
			
		||||
                RequestData();
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        IEventAggregator _eventAggregator;
 | 
			
		||||
        IDialogService _dialogService;
 | 
			
		||||
        public CollectDrugWindowViewModel(IDialogService dialogService, IEventAggregator eventAggregator)
 | 
			
		||||
        {
 | 
			
		||||
            _dialogService = dialogService;
 | 
			
		||||
            _eventAggregator = eventAggregator;
 | 
			
		||||
        }
 | 
			
		||||
        //private void BindSelectCollect(CollectDrug collectDrug)
 | 
			
		||||
        //{
 | 
			
		||||
        //    if (SelectCollects == null)
 | 
			
		||||
        //    {
 | 
			
		||||
        //        SelectCollects = new List<CollectDrug>();
 | 
			
		||||
        //    }
 | 
			
		||||
        //    if (SelectCollects.Contains(collectDrug))
 | 
			
		||||
        //    {
 | 
			
		||||
        //        SelectCollects.Remove(collectDrug);
 | 
			
		||||
        //    }
 | 
			
		||||
        //    else
 | 
			
		||||
        //    {
 | 
			
		||||
        //        SelectCollects.Add(collectDrug);
 | 
			
		||||
        //    }
 | 
			
		||||
        //}
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// 选中处方的请领药品
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        //private List<CollectDrug> _selectCollects;
 | 
			
		||||
        //public List<CollectDrug> SelectCollects
 | 
			
		||||
        //{
 | 
			
		||||
        //    get { return _selectCollects; }
 | 
			
		||||
        //    set { SetProperty(ref _selectCollects, value); }
 | 
			
		||||
        //}
 | 
			
		||||
 | 
			
		||||
        private string? _searchValue;
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// 查询条件 查询字段值
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        public string? SearchValue
 | 
			
		||||
        {
 | 
			
		||||
            get { return _searchValue; }
 | 
			
		||||
            set
 | 
			
		||||
            {
 | 
			
		||||
                SetProperty(ref _searchValue, value);
 | 
			
		||||
                RequestData();
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        void RequestData()
 | 
			
		||||
        {
 | 
			
		||||
            int totalCount = 0;
 | 
			
		||||
 | 
			
		||||
            List<CollectDrug> queryData = SqlSugarHelper.Db.Queryable<OrderInfo>()
 | 
			
		||||
          .InnerJoin<OrderDetail>((oi, od) => oi.OrderNo == od.OrderNo)
 | 
			
		||||
          .InnerJoin<DrugInfo>((oi, od, di) => od.DrugId == di.DrugId.ToString())
 | 
			
		||||
          .WhereIF(!String.IsNullOrEmpty(SearchValue) && SelectedItem.Code.Equals("DrugId"), (oi, od, di) => di.DrugId.ToString() == SearchValue)
 | 
			
		||||
          .WhereIF(!String.IsNullOrEmpty(SearchValue) && SelectedItem.Code.Equals("DrugName"), (oi, od, di) => di.DrugName.Contains(SearchValue))
 | 
			
		||||
          .WhereIF(!String.IsNullOrEmpty(SearchValue) && SelectedItem.Code.Equals("PyCode"), (oi, od, di) => di.PyCode.Contains(SearchValue))
 | 
			
		||||
          .WhereIF(!String.IsNullOrEmpty(SearchValue) && SelectedItem.Code.Equals("DrugBarcode"), (oi, od, di) => di.DrugBarcode.Contains(SearchValue))
 | 
			
		||||
          .WhereIF(!String.IsNullOrEmpty(ConfigurationManager.AppSettings["storage"]), oi => oi.Pharmacy == ConfigurationManager.AppSettings["storage"])
 | 
			
		||||
          .Where(oi => oi.DmStatus == 1)
 | 
			
		||||
          .Where(oi => oi.HisDispFlag == 0)
 | 
			
		||||
          .Where(oi => oi.CancelFlag == 0) 
 | 
			
		||||
          .Where(oi=>oi.ApplyStatus==0)
 | 
			
		||||
          .Where(oi => oi.Pharmacy.Equals(ConfigurationManager.AppSettings["storage"] ?? ""))
 | 
			
		||||
          .GroupBy(oi => oi.OrderDate)
 | 
			
		||||
          .Select((oi, od, di) => new CollectDrug
 | 
			
		||||
          {
 | 
			
		||||
              PatientId = oi.PatientId,
 | 
			
		||||
              PName = oi.PName,
 | 
			
		||||
              Sex = oi.Sex,
 | 
			
		||||
              Age = oi.Age,
 | 
			
		||||
              IdNumber = oi.IdNumber,
 | 
			
		||||
              OrderNo = oi.OrderNo,
 | 
			
		||||
              DeptName = oi.DeptName,
 | 
			
		||||
              DrugName = di.DrugName,
 | 
			
		||||
              Quantity = od.Quantity,
 | 
			
		||||
              DrugSpec = di.DrugSpec,
 | 
			
		||||
              Manufactory = di.Manufactory,
 | 
			
		||||
              DrugId=di.DrugId.ToString(),
 | 
			
		||||
          }).ToList();
 | 
			
		||||
         // .ToPageList(PageNum, PageSize, ref totalCount);
 | 
			
		||||
            //.ToList();
 | 
			
		||||
            CollectDrugs = queryData;
 | 
			
		||||
            TotalCount = totalCount;
 | 
			
		||||
            PageCount = (int)Math.Ceiling((double)TotalCount / PageSize);
 | 
			
		||||
 | 
			
		||||
        }
 | 
			
		||||
        public DelegateCommand RowSelected
 | 
			
		||||
        {
 | 
			
		||||
            get => new DelegateCommand(() =>
 | 
			
		||||
            {
 | 
			
		||||
                if (selectCollectDrug != null)
 | 
			
		||||
                {
 | 
			
		||||
                    CollectDrugs = CollectDrugs.Select(x =>
 | 
			
		||||
                    {
 | 
			
		||||
                        if (x.OrderNo == selectCollectDrug.OrderNo)
 | 
			
		||||
                        {
 | 
			
		||||
                            x.IsSelected = !x.IsSelected;
 | 
			
		||||
                        }
 | 
			
		||||
                        return x;
 | 
			
		||||
                    }).ToList();
 | 
			
		||||
                }
 | 
			
		||||
            });
 | 
			
		||||
        }
 | 
			
		||||
        public DelegateCommand Query
 | 
			
		||||
        {
 | 
			
		||||
            get => new DelegateCommand(() =>
 | 
			
		||||
            {
 | 
			
		||||
                RequestData();
 | 
			
		||||
            });
 | 
			
		||||
        }
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// 生成请领单
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        public DelegateCommand CreateApplyOrder
 | 
			
		||||
        {
 | 
			
		||||
            get => new DelegateCommand(OpenCreateApplyDialog);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public bool KeepAlive => false;
 | 
			
		||||
 | 
			
		||||
        public async void OpenCreateApplyDialog()
 | 
			
		||||
        {
 | 
			
		||||
            if (CollectDrugs != null)
 | 
			
		||||
            {
 | 
			
		||||
                List<CollectDrug> selectCollect = CollectDrugs.Where(cd => cd.IsSelected).ToList();
 | 
			
		||||
                if (selectCollect.Count > 0)
 | 
			
		||||
                {
 | 
			
		||||
                    // 此处延时1毫秒,等待页面渲染
 | 
			
		||||
                    await Task.Delay(TimeSpan.FromMilliseconds(1));
 | 
			
		||||
                    DialogParameters dialogParameters = new DialogParameters();
 | 
			
		||||
                    dialogParameters.Add("ApplyDrug", selectCollect);
 | 
			
		||||
                    DialogServiceExtensions.ShowDialogHost(_dialogService, "CollectDrugDialog", dialogParameters, DoDialogResult, "RootDialog");
 | 
			
		||||
 | 
			
		||||
                }
 | 
			
		||||
                else
 | 
			
		||||
                {
 | 
			
		||||
                    AlertMsg alertMsg = new AlertMsg
 | 
			
		||||
                    {
 | 
			
		||||
                        Message = "未选择任何数据,请先选择数据信息!",
 | 
			
		||||
                        Type = MsgType.ERROR,
 | 
			
		||||
                    };
 | 
			
		||||
                    _eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
 | 
			
		||||
                    return;
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        private void DoDialogResult(IDialogResult dialogResult)
 | 
			
		||||
        {
 | 
			
		||||
            // 委托   被动执行     被子窗口执行
 | 
			
		||||
            // dialogResult  第一方面可以拿到任意参数   第二方面   可判断关闭状态
 | 
			
		||||
            //if(dialogResult.Result == ButtonResult.OK)
 | 
			
		||||
            //{
 | 
			
		||||
            RequestData();
 | 
			
		||||
            //}
 | 
			
		||||
            //MessageBox.Show("返回值:" + dialogResult.Result.ToString());
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public void OnNavigatedTo(NavigationContext navigationContext)
 | 
			
		||||
        {
 | 
			
		||||
            RequestData();
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public bool IsNavigationTarget(NavigationContext navigationContext)
 | 
			
		||||
        {
 | 
			
		||||
            return true;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public void OnNavigatedFrom(NavigationContext navigationContext)
 | 
			
		||||
        { 
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,212 @@
 | 
			
		|||
using DM_Weight.Models;
 | 
			
		||||
using DM_Weight.msg;
 | 
			
		||||
using DM_Weight.util;
 | 
			
		||||
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.Reflection.PortableExecutable;
 | 
			
		||||
using System.Text;
 | 
			
		||||
using System.Threading.Channels;
 | 
			
		||||
using System.Threading.Tasks;
 | 
			
		||||
using static Unity.Storage.RegistrationSet;
 | 
			
		||||
 | 
			
		||||
namespace DM_Weight.ViewModels
 | 
			
		||||
{
 | 
			
		||||
    public class DestoryEmptyDialogViewModel : BindableBase, IDialogAware, IRegionMemberLifetime
 | 
			
		||||
    {
 | 
			
		||||
        public bool KeepAlive => false;
 | 
			
		||||
 | 
			
		||||
        public string Title => "空瓶销毁";
 | 
			
		||||
 | 
			
		||||
        private List<MachineRecord> _machineRecords = new();
 | 
			
		||||
 | 
			
		||||
        public List<MachineRecord> _MachineRecords
 | 
			
		||||
        {
 | 
			
		||||
            get => _machineRecords;
 | 
			
		||||
            set
 | 
			
		||||
            {
 | 
			
		||||
                SetProperty(ref _machineRecords, value);
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        private MachineRecord _machineRecord = new();
 | 
			
		||||
 | 
			
		||||
        public MachineRecord _MachineRecord
 | 
			
		||||
        {
 | 
			
		||||
            get => _machineRecord;
 | 
			
		||||
            set
 | 
			
		||||
            {
 | 
			
		||||
                SetProperty(ref _machineRecord, value);
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        private ChannelStock _channelStock;
 | 
			
		||||
 | 
			
		||||
        public ChannelStock _ChannelStock
 | 
			
		||||
        {
 | 
			
		||||
            get => _channelStock;
 | 
			
		||||
            set => SetProperty(ref _channelStock, value);
 | 
			
		||||
        }
 | 
			
		||||
        IEventAggregator _eventAggregator;
 | 
			
		||||
        public DestoryEmptyDialogViewModel(IEventAggregator eventAggregator)
 | 
			
		||||
        {
 | 
			
		||||
            _eventAggregator = eventAggregator;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public event Action<IDialogResult> RequestClose;
 | 
			
		||||
 | 
			
		||||
        public bool CanCloseDialog()
 | 
			
		||||
        {
 | 
			
		||||
            return true;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public void OnDialogClosed()
 | 
			
		||||
        {
 | 
			
		||||
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public void OnDialogOpened(IDialogParameters parameters)
 | 
			
		||||
        {
 | 
			
		||||
            ChannelStock _record = parameters.GetValue<ChannelStock>("channel");
 | 
			
		||||
            _ChannelStock = _record;
 | 
			
		||||
 | 
			
		||||
            RequestData();
 | 
			
		||||
        }
 | 
			
		||||
        public void RequestData()
 | 
			
		||||
        {
 | 
			
		||||
            List<MachineRecord> queryData = SqlSugarHelper.Db.Queryable<MachineRecord>()
 | 
			
		||||
                .Includes<UserList>(mr => mr.User)
 | 
			
		||||
                .Where(mr => mr.DrugId == _ChannelStock.DrugId)
 | 
			
		||||
                .Where(mr => mr.MachineId.Equals(ConfigurationManager.AppSettings["machineId"] ?? "DM1"))
 | 
			
		||||
                .Where(mr => mr.Type == 32)
 | 
			
		||||
                //.Where(mr => mr.Status != 2)
 | 
			
		||||
                .Where(mr=>mr.IsDestroy==0)
 | 
			
		||||
                .OrderByDescending(mr => mr.OperationTime)
 | 
			
		||||
                .OrderBy(mr => mr.Id)
 | 
			
		||||
                .ToList();
 | 
			
		||||
            _MachineRecords = queryData;
 | 
			
		||||
        }
 | 
			
		||||
        // 取消按钮
 | 
			
		||||
        public DelegateCommand CancleTake
 | 
			
		||||
        {
 | 
			
		||||
            get => new DelegateCommand(() =>
 | 
			
		||||
            {
 | 
			
		||||
                RequestClose?.Invoke(new DialogResult(ButtonResult.Cancel));
 | 
			
		||||
            });
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public DelegateCommand BtnCloseCommand
 | 
			
		||||
        {
 | 
			
		||||
            get => new DelegateCommand(() =>
 | 
			
		||||
            {
 | 
			
		||||
                //DialogParameters parameters = new DialogParameters();
 | 
			
		||||
                //parameters.Add("",);
 | 
			
		||||
                // 关闭当前窗口
 | 
			
		||||
                RequestClose?.Invoke(new DialogResult(ButtonResult.Cancel));
 | 
			
		||||
            });
 | 
			
		||||
        }
 | 
			
		||||
        public DelegateCommand RowSelected
 | 
			
		||||
        {
 | 
			
		||||
            get => new DelegateCommand(() =>
 | 
			
		||||
            {
 | 
			
		||||
                if (_MachineRecord != null && _MachineRecord.Quantity > 0)
 | 
			
		||||
                {
 | 
			
		||||
                    _MachineRecords = _MachineRecords.Select(x =>
 | 
			
		||||
                    {
 | 
			
		||||
                        if (x.Id == _MachineRecord.Id)
 | 
			
		||||
                        {
 | 
			
		||||
                            x.IsSelected = !x.IsSelected;
 | 
			
		||||
                        }
 | 
			
		||||
                        return x;
 | 
			
		||||
                    }).ToList();
 | 
			
		||||
                    //DialogParameters dialogParameters = new DialogParameters();
 | 
			
		||||
                    //dialogParameters.Add("channel", Channel);
 | 
			
		||||
                    //DialogServiceExtensions.ShowDialogHost(_dialogService, "ReturnEmptyDialog", dialogParameters, DoDialogResult, "RootDialog");
 | 
			
		||||
                }
 | 
			
		||||
            });
 | 
			
		||||
        }
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// 空瓶销毁
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        public DelegateCommand DestoryEmptyCommand
 | 
			
		||||
        {
 | 
			
		||||
            get => new DelegateCommand(() =>
 | 
			
		||||
            {
 | 
			
		||||
                List<MachineRecord> records = _MachineRecords.FindAll(it => it.IsSelected).ToList();
 | 
			
		||||
                if (records != null && records.Count > 0)
 | 
			
		||||
                {
 | 
			
		||||
                    var f = SqlSugarHelper.Db.UseTran(() =>
 | 
			
		||||
                    {
 | 
			
		||||
                        for (int i = 0; i < records.Count; i++)
 | 
			
		||||
                        {
 | 
			
		||||
                            MachineRecord record= records[i];
 | 
			
		||||
 | 
			
		||||
                            //修改库存数量
 | 
			
		||||
                            _ChannelStock.Quantity = _ChannelStock.Quantity - record.Quantity; 
 | 
			
		||||
                            SqlSugarHelper.Db.Updateable(_ChannelStock).ExecuteCommand();
 | 
			
		||||
 | 
			
		||||
                            //修改记录表中状态
 | 
			
		||||
                            SqlSugarHelper.Db.Updateable(record).ReSetValue(mr =>
 | 
			
		||||
                            {
 | 
			
		||||
                                mr.IsDestroy = 1; 
 | 
			
		||||
                            }).ExecuteCommand();
 | 
			
		||||
 | 
			
		||||
                            //记录销毁明细 
 | 
			
		||||
                            SqlSugarHelper.Db.Insertable(new DestoryDetail()
 | 
			
		||||
                            {
 | 
			
		||||
                                MachineId = ConfigurationManager.AppSettings["machineId"].ToString(),
 | 
			
		||||
                                Operatorid = HomeWindowViewModel.Operator?.Id,
 | 
			
		||||
                                Reviewerid = HomeWindowViewModel.Reviewer?.Id,
 | 
			
		||||
                                RecordId = record.Id,
 | 
			
		||||
                                //OrderId = ChannelStock.ManuNo,
 | 
			
		||||
 | 
			
		||||
                                //,StockQuantity = nowChannels.Sum(it => it.Quantity)
 | 
			
		||||
                            }).ExecuteCommand();
 | 
			
		||||
 | 
			
		||||
                        }
 | 
			
		||||
 | 
			
		||||
                    });
 | 
			
		||||
                    if (f.Data)
 | 
			
		||||
                    {
 | 
			
		||||
 | 
			
		||||
                        RequestData();
 | 
			
		||||
                        AlertMsg alertMsg = new AlertMsg
 | 
			
		||||
                        {
 | 
			
		||||
                            Message = "销毁完成",
 | 
			
		||||
                            Type = MsgType.SUCCESS,
 | 
			
		||||
                        };
 | 
			
		||||
                        _eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
 | 
			
		||||
                        RequestClose?.Invoke(new DialogResult(ButtonResult.OK));
 | 
			
		||||
                    }
 | 
			
		||||
                    if (!f.IsSuccess)
 | 
			
		||||
                    {
 | 
			
		||||
                        AlertMsg alertMsg = new AlertMsg
 | 
			
		||||
                        {
 | 
			
		||||
                            Message = "销毁失败!",
 | 
			
		||||
                            Type = MsgType.ERROR,
 | 
			
		||||
                        };
 | 
			
		||||
                        _eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
                else
 | 
			
		||||
                {
 | 
			
		||||
                    AlertMsg alertMsg = new AlertMsg
 | 
			
		||||
                    {
 | 
			
		||||
                        Message = "请选择要销毁的数据",
 | 
			
		||||
                        Type = MsgType.ERROR,
 | 
			
		||||
                    };
 | 
			
		||||
                    _eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
            });
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -33,16 +33,25 @@ namespace DM_Weight.ViewModels
 | 
			
		|||
            set => SetProperty(ref _channelStocks, value);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        private bool _openBoxVisibility = false;
 | 
			
		||||
        public bool OpenBoxVisibility
 | 
			
		||||
        {
 | 
			
		||||
            get => _openBoxVisibility;
 | 
			
		||||
            set => SetProperty(ref _openBoxVisibility, value);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        private static readonly DateTime Jan1st1970 = new DateTime
 | 
			
		||||
    (1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);
 | 
			
		||||
 | 
			
		||||
        private PortUtil _portUtil;
 | 
			
		||||
        IEventAggregator _eventAggregator;
 | 
			
		||||
 | 
			
		||||
        //开药盒
 | 
			
		||||
        public DelegateCommand<object> OpenBoxCommand { get; private set; }
 | 
			
		||||
        public DrawerAddDrugWindowViewModel(PortUtil portUtil, IEventAggregator eventAggregator)
 | 
			
		||||
        {
 | 
			
		||||
            _portUtil = portUtil;
 | 
			
		||||
            _eventAggregator = eventAggregator;
 | 
			
		||||
            OpenBoxCommand = new DelegateCommand<object>(param => OpenBoxAction(param));
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        void DoMyPrismEvent(DeviceMsg msg)
 | 
			
		||||
| 
						 | 
				
			
			@ -135,7 +144,7 @@ namespace DM_Weight.ViewModels
 | 
			
		|||
                    _portUtil.WindowName = "DrawerAddDrugWindow";
 | 
			
		||||
                    _portUtil.Operate = true;
 | 
			
		||||
                    _portUtil.BoardType = singleChannels.Count > 0 ? singleChannels[0].BoardType : 1;
 | 
			
		||||
                    _portUtil.ColNos = singleChannels.Select(it => it.ColNo).ToArray();
 | 
			
		||||
                    _portUtil.ColNos = singleChannels.Where(it => it.AddQuantity > 0).Select(it => it.ColNo).ToArray(); //singleChannels.Select(it => it.ColNo).ToArray();
 | 
			
		||||
                    _portUtil.DrawerNo = DrawerNo;
 | 
			
		||||
                    _portUtil.Start();
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -149,12 +158,33 @@ namespace DM_Weight.ViewModels
 | 
			
		|||
            }, () => Status == 0).ObservesProperty(() => Status);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        private void OpenBoxAction(object parameter)
 | 
			
		||||
        {
 | 
			
		||||
            ChannelStock cs = parameter as ChannelStock;
 | 
			
		||||
            if (cs.BoardType == 35)
 | 
			
		||||
            {
 | 
			
		||||
                _portUtil.BoardType = cs.BoardType;
 | 
			
		||||
                _portUtil.DrawerNo = cs.DrawerNo;
 | 
			
		||||
                _portUtil.ColNos = new int[] { cs.ColNo };
 | 
			
		||||
                _portUtil.OpenBox();
 | 
			
		||||
            }
 | 
			
		||||
            else
 | 
			
		||||
            {
 | 
			
		||||
 | 
			
		||||
                AlertMsg alertMsg = new AlertMsg
 | 
			
		||||
                {
 | 
			
		||||
                    Message = "非药盒库位,无需开药盒",
 | 
			
		||||
                    Type = MsgType.ERROR,
 | 
			
		||||
                };
 | 
			
		||||
                _eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        private bool _isFinishClick = false;
 | 
			
		||||
 | 
			
		||||
        // 完成按钮
 | 
			
		||||
        public DelegateCommand TakeFinish
 | 
			
		||||
        {
 | 
			
		||||
            get => new DelegateCommand(() =>
 | 
			
		||||
            get => new DelegateCommand(async() =>
 | 
			
		||||
            {
 | 
			
		||||
                if (!_isFinishClick)
 | 
			
		||||
                {
 | 
			
		||||
| 
						 | 
				
			
			@ -170,7 +200,7 @@ namespace DM_Weight.ViewModels
 | 
			
		|||
                            {
 | 
			
		||||
                                ChannelStock it = record[i];
 | 
			
		||||
                                it.ManuNo = it.drugManuNo.ManuNo;
 | 
			
		||||
                                it.EffDate = it.drugManuNo.EffDate;
 | 
			
		||||
                                it.EffDate = it.drugManuNo.EffDate.Substring(0,10);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
                                // 更新数据 库存信息
 | 
			
		||||
| 
						 | 
				
			
			@ -198,18 +228,146 @@ namespace DM_Weight.ViewModels
 | 
			
		|||
                                    ManuNo = it.ManuNo,
 | 
			
		||||
                                    EffDate = !String.IsNullOrEmpty(it.EffDate) ? DateTime.ParseExact(it.EffDate, "yyyy-MM-dd", System.Globalization.CultureInfo.CurrentCulture) : null,
 | 
			
		||||
                                    Operator = HomeWindowViewModel.Operator?.Id,
 | 
			
		||||
                                    Reviewer=HomeWindowViewModel.Reviewer?.Id,
 | 
			
		||||
                                    Reviewer = HomeWindowViewModel.Reviewer?.Id,
 | 
			
		||||
                                    OperationTime = DateTime.Now,
 | 
			
		||||
                                    Quantity = it.AddQuantity,
 | 
			
		||||
                                    Type = 1,
 | 
			
		||||
                                    InvoiceId = InvoiceId,
 | 
			
		||||
                                    StockQuantity = nowChannels.Sum(it => it.Quantity)
 | 
			
		||||
                                    //,StockQuantity = nowChannels.Sum(it => it.Quantity)
 | 
			
		||||
                                }).ExecuteCommand();
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
                                //保存账册
 | 
			
		||||
                                SqlSugarHelper.Db.Insertable(new AccountBookG2()
 | 
			
		||||
                                {
 | 
			
		||||
                                    DrugId = it.DrugId,
 | 
			
		||||
                                    Type = 1,
 | 
			
		||||
                                    Department = ConfigurationManager.AppSettings["department"].ToString(),
 | 
			
		||||
                                    InvoiceNo = InvoiceId,
 | 
			
		||||
                                    ManuNo = it.ManuNo,
 | 
			
		||||
                                    EffDate = it.EffDate,
 | 
			
		||||
                                    AddQuantity = it.AddQuantity,
 | 
			
		||||
                                    UserId1 = HomeWindowViewModel.Operator?.Id,
 | 
			
		||||
                                    UserId2 = HomeWindowViewModel.Reviewer?.Id,
 | 
			
		||||
                                    MachineId = ConfigurationManager.AppSettings["machineId"].ToString(),
 | 
			
		||||
                                    CreateDate = DateTime.Now.ToString("yyyy-MM-dd"),
 | 
			
		||||
                                    CreateTime = DateTime.Now,
 | 
			
		||||
                                    TotalStock = nowChannels.Sum(itx => itx.Quantity),
 | 
			
		||||
                                    ManuStock = nowChannels.Where(itx => itx.ManuNo == it.ManuNo && itx.EffDate == it.EffDate).Sum(itx => itx.Quantity)
 | 
			
		||||
                                }).ExecuteCommand();
 | 
			
		||||
                                //修改凌晨生成的日结存数据
 | 
			
		||||
                                AccountBookG2 accountBookG2Day = SqlSugarHelper.Db.Queryable<AccountBookG2>()
 | 
			
		||||
                                .Where(ab => ab.MachineId.Equals(it.MachineId))
 | 
			
		||||
                                .Where(ab => ab.Type == 3)
 | 
			
		||||
                                .Where(ab => ab.DrugId == it.DrugId)
 | 
			
		||||
                                .Where(ab => ab.ManuNo == it.ManuNo)
 | 
			
		||||
                                .Where(ab => ab.CreateDate == DateTime.Now.ToString("yyyy-MM-dd")).First();
 | 
			
		||||
                                if (accountBookG2Day != null)
 | 
			
		||||
                                {
 | 
			
		||||
                                    accountBookG2Day.AddQuantity = accountBookG2Day.AddQuantity + it.AddQuantity;
 | 
			
		||||
                                    accountBookG2Day.ManuStock = nowChannels.Where(itx => itx.ManuNo == it.ManuNo && itx.EffDate == it.EffDate).Sum(itx => itx.Quantity);
 | 
			
		||||
                                    accountBookG2Day.TotalStock = nowChannels.Sum(itx => itx.Quantity);
 | 
			
		||||
                                    SqlSugarHelper.Db.Updateable(accountBookG2Day).ExecuteCommand();
 | 
			
		||||
 | 
			
		||||
                                }
 | 
			
		||||
                                else
 | 
			
		||||
                                {
 | 
			
		||||
                                    //生成日结存时可能没有该库位的绑定信息,需要写入日结存
 | 
			
		||||
                                    int iDayResult = SqlSugarHelper.Db.Insertable(new AccountBookG2()
 | 
			
		||||
                                    {
 | 
			
		||||
                                        DrugId = it.DrugId,
 | 
			
		||||
                                        Type = 3,
 | 
			
		||||
                                        ManuNo = it.ManuNo,
 | 
			
		||||
                                        EffDate = it.EffDate,
 | 
			
		||||
                                        YQuantity = 0,
 | 
			
		||||
                                        AddQuantity = it.AddQuantity,
 | 
			
		||||
                                        UserId1 = HomeWindowViewModel.Operator?.Id,
 | 
			
		||||
                                        UserId2 = HomeWindowViewModel.Reviewer?.Id,
 | 
			
		||||
                                        MachineId = ConfigurationManager.AppSettings["machineId"].ToString(),
 | 
			
		||||
                                        CreateDate = DateTime.Now.ToString("yyyy-MM-dd"),
 | 
			
		||||
                                        InvoiceNo = "日结存",
 | 
			
		||||
                                        Department = ConfigurationManager.AppSettings["department"].ToString(),
 | 
			
		||||
                                        ManuStock= nowChannels.Where(itx => itx.ManuNo == it.ManuNo && itx.EffDate == it.EffDate).Sum(itx => itx.Quantity),
 | 
			
		||||
                                        TotalStock = nowChannels.Sum(itx => itx.Quantity)
 | 
			
		||||
                                    }).ExecuteCommand();
 | 
			
		||||
                                    if (iDayResult <= 0)
 | 
			
		||||
                                    {
 | 
			
		||||
                                        logger.Info($"未写入日结存数据{it.DrugId}-{it.ManuNo}-{it.EffDate}-{it.AddQuantity}");
 | 
			
		||||
                                    }
 | 
			
		||||
                                }
 | 
			
		||||
                                //修改凌晨生成的总结存数据
 | 
			
		||||
                                AccountBookG2 accountBookG2Total = SqlSugarHelper.Db.Queryable<AccountBookG2>()
 | 
			
		||||
                                .Where(ab => ab.MachineId.Equals(it.MachineId))
 | 
			
		||||
                                .Where(ab => ab.Type == 4)
 | 
			
		||||
                                .Where(ab => ab.DrugId == it.DrugId)
 | 
			
		||||
                                .Where(ab => ab.CreateDate == DateTime.Now.ToString("yyyy-MM-dd")).First();
 | 
			
		||||
                                if (accountBookG2Total != null)
 | 
			
		||||
                                {
 | 
			
		||||
                                    accountBookG2Total.AddQuantity = accountBookG2Total.AddQuantity + it.AddQuantity;
 | 
			
		||||
                                    accountBookG2Total.ManuStock =nowChannels.Where(itx => itx.ManuNo == it.ManuNo && itx.EffDate == it.EffDate).Sum(itx => itx.Quantity);
 | 
			
		||||
                                    accountBookG2Total.TotalStock =  nowChannels.Sum(itx => itx.Quantity);
 | 
			
		||||
                                    SqlSugarHelper.Db.Updateable(accountBookG2Total).ExecuteCommand();
 | 
			
		||||
                                }
 | 
			
		||||
                                else
 | 
			
		||||
                                {
 | 
			
		||||
                                    //生成总结存时可能没有该库位的绑定信息,需要写入总结存
 | 
			
		||||
                                    int iTotalResult = SqlSugarHelper.Db.Insertable(new AccountBookG2()
 | 
			
		||||
                                    {
 | 
			
		||||
                                        DrugId = it.DrugId,
 | 
			
		||||
                                        Type = 4,
 | 
			
		||||
                                        YQuantity = 0,
 | 
			
		||||
                                        AddQuantity = it.AddQuantity,
 | 
			
		||||
                                        UserId1 = HomeWindowViewModel.Operator?.Id,
 | 
			
		||||
                                        UserId2 = HomeWindowViewModel.Reviewer?.Id,
 | 
			
		||||
                                        MachineId = ConfigurationManager.AppSettings["machineId"].ToString(),
 | 
			
		||||
                                        CreateDate = DateTime.Now.ToString("yyyy-MM-dd"),
 | 
			
		||||
                                        InvoiceNo = "总结存",
 | 
			
		||||
                                        Department = ConfigurationManager.AppSettings["department"].ToString(),
 | 
			
		||||
                                        ManuStock = nowChannels.Where(itx => itx.ManuNo == it.ManuNo && itx.EffDate == it.EffDate).Sum(itx => itx.Quantity),
 | 
			
		||||
                                        TotalStock = nowChannels.Sum(itx => itx.Quantity)
 | 
			
		||||
                                    }).ExecuteCommand();
 | 
			
		||||
                                    if (iTotalResult <= 0)
 | 
			
		||||
                                    {
 | 
			
		||||
                                        logger.Info($"未写入总结存数据{it.DrugId}-{it.AddQuantity}");
 | 
			
		||||
                                    }
 | 
			
		||||
                                }
 | 
			
		||||
                            }
 | 
			
		||||
                            return true;
 | 
			
		||||
                        });
 | 
			
		||||
                        if (f.Data)
 | 
			
		||||
                        {
 | 
			
		||||
                            List<ChannelStock> singleChannels = ChannelStocks.Where(it => it.BoardType != 1)
 | 
			
		||||
                                                                     .GroupBy(it => it.ColNo)
 | 
			
		||||
                                                                     .Select(it =>
 | 
			
		||||
                                                                     {
 | 
			
		||||
                                                                         var ret = it.First();
 | 
			
		||||
                                                                         ret.Quantity = it.Sum(itx => itx.Quantity);
 | 
			
		||||
                                                                         ret.AddQuantity = it.Sum(itx => itx.AddQuantity);
 | 
			
		||||
                                                                         return ret;
 | 
			
		||||
                                                                     }).ToList();
 | 
			
		||||
                            singleChannels = singleChannels.Where(it => it.AddQuantity > 0).ToList();
 | 
			
		||||
                            if ((singleChannels.Count > 0 ? singleChannels[0].BoardType : 1) == 5)
 | 
			
		||||
                            {
 | 
			
		||||
                                //将库位多批次的总库存数更新标签
 | 
			
		||||
                                //_portUtil.WriteQuantity(singleChannels[0].DrawerNo, singleChannels[0].ColNo, singleChannels.Sum(it => it.Quantity) - singleChannels.Sum(it => it.TakeQuantity));
 | 
			
		||||
 | 
			
		||||
                                singleChannels.ForEach(async it =>
 | 
			
		||||
                                {
 | 
			
		||||
 | 
			
		||||
                                    await Task.Delay(200);
 | 
			
		||||
                                    _portUtil.WriteQuantity(it.DrawerNo, it.ColNo, it.Quantity + it.AddQuantity);
 | 
			
		||||
                                });
 | 
			
		||||
                            }
 | 
			
		||||
                            if ((singleChannels.Count > 0 ? singleChannels[0].BoardType : 1) == 35)
 | 
			
		||||
                            {
 | 
			
		||||
                                for (int i = 0; i < singleChannels.Count; i++)
 | 
			
		||||
                                {
 | 
			
		||||
                                    await Task.Delay(200);
 | 
			
		||||
                                    await _portUtil.WriteChannelInfoMethod(2, (singleChannels[i].Quantity + singleChannels[i].AddQuantity).ToString(), singleChannels[i].DrawerNo, singleChannels[i].ColNo);
 | 
			
		||||
                                    await Task.Delay(200);
 | 
			
		||||
                                    await _portUtil.ShowContentMethod(singleChannels[i].DrawerNo, singleChannels[i].ColNo);
 | 
			
		||||
                                }
 | 
			
		||||
                            }
 | 
			
		||||
                            RequestData();
 | 
			
		||||
                            AlertMsg alertMsg = new AlertMsg
 | 
			
		||||
                            {
 | 
			
		||||
| 
						 | 
				
			
			@ -299,6 +457,11 @@ namespace DM_Weight.ViewModels
 | 
			
		|||
               .Where(cs => cs.DrugId != null)
 | 
			
		||||
               .OrderBy(cs => cs.ColNo)
 | 
			
		||||
               .ToList();
 | 
			
		||||
 | 
			
		||||
            if (queryData != null && queryData.Count > 0)
 | 
			
		||||
            {
 | 
			
		||||
                OpenBoxVisibility = queryData[0].BoardType == 3 ? true : queryData[0].BoardType == 35 ? true : false;
 | 
			
		||||
            }
 | 
			
		||||
            ChannelStocks = queryData.Select(cs =>
 | 
			
		||||
            {
 | 
			
		||||
                cs.drugManuNo = cs.DrugInfo.DrugManuNos.Find(it => it.ManuNo.Equals(cs.ManuNo));
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -35,7 +35,12 @@ namespace DM_Weight.ViewModels
 | 
			
		|||
            get => _channelStocks;
 | 
			
		||||
            set => SetProperty(ref _channelStocks, value);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        private bool _openBoxVisibility = false;
 | 
			
		||||
        public bool OpenBoxVisibility
 | 
			
		||||
        {
 | 
			
		||||
            get => _openBoxVisibility;
 | 
			
		||||
            set => SetProperty(ref _openBoxVisibility, value);
 | 
			
		||||
        }
 | 
			
		||||
        private static readonly DateTime Jan1st1970 = new DateTime
 | 
			
		||||
    (1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -44,11 +49,13 @@ namespace DM_Weight.ViewModels
 | 
			
		|||
        private PortUtil _portUtil;
 | 
			
		||||
        IEventAggregator _eventAggregator;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
        //开药盒
 | 
			
		||||
        public DelegateCommand<object> OpenBoxCommand { get; private set; }
 | 
			
		||||
        public DrawerTakeDrugWindowViewModel(PortUtil portUtil, IEventAggregator eventAggregator)
 | 
			
		||||
        {
 | 
			
		||||
            _portUtil = portUtil;
 | 
			
		||||
            _eventAggregator = eventAggregator;
 | 
			
		||||
            OpenBoxCommand = new DelegateCommand<object>(param => OpenBoxAction(param));
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        void DoMyPrismEvent(DeviceMsg msg)
 | 
			
		||||
| 
						 | 
				
			
			@ -143,7 +150,7 @@ namespace DM_Weight.ViewModels
 | 
			
		|||
 | 
			
		||||
                    _portUtil.WindowName = "DrawerTakeDrugWindow";
 | 
			
		||||
                    _portUtil.BoardType = singleChannels.Count > 0 ? singleChannels[0].BoardType : 1;
 | 
			
		||||
                    _portUtil.ColNos = singleChannels.Select(it => it.ColNo).ToArray();
 | 
			
		||||
                    _portUtil.ColNos = singleChannels.Where(it=>it.TakeQuantity>0).Select(it => it.ColNo).ToArray();
 | 
			
		||||
                    _portUtil.DrawerNo = DrawerNo;
 | 
			
		||||
                    Dispatcher.CurrentDispatcher.BeginInvoke(DispatcherPriority.Normal, () => _portUtil.Start())
 | 
			
		||||
                    ;
 | 
			
		||||
| 
						 | 
				
			
			@ -151,7 +158,27 @@ namespace DM_Weight.ViewModels
 | 
			
		|||
 | 
			
		||||
            });
 | 
			
		||||
        }
 | 
			
		||||
        private void OpenBoxAction(object parameter)
 | 
			
		||||
        {
 | 
			
		||||
            ChannelStock cs = parameter as ChannelStock;
 | 
			
		||||
            if (cs.BoardType == 35)
 | 
			
		||||
            {
 | 
			
		||||
                _portUtil.BoardType = cs.BoardType;
 | 
			
		||||
                _portUtil.DrawerNo = cs.DrawerNo;
 | 
			
		||||
                _portUtil.ColNos = new int[] { cs.ColNo };
 | 
			
		||||
                _portUtil.OpenBox();
 | 
			
		||||
            }
 | 
			
		||||
            else
 | 
			
		||||
            {
 | 
			
		||||
 | 
			
		||||
                AlertMsg alertMsg = new AlertMsg
 | 
			
		||||
                {
 | 
			
		||||
                    Message = "非药盒库位,无需开药盒",
 | 
			
		||||
                    Type = MsgType.ERROR,
 | 
			
		||||
                };
 | 
			
		||||
                _eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        private bool _isFinishClick = false;
 | 
			
		||||
 | 
			
		||||
        // 完成按钮
 | 
			
		||||
| 
						 | 
				
			
			@ -204,16 +231,146 @@ namespace DM_Weight.ViewModels
 | 
			
		|||
                                    OperationTime = DateTime.Now,
 | 
			
		||||
                                    Quantity = it.TakeQuantity,
 | 
			
		||||
                                    Type = 2,
 | 
			
		||||
                                    InvoiceId = InvoiceId,
 | 
			
		||||
                                    StockQuantity = nowChannels.Sum(it => it.Quantity)
 | 
			
		||||
                                    InvoiceId = InvoiceId
 | 
			
		||||
                                    //,StockQuantity = nowChannels.Sum(it => it.Quantity)
 | 
			
		||||
                                }).ExecuteCommand();
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
                                //保存账册
 | 
			
		||||
                                SqlSugarHelper.Db.Insertable(new AccountBookG2()
 | 
			
		||||
                                {
 | 
			
		||||
                                    DrugId =it.DrugId,
 | 
			
		||||
                                    Type = 2,
 | 
			
		||||
                                    Department = ConfigurationManager.AppSettings["department"].ToString(),
 | 
			
		||||
                                    InvoiceNo = InvoiceId,
 | 
			
		||||
                                    ManuNo = it.ManuNo,
 | 
			
		||||
                                    EffDate = it.EffDate,
 | 
			
		||||
                                    OutQuantity = it.TakeQuantity,
 | 
			
		||||
                                    UserId1 = HomeWindowViewModel.Operator?.Id,
 | 
			
		||||
                                    UserId2 = HomeWindowViewModel.Reviewer?.Id,
 | 
			
		||||
                                    MachineId = ConfigurationManager.AppSettings["machineId"].ToString(),
 | 
			
		||||
                                    CreateDate = DateTime.Now.ToString("yyyy-MM-dd"),
 | 
			
		||||
                                    CreateTime = DateTime.Now,
 | 
			
		||||
                                    TotalStock = nowChannels.Sum(itx => itx.Quantity),
 | 
			
		||||
                                    ManuStock = nowChannels.Where(itx => itx.ManuNo == it.ManuNo && itx.EffDate == it.EffDate).Sum(itx => itx.Quantity)
 | 
			
		||||
 | 
			
		||||
                                }).ExecuteCommand();
 | 
			
		||||
                                //修改凌晨生成的日结存数据
 | 
			
		||||
                                AccountBookG2 accountBookG2Day = SqlSugarHelper.Db.Queryable<AccountBookG2>()
 | 
			
		||||
                                .Where(ab => ab.MachineId.Equals(it.MachineId))
 | 
			
		||||
                                .Where(ab => ab.Type == 3)
 | 
			
		||||
                                .Where(ab => ab.DrugId == it.DrugId)
 | 
			
		||||
                                .Where(ab => ab.ManuNo == it.ManuNo)
 | 
			
		||||
                                .Where(ab => ab.CreateDate == DateTime.Now.ToString("yyyy-MM-dd")).First();
 | 
			
		||||
                                if (accountBookG2Day != null)
 | 
			
		||||
                                {
 | 
			
		||||
                                    accountBookG2Day.OutQuantity = accountBookG2Day.OutQuantity + it.TakeQuantity;
 | 
			
		||||
                                    accountBookG2Day.ManuStock =nowChannels.Where(itx => itx.ManuNo == it.ManuNo && itx.EffDate == it.EffDate).Sum(itx => itx.Quantity);
 | 
			
		||||
                                    accountBookG2Day.TotalStock = nowChannels.Sum(itx=>itx.Quantity); 
 | 
			
		||||
                                    SqlSugarHelper.Db.Updateable(accountBookG2Day).ExecuteCommand();
 | 
			
		||||
                                }
 | 
			
		||||
                                else
 | 
			
		||||
                                {
 | 
			
		||||
                                    //生成日结存时可能没有该库位的绑定信息,需要写入日结存
 | 
			
		||||
                                    int iDayResult = SqlSugarHelper.Db.Insertable(new AccountBookG2()
 | 
			
		||||
                                    {
 | 
			
		||||
                                        DrugId =it.DrugId,
 | 
			
		||||
                                        Type = 3,
 | 
			
		||||
                                        Department = ConfigurationManager.AppSettings["department"].ToString(),
 | 
			
		||||
                                        ManuNo = it.ManuNo,
 | 
			
		||||
                                        EffDate = it.EffDate,
 | 
			
		||||
                                        YQuantity = 0,
 | 
			
		||||
                                        UserId1 = HomeWindowViewModel.Operator?.Id,
 | 
			
		||||
                                        UserId2 = HomeWindowViewModel.Reviewer?.Id,
 | 
			
		||||
                                        MachineId = ConfigurationManager.AppSettings["machineId"].ToString(),
 | 
			
		||||
                                        CreateDate = DateTime.Now.ToString("yyyy-MM-dd"),
 | 
			
		||||
                                        InvoiceNo = "日结存",
 | 
			
		||||
                                        OutQuantity=it.TakeQuantity,
 | 
			
		||||
                                        TotalStock = nowChannels.Sum(itx => itx.Quantity),
 | 
			
		||||
                                        ManuStock = nowChannels.Where(itx => itx.ManuNo == it.ManuNo && itx.EffDate == it.EffDate).Sum(itx => itx.Quantity)
 | 
			
		||||
                                    }).ExecuteCommand();
 | 
			
		||||
                                    if (iDayResult <= 0)
 | 
			
		||||
                                    {
 | 
			
		||||
                                        logger.Info($"未写入日结存数据{it.DrugId}-{it.ManuNo}-{it.EffDate}-{it.AddQuantity}");
 | 
			
		||||
                                    }
 | 
			
		||||
                                }
 | 
			
		||||
                                //修改凌晨生成的总结存数据
 | 
			
		||||
                                AccountBookG2 accountBookG2Total = SqlSugarHelper.Db.Queryable<AccountBookG2>()
 | 
			
		||||
                                .Where(ab => ab.MachineId.Equals(it.MachineId))
 | 
			
		||||
                                .Where(ab => ab.Type == 4)
 | 
			
		||||
                                .Where(ab => ab.DrugId ==it.DrugId)
 | 
			
		||||
                                .Where(ab => ab.CreateDate == DateTime.Now.ToString("yyyy-MM-dd")).First();
 | 
			
		||||
                                if (accountBookG2Total != null)
 | 
			
		||||
                                {
 | 
			
		||||
                                    accountBookG2Total.ManuStock = nowChannels.Where(itx => itx.ManuNo == it.ManuNo && itx.EffDate == it.EffDate).Sum(itx => itx.Quantity);
 | 
			
		||||
                                    accountBookG2Total.OutQuantity = accountBookG2Total.OutQuantity + it.TakeQuantity;
 | 
			
		||||
                                    accountBookG2Total.TotalStock = nowChannels.Sum(itx=>itx.Quantity);
 | 
			
		||||
                                    SqlSugarHelper.Db.Updateable(accountBookG2Total).ExecuteCommand();
 | 
			
		||||
                                }
 | 
			
		||||
                                else
 | 
			
		||||
                                {
 | 
			
		||||
                                    //生成总结存时可能没有该库位的绑定信息,需要写入总结存
 | 
			
		||||
                                    int iTotalResult = SqlSugarHelper.Db.Insertable(new AccountBookG2()
 | 
			
		||||
                                    {
 | 
			
		||||
                                        DrugId =it.DrugId,
 | 
			
		||||
                                        Type = 4,
 | 
			
		||||
                                        YQuantity = 0,
 | 
			
		||||
                                        OutQuantity=it.TakeQuantity,
 | 
			
		||||
                                        UserId1 = HomeWindowViewModel.Operator?.Id,
 | 
			
		||||
                                        UserId2 = HomeWindowViewModel.Reviewer?.Id,
 | 
			
		||||
                                        MachineId = ConfigurationManager.AppSettings["machineId"].ToString(),
 | 
			
		||||
                                        CreateDate = DateTime.Now.ToString("yyyy-MM-dd"),
 | 
			
		||||
                                        InvoiceNo = "总结存",
 | 
			
		||||
                                        Department= ConfigurationManager.AppSettings["department"].ToString(),
 | 
			
		||||
                                        ManuStock = nowChannels.Where(itx => itx.ManuNo == it.ManuNo && itx.EffDate == it.EffDate).Sum(itx => itx.Quantity),
 | 
			
		||||
                                        TotalStock = nowChannels.Sum(itx=>itx.Quantity),
 | 
			
		||||
                                    }).ExecuteCommand();
 | 
			
		||||
                                    if (iTotalResult <= 0)
 | 
			
		||||
                                    {
 | 
			
		||||
                                        logger.Info($"未写入总结存数据{it.DrugId}-{it.AddQuantity}");
 | 
			
		||||
                                    }
 | 
			
		||||
                                }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
                                logger.Info($"抽屉取药保存->库位【{it.DrawerNo}-{it.ColNo}】取出药品【{it.DrugInfo.DrugName}】个数【{it.TakeQuantity}】,取药前库存【{it.Quantity}】");
 | 
			
		||||
                            }
 | 
			
		||||
                            return true;
 | 
			
		||||
                        });
 | 
			
		||||
                        if (f.Data)
 | 
			
		||||
                        {
 | 
			
		||||
                            List<ChannelStock> singleChannels = ChannelStocks.Where(it => it.BoardType != 1)
 | 
			
		||||
                                                                      .GroupBy(it => it.ColNo)
 | 
			
		||||
                                                                      .Select(it =>
 | 
			
		||||
                                                                      {
 | 
			
		||||
                                                                          var ret = it.First();
 | 
			
		||||
                                                                          ret.Quantity = it.Sum(itx => itx.Quantity);
 | 
			
		||||
                                                                          ret.TakeQuantity = it.Sum(itx => itx.TakeQuantity);
 | 
			
		||||
                                                                          return ret;
 | 
			
		||||
                                                                      }).ToList();
 | 
			
		||||
                            singleChannels = singleChannels.Where(it => it.TakeQuantity > 0).ToList();
 | 
			
		||||
                            if ((singleChannels.Count > 0 ? singleChannels[0].BoardType : 1) == 5)
 | 
			
		||||
                            {
 | 
			
		||||
                                //将库位多批次的总库存数更新标签
 | 
			
		||||
                                //_portUtil.WriteQuantity(singleChannels[0].DrawerNo, singleChannels[0].ColNo, singleChannels.Sum(it => it.Quantity) - singleChannels.Sum(it => it.TakeQuantity));
 | 
			
		||||
 | 
			
		||||
                                singleChannels.ForEach(async it =>
 | 
			
		||||
                                {
 | 
			
		||||
                                    await Task.Delay(200);
 | 
			
		||||
                                    _portUtil.WriteQuantity(it.DrawerNo, it.ColNo, it.Quantity - it.TakeQuantity);
 | 
			
		||||
                                });
 | 
			
		||||
                            }
 | 
			
		||||
                            if ((singleChannels.Count > 0 ? singleChannels[0].BoardType : 1) == 35)
 | 
			
		||||
                            {
 | 
			
		||||
                                singleChannels.ForEach(async it =>
 | 
			
		||||
                                {
 | 
			
		||||
                                    await Task.Delay(200);
 | 
			
		||||
                                    await _portUtil.WriteChannelInfoMethod(2, (it.Quantity - it.TakeQuantity).ToString(), it.DrawerNo, it.ColNo);
 | 
			
		||||
                                    await Task.Delay(200);
 | 
			
		||||
                                    await _portUtil.ShowContentMethod(it.DrawerNo, it.ColNo);
 | 
			
		||||
                                });
 | 
			
		||||
                            }
 | 
			
		||||
                            RequestData();
 | 
			
		||||
                            AlertMsg alertMsg = new AlertMsg
 | 
			
		||||
                            {
 | 
			
		||||
| 
						 | 
				
			
			@ -304,6 +461,11 @@ namespace DM_Weight.ViewModels
 | 
			
		|||
                .Where(cs => cs.Quantity > 0)
 | 
			
		||||
                .OrderBy(cs => cs.ColNo)
 | 
			
		||||
                .ToList();
 | 
			
		||||
 | 
			
		||||
            if (queryData != null && queryData.Count > 0)
 | 
			
		||||
            {
 | 
			
		||||
                OpenBoxVisibility = queryData[0].BoardType == 3 ? true : queryData[0].BoardType == 35 ? true : false;
 | 
			
		||||
            }
 | 
			
		||||
            ChannelStocks = queryData;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -0,0 +1,12 @@
 | 
			
		|||
using System;
 | 
			
		||||
using System.Collections.Generic;
 | 
			
		||||
using System.Linq;
 | 
			
		||||
using System.Text;
 | 
			
		||||
using System.Threading.Tasks;
 | 
			
		||||
 | 
			
		||||
namespace DM_Weight.ViewModels
 | 
			
		||||
{
 | 
			
		||||
    public class DrugBaseWindowViewModel
 | 
			
		||||
    {
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -12,6 +12,10 @@ using DM_Weight.select;
 | 
			
		|||
using DM_Weight.util;
 | 
			
		||||
using log4net.Repository.Hierarchy;
 | 
			
		||||
using log4net;
 | 
			
		||||
using DM_Weight.msg;
 | 
			
		||||
using Prism.Events;
 | 
			
		||||
using System.Configuration;
 | 
			
		||||
using static Unity.Storage.RegistrationSet;
 | 
			
		||||
 | 
			
		||||
namespace DM_Weight.ViewModels
 | 
			
		||||
{
 | 
			
		||||
| 
						 | 
				
			
			@ -58,6 +62,13 @@ namespace DM_Weight.ViewModels
 | 
			
		|||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        IEventAggregator _eventAggregator;
 | 
			
		||||
        public DrugListWindowViewModel(IEventAggregator eventAggregator)
 | 
			
		||||
        {
 | 
			
		||||
            _eventAggregator = eventAggregator;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
        private List<DrugInfo> _drugInfos;
 | 
			
		||||
        public List<DrugInfo> DrugInfos
 | 
			
		||||
        {
 | 
			
		||||
| 
						 | 
				
			
			@ -68,7 +79,10 @@ namespace DM_Weight.ViewModels
 | 
			
		|||
        private DrugInfo _selectedDrug = new();
 | 
			
		||||
        public DrugInfo SelectedDrug
 | 
			
		||||
        {
 | 
			
		||||
            get { return _selectedDrug; }
 | 
			
		||||
            get
 | 
			
		||||
            {
 | 
			
		||||
                return _selectedDrug;
 | 
			
		||||
            }
 | 
			
		||||
            set
 | 
			
		||||
            {
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -81,6 +95,7 @@ namespace DM_Weight.ViewModels
 | 
			
		|||
                {
 | 
			
		||||
                    SetProperty(ref _selectedDrug, new());
 | 
			
		||||
                    Manunos = null;
 | 
			
		||||
                    SelectedDrug.drugBase = new();
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
            }
 | 
			
		||||
| 
						 | 
				
			
			@ -182,26 +197,117 @@ namespace DM_Weight.ViewModels
 | 
			
		|||
                try
 | 
			
		||||
                {
 | 
			
		||||
 | 
			
		||||
                    //SelectedDrug.DrugId = 0;
 | 
			
		||||
 | 
			
		||||
                    //查询最大药品id并+1赋值给新增药品
 | 
			
		||||
                    string maxDrugId = SqlSugarHelper.Db.Queryable<DrugInfo>().Max(it => it.DrugId);
 | 
			
		||||
                    SelectedDrug.DrugId = maxDrugId + 1;
 | 
			
		||||
                    var f = SqlSugarHelper.Db.UseTran(() =>
 | 
			
		||||
                    {
 | 
			
		||||
                        SqlSugarHelper.Db.Insertable(SelectedDrug).ExecuteCommand();
 | 
			
		||||
 | 
			
		||||
                        SqlSugarHelper.Db.Insertable(new DrugBase()
 | 
			
		||||
                        {
 | 
			
		||||
                            DrugId = SelectedDrug.DrugId.ToString(),
 | 
			
		||||
                            MachineId = ConfigurationManager.AppSettings["machineId"] ?? "DM1",
 | 
			
		||||
                            BaseQuantity = SelectedDrug.drugBase.BaseQuantity
 | 
			
		||||
                        }).ExecuteCommand();
 | 
			
		||||
 | 
			
		||||
                    });
 | 
			
		||||
                    if (f.IsSuccess)
 | 
			
		||||
                    {
 | 
			
		||||
                        AlertMsg alertMsg = new AlertMsg
 | 
			
		||||
                        {
 | 
			
		||||
                            Message = "新增成功",
 | 
			
		||||
                            Type = MsgType.ERROR,
 | 
			
		||||
                        };
 | 
			
		||||
                        _eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
 | 
			
		||||
                    }
 | 
			
		||||
                    else
 | 
			
		||||
                    {
 | 
			
		||||
                        AlertMsg alertMsg = new AlertMsg
 | 
			
		||||
                        {
 | 
			
		||||
                            Message = "新增失败",
 | 
			
		||||
                            Type = MsgType.INFO,
 | 
			
		||||
                        };
 | 
			
		||||
                        _eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
 | 
			
		||||
                    }
 | 
			
		||||
                    RequestData();
 | 
			
		||||
                }
 | 
			
		||||
                catch (Exception ex)
 | 
			
		||||
                {
 | 
			
		||||
                    ILog logger = LogManager.GetLogger(typeof(DrugListWindowViewModel));
 | 
			
		||||
                    logger.Info($"添加数据异常:{ex.ToString()}");
 | 
			
		||||
 | 
			
		||||
                    AlertMsg alertMsg = new AlertMsg
 | 
			
		||||
                    {
 | 
			
		||||
                        Message = $"添加数据异常:{ex.ToString()}",
 | 
			
		||||
                        Type = MsgType.ERROR,
 | 
			
		||||
                    };
 | 
			
		||||
                    _eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
 | 
			
		||||
                    return;
 | 
			
		||||
                }
 | 
			
		||||
            });
 | 
			
		||||
            }, () => SelectedDrug.DrugId ==null).ObservesProperty(() => SelectedDrug);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public DelegateCommand EditDrugCommand
 | 
			
		||||
        {
 | 
			
		||||
            get => new DelegateCommand(() =>
 | 
			
		||||
            {
 | 
			
		||||
                var f = SqlSugarHelper.Db.UseTran(() =>
 | 
			
		||||
                {
 | 
			
		||||
                    SqlSugarHelper.Db.Updateable(SelectedDrug).UpdateColumns(d => new { d.DrugName, d.Manufactory, d.PyCode, d.PackUnit, d.MaxStock, d.DrugSpec }).ExecuteCommand();
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
                    if (SelectedDrug.drugBase == null)
 | 
			
		||||
                    {
 | 
			
		||||
                        SqlSugarHelper.Db.Insertable(new DrugBase()
 | 
			
		||||
                        {
 | 
			
		||||
                            DrugId = SelectedDrug.DrugId.ToString(),
 | 
			
		||||
                            MachineId = ConfigurationManager.AppSettings["machineId"] ?? "DM1",
 | 
			
		||||
                            BaseQuantity = SelectedDrug.drugBase.BaseQuantity
 | 
			
		||||
                        }).ExecuteCommand();
 | 
			
		||||
                    }
 | 
			
		||||
                    else
 | 
			
		||||
                    {
 | 
			
		||||
                        //查询药品基数是否存在,存在则修改不存在则新增
 | 
			
		||||
                        DrugBase drugBase = SqlSugarHelper.Db.Queryable<DrugBase>()
 | 
			
		||||
                                       .Where(db => db.BaseId == SelectedDrug.drugBase.BaseId).First();
 | 
			
		||||
                        if (drugBase == null)
 | 
			
		||||
                        {
 | 
			
		||||
                            SqlSugarHelper.Db.Insertable(new DrugBase()
 | 
			
		||||
                            {
 | 
			
		||||
                                DrugId = SelectedDrug.DrugId.ToString(),
 | 
			
		||||
                                MachineId = ConfigurationManager.AppSettings["machineId"]??"DM1",
 | 
			
		||||
                                BaseQuantity = SelectedDrug.drugBase.BaseQuantity
 | 
			
		||||
                            }).ExecuteCommand();
 | 
			
		||||
                        }
 | 
			
		||||
                        else
 | 
			
		||||
                        {
 | 
			
		||||
                            drugBase.BaseQuantity = SelectedDrug.drugBase.BaseQuantity;
 | 
			
		||||
                            SqlSugarHelper.Db.Updateable(drugBase).UpdateColumns(bs => new { bs.BaseQuantity }).Where(bs => bs.BaseId == SelectedDrug.drugBase.BaseId).ExecuteCommand();
 | 
			
		||||
                        }
 | 
			
		||||
                    }
 | 
			
		||||
                });
 | 
			
		||||
                if (f.IsSuccess)
 | 
			
		||||
                {
 | 
			
		||||
                    AlertMsg alertMsg = new AlertMsg
 | 
			
		||||
                    {
 | 
			
		||||
                        Message = "修改完成",
 | 
			
		||||
                        Type = MsgType.INFO,
 | 
			
		||||
                    };
 | 
			
		||||
                    _eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
 | 
			
		||||
                }
 | 
			
		||||
                else
 | 
			
		||||
                {
 | 
			
		||||
                    AlertMsg alertMsg = new AlertMsg
 | 
			
		||||
                    {
 | 
			
		||||
                        Message = "修改失败!",
 | 
			
		||||
                        Type = MsgType.ERROR,
 | 
			
		||||
                    };
 | 
			
		||||
                    _eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
 | 
			
		||||
                }
 | 
			
		||||
                RequestData();
 | 
			
		||||
            }, () => SelectedDrug.DrugId > 0).ObservesProperty(() => SelectedDrug);
 | 
			
		||||
            }, () => SelectedDrug.DrugId!=null).ObservesProperty(() => SelectedDrug);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public DelegateCommand AddManuCommand
 | 
			
		||||
| 
						 | 
				
			
			@ -217,7 +323,7 @@ namespace DM_Weight.ViewModels
 | 
			
		|||
                    GetManuNos();
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
            }, () => SelectedDrug.DrugId > 0).ObservesProperty(() => SelectedDrug);
 | 
			
		||||
            }, () => SelectedDrug.DrugId != null).ObservesProperty(() => SelectedDrug);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public DelegateCommand EditManuCommand
 | 
			
		||||
| 
						 | 
				
			
			@ -257,13 +363,22 @@ namespace DM_Weight.ViewModels
 | 
			
		|||
        {
 | 
			
		||||
            int totalCount = 0;
 | 
			
		||||
            DrugInfos = SqlSugarHelper.Db.Queryable<DrugInfo>()
 | 
			
		||||
                .Includes(di => di.drugBase)
 | 
			
		||||
                .WhereIF(!String.IsNullOrEmpty(SearchValue) && SelectedItem.Code.Equals("DrugId"), (di) => di.DrugId.ToString().Contains(SearchValue))
 | 
			
		||||
                .WhereIF(!String.IsNullOrEmpty(SearchValue) && SelectedItem.Code.Equals("DrugName"), (di) => di.DrugName.Contains(SearchValue))
 | 
			
		||||
                .WhereIF(!String.IsNullOrEmpty(SearchValue) && SelectedItem.Code.Equals("PyCode"), (di) => di.PyCode.Contains(SearchValue))
 | 
			
		||||
                .WhereIF(!String.IsNullOrEmpty(SearchValue) && SelectedItem.Code.Equals("DrugBarcode"), (di) => di.DrugBarcode.Contains(SearchValue))
 | 
			
		||||
                .Select(di => di)
 | 
			
		||||
                .ToPageList(PageNum, PageSize, ref totalCount)
 | 
			
		||||
            ;
 | 
			
		||||
                //.Select(di => di)
 | 
			
		||||
                .ToPageList(PageNum, PageSize, ref totalCount);
 | 
			
		||||
            foreach(DrugInfo di in DrugInfos)
 | 
			
		||||
            {
 | 
			
		||||
 | 
			
		||||
                if(di.drugBase==null)
 | 
			
		||||
                {
 | 
			
		||||
                    di.drugBase = new DrugBase();
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            TotalCount = totalCount;
 | 
			
		||||
            PageCount = (int)Math.Ceiling((double)TotalCount / PageSize);
 | 
			
		||||
        }
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -0,0 +1,109 @@
 | 
			
		|||
using DM_Weight.Models;
 | 
			
		||||
using DM_Weight.msg;
 | 
			
		||||
using DM_Weight.Port;
 | 
			
		||||
using DM_Weight.util;
 | 
			
		||||
using log4net;
 | 
			
		||||
using Prism.Commands;
 | 
			
		||||
using Prism.Events;
 | 
			
		||||
using Prism.Mvvm;
 | 
			
		||||
using Prism.Regions;
 | 
			
		||||
using System;
 | 
			
		||||
using System.Collections;
 | 
			
		||||
using System.Collections.Generic;
 | 
			
		||||
using System.Diagnostics;
 | 
			
		||||
using System.Linq;
 | 
			
		||||
using System.Text;
 | 
			
		||||
using System.Threading.Tasks;
 | 
			
		||||
using System.Windows.Threading;
 | 
			
		||||
 | 
			
		||||
namespace DM_Weight.ViewModels
 | 
			
		||||
{
 | 
			
		||||
    public class EmergencyWindowViewModel : BindableBase, IRegionMemberLifetime, INavigationAware
 | 
			
		||||
    {
 | 
			
		||||
        private readonly ILog logger = LogManager.GetLogger(typeof(HomeWindowViewModel));
 | 
			
		||||
        IEventAggregator _eventAggregator;
 | 
			
		||||
        private PortUtil _portUtil;
 | 
			
		||||
        IRegionManager _regionManager;
 | 
			
		||||
        private bool _dbConnectionFail = !App.DbConnectionFail;
 | 
			
		||||
        public bool DBConnectionStatus { get => _dbConnectionFail; set => SetProperty(ref _dbConnectionFail, value); }
 | 
			
		||||
        private int _status;
 | 
			
		||||
 | 
			
		||||
        public int Status { get => _status; set => SetProperty(ref _status, value); }
 | 
			
		||||
        public EmergencyWindowViewModel(IRegionManager regionManager, PortUtil portUtil, IEventAggregator eventAggregator)
 | 
			
		||||
        {
 | 
			
		||||
            _portUtil = portUtil;
 | 
			
		||||
            _eventAggregator = eventAggregator;
 | 
			
		||||
            _regionManager = regionManager;
 | 
			
		||||
        }
 | 
			
		||||
        public DelegateCommand<string> OpenDrawer
 | 
			
		||||
        {
 | 
			
		||||
            get => new DelegateCommand<string>((DrawerNo) =>
 | 
			
		||||
            {
 | 
			
		||||
                //应急开锁
 | 
			
		||||
                logger.Info($"应急开锁正在打开{DrawerNo}号抽屉");
 | 
			
		||||
                Status = 1;
 | 
			
		||||
                _portUtil.SpeakAsync("正在打开" + DrawerNo + "号抽屉");
 | 
			
		||||
                _portUtil.WindowName = "EmergencyWindow";
 | 
			
		||||
                _portUtil.BoardType = 1;
 | 
			
		||||
                _portUtil.ColNos = new int[] { 1 };
 | 
			
		||||
                _portUtil.DrawerNo = Convert.ToInt32(DrawerNo);
 | 
			
		||||
                Dispatcher.CurrentDispatcher.BeginInvoke(DispatcherPriority.Normal, () => _portUtil.OpenDrawer());
 | 
			
		||||
 | 
			
		||||
            }
 | 
			
		||||
            );
 | 
			
		||||
        }
 | 
			
		||||
        public DelegateCommand ReturnLoginDelegate
 | 
			
		||||
        {
 | 
			
		||||
            get => new DelegateCommand(() =>
 | 
			
		||||
            {
 | 
			
		||||
                _regionManager.RequestNavigate("MainRegion", "LoginWindow");
 | 
			
		||||
            });
 | 
			
		||||
        }
 | 
			
		||||
        private DelegateCommand? _exitCommand;
 | 
			
		||||
        public DelegateCommand ExitCommand => _exitCommand ??= new DelegateCommand(Exit);
 | 
			
		||||
 | 
			
		||||
        public bool KeepAlive => false;
 | 
			
		||||
 | 
			
		||||
        void Exit()
 | 
			
		||||
        {
 | 
			
		||||
            Process.GetCurrentProcess().Kill();
 | 
			
		||||
            Environment.Exit(0);
 | 
			
		||||
        }
 | 
			
		||||
        //间隔1分钟查询数据库连接状态
 | 
			
		||||
        private void CheckDBConnect()
 | 
			
		||||
        {
 | 
			
		||||
            new PromiseUtil<int>().taskAsyncLoop(60000, 0, async (options, next, stop) =>
 | 
			
		||||
            {
 | 
			
		||||
                try
 | 
			
		||||
                {
 | 
			
		||||
                    var userList = SqlSugarHelper.Db.Queryable<UserList>()
 | 
			
		||||
                                        .First(u => u.UserName == "admin");
 | 
			
		||||
                    App.DbConnectionFail = false;
 | 
			
		||||
                    DBConnectionStatus = true;
 | 
			
		||||
                    stop();
 | 
			
		||||
                }
 | 
			
		||||
                catch (Exception ex)
 | 
			
		||||
                {
 | 
			
		||||
                    next();
 | 
			
		||||
                }
 | 
			
		||||
            });
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
        public void OnNavigatedTo(NavigationContext navigationContext)
 | 
			
		||||
        {
 | 
			
		||||
            DBConnectionStatus = !App.DbConnectionFail;
 | 
			
		||||
            CheckDBConnect();
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public bool IsNavigationTarget(NavigationContext navigationContext)
 | 
			
		||||
        {
 | 
			
		||||
            return true;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public void OnNavigatedFrom(NavigationContext navigationContext)
 | 
			
		||||
        {
 | 
			
		||||
           
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,263 @@
 | 
			
		|||
using DM_Weight.Common;
 | 
			
		||||
using DM_Weight.msg;
 | 
			
		||||
using DM_Weight.Port;
 | 
			
		||||
using DM_Weight.util;
 | 
			
		||||
using Prism.Commands;
 | 
			
		||||
using Prism.Events;
 | 
			
		||||
using Prism.Mvvm;
 | 
			
		||||
using Prism.Regions;
 | 
			
		||||
using System;
 | 
			
		||||
using System.Collections.Generic;
 | 
			
		||||
using System.Configuration;
 | 
			
		||||
using System.Linq;
 | 
			
		||||
using System.Text;
 | 
			
		||||
using System.Threading;
 | 
			
		||||
using System.Threading.Tasks;
 | 
			
		||||
using System.Windows;
 | 
			
		||||
using System.Xml;
 | 
			
		||||
 | 
			
		||||
namespace DM_Weight.ViewModels
 | 
			
		||||
{
 | 
			
		||||
    public class FridgeWindowViewModel : BindableBase, IRegionMemberLifetime, INavigationAware
 | 
			
		||||
    {
 | 
			
		||||
        //温度区间
 | 
			
		||||
        private string _temperatureRange = CommonClass.ReadAppSetting("temperatureRange").ToString();
 | 
			
		||||
        public string TemperatureRange
 | 
			
		||||
        {
 | 
			
		||||
            get => _temperatureRange;
 | 
			
		||||
            set
 | 
			
		||||
            {
 | 
			
		||||
                SetProperty(ref _temperatureRange, value);
 | 
			
		||||
                //更新配置文件中冰箱温度区间
 | 
			
		||||
                CommonClass.SaveAppSetting("temperatureRange", _temperatureRange);
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        private float defaultValue = Convert.ToSingle(CommonClass.ReadAppSetting("temperatureValue"));
 | 
			
		||||
        //温度值
 | 
			
		||||
        private float _temperatureValue = Convert.ToSingle(CommonClass.ReadAppSetting("temperatureValue"));
 | 
			
		||||
        public float TemperatureValue
 | 
			
		||||
        {
 | 
			
		||||
            get => _temperatureValue;
 | 
			
		||||
            set => SetProperty(ref _temperatureValue, value);
 | 
			
		||||
        }
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// 根据冰箱温度控制保存按钮是否可点击
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        private bool _isInvalid;
 | 
			
		||||
        public bool IsInvalid
 | 
			
		||||
        {
 | 
			
		||||
            get => _isInvalid;
 | 
			
		||||
            set
 | 
			
		||||
            {
 | 
			
		||||
                SetProperty(ref _isInvalid, value);
 | 
			
		||||
                BtnIsEnable = !IsInvalid;
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// 根据冰箱温度控制保存按钮是否可用
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        private bool _btnIsEnable = true;
 | 
			
		||||
        public bool BtnIsEnable
 | 
			
		||||
        {
 | 
			
		||||
            get => _btnIsEnable;
 | 
			
		||||
            set => SetProperty(ref _btnIsEnable, value);
 | 
			
		||||
        }
 | 
			
		||||
        //冰箱状态:true关;false开
 | 
			
		||||
        private bool _fridgeState;
 | 
			
		||||
        public bool FridgeState
 | 
			
		||||
        {
 | 
			
		||||
            get => _fridgeState;
 | 
			
		||||
            set => SetProperty(ref _fridgeState, value);
 | 
			
		||||
        }
 | 
			
		||||
        //报警状态:true关;false开
 | 
			
		||||
        private bool _alarmState;
 | 
			
		||||
        public bool AlarmState
 | 
			
		||||
        {
 | 
			
		||||
            get => _alarmState;
 | 
			
		||||
            set => SetProperty(ref _alarmState, value);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        private int _defaultLoginMode;//1开0关
 | 
			
		||||
 | 
			
		||||
        private int _defaultAlarmMode;//1开0关
 | 
			
		||||
 | 
			
		||||
        private float retTemperature = Convert.ToSingle(ConfigurationManager.AppSettings["temperatureValue"]);
 | 
			
		||||
 | 
			
		||||
        private PortUtil _portUtil;
 | 
			
		||||
        IEventAggregator _eventAggregator;
 | 
			
		||||
        public FridgeWindowViewModel(PortUtil portUtil, IEventAggregator eventAggregator)
 | 
			
		||||
        {
 | 
			
		||||
            _portUtil = portUtil;
 | 
			
		||||
            _eventAggregator = eventAggregator;
 | 
			
		||||
        }
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// 保存按钮
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        public DelegateCommand SaveCommand { get => new DelegateCommand(SaveAction, () => !IsInvalid); }
 | 
			
		||||
 | 
			
		||||
        public bool KeepAlive => false;
 | 
			
		||||
 | 
			
		||||
        private async void SaveAction()
 | 
			
		||||
        {
 | 
			
		||||
            try
 | 
			
		||||
            {
 | 
			
		||||
                _portUtil.FridgeOperate = true;
 | 
			
		||||
 | 
			
		||||
                //设置温度值验证不通过则直接返回不保存
 | 
			
		||||
                //获取冰箱温度
 | 
			
		||||
                //if (_fridgeState != _defaultLoginMode.Equals(1))
 | 
			
		||||
                //{
 | 
			
		||||
                //    ConfigurationManager.RefreshSection("FridgeState");
 | 
			
		||||
                //发送冰箱使能/失能指令
 | 
			
		||||
                if (_fridgeState)
 | 
			
		||||
                {
 | 
			
		||||
                    await _portUtil.FridgeOff();
 | 
			
		||||
                    Thread.Sleep(100);
 | 
			
		||||
                    CommonClass.SaveAppSetting("FridgeState", "0");
 | 
			
		||||
                }
 | 
			
		||||
                else
 | 
			
		||||
                {
 | 
			
		||||
                    await _portUtil.FridegOpen();
 | 
			
		||||
                    Thread.Sleep(100);
 | 
			
		||||
                    CommonClass.SaveAppSetting("FridgeState", "1");
 | 
			
		||||
                }
 | 
			
		||||
                //}
 | 
			
		||||
                //温度报警设定
 | 
			
		||||
                //if (AlarmState != _defaultAlarmMode.Equals(1))
 | 
			
		||||
                //{
 | 
			
		||||
                //发送警报使能/失能指令
 | 
			
		||||
                if (_alarmState)
 | 
			
		||||
                {
 | 
			
		||||
                    await _portUtil.FridgeAlarmOff();
 | 
			
		||||
                    Thread.Sleep(100);
 | 
			
		||||
                    CommonClass.SaveAppSetting("AlarmState", "0");
 | 
			
		||||
                }
 | 
			
		||||
                else
 | 
			
		||||
                {
 | 
			
		||||
                    await _portUtil.FridgeAlarmOn();
 | 
			
		||||
                    Thread.Sleep(100);
 | 
			
		||||
                    CommonClass.SaveAppSetting("AlarmState", "1");
 | 
			
		||||
                }
 | 
			
		||||
                //}
 | 
			
		||||
 | 
			
		||||
                //if (retTemperature != TemperatureValue)
 | 
			
		||||
                //{
 | 
			
		||||
                //    //设定冰箱温度
 | 
			
		||||
                //    await _portUtil.SetFridgeTemperature(TemperatureValue);
 | 
			
		||||
 | 
			
		||||
                //    CommonClass.SaveAppSetting("temperatureValue", TemperatureValue.ToString());
 | 
			
		||||
                //}
 | 
			
		||||
                //设定冰箱温度区间
 | 
			
		||||
                string[] range = ConfigurationManager.AppSettings["temperatureRange"].Split('-');
 | 
			
		||||
                string[] newRange = TemperatureRange.Split('-');
 | 
			
		||||
                if (range.Length >= 2)
 | 
			
		||||
                {
 | 
			
		||||
                    bool bMix = float.TryParse(range[0], out float Min);
 | 
			
		||||
                    bool bMax = float.TryParse(range[1], out float Max);
 | 
			
		||||
 | 
			
		||||
                    if (bMix && bMax)
 | 
			
		||||
                    {
 | 
			
		||||
                        if (Min != Convert.ToSingle(newRange[0]))
 | 
			
		||||
                        {
 | 
			
		||||
                            //设定冰箱温度最小值
 | 
			
		||||
                            await _portUtil.FridgeMinSetting(Convert.ToSingle(newRange[0]));
 | 
			
		||||
                            Thread.Sleep(100);
 | 
			
		||||
                        }
 | 
			
		||||
                        if (Max != Convert.ToSingle(newRange[1]))
 | 
			
		||||
                        {
 | 
			
		||||
                            Thread.Sleep(100);
 | 
			
		||||
                            //设定冰箱温度最有值
 | 
			
		||||
                            await _portUtil.FridgeMaxSetting(Convert.ToSingle(newRange[1]));
 | 
			
		||||
                            Thread.Sleep(100);
 | 
			
		||||
                        }
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
                _portUtil.FridgeOperate = false;
 | 
			
		||||
                AlertMsg alertMsg = new AlertMsg
 | 
			
		||||
                {
 | 
			
		||||
                    Message = $"保存成功",
 | 
			
		||||
                    Type = MsgType.SUCCESS
 | 
			
		||||
                };
 | 
			
		||||
                _eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
 | 
			
		||||
 | 
			
		||||
                //_fridgeState = ReadAppSetting("FridgeState").Equals(1);
 | 
			
		||||
                //_defaultLoginMode = ReadAppSetting("FridgeState");
 | 
			
		||||
                //_defaultAlarmMode = ReadAppSetting("AlarmState");
 | 
			
		||||
                //_alarmState = ReadAppSetting("AlarmState").Equals(1);
 | 
			
		||||
                //_temperatureRange = CommonClass.ReadAppSetting("temperatureRange");
 | 
			
		||||
                //_temperatureValue = Convert.ToSingle(CommonClass.ReadAppSetting("temperatureValue"));
 | 
			
		||||
            }
 | 
			
		||||
            catch (Exception ex)
 | 
			
		||||
            {
 | 
			
		||||
 | 
			
		||||
                AlertMsg alertMsg = new AlertMsg
 | 
			
		||||
                {
 | 
			
		||||
                    Message = $"保存异常{ex.ToString}",
 | 
			
		||||
                    Type = MsgType.ERROR
 | 
			
		||||
                };
 | 
			
		||||
                _eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
 | 
			
		||||
                _portUtil.FridgeOperate = false;
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        public FridgeWindowViewModel()
 | 
			
		||||
        {
 | 
			
		||||
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        //手动实现调用配置的逻辑 规避修改配置文件后不起作用的问题
 | 
			
		||||
        public int 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 Convert.ToInt32(node.Attributes["value"].Value);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public void ConfirmNavigationRequest(NavigationContext navigationContext, Action<bool> continuationCallback)
 | 
			
		||||
        {
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public void OnNavigatedTo(NavigationContext navigationContext)
 | 
			
		||||
        {
 | 
			
		||||
            _fridgeState = ReadAppSetting("FridgeState").Equals(0);
 | 
			
		||||
            _defaultLoginMode = ReadAppSetting("FridgeState");
 | 
			
		||||
            _defaultAlarmMode = ReadAppSetting("AlarmState");
 | 
			
		||||
            _alarmState = ReadAppSetting("AlarmState").Equals(0);
 | 
			
		||||
 | 
			
		||||
            GetTemperature();
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public bool IsNavigationTarget(NavigationContext navigationContext)
 | 
			
		||||
        {
 | 
			
		||||
            return true;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public void OnNavigatedFrom(NavigationContext navigationContext)
 | 
			
		||||
        {
 | 
			
		||||
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        //public void OnNavigatedTo(NavigationContext navigationContext)
 | 
			
		||||
        //{
 | 
			
		||||
        //    GetTemperature();
 | 
			
		||||
        //}
 | 
			
		||||
 | 
			
		||||
        //public bool IsNavigationTarget(NavigationContext navigationContext)
 | 
			
		||||
        //{
 | 
			
		||||
        //    return true;
 | 
			
		||||
        //}
 | 
			
		||||
 | 
			
		||||
        //public void OnNavigatedFrom(NavigationContext navigationContext)
 | 
			
		||||
        //{
 | 
			
		||||
        //}
 | 
			
		||||
        //获取冰箱温度值,如有更改则保存更改
 | 
			
		||||
        private async Task GetTemperature()
 | 
			
		||||
        {
 | 
			
		||||
 | 
			
		||||
            //float retT = await _portUtil.GetFridgeTemperature();
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -23,6 +23,9 @@ 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;
 | 
			
		||||
 | 
			
		||||
namespace DM_Weight.ViewModels
 | 
			
		||||
{
 | 
			
		||||
| 
						 | 
				
			
			@ -34,12 +37,36 @@ namespace DM_Weight.ViewModels
 | 
			
		|||
        private UserList? _userList;
 | 
			
		||||
        private UserList? _userList2;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// 冰箱温度
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        private string _wd = "恒温冷藏抽屉当前温度2.8(非真实数据)";
 | 
			
		||||
        public string WD { get => _wd; set => SetProperty(ref _wd, value); }
 | 
			
		||||
        System.Timers.Timer WDTimer;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
        private int loginMode = Convert.ToInt32(ConfigurationManager.AppSettings["loginMode"]?.ToString() ?? "1");
 | 
			
		||||
        public bool MultiLogin
 | 
			
		||||
        {
 | 
			
		||||
            get => loginMode == 2;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        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 PremissionDm? _selectedMenu;
 | 
			
		||||
 | 
			
		||||
        private PremissionDm? _selectedChildMenu;
 | 
			
		||||
| 
						 | 
				
			
			@ -51,76 +78,76 @@ namespace DM_Weight.ViewModels
 | 
			
		|||
            get { return _selectedChildMenu; }
 | 
			
		||||
            set
 | 
			
		||||
            {
 | 
			
		||||
                if (!_portUtil.Operate)
 | 
			
		||||
                {
 | 
			
		||||
                    if (value != null)
 | 
			
		||||
                    {
 | 
			
		||||
                        if (value.PremissionPath.Equals("TakeRecordWindow"))
 | 
			
		||||
                        {
 | 
			
		||||
                            //定义传参变量
 | 
			
		||||
                            NavigationParameters keys = new NavigationParameters();
 | 
			
		||||
                //if (!_portUtil.Operate)
 | 
			
		||||
                //{
 | 
			
		||||
                //    if (value != null)
 | 
			
		||||
                //    {
 | 
			
		||||
                //        if (value.PremissionPath.Equals("TakeRecordWindow"))
 | 
			
		||||
                //        {
 | 
			
		||||
                //            //定义传参变量
 | 
			
		||||
                //            NavigationParameters keys = new NavigationParameters();
 | 
			
		||||
 | 
			
		||||
                            //添加参数,键值对格式
 | 
			
		||||
                            keys.Add("Type", 2);
 | 
			
		||||
                            _regionManager.RequestNavigate("ContentRegion", "MachineRecordWindow", keys);
 | 
			
		||||
                        }
 | 
			
		||||
                        else if (value.PremissionPath.Equals("AddRecordWindow"))
 | 
			
		||||
                        {
 | 
			
		||||
                            //定义传参变量
 | 
			
		||||
                            NavigationParameters keys = new NavigationParameters();
 | 
			
		||||
                //            //添加参数,键值对格式
 | 
			
		||||
                //            keys.Add("Type", 2);
 | 
			
		||||
                //            _regionManager.RequestNavigate("ContentRegion", "MachineRecordWindow", keys);
 | 
			
		||||
                //        }
 | 
			
		||||
                //        else if (value.PremissionPath.Equals("AddRecordWindow"))
 | 
			
		||||
                //        {
 | 
			
		||||
                //            //定义传参变量
 | 
			
		||||
                //            NavigationParameters keys = new NavigationParameters();
 | 
			
		||||
 | 
			
		||||
                            //添加参数,键值对格式
 | 
			
		||||
                            keys.Add("Type", 1);
 | 
			
		||||
                            _regionManager.RequestNavigate("ContentRegion", "MachineRecordWindow", keys);
 | 
			
		||||
                        }
 | 
			
		||||
                        else if (value.PremissionPath.Equals("ReturnRecordWindow"))
 | 
			
		||||
                        {
 | 
			
		||||
                            //定义传参变量
 | 
			
		||||
                            NavigationParameters keys = new NavigationParameters();
 | 
			
		||||
                //            //添加参数,键值对格式
 | 
			
		||||
                //            keys.Add("Type", 1);
 | 
			
		||||
                //            _regionManager.RequestNavigate("ContentRegion", "MachineRecordWindow", keys);
 | 
			
		||||
                //        }
 | 
			
		||||
                //        else if (value.PremissionPath.Equals("ReturnRecordWindow"))
 | 
			
		||||
                //        {
 | 
			
		||||
                //            //定义传参变量
 | 
			
		||||
                //            NavigationParameters keys = new NavigationParameters();
 | 
			
		||||
 | 
			
		||||
                            //添加参数,键值对格式
 | 
			
		||||
                            keys.Add("Type", 3);
 | 
			
		||||
                            _regionManager.RequestNavigate("ContentRegion", "MachineRecordWindow", keys);
 | 
			
		||||
                        }
 | 
			
		||||
                        else if (value.PremissionPath.Equals("RetrunEmptyRecordWindow"))
 | 
			
		||||
                        {
 | 
			
		||||
                            //定义传参变量
 | 
			
		||||
                            NavigationParameters keys = new NavigationParameters();
 | 
			
		||||
                //            //添加参数,键值对格式
 | 
			
		||||
                //            keys.Add("Type", 3);
 | 
			
		||||
                //            _regionManager.RequestNavigate("ContentRegion", "MachineRecordWindow", keys);
 | 
			
		||||
                //        }
 | 
			
		||||
                //        else if (value.PremissionPath.Equals("RetrunEmptyRecordWindow"))
 | 
			
		||||
                //        {
 | 
			
		||||
                //            //定义传参变量
 | 
			
		||||
                //            NavigationParameters keys = new NavigationParameters();
 | 
			
		||||
 | 
			
		||||
                            //添加参数,键值对格式
 | 
			
		||||
                            keys.Add("Type", 3);
 | 
			
		||||
                            _regionManager.RequestNavigate("ContentRegion", value.PremissionPath, keys);
 | 
			
		||||
                        }
 | 
			
		||||
                        else if (value.PremissionPath.Equals("CheckRecordWindow"))
 | 
			
		||||
                        {
 | 
			
		||||
                            //定义传参变量
 | 
			
		||||
                            NavigationParameters keys = new NavigationParameters();
 | 
			
		||||
                //            //添加参数,键值对格式
 | 
			
		||||
                //            keys.Add("Type", 3);
 | 
			
		||||
                //            _regionManager.RequestNavigate("ContentRegion", value.PremissionPath, keys);
 | 
			
		||||
                //        }
 | 
			
		||||
                //        else if (value.PremissionPath.Equals("CheckRecordWindow"))
 | 
			
		||||
                //        {
 | 
			
		||||
                //            //定义传参变量
 | 
			
		||||
                //            NavigationParameters keys = new NavigationParameters();
 | 
			
		||||
 | 
			
		||||
                            //添加参数,键值对格式
 | 
			
		||||
                            keys.Add("Type", 4);
 | 
			
		||||
                            _regionManager.RequestNavigate("ContentRegion", "MachineRecordWindow", keys);
 | 
			
		||||
                        }
 | 
			
		||||
                        else
 | 
			
		||||
                        {
 | 
			
		||||
                            if (value.PremissionPath.Equals("ReturnDrugWindow") || value.PremissionPath.Equals("ReturnDrugWindow2"))
 | 
			
		||||
                            {
 | 
			
		||||
                                if (ConfigurationManager.AppSettings["returnDrugMode"].ToString().Equals("1"))
 | 
			
		||||
                                {
 | 
			
		||||
                                    _regionManager.RequestNavigate("ContentRegion", "ReturnDrugWindow2");
 | 
			
		||||
                                }
 | 
			
		||||
                                else
 | 
			
		||||
                                {
 | 
			
		||||
                                    _regionManager.RequestNavigate("ContentRegion", "ReturnDrugWindow");
 | 
			
		||||
                                }
 | 
			
		||||
                            }
 | 
			
		||||
                            else
 | 
			
		||||
                            {
 | 
			
		||||
                                _regionManager.RequestNavigate("ContentRegion", value.PremissionPath);
 | 
			
		||||
                            }
 | 
			
		||||
                        }
 | 
			
		||||
                    }
 | 
			
		||||
                //            //添加参数,键值对格式
 | 
			
		||||
                //            keys.Add("Type", 4);
 | 
			
		||||
                //            _regionManager.RequestNavigate("ContentRegion", "MachineRecordWindow", keys);
 | 
			
		||||
                //        }
 | 
			
		||||
                //        else
 | 
			
		||||
                //        {
 | 
			
		||||
                //            if (value.PremissionPath.Equals("ReturnDrugWindow") || value.PremissionPath.Equals("ReturnDrugWindow2"))
 | 
			
		||||
                //            {
 | 
			
		||||
                //                if (ConfigurationManager.AppSettings["returnDrugMode"].ToString().Equals("1"))
 | 
			
		||||
                //                {
 | 
			
		||||
                //                    _regionManager.RequestNavigate("ContentRegion", "ReturnDrugWindow2");
 | 
			
		||||
                //                }
 | 
			
		||||
                //                else
 | 
			
		||||
                //                {
 | 
			
		||||
                //                    _regionManager.RequestNavigate("ContentRegion", "ReturnDrugWindow");
 | 
			
		||||
                //                }
 | 
			
		||||
                //            }
 | 
			
		||||
                //            else
 | 
			
		||||
                //            {
 | 
			
		||||
                //                _regionManager.RequestNavigate("ContentRegion", value.PremissionPath);
 | 
			
		||||
                //            }
 | 
			
		||||
                //        }
 | 
			
		||||
                //    }
 | 
			
		||||
                    SetProperty(ref _selectedChildMenu, value);
 | 
			
		||||
                }
 | 
			
		||||
                //}
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -143,22 +170,54 @@ namespace DM_Weight.ViewModels
 | 
			
		|||
                //        SelectedChildMenu = value.Children[0];
 | 
			
		||||
                //    }
 | 
			
		||||
                //}
 | 
			
		||||
                if (!_portUtil.Operate)
 | 
			
		||||
                {
 | 
			
		||||
                    SetProperty(ref _selectedMenu, value);
 | 
			
		||||
                }
 | 
			
		||||
                else
 | 
			
		||||
                {
 | 
			
		||||
                    logger.Info($"未关闭抽屉切换菜单");
 | 
			
		||||
                    SnackbarBackground = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#b71c1c"));
 | 
			
		||||
                    SnackbarMessageQueue.Enqueue("请关闭抽屉后再切换菜单");
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        private DelegateCommand<ListBox> _selectionCommon;
 | 
			
		||||
        public DelegateCommand<ListBox> SelectionCommon
 | 
			
		||||
        private DelegateCommand _selectionCommon;
 | 
			
		||||
        public DelegateCommand SelectionCommon
 | 
			
		||||
        {
 | 
			
		||||
            get => _selectionCommon ?? (_selectionCommon = new DelegateCommand<ListBox>(SelectionMethod));
 | 
			
		||||
            //get => _selectionCommon ?? (_selectionCommon = new DelegateCommand<ListBox>(SelectionMethod));
 | 
			
		||||
            get => _selectionCommon ?? (_selectionCommon = new DelegateCommand(SelectionMethod));
 | 
			
		||||
        }
 | 
			
		||||
        private void SelectionMethod(ListBox viewName)
 | 
			
		||||
        private void SelectionMethod()
 | 
			
		||||
        {
 | 
			
		||||
            SelectedMenu = viewName.SelectedItem as PremissionDm;
 | 
			
		||||
            if (SelectedMenu.PremissionName == "退出")
 | 
			
		||||
            //SelectedMenu = viewName.SelectedItem as PremissionDm;
 | 
			
		||||
            //if (SelectedMenu.PremissionName == "退出")
 | 
			
		||||
            //{
 | 
			
		||||
            //    if (!_portUtil.Operate)
 | 
			
		||||
            //    {
 | 
			
		||||
            //        _chkFunction.HIKStopDVRRecord();
 | 
			
		||||
            //        logger.Info($"用户【{Operator?.Nickname}】退出登录");
 | 
			
		||||
            //        Operator = null;
 | 
			
		||||
            //        Reviewer = null;
 | 
			
		||||
            //        _regionManager.RequestNavigate("MainRegion", "LoginWindow");
 | 
			
		||||
            //    }
 | 
			
		||||
            //    else
 | 
			
		||||
            //    {
 | 
			
		||||
            //        logger.Info($"未关闭抽屉操作退出");
 | 
			
		||||
            //        SnackbarBackground = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#b71c1c"));
 | 
			
		||||
            //        SnackbarMessageQueue.Enqueue("请关闭抽屉后再退出");
 | 
			
		||||
            //        return;
 | 
			
		||||
            //    }
 | 
			
		||||
            //}
 | 
			
		||||
            //else
 | 
			
		||||
            //{
 | 
			
		||||
            //    //SelectedMenu.Children = SelectedMenu.Children;
 | 
			
		||||
            //    SelectedChildMenu = SelectedMenu.Children[0];
 | 
			
		||||
            //}
 | 
			
		||||
            logger.Info("开始进入父菜单");
 | 
			
		||||
            if (SelectedMenu != null && SelectedMenu.PremissionName == "退出")
 | 
			
		||||
            {
 | 
			
		||||
 | 
			
		||||
                _chkFunction.HIKStopDVRRecord();
 | 
			
		||||
                logger.Info($"用户【{Operator?.Nickname}】退出登录");
 | 
			
		||||
                Operator = null;
 | 
			
		||||
                Reviewer = null;
 | 
			
		||||
| 
						 | 
				
			
			@ -166,11 +225,108 @@ namespace DM_Weight.ViewModels
 | 
			
		|||
            }
 | 
			
		||||
            else
 | 
			
		||||
            {
 | 
			
		||||
                //SelectedMenu.Children = SelectedMenu.Children;
 | 
			
		||||
                SelectedChildMenu = SelectedMenu.Children[0];
 | 
			
		||||
                if (!_portUtil.Operate)
 | 
			
		||||
                {
 | 
			
		||||
                    _regionManager.RequestNavigate("ContentRegion", SelectedMenu.Children[0].PremissionPath);
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
            logger.Info("结束父菜单");
 | 
			
		||||
        }
 | 
			
		||||
        #region
 | 
			
		||||
        private DelegateCommand _selectionChildCommon;
 | 
			
		||||
        public DelegateCommand SelectionChildCommon
 | 
			
		||||
        {
 | 
			
		||||
            get => _selectionChildCommon ?? (_selectionChildCommon = new DelegateCommand(SelectionChildMethod));
 | 
			
		||||
        }
 | 
			
		||||
        private void SelectionChildMethod()
 | 
			
		||||
        {
 | 
			
		||||
            SelectChildNavigate(SelectedChildMenu);
 | 
			
		||||
        }
 | 
			
		||||
        private void SelectChildNavigate(PremissionDm SelectedChildMenu)
 | 
			
		||||
        {
 | 
			
		||||
            if (!_portUtil.Operate)
 | 
			
		||||
            {
 | 
			
		||||
                if (SelectedChildMenu != null)
 | 
			
		||||
                {
 | 
			
		||||
                    if (SelectedChildMenu.PremissionPath.Equals("TakeRecordWindow"))
 | 
			
		||||
                    {
 | 
			
		||||
                        //定义传参变量
 | 
			
		||||
                        NavigationParameters keys = new NavigationParameters();
 | 
			
		||||
 | 
			
		||||
                        //添加参数,键值对格式
 | 
			
		||||
                        keys.Add("Type", 2);
 | 
			
		||||
                        _regionManager.RequestNavigate("ContentRegion", "MachineRecordWindow", keys);
 | 
			
		||||
                    }
 | 
			
		||||
                    else if (SelectedChildMenu.PremissionPath.Equals("AddRecordWindow"))
 | 
			
		||||
                    {
 | 
			
		||||
                        //定义传参变量
 | 
			
		||||
                        NavigationParameters keys = new NavigationParameters();
 | 
			
		||||
 | 
			
		||||
                        //添加参数,键值对格式
 | 
			
		||||
                        keys.Add("Type", 1);
 | 
			
		||||
                        _regionManager.RequestNavigate("ContentRegion", "MachineRecordWindow", keys);
 | 
			
		||||
                    }
 | 
			
		||||
                    else if (SelectedChildMenu.PremissionPath.Equals("ReturnRecordWindow"))
 | 
			
		||||
                    {
 | 
			
		||||
                        //定义传参变量
 | 
			
		||||
                        NavigationParameters keys = new NavigationParameters();
 | 
			
		||||
 | 
			
		||||
                        //添加参数,键值对格式
 | 
			
		||||
                        keys.Add("Type", 3);
 | 
			
		||||
                        _regionManager.RequestNavigate("ContentRegion", "MachineRecordWindow", keys);
 | 
			
		||||
                    }
 | 
			
		||||
                    else if (SelectedChildMenu.PremissionPath.Equals("RetrunEmptyRecordWindow"))
 | 
			
		||||
                    {
 | 
			
		||||
                        //定义传参变量
 | 
			
		||||
                        NavigationParameters keys = new NavigationParameters();
 | 
			
		||||
 | 
			
		||||
                        //添加参数,键值对格式
 | 
			
		||||
                        keys.Add("Type", 3);
 | 
			
		||||
                        _regionManager.RequestNavigate("ContentRegion", SelectedChildMenu.PremissionPath, keys);
 | 
			
		||||
                    }
 | 
			
		||||
                    else if (SelectedChildMenu.PremissionPath.Equals("CheckRecordWindow"))
 | 
			
		||||
                    {
 | 
			
		||||
                        //定义传参变量
 | 
			
		||||
                        NavigationParameters keys = new NavigationParameters();
 | 
			
		||||
 | 
			
		||||
                        //添加参数,键值对格式
 | 
			
		||||
                        keys.Add("Type", 4);
 | 
			
		||||
                        _regionManager.RequestNavigate("ContentRegion", "MachineRecordWindow", keys);
 | 
			
		||||
                    }
 | 
			
		||||
                    else
 | 
			
		||||
                    {
 | 
			
		||||
                        if (SelectedChildMenu.PremissionPath.Equals("ReturnDrugWindow") || SelectedChildMenu.PremissionPath.Equals("ReturnDrugWindow2"))
 | 
			
		||||
                        {
 | 
			
		||||
                            if (ConfigurationManager.AppSettings["returnDrugMode"].ToString().Equals("1"))
 | 
			
		||||
                            {
 | 
			
		||||
                                _regionManager.RequestNavigate("ContentRegion", "ReturnDrugWindow2");
 | 
			
		||||
                            }
 | 
			
		||||
                            else
 | 
			
		||||
                            {
 | 
			
		||||
                                _regionManager.RequestNavigate("ContentRegion", "ReturnDrugWindow");
 | 
			
		||||
                            }
 | 
			
		||||
                        }
 | 
			
		||||
                        else if (SelectedChildMenu.PremissionPath.Equals("SettingMainWindow") || SelectedChildMenu.PremissionPath.Equals("SettingWindow"))
 | 
			
		||||
                        {
 | 
			
		||||
                            //if (Convert.ToInt32(ConfigurationManager.AppSettings["hasFridge"])>0)
 | 
			
		||||
                            //{
 | 
			
		||||
                            //    _regionManager.RequestNavigate("ContentRegion", "SettingMainWindow");
 | 
			
		||||
                            //}
 | 
			
		||||
                            //else
 | 
			
		||||
                            {
 | 
			
		||||
                                _regionManager.RequestNavigate("ContentRegion", "SettingWindow");
 | 
			
		||||
                            }
 | 
			
		||||
                        }
 | 
			
		||||
                        else
 | 
			
		||||
                        {
 | 
			
		||||
                            _regionManager.RequestNavigate("ContentRegion", SelectedChildMenu.PremissionPath);
 | 
			
		||||
                        }
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        #endregion
 | 
			
		||||
        public List<PremissionDm> PremissionDmList { get { return _premissionDmList; } set { SetProperty(ref _premissionDmList, value); } }
 | 
			
		||||
 | 
			
		||||
        public UserList UserList { get { return _userList; } set { SetProperty(ref _userList, value); } }
 | 
			
		||||
| 
						 | 
				
			
			@ -186,16 +342,14 @@ namespace DM_Weight.ViewModels
 | 
			
		|||
        public bool Is16Drawer { get => _is16Drawer; set => SetProperty(ref _is16Drawer, value); }
 | 
			
		||||
        public bool KeepAlive => false;
 | 
			
		||||
        private PortUtil _portUtil;
 | 
			
		||||
        private CHKFunction _chkFunction;
 | 
			
		||||
        IEventAggregator _eventAggregator;
 | 
			
		||||
        public HomeWindowViewModel(IRegionManager iRegionManager, PortUtil portUtil, IDialogService dialogService, IUnityContainer container, IEventAggregator eventAggregator,CHKFunction cHKFunction)
 | 
			
		||||
        public HomeWindowViewModel(IRegionManager iRegionManager, PortUtil portUtil, IDialogService dialogService, IUnityContainer container, IEventAggregator eventAggregator)
 | 
			
		||||
        {
 | 
			
		||||
            _portUtil = portUtil;
 | 
			
		||||
            _regionManager = iRegionManager;
 | 
			
		||||
            _dialogService = dialogService;
 | 
			
		||||
            _container = container;
 | 
			
		||||
            this._eventAggregator = eventAggregator;
 | 
			
		||||
            _chkFunction= cHKFunction;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public DelegateCommand<string> OpenFingerDialog
 | 
			
		||||
| 
						 | 
				
			
			@ -262,7 +416,6 @@ namespace DM_Weight.ViewModels
 | 
			
		|||
            }
 | 
			
		||||
            Is16Drawer = count == 16;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        //这个方法用于拦截请求,continuationCallback(true)就是不拦截,continuationCallback(false)拦截本次操作
 | 
			
		||||
        public void ConfirmNavigationRequest(NavigationContext navigationContext, Action<bool> continuationCallback)
 | 
			
		||||
        {
 | 
			
		||||
| 
						 | 
				
			
			@ -306,36 +459,88 @@ namespace DM_Weight.ViewModels
 | 
			
		|||
            PremissionDmList = premissions;
 | 
			
		||||
            SelectedMenu = premissions[0];
 | 
			
		||||
            SelectedChildMenu = premissions[0].Children[0];
 | 
			
		||||
            _regionManager.RequestNavigate("ContentRegion", premissions[0].Children[0].PremissionPath);
 | 
			
		||||
 | 
			
		||||
            FindDrawerCount();
 | 
			
		||||
 | 
			
		||||
            int autoExit = Convert.ToInt32(ConfigurationManager.AppSettings["autoExit"] ?? "0");
 | 
			
		||||
            int stopRecord = Convert.ToInt32(ConfigurationManager.AppSettings["stopRecord"] ?? "0");
 | 
			
		||||
            if (autoExit > 0)
 | 
			
		||||
            {
 | 
			
		||||
                Timer timer = new Timer();
 | 
			
		||||
                timer.Interval = 1000;
 | 
			
		||||
                timer.Elapsed += (sender, e) =>
 | 
			
		||||
                logger.Info("启动自动退出检测");
 | 
			
		||||
                //int interval = autoExit * 1000;
 | 
			
		||||
                new PromiseUtil<int>().taskAsyncLoop(1000, 0, async (options, next, stop) =>
 | 
			
		||||
                {
 | 
			
		||||
                    try
 | 
			
		||||
                    {
 | 
			
		||||
                    // 串口无人操作
 | 
			
		||||
                        if (!_portUtil.Operate)
 | 
			
		||||
                        {
 | 
			
		||||
                        // 30秒内无人操作鼠标键盘
 | 
			
		||||
                            // 无人操作鼠标键盘
 | 
			
		||||
                            if ((DateTime.Now - _portUtil.dateTime).TotalSeconds > autoExit && CheckComputerFreeState.GetLastInputTime() > autoExit)
 | 
			
		||||
                            {
 | 
			
		||||
                            logger.Info($"设备30秒内无人操作,用户【{Operator?.Nickname}】自动退出登录");
 | 
			
		||||
                            _chkFunction.HIKStopDVRRecord();
 | 
			
		||||
                                logger.Info($"设备{autoExit}内无人操作,用户【{Operator?.Nickname}】自动退出登录,_portUtil.Operate:{_portUtil.Operate},totalSecond:{(DateTime.Now - _portUtil.dateTime).TotalSeconds},lastInputTime:{CheckComputerFreeState.GetLastInputTime()},autoExit:{autoExit}");
 | 
			
		||||
 | 
			
		||||
                                Operator = null;
 | 
			
		||||
                                Reviewer = null;
 | 
			
		||||
                            Application.Current.Dispatcher.Invoke(() =>
 | 
			
		||||
                                //Application.Current.Dispatcher.Invoke(() =>
 | 
			
		||||
                                //{
 | 
			
		||||
                                stop();
 | 
			
		||||
                                System.Windows.Application.Current.Dispatcher.Invoke(System.Windows.Threading.DispatcherPriority.Send, new Action(() =>
 | 
			
		||||
                                {
 | 
			
		||||
                                    if (DialogHost.IsDialogOpen("RootDialog"))
 | 
			
		||||
                                    {
 | 
			
		||||
                                        DialogHost.Close("RootDialog");
 | 
			
		||||
                                    }
 | 
			
		||||
                                    _regionManager.RequestNavigate("MainRegion", "LoginWindow");
 | 
			
		||||
                                timer.Stop();
 | 
			
		||||
                                }));
 | 
			
		||||
                                //});
 | 
			
		||||
                                //timer.Dispose();
 | 
			
		||||
                            }
 | 
			
		||||
                            else
 | 
			
		||||
                            {
 | 
			
		||||
                                if (Operator == null)
 | 
			
		||||
                                {
 | 
			
		||||
                                    logger.Info("自动退出检测已停止");
 | 
			
		||||
                                    stop();
 | 
			
		||||
                                }
 | 
			
		||||
                                else
 | 
			
		||||
                                {
 | 
			
		||||
                                    logger.Info($"停止操作时间{_portUtil.dateTime},自动退出时间{autoExit},运算结果{(DateTime.Now - _portUtil.dateTime).TotalSeconds},用户上次使用系统到现在的时间间隔{CheckComputerFreeState.GetLastInputTime()}");
 | 
			
		||||
                                    next();
 | 
			
		||||
                                }
 | 
			
		||||
                            }
 | 
			
		||||
                        }
 | 
			
		||||
                        else
 | 
			
		||||
                        {
 | 
			
		||||
                            _portUtil.dateTime = DateTime.Now;
 | 
			
		||||
                            next();
 | 
			
		||||
                        }
 | 
			
		||||
                    }
 | 
			
		||||
                    catch (Exception ex)
 | 
			
		||||
                    {
 | 
			
		||||
                        logger.Info($"自动退出异常:{ex.Message}");
 | 
			
		||||
                    }
 | 
			
		||||
                });
 | 
			
		||||
            }
 | 
			
		||||
                    }
 | 
			
		||||
                };
 | 
			
		||||
                timer.Start();
 | 
			
		||||
            }
 | 
			
		||||
            _chkFunction.HIKStartDVRRecord();
 | 
			
		||||
            //if (stopRecord > 0)
 | 
			
		||||
            //{
 | 
			
		||||
            //    System.Timers.Timer timer = new System.Timers.Timer();
 | 
			
		||||
            //    timer.Interval = 1000;
 | 
			
		||||
            //    timer.Elapsed += (sender, e) =>
 | 
			
		||||
            //    {
 | 
			
		||||
 | 
			
		||||
            //        //指定时间内无人操作鼠标键盘则停止录像
 | 
			
		||||
            //        if (!_portUtil.Operate && CheckComputerFreeState.GetLastInputTime() > stopRecord)
 | 
			
		||||
            //        {
 | 
			
		||||
            //            _chkFunction.HIKStopDVRRecord();
 | 
			
		||||
            //        }
 | 
			
		||||
            //    };
 | 
			
		||||
            //    timer.Start();
 | 
			
		||||
            //}
 | 
			
		||||
            logger.Info($"当前时间:{DateTime.Now}\r\n获取录像机的时间");
 | 
			
		||||
            //获取录像机的时间
 | 
			
		||||
            //_chkFunction.HIK_DVR_TIME();
 | 
			
		||||
            //_chkFunction.HIKStartDVRRecord();
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        //每次导航的时候,该实列用不用重新创建,true是不重新创建,false是重新创建
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -11,6 +11,7 @@ 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;
 | 
			
		||||
| 
						 | 
				
			
			@ -275,9 +276,105 @@ namespace DM_Weight.ViewModels
 | 
			
		|||
                                OperationTime = DateTime.Now,
 | 
			
		||||
                                Quantity = it.AddQuantity,
 | 
			
		||||
                                Type = 1,
 | 
			
		||||
                                InvoiceId = InvoiceId,
 | 
			
		||||
                                StockQuantity = nowChannels.Sum(it => it.Quantity)
 | 
			
		||||
                                InvoiceId = InvoiceId
 | 
			
		||||
                                //,StockQuantity = nowChannels.Sum(it => it.Quantity)
 | 
			
		||||
                            }).ExecuteCommand();
 | 
			
		||||
 | 
			
		||||
                            //保存账册
 | 
			
		||||
                            SqlSugarHelper.Db.Insertable(new AccountBookG2()
 | 
			
		||||
                            {
 | 
			
		||||
                                DrugId = it.DrugId,
 | 
			
		||||
                                Type = 1,
 | 
			
		||||
                                Department = ConfigurationManager.AppSettings["department"].ToString(),
 | 
			
		||||
                                InvoiceNo = InvoiceId,
 | 
			
		||||
                                ManuNo = it.ManuNo,
 | 
			
		||||
                                EffDate = it.EffDate,
 | 
			
		||||
                                AddQuantity = it.AddQuantity,
 | 
			
		||||
                                UserId1 = HomeWindowViewModel.Operator?.Id,
 | 
			
		||||
                                UserId2 = HomeWindowViewModel.Reviewer?.Id,
 | 
			
		||||
                                MachineId = ConfigurationManager.AppSettings["machineId"].ToString(),
 | 
			
		||||
                                CreateDate = DateTime.Now.ToString("yyyy-MM-dd"),
 | 
			
		||||
                                CreateTime = DateTime.Now,
 | 
			
		||||
                                ManuStock=nowChannels.Where(itx => itx.ManuNo == it.ManuNo && itx.EffDate == it.EffDate).Sum(itx => itx.Quantity),
 | 
			
		||||
                                TotalStock=nowChannels.Sum(itx=>itx.Quantity)
 | 
			
		||||
                            }).ExecuteCommand();
 | 
			
		||||
                            //修改凌晨生成的日结存数据
 | 
			
		||||
                            AccountBookG2 accountBookG2Day = SqlSugarHelper.Db.Queryable<AccountBookG2>()
 | 
			
		||||
                            .Where(ab => ab.MachineId.Equals(it.MachineId))
 | 
			
		||||
                            .Where(ab => ab.Type == 3)
 | 
			
		||||
                            .Where(ab => ab.DrugId == it.DrugId)
 | 
			
		||||
                            .Where(ab => ab.ManuNo == it.ManuNo)
 | 
			
		||||
                            .Where(ab => ab.CreateDate == DateTime.Now.ToString("yyyy-MM-dd")).First();
 | 
			
		||||
                            if (accountBookG2Day != null)
 | 
			
		||||
                            {
 | 
			
		||||
                                accountBookG2Day.AddQuantity = accountBookG2Day.AddQuantity + it.AddQuantity;
 | 
			
		||||
                                accountBookG2Day.ManuStock =nowChannels.Where(itx => itx.ManuNo == it.ManuNo && itx.EffDate == it.EffDate).Sum(itx => itx.Quantity);
 | 
			
		||||
                                accountBookG2Day.TotalStock = nowChannels.Sum(itx=>itx.Quantity); 
 | 
			
		||||
                                SqlSugarHelper.Db.Updateable(accountBookG2Day).ExecuteCommand();
 | 
			
		||||
                            }
 | 
			
		||||
                            else
 | 
			
		||||
                            {
 | 
			
		||||
                                //生成日结存时可能没有该库位的绑定信息,需要写入日结存
 | 
			
		||||
                                int iDayResult = SqlSugarHelper.Db.Insertable(new AccountBookG2()
 | 
			
		||||
                                {
 | 
			
		||||
                                    DrugId = it.DrugId,
 | 
			
		||||
                                    Type = 3,
 | 
			
		||||
                                    ManuNo = it.ManuNo,
 | 
			
		||||
                                    EffDate = it.EffDate,
 | 
			
		||||
                                    YQuantity = 0,
 | 
			
		||||
                                    AddQuantity = it.AddQuantity,
 | 
			
		||||
                                    UserId1 = HomeWindowViewModel.Operator?.Id,
 | 
			
		||||
                                    UserId2 = HomeWindowViewModel.Reviewer?.Id,
 | 
			
		||||
                                    MachineId = ConfigurationManager.AppSettings["machineId"].ToString(),
 | 
			
		||||
                                    CreateDate = DateTime.Now.ToString("yyyy-MM-dd"),
 | 
			
		||||
                                    InvoiceNo = "日结存",
 | 
			
		||||
                                    Department = ConfigurationManager.AppSettings["department"].ToString(),
 | 
			
		||||
                                    ManuStock =nowChannels.Where(itx => itx.ManuNo == it.ManuNo && itx.EffDate == it.EffDate).Sum(itx => itx.Quantity),
 | 
			
		||||
                                    TotalStock = nowChannels.Sum(itx=>itx.Quantity) 
 | 
			
		||||
 | 
			
		||||
                                }).ExecuteCommand();
 | 
			
		||||
                                if (iDayResult <= 0)
 | 
			
		||||
                                {
 | 
			
		||||
                                    logger.Info($"未写入日结存数据{it.DrugId}-{it.ManuNo}-{it.EffDate}-{it.AddQuantity}");
 | 
			
		||||
                                }
 | 
			
		||||
                            }
 | 
			
		||||
                            //修改凌晨生成的总结存数据
 | 
			
		||||
                            AccountBookG2 accountBookG2Total = SqlSugarHelper.Db.Queryable<AccountBookG2>()
 | 
			
		||||
                            .Where(ab => ab.MachineId.Equals(it.MachineId))
 | 
			
		||||
                            .Where(ab => ab.Type == 4)
 | 
			
		||||
                            .Where(ab => ab.DrugId == it.DrugId)
 | 
			
		||||
                            .Where(ab => ab.CreateDate == DateTime.Now.ToString("yyyy-MM-dd")).First();
 | 
			
		||||
                            if (accountBookG2Total != null)
 | 
			
		||||
                            {
 | 
			
		||||
                                accountBookG2Total.AddQuantity = accountBookG2Total.AddQuantity + it.AddQuantity;
 | 
			
		||||
                                accountBookG2Total.ManuStock =  nowChannels.Where(itx => itx.ManuNo == it.ManuNo && itx.EffDate == it.EffDate).Sum(itx => itx.Quantity);
 | 
			
		||||
                                accountBookG2Total.TotalStock =nowChannels.Sum(itx => itx.Quantity);
 | 
			
		||||
                                SqlSugarHelper.Db.Updateable(accountBookG2Total).ExecuteCommand();
 | 
			
		||||
                            }
 | 
			
		||||
                            else
 | 
			
		||||
                            {
 | 
			
		||||
                                //生成总结存时可能没有该库位的绑定信息,需要写入总结存
 | 
			
		||||
                                int iTotalResult = SqlSugarHelper.Db.Insertable(new AccountBookG2()
 | 
			
		||||
                                {
 | 
			
		||||
                                    DrugId = it.DrugId,
 | 
			
		||||
                                    Type = 4,
 | 
			
		||||
                                    YQuantity = 0,
 | 
			
		||||
                                    UserId1 = HomeWindowViewModel.Operator?.Id,
 | 
			
		||||
                                    UserId2 = HomeWindowViewModel.Reviewer?.Id,
 | 
			
		||||
                                    MachineId = ConfigurationManager.AppSettings["machineId"].ToString(),
 | 
			
		||||
                                    CreateDate = DateTime.Now.ToString("yyyy-MM-dd"),
 | 
			
		||||
                                    InvoiceNo = "总结存",
 | 
			
		||||
                                    Department = ConfigurationManager.AppSettings["department"].ToString(),
 | 
			
		||||
                                    AddQuantity=it.AddQuantity,
 | 
			
		||||
                                    ManuStock =nowChannels.Where(itx => itx.ManuNo == it.ManuNo && itx.EffDate == it.EffDate).Sum(itx => itx.Quantity),
 | 
			
		||||
                                    TotalStock = nowChannels.Sum(itx=>itx.Quantity) 
 | 
			
		||||
 | 
			
		||||
                                }).ExecuteCommand();
 | 
			
		||||
                                if (iTotalResult <= 0)
 | 
			
		||||
                                {
 | 
			
		||||
                                    logger.Info($"未写入总结存数据{it.DrugId}-{it.AddQuantity}");
 | 
			
		||||
                                }
 | 
			
		||||
                            }
 | 
			
		||||
                        }
 | 
			
		||||
                        return true;
 | 
			
		||||
                    });
 | 
			
		||||
| 
						 | 
				
			
			@ -292,7 +389,16 @@ namespace DM_Weight.ViewModels
 | 
			
		|||
                                _portUtil.WriteQuantity(it.DrawerNo, it.ColNo, it.Quantity + it.AddQuantity);
 | 
			
		||||
                            });
 | 
			
		||||
                        }
 | 
			
		||||
 | 
			
		||||
                        if ((singleChannels.Count > 0 ? singleChannels[0].BoardType : 1) == 35)
 | 
			
		||||
                        {
 | 
			
		||||
                            for (int i = 0; i < singleChannels.Count; i++)
 | 
			
		||||
                            {
 | 
			
		||||
                                await Task.Delay(200);
 | 
			
		||||
                                await _portUtil.WriteChannelInfoMethod(2, (singleChannels[i].Quantity + singleChannels[i].AddQuantity).ToString(), singleChannels[i].DrawerNo, singleChannels[i].ColNo);
 | 
			
		||||
                                await Task.Delay(200);
 | 
			
		||||
                                await _portUtil.ShowContentMethod(singleChannels[i].DrawerNo, singleChannels[i].ColNo);
 | 
			
		||||
                            }
 | 
			
		||||
                        }
 | 
			
		||||
 | 
			
		||||
                        AlertMsg alertMsg = new AlertMsg
 | 
			
		||||
                        {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -198,14 +198,16 @@ namespace DM_Weight.ViewModels
 | 
			
		|||
            {
 | 
			
		||||
                var invoices = SqlSugarHelper.Db.Queryable<InOutInvoice>()
 | 
			
		||||
                                .Includes<DrugInfo>(i => i.DrugInfo)
 | 
			
		||||
                                .InnerJoin(SqlSugarHelper.Db.Queryable<ChannelStock>().Where(cs => cs.DrawerType == 1).Where(cs => cs.MachineId.Equals(ConfigurationManager.AppSettings["machineId"] ?? "DM1")).GroupBy(cs => cs.DrugId), (i, t) => i.DrugId == t.DrugId)
 | 
			
		||||
                                .InnerJoin(SqlSugarHelper.Db.Queryable<ChannelStock>().Where(cs => cs.DrawerType == 1)
 | 
			
		||||
                                .Where(cs => cs.MachineId.Equals(ConfigurationManager.AppSettings["machineId"] ?? "DM1"))
 | 
			
		||||
                                .GroupBy(cs => cs.DrugId), (i, t) => i.DrugId == t.DrugId)
 | 
			
		||||
                                .Where(i => i.InvoiceNo == SelectedInvoice.InvoiceNo)
 | 
			
		||||
                                .ToList();
 | 
			
		||||
                foreach (var invoice in invoices)
 | 
			
		||||
                {
 | 
			
		||||
                    List<ChannelStock> q = SqlSugarHelper.Db.Queryable<ChannelStock>()
 | 
			
		||||
                    .Includes<DrugInfo>(cs => cs.DrugInfo)
 | 
			
		||||
                    .WhereIF(!string.IsNullOrEmpty(invoice.DrugEffDate), cs => cs.EffDate.Equals(invoice.DrugEffDate))
 | 
			
		||||
                    .WhereIF(!string.IsNullOrEmpty(invoice.DrugEffDate), cs => cs.EffDate.Substring(0,10).Equals(invoice.DrugEffDate.Substring(0,10)))
 | 
			
		||||
                    .WhereIF(!string.IsNullOrEmpty(invoice.DrugManuNo), cs => cs.ManuNo.Equals(invoice.DrugManuNo))
 | 
			
		||||
                    .Where(cs => cs.DrugId == invoice.DrugId)
 | 
			
		||||
                    .Where(cs => cs.DrawerType == 1)
 | 
			
		||||
| 
						 | 
				
			
			@ -325,14 +327,14 @@ namespace DM_Weight.ViewModels
 | 
			
		|||
            var sb = new StringBuilder();
 | 
			
		||||
            sb.Append("select i.invoice_no as InvoiceNo, i.invoice_date as InvoiceDate, COUNT(i.id) as `Count`, SUM(i.quantity) as quantity, p1.pharmacy_name as PharmacyName1, p2.pharmacy_name as PharmacyName2 from in_out_invoice i");
 | 
			
		||||
            sb.Append(" inner join ( select c.drug_id as drug_id from channel_stock c where c.machine_id = '" + (ConfigurationManager.AppSettings["machineId"] ?? "DM1") + "' group by c.drug_id ) di on di.drug_id = i.drug_id");
 | 
			
		||||
            sb.Append(" left join pharmacy_info p1 on p1.pharmacy_id = i.in_pharmacy_id");
 | 
			
		||||
            sb.Append(" left join pharmacy_info p2 on p2.pharmacy_id = i.out_pharmacy_id");
 | 
			
		||||
            sb.Append(" left join pharmacy_info p1 on p1.pharmacy = i.in_pharmacy_id");
 | 
			
		||||
            sb.Append(" left join pharmacy_info p2 on p2.pharmacy = i.out_pharmacy_id");
 | 
			
		||||
            sb.Append(" where i.status=@Status ");
 | 
			
		||||
            sb.Append(" and i.type!=@type ");
 | 
			
		||||
            sb.Append(" and i.type=@type ");
 | 
			
		||||
            sb.Append(" and i.cancel_flag=@CancelFlag ");
 | 
			
		||||
            if (OrderDate != null)
 | 
			
		||||
            {
 | 
			
		||||
                sb.Append(" and i.invoice_date = @CreateTime ");
 | 
			
		||||
                sb.Append(" and DATE_FORMAT(i.invoice_date,'%Y-%m-%d') = @CreateTime ");
 | 
			
		||||
            }
 | 
			
		||||
            if (!String.IsNullOrEmpty(SearchValue))
 | 
			
		||||
            {
 | 
			
		||||
| 
						 | 
				
			
			@ -347,7 +349,7 @@ namespace DM_Weight.ViewModels
 | 
			
		|||
            Invoices = SqlSugarHelper.Db.SqlQueryable<dynamic>(sb.ToString())
 | 
			
		||||
                .AddParameters(new
 | 
			
		||||
                {
 | 
			
		||||
                    Status = 0,
 | 
			
		||||
                    Status = 1,
 | 
			
		||||
                    type = 2,
 | 
			
		||||
                    CancelFlag = 0,
 | 
			
		||||
                    CreateTime = OrderDate,
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -211,8 +211,8 @@ namespace DM_Weight.ViewModels
 | 
			
		|||
            var sb = new StringBuilder();
 | 
			
		||||
            sb.Append("select i.invoice_no as InvoiceNo, i.invoice_date as InvoiceDate, COUNT(i.id) as `Count`, SUM(i.quantity) as quantity, p1.pharmacy_name as PharmacyName1, p2.pharmacy_name as PharmacyName2 from in_out_invoice i");
 | 
			
		||||
            sb.Append(" inner join ( select c.drug_id as drug_id from channel_stock c where c.machine_id = '" + (ConfigurationManager.AppSettings["machineId"] ?? "DM1") + "' group by c.drug_id ) di on di.drug_id = i.drug_id");
 | 
			
		||||
            sb.Append(" left join pharmacy_info p1 on p1.pharmacy_id = i.in_pharmacy_id");
 | 
			
		||||
            sb.Append(" left join pharmacy_info p2 on p2.pharmacy_id = i.out_pharmacy_id");
 | 
			
		||||
            sb.Append(" left join pharmacy_info p1 on p1.pharmacy = i.in_pharmacy_id");
 | 
			
		||||
            sb.Append(" left join pharmacy_info p2 on p2.pharmacy = i.out_pharmacy_id");
 | 
			
		||||
            sb.Append(" where i.status=@Status ");
 | 
			
		||||
            sb.Append(" and i.type!=@type ");
 | 
			
		||||
            sb.Append(" and i.cancel_flag=@CancelFlag ");
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -288,7 +288,7 @@ namespace DM_Weight.ViewModels
 | 
			
		|||
        // 完成按钮
 | 
			
		||||
        public DelegateCommand TakeFinish
 | 
			
		||||
        {
 | 
			
		||||
            get => new DelegateCommand(() =>
 | 
			
		||||
            get => new DelegateCommand(async() =>
 | 
			
		||||
            {
 | 
			
		||||
                if (!_isFinishClick)
 | 
			
		||||
                {
 | 
			
		||||
| 
						 | 
				
			
			@ -337,9 +337,107 @@ namespace DM_Weight.ViewModels
 | 
			
		|||
                                    OperationTime = DateTime.Now,
 | 
			
		||||
                                    Quantity = it.TakeQuantity,
 | 
			
		||||
                                    Type = 2,
 | 
			
		||||
                                    InvoiceId = InvoiceId,
 | 
			
		||||
                                    StockQuantity = nowChannels.Sum(it => it.Quantity)
 | 
			
		||||
                                    InvoiceId = InvoiceId
 | 
			
		||||
                                    //,StockQuantity = nowChannels.Sum(it => it.Quantity)
 | 
			
		||||
                                }).ExecuteCommand();
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
                                //保存账册
 | 
			
		||||
                                SqlSugarHelper.Db.Insertable(new AccountBookG2()
 | 
			
		||||
                                {
 | 
			
		||||
                                    DrugId = it.DrugId,
 | 
			
		||||
                                    Type = 2,
 | 
			
		||||
                                    Department = ConfigurationManager.AppSettings["department"].ToString(),
 | 
			
		||||
                                    InvoiceNo = InvoiceId,
 | 
			
		||||
                                    ManuNo = it.ManuNo,
 | 
			
		||||
                                    EffDate = it.EffDate,
 | 
			
		||||
                                    OutQuantity = it.TakeQuantity,
 | 
			
		||||
                                    UserId1 = HomeWindowViewModel.Operator?.Id,
 | 
			
		||||
                                    UserId2 = HomeWindowViewModel.Reviewer?.Id,
 | 
			
		||||
                                    MachineId = ConfigurationManager.AppSettings["machineId"].ToString(),
 | 
			
		||||
                                    CreateDate = DateTime.Now.ToString("yyyy-MM-dd"),
 | 
			
		||||
                                    CreateTime = DateTime.Now,
 | 
			
		||||
                                    ManuStock=nowChannels.Where(itx => itx.ManuNo == it.ManuNo && itx.EffDate == it.EffDate).Sum(itx => itx.Quantity),
 | 
			
		||||
                                    TotalStock=nowChannels.Sum(itx=>itx.Quantity)
 | 
			
		||||
 | 
			
		||||
                                }).ExecuteCommand();
 | 
			
		||||
                                //修改凌晨生成的日结存数据
 | 
			
		||||
                                AccountBookG2 accountBookG2Day = SqlSugarHelper.Db.Queryable<AccountBookG2>()
 | 
			
		||||
                                .Where(ab => ab.MachineId.Equals(it.MachineId))
 | 
			
		||||
                                .Where(ab => ab.Type == 3)
 | 
			
		||||
                                .Where(ab => ab.DrugId == it.DrugId)
 | 
			
		||||
                                .Where(ab => ab.ManuNo == it.ManuNo)
 | 
			
		||||
                                .Where(ab => ab.CreateDate == DateTime.Now.ToString("yyyy-MM-dd")).First();
 | 
			
		||||
                                if (accountBookG2Day != null)
 | 
			
		||||
                                {
 | 
			
		||||
                                    accountBookG2Day.OutQuantity = accountBookG2Day.OutQuantity + it.TakeQuantity;
 | 
			
		||||
                                    accountBookG2Day.ManuStock = nowChannels.Where(itx => itx.ManuNo == it.ManuNo && itx.EffDate == it.EffDate).Sum(itx => itx.Quantity);
 | 
			
		||||
                                    accountBookG2Day.TotalStock = nowChannels.Sum(itx => itx.Quantity);
 | 
			
		||||
                                    SqlSugarHelper.Db.Updateable(accountBookG2Day).ExecuteCommand();
 | 
			
		||||
                                }
 | 
			
		||||
                                else
 | 
			
		||||
                                {
 | 
			
		||||
                                    //生成日结存时可能没有该库位的绑定信息,需要写入日结存
 | 
			
		||||
                                    int iDayResult = SqlSugarHelper.Db.Insertable(new AccountBookG2()
 | 
			
		||||
                                    {
 | 
			
		||||
                                        DrugId = it.DrugId,
 | 
			
		||||
                                        Type = 3,
 | 
			
		||||
                                        ManuNo = it.ManuNo,
 | 
			
		||||
                                        EffDate = it.EffDate,
 | 
			
		||||
                                        YQuantity = 0,
 | 
			
		||||
                                        UserId1 = HomeWindowViewModel.Operator?.Id,
 | 
			
		||||
                                        UserId2 = HomeWindowViewModel.Reviewer?.Id,
 | 
			
		||||
                                        MachineId = ConfigurationManager.AppSettings["machineId"].ToString(),
 | 
			
		||||
                                        CreateDate = DateTime.Now.ToString("yyyy-MM-dd"),
 | 
			
		||||
                                        InvoiceNo = "日结存",
 | 
			
		||||
                                        Department = ConfigurationManager.AppSettings["department"].ToString(),
 | 
			
		||||
                                        OutQuantity = it.TakeQuantity,
 | 
			
		||||
                                        ManuStock =nowChannels.Where(itx => itx.ManuNo == it.ManuNo && itx.EffDate == it.EffDate).Sum(itx => itx.Quantity),
 | 
			
		||||
                                        TotalStock = nowChannels.Sum(itx=>itx.Quantity), 
 | 
			
		||||
 | 
			
		||||
                                    }).ExecuteCommand();
 | 
			
		||||
                                    if (iDayResult <= 0)
 | 
			
		||||
                                    {
 | 
			
		||||
                                        logger.Info($"未写入日结存数据{it.DrugId}-{it.ManuNo}-{it.EffDate}-{it.AddQuantity}");
 | 
			
		||||
                                    }
 | 
			
		||||
                                }
 | 
			
		||||
                                //修改凌晨生成的总结存数据
 | 
			
		||||
                                AccountBookG2 accountBookG2Total = SqlSugarHelper.Db.Queryable<AccountBookG2>()
 | 
			
		||||
                                .Where(ab => ab.MachineId.Equals(it.MachineId))
 | 
			
		||||
                                .Where(ab => ab.Type == 4)
 | 
			
		||||
                                .Where(ab => ab.DrugId == it.DrugId)
 | 
			
		||||
                                .Where(ab => ab.CreateDate == DateTime.Now.ToString("yyyy-MM-dd")).First();
 | 
			
		||||
                                if (accountBookG2Total != null)
 | 
			
		||||
                                {
 | 
			
		||||
                                    accountBookG2Total.OutQuantity = accountBookG2Total.OutQuantity + it.TakeQuantity;
 | 
			
		||||
                                    accountBookG2Total.ManuStock = nowChannels.Where(itx => itx.ManuNo == it.ManuNo && itx.EffDate == it.EffDate).Sum(itx => itx.Quantity);
 | 
			
		||||
                                    accountBookG2Total.TotalStock = nowChannels.Sum(itx => itx.Quantity);
 | 
			
		||||
                                    SqlSugarHelper.Db.Updateable(accountBookG2Total).ExecuteCommand();
 | 
			
		||||
                                }
 | 
			
		||||
                                else
 | 
			
		||||
                                {
 | 
			
		||||
                                    //生成总结存时可能没有该库位的绑定信息,需要写入总结存
 | 
			
		||||
                                    int iTotalResult = SqlSugarHelper.Db.Insertable(new AccountBookG2()
 | 
			
		||||
                                    {
 | 
			
		||||
                                        DrugId = it.DrugId,
 | 
			
		||||
                                        Type = 4,
 | 
			
		||||
                                        YQuantity = 0,
 | 
			
		||||
                                        UserId1 = HomeWindowViewModel.Operator?.Id,
 | 
			
		||||
                                        UserId2 = HomeWindowViewModel.Reviewer?.Id,
 | 
			
		||||
                                        MachineId = ConfigurationManager.AppSettings["machineId"].ToString(),
 | 
			
		||||
                                        CreateDate = DateTime.Now.ToString("yyyy-MM-dd"),
 | 
			
		||||
                                        InvoiceNo = "总结存",
 | 
			
		||||
                                        Department = ConfigurationManager.AppSettings["department"].ToString(),
 | 
			
		||||
                                        OutQuantity = it.TakeQuantity,
 | 
			
		||||
                                        ManuStock =  nowChannels.Where(itx => itx.ManuNo == it.ManuNo && itx.EffDate == it.EffDate).Sum(itx => itx.Quantity),
 | 
			
		||||
                                        TotalStock =nowChannels.Sum(itx=>itx.Quantity),
 | 
			
		||||
                                    }).ExecuteCommand();
 | 
			
		||||
                                    if (iTotalResult <= 0)
 | 
			
		||||
                                    {
 | 
			
		||||
                                        logger.Info($"未写入总结存数据{it.DrugId}-{it.AddQuantity}");
 | 
			
		||||
                                    }
 | 
			
		||||
                                }
 | 
			
		||||
                            }
 | 
			
		||||
                            return true;
 | 
			
		||||
                        });
 | 
			
		||||
| 
						 | 
				
			
			@ -354,6 +452,16 @@ namespace DM_Weight.ViewModels
 | 
			
		|||
                                    _portUtil.WriteQuantity(it.DrawerNo, it.ColNo, it.Quantity - it.TakeQuantity);
 | 
			
		||||
                                });
 | 
			
		||||
                            }
 | 
			
		||||
                            if ((singleChannels.Count > 0 ? singleChannels[0].BoardType : 1) == 35)
 | 
			
		||||
                            {
 | 
			
		||||
                                for (int i = 0; i < singleChannels.Count; i++)
 | 
			
		||||
                                {
 | 
			
		||||
                                    await Task.Delay(200);
 | 
			
		||||
                                    await _portUtil.WriteChannelInfoMethod(2, (singleChannels[i].Quantity - singleChannels[i].TakeQuantity).ToString(), singleChannels[i].DrawerNo, singleChannels[i].ColNo);
 | 
			
		||||
                                    await Task.Delay(200);
 | 
			
		||||
                                    await _portUtil.ShowContentMethod(singleChannels[i].DrawerNo, singleChannels[i].ColNo);
 | 
			
		||||
                                }
 | 
			
		||||
                            }
 | 
			
		||||
                            AlertMsg alertMsg = new AlertMsg
 | 
			
		||||
                            {
 | 
			
		||||
                                Message = "调拨取药完成,库存已更新",
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -54,10 +54,18 @@ namespace DM_Weight.ViewModels
 | 
			
		|||
            //get => loginMode == 2;
 | 
			
		||||
            get => ReadAppSetting("loginMode") == "2";
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public string LoginUserCheck
 | 
			
		||||
        {
 | 
			
		||||
 | 
			
		||||
            get => ReadAppSetting("loginUser");
 | 
			
		||||
        }
 | 
			
		||||
        private HkcChangeShifts listHkcChangeShifts = new HkcChangeShifts();
 | 
			
		||||
 | 
			
		||||
        private FingerprintUtil _fingerprintUtil;
 | 
			
		||||
 | 
			
		||||
        private PortUtil _portUtil;
 | 
			
		||||
        private CHKFunction _chkFunction;
 | 
			
		||||
        //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); } }
 | 
			
		||||
| 
						 | 
				
			
			@ -76,19 +84,23 @@ namespace DM_Weight.ViewModels
 | 
			
		|||
            get => _portUtil._canBusExsit && !_portUtil.canBusSerial.IsOpen;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        private bool _fingerMsg= CHKFunction.HKUserId>=0;
 | 
			
		||||
        private bool _fingerMsg = CHKFunction.HKUserId >= 0;
 | 
			
		||||
 | 
			
		||||
        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);
 | 
			
		||||
            get => _hikMsg;
 | 
			
		||||
            set => SetProperty(ref _hikMsg, value);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        //public LoginWindowViewModel(IRegionManager regionManager, IEventAggregator eventAggregator, PortUtil portUtil, FingerprintUtil fingerprintUtil)
 | 
			
		||||
| 
						 | 
				
			
			@ -98,11 +110,11 @@ namespace DM_Weight.ViewModels
 | 
			
		|||
        //    _regionManager = regionManager;
 | 
			
		||||
        //    _eventAggregator = eventAggregator;
 | 
			
		||||
        //}
 | 
			
		||||
        public LoginWindowViewModel(IRegionManager regionManager, IEventAggregator eventAggregator, PortUtil portUtil, CHKFunction chcFunction)
 | 
			
		||||
        public LoginWindowViewModel(IRegionManager regionManager, IEventAggregator eventAggregator, PortUtil portUtil)
 | 
			
		||||
        {
 | 
			
		||||
            //_fingerprintUtil = fingerprintUtil;
 | 
			
		||||
            _portUtil = portUtil;
 | 
			
		||||
            _chkFunction= chcFunction;
 | 
			
		||||
            //_chkFunction= chcFunction;
 | 
			
		||||
            _regionManager = regionManager;
 | 
			
		||||
            _eventAggregator = eventAggregator;
 | 
			
		||||
        }
 | 
			
		||||
| 
						 | 
				
			
			@ -167,7 +179,7 @@ _exitCommand ??= new DelegateCommand(Exit);
 | 
			
		|||
                        Username = "";
 | 
			
		||||
                        Password = "";
 | 
			
		||||
                    }
 | 
			
		||||
                    else if (userList.Role == null|| userList.Role.Permissions.Count<=0)
 | 
			
		||||
                    else if (userList.Role == null || userList.Role.Permissions.Count <= 0)
 | 
			
		||||
                    {
 | 
			
		||||
                        AlertMsg alertMsg = new AlertMsg
 | 
			
		||||
                        {
 | 
			
		||||
| 
						 | 
				
			
			@ -180,6 +192,29 @@ _exitCommand ??= new DelegateCommand(Exit);
 | 
			
		|||
                    }
 | 
			
		||||
                    else
 | 
			
		||||
                    {
 | 
			
		||||
                        //1仅当班人、审核人可登录
 | 
			
		||||
                        if (LoginUserCheck.Equals("1"))
 | 
			
		||||
                        {
 | 
			
		||||
                            //检查当前登录人是否是值班人 (审核人与发药人)
 | 
			
		||||
                            listHkcChangeShifts = SqlSugarHelper.Db.Queryable<HkcChangeShifts>()
 | 
			
		||||
                               .Where(cs => cs.State == "0").First();
 | 
			
		||||
                            if (listHkcChangeShifts != null)
 | 
			
		||||
                            {
 | 
			
		||||
                                if (!listHkcChangeShifts.FromOperator.Equals(userList.UserName) && !listHkcChangeShifts.FromRviewer.Equals(userList.UserName))
 | 
			
		||||
                                {
 | 
			
		||||
                                    AlertMsg alertMsg = new AlertMsg
 | 
			
		||||
                                    {
 | 
			
		||||
                                        Message = "仅值班人可登录,当前登录人非值班人",
 | 
			
		||||
                                        Type = MsgType.ERROR
 | 
			
		||||
                                    };
 | 
			
		||||
                                    _eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
 | 
			
		||||
                                    Username = "";
 | 
			
		||||
                                    Password = "";
 | 
			
		||||
                                    return;
 | 
			
		||||
                                }
 | 
			
		||||
 | 
			
		||||
                            }
 | 
			
		||||
                        }
 | 
			
		||||
                        if (userList.PassWord == MD5.GetMD5Hash(Password))
 | 
			
		||||
                        {
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -278,6 +313,28 @@ _exitCommand ??= new DelegateCommand(Exit);
 | 
			
		|||
                // 第一个用户登录
 | 
			
		||||
                else
 | 
			
		||||
                {
 | 
			
		||||
                    //1仅当班人、审核人可登录
 | 
			
		||||
                    if (LoginUserCheck.Equals("1"))
 | 
			
		||||
                    {
 | 
			
		||||
                        if (listHkcChangeShifts != null)
 | 
			
		||||
                        {
 | 
			
		||||
                            if (listHkcChangeShifts.FromOperator.Equals(user.UserName))
 | 
			
		||||
                            {
 | 
			
		||||
                                keys.Add("operator", user);
 | 
			
		||||
                                Operator = user;
 | 
			
		||||
                                RaisePropertyChanged("Operator");
 | 
			
		||||
                            }
 | 
			
		||||
                            else
 | 
			
		||||
                            {
 | 
			
		||||
                                keys.Add("reviewer", user);
 | 
			
		||||
                                Reviewer = user;
 | 
			
		||||
                                RaisePropertyChanged("Reviewer");
 | 
			
		||||
                            }
 | 
			
		||||
                            Username = string.Empty;
 | 
			
		||||
                            Password = string.Empty;
 | 
			
		||||
                            return;
 | 
			
		||||
                        }
 | 
			
		||||
                    }
 | 
			
		||||
                    if (firstLogin.Equals("operator"))
 | 
			
		||||
                    {
 | 
			
		||||
                        keys.Add("operator", user);
 | 
			
		||||
| 
						 | 
				
			
			@ -291,14 +348,14 @@ _exitCommand ??= new DelegateCommand(Exit);
 | 
			
		|||
                        RaisePropertyChanged("Reviewer");
 | 
			
		||||
                    }
 | 
			
		||||
                    Username = string.Empty;
 | 
			
		||||
                    Password =string.Empty;
 | 
			
		||||
                    Password = string.Empty;
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        void Exit()
 | 
			
		||||
        {
 | 
			
		||||
            _chkFunction.HIKLoginOut();
 | 
			
		||||
            //_chkFunction.HIKLoginOut();
 | 
			
		||||
            Process.GetCurrentProcess().Kill();
 | 
			
		||||
            Environment.Exit(0);
 | 
			
		||||
        }
 | 
			
		||||
| 
						 | 
				
			
			@ -314,6 +371,9 @@ _exitCommand ??= new DelegateCommand(Exit);
 | 
			
		|||
            {
 | 
			
		||||
                if (msg.Message.Equals("LOGIN"))
 | 
			
		||||
                {
 | 
			
		||||
                    try
 | 
			
		||||
                    {
 | 
			
		||||
 | 
			
		||||
                        UserList userList = SqlSugarHelper.Db.Queryable<UserList>()
 | 
			
		||||
 | 
			
		||||
                        .Includes<RoleDm>(u => u.Role)
 | 
			
		||||
| 
						 | 
				
			
			@ -343,8 +403,46 @@ _exitCommand ??= new DelegateCommand(Exit);
 | 
			
		|||
                        }
 | 
			
		||||
                        else
 | 
			
		||||
                        {
 | 
			
		||||
                            //1仅当班人、审核人可登录
 | 
			
		||||
                            if (LoginUserCheck.Equals("1"))
 | 
			
		||||
                            {
 | 
			
		||||
                                //检查当前登录人是否是值班人 (审核人与发药人)
 | 
			
		||||
                                listHkcChangeShifts = SqlSugarHelper.Db.Queryable<HkcChangeShifts>()
 | 
			
		||||
                                   .Where(cs => cs.State == "0").First();
 | 
			
		||||
                                if (listHkcChangeShifts != null)
 | 
			
		||||
                                {
 | 
			
		||||
                                    if (!listHkcChangeShifts.FromOperator.Equals(userList.UserName) && !listHkcChangeShifts.FromRviewer.Equals(userList.UserName))
 | 
			
		||||
                                    {
 | 
			
		||||
                                        AlertMsg alertMsg = new AlertMsg
 | 
			
		||||
                                        {
 | 
			
		||||
                                            Message = "仅值班人可登录,当前登录人非值班人",
 | 
			
		||||
                                            Type = MsgType.ERROR
 | 
			
		||||
                                        };
 | 
			
		||||
                                        _eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
 | 
			
		||||
                                        Username = "";
 | 
			
		||||
                                        Password = "";
 | 
			
		||||
                                        return;
 | 
			
		||||
                                    }
 | 
			
		||||
 | 
			
		||||
                                }
 | 
			
		||||
                            }
 | 
			
		||||
                            SetUser(userList);
 | 
			
		||||
                        }
 | 
			
		||||
 | 
			
		||||
                    }
 | 
			
		||||
                    catch (Exception ex)
 | 
			
		||||
                    {
 | 
			
		||||
                        if(ex.Message.Contains("连接数据库过程中发生错误"))
 | 
			
		||||
                        {
 | 
			
		||||
                            App.DbConnectionFail = true;
 | 
			
		||||
                            _regionManager.RequestNavigate("MainRegion", "EmergencyWindow");
 | 
			
		||||
                            //System.Windows.Application.Current.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Send, new Action(() =>
 | 
			
		||||
                            //{
 | 
			
		||||
                            //    _regionManager.RequestNavigate("MainRegion", "EmergencyWindow");
 | 
			
		||||
                            //}));
 | 
			
		||||
                        }
 | 
			
		||||
                        logger.Info(ex.Message);
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -63,8 +63,8 @@ namespace DM_Weight.ViewModels
 | 
			
		|||
        private FingerprintUtil _fingerprintUtil;
 | 
			
		||||
        IRegionManager _regionManager;
 | 
			
		||||
        IUnityContainer _container;
 | 
			
		||||
        private CHKFunction _cHKFunction;
 | 
			
		||||
        public MainWindowViewModel(IRegionManager regionManager, IUnityContainer container, IEventAggregator eventAggregator, FingerprintUtil fingerprintUtil, ScreenUtil screenUtil, CHKFunction cHKFunction)
 | 
			
		||||
        //private CHKFunction _cHKFunction;
 | 
			
		||||
        public MainWindowViewModel(IRegionManager regionManager, IUnityContainer container, IEventAggregator eventAggregator, FingerprintUtil fingerprintUtil, ScreenUtil screenUtil)
 | 
			
		||||
        {
 | 
			
		||||
            //_portUtil = portUtil;
 | 
			
		||||
            this.eventAggregator = eventAggregator;
 | 
			
		||||
| 
						 | 
				
			
			@ -73,12 +73,18 @@ namespace DM_Weight.ViewModels
 | 
			
		|||
            _fingerprintUtil = fingerprintUtil;
 | 
			
		||||
            _regionManager = regionManager;
 | 
			
		||||
            _container = container;
 | 
			
		||||
            _cHKFunction = cHKFunction;
 | 
			
		||||
            //_cHKFunction = cHKFunction;
 | 
			
		||||
            System.Windows.Application.Current.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Send, new Action(() =>
 | 
			
		||||
            {
 | 
			
		||||
 | 
			
		||||
                if (App.DbConnectionFail)
 | 
			
		||||
                {
 | 
			
		||||
                    _regionManager.RequestNavigate("MainRegion", "EmergencyWindow");
 | 
			
		||||
                }
 | 
			
		||||
                else
 | 
			
		||||
                {
 | 
			
		||||
                    _container.RegisterType<object, LoginWindow>("LoginWindow");
 | 
			
		||||
                    _regionManager.RequestNavigate("MainRegion", "LoginWindow");
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
            }));
 | 
			
		||||
        }
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -399,8 +399,8 @@ namespace DM_Weight.ViewModels
 | 
			
		|||
                                        OperationTime = DateTime.Now,
 | 
			
		||||
                                        Quantity = orderTakeQuantity,
 | 
			
		||||
                                        Type = 2,
 | 
			
		||||
                                        InvoiceId = InvoiceId,
 | 
			
		||||
                                        StockQuantity = nowChannels.Sum(it => it.Quantity)
 | 
			
		||||
                                        InvoiceId = InvoiceId
 | 
			
		||||
                                        //,StockQuantity = nowChannels.Sum(it => it.Quantity)
 | 
			
		||||
                                    }).ExecuteCommand();
 | 
			
		||||
                                }
 | 
			
		||||
                                //更新处方状态
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -312,14 +312,14 @@ namespace DM_Weight.ViewModels
 | 
			
		|||
            List<OrderInfo> queryData = SqlSugarHelper.Db.Queryable<OrderInfo>()
 | 
			
		||||
                .InnerJoin<OrderDetail>((oi, od) => oi.OrderNo == od.OrderNo)
 | 
			
		||||
                .InnerJoin(SqlSugarHelper.Db.Queryable<ChannelStock>().Where(cs => cs.DrawerType == 1).Where(cs => cs.MachineId.Equals(ConfigurationManager.AppSettings["machineId"] ?? "DM1")).GroupBy(cs => cs.DrugId), (oi, od, t) => od.DrugId == t.DrugId)
 | 
			
		||||
                .WhereIF(OrderDate != null, oi => oi.OrderDate.ToString("yyyy-MM-dd") == OrderDate)
 | 
			
		||||
                .WhereIF(OrderDate != null, oi => oi.ChargeDate.ToString("yyyy-MM-dd") == OrderDate)
 | 
			
		||||
                .WhereIF(!(OrderDepartment.DeptName.Equals("全部")), oi => oi.DeptName == OrderDepartment.DeptName)
 | 
			
		||||
                //.WhereIF(!String.IsNullOrEmpty(SearchValue) && SelectedItem.Code.Equals("PatientId"), oi => oi.PatientId == SearchValue)
 | 
			
		||||
                .WhereIF(!String.IsNullOrEmpty(ConfigurationManager.AppSettings["storage"]), oi => oi.Pharmacy == ConfigurationManager.AppSettings["storage"])
 | 
			
		||||
                .Where(oi => oi.DmStatus == 0)
 | 
			
		||||
                .Where(oi => oi.HisDispFlag == 0)
 | 
			
		||||
                .Where(oi => oi.CancelFlag == 0)
 | 
			
		||||
                .GroupBy(oi => oi.OrderDate)
 | 
			
		||||
                .GroupBy(oi => oi.OrderNo)
 | 
			
		||||
                .Select(oi => oi)
 | 
			
		||||
                .ToPageList(PageNum, PageSize, ref totalCount);
 | 
			
		||||
            //.ToList();
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -283,7 +283,7 @@ namespace DM_Weight.ViewModels
 | 
			
		|||
        // 完成按钮
 | 
			
		||||
        public DelegateCommand TakeFinish
 | 
			
		||||
        {
 | 
			
		||||
            get => new DelegateCommand(() =>
 | 
			
		||||
            get => new DelegateCommand(async() =>
 | 
			
		||||
            {
 | 
			
		||||
                if (!_isFinishClick)
 | 
			
		||||
                {
 | 
			
		||||
| 
						 | 
				
			
			@ -297,7 +297,7 @@ namespace DM_Weight.ViewModels
 | 
			
		|||
                    {
 | 
			
		||||
                        SqlSugarHelper.Db.Updateable(new OrderInfo()
 | 
			
		||||
                        {
 | 
			
		||||
                            DmStatus = 2,
 | 
			
		||||
                            DmStatus = 0,
 | 
			
		||||
                            OrderNo = OrderInfo.OrderNo
 | 
			
		||||
                        }).UpdateColumns(it => new { it.DmStatus }).WhereColumns(it => new { it.OrderNo }).ExecuteCommand();
 | 
			
		||||
                        for (int i = 0; i < record.Count; i++)
 | 
			
		||||
| 
						 | 
				
			
			@ -334,9 +334,104 @@ namespace DM_Weight.ViewModels
 | 
			
		|||
                                //Quantity = it.TakeQuantity,
 | 
			
		||||
                                Quantity = it.ReturnQuantity,
 | 
			
		||||
                                Type = 31,
 | 
			
		||||
                                InvoiceId = InvoiceId,
 | 
			
		||||
                                StockQuantity = nowChannels.Sum(it => it.Quantity)
 | 
			
		||||
                                InvoiceId = InvoiceId
 | 
			
		||||
                                //,StockQuantity = nowChannels.Sum(it => it.Quantity)
 | 
			
		||||
                            }).ExecuteCommand();
 | 
			
		||||
 | 
			
		||||
                            //保存账册
 | 
			
		||||
                            SqlSugarHelper.Db.Insertable(new AccountBookG2()
 | 
			
		||||
                            {
 | 
			
		||||
                                DrugId = it.DrugId,
 | 
			
		||||
                                Type = 1,
 | 
			
		||||
                                Department = ConfigurationManager.AppSettings["department"].ToString(),
 | 
			
		||||
                                InvoiceNo = InvoiceId,
 | 
			
		||||
                                ManuNo = it.ManuNo,
 | 
			
		||||
                                EffDate = it.EffDate,
 | 
			
		||||
                                AddQuantity = it.ReturnQuantity,
 | 
			
		||||
                                UserId1 = HomeWindowViewModel.Operator?.Id,
 | 
			
		||||
                                UserId2 = HomeWindowViewModel.Reviewer?.Id,
 | 
			
		||||
                                MachineId = ConfigurationManager.AppSettings["machineId"].ToString(),
 | 
			
		||||
                                CreateDate = DateTime.Now.ToString("yyyy-MM-dd"),
 | 
			
		||||
                                CreateTime = DateTime.Now,
 | 
			
		||||
                                ManuStock=nowChannels.Where(itx => itx.ManuNo == it.ManuNo && itx.EffDate == it.EffDate).Sum(itx => itx.Quantity),
 | 
			
		||||
                                TotalStock=nowChannels.Sum(itx=>itx.Quantity),
 | 
			
		||||
 | 
			
		||||
                            }).ExecuteCommand();
 | 
			
		||||
                            //修改凌晨生成的日结存数据
 | 
			
		||||
                            AccountBookG2 accountBookG2Day = SqlSugarHelper.Db.Queryable<AccountBookG2>()
 | 
			
		||||
                            .Where(ab => ab.MachineId.Equals(it.MachineId))
 | 
			
		||||
                            .Where(ab => ab.Type == 3)
 | 
			
		||||
                            .Where(ab => ab.DrugId == it.DrugId)
 | 
			
		||||
                            .Where(ab => ab.ManuNo == it.ManuNo)
 | 
			
		||||
                            .Where(ab => ab.CreateDate == DateTime.Now.ToString("yyyy-MM-dd")).First();
 | 
			
		||||
                            if (accountBookG2Day != null)
 | 
			
		||||
                            {
 | 
			
		||||
                                accountBookG2Day.AddQuantity = accountBookG2Day.AddQuantity + it.ReturnQuantity;
 | 
			
		||||
                                accountBookG2Day.ManuStock = nowChannels.Where(itx => itx.ManuNo == it.ManuNo && itx.EffDate == it.EffDate).Sum(itx => itx.Quantity);
 | 
			
		||||
                                accountBookG2Day.TotalStock = nowChannels.Sum(itx=>itx.Quantity);
 | 
			
		||||
                                SqlSugarHelper.Db.Updateable(accountBookG2Day).ExecuteCommand();
 | 
			
		||||
                            }
 | 
			
		||||
                            else
 | 
			
		||||
                            {
 | 
			
		||||
                                //生成日结存时可能没有该库位的绑定信息,需要写入日结存
 | 
			
		||||
                                int iDayResult = SqlSugarHelper.Db.Insertable(new AccountBookG2()
 | 
			
		||||
                                {
 | 
			
		||||
                                    DrugId = it.DrugId,
 | 
			
		||||
                                    Type = 3,
 | 
			
		||||
                                    ManuNo = it.ManuNo,
 | 
			
		||||
                                    EffDate = it.EffDate,
 | 
			
		||||
                                    YQuantity = 0,
 | 
			
		||||
                                    UserId1 = HomeWindowViewModel.Operator?.Id,
 | 
			
		||||
                                    UserId2 = HomeWindowViewModel.Reviewer?.Id,
 | 
			
		||||
                                    MachineId = ConfigurationManager.AppSettings["machineId"].ToString(),
 | 
			
		||||
                                    CreateDate = DateTime.Now.ToString("yyyy-MM-dd"),
 | 
			
		||||
                                    InvoiceNo = "日结存",
 | 
			
		||||
                                    Department = ConfigurationManager.AppSettings["department"].ToString(),
 | 
			
		||||
                                    AddQuantity = it.ReturnQuantity,
 | 
			
		||||
                                    ManuStock = nowChannels.Where(itx => itx.ManuNo == it.ManuNo && itx.EffDate == it.EffDate).Sum(itx => itx.Quantity),
 | 
			
		||||
                                    TotalStock = nowChannels.Sum(itx=>itx.Quantity),
 | 
			
		||||
                                }).ExecuteCommand();
 | 
			
		||||
                                if (iDayResult <= 0)
 | 
			
		||||
                                {
 | 
			
		||||
                                    logger.Info($"未写入日结存数据{it.DrugId}-{it.ManuNo}-{it.EffDate}-{it.AddQuantity}");
 | 
			
		||||
                                }
 | 
			
		||||
                            }
 | 
			
		||||
                            //修改凌晨生成的总结存数据
 | 
			
		||||
                            AccountBookG2 accountBookG2Total = SqlSugarHelper.Db.Queryable<AccountBookG2>()
 | 
			
		||||
                            .Where(ab => ab.MachineId.Equals(it.MachineId))
 | 
			
		||||
                            .Where(ab => ab.Type == 4)
 | 
			
		||||
                            .Where(ab => ab.DrugId == it.DrugId)
 | 
			
		||||
                            .Where(ab => ab.CreateDate == DateTime.Now.ToString("yyyy-MM-dd")).First();
 | 
			
		||||
                            if (accountBookG2Total != null)
 | 
			
		||||
                            {
 | 
			
		||||
                                accountBookG2Total.AddQuantity = accountBookG2Total.AddQuantity + it.ReturnQuantity;
 | 
			
		||||
                                accountBookG2Total.ManuStock=nowChannels.Where(itx => itx.ManuNo == it.ManuNo && itx.EffDate == it.EffDate).Sum(itx => itx.Quantity);
 | 
			
		||||
                                accountBookG2Total.TotalStock = nowChannels.Sum(itx => itx.Quantity);
 | 
			
		||||
                                SqlSugarHelper.Db.Updateable(accountBookG2Total).ExecuteCommand();
 | 
			
		||||
                            }
 | 
			
		||||
                            else
 | 
			
		||||
                            {
 | 
			
		||||
                                //生成总结存时可能没有该库位的绑定信息,需要写入总结存
 | 
			
		||||
                                int iTotalResult = SqlSugarHelper.Db.Insertable(new AccountBookG2()
 | 
			
		||||
                                {
 | 
			
		||||
                                    DrugId = it.DrugId,
 | 
			
		||||
                                    Type = 4,
 | 
			
		||||
                                    YQuantity = 0,
 | 
			
		||||
                                    UserId1 = HomeWindowViewModel.Operator?.Id,
 | 
			
		||||
                                    UserId2 = HomeWindowViewModel.Reviewer?.Id,
 | 
			
		||||
                                    MachineId = ConfigurationManager.AppSettings["machineId"].ToString(),
 | 
			
		||||
                                    CreateDate = DateTime.Now.ToString("yyyy-MM-dd"),
 | 
			
		||||
                                    InvoiceNo = "总结存",
 | 
			
		||||
                                    Department = ConfigurationManager.AppSettings["department"].ToString(),
 | 
			
		||||
                                    AddQuantity=it.ReturnQuantity,
 | 
			
		||||
                                    ManuStock = nowChannels.Where(itx => itx.ManuNo == it.ManuNo && itx.EffDate == it.EffDate).Sum(itx => itx.Quantity),
 | 
			
		||||
                                    TotalStock = nowChannels.Sum(itx => itx.Quantity),
 | 
			
		||||
                                }).ExecuteCommand();
 | 
			
		||||
                                if (iTotalResult <= 0)
 | 
			
		||||
                                {
 | 
			
		||||
                                    logger.Info($"未写入总结存数据{it.DrugId}-{it.AddQuantity}");
 | 
			
		||||
                                }
 | 
			
		||||
                            }
 | 
			
		||||
                        }
 | 
			
		||||
                        return true;
 | 
			
		||||
                    });
 | 
			
		||||
| 
						 | 
				
			
			@ -351,6 +446,16 @@ namespace DM_Weight.ViewModels
 | 
			
		|||
                                _portUtil.WriteQuantity(it.DrawerNo, it.ColNo, it.Quantity + it.TakeQuantity);
 | 
			
		||||
                            });
 | 
			
		||||
                        }
 | 
			
		||||
                        if ((singleChannels.Count > 0 ? singleChannels[0].BoardType : 1) == 35)
 | 
			
		||||
                        {
 | 
			
		||||
                            for (int i = 0; i < singleChannels.Count; i++)
 | 
			
		||||
                            {
 | 
			
		||||
                                await Task.Delay(200);
 | 
			
		||||
                                await _portUtil.WriteChannelInfoMethod(2, (singleChannels[i].Quantity + singleChannels[i].TakeQuantity).ToString(), singleChannels[i].DrawerNo, singleChannels[i].ColNo);
 | 
			
		||||
                                await Task.Delay(200);
 | 
			
		||||
                                await _portUtil.ShowContentMethod(singleChannels[i].DrawerNo, singleChannels[i].ColNo);
 | 
			
		||||
                            }
 | 
			
		||||
                        }
 | 
			
		||||
                        AlertMsg alertMsg = new AlertMsg
 | 
			
		||||
                        {
 | 
			
		||||
                            Message = "处方退药完成,库存已更新",
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -21,7 +21,7 @@ using DM_Weight.Port;
 | 
			
		|||
using DM_Weight.select;
 | 
			
		||||
using DM_Weight.util;
 | 
			
		||||
using System.Threading;
 | 
			
		||||
using System.Windows.Markup;
 | 
			
		||||
using DM_Weight.HIKVISION;
 | 
			
		||||
 | 
			
		||||
namespace DM_Weight.ViewModels
 | 
			
		||||
{
 | 
			
		||||
| 
						 | 
				
			
			@ -59,8 +59,6 @@ namespace DM_Weight.ViewModels
 | 
			
		|||
                {
 | 
			
		||||
                    // 抽屉打开
 | 
			
		||||
                    case EventType.DRAWEROPEN:
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
                        if (Status == 1)
 | 
			
		||||
                        {
 | 
			
		||||
                            if (channelStocks[0].process == 1)
 | 
			
		||||
| 
						 | 
				
			
			@ -167,7 +165,6 @@ namespace DM_Weight.ViewModels
 | 
			
		|||
            OrderInfo = o;
 | 
			
		||||
            RequestData();
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public async void RequestData()
 | 
			
		||||
        {
 | 
			
		||||
            orderDetails = SqlSugarHelper.Db.Queryable<OrderDetail>()
 | 
			
		||||
| 
						 | 
				
			
			@ -187,7 +184,7 @@ namespace DM_Weight.ViewModels
 | 
			
		|||
                    .Where(cs => cs.Quantity > 0)
 | 
			
		||||
                    .Where(cs => cs.DrawerType == 1)
 | 
			
		||||
                    .Where(cs => cs.MachineId.Equals(ConfigurationManager.AppSettings["machineId"] ?? "DM1"))
 | 
			
		||||
                    .WhereIF(!string.IsNullOrEmpty(orderDetail.SetEffDate), cs => cs.EffDate.Equals(orderDetail.SetEffDate))
 | 
			
		||||
                    .WhereIF(!string.IsNullOrEmpty(orderDetail.SetEffDate), cs => cs.EffDate.Equals(orderDetail.SetEffDate.Substring(0,10)))
 | 
			
		||||
                    .WhereIF(!string.IsNullOrEmpty(orderDetail.SetManuNo), cs => cs.ManuNo.Equals(orderDetail.SetManuNo))
 | 
			
		||||
                    .Where(cs => cs.DrugId == orderDetail.DrugId)
 | 
			
		||||
                    .OrderBy(cs => cs.EffDate)
 | 
			
		||||
| 
						 | 
				
			
			@ -259,314 +256,7 @@ namespace DM_Weight.ViewModels
 | 
			
		|||
 | 
			
		||||
            });
 | 
			
		||||
        }
 | 
			
		||||
        public DelegateCommand OpenDrawer_New
 | 
			
		||||
        {
 | 
			
		||||
            get => new DelegateCommand(async () =>
 | 
			
		||||
            {
 | 
			
		||||
                OpenDrawerAction();
 | 
			
		||||
 | 
			
		||||
            });
 | 
			
		||||
        }
 | 
			
		||||
        async Task OpenDrawerAction()
 | 
			
		||||
        {
 | 
			
		||||
            this.Status = 1;
 | 
			
		||||
            // 解析需要打开的抽屉列表
 | 
			
		||||
            //List<OrderTakeVo> drawerNos = this.data.GroupBy(it => it.ChannelStock.DrawerNo).Select(it => it.First()).ToList();
 | 
			
		||||
 | 
			
		||||
            // 根据抽屉类型来决定打开前是否需要查询数量
 | 
			
		||||
            var promiseUtil = new PromiseUtil<int>();
 | 
			
		||||
            enumerable = ChannelStocks.GroupBy(cs => cs.DrawerNo, cs => cs);
 | 
			
		||||
            enumerator = enumerable.GetEnumerator();
 | 
			
		||||
 | 
			
		||||
            _portUtil.WindowName = "OrderTakeDrugWindow";
 | 
			
		||||
            _portUtil.BoardType = ChannelStocks.Count > 0 ? ChannelStocks[0].BoardType : 1;
 | 
			
		||||
            _portUtil.ColNos = ChannelStocks.Select(it => it.ColNo).ToArray();
 | 
			
		||||
            enumerator.MoveNext();
 | 
			
		||||
 | 
			
		||||
            await promiseUtil.taskAsyncLoop(500, 0, async (options, next, stop) =>
 | 
			
		||||
            {
 | 
			
		||||
                //var orderTakeVo = drawerNos[options._data];
 | 
			
		||||
                //orderTakeVo.ChannelStock.DrawerNo;
 | 
			
		||||
                IGrouping<int, ChannelStock> groupingStock = enumerator.Current;
 | 
			
		||||
                var drawerNo = groupingStock.Key;
 | 
			
		||||
                _portUtil.DrawerNo = groupingStock.Key;
 | 
			
		||||
                int[] BeforeQuantity = new int[] { };
 | 
			
		||||
                List<ChannelStock> channelStocks = groupingStock.ToList();
 | 
			
		||||
                try
 | 
			
		||||
                {
 | 
			
		||||
                    if (this.Status == 0)
 | 
			
		||||
                    {
 | 
			
		||||
                        stop();
 | 
			
		||||
                    }
 | 
			
		||||
                    // 开启抽屉
 | 
			
		||||
                    else if (this.Status == 1)
 | 
			
		||||
                    {
 | 
			
		||||
                        // 储物箱直接开
 | 
			
		||||
                        if (channelStocks[0].BoardType == 4)
 | 
			
		||||
                        {
 | 
			
		||||
                            if (channelStocks[0].DrawerState == 0)
 | 
			
		||||
                            {
 | 
			
		||||
                                byte[] resultOpen = await _portUtil.OpenStorage();
 | 
			
		||||
 | 
			
		||||
                                int[] rOpen = resultOpen.Select(it => Convert.ToInt32(it)).ToArray();
 | 
			
		||||
                                if (rOpen[4] != 0)
 | 
			
		||||
                                {
 | 
			
		||||
                                    logger.Info($"储物箱使能成功");
 | 
			
		||||
                                    channelStocks[0].DrawerState = 1;
 | 
			
		||||
                                    next();
 | 
			
		||||
                                }
 | 
			
		||||
                                else
 | 
			
		||||
                                {
 | 
			
		||||
                                    string _WindowName = "OrderTakeDialog";
 | 
			
		||||
                                    // 重新初始化数据
 | 
			
		||||
                                    _portUtil.ResetData();
 | 
			
		||||
                                    // 指令发送错误,未打开
 | 
			
		||||
                                    // 返回消息  抽屉打开失败
 | 
			
		||||
                                    _eventAggregator.GetEvent<PortUtilEvent>().Publish(new util.DeviceMsg()
 | 
			
		||||
                                    {
 | 
			
		||||
                                        EventType = util.EventType.OPENERROR,
 | 
			
		||||
                                        WindowName = "OrderTakeDialog",
 | 
			
		||||
                                        Message = "储物箱使能失败"
 | 
			
		||||
                                    });
 | 
			
		||||
                                    logger.Info($"储物箱使能失败");
 | 
			
		||||
                                    stop();
 | 
			
		||||
                                }
 | 
			
		||||
 | 
			
		||||
                            }
 | 
			
		||||
                            if (channelStocks[0].DrawerState == 1)
 | 
			
		||||
                            {
 | 
			
		||||
                                // 查询锁状态
 | 
			
		||||
                                byte[] resultBackDoor = await _portUtil.BackDoorState();
 | 
			
		||||
 | 
			
		||||
                                int[] rBackDoor = resultBackDoor.Select(it => Convert.ToInt32(it)).ToArray();
 | 
			
		||||
                                int[] lockStates = _portUtil.CheckStorageStatus(rBackDoor.Skip(3).Take(2).ToArray());
 | 
			
		||||
                                int[] lightStates = _portUtil.CheckStorageStatus(rBackDoor.Skip(5).Take(2).ToArray());
 | 
			
		||||
                                // 锁处于关闭状态
 | 
			
		||||
                                if (lockStates[Convert.ToInt32(ConfigurationManager.AppSettings["StorageBoxAddr"]) - 1] == 0)
 | 
			
		||||
                                {
 | 
			
		||||
                                    // 锁还未打开过
 | 
			
		||||
                                    if (_portUtil.statue == 0)
 | 
			
		||||
                                    {
 | 
			
		||||
                                        // 指示灯不闪烁了,说明规定时间内没有开锁,需要给前台提示
 | 
			
		||||
                                        if (lightStates[Convert.ToInt32(ConfigurationManager.AppSettings["StorageBoxAddr"]) - 1] == 0)
 | 
			
		||||
                                        {
 | 
			
		||||
                                            // 打开失败
 | 
			
		||||
                                            logger.Info($"储物箱指示灯不闪烁,使能过期");
 | 
			
		||||
                                            enumerator.MoveNext();
 | 
			
		||||
                                            next();
 | 
			
		||||
                                        }
 | 
			
		||||
                                        else
 | 
			
		||||
                                        {
 | 
			
		||||
                                            channelStocks[0].DrawerState = 1;
 | 
			
		||||
                                            next();
 | 
			
		||||
                                        }
 | 
			
		||||
                                    }
 | 
			
		||||
                                    else if (_portUtil.statue == 1)
 | 
			
		||||
                                    {
 | 
			
		||||
 | 
			
		||||
                                        // 锁是打开状态现在关闭了,说明操作完成了,告诉前台锁已关闭
 | 
			
		||||
                                        _portUtil.statue = 2;
 | 
			
		||||
                                        logger.Info($"储物箱关闭");
 | 
			
		||||
                                        if (options._data == (enumerable.Count() - 1))
 | 
			
		||||
                                        {
 | 
			
		||||
                                            _portUtil.SpeakAsync($"取药完成,请,点击完成按钮进行确认");
 | 
			
		||||
                                            this.Status = 3;
 | 
			
		||||
                                            channelStocks[0].DrawerState = 0;
 | 
			
		||||
                                            stop();
 | 
			
		||||
                                        }
 | 
			
		||||
                                        else
 | 
			
		||||
                                        {
 | 
			
		||||
                                            channelStocks[0].DrawerState = 0;
 | 
			
		||||
                                            enumerator.MoveNext();
 | 
			
		||||
                                            next();
 | 
			
		||||
                                        }
 | 
			
		||||
                                    }
 | 
			
		||||
                                }
 | 
			
		||||
                            }
 | 
			
		||||
                        }
 | 
			
		||||
                        // 外置抽屉
 | 
			
		||||
                        else
 | 
			
		||||
                        {
 | 
			
		||||
                            if (channelStocks[0].DrawerType == 3)
 | 
			
		||||
                            {
 | 
			
		||||
                                if (channelStocks[0].BoardType == 2)
 | 
			
		||||
                                {
 | 
			
		||||
                                    if (channelStocks[0].DrawerState == 0)
 | 
			
		||||
                                    {
 | 
			
		||||
                                        byte[] buffer = await _portUtil.OpenRecover();
 | 
			
		||||
                                        int[] r = buffer.Select(it => Convert.ToInt32(it)).ToArray();
 | 
			
		||||
                                        if ((_portUtil.ColNos[0] > 3 && r[4] == 1) || (_portUtil.ColNos[0] < 4 && r[3] == 1))
 | 
			
		||||
                                        {
 | 
			
		||||
                                            logger.Info($"回收箱打开成功");
 | 
			
		||||
                                            channelStocks[0].DrawerState = 1;
 | 
			
		||||
                                            next();
 | 
			
		||||
                                        }
 | 
			
		||||
                                        else
 | 
			
		||||
                                        {
 | 
			
		||||
                                            logger.Info($"回收箱打开失败");
 | 
			
		||||
                                            stop();
 | 
			
		||||
                                        }
 | 
			
		||||
 | 
			
		||||
                                    }
 | 
			
		||||
                                    if(channelStocks[0].DrawerState == 1)
 | 
			
		||||
                                    {
 | 
			
		||||
                                        // 查询是否关闭状态
 | 
			
		||||
                                        byte[] buffer = await _portUtil.CheckRecoverStatus();
 | 
			
		||||
                                        int[] r = buffer.Select(it => Convert.ToInt32(it)).ToArray();
 | 
			
		||||
 | 
			
		||||
                                        logger.Info($"GeRecoverStatus{string.Join(",", r)}");
 | 
			
		||||
 | 
			
		||||
                                        // 回收箱关闭成功
 | 
			
		||||
                                        if ((_portUtil.ColNos[0] > 3 && r[4] == 0) || (_portUtil.ColNos[0] < 4 && r[3] == 0))
 | 
			
		||||
                                        {
 | 
			
		||||
                                            logger.Info($"回收箱关闭");
 | 
			
		||||
                                            // 查询数量
 | 
			
		||||
                                            byte[] bytes = await _portUtil.CheckRecoverQuantity();
 | 
			
		||||
 | 
			
		||||
                                            int[] r1 = bytes.Select(it => Convert.ToInt32(it)).ToArray();
 | 
			
		||||
                                            // 返回消息库位关闭,放入空瓶数量
 | 
			
		||||
                                            int[] quantitys = r1.Skip(3).Take(3).ToArray();
 | 
			
		||||
                                            int index = _portUtil.ColNos[0] % 3 > 0 ? _portUtil.ColNos[0] % 3 - 1 : 2;
 | 
			
		||||
 | 
			
		||||
                                            // 指定库位放入的药品数量
 | 
			
		||||
                                            int InCount = quantitys[index];
 | 
			
		||||
                                            logger.Info($"回收板数量变化【{string.Join(",", quantitys)}】");
 | 
			
		||||
 | 
			
		||||
                                            enumerator.MoveNext();
 | 
			
		||||
                                            next();
 | 
			
		||||
                                        }
 | 
			
		||||
                                        else
 | 
			
		||||
                                        {
 | 
			
		||||
                                            // 查询是否关闭状态
 | 
			
		||||
                                            await Task.Delay(200);
 | 
			
		||||
                                            next();
 | 
			
		||||
                                        }
 | 
			
		||||
                                    }
 | 
			
		||||
                                }
 | 
			
		||||
                            }
 | 
			
		||||
                            else
 | 
			
		||||
                            {
 | 
			
		||||
                                if (channelStocks[0].DrawerState == 0)
 | 
			
		||||
                                {
 | 
			
		||||
                                    // 判断是否为单支抽屉
 | 
			
		||||
                                    if (channelStocks[0].BoardType == 2)
 | 
			
		||||
                                    {
 | 
			
		||||
                                        byte[] quantity = await _portUtil.CheckQuantityByDrawer();
 | 
			
		||||
                                        BeforeQuantity = quantity.Select(it => Convert.ToInt32(it)).ToArray().Skip(3).Take(9).ToArray();
 | 
			
		||||
                                        logger.Info($"单支抽屉,开抽屉前检测数量【{string.Join(",", BeforeQuantity)}】");
 | 
			
		||||
 | 
			
		||||
                                        await _portUtil.HasLightOnByCol();
 | 
			
		||||
                                    }
 | 
			
		||||
                                    // 药盒
 | 
			
		||||
                                    if (channelStocks[0].BoardType == 3)
 | 
			
		||||
                                    {
 | 
			
		||||
                                        // 药盒指示灯使能
 | 
			
		||||
                                        await _portUtil.BoxLockLightOn();
 | 
			
		||||
                                    }
 | 
			
		||||
                                    if (channelStocks[0].BoardType == 6)
 | 
			
		||||
                                    {
 | 
			
		||||
                                        // 药盒指示灯使能
 | 
			
		||||
                                        await _portUtil.BoxLockLightOn2();
 | 
			
		||||
                                    }
 | 
			
		||||
                                    byte[] buffer = await _portUtil.OpenDrawer();
 | 
			
		||||
                                    int[] r = buffer.Select(it => Convert.ToInt32(it)).ToArray();
 | 
			
		||||
 | 
			
		||||
                                    logger.Info($"OpenDrawer{string.Join(",", r)}");
 | 
			
		||||
                                    if (_portUtil.DrawerState(r))
 | 
			
		||||
                                    {
 | 
			
		||||
                                        _portUtil.SpeakAsync($"{drawerNo}号抽屉已经打开,请,取药");
 | 
			
		||||
                                        channelStocks[0].DrawerState = 1;
 | 
			
		||||
                                        next();
 | 
			
		||||
                                    }
 | 
			
		||||
                                    else
 | 
			
		||||
                                    {
 | 
			
		||||
                                        AlertMsg alertMsg = new AlertMsg
 | 
			
		||||
                                        {
 | 
			
		||||
                                            Message = $"抽屉【{drawerNo}】打开失败,请检测硬件",
 | 
			
		||||
                                            Type = MsgType.ERROR,
 | 
			
		||||
                                        };
 | 
			
		||||
                                        _eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
 | 
			
		||||
 | 
			
		||||
                                        logger.Info($"抽屉打开失败");
 | 
			
		||||
                                        _portUtil.ResetData();
 | 
			
		||||
                                        stop();
 | 
			
		||||
                                    }
 | 
			
		||||
                                }
 | 
			
		||||
                                // 检测状态
 | 
			
		||||
                                else if (channelStocks[0].DrawerState == 1)
 | 
			
		||||
                                {
 | 
			
		||||
                                    // 查询抽屉是否为关闭状态
 | 
			
		||||
                                    byte[] buffer = await _portUtil.CheckDrawerStatus();
 | 
			
		||||
 | 
			
		||||
                                    int[] r = buffer.Select(it => Convert.ToInt32(it)).ToArray();
 | 
			
		||||
 | 
			
		||||
                                    logger.Info($"GetDrawerStatus{string.Join(",", r)}");
 | 
			
		||||
                                    // 抽屉没有关闭
 | 
			
		||||
                                    if (_portUtil.DrawerState(r))
 | 
			
		||||
                                    {
 | 
			
		||||
                                        if (channelStocks[0].BoardType == 2)
 | 
			
		||||
                                        {
 | 
			
		||||
                                            byte[] quantity = await _portUtil.CheckQuantityByDrawer();
 | 
			
		||||
                                            int[] AfterQuantity = quantity.Select(it => Convert.ToInt32(it)).ToArray().Skip(3).Take(9).ToArray();
 | 
			
		||||
                                            logger.Info($"AfterQuantity{string.Join(",", AfterQuantity)}");
 | 
			
		||||
                                            logger.Info($"单支抽屉,抽屉未关检测数量【{string.Join(",", AfterQuantity)}】");
 | 
			
		||||
 | 
			
		||||
                                            ChannelStocks.ForEach(cl =>
 | 
			
		||||
                                            {
 | 
			
		||||
                                                if (cl.DrawerNo == drawerNo)
 | 
			
		||||
                                                {
 | 
			
		||||
                                                    logger.Info($"单支抽屉【{drawerNo}】,应取药品数量【{cl.Quantity}】,现实取数量【{BeforeQuantity[cl.ColNo - 1] - AfterQuantity[cl.ColNo - 1]}】");
 | 
			
		||||
                                                }
 | 
			
		||||
 | 
			
		||||
                                            });
 | 
			
		||||
                                        }
 | 
			
		||||
                                        next(); // continue iteration
 | 
			
		||||
                                    }
 | 
			
		||||
                                    else
 | 
			
		||||
                                    {
 | 
			
		||||
                                        ChannelStocks.ForEach(cl =>
 | 
			
		||||
                                        {
 | 
			
		||||
                                            if (cl.DrawerNo == drawerNo)
 | 
			
		||||
                                            {
 | 
			
		||||
                                                cl.TakeQuantity = cl.Quantity;
 | 
			
		||||
 | 
			
		||||
                                            }
 | 
			
		||||
                                        });
 | 
			
		||||
                                        channelStocks[0].DrawerState = 2;
 | 
			
		||||
                                        if (options._data == (enumerable.Count() - 1))
 | 
			
		||||
                                        {
 | 
			
		||||
                                            _portUtil.SpeakAsync($"取药完成,请,点击完成按钮进行确认");
 | 
			
		||||
                                            this.Status = 3;
 | 
			
		||||
                                            channelStocks[0].DrawerState = 0;
 | 
			
		||||
                                            stop();
 | 
			
		||||
                                        }
 | 
			
		||||
                                        else
 | 
			
		||||
                                        {
 | 
			
		||||
                                            options._data += 1;
 | 
			
		||||
                                            channelStocks[0].DrawerState = 0;
 | 
			
		||||
                                            enumerator.MoveNext();
 | 
			
		||||
                                            next();
 | 
			
		||||
                                        }
 | 
			
		||||
                                    }
 | 
			
		||||
                                }
 | 
			
		||||
                            }
 | 
			
		||||
                        }
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
                catch (Exception e)
 | 
			
		||||
                {
 | 
			
		||||
                    //_portUtil.ResetData();
 | 
			
		||||
                    logger.Info($"处方取药发生错误,{e.Message}"); AlertMsg alertMsg = new AlertMsg
 | 
			
		||||
                    {
 | 
			
		||||
                        Message = $"处方取药发生错误{e.Message}",
 | 
			
		||||
                        Type = MsgType.ERROR,
 | 
			
		||||
                    };
 | 
			
		||||
                    _eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
 | 
			
		||||
 | 
			
		||||
                    stop();
 | 
			
		||||
                }
 | 
			
		||||
            });
 | 
			
		||||
        }
 | 
			
		||||
        private void OpenOneByOne()
 | 
			
		||||
        {
 | 
			
		||||
            IGrouping<int, ChannelStock> grouping = enumerator.Current;
 | 
			
		||||
| 
						 | 
				
			
			@ -608,7 +298,7 @@ namespace DM_Weight.ViewModels
 | 
			
		|||
        // 完成按钮
 | 
			
		||||
        public DelegateCommand TakeFinish
 | 
			
		||||
        {
 | 
			
		||||
            get => new DelegateCommand(() =>
 | 
			
		||||
            get => new DelegateCommand(async() =>
 | 
			
		||||
            {
 | 
			
		||||
                if (!_isFinishClick)
 | 
			
		||||
                {
 | 
			
		||||
| 
						 | 
				
			
			@ -666,9 +356,106 @@ namespace DM_Weight.ViewModels
 | 
			
		|||
                                    OperationTime = DateTime.Now,
 | 
			
		||||
                                    Quantity = it.TakeQuantity,
 | 
			
		||||
                                    Type = 2,
 | 
			
		||||
                                    InvoiceId = InvoiceId,
 | 
			
		||||
                                    StockQuantity = nowChannels.Sum(it => it.Quantity)
 | 
			
		||||
                                    InvoiceId = InvoiceId
 | 
			
		||||
                                    //, StockQuantity = nowChannels.Sum(it => it.Quantity)
 | 
			
		||||
                                }).ExecuteCommand();
 | 
			
		||||
 | 
			
		||||
                                //保存账册
 | 
			
		||||
                                int iInsertResult= SqlSugarHelper.Db.Insertable(new AccountBookG2() {
 | 
			
		||||
                                    DrugId = it.DrugId,
 | 
			
		||||
                                    Type= 2,
 | 
			
		||||
                                    Department= OrderInfo.DeptName,
 | 
			
		||||
                                    OrderNo=OrderInfo.OrderNo,
 | 
			
		||||
                                    ManuNo=it.ManuNo,
 | 
			
		||||
                                    EffDate=it.EffDate,
 | 
			
		||||
                                    OutQuantity=it.TakeQuantity,
 | 
			
		||||
                                    UserId1 = HomeWindowViewModel.Operator?.Id,
 | 
			
		||||
                                    UserId2 = HomeWindowViewModel.Reviewer?.Id,
 | 
			
		||||
                                    MachineId = ConfigurationManager.AppSettings["machineId"].ToString(),
 | 
			
		||||
                                    CreateDate=DateTime.Now.ToString("yyyy-MM-dd"),
 | 
			
		||||
                                    CreateTime = DateTime.Now,
 | 
			
		||||
                                    InvoiceNo=OrderInfo.OrderNo,
 | 
			
		||||
                                    ManuStock=nowChannels.Where(itx => itx.ManuNo == it.ManuNo && itx.EffDate == it.EffDate).Sum(itx => itx.Quantity),
 | 
			
		||||
                                    TotalStock=nowChannels.Sum(itx=>itx.Quantity)
 | 
			
		||||
 | 
			
		||||
                                }).ExecuteCommand();
 | 
			
		||||
                                //修改凌晨生成的日结存与总结存数据
 | 
			
		||||
                                AccountBookG2 accountBookG2Day= SqlSugarHelper.Db.Queryable<AccountBookG2>()
 | 
			
		||||
                                .Where(ab=>ab.MachineId.Equals(it.MachineId))
 | 
			
		||||
                                .Where(ab=>ab.Type==3)
 | 
			
		||||
                                .Where(ab=>ab.DrugId==it.DrugId)
 | 
			
		||||
                                .Where(ab=>ab.ManuNo==it.ManuNo)
 | 
			
		||||
                                .Where(ab=>ab.CreateDate==DateTime.Now.ToString("yyyy-MM-dd")).First();
 | 
			
		||||
                                if (accountBookG2Day != null)
 | 
			
		||||
                                {
 | 
			
		||||
                                    accountBookG2Day.OutQuantity = accountBookG2Day.OutQuantity + it.TakeQuantity;
 | 
			
		||||
                                    accountBookG2Day.ManuStock = nowChannels.Where(itx => itx.ManuNo == it.ManuNo && itx.EffDate == it.EffDate).Sum(itx => itx.Quantity);
 | 
			
		||||
                                    accountBookG2Day.TotalStock=nowChannels.Sum(itx => itx.Quantity);
 | 
			
		||||
                                    SqlSugarHelper.Db.Updateable(accountBookG2Day).ExecuteCommand();
 | 
			
		||||
                                }
 | 
			
		||||
                                else
 | 
			
		||||
                                {
 | 
			
		||||
                                    //生成日结存时可能没有该库位的绑定信息,需要写入日结存
 | 
			
		||||
                                    int iDayResult = SqlSugarHelper.Db.Insertable(new AccountBookG2()
 | 
			
		||||
                                    {
 | 
			
		||||
                                        DrugId = it.DrugId,
 | 
			
		||||
                                        Type = 3,
 | 
			
		||||
                                        ManuNo = it.ManuNo,
 | 
			
		||||
                                        EffDate = it.EffDate,
 | 
			
		||||
                                        YQuantity = 0,
 | 
			
		||||
                                        UserId1 = HomeWindowViewModel.Operator?.Id,
 | 
			
		||||
                                        UserId2 = HomeWindowViewModel.Reviewer?.Id,
 | 
			
		||||
                                        MachineId = ConfigurationManager.AppSettings["machineId"].ToString(),
 | 
			
		||||
                                        CreateDate = DateTime.Now.ToString("yyyy-MM-dd"),
 | 
			
		||||
                                        InvoiceNo = "日结存",
 | 
			
		||||
                                        Department=OrderInfo.DeptName,
 | 
			
		||||
                                        OutQuantity=it.TakeQuantity,
 | 
			
		||||
                                        ManuStock = nowChannels.Where(itx => itx.ManuNo == it.ManuNo && itx.EffDate == it.EffDate).Sum(itx => itx.Quantity),
 | 
			
		||||
                                        TotalStock = nowChannels.Sum(itx=>itx.Quantity),
 | 
			
		||||
 | 
			
		||||
                                    }).ExecuteCommand();
 | 
			
		||||
                                    if (iDayResult <= 0)
 | 
			
		||||
                                    {
 | 
			
		||||
                                        logger.Info($"未写入日结存数据{it.DrugId}-{it.ManuNo}-{it.EffDate}-{it.AddQuantity}");
 | 
			
		||||
                                    }
 | 
			
		||||
                                }
 | 
			
		||||
                                //修改凌晨生成的日结存与总结存数据
 | 
			
		||||
                                AccountBookG2 accountBookG2Total = SqlSugarHelper.Db.Queryable<AccountBookG2>()
 | 
			
		||||
                                .Where(ab => ab.MachineId.Equals(it.MachineId))
 | 
			
		||||
                                .Where(ab => ab.Type == 4)
 | 
			
		||||
                                .Where(ab=>ab.DrugId==it.DrugId)
 | 
			
		||||
                                .Where(ab => ab.CreateDate == DateTime.Now.ToString("yyyy-MM-dd")).First();
 | 
			
		||||
                                if (accountBookG2Total != null)
 | 
			
		||||
                                {
 | 
			
		||||
                                    accountBookG2Total.OutQuantity = accountBookG2Total.OutQuantity + it.TakeQuantity;
 | 
			
		||||
                                    accountBookG2Total.ManuStock = nowChannels.Where(itx => itx.ManuNo == it.ManuNo && itx.EffDate == it.EffDate).Sum(itx => itx.Quantity);
 | 
			
		||||
                                    accountBookG2Total.TotalStock = nowChannels.Sum(itx=>itx.Quantity);
 | 
			
		||||
                                    SqlSugarHelper.Db.Updateable(accountBookG2Total).ExecuteCommand();
 | 
			
		||||
                                }
 | 
			
		||||
                                else
 | 
			
		||||
                                {
 | 
			
		||||
                                    //生成总结存时可能没有该库位的绑定信息,需要写入总结存
 | 
			
		||||
                                    int iTotalResult = SqlSugarHelper.Db.Insertable(new AccountBookG2()
 | 
			
		||||
                                    {
 | 
			
		||||
                                        DrugId = it.DrugId,
 | 
			
		||||
                                        Type = 4,
 | 
			
		||||
                                        YQuantity = 0,
 | 
			
		||||
                                        UserId1 = HomeWindowViewModel.Operator?.Id,
 | 
			
		||||
                                        UserId2 = HomeWindowViewModel.Reviewer?.Id,
 | 
			
		||||
                                        MachineId = ConfigurationManager.AppSettings["machineId"].ToString(),
 | 
			
		||||
                                        CreateDate = DateTime.Now.ToString("yyyy-MM-dd"),
 | 
			
		||||
                                        InvoiceNo = "总结存",
 | 
			
		||||
                                        Department=OrderInfo.DeptName,
 | 
			
		||||
                                        OutQuantity = it.TakeQuantity,
 | 
			
		||||
                                        ManuStock = nowChannels.Where(itx => itx.ManuNo == it.ManuNo && itx.EffDate == it.EffDate).Sum(itx => itx.Quantity),
 | 
			
		||||
                                        TotalStock = nowChannels.Sum(itx=>itx.Quantity),
 | 
			
		||||
 | 
			
		||||
                                    }).ExecuteCommand();
 | 
			
		||||
                                    if (iTotalResult <= 0)
 | 
			
		||||
                                    {
 | 
			
		||||
                                        logger.Info($"未写入总结存数据{it.DrugId}-{it.AddQuantity}");
 | 
			
		||||
                                    }
 | 
			
		||||
                                }
 | 
			
		||||
                            }
 | 
			
		||||
                            return true;
 | 
			
		||||
                        });
 | 
			
		||||
| 
						 | 
				
			
			@ -676,13 +463,25 @@ namespace DM_Weight.ViewModels
 | 
			
		|||
                        {
 | 
			
		||||
                            // 更新屏显库存
 | 
			
		||||
                            List<ChannelStock> singleChannels = record.FindAll(it => it.BoardType != 1);
 | 
			
		||||
                            if ((singleChannels.Count > 0 ? singleChannels[0].BoardType : 1) == 5)
 | 
			
		||||
                            //if ((singleChannels.Count > 0 ? singleChannels[0].BoardType : 1) == 5)
 | 
			
		||||
                            if ((singleChannels.Count > 0 ? singleChannels[0].BoardType : 1).ToString().Contains("5"))
 | 
			
		||||
                            {
 | 
			
		||||
                                singleChannels.ForEach(it =>
 | 
			
		||||
                                {
 | 
			
		||||
                                    _portUtil.WriteQuantity(it.DrawerNo, it.ColNo, it.Quantity - it.TakeQuantity);
 | 
			
		||||
                                });
 | 
			
		||||
                            }
 | 
			
		||||
                            List<ChannelStock> singleChannelsBoxSmart = record.FindAll(it => it.BoardType == 35);
 | 
			
		||||
                            if ((singleChannelsBoxSmart.Count > 0 ? singleChannelsBoxSmart[0].BoardType : 1) == 35)
 | 
			
		||||
                            {
 | 
			
		||||
                                for (int i = 0; i < singleChannels.Count; i++)
 | 
			
		||||
                                {
 | 
			
		||||
                                    await Task.Delay(200);
 | 
			
		||||
                                    await _portUtil.WriteChannelInfoMethod(2, (singleChannels[i].Quantity - singleChannels[i].TakeQuantity).ToString(), singleChannels[i].DrawerNo, singleChannels[i].ColNo);
 | 
			
		||||
                                    await Task.Delay(200);
 | 
			
		||||
                                    await _portUtil.ShowContentMethod(singleChannels[i].DrawerNo, singleChannels[i].ColNo);
 | 
			
		||||
                                }
 | 
			
		||||
                            }
 | 
			
		||||
                            AlertMsg alertMsg = new AlertMsg
 | 
			
		||||
                            {
 | 
			
		||||
                                Message = "抽屉取药完成,库存已更新",
 | 
			
		||||
| 
						 | 
				
			
			@ -690,7 +489,7 @@ namespace DM_Weight.ViewModels
 | 
			
		|||
                            };
 | 
			
		||||
                            _eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
 | 
			
		||||
                        }
 | 
			
		||||
                        if (!f.IsSuccess)
 | 
			
		||||
                        if(!f.IsSuccess)
 | 
			
		||||
                        {
 | 
			
		||||
                            AlertMsg alertMsg = new AlertMsg
 | 
			
		||||
                            {
 | 
			
		||||
| 
						 | 
				
			
			@ -729,18 +528,9 @@ namespace DM_Weight.ViewModels
 | 
			
		|||
        public DelegateCommand CancleTake
 | 
			
		||||
        {
 | 
			
		||||
            get => new DelegateCommand(() =>
 | 
			
		||||
            {
 | 
			
		||||
                //Status = 0;
 | 
			
		||||
                //_portUtil.statue = 0;
 | 
			
		||||
                //_portUtil.ResetData();
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
                if (Status != 0)
 | 
			
		||||
            {
 | 
			
		||||
                _portUtil.ResetData();
 | 
			
		||||
                Status = 0;
 | 
			
		||||
                }
 | 
			
		||||
                RequestClose?.Invoke(new DialogResult(ButtonResult.Cancel));
 | 
			
		||||
            });
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -225,14 +225,15 @@ namespace DM_Weight.ViewModels
 | 
			
		|||
            List<OrderInfo> queryData = SqlSugarHelper.Db.Queryable<OrderInfo>()
 | 
			
		||||
                .InnerJoin<OrderDetail>((oi, od) => oi.OrderNo == od.OrderNo)
 | 
			
		||||
                .InnerJoin(SqlSugarHelper.Db.Queryable<ChannelStock>().Where(cs => cs.DrawerType == 1).Where(cs => cs.MachineId.Equals(ConfigurationManager.AppSettings["machineId"] ?? "DM1")).GroupBy(cs => cs.DrugId), (oi, od, t) => od.DrugId == t.DrugId)
 | 
			
		||||
                .WhereIF(OrderDate != null, oi => oi.OrderDate.ToString("yyyy-MM-dd") == OrderDate)
 | 
			
		||||
                .WhereIF(OrderDate != null, oi => oi.ChargeDate.ToString("yyyy-MM-dd") == OrderDate)
 | 
			
		||||
                .WhereIF(!String.IsNullOrEmpty(SearchValue) && SelectedItem.Code.Equals("OrderNo"), oi => oi.OrderNo == SearchValue)
 | 
			
		||||
                .WhereIF(!String.IsNullOrEmpty(SearchValue) && SelectedItem.Code.Equals("PatientId"), oi => oi.PatientId == SearchValue)
 | 
			
		||||
                .WhereIF(!String.IsNullOrEmpty(ConfigurationManager.AppSettings["storage"]), oi => oi.Pharmacy == ConfigurationManager.AppSettings["storage"])
 | 
			
		||||
                .Where(oi => oi.DmStatus == 0)
 | 
			
		||||
                .Where(oi => oi.HisDispFlag == 0)
 | 
			
		||||
                .Where(oi => oi.CancelFlag == 0)
 | 
			
		||||
                .GroupBy(oi => oi.OrderDate)
 | 
			
		||||
                .Where(oi=>oi.Pharmacy.Equals(ConfigurationManager.AppSettings["storage"] ?? ""))
 | 
			
		||||
                .GroupBy(oi => oi.OrderNo)
 | 
			
		||||
                .Select(oi => oi)
 | 
			
		||||
                .ToPageList(PageNum, PageSize, ref totalCount);
 | 
			
		||||
            //.ToList();
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -176,12 +176,12 @@ namespace DM_Weight.ViewModels
 | 
			
		|||
            List<ChannelStock> queryData = SqlSugarHelper.Db.Queryable<ChannelStock>()
 | 
			
		||||
                .Where(cs => cs.DrugId == MachineRecord.DrugId)
 | 
			
		||||
                .Where(cs => cs.MachineId.Equals(ConfigurationManager.AppSettings["machineId"] ?? "DM1"))
 | 
			
		||||
                .WhereIF(MachineRecord.ManuNo != null,cs => cs.ManuNo == MachineRecord.ManuNo)
 | 
			
		||||
                .WhereIF(MachineRecord.ManuNo != null, cs => cs.ManuNo == MachineRecord.ManuNo)
 | 
			
		||||
                .OrderBy(cs => cs.DrawerNo)
 | 
			
		||||
                .OrderBy(cs => cs.ColNo)
 | 
			
		||||
                .ToList();
 | 
			
		||||
            ChannelStocks = queryData;
 | 
			
		||||
            if(ChannelStocks.Count > 0)
 | 
			
		||||
            if (ChannelStocks.Count > 0)
 | 
			
		||||
            {
 | 
			
		||||
                ChannelStock = ChannelStocks[0];
 | 
			
		||||
            }
 | 
			
		||||
| 
						 | 
				
			
			@ -202,7 +202,8 @@ namespace DM_Weight.ViewModels
 | 
			
		|||
                    _portUtil.ColNos = new int[] { ChannelStock.ColNo };
 | 
			
		||||
                    _portUtil.DrawerNo = ChannelStock.DrawerNo;
 | 
			
		||||
                    _portUtil.Start();
 | 
			
		||||
                } else
 | 
			
		||||
                }
 | 
			
		||||
                else
 | 
			
		||||
                {
 | 
			
		||||
                    AlertMsg alertMsg = new AlertMsg
 | 
			
		||||
                    {
 | 
			
		||||
| 
						 | 
				
			
			@ -222,7 +223,7 @@ namespace DM_Weight.ViewModels
 | 
			
		|||
        // 完成按钮
 | 
			
		||||
        public DelegateCommand TakeFinish
 | 
			
		||||
        {
 | 
			
		||||
            get => new DelegateCommand(() =>
 | 
			
		||||
            get => new DelegateCommand(async() =>
 | 
			
		||||
            {
 | 
			
		||||
                IsFinishClick = true;
 | 
			
		||||
                string InvoiceId = "RETURN_" + CurrentTimeMillis();
 | 
			
		||||
| 
						 | 
				
			
			@ -264,9 +265,106 @@ namespace DM_Weight.ViewModels
 | 
			
		|||
                        Quantity = ReturnQuantity,
 | 
			
		||||
                        Type = 31,
 | 
			
		||||
                        InvoiceId = InvoiceId,
 | 
			
		||||
                            GetId = MachineRecord.Id,
 | 
			
		||||
                            StockQuantity = nowChannels.Sum(it => it.Quantity)
 | 
			
		||||
                        GetId = MachineRecord.Id
 | 
			
		||||
                        //,StockQuantity = nowChannels.Sum(it => it.Quantity)
 | 
			
		||||
                    }).ExecuteCommand();
 | 
			
		||||
 | 
			
		||||
                    //保存账册
 | 
			
		||||
                    SqlSugarHelper.Db.Insertable(new AccountBookG2()
 | 
			
		||||
                    {
 | 
			
		||||
                        DrugId = ChannelStock.DrugId,
 | 
			
		||||
                        Type = 1,
 | 
			
		||||
                        Department = ConfigurationManager.AppSettings["department"].ToString(),
 | 
			
		||||
                        InvoiceNo = InvoiceId,
 | 
			
		||||
                        ManuNo = ChannelStock.ManuNo,
 | 
			
		||||
                        EffDate = ChannelStock.EffDate,
 | 
			
		||||
                        AddQuantity = ReturnQuantity,
 | 
			
		||||
                        UserId1 = HomeWindowViewModel.Operator?.Id,
 | 
			
		||||
                        UserId2 = HomeWindowViewModel.Reviewer?.Id,
 | 
			
		||||
                        MachineId = ConfigurationManager.AppSettings["machineId"].ToString(),
 | 
			
		||||
                        CreateDate = DateTime.Now.ToString("yyyy-MM-dd"),
 | 
			
		||||
                        CreateTime = DateTime.Now,
 | 
			
		||||
                        TotalStock=nowChannels.Sum(itx=>itx.Quantity),
 | 
			
		||||
                        ManuStock=nowChannels.Where(itx => itx.ManuNo == ChannelStock.ManuNo && itx.EffDate == ChannelStock.EffDate).Sum(itx => itx.Quantity)
 | 
			
		||||
                    }).ExecuteCommand();
 | 
			
		||||
                    //修改凌晨生成的日结存数据
 | 
			
		||||
                    AccountBookG2 accountBookG2Day = SqlSugarHelper.Db.Queryable<AccountBookG2>()
 | 
			
		||||
                    .Where(ab => ab.MachineId.Equals(ChannelStock.MachineId))
 | 
			
		||||
                    .Where(ab => ab.Type == 3)
 | 
			
		||||
                    .Where(ab => ab.DrugId ==ChannelStock.DrugId)
 | 
			
		||||
                    .Where(ab => ab.ManuNo == ChannelStock.ManuNo)
 | 
			
		||||
                    .Where(ab => ab.CreateDate == DateTime.Now.ToString("yyyy-MM-dd")).First();
 | 
			
		||||
                    if (accountBookG2Day != null)
 | 
			
		||||
                    {
 | 
			
		||||
                        accountBookG2Day.AddQuantity = accountBookG2Day.AddQuantity + ChannelStock.ReturnQuantity;
 | 
			
		||||
                        accountBookG2Day.ManuStock = nowChannels.Where(itx => itx.ManuNo == ChannelStock.ManuNo && itx.EffDate == ChannelStock.EffDate).Sum(itx => itx.Quantity);
 | 
			
		||||
                        accountBookG2Day.TotalStock = nowChannels.Sum(itx => itx.Quantity);
 | 
			
		||||
                        SqlSugarHelper.Db.Updateable(accountBookG2Day).ExecuteCommand();
 | 
			
		||||
                    }
 | 
			
		||||
                    else
 | 
			
		||||
                    {
 | 
			
		||||
                        //生成日结存时可能没有该库位的绑定信息,需要写入日结存
 | 
			
		||||
                        int iDayResult = SqlSugarHelper.Db.Insertable(new AccountBookG2()
 | 
			
		||||
                        {
 | 
			
		||||
                            DrugId = ChannelStock.DrugId,
 | 
			
		||||
                            Type = 3,
 | 
			
		||||
                            ManuNo = ChannelStock.ManuNo,
 | 
			
		||||
                            EffDate = ChannelStock.EffDate,
 | 
			
		||||
                            YQuantity = 0,
 | 
			
		||||
                            UserId1 = HomeWindowViewModel.Operator?.Id,
 | 
			
		||||
                            UserId2 = HomeWindowViewModel.Reviewer?.Id,
 | 
			
		||||
                            MachineId = ConfigurationManager.AppSettings["machineId"].ToString(),
 | 
			
		||||
                            CreateDate = DateTime.Now.ToString("yyyy-MM-dd"),
 | 
			
		||||
                            InvoiceNo = "日结存",
 | 
			
		||||
                            Department = ConfigurationManager.AppSettings["department"].ToString(),
 | 
			
		||||
                            AddQuantity = ChannelStock.ReturnQuantity,
 | 
			
		||||
                            ManuStock = nowChannels.Where(itx => itx.ManuNo == ChannelStock.ManuNo && itx.EffDate == ChannelStock.EffDate).Sum(itx => itx.Quantity),
 | 
			
		||||
                            TotalStock = nowChannels.Sum(itx=>itx.Quantity),
 | 
			
		||||
                        }).ExecuteCommand();
 | 
			
		||||
                        if (iDayResult <= 0)
 | 
			
		||||
                        {
 | 
			
		||||
                            logger.Info($"未写入日结存数据{ChannelStock.DrugId}-{ChannelStock.ManuNo}-{ChannelStock.EffDate}-{ChannelStock.AddQuantity}");
 | 
			
		||||
                        }
 | 
			
		||||
                    }
 | 
			
		||||
                    //修改凌晨生成的总结存数据
 | 
			
		||||
                    AccountBookG2 accountBookG2Total = SqlSugarHelper.Db.Queryable<AccountBookG2>()
 | 
			
		||||
                    .Where(ab => ab.MachineId.Equals(ChannelStock.MachineId))
 | 
			
		||||
                    .Where(ab => ab.Type == 4)
 | 
			
		||||
                    .Where(ab => ab.DrugId == ChannelStock.DrugId)
 | 
			
		||||
                    .Where(ab => ab.CreateDate == DateTime.Now.ToString("yyyy-MM-dd")).First();
 | 
			
		||||
                    if (accountBookG2Total != null)
 | 
			
		||||
                    {
 | 
			
		||||
                        accountBookG2Total.AddQuantity = accountBookG2Total.AddQuantity + ChannelStock.ReturnQuantity;
 | 
			
		||||
                        accountBookG2Total.ManuStock = nowChannels.Where(itx => itx.ManuNo == ChannelStock.ManuNo && itx.EffDate == ChannelStock.EffDate).Sum(itx => itx.Quantity);
 | 
			
		||||
                        accountBookG2Total.TotalStock = nowChannels.Sum(itx=>itx.Quantity);
 | 
			
		||||
                        SqlSugarHelper.Db.Updateable(accountBookG2Total).ExecuteCommand();
 | 
			
		||||
                    }
 | 
			
		||||
                    else
 | 
			
		||||
                    {
 | 
			
		||||
                        //生成总结存时可能没有该库位的绑定信息,需要写入总结存
 | 
			
		||||
                        int iTotalResult = SqlSugarHelper.Db.Insertable(new AccountBookG2()
 | 
			
		||||
                        {
 | 
			
		||||
                            DrugId = ChannelStock.DrugId,
 | 
			
		||||
                            Type = 4,
 | 
			
		||||
                            YQuantity = 0,
 | 
			
		||||
                            UserId1 = HomeWindowViewModel.Operator?.Id,
 | 
			
		||||
                            UserId2 = HomeWindowViewModel.Reviewer?.Id,
 | 
			
		||||
                            MachineId = ConfigurationManager.AppSettings["machineId"].ToString(),
 | 
			
		||||
                            CreateDate = DateTime.Now.ToString("yyyy-MM-dd"),
 | 
			
		||||
                            InvoiceNo = "总结存",
 | 
			
		||||
                            Department = ConfigurationManager.AppSettings["department"].ToString(),
 | 
			
		||||
                            AddQuantity = ChannelStock.ReturnQuantity,
 | 
			
		||||
                            ManuStock = nowChannels.Where(itx => itx.ManuNo == ChannelStock.ManuNo && itx.EffDate == ChannelStock.EffDate).Sum(itx => itx.Quantity),
 | 
			
		||||
                            TotalStock = nowChannels.Sum(itx=>itx.Quantity),
 | 
			
		||||
                        }).ExecuteCommand();
 | 
			
		||||
                        if (iTotalResult <= 0)
 | 
			
		||||
                        {
 | 
			
		||||
                            logger.Info($"未写入总结存数据{ChannelStock.DrugId}-{ChannelStock.AddQuantity}");
 | 
			
		||||
                        }
 | 
			
		||||
                    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
                    return true;
 | 
			
		||||
                });
 | 
			
		||||
                if (f.Data)
 | 
			
		||||
| 
						 | 
				
			
			@ -276,7 +374,12 @@ namespace DM_Weight.ViewModels
 | 
			
		|||
                    {
 | 
			
		||||
                        _portUtil.WriteQuantity(ChannelStock.DrawerNo, ChannelStock.ColNo, ChannelStock.Quantity + ReturnQuantity);
 | 
			
		||||
                    }
 | 
			
		||||
 | 
			
		||||
                    if (ChannelStock.BoardType == 35)
 | 
			
		||||
                    {
 | 
			
		||||
                        await _portUtil.WriteChannelInfoMethod(2, (ChannelStock.Quantity + ChannelStock.ReturnQuantity).ToString(), ChannelStock.DrawerNo, ChannelStock.ColNo);
 | 
			
		||||
                        await Task.Delay(200);
 | 
			
		||||
                        await _portUtil.ShowContentMethod(ChannelStock.DrawerNo, ChannelStock.ColNo);
 | 
			
		||||
                    }
 | 
			
		||||
                    AlertMsg alertMsg = new AlertMsg
 | 
			
		||||
                    {
 | 
			
		||||
                        Message = "操作完成,库存已更新",
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -132,7 +132,16 @@ namespace DM_Weight.ViewModels
 | 
			
		|||
                SetProperty(ref _machineRecords, value);
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        private MachineRecord _machineRecord = new();
 | 
			
		||||
 | 
			
		||||
        public MachineRecord _MachineRecord
 | 
			
		||||
        {
 | 
			
		||||
            get => _machineRecord;
 | 
			
		||||
            set
 | 
			
		||||
            {
 | 
			
		||||
                SetProperty(ref _machineRecord, value);
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        private ChannelStock _channelStock;
 | 
			
		||||
 | 
			
		||||
        public ChannelStock ChannelStock
 | 
			
		||||
| 
						 | 
				
			
			@ -169,15 +178,35 @@ namespace DM_Weight.ViewModels
 | 
			
		|||
            List<MachineRecord> queryData = SqlSugarHelper.Db.Queryable<MachineRecord>()
 | 
			
		||||
                .Includes<UserList>(mr => mr.User)
 | 
			
		||||
                .Where(mr => mr.DrugId == ChannelStock.DrugId)
 | 
			
		||||
                .Where(mr => mr.MachineId.Equals(ConfigurationManager.AppSettings["machineId"] ?? "DM1"))
 | 
			
		||||
                .Where(mr => mr.MachineId.Equals(ConfigurationManager.AppSettings["machineId"] ?? "DM3"))
 | 
			
		||||
                .Where(mr => mr.Type == 2)
 | 
			
		||||
                .Where(mr => mr.Status != 2)
 | 
			
		||||
                .OrderBy(mr => mr.OperationTime)
 | 
			
		||||
                .OrderByDescending(mr => mr.OperationTime)
 | 
			
		||||
                .OrderBy(mr => mr.Id)
 | 
			
		||||
                .ToList();
 | 
			
		||||
            MachineRecords = queryData;
 | 
			
		||||
        }
 | 
			
		||||
        
 | 
			
		||||
        public DelegateCommand RowSelected
 | 
			
		||||
        {
 | 
			
		||||
            get => new DelegateCommand(() =>
 | 
			
		||||
            {
 | 
			
		||||
                if (_MachineRecord != null && _MachineRecord.Quantity > 0)
 | 
			
		||||
                {
 | 
			
		||||
                    MachineRecords = MachineRecords.Select(x =>
 | 
			
		||||
                    {
 | 
			
		||||
                        if (x.Id == _MachineRecord.Id)
 | 
			
		||||
                        {
 | 
			
		||||
                            x.IsSelected = !x.IsSelected;
 | 
			
		||||
                        }
 | 
			
		||||
                        return x;
 | 
			
		||||
                    }).ToList();
 | 
			
		||||
                    //DialogParameters dialogParameters = new DialogParameters();
 | 
			
		||||
                    //dialogParameters.Add("channel", Channel);
 | 
			
		||||
                    //DialogServiceExtensions.ShowDialogHost(_dialogService, "ReturnEmptyDialog", dialogParameters, DoDialogResult, "RootDialog");
 | 
			
		||||
                }
 | 
			
		||||
            });
 | 
			
		||||
        }
 | 
			
		||||
        public DelegateCommand OpenDrawer
 | 
			
		||||
        {
 | 
			
		||||
            get => new DelegateCommand(() =>
 | 
			
		||||
| 
						 | 
				
			
			@ -255,7 +284,7 @@ namespace DM_Weight.ViewModels
 | 
			
		|||
                                ReturnQuantity2 = _MachineRecord.Quantity - _MachineRecord.ReturnQuantity1,
 | 
			
		||||
                                Id = _MachineRecord.Id,
 | 
			
		||||
                                Status = 2,
 | 
			
		||||
                            }).UpdateColumns(it => new { it.ReturnQuantity1, it.Status }).ExecuteCommand();
 | 
			
		||||
                            }).UpdateColumns(it => new { it.ReturnQuantity2, it.Status }).ExecuteCommand();
 | 
			
		||||
 | 
			
		||||
                            // 保存数据 还药空瓶记录
 | 
			
		||||
                            SqlSugarHelper.Db.Insertable(new MachineRecord()
 | 
			
		||||
| 
						 | 
				
			
			@ -269,11 +298,11 @@ namespace DM_Weight.ViewModels
 | 
			
		|||
                                Operator = HomeWindowViewModel.Operator?.Id,
 | 
			
		||||
                                Reviewer = HomeWindowViewModel.Reviewer?.Id,
 | 
			
		||||
                                OperationTime = DateTime.Now,
 | 
			
		||||
                                Quantity = ReturnQuantity,
 | 
			
		||||
                                Quantity = _MachineRecord.Quantity, //ReturnQuantity,
 | 
			
		||||
                                Type = 32,
 | 
			
		||||
                                InvoiceId = InvoiceId,
 | 
			
		||||
                                GetId = _MachineRecord.Id,
 | 
			
		||||
                                StockQuantity = nowChannels.Sum(it => it.Quantity)
 | 
			
		||||
                                GetId = _MachineRecord.Id
 | 
			
		||||
                                //,StockQuantity = nowChannels.Sum(it => it.Quantity)
 | 
			
		||||
                            }).ExecuteCommand();
 | 
			
		||||
                        }
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -10,6 +10,11 @@ using System.Text;
 | 
			
		|||
using System.Threading.Tasks;
 | 
			
		||||
using DM_Weight.Models;
 | 
			
		||||
using DM_Weight.util;
 | 
			
		||||
using DM_Weight.msg;
 | 
			
		||||
using Prism.Events;
 | 
			
		||||
using System.Configuration;
 | 
			
		||||
using System.Reflection.PortableExecutable;
 | 
			
		||||
using DM_Weight.Report;
 | 
			
		||||
 | 
			
		||||
namespace DM_Weight.ViewModels
 | 
			
		||||
{
 | 
			
		||||
| 
						 | 
				
			
			@ -34,10 +39,53 @@ namespace DM_Weight.ViewModels
 | 
			
		|||
            set { SetProperty(ref _channelStock, value); }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
        private DateTime? _startDate = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day);
 | 
			
		||||
 | 
			
		||||
        public DateTime? StartDate
 | 
			
		||||
        {
 | 
			
		||||
            get => _startDate;
 | 
			
		||||
            set
 | 
			
		||||
            {
 | 
			
		||||
                if (value != null)
 | 
			
		||||
                {
 | 
			
		||||
                    SetProperty(ref _startDate, new DateTime(value?.Year ?? 0, value?.Month ?? 0, value?.Day ?? 0));
 | 
			
		||||
                }
 | 
			
		||||
                else
 | 
			
		||||
                {
 | 
			
		||||
                    SetProperty(ref _startDate, value);
 | 
			
		||||
                }
 | 
			
		||||
                RequestData();
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        private DateTime? _endDate = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, 23, 59, 59);
 | 
			
		||||
 | 
			
		||||
        public DateTime? EndDate
 | 
			
		||||
        {
 | 
			
		||||
            get => _endDate;
 | 
			
		||||
            set
 | 
			
		||||
            {
 | 
			
		||||
                if (value != null)
 | 
			
		||||
                {
 | 
			
		||||
                    TimeSpan ershisi = new TimeSpan(23, 59, 59);
 | 
			
		||||
                    SetProperty(ref _endDate, new DateTime(value?.Year ?? 0, value?.Month ?? 0, value?.Day ?? 0, 23, 59, 59));
 | 
			
		||||
                }
 | 
			
		||||
                else
 | 
			
		||||
                {
 | 
			
		||||
                    SetProperty(ref _endDate, value);
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
                RequestData();
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        IDialogService _dialogService;
 | 
			
		||||
        public ReturnEmptyWindowViewModel(IDialogService dialogService)
 | 
			
		||||
        IEventAggregator _eventAggregator;
 | 
			
		||||
        public ReturnEmptyWindowViewModel(IDialogService dialogService, IEventAggregator eventAggregator)
 | 
			
		||||
        {
 | 
			
		||||
            _dialogService = dialogService;
 | 
			
		||||
            _eventAggregator = eventAggregator;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public DelegateCommand RowSelected
 | 
			
		||||
| 
						 | 
				
			
			@ -51,16 +99,190 @@ namespace DM_Weight.ViewModels
 | 
			
		|||
                    dialogParameters.Add("DrawerNo", Channel.DrawerNo);
 | 
			
		||||
                    DialogServiceExtensions.ShowDialogHost(_dialogService, "BindingChannelDialog", dialogParameters, DoDialogResult, "RootDialog");
 | 
			
		||||
                }
 | 
			
		||||
                else if(Channel != null && Channel.CanReturnQuantity > 0)
 | 
			
		||||
                else if (Channel != null && Channel.CanReturnQuantity > 0)
 | 
			
		||||
                {
 | 
			
		||||
                    DialogParameters dialogParameters = new DialogParameters();
 | 
			
		||||
                    dialogParameters.Add("channel", Channel);
 | 
			
		||||
                    DialogServiceExtensions.ShowDialogHost(_dialogService, "ReturnEmptyDialog", dialogParameters, DoDialogResult, "RootDialog");
 | 
			
		||||
                    Channels = Channels.Select(x =>
 | 
			
		||||
                    {
 | 
			
		||||
                        if (x.Id == Channel.Id)
 | 
			
		||||
                        {
 | 
			
		||||
                            x.IsSelected = !x.IsSelected;
 | 
			
		||||
                        }
 | 
			
		||||
                        return x;
 | 
			
		||||
                    }).ToList();
 | 
			
		||||
                    //DialogParameters dialogParameters = new DialogParameters();
 | 
			
		||||
                    //dialogParameters.Add("channel", Channel);
 | 
			
		||||
                    //DialogServiceExtensions.ShowDialogHost(_dialogService, "ReturnEmptyDialog", dialogParameters, DoDialogResult, "RootDialog");
 | 
			
		||||
                }
 | 
			
		||||
            });
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
        //还空瓶
 | 
			
		||||
        public DelegateCommand ReturnEmptyCommand
 | 
			
		||||
        {
 | 
			
		||||
            get => new DelegateCommand(() =>
 | 
			
		||||
            {
 | 
			
		||||
                //List<ChannelStock> records = Channels.FindAll(it => it.IsSelected).ToList();
 | 
			
		||||
                //if (records.Count > 0)
 | 
			
		||||
                if (Channel != null && Channel.DrugId == null)
 | 
			
		||||
                {
 | 
			
		||||
                    DialogParameters dialogParameters = new DialogParameters();
 | 
			
		||||
                    dialogParameters.Add("DrawerNo", Channel.DrawerNo);
 | 
			
		||||
                    DialogServiceExtensions.ShowDialogHost(_dialogService, "BindingChannelDialog", dialogParameters, DoDialogResult, "RootDialog");
 | 
			
		||||
 | 
			
		||||
                }
 | 
			
		||||
                else if(Channel!=null&&Channel.CanReturnQuantity>0)
 | 
			
		||||
                {
 | 
			
		||||
                    
 | 
			
		||||
                    DialogParameters dialogParameters = new DialogParameters();
 | 
			
		||||
                    dialogParameters.Add("channel", Channel);
 | 
			
		||||
                    DialogServiceExtensions.ShowDialogHost(_dialogService, "ReturnEmptyDialog", dialogParameters, DoDialogResult, "RootDialog");
 | 
			
		||||
                }
 | 
			
		||||
                else
 | 
			
		||||
                {
 | 
			
		||||
 | 
			
		||||
                    AlertMsg alertMsg = new AlertMsg
 | 
			
		||||
                    {
 | 
			
		||||
                        Message = "请选择要还的空瓶",
 | 
			
		||||
                        Type = MsgType.ERROR,
 | 
			
		||||
                    };
 | 
			
		||||
                    _eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
 | 
			
		||||
                }
 | 
			
		||||
            });
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
        private List<ChannelStock> csList = new List<ChannelStock>();
 | 
			
		||||
 | 
			
		||||
        //销毁
 | 
			
		||||
        public DelegateCommand DestoryCommand
 | 
			
		||||
        {
 | 
			
		||||
            get => new DelegateCommand(() =>
 | 
			
		||||
            {
 | 
			
		||||
                if (Channels != null && Channels.Count > 0)
 | 
			
		||||
                {
 | 
			
		||||
                    csList = Channels.FindAll(it => it.IsSelected && it.Quantity > 0).ToList();
 | 
			
		||||
                    if (csList != null && csList.Count > 0)
 | 
			
		||||
                    {
 | 
			
		||||
                        //RequestClose?.Invoke(new DialogResult(ButtonResult.Cancel));
 | 
			
		||||
                        //DialogParameters dialogParameters = new DialogParameters();
 | 
			
		||||
                        //List<string> msg = new List<string>();
 | 
			
		||||
                        //msg.Add("确认");
 | 
			
		||||
                        //msg.Add("确认要销毁吗?");
 | 
			
		||||
                        //dialogParameters.Add("msgInfo", msg);
 | 
			
		||||
                        //DialogServiceExtensions.ShowDialogHost(_dialogService, "ConfirmMessageDialog", dialogParameters, DestoryDialogResult, "RootDialog");
 | 
			
		||||
                        var f = SqlSugarHelper.Db.UseTran(() =>
 | 
			
		||||
                        {
 | 
			
		||||
                            for (int i = 0; i < csList.Count; i++)
 | 
			
		||||
                            {
 | 
			
		||||
                                ChannelStock channelStock = csList[i];
 | 
			
		||||
                                channelStock.Quantity = 0;
 | 
			
		||||
                                SqlSugarHelper.Db.Updateable(channelStock).ExecuteCommand();
 | 
			
		||||
                                MachineRecord machines = SqlSugarHelper.Db.Queryable<MachineRecord>()
 | 
			
		||||
                                 //.InnerJoin<ChannelStock>((mr, cs) => mr.DrugId == cs.DrugId)
 | 
			
		||||
                                 //.Where(mr => mr.DrugId.Contains(csList.Select(it => it.DrugId).ToList()) && mr.Type = 32)
 | 
			
		||||
                                 .Where(mr => mr.MachineId.Equals(ConfigurationManager.AppSettings["machineId"] ?? "DM1"))
 | 
			
		||||
                                 .Where(mr => mr.DrugId == channelStock.DrugId)
 | 
			
		||||
                                 .Where(mr => mr.Type == 32)
 | 
			
		||||
                                 .First();
 | 
			
		||||
                                SqlSugarHelper.Db.Updateable(machines).ReSetValue(mr =>
 | 
			
		||||
                                {
 | 
			
		||||
                                    mr.IsDestroy = 1;
 | 
			
		||||
                                    mr.TakeUser = HomeWindowViewModel.Operator?.Id.ToString();
 | 
			
		||||
                                    mr.DestoryReviewerUser = HomeWindowViewModel.Reviewer?.Id.ToString();
 | 
			
		||||
                                }).ExecuteCommand();
 | 
			
		||||
                            }
 | 
			
		||||
                            return true;
 | 
			
		||||
                        });
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
                        //csList.ForEach(it => it.Quantity = 0);
 | 
			
		||||
                        //var f = SqlSugarHelper.Db.UseTran(() =>
 | 
			
		||||
                        //{
 | 
			
		||||
                        //    SqlSugarHelper.Db.Updateable(csList).ExecuteCommand();
 | 
			
		||||
                        //    string[] str = new string[csList.Count];
 | 
			
		||||
                        //    str = csList.Select(t => t.DrugId).ToArray();
 | 
			
		||||
                        //    List<MachineRecord> machines = SqlSugarHelper.Db.Queryable<MachineRecord>()
 | 
			
		||||
                        //     //.InnerJoin<ChannelStock>((mr, cs) => mr.DrugId == cs.DrugId)
 | 
			
		||||
                        //     //.Where(mr => mr.DrugId.Contains(csList.Select(it => it.DrugId).ToList()) && mr.Type = 32)
 | 
			
		||||
                        //     .Where(mr => mr.MachineId.Equals(ConfigurationManager.AppSettings["machineId"] ?? "DM1"))
 | 
			
		||||
                        //     .In(mr => mr.DrugId, str)
 | 
			
		||||
                        //     .Where(mr => mr.Type == 32)
 | 
			
		||||
                        //     .ToList();
 | 
			
		||||
                        //    SqlSugarHelper.Db.Updateable(machines).ReSetValue(mr =>
 | 
			
		||||
                        //    {
 | 
			
		||||
                        //        mr.IsDestroy = 1;
 | 
			
		||||
                        //    }).ExecuteCommand();
 | 
			
		||||
                        //    return true;
 | 
			
		||||
                        //});
 | 
			
		||||
                        if (f.Data)
 | 
			
		||||
                        {
 | 
			
		||||
 | 
			
		||||
                            RequestData();
 | 
			
		||||
                            AlertMsg alertMsg = new AlertMsg
 | 
			
		||||
                            {
 | 
			
		||||
                                Message = "销毁完成",
 | 
			
		||||
                                Type = MsgType.SUCCESS,
 | 
			
		||||
                            };
 | 
			
		||||
                            _eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
 | 
			
		||||
                        }
 | 
			
		||||
                        if (!f.IsSuccess)
 | 
			
		||||
                        {
 | 
			
		||||
                            AlertMsg alertMsg = new AlertMsg
 | 
			
		||||
                            {
 | 
			
		||||
                                Message = "销毁失败!",
 | 
			
		||||
                                Type = MsgType.ERROR,
 | 
			
		||||
                            };
 | 
			
		||||
                            _eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
 | 
			
		||||
                        }
 | 
			
		||||
                    }
 | 
			
		||||
                    else
 | 
			
		||||
                    {
 | 
			
		||||
                        AlertMsg alertMsg = new AlertMsg
 | 
			
		||||
                        {
 | 
			
		||||
                            Message = "未勾选要销毁的数据或勾选的数据库存为0",
 | 
			
		||||
                            Type = MsgType.ERROR,
 | 
			
		||||
                        };
 | 
			
		||||
                        _eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
                else
 | 
			
		||||
                {
 | 
			
		||||
                    AlertMsg alertMsg = new AlertMsg
 | 
			
		||||
                    {
 | 
			
		||||
                        Message = "没有要操作销毁的数据",
 | 
			
		||||
                        Type = MsgType.ERROR,
 | 
			
		||||
                    };
 | 
			
		||||
                    _eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
 | 
			
		||||
                }
 | 
			
		||||
            });
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        //空瓶销毁(根据还的空瓶)
 | 
			
		||||
        public DelegateCommand DestoryEmptyCommand { get => new DelegateCommand(DestoryEmptyAction); }
 | 
			
		||||
        private void DestoryEmptyAction()
 | 
			
		||||
        {
 | 
			
		||||
            //List<ChannelStock> records = Channels.FindAll(it => it.IsSelected).ToList();
 | 
			
		||||
            //if (records.Count > 0)
 | 
			
		||||
            if (Channel != null && Channel.DrugId != null&&Channel.Quantity>0)
 | 
			
		||||
            {
 | 
			
		||||
 | 
			
		||||
                DialogParameters dialogParameters = new DialogParameters();
 | 
			
		||||
                dialogParameters.Add("channel", Channel);
 | 
			
		||||
                DialogServiceExtensions.ShowDialogHost(_dialogService, "DestoryEmptyDialog", dialogParameters, DoDialogResult, "RootDialog");
 | 
			
		||||
            }
 | 
			
		||||
            else
 | 
			
		||||
            {
 | 
			
		||||
                AlertMsg alertMsg = new AlertMsg
 | 
			
		||||
                {
 | 
			
		||||
                    Message = "请选择有库存的数据",
 | 
			
		||||
                    Type = MsgType.ERROR,
 | 
			
		||||
                };
 | 
			
		||||
                _eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        private void DoDialogResult(IDialogResult dialogResult)
 | 
			
		||||
        {
 | 
			
		||||
            // 委托   被动执行     被子窗口执行
 | 
			
		||||
| 
						 | 
				
			
			@ -69,6 +291,13 @@ namespace DM_Weight.ViewModels
 | 
			
		|||
            //MessageBox.Show("返回值:" + dialogResult.Result.ToString());
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        //导出回收销毁记录
 | 
			
		||||
        public DelegateCommand DownloadRecordCommand { get => new DelegateCommand(() => {
 | 
			
		||||
 | 
			
		||||
            GridReportUtil.PrintEmptyDestoryReport(StartDate, EndDate);
 | 
			
		||||
 | 
			
		||||
        }); } 
 | 
			
		||||
 | 
			
		||||
        public bool KeepAlive => false;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -98,10 +327,11 @@ namespace DM_Weight.ViewModels
 | 
			
		|||
        {
 | 
			
		||||
 | 
			
		||||
            Channels = SqlSugarHelper.Db.Queryable<ChannelStock>()
 | 
			
		||||
                .LeftJoin<DrugInfo>((cs,di) => cs.DrugId == di.DrugId.ToString())
 | 
			
		||||
                .Where((cs) => cs.DrawerType != 1)
 | 
			
		||||
                .Select((cs, di) => new ChannelStock{
 | 
			
		||||
                    CanReturnQuantity = SqlFunc.Subqueryable<MachineRecord>().Where(mr => mr.DrugId == cs.DrugId).Where(mr => mr.Type == 2).Where(mr => mr.Status != 2).Select(mr => SqlFunc.IsNull(SqlFunc.AggregateSumNoNull(mr.Quantity - mr.ReturnQuantity1 - mr.ReturnQuantity2), 0)) ,
 | 
			
		||||
                .LeftJoin<DrugInfo>((cs, di) => cs.DrugId == di.DrugId.ToString())
 | 
			
		||||
                .Where((cs) => cs.DrawerType != 1).Where(cs => cs.MachineId == ConfigurationManager.AppSettings["machineId"])
 | 
			
		||||
                .Select((cs, di) => new ChannelStock
 | 
			
		||||
                {
 | 
			
		||||
                    CanReturnQuantity = SqlFunc.Subqueryable<MachineRecord>().Where(mr => mr.DrugId == cs.DrugId && mr.MachineId == ConfigurationManager.AppSettings["machineId"]).Where(mr => mr.Type == 2).Where(mr => mr.Status != 2).Select(mr => SqlFunc.IsNull(SqlFunc.AggregateSumNoNull(mr.Quantity - mr.ReturnQuantity1 - mr.ReturnQuantity2), 0)),
 | 
			
		||||
                    DrugInfo = new DrugInfo
 | 
			
		||||
                    {
 | 
			
		||||
                        DrugId = di.DrugId,
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -203,7 +203,7 @@ namespace DM_Weight.ViewModels
 | 
			
		|||
                    PremissionName = "多处方取药",
 | 
			
		||||
                    PremissionPath = "MultiOrderTakeDrugWindow",
 | 
			
		||||
                };
 | 
			
		||||
                quyaoChild.Add(mulityOrder);
 | 
			
		||||
                //quyaoChild.Add(mulityOrder);
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            quyaoChild.Add(quyao1);
 | 
			
		||||
| 
						 | 
				
			
			@ -256,10 +256,32 @@ namespace DM_Weight.ViewModels
 | 
			
		|||
                };
 | 
			
		||||
                jiayaoChild.Add(jiayao5);
 | 
			
		||||
            }
 | 
			
		||||
            PremissionDm jiayao6 = new PremissionDm
 | 
			
		||||
            {
 | 
			
		||||
                Id = 26,
 | 
			
		||||
                PremissionName = "药品请领",
 | 
			
		||||
                PremissionPath = "CollectDrugWindow",
 | 
			
		||||
            };
 | 
			
		||||
 | 
			
		||||
            PremissionDm jiayao7 = new PremissionDm
 | 
			
		||||
            {
 | 
			
		||||
                Id = 27,
 | 
			
		||||
                PremissionName = "请领列表",
 | 
			
		||||
                PremissionPath = "ApplyListWindow",
 | 
			
		||||
            };
 | 
			
		||||
            PremissionDm jiayao8 = new PremissionDm
 | 
			
		||||
            {
 | 
			
		||||
                Id = 28,
 | 
			
		||||
                PremissionName = "请领入库",
 | 
			
		||||
                PremissionPath = "ApplyInStockWindow",
 | 
			
		||||
            };
 | 
			
		||||
            jiayaoChild.Add(jiayao1);
 | 
			
		||||
            jiayaoChild.Add(jiayao2);
 | 
			
		||||
            jiayaoChild.Add(jiayao3);
 | 
			
		||||
            jiayaoChild.Add(jiayao4);
 | 
			
		||||
            jiayaoChild.Add(jiayao6);
 | 
			
		||||
            jiayaoChild.Add(jiayao7);
 | 
			
		||||
            jiayaoChild.Add(jiayao8);
 | 
			
		||||
            jiayao.Children = jiayaoChild;
 | 
			
		||||
            defaultAll.Add(jiayao);
 | 
			
		||||
            #endregion
 | 
			
		||||
| 
						 | 
				
			
			@ -333,10 +355,24 @@ namespace DM_Weight.ViewModels
 | 
			
		|||
                PremissionName = "药品列表",
 | 
			
		||||
                PremissionPath = "DrugListWindow",
 | 
			
		||||
            }; 
 | 
			
		||||
            PremissionDm kuguan5 = new PremissionDm
 | 
			
		||||
            {
 | 
			
		||||
                Id = 45,
 | 
			
		||||
                PremissionName = "交接班记录",
 | 
			
		||||
                PremissionPath = "ChangeShiftsListWindow",
 | 
			
		||||
            };
 | 
			
		||||
            PremissionDm kuguan6 = new PremissionDm
 | 
			
		||||
            {
 | 
			
		||||
                Id = 46,
 | 
			
		||||
                PremissionName = "账册",
 | 
			
		||||
                PremissionPath = "AccountWindow",
 | 
			
		||||
            };
 | 
			
		||||
            kuguanChild.Add(kuguan1);
 | 
			
		||||
            kuguanChild.Add(kuguan2);
 | 
			
		||||
            kuguanChild.Add(kuguan3);
 | 
			
		||||
            kuguanChild.Add(kuguan4);
 | 
			
		||||
            kuguanChild.Add(kuguan5);
 | 
			
		||||
            kuguanChild.Add(kuguan6);
 | 
			
		||||
            kuguan.Children = kuguanChild;
 | 
			
		||||
            defaultAll.Add(kuguan);
 | 
			
		||||
            #endregion
 | 
			
		||||
| 
						 | 
				
			
			@ -366,6 +402,12 @@ namespace DM_Weight.ViewModels
 | 
			
		|||
                PremissionName = "设置",
 | 
			
		||||
                PremissionPath = "SettingWindow",
 | 
			
		||||
            };
 | 
			
		||||
            //PremissionDm sysset3 = new PremissionDm
 | 
			
		||||
            //{
 | 
			
		||||
            //    Id = 53,
 | 
			
		||||
            //    PremissionName = "设置",
 | 
			
		||||
            //    PremissionPath = "SettingMainWindow",
 | 
			
		||||
            //};
 | 
			
		||||
            syssetChild.Add(sysset1);
 | 
			
		||||
            syssetChild.Add(sysset2);
 | 
			
		||||
            syssetChild.Add(sysset3);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -18,6 +18,7 @@ using DM_Weight.Port;
 | 
			
		|||
using DM_Weight.util;
 | 
			
		||||
using DM_Weight.Views;
 | 
			
		||||
using System.Threading;
 | 
			
		||||
using System.Configuration;
 | 
			
		||||
 | 
			
		||||
namespace DM_Weight.ViewModels
 | 
			
		||||
{
 | 
			
		||||
| 
						 | 
				
			
			@ -263,9 +264,108 @@ namespace DM_Weight.ViewModels
 | 
			
		|||
                                OperationTime = DateTime.Now,
 | 
			
		||||
                                Quantity = it.AddQuantity,
 | 
			
		||||
                                Type = 1,
 | 
			
		||||
                                InvoiceId = InvoiceId,
 | 
			
		||||
                                StockQuantity = nowChannels.Sum(it => it.Quantity)
 | 
			
		||||
                                InvoiceId = InvoiceId
 | 
			
		||||
                                //,StockQuantity = nowChannels.Sum(it => it.Quantity)
 | 
			
		||||
                            }).ExecuteCommand();
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
                            //保存账册
 | 
			
		||||
                            SqlSugarHelper.Db.Insertable(new AccountBookG2()
 | 
			
		||||
                            {
 | 
			
		||||
                                DrugId = it.DrugId,
 | 
			
		||||
                                Type = 1,
 | 
			
		||||
                                Department = ConfigurationManager.AppSettings["department"].ToString(),
 | 
			
		||||
                                InvoiceNo = InvoiceId,
 | 
			
		||||
                                ManuNo = it.ManuNo,
 | 
			
		||||
                                EffDate = it.EffDate,
 | 
			
		||||
                                AddQuantity = it.AddQuantity,
 | 
			
		||||
                                UserId1 = HomeWindowViewModel.Operator?.Id,
 | 
			
		||||
                                UserId2 = HomeWindowViewModel.Reviewer?.Id,
 | 
			
		||||
                                MachineId = ConfigurationManager.AppSettings["machineId"].ToString(),
 | 
			
		||||
                                CreateDate = DateTime.Now.ToString("yyyy-MM-dd"),
 | 
			
		||||
                                CreateTime = DateTime.Now,
 | 
			
		||||
                                ManuStock=nowChannels.Where(itx => itx.ManuNo == it.ManuNo && itx.EffDate == it.EffDate).Sum(itx => itx.Quantity),
 | 
			
		||||
                                TotalStock = nowChannels.Sum(itx => itx.Quantity)
 | 
			
		||||
 | 
			
		||||
                            }).ExecuteCommand();
 | 
			
		||||
                            //修改凌晨生成的日结存数据
 | 
			
		||||
                            AccountBookG2 accountBookG2Day = SqlSugarHelper.Db.Queryable<AccountBookG2>()
 | 
			
		||||
                            .Where(ab => ab.MachineId.Equals(it.MachineId))
 | 
			
		||||
                            .Where(ab => ab.Type == 3)
 | 
			
		||||
                            .Where(ab => ab.DrugId ==it.DrugId)
 | 
			
		||||
                            .Where(ab => ab.ManuNo == it.ManuNo)
 | 
			
		||||
                            .Where(ab => ab.CreateDate == DateTime.Now.ToString("yyyy-MM-dd")).First();
 | 
			
		||||
                            if (accountBookG2Day != null)
 | 
			
		||||
                            {
 | 
			
		||||
                                accountBookG2Day.AddQuantity = accountBookG2Day.AddQuantity + it.AddQuantity;
 | 
			
		||||
                                accountBookG2Day.ManuStock = nowChannels.Where(itx => itx.ManuNo == it.ManuNo && itx.EffDate == it.EffDate).Sum(itx => itx.Quantity);
 | 
			
		||||
                                accountBookG2Day.TotalStock=nowChannels.Sum(itx => itx.Quantity);
 | 
			
		||||
                                SqlSugarHelper.Db.Updateable(accountBookG2Day).ExecuteCommand();
 | 
			
		||||
                            }
 | 
			
		||||
                            else
 | 
			
		||||
                            {
 | 
			
		||||
                                //生成日结存时可能没有该库位的绑定信息,需要写入日结存
 | 
			
		||||
                                int iDayResult = SqlSugarHelper.Db.Insertable(new AccountBookG2()
 | 
			
		||||
                                {
 | 
			
		||||
                                    DrugId = it.DrugId,
 | 
			
		||||
                                    Type = 3,
 | 
			
		||||
                                    ManuNo = it.ManuNo,
 | 
			
		||||
                                    EffDate = it.EffDate,
 | 
			
		||||
                                    YQuantity = 0,
 | 
			
		||||
                                    UserId1 = HomeWindowViewModel.Operator?.Id,
 | 
			
		||||
                                    UserId2 = HomeWindowViewModel.Reviewer?.Id,
 | 
			
		||||
                                    MachineId = ConfigurationManager.AppSettings["machineId"].ToString(),
 | 
			
		||||
                                    CreateDate = DateTime.Now.ToString("yyyy-MM-dd"),
 | 
			
		||||
                                    InvoiceNo = "日结存",
 | 
			
		||||
                                    Department = ConfigurationManager.AppSettings["department"].ToString(),
 | 
			
		||||
                                    AddQuantity = it.AddQuantity,
 | 
			
		||||
                                    ManuStock = nowChannels.Where(itx => itx.ManuNo == it.ManuNo && itx.EffDate == it.EffDate).Sum(itx => itx.Quantity),
 | 
			
		||||
                                    TotalStock = nowChannels.Sum(itx=>itx.Quantity),
 | 
			
		||||
 | 
			
		||||
                                }).ExecuteCommand();
 | 
			
		||||
                                if (iDayResult <= 0)
 | 
			
		||||
                                {
 | 
			
		||||
                                    logger.Info($"未写入日结存数据{it.DrugId}-{it.ManuNo}-{it.EffDate}-{it.AddQuantity}");
 | 
			
		||||
                                }
 | 
			
		||||
                            }
 | 
			
		||||
                            //修改凌晨生成的总结存数据
 | 
			
		||||
                            AccountBookG2 accountBookG2Total = SqlSugarHelper.Db.Queryable<AccountBookG2>()
 | 
			
		||||
                            .Where(ab => ab.MachineId.Equals(it.MachineId))
 | 
			
		||||
                            .Where(ab => ab.Type == 4)
 | 
			
		||||
                            .Where(ab => ab.DrugId == it.DrugId)
 | 
			
		||||
                            .Where(ab => ab.CreateDate == DateTime.Now.ToString("yyyy-MM-dd")).First();
 | 
			
		||||
 | 
			
		||||
                            if (accountBookG2Total != null)
 | 
			
		||||
                            {
 | 
			
		||||
                                accountBookG2Total.AddQuantity=accountBookG2Total.AddQuantity + it.AddQuantity;
 | 
			
		||||
                                accountBookG2Total.ManuStock = nowChannels.Where(itx => itx.ManuNo == it.ManuNo && itx.EffDate == it.EffDate).Sum(itx => itx.Quantity);
 | 
			
		||||
                                accountBookG2Total.TotalStock = nowChannels.Sum(itx=>itx.Quantity);
 | 
			
		||||
                                SqlSugarHelper.Db.Updateable(accountBookG2Total).ExecuteCommand();
 | 
			
		||||
                            }
 | 
			
		||||
                            else
 | 
			
		||||
                            {
 | 
			
		||||
                                //生成总结存时可能没有该库位的绑定信息,需要写入总结存
 | 
			
		||||
                                int iTotalResult = SqlSugarHelper.Db.Insertable(new AccountBookG2()
 | 
			
		||||
                                {
 | 
			
		||||
                                    DrugId = it.DrugId,
 | 
			
		||||
                                    Type = 4,
 | 
			
		||||
                                    YQuantity = 0,
 | 
			
		||||
                                    UserId1 = HomeWindowViewModel.Operator?.Id,
 | 
			
		||||
                                    UserId2 = HomeWindowViewModel.Reviewer?.Id,
 | 
			
		||||
                                    MachineId = ConfigurationManager.AppSettings["machineId"].ToString(),
 | 
			
		||||
                                    CreateDate = DateTime.Now.ToString("yyyy-MM-dd"),
 | 
			
		||||
                                    InvoiceNo = "总结存",
 | 
			
		||||
                                    Department = ConfigurationManager.AppSettings["department"].ToString(),
 | 
			
		||||
                                    AddQuantity = it.AddQuantity,
 | 
			
		||||
                                    ManuStock = nowChannels.Where(itx => itx.ManuNo == it.ManuNo && itx.EffDate == it.EffDate).Sum(itx => itx.Quantity),
 | 
			
		||||
                                    TotalStock = nowChannels.Sum(itx=>itx.Quantity),
 | 
			
		||||
                                }).ExecuteCommand();
 | 
			
		||||
                                if (iTotalResult <= 0)
 | 
			
		||||
                                {
 | 
			
		||||
                                    logger.Info($"未写入总结存数据{it.DrugId}-{it.AddQuantity}");
 | 
			
		||||
                                }
 | 
			
		||||
                            }
 | 
			
		||||
 | 
			
		||||
                        }
 | 
			
		||||
                        return true;
 | 
			
		||||
                    });
 | 
			
		||||
| 
						 | 
				
			
			@ -280,7 +380,22 @@ namespace DM_Weight.ViewModels
 | 
			
		|||
                                _portUtil.WriteQuantity(it.DrawerNo, it.ColNo, it.Quantity + it.AddQuantity);
 | 
			
		||||
                            });
 | 
			
		||||
                        }
 | 
			
		||||
                        
 | 
			
		||||
                        if ((singleChannels.Count > 0 ? singleChannels[0].BoardType : 1) == 35)
 | 
			
		||||
                        {
 | 
			
		||||
                            for (int i = 0; i < singleChannels.Count; i++)
 | 
			
		||||
                            {
 | 
			
		||||
                                await Task.Delay(200);
 | 
			
		||||
                                await _portUtil.WriteChannelInfoMethod(2, (singleChannels[i].Quantity + singleChannels[i].AddQuantity).ToString(), singleChannels[i].DrawerNo, singleChannels[i].ColNo);
 | 
			
		||||
                                await Task.Delay(200);
 | 
			
		||||
                                await _portUtil.ShowContentMethod(singleChannels[i].DrawerNo, singleChannels[i].ColNo);
 | 
			
		||||
                            }
 | 
			
		||||
                            //singleChannels.ForEach(async it =>
 | 
			
		||||
                            //{
 | 
			
		||||
                            //    await _portUtil.WriteChannelInfoMethod(2, (it.Quantity + it.AddQuantity).ToString(), it.DrawerNo, it.ColNo);
 | 
			
		||||
                            //    await Task.Delay(200);
 | 
			
		||||
                            //    await _portUtil.ShowContentMethod(it.DrawerNo, it.ColNo);
 | 
			
		||||
                            //});
 | 
			
		||||
                        }
 | 
			
		||||
 | 
			
		||||
                        AlertMsg alertMsg = new AlertMsg
 | 
			
		||||
                        {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -16,6 +16,8 @@ using DM_Weight.msg;
 | 
			
		|||
using DM_Weight.Port;
 | 
			
		||||
using DM_Weight.util;
 | 
			
		||||
using System.Threading;
 | 
			
		||||
using System.Configuration;
 | 
			
		||||
using DM_Weight.HIKVISION;
 | 
			
		||||
 | 
			
		||||
namespace DM_Weight.ViewModels
 | 
			
		||||
{
 | 
			
		||||
| 
						 | 
				
			
			@ -34,7 +36,6 @@ namespace DM_Weight.ViewModels
 | 
			
		|||
 | 
			
		||||
        private PortUtil _portUtil;
 | 
			
		||||
        IEventAggregator _eventAggregator;
 | 
			
		||||
 | 
			
		||||
        public SelfTakeDialogViewModel(PortUtil portUtil, IEventAggregator eventAggregator)
 | 
			
		||||
        {
 | 
			
		||||
            _portUtil = portUtil;
 | 
			
		||||
| 
						 | 
				
			
			@ -63,7 +64,6 @@ namespace DM_Weight.ViewModels
 | 
			
		|||
                                channelStocks.ForEach(it => it.process = 2);
 | 
			
		||||
                            }
 | 
			
		||||
                        }
 | 
			
		||||
 | 
			
		||||
                        break;
 | 
			
		||||
                    // 抽屉关闭
 | 
			
		||||
                    case EventType.DRAWERCLOSE:
 | 
			
		||||
| 
						 | 
				
			
			@ -199,7 +199,7 @@ namespace DM_Weight.ViewModels
 | 
			
		|||
        // 完成按钮
 | 
			
		||||
        public DelegateCommand TakeFinish
 | 
			
		||||
        {
 | 
			
		||||
            get => new DelegateCommand(() =>
 | 
			
		||||
            get => new DelegateCommand(async() =>
 | 
			
		||||
            {
 | 
			
		||||
                if (!_isFinishClick)
 | 
			
		||||
                {
 | 
			
		||||
| 
						 | 
				
			
			@ -240,9 +240,108 @@ namespace DM_Weight.ViewModels
 | 
			
		|||
                                Quantity = it.TakeQuantity,
 | 
			
		||||
                                Reviewer = HomeWindowViewModel.Reviewer?.Id,
 | 
			
		||||
                                Type = 2,
 | 
			
		||||
                                InvoiceId = InvoiceId,
 | 
			
		||||
                                StockQuantity = nowChannels.Sum(it => it.Quantity)
 | 
			
		||||
                                InvoiceId = InvoiceId
 | 
			
		||||
                                //,StockQuantity = nowChannels.Sum(it => it.Quantity)
 | 
			
		||||
                            }).ExecuteCommand();
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
                            //保存账册
 | 
			
		||||
                            SqlSugarHelper.Db.Insertable(new AccountBookG2()
 | 
			
		||||
                            {
 | 
			
		||||
                                DrugId = it.DrugId,
 | 
			
		||||
                                Type = 2,
 | 
			
		||||
                                Department = ConfigurationManager.AppSettings["department"].ToString(),
 | 
			
		||||
                                InvoiceNo = InvoiceId,
 | 
			
		||||
                                ManuNo = it.ManuNo,
 | 
			
		||||
                                EffDate = it.EffDate,
 | 
			
		||||
                                OutQuantity = it.TakeQuantity,
 | 
			
		||||
                                UserId1 = HomeWindowViewModel.Operator?.Id,
 | 
			
		||||
                                UserId2 = HomeWindowViewModel.Reviewer?.Id,
 | 
			
		||||
                                MachineId = ConfigurationManager.AppSettings["machineId"].ToString(),
 | 
			
		||||
                                CreateDate = DateTime.Now.ToString("yyyy-MM-dd"),
 | 
			
		||||
                                CreateTime = DateTime.Now,
 | 
			
		||||
                                ManuStock=nowChannels.Where(itx => itx.ManuNo == it.ManuNo && itx.EffDate == it.EffDate).Sum(itx => itx.Quantity),
 | 
			
		||||
                                TotalStock = nowChannels.Sum(itx => itx.Quantity)
 | 
			
		||||
 | 
			
		||||
                            }).ExecuteCommand();
 | 
			
		||||
                            //修改凌晨生成的日结存数据
 | 
			
		||||
                            AccountBookG2 accountBookG2Day = SqlSugarHelper.Db.Queryable<AccountBookG2>()
 | 
			
		||||
                            .Where(ab => ab.MachineId.Equals(it.MachineId))
 | 
			
		||||
                            .Where(ab => ab.Type == 3)
 | 
			
		||||
                            .Where(ab => ab.DrugId == it.DrugId)
 | 
			
		||||
                            .Where(ab => ab.ManuNo == it.ManuNo)
 | 
			
		||||
                            .Where(ab => ab.CreateDate == DateTime.Now.ToString("yyyy-MM-dd")).First();
 | 
			
		||||
                            if (accountBookG2Day != null)
 | 
			
		||||
                            {
 | 
			
		||||
                                accountBookG2Day.OutQuantity = accountBookG2Day.OutQuantity + it.TakeQuantity;
 | 
			
		||||
                                accountBookG2Day.ManuStock = nowChannels.Where(itx => itx.ManuNo == it.ManuNo && itx.EffDate == it.EffDate).Sum(itx => itx.Quantity);
 | 
			
		||||
                                accountBookG2Day.TotalStock=nowChannels.Sum(itx=>itx.Quantity);
 | 
			
		||||
                                SqlSugarHelper.Db.Updateable(accountBookG2Day).ExecuteCommand();
 | 
			
		||||
                            }
 | 
			
		||||
                            else
 | 
			
		||||
                            {
 | 
			
		||||
                                //生成日结存时可能没有该库位的绑定信息,需要写入日结存
 | 
			
		||||
                                int iDayResult = SqlSugarHelper.Db.Insertable(new AccountBookG2()
 | 
			
		||||
                                {
 | 
			
		||||
                                    DrugId = it.DrugId,
 | 
			
		||||
                                    Type = 3,
 | 
			
		||||
                                    ManuNo = it.ManuNo,
 | 
			
		||||
                                    EffDate = it.EffDate,
 | 
			
		||||
                                    YQuantity = 0,
 | 
			
		||||
                                    UserId1 = HomeWindowViewModel.Operator?.Id,
 | 
			
		||||
                                    UserId2 = HomeWindowViewModel.Reviewer?.Id,
 | 
			
		||||
                                    MachineId = ConfigurationManager.AppSettings["machineId"].ToString(),
 | 
			
		||||
                                    CreateDate = DateTime.Now.ToString("yyyy-MM-dd"),
 | 
			
		||||
                                    InvoiceNo = "日结存",
 | 
			
		||||
                                    Department = ConfigurationManager.AppSettings["department"].ToString(),
 | 
			
		||||
                                    OutQuantity = it.TakeQuantity,
 | 
			
		||||
                                    ManuStock = nowChannels.Where(itx => itx.ManuNo == it.ManuNo && itx.EffDate == it.EffDate).Sum(itx => itx.Quantity),
 | 
			
		||||
                                    TotalStock = nowChannels.Sum(itx=>itx.Quantity),
 | 
			
		||||
 | 
			
		||||
                                }).ExecuteCommand();
 | 
			
		||||
                                if (iDayResult <= 0)
 | 
			
		||||
                                {
 | 
			
		||||
                                    logger.Info($"未写入日结存数据{it.DrugId}-{it.ManuNo}-{it.EffDate}-{it.AddQuantity}");
 | 
			
		||||
                                }
 | 
			
		||||
                            }
 | 
			
		||||
                            //修改凌晨生成的总结存数据
 | 
			
		||||
                            AccountBookG2 accountBookG2Total = SqlSugarHelper.Db.Queryable<AccountBookG2>()
 | 
			
		||||
                            .Where(ab => ab.MachineId.Equals(it.MachineId))
 | 
			
		||||
                            .Where(ab => ab.Type == 4)
 | 
			
		||||
                            .Where(ab => ab.DrugId == it.DrugId)
 | 
			
		||||
                            .Where(ab => ab.CreateDate == DateTime.Now.ToString("yyyy-MM-dd")).First();
 | 
			
		||||
 | 
			
		||||
                            if (accountBookG2Total != null)
 | 
			
		||||
                            {
 | 
			
		||||
                                accountBookG2Total.OutQuantity = accountBookG2Total.OutQuantity + it.TakeQuantity;
 | 
			
		||||
                                accountBookG2Total.ManuStock = nowChannels.Where(itx => itx.ManuNo == it.ManuNo && itx.EffDate == it.EffDate).Sum(itx => itx.Quantity);
 | 
			
		||||
                                accountBookG2Total.TotalStock = nowChannels.Sum(itx=>itx.Quantity);
 | 
			
		||||
                                SqlSugarHelper.Db.Updateable(accountBookG2Total).ExecuteCommand();
 | 
			
		||||
                            }
 | 
			
		||||
                            else
 | 
			
		||||
                            {
 | 
			
		||||
                                //生成总结存时可能没有该库位的绑定信息,需要写入总结存
 | 
			
		||||
                                int iTotalResult = SqlSugarHelper.Db.Insertable(new AccountBookG2()
 | 
			
		||||
                                {
 | 
			
		||||
                                    DrugId = it.DrugId,
 | 
			
		||||
                                    Type = 4,
 | 
			
		||||
                                    YQuantity = 0,
 | 
			
		||||
                                    UserId1 = HomeWindowViewModel.Operator?.Id,
 | 
			
		||||
                                    UserId2 = HomeWindowViewModel.Reviewer?.Id,
 | 
			
		||||
                                    MachineId = ConfigurationManager.AppSettings["machineId"].ToString(),
 | 
			
		||||
                                    CreateDate = DateTime.Now.ToString("yyyy-MM-dd"),
 | 
			
		||||
                                    InvoiceNo = "总结存",
 | 
			
		||||
                                    Department = ConfigurationManager.AppSettings["department"].ToString(),
 | 
			
		||||
                                    OutQuantity = it.TakeQuantity,
 | 
			
		||||
                                    ManuStock = nowChannels.Where(itx => itx.ManuNo == it.ManuNo && itx.EffDate == it.EffDate).Sum(itx => itx.Quantity),
 | 
			
		||||
                                    TotalStock = nowChannels.Sum(itx=>itx.Quantity),
 | 
			
		||||
                                }).ExecuteCommand();
 | 
			
		||||
                                if (iTotalResult <= 0)
 | 
			
		||||
                                {
 | 
			
		||||
                                    logger.Info($"未写入总结存数据{it.DrugId}-{it.AddQuantity}");
 | 
			
		||||
                                }
 | 
			
		||||
                            }
 | 
			
		||||
                        }
 | 
			
		||||
                        return true;
 | 
			
		||||
                    });
 | 
			
		||||
| 
						 | 
				
			
			@ -257,7 +356,16 @@ namespace DM_Weight.ViewModels
 | 
			
		|||
                                _portUtil.WriteQuantity(it.DrawerNo, it.ColNo, it.Quantity - it.TakeQuantity);
 | 
			
		||||
                            });
 | 
			
		||||
                        }
 | 
			
		||||
 | 
			
		||||
                        if ((singleChannels.Count > 0 ? singleChannels[0].BoardType : 1) == 35)
 | 
			
		||||
                        {
 | 
			
		||||
                            for (int i = 0; i < singleChannels.Count; i++)
 | 
			
		||||
                            {
 | 
			
		||||
                                await Task.Delay(200);
 | 
			
		||||
                                await _portUtil.WriteChannelInfoMethod(2, (singleChannels[i].Quantity - singleChannels[i].TakeQuantity).ToString(), singleChannels[i].DrawerNo, singleChannels[i].ColNo);
 | 
			
		||||
                                await Task.Delay(200);
 | 
			
		||||
                                await _portUtil.ShowContentMethod(singleChannels[i].DrawerNo, singleChannels[i].ColNo);
 | 
			
		||||
                            }
 | 
			
		||||
                        }
 | 
			
		||||
                        AlertMsg alertMsg = new AlertMsg
 | 
			
		||||
                        {
 | 
			
		||||
                            Message = "操作完成,库存已更新",
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -0,0 +1,74 @@
 | 
			
		|||
using DM_Weight.Common;
 | 
			
		||||
using DM_Weight.Models;
 | 
			
		||||
using DM_Weight.util;
 | 
			
		||||
using Prism.Commands;
 | 
			
		||||
using Prism.Common;
 | 
			
		||||
using Prism.Mvvm;
 | 
			
		||||
using Prism.Regions;
 | 
			
		||||
using System;
 | 
			
		||||
using System.Collections.Generic;
 | 
			
		||||
using System.Collections.ObjectModel;
 | 
			
		||||
using System.Linq;
 | 
			
		||||
using System.Text;
 | 
			
		||||
using System.Threading.Tasks;
 | 
			
		||||
 | 
			
		||||
namespace DM_Weight.ViewModels
 | 
			
		||||
{
 | 
			
		||||
    public class SettingMainWindowViewModel : BindableBase, INavigationAware,IRegionMemberLifetime
 | 
			
		||||
    {
 | 
			
		||||
        //设置页面数据集
 | 
			
		||||
        private ObservableCollection<SettingPage> _settingPages;
 | 
			
		||||
        public ObservableCollection<SettingPage> SettingPages
 | 
			
		||||
        {
 | 
			
		||||
            get => _settingPages;
 | 
			
		||||
            set=>SetProperty(ref _settingPages, value);
 | 
			
		||||
        }
 | 
			
		||||
        //默认加载页面
 | 
			
		||||
        string defaultView = string.Empty;
 | 
			
		||||
 | 
			
		||||
        IRegionManager _regionManager;
 | 
			
		||||
 | 
			
		||||
        public SettingMainWindowViewModel(IRegionManager regionManager)
 | 
			
		||||
        {
 | 
			
		||||
            this._regionManager=regionManager;
 | 
			
		||||
        }
 | 
			
		||||
        //选中事件
 | 
			
		||||
        public DelegateCommand<string> NavigateCommand { get => new DelegateCommand<string>(navigateAction); }
 | 
			
		||||
 | 
			
		||||
        public bool KeepAlive => false;
 | 
			
		||||
 | 
			
		||||
        private void navigateAction(string obj)
 | 
			
		||||
        {
 | 
			
		||||
            if(obj==null||string.IsNullOrWhiteSpace(obj))
 | 
			
		||||
            {
 | 
			
		||||
                return;
 | 
			
		||||
            }
 | 
			
		||||
            defaultView = obj;
 | 
			
		||||
            _regionManager.RequestNavigate(PrismManager.SettingViewRegionName, defaultView);
 | 
			
		||||
        }
 | 
			
		||||
        public bool IsNavigationTarget(NavigationContext navigationContext)
 | 
			
		||||
        {
 | 
			
		||||
            return true;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public void OnNavigatedFrom(NavigationContext navigationContext)
 | 
			
		||||
        {
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public void OnNavigatedTo(NavigationContext navigationContext)
 | 
			
		||||
        {
 | 
			
		||||
            if(SettingPages is null|| SettingPages.Count<=0)
 | 
			
		||||
            {
 | 
			
		||||
                SettingPages=new ObservableCollection<SettingPage>(SqlSugarHelper.Db.Queryable<SettingPage>().ToList());
 | 
			
		||||
                if(SettingPages.Count>0)
 | 
			
		||||
                {
 | 
			
		||||
                    if(string.IsNullOrEmpty(defaultView))
 | 
			
		||||
                    {
 | 
			
		||||
                        defaultView = SettingPages[0].ViewName;
 | 
			
		||||
                    }
 | 
			
		||||
                    _regionManager.RequestNavigate(PrismManager.SettingViewRegionName,defaultView);
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,256 @@
 | 
			
		|||
<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/"
 | 
			
		||||
             xmlns:convert="clr-namespace:DM_Weight.Converter"
 | 
			
		||||
             mc:Ignorable="d" 
 | 
			
		||||
             d:DesignHeight="450" d:DesignWidth="800" Loaded="UserControl_Loaded">
 | 
			
		||||
    <UserControl.Resources>
 | 
			
		||||
        <Style x:Key="st" TargetType="GridViewColumnHeader">
 | 
			
		||||
            <Style.Setters>
 | 
			
		||||
                <Setter Property="Height">
 | 
			
		||||
                    <Setter.Value>55</Setter.Value>
 | 
			
		||||
                </Setter>
 | 
			
		||||
                <Setter Property="Background">
 | 
			
		||||
                    <Setter.Value>#31ccec</Setter.Value>
 | 
			
		||||
                </Setter>
 | 
			
		||||
                <Setter Property="Foreground">
 | 
			
		||||
                    <Setter.Value>white</Setter.Value>
 | 
			
		||||
                </Setter>
 | 
			
		||||
            </Style.Setters>
 | 
			
		||||
        </Style> 
 | 
			
		||||
    </UserControl.Resources>
 | 
			
		||||
    <Grid>
 | 
			
		||||
        <Grid.RowDefinitions>
 | 
			
		||||
            <RowDefinition Height="Auto" />
 | 
			
		||||
            <RowDefinition />
 | 
			
		||||
            <RowDefinition Height="Auto" />
 | 
			
		||||
        </Grid.RowDefinitions>
 | 
			
		||||
        <Grid Margin="0 6 0 6" Grid.Row="0">
 | 
			
		||||
            <Grid.ColumnDefinitions>
 | 
			
		||||
                <ColumnDefinition Width="1.5*" />
 | 
			
		||||
                <ColumnDefinition Width="1.5*" />
 | 
			
		||||
                <ColumnDefinition Width="2*" />
 | 
			
		||||
                <ColumnDefinition Width="2*" />
 | 
			
		||||
                <ColumnDefinition Width="5*"/>
 | 
			
		||||
            </Grid.ColumnDefinitions>
 | 
			
		||||
            <DatePicker
 | 
			
		||||
                Grid.Column="0"
 | 
			
		||||
                SelectedDate="{Binding StartDate, TargetNullValue=''}"
 | 
			
		||||
                Margin="6 0 0 0"
 | 
			
		||||
                materialDesign:HintAssist.Hint="开始时间"
 | 
			
		||||
                Style="{StaticResource MaterialDesignOutlinedDatePicker}"
 | 
			
		||||
            />
 | 
			
		||||
            <DatePicker
 | 
			
		||||
                Grid.Column="1"
 | 
			
		||||
                SelectedDate="{Binding EndDate}"
 | 
			
		||||
                Margin="6 0 0 0"
 | 
			
		||||
                materialDesign:HintAssist.Hint="结束时间"
 | 
			
		||||
                Style="{StaticResource MaterialDesignOutlinedDatePicker}"
 | 
			
		||||
            />
 | 
			
		||||
            <!--<ComboBox
 | 
			
		||||
                    Margin="12 0 0 0"
 | 
			
		||||
                    Grid.Column="2"
 | 
			
		||||
                    materialDesign:HintAssist.Hint="药品名称"
 | 
			
		||||
                    IsEditable="True"
 | 
			
		||||
                    ItemsSource="{Binding DrugInfos}"
 | 
			
		||||
                    SelectedItem="{Binding DrugInfo}"
 | 
			
		||||
                    DisplayMemberPath="DrugName"
 | 
			
		||||
                />-->
 | 
			
		||||
            <ComboBox
 | 
			
		||||
                    Margin="6 0 6 0"
 | 
			
		||||
                    Grid.Column="2"
 | 
			
		||||
                    materialDesign:HintAssist.Hint="药品名称/拼音码/药品编码"
 | 
			
		||||
                    ItemsSource="{Binding DrugInfos}"
 | 
			
		||||
                    SelectedItem="{Binding DrugInfo}"
 | 
			
		||||
                    DisplayMemberPath="DrugName" IsEditable="True" IsTextSearchEnabled="False" KeyUp="ComboBox_KeyUp"
 | 
			
		||||
                />
 | 
			
		||||
            <ComboBox Visibility="Collapsed"
 | 
			
		||||
                    Margin="12 0 0 0"
 | 
			
		||||
                    Grid.Column="3"
 | 
			
		||||
                    materialDesign:HintAssist.Hint="账册类型"
 | 
			
		||||
                    IsEditable="True"
 | 
			
		||||
                    ItemsSource="{Binding AccountTypeList}"
 | 
			
		||||
                    SelectedItem="{Binding AccountType}"
 | 
			
		||||
                    DisplayMemberPath="AccountTypeName"
 | 
			
		||||
                />
 | 
			
		||||
            <StackPanel Grid.Column="4" Orientation="Horizontal" HorizontalAlignment="Right">
 | 
			
		||||
                <Button Visibility="Collapsed"
 | 
			
		||||
                    Margin="0 0 3 0"
 | 
			
		||||
                    VerticalAlignment="Center"
 | 
			
		||||
                    Style="{StaticResource MaterialDesignOutlinedLightButton}"
 | 
			
		||||
                    ToolTip="导出" Command="{Binding DownloadOrderUser}">
 | 
			
		||||
                    <StackPanel Orientation="Horizontal">
 | 
			
		||||
                        <materialDesign:PackIcon Kind="download" />
 | 
			
		||||
                        <TextBlock Text="导出发药登记表" />
 | 
			
		||||
                    </StackPanel>
 | 
			
		||||
                </Button>
 | 
			
		||||
                <Button Visibility="Collapsed"
 | 
			
		||||
                    Margin="0 0 3 0"
 | 
			
		||||
                    VerticalAlignment="Center"
 | 
			
		||||
                    Style="{StaticResource MaterialDesignOutlinedLightButton}"
 | 
			
		||||
                    ToolTip="导出" Command="{Binding DownloadAccountBook}">
 | 
			
		||||
                    <StackPanel Orientation="Horizontal">
 | 
			
		||||
                        <materialDesign:PackIcon Kind="download" />
 | 
			
		||||
                        <TextBlock Text="导出账册" />
 | 
			
		||||
                    </StackPanel>
 | 
			
		||||
                </Button>
 | 
			
		||||
                <Button
 | 
			
		||||
                    Margin="0 0 3 0"
 | 
			
		||||
                    VerticalAlignment="Center"
 | 
			
		||||
                    Style="{StaticResource MaterialDesignOutlinedLightButton}"
 | 
			
		||||
                    ToolTip="导出" Command="{Binding DownloadAccountBookForDrug}">
 | 
			
		||||
                    <StackPanel Orientation="Horizontal">
 | 
			
		||||
                        <materialDesign:PackIcon Kind="download" />
 | 
			
		||||
                        <TextBlock Text="药品专用账册" />
 | 
			
		||||
                    </StackPanel>
 | 
			
		||||
                </Button>
 | 
			
		||||
                <Button
 | 
			
		||||
                    Margin="0 0 3 0"
 | 
			
		||||
                    VerticalAlignment="Center"
 | 
			
		||||
                    Style="{StaticResource MaterialDesignOutlinedLightButton}"
 | 
			
		||||
                    ToolTip="导出" Command="{Binding DownloadAccountBookForOrder}">
 | 
			
		||||
                    <StackPanel Orientation="Horizontal">
 | 
			
		||||
                        <materialDesign:PackIcon Kind="download" />
 | 
			
		||||
                        <TextBlock Text="处方专用账册" />
 | 
			
		||||
                    </StackPanel>
 | 
			
		||||
                </Button>
 | 
			
		||||
                <Button
 | 
			
		||||
                Margin="0 0 6 0"
 | 
			
		||||
                VerticalAlignment="Center"
 | 
			
		||||
                Style="{StaticResource MaterialDesignOutlinedLightButton}"
 | 
			
		||||
                ToolTip="刷新" Command="{Binding Query}">
 | 
			
		||||
                    <materialDesign:PackIcon
 | 
			
		||||
                    Kind="Refresh" />
 | 
			
		||||
                </Button>
 | 
			
		||||
            </StackPanel>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
        </Grid>
 | 
			
		||||
        <DataGrid x:Name="dgv1" Visibility="Collapsed"
 | 
			
		||||
                Grid.Row="1"
 | 
			
		||||
                materialDesign:DataGridAssist.ColumnHeaderPadding="15"
 | 
			
		||||
                ItemsSource="{Binding AccountList}"
 | 
			
		||||
                materialDesign:DataGridAssist.EnableEditBoxAssist="False"
 | 
			
		||||
                IsSynchronizedWithCurrentItem="True"
 | 
			
		||||
                materialDesign:DataGridAssist.CellPadding="13"
 | 
			
		||||
                CanUserAddRows="False"
 | 
			
		||||
                AutoGenerateColumns="False" >
 | 
			
		||||
            <DataGrid.Resources>
 | 
			
		||||
                <Style TargetType="{x:Type DataGridColumnHeader}" BasedOn="{StaticResource MaterialDesignDataGridColumnHeader}">
 | 
			
		||||
                    <Setter Property="Background" Value="#31ccec" />
 | 
			
		||||
                    <Setter Property="Foreground" Value="white" />
 | 
			
		||||
                    <Setter Property="Height" Value="56" />
 | 
			
		||||
                    <Setter Property="BorderBrush" Value="white"/>
 | 
			
		||||
                    <Setter Property="BorderThickness" Value="0.6"/>
 | 
			
		||||
                    <Setter Property="HorizontalContentAlignment" Value="Center"/>
 | 
			
		||||
                </Style>
 | 
			
		||||
                <Style TargetType="{x:Type DataGridCell}" BasedOn="{StaticResource MaterialDesignDataGridCell}">
 | 
			
		||||
                    <Style.Triggers>
 | 
			
		||||
                        <Trigger Property="IsReadOnly" Value="True">
 | 
			
		||||
                            <Setter Property="BorderBrush" Value="Transparent" />
 | 
			
		||||
                            <Setter Property="Background" Value="Transparent"/>
 | 
			
		||||
                            <!--<Setter Property="HorizontalAlignment" Value="Left"/>-->
 | 
			
		||||
                        </Trigger>
 | 
			
		||||
                    </Style.Triggers>
 | 
			
		||||
                </Style>
 | 
			
		||||
            </DataGrid.Resources>
 | 
			
		||||
            <DataGrid.Columns>
 | 
			
		||||
                <DataGridTextColumn Width="80"
 | 
			
		||||
                        Binding="{Binding CreateDate}"
 | 
			
		||||
                        Header="日期"
 | 
			
		||||
                        IsReadOnly="True"
 | 
			
		||||
                        ElementStyle="{StaticResource MaterialDesignDataGridTextColumnStyle}"/>
 | 
			
		||||
                <DataGridTextColumn Width="150"
 | 
			
		||||
                        Binding="{Binding DrugName}"
 | 
			
		||||
                        Header="药品名称"
 | 
			
		||||
                        IsReadOnly="True"
 | 
			
		||||
                        ElementStyle="{StaticResource MaterialDesignDataGridTextColumnStyle}"/>
 | 
			
		||||
                <DataGridTextColumn Width="130"
 | 
			
		||||
                        Binding="{Binding DrugSpec}"
 | 
			
		||||
                        Header="规格"
 | 
			
		||||
                        IsReadOnly="True"
 | 
			
		||||
                        ElementStyle="{StaticResource MaterialDesignDataGridTextColumnStyle}"/>
 | 
			
		||||
                <DataGridTextColumn Width="200"
 | 
			
		||||
                        Binding="{Binding Manufactory}"
 | 
			
		||||
                        Header="厂家"
 | 
			
		||||
                        IsReadOnly="True"
 | 
			
		||||
                        ElementStyle="{StaticResource MaterialDesignDataGridTextColumnStyle}"/>
 | 
			
		||||
                <DataGridTextColumn Width="100"
 | 
			
		||||
                        Binding="{Binding InvoiceNo}"
 | 
			
		||||
                        Header="凭证号"
 | 
			
		||||
                        IsReadOnly="True"
 | 
			
		||||
                        ElementStyle="{StaticResource MaterialDesignDataGridTextColumnStyle}"/>
 | 
			
		||||
                <DataGridTextColumn Width="130"
 | 
			
		||||
                        Binding="{Binding ManuNo}"
 | 
			
		||||
                        Header="批号"
 | 
			
		||||
                        IsReadOnly="True"
 | 
			
		||||
                        ElementStyle="{StaticResource MaterialDesignDataGridTextColumnStyle}"/>
 | 
			
		||||
                <DataGridTextColumn Width="100"
 | 
			
		||||
                        Binding="{Binding EffDate, StringFormat='yy/MM/dd'}"
 | 
			
		||||
                        Header="有效期"
 | 
			
		||||
                        IsReadOnly="True"
 | 
			
		||||
                        ElementStyle="{StaticResource MaterialDesignDataGridTextColumnStyle}"/>
 | 
			
		||||
                <DataGridTextColumn Width="75"
 | 
			
		||||
                        Binding="{Binding YQuantity}"
 | 
			
		||||
                        Header="上日结存"
 | 
			
		||||
                        IsReadOnly="True"
 | 
			
		||||
                        ElementStyle="{StaticResource MaterialDesignDataGridTextColumnStyle}"/>
 | 
			
		||||
                <DataGridTextColumn Width="75"
 | 
			
		||||
                        Binding="{Binding AddQuantity}"
 | 
			
		||||
                        Header="借入数"
 | 
			
		||||
                        IsReadOnly="True"
 | 
			
		||||
                        ElementStyle="{StaticResource MaterialDesignDataGridTextColumnStyle}"/>
 | 
			
		||||
                <DataGridTextColumn Width="75"
 | 
			
		||||
                        Binding="{Binding OutQuantity}"
 | 
			
		||||
                        Header="发出数"
 | 
			
		||||
                        IsReadOnly="True"
 | 
			
		||||
                        ElementStyle="{StaticResource MaterialDesignDataGridTextColumnStyle}"/>
 | 
			
		||||
                <DataGridTextColumn Width="75"
 | 
			
		||||
                        Binding="{Binding ManuStock}"
 | 
			
		||||
                        Header="批次结存"
 | 
			
		||||
                        IsReadOnly="True"
 | 
			
		||||
                        ElementStyle="{StaticResource MaterialDesignDataGridTextColumnStyle}"/>
 | 
			
		||||
                <DataGridTextColumn Width="75"
 | 
			
		||||
                        Binding="{Binding TotalStock}"
 | 
			
		||||
                        Header="总结存"
 | 
			
		||||
                        IsReadOnly="True"
 | 
			
		||||
                        ElementStyle="{StaticResource MaterialDesignDataGridTextColumnStyle}"/>
 | 
			
		||||
                <DataGridTextColumn Width="75"
 | 
			
		||||
                        Binding="{Binding OperatorName}"
 | 
			
		||||
                        Header="发药人"
 | 
			
		||||
                        IsReadOnly="True"
 | 
			
		||||
                        ElementStyle="{StaticResource MaterialDesignDataGridTextColumnStyle}"/>
 | 
			
		||||
                <DataGridTextColumn Width="75"
 | 
			
		||||
                        Binding="{Binding ReviewerName}"
 | 
			
		||||
                        Header="复核人"
 | 
			
		||||
                        IsReadOnly="True"
 | 
			
		||||
                        ElementStyle="{StaticResource MaterialDesignDataGridTextColumnStyle}"/>
 | 
			
		||||
                <!--<DataGridTextColumn Width="100"
 | 
			
		||||
                        Binding="{Binding SupplierDept}"
 | 
			
		||||
                        Header="供应单位"
 | 
			
		||||
                        IsReadOnly="True"
 | 
			
		||||
                        ElementStyle="{StaticResource MaterialDesignDataGridTextColumnStyle}"/>
 | 
			
		||||
                <DataGridTextColumn Width="100"
 | 
			
		||||
                        Binding="{Binding ReceiveDept}"
 | 
			
		||||
                        Header="领用部门"
 | 
			
		||||
                        IsReadOnly="True"
 | 
			
		||||
                        ElementStyle="{StaticResource MaterialDesignDataGridTextColumnStyle}"/>-->
 | 
			
		||||
 | 
			
		||||
            </DataGrid.Columns>
 | 
			
		||||
        </DataGrid>
 | 
			
		||||
 | 
			
		||||
        <!--<pagination:Pagination Grid.Row="2"
 | 
			
		||||
                                   CurrentPage="{Binding PageNum}"
 | 
			
		||||
                                   PageSize="{Binding PageSize}"
 | 
			
		||||
                                   TotalPages="{Binding TotalCount}"
 | 
			
		||||
                                   InfoTextIsEnabel="True"
 | 
			
		||||
                                />-->
 | 
			
		||||
    </Grid>
 | 
			
		||||
</UserControl>
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,51 @@
 | 
			
		|||
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
 | 
			
		||||
    {
 | 
			
		||||
        AccountWindowViewModel vms;
 | 
			
		||||
        public AccountWindow()
 | 
			
		||||
        {
 | 
			
		||||
            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 = AccountWindowViewModel.vm;
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,266 @@
 | 
			
		|||
<UserControl x:Class="DM_Weight.Views.ApplyInStockWindow"
 | 
			
		||||
             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:pagination="clr-namespace:DM_Weight.Components.pagination"
 | 
			
		||||
             xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes" 
 | 
			
		||||
             xmlns:local="clr-namespace:DM_Weight.Views"
 | 
			
		||||
             mc:Ignorable="d" 
 | 
			
		||||
             xmlns:i="http://schemas.microsoft.com/xaml/behaviors"
 | 
			
		||||
             xmlns:prism="http://prismlibrary.com/"
 | 
			
		||||
             xmlns:convert="clr-namespace:DM_Weight.Converter">
 | 
			
		||||
    <UserControl.Resources>
 | 
			
		||||
        <Style x:Key="st" TargetType="GridViewColumnHeader">
 | 
			
		||||
            <Style.Setters>
 | 
			
		||||
                <Setter Property="Height">
 | 
			
		||||
                    <Setter.Value>55</Setter.Value>
 | 
			
		||||
                </Setter>
 | 
			
		||||
                <Setter Property="Background">
 | 
			
		||||
                    <Setter.Value>#31ccec</Setter.Value>
 | 
			
		||||
                </Setter>
 | 
			
		||||
                <Setter Property="Foreground">
 | 
			
		||||
                    <Setter.Value>white</Setter.Value>
 | 
			
		||||
                </Setter>
 | 
			
		||||
            </Style.Setters>
 | 
			
		||||
        </Style>
 | 
			
		||||
    </UserControl.Resources>
 | 
			
		||||
    <Grid>
 | 
			
		||||
        <!--<Grid.Resources>
 | 
			
		||||
        <CollectionViewSource x:Key="GroupedDataList" Source="{Binding ChannelStocks}">
 | 
			
		||||
            <CollectionViewSource.GroupDescriptions>
 | 
			
		||||
                <PropertyGroupDescription PropertyName="DrugInfo" />
 | 
			
		||||
            </CollectionViewSource.GroupDescriptions>
 | 
			
		||||
        </CollectionViewSource>
 | 
			
		||||
        </Grid.Resources>-->
 | 
			
		||||
        <Grid.Resources>
 | 
			
		||||
            <convert:GroupSumConverter x:Key="GroupSumConverter" />
 | 
			
		||||
            <convert:StatusConverter x:Key="StatusConverter" />
 | 
			
		||||
        </Grid.Resources>
 | 
			
		||||
        <Grid.ColumnDefinitions>
 | 
			
		||||
            <ColumnDefinition Width="4*" />
 | 
			
		||||
            <ColumnDefinition Width="6*"/>
 | 
			
		||||
        </Grid.ColumnDefinitions>
 | 
			
		||||
        <Grid Grid.Column="0" >
 | 
			
		||||
            <Grid.RowDefinitions>
 | 
			
		||||
                <RowDefinition Height="Auto" />
 | 
			
		||||
                <RowDefinition />
 | 
			
		||||
                <RowDefinition Height="Auto" />
 | 
			
		||||
            </Grid.RowDefinitions>
 | 
			
		||||
            <Grid Margin="0 6 0 6" Grid.Row="0">
 | 
			
		||||
                <Grid.ColumnDefinitions>
 | 
			
		||||
                    <ColumnDefinition Width="3*" />
 | 
			
		||||
                    <ColumnDefinition Width="3*" />
 | 
			
		||||
                    <ColumnDefinition Width="4*" />
 | 
			
		||||
                </Grid.ColumnDefinitions>
 | 
			
		||||
                <ComboBox
 | 
			
		||||
                Grid.Column="0"
 | 
			
		||||
                Margin="6 0 0 0"
 | 
			
		||||
                Style="{StaticResource MaterialDesignOutlinedComboBox}"
 | 
			
		||||
                SelectedItem="{Binding SelectedItem}"
 | 
			
		||||
                DisplayMemberPath="Name"
 | 
			
		||||
                ItemsSource="{Binding OrderTakeSelects}"
 | 
			
		||||
                />
 | 
			
		||||
                <TextBox
 | 
			
		||||
                Grid.Column="1"
 | 
			
		||||
                Text="{Binding SearchValue, UpdateSourceTrigger=PropertyChanged}"
 | 
			
		||||
                materialDesign:HintAssist.Hint="{Binding SelectedItem.Name}"
 | 
			
		||||
                materialDesign:HintAssist.IsFloating="True"
 | 
			
		||||
                Margin="6 0 0 0"
 | 
			
		||||
                Style="{StaticResource MaterialDesignOutlinedTextBox}"/>
 | 
			
		||||
                <DatePicker
 | 
			
		||||
                Grid.Column="2"
 | 
			
		||||
                SelectedDate="{Binding OrderDate, StringFormat=yyyy-MM-dd, TargetNullValue='',UpdateSourceTrigger=PropertyChanged}"
 | 
			
		||||
                SelectedDateFormat="Short"
 | 
			
		||||
                Margin="6 0 0 0"
 | 
			
		||||
                materialDesign:HintAssist.Hint="日期"
 | 
			
		||||
                Style="{StaticResource MaterialDesignOutlinedDatePicker}" />
 | 
			
		||||
 | 
			
		||||
            </Grid>
 | 
			
		||||
            <ListView Grid.Row="1"
 | 
			
		||||
                    ItemsSource="{Binding _DrugPleaseClaimList}"
 | 
			
		||||
                    SelectedItem="{Binding SelectDrugPleaseClaim}"
 | 
			
		||||
                    materialDesign:ListViewAssist.HeaderRowBackground="#31ccec"
 | 
			
		||||
                    materialDesign:DataGridAssist.ColumnHeaderPadding="10"
 | 
			
		||||
                    materialDesign:ListViewAssist.ListViewItemPadding="13">
 | 
			
		||||
                <ListView.Resources>
 | 
			
		||||
                    <Style TargetType="{x:Type GridViewColumnHeader}" BasedOn="{StaticResource {x:Type GridViewColumnHeader}}">
 | 
			
		||||
                        <Setter Property="Foreground" Value="White" />
 | 
			
		||||
                    </Style>
 | 
			
		||||
                </ListView.Resources>
 | 
			
		||||
                <i:Interaction.Triggers>
 | 
			
		||||
                    <i:EventTrigger EventName="SelectionChanged">
 | 
			
		||||
                        <i:InvokeCommandAction Command="{Binding RowSelected}" />
 | 
			
		||||
                    </i:EventTrigger>
 | 
			
		||||
                </i:Interaction.Triggers>
 | 
			
		||||
                <ListView.View>
 | 
			
		||||
                    <GridView ColumnHeaderContainerStyle="{StaticResource st}">
 | 
			
		||||
                        <GridViewColumn Width="110"
 | 
			
		||||
                        Header="请领单号"
 | 
			
		||||
                        DisplayMemberBinding="{Binding PleaseNo}"/>
 | 
			
		||||
                        <GridViewColumn Width="100"
 | 
			
		||||
                        Header="时间"
 | 
			
		||||
                        DisplayMemberBinding="{Binding DoDate, StringFormat=yyyy-MM-dd}" />
 | 
			
		||||
                        <GridViewColumn Width="100"
 | 
			
		||||
                        DisplayMemberBinding="{Binding GetQuantity}"
 | 
			
		||||
                        Header="药品种类"/>
 | 
			
		||||
                        <GridViewColumn Width="100"
 | 
			
		||||
                        DisplayMemberBinding="{Binding TotalQuantity}"
 | 
			
		||||
                        Header="药品总数"/>
 | 
			
		||||
                        <!--<GridViewColumn
 | 
			
		||||
                        DisplayMemberBinding="{Binding Status}"
 | 
			
		||||
                        Header="状态"/>-->
 | 
			
		||||
                    </GridView>
 | 
			
		||||
                </ListView.View>
 | 
			
		||||
            </ListView>
 | 
			
		||||
 | 
			
		||||
            <pagination:Pagination Grid.Row="2"
 | 
			
		||||
                                   CurrentPage="{Binding PageNum}"
 | 
			
		||||
                                   PageSize="{Binding PageSize}"
 | 
			
		||||
                                   TotalPages="{Binding TotalCount}"
 | 
			
		||||
                                   InfoTextIsEnabel="True"
 | 
			
		||||
                                />
 | 
			
		||||
        </Grid>
 | 
			
		||||
        <Grid Grid.Column="1" Margin="10 0 0 0">
 | 
			
		||||
            <Grid.RowDefinitions>
 | 
			
		||||
                <RowDefinition Height="61" />
 | 
			
		||||
                <RowDefinition />
 | 
			
		||||
            </Grid.RowDefinitions>
 | 
			
		||||
            <StackPanel Orientation="Horizontal" HorizontalAlignment="Right">
 | 
			
		||||
                <Button
 | 
			
		||||
                    Margin="0 0 6 0"
 | 
			
		||||
                    VerticalAlignment="Center"
 | 
			
		||||
                    Style="{StaticResource MaterialDesignOutlinedLightButton}"
 | 
			
		||||
                    Command="{Binding OpenInvoiceAdd}"
 | 
			
		||||
                    Visibility="{Binding Status,Converter={StaticResource StatusConverter}, ConverterParameter=opearBtnVisible}"
 | 
			
		||||
                    materialDesign:ButtonProgressAssist.IsIndicatorVisible="{Binding Status, Converter={StaticResource StatusConverter}, ConverterParameter=opearBtnLoading}"
 | 
			
		||||
                    materialDesign:ButtonProgressAssist.IsIndeterminate="{Binding Status, Converter={StaticResource StatusConverter}, ConverterParameter=opearBtnLoading}"
 | 
			
		||||
                    Content="入库"
 | 
			
		||||
                    />
 | 
			
		||||
                <Button
 | 
			
		||||
                    Margin="0 0 3 0"
 | 
			
		||||
                    VerticalAlignment="Center"
 | 
			
		||||
                    Command="{Binding TakeFinish}"
 | 
			
		||||
                    Visibility="{Binding Status, Converter={StaticResource StatusConverter}, ConverterParameter=CompleteBtn}"
 | 
			
		||||
                    Style="{StaticResource MaterialDesignOutlinedLightButton}"
 | 
			
		||||
                    Content="完成" />
 | 
			
		||||
 | 
			
		||||
                <Button
 | 
			
		||||
                    Margin="0 0 6 0"
 | 
			
		||||
                    VerticalAlignment="Center"
 | 
			
		||||
                    Command="{Binding CancleTake}"
 | 
			
		||||
                    Visibility="{Binding Status, Converter={StaticResource StatusConverter}, ConverterParameter=CancelBtn}"
 | 
			
		||||
                    Style="{StaticResource MaterialDesignOutlinedLightButton}"
 | 
			
		||||
                    Content="取消" />
 | 
			
		||||
                <Button
 | 
			
		||||
                    Margin="0 0 6 0"
 | 
			
		||||
                    VerticalAlignment="Center"
 | 
			
		||||
                    Style="{StaticResource MaterialDesignOutlinedLightButton}"
 | 
			
		||||
                    Command="{Binding QueryCommand}"
 | 
			
		||||
                    ToolTip="刷新">
 | 
			
		||||
                    <materialDesign:PackIcon
 | 
			
		||||
                    Kind="Refresh" />
 | 
			
		||||
                </Button>
 | 
			
		||||
            </StackPanel>
 | 
			
		||||
            <DataGrid
 | 
			
		||||
                Grid.Row="1"
 | 
			
		||||
                materialDesign:DataGridAssist.ColumnHeaderPadding="15" 
 | 
			
		||||
                 ItemsSource="{Binding ChannelStocks}"
 | 
			
		||||
                materialDesign:DataGridAssist.EnableEditBoxAssist="False"
 | 
			
		||||
                IsSynchronizedWithCurrentItem="True"
 | 
			
		||||
                materialDesign:DataGridAssist.CellPadding="13"
 | 
			
		||||
                CanUserAddRows="False"
 | 
			
		||||
                AutoGenerateColumns="False">
 | 
			
		||||
                <DataGrid.Resources>
 | 
			
		||||
                    <Style TargetType="{x:Type DataGridColumnHeader}" BasedOn="{StaticResource MaterialDesignDataGridColumnHeader}">
 | 
			
		||||
                        <Setter Property="Background" Value="#31ccec" />
 | 
			
		||||
                        <Setter Property="Foreground" Value="white" />
 | 
			
		||||
                        <Setter Property="Height" Value="56" />
 | 
			
		||||
                        <Setter Property="BorderBrush" Value="white"/>
 | 
			
		||||
                        <Setter Property="BorderThickness" Value="0.6"/>
 | 
			
		||||
                        <Setter Property="HorizontalContentAlignment" Value="Center"/>
 | 
			
		||||
                    </Style>
 | 
			
		||||
                    <Style TargetType="{x:Type DataGridCell}" BasedOn="{StaticResource MaterialDesignDataGridCell}">
 | 
			
		||||
                        <Style.Triggers>
 | 
			
		||||
                            <Trigger Property="IsReadOnly" Value="True">
 | 
			
		||||
                                <Setter Property="BorderBrush" Value="Transparent" />
 | 
			
		||||
                                <Setter Property="HorizontalAlignment" Value="Left"/>
 | 
			
		||||
                            </Trigger>
 | 
			
		||||
                        </Style.Triggers>
 | 
			
		||||
                    </Style>
 | 
			
		||||
                </DataGrid.Resources>
 | 
			
		||||
                <!--GroupStyle to group data-->
 | 
			
		||||
                <DataGrid.GroupStyle>
 | 
			
		||||
                    <GroupStyle>
 | 
			
		||||
                        <!--Group DataItems into DataGroup-->
 | 
			
		||||
                        <GroupStyle.ContainerStyle>
 | 
			
		||||
                            <Style TargetType="{x:Type GroupItem}">
 | 
			
		||||
                                <Setter Property="Template">
 | 
			
		||||
                                    <Setter.Value>
 | 
			
		||||
                                        <ControlTemplate TargetType="{x:Type GroupItem}">
 | 
			
		||||
                                            <Expander IsExpanded="True"
 | 
			
		||||
                                                  materialDesign:ExpanderAssist.HeaderBackground="PaleTurquoise">
 | 
			
		||||
                                                <Expander.Header >
 | 
			
		||||
                                                    <StackPanel Orientation="Horizontal">
 | 
			
		||||
                                                        <TextBlock Text="{Binding Path=Name.DrugInfo.DrugName,StringFormat=药品:{0},}" FontWeight="Bold" />
 | 
			
		||||
                                                        <TextBlock FontWeight="Bold" Text="{Binding Path=Name.DrugInfo.DrugSpec,StringFormat=规格:{0},}" />
 | 
			
		||||
                                                        <TextBlock FontWeight="Bold" Text="{Binding Path=Name.DrugInfo.Manufactory,StringFormat=厂家:{0},}" />
 | 
			
		||||
                                                        <TextBlock FontWeight="Bold" Text="{Binding Path=Items,Converter={StaticResource GroupSumConverter}}" />
 | 
			
		||||
 | 
			
		||||
                                                        <!--<TextBlock FontWeight="Bold" Text="{Binding Path=Items,Converter={StaticResource GroupSumConverter}}" />-->
 | 
			
		||||
 | 
			
		||||
                                                    </StackPanel>
 | 
			
		||||
                                                </Expander.Header>
 | 
			
		||||
                                                <ItemsPresenter/>
 | 
			
		||||
                                            </Expander>
 | 
			
		||||
                                        </ControlTemplate>
 | 
			
		||||
                                    </Setter.Value>
 | 
			
		||||
                                </Setter>
 | 
			
		||||
                            </Style>
 | 
			
		||||
                        </GroupStyle.ContainerStyle>
 | 
			
		||||
 | 
			
		||||
                    </GroupStyle>
 | 
			
		||||
                </DataGrid.GroupStyle>
 | 
			
		||||
                <DataGrid.Columns>
 | 
			
		||||
                    <DataGridTextColumn Width="100"
 | 
			
		||||
                        Binding="{Binding Location}"
 | 
			
		||||
                        Header="库位"
 | 
			
		||||
                        IsReadOnly="True"
 | 
			
		||||
                        ElementStyle="{StaticResource MaterialDesignDataGridTextColumnStyle}"/>
 | 
			
		||||
                    <DataGridTextColumn  Width="147"
 | 
			
		||||
                        Binding="{Binding ManuNo}"
 | 
			
		||||
                        Header="批次"
 | 
			
		||||
                        IsReadOnly="True"
 | 
			
		||||
                        ElementStyle="{StaticResource MaterialDesignDataGridTextColumnStyle}"/>
 | 
			
		||||
                    <DataGridTextColumn  Width="147"
 | 
			
		||||
                        Binding="{Binding EffDate}"
 | 
			
		||||
                        Header="效期"
 | 
			
		||||
                        IsReadOnly="True"
 | 
			
		||||
                        ElementStyle="{StaticResource MaterialDesignDataGridTextColumnStyle}"/>
 | 
			
		||||
                    <DataGridTextColumn  Width="100"
 | 
			
		||||
                        Binding="{Binding Quantity}"
 | 
			
		||||
                        Header="库存"
 | 
			
		||||
                        IsReadOnly="True"
 | 
			
		||||
                        ElementStyle="{StaticResource MaterialDesignDataGridTextColumnStyle}"/>
 | 
			
		||||
                    <DataGridTemplateColumn Width="100"
 | 
			
		||||
                        Header="添加数量">
 | 
			
		||||
                        <DataGridTemplateColumn.CellTemplate>
 | 
			
		||||
                            <DataTemplate>
 | 
			
		||||
                                <TextBox Style="{StaticResource MaterialDesignDataGridTextColumnEditingStyle}">
 | 
			
		||||
                                    <TextBox.Text>
 | 
			
		||||
                                        <Binding Path="AddQuantity" Mode="TwoWay" UpdateSourceTrigger="PropertyChanged">
 | 
			
		||||
                                            <Binding.ValidationRules>
 | 
			
		||||
                                                <ExceptionValidationRule />
 | 
			
		||||
                                            </Binding.ValidationRules>
 | 
			
		||||
                                        </Binding>
 | 
			
		||||
                                    </TextBox.Text>
 | 
			
		||||
                                </TextBox>
 | 
			
		||||
                            </DataTemplate>
 | 
			
		||||
                        </DataGridTemplateColumn.CellTemplate>
 | 
			
		||||
                    </DataGridTemplateColumn>
 | 
			
		||||
                </DataGrid.Columns>
 | 
			
		||||
            </DataGrid>
 | 
			
		||||
        </Grid>
 | 
			
		||||
 | 
			
		||||
    </Grid>
 | 
			
		||||
</UserControl>
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,28 @@
 | 
			
		|||
using System;
 | 
			
		||||
using System.Collections.Generic;
 | 
			
		||||
using System.Linq;
 | 
			
		||||
using System.Text;
 | 
			
		||||
using System.Threading.Tasks;
 | 
			
		||||
using System.Windows;
 | 
			
		||||
using System.Windows.Controls;
 | 
			
		||||
using System.Windows.Data;
 | 
			
		||||
using System.Windows.Documents;
 | 
			
		||||
using System.Windows.Input;
 | 
			
		||||
using System.Windows.Media;
 | 
			
		||||
using System.Windows.Media.Imaging;
 | 
			
		||||
using System.Windows.Navigation;
 | 
			
		||||
using System.Windows.Shapes;
 | 
			
		||||
 | 
			
		||||
namespace DM_Weight.Views
 | 
			
		||||
{
 | 
			
		||||
    /// <summary>
 | 
			
		||||
    /// ApplyInStockWindow.xaml 的交互逻辑
 | 
			
		||||
    /// </summary>
 | 
			
		||||
    public partial class ApplyInStockWindow : UserControl
 | 
			
		||||
    {
 | 
			
		||||
        public ApplyInStockWindow()
 | 
			
		||||
        {
 | 
			
		||||
            InitializeComponent();
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,283 @@
 | 
			
		|||
<UserControl x:Class="DM_Weight.Views.ApplyListWindow" 
 | 
			
		||||
             xmlns:pagination="clr-namespace:DM_Weight.Components.pagination"
 | 
			
		||||
              xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
 | 
			
		||||
             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:i="http://schemas.microsoft.com/xaml/behaviors"
 | 
			
		||||
             xmlns:local="clr-namespace:DM_Weight.Views"
 | 
			
		||||
             mc:Ignorable="d" 
 | 
			
		||||
             xmlns:convert="clr-namespace:DM_Weight.Converter" 
 | 
			
		||||
             xmlns:prism="http://prismlibrary.com/">
 | 
			
		||||
    <UserControl.Resources>
 | 
			
		||||
        <convert:ApplyListConverter x:Key="ApplyListConverter" />
 | 
			
		||||
        <Style x:Key="st" TargetType="GridViewColumnHeader">
 | 
			
		||||
            <Style.Setters>
 | 
			
		||||
                <Setter Property="Height">
 | 
			
		||||
                    <Setter.Value>55</Setter.Value>
 | 
			
		||||
                </Setter>
 | 
			
		||||
                <Setter Property="Background">
 | 
			
		||||
                    <Setter.Value>#31ccec</Setter.Value>
 | 
			
		||||
                </Setter>
 | 
			
		||||
                <Setter Property="Foreground">
 | 
			
		||||
                    <Setter.Value>white</Setter.Value>
 | 
			
		||||
                </Setter>
 | 
			
		||||
            </Style.Setters>
 | 
			
		||||
        </Style>
 | 
			
		||||
    </UserControl.Resources>
 | 
			
		||||
    <Grid>
 | 
			
		||||
        <Grid.Resources>
 | 
			
		||||
            <CollectionViewSource x:Key="GroupedDataList" Source="{Binding CollectDrugLst}">
 | 
			
		||||
                <CollectionViewSource.GroupDescriptions>
 | 
			
		||||
                    <PropertyGroupDescription PropertyName="drugPleaseClaim" />
 | 
			
		||||
                </CollectionViewSource.GroupDescriptions>
 | 
			
		||||
            </CollectionViewSource>
 | 
			
		||||
        </Grid.Resources>
 | 
			
		||||
        <Grid.RowDefinitions>
 | 
			
		||||
            <RowDefinition Height="Auto" />
 | 
			
		||||
            <RowDefinition />
 | 
			
		||||
        </Grid.RowDefinitions>
 | 
			
		||||
        <Grid Margin="0 6 0 6" Grid.Row="0">
 | 
			
		||||
            <Grid.ColumnDefinitions>
 | 
			
		||||
                <ColumnDefinition Width="1*" />
 | 
			
		||||
                <ColumnDefinition Width="2*" />
 | 
			
		||||
                <ColumnDefinition Width="2*" />
 | 
			
		||||
                <ColumnDefinition Width="5*"/>
 | 
			
		||||
            </Grid.ColumnDefinitions>
 | 
			
		||||
            <ComboBox
 | 
			
		||||
                Grid.Column="0"
 | 
			
		||||
                Margin="6 0 0 0"
 | 
			
		||||
                Style="{StaticResource MaterialDesignOutlinedComboBox}"
 | 
			
		||||
                SelectedItem="{Binding SelectedItem}"
 | 
			
		||||
                DisplayMemberPath="Name"
 | 
			
		||||
                ItemsSource="{Binding Selects}"
 | 
			
		||||
                />
 | 
			
		||||
            <TextBox
 | 
			
		||||
                Grid.Column="1"
 | 
			
		||||
                Text="{Binding SearchValue}"
 | 
			
		||||
                materialDesign:HintAssist.Hint="{Binding SelectedItem.Name}"
 | 
			
		||||
                Margin="6 0 0 0"
 | 
			
		||||
                Style="{StaticResource MaterialDesignOutlinedTextBox}"/>
 | 
			
		||||
            <ComboBox
 | 
			
		||||
                    Margin="12 0 0 0"
 | 
			
		||||
                    Grid.Column="2"
 | 
			
		||||
                    materialDesign:HintAssist.Hint="请领单状态"
 | 
			
		||||
                    IsEditable="True"
 | 
			
		||||
                    ItemsSource="{Binding DrugPleaseStateList}"
 | 
			
		||||
                    SelectedItem="{Binding _DrugPleaseState}"
 | 
			
		||||
                    DisplayMemberPath="StateName"
 | 
			
		||||
                />
 | 
			
		||||
            <StackPanel Grid.Column="3" Orientation="Horizontal" HorizontalAlignment="Right">
 | 
			
		||||
                <Button
 | 
			
		||||
                Margin="0 0 6 0"
 | 
			
		||||
                VerticalAlignment="Center"
 | 
			
		||||
                Style="{StaticResource MaterialDesignOutlinedLightButton}"
 | 
			
		||||
                ToolTip="刷新" Command="{Binding Query}">
 | 
			
		||||
                    <materialDesign:PackIcon
 | 
			
		||||
                    Kind="Refresh" />
 | 
			
		||||
                </Button>
 | 
			
		||||
            </StackPanel>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
        </Grid>
 | 
			
		||||
        <DataGrid
 | 
			
		||||
                Grid.Row="1"
 | 
			
		||||
                materialDesign:DataGridAssist.ColumnHeaderPadding="15"
 | 
			
		||||
                ItemsSource="{Binding Source={StaticResource GroupedDataList}}"
 | 
			
		||||
                SelectedItem="SelectDrugPleaseClaim"
 | 
			
		||||
                materialDesign:DataGridAssist.EnableEditBoxAssist="False"
 | 
			
		||||
                IsSynchronizedWithCurrentItem="True"
 | 
			
		||||
                materialDesign:DataGridAssist.CellPadding="13"
 | 
			
		||||
                CanUserAddRows="False"
 | 
			
		||||
                AutoGenerateColumns="False">
 | 
			
		||||
            <DataGrid.Resources>
 | 
			
		||||
                <Style TargetType="{x:Type DataGridColumnHeader}" BasedOn="{StaticResource MaterialDesignDataGridColumnHeader}">
 | 
			
		||||
                    <Setter Property="Background" Value="#31ccec" />
 | 
			
		||||
                    <Setter Property="Foreground" Value="white" />
 | 
			
		||||
                    <Setter Property="Height" Value="56" />
 | 
			
		||||
                    <Setter Property="BorderBrush" Value="white"/>
 | 
			
		||||
                    <Setter Property="BorderThickness" Value="0.6"/>
 | 
			
		||||
                    <Setter Property="HorizontalContentAlignment" Value="Center"/>
 | 
			
		||||
                </Style>
 | 
			
		||||
                <Style TargetType="{x:Type DataGridCell}" BasedOn="{StaticResource MaterialDesignDataGridCell}">
 | 
			
		||||
                    <Style.Triggers>
 | 
			
		||||
                        <Trigger Property="IsReadOnly" Value="True">
 | 
			
		||||
                            <Setter Property="BorderBrush" Value="Transparent" />
 | 
			
		||||
                            <Setter Property="HorizontalAlignment" Value="Left"/>
 | 
			
		||||
                        </Trigger>
 | 
			
		||||
                    </Style.Triggers>
 | 
			
		||||
                </Style>
 | 
			
		||||
            </DataGrid.Resources>
 | 
			
		||||
            <!--GroupStyle to group data-->
 | 
			
		||||
            <DataGrid.GroupStyle>
 | 
			
		||||
                <GroupStyle>
 | 
			
		||||
                    <!--Group DataItems into DataGroup-->
 | 
			
		||||
                    <GroupStyle.ContainerStyle>
 | 
			
		||||
                        <Style TargetType="{x:Type GroupItem}">
 | 
			
		||||
                            <Setter Property="Template">
 | 
			
		||||
                                <Setter.Value>
 | 
			
		||||
                                    <ControlTemplate TargetType="{x:Type GroupItem}">
 | 
			
		||||
                                        <Expander IsExpanded="True"
 | 
			
		||||
                                                  materialDesign:ExpanderAssist.HeaderBackground="PaleTurquoise">
 | 
			
		||||
                                            <Expander.Header >
 | 
			
		||||
 | 
			
		||||
                                                <StackPanel Orientation="Horizontal">
 | 
			
		||||
                                                    <TextBlock Text="{Binding Path=Name.PleaseNo,StringFormat=请领单号:{0},}" FontWeight="Bold" />
 | 
			
		||||
                                                    <TextBlock Text="{Binding Path=Name.TotalQuantity,StringFormat=请领数量:{0},}" FontWeight="Bold" />
 | 
			
		||||
                                                    <TextBlock FontWeight="Bold" Text="{Binding Path=Name.ReturnPrQuantity,StringFormat=处方张数:{0},}" />
 | 
			
		||||
                                                    <TextBlock FontWeight="Bold" Text="{Binding Path=Name.DoDate,StringFormat=请领时间:{0},}" />
 | 
			
		||||
                                                    <TextBlock FontWeight="Bold" Text="{Binding Path=Name.MachineId,Converter={StaticResource ApplyListConverter},ConverterParameter=machineId,StringFormat=请领药房:{0},}" />
 | 
			
		||||
                                                    <TextBlock FontWeight="Bold" Text="{Binding Path=Name.ApplyUser,Converter={StaticResource ApplyListConverter}, ConverterParameter=UserId, StringFormat=申请人:{0},}" />
 | 
			
		||||
                                                    <TextBlock FontWeight="Bold" Text="{Binding Path=Name.ReviewUser,Converter={StaticResource ApplyListConverter}, ConverterParameter=UserId,StringFormat=复核人:{0},}" />
 | 
			
		||||
                                                    <TextBlock FontWeight="Bold" Text="{Binding Path=Name.State,Converter={StaticResource ApplyListConverter}, ConverterParameter=PleaseStatus}" />
 | 
			
		||||
 | 
			
		||||
                                                </StackPanel>
 | 
			
		||||
                                            </Expander.Header>
 | 
			
		||||
                                            <ItemsPresenter/>
 | 
			
		||||
                                        </Expander>
 | 
			
		||||
                                    </ControlTemplate>
 | 
			
		||||
                                </Setter.Value>
 | 
			
		||||
                            </Setter>
 | 
			
		||||
                        </Style>
 | 
			
		||||
                    </GroupStyle.ContainerStyle>
 | 
			
		||||
 | 
			
		||||
                </GroupStyle>
 | 
			
		||||
            </DataGrid.GroupStyle>
 | 
			
		||||
            <DataGrid.Columns>
 | 
			
		||||
                <DataGridTextColumn Width="180"
 | 
			
		||||
                        Binding="{Binding OrderNo}"
 | 
			
		||||
                        Header="处方号"
 | 
			
		||||
                        IsReadOnly="True"
 | 
			
		||||
                        ElementStyle="{StaticResource MaterialDesignDataGridTextColumnStyle}"/>
 | 
			
		||||
                <DataGridTextColumn Width="180"
 | 
			
		||||
                        Binding="{Binding drugInfo.DrugName}"
 | 
			
		||||
                        Header="药品名称"
 | 
			
		||||
                        IsReadOnly="True"
 | 
			
		||||
                        ElementStyle="{StaticResource MaterialDesignDataGridTextColumnStyle}"/>
 | 
			
		||||
                <DataGridTextColumn Width="130"
 | 
			
		||||
                        Binding="{Binding drugInfo.DrugSpec}"
 | 
			
		||||
                        Header="规格"
 | 
			
		||||
                        IsReadOnly="True"
 | 
			
		||||
                        ElementStyle="{StaticResource MaterialDesignDataGridTextColumnStyle}"/>
 | 
			
		||||
                <DataGridTextColumn Width="241"
 | 
			
		||||
                        Binding="{Binding drugInfo.Manufactory}"
 | 
			
		||||
                        Header="厂家"
 | 
			
		||||
                        IsReadOnly="True"
 | 
			
		||||
                        ElementStyle="{StaticResource MaterialDesignDataGridTextColumnStyle}"/>
 | 
			
		||||
                <DataGridTextColumn Width="80"
 | 
			
		||||
                                    Binding="{Binding Quantity}"
 | 
			
		||||
                                    Header="数量"
 | 
			
		||||
                                    IsReadOnly="True"
 | 
			
		||||
                                    ElementStyle="{StaticResource MaterialDesignDataGridTextColumnStyle}"/>
 | 
			
		||||
                <DataGridTextColumn Width="100"
 | 
			
		||||
                        Binding="{Binding CurrentMachineId}"
 | 
			
		||||
                        Header="当前所在"
 | 
			
		||||
                        IsReadOnly="True"
 | 
			
		||||
                        ElementStyle="{StaticResource MaterialDesignDataGridTextColumnStyle}"/>
 | 
			
		||||
                <!--<DataGridTextColumn Width="80"
 | 
			
		||||
                        Binding="{Binding Status,Converter={StaticResource ApplyListConverter}, ConverterParameter=OrderStatus}"
 | 
			
		||||
                        Header="状态"
 | 
			
		||||
                        IsReadOnly="True"
 | 
			
		||||
                        ElementStyle="{StaticResource MaterialDesignDataGridTextColumnStyle}"/>-->
 | 
			
		||||
 | 
			
		||||
            </DataGrid.Columns>
 | 
			
		||||
        </DataGrid>
 | 
			
		||||
        <!--<Grid.RowDefinitions>
 | 
			
		||||
            <RowDefinition Height="Auto" />
 | 
			
		||||
            <RowDefinition />
 | 
			
		||||
            <RowDefinition Height="Auto" />
 | 
			
		||||
        </Grid.RowDefinitions>
 | 
			
		||||
        <Grid Margin="0 6 0 6" Grid.Row="0">
 | 
			
		||||
            <Grid.ColumnDefinitions>
 | 
			
		||||
                <ColumnDefinition Width="110" />
 | 
			
		||||
                <ColumnDefinition Width="180" />
 | 
			
		||||
                <ColumnDefinition />
 | 
			
		||||
            </Grid.ColumnDefinitions>
 | 
			
		||||
            <ComboBox
 | 
			
		||||
                Grid.Column="0"
 | 
			
		||||
                Margin="6 0 0 0"
 | 
			
		||||
                Style="{StaticResource MaterialDesignOutlinedComboBox}"
 | 
			
		||||
                SelectedItem="{Binding SelectedItem}"
 | 
			
		||||
                DisplayMemberPath="Name"
 | 
			
		||||
                ItemsSource="{Binding Selects}"
 | 
			
		||||
                />
 | 
			
		||||
            <TextBox
 | 
			
		||||
                Grid.Column="1"
 | 
			
		||||
                Text="{Binding SearchValue}"
 | 
			
		||||
                materialDesign:HintAssist.Hint="{Binding SelectedItem.Name}"
 | 
			
		||||
                Margin="6 0 0 0"
 | 
			
		||||
                Style="{StaticResource MaterialDesignOutlinedTextBox}"/>
 | 
			
		||||
 | 
			
		||||
            <StackPanel Grid.Column="2" Orientation="Horizontal" HorizontalAlignment="Right">
 | 
			
		||||
 | 
			
		||||
                <Button
 | 
			
		||||
                Margin="0 0 6 0"
 | 
			
		||||
                VerticalAlignment="Center"
 | 
			
		||||
                Style="{StaticResource MaterialDesignOutlinedLightButton}"
 | 
			
		||||
                ToolTip="刷新" Command="{Binding Query}">
 | 
			
		||||
                    <materialDesign:PackIcon
 | 
			
		||||
                    Kind="Refresh" />
 | 
			
		||||
                </Button>
 | 
			
		||||
 | 
			
		||||
                <Button
 | 
			
		||||
                Margin="0 0 6 0"
 | 
			
		||||
                VerticalAlignment="Center" Command="{Binding CreateApplyOrder}"
 | 
			
		||||
                Style="{StaticResource MaterialDesignOutlinedLightButton}" Content="生成请领单">
 | 
			
		||||
                </Button>
 | 
			
		||||
            </StackPanel>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
        </Grid>
 | 
			
		||||
        <ListView
 | 
			
		||||
            Grid.Row="1"
 | 
			
		||||
            ItemsSource="{Binding CollectDrugs}"
 | 
			
		||||
            SelectedItem="{Binding selectCollectDrug}"
 | 
			
		||||
            materialDesign:ListViewAssist.HeaderRowBackground="#31ccec"
 | 
			
		||||
            materialDesign:DataGridAssist.ColumnHeaderPadding="10"
 | 
			
		||||
            materialDesign:ListViewAssist.ListViewItemPadding="13">
 | 
			
		||||
            <ListView.Resources>
 | 
			
		||||
                <Style TargetType="{x:Type GridViewColumnHeader}" BasedOn="{StaticResource {x:Type GridViewColumnHeader}}">
 | 
			
		||||
                    <Setter Property="Foreground" Value="White" />
 | 
			
		||||
                </Style>
 | 
			
		||||
            </ListView.Resources>
 | 
			
		||||
            <i:Interaction.Triggers>
 | 
			
		||||
                <i:EventTrigger EventName="SelectionChanged">
 | 
			
		||||
                    <i:InvokeCommandAction Command="{Binding RowSelected}" />
 | 
			
		||||
                </i:EventTrigger>
 | 
			
		||||
            </i:Interaction.Triggers>
 | 
			
		||||
            <ListView.View>
 | 
			
		||||
                <GridView ColumnHeaderContainerStyle="{StaticResource st}">
 | 
			
		||||
                    <GridViewColumn Width="110"
 | 
			
		||||
                        Header="请领ID"
 | 
			
		||||
                        DisplayMemberBinding="{Binding PatientId}"/>
 | 
			
		||||
                    <GridViewColumn Width="130"
 | 
			
		||||
                        Header="请领数量"
 | 
			
		||||
                        DisplayMemberBinding="{Binding PName}" />
 | 
			
		||||
                    <GridViewColumn Width="80"
 | 
			
		||||
                        DisplayMemberBinding="{Binding Sex}"
 | 
			
		||||
                        Header="处方张数"/>
 | 
			
		||||
                    <GridViewColumn Width="80"
 | 
			
		||||
                        DisplayMemberBinding="{Binding Age}"
 | 
			
		||||
                        Header="类型"/>
 | 
			
		||||
                    <GridViewColumn Width="200"
 | 
			
		||||
                        DisplayMemberBinding="{Binding IdNumber}"
 | 
			
		||||
                        Header="状态"/>
 | 
			
		||||
                    <GridViewColumn  Width="200"
 | 
			
		||||
                        DisplayMemberBinding="{Binding OrderNo}"
 | 
			
		||||
                        Header="申请人"/>
 | 
			
		||||
                    <GridViewColumn Width="240"
 | 
			
		||||
                        DisplayMemberBinding="{Binding DeptName}"
 | 
			
		||||
                        Header="复核人"/>
 | 
			
		||||
                </GridView>
 | 
			
		||||
            </ListView.View>
 | 
			
		||||
        </ListView>
 | 
			
		||||
 | 
			
		||||
        <pagination:Pagination Grid.Row="2"
 | 
			
		||||
                                   CurrentPage="{Binding PageNum}"
 | 
			
		||||
                                   PageSize="{Binding PageSize}"
 | 
			
		||||
                                   TotalPages="{Binding TotalCount}"
 | 
			
		||||
                                   InfoTextIsEnabel="True"
 | 
			
		||||
                                />-->
 | 
			
		||||
    </Grid>
 | 
			
		||||
</UserControl>
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,28 @@
 | 
			
		|||
using System;
 | 
			
		||||
using System.Collections.Generic;
 | 
			
		||||
using System.Linq;
 | 
			
		||||
using System.Text;
 | 
			
		||||
using System.Threading.Tasks;
 | 
			
		||||
using System.Windows;
 | 
			
		||||
using System.Windows.Controls;
 | 
			
		||||
using System.Windows.Data;
 | 
			
		||||
using System.Windows.Documents;
 | 
			
		||||
using System.Windows.Input;
 | 
			
		||||
using System.Windows.Media;
 | 
			
		||||
using System.Windows.Media.Imaging;
 | 
			
		||||
using System.Windows.Navigation;
 | 
			
		||||
using System.Windows.Shapes;
 | 
			
		||||
 | 
			
		||||
namespace DM_Weight.Views
 | 
			
		||||
{
 | 
			
		||||
    /// <summary>
 | 
			
		||||
    /// ApplyListWindow.xaml 的交互逻辑
 | 
			
		||||
    /// </summary>
 | 
			
		||||
    public partial class ApplyListWindow : UserControl
 | 
			
		||||
    {
 | 
			
		||||
        public ApplyListWindow()
 | 
			
		||||
        {
 | 
			
		||||
            InitializeComponent();
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,136 @@
 | 
			
		|||
<UserControl x:Class="DM_Weight.Views.ChangeShiftsListWindow"
 | 
			
		||||
             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/"
 | 
			
		||||
             xmlns:convert="clr-namespace:DM_Weight.Converter"
 | 
			
		||||
             mc:Ignorable="d" 
 | 
			
		||||
             d:DesignHeight="450" d:DesignWidth="800">
 | 
			
		||||
    <UserControl.Resources>
 | 
			
		||||
        <Style x:Key="st" TargetType="GridViewColumnHeader">
 | 
			
		||||
            <Style.Setters>
 | 
			
		||||
                <Setter Property="Height">
 | 
			
		||||
                    <Setter.Value>55</Setter.Value>
 | 
			
		||||
                </Setter>
 | 
			
		||||
                <Setter Property="Background">
 | 
			
		||||
                    <Setter.Value>#31ccec</Setter.Value>
 | 
			
		||||
                </Setter>
 | 
			
		||||
                <Setter Property="Foreground">
 | 
			
		||||
                    <Setter.Value>white</Setter.Value>
 | 
			
		||||
                </Setter>
 | 
			
		||||
            </Style.Setters>
 | 
			
		||||
        </Style>
 | 
			
		||||
        <convert:ShiftsStateConverter x:Key="ShiftsStateConverter"/>
 | 
			
		||||
    </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="1.5*" />
 | 
			
		||||
                <ColumnDefinition Width="1.5*" />
 | 
			
		||||
                <ColumnDefinition Width="2*" />
 | 
			
		||||
                <ColumnDefinition Width="5*"/>
 | 
			
		||||
            </Grid.ColumnDefinitions>
 | 
			
		||||
            <DatePicker
 | 
			
		||||
                Grid.Column="0"
 | 
			
		||||
                SelectedDate="{Binding StartDate, TargetNullValue=''}"
 | 
			
		||||
                Margin="6 0 0 0"
 | 
			
		||||
                materialDesign:HintAssist.Hint="开始时间"
 | 
			
		||||
                Style="{StaticResource MaterialDesignOutlinedDatePicker}"
 | 
			
		||||
            />
 | 
			
		||||
            <DatePicker
 | 
			
		||||
                Grid.Column="1"
 | 
			
		||||
                SelectedDate="{Binding EndDate}"
 | 
			
		||||
                Margin="6 0 0 0"
 | 
			
		||||
                materialDesign:HintAssist.Hint="结束时间"
 | 
			
		||||
                Style="{StaticResource MaterialDesignOutlinedDatePicker}"
 | 
			
		||||
            />
 | 
			
		||||
 | 
			
		||||
            <StackPanel Grid.Column="3" Orientation="Horizontal" HorizontalAlignment="Right">
 | 
			
		||||
 | 
			
		||||
                <Button
 | 
			
		||||
                    Margin="0 0 3 0"
 | 
			
		||||
                    VerticalAlignment="Center"
 | 
			
		||||
                    Style="{StaticResource MaterialDesignOutlinedLightButton}"
 | 
			
		||||
                    ToolTip="导出" Command="{Binding Download}">
 | 
			
		||||
                    <StackPanel Orientation="Horizontal">
 | 
			
		||||
                        <materialDesign:PackIcon Kind="download" />
 | 
			
		||||
                        <TextBlock Text="导出记录" />
 | 
			
		||||
                    </StackPanel>
 | 
			
		||||
                </Button>
 | 
			
		||||
                <Button
 | 
			
		||||
                    Margin="0 0 3 0"
 | 
			
		||||
                    VerticalAlignment="Center"
 | 
			
		||||
                    Style="{StaticResource MaterialDesignOutlinedLightButton}"
 | 
			
		||||
                    ToolTip="交接班" Command="{Binding ShiftsCommand}">
 | 
			
		||||
                    <StackPanel Orientation="Horizontal">
 | 
			
		||||
                        <materialDesign:PackIcon Kind="CompareVertical" />
 | 
			
		||||
                        <TextBlock Text="交接班" />
 | 
			
		||||
                    </StackPanel>
 | 
			
		||||
                </Button>
 | 
			
		||||
                <Button
 | 
			
		||||
                Margin="0 0 6 0"
 | 
			
		||||
                VerticalAlignment="Center"
 | 
			
		||||
                Style="{StaticResource MaterialDesignOutlinedLightButton}"
 | 
			
		||||
                ToolTip="刷新" Command="{Binding Query}">
 | 
			
		||||
                    <materialDesign:PackIcon
 | 
			
		||||
                    Kind="Refresh" />
 | 
			
		||||
                </Button>
 | 
			
		||||
            </StackPanel>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
        </Grid>
 | 
			
		||||
        <ListView Grid.Row="1" ItemsSource="{Binding HkcChangeShifts}" 
 | 
			
		||||
                materialDesign:ListViewAssist.HeaderRowBackground="#31ccec"
 | 
			
		||||
            materialDesign:DataGridAssist.ColumnHeaderPadding="10"
 | 
			
		||||
            materialDesign:ListViewAssist.ListViewItemPadding="13">
 | 
			
		||||
 | 
			
		||||
            <ListView.Resources>
 | 
			
		||||
                <Style TargetType="{x:Type GridViewColumnHeader}" BasedOn="{StaticResource {x:Type GridViewColumnHeader}}">
 | 
			
		||||
                    <Setter Property="Foreground" Value="White" />
 | 
			
		||||
                </Style>
 | 
			
		||||
            </ListView.Resources>
 | 
			
		||||
            <ListView.View>
 | 
			
		||||
                <GridView  ColumnHeaderContainerStyle="{StaticResource st}">
 | 
			
		||||
                    <GridViewColumn  Width="180"
 | 
			
		||||
                        Header="日期"
 | 
			
		||||
                        DisplayMemberBinding="{Binding OptDate, StringFormat='yyyy-MM-dd HH:mm:ss'}" />
 | 
			
		||||
                    <GridViewColumn  Width="130"
 | 
			
		||||
                        DisplayMemberBinding="{Binding FromOperator}"
 | 
			
		||||
                        Header="交班人发药人"/>
 | 
			
		||||
                    <GridViewColumn  Width="130"
 | 
			
		||||
                        DisplayMemberBinding="{Binding FromRviewer}"
 | 
			
		||||
                        Header="交班人审核人"/>
 | 
			
		||||
                    <GridViewColumn  Width="130"
 | 
			
		||||
                        DisplayMemberBinding="{Binding ToOperator}"
 | 
			
		||||
                        Header="接班人发药人"/>
 | 
			
		||||
                    <GridViewColumn  Width="130"
 | 
			
		||||
                        DisplayMemberBinding="{Binding ToReviewer}"
 | 
			
		||||
                        Header="接班人审核人"/>
 | 
			
		||||
                    <GridViewColumn  Width="180"
 | 
			
		||||
                        DisplayMemberBinding="{Binding ToDate, StringFormat='yyyy-MM-dd HH:mm:ss'}"
 | 
			
		||||
                        Header="接班日期"/>
 | 
			
		||||
                    <GridViewColumn  Width="100"
 | 
			
		||||
                        DisplayMemberBinding="{Binding State,Converter={StaticResource ShiftsStateConverter}}"
 | 
			
		||||
                        Header="当班状态"/>
 | 
			
		||||
                </GridView>
 | 
			
		||||
            </ListView.View>
 | 
			
		||||
        </ListView>
 | 
			
		||||
 | 
			
		||||
        <pagination:Pagination Grid.Row="2"
 | 
			
		||||
                                   CurrentPage="{Binding PageNum}"
 | 
			
		||||
                                   PageSize="{Binding PageSize}"
 | 
			
		||||
                                   TotalPages="{Binding TotalCount}"
 | 
			
		||||
                                   InfoTextIsEnabel="True"
 | 
			
		||||
                                />
 | 
			
		||||
    </Grid>
 | 
			
		||||
</UserControl>
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,28 @@
 | 
			
		|||
using System;
 | 
			
		||||
using System.Collections.Generic;
 | 
			
		||||
using System.Linq;
 | 
			
		||||
using System.Text;
 | 
			
		||||
using System.Threading.Tasks;
 | 
			
		||||
using System.Windows;
 | 
			
		||||
using System.Windows.Controls;
 | 
			
		||||
using System.Windows.Data;
 | 
			
		||||
using System.Windows.Documents;
 | 
			
		||||
using System.Windows.Input;
 | 
			
		||||
using System.Windows.Media;
 | 
			
		||||
using System.Windows.Media.Imaging;
 | 
			
		||||
using System.Windows.Navigation;
 | 
			
		||||
using System.Windows.Shapes;
 | 
			
		||||
 | 
			
		||||
namespace DM_Weight.Views
 | 
			
		||||
{
 | 
			
		||||
    /// <summary>
 | 
			
		||||
    /// ChangeShiftsListWindow.xaml 的交互逻辑
 | 
			
		||||
    /// </summary>
 | 
			
		||||
    public partial class ChangeShiftsListWindow : UserControl
 | 
			
		||||
    {
 | 
			
		||||
        public ChangeShiftsListWindow()
 | 
			
		||||
        {
 | 
			
		||||
            InitializeComponent();
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,140 @@
 | 
			
		|||
<UserControl x:Class="DM_Weight.Views.CollectDrugWindow"
 | 
			
		||||
              xmlns:pagination="clr-namespace:DM_Weight.Components.pagination"
 | 
			
		||||
             xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes" 
 | 
			
		||||
             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:i="http://schemas.microsoft.com/xaml/behaviors"
 | 
			
		||||
             xmlns:local="clr-namespace:DM_Weight.Views"
 | 
			
		||||
             mc:Ignorable="d" 
 | 
			
		||||
             xmlns:convert="clr-namespace:DM_Weight.Converter"
 | 
			
		||||
             xmlns:prism="http://prismlibrary.com/">
 | 
			
		||||
    <UserControl.Resources>
 | 
			
		||||
        <convert:OrderStatusConverter x:Key="OrderStatusConverter" />
 | 
			
		||||
        <Style x:Key="st" TargetType="GridViewColumnHeader">
 | 
			
		||||
            <Style.Setters>
 | 
			
		||||
                <Setter Property="Height">
 | 
			
		||||
                    <Setter.Value>55</Setter.Value>
 | 
			
		||||
                </Setter>
 | 
			
		||||
                <Setter Property="Background">
 | 
			
		||||
                    <Setter.Value>#31ccec</Setter.Value>
 | 
			
		||||
                </Setter>
 | 
			
		||||
                <Setter Property="Foreground">
 | 
			
		||||
                    <Setter.Value>white</Setter.Value>
 | 
			
		||||
                </Setter>
 | 
			
		||||
            </Style.Setters>
 | 
			
		||||
        </Style>
 | 
			
		||||
    </UserControl.Resources>
 | 
			
		||||
    <Grid>
 | 
			
		||||
        <Grid.RowDefinitions>
 | 
			
		||||
            <RowDefinition Height="Auto" />
 | 
			
		||||
            <RowDefinition /> 
 | 
			
		||||
            <RowDefinition Height="Auto" />
 | 
			
		||||
        </Grid.RowDefinitions>
 | 
			
		||||
        <Grid Margin="0 6 0 6" Grid.Row="0">
 | 
			
		||||
            <Grid.ColumnDefinitions>
 | 
			
		||||
                <ColumnDefinition Width="110" />
 | 
			
		||||
                <ColumnDefinition Width="180" />
 | 
			
		||||
                <ColumnDefinition />
 | 
			
		||||
            </Grid.ColumnDefinitions>
 | 
			
		||||
            <ComboBox
 | 
			
		||||
                Grid.Column="0"
 | 
			
		||||
                Margin="6 0 0 0"
 | 
			
		||||
                Style="{StaticResource MaterialDesignOutlinedComboBox}"
 | 
			
		||||
                SelectedItem="{Binding SelectedItem}"
 | 
			
		||||
                DisplayMemberPath="Name"
 | 
			
		||||
                ItemsSource="{Binding Selects}"
 | 
			
		||||
                />
 | 
			
		||||
            <TextBox
 | 
			
		||||
                Grid.Column="1"
 | 
			
		||||
                Text="{Binding SearchValue}"
 | 
			
		||||
                materialDesign:HintAssist.Hint="{Binding SelectedItem.Name}"
 | 
			
		||||
                Margin="6 0 0 0"
 | 
			
		||||
                Style="{StaticResource MaterialDesignOutlinedTextBox}"/>
 | 
			
		||||
 | 
			
		||||
            <StackPanel Grid.Column="2" Orientation="Horizontal" HorizontalAlignment="Right">
 | 
			
		||||
 | 
			
		||||
                <Button
 | 
			
		||||
                Margin="0 0 6 0"
 | 
			
		||||
                VerticalAlignment="Center"
 | 
			
		||||
                Style="{StaticResource MaterialDesignOutlinedLightButton}"
 | 
			
		||||
                ToolTip="刷新" Command="{Binding Query}">
 | 
			
		||||
                    <materialDesign:PackIcon
 | 
			
		||||
                    Kind="Refresh" />
 | 
			
		||||
                </Button>
 | 
			
		||||
 | 
			
		||||
                <Button
 | 
			
		||||
                Margin="0 0 6 0"
 | 
			
		||||
                VerticalAlignment="Center" Command="{Binding CreateApplyOrder}"
 | 
			
		||||
                Style="{StaticResource MaterialDesignOutlinedLightButton}" Content="生成请领单"> 
 | 
			
		||||
                </Button>
 | 
			
		||||
            </StackPanel>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
        </Grid>
 | 
			
		||||
        <ListView
 | 
			
		||||
            Grid.Row="1"
 | 
			
		||||
            ItemsSource="{Binding CollectDrugs}"
 | 
			
		||||
            SelectedItem="{Binding selectCollectDrug}"
 | 
			
		||||
            materialDesign:ListViewAssist.HeaderRowBackground="#31ccec"
 | 
			
		||||
            materialDesign:DataGridAssist.ColumnHeaderPadding="10"
 | 
			
		||||
            materialDesign:ListViewAssist.ListViewItemPadding="13">
 | 
			
		||||
            <ListView.Resources>
 | 
			
		||||
                <Style TargetType="{x:Type GridViewColumnHeader}" BasedOn="{StaticResource {x:Type GridViewColumnHeader}}">
 | 
			
		||||
                    <Setter Property="Foreground" Value="White" />
 | 
			
		||||
                </Style>
 | 
			
		||||
            </ListView.Resources>
 | 
			
		||||
            <i:Interaction.Triggers>
 | 
			
		||||
                <i:EventTrigger EventName="SelectionChanged">
 | 
			
		||||
                    <i:InvokeCommandAction Command="{Binding RowSelected}" />
 | 
			
		||||
                </i:EventTrigger>
 | 
			
		||||
            </i:Interaction.Triggers>
 | 
			
		||||
            <ListView.View>
 | 
			
		||||
                <GridView ColumnHeaderContainerStyle="{StaticResource st}">
 | 
			
		||||
                    <GridViewColumn Header="选择" Width="60">
 | 
			
		||||
                        <GridViewColumn.CellTemplate>
 | 
			
		||||
                            <DataTemplate>
 | 
			
		||||
                                <CheckBox IsChecked="{Binding IsSelected}" />
 | 
			
		||||
                            </DataTemplate>
 | 
			
		||||
                        </GridViewColumn.CellTemplate>
 | 
			
		||||
                    </GridViewColumn>
 | 
			
		||||
                    <GridViewColumn Width="110"
 | 
			
		||||
                        Header="患者ID"
 | 
			
		||||
                        DisplayMemberBinding="{Binding PatientId}"/>
 | 
			
		||||
                    <GridViewColumn Width="130"
 | 
			
		||||
                        Header="姓名"
 | 
			
		||||
                        DisplayMemberBinding="{Binding PName}" />
 | 
			
		||||
                    <GridViewColumn Width="60"
 | 
			
		||||
                        DisplayMemberBinding="{Binding Sex}"
 | 
			
		||||
                        Header="性别"/>
 | 
			
		||||
                    <GridViewColumn Width="60"
 | 
			
		||||
                        DisplayMemberBinding="{Binding Age}"
 | 
			
		||||
                        Header="年龄"/>
 | 
			
		||||
                    <GridViewColumn Width="200"
 | 
			
		||||
                        DisplayMemberBinding="{Binding IdNumber}"
 | 
			
		||||
                        Header="身份证"/>
 | 
			
		||||
                    <GridViewColumn  Width="200"
 | 
			
		||||
                        DisplayMemberBinding="{Binding OrderNo}"
 | 
			
		||||
                        Header="处方号"/>
 | 
			
		||||
                    <GridViewColumn Width="240"
 | 
			
		||||
                        DisplayMemberBinding="{Binding DeptName}"
 | 
			
		||||
                        Header="科室"/>
 | 
			
		||||
                    <GridViewColumn Width="240"
 | 
			
		||||
                        DisplayMemberBinding="{Binding DrugName}"
 | 
			
		||||
                        Header="药品名称"/>
 | 
			
		||||
                    <GridViewColumn Width="60"
 | 
			
		||||
                        DisplayMemberBinding="{Binding Quantity}"
 | 
			
		||||
                        Header="数量"/>
 | 
			
		||||
                </GridView>
 | 
			
		||||
            </ListView.View>
 | 
			
		||||
        </ListView> 
 | 
			
		||||
 | 
			
		||||
        <!--<pagination:Pagination Grid.Row="2"
 | 
			
		||||
                                   CurrentPage="{Binding PageNum}"
 | 
			
		||||
                                   PageSize="{Binding PageSize}"
 | 
			
		||||
                                   TotalPages="{Binding TotalCount}"
 | 
			
		||||
                                   InfoTextIsEnabel="True"
 | 
			
		||||
                                />-->
 | 
			
		||||
    </Grid>
 | 
			
		||||
</UserControl>
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,28 @@
 | 
			
		|||
using System;
 | 
			
		||||
using System.Collections.Generic;
 | 
			
		||||
using System.Linq;
 | 
			
		||||
using System.Text;
 | 
			
		||||
using System.Threading.Tasks;
 | 
			
		||||
using System.Windows;
 | 
			
		||||
using System.Windows.Controls;
 | 
			
		||||
using System.Windows.Data;
 | 
			
		||||
using System.Windows.Documents;
 | 
			
		||||
using System.Windows.Input;
 | 
			
		||||
using System.Windows.Media;
 | 
			
		||||
using System.Windows.Media.Imaging;
 | 
			
		||||
using System.Windows.Navigation;
 | 
			
		||||
using System.Windows.Shapes;
 | 
			
		||||
 | 
			
		||||
namespace DM_Weight.Views
 | 
			
		||||
{
 | 
			
		||||
    /// <summary>
 | 
			
		||||
    /// CollectDrugWindow.xaml 的交互逻辑
 | 
			
		||||
    /// </summary>
 | 
			
		||||
    public partial class CollectDrugWindow : UserControl
 | 
			
		||||
    {
 | 
			
		||||
        public CollectDrugWindow()
 | 
			
		||||
        {
 | 
			
		||||
            InitializeComponent();
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -52,7 +52,7 @@
 | 
			
		|||
                    IsEditable="True"
 | 
			
		||||
                    ItemsSource="{Binding DrugInfos}"
 | 
			
		||||
                    SelectedItem="{Binding DrugInfo}"
 | 
			
		||||
                    DisplayMemberPath="DrugName" IsEnabled="True" IsTextSearchEnabled="False" KeyUp="ComboBox_KeyUp"
 | 
			
		||||
                    DisplayMemberPath="drug_name_spec" IsEnabled="True" IsTextSearchEnabled="False" KeyUp="ComboBox_KeyUp"
 | 
			
		||||
                />
 | 
			
		||||
            <ComboBox
 | 
			
		||||
                    Grid.Column="1"
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -71,7 +71,7 @@
 | 
			
		|||
                    IsEditable="True"
 | 
			
		||||
                    ItemsSource="{Binding DrugInfos}"
 | 
			
		||||
                    SelectedItem="{Binding DrugInfo}"
 | 
			
		||||
                    DisplayMemberPath="DrugName" IsEnabled="True" IsTextSearchEnabled="False" KeyUp="ComboBox_KeyUp"
 | 
			
		||||
                    DisplayMemberPath="drug_name_spec" IsEnabled="True" IsTextSearchEnabled="False" KeyUp="ComboBox_KeyUp"
 | 
			
		||||
                />
 | 
			
		||||
            <StackPanel HorizontalAlignment="Right"  Grid.Column="3" Orientation="Horizontal">
 | 
			
		||||
                    <Button
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -0,0 +1,163 @@
 | 
			
		|||
<UserControl x:Class="DM_Weight.Views.Dialog.ChangeShiftsDialog"
 | 
			
		||||
             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:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
 | 
			
		||||
             xmlns:convert="clr-namespace:DM_Weight.Converter"
 | 
			
		||||
             mc:Ignorable="d" 
 | 
			
		||||
             d:DesignHeight="450" d:DesignWidth="800">
 | 
			
		||||
    <UserControl.Resources>
 | 
			
		||||
        <convert:BoardTypeConverter x:Key="BoardTypeConverter" />
 | 
			
		||||
        <convert:ForeColorConverter x:Key="ForeColorConverter"/>
 | 
			
		||||
    </UserControl.Resources>
 | 
			
		||||
 | 
			
		||||
    <Grid>
 | 
			
		||||
        <Grid.RowDefinitions>
 | 
			
		||||
            <RowDefinition Height="Auto" />
 | 
			
		||||
            <RowDefinition Height="Auto" />
 | 
			
		||||
            <RowDefinition Height="Auto" />
 | 
			
		||||
            <RowDefinition Height="Auto" />
 | 
			
		||||
        </Grid.RowDefinitions>
 | 
			
		||||
        <Grid.ColumnDefinitions>
 | 
			
		||||
            <ColumnDefinition Width="5*"/>
 | 
			
		||||
            <ColumnDefinition Width="5*"/>
 | 
			
		||||
        </Grid.ColumnDefinitions>
 | 
			
		||||
        <Grid Background="#03a9f4" Grid.Row="0" Grid.ColumnSpan="2">
 | 
			
		||||
            <TextBlock VerticalAlignment="Center" Foreground="{DynamicResource PrimaryHueDarkForegroundBrush}" Margin="16 0 16 0" Style="{StaticResource MaterialDesignHeadline5TextBlock}" Text="{Binding Title}" />
 | 
			
		||||
            <Button
 | 
			
		||||
                        Style="{StaticResource MaterialDesignIconForegroundButton}"
 | 
			
		||||
                        Foreground="{DynamicResource PrimaryHueDarkForegroundBrush}"
 | 
			
		||||
                        HorizontalAlignment="Right"
 | 
			
		||||
                        Command="{Binding BtnCloseCommand}"
 | 
			
		||||
                        ToolTip="关闭" Cursor="Hand"
 | 
			
		||||
                    >
 | 
			
		||||
                <materialDesign:PackIcon Kind="Close" Width="34" Height="34" />
 | 
			
		||||
            </Button>
 | 
			
		||||
        </Grid>
 | 
			
		||||
        <Grid Grid.Row="1">
 | 
			
		||||
            <materialDesign:Card>
 | 
			
		||||
                <Grid>
 | 
			
		||||
                    <Grid.RowDefinitions>
 | 
			
		||||
                        <RowDefinition/>
 | 
			
		||||
                        <RowDefinition/>
 | 
			
		||||
                        <RowDefinition/>
 | 
			
		||||
                        <RowDefinition/>
 | 
			
		||||
                    </Grid.RowDefinitions>
 | 
			
		||||
                    <TextBlock Grid.Row="0" Margin="15,10,60,5" Text="验证方式1:账号密码验证" Foreground="#31ccec" FontWeight="Bold" FontSize="14"/>
 | 
			
		||||
                    <TextBox  Margin="15,5,15,5" 
 | 
			
		||||
                            Grid.Row="1"
 | 
			
		||||
                            x:Name="account" Foreground="Gray"
 | 
			
		||||
                            Text="{Binding Username, UpdateSourceTrigger=PropertyChanged}"
 | 
			
		||||
                            Style="{StaticResource MaterialDesignOutlinedTextBox}"
 | 
			
		||||
                            VerticalAlignment="Top"
 | 
			
		||||
                            AcceptsReturn="False"
 | 
			
		||||
                            TextWrapping="Wrap" 
 | 
			
		||||
                            materialDesign:HintAssist.Hint="账号" />
 | 
			
		||||
                    <PasswordBox Margin="15,5,15,5" 
 | 
			
		||||
                            Grid.Row="2"
 | 
			
		||||
                            x:Name="PasswordBox" Foreground="Gray"
 | 
			
		||||
                            materialDesign:PasswordBoxAssist.Password="{Binding Password, UpdateSourceTrigger=PropertyChanged, Mode=TwoWay}"
 | 
			
		||||
                            Style="{StaticResource MaterialDesignOutlinedPasswordBox}"
 | 
			
		||||
                            VerticalAlignment="Top"
 | 
			
		||||
                            materialDesign:HintAssist.Hint="密码" />
 | 
			
		||||
                    <StackPanel Grid.Row="3"
 | 
			
		||||
                            Grid.Column="1">
 | 
			
		||||
                        <Grid Margin="2,2,2,10">
 | 
			
		||||
                            <Grid.ColumnDefinitions>
 | 
			
		||||
                                <ColumnDefinition Width="*"></ColumnDefinition>
 | 
			
		||||
                                <ColumnDefinition Width="3*"></ColumnDefinition>
 | 
			
		||||
                                <ColumnDefinition Width="*"></ColumnDefinition>
 | 
			
		||||
                                <ColumnDefinition Width="3*"></ColumnDefinition>
 | 
			
		||||
                                <ColumnDefinition Width="*"></ColumnDefinition>
 | 
			
		||||
                            </Grid.ColumnDefinitions>
 | 
			
		||||
                            <Button
 | 
			
		||||
                                    Grid.Column="1"
 | 
			
		||||
                                    Style="{StaticResource MaterialDesignRaisedButton}"
 | 
			
		||||
                                    materialDesign:ButtonAssist.CornerRadius="5"
 | 
			
		||||
                                    Command="{ Binding LoginCommand }"
 | 
			
		||||
                                    Background="#42a5f5" IsEnabled="{Binding JiaoBanOk}"
 | 
			
		||||
                                    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 ClearCommand }" >
 | 
			
		||||
                                <TextBlock Foreground="{DynamicResource MaterialDesignPaper}" Text="清空" />
 | 
			
		||||
                            </Button>
 | 
			
		||||
                        </Grid>
 | 
			
		||||
                    </StackPanel>
 | 
			
		||||
                </Grid> 
 | 
			
		||||
            </materialDesign:Card>
 | 
			
		||||
        </Grid>
 | 
			
		||||
        <Grid Grid.Row="1" Grid.Column="1" >
 | 
			
		||||
            <materialDesign:Card>
 | 
			
		||||
                <Grid> 
 | 
			
		||||
                    <Grid.RowDefinitions>
 | 
			
		||||
                        <RowDefinition/>
 | 
			
		||||
                        <RowDefinition/>
 | 
			
		||||
                        <RowDefinition/>
 | 
			
		||||
                        <RowDefinition/>
 | 
			
		||||
                    </Grid.RowDefinitions> 
 | 
			
		||||
 | 
			
		||||
                    <TextBlock Grid.Row="0" Margin="15,10,15,0" Text="验证方式2:屏幕外右侧指纹验证" Foreground="#31ccec" FontWeight="Bold" FontSize="14" />
 | 
			
		||||
 | 
			
		||||
                    <StackPanel Grid.Row="1">
 | 
			
		||||
                        <Grid>
 | 
			
		||||
                            <Grid.RowDefinitions>
 | 
			
		||||
                                <RowDefinition/>
 | 
			
		||||
                                <RowDefinition/>
 | 
			
		||||
                                <RowDefinition/>
 | 
			
		||||
                                <RowDefinition/>
 | 
			
		||||
                            </Grid.RowDefinitions>
 | 
			
		||||
                            <Grid.ColumnDefinitions>
 | 
			
		||||
                                <ColumnDefinition/>
 | 
			
		||||
                                <ColumnDefinition/>
 | 
			
		||||
                            </Grid.ColumnDefinitions>
 | 
			
		||||
                            <TextBlock Grid.Row="0" Text="交班人 发药人:" Grid.Column="0"  HorizontalAlignment="Right" Margin="0 15 0 5"
 | 
			
		||||
                    FontSize="14" Foreground="#31ccec" FontWeight="Bold"/>
 | 
			
		||||
                            <TextBlock  Grid.Row="0" Grid.Column="1" Margin="5 15 0 5" Foreground="{Binding OperatorLogin,Converter={StaticResource ForeColorConverter}}"
 | 
			
		||||
                            FontSize="14"
 | 
			
		||||
                            FontWeight="Bold"
 | 
			
		||||
                            Text="{Binding Operator.Nickname, UpdateSourceTrigger=PropertyChanged}" />
 | 
			
		||||
 | 
			
		||||
                            <TextBlock  Grid.Row="1"  Text="审核人:" Grid.Column="0" HorizontalAlignment="Right" Margin="0 15 0 5"
 | 
			
		||||
                    FontSize="14" Foreground="#31ccec" FontWeight="Bold"/>
 | 
			
		||||
                            <TextBlock Grid.Column="1" Margin="5 15 0 5"  Foreground="{Binding ReviewerLogin,Converter={StaticResource ForeColorConverter}}"
 | 
			
		||||
                            FontSize="14"
 | 
			
		||||
                            FontWeight="Bold" 
 | 
			
		||||
                            Grid.Row="1" Text="{Binding Reviewer.Nickname, UpdateSourceTrigger=PropertyChanged}" />
 | 
			
		||||
 | 
			
		||||
                            <TextBlock  Grid.Row="2" Text="接班人 发药人:" Grid.Column="0"  HorizontalAlignment="Right" Margin="0 15 0 5"
 | 
			
		||||
                    FontSize="14" Foreground="#31ccec" FontWeight="Bold"/>
 | 
			
		||||
                            <TextBlock Grid.Column="2" Margin="5 15 0 5"
 | 
			
		||||
                            FontSize="14"
 | 
			
		||||
                            FontWeight="Bold" TextAlignment="Left" HorizontalAlignment="Left"
 | 
			
		||||
                            Foreground="#3ECFED"
 | 
			
		||||
                            Grid.Row="2" Text="{Binding JieOperator.Nickname, UpdateSourceTrigger=PropertyChanged}" />
 | 
			
		||||
 | 
			
		||||
                            <TextBlock Grid.Row="3" Text="审核人:" Grid.Column="0"  HorizontalAlignment="Right" Margin="0 15 0 5"
 | 
			
		||||
                    FontSize="14" Foreground="#31ccec" FontWeight="Bold"/>
 | 
			
		||||
                            <TextBlock Grid.Column="1" HorizontalAlignment="Left" Margin="5 15 0 5"
 | 
			
		||||
                            FontSize="14"
 | 
			
		||||
                            FontWeight="Bold"
 | 
			
		||||
                            Foreground="#3ECFED"
 | 
			
		||||
                            Grid.Row="3" Text="{Binding JieReviewer.Nickname, UpdateSourceTrigger=PropertyChanged}" />
 | 
			
		||||
                        </Grid>
 | 
			
		||||
                    </StackPanel> 
 | 
			
		||||
                </Grid>
 | 
			
		||||
            </materialDesign:Card> 
 | 
			
		||||
        </Grid>
 | 
			
		||||
        <materialDesign:Card Grid.Row="2" Grid.ColumnSpan="2" Margin="10">
 | 
			
		||||
            <Button
 | 
			
		||||
                                    Style="{StaticResource MaterialDesignRaisedButton}"
 | 
			
		||||
                                    materialDesign:ButtonAssist.CornerRadius="5"
 | 
			
		||||
                                    Command="{ Binding ShiftsCommand }"
 | 
			
		||||
                                    Background="#42a5f5"
 | 
			
		||||
                                    BorderBrush="#42a5f5" Cursor="Hand"  IsDefault="True"  Content="确认交接"/>
 | 
			
		||||
        </materialDesign:Card>
 | 
			
		||||
    </Grid>
 | 
			
		||||
</UserControl>
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,28 @@
 | 
			
		|||
using System;
 | 
			
		||||
using System.Collections.Generic;
 | 
			
		||||
using System.Linq;
 | 
			
		||||
using System.Text;
 | 
			
		||||
using System.Threading.Tasks;
 | 
			
		||||
using System.Windows;
 | 
			
		||||
using System.Windows.Controls;
 | 
			
		||||
using System.Windows.Data;
 | 
			
		||||
using System.Windows.Documents;
 | 
			
		||||
using System.Windows.Input;
 | 
			
		||||
using System.Windows.Media;
 | 
			
		||||
using System.Windows.Media.Imaging;
 | 
			
		||||
using System.Windows.Navigation;
 | 
			
		||||
using System.Windows.Shapes;
 | 
			
		||||
 | 
			
		||||
namespace DM_Weight.Views.Dialog
 | 
			
		||||
{
 | 
			
		||||
    /// <summary>
 | 
			
		||||
    /// ChangeShiftsDialog.xaml 的交互逻辑
 | 
			
		||||
    /// </summary>
 | 
			
		||||
    public partial class ChangeShiftsDialog : UserControl
 | 
			
		||||
    {
 | 
			
		||||
        public ChangeShiftsDialog()
 | 
			
		||||
        {
 | 
			
		||||
            InitializeComponent();
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,145 @@
 | 
			
		|||
<UserControl x:Class="DM_Weight.Views.Dialog.CollectDrugDialog"
 | 
			
		||||
              xmlns:pagination="clr-namespace:DM_Weight.Components.pagination"
 | 
			
		||||
              xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes" 
 | 
			
		||||
             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" 
 | 
			
		||||
             xmlns:prism="http://prismlibrary.com/">
 | 
			
		||||
    <UserControl.Resources>
 | 
			
		||||
        <Style x:Key="st" TargetType="GridViewColumnHeader">
 | 
			
		||||
            <Style.Setters>
 | 
			
		||||
                <Setter Property="Height">
 | 
			
		||||
                    <Setter.Value>55</Setter.Value>
 | 
			
		||||
                </Setter>
 | 
			
		||||
                <Setter Property="Background">
 | 
			
		||||
                    <Setter.Value>#31ccec</Setter.Value>
 | 
			
		||||
                </Setter>
 | 
			
		||||
                <Setter Property="Foreground">
 | 
			
		||||
                    <Setter.Value>white</Setter.Value>
 | 
			
		||||
                </Setter>
 | 
			
		||||
            </Style.Setters>
 | 
			
		||||
        </Style>
 | 
			
		||||
    </UserControl.Resources>
 | 
			
		||||
    <materialDesign:Card Padding="0">
 | 
			
		||||
        <Grid>
 | 
			
		||||
            <Grid.RowDefinitions>
 | 
			
		||||
                <RowDefinition Height="Auto" />
 | 
			
		||||
                <RowDefinition Height="Auto" />
 | 
			
		||||
                <RowDefinition Height="Auto" />
 | 
			
		||||
            </Grid.RowDefinitions>
 | 
			
		||||
            <Grid Background="#03a9f4" Grid.Row="0">
 | 
			
		||||
                <TextBlock VerticalAlignment="Center" Foreground="{DynamicResource PrimaryHueDarkForegroundBrush}" Margin="16 4 16 4" Style="{StaticResource MaterialDesignHeadline5TextBlock}" Text="{Binding Title}" />
 | 
			
		||||
                <Button
 | 
			
		||||
                        Style="{StaticResource MaterialDesignIconForegroundButton}"
 | 
			
		||||
                        Foreground="{DynamicResource PrimaryHueDarkForegroundBrush}"
 | 
			
		||||
                        HorizontalAlignment="Right"
 | 
			
		||||
                        Command="{Binding BtnCloseCommand}"
 | 
			
		||||
                        ToolTip="关闭"
 | 
			
		||||
                    >
 | 
			
		||||
                    <materialDesign:PackIcon Kind="Close" Width="34" Height="34" />
 | 
			
		||||
                </Button>
 | 
			
		||||
            </Grid>
 | 
			
		||||
            <Grid Grid.Row="1" x:Name="Border" Margin="0 10 10 0">
 | 
			
		||||
                <Grid.RowDefinitions>
 | 
			
		||||
                    <RowDefinition />
 | 
			
		||||
                </Grid.RowDefinitions>
 | 
			
		||||
                <Grid.ColumnDefinitions>
 | 
			
		||||
                    <ColumnDefinition />
 | 
			
		||||
                    <ColumnDefinition />
 | 
			
		||||
                    <ColumnDefinition />
 | 
			
		||||
                    <ColumnDefinition />
 | 
			
		||||
                    <ColumnDefinition />
 | 
			
		||||
                    <ColumnDefinition />
 | 
			
		||||
                    <ColumnDefinition />
 | 
			
		||||
                </Grid.ColumnDefinitions>
 | 
			
		||||
                <Grid.Resources>
 | 
			
		||||
                    <Style TargetType="{x:Type TextBlock}" BasedOn="{StaticResource MaterialDesignSubtitle1TextBlock}">
 | 
			
		||||
                        <Setter Property="Padding" Value="6" />
 | 
			
		||||
                    </Style>
 | 
			
		||||
                </Grid.Resources>
 | 
			
		||||
                <TextBlock
 | 
			
		||||
                                        HorizontalAlignment="Right"
 | 
			
		||||
                                        Grid.Row="0"
 | 
			
		||||
                                        Grid.Column="0"
 | 
			
		||||
                                        Text="请领数量:" />
 | 
			
		||||
                <StackPanel
 | 
			
		||||
                                        Grid.Row="0"
 | 
			
		||||
                                        Grid.Column="1"
 | 
			
		||||
                                        HorizontalAlignment="Left"
 | 
			
		||||
                                        Orientation="Horizontal">
 | 
			
		||||
                    <TextBlock Text="{Binding QuantityCount}" />
 | 
			
		||||
                </StackPanel>
 | 
			
		||||
 | 
			
		||||
                <TextBlock
 | 
			
		||||
                                        HorizontalAlignment="Right"
 | 
			
		||||
                                        Grid.Row="0"
 | 
			
		||||
                                        Grid.Column="2"
 | 
			
		||||
                                        Text="交处方张数:" />
 | 
			
		||||
                <TextBlock
 | 
			
		||||
                                        HorizontalAlignment="Left"
 | 
			
		||||
                                        Grid.Row="0"
 | 
			
		||||
                                        Grid.Column="3"
 | 
			
		||||
                                        Text="{Binding OrderCount}" />
 | 
			
		||||
                <TextBlock
 | 
			
		||||
                                        HorizontalAlignment="Right"
 | 
			
		||||
                                        Grid.Row="0"
 | 
			
		||||
                                        Grid.Column="4"
 | 
			
		||||
                                        Text="请领药库:" />
 | 
			
		||||
                <ComboBox Grid.Column="5"  Width="80" Height="50" FontFamily="微软雅黑"
 | 
			
		||||
                    Margin="0 0 0 5"  HorizontalAlignment="Left"
 | 
			
		||||
                    Style="{StaticResource MaterialDesignOutlinedComboBox}"
 | 
			
		||||
                    SelectedItem="{Binding SelectedItem}"
 | 
			
		||||
                    DisplayMemberPath="Name"
 | 
			
		||||
                    ItemsSource="{Binding Selects}"/>
 | 
			
		||||
                <Button Width="130" Height="50"
 | 
			
		||||
                        Margin="6 0 6 3" Grid.Row="0" Grid.Column="6"
 | 
			
		||||
                        Style="{StaticResource MaterialDesignOutlinedLightButton}"
 | 
			
		||||
                        ToolTip="确认并生成"
 | 
			
		||||
                        Content="确认并生成"
 | 
			
		||||
                        Command="{Binding CreateApply}" />
 | 
			
		||||
            </Grid>
 | 
			
		||||
            <ListView
 | 
			
		||||
            Grid.Row="2"
 | 
			
		||||
            ItemsSource="{Binding CollectDrugList}" 
 | 
			
		||||
            materialDesign:ListViewAssist.HeaderRowBackground="#31ccec"
 | 
			
		||||
            materialDesign:DataGridAssist.ColumnHeaderPadding="10"
 | 
			
		||||
            materialDesign:ListViewAssist.ListViewItemPadding="13">
 | 
			
		||||
                <ListView.Resources>
 | 
			
		||||
                    <Style TargetType="{x:Type GridViewColumnHeader}" BasedOn="{StaticResource {x:Type GridViewColumnHeader}}">
 | 
			
		||||
                        <Setter Property="Foreground" Value="White" />
 | 
			
		||||
                    </Style>
 | 
			
		||||
                </ListView.Resources>
 | 
			
		||||
                <ListView.View>
 | 
			
		||||
                    <GridView ColumnHeaderContainerStyle="{StaticResource st}">
 | 
			
		||||
                        <GridViewColumn Width="200"
 | 
			
		||||
                        Header="药品名称"
 | 
			
		||||
                        DisplayMemberBinding="{Binding DrugName}"/>
 | 
			
		||||
                        <GridViewColumn Width="100"
 | 
			
		||||
                        Header="规格"
 | 
			
		||||
                        DisplayMemberBinding="{Binding DrugSpec}" />
 | 
			
		||||
                        <GridViewColumn Width="280"
 | 
			
		||||
                        DisplayMemberBinding="{Binding Manufactory}"
 | 
			
		||||
                        Header="厂家"/>
 | 
			
		||||
                        <GridViewColumn Width="80"
 | 
			
		||||
                        DisplayMemberBinding="{Binding Quantity}"
 | 
			
		||||
                        Header="数量"/>
 | 
			
		||||
                        <!--<GridViewColumn  Width="200"
 | 
			
		||||
                        DisplayMemberBinding="{Binding OrderNo}"
 | 
			
		||||
                        Header="处方号"/>-->
 | 
			
		||||
                    </GridView>
 | 
			
		||||
                </ListView.View>
 | 
			
		||||
            </ListView>
 | 
			
		||||
 | 
			
		||||
            <!--<pagination:Pagination Grid.Row="3"
 | 
			
		||||
                                   CurrentPage="{Binding PageNum}"
 | 
			
		||||
                                   PageSize="{Binding PageSize}"
 | 
			
		||||
                                   TotalPages="{Binding TotalCount}"
 | 
			
		||||
                                   InfoTextIsEnabel="True"
 | 
			
		||||
                                />-->
 | 
			
		||||
        </Grid>
 | 
			
		||||
 | 
			
		||||
    </materialDesign:Card>
 | 
			
		||||
</UserControl>
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,28 @@
 | 
			
		|||
using System;
 | 
			
		||||
using System.Collections.Generic;
 | 
			
		||||
using System.Linq;
 | 
			
		||||
using System.Text;
 | 
			
		||||
using System.Threading.Tasks;
 | 
			
		||||
using System.Windows;
 | 
			
		||||
using System.Windows.Controls;
 | 
			
		||||
using System.Windows.Data;
 | 
			
		||||
using System.Windows.Documents;
 | 
			
		||||
using System.Windows.Input;
 | 
			
		||||
using System.Windows.Media;
 | 
			
		||||
using System.Windows.Media.Imaging;
 | 
			
		||||
using System.Windows.Navigation;
 | 
			
		||||
using System.Windows.Shapes;
 | 
			
		||||
 | 
			
		||||
namespace DM_Weight.Views.Dialog
 | 
			
		||||
{
 | 
			
		||||
    /// <summary>
 | 
			
		||||
    /// CollectDrugDialog.xaml 的交互逻辑
 | 
			
		||||
    /// </summary>
 | 
			
		||||
    public partial class CollectDrugDialog : UserControl
 | 
			
		||||
    {
 | 
			
		||||
        public CollectDrugDialog()
 | 
			
		||||
        {
 | 
			
		||||
            InitializeComponent();
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,196 @@
 | 
			
		|||
<UserControl x:Class="DM_Weight.Views.Dialog.DestoryEmptyDialog"
 | 
			
		||||
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
 | 
			
		||||
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
 | 
			
		||||
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
 | 
			
		||||
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
 | 
			
		||||
             xmlns:local="clr-namespace:DM_Weight.Views.Dialog"
 | 
			
		||||
             xmlns:prism="http://prismlibrary.com/"
 | 
			
		||||
             prism:ViewModelLocator.AutoWireViewModel="True"
 | 
			
		||||
             xmlns:convert="clr-namespace:DM_Weight.Converter"
 | 
			
		||||
             xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
 | 
			
		||||
             xmlns:i="http://schemas.microsoft.com/xaml/behaviors"
 | 
			
		||||
             mc:Ignorable="d" 
 | 
			
		||||
             d:DesignHeight="450" d:DesignWidth="800">
 | 
			
		||||
    <UserControl.Resources>
 | 
			
		||||
        <convert:StatusConverter x:Key="StatusConverter" />
 | 
			
		||||
        <convert:InputQuantityConverter x:Key="InputQuantityConverter" />
 | 
			
		||||
        <Style x:Key="st" TargetType="GridViewColumnHeader">
 | 
			
		||||
            <Style.Setters>
 | 
			
		||||
                <Setter Property="Height">
 | 
			
		||||
                    <Setter.Value>55</Setter.Value>
 | 
			
		||||
                </Setter>
 | 
			
		||||
                <Setter Property="Background">
 | 
			
		||||
                    <Setter.Value>#31ccec</Setter.Value>
 | 
			
		||||
                </Setter>
 | 
			
		||||
                <Setter Property="Foreground">
 | 
			
		||||
                    <Setter.Value>white</Setter.Value>
 | 
			
		||||
                </Setter>
 | 
			
		||||
            </Style.Setters>
 | 
			
		||||
        </Style>
 | 
			
		||||
    </UserControl.Resources>
 | 
			
		||||
    <materialDesign:Card Padding="0">
 | 
			
		||||
        <Grid>
 | 
			
		||||
            <Grid.RowDefinitions>
 | 
			
		||||
                <RowDefinition Height="Auto" />
 | 
			
		||||
                <RowDefinition Height="50" />
 | 
			
		||||
                <RowDefinition Height="Auto" />
 | 
			
		||||
                <RowDefinition Height="Auto" />
 | 
			
		||||
            </Grid.RowDefinitions>
 | 
			
		||||
            <Grid Background="#03a9f4" Grid.Row="0">
 | 
			
		||||
                <TextBlock VerticalAlignment="Center" Foreground="{DynamicResource PrimaryHueDarkForegroundBrush}" Margin="16 4 16 4" Style="{StaticResource MaterialDesignHeadline5TextBlock}" Text="{Binding Title}" />
 | 
			
		||||
                <Button
 | 
			
		||||
                        Style="{StaticResource MaterialDesignIconForegroundButton}"
 | 
			
		||||
                        Foreground="{DynamicResource PrimaryHueDarkForegroundBrush}"
 | 
			
		||||
                        HorizontalAlignment="Right"
 | 
			
		||||
                        Command="{Binding BtnCloseCommand}"
 | 
			
		||||
                        ToolTip="关闭"
 | 
			
		||||
                    >
 | 
			
		||||
                    <materialDesign:PackIcon Kind="Close" Width="34" Height="34" />
 | 
			
		||||
                </Button>
 | 
			
		||||
            </Grid>
 | 
			
		||||
            <Grid Grid.Row="1">
 | 
			
		||||
                <Grid.ColumnDefinitions>
 | 
			
		||||
                    <ColumnDefinition Width="2*" />
 | 
			
		||||
                    <ColumnDefinition Width="3*" />
 | 
			
		||||
                    <ColumnDefinition Width="2*" />
 | 
			
		||||
                    <ColumnDefinition Width="*" />
 | 
			
		||||
                    <ColumnDefinition Width="2*" />
 | 
			
		||||
                    <ColumnDefinition Width="2*" />
 | 
			
		||||
                    <ColumnDefinition Width="3*" />
 | 
			
		||||
                    <ColumnDefinition Width="*" />
 | 
			
		||||
                </Grid.ColumnDefinitions>
 | 
			
		||||
 | 
			
		||||
                <TextBlock
 | 
			
		||||
                      Grid.Column="0"
 | 
			
		||||
                      Margin="16 0 16 8"
 | 
			
		||||
                      VerticalAlignment="Center"
 | 
			
		||||
                      HorizontalAlignment="Right"
 | 
			
		||||
                      Style="{StaticResource MaterialDesignBody2TextBlock}"
 | 
			
		||||
                      Text="药品:" />
 | 
			
		||||
                <TextBlock
 | 
			
		||||
                      Grid.Column="1"
 | 
			
		||||
                      Margin="16 0 16 8"
 | 
			
		||||
                      VerticalAlignment="Center"
 | 
			
		||||
                      HorizontalAlignment="Left"
 | 
			
		||||
                      Style="{StaticResource MaterialDesignBody2TextBlock}"
 | 
			
		||||
                      Text="{Binding _ChannelStock.DrugInfo.DrugName}" />
 | 
			
		||||
                <TextBlock
 | 
			
		||||
                      Grid.Column="2"
 | 
			
		||||
                      Margin="16 0 16 8"
 | 
			
		||||
                      VerticalAlignment="Center"
 | 
			
		||||
                      HorizontalAlignment="Right"
 | 
			
		||||
                      Style="{StaticResource MaterialDesignBody2TextBlock}"
 | 
			
		||||
                      Text="规格:" />
 | 
			
		||||
                <TextBlock
 | 
			
		||||
                      Grid.Column="3"
 | 
			
		||||
                      Margin="16 0 16 8"
 | 
			
		||||
                      VerticalAlignment="Center"
 | 
			
		||||
                      HorizontalAlignment="Left"
 | 
			
		||||
                      Style="{StaticResource MaterialDesignBody2TextBlock}"
 | 
			
		||||
                      Text="{Binding _ChannelStock.DrugInfo.DrugSpec}" />
 | 
			
		||||
                <TextBlock
 | 
			
		||||
                      Grid.Column="4"
 | 
			
		||||
                      Margin="16 0 16 8"
 | 
			
		||||
                      VerticalAlignment="Center"
 | 
			
		||||
                      HorizontalAlignment="Right"
 | 
			
		||||
                      Style="{StaticResource MaterialDesignBody2TextBlock}"
 | 
			
		||||
                      Text="厂家:" />
 | 
			
		||||
                <TextBlock
 | 
			
		||||
                      Grid.Column="5"
 | 
			
		||||
                      Margin="16 0 16 8"
 | 
			
		||||
                      VerticalAlignment="Center"
 | 
			
		||||
                      HorizontalAlignment="Left"
 | 
			
		||||
                      Style="{StaticResource MaterialDesignBody2TextBlock}"
 | 
			
		||||
                      Text="{Binding _ChannelStock.DrugInfo.Manufactory}" />
 | 
			
		||||
                <TextBlock
 | 
			
		||||
                      Grid.Column="6"
 | 
			
		||||
                      Margin="16 0 16 8"
 | 
			
		||||
                      VerticalAlignment="Center"
 | 
			
		||||
                      HorizontalAlignment="Right"
 | 
			
		||||
                      Style="{StaticResource MaterialDesignBody2TextBlock}"
 | 
			
		||||
                      Text="可销毁空瓶数:" />
 | 
			
		||||
                <TextBlock
 | 
			
		||||
                      Grid.Column="7"
 | 
			
		||||
                      Margin="16 0 16 8"
 | 
			
		||||
                      VerticalAlignment="Center"
 | 
			
		||||
                      HorizontalAlignment="Left"
 | 
			
		||||
                      Style="{StaticResource MaterialDesignBody2TextBlock}"
 | 
			
		||||
                      Text="{Binding _ChannelStock.Quantity}" />
 | 
			
		||||
            </Grid>
 | 
			
		||||
            <ListView
 | 
			
		||||
                Grid.Row="2" ScrollViewer.VerticalScrollBarVisibility="Auto"
 | 
			
		||||
                ItemsSource="{Binding _MachineRecords}"
 | 
			
		||||
                SelectedItem="{Binding _MachineRecord}"
 | 
			
		||||
                materialDesign:ListViewAssist.HeaderRowBackground="#31ccec"
 | 
			
		||||
                materialDesign:DataGridAssist.ColumnHeaderPadding="10"
 | 
			
		||||
                materialDesign:ListViewAssist.ListViewItemPadding="13">
 | 
			
		||||
                <ListView.Resources>
 | 
			
		||||
                    <Style TargetType="{x:Type GridViewColumnHeader}" BasedOn="{StaticResource {x:Type GridViewColumnHeader}}">
 | 
			
		||||
                        <Setter Property="Foreground" Value="White" />
 | 
			
		||||
                    </Style>
 | 
			
		||||
                </ListView.Resources>
 | 
			
		||||
 | 
			
		||||
                <i:Interaction.Triggers>
 | 
			
		||||
                    <i:EventTrigger EventName="SelectionChanged">
 | 
			
		||||
                        <i:InvokeCommandAction Command="{Binding RowSelected}" />
 | 
			
		||||
                    </i:EventTrigger>
 | 
			
		||||
                </i:Interaction.Triggers>
 | 
			
		||||
                <ListView.View>
 | 
			
		||||
                    <GridView   ColumnHeaderContainerStyle="{StaticResource st}">
 | 
			
		||||
                        <GridViewColumn Header="选择" Width="100">
 | 
			
		||||
                            <GridViewColumn.CellTemplate>
 | 
			
		||||
                                <DataTemplate>
 | 
			
		||||
                                    <CheckBox IsChecked="{Binding IsSelected}" />
 | 
			
		||||
                                </DataTemplate>
 | 
			
		||||
                            </GridViewColumn.CellTemplate>
 | 
			
		||||
                        </GridViewColumn>
 | 
			
		||||
                        <GridViewColumn Width="100"
 | 
			
		||||
                            Header="操作人"
 | 
			
		||||
                            DisplayMemberBinding="{Binding User.Nickname}"/>
 | 
			
		||||
                        <GridViewColumn Width="150"
 | 
			
		||||
                            Header="时间"
 | 
			
		||||
                            DisplayMemberBinding="{Binding OperationTime, StringFormat='yyyy-MM-dd HH:mm:ss'}" />
 | 
			
		||||
                        <GridViewColumn Width="100"
 | 
			
		||||
                            DisplayMemberBinding="{Binding Quantity}"
 | 
			
		||||
                            Header="数量"/>
 | 
			
		||||
                        <GridViewColumn Width="150"
 | 
			
		||||
                            DisplayMemberBinding="{Binding ManuNo}"
 | 
			
		||||
                            Header="批次"/>
 | 
			
		||||
                        <GridViewColumn Width="150"
 | 
			
		||||
                            DisplayMemberBinding="{Binding EffDate, StringFormat=yyyy-MM-dd}"
 | 
			
		||||
                            Header="效期"/>
 | 
			
		||||
                    </GridView>
 | 
			
		||||
                </ListView.View>
 | 
			
		||||
            </ListView>
 | 
			
		||||
 | 
			
		||||
            <Grid Grid.Row="3">
 | 
			
		||||
                <Grid.RowDefinitions>
 | 
			
		||||
                    <RowDefinition />
 | 
			
		||||
                    <RowDefinition />
 | 
			
		||||
                </Grid.RowDefinitions>
 | 
			
		||||
                <Grid.ColumnDefinitions>
 | 
			
		||||
                    <ColumnDefinition />
 | 
			
		||||
                    <ColumnDefinition />
 | 
			
		||||
                    <ColumnDefinition />
 | 
			
		||||
                </Grid.ColumnDefinitions>
 | 
			
		||||
                <StackPanel Orientation="Horizontal" Grid.Row="1" Grid.Column="1" HorizontalAlignment="Center">
 | 
			
		||||
 | 
			
		||||
                    <Button
 | 
			
		||||
                            Margin="2"
 | 
			
		||||
                            Style="{StaticResource MaterialDesignRaisedAccentButton}"
 | 
			
		||||
                            Content="销毁"
 | 
			
		||||
                            Command="{Binding DestoryEmptyCommand}">
 | 
			
		||||
                    </Button>
 | 
			
		||||
                    <Button
 | 
			
		||||
                            Margin="2"
 | 
			
		||||
                            Style="{StaticResource MaterialDesignRaisedButton}"
 | 
			
		||||
                            Background="Orange"
 | 
			
		||||
                            BorderBrush="Orange"
 | 
			
		||||
                            Content="取消"
 | 
			
		||||
                            Command="{Binding CancleTake}" />
 | 
			
		||||
                </StackPanel>
 | 
			
		||||
 | 
			
		||||
            </Grid>
 | 
			
		||||
        </Grid>
 | 
			
		||||
    </materialDesign:Card>
 | 
			
		||||
</UserControl>
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,28 @@
 | 
			
		|||
using System;
 | 
			
		||||
using System.Collections.Generic;
 | 
			
		||||
using System.Linq;
 | 
			
		||||
using System.Text;
 | 
			
		||||
using System.Threading.Tasks;
 | 
			
		||||
using System.Windows;
 | 
			
		||||
using System.Windows.Controls;
 | 
			
		||||
using System.Windows.Data;
 | 
			
		||||
using System.Windows.Documents;
 | 
			
		||||
using System.Windows.Input;
 | 
			
		||||
using System.Windows.Media;
 | 
			
		||||
using System.Windows.Media.Imaging;
 | 
			
		||||
using System.Windows.Navigation;
 | 
			
		||||
using System.Windows.Shapes;
 | 
			
		||||
 | 
			
		||||
namespace DM_Weight.Views.Dialog
 | 
			
		||||
{
 | 
			
		||||
    /// <summary>
 | 
			
		||||
    /// DestoryEmptyDialog.xaml 的交互逻辑
 | 
			
		||||
    /// </summary>
 | 
			
		||||
    public partial class DestoryEmptyDialog : UserControl
 | 
			
		||||
    {
 | 
			
		||||
        public DestoryEmptyDialog()
 | 
			
		||||
        {
 | 
			
		||||
            InitializeComponent();
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -198,7 +198,7 @@
 | 
			
		|||
                            materialDesign:ButtonProgressAssist.IsIndicatorVisible="{Binding Status, Converter={StaticResource StatusConverter}, ConverterParameter=opearBtnLoading}"
 | 
			
		||||
                            materialDesign:ButtonProgressAssist.IsIndeterminate="{Binding Status, Converter={StaticResource StatusConverter}, ConverterParameter=opearBtnLoading}"
 | 
			
		||||
                            Content="取药"
 | 
			
		||||
                            Command="{Binding OpenDrawer_New}">
 | 
			
		||||
                            Command="{Binding OpenDrawer}">
 | 
			
		||||
                    </Button>
 | 
			
		||||
                    <Button
 | 
			
		||||
                            Margin="2"
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
Some files were not shown because too many files have changed in this diff Show More
		Loading…
	
		Reference in New Issue