Compare commits
72 Commits
master
...
SanYa_ZhuYuan
Author | SHA1 | Date | |
---|---|---|---|
|
7217e45a21 |
|
|
|
d449c1a99a |
|
|
|
b337e470a6 |
|
|
|
52d2da4db9 |
|
|
|
d009de4de7 |
|
|
|
6a9d8e0aeb |
|
|
|
2e13275890 |
|
|
|
8a61c1017f |
|
|
|
d58b9967a9 |
|
|
|
db6eb0c339 |
|
|
|
8709bd0e3d |
|
|
|
37fe5d4a6c |
|
|
|
e224fdd28b |
|
|
|
dd4e0a6695 |
|
|
|
4ebdcc4ac7 |
|
|
|
d405184691 |
|
|
|
3d512a00e6 |
|
|
|
76e25b979d |
|
|
|
2d9d86443b |
|
|
|
9c61e57fb0 |
|
|
|
ba61bc5282 |
|
|
|
784c1b0c0d |
|
|
|
18df517149 |
|
|
|
ce3aa0bdd3 |
|
|
|
a94b9f0f08 |
|
|
|
20fd5a2e57 |
|
|
|
aadc0be0ab |
|
|
|
f6982af384 |
|
|
|
2178fa777c |
|
|
|
336531bb2a |
|
|
|
27d5886dda |
|
|
|
5ab35c846c |
|
|
|
7b2f72db15 |
|
|
|
ce6d519b93 |
|
|
|
ddbd41b3dc |
|
|
|
8f7cd84b08 |
|
|
|
ce7f17d022 |
|
|
|
0c090cb039 |
|
|
|
2b7c06fd71 |
|
|
|
c7254d66c6 |
|
|
|
217dd11512 |
|
|
|
cc88fca01d |
|
|
|
102905d800 |
|
|
|
5c304cb974 |
|
|
|
ac459a7a14 |
|
|
|
deb7b044e9 |
|
|
|
fcf1238c2c |
|
|
|
d31b7016a7 |
|
|
|
a716c3543e |
|
|
|
9f90263a61 |
|
|
|
b7cfd4e1b3 |
|
|
|
db6d0200cc |
|
|
|
2ac87cd83e |
|
|
|
0aec8f0dc5 |
|
|
|
c858bbff7d |
|
|
|
d4c42203d2 |
|
|
|
b11a8a479c |
|
|
|
c580e69347 |
|
|
|
8d8502c734 |
|
|
|
ef8627e884 |
|
|
|
a23fcb0599 |
|
|
|
9aeafa2552 |
|
|
|
d841eb08fe |
|
|
|
35c788fbf3 |
|
|
|
134d3119aa |
|
|
|
464b8bc147 |
|
|
|
36ca926b87 |
|
|
|
601c6766b5 |
|
|
|
07109c9c47 |
|
|
|
e2de3d5051 |
|
|
|
ad86e96860 |
|
|
|
71f437cdae |
|
|
@ -360,4 +360,5 @@ MigrationBackup/
|
||||||
.ionide/
|
.ionide/
|
||||||
|
|
||||||
# Fody - auto-generated XML schema
|
# Fody - auto-generated XML schema
|
||||||
FodyWeavers.xsd
|
FodyWeavers.xsd
|
||||||
|
/readme.txt
|
||||||
|
|
|
@ -8,13 +8,19 @@ EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
Debug|Any CPU = Debug|Any CPU
|
Debug|Any CPU = Debug|Any CPU
|
||||||
|
Debug|x64 = Debug|x64
|
||||||
Release|Any CPU = Release|Any CPU
|
Release|Any CPU = Release|Any CPU
|
||||||
|
Release|x64 = Release|x64
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||||
{439FA76B-F874-40DB-BAF2-E3647CD55B10}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
{439FA76B-F874-40DB-BAF2-E3647CD55B10}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
{439FA76B-F874-40DB-BAF2-E3647CD55B10}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{439FA76B-F874-40DB-BAF2-E3647CD55B10}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{439FA76B-F874-40DB-BAF2-E3647CD55B10}.Debug|x64.ActiveCfg = Debug|x64
|
||||||
|
{439FA76B-F874-40DB-BAF2-E3647CD55B10}.Debug|x64.Build.0 = Debug|x64
|
||||||
{439FA76B-F874-40DB-BAF2-E3647CD55B10}.Release|Any CPU.ActiveCfg = Release|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}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{439FA76B-F874-40DB-BAF2-E3647CD55B10}.Release|x64.ActiveCfg = Release|x64
|
||||||
|
{439FA76B-F874-40DB-BAF2-E3647CD55B10}.Release|x64.Build.0 = Release|x64
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
<connectionStrings>
|
<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;database=wpf_dm_program;userid=root;password=qq1223" />-->
|
||||||
<add name="database" connectionString="server=127.0.0.1;port=3306;database=hunanxianchang_db;userid=root;password=root" />
|
<add name="database" connectionString="server=192.168.50.84;port=3306;database=sanya_xianchang2;userid=root;password=root" />
|
||||||
</connectionStrings>
|
</connectionStrings>
|
||||||
<!--<runtime>
|
<!--<runtime>
|
||||||
--><!--配置之后,Appdomain.CurrentDomain.UnhandledException 事件的 IsTerminating 就变成了 false 啦!也就是说,程序并不会因为这次的异常而崩溃退出。--><!--
|
--><!--配置之后,Appdomain.CurrentDomain.UnhandledException 事件的 IsTerminating 就变成了 false 啦!也就是说,程序并不会因为这次的异常而崩溃退出。--><!--
|
||||||
|
@ -12,15 +12,15 @@
|
||||||
<appSettings>
|
<appSettings>
|
||||||
|
|
||||||
<!-- 设备id -->
|
<!-- 设备id -->
|
||||||
<add key="machineId" value="DM1" />
|
<add key="machineId" value="DM2" />
|
||||||
<!-- 供应单位 -->
|
<!-- 供应单位 -->
|
||||||
<add key="supplierDept" value="药库" />
|
<add key="supplierDept" value="药库" />
|
||||||
<!-- 领用部门 -->
|
<!-- 领用部门 -->
|
||||||
<add key="receiveDept" value="麻精药房" />
|
<add key="receiveDept" value="麻精药房" />
|
||||||
<!--2023/7/13 药房代码 有则写无则空 -->
|
<!--2023/7/13 药房代码 有则写无则空 -->
|
||||||
<add key="storage" value="" />
|
<add key="storage" value="009902" />
|
||||||
<!-- 登录模式 1单人登录2双人登录 -->
|
<!-- 登录模式 1单人登录2双人登录 -->
|
||||||
<add key="loginMode" value="2" />
|
<add key="loginMode" value="1" />
|
||||||
<!-- 登录顺序,指定先登录的人的名称有效值,只有在登录模式等于2时才会生效; 发药人:【operator】审核人:【reviewer】 -->
|
<!-- 登录顺序,指定先登录的人的名称有效值,只有在登录模式等于2时才会生效; 发药人:【operator】审核人:【reviewer】 -->
|
||||||
<add key="firstLogin" value="operator" />
|
<add key="firstLogin" value="operator" />
|
||||||
<!-- 按处方还药或者按取药记录还药 1:处方2:药品-->
|
<!-- 按处方还药或者按取药记录还药 1:处方2:药品-->
|
||||||
|
@ -28,7 +28,7 @@
|
||||||
<!-- 自动退出时间,单位秒,为0时不自动退出 -->
|
<!-- 自动退出时间,单位秒,为0时不自动退出 -->
|
||||||
<add key="autoExit" value="0"/>
|
<add key="autoExit" value="0"/>
|
||||||
<!--报表数据库连接-->
|
<!--报表数据库连接-->
|
||||||
<add key="gridConnectionString" value="MYSQL; Database=hunanxianchang_db; Password=root; Port=3306; Server=127.0.0.1; User=root;"/>
|
<add key="gridConnectionString" value="MYSQL; Database=sanya_xianchang2; Password=root; Port=3306; Server=192.168.50.84; User=root;"/>
|
||||||
<!-- 查询处方是orderNo还是orderGroupNo -->
|
<!-- 查询处方是orderNo还是orderGroupNo -->
|
||||||
<add key="OrderNoName" value="orderNo" />
|
<add key="OrderNoName" value="orderNo" />
|
||||||
<!-- 后门耗材板地址 没有则填写0-->
|
<!-- 后门耗材板地址 没有则填写0-->
|
||||||
|
@ -40,9 +40,9 @@
|
||||||
<!-- 抽屉串口使用的协议232或者485 -->
|
<!-- 抽屉串口使用的协议232或者485 -->
|
||||||
<add key="DrawerProtocol" value="485" />
|
<add key="DrawerProtocol" value="485" />
|
||||||
<!-- 抽屉串口的串口号 -->
|
<!-- 抽屉串口的串口号 -->
|
||||||
<add key="DrawerPortPath" value="COM3" />
|
<add key="DrawerPortPath" value="COM2" />
|
||||||
<!-- can总线串口的串口号 -->
|
<!-- can总线串口的串口号 -->
|
||||||
<add key="CanBusPortPath" value="COM9" />
|
<add key="CanBusPortPath" value="COM5" />
|
||||||
<!-- 条码枪串口的串口号 -->
|
<!-- 条码枪串口的串口号 -->
|
||||||
<add key="ScanCodePortPath" value="COM11" />
|
<add key="ScanCodePortPath" value="COM11" />
|
||||||
<!-- 抽屉串口的串口号 --><!--
|
<!-- 抽屉串口的串口号 --><!--
|
||||||
|
@ -61,6 +61,8 @@
|
||||||
<add key="fingerIp" value="192.168.50.201"/>
|
<add key="fingerIp" value="192.168.50.201"/>
|
||||||
<!--一个抽屉对应标签数-->
|
<!--一个抽屉对应标签数-->
|
||||||
<add key="labelCount" value="2"/>
|
<add key="labelCount" value="2"/>
|
||||||
|
<!--是否自动写标签数量-->
|
||||||
|
<add key="AutoWriteNum" value="true"/>
|
||||||
|
|
||||||
</appSettings>
|
</appSettings>
|
||||||
</configuration>
|
</configuration>
|
|
@ -55,13 +55,22 @@ namespace DM_Weight
|
||||||
set => _currentShenUserList = value;
|
set => _currentShenUserList = value;
|
||||||
}
|
}
|
||||||
#endregion 当前登录用户的审核人信息
|
#endregion 当前登录用户的审核人信息
|
||||||
|
#region 登录模式,SingleModel=true则为单人登录
|
||||||
|
private static bool _singleModel;
|
||||||
|
public static bool SingleModel
|
||||||
|
{
|
||||||
|
get => _singleModel;
|
||||||
|
set=>_singleModel = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
private readonly ILog logger = LogManager.GetLogger(typeof(App));
|
private readonly ILog logger = LogManager.GetLogger(typeof(App));
|
||||||
public App()
|
public App()
|
||||||
{
|
{
|
||||||
//TabTipAutomation.IgnoreHardwareKeyboard = HardwareKeyboardIgnoreOptions.IgnoreAll;
|
TabTipAutomation.IgnoreHardwareKeyboard = HardwareKeyboardIgnoreOptions.IgnoreAll;
|
||||||
//TabTipAutomation.BindTo<TextBox>();
|
TabTipAutomation.BindTo<TextBox>();
|
||||||
//TabTipAutomation.BindTo<PasswordBox>();
|
TabTipAutomation.BindTo<PasswordBox>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -133,6 +142,8 @@ namespace DM_Weight
|
||||||
|
|
||||||
// 登录页面
|
// 登录页面
|
||||||
containerRegistry.RegisterForNavigation<LoginWindow, LoginWindowViewModel>();
|
containerRegistry.RegisterForNavigation<LoginWindow, LoginWindowViewModel>();
|
||||||
|
//值班柜、周转柜选择
|
||||||
|
containerRegistry.RegisterForNavigation<BeforeLogin, BeforeLoginViewModel>();
|
||||||
|
|
||||||
// 布局页面
|
// 布局页面
|
||||||
containerRegistry.RegisterForNavigation<HomeWindow, HomeWindowViewModel>();
|
containerRegistry.RegisterForNavigation<HomeWindow, HomeWindowViewModel>();
|
||||||
|
@ -143,6 +154,9 @@ namespace DM_Weight
|
||||||
|
|
||||||
|
|
||||||
#region 取药
|
#region 取药
|
||||||
|
// 多处方取药页面
|
||||||
|
containerRegistry.RegisterForNavigation<MultiOrderTakeDrugWindow, MultiOrderTakeDrugWindowViewModel>();
|
||||||
|
containerRegistry.RegisterForNavigation<MultiOrderTakeDialog, MultiOrderTakeDialogViewModel>();
|
||||||
// 处方取药页面
|
// 处方取药页面
|
||||||
containerRegistry.RegisterForNavigation<OrderTakeDrugWindow, OrderTakeDrugWindowViewModel>();
|
containerRegistry.RegisterForNavigation<OrderTakeDrugWindow, OrderTakeDrugWindowViewModel>();
|
||||||
// 处方取药模态框
|
// 处方取药模态框
|
||||||
|
@ -225,6 +239,8 @@ namespace DM_Weight
|
||||||
containerRegistry.RegisterForNavigation<DrugListWindow, DrugListWindowViewModel>();
|
containerRegistry.RegisterForNavigation<DrugListWindow, DrugListWindowViewModel>();
|
||||||
//库存列表导出账册弹窗
|
//库存列表导出账册弹窗
|
||||||
containerRegistry.RegisterForNavigation<StockListAccountDialog, StockListAccountDialogViewModel>();
|
containerRegistry.RegisterForNavigation<StockListAccountDialog, StockListAccountDialogViewModel>();
|
||||||
|
//账册
|
||||||
|
containerRegistry.RegisterForNavigation<SpecialAccountWindow, SpecialAccountWindowViewModel>();
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region 系统设置
|
#region 系统设置
|
||||||
|
@ -263,6 +279,8 @@ namespace DM_Weight
|
||||||
containerRegistry.RegisterForNavigation<AccountWindow,AccountWindowViewModel>();
|
containerRegistry.RegisterForNavigation<AccountWindow,AccountWindowViewModel>();
|
||||||
//账册服务类
|
//账册服务类
|
||||||
containerRegistry.Register<MachineRecordService>();
|
containerRegistry.Register<MachineRecordService>();
|
||||||
|
|
||||||
|
containerRegistry.RegisterForNavigation<EmptyWindow, EmptyWindowViewModel>();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void PrismApplication_Startup(object sender, StartupEventArgs e)
|
private void PrismApplication_Startup(object sender, StartupEventArgs e)
|
||||||
|
|
|
@ -0,0 +1,37 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Globalization;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows;
|
||||||
|
using System.Windows.Data;
|
||||||
|
|
||||||
|
namespace DM_Weight.Converter
|
||||||
|
{
|
||||||
|
internal class DrawerAuthorityConverter : IValueConverter
|
||||||
|
{
|
||||||
|
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||||
|
{
|
||||||
|
if (value != null && value.ToString().Equals("1"))
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||||
|
{
|
||||||
|
bool isTrue;
|
||||||
|
if (bool.TryParse(value.ToString(), out isTrue))
|
||||||
|
{
|
||||||
|
if(isTrue)
|
||||||
|
{
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -73,6 +73,30 @@ namespace DM_Weight.Converter
|
||||||
return 100;
|
return 100;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
//“导出处方登记专册” 按钮是否显示
|
||||||
|
if (para.Equals("ReportOrderAccount"))
|
||||||
|
{
|
||||||
|
if (status == 2)
|
||||||
|
{
|
||||||
|
return Visibility.Visible;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return Visibility.Collapsed;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//“导出回收登记记录” 按钮是否显示
|
||||||
|
if (para.Equals("ReportReturnRecord"))
|
||||||
|
{
|
||||||
|
if (status == 3)
|
||||||
|
{
|
||||||
|
return Visibility.Visible;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return Visibility.Collapsed;
|
||||||
|
}
|
||||||
|
}
|
||||||
return Visibility.Collapsed;
|
return Visibility.Collapsed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -76,6 +76,29 @@ namespace DM_Weight.Converter
|
||||||
return Visibility.Collapsed;
|
return Visibility.Collapsed;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
//显示样式
|
||||||
|
if (para.Equals("TakeFinishLoading"))
|
||||||
|
{
|
||||||
|
if (status ==4)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(para.Equals("TakeFinishEnable"))
|
||||||
|
{
|
||||||
|
if (status ==4)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return Visibility.Collapsed;
|
return Visibility.Collapsed;
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
<PackageIcon></PackageIcon>
|
<PackageIcon></PackageIcon>
|
||||||
<Product>毒麻管理程序</Product>
|
<Product>毒麻管理程序</Product>
|
||||||
<ApplicationIcon>Images\favicon.ico</ApplicationIcon>
|
<ApplicationIcon>Images\favicon.ico</ApplicationIcon>
|
||||||
|
<Platforms>AnyCPU;x64</Platforms>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
@ -101,6 +102,18 @@
|
||||||
<None Update="log4net.config">
|
<None Update="log4net.config">
|
||||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
</None>
|
</None>
|
||||||
|
<None Update="ReportTemp\account_book_order.grf">
|
||||||
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
|
<None Update="ReportTemp\account_book_temp - 01.grf">
|
||||||
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
|
<None Update="ReportTemp\account_book_temp - 02.grf">
|
||||||
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
|
<None Update="ReportTemp\account_book_temp-01.grf">
|
||||||
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
<None Update="ReportTemp\changeShifts_temp.grf">
|
<None Update="ReportTemp\changeShifts_temp.grf">
|
||||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
</None>
|
</None>
|
||||||
|
@ -110,6 +123,9 @@
|
||||||
<None Update="ReportTemp\changeShifts_temp.grf">
|
<None Update="ReportTemp\changeShifts_temp.grf">
|
||||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
</None>
|
</None>
|
||||||
|
<None Update="ReportTemp\changeShifts_temp_new.grf">
|
||||||
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
<None Update="ReportTemp\machine_log_check.grf">
|
<None Update="ReportTemp\machine_log_check.grf">
|
||||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
</None>
|
</None>
|
||||||
|
@ -128,6 +144,9 @@
|
||||||
<None Update="ReportTemp\machine_log_take.grf">
|
<None Update="ReportTemp\machine_log_take.grf">
|
||||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
</None>
|
</None>
|
||||||
|
<None Update="ReportTemp\return_empty.grf">
|
||||||
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
<None Update="ReportTemp\stock_template.grf">
|
<None Update="ReportTemp\stock_template.grf">
|
||||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
</None>
|
</None>
|
||||||
|
|
Binary file not shown.
After Width: | Height: | Size: 39 KiB |
|
@ -0,0 +1,19 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace DM_Weight.Models
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 逐日消耗专用账册中数量及批号
|
||||||
|
/// </summary>
|
||||||
|
public class AccountTotalQuantity
|
||||||
|
{
|
||||||
|
//领药数量、发药数量、结存数量
|
||||||
|
public string StrTotalQuantity { get; set; }
|
||||||
|
//数量对应的批号
|
||||||
|
public string StrTotalManuNo { get; set; }
|
||||||
|
}
|
||||||
|
}
|
|
@ -87,7 +87,7 @@ namespace DM_Weight.Models
|
||||||
///
|
///
|
||||||
/// 默认值: 1
|
/// 默认值: 1
|
||||||
///</summary>
|
///</summary>
|
||||||
[SugarColumn(ColumnName = "state")]
|
[SugarColumn(ColumnName = "dm_state")]
|
||||||
public int? State { get; set; }
|
public int? State { get; set; }
|
||||||
|
|
||||||
[SugarColumn(IsIgnore = true)]
|
[SugarColumn(IsIgnore = true)]
|
||||||
|
|
|
@ -92,6 +92,12 @@ namespace DM_Weight.Models
|
||||||
[SugarColumn(ColumnName = "state")]
|
[SugarColumn(ColumnName = "state")]
|
||||||
public int? State { get; set; }
|
public int? State { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 入库时间:针对先入先出操作
|
||||||
|
/// </summary>
|
||||||
|
[SugarColumn(ColumnName = "fill_time")]
|
||||||
|
public DateTime? FillTime { get; set; }
|
||||||
|
|
||||||
[SugarColumn(IsIgnore = true)]
|
[SugarColumn(IsIgnore = true)]
|
||||||
public bool IsSelected { get; set; }
|
public bool IsSelected { get; set; }
|
||||||
|
|
||||||
|
|
|
@ -57,11 +57,21 @@ namespace DM_Weight.Models
|
||||||
[SugarColumn(ColumnName = "dosage")]
|
[SugarColumn(ColumnName = "dosage")]
|
||||||
public string Dosage { get; set; }
|
public string Dosage { get; set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// <20><>װ<EFBFBD><D7B0>λ
|
/// <20><>װ<EFBFBD><D7B0>λ packUnit这个字段不用了,用bigUnit,smallUnit那2个字段
|
||||||
///</summary>
|
///</summary>
|
||||||
[SugarColumn(ColumnName = "pack_unit")]
|
[SugarColumn(ColumnName = "pack_unit")]
|
||||||
public string PackUnit { get; set; }
|
public string PackUnit { get; set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
/// bigUnit大单位是整盒的
|
||||||
|
/// </summary>
|
||||||
|
[SugarColumn(ColumnName = "big_unit")]
|
||||||
|
public string BigUnit { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// smallUnit是拆零单位
|
||||||
|
/// </summary>
|
||||||
|
[SugarColumn(ColumnName = "small_unit")]
|
||||||
|
public string SmallUnit { get; set; }
|
||||||
|
/// <summary>
|
||||||
/// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
/// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
///</summary>
|
///</summary>
|
||||||
[SugarColumn(ColumnName = "manufactory")]
|
[SugarColumn(ColumnName = "manufactory")]
|
||||||
|
@ -83,7 +93,11 @@ namespace DM_Weight.Models
|
||||||
|
|
||||||
[SugarColumn(IsIgnore = true)]
|
[SugarColumn(IsIgnore = true)]
|
||||||
public string drug_name_spec { get; set; }
|
public string drug_name_spec { get; set; }
|
||||||
//[SugarColumn(ColumnName = "drug_name_spec")]
|
|
||||||
//public string Name { get; set; }
|
/// <summary>
|
||||||
|
/// 药品单位转换率
|
||||||
|
/// </summary>
|
||||||
|
[SugarColumn(ColumnName = "convert_ratio")]
|
||||||
|
public int ConvertRatio { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -55,6 +55,9 @@ namespace DM_Weight.Models
|
||||||
|
|
||||||
[Navigate(NavigateType.ManyToOne, nameof(Operator))]
|
[Navigate(NavigateType.ManyToOne, nameof(Operator))]
|
||||||
public UserList User { get; set; }
|
public UserList User { get; set; }
|
||||||
|
|
||||||
|
[Navigate(NavigateType.ManyToOne, nameof(InvoiceId))]
|
||||||
|
public OrderInfo orderInfo { get; set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 审核人id
|
/// 审核人id
|
||||||
///</summary>
|
///</summary>
|
||||||
|
@ -72,7 +75,7 @@ namespace DM_Weight.Models
|
||||||
[SugarColumn(ColumnName = "eff_date")]
|
[SugarColumn(ColumnName = "eff_date")]
|
||||||
public DateTime? EffDate { get; set; }
|
public DateTime? EffDate { get; set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 出库入库类型(1入库2出库31还药32还空瓶)
|
/// 出库入库类型(1入库 2出库 31还药 32还空瓶 4盘点 5日结存)
|
||||||
///</summary>
|
///</summary>
|
||||||
[SugarColumn(ColumnName = "type")]
|
[SugarColumn(ColumnName = "type")]
|
||||||
public int Type { get; set; }
|
public int Type { get; set; }
|
||||||
|
@ -106,13 +109,13 @@ namespace DM_Weight.Models
|
||||||
/// 退药量
|
/// 退药量
|
||||||
/// 默认值: 0
|
/// 默认值: 0
|
||||||
///</summary>
|
///</summary>
|
||||||
[SugarColumn(ColumnName = "return_quantity1", IsOnlyIgnoreInsert = true)]
|
[SugarColumn(ColumnName = "return_quantity1")]
|
||||||
public int ReturnQuantity1 { get; set; }
|
public int ReturnQuantity1 { get; set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 退空瓶量
|
/// 退空瓶量
|
||||||
/// 默认值: 0
|
/// 默认值: 0
|
||||||
///</summary>
|
///</summary>
|
||||||
[SugarColumn(ColumnName = "return_quantity2", IsOnlyIgnoreInsert = true)]
|
[SugarColumn(ColumnName = "return_quantity2")]
|
||||||
public int ReturnQuantity2 { get; set; }
|
public int ReturnQuantity2 { get; set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 取药记录id
|
/// 取药记录id
|
||||||
|
@ -153,5 +156,20 @@ namespace DM_Weight.Models
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[SugarColumn(ColumnName = "receiveDept")]
|
[SugarColumn(ColumnName = "receiveDept")]
|
||||||
public string ReceiveDept { get; set; }
|
public string ReceiveDept { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 交回人
|
||||||
|
/// </summary>
|
||||||
|
[SugarColumn(ColumnName = "returnPerson")]
|
||||||
|
public string ReturnPerson { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 接收人
|
||||||
|
/// </summary>
|
||||||
|
[SugarColumn(ColumnName = "receivePerson")]
|
||||||
|
public string ReceivePerson { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 序号
|
||||||
|
/// </summary>
|
||||||
|
[SugarColumn(ColumnName = "ordinalNum")]
|
||||||
|
public int OrdinalNum { get;set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,16 @@
|
||||||
|
using Prism.Mvvm;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace DM_Weight.Models
|
||||||
|
{
|
||||||
|
public class OrderDepartment : BindableBase
|
||||||
|
{
|
||||||
|
//科室
|
||||||
|
public string _deptName = "全部";
|
||||||
|
public string DeptName { get => _deptName; set { SetProperty(ref _deptName, value); } }
|
||||||
|
}
|
||||||
|
}
|
|
@ -19,8 +19,8 @@ namespace DM_Weight.Models
|
||||||
///
|
///
|
||||||
/// 默认值: NULL
|
/// 默认值: NULL
|
||||||
///</summary>
|
///</summary>
|
||||||
//[SugarColumn(ColumnName = "order_id")]
|
[SugarColumn(ColumnName = "order_id")]
|
||||||
//public int? OrderId { get; set; }
|
public int? OrderId { get; set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
///</summary>
|
///</summary>
|
||||||
|
@ -127,5 +127,11 @@ namespace DM_Weight.Models
|
||||||
///</summary>
|
///</summary>
|
||||||
[SugarColumn(ColumnName = "use_dosage")]
|
[SugarColumn(ColumnName = "use_dosage")]
|
||||||
public string UseDosage { get; set; }
|
public string UseDosage { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 药品状态0未取1已取
|
||||||
|
/// 默认值: 0
|
||||||
|
///</summary>
|
||||||
|
[SugarColumn(ColumnName = "detail_status")]
|
||||||
|
public int? DetailStatus { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -10,10 +10,16 @@ namespace DM_Weight.Models
|
||||||
[SugarTable("order_info")]
|
[SugarTable("order_info")]
|
||||||
public class OrderInfo
|
public class OrderInfo
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 是否选中
|
||||||
|
/// </summary>
|
||||||
|
[SugarColumn(IsIgnore = true)]
|
||||||
|
public bool ItemIsChecked { get; set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
///</summary>
|
/////</summary>
|
||||||
[SugarColumn(ColumnName = "order_id", IsPrimaryKey = true, IsIdentity = true)]
|
//[SugarColumn(ColumnName = "order_id", IsPrimaryKey = true, IsIdentity = true)]
|
||||||
|
[SugarColumn(ColumnName = "order_id")]
|
||||||
public int OrderId { get; set; }
|
public int OrderId { get; set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
|
@ -24,7 +30,7 @@ namespace DM_Weight.Models
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
///</summary>
|
///</summary>
|
||||||
[SugarColumn(ColumnName = "order_no")]
|
[SugarColumn(ColumnName = "order_no", IsPrimaryKey = true, IsIdentity = true)]
|
||||||
public string OrderNo { get; set; }
|
public string OrderNo { get; set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
|
|
|
@ -36,5 +36,22 @@ namespace DM_Weight.Models
|
||||||
///</summary>
|
///</summary>
|
||||||
[SugarColumn(ColumnName="machine_id" )]
|
[SugarColumn(ColumnName="machine_id" )]
|
||||||
public string MachineId { get; set; }
|
public string MachineId { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 1-8号抽屉
|
||||||
|
///</summary>
|
||||||
|
[SugarColumn(ColumnName = "FirstEightChecked")]
|
||||||
|
public string FirstEightChecked { get; set; } = "0";
|
||||||
|
/// <summary>
|
||||||
|
/// 9-16号抽屉
|
||||||
|
///</summary>
|
||||||
|
[SugarColumn(ColumnName= "LastEightChecked")]
|
||||||
|
public string LastEightChecked { get; set; } = "0";
|
||||||
|
/// <summary>
|
||||||
|
/// 17号抽屉
|
||||||
|
///</summary>
|
||||||
|
[SugarColumn(ColumnName= "StorageBoxChecked")]
|
||||||
|
public string StorageBoxChecked { get; set; } = "0";
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -51,5 +51,23 @@ namespace DM_Weight.Models
|
||||||
|
|
||||||
[SugarColumn(ColumnName = "machineId")]
|
[SugarColumn(ColumnName = "machineId")]
|
||||||
public string MachineId { get; set; }
|
public string MachineId { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 单位
|
||||||
|
/// </summary>
|
||||||
|
[SugarColumn(ColumnName = "pack_unit")]
|
||||||
|
public string PackdUnit { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 库存数
|
||||||
|
/// </summary>
|
||||||
|
[SugarColumn(ColumnName = "stockQuantity")]
|
||||||
|
public int StockQuantity { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 空瓶数
|
||||||
|
/// </summary>
|
||||||
|
[SugarColumn(ColumnName = "emptyQuantity")]
|
||||||
|
public int EmptyQuantity { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,24 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace DM_Weight.Models
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 取药或加药用途字段(如果是补库存则不加入到报表中)
|
||||||
|
/// </summary>
|
||||||
|
public class UseFor
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 96不用于入账册
|
||||||
|
/// </summary>
|
||||||
|
public int UseId { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// (入账册/不入账册)
|
||||||
|
/// </summary>
|
||||||
|
public string UseName { get; set; }
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -545,6 +545,7 @@ namespace DM_Weight.Port
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
Thread.Sleep(200);
|
||||||
// 灯在闪烁继续监听状态
|
// 灯在闪烁继续监听状态
|
||||||
GetBackDoorState();
|
GetBackDoorState();
|
||||||
}
|
}
|
||||||
|
@ -581,6 +582,7 @@ namespace DM_Weight.Port
|
||||||
});
|
});
|
||||||
logger.Info($"储物箱打开成功");
|
logger.Info($"储物箱打开成功");
|
||||||
}
|
}
|
||||||
|
Thread.Sleep(100);
|
||||||
// 灯在闪烁继续监听状态
|
// 灯在闪烁继续监听状态
|
||||||
GetBackDoorState();
|
GetBackDoorState();
|
||||||
}
|
}
|
||||||
|
@ -698,7 +700,7 @@ namespace DM_Weight.Port
|
||||||
while (_length != length && end.Subtract(start).TotalMilliseconds < timeout)
|
while (_length != length && end.Subtract(start).TotalMilliseconds < timeout)
|
||||||
{
|
{
|
||||||
_length = serialPort.BytesToRead;
|
_length = serialPort.BytesToRead;
|
||||||
if (_length == 0&& operation.Equals("开储物箱"))
|
if (_length == 0 && operation.Equals("开储物箱"))
|
||||||
{
|
{
|
||||||
|
|
||||||
_length = serialPort.BytesToRead;
|
_length = serialPort.BytesToRead;
|
||||||
|
@ -710,6 +712,13 @@ namespace DM_Weight.Port
|
||||||
logger.Info($"再次发送OpenStorage:{Convert.ToHexString(bufferWrite)};{end}");
|
logger.Info($"再次发送OpenStorage:{Convert.ToHexString(bufferWrite)};{end}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (_length == 0 && operation.Equals("查储物箱状态"))
|
||||||
|
{
|
||||||
|
Thread.Sleep(200);
|
||||||
|
byte[] bufferWrite = new byte[] { 0xaa, (byte)(_doorAddr), 0x02, 0x00, 0x00, 0x00, 0x00, 0xee };
|
||||||
|
canBusSerial.Write(bufferWrite, 0, 8);
|
||||||
|
logger.Info($"再次发送查储物箱状态指令:{Convert.ToHexString(bufferWrite)};{end}");
|
||||||
|
}
|
||||||
end = DateTime.Now;
|
end = DateTime.Now;
|
||||||
}
|
}
|
||||||
if (_length != length)
|
if (_length != length)
|
||||||
|
@ -815,7 +824,7 @@ namespace DM_Weight.Port
|
||||||
byte[] buffer = new byte[] { 0xaa, (byte)(_doorAddr), 0x02, 0x00, 0x00, 0x00, 0x00, 0xee };
|
byte[] buffer = new byte[] { 0xaa, (byte)(_doorAddr), 0x02, 0x00, 0x00, 0x00, 0x00, 0xee };
|
||||||
canBusSerial.Write(buffer, 0, 8);
|
canBusSerial.Write(buffer, 0, 8);
|
||||||
|
|
||||||
return await GetBufferByPort(canBusSerial, 8);
|
return await GetBufferByPort(canBusSerial, 8, "查储物箱状态");
|
||||||
|
|
||||||
}
|
}
|
||||||
// 打开电控门储物箱(有灯使能)
|
// 打开电控门储物箱(有灯使能)
|
||||||
|
@ -1027,6 +1036,7 @@ namespace DM_Weight.Port
|
||||||
|
|
||||||
#region 2.4寸汉显屏
|
#region 2.4寸汉显屏
|
||||||
// 基础数据写入方法
|
// 基础数据写入方法
|
||||||
|
//三色灯写标签type:1药品名称;2规格;5批次;6效期;8厂家
|
||||||
public void WriteChannelInfo(int type, string content, int drawerNo, int colNo)
|
public void WriteChannelInfo(int type, string content, int drawerNo, int colNo)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
@ -1042,6 +1052,9 @@ namespace DM_Weight.Port
|
||||||
}
|
}
|
||||||
byte[] buffer = new byte[] { 0xaa, (byte)channel, 1, (byte)type, 0, 0, 0, 0xee };
|
byte[] buffer = new byte[] { 0xaa, (byte)channel, 1, (byte)type, 0, 0, 0, 0xee };
|
||||||
canBusSerial.Write(buffer, 0, 8);
|
canBusSerial.Write(buffer, 0, 8);
|
||||||
|
logger.Info(Convert.ToHexString(buffer));
|
||||||
|
//byte[] bufferReturn = GetBufferByPort(canBusSerial, 8).Result;
|
||||||
|
//logger.Info($"写入数量返回:" + Convert.ToHexString(bufferReturn));
|
||||||
//await Task.Delay(20);
|
//await Task.Delay(20);
|
||||||
Thread.Sleep(20);
|
Thread.Sleep(20);
|
||||||
buffer[4] = 1;
|
buffer[4] = 1;
|
||||||
|
@ -1050,6 +1063,9 @@ namespace DM_Weight.Port
|
||||||
buffer[5] = contentBuf[i];
|
buffer[5] = contentBuf[i];
|
||||||
buffer[6] = contentBuf[i + 1];
|
buffer[6] = contentBuf[i + 1];
|
||||||
canBusSerial.Write(buffer, 0, 8);
|
canBusSerial.Write(buffer, 0, 8);
|
||||||
|
logger.Info(Convert.ToHexString(buffer));
|
||||||
|
//byte[] fBufferReturn = GetBufferByPort(canBusSerial, 8).Result;
|
||||||
|
//logger.Info($"写入数量返回:" + Convert.ToHexString(fBufferReturn));
|
||||||
//await Task.Delay(20);
|
//await Task.Delay(20);
|
||||||
Thread.Sleep(20);
|
Thread.Sleep(20);
|
||||||
}
|
}
|
||||||
|
@ -1057,17 +1073,23 @@ namespace DM_Weight.Port
|
||||||
buffer[5] = 0;
|
buffer[5] = 0;
|
||||||
buffer[6] = 0;
|
buffer[6] = 0;
|
||||||
canBusSerial.Write(buffer, 0, 8);
|
canBusSerial.Write(buffer, 0, 8);
|
||||||
|
logger.Info(Convert.ToHexString(buffer));
|
||||||
|
//byte[] eBufferReturn = GetBufferByPort(canBusSerial, 8).Result;
|
||||||
|
//logger.Info($"写入数量返回:" + Convert.ToHexString(eBufferReturn));
|
||||||
//await Task.Delay(20);
|
//await Task.Delay(20);
|
||||||
Thread.Sleep(20);
|
Thread.Sleep(20);
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
_eventAggregator.GetEvent<PortUtilEvent>().Publish(new util.DeviceMsg()
|
System.Windows.Application.Current.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Send, new Action(() =>
|
||||||
{
|
{
|
||||||
EventType = util.EventType.OPENERROR,
|
_eventAggregator.GetEvent<PortUtilEvent>().Publish(new util.DeviceMsg()
|
||||||
WindowName = WindowName,
|
{
|
||||||
Message = $"2.4寸汉显屏异常{ex.Message}"
|
EventType = util.EventType.OPENERROR,
|
||||||
});
|
WindowName = WindowName,
|
||||||
|
Message = $"2.4寸汉显屏异常{ex.Message}"
|
||||||
|
});
|
||||||
|
}));
|
||||||
logger.Info($"2.4寸汉显屏异常:ex:{ex.Message}");
|
logger.Info($"2.4寸汉显屏异常:ex:{ex.Message}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1156,12 +1178,15 @@ namespace DM_Weight.Port
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
_eventAggregator.GetEvent<PortUtilEvent>().Publish(new util.DeviceMsg()
|
System.Windows.Application.Current.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Send, new Action(() =>
|
||||||
{
|
{
|
||||||
EventType = util.EventType.OPENERROR,
|
_eventAggregator.GetEvent<PortUtilEvent>().Publish(new util.DeviceMsg()
|
||||||
WindowName = WindowName,
|
{
|
||||||
Message = $"操作发生异常{ex.InnerException}"
|
EventType = util.EventType.OPENERROR,
|
||||||
});
|
WindowName = WindowName,
|
||||||
|
Message = $"操作发生异常{ex.InnerException}"
|
||||||
|
});
|
||||||
|
}));
|
||||||
logger.Info($"操作发生异常:ex:{ex.InnerException}");
|
logger.Info($"操作发生异常:ex:{ex.InnerException}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,6 +9,9 @@ using System.Threading.Tasks;
|
||||||
using DM_Weight.Models;
|
using DM_Weight.Models;
|
||||||
using System.Configuration;
|
using System.Configuration;
|
||||||
using DM_Weight.util;
|
using DM_Weight.util;
|
||||||
|
using System.Data;
|
||||||
|
using MySqlConnector;
|
||||||
|
using System.Windows.Markup;
|
||||||
|
|
||||||
namespace DM_Weight.Report
|
namespace DM_Weight.Report
|
||||||
{
|
{
|
||||||
|
@ -17,7 +20,7 @@ namespace DM_Weight.Report
|
||||||
|
|
||||||
// 定义Grid++Report报表主对象
|
// 定义Grid++Report报表主对象
|
||||||
public static GridppReport Report = new GridppReport();
|
public static GridppReport Report = new GridppReport();
|
||||||
public static string gridConnectionString = ConfigurationManager.AppSettings["gridConnectionString"];
|
public static string gridConnectionString = ConfigurationManager.AppSettings["gridConnectionString"];
|
||||||
/**
|
/**
|
||||||
* 打印预览
|
* 打印预览
|
||||||
* tempname: 模板文件名称
|
* tempname: 模板文件名称
|
||||||
|
@ -43,10 +46,20 @@ namespace DM_Weight.Report
|
||||||
{
|
{
|
||||||
Report.ParameterByName("machine_id").Value = (ConfigurationManager.AppSettings["machineId"] ?? "DM1");
|
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,
|
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,
|
di.`drug_name` AS drugName,di.`drug_spec` AS drugSpec,di.`pack_unit` AS packUnit,di.small_unit as smallUnit,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`";
|
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 ";
|
||||||
|
if(App.SingleModel)
|
||||||
|
{
|
||||||
|
SQL += " and cl.row_no<=8";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
SQL += " and cl.row_no>8";
|
||||||
|
}
|
||||||
|
SQL += " ORDER BY cl.`drug_id`";
|
||||||
|
|
||||||
// 加载模板文件
|
// 加载模板文件
|
||||||
Report.LoadFromFile(new FileInfo(AppDomain.CurrentDomain.BaseDirectory) + "ReportTemp//" + "stock_template.grf");
|
Report.LoadFromFile(new FileInfo(AppDomain.CurrentDomain.BaseDirectory) + "ReportTemp//" + "stock_template.grf");
|
||||||
Report.DetailGrid.Recordset.ConnectionString = gridConnectionString;
|
Report.DetailGrid.Recordset.ConnectionString = gridConnectionString;
|
||||||
|
@ -70,7 +83,7 @@ namespace DM_Weight.Report
|
||||||
//});
|
//});
|
||||||
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,
|
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,
|
||||||
`drug_name` AS drugName,`drug_spec` AS drugSpec,`pack_unit` AS packUnit,`manufactory` AS manuFactory,`max_stock` AS baseQuantity,
|
`drug_name` AS drugName,`drug_spec` AS drugSpec,`pack_unit` AS packUnit,pack_unit AS smallUnit,`manufactory` AS manuFactory,`max_stock` AS baseQuantity,
|
||||||
cl.`drug_id` AS drugId,cl.manuquantity, cl.`optdate` FROM check_stock cl WHERE cl.`machine_id` = '{machine_id}' AND cl.`optdate` > '{p_startDate}' AND cl.`optdate` < '{p_endDate}' ORDER BY cl.`optdate` desc, cl.`drug_id`";
|
cl.`drug_id` AS drugId,cl.manuquantity, cl.`optdate` FROM check_stock cl WHERE cl.`machine_id` = '{machine_id}' AND cl.`optdate` > '{p_startDate}' AND cl.`optdate` < '{p_endDate}' ORDER BY cl.`optdate` desc, cl.`drug_id`";
|
||||||
// 加载模板文件
|
// 加载模板文件
|
||||||
Report.LoadFromFile(new FileInfo(AppDomain.CurrentDomain.BaseDirectory) + "ReportTemp//" + "machine_log_check_new2.grf");
|
Report.LoadFromFile(new FileInfo(AppDomain.CurrentDomain.BaseDirectory) + "ReportTemp//" + "machine_log_check_new2.grf");
|
||||||
|
@ -78,13 +91,13 @@ namespace DM_Weight.Report
|
||||||
Report.DetailGrid.Recordset.QuerySQL = SQL;
|
Report.DetailGrid.Recordset.QuerySQL = SQL;
|
||||||
Report.PrintPreview(true);
|
Report.PrintPreview(true);
|
||||||
}
|
}
|
||||||
public static void PrintReportAccountBook(DateTime? startDate, DateTime? endDate,int type,string drug_id)
|
public static void PrintReportAccountBook(DateTime? startDate, DateTime? endDate, int type, string drug_id)
|
||||||
{
|
{
|
||||||
DateTime? p_startDate = startDate ?? Convert.ToDateTime("2010-1-1");
|
DateTime? p_startDate = startDate ?? Convert.ToDateTime("2010-1-1");
|
||||||
DateTime? p_endDate = endDate ?? DateTime.Now.AddDays(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报表主对象
|
// 定义Grid++Report报表主对象
|
||||||
GridppReport Report = new GridppReport();
|
GridppReport Report = new GridppReport();
|
||||||
// 加载模板文件
|
// 加载模板文件
|
||||||
Report.LoadFromFile(new FileInfo(AppDomain.CurrentDomain.BaseDirectory) + "ReportTemp//" + "account_book_temp.grf");
|
Report.LoadFromFile(new FileInfo(AppDomain.CurrentDomain.BaseDirectory) + "ReportTemp//" + "account_book_temp.grf");
|
||||||
string SQL = string.Empty;
|
string SQL = string.Empty;
|
||||||
|
@ -96,21 +109,21 @@ namespace DM_Weight.Report
|
||||||
Report.ParameterByName("endDate").Value = endDate ?? DateTime.Now.AddDays(1);
|
Report.ParameterByName("endDate").Value = endDate ?? DateTime.Now.AddDays(1);
|
||||||
});
|
});
|
||||||
//Report.DetailGrid.Recordset.QuerySQL = SQL;
|
//Report.DetailGrid.Recordset.QuerySQL = SQL;
|
||||||
SQL = $@"SELECT TYPE, stockQuantity,inQuantity,outQuantity,operationTime,invoiceId,drugName,drugId,drugSpec,packUnit,dosage,manufactory,manuNo,effDate,
|
SQL = $@"SELECT TYPE, stockQuantity,inQuantity,outQuantity,operationTime,invoiceId,drugName,drugId,drugSpec,packUnit,smallUnit,dosage,manufactory,manuNo,effDate,
|
||||||
operatorName,reviewerName,supplierDept,receiveDept,bigUnit FROM
|
operatorName,reviewerName,supplierDept,receiveDept,bigUnit FROM
|
||||||
(SELECT mr.type, mr.`stock_quantity` AS `stockQuantity`, IF(mr.`type` IN (1, 31), mr.`quantity`, IF(mr.`type` = 4 AND mr.`quantity` > 0, mr.`quantity`, 0))
|
(SELECT mr.type, mr.`stock_quantity` AS `stockQuantity`, IF(mr.`type` IN (1, 31), mr.`quantity`, IF(mr.`type` = 4 AND mr.`quantity` > 0, mr.`quantity`, 0))
|
||||||
AS `inQuantity`, IF(mr.`type` = 2, mr.`quantity`, IF(mr.`type` = 4 AND mr.`quantity` < 0, (0 - mr.`quantity`), 0)) AS `outQuantity`,
|
AS `inQuantity`, IF(mr.`type` = 2, mr.`quantity`, IF(mr.`type` = 4 AND mr.`quantity` < 0, (0 - mr.`quantity`), 0)) AS `outQuantity`,
|
||||||
mr.`operation_time` AS `operationTime`,IF(mr.`type`=1,mr.`invoice_id`,NULL) AS `invoiceId`, di.`drug_name` AS `drugName`, di.`drug_id` AS `drugId`,
|
mr.`operation_time` AS `operationTime`,IF(mr.`type`=1,mr.`invoice_id`,NULL) AS `invoiceId`, di.`drug_name` AS `drugName`, di.`drug_id` AS `drugId`,
|
||||||
di.`drug_spec` AS `drugSpec`, di.`pack_unit` AS `packUnit`,di.big_unit as bigUnit, di.`dosage` AS `dosage`, di.`manufactory` AS `manufactory`,
|
di.`drug_spec` AS `drugSpec`, di.`pack_unit` AS `packUnit`,di.big_unit as bigUnit,di.small_unit as smallUnit, di.`dosage` AS `dosage`, di.`manufactory` AS `manufactory`,
|
||||||
mr.`manu_no` AS `manuNo`, mr.`eff_date` AS `effDate`, u1.`user_name` AS `operatorName`, u2.`user_name` AS `reviewerName`,mr.supplierDept,mr.receiveDept FROM
|
mr.`manu_no` AS `manuNo`, mr.`eff_date` AS `effDate`, u1.`user_name` AS `operatorName`, u2.`user_name` AS `reviewerName`,mr.supplierDept,mr.receiveDept FROM
|
||||||
dm_machine_record mr LEFT JOIN drug_info di ON mr.`drug_id` = di.`drug_id` LEFT JOIN user_list u1 ON mr.`operator` = u1.`id`
|
dm_machine_record mr LEFT JOIN drug_info di ON mr.`drug_id` = di.`drug_id` LEFT JOIN user_list u1 ON mr.`operator` = u1.`id`
|
||||||
LEFT JOIN user_list u2 ON mr.`reviewer` = u2.`id` WHERE mr.`machine_id` = '{p_machine_id}' AND mr.`operation_time` > '{p_startDate}'
|
LEFT JOIN user_list u2 ON mr.`reviewer` = u2.`id` WHERE mr.`machine_id` = '{p_machine_id}' AND mr.`operation_time` > '{p_startDate}'
|
||||||
AND mr.`operation_time` < '{p_endDate}' and IF(mr.`type` = 4 AND mr.`quantity` = 0, 99999, mr.`quantity`) <>99999 ";
|
AND mr.`operation_time` < '{p_endDate}' and IF(mr.`type` = 4 AND mr.`quantity` = 0, 99999, mr.`quantity`) <>99999 ";
|
||||||
if(!string.IsNullOrEmpty(drug_id))
|
if (!string.IsNullOrEmpty(drug_id))
|
||||||
{
|
{
|
||||||
SQL+= " AND mr.drug_id='"+ drug_id+"' ";
|
SQL += " AND mr.drug_id='" + drug_id + "' ";
|
||||||
}
|
}
|
||||||
SQL+= " ORDER BY mr.`drug_id`, mr.`operation_time`, mr.`id`) AS T";
|
SQL += " ORDER BY mr.`drug_id`, mr.`operation_time`, mr.`id`) AS T";
|
||||||
if (type > 0)
|
if (type > 0)
|
||||||
{
|
{
|
||||||
if (type == 1)
|
if (type == 1)
|
||||||
|
@ -127,6 +140,7 @@ namespace DM_Weight.Report
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Report.DetailGrid.Recordset.QuerySQL = SQL;
|
Report.DetailGrid.Recordset.QuerySQL = SQL;
|
||||||
|
|
||||||
Report.PrintPreview(true);
|
Report.PrintPreview(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -150,7 +164,7 @@ namespace DM_Weight.Report
|
||||||
Report.LoadFromFile(new FileInfo(AppDomain.CurrentDomain.BaseDirectory) + "ReportTemp//" + "machine_log_add.grf");
|
Report.LoadFromFile(new FileInfo(AppDomain.CurrentDomain.BaseDirectory) + "ReportTemp//" + "machine_log_add.grf");
|
||||||
SQL = $@"SELECT dmr.`drawer_no` AS drawerNo,dmr.`col_no` AS colNo,dmr.`type` AS `type`,dmr.`quantity` AS quantity,
|
SQL = $@"SELECT dmr.`drawer_no` AS drawerNo,dmr.`col_no` AS colNo,dmr.`type` AS `type`,dmr.`quantity` AS quantity,
|
||||||
dmr.`manu_no` AS manuNo,dmr.`eff_date` AS effDate,dmr.`operation_time` AS operationTime,
|
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.`drug_name` AS drugName,di.`drug_spec` AS drugSpec,di.`pack_unit` AS packUnit,di.small_unit as smallUnit,
|
||||||
di.`manufactory` AS manuFactory,di.`max_stock` AS baseQuantity,dmr.`drug_id` AS drugId,
|
di.`manufactory` AS manuFactory,di.`max_stock` AS baseQuantity,dmr.`drug_id` AS drugId,
|
||||||
ul.`user_name` AS nickname FROM dm_machine_record dmr LEFT JOIN drug_info di ON di.`drug_id` = dmr.`drug_id`
|
ul.`user_name` AS nickname FROM dm_machine_record dmr LEFT JOIN drug_info di ON di.`drug_id` = dmr.`drug_id`
|
||||||
LEFT JOIN user_list ul ON ul.`id` = dmr.`Operator` WHERE dmr.`type` = 1 AND dmr.`machine_id` = '{p_machine_id}'
|
LEFT JOIN user_list ul ON ul.`id` = dmr.`Operator` WHERE dmr.`type` = 1 AND dmr.`machine_id` = '{p_machine_id}'
|
||||||
|
@ -161,7 +175,7 @@ namespace DM_Weight.Report
|
||||||
Report.LoadFromFile(new FileInfo(AppDomain.CurrentDomain.BaseDirectory) + "ReportTemp//" + "machine_log_take.grf");
|
Report.LoadFromFile(new FileInfo(AppDomain.CurrentDomain.BaseDirectory) + "ReportTemp//" + "machine_log_take.grf");
|
||||||
SQL = $@" SELECT dmr.`drawer_no` AS drawerNo,dmr.`col_no` AS colNo,dmr.`type` AS `type`,dmr.`quantity` AS quantity,
|
SQL = $@" SELECT dmr.`drawer_no` AS drawerNo,dmr.`col_no` AS colNo,dmr.`type` AS `type`,dmr.`quantity` AS quantity,
|
||||||
dmr.`manu_no` AS manuNo,dmr.`eff_date` AS effDate,dmr.`operation_time` AS operationTime,
|
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.`drug_name` AS drugName,di.`drug_spec` AS drugSpec,di.`pack_unit` AS packUnit,di.small_unit as smallUnit,
|
||||||
di.`manufactory` AS manuFactory,di.`max_stock` AS baseQuantity,dmr.`drug_id` AS drugId,
|
di.`manufactory` AS manuFactory,di.`max_stock` AS baseQuantity,dmr.`drug_id` AS drugId,
|
||||||
ul.`user_name` AS nickname FROM dm_machine_record dmr LEFT JOIN drug_info di ON di.`drug_id` = dmr.`drug_id`
|
ul.`user_name` AS nickname FROM dm_machine_record dmr LEFT JOIN drug_info di ON di.`drug_id` = dmr.`drug_id`
|
||||||
LEFT JOIN user_list ul ON ul.`id` = dmr.`Operator` WHERE dmr.`type` = 2
|
LEFT JOIN user_list ul ON ul.`id` = dmr.`Operator` WHERE dmr.`type` = 2
|
||||||
|
@ -174,7 +188,7 @@ namespace DM_Weight.Report
|
||||||
SQL = $@" SELECT dmr.`drawer_no` AS drawerNo,dmr.`col_no` AS colNo,dmr.`type` AS `type`,
|
SQL = $@" SELECT dmr.`drawer_no` AS drawerNo,dmr.`col_no` AS colNo,dmr.`type` AS `type`,
|
||||||
CONCAT(dmr.`quantity`,IF(dmr.`type`=32,""(空瓶)"","""")) AS quantity,dmr.`manu_no` AS manuNo,
|
CONCAT(dmr.`quantity`,IF(dmr.`type`=32,""(空瓶)"","""")) AS quantity,dmr.`manu_no` AS manuNo,
|
||||||
dmr.`eff_date` AS effDate,dmr.`operation_time` AS operationTime,di.`drug_name` AS drugName,
|
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.`drug_spec` AS drugSpec,di.`pack_unit` AS packUnit,di.small_unit as smallUnit,
|
||||||
di.`manufactory` AS manuFactory,di.`max_stock` AS baseQuantity,
|
di.`manufactory` AS manuFactory,di.`max_stock` AS baseQuantity,
|
||||||
dmr.`drug_id` AS drugId,ul.`user_name` AS nickname FROM dm_machine_record dmr
|
dmr.`drug_id` AS drugId,ul.`user_name` AS nickname FROM dm_machine_record dmr
|
||||||
LEFT JOIN drug_info di ON di.`drug_id` = dmr.`drug_id` LEFT JOIN user_list ul ON ul.`id` = dmr.`Operator`
|
LEFT JOIN drug_info di ON di.`drug_id` = dmr.`drug_id` LEFT JOIN user_list ul ON ul.`id` = dmr.`Operator`
|
||||||
|
@ -186,7 +200,7 @@ namespace DM_Weight.Report
|
||||||
Report.LoadFromFile(new FileInfo(AppDomain.CurrentDomain.BaseDirectory) + "ReportTemp//" + "machine_log_check.grf");
|
Report.LoadFromFile(new FileInfo(AppDomain.CurrentDomain.BaseDirectory) + "ReportTemp//" + "machine_log_check.grf");
|
||||||
SQL = $@" SELECT dmr.`drawer_no` AS drawerNo,dmr.`col_no` AS colNo,dmr.`type` AS `type`,dmr.`check_quantity` AS quantity,
|
SQL = $@" SELECT dmr.`drawer_no` AS drawerNo,dmr.`col_no` AS colNo,dmr.`type` AS `type`,dmr.`check_quantity` AS quantity,
|
||||||
dmr.`manu_no` AS manuNo,dmr.`eff_date` AS effDate,dmr.`operation_time` AS operationTime,
|
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.`drug_name` AS drugName,di.`drug_spec` AS drugSpec,di.`pack_unit` AS packUnit,di.small_unit as smallUnit,
|
||||||
di.`manufactory` AS manuFactory,di.`max_stock` AS baseQuantity,dmr.`drug_id` AS drugId,
|
di.`manufactory` AS manuFactory,di.`max_stock` AS baseQuantity,dmr.`drug_id` AS drugId,
|
||||||
ul.`user_name` AS nickname,u2.`user_name` as reviewer FROM dm_machine_record dmr
|
ul.`user_name` AS nickname,u2.`user_name` as reviewer FROM dm_machine_record dmr
|
||||||
LEFT JOIN drug_info di ON di.`drug_id` = dmr.`drug_id`
|
LEFT JOIN drug_info di ON di.`drug_id` = dmr.`drug_id`
|
||||||
|
@ -195,9 +209,9 @@ namespace DM_Weight.Report
|
||||||
AND dmr.`machine_id` = '{p_machine_id}' AND dmr.`operation_time` > '{p_startDate}'
|
AND dmr.`machine_id` = '{p_machine_id}' AND dmr.`operation_time` > '{p_startDate}'
|
||||||
AND dmr.`operation_time` < '{p_endDate}'";
|
AND dmr.`operation_time` < '{p_endDate}'";
|
||||||
}
|
}
|
||||||
|
|
||||||
Report.DetailGrid.Recordset.ConnectionString = gridConnectionString;
|
Report.DetailGrid.Recordset.ConnectionString = gridConnectionString;
|
||||||
Report.DetailGrid.Recordset.QuerySQL= SQL;
|
Report.DetailGrid.Recordset.QuerySQL = SQL;
|
||||||
|
|
||||||
Report.PrintPreview(true);
|
Report.PrintPreview(true);
|
||||||
}
|
}
|
||||||
|
@ -215,13 +229,13 @@ namespace DM_Weight.Report
|
||||||
GridppReport Report = new GridppReport();
|
GridppReport Report = new GridppReport();
|
||||||
// 加载模板文件
|
// 加载模板文件
|
||||||
Report.LoadFromFile(new FileInfo(AppDomain.CurrentDomain.BaseDirectory) + "ReportTemp//machine_log.grf");
|
Report.LoadFromFile(new FileInfo(AppDomain.CurrentDomain.BaseDirectory) + "ReportTemp//machine_log.grf");
|
||||||
|
|
||||||
// 加载数据
|
// 加载数据
|
||||||
Report.ParameterByName("type").AsInteger = 1;
|
Report.ParameterByName("type").AsInteger = 1;
|
||||||
Report.PrintPreview(true);
|
Report.PrintPreview(true);
|
||||||
}
|
}
|
||||||
//交接班记录报表
|
//交接班记录报表
|
||||||
public static void PrintChangeShiftsReport(DateTime? startDate,DateTime? endDate)
|
public static void PrintChangeShiftsReport(DateTime? startDate, DateTime? endDate)
|
||||||
{
|
{
|
||||||
DateTime? p_startDate = startDate ?? Convert.ToDateTime("2010-1-1");
|
DateTime? p_startDate = startDate ?? Convert.ToDateTime("2010-1-1");
|
||||||
DateTime? p_endDate = endDate ?? DateTime.Now.AddDays(1);
|
DateTime? p_endDate = endDate ?? DateTime.Now.AddDays(1);
|
||||||
|
@ -229,7 +243,8 @@ namespace DM_Weight.Report
|
||||||
// 定义Grid++Report报表主对象
|
// 定义Grid++Report报表主对象
|
||||||
GridppReport Report = new GridppReport();
|
GridppReport Report = new GridppReport();
|
||||||
// 加载模板文件
|
// 加载模板文件
|
||||||
Report.LoadFromFile(new FileInfo(AppDomain.CurrentDomain.BaseDirectory) + "ReportTemp//" + "changeShifts_temp.grf");
|
//Report.LoadFromFile(new FileInfo(AppDomain.CurrentDomain.BaseDirectory) + "ReportTemp//" + "changeShifts_temp.grf");
|
||||||
|
Report.LoadFromFile(new FileInfo(AppDomain.CurrentDomain.BaseDirectory) + "ReportTemp//" + "changeShifts_temp_new.grf");
|
||||||
string SQL = string.Empty;
|
string SQL = string.Empty;
|
||||||
Report.DetailGrid.Recordset.ConnectionString = gridConnectionString;
|
Report.DetailGrid.Recordset.ConnectionString = gridConnectionString;
|
||||||
Report.Initialize += new _IGridppReportEvents_InitializeEventHandler(() =>
|
Report.Initialize += new _IGridppReportEvents_InitializeEventHandler(() =>
|
||||||
|
@ -239,7 +254,7 @@ namespace DM_Weight.Report
|
||||||
Report.ParameterByName("endDate").Value = endDate ?? DateTime.Now.AddDays(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,
|
SQL = $@"SELECT opt_date,drug_name,drug_spec,beforenum,getnum,usenum,manu_no,surplus,CONCAT(fromoperator,' ',fromreviewer) as fromoperator,
|
||||||
CONCAT(tooperator,' ',toreviewer) as tooperator
|
CONCAT(tooperator,' ',toreviewer) as tooperator,pack_unit,stockQuantity,emptyQuantity
|
||||||
from `hkc_shiftsreport` WHERE `machineid` = '{p_machine_id}' AND `opt_date` > '{p_startDate}'
|
from `hkc_shiftsreport` WHERE `machineid` = '{p_machine_id}' AND `opt_date` > '{p_startDate}'
|
||||||
AND opt_date < '{p_endDate}' ORDER BY opt_date";
|
AND opt_date < '{p_endDate}' ORDER BY opt_date";
|
||||||
Report.DetailGrid.Recordset.QuerySQL = SQL;
|
Report.DetailGrid.Recordset.QuerySQL = SQL;
|
||||||
|
@ -258,12 +273,407 @@ namespace DM_Weight.Report
|
||||||
GridppReport Report = new GridppReport();
|
GridppReport Report = new GridppReport();
|
||||||
// 加载模板文件
|
// 加载模板文件
|
||||||
Report.LoadFromFile(new FileInfo(AppDomain.CurrentDomain.BaseDirectory) + "ReportTemp//machine_log_check.grf");
|
Report.LoadFromFile(new FileInfo(AppDomain.CurrentDomain.BaseDirectory) + "ReportTemp//machine_log_check.grf");
|
||||||
Dictionary<string,List<MachineRecord>> records = new Dictionary<string,List<MachineRecord>>();
|
Dictionary<string, List<MachineRecord>> records = new Dictionary<string, List<MachineRecord>>();
|
||||||
records.Add("table", data);
|
records.Add("table", data);
|
||||||
string str= JsonConvert.SerializeObject(records);
|
string str = JsonConvert.SerializeObject(records);
|
||||||
Report.LoadDataFromXML(str);
|
Report.LoadDataFromXML(str);
|
||||||
// 加载数据
|
// 加载数据
|
||||||
Report.PrintPreview(true);
|
Report.PrintPreview(true);
|
||||||
}
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 导出处方登记专册
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="orderNo"></param>
|
||||||
|
/// <param name="startDate"></param>
|
||||||
|
/// <param name="endDate"></param>
|
||||||
|
public static void PrintReportOrderAccount(string orderNo, DateTime? startDate, DateTime? endDate)
|
||||||
|
{
|
||||||
|
// 定义Grid++Report报表主对象
|
||||||
|
GridppReport Report = new GridppReport();
|
||||||
|
DateTime? p_startDate = startDate ?? Convert.ToDateTime("2010-1-1");
|
||||||
|
DateTime? p_endDate = endDate ?? DateTime.Now.AddDays(1);
|
||||||
|
string p_machine_id = (ConfigurationManager.AppSettings["machineId"] ?? "DM1");
|
||||||
|
string SQL = string.Empty;
|
||||||
|
Report.Initialize += new _IGridppReportEvents_InitializeEventHandler(() =>
|
||||||
|
{
|
||||||
|
Report.ParameterByName("machine_id").Value = (ConfigurationManager.AppSettings["machineId"] ?? "DM1");
|
||||||
|
Report.ParameterByName("startDate").Value = startDate ?? DateTime.Now.AddYears(-10);
|
||||||
|
Report.ParameterByName("endDate").Value = endDate ?? DateTime.Now.AddDays(1);
|
||||||
|
});
|
||||||
|
Report.LoadFromFile(new FileInfo(AppDomain.CurrentDomain.BaseDirectory) + "ReportTemp//account_book_order.grf");
|
||||||
|
|
||||||
|
SQL = $@"SELECT DISTINCT oi.recv_date,oi.p_name,oi.sex,oi.age,oi.id_number,oi.patient_no,oi.patient_id,oi.disease,dm.manu_no,dm.Quantity,oi.doctor_name,oi.order_no,dm.reviewer,dm.operator,ul.user_name operatorName,ul2.user_name reviewerName
|
||||||
|
,di.Drug_name,di.Drug_spec,di.big_unit,di.small_unit as smallUnit,di.drug_id,di.manuFactory,dm.receivePerson,dm.ordinalNum as ordinalNum,CONCAT(DATE_FORMAT(operation_time,'%Y%m%d'),ordinalnum) as OrderOrdinal
|
||||||
|
from order_info oi inner join order_detail od on oi.order_no=od.Order_No
|
||||||
|
LEFT JOIN dm_machine_record dm on oi.order_no=dm.invoice_id AND od.`drug_id`=dm.`drug_id`
|
||||||
|
inner JOIN drug_info di on od.drug_id=di.drug_id left join user_list ul on dm.operator=ul.id
|
||||||
|
left join user_list ul2 on dm.reviewer=ul2.id
|
||||||
|
WHERE dm.machine_id = '{p_machine_id}' and oi.recv_date>'{p_startDate}' and oi.recv_date<'{p_endDate}' and dm.type=2 ";
|
||||||
|
if (!string.IsNullOrEmpty(orderNo))
|
||||||
|
{
|
||||||
|
SQL += $" and oi.order_no='{orderNo}'";
|
||||||
|
}
|
||||||
|
SQL += " order by di.drug_id,oi.recv_date,dm.ordinalNum";
|
||||||
|
|
||||||
|
Report.DetailGrid.Recordset.ConnectionString = gridConnectionString;
|
||||||
|
Report.DetailGrid.Recordset.QuerySQL = SQL;
|
||||||
|
|
||||||
|
Report.PrintPreview(true);
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 导出回收登记记录
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="orderNo"></param>
|
||||||
|
/// <param name="startDate"></param>
|
||||||
|
/// <param name="endDate"></param>
|
||||||
|
public static void PrintReportReturnEmpty(DateTime? startDate, DateTime? endDate)
|
||||||
|
{
|
||||||
|
// 定义Grid++Report报表主对象
|
||||||
|
GridppReport Report = new GridppReport();
|
||||||
|
DateTime? p_startDate = startDate ?? Convert.ToDateTime("2010-1-1");
|
||||||
|
DateTime? p_endDate = endDate ?? DateTime.Now.AddDays(1);
|
||||||
|
string p_machine_id = (ConfigurationManager.AppSettings["machineId"] ?? "DM1");
|
||||||
|
string SQL = string.Empty;
|
||||||
|
Report.Initialize += new _IGridppReportEvents_InitializeEventHandler(() =>
|
||||||
|
{
|
||||||
|
Report.ParameterByName("machine_id").Value = (ConfigurationManager.AppSettings["machineId"] ?? "DM1");
|
||||||
|
Report.ParameterByName("startDate").Value = startDate ?? DateTime.Now.AddYears(-10);
|
||||||
|
Report.ParameterByName("endDate").Value = endDate ?? DateTime.Now.AddDays(1);
|
||||||
|
});
|
||||||
|
Report.LoadFromFile(new FileInfo(AppDomain.CurrentDomain.BaseDirectory) + "ReportTemp//return_empty.grf");
|
||||||
|
|
||||||
|
SQL = $@"SELECT di.drug_id, YEAR(dm.operation_time) as dmYear,oi.P_name,oi.dept_name,dm.operation_time,dm.Quantity,dm.manu_no,dm.returnPerson,dm.receivePerson,di.drug_name,di.Drug_spec,di.big_unit,di.small_unit as smallUnit,di.manufactory from order_info oi
|
||||||
|
inner join dm_machine_record dm on oi.order_no=dm.invoice_id
|
||||||
|
inner join drug_info di on dm.drug_id=di.drug_id
|
||||||
|
where dm.type=32 and dm.machine_id = '{p_machine_id}' and dm.operation_time>'{p_startDate}' and dm.operation_time<'{p_endDate}'";
|
||||||
|
|
||||||
|
SQL += " order by di.drug_id,dm.operation_time";
|
||||||
|
|
||||||
|
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="drug_id"></param>
|
||||||
|
public static void PrintReportSpecialAccount(DateTime endDate, string drug_id)
|
||||||
|
{
|
||||||
|
//DateTime? p_startDate = startDate ?? Convert.ToDateTime("2010-1-1");
|
||||||
|
//DateTime? p_endDate = endDate ?? DateTime.Now.AddDays(1);
|
||||||
|
string strDate = endDate.ToString("yyyy-MM");
|
||||||
|
string p_machine_id = (ConfigurationManager.AppSettings["machineId"] ?? "DM1");
|
||||||
|
// 定义Grid++Report报表主对象
|
||||||
|
GridppReport Report = new GridppReport();
|
||||||
|
string SQL = string.Empty;
|
||||||
|
string machine_id = (ConfigurationManager.AppSettings["machineId"] ?? "DM1");
|
||||||
|
// SQL = $@"SELECT mr.drug_id as drugId,'test' InTotal,YEAR(mr.`operation_time`) as DMYear,MONTH(mr.`operation_time`) as DMMonth,
|
||||||
|
// DAY(mr.`operation_time`) as DMDay,manu_no as manuNo,operation_time as operationTime,return_quantity1 as inQuantity,return_quantity2 as outQuantity,
|
||||||
|
// manunoQuantity as stockQuantity,u1.user_name as operatorName,u2.user_name as reviewerName,di.`drug_name` AS `drugName`,
|
||||||
|
// di.`drug_spec` AS `drugSpec`, di.`pack_unit` AS `packUnit`,di.big_unit as bigUnit, di.`dosage` AS `dosage`, di.`manufactory` AS `manufactory`
|
||||||
|
//FROM dm_machine_record mr INNER JOIN DRUG_INFO di ON mr.drug_id=di.drug_id LEFT JOIN user_list u1 ON mr.`operator` = u1.`id`LEFT JOIN user_list u2 ON mr.`reviewer` = u2.`id`
|
||||||
|
//WHERE mr.`machine_id` = '{machine_id}' and type=5 and DATE_FORMAT(operation_time,'%Y-%m')='{strDate}' ORDER BY mr.drug_id,operation_time";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// SQL = $@" SELECT drugId,DMYear,DMMonth,DMDay,manuNo,operationTime,sum(inQuantity) as inQuantity,SUM(outQuantity) as outQuantity,stockQuantity,operatorName,reviewerName,drugName,drugSpec,packUnit,bigUnit,dosage,manufactory
|
||||||
|
//FROM (
|
||||||
|
|
||||||
|
//SELECT mr.drug_id as drugId,'test' InTotal,YEAR(mr.`operation_time`) as DMYear,MONTH(mr.`operation_time`) as DMMonth,
|
||||||
|
// DAY(mr.`operation_time`) as DMDay,manu_no as manuNo,operation_time as operationTime,-- return_quantity1 as inQuantity,return_quantity2 as outQuantity,
|
||||||
|
// IF(mr.`type` IN (1, 31), mr.`quantity`, IF(mr.`type` = 4 AND mr.`quantity` > 0, mr.`quantity`, 0))
|
||||||
|
// AS `inQuantity`, IF(mr.`type` = 2, mr.`quantity`, IF(mr.`type` = 4 AND mr.`quantity` < 0, (0 - mr.`quantity`), 0)) AS `outQuantity`,
|
||||||
|
// manunoQuantity as stockQuantity,u1.user_name as operatorName,u2.user_name as reviewerName,di.`drug_name` AS `drugName`,
|
||||||
|
// di.`drug_spec` AS `drugSpec`, di.`pack_unit` AS `packUnit`,di.big_unit as bigUnit, di.`dosage` AS `dosage`, di.`manufactory` AS `manufactory`
|
||||||
|
// FROM dm_machine_record mr INNER JOIN DRUG_INFO di ON mr.drug_id=di.drug_id LEFT JOIN user_list u1 ON mr.`operator` = u1.`id`LEFT JOIN user_list u2 ON mr.`reviewer` = u2.`id`
|
||||||
|
// WHERE mr.`machine_id` = '{machine_id}' and type in(1,2,31,4,5) and DATE_FORMAT(operation_time,'%Y-%m')='{strDate}'and IF(mr.`type` = 4 AND mr.`quantity` = 0, 99999, mr.`quantity`) <>99999 ORDER BY mr.drug_id,operation_time
|
||||||
|
//) t GROUP BY drugId,DMYear,DMMonth,DMDay,manuNo";
|
||||||
|
|
||||||
|
SQL = $@"SELECT t.drugId,t.DMYear,t.DMMonth,t.DMDay,t.manuNo,t.operationTime,t.inQuantity as inQuantity,t.outQuantity AS outQuantity,dmr.manunoQuantity AS stockQuantity,t.operatorName,t.reviewerName,
|
||||||
|
t.drugName,t.drugSpec,t.packUnit,t.bigUnit,t.smallUnit,t.dosage,t.manufactory from dm_machine_record dmr inner join
|
||||||
|
(SELECT max(mr.id) id, mr.drug_id as drugId,'test' InTotal,YEAR(mr.`operation_time`) as DMYear,MONTH(mr.`operation_time`) as DMMonth,
|
||||||
|
DAY(mr.`operation_time`) as DMDay,manu_no as manuNo,operation_time as operationTime,
|
||||||
|
SUM(IF(mr.`type` IN (1, 31), mr.`quantity`, IF(mr.`type` = 4 AND mr.`quantity` > 0, mr.`quantity`, 0)) ) AS `inQuantity`,
|
||||||
|
SUM(IF(mr.`type` = 2, mr.`quantity`, IF(mr.`type` = 4 AND mr.`quantity` < 0, (0 - mr.`quantity`), 0))) AS `outQuantity`,
|
||||||
|
manunoQuantity as stockQuantity,u1.user_name as operatorName,u2.user_name as reviewerName,di.`drug_name` AS `drugName`,
|
||||||
|
di.`drug_spec` AS `drugSpec`, di.`pack_unit` AS `packUnit`,di.big_unit as bigUnit,di.small_unit as smallUnit, di.`dosage` AS `dosage`, di.`manufactory` AS `manufactory`
|
||||||
|
FROM dm_machine_record mr INNER JOIN DRUG_INFO di ON mr.drug_id=di.drug_id LEFT JOIN user_list u1 ON mr.`operator` = u1.`id`LEFT JOIN user_list u2 ON mr.`reviewer` = u2.`id`
|
||||||
|
WHERE mr.`machine_id` = '{machine_id}' and type in(1,2,31,4,5) and mr.manu_no is not NULL and DATE_FORMAT(operation_time,'%Y-%m')='{strDate}'and IF(mr.`type` = 4 AND mr.`quantity` = 0, 99999, mr.`quantity`) <>99999
|
||||||
|
GROUP BY drugId,DMYear,DMMonth,DMDay,manuNo ORDER BY mr.drug_id,operation_time) t on dmr.id=t.id";
|
||||||
|
|
||||||
|
List<Dictionary<string, object>> tableList = SqlSugarHelper.Db.SqlQueryable<dynamic>(SQL).ToDictionaryList();
|
||||||
|
for (int i = 0; i < tableList.Count; i++)
|
||||||
|
{
|
||||||
|
LastMonthModel InTotalModel = new LastMonthModel();
|
||||||
|
LastMonthModel OutTotalModel = new LastMonthModel();
|
||||||
|
LastMonthModel StackTotalModel = new LastMonthModel();
|
||||||
|
foreach (KeyValuePair<string, object> kvp in tableList[i])
|
||||||
|
{
|
||||||
|
if (kvp.Key == "drugId")
|
||||||
|
{
|
||||||
|
//查询药品id对应的上月结存数量及批号
|
||||||
|
string strValue = kvp.Value.ToString();
|
||||||
|
string inQuantitySQL = $@"SELECT GROUP_CONCAT(SumInQuantity) as StrTotalQuantity,GROUP_CONCAT(manu_no) as StrTotalManuNo from
|
||||||
|
(SELECT sum(IF(mr.`type` IN (1, 31), mr.`quantity`, IF(mr.`type` = 4 AND mr.`quantity` > 0, mr.`quantity`, 0))) as SumInQuantity,manu_no
|
||||||
|
from dm_machine_record mr where drug_id='{strValue}' and machine_id='{machine_id}' and type in(1,2,31,4,5) and mr.manu_no is not NULL
|
||||||
|
and DATE_FORMAT(operation_time,'%Y-%m')='{strDate}'and IF(mr.`type` = 4 AND mr.`quantity` = 0, 99999, mr.`quantity`) <>99999 GROUP BY drug_id,manu_no ORDER BY drug_id,operation_time) as t";
|
||||||
|
InTotalModel = SqlSugarHelper.Db.SqlQueryable<LastMonthModel>(inQuantitySQL).First();
|
||||||
|
|
||||||
|
string outQuantitySQL = $@"SELECT GROUP_CONCAT(SumInQuantity) as StrTotalQuantity,GROUP_CONCAT(manu_no) as StrTotalManuNo from
|
||||||
|
(SELECT sum(IF(mr.`type` = 2, mr.`quantity`, IF(mr.`type` = 4 AND mr.`quantity` < 0, (0 - mr.`quantity`), 0))) as SumInQuantity ,manu_no
|
||||||
|
from dm_machine_record mr where drug_id='{strValue}' and machine_id='{machine_id}' and type in(1,2,31,4,5) and mr.manu_no is not NULL
|
||||||
|
and DATE_FORMAT(operation_time,'%Y-%m')='{strDate}' and IF(mr.`type` = 4 AND mr.`quantity` = 0, 99999, mr.`quantity`) <>99999 GROUP BY drug_id,manu_no ORDER BY drug_id,operation_time) as t";
|
||||||
|
OutTotalModel = SqlSugarHelper.Db.SqlQueryable<LastMonthModel>(outQuantitySQL).First();
|
||||||
|
|
||||||
|
string stockQuantitySQL = $@"SELECT GROUP_CONCAT(a.Manu_No) as StrTotalManuNo,GROUP_CONCAT(a.manunoQuantity) as StrTotalQuantity from dm_machine_record a inner join
|
||||||
|
(select drug_id,manu_no,max(operation_time) as latest_date,stock_quantity from dm_machine_record
|
||||||
|
WHERE DATE_FORMAT(operation_time,'%Y-%m')='{strDate}' and machine_id='{machine_id}'and manu_no is not NULL GROUP BY drug_id,manu_no ) b on a.drug_id=b.drug_id and a.manu_no=b.manu_no
|
||||||
|
and a.operation_time=b.latest_date and machine_id='{machine_id}' WHERE a.drug_id='{strValue}' and DATE_FORMAT(operation_time,'%Y-%m')='{strDate}'";
|
||||||
|
StackTotalModel = SqlSugarHelper.Db.SqlQueryable<LastMonthModel>(stockQuantitySQL).First();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
tableList[i].Add("inTotal", InTotalModel.StrTotalQuantity);
|
||||||
|
tableList[i].Add("inTotalManuNo", InTotalModel.StrTotalManuNo);
|
||||||
|
tableList[i].Add("outTotal", OutTotalModel.StrTotalQuantity);
|
||||||
|
tableList[i].Add("outTotalManuNo", OutTotalModel.StrTotalManuNo);
|
||||||
|
tableList[i].Add("stockTotal", StackTotalModel.StrTotalQuantity);
|
||||||
|
tableList[i].Add("stockTotalManuNO", StackTotalModel.StrTotalManuNo);
|
||||||
|
}
|
||||||
|
Dictionary<string, List<Dictionary<string, object>>> records = new Dictionary<string, List<Dictionary<string, object>>>();
|
||||||
|
records.Add("table", tableList);
|
||||||
|
string str = JsonConvert.SerializeObject(records);
|
||||||
|
// 加载模板文件
|
||||||
|
Report.LoadFromFile(new FileInfo(AppDomain.CurrentDomain.BaseDirectory) + "ReportTemp//" + "account_book_temp-01.grf");
|
||||||
|
Report.LoadDataFromXML(str);
|
||||||
|
Report.PrintPreview(true);
|
||||||
|
}
|
||||||
|
static GridppReport rptMain = new GridppReport();
|
||||||
|
static GridppReport rptCustomerList = new GridppReport();
|
||||||
|
/// <summary>
|
||||||
|
/// 逐日消耗专用账册2
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="startDate"></param>
|
||||||
|
/// <param name="endDate"></param>
|
||||||
|
/// <param name="drug_id"></param>
|
||||||
|
public static void PrintReportSpecialAccount2(DateTime endDate, string drug_id)
|
||||||
|
{
|
||||||
|
//InsertSubReport("ReportTemp//account_book_temp-022.grf", "2d");
|
||||||
|
|
||||||
|
//用推模式给子报表提供数据:为子报表定义一个外部的报表对象,以便处理其报表事件
|
||||||
|
//用推模式给子报表提供数据:
|
||||||
|
//rptMain.ControlByName("2d").AsSubReport.Report = rptCustomerList; //子报表部件框的报表对象关联一个外部报表对象,以便响应报表事件
|
||||||
|
////rptCustomerList.DetailGrid.Recordset.ConnectionString = gridConnectionString; //让子报表 rptProductList 用推模式填入报表数据,将程序中取得的数据填入到报表中
|
||||||
|
//rptCustomerList.FetchRecord += new _IGridppReportEvents_FetchRecordEventHandler(CustomerListFetchRecord); //连接报表事件
|
||||||
|
//rptMain.PrintPreview(true);
|
||||||
|
|
||||||
|
GridppReport Report = new GridppReport();
|
||||||
|
string machine_id = (ConfigurationManager.AppSettings["machineId"] ?? "DM1");
|
||||||
|
string strDate = endDate.ToString("yyyy-MM");
|
||||||
|
|
||||||
|
string masterSql = $@" SELECT DISTINCT di.`drug_id` AS `drugId`, YEAR(mr.`operation_time`) as DMYear,MONTH(mr.`operation_time`) as DMMonth, di.`drug_name` AS `drugName`, di.`drug_spec` AS `drugSpec`,
|
||||||
|
di.big_unit as bigUnit,di.small_unit as smallUnit, di.`dosage` AS `dosage`, di.`manufactory` AS `manufactory`, '' lastMonthStock,'' lastMonthMauno,
|
||||||
|
mr.`manu_no` AS `manuNo`from dm_machine_record mr inner join drug_info di on mr.drug_id=di.drug_id where machine_id='{machine_id}' and type in(1,2,31,4) and DATE_FORMAT(mr.operation_time,'%Y-%m')='{strDate}'
|
||||||
|
ORDER BY mr.drug_id";
|
||||||
|
List<Dictionary<string, object>> masterList = SqlSugarHelper.Db.SqlQueryable<dynamic>(masterSql).ToDictionaryList();
|
||||||
|
|
||||||
|
string detail1Sql = $@" SELECT di.drug_id as drugId,DAY(mr.operation_time) AS DMDAY,mr.TYPE,
|
||||||
|
IF(mr.`type` IN (1, 31), mr.`quantity`, IF(mr.`type` = 4 AND mr.`quantity` > 0, mr.`quantity`, 0)) AS `inQuantity`,
|
||||||
|
mr.manu_no as manuNo,ul.user_name as operatorname,u2.user_name as reviewername from dm_machine_record mr
|
||||||
|
inner join drug_info di on mr.drug_id=di.drug_id left join user_list ul on mr.operator=ul.id left join user_list u2 on mr.reviewer=u2.id
|
||||||
|
where mr.machine_id='{machine_id}' and type in (1,31,4) and DATE_FORMAT(mr.operation_time,'%Y-%m')='{strDate}'
|
||||||
|
and if(mr.Type=4 and mr.Quantity=0,99999, mr.`quantity`) <>99999 ORDER BY mr.drug_id";
|
||||||
|
List<Dictionary<string, object>> detail1List = SqlSugarHelper.Db.SqlQueryable<dynamic>(detail1Sql).ToDictionaryList();
|
||||||
|
|
||||||
|
string detail2Sql = $@"SELECT
|
||||||
|
di.`drug_id` AS `drugId`,DAY(mr.`operation_time`) as DMDay,
|
||||||
|
mr.type, mr.`stock_quantity` AS `stockQuantity`,
|
||||||
|
-- IF(mr.`type` IN (1, 31), mr.`quantity`, IF(mr.`type` = 4 AND mr.`quantity` > 0, mr.`quantity`, 0)) AS `inQuantity`,
|
||||||
|
IF(mr.`type` = 2, mr.`quantity`, IF(mr.`type` = 4 AND mr.`quantity` < 0, (0 - mr.`quantity`), 0)) AS `outQuantity`,
|
||||||
|
mr.`operation_time` AS `operationTime`,-- IF(mr.`type`=1,mr.`invoice_id`,NULL) AS `invoiceId`,
|
||||||
|
mr.`manu_no` AS `manuNo`,-- mr.`eff_date` AS `effDate`,
|
||||||
|
u1.`user_name` AS `operatorName`, u2.`user_name` AS `reviewerName` -- ,mr.supplierDept,mr.receiveDept
|
||||||
|
-- sum(InQuantity) as TotalInQuantity
|
||||||
|
FROM
|
||||||
|
dm_machine_record mr INNER JOIN drug_info di ON mr.`drug_id` = di.`drug_id` LEFT JOIN user_list u1 ON mr.`operator` = u1.`id`
|
||||||
|
LEFT JOIN user_list u2 ON mr.`reviewer` = u2.`id` WHERE mr.`machine_id` = '{machine_id}' AND type in(2,4)
|
||||||
|
AND DATE_FORMAT(mr.operation_time,'%Y-%m')= '{strDate}' and IF(mr.`type` = 4 AND mr.`quantity` = 0, 99999, mr.`quantity`) <>99999 ORDER BY mr.drug_id ";
|
||||||
|
|
||||||
|
List<Dictionary<string, object>> detail2List = SqlSugarHelper.Db.SqlQueryable<dynamic>(detail2Sql).ToDictionaryList();
|
||||||
|
|
||||||
|
Dictionary<string, List<Dictionary<string, object>>> records = new Dictionary<string, List<Dictionary<string, object>>>();
|
||||||
|
records.Add("Master", masterList);
|
||||||
|
records.Add("Detail1", detail1List);
|
||||||
|
records.Add("Detail2", detail2List);
|
||||||
|
|
||||||
|
string str = JsonConvert.SerializeObject(records);
|
||||||
|
Report.LoadFromFile(new FileInfo(AppDomain.CurrentDomain.BaseDirectory) + "ReportTemp//" + "account_book_temp-022.grf");
|
||||||
|
Report.LoadDataFromXML(str);
|
||||||
|
// 加载数据
|
||||||
|
Report.PrintPreview(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void PrintReportSpecialAccount2New(DateTime MonthDate, string drug_id)
|
||||||
|
{
|
||||||
|
GridppReport Report = new GridppReport();
|
||||||
|
string machine_id = (ConfigurationManager.AppSettings["machineId"] ?? "DM1");
|
||||||
|
string strDate = MonthDate.ToString("yyyy-MM");
|
||||||
|
int DMYear = MonthDate.Year;
|
||||||
|
int DMMonth = MonthDate.Month;
|
||||||
|
string masterSql = $@"SELECT distinct di.drug_id as drugId,di.drug_name as drugName,di.drug_spec as drugSpec,di.big_unit as bigUnit,di.small_unit as smallUnit,di.manufactory as manufactory,{DMYear} DMYear,{DMMonth} DMMonth from channel_stock cs
|
||||||
|
inner join drug_info di on cs.drug_id=di.drug_id where machine_id='{machine_id}' ORDER BY di.drug_id ";
|
||||||
|
List<Dictionary<string, object>> masterList = SqlSugarHelper.Db.SqlQueryable<dynamic>(masterSql).ToDictionaryList();
|
||||||
|
|
||||||
|
|
||||||
|
for (int i = 0; i < masterList.Count; i++)
|
||||||
|
{
|
||||||
|
LastMonthModel lastMonth = new LastMonthModel();
|
||||||
|
foreach (KeyValuePair<string, object> kvp in masterList[i])
|
||||||
|
{
|
||||||
|
if (kvp.Key == "drugId")
|
||||||
|
{
|
||||||
|
//查询药品id对应的上月结存数量及批号
|
||||||
|
string strValue = kvp.Value.ToString();
|
||||||
|
string lastMonthSql = $@"SELECT GROUP_CONCAT(manu_no) as StrTotalManuNo,GROUP_CONCAT(manunoQuantity) as StrTotalQuantity
|
||||||
|
from dm_machine_record where drug_id='{strValue}' and machine_id='{machine_id}' and DATE_FORMAT(operation_time,'%Y-%m-%d')=LAST_DAY(DATE_SUB('{MonthDate}', INTERVAL 1 MONTH)) and type=5";
|
||||||
|
lastMonth = SqlSugarHelper.Db.SqlQueryable<LastMonthModel>(lastMonthSql).First();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
masterList[i].Add("lastMonthStock", lastMonth.StrTotalManuNo);
|
||||||
|
masterList[i].Add("lastMonthMauno", lastMonth.StrTotalQuantity);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
string detailSql = $@"SELECT drug_id as drugId,DAY(mr.`operation_time`) as DMDay,manu_no as manuNo,operation_time as operationTime,return_quantity1 as inQuantity,return_quantity2 as outQuantity,
|
||||||
|
manunoQuantity as stockQuantity,u1.user_name as operatorName,u2.user_name as reviewerName
|
||||||
|
FROM dm_machine_record mr LEFT JOIN user_list u1 ON mr.`operator` = u1.`id`LEFT JOIN user_list u2 ON mr.`reviewer` = u2.`id`
|
||||||
|
WHERE mr.`machine_id` = '{machine_id}' and type=5 and DATE_FORMAT(operation_time,'%Y-%m')='{strDate}' ORDER BY drug_id,operation_time";
|
||||||
|
|
||||||
|
List<Dictionary<string, object>> detailMaster0List = SqlSugarHelper.Db.SqlQueryable<dynamic>(detailSql).ToDictionaryList();
|
||||||
|
List<Dictionary<string, object>> detailMaster1List = SqlSugarHelper.Db.SqlQueryable<dynamic>(detailSql).ToDictionaryList();
|
||||||
|
|
||||||
|
//List<Dictionary<string, object>> detail1List = detailList.Where(it => Convert.ToInt32(it.GetValueOrDefault("inQuantity")) > 0 && Convert.ToInt32(it.GetValueOrDefault("outQuantity")) <= 0)
|
||||||
|
List<Dictionary<string, object>> detail1List = detailMaster0List.Where(it => Convert.ToInt32(it.GetValueOrDefault("inQuantity")) > 0)
|
||||||
|
.Select(it =>
|
||||||
|
{
|
||||||
|
it.Remove("outQuantity");
|
||||||
|
it.Remove("stockQuantity");
|
||||||
|
return it;
|
||||||
|
})
|
||||||
|
.ToList();
|
||||||
|
//List<Dictionary<string, object>> detail2List = detailList.Where(it => Convert.ToInt32(it.GetValueOrDefault("outQuantity")) >0||!(Convert.ToInt32(it.GetValueOrDefault("inQuantity")) >0 && Convert.ToInt32(it.GetValueOrDefault("outQuantity")) == 0))
|
||||||
|
List<Dictionary<string, object>> detail2List = detailMaster1List
|
||||||
|
.Select(it =>
|
||||||
|
{
|
||||||
|
it.Remove("inQuantity");
|
||||||
|
return it;
|
||||||
|
}).ToList();
|
||||||
|
Dictionary<string, List<Dictionary<string, object>>> records = new Dictionary<string, List<Dictionary<string, object>>>();
|
||||||
|
records.Add("Master", masterList);
|
||||||
|
records.Add("Detail1", detail1List);
|
||||||
|
records.Add("Detail2", detail2List);
|
||||||
|
string str = JsonConvert.SerializeObject(records);
|
||||||
|
Report.LoadFromFile(new FileInfo(AppDomain.CurrentDomain.BaseDirectory) + "ReportTemp//" + "account_book_temp-022.grf");
|
||||||
|
Report.LoadDataFromXML(str);
|
||||||
|
// 加载数据
|
||||||
|
Report.PrintPreview(true);
|
||||||
|
|
||||||
|
}
|
||||||
|
public static void test(DateTime endDate, string drug_id)
|
||||||
|
{
|
||||||
|
//DateTime? p_startDate = startDate ?? Convert.ToDateTime("2010-1-1");
|
||||||
|
//DateTime? p_endDate = endDate ?? DateTime.Now.AddDays(1);
|
||||||
|
string strDate = endDate.ToString("yyyy-MM");
|
||||||
|
string p_machine_id = (ConfigurationManager.AppSettings["machineId"] ?? "DM1");
|
||||||
|
// 定义Grid++Report报表主对象
|
||||||
|
GridppReport Report = new GridppReport();
|
||||||
|
// 加载模板文件
|
||||||
|
Report.LoadFromFile(new FileInfo(AppDomain.CurrentDomain.BaseDirectory) + "ReportTemp//" + "account_book_temp-02.grf");
|
||||||
|
string SQL = string.Empty;
|
||||||
|
string machine_id = (ConfigurationManager.AppSettings["machineId"] ?? "DM1");
|
||||||
|
string strINSql = $@"SELECT GROUP_CONCAT(Manu_No) AS StrTotalManuNo,GROUP_CONCAT(totalInQuantity) AS StrTotalQuantity FROM
|
||||||
|
(
|
||||||
|
SELECT
|
||||||
|
DISTINCT Manu_No ,sum(IF(mr.`type` IN (1, 31), mr.`quantity`, IF(mr.`type` = 4 AND mr.`quantity` > 0, mr.`quantity`, 0))) as totalInQuantity
|
||||||
|
from dm_machine_record mr
|
||||||
|
INNER JOIN drug_info di ON mr.`drug_id` = di.`drug_id` where mr.machine_id='{machine_id}'
|
||||||
|
and IF(mr.`type` IN (1, 31), mr.`quantity`, IF(mr.`type` = 4 AND mr.`quantity` > 0, mr.`quantity`, 0)) >0
|
||||||
|
and DATE_FORMAT(operation_time,'%Y-%m')= '{strDate}' and type in('1,31,4')
|
||||||
|
GROUP BY mr.drug_id,mr.manu_no
|
||||||
|
) as t";
|
||||||
|
AccountTotalQuantity InQuantityList = SqlSugarHelper.Db.SqlQueryable<dynamic>(strINSql)
|
||||||
|
.Select(it => new AccountTotalQuantity()).First();
|
||||||
|
|
||||||
|
string strOutSql = $@"SELECT GROUP_CONCAT(Manu_No) AS StrTotalManuNo,GROUP_CONCAT(TotalOutQuantity) AS StrTotalQuantity FROM
|
||||||
|
(
|
||||||
|
SELECT
|
||||||
|
DISTINCT Manu_No ,SUM(IF(mr.`type` = 2, mr.`quantity`, IF(mr.`type` = 4 AND mr.`quantity` < 0, (0 - mr.`quantity`), 0))) AS TotalOutQuantity
|
||||||
|
from dm_machine_record mr
|
||||||
|
INNER JOIN drug_info di ON mr.`drug_id` = di.`drug_id` where mr.machine_id='{machine_id}'
|
||||||
|
and IF(mr.`type` = 2, mr.`quantity`, IF(mr.`type` = 4 AND mr.`quantity` < 0, (0 - mr.`quantity`), 0)) >0
|
||||||
|
and DATE_FORMAT(operation_time,'%Y-%m')= '{strDate}' and type in('2,4')
|
||||||
|
GROUP BY mr.drug_id,mr.manu_no
|
||||||
|
) as t";
|
||||||
|
AccountTotalQuantity OutQuantityList = SqlSugarHelper.Db.SqlQueryable<dynamic>(strOutSql)
|
||||||
|
.Select(it => new AccountTotalQuantity()).First();
|
||||||
|
|
||||||
|
string strStockSql = $@"SELECT GROUP_CONCAT(Manu_No) AS StrTotalManuNo,GROUP_CONCAT(stock_quantity) AS StrTotalQuantity FROM
|
||||||
|
(SELECT a.Manu_No,a.stock_quantity from dm_machine_record a inner join
|
||||||
|
(select drug_id,manu_no,max(operation_time) as latest_date,stock_quantity from dm_machine_record
|
||||||
|
WHERE DATE_FORMAT(operation_time,'%Y-%m')='{strDate}' and machine_id='{machine_id}' GROUP BY drug_id,manu_no ) b on a.drug_id=b.drug_id and a.manu_no=b.manu_no
|
||||||
|
and a.operation_time=b.latest_date and machine_id='{machine_id}' WHERE DATE_FORMAT(operation_time,'%Y-%m')='{strDate}') as t ";
|
||||||
|
AccountTotalQuantity StockQuantityList = SqlSugarHelper.Db.SqlQueryable<dynamic>(strStockSql)
|
||||||
|
.Select(it => new AccountTotalQuantity()).First();
|
||||||
|
string str1 = "本月领药数量" + ":" + InQuantityList.StrTotalQuantity + " 批号:" + InQuantityList.StrTotalManuNo;
|
||||||
|
string str2 = "本月发药数量" + ":" + OutQuantityList.StrTotalQuantity + " 批号:" + OutQuantityList.StrTotalManuNo;
|
||||||
|
string str3 = "本月结存数量" + ":" + StockQuantityList.StrTotalQuantity + " 批号:" + StockQuantityList.StrTotalManuNo;
|
||||||
|
//Report.ControlByName("StaticBox24").AsStaticBox.Text = str1;
|
||||||
|
//Report.ControlByName("StaticBox26").AsStaticBox.Text = str2;
|
||||||
|
//Report.ControlByName("StaticBox28").AsStaticBox.Text = str3;
|
||||||
|
|
||||||
|
|
||||||
|
Report.DetailGrid.Recordset.ConnectionString = gridConnectionString;
|
||||||
|
//Report.Initialize += new _IGridppReportEvents_InitializeEventHandler(() =>
|
||||||
|
//{
|
||||||
|
// Report.ParameterByName("machine_id").Value = (ConfigurationManager.AppSettings["machineId"] ?? "DM1");
|
||||||
|
// Report.ParameterByName("startDate").Value = startDate ?? Convert.ToDateTime("2010-1-1");
|
||||||
|
// Report.ParameterByName("endDate").Value = endDate ?? DateTime.Now.AddDays(1);
|
||||||
|
//});
|
||||||
|
//Report.DetailGrid.Recordset.QuerySQL = SQL;
|
||||||
|
SQL = $@"SELECT
|
||||||
|
YEAR(mr.`operation_time`) as DMYear,MONTH(mr.`operation_time`) as DMMonth,DAY(mr.`operation_time`) as DMDay,
|
||||||
|
mr.type, mr.`stock_quantity` AS `stockQuantity`,
|
||||||
|
-- IF(mr.`type` IN (1, 31), mr.`quantity`, IF(mr.`type` = 4 AND mr.`quantity` > 0, mr.`quantity`, 0)) AS `inQuantity`,
|
||||||
|
IF(mr.`type` = 2, mr.`quantity`, IF(mr.`type` = 4 AND mr.`quantity` < 0, (0 - mr.`quantity`), 0)) AS `outQuantity`,
|
||||||
|
mr.`operation_time` AS `operationTime`,-- IF(mr.`type`=1,mr.`invoice_id`,NULL) AS `invoiceId`,
|
||||||
|
di.`drug_name` AS `drugName`, di.`drug_id` AS `drugId`,
|
||||||
|
di.`drug_spec` AS `drugSpec`, di.`pack_unit` AS `packUnit`,di.big_unit as bigUnit,di.small_unit as smallUnit, di.`dosage` AS `dosage`, di.`manufactory` AS `manufactory`,
|
||||||
|
mr.`manu_no` AS `manuNo`,-- mr.`eff_date` AS `effDate`,
|
||||||
|
u1.`user_name` AS `operatorName`, u2.`user_name` AS `reviewerName` -- ,mr.supplierDept,mr.receiveDept
|
||||||
|
-- sum(InQuantity) as TotalInQuantity
|
||||||
|
FROM
|
||||||
|
dm_machine_record mr INNER JOIN drug_info di ON mr.`drug_id` = di.`drug_id` LEFT JOIN user_list u1 ON mr.`operator` = u1.`id`
|
||||||
|
LEFT JOIN user_list u2 ON mr.`reviewer` = u2.`id` WHERE mr.`machine_id` = '{machine_id}' AND type in(2,4)
|
||||||
|
AND DATE_FORMAT(mr.operation_time,'%Y-%m')= '{strDate}' and IF(mr.`type` = 4 AND mr.`quantity` = 0, 99999, mr.`quantity`) <>99999 ";
|
||||||
|
if (!string.IsNullOrEmpty(drug_id))
|
||||||
|
{
|
||||||
|
SQL += " AND mr.drug_id='" + drug_id + "' ";
|
||||||
|
}
|
||||||
|
SQL += "ORDER BY YEAR(mr.`operation_time`),MONTH(mr.`operation_time`),DAY(mr.`operation_time`),mr.`drug_id`,mr.manu_no"; //" GROUP BY mr.drug_id,mr.manu_no,mr.operation_time " +
|
||||||
|
|
||||||
|
Report.DetailGrid.Recordset.QuerySQL = SQL;
|
||||||
|
|
||||||
|
Report.PrintPreview(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
public class LastMonthModel
|
||||||
|
{
|
||||||
|
public string StrTotalManuNo { get; set; } = "0";
|
||||||
|
public string StrTotalQuantity { get; set; } = "0";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -0,0 +1,538 @@
|
||||||
|
{
|
||||||
|
"Version":"6.8.1.1",
|
||||||
|
"Font":{
|
||||||
|
"Name":"宋体",
|
||||||
|
"Size":105000,
|
||||||
|
"Weight":400,
|
||||||
|
"Charset":134
|
||||||
|
},
|
||||||
|
"Printer":{
|
||||||
|
"Oriention":"Landscape"
|
||||||
|
},
|
||||||
|
"DetailGrid":{
|
||||||
|
"ShowColLine":false,
|
||||||
|
"ShowRowLine":false,
|
||||||
|
"PrintAdaptMethod":"ResizeToFit",
|
||||||
|
"GrowToBottom":true,
|
||||||
|
"Border":{
|
||||||
|
"Styles":"[]"
|
||||||
|
},
|
||||||
|
"Recordset":{
|
||||||
|
"Field":[
|
||||||
|
{
|
||||||
|
"Name":"批号",
|
||||||
|
"DBFieldName":"manuNo"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Name":"药品名称",
|
||||||
|
"DBFieldName":"drugName"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Name":"规格",
|
||||||
|
"DBFieldName":"drugSpec"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Name":"单位",
|
||||||
|
"DBFieldName":"bigUnit"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Name":"生产厂家",
|
||||||
|
"DBFieldName":"manufactory"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Name":"年",
|
||||||
|
"Type":"Integer",
|
||||||
|
"DBFieldName":"DMYear"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Name":"月",
|
||||||
|
"Type":"Integer",
|
||||||
|
"DBFieldName":"DMMonth"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Name":"日",
|
||||||
|
"Type":"Integer",
|
||||||
|
"DBFieldName":"DMDay"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Name":"发药数量",
|
||||||
|
"DBFieldName":"outQuantity"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Name":"登记人",
|
||||||
|
"DBFieldName":"operatorName"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Name":"核对人",
|
||||||
|
"DBFieldName":"reviewerName"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Name":"领药数量",
|
||||||
|
"DBFieldName":"inQuantity"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Name":"结存",
|
||||||
|
"DBFieldName":"stockQuantity"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Name":"drugId"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"Column":[
|
||||||
|
{
|
||||||
|
"Name":"Column1",
|
||||||
|
"Width":24.7385
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"ColumnContent":{
|
||||||
|
"Height":0.608542,
|
||||||
|
"ColumnContentCell":[
|
||||||
|
{
|
||||||
|
"Column":"Column1",
|
||||||
|
"FreeCell":true,
|
||||||
|
"CanGrow":true,
|
||||||
|
"Control":[
|
||||||
|
{
|
||||||
|
"Type":"SubReport",
|
||||||
|
"Name":"SubReport1",
|
||||||
|
"Dock":"Fill",
|
||||||
|
"RelationFields":"drugId",
|
||||||
|
"Report":{
|
||||||
|
"Version":"6.8.1.1",
|
||||||
|
"Font":{
|
||||||
|
"Name":"宋体",
|
||||||
|
"Size":105000,
|
||||||
|
"Weight":400,
|
||||||
|
"Charset":134
|
||||||
|
},
|
||||||
|
"Printer":{
|
||||||
|
"Oriention":"Landscape"
|
||||||
|
},
|
||||||
|
"DetailGrid":{
|
||||||
|
"Recordset":{
|
||||||
|
"Field":[
|
||||||
|
{
|
||||||
|
"Name":"日期",
|
||||||
|
"DBFieldName":"DMDay"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Name":"批号",
|
||||||
|
"DBFieldName":"manuNo"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Name":"领药数量",
|
||||||
|
"DBFieldName":"inQuantity"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Name":"登记人",
|
||||||
|
"DBFieldName":"operatorName"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Name":"核对人",
|
||||||
|
"DBFieldName":"reviewerName"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"Column":[
|
||||||
|
{
|
||||||
|
"Name":"日期",
|
||||||
|
"Width":1.98438
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Name":"批号",
|
||||||
|
"Width":5.97958
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Name":"Column4",
|
||||||
|
"Width":7.99042
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Name":"Column5",
|
||||||
|
"Width":4.20688
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Name":"Column6",
|
||||||
|
"Width":4.2069
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"ColumnContent":{
|
||||||
|
"Height":2.01083,
|
||||||
|
"ColumnContentCell":[
|
||||||
|
{
|
||||||
|
"Column":"日期",
|
||||||
|
"TextAlign":"MiddleCenter",
|
||||||
|
"DataField":"日期"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Column":"批号",
|
||||||
|
"TextAlign":"MiddleCenter",
|
||||||
|
"DataField":"批号"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Column":"Column4",
|
||||||
|
"TextAlign":"MiddleCenter",
|
||||||
|
"DataField":"领药数量"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Column":"Column5",
|
||||||
|
"TextAlign":"MiddleCenter",
|
||||||
|
"DataField":"登记人"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Column":"Column6",
|
||||||
|
"TextAlign":"MiddleCenter",
|
||||||
|
"DataField":"核对人"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"ColumnTitle":{
|
||||||
|
"Height":1,
|
||||||
|
"RepeatStyle":"OnPageColumn",
|
||||||
|
"ColumnTitleCell":[
|
||||||
|
{
|
||||||
|
"GroupTitle":false,
|
||||||
|
"Column":"日期",
|
||||||
|
"TextAlign":"MiddleCenter",
|
||||||
|
"Text":"日期"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"GroupTitle":false,
|
||||||
|
"Column":"批号",
|
||||||
|
"TextAlign":"MiddleCenter",
|
||||||
|
"Text":"批号"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"GroupTitle":false,
|
||||||
|
"Column":"Column4",
|
||||||
|
"TextAlign":"MiddleCenter",
|
||||||
|
"Text":"领药数量"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"GroupTitle":false,
|
||||||
|
"Column":"Column5",
|
||||||
|
"TextAlign":"MiddleCenter",
|
||||||
|
"Text":"登记人"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"GroupTitle":false,
|
||||||
|
"Column":"Column6",
|
||||||
|
"TextAlign":"MiddleCenter",
|
||||||
|
"Text":"核对人"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"ReportHeader":[
|
||||||
|
{
|
||||||
|
"Name":"ReportHeader1",
|
||||||
|
"Height":1.00542,
|
||||||
|
"Control":[
|
||||||
|
{
|
||||||
|
"Type":"StaticBox",
|
||||||
|
"Name":"StaticBox1",
|
||||||
|
"Left":10.2129,
|
||||||
|
"Width":3.38667,
|
||||||
|
"Height":1.00542,
|
||||||
|
"Font":{
|
||||||
|
"Name":"宋体",
|
||||||
|
"Size":150000,
|
||||||
|
"Bold":true,
|
||||||
|
"Charset":134
|
||||||
|
},
|
||||||
|
"TextAlign":"MiddleCenter",
|
||||||
|
"Text":"入库情况"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"ColumnTitle":{
|
||||||
|
"Height":0,
|
||||||
|
"ColumnTitleCell":[
|
||||||
|
{
|
||||||
|
"GroupTitle":false,
|
||||||
|
"Column":"Column1",
|
||||||
|
"FreeCell":true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"Group":[
|
||||||
|
{
|
||||||
|
"Name":"Group1",
|
||||||
|
"ByFields":"drugId;年;月",
|
||||||
|
"GroupHeader":{
|
||||||
|
"Height":1.00542,
|
||||||
|
"PrintGridBorder":false,
|
||||||
|
"Control":[
|
||||||
|
{
|
||||||
|
"Type":"MemoBox",
|
||||||
|
"Name":"MemoBox2",
|
||||||
|
"Left":0.608542,
|
||||||
|
"Top":0.211667,
|
||||||
|
"Width":3.99521,
|
||||||
|
"Height":0.582083,
|
||||||
|
"Text":"品名:[#药品名称#]"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Type":"MemoBox",
|
||||||
|
"Name":"MemoBox3",
|
||||||
|
"Left":5.60917,
|
||||||
|
"Top":0.211667,
|
||||||
|
"Width":3.9952,
|
||||||
|
"Height":0.582083,
|
||||||
|
"Text":"规格:[#规格#]"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Type":"MemoBox",
|
||||||
|
"Name":"MemoBox4",
|
||||||
|
"Left":9.39271,
|
||||||
|
"Top":0.211667,
|
||||||
|
"Width":3.01625,
|
||||||
|
"Height":0.608542,
|
||||||
|
"Text":"单位:[#单位#]"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Type":"MemoBox",
|
||||||
|
"Name":"MemoBox5",
|
||||||
|
"Left":12.8058,
|
||||||
|
"Top":0.211667,
|
||||||
|
"Width":7.19667,
|
||||||
|
"Height":0.5821,
|
||||||
|
"Text":"厂家:[#生产厂家#]"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Type":"MemoBox",
|
||||||
|
"Name":"MemoBox6",
|
||||||
|
"Left":21.3254,
|
||||||
|
"Top":0.185208,
|
||||||
|
"Width":1.61396,
|
||||||
|
"Height":0.5821,
|
||||||
|
"Text":"[#年#]年"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Type":"MemoBox",
|
||||||
|
"Name":"MemoBox7",
|
||||||
|
"Left":22.9394,
|
||||||
|
"Top":0.185208,
|
||||||
|
"Width":1.66688,
|
||||||
|
"Height":0.5821,
|
||||||
|
"Text":"[#月#]月"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"GroupFooter":{
|
||||||
|
"CanGrow":true,
|
||||||
|
"CanShrink":true,
|
||||||
|
"Height":2.01083,
|
||||||
|
"Control":[
|
||||||
|
{
|
||||||
|
"Type":"SubReport",
|
||||||
|
"Name":"SubReport2",
|
||||||
|
"Dock":"Fill",
|
||||||
|
"CanShrink":true,
|
||||||
|
"RelationFields":"drugId",
|
||||||
|
"Report":{
|
||||||
|
"Version":"6.8.1.1",
|
||||||
|
"PrintAsDesignPaper":false,
|
||||||
|
"Font":{
|
||||||
|
"Name":"宋体",
|
||||||
|
"Size":105000,
|
||||||
|
"Weight":400,
|
||||||
|
"Charset":134
|
||||||
|
},
|
||||||
|
"Printer":{
|
||||||
|
"Oriention":"Landscape"
|
||||||
|
},
|
||||||
|
"DetailGrid":{
|
||||||
|
"Recordset":{
|
||||||
|
"Field":[
|
||||||
|
{
|
||||||
|
"Name":"日期",
|
||||||
|
"DBFieldName":"DMDay"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Name":"批号",
|
||||||
|
"DBFieldName":"manuNo"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Name":"发药数量",
|
||||||
|
"DBFieldName":"outQuantity"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Name":"结存",
|
||||||
|
"DBFieldName":"stockQuantity"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Name":"登记人",
|
||||||
|
"DBFieldName":"operatorName"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Name":"核对人",
|
||||||
|
"DBFieldName":"reviewerName"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"Column":[
|
||||||
|
{
|
||||||
|
"Name":"日期",
|
||||||
|
"Width":1.9844
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Name":"批号",
|
||||||
|
"Width":6.00604
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Name":"发药数量",
|
||||||
|
"Width":3.9953
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Name":"结存",
|
||||||
|
"Width":3.9952
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Name":"登记人",
|
||||||
|
"Width":4.2069
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Name":"核对人",
|
||||||
|
"Width":4.2069
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"ColumnContent":{
|
||||||
|
"Height":0.79375,
|
||||||
|
"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":"核对人"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"ColumnTitle":{
|
||||||
|
"Height":1,
|
||||||
|
"ColumnTitleCell":[
|
||||||
|
{
|
||||||
|
"GroupTitle":false,
|
||||||
|
"Column":"日期",
|
||||||
|
"TextAlign":"MiddleCenter",
|
||||||
|
"Text":"日期"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"GroupTitle":false,
|
||||||
|
"Column":"批号",
|
||||||
|
"TextAlign":"MiddleCenter",
|
||||||
|
"Text":"批号"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"GroupTitle":false,
|
||||||
|
"Column":"发药数量",
|
||||||
|
"TextAlign":"MiddleCenter",
|
||||||
|
"Text":"发药数量"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"GroupTitle":false,
|
||||||
|
"Column":"结存",
|
||||||
|
"TextAlign":"MiddleCenter",
|
||||||
|
"Text":"结存"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"GroupTitle":false,
|
||||||
|
"Column":"登记人",
|
||||||
|
"TextAlign":"MiddleCenter",
|
||||||
|
"Text":"登记人"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"GroupTitle":false,
|
||||||
|
"Column":"核对人",
|
||||||
|
"TextAlign":"MiddleCenter",
|
||||||
|
"Text":"核对人"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"ReportHeader":[
|
||||||
|
{
|
||||||
|
"Name":"ReportHeader1",
|
||||||
|
"Height":0.79375,
|
||||||
|
"Control":[
|
||||||
|
{
|
||||||
|
"Type":"StaticBox",
|
||||||
|
"Name":"StaticBox1",
|
||||||
|
"Left":8.99583,
|
||||||
|
"Width":5.60917,
|
||||||
|
"Height":0.79375,
|
||||||
|
"Font":{
|
||||||
|
"Name":"宋体",
|
||||||
|
"Size":150000,
|
||||||
|
"Bold":true,
|
||||||
|
"Charset":134
|
||||||
|
},
|
||||||
|
"TextAlign":"MiddleCenter",
|
||||||
|
"Text":"逐日消耗与结存情况"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"ReportHeader":[
|
||||||
|
{
|
||||||
|
"Name":"ReportHeader1",
|
||||||
|
"CanGrow":true,
|
||||||
|
"Height":1.00542,
|
||||||
|
"Control":[
|
||||||
|
{
|
||||||
|
"Type":"MemoBox",
|
||||||
|
"Name":"MemoBox1",
|
||||||
|
"Dock":"Fill",
|
||||||
|
"Center":"Horizontal",
|
||||||
|
"Font":{
|
||||||
|
"Name":"宋体",
|
||||||
|
"Size":262500,
|
||||||
|
"Bold":true,
|
||||||
|
"Charset":134
|
||||||
|
},
|
||||||
|
"TextAlign":"MiddleCenter",
|
||||||
|
"Text":"药房麻醉药品、第一类精神药品逐日消耗专用账册"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"RepeatOnPage":true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -30,13 +30,18 @@ namespace DM_Weight.Services
|
||||||
string p_machine_id = (ConfigurationManager.AppSettings["machineId"] ?? "DM1");
|
string p_machine_id = (ConfigurationManager.AppSettings["machineId"] ?? "DM1");
|
||||||
string SQL = $@"SELECT TYPE, stockQuantity,inQuantity,outQuantity,operationTime,invoiceId,drugName,drugId,drugSpec,packUnit,dosage,manufactory,manuNo,effDate,
|
string SQL = $@"SELECT TYPE, stockQuantity,inQuantity,outQuantity,operationTime,invoiceId,drugName,drugId,drugSpec,packUnit,dosage,manufactory,manuNo,effDate,
|
||||||
operatorName,reviewerName,supplierDept,receiveDept FROM
|
operatorName,reviewerName,supplierDept,receiveDept FROM
|
||||||
(SELECT mr.type,mr.`stock_quantity` AS `stockQuantity`, IF(mr.`type` IN (1, 31), mr.`quantity`, IF(mr.`type` = 4 AND mr.`quantity` > 0, mr.`quantity`, 0))
|
(SELECT mr.type,mr.`stock_quantity` AS `stockQuantity`,
|
||||||
AS `inQuantity`, IF(mr.`type` = 2, mr.`quantity`, IF(mr.`type` = 4 AND mr.`quantity` < 0, (0 - mr.`quantity`), 0)) AS `outQuantity`,
|
-- IF(mr.`type` IN (1, 31), mr.`quantity`,IF(mr.`type` = 4 AND mr.`quantity` > 0, mr.`quantity`, 0)) AS `inQuantity`,
|
||||||
|
-- IF(mr.`type` = 2, mr.`quantity`, IF(mr.`type` = 4 AND mr.`quantity` < 0, (0 - mr.`quantity`), 0)) AS `outQuantity`,
|
||||||
|
if(mr.drawer_no>2 and mr.`type` IN (1, 31),quantity,IF(mr.`type` = 4 AND mr.`quantity` > 0, mr.`quantity`,0)) AS `inQuantity`,
|
||||||
|
if(OI.ORDER_NO is not null,mr.quantity,IF(mr.`type` = 4 AND mr.`quantity` < 0, (0 - mr.`quantity`), 0)) AS `outQuantity`,
|
||||||
DATE_FORMAT(mr.`operation_time`,'%m/%d') AS `operationTime`,IF(mr.`type`=1,mr.`invoice_id`,NULL) AS `invoiceId`, di.`drug_name` AS `drugName`, di.`drug_id` AS `drugId`,
|
DATE_FORMAT(mr.`operation_time`,'%m/%d') AS `operationTime`,IF(mr.`type`=1,mr.`invoice_id`,NULL) AS `invoiceId`, di.`drug_name` AS `drugName`, di.`drug_id` AS `drugId`,
|
||||||
di.`drug_spec` AS `drugSpec`, di.`pack_unit` AS `packUnit`, di.`dosage` AS `dosage`, di.`manufactory` AS `manufactory`,
|
di.`drug_spec` AS `drugSpec`, di.`pack_unit` AS `packUnit`, di.`dosage` AS `dosage`, di.`manufactory` AS `manufactory`,
|
||||||
mr.`manu_no` AS `manuNo`, DATE_FORMAT(mr.`eff_date`,'%y/%m/%d') AS `effDate`, u1.`user_name` AS `operatorName`, u2.`user_name` AS `reviewerName`,mr.supplierDept,mr.receiveDept FROM
|
mr.`manu_no` AS `manuNo`, DATE_FORMAT(mr.`eff_date`,'%y/%m/%d') AS `effDate`, u1.`user_name` AS `operatorName`, u2.`user_name` AS `reviewerName`,mr.supplierDept,mr.receiveDept FROM
|
||||||
dm_machine_record mr LEFT JOIN drug_info di ON mr.`drug_id` = di.`drug_id` LEFT JOIN user_list u1 ON mr.`operator` = u1.`id`
|
dm_machine_record mr LEFT JOIN drug_info di ON mr.`drug_id` = di.`drug_id` LEFT JOIN user_list u1 ON mr.`operator` = u1.`id`
|
||||||
LEFT JOIN user_list u2 ON mr.`reviewer` = u2.`id` WHERE mr.`machine_id` = '{p_machine_id}' AND mr.`operation_time` > '{p_startDate}'
|
LEFT JOIN user_list u2 ON mr.`reviewer` = u2.`id`
|
||||||
|
LEFT JOIN ORDER_INFO OI ON OI.ORDER_NO=mr.invoice_id
|
||||||
|
WHERE mr.`machine_id` = '{p_machine_id}' AND mr.`operation_time` > '{p_startDate}'
|
||||||
AND mr.`operation_time` < '{p_endDate}' and IF(mr.`type` = 4 AND mr.`quantity` = 0, 99999, mr.`quantity`) <>99999 ";
|
AND mr.`operation_time` < '{p_endDate}' and IF(mr.`type` = 4 AND mr.`quantity` = 0, 99999, mr.`quantity`) <>99999 ";
|
||||||
if (!string.IsNullOrEmpty(drug_id))
|
if (!string.IsNullOrEmpty(drug_id))
|
||||||
{
|
{
|
||||||
|
|
|
@ -237,8 +237,13 @@ namespace DM_Weight.ViewModels
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
string machineId = ConfigurationManager.AppSettings["machineId"] ?? "DM1";
|
||||||
//查询账册中所有记录,与库存中的记录做比校,如果账册中没有,则添加一条
|
//根据已生成的日结存记录
|
||||||
|
int deleteNum = SqlSugarHelper.Db.Deleteable<MachineRecord>()
|
||||||
|
.Where(cs => cs.Type.Equals(5) && cs.OperationTime.ToString("yyyy-MM-dd") == DateTime.Now.ToString("yyyy-MM-dd") && cs.MachineId.Equals(machineId)).ExecuteCommand();
|
||||||
|
int inQuantity = 0; //当日入库量
|
||||||
|
int outQuantity = 0; //当日出库量
|
||||||
|
//查询账册中所有记录,与库存中的记录做比校,如果账册中没有,则添加一条,有则添加一条总日结存
|
||||||
List<AccountModel> accountList = _machineRecordService.ReportAccountBook(nowDate, null, 0);
|
List<AccountModel> accountList = _machineRecordService.ReportAccountBook(nowDate, null, 0);
|
||||||
//库存中的记录
|
//库存中的记录
|
||||||
List<ChannelStockCount> channelStockList = _channelStockService.GetAll();
|
List<ChannelStockCount> channelStockList = _channelStockService.GetAll();
|
||||||
|
@ -249,33 +254,48 @@ namespace DM_Weight.ViewModels
|
||||||
|
|
||||||
for (int i = 0; i < channelStockList.Count; i++)
|
for (int i = 0; i < channelStockList.Count; i++)
|
||||||
{
|
{
|
||||||
int Count = accountList.Where(cs => cs.DrugId == channelStockList[i].DrugId && cs.ManuNo == channelStockList[i].ManuNo).Count();
|
string drugId = channelStockList[i].DrugId;
|
||||||
|
int Count = accountList.Where(cs => cs.DrugId == drugId).Count();
|
||||||
|
|
||||||
if (Count <= 0)
|
if (Count <= 0)
|
||||||
{
|
{
|
||||||
//没有直接插入
|
inQuantity = 0;
|
||||||
// 保存数据 出/入库记录
|
outQuantity = 0;
|
||||||
string InvoiceId = "Account_" + CurrentTimeMillis();
|
|
||||||
SqlSugarHelper.Db.Insertable(new MachineRecord()
|
|
||||||
{
|
|
||||||
MachineId = channelStockList[i].MachineId,
|
|
||||||
DrawerNo = 0,//channelStockList[i].DrawerNo,
|
|
||||||
ColNo = 0,// channelStockList[i].ColNo,FV
|
|
||||||
DrugId = channelStockList[i].DrugId,
|
|
||||||
ManuNo = channelStockList[i].ManuNo,
|
|
||||||
EffDate = !String.IsNullOrEmpty(channelStockList[i].EffDate) ? DateTime.ParseExact(channelStockList[i].EffDate, "yyyy-MM-dd", System.Globalization.CultureInfo.CurrentCulture) : null,
|
|
||||||
Operator = HomeWindowViewModel.Operator?.Id,
|
|
||||||
Reviewer = HomeWindowViewModel.Reviewer?.Id,
|
|
||||||
OperationTime = DateTime.Now,
|
|
||||||
Quantity = 0,
|
|
||||||
Type = 5,
|
|
||||||
InvoiceId = string.Empty,//InvoiceId,
|
|
||||||
StockQuantity = channelStockList[i].Quantity,
|
|
||||||
ManunoQuantity = 0,
|
|
||||||
SupplierDept = ConfigurationManager.AppSettings["supplierDept"].ToString(),
|
|
||||||
ReceiveDept = ConfigurationManager.AppSettings["receiveDept"].ToString()
|
|
||||||
}).ExecuteCommand();
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
inQuantity = accountList.Where(cs => cs.DrugId == drugId).Sum(cs => cs.InQuantity);
|
||||||
|
outQuantity = accountList.Where(cs => cs.DrugId == drugId).Sum(cs => cs.OutQuantity);
|
||||||
|
}
|
||||||
|
// 获取药品总库存
|
||||||
|
int channelStockQuantity = SqlSugarHelper.Db.Queryable<ChannelStock>()
|
||||||
|
.Where(cs => cs.DrugId.Equals(drugId)).Sum(it => it.Quantity);
|
||||||
|
//没有直接插入
|
||||||
|
// 保存数据 出/入库记录
|
||||||
|
string InvoiceId = "Account_" + CurrentTimeMillis();
|
||||||
|
SqlSugarHelper.Db.Insertable(new MachineRecord()
|
||||||
|
{
|
||||||
|
MachineId = channelStockList[i].MachineId,
|
||||||
|
DrawerNo = 0,//channelStockList[i].DrawerNo,
|
||||||
|
ColNo = 0,// channelStockList[i].ColNo,FV
|
||||||
|
DrugId = drugId,
|
||||||
|
ManuNo = "",//channelStockList[i].ManuNo,
|
||||||
|
EffDate = null,// !String.IsNullOrEmpty(channelStockList[i].EffDate) ? DateTime.ParseExact(channelStockList[i].EffDate, "yyyy-MM-dd", System.Globalization.CultureInfo.CurrentCulture) : null,
|
||||||
|
Operator = HomeWindowViewModel.Operator?.Id,
|
||||||
|
Reviewer = HomeWindowViewModel.Reviewer?.Id,
|
||||||
|
OperationTime = DateTime.Now,
|
||||||
|
Quantity = 0,
|
||||||
|
Type = 5,
|
||||||
|
InvoiceId = "日结存",//InvoiceId,
|
||||||
|
ReturnQuantity1 = inQuantity, //当日入库量总数
|
||||||
|
ReturnQuantity2 = outQuantity, //当日出库量总数
|
||||||
|
StockQuantity = channelStockQuantity,
|
||||||
|
ManunoQuantity = 0,
|
||||||
|
SupplierDept = string.Empty,// ConfigurationManager.AppSettings["supplierDept"].ToString(),
|
||||||
|
ReceiveDept = string.Empty,//ConfigurationManager.AppSettings["receiveDept"].ToString()
|
||||||
|
}).ExecuteCommand();
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -284,25 +304,33 @@ namespace DM_Weight.ViewModels
|
||||||
{
|
{
|
||||||
//账册中没有记录则把库存中的所有数据都要生成一条账册记录
|
//账册中没有记录则把库存中的所有数据都要生成一条账册记录
|
||||||
// 保存数据 出/入库记录
|
// 保存数据 出/入库记录
|
||||||
|
// 获取药品总库存
|
||||||
|
string drugId= channelStockList[i].DrugId;
|
||||||
|
int channelStockQuantity = SqlSugarHelper.Db.Queryable<ChannelStock>()
|
||||||
|
.Where(cs => cs.DrugId.Equals(drugId)).Sum(it => it.Quantity);
|
||||||
|
|
||||||
|
|
||||||
string InvoiceId = "Account_" + CurrentTimeMillis();
|
string InvoiceId = "Account_" + CurrentTimeMillis();
|
||||||
SqlSugarHelper.Db.Insertable(new MachineRecord()
|
SqlSugarHelper.Db.Insertable(new MachineRecord()
|
||||||
{
|
{
|
||||||
MachineId = channelStockList[i].MachineId,
|
MachineId = channelStockList[i].MachineId,
|
||||||
DrawerNo = 0,//channelStockList[i].DrawerNo,
|
DrawerNo = 0,//channelStockList[i].DrawerNo,
|
||||||
ColNo = 0,//channelStockList[i].ColNo,
|
ColNo = 0,//channelStockList[i].ColNo,
|
||||||
DrugId = channelStockList[i].DrugId,
|
DrugId = drugId,
|
||||||
ManuNo = channelStockList[i].ManuNo,
|
ManuNo = "",// channelStockList[i].ManuNo,
|
||||||
EffDate = !String.IsNullOrEmpty(channelStockList[i].EffDate) ? DateTime.ParseExact(channelStockList[i].EffDate, "yyyy-MM-dd", System.Globalization.CultureInfo.CurrentCulture) : null,
|
EffDate = null,// !String.IsNullOrEmpty(channelStockList[i].EffDate) ? DateTime.ParseExact(channelStockList[i].EffDate, "yyyy-MM-dd", System.Globalization.CultureInfo.CurrentCulture) : null,
|
||||||
Operator = HomeWindowViewModel.Operator?.Id,
|
Operator = HomeWindowViewModel.Operator?.Id,
|
||||||
Reviewer = HomeWindowViewModel.Reviewer?.Id,
|
Reviewer = HomeWindowViewModel.Reviewer?.Id,
|
||||||
OperationTime = DateTime.Now,
|
OperationTime = DateTime.Now,
|
||||||
Quantity = 0,
|
Quantity = 0,
|
||||||
Type = 5,
|
Type = 5,
|
||||||
InvoiceId = string.Empty,//InvoiceId,
|
InvoiceId = "日结存",// string.Empty,//InvoiceId,
|
||||||
StockQuantity = channelStockList[i].Quantity,
|
ReturnQuantity1 = inQuantity, //当日入库量总数
|
||||||
|
ReturnQuantity2 = outQuantity, //当日出库量总数
|
||||||
|
StockQuantity = channelStockQuantity,
|
||||||
ManunoQuantity = 0,
|
ManunoQuantity = 0,
|
||||||
SupplierDept = ConfigurationManager.AppSettings["supplierDept"].ToString(),
|
SupplierDept = string.Empty,//ConfigurationManager.AppSettings["supplierDept"].ToString(),
|
||||||
ReceiveDept = ConfigurationManager.AppSettings["receiveDept"].ToString()
|
ReceiveDept = string.Empty,//ConfigurationManager.AppSettings["receiveDept"].ToString()
|
||||||
}).ExecuteCommand();
|
}).ExecuteCommand();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,6 +25,33 @@ namespace DM_Weight.ViewModels
|
||||||
{
|
{
|
||||||
public class AddDrugControlViewModel : BindableBase, IConfirmNavigationRequest, IRegionMemberLifetime
|
public class AddDrugControlViewModel : BindableBase, IConfirmNavigationRequest, IRegionMemberLifetime
|
||||||
{
|
{
|
||||||
|
public static List<UseFor> SelectUseList = new()
|
||||||
|
{
|
||||||
|
new UseFor { UseId = 96, UseName = "不入账册" },
|
||||||
|
new UseFor{UseId=0,UseName="入账册"}
|
||||||
|
};
|
||||||
|
private List<UseFor> _selects = SelectUseList;
|
||||||
|
|
||||||
|
public List<UseFor> Selects
|
||||||
|
{
|
||||||
|
get { return _selects; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
SetProperty(ref _selects, value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private UseFor _selectedItem = SelectUseList[0];
|
||||||
|
/// <summary>
|
||||||
|
/// 取药或加药用途字段
|
||||||
|
/// </summary>
|
||||||
|
public UseFor SelectedItem
|
||||||
|
{
|
||||||
|
get { return _selectedItem; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
SetProperty(ref _selectedItem, value);
|
||||||
|
}
|
||||||
|
}
|
||||||
private readonly ILog logger = LogManager.GetLogger(typeof(AddDrugControlViewModel));
|
private readonly ILog logger = LogManager.GetLogger(typeof(AddDrugControlViewModel));
|
||||||
private List<int> _drawerNoList = new List<int>();
|
private List<int> _drawerNoList = new List<int>();
|
||||||
public static AddDrugControlViewModel vm;
|
public static AddDrugControlViewModel vm;
|
||||||
|
@ -148,7 +175,18 @@ namespace DM_Weight.ViewModels
|
||||||
private int _status;
|
private int _status;
|
||||||
|
|
||||||
public int Status { get => _status; set => SetProperty(ref _status, value); }
|
public int Status { get => _status; set => SetProperty(ref _status, value); }
|
||||||
|
/// <summary>
|
||||||
|
/// 操作状态
|
||||||
|
/// </summary>
|
||||||
|
private int _OptionStatus = -1;
|
||||||
|
|
||||||
|
public int OptionStatus { get => _OptionStatus; set => SetProperty(ref _OptionStatus, value); }
|
||||||
|
/// <summary>
|
||||||
|
/// 完成按钮绑定文本(完成;保存中)
|
||||||
|
/// </summary>
|
||||||
|
private string _FinishContent = "完成";
|
||||||
|
public string FinishContent
|
||||||
|
{ get => _FinishContent; set => SetProperty(ref _FinishContent, value); }
|
||||||
private int _drawerNo = 1;
|
private int _drawerNo = 1;
|
||||||
|
|
||||||
public int DrawerNo
|
public int DrawerNo
|
||||||
|
@ -215,13 +253,25 @@ namespace DM_Weight.ViewModels
|
||||||
// 完成按钮
|
// 完成按钮
|
||||||
public DelegateCommand TakeFinish
|
public DelegateCommand TakeFinish
|
||||||
{
|
{
|
||||||
get => new DelegateCommand(() =>
|
get => new DelegateCommand(TakeFinishAction);
|
||||||
|
}
|
||||||
|
private void TakeFinishAction()
|
||||||
|
{
|
||||||
|
OptionStatus = 4;
|
||||||
|
FinishContent = "保存中";
|
||||||
|
Task.Factory.StartNew(() => TakeFinishMethod());
|
||||||
|
}
|
||||||
|
private async void TakeFinishMethod()
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
|
logger.Info("开始保存数据");
|
||||||
if (!_isFinishClick)
|
if (!_isFinishClick)
|
||||||
{
|
{
|
||||||
_isFinishClick = true;
|
_isFinishClick = true;
|
||||||
foreach (ChannelList lst in ChannelLsts)
|
foreach (ChannelList lst in ChannelLsts)
|
||||||
{
|
{
|
||||||
|
lst.channelStocks.ForEach(it => it.DrugId = lst.DrugId);
|
||||||
ChannelStocks.AddRange(lst.channelStocks);
|
ChannelStocks.AddRange(lst.channelStocks);
|
||||||
}
|
}
|
||||||
List<ChannelStock> record = ChannelStocks.FindAll(it => it.AddQuantity != 0).ToList();
|
List<ChannelStock> record = ChannelStocks.FindAll(it => it.AddQuantity != 0).ToList();
|
||||||
|
@ -247,13 +297,19 @@ namespace DM_Weight.ViewModels
|
||||||
Quantity = it.Quantity + it.AddQuantity,
|
Quantity = it.Quantity + it.AddQuantity,
|
||||||
ManuNo = it.ManuNo,
|
ManuNo = it.ManuNo,
|
||||||
EffDate = it.EffDate,
|
EffDate = it.EffDate,
|
||||||
|
DrugId = it.DrugId,
|
||||||
Id = it.Id,
|
Id = it.Id,
|
||||||
}).UpdateColumns(it => new { it.Quantity, it.ManuNo, it.EffDate }).ExecuteCommand();
|
DrawerNo = it.DrawerNo,
|
||||||
|
ColNo = it.ColNo,
|
||||||
|
DrawerType = it.DrawerType,
|
||||||
|
BoardType = it.BoardType,
|
||||||
|
FillTime=it.Quantity<=0||it.FillTime==null ? DateTime.Now : it.FillTime,
|
||||||
|
}).UpdateColumns(it => new { it.Quantity, it.ManuNo, it.EffDate, it.DrugId,it.FillTime }).ExecuteCommand();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
//如果批号重复则不让添加
|
//如果批号重复则不让添加
|
||||||
List<ChannelStock> csCount = SqlSugarHelper.Db.Queryable<ChannelStock>().Where(cs => cs.DrawerNo == it.DrawerNo && cs.ManuNo == it.ManuNo && cs.MachineId.Equals(ConfigurationManager.AppSettings["machineId"] ?? "DM1")).ToList();
|
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")).ToList();
|
||||||
if (csCount.Count > 0)
|
if (csCount.Count > 0)
|
||||||
{
|
{
|
||||||
//repeatList.Add(it.ManuNo);
|
//repeatList.Add(it.ManuNo);
|
||||||
|
@ -274,7 +330,8 @@ namespace DM_Weight.ViewModels
|
||||||
DrawerType = it.DrawerType,
|
DrawerType = it.DrawerType,
|
||||||
BoardType = it.BoardType,
|
BoardType = it.BoardType,
|
||||||
Id = Guid.NewGuid().ToString(),
|
Id = Guid.NewGuid().ToString(),
|
||||||
MachineId = ConfigurationManager.AppSettings["machineId"] ?? "DM1"
|
MachineId = ConfigurationManager.AppSettings["machineId"] ?? "DM1",
|
||||||
|
FillTime = DateTime.Now
|
||||||
}).ExecuteCommand();
|
}).ExecuteCommand();
|
||||||
}
|
}
|
||||||
// 获取更新完库存后的药品库存
|
// 获取更新完库存后的药品库存
|
||||||
|
@ -294,10 +351,10 @@ namespace DM_Weight.ViewModels
|
||||||
ManuNo = it.ManuNo,
|
ManuNo = it.ManuNo,
|
||||||
EffDate = !String.IsNullOrEmpty(it.EffDate) ? DateTime.ParseExact(it.EffDate, "yyyy-MM-dd", System.Globalization.CultureInfo.CurrentCulture) : null,
|
EffDate = !String.IsNullOrEmpty(it.EffDate) ? DateTime.ParseExact(it.EffDate, "yyyy-MM-dd", System.Globalization.CultureInfo.CurrentCulture) : null,
|
||||||
Operator = HomeWindowViewModel.Operator?.Id,
|
Operator = HomeWindowViewModel.Operator?.Id,
|
||||||
Reviewer= HomeWindowViewModel.Reviewer?.Id,
|
Reviewer = HomeWindowViewModel.Reviewer?.Id,
|
||||||
OperationTime = DateTime.Now,
|
OperationTime = DateTime.Now,
|
||||||
Quantity = it.AddQuantity,
|
Quantity = it.AddQuantity,
|
||||||
Type = 1,
|
Type = SelectedItem.UseId == 0 ? 1 : SelectedItem.UseId,
|
||||||
InvoiceId = InvoiceId,
|
InvoiceId = InvoiceId,
|
||||||
StockQuantity = nowChannels.Sum(it => it.Quantity),
|
StockQuantity = nowChannels.Sum(it => it.Quantity),
|
||||||
ManunoQuantity = nowChannels.FindAll(it2 => it2.ManuNo == it.ManuNo).Sum(it => it.Quantity)
|
ManunoQuantity = nowChannels.FindAll(it2 => it2.ManuNo == it.ManuNo).Sum(it => it.Quantity)
|
||||||
|
@ -310,10 +367,14 @@ namespace DM_Weight.ViewModels
|
||||||
{
|
{
|
||||||
AlertMsg alertMsg = new AlertMsg
|
AlertMsg alertMsg = new AlertMsg
|
||||||
{
|
{
|
||||||
Message = $"该抽屉已存在此药品批次{string.Join(',', stockRepeats.Select(r=>r.ManuNo).ToArray())},请选择其他批次",
|
Message = $"该抽屉已存在此药品批次{string.Join(',', stockRepeats.Select(r => r.ManuNo).ToArray())},请选择其他批次",
|
||||||
Type = MsgType.ERROR
|
Type = MsgType.ERROR
|
||||||
};
|
};
|
||||||
_eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
|
|
||||||
|
System.Windows.Application.Current.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Send, new Action(() =>
|
||||||
|
{
|
||||||
|
_eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
|
||||||
|
}));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -325,7 +386,7 @@ namespace DM_Weight.ViewModels
|
||||||
if (stockRepeats.Count > 0)
|
if (stockRepeats.Count > 0)
|
||||||
{
|
{
|
||||||
msg = $"该抽屉下批次{string.Join(',', stockRepeats.Select(r => r.ManuNo).ToArray())}已存在,不可重复添加,其他批次加药完成,库存已更新";
|
msg = $"该抽屉下批次{string.Join(',', stockRepeats.Select(r => r.ManuNo).ToArray())}已存在,不可重复添加,其他批次加药完成,库存已更新";
|
||||||
foreach(var stockRpt in stockRepeats)
|
foreach (var stockRpt in stockRepeats)
|
||||||
{
|
{
|
||||||
//移除重复的信息,以免更新屏显库存时更新了重复数据
|
//移除重复的信息,以免更新屏显库存时更新了重复数据
|
||||||
record.Remove(stockRpt);
|
record.Remove(stockRpt);
|
||||||
|
@ -339,7 +400,7 @@ namespace DM_Weight.ViewModels
|
||||||
}
|
}
|
||||||
// 更新屏显库存
|
// 更新屏显库存
|
||||||
//List<ChannelStock> singleChannels = record.FindAll(it => it.BoardType != 1);
|
//List<ChannelStock> singleChannels = record.FindAll(it => it.BoardType != 1);
|
||||||
List<ChannelStock> singleChannels = ChannelStocks.Where(it => it.BoardType != 1)
|
List<ChannelStock> singleChannels = ChannelStocks.Where(it => it.BoardType == 5&&(it.AddQuantity>0||it.Quantity>0))
|
||||||
.GroupBy(it => it.ColNo)
|
.GroupBy(it => it.ColNo)
|
||||||
.Select(it =>
|
.Select(it =>
|
||||||
{
|
{
|
||||||
|
@ -347,31 +408,31 @@ namespace DM_Weight.ViewModels
|
||||||
ret.Quantity = it.Sum(itx => itx.Quantity);
|
ret.Quantity = it.Sum(itx => itx.Quantity);
|
||||||
ret.AddQuantity = it.Sum(itx => itx.AddQuantity);
|
ret.AddQuantity = it.Sum(itx => itx.AddQuantity);
|
||||||
ret.EffDate = it.Min(it => it.EffDate);
|
ret.EffDate = it.Min(it => it.EffDate);
|
||||||
ret.ManuNo = it.OrderBy(it=>it.ManuNo).Select(it=>it.ManuNo).First().ToString();
|
ret.ManuNo = it.OrderBy(it => it.ManuNo).Select(it => it.ManuNo).First().ToString();
|
||||||
return ret;
|
return ret;
|
||||||
})
|
})
|
||||||
.OrderBy(it=>it.EffDate)
|
.OrderBy(it => it.EffDate)
|
||||||
.ToList();
|
.ToList();
|
||||||
singleChannels = singleChannels.Where(it => it.AddQuantity > 0).ToList();
|
singleChannels = singleChannels.Where(it => it.AddQuantity > 0).ToList();
|
||||||
if ((singleChannels.Count > 0 ? singleChannels[0].BoardType : 1) == 5)
|
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.AddQuantity));
|
//_portUtil.WriteQuantity(singleChannels[0].DrawerNo, singleChannels[0].ColNo, singleChannels.Sum(it => it.Quantity) + singleChannels.Sum(it => it.AddQuantity));
|
||||||
|
|
||||||
singleChannels.ForEach(it =>
|
singleChannels.ForEach(it =>
|
||||||
{
|
{
|
||||||
|
|
||||||
_portUtil.WriteChannelInfo(6, it.EffDate == null ? "" : it.EffDate, it.DrawerNo, it.ColNo);
|
_portUtil.WriteChannelInfo(6, it.EffDate == null ? "" : it.EffDate, it.DrawerNo, it.ColNo);
|
||||||
Thread.Sleep(200);
|
Thread.Sleep(200);
|
||||||
_portUtil.WriteChannelInfo(5, it.ManuNo, it.DrawerNo, it.ColNo);
|
_portUtil.WriteChannelInfo(5, it.ManuNo, it.DrawerNo, it.ColNo);
|
||||||
Thread.Sleep(200);
|
Thread.Sleep(200);
|
||||||
_portUtil.ShowContent(it.DrawerNo, it.ColNo);
|
_portUtil.ShowContent(it.DrawerNo, it.ColNo);
|
||||||
|
|
||||||
Thread.Sleep(500);
|
Thread.Sleep(200);
|
||||||
|
|
||||||
//写库存数量
|
//写库存数量
|
||||||
_portUtil.WriteQuantity(it.DrawerNo, it.ColNo, it.Quantity + it.AddQuantity);
|
_portUtil.WriteQuantity(it.DrawerNo, it.ColNo, it.Quantity + it.AddQuantity);
|
||||||
|
Thread.Sleep(200);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
RequestData();
|
RequestData();
|
||||||
|
@ -380,7 +441,11 @@ namespace DM_Weight.ViewModels
|
||||||
Message = msg,
|
Message = msg,
|
||||||
Type = type,
|
Type = type,
|
||||||
};
|
};
|
||||||
_eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
|
|
||||||
|
System.Windows.Application.Current.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Send, new Action(() =>
|
||||||
|
{
|
||||||
|
_eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
|
||||||
|
}));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -389,7 +454,11 @@ namespace DM_Weight.ViewModels
|
||||||
Message = "更新库存失败",
|
Message = "更新库存失败",
|
||||||
Type = MsgType.SUCCESS,
|
Type = MsgType.SUCCESS,
|
||||||
};
|
};
|
||||||
_eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
|
|
||||||
|
System.Windows.Application.Current.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Send, new Action(() =>
|
||||||
|
{
|
||||||
|
_eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
|
||||||
|
}));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Status = 0;
|
Status = 0;
|
||||||
|
@ -407,14 +476,33 @@ namespace DM_Weight.ViewModels
|
||||||
Message = "没有填写加药数量",
|
Message = "没有填写加药数量",
|
||||||
Type = MsgType.ERROR
|
Type = MsgType.ERROR
|
||||||
};
|
};
|
||||||
_eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
|
|
||||||
|
System.Windows.Application.Current.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Send, new Action(() =>
|
||||||
|
{
|
||||||
|
_eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
|
||||||
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
OptionStatus = -1;
|
||||||
|
|
||||||
});
|
logger.Info("结束保存数据");
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
logger.Info($"AddDrugControlViewModel异常:{ex.Message}");
|
||||||
|
_isFinishClick = false;
|
||||||
|
AlertMsg alertMsg = new AlertMsg
|
||||||
|
{
|
||||||
|
Message = $"异常:{ex.Message}",
|
||||||
|
Type = MsgType.ERROR
|
||||||
|
};
|
||||||
|
System.Windows.Application.Current.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Send, new Action(() =>
|
||||||
|
{
|
||||||
|
_eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
|
||||||
|
}));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 取消按钮
|
// 取消按钮
|
||||||
public DelegateCommand CancleTake
|
public DelegateCommand CancleTake
|
||||||
{
|
{
|
||||||
|
@ -482,11 +570,11 @@ namespace DM_Weight.ViewModels
|
||||||
|
|
||||||
public void FindDrawerCount()
|
public void FindDrawerCount()
|
||||||
{
|
{
|
||||||
int count = SqlSugarHelper.Db.Queryable<ChannelList>().Where(cs => cs.DrawerType != 3)
|
//int count = SqlSugarHelper.Db.Queryable<ChannelList>().Where(cs => cs.DrawerType != 3)
|
||||||
.Where(cs => cs.MachineId.Equals(ConfigurationManager.AppSettings["machineId"] ?? "DM1")).GroupBy(cs => cs.DrawerNo).Select(cs => SqlFunc.AggregateCount(cs.DrawerNo)).Count();
|
// .Where(cs => cs.MachineId.Equals(ConfigurationManager.AppSettings["machineId"] ?? "DM1")).GroupBy(cs => cs.DrawerNo).Select(cs => SqlFunc.AggregateCount(cs.DrawerNo)).Count();
|
||||||
Is8Drawer = count < 9;
|
Is8Drawer = App.SingleModel; //count < 9;
|
||||||
Is16Drawer = count >= 16;
|
Is16Drawer = !App.SingleModel; //count >= 16;
|
||||||
Is17Drawer = count > 16;
|
Is17Drawer = false;//count > 16;
|
||||||
}
|
}
|
||||||
|
|
||||||
//这个方法用于拦截请求,continuationCallback(true)就是不拦截,continuationCallback(false)拦截本次操作
|
//这个方法用于拦截请求,continuationCallback(true)就是不拦截,continuationCallback(false)拦截本次操作
|
||||||
|
|
|
@ -0,0 +1,87 @@
|
||||||
|
using DM_Weight.Finger;
|
||||||
|
using DM_Weight.Port;
|
||||||
|
using Prism.Commands;
|
||||||
|
using Prism.Events;
|
||||||
|
using Prism.Mvvm;
|
||||||
|
using Prism.Regions;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Xml;
|
||||||
|
|
||||||
|
namespace DM_Weight.ViewModels
|
||||||
|
{
|
||||||
|
public class BeforeLoginViewModel : BindableBase, IRegionMemberLifetime, IConfirmNavigationRequest
|
||||||
|
{
|
||||||
|
public bool KeepAlive => false;
|
||||||
|
IRegionManager _regionManager;
|
||||||
|
IEventAggregator _eventAggregator;
|
||||||
|
public BeforeLoginViewModel(IRegionManager regionManager, IEventAggregator eventAggregator, PortUtil portUtil)
|
||||||
|
{
|
||||||
|
_regionManager = regionManager;
|
||||||
|
_eventAggregator = eventAggregator;
|
||||||
|
}
|
||||||
|
private NavigationParameters keys = new NavigationParameters();
|
||||||
|
/// <summary>
|
||||||
|
/// 值班柜柜登录
|
||||||
|
/// </summary>
|
||||||
|
public DelegateCommand DutyCommand
|
||||||
|
{
|
||||||
|
get => new DelegateCommand(() =>
|
||||||
|
{
|
||||||
|
|
||||||
|
//_loginWindowViewModel.SingleLogin = true;
|
||||||
|
//_loginWindowViewModel.MultiLogin = false;
|
||||||
|
|
||||||
|
keys.Add("SingleLogin", true);
|
||||||
|
App.SingleModel = true;
|
||||||
|
_regionManager.RequestNavigate("MainRegion", "LoginWindow",keys);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 周转柜登录
|
||||||
|
/// </summary>
|
||||||
|
public DelegateCommand OtherCommand
|
||||||
|
{
|
||||||
|
get => new DelegateCommand(() =>
|
||||||
|
{
|
||||||
|
//_loginWindowViewModel.SingleLogin = false;
|
||||||
|
//_loginWindowViewModel.MultiLogin = true;
|
||||||
|
|
||||||
|
keys.Add("SingleLogin", false);
|
||||||
|
App.SingleModel = false;
|
||||||
|
_regionManager.RequestNavigate("MainRegion", "LoginWindow", keys);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public void ConfirmNavigationRequest(NavigationContext navigationContext, Action<bool> continuationCallback)
|
||||||
|
{
|
||||||
|
continuationCallback(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool IsNavigationTarget(NavigationContext navigationContext)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void OnNavigatedFrom(NavigationContext navigationContext)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public void OnNavigatedTo(NavigationContext navigationContext)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
//手动实现调用配置的逻辑 规避修改配置文件后不起作用的问题
|
||||||
|
public string ReadAppSetting(string key)
|
||||||
|
{
|
||||||
|
string xPath = $"/configuration/appSettings//add[@key='{key}']";
|
||||||
|
XmlDocument doc = new XmlDocument();
|
||||||
|
string exeFileName = System.Reflection.Assembly.GetExecutingAssembly().GetName().Name;
|
||||||
|
doc.Load(exeFileName + ".dll.config");
|
||||||
|
XmlNode node = doc.SelectSingleNode(xPath);
|
||||||
|
return node.Attributes["value"].Value.ToString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -229,6 +229,8 @@ namespace DM_Weight.ViewModels
|
||||||
var list = SqlSugarHelper.Db.Queryable<ChannelStock>()
|
var list = SqlSugarHelper.Db.Queryable<ChannelStock>()
|
||||||
.Includes<DrugInfo>(cs => cs.DrugInfo)
|
.Includes<DrugInfo>(cs => cs.DrugInfo)
|
||||||
.WhereIF(DrawerNo > 0, cs => cs.DrawerNo == DrawerNo)
|
.WhereIF(DrawerNo > 0, cs => cs.DrawerNo == DrawerNo)
|
||||||
|
.WhereIF(App.SingleModel, cs => cs.DrawerNo <= 2) //单人登录开前8个抽屉,双人登录开后8个抽屉
|
||||||
|
.WhereIF(!(App.SingleModel), cs => cs.DrawerNo > 2)
|
||||||
.Where(cs => cs.MachineId.Equals(ConfigurationManager.AppSettings["machineId"] ?? "DM1"))
|
.Where(cs => cs.MachineId.Equals(ConfigurationManager.AppSettings["machineId"] ?? "DM1"))
|
||||||
.OrderBy(cs => cs.DrawerNo)
|
.OrderBy(cs => cs.DrawerNo)
|
||||||
.OrderBy(cs => cs.ColNo)
|
.OrderBy(cs => cs.ColNo)
|
||||||
|
@ -280,6 +282,24 @@ namespace DM_Weight.ViewModels
|
||||||
item.DrugId = DrugInfo.DrugId.ToString();
|
item.DrugId = DrugInfo.DrugId.ToString();
|
||||||
//SqlSugarHelper.Db.Updateable(item).UpdateColumns(it => new { it.DrugId, it.PosNo }).ExecuteCommand();
|
//SqlSugarHelper.Db.Updateable(item).UpdateColumns(it => new { it.DrugId, it.PosNo }).ExecuteCommand();
|
||||||
SqlSugarHelper.Db.Updateable(item).UpdateColumns(it => new { it.DrugId, it.PosNo }).ExecuteCommand();
|
SqlSugarHelper.Db.Updateable(item).UpdateColumns(it => new { it.DrugId, it.PosNo }).ExecuteCommand();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//插入channel_stock表数据
|
||||||
|
SqlSugarHelper.Db.Insertable(new ChannelStock()
|
||||||
|
{
|
||||||
|
Quantity = 0,
|
||||||
|
Chnguid = item.Chnguid,
|
||||||
|
DrawerNo = item.DrawerNo,
|
||||||
|
ColNo = item.ColNo,
|
||||||
|
DrugId = item.DrugId,
|
||||||
|
DrawerType = item.DrawerType,
|
||||||
|
BoardType = item.BoardType,
|
||||||
|
Id = Guid.NewGuid().ToString(),
|
||||||
|
MachineId = ConfigurationManager.AppSettings["machineId"] ?? "DM1"
|
||||||
|
}).ExecuteCommand();
|
||||||
|
|
||||||
|
|
||||||
GetChannelsByDrawerNo();
|
GetChannelsByDrawerNo();
|
||||||
|
|
||||||
if (item.BoardType == 5)
|
if (item.BoardType == 5)
|
||||||
|
@ -292,10 +312,10 @@ namespace DM_Weight.ViewModels
|
||||||
await Task.Delay(200);
|
await Task.Delay(200);
|
||||||
_portUtil.WriteChannelInfo(8, DrugInfo.Manufactory, item.DrawerNo, item.ColNo);
|
_portUtil.WriteChannelInfo(8, DrugInfo.Manufactory, item.DrawerNo, item.ColNo);
|
||||||
await Task.Delay(200);
|
await Task.Delay(200);
|
||||||
_portUtil.WriteChannelInfo(6, DrugManuNo.EffDate == null ? "" : DrugManuNo.EffDate, item.DrawerNo, item.ColNo);
|
//_portUtil.WriteChannelInfo(6, DrugManuNo.EffDate == null ? "" : DrugManuNo.EffDate, item.DrawerNo, item.ColNo);
|
||||||
await Task.Delay(200);
|
//await Task.Delay(200);
|
||||||
_portUtil.WriteChannelInfo(5, DrugManuNo.ManuNo, item.DrawerNo, item.ColNo);
|
//_portUtil.WriteChannelInfo(5, DrugManuNo.ManuNo, item.DrawerNo, item.ColNo);
|
||||||
await Task.Delay(200);
|
//await Task.Delay(200);
|
||||||
_portUtil.ShowContent(item.DrawerNo, item.ColNo);
|
_portUtil.ShowContent(item.DrawerNo, item.ColNo);
|
||||||
}
|
}
|
||||||
//_screenUtil.SetStockInfo(item, 1);
|
//_screenUtil.SetStockInfo(item, 1);
|
||||||
|
@ -462,6 +482,7 @@ namespace DM_Weight.ViewModels
|
||||||
item.DrugInfo = null;
|
item.DrugInfo = null;
|
||||||
//SqlSugarHelper.Db.Updateable(item).UpdateColumns(it => new { it.DrugId, it.ManuNo, it.EffDate }).ExecuteCommand();
|
//SqlSugarHelper.Db.Updateable(item).UpdateColumns(it => new { it.DrugId, it.ManuNo, it.EffDate }).ExecuteCommand();
|
||||||
SqlSugarHelper.Db.Updateable(item).UpdateColumns(it => new { it.DrugId, it.ManuNo, it.EffDate }).ExecuteCommand();
|
SqlSugarHelper.Db.Updateable(item).UpdateColumns(it => new { it.DrugId, it.ManuNo, it.EffDate }).ExecuteCommand();
|
||||||
|
SqlSugarHelper.Db.Updateable<ChannelStock>().SetColumns(it => new ChannelStock { DrugId = null, ManuNo = null, EffDate = null }).Where(it => it.Chnguid == item.Id).ExecuteCommand();
|
||||||
if (item.BoardType == 5)
|
if (item.BoardType == 5)
|
||||||
{
|
{
|
||||||
// 清除显示屏库位信息
|
// 清除显示屏库位信息
|
||||||
|
|
|
@ -19,6 +19,9 @@ using DM_Weight.util;
|
||||||
using log4net;
|
using log4net;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Reflection.Metadata.Ecma335;
|
using System.Reflection.Metadata.Ecma335;
|
||||||
|
using System.Windows.Threading;
|
||||||
|
using System.Windows;
|
||||||
|
using System.Reflection.PortableExecutable;
|
||||||
|
|
||||||
namespace DM_Weight.ViewModels
|
namespace DM_Weight.ViewModels
|
||||||
{
|
{
|
||||||
|
@ -139,7 +142,7 @@ namespace DM_Weight.ViewModels
|
||||||
public void UpdateComboBoxItems(string text)
|
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,
|
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))
|
if (string.IsNullOrEmpty(text))
|
||||||
{
|
{
|
||||||
DrugInfos = SqlSugarHelper.Db.SqlQueryable<DrugInfo>(str).OrderBy(di => di.DrugName).OrderBy(di => di.DrugId).ToList();
|
DrugInfos = SqlSugarHelper.Db.SqlQueryable<DrugInfo>(str).OrderBy(di => di.DrugName).OrderBy(di => di.DrugId).ToList();
|
||||||
|
@ -218,7 +221,15 @@ namespace DM_Weight.ViewModels
|
||||||
SetProperty(ref _pageSize, value);
|
SetProperty(ref _pageSize, value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 渲染标签状态
|
||||||
|
/// </summary>
|
||||||
|
private bool _status = false;
|
||||||
|
public bool Status
|
||||||
|
{
|
||||||
|
get => _status;
|
||||||
|
set => SetProperty(ref _status, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public bool CanCloseDialog()
|
public bool CanCloseDialog()
|
||||||
|
@ -236,7 +247,7 @@ namespace DM_Weight.ViewModels
|
||||||
//var list = SqlSugarHelper.Db.Queryable<DrugInfo>().Includes<DrugManuNo>(di => di.DrugManuNos).OrderBy(di => di.DrugId).ToList();
|
//var list = SqlSugarHelper.Db.Queryable<DrugInfo>().Includes<DrugManuNo>(di => di.DrugManuNos).OrderBy(di => di.DrugId).ToList();
|
||||||
//DrugInfos = list;
|
//DrugInfos = list;
|
||||||
//DrugInfos_PY = 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)as drug_name_spec FROM `drug_info` d";
|
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();
|
DrugInfos = SqlSugarHelper.Db.SqlQueryable<DrugInfo>(str).OrderBy(di => di.DrugName).OrderBy(di => di.DrugId).ToList();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -247,17 +258,19 @@ namespace DM_Weight.ViewModels
|
||||||
int totalCount = 0;
|
int totalCount = 0;
|
||||||
var list = SqlSugarHelper.Db.Queryable<ChannelList>()
|
var list = SqlSugarHelper.Db.Queryable<ChannelList>()
|
||||||
.Includes<DrugInfo>(cl => cl.Drug)
|
.Includes<DrugInfo>(cl => cl.Drug)
|
||||||
|
.WhereIF(App.SingleModel, cl => cl.DrawerNo <= 2) //单人登录开前8个抽屉,双人登录开后8个抽屉
|
||||||
|
.WhereIF(!(App.SingleModel), cl => cl.DrawerNo > 2)
|
||||||
.Includes<ChannelStock>(cs => cs.channelStocks)
|
.Includes<ChannelStock>(cs => cs.channelStocks)
|
||||||
.WhereIF(DrawerNo > 0, cl => cl.DrawerNo == DrawerNo)
|
.WhereIF(DrawerNo > 0, cl => cl.DrawerNo == DrawerNo)
|
||||||
.Where(cl => cl.MachineId.Equals(ConfigurationManager.AppSettings["machineId"] ?? "DM1"))
|
.Where(cl => cl.MachineId.Equals(ConfigurationManager.AppSettings["machineId"] ?? "DM1"))
|
||||||
.OrderBy(cl => cl.DrawerNo)
|
.OrderBy(cl => cl.DrawerNo)
|
||||||
.OrderBy(cl => cl.ColNo)
|
.OrderBy(cl => cl.ColNo)
|
||||||
.ToPageList(PageNum, PageSize, ref totalCount);
|
.ToPageList(PageNum, PageSize, ref totalCount);
|
||||||
if(list!=null&&list.Count>0)
|
if (list != null && list.Count > 0)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < list.Count; i++)
|
for (int i = 0; i < list.Count; i++)
|
||||||
{
|
{
|
||||||
if(list[i].channelStocks!=null&& list[i].channelStocks.Count>0)
|
if (list[i].channelStocks != null && list[i].channelStocks.Count > 0)
|
||||||
{
|
{
|
||||||
for (int j = 0; j < list[i].channelStocks.Count; j++)
|
for (int j = 0; j < list[i].channelStocks.Count; j++)
|
||||||
{
|
{
|
||||||
|
@ -312,6 +325,23 @@ namespace DM_Weight.ViewModels
|
||||||
}
|
}
|
||||||
item.DrugId = DrugInfo.DrugId.ToString();
|
item.DrugId = DrugInfo.DrugId.ToString();
|
||||||
SqlSugarHelper.Db.Updateable(item).UpdateColumns(it => new { it.DrugId, it.PosNo }).ExecuteCommand();
|
SqlSugarHelper.Db.Updateable(item).UpdateColumns(it => new { it.DrugId, it.PosNo }).ExecuteCommand();
|
||||||
|
|
||||||
|
int deleteNum = SqlSugarHelper.Db.Deleteable<ChannelStock>()
|
||||||
|
.Where(cs => cs.Chnguid.Equals(item.Id) && cs.MachineId.Equals(ConfigurationManager.AppSettings["machineId"])).ExecuteCommand();
|
||||||
|
//插入channel_stock表数据
|
||||||
|
SqlSugarHelper.Db.Insertable(new ChannelStock()
|
||||||
|
{
|
||||||
|
Quantity = 0,
|
||||||
|
Chnguid = item.Id,
|
||||||
|
DrawerNo = item.DrawerNo,
|
||||||
|
ColNo = item.ColNo,
|
||||||
|
DrugId = item.DrugId,
|
||||||
|
DrawerType = item.DrawerType,
|
||||||
|
BoardType = item.BoardType,
|
||||||
|
Id = Guid.NewGuid().ToString(),
|
||||||
|
MachineId = ConfigurationManager.AppSettings["machineId"] ?? "DM1"
|
||||||
|
}).ExecuteCommand();
|
||||||
|
|
||||||
GetChannelsByDrawerNo();
|
GetChannelsByDrawerNo();
|
||||||
|
|
||||||
if (item.BoardType == 5)
|
if (item.BoardType == 5)
|
||||||
|
@ -322,7 +352,7 @@ namespace DM_Weight.ViewModels
|
||||||
await Task.Delay(200);
|
await Task.Delay(200);
|
||||||
_portUtil.WriteChannelInfo(2, DrugInfo.DrugSpec, item.DrawerNo, item.ColNo);
|
_portUtil.WriteChannelInfo(2, DrugInfo.DrugSpec, item.DrawerNo, item.ColNo);
|
||||||
await Task.Delay(200);
|
await Task.Delay(200);
|
||||||
_portUtil.WriteChannelInfo(8, DrugInfo.Manufactory.Length>10? DrugInfo.Manufactory.Substring(0, 10): DrugInfo.Manufactory, item.DrawerNo, item.ColNo);
|
_portUtil.WriteChannelInfo(8, DrugInfo.Manufactory.Length > 10 ? DrugInfo.Manufactory.Substring(0, 10) : DrugInfo.Manufactory, item.DrawerNo, item.ColNo);
|
||||||
await Task.Delay(200);
|
await Task.Delay(200);
|
||||||
//_portUtil.WriteChannelInfo(6, DrugManuNo.EffDate==null?"": DrugManuNo.EffDate, item.DrawerNo, item.ColNo);
|
//_portUtil.WriteChannelInfo(6, DrugManuNo.EffDate==null?"": DrugManuNo.EffDate, item.DrawerNo, item.ColNo);
|
||||||
//await Task.Delay(200);
|
//await Task.Delay(200);
|
||||||
|
@ -360,7 +390,7 @@ namespace DM_Weight.ViewModels
|
||||||
|
|
||||||
if (c > 0)
|
if (c > 0)
|
||||||
{
|
{
|
||||||
if(c>1)
|
if (c > 1)
|
||||||
{
|
{
|
||||||
SnackbarBackground = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#b71c1c"));
|
SnackbarBackground = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#b71c1c"));
|
||||||
SnackbarMessageQueue.Enqueue("同一药品不可绑多个库位");
|
SnackbarMessageQueue.Enqueue("同一药品不可绑多个库位");
|
||||||
|
@ -390,7 +420,7 @@ namespace DM_Weight.ViewModels
|
||||||
.Where(cs => cs.DrugId.Equals(DrugInfo.DrugId.ToString()))
|
.Where(cs => cs.DrugId.Equals(DrugInfo.DrugId.ToString()))
|
||||||
.Where(cs => cs.DrawerType == 1)
|
.Where(cs => cs.DrawerType == 1)
|
||||||
.Where(cs => cs.MachineId.Equals(ConfigurationManager.AppSettings["machineId"] ?? "DM1"))
|
.Where(cs => cs.MachineId.Equals(ConfigurationManager.AppSettings["machineId"] ?? "DM1"))
|
||||||
.Where(cs => cs.DrawerNo == item.DrawerNo)
|
.Where(cs => cs.DrawerNo == item.DrawerNo&&cs.ColNo==item.ColNo)
|
||||||
.Count();
|
.Count();
|
||||||
|
|
||||||
if (count > 0)
|
if (count > 0)
|
||||||
|
@ -399,8 +429,8 @@ namespace DM_Weight.ViewModels
|
||||||
SnackbarMessageQueue.Enqueue("该药品已绑定库位,不可绑定多个库位");
|
SnackbarMessageQueue.Enqueue("该药品已绑定库位,不可绑定多个库位");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var channelStock = SqlSugarHelper.Db.Queryable<ChannelStock>().Where(cs => cs.Chnguid == item.Id&&cs.Quantity>0).ToList();
|
var channelStock = SqlSugarHelper.Db.Queryable<ChannelStock>().Where(cs => cs.Chnguid == item.Id && cs.Quantity > 0).ToList();
|
||||||
if(channelStock.Count>0)
|
if (channelStock.Count > 0)
|
||||||
{
|
{
|
||||||
//有库存,不能解绑
|
//有库存,不能解绑
|
||||||
|
|
||||||
|
@ -485,7 +515,7 @@ namespace DM_Weight.ViewModels
|
||||||
//item.EffDate = null;
|
//item.EffDate = null;
|
||||||
item.Drug = null;
|
item.Drug = null;
|
||||||
SqlSugarHelper.Db.Updateable(item).UpdateColumns(it => new { it.DrugId }).ExecuteCommand();
|
SqlSugarHelper.Db.Updateable(item).UpdateColumns(it => new { it.DrugId }).ExecuteCommand();
|
||||||
SqlSugarHelper.Db.Updateable<ChannelStock>().SetColumns(it =>new ChannelStock { DrugId = null, ManuNo = null, EffDate = null} ).Where(it=>it.Chnguid==item.Id).ExecuteCommand();
|
SqlSugarHelper.Db.Updateable<ChannelStock>().SetColumns(it => new ChannelStock { DrugId = null, ManuNo = null, EffDate = null }).Where(it => it.Chnguid == item.Id).ExecuteCommand();
|
||||||
if (item.BoardType == 5)
|
if (item.BoardType == 5)
|
||||||
{
|
{
|
||||||
// 清除显示屏库位信息
|
// 清除显示屏库位信息
|
||||||
|
@ -505,7 +535,90 @@ namespace DM_Weight.ViewModels
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 渲染标签
|
||||||
|
/// </summary>
|
||||||
|
public DelegateCommand ResetLabelCommand
|
||||||
|
{
|
||||||
|
get => new DelegateCommand(ResetLabelMethod, () => Status == false);
|
||||||
|
}
|
||||||
|
private void ResetLabelMethod()
|
||||||
|
{
|
||||||
|
if (Channels != null)
|
||||||
|
{
|
||||||
|
Task t = new Task(() =>
|
||||||
|
{
|
||||||
|
var SelectChannels = Channels.FindAll(item => item.IsSelected && item.BoardType == 5);
|
||||||
|
var c = SelectChannels.Count;
|
||||||
|
if (c > 0)
|
||||||
|
{
|
||||||
|
Status = true;
|
||||||
|
SelectChannels.ForEach(item =>
|
||||||
|
{
|
||||||
|
if (item.DrugId == null)
|
||||||
|
{
|
||||||
|
// 清除显示屏库位信息
|
||||||
|
_portUtil.ClearContent(item.DrawerNo, item.ColNo);
|
||||||
|
Thread.Sleep(200);
|
||||||
|
_portUtil.ShowContent(item.DrawerNo, item.ColNo);
|
||||||
|
Thread.Sleep(200);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//查询绑定库位的最近效期绑定到标签
|
||||||
|
ChannelStock cs = SqlSugarHelper.Db.Queryable<ChannelStock>().Where(cs => cs.MachineId.Equals(ConfigurationManager.AppSettings["machineId"] ?? "DM1") &&cs.DrawerNo == item.DrawerNo && cs.ColNo == item.ColNo&&cs.Quantity>0).OrderBy(cs => cs.EffDate).First();
|
||||||
|
DrugInfo drugSelected = item.Drug ?? new DrugInfo();
|
||||||
|
_portUtil.WindowName = "BindingChannelDialog";
|
||||||
|
// 向显示屏写入库位信息
|
||||||
|
_portUtil.WriteChannelInfo(1, drugSelected.DrugName ?? "", item.DrawerNo, item.ColNo);
|
||||||
|
Thread.Sleep(200);
|
||||||
|
_portUtil.WriteChannelInfo(2, drugSelected.DrugSpec ?? "", item.DrawerNo, item.ColNo);
|
||||||
|
Thread.Sleep(200);
|
||||||
|
_portUtil.WriteChannelInfo(8, drugSelected.Manufactory == null ? "" : drugSelected.Manufactory.Length > 10 ? drugSelected.Manufactory.Substring(0, 10) : drugSelected.Manufactory, item.DrawerNo, item.ColNo);
|
||||||
|
Thread.Sleep(200);
|
||||||
|
_portUtil.WriteChannelInfo(5, (cs==null||cs.EffDate == null) ? "" : cs.EffDate, item.DrawerNo, item.ColNo);
|
||||||
|
Thread.Sleep(200);
|
||||||
|
_portUtil.WriteChannelInfo(6, (cs == null || cs.ManuNo == null) ? "" : cs.ManuNo, item.DrawerNo, item.ColNo);
|
||||||
|
Thread.Sleep(200);
|
||||||
|
_portUtil.ShowContent(item.DrawerNo, item.ColNo);
|
||||||
|
Thread.Sleep(200);
|
||||||
|
_portUtil.WriteQuantity(item.DrawerNo, item.ColNo, item.totalCount);
|
||||||
|
Thread.Sleep(200);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Application.Current.Dispatcher.Invoke(() =>
|
||||||
|
{
|
||||||
|
SnackbarBackground = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#b71c1c"));
|
||||||
|
SnackbarMessageQueue.Enqueue("未选择库位或所选库位无标签");
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
t.Start();
|
||||||
|
t.ContinueWith(task =>
|
||||||
|
{
|
||||||
|
if (Status.Equals(true))
|
||||||
|
{
|
||||||
|
Status = false;
|
||||||
|
Application.Current.Dispatcher.Invoke(() =>
|
||||||
|
{
|
||||||
|
|
||||||
|
SnackbarBackground = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#00e676"));
|
||||||
|
SnackbarMessageQueue.Enqueue("操作完成!");
|
||||||
|
GetChannelsByDrawerNo();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//static Task TaskSleep()
|
||||||
|
//{
|
||||||
|
// //await Task.Delay(200);
|
||||||
|
// Thread.Sleep(200);
|
||||||
|
//}
|
||||||
public DelegateCommand BtnCloseCommand
|
public DelegateCommand BtnCloseCommand
|
||||||
{
|
{
|
||||||
get => new DelegateCommand(() =>
|
get => new DelegateCommand(() =>
|
|
@ -213,25 +213,32 @@ namespace DM_Weight.ViewModels
|
||||||
}).ExecuteCommand();
|
}).ExecuteCommand();
|
||||||
|
|
||||||
//插入交接班报表数据信息
|
//插入交接班报表数据信息
|
||||||
string strSql = @"SELECT drug.drug_name,drug.DRUG_SPEC,c.manu_no,d.useNum,d.getNum,sum(quantity) as surplus,
|
//string strSql = @"SELECT drug.drug_name,drug.DRUG_SPEC,c.manu_no,d.useNum,d.getNum,sum(quantity) as surplus,
|
||||||
(SELECT d2.manunoquantity FROM dm_machine_record d2 WHERE d2.drug_id = c.`drug_id` and d2.manu_no=c.manu_no AND d2.operation_time < @beforeDate
|
// (SELECT d2.manunoquantity FROM dm_machine_record d2 WHERE d2.drug_id = c.`drug_id` and d2.manu_no=c.manu_no AND d2.operation_time < @beforeDate
|
||||||
ORDER BY d2.operation_time DESC,d2.id DESC LIMIT 1) AS beforeNum
|
// ORDER BY d2.operation_time 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,
|
// 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
|
// 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
|
// 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
|
// 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
|
// UNION
|
||||||
SELECT drug.drug_name,drug.DRUG_SPEC,d.manu_no,d.useNum,d.getNum,sum(quantity) as surplus,(SELECT d2.manunoquantity FROM dm_machine_record d2 WHERE d2.drug_id = d.`drug_id` and d2.manu_no=d.manu_no AND d2.operation_time < @beforeDate
|
// SELECT drug.drug_name,drug.DRUG_SPEC,d.manu_no,d.useNum,d.getNum,sum(quantity) as surplus,(SELECT d2.manunoquantity FROM dm_machine_record d2 WHERE d2.drug_id = d.`drug_id` and d2.manu_no=d.manu_no AND d2.operation_time < @beforeDate
|
||||||
ORDER BY d2.operation_time 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
|
// ORDER BY d2.operation_time 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
|
// 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 ";
|
// 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 ";
|
||||||
|
|
||||||
|
|
||||||
|
//交接班表里只显示值班柜(row_no:1,2)的不显示周转柜
|
||||||
|
string strSql = @"SELECT di.drug_name as DrugName,di.drug_spec as DrugSpec,di.small_unit as pack_unit,sum(if(cs.drawer_type=1,cs.quantity,0)) stockQuantity,
|
||||||
|
sum(if(cs.drawer_type=2,cs.quantity,0)) EmptyQuantity FROM channel_stock cs inner join drug_info di on cs.drug_id=di.drug_id
|
||||||
|
WHERE (row_no in(1,2) or drawer_type=2) and machine_id =@machineId GROUP BY cs.drug_id ORDER BY cs.Drug_ID";
|
||||||
|
|
||||||
List<ShiftsReport> shiftsReports = SqlSugarHelper.Db.SqlQueryable<dynamic>(strSql)
|
List<ShiftsReport> shiftsReports = SqlSugarHelper.Db.SqlQueryable<dynamic>(strSql)
|
||||||
.AddParameters(new
|
.AddParameters(new
|
||||||
{
|
{
|
||||||
machineId = ConfigurationManager.AppSettings["machineId"] ?? "DM1",
|
machineId = ConfigurationManager.AppSettings["machineId"] ?? "DM1",
|
||||||
beforeDate = listHkcChangeShifts[0].OptDate,
|
//beforeDate = listHkcChangeShifts[0].OptDate,
|
||||||
startDate = listHkcChangeShifts[0].OptDate,
|
//startDate = listHkcChangeShifts[0].OptDate,
|
||||||
endDate = dt
|
//endDate = dt
|
||||||
})
|
})
|
||||||
.Select(it => new ShiftsReport())
|
.Select(it => new ShiftsReport())
|
||||||
.ToList();
|
.ToList();
|
||||||
|
@ -245,11 +252,14 @@ namespace DM_Weight.ViewModels
|
||||||
OptDate = dt,
|
OptDate = dt,
|
||||||
DrugName = shiftsReports[i].DrugName,
|
DrugName = shiftsReports[i].DrugName,
|
||||||
DrugSpec = shiftsReports[i].DrugSpec,
|
DrugSpec = shiftsReports[i].DrugSpec,
|
||||||
BeforeNum = shiftsReports[i].BeforeNum ?? 0,
|
PackdUnit= shiftsReports[i].PackdUnit,
|
||||||
GetNum = shiftsReports[i].GetNum ?? 0,
|
StockQuantity= shiftsReports[i].StockQuantity,
|
||||||
UseNum = shiftsReports[i].UseNum ?? 0,
|
EmptyQuantity= shiftsReports[i].EmptyQuantity,
|
||||||
ManuNo = shiftsReports[i].ManuNo,
|
//BeforeNum = shiftsReports[i].BeforeNum ?? 0,
|
||||||
Surplus = shiftsReports[i].Surplus ?? 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,
|
FromOperator = Operator == null ? "" : Operator.Nickname,
|
||||||
FromReviewer = Reviewer == null ? "" : Reviewer.Nickname,
|
FromReviewer = Reviewer == null ? "" : Reviewer.Nickname,
|
||||||
ToOperator = JieOperator == null ? "" : JieOperator.Nickname,
|
ToOperator = JieOperator == null ? "" : JieOperator.Nickname,
|
||||||
|
@ -642,7 +652,7 @@ namespace DM_Weight.ViewModels
|
||||||
private HkcChangeShifts GetOperator()
|
private HkcChangeShifts GetOperator()
|
||||||
{
|
{
|
||||||
//查询发药人及审核人
|
//查询发药人及审核人
|
||||||
HkcChangeShifts changeOperator = SqlSugarHelper.Db.Queryable<HkcChangeShifts>().Single(change => change.State == "0");
|
HkcChangeShifts changeOperator = SqlSugarHelper.Db.Queryable<HkcChangeShifts>().Single(change => change.Machineid==(ConfigurationManager.AppSettings["machineId"] ?? "DM1") &&change.State == "0");
|
||||||
//if (changeOperator != null)
|
//if (changeOperator != null)
|
||||||
//{
|
//{
|
||||||
// Operator = SqlSugarHelper.Db.Queryable<UserList>().Single(u => u.UserName == changeOperator.FromOperator);
|
// Operator = SqlSugarHelper.Db.Queryable<UserList>().Single(u => u.UserName == changeOperator.FromOperator);
|
||||||
|
|
|
@ -158,7 +158,10 @@ namespace DM_Weight.ViewModels
|
||||||
//strSql += " GROUP BY C.optdate,Drug_id ORDER BY C.OPTDATE DESC";
|
//strSql += " GROUP BY C.optdate,Drug_id ORDER BY C.OPTDATE DESC";
|
||||||
List<CheckRecordStock> checkList = SqlSugarHelper.Db.Queryable<CheckRecordStock>()
|
List<CheckRecordStock> checkList = SqlSugarHelper.Db.Queryable<CheckRecordStock>()
|
||||||
.Includes<DrugInfo>(cs => cs.DrugInfo)
|
.Includes<DrugInfo>(cs => cs.DrugInfo)
|
||||||
.Where(cs => cs.optdate == OptDate).OrderByDescending(cs => cs.optdate).ToList();
|
.Where(cs => cs.optdate == OptDate).OrderByDescending(cs => cs.optdate)
|
||||||
|
.WhereIF(App.SingleModel, cs => cs.rowNo <= 2) //单人登录开前2个抽屉,双人登录开后14个抽屉
|
||||||
|
.WhereIF(!(App.SingleModel), cs => cs.rowNo > 2)
|
||||||
|
.ToList();
|
||||||
ICollectionView vw = CollectionViewSource.GetDefaultView(checkList);
|
ICollectionView vw = CollectionViewSource.GetDefaultView(checkList);
|
||||||
vw.GroupDescriptions.Add(new PropertyGroupDescription("DrugInfo"));
|
vw.GroupDescriptions.Add(new PropertyGroupDescription("DrugInfo"));
|
||||||
obsCheckRecordStock = new ObservableCollection<CheckRecordStock>(checkList);
|
obsCheckRecordStock = new ObservableCollection<CheckRecordStock>(checkList);
|
||||||
|
|
|
@ -12,6 +12,7 @@ using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Collections.ObjectModel;
|
using System.Collections.ObjectModel;
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
|
using System.Configuration;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
@ -144,8 +145,8 @@ namespace DM_Weight.ViewModels
|
||||||
{
|
{
|
||||||
int totalCount = 0;
|
int totalCount = 0;
|
||||||
string strSql = @"SELECT optDate AS optdate,U.User_name AS operatorUser,R.User_name AS reviewerUser,Drug_spec AS drugSpec,Manufactory AS manufactory,Quantity FROM check_stock C
|
string strSql = @"SELECT optDate AS optdate,U.User_name AS operatorUser,R.User_name AS reviewerUser,Drug_spec AS drugSpec,Manufactory AS manufactory,Quantity FROM check_stock C
|
||||||
LEFT JOIN user_list U ON C.operator=U.ID LEFT JOIN user_list R ON C.reviewer=R.ID WHERE 1=1";
|
LEFT JOIN user_list U ON C.operator=U.ID LEFT JOIN user_list R ON C.reviewer=R.ID WHERE C.machine_id='" + (ConfigurationManager.AppSettings["machineId"] ?? "DM1") + "'";
|
||||||
if(StartDate!=null)
|
if (StartDate!=null)
|
||||||
{
|
{
|
||||||
strSql += " AND C.optDate>@OPTSTARTDATE ";
|
strSql += " AND C.optDate>@OPTSTARTDATE ";
|
||||||
}
|
}
|
||||||
|
|
|
@ -277,8 +277,14 @@ namespace DM_Weight.ViewModels
|
||||||
List<ChannelStock> channelStocks = grouping.ToList();
|
List<ChannelStock> channelStocks = grouping.ToList();
|
||||||
channelStocks.ForEach(it => it.process = 1);
|
channelStocks.ForEach(it => it.process = 1);
|
||||||
_portUtil.SpeakAsync("正在打开" + DrawerNo + "号抽屉");
|
_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);
|
||||||
|
}
|
||||||
|
|
||||||
List<ChannelStock> singleChannels = channelStocks.GroupBy(it => new
|
singleChannels = singleChannels.GroupBy(it => new
|
||||||
{
|
{
|
||||||
it.DrawerNo,
|
it.DrawerNo,
|
||||||
it.ColNo
|
it.ColNo
|
||||||
|
@ -380,7 +386,7 @@ namespace DM_Weight.ViewModels
|
||||||
|
|
||||||
string machine_id = (ConfigurationManager.AppSettings["machineId"] ?? "DM1");
|
string machine_id = (ConfigurationManager.AppSettings["machineId"] ?? "DM1");
|
||||||
string strSql = $@"SELECT cl.`row_no` AS rowNo,cl.`col_no` AS colNo,cl.`quantity` AS quantity,cl.`manu_no` AS manuNo,cl.`eff_date` AS effDate,
|
string strSql = $@"SELECT cl.`row_no` AS rowNo,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` maxStock,
|
di.`drug_name` AS drugName,di.`drug_spec` AS drugSpec,di.`small_unit` AS packUnit,di.`manufactory` AS manufactory,di.`max_stock` maxStock,
|
||||||
cl.`drug_id` AS drugId,cl.`machine_id` AS MachineId 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`";
|
cl.`drug_id` AS drugId,cl.`machine_id` AS MachineId 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`";
|
||||||
List<CheckRecordStock> checkRecordStockList = SqlSugarHelper.Db.SqlQueryable<dynamic>(strSql)
|
List<CheckRecordStock> checkRecordStockList = SqlSugarHelper.Db.SqlQueryable<dynamic>(strSql)
|
||||||
.AddParameters(new
|
.AddParameters(new
|
||||||
|
@ -453,7 +459,7 @@ namespace DM_Weight.ViewModels
|
||||||
{
|
{
|
||||||
// 将库位多批次的总库存数更新标签
|
// 将库位多批次的总库存数更新标签
|
||||||
_portUtil.WriteQuantity(it.DrawerNo, it.ColNo, it.CheckQuantity);
|
_portUtil.WriteQuantity(it.DrawerNo, it.ColNo, it.CheckQuantity);
|
||||||
|
Thread.Sleep(200);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -568,7 +574,8 @@ namespace DM_Weight.ViewModels
|
||||||
.Where(cs => cs.DrawerType == 1)
|
.Where(cs => cs.DrawerType == 1)
|
||||||
.Where(cs => cs.DrugId != null)
|
.Where(cs => cs.DrugId != null)
|
||||||
.Where(cs => cs.MachineId.Equals(ConfigurationManager.AppSettings["machineId"] ?? "DM1"))
|
.Where(cs => cs.MachineId.Equals(ConfigurationManager.AppSettings["machineId"] ?? "DM1"))
|
||||||
|
.WhereIF(App.SingleModel, cs => cs.DrawerNo <= 2) //单人登录开前8个抽屉,双人登录开后8个抽屉
|
||||||
|
.WhereIF(!(App.SingleModel), cs => cs.DrawerNo > 2)
|
||||||
.WhereIF(!String.IsNullOrEmpty(SearchValue), cs => cs.DrugInfo.DrugName == SearchValue)
|
.WhereIF(!String.IsNullOrEmpty(SearchValue), cs => cs.DrugInfo.DrugName == SearchValue)
|
||||||
.OrderBy(cs => cs.DrawerNo)
|
.OrderBy(cs => cs.DrawerNo)
|
||||||
.OrderBy(cs => cs.ColNo)
|
.OrderBy(cs => cs.ColNo)
|
||||||
|
|
|
@ -26,8 +26,36 @@ namespace DM_Weight.ViewModels
|
||||||
{
|
{
|
||||||
public class CheckStockNewWindowViewModel : BindableBase, IConfirmNavigationRequest, IRegionMemberLifetime
|
public class CheckStockNewWindowViewModel : BindableBase, IConfirmNavigationRequest, IRegionMemberLifetime
|
||||||
{
|
{
|
||||||
|
public static List<UseFor> SelectUseList = new()
|
||||||
|
{
|
||||||
|
|
||||||
|
new UseFor{UseId=0,UseName="不入账册"},
|
||||||
|
new UseFor { UseId = 96, UseName = "入账册" }
|
||||||
|
};
|
||||||
|
private List<UseFor> _selectsUseFor = SelectUseList;
|
||||||
|
|
||||||
|
public List<UseFor> SelectsUseFor
|
||||||
|
{
|
||||||
|
get { return _selectsUseFor; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
SetProperty(ref _selectsUseFor, value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private UseFor _selectedItemUseFor = SelectUseList[0];
|
||||||
|
/// <summary>
|
||||||
|
/// 取药或加药用途字段
|
||||||
|
/// </summary>
|
||||||
|
public UseFor SelectedItemUseFor
|
||||||
|
{
|
||||||
|
get { return _selectedItemUseFor; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
SetProperty(ref _selectedItemUseFor, value);
|
||||||
|
}
|
||||||
|
}
|
||||||
//public static CheckStockNewWindowViewModel vm;
|
//public static CheckStockNewWindowViewModel vm;
|
||||||
private readonly ILog logger = LogManager.GetLogger(typeof(CheckStockWindowViewModel));
|
private readonly ILog logger = LogManager.GetLogger(typeof(CheckStockNewWindowViewModel));
|
||||||
public string drugId;
|
public string drugId;
|
||||||
//public string Stock;
|
//public string Stock;
|
||||||
private static readonly DateTime Jan1st1970 = new DateTime
|
private static readonly DateTime Jan1st1970 = new DateTime
|
||||||
|
@ -170,8 +198,8 @@ namespace DM_Weight.ViewModels
|
||||||
|
|
||||||
if (msg.WindowName == "CheckStockNewWindow")
|
if (msg.WindowName == "CheckStockNewWindow")
|
||||||
{
|
{
|
||||||
IGrouping<string, ChannelStock> grouping = enumerator.Current;
|
IGrouping<int, ChannelStock> grouping = enumerator.Current;
|
||||||
int DrawerNo =Convert.ToInt32(grouping.Key.Substring(0, grouping.Key.IndexOf('-')));
|
int DrawerNo = grouping.Key;// Convert.ToInt32(grouping.Key.Substring(0, grouping.Key.IndexOf('-')));
|
||||||
List<ChannelStock> channelStocks = grouping.ToList();
|
List<ChannelStock> channelStocks = grouping.ToList();
|
||||||
|
|
||||||
switch (msg.EventType)
|
switch (msg.EventType)
|
||||||
|
@ -198,34 +226,36 @@ namespace DM_Weight.ViewModels
|
||||||
{
|
{
|
||||||
channelStocks.ForEach(it => it.process = 3);
|
channelStocks.ForEach(it => it.process = 3);
|
||||||
}
|
}
|
||||||
IGrouping<string, ChannelStock> groupingBefore = enumerator.Current;
|
IGrouping<int, ChannelStock> groupingBefore = enumerator.Current;
|
||||||
int DrawerNoBefore = Convert.ToInt32(groupingBefore.Key.Substring(0, groupingBefore.Key.IndexOf('-')));
|
int DrawerNoBefore = groupingBefore.Key; //Convert.ToInt32(groupingBefore.Key.Substring(0, groupingBefore.Key.IndexOf('-')));
|
||||||
if (enumerator.MoveNext())
|
if (enumerator.MoveNext())
|
||||||
{
|
{
|
||||||
IGrouping<string, ChannelStock> groupingAfter = enumerator.Current;
|
IGrouping<int, ChannelStock> groupingAfter = enumerator.Current;
|
||||||
int DrawerNoAfter = Convert.ToInt32(groupingAfter.Key.Substring(0, groupingAfter.Key.IndexOf('-')));
|
int DrawerNoAfter = groupingAfter.Key;//Convert.ToInt32(groupingAfter.Key.Substring(0, groupingAfter.Key.IndexOf('-')));
|
||||||
//if (DrawerNoBefore < 9 && DrawerNoAfter > 8)
|
//if (DrawerNoBefore < 9 && DrawerNoAfter > 8)
|
||||||
//{
|
//{
|
||||||
// Thread.Sleep(50);
|
// Thread.Sleep(50);
|
||||||
//}
|
//}
|
||||||
|
|
||||||
logger.Info($"抽屉号DrawerNoBefore【{DrawerNoBefore}】抽屉号DrawerNoAfter【{DrawerNoAfter}】");
|
logger.Info($"抽屉号DrawerNoBefore【{DrawerNoBefore}】抽屉号DrawerNoAfter【{DrawerNoAfter}】");
|
||||||
if (DrawerNoAfter == 17)
|
if (DrawerNoAfter == 17 || DrawerNoBefore == 17)
|
||||||
{
|
{
|
||||||
if (DrawerNoBefore == 17)
|
//if (DrawerNoBefore == 17)
|
||||||
{
|
{
|
||||||
Thread.Sleep(1000);
|
int sleepMilliseconds = Convert.ToInt32(ConfigurationManager.AppSettings["CheckSleepMilliseconds"] ?? "500");
|
||||||
}
|
Thread.Sleep(sleepMilliseconds);
|
||||||
else
|
|
||||||
{
|
|
||||||
Thread.Sleep(500);
|
|
||||||
}
|
}
|
||||||
|
//else
|
||||||
|
//{
|
||||||
|
// Thread.Sleep(500);
|
||||||
|
//}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Thread.Sleep(80);
|
//Thread.Sleep(80);
|
||||||
|
Thread.Sleep(500);
|
||||||
}
|
}
|
||||||
logger.Info($"抽屉号DrawerNoBefore【{DrawerNoBefore}】抽屉号DrawerNoAfter【{DrawerNoAfter}】");
|
//logger.Info($"抽屉号DrawerNoBefore【{DrawerNoBefore}】抽屉号DrawerNoAfter【{DrawerNoAfter}】");
|
||||||
OpenOneByOne();
|
OpenOneByOne();
|
||||||
}
|
}
|
||||||
// 已经全部取出
|
// 已经全部取出
|
||||||
|
@ -272,8 +302,8 @@ namespace DM_Weight.ViewModels
|
||||||
set => SetProperty(ref _channelStocks, value);
|
set => SetProperty(ref _channelStocks, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
private IEnumerable<IGrouping<string, ChannelStock>> enumerable;
|
private IEnumerable<IGrouping<int, ChannelStock>> enumerable;
|
||||||
private IEnumerator<IGrouping<string, ChannelStock>> enumerator;
|
private IEnumerator<IGrouping<int, ChannelStock>> enumerator;
|
||||||
|
|
||||||
public DelegateCommand BindingChannelDialog
|
public DelegateCommand BindingChannelDialog
|
||||||
{
|
{
|
||||||
|
@ -301,32 +331,40 @@ namespace DM_Weight.ViewModels
|
||||||
{
|
{
|
||||||
if (Status == 0)
|
if (Status == 0)
|
||||||
{
|
{
|
||||||
//enumerable = ChannelStocks.GroupBy(cs => cs.DrawerNo, cs => cs);
|
logger.Info("开始盘点");
|
||||||
enumerable = ChannelStocks.GroupBy(cs => cs.Location, cs => cs);
|
enumerable = ChannelStocks.GroupBy(cs => cs.DrawerNo, cs => cs);
|
||||||
|
//enumerable = ChannelStocks.GroupBy(cs => cs.Location, cs => cs);
|
||||||
enumerator = enumerable.GetEnumerator();
|
enumerator = enumerable.GetEnumerator();
|
||||||
enumerator.MoveNext();
|
enumerator.MoveNext();
|
||||||
Status = 1;
|
Status = 1;
|
||||||
OpenOneByOne();
|
OpenOneByOne();
|
||||||
|
logger.Info("结束盘点");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
private void OpenOneByOne()
|
private void OpenOneByOne()
|
||||||
{
|
{
|
||||||
IGrouping<string, ChannelStock> grouping = enumerator.Current;
|
IGrouping<int, ChannelStock> grouping = enumerator.Current;
|
||||||
int DrawerNo =Convert.ToInt32(grouping.Key.Substring(0,grouping.Key.IndexOf('-')));
|
//int DrawerNo =Convert.ToInt32(grouping.Key.Substring(0,grouping.Key.IndexOf('-')));
|
||||||
List<ChannelStock> channelStocks = grouping.ToList();
|
int DrawerNo = grouping.Key;
|
||||||
channelStocks.ForEach(it => it.process = 1);
|
List<ChannelStock> Stocks = grouping.ToList();
|
||||||
|
Stocks.ForEach(it => it.process = 1);
|
||||||
_portUtil.SpeakAsync("正在打开" + DrawerNo + "号抽屉");
|
_portUtil.SpeakAsync("正在打开" + DrawerNo + "号抽屉");
|
||||||
|
List<ChannelStock> singleChannels = new List<ChannelStock>();
|
||||||
List<ChannelStock> singleChannels = channelStocks.GroupBy(it => new
|
for (int i = 0; i < Stocks.Count; i++)
|
||||||
|
{
|
||||||
|
ChannelStock copy = TransExpV2<ChannelStock, ChannelStock>.Trans(Stocks[i]);
|
||||||
|
singleChannels.Add(copy);
|
||||||
|
}
|
||||||
|
singleChannels = singleChannels.GroupBy(it => new
|
||||||
{
|
{
|
||||||
it.DrawerNo,
|
it.DrawerNo,
|
||||||
it.ColNo
|
it.ColNo
|
||||||
}).Select(it =>
|
}).Select(it =>
|
||||||
{
|
{
|
||||||
var ret = it.First();
|
var ret = it.First();
|
||||||
ret.Quantity = it.Sum(itx => itx.Quantity);
|
//ret.Quantity = it.Sum(itx => itx.Quantity);
|
||||||
ret.AddQuantity = it.Sum(itx => itx.AddQuantity);
|
//ret.AddQuantity = it.Sum(itx => itx.AddQuantity);
|
||||||
return ret;
|
return ret;
|
||||||
}).ToList().FindAll(it => it.BoardType != 1);
|
}).ToList().FindAll(it => it.BoardType != 1);
|
||||||
|
|
||||||
|
@ -352,7 +390,7 @@ namespace DM_Weight.ViewModels
|
||||||
_portUtil.Operate = true;
|
_portUtil.Operate = true;
|
||||||
_portUtil.BoardType = singleChannels.Count > 0 ? singleChannels[0].BoardType : 1;
|
_portUtil.BoardType = singleChannels.Count > 0 ? singleChannels[0].BoardType : 1;
|
||||||
_portUtil.ColNos = singleChannels.Select(it => it.ColNo).ToArray();
|
_portUtil.ColNos = singleChannels.Select(it => it.ColNo).ToArray();
|
||||||
_portUtil.Stocks = singleChannels.Select(it => it.Quantity).ToArray();
|
//_portUtil.Stocks = singleChannels.Select(it => it.Quantity).ToArray();
|
||||||
_portUtil.DrawerNo = DrawerNo;
|
_portUtil.DrawerNo = DrawerNo;
|
||||||
_portUtil.Start();
|
_portUtil.Start();
|
||||||
}
|
}
|
||||||
|
@ -372,7 +410,6 @@ namespace DM_Weight.ViewModels
|
||||||
string InvoiceId = "CHECK_" + CurrentTimeMillis();
|
string InvoiceId = "CHECK_" + CurrentTimeMillis();
|
||||||
var f = SqlSugarHelper.Db.UseTran(() =>
|
var f = SqlSugarHelper.Db.UseTran(() =>
|
||||||
{
|
{
|
||||||
|
|
||||||
for (int i = 0; i < record.Count; i++)
|
for (int i = 0; i < record.Count; i++)
|
||||||
{
|
{
|
||||||
ChannelStock it = record[i];
|
ChannelStock it = record[i];
|
||||||
|
@ -393,35 +430,48 @@ namespace DM_Weight.ViewModels
|
||||||
.Where(cs => cs.DrawerType == 1)
|
.Where(cs => cs.DrawerType == 1)
|
||||||
.ToList();
|
.ToList();
|
||||||
|
|
||||||
// 保存数据 盘点记录
|
//盘点时不记录盘点库存为0且盘点后库存仍为0的记录(该批次可能不再用了)
|
||||||
SqlSugarHelper.Db.Insertable(new MachineRecord()
|
if (!it.Quantity.Equals(0) || !it.CheckQuantity.Equals(0))
|
||||||
{
|
{
|
||||||
MachineId = it.MachineId,
|
// 保存数据 盘点记录
|
||||||
DrawerNo = it.DrawerNo,
|
SqlSugarHelper.Db.Insertable(new MachineRecord()
|
||||||
ColNo = it.ColNo,
|
{
|
||||||
DrugId = it.DrugId,
|
MachineId = it.MachineId,
|
||||||
ManuNo = it.ManuNo,
|
DrawerNo = it.DrawerNo,
|
||||||
EffDate = !String.IsNullOrEmpty(it.EffDate) ? DateTime.ParseExact(it.EffDate, "yyyy-MM-dd", System.Globalization.CultureInfo.CurrentCulture) : null,
|
ColNo = it.ColNo,
|
||||||
Operator = HomeWindowViewModel.Operator?.Id,
|
DrugId = it.DrugId,
|
||||||
Reviewer = HomeWindowViewModel.Reviewer?.Id,
|
ManuNo = it.ManuNo,
|
||||||
OperationTime = DateTime.Now,
|
EffDate = !String.IsNullOrEmpty(it.EffDate) ? DateTime.ParseExact(it.EffDate, "yyyy-MM-dd", System.Globalization.CultureInfo.CurrentCulture) : null,
|
||||||
Quantity = it.CheckQuantity - it.Quantity,
|
Operator = HomeWindowViewModel.Operator?.Id,
|
||||||
Type = 4,
|
Reviewer = HomeWindowViewModel.Reviewer?.Id,
|
||||||
InvoiceId = InvoiceId,
|
OperationTime = DateTime.Now,
|
||||||
StockQuantity = nowChannels.Sum(it => it.Quantity),
|
Quantity = it.CheckQuantity - it.Quantity,
|
||||||
CheckQuantity = it.CheckQuantity,
|
Type = SelectedItemUseFor.UseId==0? 4: SelectedItemUseFor.UseId,
|
||||||
ManunoQuantity = nowChannels.FindAll(it2 => it2.ManuNo == it.ManuNo).Sum(it => it.Quantity)
|
InvoiceId = InvoiceId,
|
||||||
}).ExecuteCommand();
|
StockQuantity = nowChannels.Sum(it => it.Quantity),
|
||||||
|
CheckQuantity = it.CheckQuantity,
|
||||||
|
ManunoQuantity = nowChannels.FindAll(it2 => it2.ManuNo == it.ManuNo).Sum(it => it.Quantity)
|
||||||
|
}).ExecuteCommand();
|
||||||
|
|
||||||
|
logger.Info($"库存盘点->库位【{it.DrawerNo}-{it.ColNo}】药品【{it.DrugInfo.DrugName}】盘点前库存【{it.Quantity}】,更改后【{it.CheckQuantity}】");
|
||||||
|
|
||||||
logger.Info($"库存盘点->库位【{it.DrawerNo}-{it.ColNo}】药品【{it.DrugInfo.DrugName}】盘点前库存【{it.Quantity}】,更改后【{it.CheckQuantity}】");
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Task.Factory.StartNew(()=> SaveCheckRecord());
|
||||||
string machine_id = (ConfigurationManager.AppSettings["machineId"] ?? "DM1");
|
string machine_id = (ConfigurationManager.AppSettings["machineId"] ?? "DM1");
|
||||||
string strSql = $@"SELECT cl.`row_no` AS rowNo,cl.`col_no` AS colNo,cl.`quantity` AS quantity,cl.`manu_no` AS manuNo,cl.`eff_date` AS effDate,
|
string strSql = $@"SELECT cl.`row_no` AS rowNo,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` maxStock,
|
di.`drug_name` AS drugName,di.`drug_spec` AS drugSpec,di.`pack_unit` AS packUnit,di.`manufactory` AS manufactory,di.`max_stock` maxStock,
|
||||||
cl.`drug_id` AS drugId,cl.`machine_id` AS MachineId 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`";
|
cl.`drug_id` AS drugId,cl.`machine_id` AS MachineId 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 ";
|
||||||
|
if(App.SingleModel)
|
||||||
|
{
|
||||||
|
strSql += " AND ROW_NO<=2";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
strSql += " AND ROW_NO>2";
|
||||||
|
}
|
||||||
|
strSql += " ORDER BY cl.`drug_id`";
|
||||||
List<CheckRecordStock> checkRecordStockList = SqlSugarHelper.Db.SqlQueryable<dynamic>(strSql)
|
List<CheckRecordStock> checkRecordStockList = SqlSugarHelper.Db.SqlQueryable<dynamic>(strSql)
|
||||||
.AddParameters(new
|
.AddParameters(new
|
||||||
{
|
{
|
||||||
|
@ -429,6 +479,10 @@ namespace DM_Weight.ViewModels
|
||||||
})
|
})
|
||||||
.Select(it => new CheckRecordStock())
|
.Select(it => new CheckRecordStock())
|
||||||
.ToList();
|
.ToList();
|
||||||
|
|
||||||
|
logger.Info("已完成-查询channel_stock关联drug_info表信息查询");
|
||||||
|
|
||||||
|
|
||||||
List<CheckRecordStock> insertList = new List<CheckRecordStock>();
|
List<CheckRecordStock> insertList = new List<CheckRecordStock>();
|
||||||
|
|
||||||
if (checkRecordStockList != null && checkRecordStockList.Count > 0)
|
if (checkRecordStockList != null && checkRecordStockList.Count > 0)
|
||||||
|
@ -443,39 +497,41 @@ namespace DM_Weight.ViewModels
|
||||||
for (int j = 0; j < insertList.Count; j++)
|
for (int j = 0; j < insertList.Count; j++)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
//盘点时不记录盘点库存为0且盘点后库存仍为0的记录(该批次可能不再用了)
|
||||||
CheckRecordStock cStock = insertList[j];
|
if (!insertList[j].quantity.Equals(0))
|
||||||
// 保存数据 盘点后药品总库存及批次库存数
|
|
||||||
SqlSugarHelper.Db.Insertable(new CheckRecordStock()
|
|
||||||
{
|
{
|
||||||
rowNo = cStock.rowNo,
|
CheckRecordStock cStock = insertList[j];
|
||||||
colNo = cStock.colNo,
|
// 保存数据 盘点后药品总库存及批次库存数
|
||||||
ManuQuantity = checkRecordStockList.Where(it => it.drugId == cStock.drugId && it.manuNo == cStock.manuNo).Sum(it => it.quantity),
|
SqlSugarHelper.Db.Insertable(new CheckRecordStock()
|
||||||
manuNo = cStock.manuNo,
|
{
|
||||||
effDate = cStock.effDate,
|
rowNo = cStock.rowNo,
|
||||||
drugName = cStock.drugName,
|
colNo = cStock.colNo,
|
||||||
manufactory = cStock.manufactory,
|
ManuQuantity = checkRecordStockList.Where(it => it.drugId == cStock.drugId && it.manuNo == cStock.manuNo).Sum(it => it.quantity),
|
||||||
drugSpec = cStock.drugSpec,
|
manuNo = cStock.manuNo,
|
||||||
packUnit = cStock.packUnit,
|
effDate = cStock.effDate,
|
||||||
maxStock = cStock.maxStock,
|
drugName = cStock.drugName,
|
||||||
drugId = cStock.drugId,
|
manufactory = cStock.manufactory,
|
||||||
MachineId = cStock.MachineId,
|
drugSpec = cStock.drugSpec,
|
||||||
quantity = checkRecordStockList.Where(it => it.drugId == cStock.drugId).Sum(it => it.quantity),
|
packUnit = cStock.packUnit,
|
||||||
optdate = DateTime.Now.ToString(),
|
maxStock = cStock.maxStock,
|
||||||
operatorUser = HomeWindowViewModel.Operator?.Id.ToString(),
|
drugId = cStock.drugId,
|
||||||
reviewerUser = HomeWindowViewModel.Reviewer?.Id.ToString()
|
MachineId = cStock.MachineId,
|
||||||
}).ExecuteCommand();
|
quantity = checkRecordStockList.Where(it => it.drugId == cStock.drugId).Sum(it => it.quantity),
|
||||||
|
optdate = DateTime.Now.ToString(),
|
||||||
|
operatorUser = HomeWindowViewModel.Operator?.Id.ToString(),
|
||||||
|
reviewerUser = HomeWindowViewModel.Reviewer?.Id.ToString()
|
||||||
|
}).ExecuteCommand();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
logger.Info("已完成-保存数据 盘点后药品总库存及批次库存数");
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
if (f.Data)
|
if (f.Data)
|
||||||
{
|
{
|
||||||
// 更新屏显库存
|
// 更新屏显库存
|
||||||
//List<ChannelStock> singleChannels = record.FindAll(it => it.BoardType != 1);
|
//List<ChannelStock> singleChannels = record.FindAll(it => it.BoardType != 1);
|
||||||
List<ChannelStock> singleChannels = record.FindAll(it => it.BoardType != 1)
|
List<ChannelStock> singleChannels = record.FindAll(it => it.BoardType == 5&&it.CheckQuantity>0).OrderBy(it => it.EffDate)
|
||||||
.GroupBy(it => new
|
.GroupBy(it => new
|
||||||
{
|
{
|
||||||
it.DrawerNo,
|
it.DrawerNo,
|
||||||
|
@ -487,23 +543,32 @@ namespace DM_Weight.ViewModels
|
||||||
//ret.AddQuantity = it.Sum(itx => itx.AddQuantity);
|
//ret.AddQuantity = it.Sum(itx => itx.AddQuantity);
|
||||||
return ret;
|
return ret;
|
||||||
}).ToList();
|
}).ToList();
|
||||||
if ((singleChannels.Count > 0 ? singleChannels[0].BoardType : 1) == 5)
|
//if ((singleChannels.Count > 0 ? singleChannels[0].BoardType : 1) == 5)
|
||||||
{
|
{
|
||||||
singleChannels.ForEach(it =>
|
singleChannels.ForEach(it =>
|
||||||
{
|
{
|
||||||
|
//将库位多批次的总库存数更新标签
|
||||||
|
_portUtil.WriteChannelInfo(6, it.EffDate == null ? "" : it.EffDate, it.DrawerNo, it.ColNo);
|
||||||
|
Thread.Sleep(200);
|
||||||
|
_portUtil.WriteChannelInfo(5, it.ManuNo, it.DrawerNo, it.ColNo);
|
||||||
|
Thread.Sleep(200);
|
||||||
// 将库位多批次的总库存数更新标签
|
// 将库位多批次的总库存数更新标签
|
||||||
_portUtil.WriteQuantity(it.DrawerNo, it.ColNo, it.CheckQuantity);
|
_portUtil.WriteQuantity(it.DrawerNo, it.ColNo, it.CheckQuantity);
|
||||||
|
Thread.Sleep(200);
|
||||||
|
_portUtil.ShowContent(it.DrawerNo, it.ColNo);
|
||||||
|
Thread.Sleep(200);
|
||||||
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
logger.Info("已完成-更新标签");
|
||||||
RequestData();
|
|
||||||
AlertMsg alertMsg = new AlertMsg
|
AlertMsg alertMsg = new AlertMsg
|
||||||
{
|
{
|
||||||
Message = "抽屉盘点完成,库存已更新",
|
Message = "抽屉盘点完成,库存已更新",
|
||||||
Type = MsgType.SUCCESS,
|
Type = MsgType.SUCCESS,
|
||||||
};
|
};
|
||||||
_eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
|
_eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
|
||||||
|
|
||||||
|
RequestData();
|
||||||
}
|
}
|
||||||
if (!f.IsSuccess)
|
if (!f.IsSuccess)
|
||||||
{
|
{
|
||||||
|
@ -533,7 +598,64 @@ namespace DM_Weight.ViewModels
|
||||||
|
|
||||||
}, () => Status == 3 && !_isFinishClick).ObservesProperty(() => Status);
|
}, () => Status == 3 && !_isFinishClick).ObservesProperty(() => Status);
|
||||||
}
|
}
|
||||||
|
public void SaveCheckRecord()
|
||||||
|
{
|
||||||
|
string machine_id = (ConfigurationManager.AppSettings["machineId"] ?? "DM1");
|
||||||
|
string strSql = $@"SELECT cl.`row_no` AS rowNo,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` maxStock,
|
||||||
|
cl.`drug_id` AS drugId,cl.`machine_id` AS MachineId 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`";
|
||||||
|
List<CheckRecordStock> checkRecordStockList = SqlSugarHelper.Db.SqlQueryable<dynamic>(strSql)
|
||||||
|
.AddParameters(new
|
||||||
|
{
|
||||||
|
machineId = ConfigurationManager.AppSettings["machineId"] ?? "DM1"
|
||||||
|
})
|
||||||
|
.Select(it => new CheckRecordStock())
|
||||||
|
.ToList();
|
||||||
|
|
||||||
|
logger.Info("已完成-查询channel_stock关联drug_info表信息查询");
|
||||||
|
|
||||||
|
List<CheckRecordStock> insertList = new List<CheckRecordStock>();
|
||||||
|
|
||||||
|
if (checkRecordStockList != null && checkRecordStockList.Count > 0)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < checkRecordStockList.Count; i++)
|
||||||
|
{
|
||||||
|
if (!(insertList.Where(it => it.drugId == checkRecordStockList[i].drugId && it.manuNo == checkRecordStockList[i].manuNo).Count() > 0))
|
||||||
|
{
|
||||||
|
insertList.Add(checkRecordStockList[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (int j = 0; j < insertList.Count; j++)
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
CheckRecordStock cStock = insertList[j];
|
||||||
|
// 保存数据 盘点后药品总库存及批次库存数
|
||||||
|
SqlSugarHelper.Db.Insertable(new CheckRecordStock()
|
||||||
|
{
|
||||||
|
rowNo = cStock.rowNo,
|
||||||
|
colNo = cStock.colNo,
|
||||||
|
ManuQuantity = checkRecordStockList.Where(it => it.drugId == cStock.drugId && it.manuNo == cStock.manuNo).Sum(it => it.quantity),
|
||||||
|
manuNo = cStock.manuNo,
|
||||||
|
effDate = cStock.effDate,
|
||||||
|
drugName = cStock.drugName,
|
||||||
|
manufactory = cStock.manufactory,
|
||||||
|
drugSpec = cStock.drugSpec,
|
||||||
|
packUnit = cStock.packUnit,
|
||||||
|
maxStock = cStock.maxStock,
|
||||||
|
drugId = cStock.drugId,
|
||||||
|
MachineId = cStock.MachineId,
|
||||||
|
quantity = checkRecordStockList.Where(it => it.drugId == cStock.drugId).Sum(it => it.quantity),
|
||||||
|
optdate = DateTime.Now.ToString(),
|
||||||
|
operatorUser = HomeWindowViewModel.Operator?.Id.ToString(),
|
||||||
|
reviewerUser = HomeWindowViewModel.Reviewer?.Id.ToString()
|
||||||
|
}).ExecuteCommand();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
logger.Info("已完成-插入check_stock表信息");
|
||||||
|
}
|
||||||
// 取消按钮
|
// 取消按钮
|
||||||
public DelegateCommand CancleTake
|
public DelegateCommand CancleTake
|
||||||
{
|
{
|
||||||
|
@ -544,7 +666,7 @@ namespace DM_Weight.ViewModels
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool KeepAlive => true;
|
public bool KeepAlive => false;
|
||||||
|
|
||||||
private void DoDialogResult(IDialogResult dialogResult)
|
private void DoDialogResult(IDialogResult dialogResult)
|
||||||
{
|
{
|
||||||
|
@ -610,9 +732,11 @@ namespace DM_Weight.ViewModels
|
||||||
.Where(cs => cs.DrawerType == 1)
|
.Where(cs => cs.DrawerType == 1)
|
||||||
.Where(cs => cs.DrugId != null)
|
.Where(cs => cs.DrugId != null)
|
||||||
.Where(cs => cs.MachineId.Equals(ConfigurationManager.AppSettings["machineId"] ?? "DM1"))
|
.Where(cs => cs.MachineId.Equals(ConfigurationManager.AppSettings["machineId"] ?? "DM1"))
|
||||||
|
.WhereIF(App.SingleModel, cs => cs.DrawerNo <= 2) //单人登录开前8个抽屉,双人登录开后8个抽屉
|
||||||
|
.WhereIF(!(App.SingleModel), cs => cs.DrawerNo > 2)
|
||||||
.WhereIF(!String.IsNullOrEmpty(SearchValue), cs => cs.DrugInfo.DrugName == SearchValue)
|
.WhereIF(!String.IsNullOrEmpty(SearchValue), cs => cs.DrugInfo.DrugName == SearchValue)
|
||||||
.OrderBy(cs => cs.DrawerNo)
|
.OrderBy(cs => cs.DrawerNo)
|
||||||
|
//.OrderByDescending(cs => cs.DrawerNo)
|
||||||
.OrderBy(cs => cs.ColNo)
|
.OrderBy(cs => cs.ColNo)
|
||||||
//.OrderBy(cs => cs.DrugId)
|
//.OrderBy(cs => cs.DrugId)
|
||||||
.ToList();
|
.ToList();
|
||||||
|
@ -643,5 +767,42 @@ namespace DM_Weight.ViewModels
|
||||||
// 取消消息订阅
|
// 取消消息订阅
|
||||||
_eventAggregator.GetEvent<PortUtilEvent>().Unsubscribe(DoMyPrismEvent);
|
_eventAggregator.GetEvent<PortUtilEvent>().Unsubscribe(DoMyPrismEvent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//无权限,进入下一个抽屉
|
||||||
|
private void NoAuthority()
|
||||||
|
{
|
||||||
|
|
||||||
|
IGrouping<int, ChannelStock> groupingBefore = enumerator.Current;
|
||||||
|
int DrawerNoBefore = groupingBefore.Key; //Convert.ToInt32(groupingBefore.Key.Substring(0, groupingBefore.Key.IndexOf('-')));
|
||||||
|
if (enumerator.MoveNext())
|
||||||
|
{
|
||||||
|
IGrouping<int, ChannelStock> groupingAfter = enumerator.Current;
|
||||||
|
int DrawerNoAfter = groupingAfter.Key;//Convert.ToInt32(groupingAfter.Key.Substring(0, groupingAfter.Key.IndexOf('-')));
|
||||||
|
//if (DrawerNoBefore < 9 && DrawerNoAfter > 8)
|
||||||
|
//{
|
||||||
|
// Thread.Sleep(50);
|
||||||
|
//}
|
||||||
|
|
||||||
|
logger.Info($"抽屉号DrawerNoBefore【{DrawerNoBefore}】抽屉号DrawerNoAfter【{DrawerNoAfter}】");
|
||||||
|
if (DrawerNoAfter == 17 || DrawerNoBefore == 17)
|
||||||
|
{
|
||||||
|
//if (DrawerNoBefore == 17)
|
||||||
|
{
|
||||||
|
int sleepMilliseconds = Convert.ToInt32(ConfigurationManager.AppSettings["CheckSleepMilliseconds"] ?? "500");
|
||||||
|
Thread.Sleep(sleepMilliseconds);
|
||||||
|
}
|
||||||
|
//else
|
||||||
|
//{
|
||||||
|
// Thread.Sleep(500);
|
||||||
|
//}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//Thread.Sleep(80);
|
||||||
|
Thread.Sleep(500);
|
||||||
|
}
|
||||||
|
OpenOneByOne();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -15,6 +15,7 @@ using DM_Weight.Models;
|
||||||
using DM_Weight.msg;
|
using DM_Weight.msg;
|
||||||
using DM_Weight.Port;
|
using DM_Weight.Port;
|
||||||
using DM_Weight.util;
|
using DM_Weight.util;
|
||||||
|
using System.Threading;
|
||||||
|
|
||||||
namespace DM_Weight.ViewModels
|
namespace DM_Weight.ViewModels
|
||||||
{
|
{
|
||||||
|
@ -121,6 +122,55 @@ namespace DM_Weight.ViewModels
|
||||||
{
|
{
|
||||||
get => new DelegateCommand(() =>
|
get => new DelegateCommand(() =>
|
||||||
{
|
{
|
||||||
|
//if (App.CurrentFaUserList.Role != null)
|
||||||
|
//{
|
||||||
|
// //查看当前用户是否有所在药品抽屉的权限
|
||||||
|
// bool bLessEight = ChannelStocks.Select(it => it.DrawerNo).Where(n => n <= 8).Any();
|
||||||
|
// bool bMoreEight = ChannelStocks.Select(it => it.DrawerNo).Where(n => n > 8&&n<17).Any();
|
||||||
|
// bool bEqualEight = ChannelStocks.Select(it => it.DrawerNo).Where(n => n == 17).Any();
|
||||||
|
// if (bLessEight)
|
||||||
|
// {
|
||||||
|
// if (App.CurrentFaUserList.Role.FirstEightChecked == "0")
|
||||||
|
// {
|
||||||
|
// AlertMsg alertMsg = new AlertMsg
|
||||||
|
// {
|
||||||
|
// Message = "当前用户没有打开抽屉的权限!",
|
||||||
|
// Type = MsgType.ERROR,
|
||||||
|
// };
|
||||||
|
// _eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// if (bMoreEight)
|
||||||
|
// {
|
||||||
|
// if (App.CurrentFaUserList.Role.LastEightChecked == "0")
|
||||||
|
// {
|
||||||
|
// AlertMsg alertMsg = new AlertMsg
|
||||||
|
// {
|
||||||
|
// Message = "当前用户没有打开抽屉的权限!",
|
||||||
|
// Type = MsgType.ERROR,
|
||||||
|
// };
|
||||||
|
// _eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// if (bEqualEight)
|
||||||
|
// {
|
||||||
|
// if (App.CurrentFaUserList.Role.StorageBoxChecked == "0")
|
||||||
|
// {
|
||||||
|
// AlertMsg alertMsg = new AlertMsg
|
||||||
|
// {
|
||||||
|
// Message = "当前用户没有打开抽屉的权限!",
|
||||||
|
// Type = MsgType.ERROR,
|
||||||
|
// };
|
||||||
|
// _eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
//}
|
||||||
|
|
||||||
|
|
||||||
Status = 1;
|
Status = 1;
|
||||||
_portUtil.SpeakAsync("正在打开" + DrawerNo + "号抽屉");
|
_portUtil.SpeakAsync("正在打开" + DrawerNo + "号抽屉");
|
||||||
|
|
||||||
|
@ -208,6 +258,7 @@ namespace DM_Weight.ViewModels
|
||||||
singleChannels.ForEach(it =>
|
singleChannels.ForEach(it =>
|
||||||
{
|
{
|
||||||
_portUtil.WriteQuantity(it.DrawerNo, it.ColNo, it.CheckQuantity);
|
_portUtil.WriteQuantity(it.DrawerNo, it.ColNo, it.CheckQuantity);
|
||||||
|
Thread.Sleep(200);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -17,11 +17,39 @@ using DM_Weight.msg;
|
||||||
using DM_Weight.Port;
|
using DM_Weight.Port;
|
||||||
using DM_Weight.util;
|
using DM_Weight.util;
|
||||||
using System.Collections.ObjectModel;
|
using System.Collections.ObjectModel;
|
||||||
|
using System.Threading;
|
||||||
|
|
||||||
namespace DM_Weight.ViewModels
|
namespace DM_Weight.ViewModels
|
||||||
{
|
{
|
||||||
public class DrawerAddDrugWindowViewModel : BindableBase, IConfirmNavigationRequest, IRegionMemberLifetime
|
public class DrawerAddDrugWindowViewModel : BindableBase, IConfirmNavigationRequest, IRegionMemberLifetime
|
||||||
{
|
{
|
||||||
|
public static List<UseFor> SelectUseList = new()
|
||||||
|
{
|
||||||
|
|
||||||
|
new UseFor { UseId = 96, UseName = "不入账册" } , new UseFor { UseId = 0, UseName = "入账册" }
|
||||||
|
};
|
||||||
|
private List<UseFor> _selectsUseFor = SelectUseList;
|
||||||
|
|
||||||
|
public List<UseFor> SelectsUseFor
|
||||||
|
{
|
||||||
|
get { return _selectsUseFor; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
SetProperty(ref _selectsUseFor, value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private UseFor _selectedItemUseFor = SelectUseList[0];
|
||||||
|
/// <summary>
|
||||||
|
/// 取药或加药用途字段
|
||||||
|
/// </summary>
|
||||||
|
public UseFor SelectedItemUseFor
|
||||||
|
{
|
||||||
|
get { return _selectedItemUseFor; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
SetProperty(ref _selectedItemUseFor, value);
|
||||||
|
}
|
||||||
|
}
|
||||||
private readonly ILog logger = LogManager.GetLogger(typeof(DrawerAddDrugWindowViewModel));
|
private readonly ILog logger = LogManager.GetLogger(typeof(DrawerAddDrugWindowViewModel));
|
||||||
private List<int> _drawerNoList = new List<int>();
|
private List<int> _drawerNoList = new List<int>();
|
||||||
|
|
||||||
|
@ -138,6 +166,54 @@ namespace DM_Weight.ViewModels
|
||||||
{
|
{
|
||||||
get => new DelegateCommand(() =>
|
get => new DelegateCommand(() =>
|
||||||
{
|
{
|
||||||
|
//if (App.CurrentFaUserList.Role != null)
|
||||||
|
//{
|
||||||
|
// //查看当前用户是否有所在药品抽屉的权限
|
||||||
|
// bool bLessEight = ChannelStocks.Select(it => it.DrawerNo).Where(n => n <= 8).Any();
|
||||||
|
// bool bMoreEight = ChannelStocks.Select(it => it.DrawerNo).Where(n => n > 8&&n<17).Any();
|
||||||
|
// bool bEqualEight = ChannelStocks.Select(it => it.DrawerNo).Where(n => n == 17).Any();
|
||||||
|
// if (bLessEight)
|
||||||
|
// {
|
||||||
|
// if (App.CurrentFaUserList.Role.FirstEightChecked == "0")
|
||||||
|
// {
|
||||||
|
// AlertMsg alertMsg = new AlertMsg
|
||||||
|
// {
|
||||||
|
// Message = "当前用户没有打开抽屉的权限!",
|
||||||
|
// Type = MsgType.ERROR,
|
||||||
|
// };
|
||||||
|
// _eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// if (bMoreEight)
|
||||||
|
// {
|
||||||
|
// if (App.CurrentFaUserList.Role.LastEightChecked == "0")
|
||||||
|
// {
|
||||||
|
// AlertMsg alertMsg = new AlertMsg
|
||||||
|
// {
|
||||||
|
// Message = "当前用户没有打开抽屉的权限!",
|
||||||
|
// Type = MsgType.ERROR,
|
||||||
|
// };
|
||||||
|
// _eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// if (bEqualEight)
|
||||||
|
// {
|
||||||
|
// if (App.CurrentFaUserList.Role.StorageBoxChecked == "0")
|
||||||
|
// {
|
||||||
|
// AlertMsg alertMsg = new AlertMsg
|
||||||
|
// {
|
||||||
|
// Message = "当前用户没有打开抽屉的权限!",
|
||||||
|
// Type = MsgType.ERROR,
|
||||||
|
// };
|
||||||
|
// _eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
//}
|
||||||
|
|
||||||
Status = 1;
|
Status = 1;
|
||||||
_portUtil.SpeakAsync("正在打开" + DrawerNo + "号抽屉");
|
_portUtil.SpeakAsync("正在打开" + DrawerNo + "号抽屉");
|
||||||
|
|
||||||
|
@ -228,7 +304,7 @@ namespace DM_Weight.ViewModels
|
||||||
Reviewer = HomeWindowViewModel.Reviewer?.Id,
|
Reviewer = HomeWindowViewModel.Reviewer?.Id,
|
||||||
OperationTime = DateTime.Now,
|
OperationTime = DateTime.Now,
|
||||||
Quantity = it.AddQuantity,
|
Quantity = it.AddQuantity,
|
||||||
Type = 1,
|
Type = SelectedItemUseFor.UseId == 0 ? 1 : SelectedItemUseFor.UseId,
|
||||||
InvoiceId = InvoiceId,
|
InvoiceId = InvoiceId,
|
||||||
StockQuantity = nowChannels.Sum(it => it.Quantity),
|
StockQuantity = nowChannels.Sum(it => it.Quantity),
|
||||||
ManunoQuantity = nowChannels.FindAll(it2 => it2.ManuNo == it.ManuNo).Sum(it => it.Quantity),
|
ManunoQuantity = nowChannels.FindAll(it2 => it2.ManuNo == it.ManuNo).Sum(it => it.Quantity),
|
||||||
|
@ -257,6 +333,7 @@ namespace DM_Weight.ViewModels
|
||||||
singleChannels.ForEach(it =>
|
singleChannels.ForEach(it =>
|
||||||
{
|
{
|
||||||
_portUtil.WriteQuantity(it.DrawerNo, it.ColNo, it.Quantity + it.AddQuantity);
|
_portUtil.WriteQuantity(it.DrawerNo, it.ColNo, it.Quantity + it.AddQuantity);
|
||||||
|
Thread.Sleep(200);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
RequestData();
|
RequestData();
|
||||||
|
@ -323,11 +400,11 @@ namespace DM_Weight.ViewModels
|
||||||
|
|
||||||
public void FindDrawerCount()
|
public void FindDrawerCount()
|
||||||
{
|
{
|
||||||
int count = SqlSugarHelper.Db.Queryable<ChannelList>().Where(cs => cs.DrawerType != 3)
|
//int count = SqlSugarHelper.Db.Queryable<ChannelList>().Where(cs => cs.DrawerType != 3)
|
||||||
.Where(cs => cs.MachineId.Equals(ConfigurationManager.AppSettings["machineId"] ?? "DM1")).GroupBy(cs => cs.DrawerNo).Select(cs => SqlFunc.AggregateCount(cs.DrawerNo)).Count();
|
//.Where(cs => cs.MachineId.Equals(ConfigurationManager.AppSettings["machineId"] ?? "DM1")).GroupBy(cs => cs.DrawerNo).Select(cs => SqlFunc.AggregateCount(cs.DrawerNo)).Count();
|
||||||
Is8Drawer = count < 9;
|
Is8Drawer = App.SingleModel; //count < 9;
|
||||||
Is16Drawer = count >= 16;
|
Is16Drawer = !App.SingleModel; //count >= 16;
|
||||||
Is17Drawer = count > 16;
|
Is17Drawer = false;//count > 16;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -26,6 +26,33 @@ namespace DM_Weight.ViewModels
|
||||||
{
|
{
|
||||||
public class DrawerTakeDrugWindowViewModel : BindableBase, IConfirmNavigationRequest, IRegionMemberLifetime
|
public class DrawerTakeDrugWindowViewModel : BindableBase, IConfirmNavigationRequest, IRegionMemberLifetime
|
||||||
{
|
{
|
||||||
|
public static List<UseFor> SelectUseList = new()
|
||||||
|
{
|
||||||
|
|
||||||
|
new UseFor { UseId = 96, UseName = "不入账册" } , new UseFor { UseId = 0, UseName = "入账册" }
|
||||||
|
};
|
||||||
|
private List<UseFor> _selectsUseFor = SelectUseList;
|
||||||
|
|
||||||
|
public List<UseFor> SelectsUseFor
|
||||||
|
{
|
||||||
|
get { return _selectsUseFor; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
SetProperty(ref _selectsUseFor, value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private UseFor _selectedItemUseFor = SelectUseList[0];
|
||||||
|
/// <summary>
|
||||||
|
/// 取药或加药用途字段
|
||||||
|
/// </summary>
|
||||||
|
public UseFor SelectedItemUseFor
|
||||||
|
{
|
||||||
|
get { return _selectedItemUseFor; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
SetProperty(ref _selectedItemUseFor, value);
|
||||||
|
}
|
||||||
|
}
|
||||||
private readonly ILog logger = LogManager.GetLogger(typeof(DrawerTakeDrugWindowViewModel));
|
private readonly ILog logger = LogManager.GetLogger(typeof(DrawerTakeDrugWindowViewModel));
|
||||||
|
|
||||||
private List<ChannelStock> _channelStocks = new List<ChannelStock>();
|
private List<ChannelStock> _channelStocks = new List<ChannelStock>();
|
||||||
|
@ -35,11 +62,11 @@ namespace DM_Weight.ViewModels
|
||||||
get => _channelStocks;
|
get => _channelStocks;
|
||||||
set => SetProperty(ref _channelStocks, value);
|
set => SetProperty(ref _channelStocks, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static readonly DateTime Jan1st1970 = new DateTime
|
private static readonly DateTime Jan1st1970 = new DateTime
|
||||||
(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);
|
(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private PortUtil _portUtil;
|
private PortUtil _portUtil;
|
||||||
IEventAggregator _eventAggregator;
|
IEventAggregator _eventAggregator;
|
||||||
|
@ -93,7 +120,7 @@ namespace DM_Weight.ViewModels
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private int _status;
|
private int _status;
|
||||||
|
@ -129,7 +156,7 @@ namespace DM_Weight.ViewModels
|
||||||
}, (DrawerNo) => Status == 0
|
}, (DrawerNo) => Status == 0
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public DelegateCommand OpenDrawer
|
public DelegateCommand OpenDrawer
|
||||||
{
|
{
|
||||||
|
@ -137,6 +164,48 @@ namespace DM_Weight.ViewModels
|
||||||
{
|
{
|
||||||
if (Status == 0)
|
if (Status == 0)
|
||||||
{
|
{
|
||||||
|
if (App.CurrentFaUserList.Role != null)
|
||||||
|
{
|
||||||
|
if (DrawerNo <= 8)
|
||||||
|
{
|
||||||
|
if (App.CurrentFaUserList.Role.FirstEightChecked == "0")
|
||||||
|
{
|
||||||
|
AlertMsg alertMsg = new AlertMsg
|
||||||
|
{
|
||||||
|
Message = "当前用户没有打开抽屉的权限!",
|
||||||
|
Type = MsgType.ERROR,
|
||||||
|
};
|
||||||
|
_eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (DrawerNo > 8)
|
||||||
|
{
|
||||||
|
if (App.CurrentFaUserList.Role.LastEightChecked == "0")
|
||||||
|
{
|
||||||
|
AlertMsg alertMsg = new AlertMsg
|
||||||
|
{
|
||||||
|
Message = "当前用户没有打开抽屉的权限!",
|
||||||
|
Type = MsgType.ERROR,
|
||||||
|
};
|
||||||
|
_eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (DrawerNo == 17)
|
||||||
|
{
|
||||||
|
if (App.CurrentFaUserList.Role.StorageBoxChecked == "0")
|
||||||
|
{
|
||||||
|
AlertMsg alertMsg = new AlertMsg
|
||||||
|
{
|
||||||
|
Message = "当前用户没有打开抽屉的权限!",
|
||||||
|
Type = MsgType.ERROR,
|
||||||
|
};
|
||||||
|
_eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Status = 1;
|
Status = 1;
|
||||||
_portUtil.SpeakAsync("正在打开" + DrawerNo + "号抽屉");
|
_portUtil.SpeakAsync("正在打开" + DrawerNo + "号抽屉");
|
||||||
|
|
||||||
|
@ -144,7 +213,7 @@ namespace DM_Weight.ViewModels
|
||||||
// group t by new { t.ColNo, t.BoardType }
|
// group t by new { t.ColNo, t.BoardType }
|
||||||
// into grp
|
// into grp
|
||||||
// select new { grp.Key.ColNo, grp.Key.BoardType, quantity = grp.Sum(t => t.Quantity) }).ToList();
|
// select new { grp.Key.ColNo, grp.Key.BoardType, quantity = grp.Sum(t => t.Quantity) }).ToList();
|
||||||
|
|
||||||
List<ChannelStock> singleChannels = ChannelStocks.FindAll(it => it.BoardType != 1);
|
List<ChannelStock> singleChannels = ChannelStocks.FindAll(it => it.BoardType != 1);
|
||||||
|
|
||||||
_portUtil.WindowName = "DrawerTakeDrugWindow";
|
_portUtil.WindowName = "DrawerTakeDrugWindow";
|
||||||
|
@ -206,17 +275,18 @@ namespace DM_Weight.ViewModels
|
||||||
ColNo = it.ColNo,
|
ColNo = it.ColNo,
|
||||||
DrugId = it.DrugId,
|
DrugId = it.DrugId,
|
||||||
ManuNo = it.ManuNo,
|
ManuNo = it.ManuNo,
|
||||||
EffDate = !String.IsNullOrEmpty(it.EffDate) ?DateTime.ParseExact(it.EffDate, "yyyy-MM-dd", System.Globalization.CultureInfo.CurrentCulture):null,
|
EffDate = !String.IsNullOrEmpty(it.EffDate) ? DateTime.ParseExact(it.EffDate, "yyyy-MM-dd", System.Globalization.CultureInfo.CurrentCulture) : null,
|
||||||
Operator = HomeWindowViewModel.Operator?.Id,
|
Operator = HomeWindowViewModel.Operator?.Id,
|
||||||
Reviewer = HomeWindowViewModel.Reviewer?.Id,
|
Reviewer = HomeWindowViewModel.Reviewer?.Id,
|
||||||
OperationTime = DateTime.Now,
|
OperationTime = DateTime.Now,
|
||||||
Quantity = it.TakeQuantity,
|
Quantity = it.TakeQuantity,
|
||||||
Type = 2,
|
Type = SelectedItemUseFor.UseId == 0 ? 2 : SelectedItemUseFor.UseId,
|
||||||
InvoiceId = InvoiceId,
|
InvoiceId = InvoiceId,
|
||||||
StockQuantity = nowChannels.Sum(it => it.Quantity),
|
StockQuantity = nowChannels.Sum(it => it.Quantity),
|
||||||
ManunoQuantity = nowChannels.FindAll(it2 => it2.ManuNo == it.ManuNo).Sum(it => it.Quantity),
|
ManunoQuantity = nowChannels.FindAll(it2 => it2.ManuNo == it.ManuNo).Sum(it => it.Quantity),
|
||||||
SupplierDept = ConfigurationManager.AppSettings["supplierDept"].ToString(),
|
SupplierDept = ConfigurationManager.AppSettings["supplierDept"].ToString(),
|
||||||
ReceiveDept = ConfigurationManager.AppSettings["receiveDept"].ToString()
|
ReceiveDept = ConfigurationManager.AppSettings["receiveDept"].ToString(),
|
||||||
|
Status = SelectedItemUseFor.UseId == 0 ? 0 : 2 //不入账册(96)取药后不还空瓶
|
||||||
}).ExecuteCommand();
|
}).ExecuteCommand();
|
||||||
logger.Info("Insert_MachineRecord完成");
|
logger.Info("Insert_MachineRecord完成");
|
||||||
|
|
||||||
|
@ -224,7 +294,7 @@ namespace DM_Weight.ViewModels
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
if (f.Data)
|
if (f.Data)
|
||||||
{
|
{
|
||||||
logger.Info("更新屏显库存singleChannels");
|
logger.Info("更新屏显库存singleChannels");
|
||||||
// 更新屏显库存
|
// 更新屏显库存
|
||||||
|
@ -282,7 +352,7 @@ namespace DM_Weight.ViewModels
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -305,11 +375,11 @@ namespace DM_Weight.ViewModels
|
||||||
|
|
||||||
public void FindDrawerCount()
|
public void FindDrawerCount()
|
||||||
{
|
{
|
||||||
int count = SqlSugarHelper.Db.Queryable<ChannelList>().Where(cs => cs.DrawerType != 3)
|
//int count = SqlSugarHelper.Db.Queryable<ChannelList>().Where(cs => cs.DrawerType != 3)
|
||||||
.Where(cs => cs.MachineId.Equals(ConfigurationManager.AppSettings["machineId"] ?? "DM1")).GroupBy(cs => cs.DrawerNo).Select(cs => SqlFunc.AggregateCount(cs.DrawerNo)).Count();
|
// .Where(cs => cs.MachineId.Equals(ConfigurationManager.AppSettings["machineId"] ?? "DM1")).GroupBy(cs => cs.DrawerNo).Select(cs => SqlFunc.AggregateCount(cs.DrawerNo)).Count();
|
||||||
Is8Drawer = count < 9;
|
Is8Drawer = App.SingleModel; //count < 9;
|
||||||
Is16Drawer = count >= 16;
|
Is16Drawer = !App.SingleModel; //count >= 16;
|
||||||
Is17Drawer = count > 16;
|
Is17Drawer = false;//count > 16;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,12 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace DM_Weight.ViewModels
|
||||||
|
{
|
||||||
|
internal class EmptyWindowViewModel
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
|
@ -38,7 +38,7 @@ namespace DM_Weight.ViewModels
|
||||||
private int loginMode = Convert.ToInt32(ConfigurationManager.AppSettings["loginMode"]?.ToString() ?? "1");
|
private int loginMode = Convert.ToInt32(ConfigurationManager.AppSettings["loginMode"]?.ToString() ?? "1");
|
||||||
public bool MultiLogin
|
public bool MultiLogin
|
||||||
{
|
{
|
||||||
get => loginMode == 2;
|
get => !App.SingleModel;// loginMode == 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
private PremissionDm? _selectedMenu;
|
private PremissionDm? _selectedMenu;
|
||||||
|
@ -206,7 +206,7 @@ namespace DM_Weight.ViewModels
|
||||||
logger.Info($"用户【{Operator?.Nickname}】退出登录");
|
logger.Info($"用户【{Operator?.Nickname}】退出登录");
|
||||||
Operator = null;
|
Operator = null;
|
||||||
Reviewer = null;
|
Reviewer = null;
|
||||||
_regionManager.RequestNavigate("MainRegion", "LoginWindow");
|
_regionManager.RequestNavigate("MainRegion", "BeforeLogin");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -358,7 +358,7 @@ namespace DM_Weight.ViewModels
|
||||||
Reviewer = null;
|
Reviewer = null;
|
||||||
Application.Current.Dispatcher.Invoke(() =>
|
Application.Current.Dispatcher.Invoke(() =>
|
||||||
{
|
{
|
||||||
_regionManager.RequestNavigate("MainRegion", "LoginWindow");
|
_regionManager.RequestNavigate("MainRegion", "BeforeLogin");
|
||||||
});
|
});
|
||||||
AlertMsg alertMsg = new AlertMsg
|
AlertMsg alertMsg = new AlertMsg
|
||||||
{
|
{
|
||||||
|
@ -394,7 +394,7 @@ namespace DM_Weight.ViewModels
|
||||||
Reviewer = null;
|
Reviewer = null;
|
||||||
Application.Current.Dispatcher.Invoke(() =>
|
Application.Current.Dispatcher.Invoke(() =>
|
||||||
{
|
{
|
||||||
_regionManager.RequestNavigate("MainRegion", "LoginWindow");
|
_regionManager.RequestNavigate("MainRegion", "BeforeLogin");
|
||||||
timer.Stop();
|
timer.Stop();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -433,7 +433,7 @@ namespace DM_Weight.ViewModels
|
||||||
logger.Info($"用户【{Operator?.Nickname}】退出登录");
|
logger.Info($"用户【{Operator?.Nickname}】退出登录");
|
||||||
Operator = null;
|
Operator = null;
|
||||||
Reviewer = null;
|
Reviewer = null;
|
||||||
_regionManager.RequestNavigate("MainRegion", "LoginWindow");
|
_regionManager.RequestNavigate("MainRegion", "BeforeLogin");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -453,7 +453,7 @@ namespace DM_Weight.ViewModels
|
||||||
logger.Info($"用户【{Operator?.Nickname}】退出登录");
|
logger.Info($"用户【{Operator?.Nickname}】退出登录");
|
||||||
Operator = null;
|
Operator = null;
|
||||||
Reviewer = null;
|
Reviewer = null;
|
||||||
_regionManager.RequestNavigate("MainRegion", "LoginWindow");
|
_regionManager.RequestNavigate("MainRegion", "BeforeLogin");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -474,7 +474,7 @@ namespace DM_Weight.ViewModels
|
||||||
logger.Info($"用户【{Operator?.Nickname}】退出登录");
|
logger.Info($"用户【{Operator?.Nickname}】退出登录");
|
||||||
Operator = null;
|
Operator = null;
|
||||||
Reviewer = null;
|
Reviewer = null;
|
||||||
_regionManager.RequestNavigate("MainRegion", "LoginWindow");
|
_regionManager.RequestNavigate("MainRegion", "BeforeLogin");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -493,7 +493,7 @@ namespace DM_Weight.ViewModels
|
||||||
logger.Info($"用户【{Operator?.Nickname}】退出登录");
|
logger.Info($"用户【{Operator?.Nickname}】退出登录");
|
||||||
Operator = null;
|
Operator = null;
|
||||||
Reviewer = null;
|
Reviewer = null;
|
||||||
_regionManager.RequestNavigate("MainRegion", "LoginWindow");
|
_regionManager.RequestNavigate("MainRegion", "BeforeLogin");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -512,7 +512,7 @@ namespace DM_Weight.ViewModels
|
||||||
logger.Info($"用户【{Operator?.Nickname}】退出登录");
|
logger.Info($"用户【{Operator?.Nickname}】退出登录");
|
||||||
Operator = null;
|
Operator = null;
|
||||||
Reviewer = null;
|
Reviewer = null;
|
||||||
_regionManager.RequestNavigate("MainRegion", "LoginWindow");
|
_regionManager.RequestNavigate("MainRegion", "BeforeLogin");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -177,6 +177,54 @@ namespace DM_Weight.ViewModels
|
||||||
{
|
{
|
||||||
if (Status == 0)
|
if (Status == 0)
|
||||||
{
|
{
|
||||||
|
//if (App.CurrentFaUserList.Role != null)
|
||||||
|
//{
|
||||||
|
// //查看当前用户是否有所在药品抽屉的权限
|
||||||
|
// bool bLessEight = ChannelStocks.Select(it => it.DrawerNo).Where(n => n <= 8).Any();
|
||||||
|
// bool bMoreEight = ChannelStocks.Select(it => it.DrawerNo).Where(n => n > 8 && n < 17).Any();
|
||||||
|
// bool bEqualEight = ChannelStocks.Select(it => it.DrawerNo).Where(n => n == 17).Any();
|
||||||
|
// if (bLessEight)
|
||||||
|
// {
|
||||||
|
// if (App.CurrentFaUserList.Role.FirstEightChecked == "0")
|
||||||
|
// {
|
||||||
|
// AlertMsg alertMsg = new AlertMsg
|
||||||
|
// {
|
||||||
|
// Message = "当前用户没有打开抽屉的权限!",
|
||||||
|
// Type = MsgType.ERROR,
|
||||||
|
// };
|
||||||
|
// _eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// if (bMoreEight)
|
||||||
|
// {
|
||||||
|
// if (App.CurrentFaUserList.Role.LastEightChecked == "0")
|
||||||
|
// {
|
||||||
|
// AlertMsg alertMsg = new AlertMsg
|
||||||
|
// {
|
||||||
|
// Message = "当前用户没有打开抽屉的权限!",
|
||||||
|
// Type = MsgType.ERROR,
|
||||||
|
// };
|
||||||
|
// _eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// if (bEqualEight)
|
||||||
|
// {
|
||||||
|
// if (App.CurrentFaUserList.Role.StorageBoxChecked == "0")
|
||||||
|
// {
|
||||||
|
// AlertMsg alertMsg = new AlertMsg
|
||||||
|
// {
|
||||||
|
// Message = "当前用户没有打开抽屉的权限!",
|
||||||
|
// Type = MsgType.ERROR,
|
||||||
|
// };
|
||||||
|
// _eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
//}
|
||||||
|
|
||||||
enumerator.MoveNext();
|
enumerator.MoveNext();
|
||||||
Status = 1;
|
Status = 1;
|
||||||
OpenOneByOne();
|
OpenOneByOne();
|
||||||
|
@ -202,15 +250,15 @@ namespace DM_Weight.ViewModels
|
||||||
|
|
||||||
if ((singleChannels.Count > 0 ? singleChannels[0].BoardType : 1) == 5)
|
if ((singleChannels.Count > 0 ? singleChannels[0].BoardType : 1) == 5)
|
||||||
{
|
{
|
||||||
List<ChannelStock> ChannelLst = channelStocks.Where(it => it.BoardType != 1)
|
//List<ChannelStock> ChannelLst = channelStocks.Where(it => it.BoardType != 1)
|
||||||
.GroupBy(it => it.ColNo)
|
// .GroupBy(it => it.ColNo)
|
||||||
.Select(it =>
|
// .Select(it =>
|
||||||
{
|
// {
|
||||||
var ret = it.First();
|
// var ret = it.First();
|
||||||
ret.Quantity = it.Sum(itx => itx.Quantity);
|
// ret.Quantity = it.Sum(itx => itx.Quantity);
|
||||||
ret.AddQuantity = it.Sum(itx => itx.AddQuantity);
|
// ret.AddQuantity = it.Sum(itx => itx.AddQuantity);
|
||||||
return ret;
|
// return ret;
|
||||||
}).ToList();
|
// }).ToList();
|
||||||
|
|
||||||
// 发送加药数量
|
// 发送加药数量
|
||||||
singleChannels.ForEach(it =>
|
singleChannels.ForEach(it =>
|
||||||
|
@ -269,7 +317,8 @@ namespace DM_Weight.ViewModels
|
||||||
ManuNo = it.ManuNo,
|
ManuNo = it.ManuNo,
|
||||||
EffDate = it.EffDate,
|
EffDate = it.EffDate,
|
||||||
Id = it.Id,
|
Id = it.Id,
|
||||||
}).UpdateColumns(it => new { it.Quantity, it.ManuNo, it.EffDate }).ExecuteCommand();
|
FillTime=it.Quantity<=0||it.FillTime==null ? DateTime.Now : it.FillTime
|
||||||
|
}).UpdateColumns(it => new { it.Quantity, it.ManuNo, it.EffDate,it.FillTime }).ExecuteCommand();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -299,6 +348,7 @@ namespace DM_Weight.ViewModels
|
||||||
ManuNo = recordList[0].ManuNo,
|
ManuNo = recordList[0].ManuNo,
|
||||||
EffDate = recordList[0].EffDate,
|
EffDate = recordList[0].EffDate,
|
||||||
Id = recordList[0].Id,
|
Id = recordList[0].Id,
|
||||||
|
FillTime=recordList[0].Quantity <= 0 || recordList[0].FillTime == null ? DateTime.Now : recordList[0].FillTime
|
||||||
}).Where(item => item.Id == item.Id).ExecuteCommand();
|
}).Where(item => item.Id == item.Id).ExecuteCommand();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -316,7 +366,8 @@ namespace DM_Weight.ViewModels
|
||||||
DrawerType = it.DrawerType,
|
DrawerType = it.DrawerType,
|
||||||
BoardType = it.BoardType,
|
BoardType = it.BoardType,
|
||||||
Id = Guid.NewGuid().ToString(),
|
Id = Guid.NewGuid().ToString(),
|
||||||
MachineId = ConfigurationManager.AppSettings["machineId"] ?? "DM1"
|
MachineId = ConfigurationManager.AppSettings["machineId"] ?? "DM1",
|
||||||
|
FillTime = DateTime.Now
|
||||||
}).ExecuteCommand();
|
}).ExecuteCommand();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -367,7 +418,7 @@ namespace DM_Weight.ViewModels
|
||||||
{
|
{
|
||||||
//将库位多批次的总库存数更新标签
|
//将库位多批次的总库存数更新标签
|
||||||
_portUtil.WriteQuantity(singleChannels[0].DrawerNo, singleChannels[0].ColNo, singleChannels.Sum(it => it.Quantity) + singleChannels.Sum(it => it.AddQuantity));
|
_portUtil.WriteQuantity(singleChannels[0].DrawerNo, singleChannels[0].ColNo, singleChannels.Sum(it => it.Quantity) + singleChannels.Sum(it => it.AddQuantity));
|
||||||
|
Thread.Sleep(200);
|
||||||
//singleChannels.ForEach(it =>
|
//singleChannels.ForEach(it =>
|
||||||
//{
|
//{
|
||||||
// _portUtil.WriteQuantity(it.DrawerNo, it.ColNo, it.Quantity + it.AddQuantity);
|
// _portUtil.WriteQuantity(it.DrawerNo, it.ColNo, it.Quantity + it.AddQuantity);
|
||||||
|
|
|
@ -11,6 +11,7 @@ using Prism.Regions;
|
||||||
using Prism.Services.Dialogs;
|
using Prism.Services.Dialogs;
|
||||||
using SqlSugar;
|
using SqlSugar;
|
||||||
using System;
|
using System;
|
||||||
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Collections.ObjectModel;
|
using System.Collections.ObjectModel;
|
||||||
using System.Configuration;
|
using System.Configuration;
|
||||||
|
@ -18,6 +19,7 @@ using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows.Documents;
|
||||||
|
|
||||||
namespace DM_Weight.ViewModels
|
namespace DM_Weight.ViewModels
|
||||||
{
|
{
|
||||||
|
@ -289,7 +291,7 @@ namespace DM_Weight.ViewModels
|
||||||
if (SelectedInvoice != null)
|
if (SelectedInvoice != null)
|
||||||
{
|
{
|
||||||
//先查询有几种药
|
//先查询有几种药
|
||||||
string strSql = @"SELECT sum(Quantity) AS SumQuantity, COUNT(ID) AS CountNum,INVOICE_NO AS InvoiceNo,drug_id AS DrugId,QUANTITY AS quantity,drug_manu_no AS drugManuNo FROM IN_OUT_INVOICE WHERE INVOICE_NO=@INVOICE_NO GROUP BY INVOICE_NO,DRUG_ID";
|
string strSql = @"SELECT SUM(IF(di.small_unit=io.units,io.quantity,io.quantity*di.convert_ratio)) AS SumQuantity, COUNT(io.ID) AS CountNum,io.INVOICE_NO AS InvoiceNo,io.drug_id AS DrugId,io.QUANTITY AS quantity,io.drug_manu_no AS drugManuNo FROM IN_OUT_INVOICE io inner join drug_info di on io.drug_id=di.drug_id WHERE io.INVOICE_NO=@INVOICE_NO GROUP BY io.INVOICE_NO,io.DRUG_ID";
|
||||||
|
|
||||||
var invoices = SqlSugarHelper.Db.SqlQueryable<InOutInvoice>(strSql)
|
var invoices = SqlSugarHelper.Db.SqlQueryable<InOutInvoice>(strSql)
|
||||||
.AddParameters(new
|
.AddParameters(new
|
||||||
|
@ -304,7 +306,9 @@ namespace DM_Weight.ViewModels
|
||||||
List<ChannelList> channelL = SqlSugarHelper.Db.Queryable<ChannelList>()
|
List<ChannelList> channelL = SqlSugarHelper.Db.Queryable<ChannelList>()
|
||||||
.Includes(cl => cl.Drug, di => di.DrugManuNos)
|
.Includes(cl => cl.Drug, di => di.DrugManuNos)
|
||||||
//.Includes(cl => cl.channelStocks, dr => dr.DrugInfo, d => d.DrugManuNos)
|
//.Includes(cl => cl.channelStocks, dr => dr.DrugInfo, d => d.DrugManuNos)
|
||||||
.Where(cl => cl.DrugId == invoices[i].DrugId && cl.MachineId == (ConfigurationManager.AppSettings["machineId"] ?? "DM1")).ToList();
|
.Where(cl => cl.DrugId == invoices[i].DrugId && cl.MachineId == (ConfigurationManager.AppSettings["machineId"] ?? "DM1"))
|
||||||
|
.Where(cl=>cl.DrawerNo>2&&cl.DrawerType==1) //调拨只能往周转库调住院药房3~16为周转库
|
||||||
|
.ToList();
|
||||||
ChannelList channelLst = channelL.Count > 0 ? channelL[0] : null;
|
ChannelList channelLst = channelL.Count > 0 ? channelL[0] : null;
|
||||||
if (channelLst == null || channelLst.Id is null)
|
if (channelLst == null || channelLst.Id is null)
|
||||||
{
|
{
|
||||||
|
@ -317,18 +321,20 @@ namespace DM_Weight.ViewModels
|
||||||
//_eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
|
//_eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
ChannelStock stock = new ChannelStock();
|
//ChannelStock stock = new ChannelStock();
|
||||||
//查询每种药有多少个批次
|
//查询每种药有多少个批次
|
||||||
var invoicesManuNo = SqlSugarHelper.Db.Queryable<InOutInvoice>()
|
var invoicesManuNo = SqlSugarHelper.Db.Queryable<InOutInvoice>().Includes<DrugInfo>(oi=>oi.DrugInfo).InnerJoin<DrugInfo>((oi,di)=>oi.DrugId==di.DrugId)
|
||||||
.Where(iManuNo => iManuNo.InvoiceNo == invoices[i].InvoiceNo && iManuNo.DrugId == invoices[i].DrugId).ToList();
|
.Where(oi => oi.InvoiceNo == invoices[i].InvoiceNo && oi.DrugId == invoices[i].DrugId && oi.Status == 2 && oi.Type == 2 && oi.CancelFlag == 0).ToList();
|
||||||
for (int j = 0; j < invoicesManuNo.Count; j++)
|
for (int j = 0; j < invoicesManuNo.Count; j++)
|
||||||
{
|
{
|
||||||
//查询是否有库存
|
//查询是否有库存
|
||||||
List<ChannelStock> stockList = SqlSugarHelper.Db.Queryable<ChannelStock>()
|
List<ChannelStock> stockList = SqlSugarHelper.Db.Queryable<ChannelStock>()
|
||||||
.Where(cs => cs.ManuNo == invoicesManuNo[j].DrugManuNo && cs.DrugId == invoicesManuNo[j].DrugId && cs.MachineId == (ConfigurationManager.AppSettings["machineId"] ?? "DM1")).ToList();
|
.Where(cs => cs.ManuNo == invoicesManuNo[j].DrugManuNo && cs.DrugId == invoicesManuNo[j].DrugId && cs.MachineId == (ConfigurationManager.AppSettings["machineId"] ?? "DM1"))
|
||||||
stock = stockList.Count > 0 ? stockList[0] : new ChannelStock();
|
.Where(cs=>cs.DrawerNo>2)
|
||||||
|
.ToList();
|
||||||
|
//stock = stockList.Count > 0 ? stockList[0] : new ChannelStock();
|
||||||
List<DrugManuNo> manuNoList = SqlSugarHelper.Db.Queryable<DrugManuNo>().Where(dm => dm.ManuNo == invoicesManuNo[j].DrugManuNo && dm.DrugId == invoicesManuNo[j].DrugId).ToList();
|
List<DrugManuNo> manuNoList = SqlSugarHelper.Db.Queryable<DrugManuNo>().Where(dm => dm.ManuNo == invoicesManuNo[j].DrugManuNo && dm.DrugId == invoicesManuNo[j].DrugId).ToList();
|
||||||
if (stock == null || stock.Id is null)
|
if (stockList == null || stockList.Count <= 0)
|
||||||
{
|
{
|
||||||
if (manuNoList == null || manuNoList.Count <= 0)
|
if (manuNoList == null || manuNoList.Count <= 0)
|
||||||
{
|
{
|
||||||
|
@ -341,6 +347,7 @@ namespace DM_Weight.ViewModels
|
||||||
_eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
|
_eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
ChannelStock stock = new ChannelStock();
|
||||||
//没有库存写入一条数据
|
//没有库存写入一条数据
|
||||||
stock.MachineId = ConfigurationManager.AppSettings["machineId"] ?? "DM1";
|
stock.MachineId = ConfigurationManager.AppSettings["machineId"] ?? "DM1";
|
||||||
stock.DrawerNo = channelLst.DrawerNo;
|
stock.DrawerNo = channelLst.DrawerNo;
|
||||||
|
@ -351,13 +358,24 @@ namespace DM_Weight.ViewModels
|
||||||
stock.ManuNo = invoicesManuNo[j].DrugManuNo;
|
stock.ManuNo = invoicesManuNo[j].DrugManuNo;
|
||||||
stock.EffDate = manuNoList[0].EffDate;
|
stock.EffDate = manuNoList[0].EffDate;
|
||||||
stock.Chnguid = channelLst.Id;
|
stock.Chnguid = channelLst.Id;
|
||||||
|
stockList.Add(stock);
|
||||||
}
|
}
|
||||||
stock.AddQuantity = invoicesManuNo[j].quantity;
|
//stock.AddQuantity = invoicesManuNo[j].quantity;
|
||||||
|
//stockList.ForEach(s => s.AddQuantity = invoicesManuNo[j].quantity);
|
||||||
|
stockList.GroupBy(x => x.ManuNo)
|
||||||
|
.Select(it =>
|
||||||
|
{
|
||||||
|
var ret = it.First();
|
||||||
|
ret.AddQuantity = invoicesManuNo[j].Units== invoicesManuNo[j].DrugInfo.SmallUnit? invoicesManuNo[j].quantity: invoicesManuNo[j].quantity* invoicesManuNo[j].DrugInfo.ConvertRatio;
|
||||||
|
return ret;
|
||||||
|
})
|
||||||
|
.ToList();
|
||||||
|
|
||||||
if (channelLst.channelStocks == null)
|
if (channelLst.channelStocks == null)
|
||||||
{
|
{
|
||||||
channelLst.channelStocks = new List<ChannelStock>();
|
channelLst.channelStocks = new List<ChannelStock>();
|
||||||
}
|
}
|
||||||
channelLst.channelStocks.Add(stock);
|
channelLst.channelStocks.AddRange(stockList);
|
||||||
}
|
}
|
||||||
|
|
||||||
InOutInvoice copy = TransExpV2<InOutInvoice, InOutInvoice>.Trans(invoices[i]);
|
InOutInvoice copy = TransExpV2<InOutInvoice, InOutInvoice>.Trans(invoices[i]);
|
||||||
|
@ -390,6 +408,27 @@ namespace DM_Weight.ViewModels
|
||||||
{
|
{
|
||||||
if (Status == 0)
|
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();
|
enumerator.MoveNext();
|
||||||
Status = 1;
|
Status = 1;
|
||||||
OpenOneByOne();
|
OpenOneByOne();
|
||||||
|
@ -402,7 +441,13 @@ namespace DM_Weight.ViewModels
|
||||||
List<ChannelStock> channelStocks = grouping.ToList();
|
List<ChannelStock> channelStocks = grouping.ToList();
|
||||||
channelStocks.ForEach(it => it.process = 1);
|
channelStocks.ForEach(it => it.process = 1);
|
||||||
_portUtil.SpeakAsync("正在打开" + DrawerNo + "号抽屉");
|
_portUtil.SpeakAsync("正在打开" + DrawerNo + "号抽屉");
|
||||||
List<ChannelStock> singleChannels = channelStocks.GroupBy(it => new
|
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.DrawerNo,
|
||||||
it.ColNo
|
it.ColNo
|
||||||
|
@ -422,7 +467,13 @@ namespace DM_Weight.ViewModels
|
||||||
|
|
||||||
if ((singleChannels.Count > 0 ? singleChannels[0].BoardType : 1) == 5)
|
if ((singleChannels.Count > 0 ? singleChannels[0].BoardType : 1) == 5)
|
||||||
{
|
{
|
||||||
List<ChannelStock> ChannelLst = channelStocks.Where(it => it.BoardType != 1)
|
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)
|
.GroupBy(it => it.ColNo)
|
||||||
.Select(it =>
|
.Select(it =>
|
||||||
{
|
{
|
||||||
|
@ -474,6 +525,10 @@ namespace DM_Weight.ViewModels
|
||||||
|
|
||||||
|
|
||||||
ChannelStock it = record[i];
|
ChannelStock it = record[i];
|
||||||
|
if(it.AddQuantity<=0)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
if (it.BoardType == 6 && it.PosNo == 0)
|
if (it.BoardType == 6 && it.PosNo == 0)
|
||||||
{
|
{
|
||||||
_portUtil.SetNumCount(it.DrawerNo, it.ColNo, it.AddQuantity);
|
_portUtil.SetNumCount(it.DrawerNo, it.ColNo, it.AddQuantity);
|
||||||
|
@ -501,7 +556,7 @@ namespace DM_Weight.ViewModels
|
||||||
}
|
}
|
||||||
//查询现有库位中是否有库存为0的记录,如果有直接update
|
//查询现有库位中是否有库存为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();
|
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)
|
if (recordHistory != null && recordHistory.Id != null)
|
||||||
{
|
{
|
||||||
SqlSugarHelper.Db.Updateable<ChannelStock>().SetColumns(item => new ChannelStock()
|
SqlSugarHelper.Db.Updateable<ChannelStock>().SetColumns(item => new ChannelStock()
|
||||||
{
|
{
|
||||||
|
@ -563,7 +618,7 @@ namespace DM_Weight.ViewModels
|
||||||
{
|
{
|
||||||
//根据ChannelLsts中的库位,删除该库位库存为0的记录
|
//根据ChannelLsts中的库位,删除该库位库存为0的记录
|
||||||
SqlSugarHelper.Db.Deleteable<ChannelStock>()
|
SqlSugarHelper.Db.Deleteable<ChannelStock>()
|
||||||
.Where(cs => cs.Quantity <= 0 && cs.DrawerNo == ChannelLsts[i].channelStocks[0].DrawerNo && cs.ColNo == ChannelLsts[i].channelStocks[0].ColNo).ExecuteCommand();
|
.Where(cs => cs.Quantity <= 0 && cs.DrugId == ChannelLsts[i].DrugId && cs.MachineId == ChannelLsts[i].MachineId).ExecuteCommand();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
@ -572,7 +627,7 @@ namespace DM_Weight.ViewModels
|
||||||
{
|
{
|
||||||
// 更新屏显库存
|
// 更新屏显库存
|
||||||
//List<ChannelStock> singleChannels = record.FindAll(it => it.BoardType != 1);
|
//List<ChannelStock> singleChannels = record.FindAll(it => it.BoardType != 1);
|
||||||
List<ChannelStock> singleChannels = record.Where(it => it.BoardType != 1)
|
List<ChannelStock> singleChannels = record.Where(it => it.BoardType != 1&&it.AddQuantity>0)
|
||||||
.GroupBy(it => new { it.DrawerNo, it.ColNo })
|
.GroupBy(it => new { it.DrawerNo, it.ColNo })
|
||||||
.Select(it =>
|
.Select(it =>
|
||||||
{
|
{
|
||||||
|
@ -589,9 +644,9 @@ namespace DM_Weight.ViewModels
|
||||||
if (singleChannels[i].BoardType == 5)
|
if (singleChannels[i].BoardType == 5)
|
||||||
{
|
{
|
||||||
List<ChannelStock> channelStockEffDate = SqlSugarHelper.Db.Queryable<ChannelStock>()
|
List<ChannelStock> channelStockEffDate = SqlSugarHelper.Db.Queryable<ChannelStock>()
|
||||||
.Where(cs => cs.MachineId==singleChannels[i].MachineId)
|
.Where(cs => cs.MachineId == singleChannels[i].MachineId)
|
||||||
.Where(cs => cs.DrawerNo == singleChannels[i].DrawerNo)
|
.Where(cs => cs.DrawerNo == singleChannels[i].DrawerNo)
|
||||||
.Where(cs => cs.ColNo == singleChannels[i].ColNo)
|
.Where(cs => cs.ColNo == singleChannels[i].ColNo&&cs.Quantity>0)
|
||||||
.OrderBy(cs => cs.EffDate).ToList();
|
.OrderBy(cs => cs.EffDate).ToList();
|
||||||
int totalQuantity = channelStockEffDate.Sum(it => it.Quantity);
|
int totalQuantity = channelStockEffDate.Sum(it => it.Quantity);
|
||||||
|
|
||||||
|
@ -693,11 +748,11 @@ namespace DM_Weight.ViewModels
|
||||||
var sb = new StringBuilder();
|
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("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(" SELECT count(1) as Count, i.InvoiceNo, i.InvoiceDate, sum(i.quantity) as quantity, p1.pharmacy_name as PharmacyName1, p2.pharmacy_name PharmacyName2 from ");
|
sb.Append(" SELECT count(1) as Count, i.InvoiceNo, i.InvoiceDate, sum(i.quantity) as quantity, p1.pharmacy_name as PharmacyName1, p2.pharmacy_name PharmacyName2 from ");
|
||||||
sb.Append(" (SELECT drug_id,in_pharmacy_id,out_pharmacy_id, invoice_no as InvoiceNo, DATE_FORMAT(Invoice_Date,'%Y-%m-%d') as InvoiceDate, SUM(quantity) as quantity ");
|
sb.Append(" (SELECT io.drug_id,io.in_pharmacy_id,io.out_pharmacy_id, io.invoice_no as InvoiceNo, DATE_FORMAT(io.Invoice_Date,'%Y-%m-%d') as InvoiceDate, SUM(IF(di.small_unit=io.units,io.quantity,io.quantity*di.convert_ratio)) as quantity ");
|
||||||
sb.Append(" FROM in_out_invoice where status=@Status and type!=@type and cancel_flag=@CancelFlag GROUP BY invoice_no,drug_id) i ");
|
sb.Append(" FROM in_out_invoice io inner join drug_info di on io.drug_id=di.drug_id where io.status=@Status and io.type=@type and io.cancel_flag=@CancelFlag GROUP BY io.invoice_no,io.drug_id) i ");
|
||||||
sb.Append(" inner join ( select c.drug_id as drug_id from channel_list c where c.machine_id = '" + (ConfigurationManager.AppSettings["machineId"] ?? "DM1") + "' group by c.drug_id ) di on di.drug_id = i.drug_id");
|
sb.Append(" inner join ( select c.drug_id as drug_id from channel_list 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 p1 on p1.pharmacy = i.in_pharmacy_id");
|
||||||
sb.Append(" left join pharmacy_info p2 on p2.pharmacy_id = i.out_pharmacy_id where 1=1");
|
sb.Append(" left join pharmacy_info p2 on p2.pharmacy = i.out_pharmacy_id where 1=1");
|
||||||
//sb.Append(" where i.status=@Status ");
|
//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 ");
|
//sb.Append(" and i.cancel_flag=@CancelFlag ");
|
||||||
|
@ -718,7 +773,7 @@ namespace DM_Weight.ViewModels
|
||||||
Invoices = SqlSugarHelper.Db.SqlQueryable<dynamic>(sb.ToString())
|
Invoices = SqlSugarHelper.Db.SqlQueryable<dynamic>(sb.ToString())
|
||||||
.AddParameters(new
|
.AddParameters(new
|
||||||
{
|
{
|
||||||
Status = 0,
|
Status = 2,
|
||||||
type = 2,
|
type = 2,
|
||||||
CancelFlag = 0,
|
CancelFlag = 0,
|
||||||
CreateTime = OrderDate,
|
CreateTime = OrderDate,
|
||||||
|
|
|
@ -214,8 +214,8 @@ namespace DM_Weight.ViewModels
|
||||||
var sb = new StringBuilder();
|
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("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(" 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 p1 on p1.pharmacy = 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 p2 on p2.pharmacy = i.out_pharmacy_id");
|
||||||
sb.Append(" where i.status=@Status ");
|
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 ");
|
sb.Append(" and i.cancel_flag=@CancelFlag ");
|
||||||
|
|
|
@ -252,6 +252,54 @@ namespace DM_Weight.ViewModels
|
||||||
{
|
{
|
||||||
if (Status == 0)
|
if (Status == 0)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
//if (App.CurrentFaUserList.Role != null)
|
||||||
|
//{
|
||||||
|
// //查看当前用户是否有所在药品抽屉的权限
|
||||||
|
// bool bLessEight = ChannelStocks.Select(it => it.DrawerNo).Where(n => n <= 8).Any();
|
||||||
|
// bool bMoreEight = ChannelStocks.Select(it => it.DrawerNo).Where(n => n > 8 && n < 17).Any();
|
||||||
|
// bool bEqualEight = ChannelStocks.Select(it => it.DrawerNo).Where(n => n == 17).Any();
|
||||||
|
// if (bLessEight)
|
||||||
|
// {
|
||||||
|
// if (App.CurrentFaUserList.Role.FirstEightChecked == "0")
|
||||||
|
// {
|
||||||
|
// AlertMsg alertMsg = new AlertMsg
|
||||||
|
// {
|
||||||
|
// Message = "当前用户没有打开抽屉的权限!",
|
||||||
|
// Type = MsgType.ERROR,
|
||||||
|
// };
|
||||||
|
// _eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// if (bMoreEight)
|
||||||
|
// {
|
||||||
|
// if (App.CurrentFaUserList.Role.LastEightChecked == "0")
|
||||||
|
// {
|
||||||
|
// AlertMsg alertMsg = new AlertMsg
|
||||||
|
// {
|
||||||
|
// Message = "当前用户没有打开抽屉的权限!",
|
||||||
|
// Type = MsgType.ERROR,
|
||||||
|
// };
|
||||||
|
// _eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// if (bEqualEight)
|
||||||
|
// {
|
||||||
|
// if (App.CurrentFaUserList.Role.StorageBoxChecked == "0")
|
||||||
|
// {
|
||||||
|
// AlertMsg alertMsg = new AlertMsg
|
||||||
|
// {
|
||||||
|
// Message = "当前用户没有打开抽屉的权限!",
|
||||||
|
// Type = MsgType.ERROR,
|
||||||
|
// };
|
||||||
|
// _eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
//}
|
||||||
enumerable = ChannelStocks.GroupBy(cs => cs.DrawerNo, cs => cs);
|
enumerable = ChannelStocks.GroupBy(cs => cs.DrawerNo, cs => cs);
|
||||||
enumerator = enumerable.GetEnumerator();
|
enumerator = enumerable.GetEnumerator();
|
||||||
enumerator.MoveNext();
|
enumerator.MoveNext();
|
||||||
|
@ -365,7 +413,7 @@ namespace DM_Weight.ViewModels
|
||||||
{
|
{
|
||||||
//将库位多批次的总库存数更新标签
|
//将库位多批次的总库存数更新标签
|
||||||
_portUtil.WriteQuantity(singleChannels[0].DrawerNo, singleChannels[0].ColNo, singleChannels.Sum(it => it.Quantity) - singleChannels.Sum(it => it.AddQuantity));
|
_portUtil.WriteQuantity(singleChannels[0].DrawerNo, singleChannels[0].ColNo, singleChannels.Sum(it => it.Quantity) - singleChannels.Sum(it => it.AddQuantity));
|
||||||
|
Thread.Sleep(200);
|
||||||
//singleChannels.ForEach(it =>
|
//singleChannels.ForEach(it =>
|
||||||
//{
|
//{
|
||||||
// _portUtil.WriteQuantity(it.DrawerNo, it.ColNo, it.Quantity - it.TakeQuantity);
|
// _portUtil.WriteQuantity(it.DrawerNo, it.ColNo, it.Quantity - it.TakeQuantity);
|
||||||
|
|
|
@ -46,13 +46,15 @@ namespace DM_Weight.ViewModels
|
||||||
|
|
||||||
public bool SingleLogin
|
public bool SingleLogin
|
||||||
{
|
{
|
||||||
get => ReadAppSetting("loginMode") == "1";
|
//get => ReadAppSetting("loginMode") == "1";
|
||||||
//get => loginMode == 1;
|
//get => loginMode == 1;
|
||||||
|
get;set;
|
||||||
}
|
}
|
||||||
public bool MultiLogin
|
public bool MultiLogin
|
||||||
{
|
{
|
||||||
//get => loginMode == 2;
|
//get => loginMode == 2;
|
||||||
get => ReadAppSetting("loginMode") == "2";
|
//get => ReadAppSetting("loginMode") == "2";
|
||||||
|
get;set;
|
||||||
}
|
}
|
||||||
private FingerprintUtil _fingerprintUtil;
|
private FingerprintUtil _fingerprintUtil;
|
||||||
|
|
||||||
|
@ -158,23 +160,29 @@ _exitCommand ??= new DelegateCommand(Exit);
|
||||||
|
|
||||||
if (userList == null)
|
if (userList == null)
|
||||||
{
|
{
|
||||||
AlertMsg alertMsg = new AlertMsg
|
System.Windows.Application.Current.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Send, new Action(() =>
|
||||||
{
|
{
|
||||||
Message = "无此用户",
|
AlertMsg alertMsg = new AlertMsg
|
||||||
Type = MsgType.ERROR
|
{
|
||||||
};
|
Message = "无此用户",
|
||||||
_eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
|
Type = MsgType.ERROR
|
||||||
|
};
|
||||||
|
_eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
|
||||||
|
}));
|
||||||
Username = "";
|
Username = "";
|
||||||
Password = "";
|
Password = "";
|
||||||
}
|
}
|
||||||
else if (userList.Role == null)
|
else if (userList.Role == null)
|
||||||
{
|
{
|
||||||
AlertMsg alertMsg = new AlertMsg
|
System.Windows.Application.Current.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Send, new Action(() =>
|
||||||
{
|
{
|
||||||
Message = "用户还未设置权限,请联系管理员",
|
AlertMsg alertMsg = new AlertMsg
|
||||||
Type = MsgType.ERROR
|
{
|
||||||
};
|
Message = "用户还未设置权限,请联系管理员",
|
||||||
_eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
|
Type = MsgType.ERROR
|
||||||
|
};
|
||||||
|
_eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
|
||||||
|
}));
|
||||||
Username = "";
|
Username = "";
|
||||||
Password = "";
|
Password = "";
|
||||||
}
|
}
|
||||||
|
@ -187,12 +195,15 @@ _exitCommand ??= new DelegateCommand(Exit);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
AlertMsg alertMsg = new AlertMsg
|
System.Windows.Application.Current.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Send, new Action(() =>
|
||||||
{
|
{
|
||||||
Message = "密码错误",
|
AlertMsg alertMsg = new AlertMsg
|
||||||
Type = MsgType.ERROR
|
{
|
||||||
};
|
Message = "密码错误",
|
||||||
_eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
|
Type = MsgType.ERROR
|
||||||
|
};
|
||||||
|
_eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
|
||||||
|
}));
|
||||||
Password = "";
|
Password = "";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -200,12 +211,15 @@ _exitCommand ??= new DelegateCommand(Exit);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
AlertMsg alertMsg = new AlertMsg
|
System.Windows.Application.Current.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Send, new Action(() =>
|
||||||
{
|
{
|
||||||
Message = "请输入账号或密码",
|
AlertMsg alertMsg = new AlertMsg
|
||||||
Type = MsgType.ERROR
|
{
|
||||||
};
|
Message = "请输入账号或密码",
|
||||||
_eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
|
Type = MsgType.ERROR
|
||||||
|
};
|
||||||
|
_eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
|
||||||
|
}));
|
||||||
}
|
}
|
||||||
LoginBtnEnable = true;
|
LoginBtnEnable = true;
|
||||||
}
|
}
|
||||||
|
@ -251,12 +265,15 @@ _exitCommand ??= new DelegateCommand(Exit);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
AlertMsg alertMsg = new AlertMsg
|
System.Windows.Application.Current.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Send, new Action(() =>
|
||||||
{
|
{
|
||||||
Message = "该发药人账号已登录,请输入不同账号",
|
AlertMsg alertMsg = new AlertMsg
|
||||||
Type = MsgType.ERROR
|
{
|
||||||
};
|
Message = "该发药人账号已登录,请输入不同账号",
|
||||||
_eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
|
Type = MsgType.ERROR
|
||||||
|
};
|
||||||
|
_eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
|
||||||
|
}));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// 如果已经录入了审核人, 已经有一个用户登录
|
// 如果已经录入了审核人, 已经有一个用户登录
|
||||||
|
@ -280,12 +297,15 @@ _exitCommand ??= new DelegateCommand(Exit);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
AlertMsg alertMsg = new AlertMsg
|
System.Windows.Application.Current.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Send, new Action(() =>
|
||||||
{
|
{
|
||||||
Message = "该审核人账号已登录,请输入不同账号",
|
AlertMsg alertMsg = new AlertMsg
|
||||||
Type = MsgType.ERROR
|
{
|
||||||
};
|
Message = "该审核人账号已登录,请输入不同账号",
|
||||||
_eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
|
Type = MsgType.ERROR
|
||||||
|
};
|
||||||
|
_eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
|
||||||
|
}));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// 第一个用户登录
|
// 第一个用户登录
|
||||||
|
@ -341,30 +361,36 @@ _exitCommand ??= new DelegateCommand(Exit);
|
||||||
{
|
{
|
||||||
UserList userList = SqlSugarHelper.Db.Queryable<UserList>()
|
UserList userList = SqlSugarHelper.Db.Queryable<UserList>()
|
||||||
.Includes<RoleDm>(u => u.Role)
|
.Includes<RoleDm>(u => u.Role)
|
||||||
.First(u => u.Id == msg.Id);
|
.First(u => u.Id == msg.Id&& ConfigurationManager.AppSettings["machineId"].ToString().Equals(u.MachineId));
|
||||||
|
|
||||||
//UserList userList = new UserService().CheckUserByFingerPrinter(msg.Id);
|
//UserList userList = new UserService().CheckUserByFingerPrinter(msg.Id);
|
||||||
|
|
||||||
logger.Info($"userList是空?{userList == null}");
|
logger.Info($"userList是空?{userList == null}");
|
||||||
if (userList == null)
|
if (userList == null)
|
||||||
{
|
{
|
||||||
AlertMsg alertMsg = new AlertMsg
|
System.Windows.Application.Current.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Send, new Action(() =>
|
||||||
{
|
{
|
||||||
Message = "无此用户",
|
AlertMsg alertMsg = new AlertMsg
|
||||||
Type = MsgType.ERROR
|
{
|
||||||
};
|
Message = "无此用户",
|
||||||
_eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
|
Type = MsgType.ERROR
|
||||||
|
};
|
||||||
|
_eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
|
||||||
|
}));
|
||||||
Username = "";
|
Username = "";
|
||||||
Password = "";
|
Password = "";
|
||||||
}
|
}
|
||||||
else if (userList.Role == null)
|
else if (userList.Role == null)
|
||||||
{
|
{
|
||||||
AlertMsg alertMsg = new AlertMsg
|
System.Windows.Application.Current.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Send, new Action(() =>
|
||||||
{
|
{
|
||||||
Message = "用户还未设置权限,请联系管理员",
|
AlertMsg alertMsg = new AlertMsg
|
||||||
Type = MsgType.ERROR
|
{
|
||||||
};
|
Message = "用户还未设置权限,请联系管理员",
|
||||||
_eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
|
Type = MsgType.ERROR
|
||||||
|
};
|
||||||
|
_eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
|
||||||
|
}));
|
||||||
Username = "";
|
Username = "";
|
||||||
Password = "";
|
Password = "";
|
||||||
}
|
}
|
||||||
|
@ -393,6 +419,9 @@ _exitCommand ??= new DelegateCommand(Exit);
|
||||||
//接收导航传过来的参数 现在是在此处初始化了表格数据
|
//接收导航传过来的参数 现在是在此处初始化了表格数据
|
||||||
public void OnNavigatedTo(NavigationContext navigationContext)
|
public void OnNavigatedTo(NavigationContext navigationContext)
|
||||||
{
|
{
|
||||||
|
SingleLogin = navigationContext.Parameters.GetValue<bool>("SingleLogin");
|
||||||
|
MultiLogin = !SingleLogin;
|
||||||
|
|
||||||
FingerMsg = !_fingerprintUtil.bIsConnected;//false;
|
FingerMsg = !_fingerprintUtil.bIsConnected;//false;
|
||||||
_eventAggregator.GetEvent<FingerprintEvent>().Subscribe(LoginEvent);
|
_eventAggregator.GetEvent<FingerprintEvent>().Subscribe(LoginEvent);
|
||||||
}
|
}
|
||||||
|
|
|
@ -341,6 +341,22 @@ namespace DM_Weight.ViewModels
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool KeepAlive => true;
|
public bool KeepAlive => true;
|
||||||
|
//导出处方登记专册
|
||||||
|
public DelegateCommand AccountCommand
|
||||||
|
{
|
||||||
|
get => new DelegateCommand(() => {
|
||||||
|
GridReportUtil.PrintReportOrderAccount(DrugInfo==null?"":DrugInfo.DrugId, StartDate, EndDate);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
//导出回收登记记录
|
||||||
|
public DelegateCommand ReturnRecordCommand
|
||||||
|
{
|
||||||
|
get => new DelegateCommand(() =>
|
||||||
|
{
|
||||||
|
GridReportUtil.PrintReportReturnEmpty(StartDate, EndDate);
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -18,6 +18,7 @@ using Unity;
|
||||||
using DM_Weight.Models;
|
using DM_Weight.Models;
|
||||||
using System.Runtime.CompilerServices;
|
using System.Runtime.CompilerServices;
|
||||||
using SqlSugar;
|
using SqlSugar;
|
||||||
|
using System.Configuration;
|
||||||
|
|
||||||
namespace DM_Weight.ViewModels
|
namespace DM_Weight.ViewModels
|
||||||
{
|
{
|
||||||
|
@ -75,17 +76,23 @@ namespace DM_Weight.ViewModels
|
||||||
_screenUtil = screenUtil;
|
_screenUtil = screenUtil;
|
||||||
_regionManager = regionManager;
|
_regionManager = regionManager;
|
||||||
_container = container;
|
_container = container;
|
||||||
_portUtil = portUtil;
|
_portUtil = portUtil;
|
||||||
//this.SqlSugarHelper.Db=sqlSugarScope;
|
//this.SqlSugarHelper.Db=sqlSugarScope;
|
||||||
|
|
||||||
System.Windows.Application.Current.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Send, new Action(() =>
|
System.Windows.Application.Current.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Send, new Action(() =>
|
||||||
{
|
{
|
||||||
_container.RegisterType<object, LoginWindow>("LoginWindow");
|
//_container.RegisterType<object, LoginWindow>("LoginWindow");
|
||||||
_regionManager.RequestNavigate("MainRegion", "LoginWindow");
|
//_regionManager.RequestNavigate("MainRegion", "LoginWindow");
|
||||||
|
|
||||||
|
_container.RegisterType<object, BeforeLogin>("BeforeLogin");
|
||||||
|
_regionManager.RequestNavigate("MainRegion", "BeforeLogin");
|
||||||
|
|
||||||
}));
|
}));
|
||||||
|
string bAutoWriteNum = ConfigurationManager.AppSettings["AutoWriteNum"] ?? "false";
|
||||||
Task.Factory.StartNew(() => BindStock());
|
if (bAutoWriteNum == "true")
|
||||||
|
{
|
||||||
|
Task.Factory.StartNew(() => BindStock());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void doMyPrismEvent2(AlertMsg msg)
|
void doMyPrismEvent2(AlertMsg msg)
|
||||||
|
@ -107,9 +114,12 @@ namespace DM_Weight.ViewModels
|
||||||
//写标签数量
|
//写标签数量
|
||||||
async Task BindStock()
|
async Task BindStock()
|
||||||
{
|
{
|
||||||
List<ChannelStock> singleChannels = SqlSugarHelper.Db.Queryable<ChannelStock>().Where(cs => cs.BoardType == 5&&cs.Quantity>0).Where(cs => cs.DrugId !=null).ToList();
|
List<ChannelStock> singleChannels = SqlSugarHelper.Db.Queryable<ChannelStock>().Where(cs => cs.BoardType == 5 && cs.Quantity > 0)
|
||||||
|
.Where(cs => cs.DrugId != null)
|
||||||
|
.Where(cs => cs.MachineId.Equals(ConfigurationManager.AppSettings["machineId"] ?? "DM1")).ToList();
|
||||||
singleChannels = singleChannels.GroupBy(cs => new { cs.DrawerNo, cs.ColNo })
|
singleChannels = singleChannels.GroupBy(cs => new { cs.DrawerNo, cs.ColNo })
|
||||||
.Select(cs => {
|
.Select(cs =>
|
||||||
|
{
|
||||||
var ret = cs.First();
|
var ret = cs.First();
|
||||||
ret.Quantity = cs.Sum(xt => xt.Quantity);
|
ret.Quantity = cs.Sum(xt => xt.Quantity);
|
||||||
return ret;
|
return ret;
|
||||||
|
|
|
@ -0,0 +1,619 @@
|
||||||
|
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 Prism.Services.Dialogs;
|
||||||
|
using SqlSugar;
|
||||||
|
using SqlSugar.Extensions;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Collections.ObjectModel;
|
||||||
|
using System.Configuration;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows.Threading;
|
||||||
|
|
||||||
|
namespace DM_Weight.ViewModels
|
||||||
|
{
|
||||||
|
public class MultiOrderTakeDialogViewModel : BindableBase, IDialogAware, IRegionMemberLifetime
|
||||||
|
{
|
||||||
|
private readonly ILog logger = LogManager.GetLogger(typeof(MultiOrderTakeDialogViewModel));
|
||||||
|
public string Title => "多处方取药";
|
||||||
|
|
||||||
|
|
||||||
|
public event Action<IDialogResult> RequestClose;
|
||||||
|
|
||||||
|
private static readonly DateTime Jan1st1970 = new DateTime
|
||||||
|
(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);
|
||||||
|
|
||||||
|
//取药人(科室)
|
||||||
|
private string receivePerson;
|
||||||
|
public string ReceivePerson
|
||||||
|
{
|
||||||
|
get => receivePerson;
|
||||||
|
set => SetProperty(ref receivePerson, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
private PortUtil _portUtil;
|
||||||
|
IEventAggregator _eventAggregator;
|
||||||
|
IDialogService _dialogService;
|
||||||
|
public MultiOrderTakeDialogViewModel(PortUtil portUtil, IEventAggregator eventAggregator, IDialogService DialogService)
|
||||||
|
{
|
||||||
|
_dialogService = DialogService;
|
||||||
|
_portUtil = portUtil;
|
||||||
|
_eventAggregator = eventAggregator;
|
||||||
|
}
|
||||||
|
|
||||||
|
void DoMyPrismEvent(DeviceMsg msg)
|
||||||
|
{
|
||||||
|
|
||||||
|
if (msg.WindowName == "OrderTakeDrugWindow")
|
||||||
|
{
|
||||||
|
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 int _status = 0;
|
||||||
|
|
||||||
|
public int Status
|
||||||
|
{
|
||||||
|
get => _status; set => SetProperty(ref _status, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
//多处方的处方号
|
||||||
|
private string _multiOrderNo = "处方号:";
|
||||||
|
public string MultiOrderNo
|
||||||
|
{
|
||||||
|
get => _multiOrderNo;
|
||||||
|
set => SetProperty(ref _multiOrderNo, value);
|
||||||
|
}
|
||||||
|
private ObservableCollection<OrderInfo>? _orderInfo;
|
||||||
|
|
||||||
|
|
||||||
|
public ObservableCollection<OrderInfo>? OrderInfo
|
||||||
|
{
|
||||||
|
get => _orderInfo;
|
||||||
|
set => SetProperty(ref _orderInfo, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
private List<OrderDetail> orderDetails { get; set; }
|
||||||
|
|
||||||
|
private List<ChannelStock> _channelStocks;
|
||||||
|
|
||||||
|
public List<ChannelStock> ChannelStocks
|
||||||
|
{
|
||||||
|
get => _channelStocks;
|
||||||
|
set => SetProperty(ref _channelStocks, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
private IEnumerable<IGrouping<int, ChannelStock>> enumerable;
|
||||||
|
private IEnumerator<IGrouping<int, ChannelStock>> enumerator;
|
||||||
|
|
||||||
|
|
||||||
|
public bool CanCloseDialog()
|
||||||
|
{
|
||||||
|
return Status == 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void OnDialogClosed()
|
||||||
|
{
|
||||||
|
// 取消消息订阅
|
||||||
|
_eventAggregator.GetEvent<PortUtilEvent>().Unsubscribe(DoMyPrismEvent);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void OnDialogOpened(IDialogParameters parameters)
|
||||||
|
{
|
||||||
|
logger.Info("进入MultiOrderTakeDialogViewModel_查询数据");
|
||||||
|
_eventAggregator.GetEvent<PortUtilEvent>().Subscribe(DoMyPrismEvent);
|
||||||
|
OrderInfo = parameters.GetValue<ObservableCollection<OrderInfo>>("orderInfo");
|
||||||
|
MultiOrderNo += string.Join(", ", OrderInfo.Select(o => o.OrderNo)).Length > 60 ? string.Join(", ", OrderInfo.Select(o => o.OrderNo)).Substring(0, 60) + "……" : string.Join(", ", OrderInfo.Select(o => o.OrderNo));
|
||||||
|
RequestData();
|
||||||
|
logger.Info($"结束MultiOrderTakeDialogViewModel_查询数据,处理处方{MultiOrderNo}");
|
||||||
|
}
|
||||||
|
|
||||||
|
public async void RequestData()
|
||||||
|
{
|
||||||
|
orderDetails = SqlSugarHelper.Db.Queryable<OrderDetail>()
|
||||||
|
//.Includes<DrugInfo>(od => od.DrugInfo)
|
||||||
|
.InnerJoin(SqlSugarHelper.Db.Queryable<ChannelStock>()
|
||||||
|
.Where(cs => cs.DrawerType == 1)
|
||||||
|
.Where(cs => cs.MachineId.Equals(ConfigurationManager.AppSettings["machineId"] ?? "DM1"))
|
||||||
|
.GroupBy(cs => cs.DrugId), (od, t) => od.DrugId == t.DrugId)
|
||||||
|
.Where(od => OrderInfo.Select(o => o.OrderNo).Contains(od.OrderNo)).GroupBy(od => od.DrugId)
|
||||||
|
|
||||||
|
.Select(od => new OrderDetail { DrugId = od.DrugId, SetEffDate = od.SetEffDate, SetManuNo = od.SetManuNo, Quantity = SqlFunc.AggregateSum(od.Quantity) })
|
||||||
|
|
||||||
|
//.Where(od => od.OrderNo. OrderInfo.OrderNo)
|
||||||
|
.ToList();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
List<ChannelStock> channelStocks = new List<ChannelStock>();
|
||||||
|
List<string> msg = new List<string>();
|
||||||
|
for (int i = 0; i < orderDetails.Count; i++)
|
||||||
|
{
|
||||||
|
OrderDetail orderDetail = orderDetails[i];
|
||||||
|
|
||||||
|
List<ChannelStock> HasQChannels = SqlSugarHelper.Db.Queryable<ChannelStock>()
|
||||||
|
.Includes<DrugInfo>(cs => cs.DrugInfo)
|
||||||
|
.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.SetManuNo), cs => cs.ManuNo.Equals(orderDetail.SetManuNo))
|
||||||
|
.Where(cs => cs.DrugId == orderDetail.DrugId)
|
||||||
|
.WhereIF(App.SingleModel, cs => cs.DrawerNo <= 2) //单人登录开前2个抽屉,双人登录开后14个抽屉
|
||||||
|
.WhereIF(!(App.SingleModel), cs => cs.DrawerNo > 2)
|
||||||
|
.OrderBy(cs => cs.EffDate)
|
||||||
|
//.OrderBy(cs => cs.DrawerNo)
|
||||||
|
//.OrderBy(cs => cs.ManuNo)
|
||||||
|
.OrderBy(cs=>cs.FillTime)
|
||||||
|
.ToList();
|
||||||
|
|
||||||
|
int total = HasQChannels.Sum(it => it.Quantity);
|
||||||
|
int TakeQ = orderDetail.Quantity;
|
||||||
|
int multiTakeQ = orderDetail.Quantity;
|
||||||
|
List<ChannelStock> multiTake = new List<ChannelStock>();
|
||||||
|
//multiTakeQ = orderDetails.Where(c => c.DrugId == orderDetail.DrugId).Sum(c => c.Quantity);
|
||||||
|
// 说明数量足够
|
||||||
|
if (total >= multiTakeQ)
|
||||||
|
{
|
||||||
|
for (int j = 0; TakeQ > 0; j++)
|
||||||
|
{
|
||||||
|
ChannelStock stock = HasQChannels[j];
|
||||||
|
|
||||||
|
if (TakeQ > stock.Quantity)
|
||||||
|
{
|
||||||
|
|
||||||
|
//#region 存在该库存且库存数量大于待取数量则把取药数量加上
|
||||||
|
//var varChannelStock = channelStocks.Where(c => c.Location == stock.Location && c.Quantity > c.TakeQuantity + TakeQ).ToList();
|
||||||
|
//if (varChannelStock != null && varChannelStock.Count > 0)
|
||||||
|
//{
|
||||||
|
// channelStocks.Where(c => c.Location == stock.Location).Select(c => c.TakeQuantity += TakeQ).ToList();
|
||||||
|
// break;
|
||||||
|
//}
|
||||||
|
//#endregion
|
||||||
|
stock.TakeQuantity = stock.Quantity;
|
||||||
|
channelStocks.Add(stock);
|
||||||
|
TakeQ -= stock.Quantity;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
|
||||||
|
//#region 存在该库存且库存数量大于待取数量则把取药数量加上
|
||||||
|
//var varChannelStock = channelStocks.Where(c => c.Location == stock.Location && c.Quantity > c.TakeQuantity + TakeQ).ToList();
|
||||||
|
//if (varChannelStock != null && varChannelStock.Count > 0)
|
||||||
|
//{
|
||||||
|
// channelStocks.Where(c => c.Location == stock.Location).Select(c => c.TakeQuantity += TakeQ).ToList();
|
||||||
|
// break;
|
||||||
|
//}
|
||||||
|
//#endregion
|
||||||
|
stock.TakeQuantity = TakeQ;
|
||||||
|
channelStocks.Add(stock);
|
||||||
|
TakeQ = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (HasQChannels != null && HasQChannels.Count > 0 && HasQChannels[0].DrugInfo != null)
|
||||||
|
{
|
||||||
|
//msg.Add($"药品【{orderDetail.DrugInfo.DrugName}】库存不足,应取【{TakeQ}】库存【{total}】");
|
||||||
|
msg.Add($"药品【{HasQChannels[0].DrugInfo.DrugName}】库存不足,应取【{TakeQ}】库存【{total}】");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
msg.Add($"药品【{orderDetail.DrugId}】库存不足,应取【{TakeQ}】库存【{total}】");
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (msg.Count > 0)
|
||||||
|
{
|
||||||
|
RequestClose?.Invoke(new DialogResult(ButtonResult.Cancel));
|
||||||
|
//MessageBox.Show(string.Join("\n", msg));
|
||||||
|
DialogParameters dialogParameters = new DialogParameters();
|
||||||
|
dialogParameters.Add("msgInfo", msg);
|
||||||
|
DialogServiceExtensions.ShowDialogHost(_dialogService, "ShowMessageDialog", dialogParameters, "RootDialog");
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
channelStocks.Sort((a, b) =>
|
||||||
|
{
|
||||||
|
if ((a.DrawerNo - b.DrawerNo) == 0)
|
||||||
|
{
|
||||||
|
return a.ColNo - b.ColNo;
|
||||||
|
}
|
||||||
|
return a.DrawerNo - b.DrawerNo;
|
||||||
|
});
|
||||||
|
ChannelStocks = channelStocks;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public DelegateCommand OpenDrawer
|
||||||
|
{
|
||||||
|
get => new DelegateCommand(async () =>
|
||||||
|
{
|
||||||
|
if (Status == 0)
|
||||||
|
{
|
||||||
|
enumerable = ChannelStocks.GroupBy(cs => cs.DrawerNo, cs => cs);
|
||||||
|
enumerator = enumerable.GetEnumerator();
|
||||||
|
enumerator.MoveNext();
|
||||||
|
Status = 1;
|
||||||
|
OpenOneByOne();
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private 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 = channelStocks.FindAll(it => it.BoardType != 1);
|
||||||
|
|
||||||
|
// 发送取药数量
|
||||||
|
singleChannels.ForEach(it =>
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
|
||||||
|
_portUtil.TakeQuantity(DrawerNo, it.ColNo, it.TakeQuantity, it.Quantity - it.TakeQuantity);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
AlertMsg alertMsg = new AlertMsg
|
||||||
|
{
|
||||||
|
Message = $"打开抽屉异常{ex.Message}",
|
||||||
|
Type = MsgType.ERROR,
|
||||||
|
};
|
||||||
|
_eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
_portUtil.WindowName = "OrderTakeDrugWindow";
|
||||||
|
_portUtil.BoardType = singleChannels.Count > 0 ? singleChannels[0].BoardType : 1;
|
||||||
|
_portUtil.ColNos = singleChannels.Select(it => it.ColNo).ToArray();
|
||||||
|
_portUtil.DrawerNo = DrawerNo;
|
||||||
|
_portUtil.Start();
|
||||||
|
}
|
||||||
|
private bool _isFinishClick = false;
|
||||||
|
// 完成按钮
|
||||||
|
public DelegateCommand TakeFinish
|
||||||
|
{
|
||||||
|
get => new DelegateCommand(() =>
|
||||||
|
{
|
||||||
|
if (!_isFinishClick)
|
||||||
|
{
|
||||||
|
_isFinishClick = true;
|
||||||
|
List<ChannelStock> record = ChannelStocks.FindAll(it => it.TakeQuantity > 0).ToList();
|
||||||
|
|
||||||
|
//根据处方单数量分别更新处方状态、写记录信息
|
||||||
|
if (OrderInfo != null && OrderInfo.Count > 0)
|
||||||
|
{
|
||||||
|
UpdateOrderInfo(OrderInfo, record);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
private void UpdateOrderInfo(ObservableCollection<OrderInfo> orderInfo, List<ChannelStock> record)
|
||||||
|
{
|
||||||
|
var f = SqlSugarHelper.Db.UseTran(() =>
|
||||||
|
{
|
||||||
|
logger.Info("UseTran");
|
||||||
|
for (int j = 0; j < OrderInfo.Count; j++)
|
||||||
|
{
|
||||||
|
logger.Info($"OrderInfo j-{j}");
|
||||||
|
string InvoiceId = OrderInfo[j].OrderNo;
|
||||||
|
for (int i = 0; i < record.Count; i++)
|
||||||
|
{
|
||||||
|
|
||||||
|
logger.Info($"record j-{i}");
|
||||||
|
List<OrderDetail> orderDetails = SqlSugarHelper.Db.Queryable<OrderDetail>()
|
||||||
|
.Where(od => od.OrderNo == OrderInfo[j].OrderNo && od.DrugId == record[i].DrugId && od.DetailStatus == 0).ToList();
|
||||||
|
if (orderDetails == null || orderDetails.Count <= 0)
|
||||||
|
{
|
||||||
|
logger.Info($"处方{OrderInfo[j].OrderNo}下无药品{record[i].DrugId},或detail_status字段不为 0");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
logger.Info($"orderDetails");
|
||||||
|
OrderDetail orderDetail = orderDetails.FirstOrDefault();
|
||||||
|
orderDetail.Quantity = orderDetails.Sum(it => it.Quantity);
|
||||||
|
//处方中该药品明细
|
||||||
|
//OrderDetail orderDetail = SqlSugarHelper.Db.Queryable<OrderDetail>()
|
||||||
|
// .Where(od => od.OrderNo == OrderInfo[j].OrderNo && od.DrugId == record[i].DrugId && od.DetailStatus == 0)
|
||||||
|
// .GroupBy(od => new { od.DrugId, od.OrderId }).Select(od => new OrderDetail
|
||||||
|
// {
|
||||||
|
// OrderId = od.OrderId,
|
||||||
|
// DrugId = od.DrugId,
|
||||||
|
// Quantity = SqlFunc.AggregateSum(od.Quantity)
|
||||||
|
// }).First();
|
||||||
|
|
||||||
|
int ordinalNum = SqlSugarHelper.Db.Queryable<MachineRecord>()
|
||||||
|
.Where(mr => mr.OperationTime.ToString("yyyy-MM-dd") == DateTime.Now.ToString("yyyy-MM-dd"))
|
||||||
|
.Max(mr => mr.OrdinalNum);
|
||||||
|
logger.Info($"ordinalNum{ordinalNum}");
|
||||||
|
//已取药数量
|
||||||
|
int hasTakeQuantity = SqlSugarHelper.Db.Queryable<MachineRecord>()
|
||||||
|
.Where(mr => mr.InvoiceId == InvoiceId && mr.DrugId == record[i].DrugId && mr.GetId == orderDetail.OrderId)
|
||||||
|
.Sum(mr => mr.Quantity);
|
||||||
|
//处方中该药品取药数量
|
||||||
|
int orderTakeQuantity = orderDetail.Quantity - hasTakeQuantity;
|
||||||
|
logger.Info($"orderTakeQuantity{orderTakeQuantity}");
|
||||||
|
|
||||||
|
//当前药品库存
|
||||||
|
int stockQuantity = SqlSugarHelper.Db.Queryable<ChannelStock>()
|
||||||
|
.Where(cs => cs.MachineId == (record[i].MachineId)
|
||||||
|
&& cs.DrugId == record[i].DrugId
|
||||||
|
&& cs.ManuNo == record[i].ManuNo && cs.DrawerNo == record[i].DrawerNo
|
||||||
|
&& cs.ColNo == record[i].ColNo).Select(cs => cs.Quantity).First();
|
||||||
|
|
||||||
|
|
||||||
|
logger.Info($"stockQuantity{stockQuantity}");
|
||||||
|
|
||||||
|
//该处方没有这个药,跳出循环
|
||||||
|
if (stockQuantity <= 0 || orderTakeQuantity <= 0)
|
||||||
|
continue;
|
||||||
|
if (!(stockQuantity == orderTakeQuantity))
|
||||||
|
{
|
||||||
|
if (stockQuantity > orderTakeQuantity)
|
||||||
|
{
|
||||||
|
//record[i].TakeQuantity = record[i].TakeQuantity - orderTakeQuantity;
|
||||||
|
record[i].TakeQuantity = orderTakeQuantity;
|
||||||
|
record[i].Quantity = stockQuantity - orderTakeQuantity;
|
||||||
|
}
|
||||||
|
else if (stockQuantity < orderTakeQuantity)
|
||||||
|
{
|
||||||
|
record[i].TakeQuantity = stockQuantity;
|
||||||
|
record[i].Quantity = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
record[i].TakeQuantity = orderTakeQuantity;
|
||||||
|
record[i].Quantity = stockQuantity - record[i].TakeQuantity;
|
||||||
|
}
|
||||||
|
|
||||||
|
logger.Info($"record{stockQuantity}");
|
||||||
|
ChannelStock it = record[i];
|
||||||
|
// 更新数据 库存信息
|
||||||
|
SqlSugarHelper.Db.Updateable(new ChannelStock()
|
||||||
|
{
|
||||||
|
Quantity = record[i].Quantity,
|
||||||
|
ManuNo = it.ManuNo,
|
||||||
|
EffDate = it.EffDate,
|
||||||
|
Id = it.Id,
|
||||||
|
}).UpdateColumns(it => new { it.Quantity, it.ManuNo, it.EffDate }).ExecuteCommand();
|
||||||
|
logger.Info("更新数据 库存信息");
|
||||||
|
// 获取更新完库存后的药品库存
|
||||||
|
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();
|
||||||
|
|
||||||
|
logger.Info("查询当前库存");
|
||||||
|
// 保存数据 出库记录
|
||||||
|
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 = orderDetail.Quantity,//record[i].TakeQuantity,
|
||||||
|
Type = 2,
|
||||||
|
InvoiceId = InvoiceId,
|
||||||
|
OrdinalNum = ordinalNum + 1,
|
||||||
|
StockQuantity = nowChannels.Sum(it => it.Quantity),
|
||||||
|
ManunoQuantity = nowChannels.FindAll(it2 => it2.ManuNo == it.ManuNo).Sum(it => it.Quantity),
|
||||||
|
SupplierDept = ConfigurationManager.AppSettings["receiveDept"].ToString(),
|
||||||
|
ReceiveDept = OrderInfo[j].DeptName,
|
||||||
|
GetId = orderDetail.OrderId,
|
||||||
|
ReceivePerson= ReceivePerson
|
||||||
|
}).ExecuteCommand();
|
||||||
|
|
||||||
|
logger.Info("Insertable MachineRecord");
|
||||||
|
}
|
||||||
|
//更新处方状态
|
||||||
|
SqlSugarHelper.Db.Updateable(new OrderInfo()
|
||||||
|
{
|
||||||
|
DmStatus = 1,
|
||||||
|
OrderNo = OrderInfo[j].OrderNo
|
||||||
|
}).UpdateColumns(it => new { it.DmStatus }).WhereColumns(it => new { it.OrderNo }).ExecuteCommand();
|
||||||
|
|
||||||
|
|
||||||
|
logger.Info("更新处方");
|
||||||
|
//更新处方明细状态为已取药1
|
||||||
|
List<OrderDetail> orderDetailLst = SqlSugarHelper.Db.Queryable<OrderDetail>().Where(od => od.OrderNo == OrderInfo[j].OrderNo && od.DetailStatus == 0).ToList();
|
||||||
|
if (orderDetailLst != null && orderDetailLst.Count > 0)
|
||||||
|
{
|
||||||
|
orderDetailLst.ForEach(od => od.DetailStatus = 1);
|
||||||
|
SqlSugarHelper.Db.Updateable(orderDetailLst).UpdateColumns(it => new { it.DetailStatus }).ExecuteCommand();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
logger.Info($"处方{OrderInfo[j].OrderNo}药品明细状态未更新");
|
||||||
|
}
|
||||||
|
|
||||||
|
logger.Info("处方明细状态为已取药1");
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
});
|
||||||
|
if (f.Data)
|
||||||
|
{
|
||||||
|
logger.Info("f.Data");
|
||||||
|
|
||||||
|
//});
|
||||||
|
// 更新屏显库存
|
||||||
|
List<ChannelStock> singleChannels = record.FindAll(it => it.BoardType == 5);
|
||||||
|
if (singleChannels.Count > 0)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < singleChannels.Count; i++)
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
List<ChannelStock> csList = 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 && cs.Quantity > 0).OrderBy(cs => cs.EffDate).ToList();
|
||||||
|
|
||||||
|
if (csList != null && csList.Count > 0)
|
||||||
|
{
|
||||||
|
int totalQuantity = csList.Sum(c => c.Quantity);
|
||||||
|
_portUtil.WriteChannelInfo(5, csList[0].EffDate == null ? "" : csList[0].EffDate, csList[0].DrawerNo, csList[0].ColNo);
|
||||||
|
Thread.Sleep(200);
|
||||||
|
_portUtil.WriteChannelInfo(6, csList[0].ManuNo == null ? "" : csList[0].ManuNo, csList[0].DrawerNo, csList[0].ColNo);
|
||||||
|
Thread.Sleep(200);
|
||||||
|
_portUtil.ShowContent(csList[0].DrawerNo, csList[0].ColNo);
|
||||||
|
Thread.Sleep(200);
|
||||||
|
_portUtil.WriteQuantity(csList[0].DrawerNo, csList[0].ColNo, totalQuantity);
|
||||||
|
Thread.Sleep(200);
|
||||||
|
}
|
||||||
|
// singleChannels.ForEach(it =>
|
||||||
|
//{
|
||||||
|
// _portUtil.WriteQuantity(it.DrawerNo, it.ColNo, it.Quantity - it.TakeQuantity);
|
||||||
|
// Thread.Sleep(200);
|
||||||
|
//});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
AlertMsg alertMsg = new AlertMsg
|
||||||
|
{
|
||||||
|
Message = "抽屉取药完成,库存已更新",
|
||||||
|
Type = MsgType.SUCCESS,
|
||||||
|
};
|
||||||
|
_eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
|
||||||
|
}
|
||||||
|
if (!f.IsSuccess)
|
||||||
|
{
|
||||||
|
System.Windows.Application.Current.Dispatcher.Invoke(System.Windows.Threading.DispatcherPriority.Send, new Action(() =>
|
||||||
|
{
|
||||||
|
AlertMsg alertMsg = new AlertMsg
|
||||||
|
{
|
||||||
|
Message = "抽屉取药完成,库存更新失败!",
|
||||||
|
Type = MsgType.ERROR,
|
||||||
|
};
|
||||||
|
_eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
Status = 0;
|
||||||
|
_isFinishClick = false;
|
||||||
|
//RequestClose?.Invoke(new DialogResult(ButtonResult.Cancel));
|
||||||
|
RequestClose?.Invoke(new DialogResult(ButtonResult.OK));
|
||||||
|
}
|
||||||
|
public long CurrentTimeMillis()
|
||||||
|
{
|
||||||
|
return (long)(DateTime.UtcNow - Jan1st1970).TotalMilliseconds;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 取消按钮
|
||||||
|
public DelegateCommand CancleTake
|
||||||
|
{
|
||||||
|
get => new DelegateCommand(() =>
|
||||||
|
{
|
||||||
|
_portUtil.ResetData();
|
||||||
|
Status = 0;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public DelegateCommand BtnCloseCommand
|
||||||
|
{
|
||||||
|
get => new DelegateCommand(() =>
|
||||||
|
{
|
||||||
|
if (Status != 0)
|
||||||
|
{
|
||||||
|
_portUtil.ResetData();
|
||||||
|
Status = 0;
|
||||||
|
}
|
||||||
|
//DialogParameters parameters = new DialogParameters();
|
||||||
|
//parameters.Add("",);
|
||||||
|
// 关闭当前窗口
|
||||||
|
RequestClose?.Invoke(new DialogResult(ButtonResult.Cancel));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool KeepAlive => false;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,384 @@
|
||||||
|
using DM_Weight.Models;
|
||||||
|
using DM_Weight.msg;
|
||||||
|
using DM_Weight.util;
|
||||||
|
using log4net;
|
||||||
|
using log4net.Repository.Hierarchy;
|
||||||
|
using Prism.Commands;
|
||||||
|
using Prism.Events;
|
||||||
|
using Prism.Mvvm;
|
||||||
|
using Prism.Regions;
|
||||||
|
using Prism.Services.Dialogs;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Collections.ObjectModel;
|
||||||
|
using System.Configuration;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace DM_Weight.ViewModels
|
||||||
|
{
|
||||||
|
public class MultiOrderTakeDrugWindowViewModel : BindableBase, IConfirmNavigationRequest, IRegionMemberLifetime
|
||||||
|
{
|
||||||
|
public static MultiOrderTakeDrugWindowViewModel 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);
|
||||||
|
// }
|
||||||
|
//}
|
||||||
|
|
||||||
|
|
||||||
|
IDialogService _dialogService;
|
||||||
|
IEventAggregator _eventAggregator;
|
||||||
|
|
||||||
|
|
||||||
|
public MultiOrderTakeDrugWindowViewModel(IDialogService DialogService, IEventAggregator eventAggregator)
|
||||||
|
{
|
||||||
|
_dialogService = DialogService;
|
||||||
|
_eventAggregator = eventAggregator;
|
||||||
|
vm = this;
|
||||||
|
}
|
||||||
|
|
||||||
|
//public static ObservableCollection<OrderTakeSelect> StaticOrderTakeSelects = new()
|
||||||
|
//{
|
||||||
|
// new OrderTakeSelect
|
||||||
|
// {
|
||||||
|
// Code = "OrderNo",
|
||||||
|
// Name = "处方号"
|
||||||
|
// },
|
||||||
|
// new OrderTakeSelect
|
||||||
|
// {
|
||||||
|
// Code = "PatientId",
|
||||||
|
// Name = "患者编号"
|
||||||
|
// }
|
||||||
|
//};
|
||||||
|
|
||||||
|
//private ObservableCollection<OrderTakeSelect> _orderTakeSelects = StaticOrderTakeSelects;
|
||||||
|
|
||||||
|
//public ObservableCollection<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 OrderInfo? _selectedOrder;
|
||||||
|
|
||||||
|
//public OrderInfo? SelectedOrder
|
||||||
|
//{
|
||||||
|
// get { return _selectedOrder; }
|
||||||
|
// set
|
||||||
|
// {
|
||||||
|
// SetProperty(ref _selectedOrder, value);
|
||||||
|
|
||||||
|
// //OpenOrderDialog();
|
||||||
|
// }
|
||||||
|
//}
|
||||||
|
|
||||||
|
|
||||||
|
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();
|
||||||
|
// }
|
||||||
|
//}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///全选
|
||||||
|
/// </summary>
|
||||||
|
private bool _allChecked = false;
|
||||||
|
public bool IsAllChecked
|
||||||
|
{
|
||||||
|
get { return _allChecked; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
SetProperty(ref _allChecked, value);
|
||||||
|
if (!IsItemCheck)
|
||||||
|
{
|
||||||
|
RequestData();
|
||||||
|
//根据全选或反选设置其后的选中状态
|
||||||
|
OrderInfos.ToList().ForEach(oi => oi.ItemIsChecked = _allChecked);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
IsItemCheck = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool _isItemCheck = false;
|
||||||
|
public bool IsItemCheck
|
||||||
|
{
|
||||||
|
get => _isItemCheck;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
SetProperty(ref _isItemCheck, value);
|
||||||
|
if (OrderInfos.ToList().Where(od => od.ItemIsChecked == false).Count() <= 0)
|
||||||
|
{
|
||||||
|
IsAllChecked = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//private bool _itemIsChecked = false;
|
||||||
|
//public bool ItemIsChecked
|
||||||
|
//{
|
||||||
|
// get => _itemIsChecked;
|
||||||
|
// set
|
||||||
|
// {
|
||||||
|
// SetProperty(ref _itemIsChecked, value);
|
||||||
|
// }
|
||||||
|
//}
|
||||||
|
//多处方取药
|
||||||
|
public DelegateCommand BtnTakeOrder { get => new DelegateCommand(TakeByMultiOrder); }
|
||||||
|
private void TakeByMultiOrder()
|
||||||
|
{
|
||||||
|
OrderInfos = new ObservableCollection<OrderInfo>(OrderInfos.Where(o => o.ItemIsChecked == true).ToList());
|
||||||
|
if (OrderInfos != null && OrderInfos.Count() > 0)
|
||||||
|
{
|
||||||
|
// 此处延时1毫秒,等待页面渲染
|
||||||
|
//await Task.Delay(TimeSpan.FromMilliseconds(1));
|
||||||
|
DialogParameters dialogParameters = new DialogParameters();
|
||||||
|
dialogParameters.Add("orderInfo", OrderInfos);
|
||||||
|
DialogServiceExtensions.ShowDialogHost(_dialogService, "MultiOrderTakeDialog", dialogParameters, DoDialogResult, "RootDialog");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//请勾选要取药的处方信息
|
||||||
|
AlertMsg alertMsg = new AlertMsg
|
||||||
|
{
|
||||||
|
Message = "请勾选要取药的处方信息",
|
||||||
|
Type = MsgType.ERROR,
|
||||||
|
};
|
||||||
|
_eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
|
||||||
|
}
|
||||||
|
IsAllChecked = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
private ObservableCollection<OrderInfo> _orderInfos = new();
|
||||||
|
|
||||||
|
public ObservableCollection<OrderInfo> OrderInfos
|
||||||
|
{
|
||||||
|
get { return _orderInfos; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
SetProperty(ref _orderInfos, value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//部门
|
||||||
|
private ObservableCollection<OrderDepartment> _orderDepartments = new ObservableCollection<OrderDepartment>();
|
||||||
|
public ObservableCollection<OrderDepartment> OrderDepartments
|
||||||
|
{
|
||||||
|
get => _orderDepartments;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
SetProperty(ref _orderDepartments, value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private OrderDepartment _orderDepartment = new OrderDepartment();
|
||||||
|
public OrderDepartment OrderDepartment
|
||||||
|
{
|
||||||
|
get => _orderDepartment;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
SetProperty(ref _orderDepartment, value);
|
||||||
|
RequestData();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public bool KeepAlive => false;
|
||||||
|
|
||||||
|
private void DoDialogResult(IDialogResult dialogResult)
|
||||||
|
{
|
||||||
|
// 委托 被动执行 被子窗口执行
|
||||||
|
// dialogResult 第一方面可以拿到任意参数 第二方面 可判断关闭状态
|
||||||
|
//if(dialogResult.Result == ButtonResult.OK)
|
||||||
|
//{
|
||||||
|
//SelectedOrder = null;
|
||||||
|
RequestData();
|
||||||
|
//}
|
||||||
|
//MessageBox.Show("返回值:" + dialogResult.Result.ToString());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//这个方法用于拦截请求,continuationCallback(true)就是不拦截,continuationCallback(false)拦截本次操作
|
||||||
|
public void ConfirmNavigationRequest(NavigationContext navigationContext, Action<bool> continuationCallback)
|
||||||
|
{
|
||||||
|
continuationCallback(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public DelegateCommand QueryCommand
|
||||||
|
{
|
||||||
|
get => new DelegateCommand(() =>
|
||||||
|
{
|
||||||
|
RequestData();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private readonly ILog logger = LogManager.GetLogger(typeof(MultiOrderTakeDrugWindowViewModel));
|
||||||
|
public void RequestData()
|
||||||
|
{
|
||||||
|
OrderInfos.Clear();
|
||||||
|
//int totalCount = 0;
|
||||||
|
//string SearchValue = null;
|
||||||
|
//if (SearchValue != null)
|
||||||
|
//{
|
||||||
|
// strSearchValue = SearchValue.Trim().Replace("\r", "");
|
||||||
|
//}
|
||||||
|
List<OrderInfo> queryData = SqlSugarHelper.Db.Queryable<OrderInfo>()
|
||||||
|
.InnerJoin<OrderDetail>((oi, od) => oi.OrderNo == od.OrderNo && od.DetailStatus == 0)
|
||||||
|
.InnerJoin(SqlSugarHelper.Db.Queryable<ChannelStock>().Where(cs => cs.DrawerType == 1).Where(cs => cs.MachineId.Equals(ConfigurationManager.AppSettings["machineId"] ?? "DM3")).GroupBy(cs => cs.DrugId), (oi, od, t) => od.DrugId == t.DrugId)
|
||||||
|
.WhereIF(OrderDate != null, oi => oi.RecvDate.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.OrderNo)
|
||||||
|
.Select(oi => oi)
|
||||||
|
//.ToPageList(PageNum, PageSize, ref totalCount);
|
||||||
|
.ToList();
|
||||||
|
OrderInfos = new ObservableCollection<OrderInfo>(queryData);
|
||||||
|
|
||||||
|
if (OrderDepartments.Where(d => d.DeptName == "全部").ToList().Count <= 0)
|
||||||
|
{
|
||||||
|
OrderDepartment deptDefault = new OrderDepartment();
|
||||||
|
deptDefault.DeptName = "全部";
|
||||||
|
OrderDepartments.Add(deptDefault);
|
||||||
|
|
||||||
|
}
|
||||||
|
var orderDeparts = queryData.GroupBy(o => o.DeptName).ToList();
|
||||||
|
for (int i = 0; i < orderDeparts.Count; i++)
|
||||||
|
{
|
||||||
|
OrderDepartment dept = new OrderDepartment();
|
||||||
|
if (orderDeparts[i].Key != null && orderDeparts[i].Key != string.Empty && OrderDepartments.Where(d => d.DeptName == orderDeparts[i].Key).ToList().Count <= 0)
|
||||||
|
{
|
||||||
|
dept.DeptName = orderDeparts[i].Key;
|
||||||
|
OrderDepartments.Add(dept);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//TotalCount = totalCount;
|
||||||
|
//PageCount = (int)Math.Ceiling((double)TotalCount / PageSize);
|
||||||
|
logger.Info("结束MultiOrderTakeDrugWindowViewModel_查询数据");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//接收导航传过来的参数 现在是在此处初始化了表格数据
|
||||||
|
public void OnNavigatedTo(NavigationContext navigationContext)
|
||||||
|
{
|
||||||
|
logger.Info("进入MultiOrderTakeDrugWindowViewModel_查询数据");
|
||||||
|
//_eventAggregator.GetEvent<PortUtilEvent>().Subscribe(DoMyPrismEvent);
|
||||||
|
RequestData();
|
||||||
|
}
|
||||||
|
|
||||||
|
//每次导航的时候,该实列用不用重新创建,true是不重新创建,false是重新创建
|
||||||
|
public bool IsNavigationTarget(NavigationContext navigationContext)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
//这个方法用于拦截请求
|
||||||
|
public void OnNavigatedFrom(NavigationContext navigationContext)
|
||||||
|
{
|
||||||
|
|
||||||
|
// 取消消息订阅
|
||||||
|
//_eventAggregator.GetEvent<PortUtilEvent>().Unsubscribe(DoMyPrismEvent);
|
||||||
|
}
|
||||||
|
|
||||||
|
void DoMyPrismEvent(DeviceMsg msg)
|
||||||
|
{
|
||||||
|
//if (msg.EventType == EventType.CODESCAN)
|
||||||
|
//{
|
||||||
|
// SearchValue = msg.Code;
|
||||||
|
//}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -247,6 +247,53 @@ namespace DM_Weight.ViewModels
|
||||||
{
|
{
|
||||||
if (Status == 0)
|
if (Status == 0)
|
||||||
{
|
{
|
||||||
|
//if (App.CurrentFaUserList.Role != null)
|
||||||
|
//{
|
||||||
|
// //查看当前用户是否有所在药品抽屉的权限
|
||||||
|
// bool bLessEight = ChannelStocks.Select(it => it.DrawerNo).Where(n => n <= 8).Any();
|
||||||
|
// bool bMoreEight = ChannelStocks.Select(it => it.DrawerNo).Where(n => n > 8 && n < 17).Any();
|
||||||
|
// bool bEqualEight = ChannelStocks.Select(it => it.DrawerNo).Where(n => n == 17).Any();
|
||||||
|
// if (bLessEight)
|
||||||
|
// {
|
||||||
|
// if (App.CurrentFaUserList.Role.FirstEightChecked == "0")
|
||||||
|
// {
|
||||||
|
// AlertMsg alertMsg = new AlertMsg
|
||||||
|
// {
|
||||||
|
// Message = "当前用户没有打开抽屉的权限!",
|
||||||
|
// Type = MsgType.ERROR,
|
||||||
|
// };
|
||||||
|
// _eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// if (bMoreEight)
|
||||||
|
// {
|
||||||
|
// if (App.CurrentFaUserList.Role.LastEightChecked == "0")
|
||||||
|
// {
|
||||||
|
// AlertMsg alertMsg = new AlertMsg
|
||||||
|
// {
|
||||||
|
// Message = "当前用户没有打开抽屉的权限!",
|
||||||
|
// Type = MsgType.ERROR,
|
||||||
|
// };
|
||||||
|
// _eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// if (bEqualEight)
|
||||||
|
// {
|
||||||
|
// if (App.CurrentFaUserList.Role.StorageBoxChecked == "0")
|
||||||
|
// {
|
||||||
|
// AlertMsg alertMsg = new AlertMsg
|
||||||
|
// {
|
||||||
|
// Message = "当前用户没有打开抽屉的权限!",
|
||||||
|
// Type = MsgType.ERROR,
|
||||||
|
// };
|
||||||
|
// _eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
//}
|
||||||
enumerable = ChannelStocks.GroupBy(cs => cs.DrawerNo, cs => cs);
|
enumerable = ChannelStocks.GroupBy(cs => cs.DrawerNo, cs => cs);
|
||||||
enumerator = enumerable.GetEnumerator();
|
enumerator = enumerable.GetEnumerator();
|
||||||
enumerator.MoveNext();
|
enumerator.MoveNext();
|
||||||
|
@ -266,7 +313,13 @@ namespace DM_Weight.ViewModels
|
||||||
_portUtil.SpeakAsync("正在打开" + DrawerNo + "号抽屉");
|
_portUtil.SpeakAsync("正在打开" + DrawerNo + "号抽屉");
|
||||||
|
|
||||||
|
|
||||||
List<ChannelStock> singleChannels = channelStocks
|
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 })
|
.GroupBy(it => new { it.DrawerNo, it.ColNo })
|
||||||
.Select(it =>
|
.Select(it =>
|
||||||
{
|
{
|
||||||
|
@ -380,13 +433,32 @@ namespace DM_Weight.ViewModels
|
||||||
{
|
{
|
||||||
if (singleChannels[i].BoardType == 5)
|
if (singleChannels[i].BoardType == 5)
|
||||||
{
|
{
|
||||||
int totalQuantity = SqlSugarHelper.Db.Queryable<ChannelStock>()
|
List<ChannelStock> csList = SqlSugarHelper.Db.Queryable<ChannelStock>()
|
||||||
.Where(cs => cs.MachineId == singleChannels[i].MachineId)
|
.Where(cs => cs.MachineId == singleChannels[i].MachineId)
|
||||||
.Where(cs => cs.DrawerNo == singleChannels[i].DrawerNo)
|
.Where(cs => cs.DrawerNo == singleChannels[i].DrawerNo)
|
||||||
.Where(cs => cs.ColNo == singleChannels[i].ColNo)
|
.Where(cs => cs.ColNo == singleChannels[i].ColNo && cs.Quantity > 0).OrderBy(cs => cs.EffDate).ToList();
|
||||||
.Sum(it => it.Quantity);
|
|
||||||
//将库位多批次的总库存数更新标签
|
if (csList != null && csList.Count > 0)
|
||||||
_portUtil.WriteQuantity(singleChannels[i].DrawerNo, singleChannels[i].ColNo, totalQuantity);
|
{
|
||||||
|
int totalQuantity = csList.Sum(c => c.Quantity);
|
||||||
|
_portUtil.WriteChannelInfo(5, csList[0].EffDate == null ? "" : csList[0].EffDate, csList[0].DrawerNo, csList[0].ColNo);
|
||||||
|
Thread.Sleep(200);
|
||||||
|
_portUtil.WriteChannelInfo(6, csList[0].ManuNo == null ? "" : csList[0].ManuNo, csList[0].DrawerNo, csList[0].ColNo);
|
||||||
|
Thread.Sleep(200);
|
||||||
|
_portUtil.ShowContent(csList[0].DrawerNo, csList[0].ColNo);
|
||||||
|
Thread.Sleep(200);
|
||||||
|
//将库位多批次的总库存数更新标签
|
||||||
|
_portUtil.WriteQuantity(csList[i].DrawerNo, csList[i].ColNo, totalQuantity);
|
||||||
|
Thread.Sleep(200);
|
||||||
|
}
|
||||||
|
// int totalQuantity = 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)
|
||||||
|
// .Sum(it => it.Quantity);
|
||||||
|
////将库位多批次的总库存数更新标签
|
||||||
|
//_portUtil.WriteQuantity(singleChannels[i].DrawerNo, singleChannels[i].ColNo, totalQuantity);
|
||||||
|
//Thread.Sleep(200);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,9 +35,18 @@ namespace DM_Weight.ViewModels
|
||||||
private static readonly DateTime Jan1st1970 = new DateTime
|
private static readonly DateTime Jan1st1970 = new DateTime
|
||||||
(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);
|
(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);
|
||||||
|
|
||||||
|
|
||||||
|
//取药人(科室)
|
||||||
|
private string receivePerson;
|
||||||
|
public string ReceivePerson
|
||||||
|
{
|
||||||
|
get => receivePerson;
|
||||||
|
set => SetProperty(ref receivePerson, value);
|
||||||
|
}
|
||||||
|
|
||||||
private PortUtil _portUtil;
|
private PortUtil _portUtil;
|
||||||
IEventAggregator _eventAggregator;
|
IEventAggregator _eventAggregator;
|
||||||
IDialogService _dialogService;
|
IDialogService _dialogService;
|
||||||
//private SqlSugarScope SqlSugarHelper.Db;
|
//private SqlSugarScope SqlSugarHelper.Db;
|
||||||
public OrderTakeDialogViewModel(PortUtil portUtil, IEventAggregator eventAggregator, IDialogService DialogService, SqlSugarScope sqlSugarScope)
|
public OrderTakeDialogViewModel(PortUtil portUtil, IEventAggregator eventAggregator, IDialogService DialogService, SqlSugarScope sqlSugarScope)
|
||||||
{
|
{
|
||||||
|
@ -171,11 +180,21 @@ namespace DM_Weight.ViewModels
|
||||||
|
|
||||||
public void RequestData()
|
public void RequestData()
|
||||||
{
|
{
|
||||||
orderDetails = SqlSugarHelper.Db.Queryable<OrderDetail>()
|
orderDetails = SqlSugarHelper.Db.Queryable<OrderDetail>()
|
||||||
.Includes<DrugInfo>(od => od.DrugInfo)
|
//.Includes<DrugInfo>(od => od.DrugInfo)
|
||||||
.InnerJoin(SqlSugarHelper.Db.Queryable<ChannelStock>().Where(cs => cs.DrawerType == 1).Where(cs => cs.MachineId.Equals(ConfigurationManager.AppSettings["machineId"] ?? "DM1")).GroupBy(cs => cs.DrugId), (od, t) => od.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), (od, t) => od.DrugId == t.DrugId)
|
||||||
.Where(od => od.OrderNo == OrderInfo.OrderNo)
|
.Where(od => od.OrderNo == OrderInfo.OrderNo&&od.DetailStatus==0)
|
||||||
.ToList();
|
.Select(od => new OrderDetail
|
||||||
|
{
|
||||||
|
Id = od.Id,
|
||||||
|
DrugId = od.DrugId,
|
||||||
|
SetEffDate = od.SetEffDate,
|
||||||
|
SetManuNo = od.SetManuNo,
|
||||||
|
OrderNo = od.OrderNo,
|
||||||
|
Quantity = SqlFunc.AggregateSum(od.Quantity)
|
||||||
|
})
|
||||||
|
.GroupBy(od => new { od.DrugId, od.SetEffDate, od.SetManuNo })
|
||||||
|
.ToList();
|
||||||
|
|
||||||
List<ChannelStock> channelStocks = new List<ChannelStock>();
|
List<ChannelStock> channelStocks = new List<ChannelStock>();
|
||||||
List<string> msg = new List<string>();
|
List<string> msg = new List<string>();
|
||||||
|
@ -183,6 +202,12 @@ namespace DM_Weight.ViewModels
|
||||||
{
|
{
|
||||||
OrderDetail orderDetail = orderDetails[i];
|
OrderDetail orderDetail = orderDetails[i];
|
||||||
|
|
||||||
|
//bool bAdmin=false;
|
||||||
|
////有开后8个抽屉的权限
|
||||||
|
//if(App.CurrentFaUserList.Role.LastEightChecked=="1")
|
||||||
|
//{
|
||||||
|
// bAdmin = true;
|
||||||
|
//}
|
||||||
List<ChannelStock> HasQChannels = SqlSugarHelper.Db.Queryable<ChannelStock>()
|
List<ChannelStock> HasQChannels = SqlSugarHelper.Db.Queryable<ChannelStock>()
|
||||||
.Includes<DrugInfo>(cs => cs.DrugInfo)
|
.Includes<DrugInfo>(cs => cs.DrugInfo)
|
||||||
.InnerJoin<ChannelList>((cs, cl) => cs.Chnguid == cl.Id && cs.DrugId == cl.DrugId)
|
.InnerJoin<ChannelList>((cs, cl) => cs.Chnguid == cl.Id && cs.DrugId == cl.DrugId)
|
||||||
|
@ -192,9 +217,12 @@ namespace DM_Weight.ViewModels
|
||||||
.WhereIF(!string.IsNullOrEmpty(orderDetail.SetEffDate), cs => cs.EffDate.Equals(orderDetail.SetEffDate))
|
.WhereIF(!string.IsNullOrEmpty(orderDetail.SetEffDate), cs => cs.EffDate.Equals(orderDetail.SetEffDate))
|
||||||
.WhereIF(!string.IsNullOrEmpty(orderDetail.SetManuNo), cs => cs.ManuNo.Equals(orderDetail.SetManuNo))
|
.WhereIF(!string.IsNullOrEmpty(orderDetail.SetManuNo), cs => cs.ManuNo.Equals(orderDetail.SetManuNo))
|
||||||
.Where(cs => cs.DrugId == orderDetail.DrugId)
|
.Where(cs => cs.DrugId == orderDetail.DrugId)
|
||||||
|
.WhereIF(App.SingleModel, cs => cs.DrawerNo <= 2) //单人登录开前2个抽屉,双人登录开后14个抽屉
|
||||||
|
.WhereIF(!(App.SingleModel), cs => cs.DrawerNo > 2)
|
||||||
.OrderBy(cs => cs.EffDate)
|
.OrderBy(cs => cs.EffDate)
|
||||||
.OrderBy(cs => cs.DrawerNo)
|
//.OrderBy(cs => cs.DrawerNo)
|
||||||
.OrderBy(cs=> cs.ManuNo)
|
//.OrderBy(cs => cs.ManuNo)
|
||||||
|
.OrderBy(cs=>cs.FillTime)
|
||||||
.ToList();
|
.ToList();
|
||||||
int total = HasQChannels.Sum(it => it.Quantity);
|
int total = HasQChannels.Sum(it => it.Quantity);
|
||||||
int TakeQ = orderDetail.Quantity;
|
int TakeQ = orderDetail.Quantity;
|
||||||
|
@ -220,7 +248,7 @@ namespace DM_Weight.ViewModels
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
msg.Add($"药品【{orderDetail.DrugInfo.DrugName}】库存不足,应取【{TakeQ}】库存【{total}】");
|
msg.Add($"药品【{HasQChannels[0].DrugInfo.DrugName}】库存不足,应取【{TakeQ}】库存【{total}】");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (msg.Count > 0)
|
if (msg.Count > 0)
|
||||||
|
@ -230,7 +258,7 @@ namespace DM_Weight.ViewModels
|
||||||
DialogParameters dialogParameters = new DialogParameters();
|
DialogParameters dialogParameters = new DialogParameters();
|
||||||
dialogParameters.Add("msgInfo", msg);
|
dialogParameters.Add("msgInfo", msg);
|
||||||
DialogServiceExtensions.ShowDialogHost(_dialogService, "ShowMessageDialog", dialogParameters, "RootDialog");
|
DialogServiceExtensions.ShowDialogHost(_dialogService, "ShowMessageDialog", dialogParameters, "RootDialog");
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -272,7 +300,13 @@ namespace DM_Weight.ViewModels
|
||||||
_portUtil.SpeakAsync("正在打开" + DrawerNo + "号抽屉");
|
_portUtil.SpeakAsync("正在打开" + DrawerNo + "号抽屉");
|
||||||
|
|
||||||
//List<ChannelStock> singleChannels = channelStocks.FindAll(it => it.BoardType != 1);
|
//List<ChannelStock> singleChannels = channelStocks.FindAll(it => it.BoardType != 1);
|
||||||
List<ChannelStock> singleChannels = channelStocks
|
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 })
|
.GroupBy(it => new { it.DrawerNo, it.ColNo })
|
||||||
.Select(it =>
|
.Select(it =>
|
||||||
{
|
{
|
||||||
|
@ -322,6 +356,7 @@ namespace DM_Weight.ViewModels
|
||||||
List<ChannelStock> record = ChannelStocks.FindAll(it => it.TakeQuantity > 0).ToList();
|
List<ChannelStock> record = ChannelStocks.FindAll(it => it.TakeQuantity > 0).ToList();
|
||||||
if (record.Count > 0)
|
if (record.Count > 0)
|
||||||
{
|
{
|
||||||
|
|
||||||
string InvoiceId = OrderInfo.OrderNo;
|
string InvoiceId = OrderInfo.OrderNo;
|
||||||
var f = SqlSugarHelper.Db.UseTran(() =>
|
var f = SqlSugarHelper.Db.UseTran(() =>
|
||||||
{
|
{
|
||||||
|
@ -331,17 +366,20 @@ namespace DM_Weight.ViewModels
|
||||||
OrderNo = OrderInfo.OrderNo
|
OrderNo = OrderInfo.OrderNo
|
||||||
}).UpdateColumns(it => new { it.DmStatus }).WhereColumns(it => new { it.OrderNo }).ExecuteCommand();
|
}).UpdateColumns(it => new { it.DmStatus }).WhereColumns(it => new { it.OrderNo }).ExecuteCommand();
|
||||||
|
|
||||||
SqlSugarHelper.Db.Insertable(new OrderFinish()
|
//SqlSugarHelper.Db.Insertable(new OrderFinish()
|
||||||
{
|
//{
|
||||||
OrderNo = OrderInfo.OrderNo,
|
// OrderNo = OrderInfo.OrderNo,
|
||||||
PatientId = OrderInfo.PatientId,
|
// PatientId = OrderInfo.PatientId,
|
||||||
Pharmacy = OrderInfo.Pharmacy,
|
// Pharmacy = OrderInfo.Pharmacy,
|
||||||
State = 1,
|
// State = 1,
|
||||||
Operator = HomeWindowViewModel.Operator?.Nickname,
|
// Operator = HomeWindowViewModel.Operator?.Nickname,
|
||||||
});
|
//});
|
||||||
|
|
||||||
for (int i = 0; i < record.Count; i++)
|
for (int i = 0; i < record.Count; i++)
|
||||||
{
|
{
|
||||||
|
int ordinalNum = SqlSugarHelper.Db.Queryable<MachineRecord>()
|
||||||
|
.Where(mr => mr.OperationTime.ToString("yyyy-MM-dd") == DateTime.Now.ToString("yyyy-MM-dd")&&mr.MachineId.Equals(ConfigurationManager.AppSettings["machineId"] ?? "DM1"))
|
||||||
|
.Max(mr => mr.OrdinalNum);
|
||||||
ChannelStock it = record[i];
|
ChannelStock it = record[i];
|
||||||
// 更新数据 库存信息
|
// 更新数据 库存信息
|
||||||
SqlSugarHelper.Db.Updateable(new ChannelStock()
|
SqlSugarHelper.Db.Updateable(new ChannelStock()
|
||||||
|
@ -376,9 +414,18 @@ namespace DM_Weight.ViewModels
|
||||||
StockQuantity = nowChannels.Sum(it => it.Quantity),
|
StockQuantity = nowChannels.Sum(it => it.Quantity),
|
||||||
ManunoQuantity = nowChannels.FindAll(it2 => it2.ManuNo == it.ManuNo).Sum(it => it.Quantity),
|
ManunoQuantity = nowChannels.FindAll(it2 => it2.ManuNo == it.ManuNo).Sum(it => it.Quantity),
|
||||||
SupplierDept = ConfigurationManager.AppSettings["receiveDept"].ToString(),
|
SupplierDept = ConfigurationManager.AppSettings["receiveDept"].ToString(),
|
||||||
ReceiveDept = OrderInfo.DeptName
|
ReceiveDept = OrderInfo.DeptName,
|
||||||
|
ReceivePerson = ReceivePerson,
|
||||||
|
OrdinalNum = ordinalNum<=0?1:ordinalNum+ 1,
|
||||||
}).ExecuteCommand();
|
}).ExecuteCommand();
|
||||||
}
|
}
|
||||||
|
//更新处方明细状态为已取药1
|
||||||
|
List<OrderDetail> orderDetailLst = SqlSugarHelper.Db.Queryable<OrderDetail>().Where(od => od.OrderNo == OrderInfo.OrderNo && od.DetailStatus == 0).ToList();
|
||||||
|
if (orderDetailLst != null && orderDetailLst.Count > 0)
|
||||||
|
{
|
||||||
|
orderDetailLst.ForEach(od => od.DetailStatus = 1);
|
||||||
|
SqlSugarHelper.Db.Updateable(orderDetailLst).UpdateColumns(it => new { it.DetailStatus }).ExecuteCommand();
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
if (f.Data)
|
if (f.Data)
|
||||||
|
@ -396,24 +443,42 @@ namespace DM_Weight.ViewModels
|
||||||
}).ToList();
|
}).ToList();
|
||||||
//if ((singleChannels.Count > 0 ? singleChannels[0].BoardType : 1) == 5)
|
//if ((singleChannels.Count > 0 ? singleChannels[0].BoardType : 1) == 5)
|
||||||
//{
|
//{
|
||||||
//singleChannels.ForEach(it =>
|
//singleChannels.ForEach(it =>
|
||||||
//{
|
//{
|
||||||
// _portUtil.WriteQuantity(it.DrawerNo, it.ColNo, it.Quantity - it.TakeQuantity);
|
// _portUtil.WriteQuantity(it.DrawerNo, it.ColNo, it.Quantity - it.TakeQuantity);
|
||||||
//});
|
//});
|
||||||
//}
|
//}
|
||||||
if(singleChannels.Count > 0)
|
if (singleChannels.Count > 0)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < singleChannels.Count; i++)
|
for (int i = 0; i < singleChannels.Count; i++)
|
||||||
{
|
{
|
||||||
if (singleChannels[i].BoardType == 5)
|
if (singleChannels[i].BoardType == 5)
|
||||||
{
|
{
|
||||||
int totalQuantity = SqlSugarHelper.Db.Queryable<ChannelStock>()
|
List<ChannelStock> csList = SqlSugarHelper.Db.Queryable<ChannelStock>()
|
||||||
.Where(cs => cs.MachineId == singleChannels[i].MachineId)
|
.Where(cs => cs.MachineId == singleChannels[i].MachineId)
|
||||||
.Where(cs => cs.DrawerNo == singleChannels[i].DrawerNo)
|
.Where(cs => cs.DrawerNo == singleChannels[i].DrawerNo)
|
||||||
.Where(cs => cs.ColNo == singleChannels[i].ColNo)
|
.Where(cs => cs.ColNo == singleChannels[i].ColNo&&cs.Quantity>0).OrderBy(cs => cs.EffDate).ToList();
|
||||||
.Sum(it => it.Quantity);
|
|
||||||
//将库位多批次的总库存数更新标签
|
if (csList != null && csList.Count > 0)
|
||||||
_portUtil.WriteQuantity(singleChannels[i].DrawerNo, singleChannels[i].ColNo, totalQuantity);
|
{
|
||||||
|
int totalQuantity = csList.Sum(c => c.Quantity);
|
||||||
|
|
||||||
|
//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)
|
||||||
|
// .Sum(it => it.Quantity);
|
||||||
|
|
||||||
|
_portUtil.WriteChannelInfo(5, csList[0].EffDate == null ? "" : csList[0].EffDate, csList[0].DrawerNo, csList[0].ColNo);
|
||||||
|
Thread.Sleep(200);
|
||||||
|
_portUtil.WriteChannelInfo(6, csList[0].ManuNo == null ? "" : csList[0].ManuNo, csList[0].DrawerNo, csList[0].ColNo);
|
||||||
|
Thread.Sleep(200);
|
||||||
|
_portUtil.ShowContent(csList[0].DrawerNo, csList[0].ColNo);
|
||||||
|
Thread.Sleep(200);
|
||||||
|
//将库位多批次的总库存数更新标签
|
||||||
|
_portUtil.WriteQuantity(csList[i].DrawerNo, csList[i].ColNo, totalQuantity);
|
||||||
|
Thread.Sleep(200);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -424,7 +489,7 @@ namespace DM_Weight.ViewModels
|
||||||
};
|
};
|
||||||
_eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
|
_eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
|
||||||
}
|
}
|
||||||
if(!f.IsSuccess)
|
if (!f.IsSuccess)
|
||||||
{
|
{
|
||||||
AlertMsg alertMsg = new AlertMsg
|
AlertMsg alertMsg = new AlertMsg
|
||||||
{
|
{
|
||||||
|
|
|
@ -225,9 +225,10 @@ namespace DM_Weight.ViewModels
|
||||||
logger.Info("开始OrderTakeDrugWindowViewModel_查询数据");
|
logger.Info("开始OrderTakeDrugWindowViewModel_查询数据");
|
||||||
OrderInfos.Clear();
|
OrderInfos.Clear();
|
||||||
int totalCount = 0;
|
int totalCount = 0;
|
||||||
|
|
||||||
List<OrderInfo> queryData = SqlSugarHelper.Db.Queryable<OrderInfo>()
|
List<OrderInfo> queryData = SqlSugarHelper.Db.Queryable<OrderInfo>()
|
||||||
.InnerJoin<OrderDetail>((oi, od) => oi.OrderNo == od.OrderNo)
|
.InnerJoin<OrderDetail>((oi, od) => oi.OrderNo == od.OrderNo && od.DetailStatus == 0)
|
||||||
.InnerJoin(SqlSugarHelper.Db.Queryable<ChannelList>().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)
|
.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.RecvDate.ToString("yyyy-MM-dd") == OrderDate)
|
.WhereIF(OrderDate != null, oi => oi.RecvDate.ToString("yyyy-MM-dd") == OrderDate)
|
||||||
.WhereIF(!String.IsNullOrEmpty(SearchValue) && SelectedItem.Code.Equals("OrderNo"), oi => oi.OrderNo == SearchValue)
|
.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(SearchValue) && SelectedItem.Code.Equals("PatientId"), oi => oi.PatientId == SearchValue)
|
||||||
|
|
|
@ -17,6 +17,7 @@ using DM_Weight.msg;
|
||||||
using DM_Weight.Port;
|
using DM_Weight.Port;
|
||||||
using DM_Weight.util;
|
using DM_Weight.util;
|
||||||
using SqlSugar;
|
using SqlSugar;
|
||||||
|
using System.Threading;
|
||||||
|
|
||||||
namespace DM_Weight.ViewModels
|
namespace DM_Weight.ViewModels
|
||||||
{
|
{
|
||||||
|
@ -193,6 +194,53 @@ namespace DM_Weight.ViewModels
|
||||||
{
|
{
|
||||||
get => new DelegateCommand(() =>
|
get => new DelegateCommand(() =>
|
||||||
{
|
{
|
||||||
|
//if (App.CurrentFaUserList.Role != null)
|
||||||
|
//{
|
||||||
|
// //查看当前用户是否有所在药品抽屉的权限
|
||||||
|
// bool bLessEight = ChannelStocks.Select(it => it.DrawerNo).Where(n => n <= 8).Any();
|
||||||
|
// bool bMoreEight = ChannelStocks.Select(it => it.DrawerNo).Where(n => n > 8 && n < 17).Any();
|
||||||
|
// bool bEqualEight = ChannelStocks.Select(it => it.DrawerNo).Where(n => n == 17).Any();
|
||||||
|
// if (bLessEight)
|
||||||
|
// {
|
||||||
|
// if (App.CurrentFaUserList.Role.FirstEightChecked == "0")
|
||||||
|
// {
|
||||||
|
// AlertMsg alertMsg = new AlertMsg
|
||||||
|
// {
|
||||||
|
// Message = "当前用户没有打开抽屉的权限!",
|
||||||
|
// Type = MsgType.ERROR,
|
||||||
|
// };
|
||||||
|
// _eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// if (bMoreEight)
|
||||||
|
// {
|
||||||
|
// if (App.CurrentFaUserList.Role.LastEightChecked == "0")
|
||||||
|
// {
|
||||||
|
// AlertMsg alertMsg = new AlertMsg
|
||||||
|
// {
|
||||||
|
// Message = "当前用户没有打开抽屉的权限!",
|
||||||
|
// Type = MsgType.ERROR,
|
||||||
|
// };
|
||||||
|
// _eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// if (bEqualEight)
|
||||||
|
// {
|
||||||
|
// if (App.CurrentFaUserList.Role.StorageBoxChecked == "0")
|
||||||
|
// {
|
||||||
|
// AlertMsg alertMsg = new AlertMsg
|
||||||
|
// {
|
||||||
|
// Message = "当前用户没有打开抽屉的权限!",
|
||||||
|
// Type = MsgType.ERROR,
|
||||||
|
// };
|
||||||
|
// _eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
//}
|
||||||
if (ChannelStock != null)
|
if (ChannelStock != null)
|
||||||
{
|
{
|
||||||
Status = 1;
|
Status = 1;
|
||||||
|
@ -287,6 +335,7 @@ namespace DM_Weight.ViewModels
|
||||||
.Sum(it => it.Quantity);
|
.Sum(it => it.Quantity);
|
||||||
|
|
||||||
_portUtil.WriteQuantity(ChannelStock.DrawerNo, ChannelStock.ColNo, totalQuantity);
|
_portUtil.WriteQuantity(ChannelStock.DrawerNo, ChannelStock.ColNo, totalQuantity);
|
||||||
|
Thread.Sleep(200);
|
||||||
}
|
}
|
||||||
|
|
||||||
AlertMsg alertMsg = new AlertMsg
|
AlertMsg alertMsg = new AlertMsg
|
||||||
|
|
|
@ -182,7 +182,7 @@ namespace DM_Weight.ViewModels
|
||||||
public async void OpenOrderDialog()
|
public async void OpenOrderDialog()
|
||||||
{
|
{
|
||||||
//if (SelectedOrder != null && SelectedOrder.DmStatus == 0 && SelectedOrder.CancelFlag == 0 && SelectedOrder.HisDispFlag == 0)
|
//if (SelectedOrder != null && SelectedOrder.DmStatus == 0 && SelectedOrder.CancelFlag == 0 && SelectedOrder.HisDispFlag == 0)
|
||||||
if (SelectedOrder != null && SelectedOrder.DmStatus == 1 && SelectedOrder.CancelFlag == 1 && SelectedOrder.HisDispFlag == 1)
|
if (SelectedOrder != null && SelectedOrder.DmStatus == 1 && SelectedOrder.CancelFlag == 1)
|
||||||
{
|
{
|
||||||
// 此处延时1毫秒,等待页面渲染
|
// 此处延时1毫秒,等待页面渲染
|
||||||
await Task.Delay(TimeSpan.FromMilliseconds(1));
|
await Task.Delay(TimeSpan.FromMilliseconds(1));
|
||||||
|
@ -218,13 +218,16 @@ namespace DM_Weight.ViewModels
|
||||||
int totalCount = 0;
|
int totalCount = 0;
|
||||||
List<OrderInfo> queryData = SqlSugarHelper.Db.Queryable<OrderInfo>()
|
List<OrderInfo> queryData = SqlSugarHelper.Db.Queryable<OrderInfo>()
|
||||||
.InnerJoin<OrderDetail>((oi, od) => oi.OrderNo == od.OrderNo)
|
.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)
|
.InnerJoin(SqlSugarHelper.Db.Queryable<ChannelStock>().Where(cs => cs.DrawerType == 1)
|
||||||
|
.WhereIF(App.SingleModel, cs => cs.DrawerNo <= 2) //单人登录开前8个抽屉,双人登录开后8个抽屉
|
||||||
|
.WhereIF(!(App.SingleModel), cs => cs.DrawerNo > 2)
|
||||||
|
.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.OrderDate.ToString("yyyy-MM-dd") == OrderDate)
|
||||||
.WhereIF(!String.IsNullOrEmpty(SearchValue) && SelectedItem.Code.Equals("OrderNo"), oi => oi.OrderNo == SearchValue)
|
.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(SearchValue) && SelectedItem.Code.Equals("PatientId"), oi => oi.PatientId == SearchValue)
|
||||||
.WhereIF(!String.IsNullOrEmpty(ConfigurationManager.AppSettings["storage"]), oi => oi.Pharmacy == ConfigurationManager.AppSettings["storage"])
|
.WhereIF(!String.IsNullOrEmpty(ConfigurationManager.AppSettings["storage"]), oi => oi.Pharmacy == ConfigurationManager.AppSettings["storage"])
|
||||||
.Where(oi => oi.DmStatus == 1)
|
.Where(oi => oi.DmStatus == 1)
|
||||||
.Where(oi => oi.HisDispFlag == 1)
|
//.Where(oi => oi.HisDispFlag == 1)
|
||||||
.Where(oi => oi.CancelFlag == 1)
|
.Where(oi => oi.CancelFlag == 1)
|
||||||
.GroupBy(oi => oi.OrderDate)
|
.GroupBy(oi => oi.OrderDate)
|
||||||
.Select(oi => oi)
|
.Select(oi => oi)
|
||||||
|
|
|
@ -184,6 +184,8 @@ namespace DM_Weight.ViewModels
|
||||||
.WhereIF(!String.IsNullOrEmpty(SearchValue) && SelectedItem.Code.Equals("DrugName"), (mr) => mr.DrugInfo.DrugName.Contains(SearchValue))
|
.WhereIF(!String.IsNullOrEmpty(SearchValue) && SelectedItem.Code.Equals("DrugName"), (mr) => mr.DrugInfo.DrugName.Contains(SearchValue))
|
||||||
.WhereIF(!String.IsNullOrEmpty(SearchValue) && SelectedItem.Code.Equals("PyCode"), (mr) => mr.DrugInfo.PyCode.Contains(SearchValue))
|
.WhereIF(!String.IsNullOrEmpty(SearchValue) && SelectedItem.Code.Equals("PyCode"), (mr) => mr.DrugInfo.PyCode.Contains(SearchValue))
|
||||||
.WhereIF(!String.IsNullOrEmpty(SearchValue) && SelectedItem.Code.Equals("DrugBarcode"), (mr) => mr.DrugInfo.DrugBarcode.Contains(SearchValue))
|
.WhereIF(!String.IsNullOrEmpty(SearchValue) && SelectedItem.Code.Equals("DrugBarcode"), (mr) => mr.DrugInfo.DrugBarcode.Contains(SearchValue))
|
||||||
|
.WhereIF(App.SingleModel, cs => cs.DrawerNo <= 2) //单人登录开前8个抽屉,双人登录开后8个抽屉
|
||||||
|
.WhereIF(!(App.SingleModel), cs => cs.DrawerNo > 2)
|
||||||
.OrderBy(mr => mr.OperationTime)
|
.OrderBy(mr => mr.OperationTime)
|
||||||
.ToList();
|
.ToList();
|
||||||
MachineRecords = queryData;
|
MachineRecords = queryData;
|
||||||
|
|
|
@ -20,6 +20,8 @@ using DM_Weight.util;
|
||||||
using DM_Weight.Views;
|
using DM_Weight.Views;
|
||||||
using SqlSugar;
|
using SqlSugar;
|
||||||
using System.Threading.Channels;
|
using System.Threading.Channels;
|
||||||
|
using DM_Weight.Report;
|
||||||
|
using System.Threading;
|
||||||
|
|
||||||
namespace DM_Weight.ViewModels
|
namespace DM_Weight.ViewModels
|
||||||
{
|
{
|
||||||
|
@ -49,7 +51,7 @@ namespace DM_Weight.ViewModels
|
||||||
|
|
||||||
void DoMyPrismEvent(DeviceMsg msg)
|
void DoMyPrismEvent(DeviceMsg msg)
|
||||||
{
|
{
|
||||||
|
logger.Info($"msg.WindowName【{msg.WindowName}】WindowName【{WindowName}】Status【{Status}】EventType【{msg.EventType}】");
|
||||||
if (msg.WindowName.Equals(WindowName))
|
if (msg.WindowName.Equals(WindowName))
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -135,6 +137,14 @@ namespace DM_Weight.ViewModels
|
||||||
SetProperty(ref _machineRecords, value);
|
SetProperty(ref _machineRecords, value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private MachineRecord _machineRecord=new();
|
||||||
|
|
||||||
|
public MachineRecord _MachineRecord
|
||||||
|
{
|
||||||
|
get=> _machineRecord;
|
||||||
|
set=>SetProperty(ref _machineRecord, value);
|
||||||
|
}
|
||||||
|
|
||||||
private ChannelStock _channelStock;
|
private ChannelStock _channelStock;
|
||||||
|
|
||||||
|
@ -144,6 +154,20 @@ namespace DM_Weight.ViewModels
|
||||||
set => SetProperty(ref _channelStock, value);
|
set => SetProperty(ref _channelStock, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//接受人
|
||||||
|
private string receivePerson;
|
||||||
|
public string ReceivePerson
|
||||||
|
{
|
||||||
|
get => receivePerson;
|
||||||
|
set => SetProperty(ref receivePerson, value);
|
||||||
|
}
|
||||||
|
//还药人
|
||||||
|
private string returnPerson;
|
||||||
|
public string ReturnPerson
|
||||||
|
{
|
||||||
|
get => returnPerson;
|
||||||
|
set => SetProperty(ref returnPerson, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public bool CanCloseDialog()
|
public bool CanCloseDialog()
|
||||||
|
@ -170,8 +194,17 @@ namespace DM_Weight.ViewModels
|
||||||
|
|
||||||
public void 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 == 2)
|
||||||
|
// .Where(mr => mr.Status != 2)
|
||||||
|
// .OrderBy(mr => mr.OperationTime)
|
||||||
|
// .OrderBy(mr => mr.Id)
|
||||||
|
// .ToList();
|
||||||
List<MachineRecord> queryData = SqlSugarHelper.Db.Queryable<MachineRecord>()
|
List<MachineRecord> queryData = SqlSugarHelper.Db.Queryable<MachineRecord>()
|
||||||
.Includes<UserList>(mr => mr.User)
|
.Includes<OrderInfo>(mr => mr.orderInfo)
|
||||||
.Where(mr => mr.DrugId == ChannelStock.DrugId)
|
.Where(mr => mr.DrugId == ChannelStock.DrugId)
|
||||||
.Where(mr => mr.MachineId.Equals(ConfigurationManager.AppSettings["machineId"] ?? "DM1"))
|
.Where(mr => mr.MachineId.Equals(ConfigurationManager.AppSettings["machineId"] ?? "DM1"))
|
||||||
.Where(mr => mr.Type == 2)
|
.Where(mr => mr.Type == 2)
|
||||||
|
@ -181,6 +214,32 @@ namespace DM_Weight.ViewModels
|
||||||
.ToList();
|
.ToList();
|
||||||
MachineRecords = queryData;
|
MachineRecords = queryData;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public DelegateCommand RowSelected
|
||||||
|
{
|
||||||
|
get => new DelegateCommand(() =>
|
||||||
|
{
|
||||||
|
if (MachineRecords != null && MachineRecords.Count>0)
|
||||||
|
{
|
||||||
|
MachineRecords = MachineRecords.Select(x =>
|
||||||
|
{
|
||||||
|
if (x.Id == _MachineRecord.Id)
|
||||||
|
{
|
||||||
|
x.IsSelected = !x.IsSelected;
|
||||||
|
CheckboxChecked();
|
||||||
|
}
|
||||||
|
return x;
|
||||||
|
}).ToList();
|
||||||
|
//DialogParameters dialogParameters = new DialogParameters();
|
||||||
|
//dialogParameters.Add("channel", Channel);
|
||||||
|
//DialogServiceExtensions.ShowDialogHost(_dialogService, "ReturnEmptyDialog", dialogParameters, DoDialogResult, "RootDialog");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//选中药品将要返还的数量添加到文本框
|
//选中药品将要返还的数量添加到文本框
|
||||||
private void CheckboxChecked()
|
private void CheckboxChecked()
|
||||||
{
|
{
|
||||||
|
@ -199,6 +258,7 @@ namespace DM_Weight.ViewModels
|
||||||
{
|
{
|
||||||
get => new DelegateCommand(() =>
|
get => new DelegateCommand(() =>
|
||||||
{
|
{
|
||||||
|
|
||||||
if (ChannelStock != null)
|
if (ChannelStock != null)
|
||||||
{
|
{
|
||||||
if (Status == 0)
|
if (Status == 0)
|
||||||
|
@ -209,6 +269,54 @@ namespace DM_Weight.ViewModels
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
||||||
|
//if (App.CurrentFaUserList.Role != null)
|
||||||
|
//{
|
||||||
|
// //查看当前用户是否有所在药品抽屉的权限
|
||||||
|
// bool bLessEight = ChannelStock.DrawerNo <= 8;
|
||||||
|
// bool bMoreEight = ChannelStock.DrawerNo > 8;
|
||||||
|
// bool bEqualEight = ChannelStock.DrawerNo == 17;
|
||||||
|
// if (bLessEight)
|
||||||
|
// {
|
||||||
|
// if (App.CurrentFaUserList.Role.FirstEightChecked == "0")
|
||||||
|
// {
|
||||||
|
// AlertMsg alertMsg = new AlertMsg
|
||||||
|
// {
|
||||||
|
// Message = "当前用户没有打开抽屉的权限!",
|
||||||
|
// Type = MsgType.ERROR,
|
||||||
|
// };
|
||||||
|
// _eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// if (bMoreEight)
|
||||||
|
// {
|
||||||
|
// if (App.CurrentFaUserList.Role.LastEightChecked == "0")
|
||||||
|
// {
|
||||||
|
// AlertMsg alertMsg = new AlertMsg
|
||||||
|
// {
|
||||||
|
// Message = "当前用户没有打开抽屉的权限!",
|
||||||
|
// Type = MsgType.ERROR,
|
||||||
|
// };
|
||||||
|
// _eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// if (bEqualEight)
|
||||||
|
// {
|
||||||
|
// if (App.CurrentFaUserList.Role.StorageBoxChecked == "0")
|
||||||
|
// {
|
||||||
|
// AlertMsg alertMsg = new AlertMsg
|
||||||
|
// {
|
||||||
|
// Message = "当前用户没有打开抽屉的权限!",
|
||||||
|
// Type = MsgType.ERROR,
|
||||||
|
// };
|
||||||
|
// _eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
//}
|
||||||
Status = 1;
|
Status = 1;
|
||||||
_portUtil.SpeakAsync("正在打开" + ChannelStock.DrawerNo + "号抽屉");
|
_portUtil.SpeakAsync("正在打开" + ChannelStock.DrawerNo + "号抽屉");
|
||||||
_portUtil.WindowName = WindowName;
|
_portUtil.WindowName = WindowName;
|
||||||
|
@ -286,10 +394,12 @@ namespace DM_Weight.ViewModels
|
||||||
EffDate = !String.IsNullOrEmpty(ChannelStock.EffDate) ? DateTime.ParseExact(ChannelStock.EffDate, "yyyy-MM-dd", System.Globalization.CultureInfo.CurrentCulture) : null,
|
EffDate = !String.IsNullOrEmpty(ChannelStock.EffDate) ? DateTime.ParseExact(ChannelStock.EffDate, "yyyy-MM-dd", System.Globalization.CultureInfo.CurrentCulture) : null,
|
||||||
Operator = HomeWindowViewModel.Operator?.Id,
|
Operator = HomeWindowViewModel.Operator?.Id,
|
||||||
Reviewer = HomeWindowViewModel.Reviewer?.Id,
|
Reviewer = HomeWindowViewModel.Reviewer?.Id,
|
||||||
|
ReturnPerson = ReturnPerson,
|
||||||
|
ReceivePerson = ReceivePerson,
|
||||||
OperationTime = DateTime.Now,
|
OperationTime = DateTime.Now,
|
||||||
Quantity = ReturnQuantity,
|
Quantity =_MachineRecord.Quantity, //ReturnQuantity,
|
||||||
Type = 32,
|
Type = 32,
|
||||||
InvoiceId = InvoiceId,
|
InvoiceId = _MachineRecord.InvoiceId, //InvoiceId,
|
||||||
GetId = _MachineRecord.Id,
|
GetId = _MachineRecord.Id,
|
||||||
StockQuantity = nowChannels.Sum(it => it.Quantity),
|
StockQuantity = nowChannels.Sum(it => it.Quantity),
|
||||||
ManunoQuantity = nowChannels.FindAll(it2 => it2.ManuNo == ChannelStock.ManuNo).Sum(it => it.Quantity)
|
ManunoQuantity = nowChannels.FindAll(it2 => it2.ManuNo == ChannelStock.ManuNo).Sum(it => it.Quantity)
|
||||||
|
@ -304,6 +414,7 @@ namespace DM_Weight.ViewModels
|
||||||
if (ChannelStock.BoardType == 5)
|
if (ChannelStock.BoardType == 5)
|
||||||
{
|
{
|
||||||
_portUtil.WriteQuantity(ChannelStock.DrawerNo, ChannelStock.ColNo, ChannelStock.Quantity + ReturnQuantity);
|
_portUtil.WriteQuantity(ChannelStock.DrawerNo, ChannelStock.ColNo, ChannelStock.Quantity + ReturnQuantity);
|
||||||
|
Thread.Sleep(200);
|
||||||
}
|
}
|
||||||
|
|
||||||
AlertMsg alertMsg = new AlertMsg
|
AlertMsg alertMsg = new AlertMsg
|
||||||
|
@ -372,5 +483,6 @@ namespace DM_Weight.ViewModels
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool KeepAlive => true;
|
public bool KeepAlive => true;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,6 +10,8 @@ using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using DM_Weight.Models;
|
using DM_Weight.Models;
|
||||||
using DM_Weight.util;
|
using DM_Weight.util;
|
||||||
|
using DM_Weight.Report;
|
||||||
|
using System.Configuration;
|
||||||
|
|
||||||
namespace DM_Weight.ViewModels
|
namespace DM_Weight.ViewModels
|
||||||
{
|
{
|
||||||
|
@ -42,16 +44,18 @@ namespace DM_Weight.ViewModels
|
||||||
//this.SqlSugarHelper.Db = sqlSugarScope;
|
//this.SqlSugarHelper.Db = sqlSugarScope;
|
||||||
}
|
}
|
||||||
|
|
||||||
public DelegateCommand RowSelected
|
public DelegateCommand RowSelected
|
||||||
{
|
{
|
||||||
get => new DelegateCommand(() =>
|
get => new DelegateCommand(async () =>
|
||||||
{
|
{
|
||||||
|
|
||||||
if (Channel != null && Channel.DrugId == null)
|
// 此处延时1毫秒,等待页面渲染(规避工控机上手指点击弹出的页面上的按钮无效问题)
|
||||||
|
await Task.Delay(TimeSpan.FromMilliseconds(1));
|
||||||
|
if (Channel != null &&string.IsNullOrEmpty(Channel.DrugId))
|
||||||
{
|
{
|
||||||
DialogParameters dialogParameters = new DialogParameters();
|
DialogParameters dialogParameters = new DialogParameters();
|
||||||
dialogParameters.Add("DrawerNo", Channel.DrawerNo);
|
dialogParameters.Add("DrawerNo", Channel.DrawerNo);
|
||||||
DialogServiceExtensions.ShowDialogHost(_dialogService, "BindingChannelDialog", dialogParameters, DoDialogResult, "RootDialog");
|
DialogServiceExtensions.ShowDialogHost(_dialogService, "BindingChannelNewDialog", dialogParameters, DoDialogResult, "RootDialog");
|
||||||
}
|
}
|
||||||
else if(Channel != null && Channel.CanReturnQuantity > 0)
|
else if(Channel != null && Channel.CanReturnQuantity > 0)
|
||||||
{
|
{
|
||||||
|
@ -103,8 +107,11 @@ namespace DM_Weight.ViewModels
|
||||||
Channels = SqlSugarHelper.Db.Queryable<ChannelStock>()
|
Channels = SqlSugarHelper.Db.Queryable<ChannelStock>()
|
||||||
.LeftJoin<DrugInfo>((cs,di) => cs.DrugId == di.DrugId.ToString())
|
.LeftJoin<DrugInfo>((cs,di) => cs.DrugId == di.DrugId.ToString())
|
||||||
.Where((cs) => cs.DrawerType != 1)
|
.Where((cs) => cs.DrawerType != 1)
|
||||||
|
//.WhereIF(App.SingleModel, cs => cs.DrawerNo <= 2) //单人登录开前8个抽屉,双人登录开后8个抽屉
|
||||||
|
//.WhereIF(!(App.SingleModel), cs => cs.DrawerNo > 2)
|
||||||
|
.Where(cs => cs.MachineId.Equals(ConfigurationManager.AppSettings["machineId"] ?? "DM1"))
|
||||||
.Select((cs, di) => new ChannelStock{
|
.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)) ,
|
CanReturnQuantity = SqlFunc.Subqueryable<MachineRecord>().Where(mr => mr.DrugId == cs.DrugId&&mr.MachineId.Equals(ConfigurationManager.AppSettings["machineId"] ?? "DM1")).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
|
DrugInfo = new DrugInfo
|
||||||
{
|
{
|
||||||
DrugId = di.DrugId,
|
DrugId = di.DrugId,
|
||||||
|
|
|
@ -30,6 +30,8 @@ namespace DM_Weight.ViewModels
|
||||||
get { return _roleList; }
|
get { return _roleList; }
|
||||||
set { SetProperty(ref _roleList, value); }
|
set { SetProperty(ref _roleList, value); }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//private SqlSugarScope SqlSugarHelper.Db;
|
//private SqlSugarScope SqlSugarHelper.Db;
|
||||||
public RoleManagerWindowViewModel(SqlSugarScope sqlSugarScope)
|
public RoleManagerWindowViewModel(SqlSugarScope sqlSugarScope)
|
||||||
{
|
{
|
||||||
|
@ -197,7 +199,16 @@ namespace DM_Weight.ViewModels
|
||||||
PremissionName = "取药记录",
|
PremissionName = "取药记录",
|
||||||
PremissionPath = "TakeRecordWindow",
|
PremissionPath = "TakeRecordWindow",
|
||||||
};
|
};
|
||||||
|
if (ConfigurationManager.AppSettings["MultiOrder"].ToString().Equals("1"))
|
||||||
|
{
|
||||||
|
PremissionDm mulityOrder = new PremissionDm
|
||||||
|
{
|
||||||
|
Id = 16,
|
||||||
|
PremissionName = "多处方取药",
|
||||||
|
PremissionPath = "MultiOrderTakeDrugWindow",
|
||||||
|
};
|
||||||
|
quyaoChild.Add(mulityOrder);
|
||||||
|
}
|
||||||
quyaoChild.Add(quyao1);
|
quyaoChild.Add(quyao1);
|
||||||
quyaoChild.Add(quyao2);
|
quyaoChild.Add(quyao2);
|
||||||
quyaoChild.Add(quyao3);
|
quyaoChild.Add(quyao3);
|
||||||
|
@ -247,7 +258,7 @@ namespace DM_Weight.ViewModels
|
||||||
PremissionDm jiayao5 = new PremissionDm
|
PremissionDm jiayao5 = new PremissionDm
|
||||||
{
|
{
|
||||||
Id = 24,
|
Id = 24,
|
||||||
PremissionName = "多批次抽屉加药",
|
PremissionName = "批次抽屉加药",
|
||||||
PremissionPath = "AddDrugControl",
|
PremissionPath = "AddDrugControl",
|
||||||
};
|
};
|
||||||
jiayaoChild.Add(jiayao1);
|
jiayaoChild.Add(jiayao1);
|
||||||
|
@ -341,11 +352,17 @@ namespace DM_Weight.ViewModels
|
||||||
PremissionName = "交接班记录",
|
PremissionName = "交接班记录",
|
||||||
PremissionPath = "ChangeShiftsListWindow",
|
PremissionPath = "ChangeShiftsListWindow",
|
||||||
};
|
};
|
||||||
|
//PremissionDm kuguan6 = new PremissionDm
|
||||||
|
//{
|
||||||
|
// Id = 46,
|
||||||
|
// PremissionName = "账册",
|
||||||
|
// PremissionPath = "AccountWindow",
|
||||||
|
//};
|
||||||
PremissionDm kuguan6 = new PremissionDm
|
PremissionDm kuguan6 = new PremissionDm
|
||||||
{
|
{
|
||||||
Id = 46,
|
Id = 46,
|
||||||
PremissionName = "账册",
|
PremissionName = "专用账册",
|
||||||
PremissionPath = "AccountWindow",
|
PremissionPath = "SpecialAccountWindow",
|
||||||
};
|
};
|
||||||
//PremissionDm kuguan7 = new PremissionDm
|
//PremissionDm kuguan7 = new PremissionDm
|
||||||
//{
|
//{
|
||||||
|
@ -359,6 +376,7 @@ namespace DM_Weight.ViewModels
|
||||||
kuguanChild.Add(kuguan4);
|
kuguanChild.Add(kuguan4);
|
||||||
kuguanChild.Add(kuguan5);
|
kuguanChild.Add(kuguan5);
|
||||||
kuguanChild.Add(kuguan6);
|
kuguanChild.Add(kuguan6);
|
||||||
|
//kuguanChild.Add(kuguan66);
|
||||||
//kuguanChild.Add(kuguan7);
|
//kuguanChild.Add(kuguan7);
|
||||||
kuguan.Children = kuguanChild;
|
kuguan.Children = kuguanChild;
|
||||||
defaultAll.Add(kuguan);
|
defaultAll.Add(kuguan);
|
||||||
|
@ -697,6 +715,7 @@ namespace DM_Weight.ViewModels
|
||||||
Role.Id = 0;
|
Role.Id = 0;
|
||||||
Role.MachineId = ConfigurationManager.AppSettings["machineId"] ?? "DM1";
|
Role.MachineId = ConfigurationManager.AppSettings["machineId"] ?? "DM1";
|
||||||
Role.Permissions = RightPremissions.ToList();
|
Role.Permissions = RightPremissions.ToList();
|
||||||
|
|
||||||
List<RoleDm> roleList = SqlSugarHelper.Db.Queryable<RoleDm>().Where(r => r.RoleName == Role.RoleName).ToList();
|
List<RoleDm> roleList = SqlSugarHelper.Db.Queryable<RoleDm>().Where(r => r.RoleName == Role.RoleName).ToList();
|
||||||
if(roleList.Count>0)
|
if(roleList.Count>0)
|
||||||
{
|
{
|
||||||
|
@ -743,8 +762,7 @@ namespace DM_Weight.ViewModels
|
||||||
.Where(di => di.MachineId.Equals(ConfigurationManager.AppSettings["machineId"] ?? "DM1"))
|
.Where(di => di.MachineId.Equals(ConfigurationManager.AppSettings["machineId"] ?? "DM1"))
|
||||||
.WhereIF(!String.IsNullOrEmpty(SearchValue), (di) => di.RoleName.Contains(SearchValue??""))
|
.WhereIF(!String.IsNullOrEmpty(SearchValue), (di) => di.RoleName.Contains(SearchValue??""))
|
||||||
.Select(r => r)
|
.Select(r => r)
|
||||||
.ToList()
|
.ToList();
|
||||||
;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//每次导航的时候,该实列用不用重新创建,true是不重新创建,false是重新创建
|
//每次导航的时候,该实列用不用重新创建,true是不重新创建,false是重新创建
|
||||||
|
|
|
@ -25,7 +25,33 @@ namespace DM_Weight.ViewModels
|
||||||
{
|
{
|
||||||
public class SelfAddDialogViewModel : BindableBase, IDialogAware, IRegionMemberLifetime
|
public class SelfAddDialogViewModel : BindableBase, IDialogAware, IRegionMemberLifetime
|
||||||
{
|
{
|
||||||
|
public static List<UseFor> SelectUseList = new()
|
||||||
|
{
|
||||||
|
|
||||||
|
new UseFor { UseId = 96, UseName = "不入账册" } , new UseFor { UseId = 0, UseName = "入账册" }
|
||||||
|
};
|
||||||
|
private List<UseFor> _selectsUseFor = SelectUseList;
|
||||||
|
|
||||||
|
public List<UseFor> SelectsUseFor
|
||||||
|
{
|
||||||
|
get { return _selectsUseFor; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
SetProperty(ref _selectsUseFor, value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private UseFor _selectedItemUseFor = SelectUseList[0];
|
||||||
|
/// <summary>
|
||||||
|
/// 取药或加药用途字段
|
||||||
|
/// </summary>
|
||||||
|
public UseFor SelectedItemUseFor
|
||||||
|
{
|
||||||
|
get { return _selectedItemUseFor; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
SetProperty(ref _selectedItemUseFor, value);
|
||||||
|
}
|
||||||
|
}
|
||||||
private readonly ILog logger = LogManager.GetLogger(typeof(SelfAddDialogViewModel));
|
private readonly ILog logger = LogManager.GetLogger(typeof(SelfAddDialogViewModel));
|
||||||
public string Title => "自选加药";
|
public string Title => "自选加药";
|
||||||
|
|
||||||
|
@ -176,6 +202,53 @@ namespace DM_Weight.ViewModels
|
||||||
{
|
{
|
||||||
if (Status == 0)
|
if (Status == 0)
|
||||||
{
|
{
|
||||||
|
//if (App.CurrentFaUserList.Role != null)
|
||||||
|
//{
|
||||||
|
// //查看当前用户是否有所在药品抽屉的权限
|
||||||
|
// bool bLessEight = ChannelStocks.Select(it => it.DrawerNo).Where(n => n <= 8).Any();
|
||||||
|
// bool bMoreEight = ChannelStocks.Select(it => it.DrawerNo).Where(n => n > 8 && n < 17).Any();
|
||||||
|
// bool bEqualEight = ChannelStocks.Select(it => it.DrawerNo).Where(n => n == 17).Any();
|
||||||
|
// if (bLessEight)
|
||||||
|
// {
|
||||||
|
// if (App.CurrentFaUserList.Role.FirstEightChecked == "0")
|
||||||
|
// {
|
||||||
|
// AlertMsg alertMsg = new AlertMsg
|
||||||
|
// {
|
||||||
|
// Message = "当前用户没有打开抽屉的权限!",
|
||||||
|
// Type = MsgType.ERROR,
|
||||||
|
// };
|
||||||
|
// _eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// if (bMoreEight)
|
||||||
|
// {
|
||||||
|
// if (App.CurrentFaUserList.Role.LastEightChecked == "0")
|
||||||
|
// {
|
||||||
|
// AlertMsg alertMsg = new AlertMsg
|
||||||
|
// {
|
||||||
|
// Message = "当前用户没有打开抽屉的权限!",
|
||||||
|
// Type = MsgType.ERROR,
|
||||||
|
// };
|
||||||
|
// _eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// if (bEqualEight)
|
||||||
|
// {
|
||||||
|
// if (App.CurrentFaUserList.Role.StorageBoxChecked == "0")
|
||||||
|
// {
|
||||||
|
// AlertMsg alertMsg = new AlertMsg
|
||||||
|
// {
|
||||||
|
// Message = "当前用户没有打开抽屉的权限!",
|
||||||
|
// Type = MsgType.ERROR,
|
||||||
|
// };
|
||||||
|
// _eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
//}
|
||||||
enumerator.MoveNext();
|
enumerator.MoveNext();
|
||||||
Status = 1;
|
Status = 1;
|
||||||
OpenOneByOne();
|
OpenOneByOne();
|
||||||
|
@ -193,7 +266,13 @@ namespace DM_Weight.ViewModels
|
||||||
_portUtil.SpeakAsync("正在打开" + DrawerNo + "号抽屉");
|
_portUtil.SpeakAsync("正在打开" + DrawerNo + "号抽屉");
|
||||||
|
|
||||||
|
|
||||||
List<ChannelStock> singleChannels = channelStocks
|
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 {
|
.GroupBy(it => new {
|
||||||
it.DrawerNo, it.ColNo
|
it.DrawerNo, it.ColNo
|
||||||
})
|
})
|
||||||
|
@ -296,7 +375,7 @@ namespace DM_Weight.ViewModels
|
||||||
Reviewer = HomeWindowViewModel.Reviewer?.Id,
|
Reviewer = HomeWindowViewModel.Reviewer?.Id,
|
||||||
OperationTime = DateTime.Now,
|
OperationTime = DateTime.Now,
|
||||||
Quantity = it.AddQuantity,
|
Quantity = it.AddQuantity,
|
||||||
Type = 1,
|
Type = SelectedItemUseFor.UseId == 0 ? 1 : SelectedItemUseFor.UseId,
|
||||||
InvoiceId = InvoiceId,
|
InvoiceId = InvoiceId,
|
||||||
StockQuantity = nowChannels.Sum(it => it.Quantity),
|
StockQuantity = nowChannels.Sum(it => it.Quantity),
|
||||||
ManunoQuantity = nowChannels.FindAll(it2 => it2.ManuNo == it.ManuNo).Sum(it => it.Quantity),
|
ManunoQuantity = nowChannels.FindAll(it2 => it2.ManuNo == it.ManuNo).Sum(it => it.Quantity),
|
||||||
|
@ -341,7 +420,8 @@ namespace DM_Weight.ViewModels
|
||||||
.Where(cs => cs.ColNo == singleChannels[i].ColNo)
|
.Where(cs => cs.ColNo == singleChannels[i].ColNo)
|
||||||
.Sum(it => it.Quantity);
|
.Sum(it => it.Quantity);
|
||||||
//将库位多批次的总库存数更新标签
|
//将库位多批次的总库存数更新标签
|
||||||
_portUtil.WriteQuantity(singleChannels[i].DrawerNo, singleChannels[i].ColNo, totalQuantity);
|
_portUtil.WriteQuantity(singleChannels[i].DrawerNo, singleChannels[i].ColNo, totalQuantity);
|
||||||
|
Thread.Sleep(200);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -211,7 +211,10 @@ namespace DM_Weight.ViewModels
|
||||||
// .ToList();
|
// .ToList();
|
||||||
//ChannelStocks = queryData;
|
//ChannelStocks = queryData;
|
||||||
List<DrugInfo> q = SqlSugarHelper.Db.Queryable<DrugInfo>()
|
List<DrugInfo> q = SqlSugarHelper.Db.Queryable<DrugInfo>()
|
||||||
.Includes<ChannelStock>(di => di.channelStocks.Where(cs => cs.DrawerType == 1).Where(cs => cs.MachineId.Equals(ConfigurationManager.AppSettings["machineId"] ?? "DM1") && cs.DrugId != null).OrderBy(cs => cs.DrawerNo).OrderBy(cs => cs.ColNo).ToList())
|
.Includes<ChannelStock>(di => di.channelStocks.Where(cs => cs.DrawerType == 1)
|
||||||
|
.WhereIF(App.SingleModel, cs => cs.DrawerNo <= 2) //单人登录开前8个抽屉,双人登录开后8个抽屉
|
||||||
|
.WhereIF(!(App.SingleModel), cs => cs.DrawerNo > 2)
|
||||||
|
.Where(cs => cs.MachineId.Equals(ConfigurationManager.AppSettings["machineId"] ?? "DM1") && cs.DrugId != null).OrderBy(cs => cs.DrawerNo).OrderBy(cs => cs.ColNo).ToList())
|
||||||
.WhereIF(!String.IsNullOrEmpty(SearchValue) && SelectedItem.Code.Equals("DrugId"), (cs) => cs.DrugId.Contains(SearchValue))
|
.WhereIF(!String.IsNullOrEmpty(SearchValue) && SelectedItem.Code.Equals("DrugId"), (cs) => cs.DrugId.Contains(SearchValue))
|
||||||
.WhereIF(!String.IsNullOrEmpty(SearchValue) && SelectedItem.Code.Equals("DrugName"), (cs) => cs.DrugName.Contains(SearchValue))
|
.WhereIF(!String.IsNullOrEmpty(SearchValue) && SelectedItem.Code.Equals("DrugName"), (cs) => cs.DrugName.Contains(SearchValue))
|
||||||
.WhereIF(!String.IsNullOrEmpty(SearchValue) && SelectedItem.Code.Equals("PyCode"), (cs) => cs.PyCode.Contains(SearchValue))
|
.WhereIF(!String.IsNullOrEmpty(SearchValue) && SelectedItem.Code.Equals("PyCode"), (cs) => cs.PyCode.Contains(SearchValue))
|
||||||
|
|
|
@ -23,7 +23,34 @@ namespace DM_Weight.ViewModels
|
||||||
{
|
{
|
||||||
public class SelfTakeDialogViewModel : BindableBase, IDialogAware, IRegionMemberLifetime
|
public class SelfTakeDialogViewModel : BindableBase, IDialogAware, IRegionMemberLifetime
|
||||||
{
|
{
|
||||||
|
public static List<UseFor> SelectUseList = new()
|
||||||
|
{
|
||||||
|
|
||||||
|
new UseFor { UseId = 96, UseName = "不入账册" },
|
||||||
|
new UseFor{UseId=0,UseName="入账册"}
|
||||||
|
};
|
||||||
|
private List<UseFor> _selects = SelectUseList;
|
||||||
|
|
||||||
|
public List<UseFor> Selects
|
||||||
|
{
|
||||||
|
get { return _selects; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
SetProperty(ref _selects, value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private UseFor _selectedItem = SelectUseList[0];
|
||||||
|
/// <summary>
|
||||||
|
/// 取药或加药用途字段
|
||||||
|
/// </summary>
|
||||||
|
public UseFor SelectedItem
|
||||||
|
{
|
||||||
|
get { return _selectedItem; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
SetProperty(ref _selectedItem, value);
|
||||||
|
}
|
||||||
|
}
|
||||||
private readonly ILog logger = LogManager.GetLogger(typeof(SelfTakeDialogViewModel));
|
private readonly ILog logger = LogManager.GetLogger(typeof(SelfTakeDialogViewModel));
|
||||||
public string Title => "自选取药";
|
public string Title => "自选取药";
|
||||||
|
|
||||||
|
@ -168,6 +195,53 @@ namespace DM_Weight.ViewModels
|
||||||
{
|
{
|
||||||
if (Status == 0)
|
if (Status == 0)
|
||||||
{
|
{
|
||||||
|
//if (App.CurrentFaUserList.Role != null)
|
||||||
|
//{
|
||||||
|
// //查看当前用户是否有所在药品抽屉的权限
|
||||||
|
// bool bLessEight = ChannelStocks.Select(it => it.DrawerNo).Where(n => n <= 8).Any();
|
||||||
|
// bool bMoreEight = ChannelStocks.Select(it => it.DrawerNo).Where(n => n > 8 && n < 17).Any();
|
||||||
|
// bool bEqualEight = ChannelStocks.Select(it => it.DrawerNo).Where(n => n == 17).Any();
|
||||||
|
// if (bLessEight)
|
||||||
|
// {
|
||||||
|
// if (App.CurrentFaUserList.Role.FirstEightChecked == "0")
|
||||||
|
// {
|
||||||
|
// AlertMsg alertMsg = new AlertMsg
|
||||||
|
// {
|
||||||
|
// Message = "当前用户没有打开抽屉的权限!",
|
||||||
|
// Type = MsgType.ERROR,
|
||||||
|
// };
|
||||||
|
// _eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// if (bMoreEight)
|
||||||
|
// {
|
||||||
|
// if (App.CurrentFaUserList.Role.LastEightChecked == "0")
|
||||||
|
// {
|
||||||
|
// AlertMsg alertMsg = new AlertMsg
|
||||||
|
// {
|
||||||
|
// Message = "当前用户没有打开抽屉的权限!",
|
||||||
|
// Type = MsgType.ERROR,
|
||||||
|
// };
|
||||||
|
// _eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// if (bEqualEight)
|
||||||
|
// {
|
||||||
|
// if (App.CurrentFaUserList.Role.StorageBoxChecked == "0")
|
||||||
|
// {
|
||||||
|
// AlertMsg alertMsg = new AlertMsg
|
||||||
|
// {
|
||||||
|
// Message = "当前用户没有打开抽屉的权限!",
|
||||||
|
// Type = MsgType.ERROR,
|
||||||
|
// };
|
||||||
|
// _eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
//}
|
||||||
enumerator.MoveNext();
|
enumerator.MoveNext();
|
||||||
Status = 1;
|
Status = 1;
|
||||||
OpenOneByOne();
|
OpenOneByOne();
|
||||||
|
@ -185,7 +259,13 @@ namespace DM_Weight.ViewModels
|
||||||
_portUtil.SpeakAsync("正在打开" + DrawerNo + "号抽屉");
|
_portUtil.SpeakAsync("正在打开" + DrawerNo + "号抽屉");
|
||||||
|
|
||||||
|
|
||||||
List<ChannelStock> singleChannels = channelStocks
|
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 })
|
.GroupBy(it => new { it.DrawerNo, it.ColNo })
|
||||||
.Select(it =>
|
.Select(it =>
|
||||||
{
|
{
|
||||||
|
@ -255,12 +335,13 @@ namespace DM_Weight.ViewModels
|
||||||
OperationTime = DateTime.Now,
|
OperationTime = DateTime.Now,
|
||||||
Quantity = it.TakeQuantity,
|
Quantity = it.TakeQuantity,
|
||||||
Reviewer = HomeWindowViewModel.Reviewer?.Id,
|
Reviewer = HomeWindowViewModel.Reviewer?.Id,
|
||||||
Type = 2,
|
Type = SelectedItem.UseId == 0 ? 2 : SelectedItem.UseId,
|
||||||
InvoiceId = InvoiceId,
|
InvoiceId = InvoiceId,
|
||||||
StockQuantity = nowChannels.Sum(it => it.Quantity),
|
StockQuantity = nowChannels.Sum(it => it.Quantity),
|
||||||
ManunoQuantity = nowChannels.FindAll(it2 => it2.ManuNo == it.ManuNo).Sum(it => it.Quantity),
|
ManunoQuantity = nowChannels.FindAll(it2 => it2.ManuNo == it.ManuNo).Sum(it => it.Quantity),
|
||||||
SupplierDept = ConfigurationManager.AppSettings["supplierDept"].ToString(),
|
SupplierDept = ConfigurationManager.AppSettings["supplierDept"].ToString(),
|
||||||
ReceiveDept = ConfigurationManager.AppSettings["receiveDept"].ToString()
|
ReceiveDept = ConfigurationManager.AppSettings["receiveDept"].ToString(),
|
||||||
|
Status= SelectedItem.UseId==0?0:2 //不入账册(96)取药后不还空瓶
|
||||||
}).ExecuteCommand();
|
}).ExecuteCommand();
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
@ -294,13 +375,31 @@ namespace DM_Weight.ViewModels
|
||||||
{
|
{
|
||||||
if (singleChannels[i].BoardType == 5)
|
if (singleChannels[i].BoardType == 5)
|
||||||
{
|
{
|
||||||
int totalQuantity = SqlSugarHelper.Db.Queryable<ChannelStock>()
|
List<ChannelStock> csList = SqlSugarHelper.Db.Queryable<ChannelStock>()
|
||||||
.Where(cs => cs.MachineId == singleChannels[i].MachineId)
|
.Where(cs => cs.MachineId == singleChannels[i].MachineId)
|
||||||
.Where(cs => cs.DrawerNo == singleChannels[i].DrawerNo)
|
.Where(cs => cs.DrawerNo == singleChannels[i].DrawerNo)
|
||||||
.Where(cs => cs.ColNo == singleChannels[i].ColNo)
|
.Where(cs => cs.ColNo == singleChannels[i].ColNo && cs.Quantity > 0).OrderBy(cs => cs.EffDate).ToList();
|
||||||
.Sum(it => it.Quantity);
|
|
||||||
//将库位多批次的总库存数更新标签
|
if (csList != null && csList.Count > 0)
|
||||||
_portUtil.WriteQuantity(singleChannels[i].DrawerNo, singleChannels[i].ColNo, totalQuantity);
|
{
|
||||||
|
int totalQuantity = csList.Sum(c => c.Quantity);
|
||||||
|
|
||||||
|
_portUtil.WriteChannelInfo(5, csList[0].EffDate == null ? "" : csList[0].EffDate, csList[0].DrawerNo, csList[0].ColNo);
|
||||||
|
Thread.Sleep(200);
|
||||||
|
_portUtil.WriteChannelInfo(6, csList[0].ManuNo == null ? "" : csList[0].ManuNo, csList[0].DrawerNo, csList[0].ColNo);
|
||||||
|
Thread.Sleep(200);
|
||||||
|
_portUtil.ShowContent(csList[0].DrawerNo, csList[0].ColNo);
|
||||||
|
Thread.Sleep(200);
|
||||||
|
//将库位多批次的总库存数更新标签
|
||||||
|
_portUtil.WriteQuantity(csList[i].DrawerNo, csList[i].ColNo, totalQuantity);
|
||||||
|
Thread.Sleep(200);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//库位库存为0
|
||||||
|
_portUtil.WriteQuantity(singleChannels[i].DrawerNo, singleChannels[i].ColNo, 0);
|
||||||
|
Thread.Sleep(200);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -197,6 +197,8 @@ namespace DM_Weight.ViewModels
|
||||||
//ChannelStocks = queryData;
|
//ChannelStocks = queryData;
|
||||||
List<DrugInfo> q = SqlSugarHelper.Db.Queryable<DrugInfo>()
|
List<DrugInfo> q = SqlSugarHelper.Db.Queryable<DrugInfo>()
|
||||||
.Includes<ChannelStock>(di => di.channelStocks.Where(cs => cs.DrawerType == 1)
|
.Includes<ChannelStock>(di => di.channelStocks.Where(cs => cs.DrawerType == 1)
|
||||||
|
.WhereIF(App.SingleModel, cs => cs.DrawerNo <= 2 ) //单人登录开前8个抽屉,双人登录开后8个抽屉
|
||||||
|
.WhereIF(!(App.SingleModel), cs => cs.DrawerNo > 2 )
|
||||||
.Where(cs => cs.MachineId.Equals(ConfigurationManager.AppSettings["machineId"] ?? "DM1") && cs.DrugId != null&&cs.Quantity>0).OrderBy(cs => cs.DrawerNo).OrderBy(cs => cs.ColNo).ToList())
|
.Where(cs => cs.MachineId.Equals(ConfigurationManager.AppSettings["machineId"] ?? "DM1") && cs.DrugId != null&&cs.Quantity>0).OrderBy(cs => cs.DrawerNo).OrderBy(cs => cs.ColNo).ToList())
|
||||||
.WhereIF(!String.IsNullOrEmpty(SearchValue) && SelectedItem.Code.Equals("DrugId"), (cs) => cs.DrugId.Contains(SearchValue))
|
.WhereIF(!String.IsNullOrEmpty(SearchValue) && SelectedItem.Code.Equals("DrugId"), (cs) => cs.DrugId.Contains(SearchValue))
|
||||||
.WhereIF(!String.IsNullOrEmpty(SearchValue) && SelectedItem.Code.Equals("DrugName"), (cs) => cs.DrugName.Contains(SearchValue))
|
.WhereIF(!String.IsNullOrEmpty(SearchValue) && SelectedItem.Code.Equals("DrugName"), (cs) => cs.DrugName.Contains(SearchValue))
|
||||||
|
|
|
@ -0,0 +1,300 @@
|
||||||
|
using DM_Weight.Models;
|
||||||
|
using DM_Weight.msg;
|
||||||
|
using DM_Weight.Report;
|
||||||
|
using DM_Weight.Services;
|
||||||
|
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;
|
||||||
|
|
||||||
|
namespace DM_Weight.ViewModels
|
||||||
|
{
|
||||||
|
internal class SpecialAccountWindowViewModel : BindableBase, INavigationAware, IRegionMemberLifetime
|
||||||
|
{
|
||||||
|
public static SpecialAccountWindowViewModel vm;
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private static readonly DateTime Jan1st1970 = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);
|
||||||
|
/// <summary>
|
||||||
|
/// 账册
|
||||||
|
/// </summary>
|
||||||
|
private List<AccountModel> _accountList = new();
|
||||||
|
|
||||||
|
public List<AccountModel> 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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
MachineRecordService _machineRecordService;
|
||||||
|
ChannelStockService _channelStockService;
|
||||||
|
IEventAggregator _eventAggregator;
|
||||||
|
public SpecialAccountWindowViewModel(MachineRecordService machineRecord, ChannelStockService channelStockService, IEventAggregator eventAggregator)
|
||||||
|
{
|
||||||
|
_machineRecordService = machineRecord;
|
||||||
|
_channelStockService = channelStockService;
|
||||||
|
_eventAggregator = eventAggregator;
|
||||||
|
vm = this;
|
||||||
|
}
|
||||||
|
private void GetAllDrugInfos()
|
||||||
|
{
|
||||||
|
var list = SqlSugarHelper.Db.Queryable<DrugInfo>().Includes<DrugManuNo>(di => di.DrugManuNos).OrderBy(di => di.DrugId).ToList();
|
||||||
|
DrugInfos = list;
|
||||||
|
DrugInfo = list[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 生成日结存
|
||||||
|
/// </summary>
|
||||||
|
public DelegateCommand DayAccountBook
|
||||||
|
{
|
||||||
|
get => new DelegateCommand(() =>
|
||||||
|
{
|
||||||
|
DayAccountAction();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
//生成一条当日没有记录的账册记录
|
||||||
|
private void DayAccountAction()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
string machineId = ConfigurationManager.AppSettings["machineId"] ?? "DM1";
|
||||||
|
//根据已生成的日结存记录
|
||||||
|
int deleteNum = SqlSugarHelper.Db.Deleteable<MachineRecord>()
|
||||||
|
.Where(cs => cs.Type.Equals(5) && cs.OperationTime.ToString("yyyy-MM-dd") == DateTime.Now.ToString("yyyy-MM-dd") && cs.MachineId.Equals(machineId)).ExecuteCommand();
|
||||||
|
int inQuantity = 0; //当日入库量
|
||||||
|
int outQuantity = 0; //当日出库量
|
||||||
|
//查询账册中所有记录,与库存中的记录做比校,如果账册中没有,则添加一条,有则添加一条总日结存
|
||||||
|
List<AccountModel> accountList = _machineRecordService.ReportAccountBook(nowDate, null, 0);
|
||||||
|
//库存中的记录
|
||||||
|
List<ChannelStockCount> channelStockList = _channelStockService.GetAll();
|
||||||
|
//List<ChannelStock> channelStockInsert = new List<ChannelStock>();
|
||||||
|
if (accountList != null && accountList.Count() > 0)
|
||||||
|
{
|
||||||
|
//账册中有记录则与库存记录对比
|
||||||
|
|
||||||
|
for (int i = 0; i < channelStockList.Count; i++)
|
||||||
|
{
|
||||||
|
string drugId = channelStockList[i].DrugId;
|
||||||
|
string manuNo = channelStockList[i].ManuNo;
|
||||||
|
int quantity = channelStockList[i].Quantity;
|
||||||
|
int Count = accountList.Where(cs => cs.DrugId == drugId && cs.ManuNo == manuNo).Count();
|
||||||
|
|
||||||
|
if (Count <= 0)
|
||||||
|
{
|
||||||
|
inQuantity = 0;
|
||||||
|
outQuantity = 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
inQuantity = accountList.Where(cs => cs.DrugId == drugId && cs.ManuNo == manuNo).Sum(cs => cs.InQuantity);
|
||||||
|
outQuantity = accountList.Where(cs => cs.DrugId == drugId && cs.ManuNo == manuNo).Sum(cs => cs.OutQuantity);
|
||||||
|
}
|
||||||
|
// 获取药品总库存
|
||||||
|
int channelStockQuantity = SqlSugarHelper.Db.Queryable<ChannelStock>()
|
||||||
|
.Where(cs => cs.DrugId.Equals(drugId)).Sum(it => it.Quantity);
|
||||||
|
//没有直接插入
|
||||||
|
// 保存数据 出/入库记录
|
||||||
|
string InvoiceId = "Account_" + CurrentTimeMillis();
|
||||||
|
SqlSugarHelper.Db.Insertable(new MachineRecord()
|
||||||
|
{
|
||||||
|
MachineId = channelStockList[i].MachineId,
|
||||||
|
DrawerNo = 0,//channelStockList[i].DrawerNo,
|
||||||
|
ColNo = 0,// channelStockList[i].ColNo,FV
|
||||||
|
DrugId = drugId,
|
||||||
|
ManuNo = manuNo,
|
||||||
|
EffDate = null,// !String.IsNullOrEmpty(channelStockList[i].EffDate) ? DateTime.ParseExact(channelStockList[i].EffDate, "yyyy-MM-dd", System.Globalization.CultureInfo.CurrentCulture) : null,
|
||||||
|
Operator = HomeWindowViewModel.Operator?.Id,
|
||||||
|
Reviewer = HomeWindowViewModel.Reviewer?.Id,
|
||||||
|
OperationTime = DateTime.Now,
|
||||||
|
Quantity = 0,
|
||||||
|
Type = 5,
|
||||||
|
InvoiceId = "日结存",//InvoiceId,
|
||||||
|
ReturnQuantity1 = inQuantity, //当日入库量总数
|
||||||
|
ReturnQuantity2 = outQuantity, //当日出库量总数
|
||||||
|
StockQuantity = channelStockQuantity,
|
||||||
|
ManunoQuantity = quantity,
|
||||||
|
SupplierDept = string.Empty,// ConfigurationManager.AppSettings["supplierDept"].ToString(),
|
||||||
|
ReceiveDept = string.Empty,//ConfigurationManager.AppSettings["receiveDept"].ToString()
|
||||||
|
}).ExecuteCommand();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
for (int i = 0; i < channelStockList.Count; i++)
|
||||||
|
{
|
||||||
|
//账册中没有记录则把库存中的所有数据都要生成一条账册记录
|
||||||
|
// 保存数据 出/入库记录
|
||||||
|
// 获取药品总库存
|
||||||
|
string drugId = channelStockList[i].DrugId;
|
||||||
|
string manuNo = channelStockList[i].ManuNo;
|
||||||
|
int quantity = channelStockList[i].Quantity;
|
||||||
|
int channelStockQuantity = SqlSugarHelper.Db.Queryable<ChannelStock>()
|
||||||
|
.Where(cs => cs.DrugId.Equals(drugId)).Sum(it => it.Quantity);
|
||||||
|
|
||||||
|
|
||||||
|
string InvoiceId = "Account_" + CurrentTimeMillis();
|
||||||
|
SqlSugarHelper.Db.Insertable(new MachineRecord()
|
||||||
|
{
|
||||||
|
MachineId = channelStockList[i].MachineId,
|
||||||
|
DrawerNo = 0,//channelStockList[i].DrawerNo,
|
||||||
|
ColNo = 0,//channelStockList[i].ColNo,
|
||||||
|
DrugId = drugId,
|
||||||
|
ManuNo = manuNo,// channelStockList[i].ManuNo,
|
||||||
|
EffDate = null,// !String.IsNullOrEmpty(channelStockList[i].EffDate) ? DateTime.ParseExact(channelStockList[i].EffDate, "yyyy-MM-dd", System.Globalization.CultureInfo.CurrentCulture) : null,
|
||||||
|
Operator = HomeWindowViewModel.Operator?.Id,
|
||||||
|
Reviewer = HomeWindowViewModel.Reviewer?.Id,
|
||||||
|
OperationTime = DateTime.Now,
|
||||||
|
Quantity = 0,
|
||||||
|
Type = 5,
|
||||||
|
InvoiceId = "日结存",// string.Empty,//InvoiceId,
|
||||||
|
ReturnQuantity1 = inQuantity, //当日入库量总数
|
||||||
|
ReturnQuantity2 = outQuantity, //当日出库量总数
|
||||||
|
StockQuantity = channelStockQuantity,
|
||||||
|
ManunoQuantity = quantity,
|
||||||
|
SupplierDept = string.Empty,//ConfigurationManager.AppSettings["supplierDept"].ToString(),
|
||||||
|
ReceiveDept = string.Empty,//ConfigurationManager.AppSettings["receiveDept"].ToString()
|
||||||
|
}).ExecuteCommand();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
AlertMsg alertMsg = new AlertMsg
|
||||||
|
{
|
||||||
|
Message = "日结存已生成完成",
|
||||||
|
Type = MsgType.SUCCESS,
|
||||||
|
};
|
||||||
|
_eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
AlertMsg alertMsg = new AlertMsg
|
||||||
|
{
|
||||||
|
Message = "生成日结存失败",
|
||||||
|
Type = MsgType.ERROR,
|
||||||
|
};
|
||||||
|
_eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public long CurrentTimeMillis()
|
||||||
|
{
|
||||||
|
return (long)(DateTime.UtcNow - Jan1st1970).TotalMilliseconds;
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 导出账册
|
||||||
|
/// </summary>
|
||||||
|
public DelegateCommand DownloadAccountBook
|
||||||
|
{
|
||||||
|
get => new DelegateCommand(() =>
|
||||||
|
{
|
||||||
|
GridReportUtil.PrintReportSpecialAccount(EndDate ?? DateTime.Now, DrugInfo == null ? "" : DrugInfo.DrugId);
|
||||||
|
|
||||||
|
});
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 导出账册2
|
||||||
|
/// </summary>
|
||||||
|
public DelegateCommand DownloadAccountBook2
|
||||||
|
{
|
||||||
|
get => new DelegateCommand(() =>
|
||||||
|
{
|
||||||
|
GridReportUtil.PrintReportSpecialAccount2New(EndDate ?? DateTime.Now, DrugInfo == null ? "" : DrugInfo.DrugId);
|
||||||
|
|
||||||
|
});
|
||||||
|
}
|
||||||
|
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();
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool IsNavigationTarget(NavigationContext navigationContext)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void OnNavigatedFrom(NavigationContext navigationContext)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -243,12 +243,15 @@ namespace DM_Weight.ViewModels
|
||||||
|
|
||||||
List<DrugInfo> q = SqlSugarHelper.Db.Queryable<DrugInfo>()
|
List<DrugInfo> q = SqlSugarHelper.Db.Queryable<DrugInfo>()
|
||||||
.Includes<ChannelStock>(di => di.channelStocks.Where(cs => cs.DrawerType == 1)
|
.Includes<ChannelStock>(di => di.channelStocks.Where(cs => cs.DrawerType == 1)
|
||||||
.Where(cs => cs.MachineId.Equals(ConfigurationManager.AppSettings["machineId"] ?? "DM1") && cs.DrugId != null).OrderBy(cs => cs.DrawerNo).OrderBy(cs => cs.ColNo).ToList())
|
.WhereIF(App.SingleModel, cs => cs.DrawerNo <= 2) //单人登录开前8个抽屉,双人登录开后8个抽屉
|
||||||
.WhereIF(!String.IsNullOrEmpty(SearchValue) && SelectedItem.Code.Equals("DrugId"), (cs) => cs.DrugId.Contains(SearchValue))
|
.WhereIF(!(App.SingleModel), cs => cs.DrawerNo > 2)
|
||||||
|
.Where(cs => cs.MachineId.Equals(ConfigurationManager.AppSettings["machineId"] ?? "DM1") && cs.DrugId != null).OrderBy(cs => cs.DrawerNo).OrderBy(cs => cs.ColNo).ToList())
|
||||||
|
.WhereIF(!String.IsNullOrEmpty(SearchValue) && SelectedItem.Code.Equals("DrugId"), (cs) => cs.DrugId.Contains(SearchValue))
|
||||||
.WhereIF(!String.IsNullOrEmpty(SearchValue) && SelectedItem.Code.Equals("DrugName"), (cs) => cs.DrugName.Contains(SearchValue))
|
.WhereIF(!String.IsNullOrEmpty(SearchValue) && SelectedItem.Code.Equals("DrugName"), (cs) => cs.DrugName.Contains(SearchValue))
|
||||||
.WhereIF(!String.IsNullOrEmpty(SearchValue) && SelectedItem.Code.Equals("PyCode"), (cs) => cs.PyCode.Contains(SearchValue))
|
.WhereIF(!String.IsNullOrEmpty(SearchValue) && SelectedItem.Code.Equals("PyCode"), (cs) => cs.PyCode.Contains(SearchValue))
|
||||||
.WhereIF(!String.IsNullOrEmpty(SearchValue) && SelectedItem.Code.Equals("DrugBarcode"), (cs) => cs.DrugBarcode.Contains(SearchValue))
|
.WhereIF(!String.IsNullOrEmpty(SearchValue) && SelectedItem.Code.Equals("DrugBarcode"), (cs) => cs.DrugBarcode.Contains(SearchValue))
|
||||||
.Where(di => di.channelStocks.Any(cs => cs.MachineId.Equals(ConfigurationManager.AppSettings["machineId"] ?? "DM1") && cs.DrugId != null))
|
.WhereIF(App.SingleModel, di => di.channelStocks.Any(cs => cs.MachineId.Equals(ConfigurationManager.AppSettings["machineId"] ?? "DM1") && cs.DrugId != null&&cs.DrawerNo <= 8&& cs.DrawerType == 1))
|
||||||
|
.WhereIF(!(App.SingleModel), di => di.channelStocks.Any(cs => cs.MachineId.Equals(ConfigurationManager.AppSettings["machineId"] ?? "DM1") && cs.DrugId != null&&cs.DrawerNo > 8&& cs.DrawerType == 1))
|
||||||
.OrderBy(cs => cs.DrugId)
|
.OrderBy(cs => cs.DrugId)
|
||||||
.ToList();
|
.ToList();
|
||||||
Drugs = q;
|
Drugs = q;
|
||||||
|
|
|
@ -80,14 +80,14 @@
|
||||||
</Style.Triggers>
|
</Style.Triggers>
|
||||||
</Style>
|
</Style>
|
||||||
</Grid.Resources>
|
</Grid.Resources>
|
||||||
<Button Grid.Row="0" Width="210" Content="1" Command="{Binding UpdateDrawerNo}" CommandParameter="1" />
|
<Button Grid.Row="0" Width="210" Content="1" Command="{Binding UpdateDrawerNo}" IsEnabled="{Binding Is8Drawer}" CommandParameter="1" />
|
||||||
<Button Grid.Row="1" Width="210" Content="2" Command="{Binding UpdateDrawerNo}" CommandParameter="2" />
|
<Button Grid.Row="1" Width="210" Content="2" Command="{Binding UpdateDrawerNo}" IsEnabled="{Binding Is8Drawer}" CommandParameter="2" />
|
||||||
<Button Grid.Row="2" Width="210" Content="3" Command="{Binding UpdateDrawerNo}" CommandParameter="3" />
|
<Button Grid.Row="2" Width="210" Content="3" Command="{Binding UpdateDrawerNo}" IsEnabled="{Binding Is16Drawer}" CommandParameter="3" />
|
||||||
<Button Grid.Row="3" Width="210" Content="4" Command="{Binding UpdateDrawerNo}" CommandParameter="4" />
|
<Button Grid.Row="3" Width="210" Content="4" Command="{Binding UpdateDrawerNo}" IsEnabled="{Binding Is16Drawer}" CommandParameter="4" />
|
||||||
<Button Grid.Row="4" Width="210" Content="5" Command="{Binding UpdateDrawerNo}" CommandParameter="5" />
|
<Button Grid.Row="4" Width="210" Content="5" Command="{Binding UpdateDrawerNo}" IsEnabled="{Binding Is16Drawer}" CommandParameter="5" />
|
||||||
<Button Grid.Row="5" Width="210" Content="6" Command="{Binding UpdateDrawerNo}" CommandParameter="6" />
|
<Button Grid.Row="5" Width="210" Content="6" Command="{Binding UpdateDrawerNo}" IsEnabled="{Binding Is16Drawer}" CommandParameter="6" />
|
||||||
<Button Grid.Row="6" Width="210" Content="7" Command="{Binding UpdateDrawerNo}" CommandParameter="7" />
|
<Button Grid.Row="6" Width="210" Content="7" Command="{Binding UpdateDrawerNo}" IsEnabled="{Binding Is16Drawer}" CommandParameter="7" />
|
||||||
<Button Grid.Row="7" Width="210" Content="8" Command="{Binding UpdateDrawerNo}" CommandParameter="8" />
|
<Button Grid.Row="7" Width="210" Content="8" Command="{Binding UpdateDrawerNo}" IsEnabled="{Binding Is16Drawer}" CommandParameter="8" />
|
||||||
|
|
||||||
</Grid>
|
</Grid>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
@ -141,23 +141,22 @@
|
||||||
<ColumnDefinition />
|
<ColumnDefinition />
|
||||||
</Grid.ColumnDefinitions>
|
</Grid.ColumnDefinitions>
|
||||||
|
|
||||||
<Button Grid.Row="0" Grid.Column="0" Width="120" Content="1" Command="{Binding UpdateDrawerNo}" CommandParameter="1" />
|
<Button Grid.Row="0" Grid.Column="0" Width="120" Content="1" Command="{Binding UpdateDrawerNo}" IsEnabled="{Binding Is8Drawer}" CommandParameter="1" />
|
||||||
<Button Grid.Row="1" Grid.Column="0" Width="120" Content="2" Command="{Binding UpdateDrawerNo}" CommandParameter="2" />
|
<Button Grid.Row="1" Grid.Column="0" Width="120" Content="2" Command="{Binding UpdateDrawerNo}" IsEnabled="{Binding Is8Drawer}" CommandParameter="2" />
|
||||||
<Button Grid.Row="2" Grid.Column="0" Width="120" Content="3" Command="{Binding UpdateDrawerNo}" CommandParameter="3" />
|
<Button Grid.Row="2" Grid.Column="0" Width="120" Content="3" Command="{Binding UpdateDrawerNo}" IsEnabled="{Binding Is16Drawer}" CommandParameter="3" />
|
||||||
<Button Grid.Row="3" Grid.Column="0" Width="120" Content="4" Command="{Binding UpdateDrawerNo}" CommandParameter="4" />
|
<Button Grid.Row="3" Grid.Column="0" Width="120" Content="4" Command="{Binding UpdateDrawerNo}" IsEnabled="{Binding Is16Drawer}" CommandParameter="4" />
|
||||||
<Button Grid.Row="4" Grid.Column="0" Width="120" Content="5" Command="{Binding UpdateDrawerNo}" CommandParameter="5" />
|
<Button Grid.Row="4" Grid.Column="0" Width="120" Content="5" Command="{Binding UpdateDrawerNo}" IsEnabled="{Binding Is16Drawer}" CommandParameter="5" />
|
||||||
<Button Grid.Row="5" Grid.Column="0" Width="120" Content="6" Command="{Binding UpdateDrawerNo}" CommandParameter="6" />
|
<Button Grid.Row="5" Grid.Column="0" Width="120" Content="6" Command="{Binding UpdateDrawerNo}" IsEnabled="{Binding Is16Drawer}" CommandParameter="6" />
|
||||||
<Button Grid.Row="6" Grid.Column="0" Width="120" Content="7" Command="{Binding UpdateDrawerNo}" CommandParameter="7" />
|
<Button Grid.Row="6" Grid.Column="0" Width="120" Content="7" Command="{Binding UpdateDrawerNo}" IsEnabled="{Binding Is16Drawer}" CommandParameter="7" />
|
||||||
<Button Grid.Row="7" Grid.Column="0" Width="120" Content="8" Command="{Binding UpdateDrawerNo}" CommandParameter="8" />
|
<Button Grid.Row="7" Grid.Column="0" Width="120" Content="8" Command="{Binding UpdateDrawerNo}" IsEnabled="{Binding Is16Drawer}" CommandParameter="8" />
|
||||||
|
<Button Grid.Row="0" Grid.Column="1" Width="120" Content="9" Command="{Binding UpdateDrawerNo}" IsEnabled="{Binding Is16Drawer}" CommandParameter="9" />
|
||||||
<Button Grid.Row="0" Grid.Column="1" Width="120" Content="9" Command="{Binding UpdateDrawerNo}" CommandParameter="9" />
|
<Button Grid.Row="1" Grid.Column="1" Width="120" Content="10" Command="{Binding UpdateDrawerNo}" IsEnabled="{Binding Is16Drawer}" CommandParameter="10" />
|
||||||
<Button Grid.Row="1" Grid.Column="1" Width="120" Content="10" Command="{Binding UpdateDrawerNo}" CommandParameter="10" />
|
<Button Grid.Row="2" Grid.Column="1" Width="120" Content="11" Command="{Binding UpdateDrawerNo}" IsEnabled="{Binding Is16Drawer}" CommandParameter="11" />
|
||||||
<Button Grid.Row="2" Grid.Column="1" Width="120" Content="11" Command="{Binding UpdateDrawerNo}" CommandParameter="11" />
|
<Button Grid.Row="3" Grid.Column="1" Width="120" Content="12" Command="{Binding UpdateDrawerNo}" IsEnabled="{Binding Is16Drawer}" CommandParameter="12" />
|
||||||
<Button Grid.Row="3" Grid.Column="1" Width="120" Content="12" Command="{Binding UpdateDrawerNo}" CommandParameter="12" />
|
<Button Grid.Row="4" Grid.Column="1" Width="120" Content="13" Command="{Binding UpdateDrawerNo}" IsEnabled="{Binding Is16Drawer}" CommandParameter="13" />
|
||||||
<Button Grid.Row="4" Grid.Column="1" Width="120" Content="13" Command="{Binding UpdateDrawerNo}" CommandParameter="13" />
|
<Button Grid.Row="5" Grid.Column="1" Width="120" Content="14" Command="{Binding UpdateDrawerNo}" IsEnabled="{Binding Is16Drawer}" CommandParameter="14" />
|
||||||
<Button Grid.Row="5" Grid.Column="1" Width="120" Content="14" Command="{Binding UpdateDrawerNo}" CommandParameter="14" />
|
<Button Grid.Row="6" Grid.Column="1" Width="120" Content="15" Command="{Binding UpdateDrawerNo}" IsEnabled="{Binding Is16Drawer}" CommandParameter="15" />
|
||||||
<Button Grid.Row="6" Grid.Column="1" Width="120" Content="15" Command="{Binding UpdateDrawerNo}" CommandParameter="15" />
|
<Button Grid.Row="7" Grid.Column="1" Width="120" Content="16" Command="{Binding UpdateDrawerNo}" IsEnabled="{Binding Is16Drawer}" CommandParameter="16" />
|
||||||
<Button Grid.Row="7" Grid.Column="1" Width="120" Content="16" Command="{Binding UpdateDrawerNo}" CommandParameter="16" />
|
|
||||||
|
|
||||||
</Grid>
|
</Grid>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
@ -176,7 +175,14 @@
|
||||||
materialDesign:ButtonProgressAssist.IsIndeterminate="{Binding Status, Converter={StaticResource StatusConverter}, ConverterParameter=opearBtnLoading}"
|
materialDesign:ButtonProgressAssist.IsIndeterminate="{Binding Status, Converter={StaticResource StatusConverter}, ConverterParameter=opearBtnLoading}"
|
||||||
Style="{StaticResource MaterialDesignOutlinedLightButton}"
|
Style="{StaticResource MaterialDesignOutlinedLightButton}"
|
||||||
Content="加药" />
|
Content="加药" />
|
||||||
|
<ComboBox Visibility="{Binding Status, Converter={StaticResource StatusConverter}, ConverterParameter=CompleteBtn}"
|
||||||
|
Grid.Column="0"
|
||||||
|
Margin="0 0 6 0"
|
||||||
|
Style="{StaticResource MaterialDesignOutlinedComboBox}"
|
||||||
|
SelectedItem="{Binding SelectedItem}"
|
||||||
|
DisplayMemberPath="UseName"
|
||||||
|
ItemsSource="{Binding Selects}"
|
||||||
|
/>
|
||||||
<TextBox Text="{Binding PZH, UpdateSourceTrigger=PropertyChanged}" materialDesign:HintAssist.Hint="凭证号"
|
<TextBox Text="{Binding PZH, UpdateSourceTrigger=PropertyChanged}" materialDesign:HintAssist.Hint="凭证号"
|
||||||
materialDesign:HintAssist.IsFloating="True" Width="100"
|
materialDesign:HintAssist.IsFloating="True" Width="100"
|
||||||
Margin="0 0 3 0"
|
Margin="0 0 3 0"
|
||||||
|
@ -187,10 +193,21 @@
|
||||||
Margin="0 0 3 0"
|
Margin="0 0 3 0"
|
||||||
VerticalAlignment="Center"
|
VerticalAlignment="Center"
|
||||||
Command="{Binding TakeFinish}"
|
Command="{Binding TakeFinish}"
|
||||||
|
materialDesign:ButtonProgressAssist.IsIndicatorVisible="{Binding OptionStatus,Converter={StaticResource StatusConverter},ConverterParameter=TakeFinishLoading}"
|
||||||
|
materialDesign:ButtonProgressAssist.IsIndeterminate="{Binding OptionStatus,Converter={StaticResource StatusConverter},ConverterParameter=TakeFinishLoading}"
|
||||||
|
IsEnabled="{Binding OptionStatus,Converter={StaticResource StatusConverter},ConverterParameter=TakeFinishEnable}"
|
||||||
Visibility="{Binding Status, Converter={StaticResource StatusConverter}, ConverterParameter=CompleteBtn}"
|
Visibility="{Binding Status, Converter={StaticResource StatusConverter}, ConverterParameter=CompleteBtn}"
|
||||||
Style="{StaticResource MaterialDesignOutlinedLightButton}"
|
Style="{StaticResource MaterialDesignOutlinedLightButton}"
|
||||||
Content="完成" />
|
Content="{Binding FinishContent}" />
|
||||||
|
<!--<Button
|
||||||
|
Margin="0 0 3 0"
|
||||||
|
VerticalAlignment="Center"
|
||||||
|
Command="{Binding OpenDrawer}"
|
||||||
|
materialDesign:ButtonProgressAssist.IsIndicatorVisible="{Binding Status,Converter={StaticResource BiaoDingStatusConverter},ConverterParameter=BiaoDingLoading}"
|
||||||
|
materialDesign:ButtonProgressAssist.IsIndeterminate="{Binding Status,Converter={StaticResource BiaoDingStatusConverter},ConverterParameter=BiaoDingLoading}"
|
||||||
|
|
||||||
|
IsEnabled="{Binding Status,Converter={StaticResource BiaoDingStatusConverter},ConverterParameter=BiaoDingBtnFlag}" Style="{StaticResource MaterialDesignOutlinedLightButton}"
|
||||||
|
Content="标定" />-->
|
||||||
<Button
|
<Button
|
||||||
Margin="0 0 6 0"
|
Margin="0 0 6 0"
|
||||||
VerticalAlignment="Center"
|
VerticalAlignment="Center"
|
||||||
|
|
|
@ -0,0 +1,88 @@
|
||||||
|
<UserControl x:Class="DM_Weight.Views.BeforeLogin"
|
||||||
|
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"
|
||||||
|
mc:Ignorable="d"
|
||||||
|
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
|
||||||
|
TextElement.Foreground="{DynamicResource MaterialDesignBody}"
|
||||||
|
TextElement.FontWeight="Regular"
|
||||||
|
TextElement.FontSize="13"
|
||||||
|
TextOptions.TextFormattingMode="Ideal"
|
||||||
|
TextOptions.TextRenderingMode="Auto"
|
||||||
|
FontFamily="{DynamicResource MaterialDesignFont}"
|
||||||
|
d:DesignHeight="450" d:DesignWidth="800">
|
||||||
|
<UserControl.Background>
|
||||||
|
<ImageBrush ImageSource="/Images/body-bg.jpg" Stretch="Fill"/>
|
||||||
|
</UserControl.Background>
|
||||||
|
<Grid>
|
||||||
|
<Grid.RowDefinitions >
|
||||||
|
<RowDefinition Height="2*"></RowDefinition>
|
||||||
|
<RowDefinition Height="*"></RowDefinition>
|
||||||
|
<RowDefinition Height="6*"></RowDefinition>
|
||||||
|
<RowDefinition Height="3*"></RowDefinition>
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="3*"/>
|
||||||
|
<ColumnDefinition Width="4*"/>
|
||||||
|
<ColumnDefinition Width="3*"/>
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
|
||||||
|
<materialDesign:Card Margin="16" Grid.Row="2" Grid.Column="1">
|
||||||
|
<Grid>
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="5*"/>
|
||||||
|
<ColumnDefinition Width="5*"/>
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="4*"/>
|
||||||
|
<RowDefinition Height="6*"/>
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
<TextBlock Grid.ColumnSpan="2"
|
||||||
|
HorizontalAlignment="Center"
|
||||||
|
VerticalAlignment="Center"
|
||||||
|
FontSize="28"
|
||||||
|
Foreground="#31ccec"
|
||||||
|
FontWeight="Bold"
|
||||||
|
Text="欢迎登录麻精药品管理系统">
|
||||||
|
</TextBlock>
|
||||||
|
<Grid Grid.Column="0" Grid.Row="1">
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition/>
|
||||||
|
<ColumnDefinition Width="Auto"/>
|
||||||
|
<ColumnDefinition/>
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<Button
|
||||||
|
Grid.Column="1"
|
||||||
|
Style="{StaticResource MaterialDesignRaisedButton}"
|
||||||
|
materialDesign:ButtonAssist.CornerRadius="5"
|
||||||
|
Command="{ Binding DutyCommand }"
|
||||||
|
Background="#42a5f5"
|
||||||
|
BorderBrush="#42a5f5" Cursor="Hand" IsDefault="True" Content="值班柜登录"/>
|
||||||
|
</Grid>
|
||||||
|
<Grid Grid.Column="1" Grid.Row="1">
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition/>
|
||||||
|
<ColumnDefinition Width="Auto"/>
|
||||||
|
<ColumnDefinition/>
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<Button
|
||||||
|
Grid.Column="1"
|
||||||
|
Style="{StaticResource MaterialDesignRaisedLightButton}"
|
||||||
|
Background="#7986cb"
|
||||||
|
BorderBrush="#7986cb"
|
||||||
|
materialDesign:ButtonAssist.CornerRadius="5" Cursor="Hand" IsCancel="true"
|
||||||
|
Command="{ Binding OtherCommand }" >
|
||||||
|
<TextBlock Foreground="{DynamicResource MaterialDesignPaper}" Text="周转柜登录" />
|
||||||
|
</Button>
|
||||||
|
</Grid>
|
||||||
|
</Grid>
|
||||||
|
</materialDesign:Card>
|
||||||
|
<!--<StackPanel Orientation="Vertical" Grid.Row="3" Grid.Column="2">
|
||||||
|
<TextBlock Visibility="{Binding DrawerPortMsg, Converter={StaticResource BooleanToVisibilityConverter}}" Text="抽屉串口连接失败" />
|
||||||
|
<TextBlock Visibility="{Binding CanBusPortMsg, Converter={StaticResource BooleanToVisibilityConverter}}" Text="can总线串口连接失败" />
|
||||||
|
<TextBlock Visibility="{Binding FingerMsg, Converter={StaticResource BooleanToVisibilityConverter}}" Text="指纹机连接失败" />
|
||||||
|
</StackPanel>-->
|
||||||
|
</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>
|
||||||
|
/// BeforeLogin.xaml 的交互逻辑
|
||||||
|
/// </summary>
|
||||||
|
public partial class BeforeLogin : UserControl
|
||||||
|
{
|
||||||
|
public BeforeLogin()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -42,6 +42,13 @@
|
||||||
materialDesign:ButtonProgressAssist.IsIndeterminate="{Binding Status, Converter={StaticResource StatusConverter}, ConverterParameter=opearBtnLoading}"
|
materialDesign:ButtonProgressAssist.IsIndeterminate="{Binding Status, Converter={StaticResource StatusConverter}, ConverterParameter=opearBtnLoading}"
|
||||||
Style="{StaticResource MaterialDesignOutlinedLightButton}"
|
Style="{StaticResource MaterialDesignOutlinedLightButton}"
|
||||||
Content="盘点" />
|
Content="盘点" />
|
||||||
|
<ComboBox Visibility="{Binding Status, Converter={StaticResource StatusConverter}, ConverterParameter=CompleteBtn}"
|
||||||
|
Grid.Column="0"
|
||||||
|
Margin="0 0 6 0"
|
||||||
|
Style="{StaticResource MaterialDesignOutlinedComboBox}"
|
||||||
|
SelectedItem="{Binding SelectedItemUseFor}"
|
||||||
|
DisplayMemberPath="UseName"
|
||||||
|
ItemsSource="{Binding SelectsUseFor}"/>
|
||||||
<Button
|
<Button
|
||||||
Margin="0 0 3 0"
|
Margin="0 0 3 0"
|
||||||
VerticalAlignment="Center"
|
VerticalAlignment="Center"
|
||||||
|
|
|
@ -65,15 +65,25 @@
|
||||||
DisplayMemberPath="DrugName"
|
DisplayMemberPath="DrugName"
|
||||||
/>-->
|
/>-->
|
||||||
<ComboBox
|
<ComboBox
|
||||||
Margin="6 0 6 0"
|
Margin="6 0 6 0"
|
||||||
Grid.Column="0"
|
Grid.Column="0"
|
||||||
materialDesign:HintAssist.Hint="药品名称/拼音码/药品编码"
|
materialDesign:HintAssist.Hint="药品名称/拼音码/药品编码"
|
||||||
ItemsSource="{Binding DrugInfos}"
|
ItemsSource="{Binding DrugInfos}"
|
||||||
SelectedItem="{Binding DrugInfo}"
|
SelectedItem="{Binding DrugInfo}"
|
||||||
DisplayMemberPath="drug_name_spec" IsEditable="True" IsTextSearchEnabled="False" KeyUp="ComboBox_KeyUp"
|
DisplayMemberPath="drug_name_spec" IsEditable="True" IsTextSearchEnabled="False" KeyUp="ComboBox_KeyUp"
|
||||||
/>
|
/>
|
||||||
<StackPanel HorizontalAlignment="Right" Grid.Column="3" Orientation="Horizontal">
|
<StackPanel HorizontalAlignment="Right" Grid.Column="2" Grid.ColumnSpan="2" Orientation="Horizontal">
|
||||||
|
<Button
|
||||||
|
Style="{StaticResource MaterialDesignOutlinedLightButton}"
|
||||||
|
ToolTip="渲染标签"
|
||||||
|
Content="渲染标签"
|
||||||
|
Command="{Binding ResetLabelCommand}"
|
||||||
|
materialDesign:ButtonProgressAssist.IsIndicatorVisible="{Binding Status, UpdateSourceTrigger=PropertyChanged}"
|
||||||
|
materialDesign:ButtonProgressAssist.IsIndeterminate="{Binding Status, UpdateSourceTrigger=PropertyChanged}"
|
||||||
|
|
||||||
|
/>
|
||||||
<Button
|
<Button
|
||||||
|
Margin="6 0 6 0"
|
||||||
Style="{StaticResource MaterialDesignOutlinedLightButton}"
|
Style="{StaticResource MaterialDesignOutlinedLightButton}"
|
||||||
ToolTip="绑定库位"
|
ToolTip="绑定库位"
|
||||||
Content="绑定"
|
Content="绑定"
|
||||||
|
@ -85,7 +95,7 @@
|
||||||
Content="解绑"
|
Content="解绑"
|
||||||
Command="{Binding RemoveBinding}" />
|
Command="{Binding RemoveBinding}" />
|
||||||
<Button
|
<Button
|
||||||
Margin="0 0 6 0"
|
Margin="6 0 6 0"
|
||||||
Style="{StaticResource MaterialDesignOutlinedLightButton}"
|
Style="{StaticResource MaterialDesignOutlinedLightButton}"
|
||||||
ToolTip="刷新"
|
ToolTip="刷新"
|
||||||
Command="{Binding Query}"
|
Command="{Binding Query}"
|
||||||
|
|
|
@ -0,0 +1,184 @@
|
||||||
|
<!--处方取药弹窗-->
|
||||||
|
<UserControl x:Class="DM_Weight.Views.Dialog.MultiOrderTakeDialog"
|
||||||
|
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"
|
||||||
|
MinWidth="880"
|
||||||
|
Width="Auto"
|
||||||
|
Height="Auto"
|
||||||
|
mc:Ignorable="d" >
|
||||||
|
<UserControl.Resources>
|
||||||
|
<convert:StatusConverter x:Key="StatusConverter" />
|
||||||
|
</UserControl.Resources>
|
||||||
|
<materialDesign:Card Padding="0">
|
||||||
|
<Grid>
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="Auto" />
|
||||||
|
<RowDefinition Height="50" />
|
||||||
|
<RowDefinition Height="450" />
|
||||||
|
<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="多处方取药" />
|
||||||
|
<Button
|
||||||
|
Style="{StaticResource MaterialDesignIconForegroundButton}"
|
||||||
|
Foreground="{DynamicResource PrimaryHueDarkForegroundBrush}"
|
||||||
|
HorizontalAlignment="Right"
|
||||||
|
Command="{Binding BtnCloseCommand}"
|
||||||
|
IsEnabled="{Binding Status, Converter={StaticResource StatusConverter}, ConverterParameter=CloseBtn}"
|
||||||
|
ToolTip="关闭"
|
||||||
|
>
|
||||||
|
<materialDesign:PackIcon Kind="Close" Width="34" Height="34" />
|
||||||
|
</Button>
|
||||||
|
</Grid>
|
||||||
|
<Grid Grid.Row="1">
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="*" />
|
||||||
|
<ColumnDefinition Width="*" />
|
||||||
|
<!--<ColumnDefinition Width="2*" />
|
||||||
|
<ColumnDefinition Width="2*" />
|
||||||
|
<ColumnDefinition Width="2*" />
|
||||||
|
<ColumnDefinition Width="*" />
|
||||||
|
<ColumnDefinition Width="2*" />
|
||||||
|
<ColumnDefinition Width="*" />-->
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
|
||||||
|
<TextBlock
|
||||||
|
Grid.Column="0"
|
||||||
|
Margin="16 0 0 8"
|
||||||
|
VerticalAlignment="Center"
|
||||||
|
HorizontalAlignment="Left"
|
||||||
|
Style="{StaticResource MaterialDesignBody2TextBlock}"
|
||||||
|
Text="{Binding MultiOrderNo}" />
|
||||||
|
<!--<TextBlock
|
||||||
|
Grid.Column="1"
|
||||||
|
Margin="0 0 16 8"
|
||||||
|
VerticalAlignment="Center"
|
||||||
|
HorizontalAlignment="Left"
|
||||||
|
Style="{StaticResource MaterialDesignBody2TextBlock}"
|
||||||
|
Text="{Binding OrderInfo.OrderNo}" />-->
|
||||||
|
</Grid>
|
||||||
|
<DataGrid Grid.Row="2" ItemsSource="{Binding ChannelStocks}" AutoGenerateColumns="False" CanUserAddRows="False">
|
||||||
|
<DataGrid.Resources>
|
||||||
|
<Style TargetType="{x:Type DataGridColumnHeader}" BasedOn="{StaticResource MaterialDesignDataGridColumnHeader}">
|
||||||
|
<Setter Property="HorizontalContentAlignment" Value="Center" />
|
||||||
|
<Setter Property="Background" Value="#31ccec" />
|
||||||
|
<Setter Property="Foreground" Value="white" />
|
||||||
|
<Setter Property="Height" Value="48" />
|
||||||
|
<Setter Property="BorderBrush" Value="white"/>
|
||||||
|
<Setter Property="BorderThickness" Value="0.6"/>
|
||||||
|
</Style>
|
||||||
|
<Style TargetType="{x:Type DataGridCell}" BasedOn="{StaticResource MaterialDesignDataGridCell}">
|
||||||
|
<Setter Property="HorizontalAlignment" Value="left" />
|
||||||
|
<Setter Property="Padding" Value="13" />
|
||||||
|
</Style>
|
||||||
|
</DataGrid.Resources>
|
||||||
|
<DataGrid.Columns>
|
||||||
|
|
||||||
|
<DataGridTextColumn Width="100"
|
||||||
|
Header="库位"
|
||||||
|
IsReadOnly="True"
|
||||||
|
Binding="{Binding Location}"
|
||||||
|
ElementStyle="{StaticResource MaterialDesignDataGridTextColumnStyle}"
|
||||||
|
EditingElementStyle="{StaticResource MaterialDesignDataGridTextColumnEditingStyle}"
|
||||||
|
/>
|
||||||
|
<DataGridTextColumn Width="180"
|
||||||
|
Header="药品名称"
|
||||||
|
IsReadOnly="True"
|
||||||
|
Binding="{Binding DrugInfo.DrugName}"
|
||||||
|
ElementStyle="{StaticResource MaterialDesignDataGridTextColumnStyle}"
|
||||||
|
EditingElementStyle="{StaticResource MaterialDesignDataGridTextColumnEditingStyle}"
|
||||||
|
/>
|
||||||
|
<DataGridTextColumn Width="180"
|
||||||
|
Header="规格"
|
||||||
|
IsReadOnly="True"
|
||||||
|
Binding="{Binding DrugInfo.DrugSpec}"
|
||||||
|
ElementStyle="{StaticResource MaterialDesignDataGridTextColumnStyle}"
|
||||||
|
EditingElementStyle="{StaticResource MaterialDesignDataGridTextColumnEditingStyle}"
|
||||||
|
/>
|
||||||
|
<DataGridTextColumn Width="100"
|
||||||
|
Header="数量"
|
||||||
|
IsReadOnly="True"
|
||||||
|
Binding="{Binding Quantity}"
|
||||||
|
ElementStyle="{StaticResource MaterialDesignDataGridTextColumnStyle}"
|
||||||
|
EditingElementStyle="{StaticResource MaterialDesignDataGridTextColumnEditingStyle}"
|
||||||
|
/>
|
||||||
|
<DataGridTextColumn Width="130"
|
||||||
|
Header="批次"
|
||||||
|
IsReadOnly="True"
|
||||||
|
Binding="{Binding ManuNo}"
|
||||||
|
ElementStyle="{StaticResource MaterialDesignDataGridTextColumnStyle}"
|
||||||
|
EditingElementStyle="{StaticResource MaterialDesignDataGridTextColumnEditingStyle}"
|
||||||
|
/>
|
||||||
|
<DataGridTextColumn Width="130"
|
||||||
|
Header="效期"
|
||||||
|
IsReadOnly="True"
|
||||||
|
Binding="{Binding EffDate}"
|
||||||
|
ElementStyle="{StaticResource MaterialDesignDataGridTextColumnStyle}"
|
||||||
|
EditingElementStyle="{StaticResource MaterialDesignDataGridTextColumnEditingStyle}"
|
||||||
|
/>
|
||||||
|
<DataGridTextColumn Width="100"
|
||||||
|
Header="取出数量"
|
||||||
|
IsReadOnly="True"
|
||||||
|
Binding="{Binding TakeQuantity}"
|
||||||
|
ElementStyle="{StaticResource MaterialDesignDataGridTextColumnStyle}"
|
||||||
|
EditingElementStyle="{StaticResource MaterialDesignDataGridTextColumnEditingStyle}"
|
||||||
|
/>
|
||||||
|
</DataGrid.Columns>
|
||||||
|
</DataGrid>
|
||||||
|
<Grid Grid.Row="3">
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition />
|
||||||
|
<ColumnDefinition />
|
||||||
|
<ColumnDefinition />
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<StackPanel Orientation="Horizontal" Grid.Column="1" HorizontalAlignment="Center">
|
||||||
|
|
||||||
|
<!--<Button
|
||||||
|
Margin="2"
|
||||||
|
Style="{StaticResource MaterialDesignRaisedAccentButton}"
|
||||||
|
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="取药"
|
||||||
|
Command="{Binding OpenDrawer}">
|
||||||
|
</Button>-->
|
||||||
|
<TextBox Margin="0 2 6 2" Width="110"
|
||||||
|
Style="{StaticResource MaterialDesignOutlinedTextBox}"
|
||||||
|
VerticalAlignment="Top" Text="{Binding ReceivePerson}"
|
||||||
|
materialDesign:HintAssist.Hint="取药人(科室)" />
|
||||||
|
<Button
|
||||||
|
Margin="2"
|
||||||
|
Style="{StaticResource MaterialDesignRaisedAccentButton}"
|
||||||
|
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="取药"
|
||||||
|
Command="{Binding OpenDrawer}">
|
||||||
|
</Button>
|
||||||
|
<Button
|
||||||
|
Margin="2"
|
||||||
|
Visibility="{Binding Status, Converter={StaticResource StatusConverter}, ConverterParameter=CompleteBtn}"
|
||||||
|
Style="{StaticResource MaterialDesignRaisedAccentButton}"
|
||||||
|
Content="完成"
|
||||||
|
Command="{Binding TakeFinish}"/>
|
||||||
|
<Button
|
||||||
|
Margin="2"
|
||||||
|
Visibility="{Binding Status, Converter={StaticResource StatusConverter}, ConverterParameter=CancelBtn}"
|
||||||
|
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>
|
||||||
|
/// MultiOrderTakeDialog.xaml 的交互逻辑
|
||||||
|
/// </summary>
|
||||||
|
public partial class MultiOrderTakeDialog : UserControl
|
||||||
|
{
|
||||||
|
public MultiOrderTakeDialog()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -21,7 +21,7 @@
|
||||||
<Grid.RowDefinitions>
|
<Grid.RowDefinitions>
|
||||||
<RowDefinition Height="Auto" />
|
<RowDefinition Height="Auto" />
|
||||||
<RowDefinition Height="50" />
|
<RowDefinition Height="50" />
|
||||||
<RowDefinition Height="Auto" />
|
<RowDefinition Height="300" />
|
||||||
<RowDefinition Height="Auto" />
|
<RowDefinition Height="Auto" />
|
||||||
</Grid.RowDefinitions>
|
</Grid.RowDefinitions>
|
||||||
<Grid Background="#03a9f4" Grid.Row="0">
|
<Grid Background="#03a9f4" Grid.Row="0">
|
||||||
|
@ -107,6 +107,7 @@
|
||||||
Text="{Binding OrderInfo.Age}" />
|
Text="{Binding OrderInfo.Age}" />
|
||||||
</Grid>
|
</Grid>
|
||||||
<DataGrid Grid.Row="2" ItemsSource="{Binding ChannelStocks}" AutoGenerateColumns="False" CanUserAddRows="False">
|
<DataGrid Grid.Row="2" ItemsSource="{Binding ChannelStocks}" AutoGenerateColumns="False" CanUserAddRows="False">
|
||||||
|
|
||||||
<DataGrid.Resources>
|
<DataGrid.Resources>
|
||||||
<Style TargetType="{x:Type DataGridColumnHeader}" BasedOn="{StaticResource MaterialDesignDataGridColumnHeader}">
|
<Style TargetType="{x:Type DataGridColumnHeader}" BasedOn="{StaticResource MaterialDesignDataGridColumnHeader}">
|
||||||
<Setter Property="HorizontalContentAlignment" Value="Center" />
|
<Setter Property="HorizontalContentAlignment" Value="Center" />
|
||||||
|
@ -119,7 +120,7 @@
|
||||||
<Style TargetType="{x:Type DataGridCell}" BasedOn="{StaticResource MaterialDesignDataGridCell}">
|
<Style TargetType="{x:Type DataGridCell}" BasedOn="{StaticResource MaterialDesignDataGridCell}">
|
||||||
<Setter Property="HorizontalAlignment" Value="left" />
|
<Setter Property="HorizontalAlignment" Value="left" />
|
||||||
<Setter Property="Padding" Value="13" />
|
<Setter Property="Padding" Value="13" />
|
||||||
</Style>
|
</Style>
|
||||||
</DataGrid.Resources>
|
</DataGrid.Resources>
|
||||||
<DataGrid.Columns>
|
<DataGrid.Columns>
|
||||||
|
|
||||||
|
@ -191,6 +192,10 @@
|
||||||
Content="取药"
|
Content="取药"
|
||||||
Command="{Binding OpenDrawer}">
|
Command="{Binding OpenDrawer}">
|
||||||
</Button>-->
|
</Button>-->
|
||||||
|
<TextBox Margin="6" Width="110"
|
||||||
|
Style="{StaticResource MaterialDesignOutlinedTextBox}"
|
||||||
|
VerticalAlignment="Top" Text="{Binding ReceivePerson}"
|
||||||
|
materialDesign:HintAssist.Hint="取药人(科室)" />
|
||||||
<Button
|
<Button
|
||||||
Margin="2"
|
Margin="2"
|
||||||
Style="{StaticResource MaterialDesignRaisedAccentButton}"
|
Style="{StaticResource MaterialDesignRaisedAccentButton}"
|
||||||
|
|
|
@ -36,7 +36,7 @@
|
||||||
<Grid.RowDefinitions>
|
<Grid.RowDefinitions>
|
||||||
<RowDefinition Height="Auto" />
|
<RowDefinition Height="Auto" />
|
||||||
<RowDefinition Height="50" />
|
<RowDefinition Height="50" />
|
||||||
<RowDefinition Height="Auto" />
|
<RowDefinition Height="300" />
|
||||||
<RowDefinition Height="Auto" />
|
<RowDefinition Height="Auto" />
|
||||||
</Grid.RowDefinitions>
|
</Grid.RowDefinitions>
|
||||||
<Grid Background="#03a9f4" Grid.Row="0">
|
<Grid Background="#03a9f4" Grid.Row="0">
|
||||||
|
@ -58,6 +58,8 @@
|
||||||
<ColumnDefinition Width="3*" />
|
<ColumnDefinition Width="3*" />
|
||||||
<ColumnDefinition Width="2*" />
|
<ColumnDefinition Width="2*" />
|
||||||
<ColumnDefinition Width="*" />
|
<ColumnDefinition Width="*" />
|
||||||
|
<ColumnDefinition Width="*" />
|
||||||
|
<ColumnDefinition Width="*" />
|
||||||
<ColumnDefinition Width="2*" />
|
<ColumnDefinition Width="2*" />
|
||||||
<ColumnDefinition Width="2*" />
|
<ColumnDefinition Width="2*" />
|
||||||
<ColumnDefinition Width="3*" />
|
<ColumnDefinition Width="3*" />
|
||||||
|
@ -98,32 +100,47 @@
|
||||||
VerticalAlignment="Center"
|
VerticalAlignment="Center"
|
||||||
HorizontalAlignment="Right"
|
HorizontalAlignment="Right"
|
||||||
Style="{StaticResource MaterialDesignBody2TextBlock}"
|
Style="{StaticResource MaterialDesignBody2TextBlock}"
|
||||||
Text="厂家:" />
|
Text="单位:" />
|
||||||
<TextBlock
|
<TextBlock
|
||||||
Grid.Column="5"
|
Grid.Column="5"
|
||||||
Margin="16 0 16 8"
|
Margin="16 0 16 8"
|
||||||
VerticalAlignment="Center"
|
VerticalAlignment="Center"
|
||||||
HorizontalAlignment="Left"
|
HorizontalAlignment="Left"
|
||||||
Style="{StaticResource MaterialDesignBody2TextBlock}"
|
Style="{StaticResource MaterialDesignBody2TextBlock}"
|
||||||
Text="{Binding ChannelStock.DrugInfo.Manufactory}" />
|
Text="{Binding ChannelStock.DrugInfo.BigUnit}" />
|
||||||
<TextBlock
|
<TextBlock
|
||||||
Grid.Column="6"
|
Grid.Column="6"
|
||||||
Margin="16 0 16 8"
|
Margin="16 0 16 8"
|
||||||
VerticalAlignment="Center"
|
VerticalAlignment="Center"
|
||||||
HorizontalAlignment="Right"
|
HorizontalAlignment="Right"
|
||||||
Style="{StaticResource MaterialDesignBody2TextBlock}"
|
Style="{StaticResource MaterialDesignBody2TextBlock}"
|
||||||
Text="可还空瓶数:" />
|
Text="厂家:" />
|
||||||
<TextBlock
|
<TextBlock
|
||||||
Grid.Column="7"
|
Grid.Column="7"
|
||||||
Margin="16 0 16 8"
|
Margin="16 0 16 8"
|
||||||
VerticalAlignment="Center"
|
VerticalAlignment="Center"
|
||||||
HorizontalAlignment="Left"
|
HorizontalAlignment="Left"
|
||||||
Style="{StaticResource MaterialDesignBody2TextBlock}"
|
Style="{StaticResource MaterialDesignBody2TextBlock}"
|
||||||
|
Text="{Binding ChannelStock.DrugInfo.Manufactory}" />
|
||||||
|
<TextBlock
|
||||||
|
Grid.Column="8"
|
||||||
|
Margin="16 0 16 8"
|
||||||
|
VerticalAlignment="Center"
|
||||||
|
HorizontalAlignment="Right"
|
||||||
|
Style="{StaticResource MaterialDesignBody2TextBlock}"
|
||||||
|
Text="可还空瓶数:" />
|
||||||
|
<TextBlock
|
||||||
|
Grid.Column="9"
|
||||||
|
Margin="16 0 16 8"
|
||||||
|
VerticalAlignment="Center"
|
||||||
|
HorizontalAlignment="Left"
|
||||||
|
Style="{StaticResource MaterialDesignBody2TextBlock}"
|
||||||
Text="{Binding ChannelStock.CanReturnQuantity}" />
|
Text="{Binding ChannelStock.CanReturnQuantity}" />
|
||||||
</Grid>
|
</Grid>
|
||||||
<ListView
|
<ListView
|
||||||
Grid.Row="2"
|
Grid.Row="2"
|
||||||
ItemsSource="{Binding MachineRecords}"
|
ItemsSource="{Binding MachineRecords}"
|
||||||
|
SelectedItem="{Binding _MachineRecord}"
|
||||||
materialDesign:ListViewAssist.HeaderRowBackground="#31ccec"
|
materialDesign:ListViewAssist.HeaderRowBackground="#31ccec"
|
||||||
materialDesign:DataGridAssist.ColumnHeaderPadding="10"
|
materialDesign:DataGridAssist.ColumnHeaderPadding="10"
|
||||||
materialDesign:ListViewAssist.ListViewItemPadding="13">
|
materialDesign:ListViewAssist.ListViewItemPadding="13">
|
||||||
|
@ -131,31 +148,46 @@
|
||||||
<Style TargetType="{x:Type GridViewColumnHeader}" BasedOn="{StaticResource {x:Type GridViewColumnHeader}}">
|
<Style TargetType="{x:Type GridViewColumnHeader}" BasedOn="{StaticResource {x:Type GridViewColumnHeader}}">
|
||||||
<Setter Property="Foreground" Value="White" />
|
<Setter Property="Foreground" Value="White" />
|
||||||
</Style>
|
</Style>
|
||||||
|
<Style TargetType="ScrollViewer">
|
||||||
|
<Setter Property="HorizontalScrollBarVisibility" Value="Visible"/>
|
||||||
|
<Setter Property="VerticalScrollBarVisibility" Value="Visible"/>
|
||||||
|
</Style>
|
||||||
</ListView.Resources>
|
</ListView.Resources>
|
||||||
|
<i:Interaction.Triggers>
|
||||||
|
<i:EventTrigger EventName="SelectionChanged">
|
||||||
|
<i:InvokeCommandAction Command="{Binding RowSelected}" />
|
||||||
|
</i:EventTrigger>
|
||||||
|
</i:Interaction.Triggers>
|
||||||
<ListView.View>
|
<ListView.View>
|
||||||
<GridView ColumnHeaderContainerStyle="{StaticResource st}">
|
<GridView ColumnHeaderContainerStyle="{StaticResource st}">
|
||||||
<GridViewColumn Header="选择" Width="100">
|
<GridViewColumn Header="选择" Width="100">
|
||||||
<GridViewColumn.CellTemplate>
|
<GridViewColumn.CellTemplate>
|
||||||
<DataTemplate>
|
<DataTemplate>
|
||||||
<CheckBox IsChecked="{Binding IsSelected}" Click="CheckBox_Click" />
|
<CheckBox IsChecked="{Binding IsSelected}" />
|
||||||
</DataTemplate>
|
</DataTemplate>
|
||||||
</GridViewColumn.CellTemplate>
|
</GridViewColumn.CellTemplate>
|
||||||
</GridViewColumn>
|
</GridViewColumn>
|
||||||
<GridViewColumn Width="100"
|
<GridViewColumn Width="100"
|
||||||
|
Header="患者姓名"
|
||||||
|
DisplayMemberBinding="{Binding orderInfo.PName}"/>
|
||||||
|
<GridViewColumn Width="100"
|
||||||
|
Header="使用科室"
|
||||||
|
DisplayMemberBinding="{Binding orderInfo.DeptName}"/>
|
||||||
|
<!--<GridViewColumn Width="100"
|
||||||
Header="操作人"
|
Header="操作人"
|
||||||
DisplayMemberBinding="{Binding User.Nickname}"/>
|
DisplayMemberBinding="{Binding User.Nickname}"/>-->
|
||||||
<GridViewColumn Width="150"
|
<!--<GridViewColumn Width="150"
|
||||||
Header="时间"
|
Header="时间"
|
||||||
DisplayMemberBinding="{Binding OperationTime, StringFormat='yyyy-MM-dd HH:mm:ss'}" />
|
DisplayMemberBinding="{Binding OperationTime, StringFormat='yyyy-MM-dd HH:mm:ss'}" />-->
|
||||||
<GridViewColumn Width="100"
|
<GridViewColumn Width="100"
|
||||||
DisplayMemberBinding="{Binding Quantity}"
|
DisplayMemberBinding="{Binding Quantity}"
|
||||||
Header="数量"/>
|
Header="数量"/>
|
||||||
<GridViewColumn Width="150"
|
<GridViewColumn Width="150"
|
||||||
DisplayMemberBinding="{Binding ManuNo}"
|
DisplayMemberBinding="{Binding ManuNo}"
|
||||||
Header="批次"/>
|
Header="批次"/>
|
||||||
<GridViewColumn Width="150"
|
<!--<GridViewColumn Width="150"
|
||||||
DisplayMemberBinding="{Binding EffDate, StringFormat=yyyy-MM-dd}"
|
DisplayMemberBinding="{Binding EffDate, StringFormat=yyyy-MM-dd}"
|
||||||
Header="效期"/>
|
Header="效期"/>-->
|
||||||
</GridView>
|
</GridView>
|
||||||
</ListView.View>
|
</ListView.View>
|
||||||
</ListView>
|
</ListView>
|
||||||
|
@ -171,14 +203,28 @@
|
||||||
<ColumnDefinition />
|
<ColumnDefinition />
|
||||||
</Grid.ColumnDefinitions>
|
</Grid.ColumnDefinitions>
|
||||||
<TextBox
|
<TextBox
|
||||||
Margin="0 6 0 6"
|
Margin="26 6 26 6"
|
||||||
Grid.Row="0"
|
Grid.Row="0"
|
||||||
Grid.Column="1"
|
Grid.Column="0"
|
||||||
IsReadOnly="{Binding ChannelStock.BoardType, Converter={StaticResource InputQuantityConverter}}"
|
IsReadOnly="{Binding ChannelStock.BoardType, Converter={StaticResource InputQuantityConverter}}"
|
||||||
Text="{Binding ReturnQuantity, UpdateSourceTrigger=PropertyChanged, ValidatesOnExceptions=True}"
|
Text="{Binding ReturnQuantity, UpdateSourceTrigger=PropertyChanged, ValidatesOnExceptions=True}"
|
||||||
Style="{StaticResource MaterialDesignOutlinedTextBox}"
|
Style="{StaticResource MaterialDesignOutlinedTextBox}"
|
||||||
VerticalAlignment="Top"
|
VerticalAlignment="Top"
|
||||||
materialDesign:HintAssist.Hint="归还数量" />
|
materialDesign:HintAssist.Hint="归还数量" />
|
||||||
|
<TextBox
|
||||||
|
Margin="26 6 26 6"
|
||||||
|
Grid.Row="0"
|
||||||
|
Grid.Column="1" Text="{Binding ReturnPerson}"
|
||||||
|
Style="{StaticResource MaterialDesignOutlinedTextBox}"
|
||||||
|
VerticalAlignment="Top"
|
||||||
|
materialDesign:HintAssist.Hint="交回人" />
|
||||||
|
<TextBox
|
||||||
|
Margin="26 6 26 6"
|
||||||
|
Grid.Row="0"
|
||||||
|
Grid.Column="2"
|
||||||
|
Style="{StaticResource MaterialDesignOutlinedTextBox}"
|
||||||
|
VerticalAlignment="Top" Text="{Binding ReceivePerson}"
|
||||||
|
materialDesign:HintAssist.Hint="接收人" />
|
||||||
<StackPanel Orientation="Horizontal" Grid.Row="1" Grid.Column="1" HorizontalAlignment="Center">
|
<StackPanel Orientation="Horizontal" Grid.Row="1" Grid.Column="1" HorizontalAlignment="Center">
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
|
|
|
@ -22,16 +22,16 @@ namespace DM_Weight.Views.Dialog
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public partial class ReturnEmptyDialog : UserControl
|
public partial class ReturnEmptyDialog : UserControl
|
||||||
{
|
{
|
||||||
IEventAggregator _eventAggregator;
|
//IEventAggregator _eventAggregator;
|
||||||
public ReturnEmptyDialog(IEventAggregator eventAggregator)
|
public ReturnEmptyDialog(IEventAggregator eventAggregator)
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
this._eventAggregator= eventAggregator;
|
//this._eventAggregator= eventAggregator;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void CheckBox_Click(object sender, RoutedEventArgs e)
|
//private void CheckBox_Click(object sender, RoutedEventArgs e)
|
||||||
{
|
//{
|
||||||
_eventAggregator.GetEvent<CheckBoxCheckEvent>().Publish();
|
// _eventAggregator.GetEvent<CheckBoxCheckEvent>().Publish();
|
||||||
}
|
//}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -121,6 +121,13 @@
|
||||||
Content="加药"
|
Content="加药"
|
||||||
Command="{Binding OpenDrawer}">
|
Command="{Binding OpenDrawer}">
|
||||||
</Button>
|
</Button>
|
||||||
|
<ComboBox Visibility="{Binding Status, Converter={StaticResource StatusConverter}, ConverterParameter=CompleteBtn}"
|
||||||
|
Grid.Column="0"
|
||||||
|
Margin="0 6 6 6"
|
||||||
|
Style="{StaticResource MaterialDesignOutlinedComboBox}"
|
||||||
|
SelectedItem="{Binding SelectedItemUseFor}"
|
||||||
|
DisplayMemberPath="UseName"
|
||||||
|
ItemsSource="{Binding SelectsUseFor}"/>
|
||||||
<TextBox Text="{Binding PZH, UpdateSourceTrigger=PropertyChanged}" materialDesign:HintAssist.Hint="凭证号"
|
<TextBox Text="{Binding PZH, UpdateSourceTrigger=PropertyChanged}" materialDesign:HintAssist.Hint="凭证号"
|
||||||
materialDesign:HintAssist.IsFloating="True" Width="100"
|
materialDesign:HintAssist.IsFloating="True" Width="100"
|
||||||
Margin="2"
|
Margin="2"
|
||||||
|
|
|
@ -121,6 +121,14 @@
|
||||||
Content="取药"
|
Content="取药"
|
||||||
Command="{Binding OpenDrawer}">
|
Command="{Binding OpenDrawer}">
|
||||||
</Button>
|
</Button>
|
||||||
|
<ComboBox Visibility="{Binding Status, Converter={StaticResource StatusConverter}, ConverterParameter=CompleteBtn}"
|
||||||
|
Grid.Column="0"
|
||||||
|
Margin="0 6 6 6"
|
||||||
|
Style="{StaticResource MaterialDesignOutlinedComboBox}"
|
||||||
|
SelectedItem="{Binding SelectedItem}"
|
||||||
|
DisplayMemberPath="UseName"
|
||||||
|
ItemsSource="{Binding Selects}"
|
||||||
|
/>
|
||||||
<Button
|
<Button
|
||||||
Margin="2"
|
Margin="2"
|
||||||
Visibility="{Binding Status, Converter={StaticResource StatusConverter}, ConverterParameter=CompleteBtn}"
|
Visibility="{Binding Status, Converter={StaticResource StatusConverter}, ConverterParameter=CompleteBtn}"
|
||||||
|
|
|
@ -126,23 +126,23 @@
|
||||||
<ColumnDefinition />
|
<ColumnDefinition />
|
||||||
</Grid.ColumnDefinitions>
|
</Grid.ColumnDefinitions>
|
||||||
|
|
||||||
<Button Grid.Row="0" Grid.Column="0" Width="120" Content="1" Command="{Binding UpdateDrawerNo}" CommandParameter="1" />
|
<Button Grid.Row="0" Grid.Column="0" Width="120" Content="1" Command="{Binding UpdateDrawerNo}" IsEnabled="{Binding Is8Drawer}" CommandParameter="1" />
|
||||||
<Button Grid.Row="1" Grid.Column="0" Width="120" Content="2" Command="{Binding UpdateDrawerNo}" CommandParameter="2" />
|
<Button Grid.Row="1" Grid.Column="0" Width="120" Content="2" Command="{Binding UpdateDrawerNo}" IsEnabled="{Binding Is8Drawer}" CommandParameter="2" />
|
||||||
<Button Grid.Row="2" Grid.Column="0" Width="120" Content="3" Command="{Binding UpdateDrawerNo}" CommandParameter="3" />
|
<Button Grid.Row="2" Grid.Column="0" Width="120" Content="3" Command="{Binding UpdateDrawerNo}" IsEnabled="{Binding Is16Drawer}" CommandParameter="3" />
|
||||||
<Button Grid.Row="3" Grid.Column="0" Width="120" Content="4" Command="{Binding UpdateDrawerNo}" CommandParameter="4" />
|
<Button Grid.Row="3" Grid.Column="0" Width="120" Content="4" Command="{Binding UpdateDrawerNo}" IsEnabled="{Binding Is16Drawer}" CommandParameter="4" />
|
||||||
<Button Grid.Row="4" Grid.Column="0" Width="120" Content="5" Command="{Binding UpdateDrawerNo}" CommandParameter="5" />
|
<Button Grid.Row="4" Grid.Column="0" Width="120" Content="5" Command="{Binding UpdateDrawerNo}" IsEnabled="{Binding Is16Drawer}" CommandParameter="5" />
|
||||||
<Button Grid.Row="5" Grid.Column="0" Width="120" Content="6" Command="{Binding UpdateDrawerNo}" CommandParameter="6" />
|
<Button Grid.Row="5" Grid.Column="0" Width="120" Content="6" Command="{Binding UpdateDrawerNo}" IsEnabled="{Binding Is16Drawer}" CommandParameter="6" />
|
||||||
<Button Grid.Row="6" Grid.Column="0" Width="120" Content="7" Command="{Binding UpdateDrawerNo}" CommandParameter="7" />
|
<Button Grid.Row="6" Grid.Column="0" Width="120" Content="7" Command="{Binding UpdateDrawerNo}" IsEnabled="{Binding Is16Drawer}" CommandParameter="7" />
|
||||||
<Button Grid.Row="7" Grid.Column="0" Width="120" Content="8" Command="{Binding UpdateDrawerNo}" CommandParameter="8" />
|
<Button Grid.Row="7" Grid.Column="0" Width="120" Content="8" Command="{Binding UpdateDrawerNo}" IsEnabled="{Binding Is16Drawer}" CommandParameter="8" />
|
||||||
|
|
||||||
<Button Grid.Row="0" Grid.Column="1" Width="120" Content="9" Command="{Binding UpdateDrawerNo}" CommandParameter="9" />
|
<Button Grid.Row="0" Grid.Column="1" Width="120" Content="9" Command="{Binding UpdateDrawerNo}" IsEnabled="{Binding Is16Drawer}" CommandParameter="9" />
|
||||||
<Button Grid.Row="1" Grid.Column="1" Width="120" Content="10" Command="{Binding UpdateDrawerNo}" CommandParameter="10" />
|
<Button Grid.Row="1" Grid.Column="1" Width="120" Content="10" Command="{Binding UpdateDrawerNo}" IsEnabled="{Binding Is16Drawer}" CommandParameter="10" />
|
||||||
<Button Grid.Row="2" Grid.Column="1" Width="120" Content="11" Command="{Binding UpdateDrawerNo}" CommandParameter="11" />
|
<Button Grid.Row="2" Grid.Column="1" Width="120" Content="11" Command="{Binding UpdateDrawerNo}" IsEnabled="{Binding Is16Drawer}" CommandParameter="11" />
|
||||||
<Button Grid.Row="3" Grid.Column="1" Width="120" Content="12" Command="{Binding UpdateDrawerNo}" CommandParameter="12" />
|
<Button Grid.Row="3" Grid.Column="1" Width="120" Content="12" Command="{Binding UpdateDrawerNo}" IsEnabled="{Binding Is16Drawer}" CommandParameter="12" />
|
||||||
<Button Grid.Row="4" Grid.Column="1" Width="120" Content="13" Command="{Binding UpdateDrawerNo}" CommandParameter="13" />
|
<Button Grid.Row="4" Grid.Column="1" Width="120" Content="13" Command="{Binding UpdateDrawerNo}" IsEnabled="{Binding Is16Drawer}" CommandParameter="13" />
|
||||||
<Button Grid.Row="5" Grid.Column="1" Width="120" Content="14" Command="{Binding UpdateDrawerNo}" CommandParameter="14" />
|
<Button Grid.Row="5" Grid.Column="1" Width="120" Content="14" Command="{Binding UpdateDrawerNo}" IsEnabled="{Binding Is16Drawer}" CommandParameter="14" />
|
||||||
<Button Grid.Row="6" Grid.Column="1" Width="120" Content="15" Command="{Binding UpdateDrawerNo}" CommandParameter="15" />
|
<Button Grid.Row="6" Grid.Column="1" Width="120" Content="15" Command="{Binding UpdateDrawerNo}" IsEnabled="{Binding Is16Drawer}" CommandParameter="15" />
|
||||||
<Button Grid.Row="7" Grid.Column="1" Width="120" Content="16" Command="{Binding UpdateDrawerNo}" CommandParameter="16" />
|
<Button Grid.Row="7" Grid.Column="1" Width="120" Content="16" Command="{Binding UpdateDrawerNo}" IsEnabled="{Binding Is16Drawer}" CommandParameter="16" />
|
||||||
|
|
||||||
</Grid>
|
</Grid>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
@ -161,7 +161,13 @@
|
||||||
materialDesign:ButtonProgressAssist.IsIndeterminate="{Binding Status, Converter={StaticResource StatusConverter}, ConverterParameter=opearBtnLoading}"
|
materialDesign:ButtonProgressAssist.IsIndeterminate="{Binding Status, Converter={StaticResource StatusConverter}, ConverterParameter=opearBtnLoading}"
|
||||||
Style="{StaticResource MaterialDesignOutlinedLightButton}"
|
Style="{StaticResource MaterialDesignOutlinedLightButton}"
|
||||||
Content="加药" />
|
Content="加药" />
|
||||||
|
<ComboBox Visibility="{Binding Status, Converter={StaticResource StatusConverter}, ConverterParameter=CompleteBtn}"
|
||||||
|
Grid.Column="0"
|
||||||
|
Margin="0 0 6 0"
|
||||||
|
Style="{StaticResource MaterialDesignOutlinedComboBox}"
|
||||||
|
SelectedItem="{Binding SelectedItemUseFor}"
|
||||||
|
DisplayMemberPath="UseName"
|
||||||
|
ItemsSource="{Binding SelectsUseFor}"/>
|
||||||
<TextBox Text="{Binding PZH, UpdateSourceTrigger=PropertyChanged}" materialDesign:HintAssist.Hint="凭证号"
|
<TextBox Text="{Binding PZH, UpdateSourceTrigger=PropertyChanged}" materialDesign:HintAssist.Hint="凭证号"
|
||||||
materialDesign:HintAssist.IsFloating="True" Width="100"
|
materialDesign:HintAssist.IsFloating="True" Width="100"
|
||||||
Margin="0 0 3 0"
|
Margin="0 0 3 0"
|
||||||
|
|
|
@ -122,23 +122,23 @@
|
||||||
<ColumnDefinition />
|
<ColumnDefinition />
|
||||||
</Grid.ColumnDefinitions>
|
</Grid.ColumnDefinitions>
|
||||||
|
|
||||||
<Button Grid.Row="0" Grid.Column="0" Width="120" Content="1" Command="{Binding UpdateDrawerNo}" CommandParameter="1" />
|
<Button Grid.Row="0" Grid.Column="0" Width="120" Content="1" Command="{Binding UpdateDrawerNo}" IsEnabled="{Binding Is8Drawer}" CommandParameter="1" />
|
||||||
<Button Grid.Row="1" Grid.Column="0" Width="120" Content="2" Command="{Binding UpdateDrawerNo}" CommandParameter="2" />
|
<Button Grid.Row="1" Grid.Column="0" Width="120" Content="2" Command="{Binding UpdateDrawerNo}" IsEnabled="{Binding Is8Drawer}" CommandParameter="2" />
|
||||||
<Button Grid.Row="2" Grid.Column="0" Width="120" Content="3" Command="{Binding UpdateDrawerNo}" CommandParameter="3" />
|
<Button Grid.Row="2" Grid.Column="0" Width="120" Content="3" Command="{Binding UpdateDrawerNo}" IsEnabled="{Binding Is16Drawer}" CommandParameter="3" />
|
||||||
<Button Grid.Row="3" Grid.Column="0" Width="120" Content="4" Command="{Binding UpdateDrawerNo}" CommandParameter="4" />
|
<Button Grid.Row="3" Grid.Column="0" Width="120" Content="4" Command="{Binding UpdateDrawerNo}" IsEnabled="{Binding Is16Drawer}" CommandParameter="4" />
|
||||||
<Button Grid.Row="4" Grid.Column="0" Width="120" Content="5" Command="{Binding UpdateDrawerNo}" CommandParameter="5" />
|
<Button Grid.Row="4" Grid.Column="0" Width="120" Content="5" Command="{Binding UpdateDrawerNo}" IsEnabled="{Binding Is16Drawer}" CommandParameter="5" />
|
||||||
<Button Grid.Row="5" Grid.Column="0" Width="120" Content="6" Command="{Binding UpdateDrawerNo}" CommandParameter="6" />
|
<Button Grid.Row="5" Grid.Column="0" Width="120" Content="6" Command="{Binding UpdateDrawerNo}" IsEnabled="{Binding Is16Drawer}" CommandParameter="6" />
|
||||||
<Button Grid.Row="6" Grid.Column="0" Width="120" Content="7" Command="{Binding UpdateDrawerNo}" CommandParameter="7" />
|
<Button Grid.Row="6" Grid.Column="0" Width="120" Content="7" Command="{Binding UpdateDrawerNo}" IsEnabled="{Binding Is16Drawer}" CommandParameter="7" />
|
||||||
<Button Grid.Row="7" Grid.Column="0" Width="120" Content="8" Command="{Binding UpdateDrawerNo}" CommandParameter="8" />
|
<Button Grid.Row="7" Grid.Column="0" Width="120" Content="8" Command="{Binding UpdateDrawerNo}" IsEnabled="{Binding Is16Drawer}" CommandParameter="8" />
|
||||||
|
|
||||||
<Button Grid.Row="0" Grid.Column="1" Width="120" Content="9" Command="{Binding UpdateDrawerNo}" CommandParameter="9" />
|
<Button Grid.Row="0" Grid.Column="1" Width="120" Content="9" Command="{Binding UpdateDrawerNo}" IsEnabled="{Binding Is16Drawer}" CommandParameter="9" />
|
||||||
<Button Grid.Row="1" Grid.Column="1" Width="120" Content="10" Command="{Binding UpdateDrawerNo}" CommandParameter="10" />
|
<Button Grid.Row="1" Grid.Column="1" Width="120" Content="10" Command="{Binding UpdateDrawerNo}" IsEnabled="{Binding Is16Drawer}" CommandParameter="10" />
|
||||||
<Button Grid.Row="2" Grid.Column="1" Width="120" Content="11" Command="{Binding UpdateDrawerNo}" CommandParameter="11" />
|
<Button Grid.Row="2" Grid.Column="1" Width="120" Content="11" Command="{Binding UpdateDrawerNo}" IsEnabled="{Binding Is16Drawer}" CommandParameter="11" />
|
||||||
<Button Grid.Row="3" Grid.Column="1" Width="120" Content="12" Command="{Binding UpdateDrawerNo}" CommandParameter="12" />
|
<Button Grid.Row="3" Grid.Column="1" Width="120" Content="12" Command="{Binding UpdateDrawerNo}" IsEnabled="{Binding Is16Drawer}" CommandParameter="12" />
|
||||||
<Button Grid.Row="4" Grid.Column="1" Width="120" Content="13" Command="{Binding UpdateDrawerNo}" CommandParameter="13" />
|
<Button Grid.Row="4" Grid.Column="1" Width="120" Content="13" Command="{Binding UpdateDrawerNo}" IsEnabled="{Binding Is16Drawer}" CommandParameter="13" />
|
||||||
<Button Grid.Row="5" Grid.Column="1" Width="120" Content="14" Command="{Binding UpdateDrawerNo}" CommandParameter="14" />
|
<Button Grid.Row="5" Grid.Column="1" Width="120" Content="14" Command="{Binding UpdateDrawerNo}" IsEnabled="{Binding Is16Drawer}" CommandParameter="14" />
|
||||||
<Button Grid.Row="6" Grid.Column="1" Width="120" Content="15" Command="{Binding UpdateDrawerNo}" CommandParameter="15" />
|
<Button Grid.Row="6" Grid.Column="1" Width="120" Content="15" Command="{Binding UpdateDrawerNo}" IsEnabled="{Binding Is16Drawer}" CommandParameter="15" />
|
||||||
<Button Grid.Row="7" Grid.Column="1" Width="120" Content="16" Command="{Binding UpdateDrawerNo}" CommandParameter="16" />
|
<Button Grid.Row="7" Grid.Column="1" Width="120" Content="16" Command="{Binding UpdateDrawerNo}" IsEnabled="{Binding Is16Drawer}" CommandParameter="16" />
|
||||||
|
|
||||||
</Grid>
|
</Grid>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
@ -157,6 +157,13 @@
|
||||||
materialDesign:ButtonProgressAssist.IsIndeterminate="{Binding Status, Converter={StaticResource StatusConverter}, ConverterParameter=opearBtnLoading}"
|
materialDesign:ButtonProgressAssist.IsIndeterminate="{Binding Status, Converter={StaticResource StatusConverter}, ConverterParameter=opearBtnLoading}"
|
||||||
Style="{StaticResource MaterialDesignOutlinedLightButton}"
|
Style="{StaticResource MaterialDesignOutlinedLightButton}"
|
||||||
Content="取药" />
|
Content="取药" />
|
||||||
|
<ComboBox Visibility="{Binding Status, Converter={StaticResource StatusConverter}, ConverterParameter=CompleteBtn}"
|
||||||
|
Grid.Column="0"
|
||||||
|
Margin="0 0 6 0"
|
||||||
|
Style="{StaticResource MaterialDesignOutlinedComboBox}"
|
||||||
|
SelectedItem="{Binding SelectedItemUseFor}"
|
||||||
|
DisplayMemberPath="UseName"
|
||||||
|
ItemsSource="{Binding SelectsUseFor}"/>
|
||||||
<Button
|
<Button
|
||||||
Margin="0 0 3 0"
|
Margin="0 0 3 0"
|
||||||
VerticalAlignment="Center"
|
VerticalAlignment="Center"
|
||||||
|
|
|
@ -0,0 +1,12 @@
|
||||||
|
<UserControl x:Class="DM_Weight.Views.EmptyWindow"
|
||||||
|
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"
|
||||||
|
mc:Ignorable="d"
|
||||||
|
d:DesignHeight="450" d:DesignWidth="800">
|
||||||
|
<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>
|
||||||
|
/// EmptyWindow.xaml 的交互逻辑
|
||||||
|
/// </summary>
|
||||||
|
public partial class EmptyWindow : UserControl
|
||||||
|
{
|
||||||
|
public EmptyWindow()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -26,7 +26,9 @@
|
||||||
<ColumnDefinition Width="Auto" />
|
<ColumnDefinition Width="Auto" />
|
||||||
<ColumnDefinition />
|
<ColumnDefinition />
|
||||||
</Grid.ColumnDefinitions>
|
</Grid.ColumnDefinitions>
|
||||||
<Image Grid.Column="0" Margin="30 0 30 0" HorizontalAlignment="Left" Width="Auto" Height="26" Source="/Images/logo.png" />
|
<!--<Image Grid.Column="0" Margin="30 0 30 0" HorizontalAlignment="Left" Width="Auto" Height="26" Source="/Images/logo.png" />-->
|
||||||
|
<TextBlock Text="麻精药品管理系统" Grid.Column="0" Margin="30 0 30 0" HorizontalAlignment="Left" Width="Auto" Height="26" Foreground="White" FontSize="20" FontWeight="Bold" />
|
||||||
|
|
||||||
<ListBox Name="ListBoxName" Grid.Column="1" SelectedItem="{Binding SelectedMenu}" ItemsSource="{Binding PremissionDmList}" HorizontalAlignment="Right">
|
<ListBox Name="ListBoxName" Grid.Column="1" SelectedItem="{Binding SelectedMenu}" ItemsSource="{Binding PremissionDmList}" HorizontalAlignment="Right">
|
||||||
<i:Interaction.Triggers>
|
<i:Interaction.Triggers>
|
||||||
<i:EventTrigger EventName="SelectionChanged">
|
<i:EventTrigger EventName="SelectionChanged">
|
||||||
|
|
|
@ -272,12 +272,12 @@
|
||||||
Binding="{Binding Quantity}"
|
Binding="{Binding Quantity}"
|
||||||
Header="库存"
|
Header="库存"
|
||||||
ElementStyle="{StaticResource MaterialDesignDataGridTextColumnStyle}"/>
|
ElementStyle="{StaticResource MaterialDesignDataGridTextColumnStyle}"/>
|
||||||
<DataGridTextColumn Width="100"
|
<!--<DataGridTextColumn Width="100"
|
||||||
Binding="{Binding AddQuantity}"
|
Binding="{Binding AddQuantity}"
|
||||||
Header="添加数量"
|
Header="添加数量"
|
||||||
IsReadOnly="True"
|
IsReadOnly="True"
|
||||||
ElementStyle="{StaticResource MaterialDesignDataGridTextColumnStyle}"/>
|
ElementStyle="{StaticResource MaterialDesignDataGridTextColumnStyle}"/>-->
|
||||||
<!--<DataGridTemplateColumn Width="60">
|
<DataGridTemplateColumn Width="60">
|
||||||
<DataGridTemplateColumn.Header>
|
<DataGridTemplateColumn.Header>
|
||||||
<TextBlock Text="添加数量" TextWrapping="Wrap"/>
|
<TextBlock Text="添加数量" TextWrapping="Wrap"/>
|
||||||
</DataGridTemplateColumn.Header>
|
</DataGridTemplateColumn.Header>
|
||||||
|
@ -294,7 +294,7 @@
|
||||||
</TextBox>
|
</TextBox>
|
||||||
</DataTemplate>
|
</DataTemplate>
|
||||||
</DataGridTemplateColumn.CellTemplate>
|
</DataGridTemplateColumn.CellTemplate>
|
||||||
</DataGridTemplateColumn>-->
|
</DataGridTemplateColumn>
|
||||||
|
|
||||||
</DataGrid.Columns>
|
</DataGrid.Columns>
|
||||||
</DataGrid>
|
</DataGrid>
|
||||||
|
|
|
@ -56,7 +56,7 @@
|
||||||
FontSize="28"
|
FontSize="28"
|
||||||
Foreground="#31ccec"
|
Foreground="#31ccec"
|
||||||
FontWeight="Bold"
|
FontWeight="Bold"
|
||||||
Text="欢迎登录毒麻药品管理系统">
|
Text="欢迎登录麻精药品管理系统">
|
||||||
</TextBlock>
|
</TextBlock>
|
||||||
<TextBlock
|
<TextBlock
|
||||||
Grid.Row="2"
|
Grid.Row="2"
|
||||||
|
|
|
@ -77,7 +77,23 @@
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</Button>-->
|
</Button>-->
|
||||||
<Button
|
<Button
|
||||||
Margin="0 0 3 0"
|
Margin="0 0 6 0"
|
||||||
|
Visibility="{Binding Type, Converter={StaticResource MachineTypeConverter},ConverterParameter=ReportOrderAccount}"
|
||||||
|
HorizontalAlignment="Right"
|
||||||
|
VerticalAlignment="Center"
|
||||||
|
Command="{Binding AccountCommand}"
|
||||||
|
Style="{StaticResource MaterialDesignOutlinedLightButton}" Content="导出处方登记专册">
|
||||||
|
</Button>
|
||||||
|
<Button
|
||||||
|
Margin="0 0 6 0"
|
||||||
|
Visibility="{Binding Type, Converter={StaticResource MachineTypeConverter},ConverterParameter=ReportReturnRecord}"
|
||||||
|
HorizontalAlignment="Right"
|
||||||
|
VerticalAlignment="Center"
|
||||||
|
Command="{Binding ReturnRecordCommand}"
|
||||||
|
Style="{StaticResource MaterialDesignOutlinedLightButton}" Content="导出回收登记记录">
|
||||||
|
</Button>
|
||||||
|
<Button
|
||||||
|
Margin="0 0 6 0"
|
||||||
VerticalAlignment="Center"
|
VerticalAlignment="Center"
|
||||||
Style="{StaticResource MaterialDesignOutlinedLightButton}"
|
Style="{StaticResource MaterialDesignOutlinedLightButton}"
|
||||||
ToolTip="导出" Command="{Binding Download}">
|
ToolTip="导出" Command="{Binding Download}">
|
||||||
|
|
|
@ -0,0 +1,150 @@
|
||||||
|
<!--处方取药界面-->
|
||||||
|
<UserControl x:Class="DM_Weight.Views.MultiOrderTakeDrugWindow"
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
|
||||||
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:i="http://schemas.microsoft.com/xaml/behaviors"
|
||||||
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
|
xmlns:convert="clr-namespace:DM_Weight.Converter"
|
||||||
|
mc:Ignorable="d" Loaded="UserControl_Loaded">
|
||||||
|
<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="1.5*" />
|
||||||
|
<ColumnDefinition Width="2*" />
|
||||||
|
<ColumnDefinition Width="5.5*" />
|
||||||
|
<ColumnDefinition Width="1*"/>
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<ComboBox
|
||||||
|
Grid.Column="0"
|
||||||
|
Margin="6 0 0 0"
|
||||||
|
Style="{StaticResource MaterialDesignOutlinedComboBox}"
|
||||||
|
SelectedItem="{Binding OrderDepartment}"
|
||||||
|
DisplayMemberPath="DeptName"
|
||||||
|
ItemsSource="{Binding OrderDepartments}" materialDesign:HintAssist.Hint="科室"
|
||||||
|
/>
|
||||||
|
<!--<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="1"
|
||||||
|
SelectedDate="{Binding OrderDate, StringFormat=yyyy-MM-dd, TargetNullValue='',UpdateSourceTrigger=PropertyChanged}"
|
||||||
|
SelectedDateFormat="Short"
|
||||||
|
Margin="6 0 0 0"
|
||||||
|
materialDesign:HintAssist.Hint="开方日期"
|
||||||
|
Style="{StaticResource MaterialDesignOutlinedDatePicker}" />
|
||||||
|
<Button Grid.Column="2"
|
||||||
|
HorizontalAlignment="Right"
|
||||||
|
VerticalAlignment="Center"
|
||||||
|
Style="{StaticResource MaterialDesignOutlinedLightButton}"
|
||||||
|
ToolTip="取药" Cursor="Hand"
|
||||||
|
Command="{Binding BtnTakeOrder}" Content="取药">
|
||||||
|
</Button>
|
||||||
|
<Grid
|
||||||
|
Grid.Column="3">
|
||||||
|
<Button
|
||||||
|
HorizontalAlignment="Right"
|
||||||
|
Margin="0 0 6 0"
|
||||||
|
VerticalAlignment="Center"
|
||||||
|
Command="{Binding QueryCommand}"
|
||||||
|
Style="{StaticResource MaterialDesignOutlinedLightButton}"
|
||||||
|
ToolTip="刷新" Cursor="Hand">
|
||||||
|
<materialDesign:PackIcon
|
||||||
|
Kind="Refresh" />
|
||||||
|
</Button>
|
||||||
|
</Grid>
|
||||||
|
</Grid>
|
||||||
|
<ListView
|
||||||
|
Grid.Row="1" Grid.ColumnSpan="3"
|
||||||
|
ItemsSource="{Binding OrderInfos,UpdateSourceTrigger=PropertyChanged}"
|
||||||
|
materialDesign:ListViewAssist.HeaderRowBackground="#31ccec">
|
||||||
|
<!--<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.ItemContainerStyle>
|
||||||
|
<Style TargetType="ListViewItem" BasedOn="{StaticResource MaterialDesignGridViewItem}">
|
||||||
|
<Setter Property="ListView.Height" Value="50"/>
|
||||||
|
</Style>
|
||||||
|
</ListView.ItemContainerStyle>
|
||||||
|
<ListView.View>
|
||||||
|
|
||||||
|
<GridView ColumnHeaderContainerStyle="{StaticResource st}" >
|
||||||
|
<GridViewColumn Width="50">
|
||||||
|
<GridViewColumnHeader>
|
||||||
|
<CheckBox x:Name="allCheck" IsChecked="{Binding IsAllChecked,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"/>
|
||||||
|
</GridViewColumnHeader>
|
||||||
|
<GridViewColumn.CellTemplate>
|
||||||
|
<DataTemplate>
|
||||||
|
<CheckBox x:Name="check_1" IsChecked="{Binding ItemIsChecked,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" Click="Item_Checked"/>
|
||||||
|
<!--<CheckBox x:Name="check_1" IsChecked="{Binding IsCheck}" ToolTip="{Binding BookId}" Click="Check_bool_Select_Click"/>-->
|
||||||
|
</DataTemplate>
|
||||||
|
</GridViewColumn.CellTemplate>
|
||||||
|
</GridViewColumn>
|
||||||
|
<GridViewColumn Width="153"
|
||||||
|
Header="患者ID"
|
||||||
|
DisplayMemberBinding="{Binding PatientId}"/>
|
||||||
|
<GridViewColumn Width="153"
|
||||||
|
Header="姓名"
|
||||||
|
DisplayMemberBinding="{Binding PName}" />
|
||||||
|
<GridViewColumn Width="80"
|
||||||
|
DisplayMemberBinding="{Binding Sex}"
|
||||||
|
Header="性别"/>
|
||||||
|
<GridViewColumn Width="80"
|
||||||
|
DisplayMemberBinding="{Binding Age}"
|
||||||
|
Header="年龄"/>
|
||||||
|
<GridViewColumn Width="153"
|
||||||
|
DisplayMemberBinding="{Binding IdNumber}"
|
||||||
|
Header="身份证"/>
|
||||||
|
<GridViewColumn Width="153"
|
||||||
|
DisplayMemberBinding="{Binding OrderNo}"
|
||||||
|
Header="处方号"/>
|
||||||
|
<GridViewColumn Width="153"
|
||||||
|
DisplayMemberBinding="{Binding DeptName}"
|
||||||
|
Header="科室"/>
|
||||||
|
<GridViewColumn Width="80"
|
||||||
|
DisplayMemberBinding="{Binding DmStatus, Converter={StaticResource OrderStatusConverter}}"
|
||||||
|
Header="状态"/>
|
||||||
|
</GridView>
|
||||||
|
</ListView.View>
|
||||||
|
</ListView>
|
||||||
|
<!--<pagination:PaginationPagination Grid.Row="2" Grid.ColumnSpan="3"
|
||||||
|
CurrentPage="{Binding PageNum}"
|
||||||
|
PageSize="{Binding PageSize}"
|
||||||
|
TotalPages="{Binding TotalCount}"
|
||||||
|
InfoTextIsEnabel="True"
|
||||||
|
/>-->
|
||||||
|
</Grid>
|
||||||
|
</UserControl>
|
|
@ -0,0 +1,54 @@
|
||||||
|
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>
|
||||||
|
/// MultiOrderTakeDrugWindow.xaml 的交互逻辑
|
||||||
|
/// </summary>
|
||||||
|
public partial class MultiOrderTakeDrugWindow : UserControl
|
||||||
|
{
|
||||||
|
MultiOrderTakeDrugWindowViewModel vms;
|
||||||
|
public MultiOrderTakeDrugWindow()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
private void CheckBox_Checked_Click(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
//某项被选中
|
||||||
|
private void Item_Checked(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
CheckBox cbx = (CheckBox)sender;
|
||||||
|
if (!(bool)cbx.IsChecked)
|
||||||
|
{
|
||||||
|
vms.IsItemCheck = true;
|
||||||
|
vms.IsAllChecked = false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
vms.IsItemCheck = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void UserControl_Loaded(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
vms = MultiOrderTakeDrugWindowViewModel.vm;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -29,8 +29,22 @@
|
||||||
<RowDefinition />
|
<RowDefinition />
|
||||||
</Grid.RowDefinitions>
|
</Grid.RowDefinitions>
|
||||||
<Grid Margin="0 6 0 6" Grid.Row="0">
|
<Grid Margin="0 6 0 6" Grid.Row="0">
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="9.5*"/>
|
||||||
|
<ColumnDefinition Width="0.5*"/>
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
|
||||||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right">
|
<!--<StackPanel
|
||||||
|
Margin="0 0 0 0">
|
||||||
|
<Button
|
||||||
|
HorizontalAlignment="Right"
|
||||||
|
VerticalAlignment="Center"
|
||||||
|
Command="{Binding ReturnRecordCommand}"
|
||||||
|
Style="{StaticResource MaterialDesignOutlinedLightButton}" Content="导出回收登记记录">
|
||||||
|
</Button>
|
||||||
|
</StackPanel>-->
|
||||||
|
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right"
|
||||||
|
Grid.Column="1">
|
||||||
<Button
|
<Button
|
||||||
Margin="0 0 6 0"
|
Margin="0 0 6 0"
|
||||||
VerticalAlignment="Center"
|
VerticalAlignment="Center"
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
xmlns:prism="http://prismlibrary.com/"
|
xmlns:prism="http://prismlibrary.com/"
|
||||||
mc:Ignorable="d">
|
mc:Ignorable="d">
|
||||||
<UserControl.Resources>
|
<UserControl.Resources>
|
||||||
|
<convert:DrawerAuthorityConverter x:Key="DrawerAuthorityConverter" />
|
||||||
<Style x:Key="st" TargetType="GridViewColumnHeader">
|
<Style x:Key="st" TargetType="GridViewColumnHeader">
|
||||||
<Style.Setters>
|
<Style.Setters>
|
||||||
<Setter Property="Height">
|
<Setter Property="Height">
|
||||||
|
@ -95,6 +96,7 @@
|
||||||
<Grid.RowDefinitions>
|
<Grid.RowDefinitions>
|
||||||
<RowDefinition Height="Auto" />
|
<RowDefinition Height="Auto" />
|
||||||
<RowDefinition />
|
<RowDefinition />
|
||||||
|
<RowDefinition Height="0.2*" />
|
||||||
</Grid.RowDefinitions>
|
</Grid.RowDefinitions>
|
||||||
<Grid Grid.Row="0">
|
<Grid Grid.Row="0">
|
||||||
<Grid.ColumnDefinitions>
|
<Grid.ColumnDefinitions>
|
||||||
|
@ -190,6 +192,18 @@
|
||||||
MessageQueue="{Binding SnackbarMessageQueue}"/>
|
MessageQueue="{Binding SnackbarMessageQueue}"/>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|
||||||
|
<Grid Grid.Row="2">
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition />
|
||||||
|
<ColumnDefinition />
|
||||||
|
<ColumnDefinition />
|
||||||
|
<ColumnDefinition />
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<TextBlock Text="抽屉权限" FontWeight="Bold" FontSize="14" Grid.Column="0" Margin="10"></TextBlock>
|
||||||
|
<CheckBox Content="1-8号抽屉" IsChecked="{Binding Role.FirstEightChecked, Converter={StaticResource DrawerAuthorityConverter}}" VerticalAlignment="Center" HorizontalAlignment="Left" Grid.Column="1"/>
|
||||||
|
<CheckBox Content="9-16号抽屉" IsChecked="{Binding Role.LastEightChecked, Converter={StaticResource DrawerAuthorityConverter}}" VerticalAlignment="Center" HorizontalAlignment="Left" Grid.Column="2"/>
|
||||||
|
<CheckBox Content="17号抽屉" IsChecked="{Binding Role.StorageBoxChecked, Converter={StaticResource DrawerAuthorityConverter}}" VerticalAlignment="Center" HorizontalAlignment="Left" Grid.Column="3"/>
|
||||||
|
</Grid>
|
||||||
</Grid>
|
</Grid>
|
||||||
</GroupBox>
|
</GroupBox>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|
|
@ -0,0 +1,99 @@
|
||||||
|
<UserControl x:Class="DM_Weight.Views.SpecialAccountWindow"
|
||||||
|
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>
|
||||||
|
<convert:MachineTypeConverter x:Key="MachineTypeConverter"/>
|
||||||
|
</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 Visibility="Collapsed"
|
||||||
|
Grid.Column="0"
|
||||||
|
SelectedDate="{Binding StartDate, TargetNullValue=''}"
|
||||||
|
Margin="6 0 0 0"
|
||||||
|
materialDesign:HintAssist.Hint="开始时间"
|
||||||
|
Style="{StaticResource MaterialDesignOutlinedDatePicker}"
|
||||||
|
/>
|
||||||
|
<DatePicker
|
||||||
|
Grid.Column="0"
|
||||||
|
SelectedDate="{Binding EndDate}"
|
||||||
|
Margin="6 0 0 0"
|
||||||
|
materialDesign:HintAssist.Hint="查询时间"
|
||||||
|
Style="{StaticResource MaterialDesignOutlinedDatePicker}"
|
||||||
|
/>
|
||||||
|
<ComboBox Visibility="Collapsed"
|
||||||
|
Margin="6 0 6 0"
|
||||||
|
Grid.Column="1"
|
||||||
|
materialDesign:HintAssist.Hint="药品名称/拼音码/药品编码"
|
||||||
|
ItemsSource="{Binding DrugInfos}"
|
||||||
|
SelectedItem="{Binding DrugInfo}"
|
||||||
|
DisplayMemberPath="DrugName" IsEditable="True" IsTextSearchEnabled="False" KeyUp="ComboBox_KeyUp"
|
||||||
|
/>
|
||||||
|
<StackPanel Grid.Column="4" Orientation="Horizontal" HorizontalAlignment="Right">
|
||||||
|
<Button
|
||||||
|
Margin="0 0 3 0"
|
||||||
|
VerticalAlignment="Center"
|
||||||
|
Style="{StaticResource MaterialDesignOutlinedLightButton}"
|
||||||
|
ToolTip="导出" Command="{Binding DayAccountBook}">
|
||||||
|
<StackPanel Orientation="Horizontal">
|
||||||
|
<TextBlock Text="生成日结存" />
|
||||||
|
</StackPanel>
|
||||||
|
</Button>
|
||||||
|
<Button
|
||||||
|
Margin="0 0 3 0"
|
||||||
|
VerticalAlignment="Center"
|
||||||
|
Style="{StaticResource MaterialDesignOutlinedLightButton}"
|
||||||
|
ToolTip="导出" Command="{Binding DownloadAccountBook}">
|
||||||
|
<StackPanel Orientation="Horizontal">
|
||||||
|
<materialDesign:PackIcon Kind="download" />
|
||||||
|
<TextBlock Text="导出账册1" />
|
||||||
|
</StackPanel>
|
||||||
|
</Button>
|
||||||
|
<Button
|
||||||
|
Margin="0 0 3 0"
|
||||||
|
VerticalAlignment="Center"
|
||||||
|
Style="{StaticResource MaterialDesignOutlinedLightButton}"
|
||||||
|
ToolTip="导出" Command="{Binding DownloadAccountBook2}">
|
||||||
|
<StackPanel Orientation="Horizontal">
|
||||||
|
<materialDesign:PackIcon Kind="download" />
|
||||||
|
<TextBlock Text="导出账册2" />
|
||||||
|
</StackPanel>
|
||||||
|
</Button>
|
||||||
|
</StackPanel>
|
||||||
|
</Grid>
|
||||||
|
</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>
|
||||||
|
/// SpecialAccountWindow.xaml 的交互逻辑
|
||||||
|
/// </summary>
|
||||||
|
public partial class SpecialAccountWindow : UserControl
|
||||||
|
{
|
||||||
|
SpecialAccountWindowViewModel vms;
|
||||||
|
public SpecialAccountWindow()
|
||||||
|
{
|
||||||
|
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 = SpecialAccountWindowViewModel.vm;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -1 +0,0 @@
|
||||||
湖南省儿童医院16个抽屉,每个抽屉2个库位,带两个三色灯标签
|
|
Loading…
Reference in New Issue