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/
|
||||
|
||||
# Fody - auto-generated XML schema
|
||||
FodyWeavers.xsd
|
||||
FodyWeavers.xsd
|
||||
/readme.txt
|
||||
|
|
|
@ -8,13 +8,19 @@ EndProject
|
|||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Debug|x64 = Debug|x64
|
||||
Release|Any CPU = Release|Any CPU
|
||||
Release|x64 = Release|x64
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{439FA76B-F874-40DB-BAF2-E3647CD55B10}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{439FA76B-F874-40DB-BAF2-E3647CD55B10}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{439FA76B-F874-40DB-BAF2-E3647CD55B10}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{439FA76B-F874-40DB-BAF2-E3647CD55B10}.Debug|x64.Build.0 = Debug|x64
|
||||
{439FA76B-F874-40DB-BAF2-E3647CD55B10}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{439FA76B-F874-40DB-BAF2-E3647CD55B10}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{439FA76B-F874-40DB-BAF2-E3647CD55B10}.Release|x64.ActiveCfg = Release|x64
|
||||
{439FA76B-F874-40DB-BAF2-E3647CD55B10}.Release|x64.Build.0 = Release|x64
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
<connectionStrings>
|
||||
<!-- 数据库连接字符串 -->
|
||||
<!--<add name="database" connectionString="server=127.0.0.1;database=wpf_dm_program;userid=root;password=qq1223" />-->
|
||||
<add name="database" connectionString="server=127.0.0.1;port=3306;database=hunanxianchang_db;userid=root;password=root;Pooling=false; ConnectionLifeTime=0;" />
|
||||
<add name="database" connectionString="server=192.168.50.84;port=3306;database=sanya_xianchang2;userid=root;password=root" />
|
||||
</connectionStrings>
|
||||
<!--<runtime>
|
||||
--><!--配置之后,Appdomain.CurrentDomain.UnhandledException 事件的 IsTerminating 就变成了 false 啦!也就是说,程序并不会因为这次的异常而崩溃退出。--><!--
|
||||
|
@ -12,13 +12,13 @@
|
|||
<appSettings>
|
||||
|
||||
<!-- 设备id -->
|
||||
<add key="machineId" value="DM1" />
|
||||
<add key="machineId" value="DM2" />
|
||||
<!-- 供应单位 -->
|
||||
<add key="supplierDept" value="药库" />
|
||||
<!-- 领用部门 -->
|
||||
<add key="receiveDept" value="麻精药房" />
|
||||
<!--2023/7/13 药房代码 有则写无则空 -->
|
||||
<add key="storage" value="" />
|
||||
<add key="storage" value="009902" />
|
||||
<!-- 登录模式 1单人登录2双人登录 -->
|
||||
<add key="loginMode" value="1" />
|
||||
<!-- 登录顺序,指定先登录的人的名称有效值,只有在登录模式等于2时才会生效; 发药人:【operator】审核人:【reviewer】 -->
|
||||
|
@ -28,7 +28,7 @@
|
|||
<!-- 自动退出时间,单位秒,为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 -->
|
||||
<add key="OrderNoName" value="orderNo" />
|
||||
<!-- 后门耗材板地址 没有则填写0-->
|
||||
|
@ -40,11 +40,11 @@
|
|||
<!-- 抽屉串口使用的协议232或者485 -->
|
||||
<add key="DrawerProtocol" value="485" />
|
||||
<!-- 抽屉串口的串口号 -->
|
||||
<add key="DrawerPortPath" value="COM3" />
|
||||
<add key="DrawerPortPath" value="COM2" />
|
||||
<!-- can总线串口的串口号 -->
|
||||
<add key="CanBusPortPath" value="COM9" />
|
||||
<add key="CanBusPortPath" value="COM5" />
|
||||
<!-- 条码枪串口的串口号 -->
|
||||
<add key="ScanCodePortPath" value="COM111" />
|
||||
<add key="ScanCodePortPath" value="COM11" />
|
||||
<!-- 抽屉串口的串口号 --><!--
|
||||
<add key="DrawerPortPath" value="COM11" />
|
||||
--><!-- can总线串口的串口号 --><!--
|
||||
|
@ -61,8 +61,8 @@
|
|||
<add key="fingerIp" value="192.168.50.201"/>
|
||||
<!--一个抽屉对应标签数-->
|
||||
<add key="labelCount" value="2"/>
|
||||
<!--库存盘点17号库位线程等待时间(毫秒)-->
|
||||
<add key="CheckSleepMilliseconds" value="500"/>
|
||||
<!--是否自动写标签数量-->
|
||||
<add key="AutoWriteNum" value="true"/>
|
||||
|
||||
</appSettings>
|
||||
</configuration>
|
|
@ -55,6 +55,15 @@ namespace DM_Weight
|
|||
set => _currentShenUserList = value;
|
||||
}
|
||||
#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));
|
||||
public App()
|
||||
|
@ -133,6 +142,8 @@ namespace DM_Weight
|
|||
|
||||
// 登录页面
|
||||
containerRegistry.RegisterForNavigation<LoginWindow, LoginWindowViewModel>();
|
||||
//值班柜、周转柜选择
|
||||
containerRegistry.RegisterForNavigation<BeforeLogin, BeforeLoginViewModel>();
|
||||
|
||||
// 布局页面
|
||||
containerRegistry.RegisterForNavigation<HomeWindow, HomeWindowViewModel>();
|
||||
|
@ -143,6 +154,9 @@ namespace DM_Weight
|
|||
|
||||
|
||||
#region 取药
|
||||
// 多处方取药页面
|
||||
containerRegistry.RegisterForNavigation<MultiOrderTakeDrugWindow, MultiOrderTakeDrugWindowViewModel>();
|
||||
containerRegistry.RegisterForNavigation<MultiOrderTakeDialog, MultiOrderTakeDialogViewModel>();
|
||||
// 处方取药页面
|
||||
containerRegistry.RegisterForNavigation<OrderTakeDrugWindow, OrderTakeDrugWindowViewModel>();
|
||||
// 处方取药模态框
|
||||
|
@ -225,6 +239,8 @@ namespace DM_Weight
|
|||
containerRegistry.RegisterForNavigation<DrugListWindow, DrugListWindowViewModel>();
|
||||
//库存列表导出账册弹窗
|
||||
containerRegistry.RegisterForNavigation<StockListAccountDialog, StockListAccountDialogViewModel>();
|
||||
//账册
|
||||
containerRegistry.RegisterForNavigation<SpecialAccountWindow, SpecialAccountWindowViewModel>();
|
||||
#endregion
|
||||
|
||||
#region 系统设置
|
||||
|
@ -252,17 +268,19 @@ namespace DM_Weight
|
|||
//交接班记录
|
||||
containerRegistry.RegisterForNavigation<ChangeShiftsListWindow, ChangeShiftsListWindowViewModel>();
|
||||
|
||||
containerRegistry.RegisterForNavigation<PrintPdfView, PrintPdfViewModel>();
|
||||
|
||||
|
||||
//交接班
|
||||
containerRegistry.RegisterForNavigation<ChangeShiftsDialog, ChangeShiftsDialogViewModel>();
|
||||
|
||||
//containerRegistry.RegisterSingleton<SqlSugarScope>(() => SqlSugarHelperNew.GetInstance());
|
||||
containerRegistry.RegisterSingleton<SqlSugarScope>(() => SqlSugarHelperNew.GetInstance());
|
||||
|
||||
//账册页面
|
||||
containerRegistry.RegisterForNavigation<AccountWindow,AccountWindowViewModel>();
|
||||
//账册服务类
|
||||
containerRegistry.Register<MachineRecordService>();
|
||||
|
||||
containerRegistry.RegisterForNavigation<EmptyWindow, EmptyWindowViewModel>();
|
||||
}
|
||||
|
||||
private void PrismApplication_Startup(object sender, StartupEventArgs e)
|
||||
|
|
|
@ -1,41 +1,37 @@
|
|||
using DM_Weight.Models;
|
||||
using System;
|
||||
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;
|
||||
using System.Windows.Media;
|
||||
|
||||
namespace DM_Weight.Converter
|
||||
{
|
||||
internal class ColorCountConverter : IValueConverter
|
||||
internal class DrawerAuthorityConverter : IValueConverter
|
||||
{
|
||||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
var total = 0;
|
||||
bool bInt = int.TryParse(value.ToString(), out var count); if (bInt)
|
||||
if (value != null && value.ToString().Equals("1"))
|
||||
{
|
||||
if (count <= 0)
|
||||
{
|
||||
return "Red";
|
||||
}
|
||||
else
|
||||
{
|
||||
return "black";
|
||||
}
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return "black";
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
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;
|
||||
}
|
||||
}
|
||||
//“导出处方登记专册” 按钮是否显示
|
||||
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;
|
||||
}
|
||||
|
||||
|
|
|
@ -76,6 +76,29 @@ namespace DM_Weight.Converter
|
|||
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;
|
||||
}
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
<PackageIcon></PackageIcon>
|
||||
<Product>毒麻管理程序</Product>
|
||||
<ApplicationIcon>Images\favicon.ico</ApplicationIcon>
|
||||
<Platforms>AnyCPU;x64</Platforms>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
@ -69,9 +70,7 @@
|
|||
<PackageReference Include="log4net" Version="2.0.15" />
|
||||
<PackageReference Include="MaterialDesignThemes" Version="4.8.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="8.0.0" />
|
||||
<PackageReference Include="Microsoft.Web.WebView2" Version="1.0.2365.46" />
|
||||
<PackageReference Include="Microsoft.Xaml.Behaviors.Wpf" Version="1.1.39" />
|
||||
<PackageReference Include="MySqlConnector" Version="2.3.6" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.2" />
|
||||
<PackageReference Include="Prism.Unity" Version="8.1.97" />
|
||||
<PackageReference Include="SqlSugarCore" Version="5.1.4.67" />
|
||||
|
@ -103,6 +102,18 @@
|
|||
<None Update="log4net.config">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</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">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
|
@ -112,6 +123,9 @@
|
|||
<None Update="ReportTemp\changeShifts_temp.grf">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="ReportTemp\changeShifts_temp_new.grf">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="ReportTemp\machine_log_check.grf">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
|
@ -130,6 +144,9 @@
|
|||
<None Update="ReportTemp\machine_log_take.grf">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="ReportTemp\return_empty.grf">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="ReportTemp\stock_template.grf">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</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
|
||||
///</summary>
|
||||
[SugarColumn(ColumnName = "state")]
|
||||
[SugarColumn(ColumnName = "dm_state")]
|
||||
public int? State { get; set; }
|
||||
|
||||
[SugarColumn(IsIgnore = true)]
|
||||
|
|
|
@ -73,8 +73,6 @@ namespace DM_Weight.Models
|
|||
[SugarColumn(ColumnName = "quantity")]
|
||||
public int Quantity { get; set; }
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// 默认值: 1
|
||||
|
@ -94,6 +92,12 @@ namespace DM_Weight.Models
|
|||
[SugarColumn(ColumnName = "state")]
|
||||
public int? State { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 入库时间:针对先入先出操作
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "fill_time")]
|
||||
public DateTime? FillTime { get; set; }
|
||||
|
||||
[SugarColumn(IsIgnore = true)]
|
||||
public bool IsSelected { get; set; }
|
||||
|
||||
|
@ -112,19 +116,9 @@ namespace DM_Weight.Models
|
|||
get => _addQuantity;
|
||||
set
|
||||
{
|
||||
if (value < 0)
|
||||
{
|
||||
throw new ArgumentException("加药数量不能小于0");
|
||||
}
|
||||
SetProperty(ref _addQuantity, value);
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 调拨入库数量
|
||||
/// </summary>
|
||||
private int _invoiceQuantity;
|
||||
[SugarColumn(IsIgnore =true)]
|
||||
public int InvoiceQuantity { get=>_invoiceQuantity; set=>SetProperty(ref _invoiceQuantity, value); }
|
||||
|
||||
private int _takeQuantity = 0;
|
||||
|
||||
|
@ -138,29 +132,9 @@ namespace DM_Weight.Models
|
|||
{
|
||||
throw new ArgumentException("取药数量不能大于库存");
|
||||
}
|
||||
if(value< 0)
|
||||
{
|
||||
throw new ArgumentException("取药数量不能小于0");
|
||||
}
|
||||
if(OrderQuantity>0&&value>OrderQuantity)
|
||||
{
|
||||
throw new ArgumentException("取药数量不能大于应取数量");
|
||||
}
|
||||
SetProperty(ref _takeQuantity, value);
|
||||
}
|
||||
}
|
||||
|
||||
private int _orderQuantity = 0;
|
||||
/// <summary>
|
||||
/// 处方取药数量
|
||||
/// </summary>
|
||||
[SugarColumn(IsIgnore =true)]
|
||||
public int OrderQuantity
|
||||
{
|
||||
get => _orderQuantity;
|
||||
set=>SetProperty(ref _orderQuantity, value);
|
||||
}
|
||||
|
||||
//private string _tipMessage=string.Empty;
|
||||
//[SugarColumn(IsIgnore = true)]
|
||||
//public string TipMessage
|
||||
|
|
|
@ -57,11 +57,21 @@ namespace DM_Weight.Models
|
|||
[SugarColumn(ColumnName = "dosage")]
|
||||
public string Dosage { get; set; }
|
||||
/// <summary>
|
||||
/// <20><>װ<EFBFBD><D7B0>λ
|
||||
/// <20><>װ<EFBFBD><D7B0>λ packUnit这个字段不用了,用bigUnit,smallUnit那2个字段
|
||||
///</summary>
|
||||
[SugarColumn(ColumnName = "pack_unit")]
|
||||
public string PackUnit { get; set; }
|
||||
/// <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>
|
||||
///</summary>
|
||||
[SugarColumn(ColumnName = "manufactory")]
|
||||
|
@ -83,7 +93,11 @@ namespace DM_Weight.Models
|
|||
|
||||
[SugarColumn(IsIgnore = true)]
|
||||
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))]
|
||||
public UserList User { get; set; }
|
||||
|
||||
[Navigate(NavigateType.ManyToOne, nameof(InvoiceId))]
|
||||
public OrderInfo orderInfo { get; set; }
|
||||
/// <summary>
|
||||
/// 审核人id
|
||||
///</summary>
|
||||
|
@ -72,7 +75,7 @@ namespace DM_Weight.Models
|
|||
[SugarColumn(ColumnName = "eff_date")]
|
||||
public DateTime? EffDate { get; set; }
|
||||
/// <summary>
|
||||
/// 出库入库类型(1入库2出库31还药32还空瓶4盘点5日结存)
|
||||
/// 出库入库类型(1入库 2出库 31还药 32还空瓶 4盘点 5日结存)
|
||||
///</summary>
|
||||
[SugarColumn(ColumnName = "type")]
|
||||
public int Type { get; set; }
|
||||
|
@ -106,14 +109,12 @@ namespace DM_Weight.Models
|
|||
/// 退药量
|
||||
/// 默认值: 0
|
||||
///</summary>
|
||||
//[SugarColumn(ColumnName = "return_quantity1", IsOnlyIgnoreInsert = true)]
|
||||
[SugarColumn(ColumnName = "return_quantity1")]
|
||||
public int ReturnQuantity1 { get; set; }
|
||||
/// <summary>
|
||||
/// 退空瓶量
|
||||
/// 默认值: 0
|
||||
///</summary>
|
||||
//[SugarColumn(ColumnName = "return_quantity2", IsOnlyIgnoreInsert = true
|
||||
[SugarColumn(ColumnName = "return_quantity2")]
|
||||
public int ReturnQuantity2 { get; set; }
|
||||
/// <summary>
|
||||
|
@ -155,5 +156,20 @@ namespace DM_Weight.Models
|
|||
/// </summary>
|
||||
[SugarColumn(ColumnName = "receiveDept")]
|
||||
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
|
||||
///</summary>
|
||||
//[SugarColumn(ColumnName = "order_id")]
|
||||
//public int? OrderId { get; set; }
|
||||
[SugarColumn(ColumnName = "order_id")]
|
||||
public int? OrderId { get; set; }
|
||||
/// <summary>
|
||||
///
|
||||
///</summary>
|
||||
|
@ -128,9 +128,10 @@ namespace DM_Weight.Models
|
|||
[SugarColumn(ColumnName = "use_dosage")]
|
||||
public string UseDosage { get; set; }
|
||||
/// <summary>
|
||||
/// 处方中该药品状态是否已全部取出0未取1已取(针对处方可取部分药)
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "dm_status")]
|
||||
public int? DMStatus { get;set; }
|
||||
/// 药品状态0未取1已取
|
||||
/// 默认值: 0
|
||||
///</summary>
|
||||
[SugarColumn(ColumnName = "detail_status")]
|
||||
public int? DetailStatus { get; set; }
|
||||
}
|
||||
}
|
|
@ -10,10 +10,16 @@ namespace DM_Weight.Models
|
|||
[SugarTable("order_info")]
|
||||
public class OrderInfo
|
||||
{
|
||||
/// <summary>
|
||||
/// 是否选中
|
||||
/// </summary>
|
||||
[SugarColumn(IsIgnore = true)]
|
||||
public bool ItemIsChecked { get; set; }
|
||||
/// <summary>
|
||||
///
|
||||
///</summary>
|
||||
[SugarColumn(ColumnName = "order_id", IsPrimaryKey = true, IsIdentity = true)]
|
||||
/////</summary>
|
||||
//[SugarColumn(ColumnName = "order_id", IsPrimaryKey = true, IsIdentity = true)]
|
||||
[SugarColumn(ColumnName = "order_id")]
|
||||
public int OrderId { get; set; }
|
||||
/// <summary>
|
||||
///
|
||||
|
@ -24,7 +30,7 @@ namespace DM_Weight.Models
|
|||
/// <summary>
|
||||
///
|
||||
///</summary>
|
||||
[SugarColumn(ColumnName = "order_no")]
|
||||
[SugarColumn(ColumnName = "order_no", IsPrimaryKey = true, IsIdentity = true)]
|
||||
public string OrderNo { get; set; }
|
||||
/// <summary>
|
||||
///
|
||||
|
|
|
@ -36,5 +36,22 @@ namespace DM_Weight.Models
|
|||
///</summary>
|
||||
[SugarColumn(ColumnName="machine_id" )]
|
||||
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")]
|
||||
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
|
||||
{
|
||||
Thread.Sleep(200);
|
||||
// 灯在闪烁继续监听状态
|
||||
GetBackDoorState();
|
||||
}
|
||||
|
@ -581,6 +582,7 @@ namespace DM_Weight.Port
|
|||
});
|
||||
logger.Info($"储物箱打开成功");
|
||||
}
|
||||
Thread.Sleep(100);
|
||||
// 灯在闪烁继续监听状态
|
||||
GetBackDoorState();
|
||||
}
|
||||
|
@ -698,7 +700,7 @@ namespace DM_Weight.Port
|
|||
while (_length != length && end.Subtract(start).TotalMilliseconds < timeout)
|
||||
{
|
||||
_length = serialPort.BytesToRead;
|
||||
if (_length == 0&& operation.Equals("开储物箱"))
|
||||
if (_length == 0 && operation.Equals("开储物箱"))
|
||||
{
|
||||
|
||||
_length = serialPort.BytesToRead;
|
||||
|
@ -710,6 +712,13 @@ namespace DM_Weight.Port
|
|||
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;
|
||||
}
|
||||
if (_length != length)
|
||||
|
@ -815,7 +824,7 @@ namespace DM_Weight.Port
|
|||
byte[] buffer = new byte[] { 0xaa, (byte)(_doorAddr), 0x02, 0x00, 0x00, 0x00, 0x00, 0xee };
|
||||
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寸汉显屏
|
||||
// 基础数据写入方法
|
||||
//三色灯写标签type:1药品名称;2规格;5批次;6效期;8厂家
|
||||
public void WriteChannelInfo(int type, string content, int drawerNo, int colNo)
|
||||
{
|
||||
try
|
||||
|
@ -1041,8 +1051,10 @@ namespace DM_Weight.Port
|
|||
Array.Resize(ref contentBuf, contentBuf.Length + 1);
|
||||
}
|
||||
byte[] buffer = new byte[] { 0xaa, (byte)channel, 1, (byte)type, 0, 0, 0, 0xee };
|
||||
logger.Info($"buffer:{Convert.ToHexString(buffer)}");
|
||||
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);
|
||||
Thread.Sleep(20);
|
||||
buffer[4] = 1;
|
||||
|
@ -1051,7 +1063,9 @@ namespace DM_Weight.Port
|
|||
buffer[5] = contentBuf[i];
|
||||
buffer[6] = contentBuf[i + 1];
|
||||
canBusSerial.Write(buffer, 0, 8);
|
||||
logger.Info($"buffer:{Convert.ToHexString(buffer)}");
|
||||
logger.Info(Convert.ToHexString(buffer));
|
||||
//byte[] fBufferReturn = GetBufferByPort(canBusSerial, 8).Result;
|
||||
//logger.Info($"写入数量返回:" + Convert.ToHexString(fBufferReturn));
|
||||
//await Task.Delay(20);
|
||||
Thread.Sleep(20);
|
||||
}
|
||||
|
@ -1059,17 +1073,23 @@ namespace DM_Weight.Port
|
|||
buffer[5] = 0;
|
||||
buffer[6] = 0;
|
||||
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);
|
||||
Thread.Sleep(20);
|
||||
}
|
||||
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,
|
||||
WindowName = WindowName,
|
||||
Message = $"2.4寸汉显屏异常{ex.Message}"
|
||||
});
|
||||
_eventAggregator.GetEvent<PortUtilEvent>().Publish(new util.DeviceMsg()
|
||||
{
|
||||
EventType = util.EventType.OPENERROR,
|
||||
WindowName = WindowName,
|
||||
Message = $"2.4寸汉显屏异常{ex.Message}"
|
||||
});
|
||||
}));
|
||||
logger.Info($"2.4寸汉显屏异常:ex:{ex.Message}");
|
||||
}
|
||||
}
|
||||
|
@ -1091,7 +1111,6 @@ namespace DM_Weight.Port
|
|||
canBusSerial.DiscardInBuffer();
|
||||
int channel = ((drawerNo > 8 ? (drawerNo - 8) * 2 : (drawerNo * 2 - 1)) - 1) * this.labelCount + 10 + colNo;
|
||||
byte[] buffer = new byte[] { 0xaa, (byte)channel, 2, 0, 0, 0, 0, 0xee };
|
||||
logger.Info($"刷新显示内容buffer:{Convert.ToHexString(buffer)}");
|
||||
canBusSerial.Write(buffer, 0, 8);
|
||||
}
|
||||
catch (Exception ex)
|
||||
|
@ -1110,7 +1129,6 @@ namespace DM_Weight.Port
|
|||
{
|
||||
try
|
||||
{
|
||||
logger.Info($"TakeQuantity{drawerNo}-{colNo},操作数量{quantity},操作后数量{stock}");
|
||||
|
||||
canBusSerial.DiscardInBuffer();
|
||||
//int channel = (drawerNo * 10 + colNo);
|
||||
|
@ -1149,23 +1167,26 @@ namespace DM_Weight.Port
|
|||
buffer[6] = (byte)(quantity & 0xff);
|
||||
logger.Info($"写入数量buffer:{Convert.ToHexString(buffer)}");
|
||||
canBusSerial.Write(buffer, 0, 8);
|
||||
//Task<byte[]> task = GetBufferByPort(canBusSerial, 8);
|
||||
//if (task.Status == TaskStatus.Created)
|
||||
//{
|
||||
// task.Start();
|
||||
Task<byte[]> task = GetBufferByPort(canBusSerial, 8);
|
||||
if (task.Status == TaskStatus.Created)
|
||||
{
|
||||
task.Start();
|
||||
|
||||
//}
|
||||
//byte[] bytes = task.Result;
|
||||
//logger.Info($"写入数量返回:" + Convert.ToHexString(bytes));
|
||||
}
|
||||
byte[] bytes = task.Result;
|
||||
logger.Info($"写入数量返回:" + Convert.ToHexString(bytes));
|
||||
}
|
||||
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,
|
||||
WindowName = WindowName,
|
||||
Message = $"操作发生异常{ex.InnerException}"
|
||||
});
|
||||
_eventAggregator.GetEvent<PortUtilEvent>().Publish(new util.DeviceMsg()
|
||||
{
|
||||
EventType = util.EventType.OPENERROR,
|
||||
WindowName = WindowName,
|
||||
Message = $"操作发生异常{ex.InnerException}"
|
||||
});
|
||||
}));
|
||||
logger.Info($"操作发生异常:ex:{ex.InnerException}");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,11 +9,9 @@ using System.Threading.Tasks;
|
|||
using DM_Weight.Models;
|
||||
using System.Configuration;
|
||||
using DM_Weight.util;
|
||||
using DM_Weight.Views;
|
||||
using System.Diagnostics;
|
||||
using log4net;
|
||||
using log4net.Repository.Hierarchy;
|
||||
using DM_Weight.ViewModels;
|
||||
using System.Data;
|
||||
using MySqlConnector;
|
||||
using System.Windows.Markup;
|
||||
|
||||
namespace DM_Weight.Report
|
||||
{
|
||||
|
@ -50,28 +48,23 @@ namespace DM_Weight.Report
|
|||
});
|
||||
string machine_id = (ConfigurationManager.AppSettings["machineId"] ?? "DM1");
|
||||
string SQL = $@"SELECT cl.`row_no` AS drawerNo,cl.`col_no` AS colNo,cl.`quantity` AS quantity,cl.`manu_no` AS manuNo,cl.`eff_date` AS effDate,
|
||||
di.`drug_name` AS drugName,di.`drug_spec` AS drugSpec,di.`pack_unit` AS packUnit,di.`manufactory` AS manuFactory,di.`max_stock` AS baseQuantity,
|
||||
cl.`drug_id` AS drugId FROM channel_stock cl INNER JOIN drug_info di ON di.`drug_id` = cl.`drug_id` WHERE cl.`machine_id` = '{machine_id}' AND cl.`drawer_type` = 1 ORDER BY cl.`drug_id`";
|
||||
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 ";
|
||||
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.DetailGrid.Recordset.ConnectionString = gridConnectionString;
|
||||
Report.DetailGrid.Recordset.QuerySQL = SQL;
|
||||
//Report.PrintPreview(true);
|
||||
string filePath = AppDomain.CurrentDomain.BaseDirectory + "ReportTemp//" + "stock_template.pdf";
|
||||
if (File.Exists(filePath))
|
||||
{
|
||||
try
|
||||
{
|
||||
|
||||
File.Delete(filePath);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
FindAndKillProcess();
|
||||
|
||||
}
|
||||
}
|
||||
Report.ExportDirect(GRExportType.gretPDF, filePath, false, true);
|
||||
Report.PrintPreview(true);
|
||||
}
|
||||
/// <summary>
|
||||
/// 导出盘点后库存信息
|
||||
|
@ -90,62 +83,13 @@ namespace DM_Weight.Report
|
|||
//});
|
||||
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,
|
||||
`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`";
|
||||
// 加载模板文件
|
||||
Report.LoadFromFile(new FileInfo(AppDomain.CurrentDomain.BaseDirectory) + "ReportTemp//" + "machine_log_check_new2.grf");
|
||||
Report.DetailGrid.Recordset.ConnectionString = gridConnectionString;
|
||||
Report.DetailGrid.Recordset.QuerySQL = SQL;
|
||||
// Report.PrintPreview(true);
|
||||
|
||||
string filePath = AppDomain.CurrentDomain.BaseDirectory + "ReportTemp//" + "machine_log_check_new2.pdf";
|
||||
if (File.Exists(filePath))
|
||||
{
|
||||
try
|
||||
{
|
||||
|
||||
File.Delete(filePath);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
FindAndKillProcess();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Report.ExportDirect(GRExportType.gretPDF, filePath, false, true);
|
||||
}
|
||||
public static Task<string> PrintReportStockNewTest(DateTime? startDate, DateTime? endDate)
|
||||
{
|
||||
return Task.Run(() =>
|
||||
{
|
||||
string filePath = string.Empty;
|
||||
DateTime? p_startDate = startDate ?? Convert.ToDateTime("2010-1-1");
|
||||
DateTime? p_endDate = endDate ?? DateTime.Now.AddDays(1);
|
||||
// 定义Grid++Report报表主对象
|
||||
GridppReport Report = new GridppReport();
|
||||
//Report.Initialize += new _IGridppReportEvents_InitializeEventHandler(() =>
|
||||
//{
|
||||
// Report.ParameterByName("machine_id").Value = (ConfigurationManager.AppSettings["machineId"] ?? "DM1");
|
||||
//});
|
||||
string machine_id = (ConfigurationManager.AppSettings["machineId"] ?? "DM1");
|
||||
string SQL = $@"SELECT cl.`row_no` AS drawerNo,cl.`col_no` AS colNo,cl.`quantity` AS quantity,cl.`manu_no` AS manuNo,cl.`eff_date` AS effDate,
|
||||
`drug_name` AS drugName,`drug_spec` AS drugSpec,`pack_unit` AS packUnit,`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`";
|
||||
// 加载模板文件
|
||||
Report.LoadFromFile(new FileInfo(AppDomain.CurrentDomain.BaseDirectory) + "ReportTemp//" + "machine_log_check_new2.grf");
|
||||
Report.DetailGrid.Recordset.ConnectionString = gridConnectionString;
|
||||
Report.DetailGrid.Recordset.QuerySQL = SQL;
|
||||
// Report.PrintPreview(true);
|
||||
//Report.SaveToFile(new FileInfo(AppDomain.CurrentDomain.BaseDirectory) + "ReportTemp//" + "Test.pdf");
|
||||
bool isSave = Report.ExportDirect(GRExportType.gretPDF, new FileInfo(AppDomain.CurrentDomain.BaseDirectory) + "ReportTemp//" + "machine_log_check_new2.pdf", false, false);
|
||||
|
||||
if (isSave)
|
||||
{
|
||||
filePath = AppDomain.CurrentDomain.BaseDirectory + "ReportTemp\\" + "machine_log_check_new2.pdf";
|
||||
}
|
||||
return filePath;
|
||||
});
|
||||
Report.PrintPreview(true);
|
||||
}
|
||||
public static void PrintReportAccountBook(DateTime? startDate, DateTime? endDate, int type, string drug_id)
|
||||
{
|
||||
|
@ -165,13 +109,12 @@ namespace DM_Weight.Report
|
|||
Report.ParameterByName("endDate").Value = endDate ?? DateTime.Now.AddDays(1);
|
||||
});
|
||||
//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
|
||||
(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`, IF(mr.`type` = 5,mr.return_quantity1,0))) AS `inQuantity`,
|
||||
IF(mr.`type` = 2, mr.`quantity`, IF(mr.`type` = 4 AND mr.`quantity` < 0, (0 - mr.`quantity`), IF(mr.`type` = 5,mr.return_quantity2,0))) AS `outQuantity`,
|
||||
mr.`operation_time` AS `operationTime`,IF(mr.`type`=1||mr.type=5,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`,
|
||||
(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`,
|
||||
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 FROM
|
||||
dm_machine_record mr LEFT JOIN drug_info di ON mr.`drug_id` = di.`drug_id` LEFT JOIN user_list u1 ON mr.`operator` = u1.`id`
|
||||
LEFT JOIN user_list u2 ON mr.`reviewer` = u2.`id` WHERE mr.`machine_id` = '{p_machine_id}' AND mr.`operation_time` > '{p_startDate}'
|
||||
|
@ -197,27 +140,12 @@ namespace DM_Weight.Report
|
|||
}
|
||||
}
|
||||
Report.DetailGrid.Recordset.QuerySQL = SQL;
|
||||
//Report.PrintPreview(true);
|
||||
string filePath = AppDomain.CurrentDomain.BaseDirectory + "ReportTemp//" + "account_book_temp.pdf";
|
||||
if (File.Exists(filePath))
|
||||
{
|
||||
try
|
||||
{
|
||||
|
||||
File.Delete(filePath);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
FindAndKillProcess();
|
||||
|
||||
}
|
||||
}
|
||||
Report.ExportDirect(GRExportType.gretPDF, filePath, false, true);
|
||||
Report.PrintPreview(true);
|
||||
}
|
||||
|
||||
public static void PrintReportMechineRecord(int type, DateTime? startDate, DateTime? endDate)
|
||||
{
|
||||
string saveFileName = string.Empty;
|
||||
// 定义Grid++Report报表主对象
|
||||
GridppReport Report = new GridppReport();
|
||||
DateTime? p_startDate = startDate ?? Convert.ToDateTime("2010-1-1");
|
||||
|
@ -233,11 +161,10 @@ namespace DM_Weight.Report
|
|||
// 加载模板文件
|
||||
if (type == 1)
|
||||
{
|
||||
saveFileName = "machine_log_add.pdf";
|
||||
Report.LoadFromFile(new FileInfo(AppDomain.CurrentDomain.BaseDirectory) + "ReportTemp//" + "machine_log_add.grf");
|
||||
SQL = $@"SELECT dmr.`drawer_no` AS drawerNo,dmr.`col_no` AS colNo,dmr.`type` AS `type`,dmr.`quantity` AS quantity,
|
||||
dmr.`manu_no` AS manuNo,dmr.`eff_date` AS effDate,dmr.`operation_time` AS operationTime,
|
||||
di.`drug_name` AS drugName,di.`drug_spec` AS drugSpec,di.`pack_unit` AS packUnit,
|
||||
di.`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,
|
||||
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}'
|
||||
|
@ -245,12 +172,10 @@ namespace DM_Weight.Report
|
|||
}
|
||||
else if (type == 2)
|
||||
{
|
||||
|
||||
saveFileName = "machine_log_take.pdf";
|
||||
Report.LoadFromFile(new FileInfo(AppDomain.CurrentDomain.BaseDirectory) + "ReportTemp//" + "machine_log_take.grf");
|
||||
SQL = $@" SELECT dmr.`drawer_no` AS drawerNo,dmr.`col_no` AS colNo,dmr.`type` AS `type`,dmr.`quantity` AS quantity,
|
||||
dmr.`manu_no` AS manuNo,dmr.`eff_date` AS effDate,dmr.`operation_time` AS operationTime,
|
||||
di.`drug_name` AS drugName,di.`drug_spec` AS drugSpec,di.`pack_unit` AS packUnit,
|
||||
di.`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,
|
||||
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
|
||||
|
@ -259,13 +184,11 @@ namespace DM_Weight.Report
|
|||
}
|
||||
else if (type == 3)
|
||||
{
|
||||
|
||||
saveFileName = "machine_log_return.pdf";
|
||||
Report.LoadFromFile(new FileInfo(AppDomain.CurrentDomain.BaseDirectory) + "ReportTemp//" + "machine_log_return.grf");
|
||||
SQL = $@" SELECT dmr.`drawer_no` AS drawerNo,dmr.`col_no` AS colNo,dmr.`type` AS `type`,
|
||||
CONCAT(dmr.`quantity`,IF(dmr.`type`=32,""(空瓶)"","""")) AS quantity,dmr.`manu_no` AS manuNo,
|
||||
dmr.`eff_date` AS effDate,dmr.`operation_time` AS operationTime,di.`drug_name` AS drugName,
|
||||
di.`drug_spec` AS drugSpec,di.`pack_unit` AS packUnit,
|
||||
di.`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,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`
|
||||
|
@ -274,11 +197,10 @@ namespace DM_Weight.Report
|
|||
}
|
||||
else
|
||||
{
|
||||
saveFileName = "machine_log_check.pdf";
|
||||
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,
|
||||
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,
|
||||
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`
|
||||
|
@ -291,37 +213,10 @@ namespace DM_Weight.Report
|
|||
Report.DetailGrid.Recordset.ConnectionString = gridConnectionString;
|
||||
Report.DetailGrid.Recordset.QuerySQL = SQL;
|
||||
|
||||
//Report.PrintPreview(true);
|
||||
string filePath = AppDomain.CurrentDomain.BaseDirectory + "ReportTemp//" + saveFileName;
|
||||
if (File.Exists(filePath))
|
||||
{
|
||||
try
|
||||
{
|
||||
|
||||
File.Delete(filePath);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
FindAndKillProcess();
|
||||
|
||||
}
|
||||
}
|
||||
Report.ExportDirect(GRExportType.gretPDF, filePath, false, true);
|
||||
Report.PrintPreview(true);
|
||||
}
|
||||
|
||||
public static bool FindAndKillProcess()
|
||||
{
|
||||
foreach (Process clsProcess in Process.GetProcesses())
|
||||
{
|
||||
if (clsProcess.ProcessName.Contains("wps")||clsProcess.ProcessName.Contains("msedge"))
|
||||
{
|
||||
clsProcess.Kill();
|
||||
//return true;
|
||||
}
|
||||
}
|
||||
//process not found, return false
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 打印预览
|
||||
|
@ -337,22 +232,7 @@ namespace DM_Weight.Report
|
|||
|
||||
// 加载数据
|
||||
Report.ParameterByName("type").AsInteger = 1;
|
||||
//Report.PrintPreview(true);
|
||||
string filePath = AppDomain.CurrentDomain.BaseDirectory + "ReportTemp//" + "machine_log.pdf";
|
||||
if (File.Exists(filePath))
|
||||
{
|
||||
try
|
||||
{
|
||||
|
||||
File.Delete(filePath);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
FindAndKillProcess();
|
||||
|
||||
}
|
||||
}
|
||||
Report.ExportDirect(GRExportType.gretPDF, filePath, false, true);
|
||||
Report.PrintPreview(true);
|
||||
}
|
||||
//交接班记录报表
|
||||
public static void PrintChangeShiftsReport(DateTime? startDate, DateTime? endDate)
|
||||
|
@ -363,7 +243,8 @@ namespace DM_Weight.Report
|
|||
// 定义Grid++Report报表主对象
|
||||
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;
|
||||
Report.DetailGrid.Recordset.ConnectionString = gridConnectionString;
|
||||
Report.Initialize += new _IGridppReportEvents_InitializeEventHandler(() =>
|
||||
|
@ -373,27 +254,11 @@ namespace DM_Weight.Report
|
|||
Report.ParameterByName("endDate").Value = endDate ?? DateTime.Now.AddDays(1);
|
||||
});
|
||||
SQL = $@"SELECT opt_date,drug_name,drug_spec,beforenum,getnum,usenum,manu_no,surplus,CONCAT(fromoperator,' ',fromreviewer) as fromoperator,
|
||||
CONCAT(tooperator,' ',toreviewer) as tooperator
|
||||
CONCAT(tooperator,' ',toreviewer) as tooperator,pack_unit,stockQuantity,emptyQuantity
|
||||
from `hkc_shiftsreport` WHERE `machineid` = '{p_machine_id}' AND `opt_date` > '{p_startDate}'
|
||||
AND opt_date < '{p_endDate}' ORDER BY opt_date";
|
||||
Report.DetailGrid.Recordset.QuerySQL = SQL;
|
||||
//Report.PrintPreview(true);
|
||||
string filePath = AppDomain.CurrentDomain.BaseDirectory + "ReportTemp//" + "changeShifts_temp.pdf";
|
||||
if (File.Exists(filePath))
|
||||
{
|
||||
try
|
||||
{
|
||||
|
||||
File.Delete(filePath);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
FindAndKillProcess();
|
||||
|
||||
}
|
||||
}
|
||||
Report.ExportDirect(GRExportType.gretPDF, filePath, false, true);
|
||||
|
||||
Report.PrintPreview(true);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -413,22 +278,402 @@ namespace DM_Weight.Report
|
|||
string str = JsonConvert.SerializeObject(records);
|
||||
Report.LoadDataFromXML(str);
|
||||
// 加载数据
|
||||
//Report.PrintPreview(true);
|
||||
string filePath = AppDomain.CurrentDomain.BaseDirectory + "ReportTemp//" + "machine_log_check.pdf";
|
||||
if (File.Exists(filePath))
|
||||
{
|
||||
try
|
||||
{
|
||||
|
||||
File.Delete(filePath);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
FindAndKillProcess();
|
||||
|
||||
}
|
||||
}
|
||||
Report.ExportDirect(GRExportType.gretPDF, filePath, false, 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
|
||||
}
|
||||
]
|
||||
}
|
|
@ -166,9 +166,7 @@
|
|||
"ColumnContentCell":[
|
||||
{
|
||||
"Column":"日期",
|
||||
"WordWrap":true,
|
||||
"TextAlign":"MiddleCenter",
|
||||
"ShrinkFontToFit":true,
|
||||
"DataField":"日期"
|
||||
},
|
||||
{
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -91,7 +91,6 @@
|
|||
"ColumnContentCell":[
|
||||
{
|
||||
"Column":"盘点日期",
|
||||
"WordWrap":true,
|
||||
"DataField":"盘点日期"
|
||||
},
|
||||
{
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -23,7 +23,7 @@ namespace DM_Weight.Services
|
|||
string SQL = $@"SELECT CS.drug_id as DrugId,CS.manu_no as ManuNo,sum(quantity) as Quantity,CS.eff_date as EffDate,DI.drug_name as DrugName,
|
||||
DI.drug_spec as DrugSpec,DI.dosage as Dosage,DI.manufactory as ManuFactory,DI.small_unit as SmallUnit,DI.pack_unit as PackUnit,
|
||||
CS.machine_id as MachineId FROM channel_stock CS
|
||||
INNER JOIN drug_info DI ON CS.drug_id=DI.drug_id where CS.machine_id='{p_machine_id}' AND quantity>0 GROUP BY CS.drug_id";//,CS.manu_no ";
|
||||
INNER JOIN drug_info DI ON CS.drug_id=DI.drug_id where CS.machine_id='{p_machine_id}' AND quantity>0 GROUP BY CS.drug_id,CS.manu_no ";
|
||||
|
||||
List<ChannelStockCount> accountList = SqlSugarHelper.Db.SqlQueryable<ChannelStockCount>(SQL).ToList();
|
||||
//List<ChannelStock> accountList = SqlSugarHelper.Db.Queryable<ChannelStock>().Includes<DrugInfo>(cs=>cs.DrugInfo)
|
||||
|
|
|
@ -30,13 +30,18 @@ namespace DM_Weight.Services
|
|||
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,
|
||||
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`, IF(mr.`type` = 5,mr.return_quantity1,0)))
|
||||
AS `inQuantity`, IF(mr.`type` = 2, mr.`quantity`, IF(mr.`type` = 4 AND mr.`quantity` < 0, (0 - mr.`quantity`), IF(mr.`type` = 5,mr.return_quantity2,0))) AS `outQuantity`,
|
||||
DATE_FORMAT(mr.`operation_time`,'%m/%d') AS `operationTime`,IF(mr.`type`=1||mr.type=5,mr.`invoice_id`,NULL) AS `invoiceId`, di.`drug_name` AS `drugName`, di.`drug_id` AS `drugId`,
|
||||
(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`,
|
||||
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`,
|
||||
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
|
||||
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 ";
|
||||
if (!string.IsNullOrEmpty(drug_id))
|
||||
{
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
using DM_Weight.Models;
|
||||
using log4net;
|
||||
using log4net.Repository.Hierarchy;
|
||||
using MySqlConnector;
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
|
@ -8,98 +6,49 @@ using System.Collections.Generic;
|
|||
using System.Configuration;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace DM_Weight.Services
|
||||
{
|
||||
public class UserService
|
||||
{
|
||||
private readonly ILog logger = LogManager.GetLogger(typeof(UserService));
|
||||
//public static string connStr = ConfigurationManager.AppSettings["database"].ToString();
|
||||
public static string connStr = ConfigurationManager.ConnectionStrings["database"].ToString();
|
||||
public UserList CheckUserByFingerPrinter(int fingerPrinterId)
|
||||
public UserList CheckUserByFingerPrinter(int fingerPrinterId)
|
||||
{
|
||||
UserList? user = null;
|
||||
|
||||
using (MySqlConnection con = new MySqlConnection(connStr))
|
||||
{
|
||||
logger.Info($"connStr:{connStr}");
|
||||
//try
|
||||
//{
|
||||
// con.Open();
|
||||
//}
|
||||
//catch (Exception ex)
|
||||
//{
|
||||
// logger.Info($"Open失败:{ex.ToString()}");
|
||||
// if (con.State == System.Data.ConnectionState.Open)
|
||||
// {
|
||||
// con.Close();
|
||||
// }
|
||||
// Thread.Sleep(200);
|
||||
// logger.Info("再次Open");
|
||||
// con.Open();
|
||||
//}
|
||||
connOpen(con);
|
||||
Thread.Sleep(100);
|
||||
while(con.State != System.Data.ConnectionState.Open)
|
||||
{
|
||||
logger.Info($"再次Open:{con.State}");
|
||||
connOpen(con);
|
||||
Thread.Sleep(100);
|
||||
}
|
||||
|
||||
logger.Info("数据库连接已打开");
|
||||
con.Open();
|
||||
string sql = @"select ul.id as id,ul.User_name as userName,r.id,r.role_name,r.permissions,r.machine_id from user_list ul
|
||||
INNER JOIN role r on ul.machine_role_id=r.id where ul.Id=@ID and ul.machine_id=@machine_id and r.machine_id=@machine_id;";
|
||||
MySqlCommand cmd = new MySqlCommand(sql, con);
|
||||
cmd.Parameters.Clear();
|
||||
MySqlParameter[] mySqlParameter = new MySqlParameter[] { new MySqlParameter("ID", fingerPrinterId), new MySqlParameter("machine_id", (ConfigurationManager.AppSettings["machineId"] ?? "DM1")) };
|
||||
MySqlParameter[] mySqlParameter = new MySqlParameter[] {new MySqlParameter("ID", fingerPrinterId),new MySqlParameter("machine_id", (ConfigurationManager.AppSettings["machineId"] ?? "DM1")) };
|
||||
cmd.Parameters.AddRange(mySqlParameter);
|
||||
//执行语句
|
||||
MySqlDataReader reader = cmd.ExecuteReader();
|
||||
logger.Info("MySqlDataReader读数据");
|
||||
while (reader.Read())
|
||||
{
|
||||
user = new UserList();
|
||||
user.Id = reader.GetInt32("id");
|
||||
user.UserName = reader["userName"] is DBNull ? "" : reader.GetString("userName");
|
||||
//user.UserName = reader["id"] is DBNull ? "" : reader.GetString("id");
|
||||
user.Nickname = reader["userName"] is DBNull ? "" : reader.GetString("userName");
|
||||
user.Nickname= reader["userName"] is DBNull ? "" : reader.GetString("userName");
|
||||
user.MachineId = reader["machine_id"] is DBNull ? "" : reader.GetString("machine_id");
|
||||
RoleDm role = new RoleDm();
|
||||
role.Id = reader.GetInt32("id");
|
||||
RoleDm role= new RoleDm();
|
||||
role.Id= reader.GetInt32("id");
|
||||
//role.Permissions = reader["permissions"] is DBNull ? "" : reader.GetString("permissions");
|
||||
role.RoleName = reader["role_name"] is DBNull ? "" : reader.GetString("role_name");
|
||||
role.Permissions = JsonConvert.DeserializeObject<List<PremissionDm>>(reader["permissions"] is DBNull ? "" : reader.GetString("permissions")); // JsonConvert.SerializeObject(reader.GetString("permissions")).ToList();
|
||||
user.Role = role;
|
||||
}
|
||||
|
||||
reader.Close();
|
||||
logger.Info($"sql:{sql}");
|
||||
|
||||
return user;
|
||||
}
|
||||
|
||||
}
|
||||
private Task connOpen(MySqlConnection con)
|
||||
{
|
||||
return Task.Run(() =>
|
||||
{
|
||||
if (con.State == System.Data.ConnectionState.Open)
|
||||
{
|
||||
con.Close();
|
||||
}
|
||||
try
|
||||
{
|
||||
con.Open();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
logger.Info($"Open失败:{ex.Message}");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -238,7 +238,7 @@ namespace DM_Weight.ViewModels
|
|||
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; //当日入库量
|
||||
|
@ -254,8 +254,9 @@ namespace DM_Weight.ViewModels
|
|||
|
||||
for (int i = 0; i < channelStockList.Count; i++)
|
||||
{
|
||||
int Count = accountList.Where(cs => cs.DrugId == channelStockList[i].DrugId).Count();
|
||||
|
||||
string drugId = channelStockList[i].DrugId;
|
||||
int Count = accountList.Where(cs => cs.DrugId == drugId).Count();
|
||||
|
||||
if (Count <= 0)
|
||||
{
|
||||
inQuantity = 0;
|
||||
|
@ -263,12 +264,12 @@ namespace DM_Weight.ViewModels
|
|||
}
|
||||
else
|
||||
{
|
||||
inQuantity = accountList.Where(cs => cs.DrugId == channelStockList[i].DrugId).Sum(cs => cs.InQuantity);
|
||||
outQuantity= accountList.Where(cs => cs.DrugId == channelStockList[i].DrugId).Sum(cs => cs.OutQuantity);
|
||||
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(channelStockList[i].DrugId)).Sum(it => it.Quantity);
|
||||
.Where(cs => cs.DrugId.Equals(drugId)).Sum(it => it.Quantity);
|
||||
//没有直接插入
|
||||
// 保存数据 出/入库记录
|
||||
string InvoiceId = "Account_" + CurrentTimeMillis();
|
||||
|
@ -277,7 +278,7 @@ namespace DM_Weight.ViewModels
|
|||
MachineId = channelStockList[i].MachineId,
|
||||
DrawerNo = 0,//channelStockList[i].DrawerNo,
|
||||
ColNo = 0,// channelStockList[i].ColNo,FV
|
||||
DrugId = channelStockList[i].DrugId,
|
||||
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,
|
||||
|
@ -290,7 +291,7 @@ namespace DM_Weight.ViewModels
|
|||
ReturnQuantity2 = outQuantity, //当日出库量总数
|
||||
StockQuantity = channelStockQuantity,
|
||||
ManunoQuantity = 0,
|
||||
SupplierDept =string.Empty,// ConfigurationManager.AppSettings["supplierDept"].ToString(),
|
||||
SupplierDept = string.Empty,// ConfigurationManager.AppSettings["supplierDept"].ToString(),
|
||||
ReceiveDept = string.Empty,//ConfigurationManager.AppSettings["receiveDept"].ToString()
|
||||
}).ExecuteCommand();
|
||||
|
||||
|
@ -304,17 +305,18 @@ namespace DM_Weight.ViewModels
|
|||
//账册中没有记录则把库存中的所有数据都要生成一条账册记录
|
||||
// 保存数据 出/入库记录
|
||||
// 获取药品总库存
|
||||
string drugId= channelStockList[i].DrugId;
|
||||
int channelStockQuantity = SqlSugarHelper.Db.Queryable<ChannelStock>()
|
||||
.Where(cs => cs.DrugId.Equals(channelStockList[i].DrugId)).Sum(it => it.Quantity);
|
||||
|
||||
|
||||
.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 = channelStockList[i].DrugId,
|
||||
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,
|
||||
|
|
|
@ -3,7 +3,6 @@ using DM_Weight.msg;
|
|||
using DM_Weight.Port;
|
||||
using DM_Weight.util;
|
||||
using log4net;
|
||||
using log4net.Repository.Hierarchy;
|
||||
using Prism.Commands;
|
||||
using Prism.Events;
|
||||
using Prism.Mvvm;
|
||||
|
@ -26,6 +25,33 @@ namespace DM_Weight.ViewModels
|
|||
{
|
||||
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 List<int> _drawerNoList = new List<int>();
|
||||
public static AddDrugControlViewModel vm;
|
||||
|
@ -149,7 +175,18 @@ namespace DM_Weight.ViewModels
|
|||
private int _status;
|
||||
|
||||
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;
|
||||
|
||||
public int DrawerNo
|
||||
|
@ -171,7 +208,6 @@ namespace DM_Weight.ViewModels
|
|||
|
||||
public bool Is17Drawer { get => _is17Drawer; set => SetProperty(ref _is17Drawer, value); }
|
||||
|
||||
|
||||
|
||||
public DelegateCommand<string> UpdateDrawerNo
|
||||
{
|
||||
|
@ -217,13 +253,25 @@ namespace DM_Weight.ViewModels
|
|||
// 完成按钮
|
||||
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)
|
||||
{
|
||||
_isFinishClick = true;
|
||||
foreach (ChannelList lst in ChannelLsts)
|
||||
{
|
||||
lst.channelStocks.ForEach(it => it.DrugId = lst.DrugId);
|
||||
ChannelStocks.AddRange(lst.channelStocks);
|
||||
}
|
||||
List<ChannelStock> record = ChannelStocks.FindAll(it => it.AddQuantity != 0).ToList();
|
||||
|
@ -249,14 +297,19 @@ namespace DM_Weight.ViewModels
|
|||
Quantity = it.Quantity + it.AddQuantity,
|
||||
ManuNo = it.ManuNo,
|
||||
EffDate = it.EffDate,
|
||||
DrugId = it.DrugId,
|
||||
Id = it.Id,
|
||||
DrugId= it.DrugId,
|
||||
}).UpdateColumns(it => new { it.Quantity, it.ManuNo, it.EffDate,it.DrugId }).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
|
||||
{
|
||||
//如果批号重复则不让添加
|
||||
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)
|
||||
{
|
||||
//repeatList.Add(it.ManuNo);
|
||||
|
@ -277,7 +330,8 @@ namespace DM_Weight.ViewModels
|
|||
DrawerType = it.DrawerType,
|
||||
BoardType = it.BoardType,
|
||||
Id = Guid.NewGuid().ToString(),
|
||||
MachineId = ConfigurationManager.AppSettings["machineId"] ?? "DM1"
|
||||
MachineId = ConfigurationManager.AppSettings["machineId"] ?? "DM1",
|
||||
FillTime = DateTime.Now
|
||||
}).ExecuteCommand();
|
||||
}
|
||||
// 获取更新完库存后的药品库存
|
||||
|
@ -297,10 +351,10 @@ namespace DM_Weight.ViewModels
|
|||
ManuNo = it.ManuNo,
|
||||
EffDate = !String.IsNullOrEmpty(it.EffDate) ? DateTime.ParseExact(it.EffDate, "yyyy-MM-dd", System.Globalization.CultureInfo.CurrentCulture) : null,
|
||||
Operator = HomeWindowViewModel.Operator?.Id,
|
||||
Reviewer= HomeWindowViewModel.Reviewer?.Id,
|
||||
Reviewer = HomeWindowViewModel.Reviewer?.Id,
|
||||
OperationTime = DateTime.Now,
|
||||
Quantity = it.AddQuantity,
|
||||
Type = 1,
|
||||
Type = SelectedItem.UseId == 0 ? 1 : SelectedItem.UseId,
|
||||
InvoiceId = InvoiceId,
|
||||
StockQuantity = nowChannels.Sum(it => it.Quantity),
|
||||
ManunoQuantity = nowChannels.FindAll(it2 => it2.ManuNo == it.ManuNo).Sum(it => it.Quantity)
|
||||
|
@ -313,10 +367,14 @@ namespace DM_Weight.ViewModels
|
|||
{
|
||||
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
|
||||
};
|
||||
_eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
|
||||
|
||||
System.Windows.Application.Current.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Send, new Action(() =>
|
||||
{
|
||||
_eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
|
||||
}));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -328,7 +386,7 @@ namespace DM_Weight.ViewModels
|
|||
if (stockRepeats.Count > 0)
|
||||
{
|
||||
msg = $"该抽屉下批次{string.Join(',', stockRepeats.Select(r => r.ManuNo).ToArray())}已存在,不可重复添加,其他批次加药完成,库存已更新";
|
||||
foreach(var stockRpt in stockRepeats)
|
||||
foreach (var stockRpt in stockRepeats)
|
||||
{
|
||||
//移除重复的信息,以免更新屏显库存时更新了重复数据
|
||||
record.Remove(stockRpt);
|
||||
|
@ -342,7 +400,7 @@ namespace DM_Weight.ViewModels
|
|||
}
|
||||
// 更新屏显库存
|
||||
//List<ChannelStock> singleChannels = record.FindAll(it => it.BoardType != 1);
|
||||
List<ChannelStock> singleChannels = ChannelStocks.Where(it => it.BoardType ==5&&(it.Quantity>0||it.AddQuantity>0))
|
||||
List<ChannelStock> singleChannels = ChannelStocks.Where(it => it.BoardType == 5&&(it.AddQuantity>0||it.Quantity>0))
|
||||
.GroupBy(it => it.ColNo)
|
||||
.Select(it =>
|
||||
{
|
||||
|
@ -350,31 +408,31 @@ namespace DM_Weight.ViewModels
|
|||
ret.Quantity = it.Sum(itx => itx.Quantity);
|
||||
ret.AddQuantity = it.Sum(itx => itx.AddQuantity);
|
||||
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;
|
||||
})
|
||||
.OrderBy(it=>it.EffDate)
|
||||
.OrderBy(it => it.EffDate)
|
||||
.ToList();
|
||||
singleChannels = singleChannels.Where(it => it.AddQuantity > 0).ToList();
|
||||
if ((singleChannels.Count > 0 ? singleChannels[0].BoardType : 1) == 5)
|
||||
{
|
||||
//将库位多批次的总库存数更新标签
|
||||
//_portUtil.WriteQuantity(singleChannels[0].DrawerNo, singleChannels[0].ColNo, singleChannels.Sum(it => it.Quantity) + singleChannels.Sum(it => it.AddQuantity));
|
||||
|
||||
|
||||
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.ShowContent(it.DrawerNo, it.ColNo);
|
||||
|
||||
Thread.Sleep(500);
|
||||
Thread.Sleep(200);
|
||||
|
||||
//写库存数量
|
||||
_portUtil.WriteQuantity(it.DrawerNo, it.ColNo, it.Quantity + it.AddQuantity);
|
||||
|
||||
Thread.Sleep(200);
|
||||
});
|
||||
}
|
||||
RequestData();
|
||||
|
@ -383,17 +441,24 @@ namespace DM_Weight.ViewModels
|
|||
Message = msg,
|
||||
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
|
||||
{
|
||||
logger.Info($"多批次抽屉加药,库存更新失败!{f.ErrorMessage}");
|
||||
AlertMsg alertMsg = new AlertMsg
|
||||
{
|
||||
Message = "更新库存失败",
|
||||
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;
|
||||
|
@ -411,14 +476,33 @@ namespace DM_Weight.ViewModels
|
|||
Message = "没有填写加药数量",
|
||||
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
|
||||
{
|
||||
|
@ -429,7 +513,7 @@ namespace DM_Weight.ViewModels
|
|||
});
|
||||
}
|
||||
|
||||
public bool KeepAlive => false;
|
||||
public bool KeepAlive => true;
|
||||
|
||||
|
||||
|
||||
|
@ -478,34 +562,7 @@ namespace DM_Weight.ViewModels
|
|||
channelLS.channelStocks = stockList;
|
||||
}
|
||||
}
|
||||
//删除药品下批次库存为0的批次
|
||||
private void DelManuNO(ChannelStock cstock)
|
||||
{
|
||||
if(cstock != null)
|
||||
{
|
||||
//删除ChannelStock表中该批次数据
|
||||
int isOk = SqlSugarHelper.Db.Deleteable<ChannelStock>().Where(cs => cs.DrugId == cstock.DrugId && cs.ManuNo == cs.ManuNo).ExecuteCommand();
|
||||
if(isOk>0 )
|
||||
{
|
||||
logger.Info($"删除{cstock.DrawerNo}-{cstock.ColNo}抽屉中药品{cstock.DrugId}下的批次{cstock.ManuNo},");
|
||||
AlertMsg alertMsg = new AlertMsg
|
||||
{
|
||||
Message = "该药品批次已删除",
|
||||
Type = MsgType.ERROR
|
||||
};
|
||||
_eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
|
||||
}
|
||||
else
|
||||
{
|
||||
AlertMsg alertMsg = new AlertMsg
|
||||
{
|
||||
Message = "该药品批次删除失败",
|
||||
Type = MsgType.ERROR
|
||||
};
|
||||
_eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public long CurrentTimeMillis()
|
||||
{
|
||||
return (long)(DateTime.UtcNow - Jan1st1970).TotalMilliseconds;
|
||||
|
@ -513,11 +570,11 @@ namespace DM_Weight.ViewModels
|
|||
|
||||
public void FindDrawerCount()
|
||||
{
|
||||
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();
|
||||
Is8Drawer = count < 9;
|
||||
Is16Drawer = count >= 16;
|
||||
Is17Drawer = count > 16;
|
||||
//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();
|
||||
Is8Drawer = App.SingleModel; //count < 9;
|
||||
Is16Drawer = !App.SingleModel; //count >= 16;
|
||||
Is17Drawer = false;//count > 16;
|
||||
}
|
||||
|
||||
//这个方法用于拦截请求,continuationCallback(true)就是不拦截,continuationCallback(false)拦截本次操作
|
||||
|
@ -536,12 +593,11 @@ namespace DM_Weight.ViewModels
|
|||
.Where(cl => cl.DrugId != null)
|
||||
.OrderBy(cl => cl.ColNo)
|
||||
.ToList();
|
||||
ChannelLsts = queryData.AsParallel().Select(cl =>
|
||||
ChannelLsts = queryData.Select(cl =>
|
||||
{
|
||||
cl.channelStocks = cl.channelStocks.Select(cs =>
|
||||
{
|
||||
cs.drugManuNo = cl.Drug.DrugManuNos.Find(it => it.ManuNo.Equals(cs.ManuNo));
|
||||
cs.DrugId=cl.DrugId;
|
||||
return cs;
|
||||
}).ToList();
|
||||
return cl;
|
||||
|
@ -555,7 +611,6 @@ namespace DM_Weight.ViewModels
|
|||
{
|
||||
_eventAggregator.GetEvent<PortUtilEvent>().Subscribe(DoMyPrismEvent);
|
||||
_eventAggregator.GetEvent<AddDrugEvent>().Subscribe(AddAction);
|
||||
_eventAggregator.GetEvent<DelDrugManoEvent>().Subscribe(DelManuNO);
|
||||
FindDrawerCount();
|
||||
RequestData();
|
||||
}
|
||||
|
@ -573,7 +628,6 @@ namespace DM_Weight.ViewModels
|
|||
// 取消消息订阅
|
||||
_eventAggregator.GetEvent<PortUtilEvent>().Unsubscribe(DoMyPrismEvent);
|
||||
_eventAggregator.GetEvent<AddDrugEvent>().Unsubscribe(AddAction);
|
||||
_eventAggregator.GetEvent<DelDrugManoEvent>().Unsubscribe(DelManuNO);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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>()
|
||||
.Includes<DrugInfo>(cs => cs.DrugInfo)
|
||||
.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"))
|
||||
.OrderBy(cs => cs.DrawerNo)
|
||||
.OrderBy(cs => cs.ColNo)
|
||||
|
@ -280,6 +282,24 @@ namespace DM_Weight.ViewModels
|
|||
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();
|
||||
|
||||
|
||||
|
||||
//插入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();
|
||||
|
||||
if (item.BoardType == 5)
|
||||
|
@ -292,10 +312,10 @@ namespace DM_Weight.ViewModels
|
|||
await Task.Delay(200);
|
||||
_portUtil.WriteChannelInfo(8, DrugInfo.Manufactory, item.DrawerNo, item.ColNo);
|
||||
await Task.Delay(200);
|
||||
_portUtil.WriteChannelInfo(6, DrugManuNo.EffDate == null ? "" : DrugManuNo.EffDate, item.DrawerNo, item.ColNo);
|
||||
await Task.Delay(200);
|
||||
_portUtil.WriteChannelInfo(5, DrugManuNo.ManuNo, item.DrawerNo, item.ColNo);
|
||||
await Task.Delay(200);
|
||||
//_portUtil.WriteChannelInfo(6, DrugManuNo.EffDate == null ? "" : DrugManuNo.EffDate, item.DrawerNo, item.ColNo);
|
||||
//await Task.Delay(200);
|
||||
//_portUtil.WriteChannelInfo(5, DrugManuNo.ManuNo, item.DrawerNo, item.ColNo);
|
||||
//await Task.Delay(200);
|
||||
_portUtil.ShowContent(item.DrawerNo, item.ColNo);
|
||||
}
|
||||
//_screenUtil.SetStockInfo(item, 1);
|
||||
|
@ -462,6 +482,7 @@ namespace DM_Weight.ViewModels
|
|||
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<ChannelStock>().SetColumns(it => new ChannelStock { DrugId = null, ManuNo = null, EffDate = null }).Where(it => it.Chnguid == item.Id).ExecuteCommand();
|
||||
if (item.BoardType == 5)
|
||||
{
|
||||
// 清除显示屏库位信息
|
||||
|
|
|
@ -21,6 +21,7 @@ using System.Threading;
|
|||
using System.Reflection.Metadata.Ecma335;
|
||||
using System.Windows.Threading;
|
||||
using System.Windows;
|
||||
using System.Reflection.PortableExecutable;
|
||||
|
||||
namespace DM_Weight.ViewModels
|
||||
{
|
||||
|
@ -141,7 +142,7 @@ namespace DM_Weight.ViewModels
|
|||
public void UpdateComboBoxItems(string text)
|
||||
{
|
||||
string str = @"SELECT d.drug_id,d.py_code,d.drug_barcode,d.drug_name,d.drug_brand_name,d.drug_spec,d.dosage,d.pack_unit,
|
||||
d.manufactory,d.max_stock,CONCAT(drug_name,' ',drug_spec)as drug_name_spec FROM `drug_info` d";
|
||||
d.manufactory,d.max_stock,CONCAT(drug_name,';',drug_spec,';',manufactory)as drug_name_spec FROM `drug_info` d";
|
||||
if (string.IsNullOrEmpty(text))
|
||||
{
|
||||
DrugInfos = SqlSugarHelper.Db.SqlQueryable<DrugInfo>(str).OrderBy(di => di.DrugName).OrderBy(di => di.DrugId).ToList();
|
||||
|
@ -246,7 +247,7 @@ namespace DM_Weight.ViewModels
|
|||
//var list = SqlSugarHelper.Db.Queryable<DrugInfo>().Includes<DrugManuNo>(di => di.DrugManuNos).OrderBy(di => di.DrugId).ToList();
|
||||
//DrugInfos = list;
|
||||
//DrugInfos_PY = list;
|
||||
string str = "SELECT d.drug_id,d.py_code,d.drug_barcode,d.drug_name,d.drug_brand_name,d.drug_spec,d.dosage,d.pack_unit,d.manufactory,d.max_stock,CONCAT(drug_name,' ',drug_spec)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();
|
||||
|
||||
}
|
||||
|
@ -257,6 +258,8 @@ namespace DM_Weight.ViewModels
|
|||
int totalCount = 0;
|
||||
var list = SqlSugarHelper.Db.Queryable<ChannelList>()
|
||||
.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)
|
||||
.WhereIF(DrawerNo > 0, cl => cl.DrawerNo == DrawerNo)
|
||||
.Where(cl => cl.MachineId.Equals(ConfigurationManager.AppSettings["machineId"] ?? "DM1"))
|
||||
|
@ -322,6 +325,23 @@ namespace DM_Weight.ViewModels
|
|||
}
|
||||
item.DrugId = DrugInfo.DrugId.ToString();
|
||||
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();
|
||||
|
||||
if (item.BoardType == 5)
|
||||
|
@ -400,7 +420,7 @@ namespace DM_Weight.ViewModels
|
|||
.Where(cs => cs.DrugId.Equals(DrugInfo.DrugId.ToString()))
|
||||
.Where(cs => cs.DrawerType == 1)
|
||||
.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();
|
||||
|
||||
if (count > 0)
|
||||
|
@ -469,6 +489,7 @@ namespace DM_Weight.ViewModels
|
|||
}
|
||||
});
|
||||
}
|
||||
|
||||
public DelegateCommand RemoveBinding
|
||||
{
|
||||
get => new DelegateCommand(async () =>
|
||||
|
@ -544,6 +565,8 @@ namespace DM_Weight.ViewModels
|
|||
}
|
||||
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";
|
||||
// 向显示屏写入库位信息
|
||||
|
@ -553,17 +576,14 @@ namespace DM_Weight.ViewModels
|
|||
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);
|
||||
//查询该库存下库存不为0的近效期的批次效期
|
||||
ChannelStock channelStock = SqlSugarHelper.Db.Queryable<ChannelStock>()
|
||||
.Where(cs => cs.MachineId == item.MachineId && cs.DrawerNo == item.DrawerNo && cs.ColNo == item.ColNo && cs.Quantity > 0)
|
||||
.OrderBy(cs => cs.EffDate).First();
|
||||
_portUtil.WriteChannelInfo(6, channelStock.EffDate == null ? "" : channelStock.EffDate, item.DrawerNo, item.ColNo);
|
||||
Thread.Sleep(200);
|
||||
_portUtil.WriteChannelInfo(5, channelStock.ManuNo == null ? "" : channelStock.ManuNo, item.DrawerNo, item.ColNo);
|
||||
_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);
|
||||
}
|
||||
});
|
||||
}
|
|
@ -213,25 +213,32 @@ namespace DM_Weight.ViewModels
|
|||
}).ExecuteCommand();
|
||||
|
||||
//插入交接班报表数据信息
|
||||
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
|
||||
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,
|
||||
SUM(IF(d1.`type` = 1, d1.quantity, 0)) AS getNum,SUM(IF(d1.`type` = 2, d1.quantity, 0)) AS useNum FROM dm_machine_record d1
|
||||
WHERE d1.`type` IN (1, 2) AND d1.`operation_time` >= @startDate and d1.`operation_time` <=@endDate and d1.machine_id=@machineId GROUP BY d1.Drug_ID ,d1.manu_no) d
|
||||
on c.drug_id=d.drug_id and c.manu_no=d.manu_no WHERE c.machine_id=@machineId and c.drug_id is not NULL GROUP BY c.Drug_ID ,c.manu_no
|
||||
UNION
|
||||
SELECT drug.drug_name,drug.DRUG_SPEC,d.manu_no,d.useNum,d.getNum,sum(quantity) as surplus,(SELECT d2.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
|
||||
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 ";
|
||||
//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
|
||||
// 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,
|
||||
// SUM(IF(d1.`type` = 1, d1.quantity, 0)) AS getNum,SUM(IF(d1.`type` = 2, d1.quantity, 0)) AS useNum FROM dm_machine_record d1
|
||||
// WHERE d1.`type` IN (1, 2) AND d1.`operation_time` >= @startDate and d1.`operation_time` <=@endDate and d1.machine_id=@machineId GROUP BY d1.Drug_ID ,d1.manu_no) d
|
||||
// on c.drug_id=d.drug_id and c.manu_no=d.manu_no WHERE c.machine_id=@machineId and c.drug_id is not NULL GROUP BY c.Drug_ID ,c.manu_no
|
||||
// UNION
|
||||
// SELECT drug.drug_name,drug.DRUG_SPEC,d.manu_no,d.useNum,d.getNum,sum(quantity) as surplus,(SELECT d2.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
|
||||
// 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 ";
|
||||
|
||||
|
||||
//交接班表里只显示值班柜(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)
|
||||
.AddParameters(new
|
||||
{
|
||||
machineId = ConfigurationManager.AppSettings["machineId"] ?? "DM1",
|
||||
beforeDate = listHkcChangeShifts[0].OptDate,
|
||||
startDate = listHkcChangeShifts[0].OptDate,
|
||||
endDate = dt
|
||||
//beforeDate = listHkcChangeShifts[0].OptDate,
|
||||
//startDate = listHkcChangeShifts[0].OptDate,
|
||||
//endDate = dt
|
||||
})
|
||||
.Select(it => new ShiftsReport())
|
||||
.ToList();
|
||||
|
@ -245,11 +252,14 @@ namespace DM_Weight.ViewModels
|
|||
OptDate = dt,
|
||||
DrugName = shiftsReports[i].DrugName,
|
||||
DrugSpec = shiftsReports[i].DrugSpec,
|
||||
BeforeNum = shiftsReports[i].BeforeNum ?? 0,
|
||||
GetNum = shiftsReports[i].GetNum ?? 0,
|
||||
UseNum = shiftsReports[i].UseNum ?? 0,
|
||||
ManuNo = shiftsReports[i].ManuNo,
|
||||
Surplus = shiftsReports[i].Surplus ?? 0,
|
||||
PackdUnit= shiftsReports[i].PackdUnit,
|
||||
StockQuantity= shiftsReports[i].StockQuantity,
|
||||
EmptyQuantity= shiftsReports[i].EmptyQuantity,
|
||||
//BeforeNum = shiftsReports[i].BeforeNum ?? 0,
|
||||
//GetNum = shiftsReports[i].GetNum ?? 0,
|
||||
//UseNum = shiftsReports[i].UseNum ?? 0,
|
||||
//ManuNo = shiftsReports[i].ManuNo,
|
||||
//Surplus = shiftsReports[i].Surplus ?? 0,
|
||||
FromOperator = Operator == null ? "" : Operator.Nickname,
|
||||
FromReviewer = Reviewer == null ? "" : Reviewer.Nickname,
|
||||
ToOperator = JieOperator == null ? "" : JieOperator.Nickname,
|
||||
|
@ -642,7 +652,7 @@ namespace DM_Weight.ViewModels
|
|||
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)
|
||||
//{
|
||||
// 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";
|
||||
List<CheckRecordStock> checkList = SqlSugarHelper.Db.Queryable<CheckRecordStock>()
|
||||
.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);
|
||||
vw.GroupDescriptions.Add(new PropertyGroupDescription("DrugInfo"));
|
||||
obsCheckRecordStock = new ObservableCollection<CheckRecordStock>(checkList);
|
||||
|
|
|
@ -12,6 +12,7 @@ using System;
|
|||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.ComponentModel;
|
||||
using System.Configuration;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
@ -132,16 +133,8 @@ namespace DM_Weight.ViewModels
|
|||
{
|
||||
GridReportUtil.PrintReportStockNew(StartDate, EndDate);
|
||||
});
|
||||
|
||||
//get => new DelegateCommand(() =>
|
||||
//{
|
||||
// //DialogParameters dialogParameters = new DialogParameters();
|
||||
// //dialogParameters.Add("orderInfo", SelectedOrder);
|
||||
// DialogServiceExtensions.ShowDialogHost(_dialogService, "PrintPdfView", null, DoDialogResult, "RootDialog");
|
||||
//});
|
||||
|
||||
}
|
||||
public DelegateCommand Query
|
||||
public DelegateCommand Query
|
||||
{
|
||||
get => new DelegateCommand(() =>
|
||||
{
|
||||
|
@ -152,8 +145,8 @@ namespace DM_Weight.ViewModels
|
|||
{
|
||||
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
|
||||
LEFT JOIN user_list U ON C.operator=U.ID LEFT JOIN user_list R ON C.reviewer=R.ID WHERE 1=1";
|
||||
if(StartDate!=null)
|
||||
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)
|
||||
{
|
||||
strSql += " AND C.optDate>@OPTSTARTDATE ";
|
||||
}
|
||||
|
|
|
@ -277,14 +277,13 @@ namespace DM_Weight.ViewModels
|
|||
List<ChannelStock> channelStocks = grouping.ToList();
|
||||
channelStocks.ForEach(it => it.process = 1);
|
||||
_portUtil.SpeakAsync("正在打开" + DrawerNo + "号抽屉");
|
||||
|
||||
|
||||
List<ChannelStock> singleChannels = new List<ChannelStock>();
|
||||
for (int i = 0; i < channelStocks.Count; i++)
|
||||
{
|
||||
ChannelStock copy = TransExpV2<ChannelStock, ChannelStock>.Trans(channelStocks[i]);
|
||||
singleChannels.Add(copy);
|
||||
}
|
||||
|
||||
singleChannels = singleChannels.GroupBy(it => new
|
||||
{
|
||||
it.DrawerNo,
|
||||
|
@ -387,7 +386,7 @@ namespace DM_Weight.ViewModels
|
|||
|
||||
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,
|
||||
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`";
|
||||
List<CheckRecordStock> checkRecordStockList = SqlSugarHelper.Db.SqlQueryable<dynamic>(strSql)
|
||||
.AddParameters(new
|
||||
|
@ -460,7 +459,7 @@ namespace DM_Weight.ViewModels
|
|||
{
|
||||
// 将库位多批次的总库存数更新标签
|
||||
_portUtil.WriteQuantity(it.DrawerNo, it.ColNo, it.CheckQuantity);
|
||||
|
||||
Thread.Sleep(200);
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -575,7 +574,8 @@ namespace DM_Weight.ViewModels
|
|||
.Where(cs => cs.DrawerType == 1)
|
||||
.Where(cs => cs.DrugId != null)
|
||||
.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)
|
||||
.OrderBy(cs => cs.DrawerNo)
|
||||
.OrderBy(cs => cs.ColNo)
|
||||
|
|
|
@ -26,8 +26,36 @@ namespace DM_Weight.ViewModels
|
|||
{
|
||||
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;
|
||||
private readonly ILog logger = LogManager.GetLogger(typeof(CheckStockWindowViewModel));
|
||||
private readonly ILog logger = LogManager.GetLogger(typeof(CheckStockNewWindowViewModel));
|
||||
public string drugId;
|
||||
//public string Stock;
|
||||
private static readonly DateTime Jan1st1970 = new DateTime
|
||||
|
@ -303,12 +331,14 @@ namespace DM_Weight.ViewModels
|
|||
{
|
||||
if (Status == 0)
|
||||
{
|
||||
logger.Info("开始盘点");
|
||||
enumerable = ChannelStocks.GroupBy(cs => cs.DrawerNo, cs => cs);
|
||||
//enumerable = ChannelStocks.GroupBy(cs => cs.Location, cs => cs);
|
||||
enumerator = enumerable.GetEnumerator();
|
||||
enumerator.MoveNext();
|
||||
Status = 1;
|
||||
OpenOneByOne();
|
||||
logger.Info("结束盘点");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -416,7 +446,7 @@ namespace DM_Weight.ViewModels
|
|||
Reviewer = HomeWindowViewModel.Reviewer?.Id,
|
||||
OperationTime = DateTime.Now,
|
||||
Quantity = it.CheckQuantity - it.Quantity,
|
||||
Type = 4,
|
||||
Type = SelectedItemUseFor.UseId==0? 4: SelectedItemUseFor.UseId,
|
||||
InvoiceId = InvoiceId,
|
||||
StockQuantity = nowChannels.Sum(it => it.Quantity),
|
||||
CheckQuantity = it.CheckQuantity,
|
||||
|
@ -432,7 +462,16 @@ namespace DM_Weight.ViewModels
|
|||
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`";
|
||||
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)
|
||||
.AddParameters(new
|
||||
{
|
||||
|
@ -443,6 +482,7 @@ namespace DM_Weight.ViewModels
|
|||
|
||||
logger.Info("已完成-查询channel_stock关联drug_info表信息查询");
|
||||
|
||||
|
||||
List<CheckRecordStock> insertList = new List<CheckRecordStock>();
|
||||
|
||||
if (checkRecordStockList != null && checkRecordStockList.Count > 0)
|
||||
|
@ -490,7 +530,8 @@ namespace DM_Weight.ViewModels
|
|||
if (f.Data)
|
||||
{
|
||||
// 更新屏显库存
|
||||
List<ChannelStock> singleChannels = record.FindAll(it => it.BoardType == 5)
|
||||
//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
|
||||
{
|
||||
it.DrawerNo,
|
||||
|
@ -499,64 +540,26 @@ namespace DM_Weight.ViewModels
|
|||
{
|
||||
var ret = it.First();
|
||||
ret.CheckQuantity = it.Sum(itx => itx.CheckQuantity);
|
||||
ret.Quantity = it.Sum(itx => itx.Quantity);
|
||||
//ret.AddQuantity = it.Sum(itx => itx.AddQuantity);
|
||||
return ret;
|
||||
}).OrderBy(it => it.EffDate).ToList();
|
||||
if (singleChannels != null && singleChannels.Count > 0)
|
||||
}).ToList();
|
||||
//if ((singleChannels.Count > 0 ? singleChannels[0].BoardType : 1) == 5)
|
||||
{
|
||||
for (int i = 0; i < singleChannels.Count; i++)
|
||||
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);
|
||||
Thread.Sleep(200);
|
||||
_portUtil.ShowContent(it.DrawerNo, it.ColNo);
|
||||
Thread.Sleep(200);
|
||||
|
||||
|
||||
List<ChannelStock> channel = SqlSugarHelper.Db.Queryable<ChannelStock>()
|
||||
.Where(cs => cs.MachineId == singleChannels[i].MachineId)
|
||||
.Where(cs => cs.DrawerNo == singleChannels[i].DrawerNo)
|
||||
.Where(cs => cs.ColNo == singleChannels[i].ColNo)
|
||||
//.Where(cs=>cs.Quantity>0)
|
||||
.OrderBy(cs => cs.EffDate)
|
||||
.ToList();
|
||||
//.Sum(it => it.Quantity);
|
||||
if (singleChannels[i].Quantity != singleChannels[i].CheckQuantity)
|
||||
{
|
||||
//将库位多批次的总库存数更新标签
|
||||
_portUtil.WriteQuantity(channel[0].DrawerNo, channel[0].ColNo, channel.Sum(c => c.Quantity));
|
||||
Thread.Sleep(500);
|
||||
}
|
||||
//如果最近效期的批次库存为0则重新绑定批次效期标签为库存不为0的近效期的标签
|
||||
if (channel[0].Quantity == 0)
|
||||
{
|
||||
ChannelStock cs = channel.Where(cs => cs.Quantity > 0).OrderBy(it => it.EffDate).FirstOrDefault();
|
||||
if (cs != null)
|
||||
{
|
||||
_portUtil.WriteChannelInfo(6, cs.EffDate == null ? "" : cs.EffDate, cs.DrawerNo, cs.ColNo);
|
||||
Thread.Sleep(200);
|
||||
_portUtil.WriteChannelInfo(5, cs.ManuNo, cs.DrawerNo, cs.ColNo);
|
||||
Thread.Sleep(200);
|
||||
_portUtil.ShowContent(cs.DrawerNo, cs.ColNo);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//判断盘点前数量是否是0,盘点前数量为0的可能已经把标签绑定的批次效期替换了,所以要更新回来
|
||||
int beForeQuantity = record.Where(it => it.DrawerNo == channel[0].DrawerNo && it.ColNo == channel[0].ColNo && it.ManuNo == channel[0].ManuNo && it.EffDate == channel[0].EffDate).Select(s => s.Quantity).Min();
|
||||
if (beForeQuantity == 0)
|
||||
{
|
||||
_portUtil.WriteChannelInfo(6, channel[0].EffDate == null ? "" : channel[0].EffDate, channel[0].DrawerNo, channel[0].ColNo);
|
||||
Thread.Sleep(200);
|
||||
_portUtil.WriteChannelInfo(5, channel[0].ManuNo, channel[0].DrawerNo, channel[0].ColNo);
|
||||
Thread.Sleep(200);
|
||||
_portUtil.ShowContent(channel[0].DrawerNo, channel[0].ColNo);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
//singleChannels.ForEach(it =>
|
||||
//{
|
||||
// // 将库位多批次的总库存数更新标签
|
||||
// _portUtil.WriteQuantity(it.DrawerNo, it.ColNo, it.CheckQuantity);
|
||||
|
||||
//});
|
||||
|
||||
logger.Info("已完成-更新标签");
|
||||
AlertMsg alertMsg = new AlertMsg
|
||||
{
|
||||
|
@ -729,7 +732,8 @@ namespace DM_Weight.ViewModels
|
|||
.Where(cs => cs.DrawerType == 1)
|
||||
.Where(cs => cs.DrugId != null)
|
||||
.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)
|
||||
.OrderBy(cs => cs.DrawerNo)
|
||||
//.OrderByDescending(cs => cs.DrawerNo)
|
||||
|
@ -763,5 +767,42 @@ namespace DM_Weight.ViewModels
|
|||
// 取消消息订阅
|
||||
_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.Port;
|
||||
using DM_Weight.util;
|
||||
using System.Threading;
|
||||
|
||||
namespace DM_Weight.ViewModels
|
||||
{
|
||||
|
@ -121,6 +122,55 @@ namespace DM_Weight.ViewModels
|
|||
{
|
||||
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;
|
||||
_portUtil.SpeakAsync("正在打开" + DrawerNo + "号抽屉");
|
||||
|
||||
|
@ -208,6 +258,7 @@ namespace DM_Weight.ViewModels
|
|||
singleChannels.ForEach(it =>
|
||||
{
|
||||
_portUtil.WriteQuantity(it.DrawerNo, it.ColNo, it.CheckQuantity);
|
||||
Thread.Sleep(200);
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -23,6 +23,33 @@ namespace DM_Weight.ViewModels
|
|||
{
|
||||
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 List<int> _drawerNoList = new List<int>();
|
||||
|
||||
|
@ -139,6 +166,54 @@ namespace DM_Weight.ViewModels
|
|||
{
|
||||
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;
|
||||
_portUtil.SpeakAsync("正在打开" + DrawerNo + "号抽屉");
|
||||
|
||||
|
@ -187,7 +262,7 @@ namespace DM_Weight.ViewModels
|
|||
if (!_isFinishClick)
|
||||
{
|
||||
_isFinishClick = true;
|
||||
List<ChannelStock> record = ChannelStocks.FindAll(it => it.AddQuantity > 0).ToList();
|
||||
List<ChannelStock> record = ChannelStocks.FindAll(it => it.AddQuantity != 0).ToList();
|
||||
if (record.Count > 0)
|
||||
{
|
||||
//string InvoiceId = "DRAWER_" + CurrentTimeMillis();
|
||||
|
@ -229,7 +304,7 @@ namespace DM_Weight.ViewModels
|
|||
Reviewer = HomeWindowViewModel.Reviewer?.Id,
|
||||
OperationTime = DateTime.Now,
|
||||
Quantity = it.AddQuantity,
|
||||
Type = 1,
|
||||
Type = SelectedItemUseFor.UseId == 0 ? 1 : SelectedItemUseFor.UseId,
|
||||
InvoiceId = InvoiceId,
|
||||
StockQuantity = nowChannels.Sum(it => it.Quantity),
|
||||
ManunoQuantity = nowChannels.FindAll(it2 => it2.ManuNo == it.ManuNo).Sum(it => it.Quantity),
|
||||
|
@ -242,45 +317,23 @@ namespace DM_Weight.ViewModels
|
|||
if (f.Data)
|
||||
{
|
||||
// 更新屏显库存
|
||||
//List<ChannelStock> singleChannels = ChannelStocks.Where(it => it.BoardType == 5 && (it.Quantity > 0 || it.AddQuantity > 0))
|
||||
// .GroupBy(it => it.ColNo)
|
||||
// .Select(it =>
|
||||
// {
|
||||
// var ret = it.First();
|
||||
// ret.Quantity = it.Sum(it => it.Quantity);
|
||||
// ret.AddQuantity = it.Sum(it => it.AddQuantity);
|
||||
// return ret;
|
||||
// })
|
||||
// .OrderBy(it => it.EffDate).ToList();
|
||||
|
||||
List<ChannelStock> singleChannels = ChannelStocks.Where(it => it.BoardType == 5 && (it.Quantity > 0 || it.AddQuantity > 0))
|
||||
.GroupBy(it => it.ColNo)
|
||||
.Select(it =>
|
||||
{
|
||||
var ret = it.First();
|
||||
ret.Quantity = it.Sum(itx => itx.Quantity);
|
||||
ret.AddQuantity = it.Sum(itx => itx.AddQuantity);
|
||||
ret.EffDate = it.Min(it => it.EffDate);
|
||||
ret.ManuNo = it.OrderBy(it => it.ManuNo).Select(it => it.ManuNo).First().ToString();
|
||||
return ret;
|
||||
})
|
||||
.OrderBy(it => it.EffDate)
|
||||
.ToList();
|
||||
|
||||
//singleChannels = singleChannels.Where(it => it.AddQuantity > 0).ToList();
|
||||
if (singleChannels.Count > 0)
|
||||
List<ChannelStock> singleChannels = ChannelStocks.Where(it => it.BoardType != 1)
|
||||
.GroupBy(it => it.ColNo)
|
||||
.Select(it =>
|
||||
{
|
||||
var ret = it.First();
|
||||
ret.Quantity = it.Sum(it => it.Quantity);
|
||||
ret.AddQuantity = it.Sum(it => it.AddQuantity);
|
||||
return ret;
|
||||
}).ToList();
|
||||
singleChannels = singleChannels.Where(it => it.AddQuantity > 0).ToList();
|
||||
if ((singleChannels.Count > 0 ? singleChannels[0].BoardType : 1) == 5)
|
||||
{
|
||||
//将库位多批次的总库存数更新标签
|
||||
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.ShowContent(it.DrawerNo, it.ColNo);
|
||||
|
||||
Thread.Sleep(500);
|
||||
_portUtil.WriteQuantity(it.DrawerNo, it.ColNo, it.Quantity + it.AddQuantity);
|
||||
Thread.Sleep(200);
|
||||
});
|
||||
}
|
||||
RequestData();
|
||||
|
@ -293,7 +346,6 @@ namespace DM_Weight.ViewModels
|
|||
}
|
||||
else
|
||||
{
|
||||
logger.Info($"抽屉加药,库存更新失败!{f.ErrorMessage}");
|
||||
AlertMsg alertMsg = new AlertMsg
|
||||
{
|
||||
Message = "更新库存失败",
|
||||
|
@ -348,11 +400,11 @@ namespace DM_Weight.ViewModels
|
|||
|
||||
public void FindDrawerCount()
|
||||
{
|
||||
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();
|
||||
Is8Drawer = count < 9;
|
||||
Is16Drawer = count >= 16;
|
||||
Is17Drawer = count > 16;
|
||||
//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();
|
||||
Is8Drawer = App.SingleModel; //count < 9;
|
||||
Is16Drawer = !App.SingleModel; //count >= 16;
|
||||
Is17Drawer = false;//count > 16;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -21,12 +21,38 @@ using DM_Weight.util;
|
|||
using Newtonsoft.Json;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Windows.Controls;
|
||||
using System.Threading.Channels;
|
||||
|
||||
namespace DM_Weight.ViewModels
|
||||
{
|
||||
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 List<ChannelStock> _channelStocks = new List<ChannelStock>();
|
||||
|
@ -138,6 +164,48 @@ namespace DM_Weight.ViewModels
|
|||
{
|
||||
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;
|
||||
_portUtil.SpeakAsync("正在打开" + DrawerNo + "号抽屉");
|
||||
|
||||
|
@ -168,7 +236,7 @@ namespace DM_Weight.ViewModels
|
|||
if (!_isFinishClick)
|
||||
{
|
||||
_isFinishClick = true;
|
||||
List<ChannelStock> record = ChannelStocks.FindAll(it => it.TakeQuantity > 0).ToList();
|
||||
List<ChannelStock> record = ChannelStocks.FindAll(it => it.TakeQuantity != 0).ToList();
|
||||
logger.Info("点击完成按钮,库位数据:" + JsonConvert.SerializeObject(record));
|
||||
if (record.Count > 0)
|
||||
{
|
||||
|
@ -212,12 +280,13 @@ namespace DM_Weight.ViewModels
|
|||
Reviewer = HomeWindowViewModel.Reviewer?.Id,
|
||||
OperationTime = DateTime.Now,
|
||||
Quantity = it.TakeQuantity,
|
||||
Type = 2,
|
||||
Type = SelectedItemUseFor.UseId == 0 ? 2 : SelectedItemUseFor.UseId,
|
||||
InvoiceId = InvoiceId,
|
||||
StockQuantity = nowChannels.Sum(it => it.Quantity),
|
||||
ManunoQuantity = nowChannels.FindAll(it2 => it2.ManuNo == it.ManuNo).Sum(it => it.Quantity),
|
||||
SupplierDept = ConfigurationManager.AppSettings["supplierDept"].ToString(),
|
||||
ReceiveDept = ConfigurationManager.AppSettings["receiveDept"].ToString()
|
||||
ReceiveDept = ConfigurationManager.AppSettings["receiveDept"].ToString(),
|
||||
Status = SelectedItemUseFor.UseId == 0 ? 0 : 2 //不入账册(96)取药后不还空瓶
|
||||
}).ExecuteCommand();
|
||||
logger.Info("Insert_MachineRecord完成");
|
||||
|
||||
|
@ -230,14 +299,7 @@ namespace DM_Weight.ViewModels
|
|||
logger.Info("更新屏显库存singleChannels");
|
||||
// 更新屏显库存
|
||||
//List<ChannelStock> singleChannels = record.FindAll(it => it.BoardType != 1);
|
||||
|
||||
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.Where(it => it.BoardType != 1)
|
||||
List<ChannelStock> singleChannels = ChannelStocks.Where(it => it.BoardType != 1)
|
||||
.GroupBy(it => it.ColNo)
|
||||
.Select(it =>
|
||||
{
|
||||
|
@ -245,7 +307,7 @@ namespace DM_Weight.ViewModels
|
|||
ret.Quantity = it.Sum(itx => itx.Quantity);
|
||||
ret.TakeQuantity = it.Sum(itx => itx.TakeQuantity);
|
||||
return ret;
|
||||
}).OrderBy(it => it.Quantity).ToList();
|
||||
}).ToList();
|
||||
singleChannels = singleChannels.Where(it => it.TakeQuantity > 0).ToList();
|
||||
if ((singleChannels.Count > 0 ? singleChannels[0].BoardType : 1) == 5)
|
||||
{
|
||||
|
@ -256,46 +318,6 @@ namespace DM_Weight.ViewModels
|
|||
{
|
||||
_portUtil.WriteQuantityAsync(it.DrawerNo, it.ColNo, it.Quantity - it.TakeQuantity);
|
||||
});
|
||||
|
||||
Thread.Sleep(500);
|
||||
//string varCS = from cs in ChannelStocks orderby cs.EffDate group cs by cs.ColNo into g orderby g.Key select g.;
|
||||
|
||||
List<ChannelStock> groupCS = ChannelStocks
|
||||
.GroupBy(it => it.ColNo)
|
||||
.Select(it =>
|
||||
{
|
||||
var ret = it.First();
|
||||
return ret;
|
||||
}).ToList();
|
||||
|
||||
if (groupCS != null)
|
||||
{
|
||||
for (int i = 0; i < groupCS.Count; i++)
|
||||
{
|
||||
//全部取出
|
||||
if (groupCS[i].Quantity == groupCS[i].TakeQuantity)
|
||||
{
|
||||
//查询该库位下非0的近效期及批次重新绑定
|
||||
//更新绑定的效期、批次
|
||||
ChannelStock newBind= SqlSugarHelper.Db.Queryable<ChannelStock>()
|
||||
.Where(cs => cs.MachineId == groupCS[i].MachineId)
|
||||
.Where(cs => cs.DrawerNo == groupCS[i].DrawerNo)
|
||||
.Where(cs => cs.ColNo == groupCS[i].ColNo)
|
||||
.Where(cs=>cs.Quantity>0)
|
||||
.OrderBy(cs => cs.EffDate)
|
||||
.First();
|
||||
if (newBind != null)
|
||||
{
|
||||
_portUtil.WriteChannelInfo(6, newBind.EffDate == null ? "" : newBind.EffDate, newBind.DrawerNo , newBind.ColNo);
|
||||
Thread.Sleep(200);
|
||||
_portUtil.WriteChannelInfo(5, newBind.ManuNo == null ? "" : newBind.ManuNo, newBind.DrawerNo, newBind.ColNo);
|
||||
Thread.Sleep(200);
|
||||
_portUtil.ShowContent(newBind.DrawerNo, newBind.ColNo);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
logger.Info("更新屏显库存singleChannels_完成");
|
||||
RequestData();
|
||||
|
@ -308,7 +330,6 @@ namespace DM_Weight.ViewModels
|
|||
}
|
||||
if (!f.IsSuccess)
|
||||
{
|
||||
logger.Info($"抽屉取药,库存更新失败!{f.ErrorMessage}");
|
||||
AlertMsg alertMsg = new AlertMsg
|
||||
{
|
||||
Message = $"抽屉取药完成,库存更新失败!{f.ErrorMessage}",
|
||||
|
@ -354,11 +375,11 @@ namespace DM_Weight.ViewModels
|
|||
|
||||
public void FindDrawerCount()
|
||||
{
|
||||
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();
|
||||
Is8Drawer = count < 9;
|
||||
Is16Drawer = count >= 16;
|
||||
Is17Drawer = count > 16;
|
||||
//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();
|
||||
Is8Drawer = App.SingleModel; //count < 9;
|
||||
Is16Drawer = !App.SingleModel; //count >= 16;
|
||||
Is17Drawer = false;//count > 16;
|
||||
}
|
||||
|
||||
|
||||
|
@ -379,7 +400,6 @@ namespace DM_Weight.ViewModels
|
|||
.Where(cs => cs.DrawerType == 1)
|
||||
.Where(cs => cs.Quantity > 0)
|
||||
.OrderBy(cs => cs.ColNo)
|
||||
.OrderBy(cs => cs.EffDate)
|
||||
.ToList();
|
||||
ChannelStocks = queryData;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace DM_Weight.ViewModels
|
||||
{
|
||||
internal class EmptyWindowViewModel
|
||||
{
|
||||
}
|
||||
}
|
|
@ -38,7 +38,7 @@ namespace DM_Weight.ViewModels
|
|||
private int loginMode = Convert.ToInt32(ConfigurationManager.AppSettings["loginMode"]?.ToString() ?? "1");
|
||||
public bool MultiLogin
|
||||
{
|
||||
get => loginMode == 2;
|
||||
get => !App.SingleModel;// loginMode == 2;
|
||||
}
|
||||
|
||||
private PremissionDm? _selectedMenu;
|
||||
|
@ -206,7 +206,7 @@ namespace DM_Weight.ViewModels
|
|||
logger.Info($"用户【{Operator?.Nickname}】退出登录");
|
||||
Operator = null;
|
||||
Reviewer = null;
|
||||
_regionManager.RequestNavigate("MainRegion", "LoginWindow");
|
||||
_regionManager.RequestNavigate("MainRegion", "BeforeLogin");
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -358,7 +358,7 @@ namespace DM_Weight.ViewModels
|
|||
Reviewer = null;
|
||||
Application.Current.Dispatcher.Invoke(() =>
|
||||
{
|
||||
_regionManager.RequestNavigate("MainRegion", "LoginWindow");
|
||||
_regionManager.RequestNavigate("MainRegion", "BeforeLogin");
|
||||
});
|
||||
AlertMsg alertMsg = new AlertMsg
|
||||
{
|
||||
|
@ -394,7 +394,7 @@ namespace DM_Weight.ViewModels
|
|||
Reviewer = null;
|
||||
Application.Current.Dispatcher.Invoke(() =>
|
||||
{
|
||||
_regionManager.RequestNavigate("MainRegion", "LoginWindow");
|
||||
_regionManager.RequestNavigate("MainRegion", "BeforeLogin");
|
||||
timer.Stop();
|
||||
});
|
||||
}
|
||||
|
@ -433,7 +433,7 @@ namespace DM_Weight.ViewModels
|
|||
logger.Info($"用户【{Operator?.Nickname}】退出登录");
|
||||
Operator = null;
|
||||
Reviewer = null;
|
||||
_regionManager.RequestNavigate("MainRegion", "LoginWindow");
|
||||
_regionManager.RequestNavigate("MainRegion", "BeforeLogin");
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -453,7 +453,7 @@ namespace DM_Weight.ViewModels
|
|||
logger.Info($"用户【{Operator?.Nickname}】退出登录");
|
||||
Operator = null;
|
||||
Reviewer = null;
|
||||
_regionManager.RequestNavigate("MainRegion", "LoginWindow");
|
||||
_regionManager.RequestNavigate("MainRegion", "BeforeLogin");
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -474,7 +474,7 @@ namespace DM_Weight.ViewModels
|
|||
logger.Info($"用户【{Operator?.Nickname}】退出登录");
|
||||
Operator = null;
|
||||
Reviewer = null;
|
||||
_regionManager.RequestNavigate("MainRegion", "LoginWindow");
|
||||
_regionManager.RequestNavigate("MainRegion", "BeforeLogin");
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -493,7 +493,7 @@ namespace DM_Weight.ViewModels
|
|||
logger.Info($"用户【{Operator?.Nickname}】退出登录");
|
||||
Operator = null;
|
||||
Reviewer = null;
|
||||
_regionManager.RequestNavigate("MainRegion", "LoginWindow");
|
||||
_regionManager.RequestNavigate("MainRegion", "BeforeLogin");
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -512,7 +512,7 @@ namespace DM_Weight.ViewModels
|
|||
logger.Info($"用户【{Operator?.Nickname}】退出登录");
|
||||
Operator = null;
|
||||
Reviewer = null;
|
||||
_regionManager.RequestNavigate("MainRegion", "LoginWindow");
|
||||
_regionManager.RequestNavigate("MainRegion", "BeforeLogin");
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -177,6 +177,54 @@ namespace DM_Weight.ViewModels
|
|||
{
|
||||
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();
|
||||
Status = 1;
|
||||
OpenOneByOne();
|
||||
|
@ -202,15 +250,15 @@ namespace DM_Weight.ViewModels
|
|||
|
||||
if ((singleChannels.Count > 0 ? singleChannels[0].BoardType : 1) == 5)
|
||||
{
|
||||
List<ChannelStock> ChannelLst = channelStocks.Where(it => it.BoardType != 1)
|
||||
.GroupBy(it => it.ColNo)
|
||||
.Select(it =>
|
||||
{
|
||||
var ret = it.First();
|
||||
ret.Quantity = it.Sum(itx => itx.Quantity);
|
||||
ret.AddQuantity = it.Sum(itx => itx.AddQuantity);
|
||||
return ret;
|
||||
}).ToList();
|
||||
//List<ChannelStock> ChannelLst = channelStocks.Where(it => it.BoardType != 1)
|
||||
// .GroupBy(it => it.ColNo)
|
||||
// .Select(it =>
|
||||
// {
|
||||
// var ret = it.First();
|
||||
// ret.Quantity = it.Sum(itx => itx.Quantity);
|
||||
// ret.AddQuantity = it.Sum(itx => itx.AddQuantity);
|
||||
// return ret;
|
||||
// }).ToList();
|
||||
|
||||
// 发送加药数量
|
||||
singleChannels.ForEach(it =>
|
||||
|
@ -269,7 +317,8 @@ namespace DM_Weight.ViewModels
|
|||
ManuNo = it.ManuNo,
|
||||
EffDate = it.EffDate,
|
||||
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
|
||||
{
|
||||
|
@ -299,6 +348,7 @@ namespace DM_Weight.ViewModels
|
|||
ManuNo = recordList[0].ManuNo,
|
||||
EffDate = recordList[0].EffDate,
|
||||
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();
|
||||
}
|
||||
else
|
||||
|
@ -316,7 +366,8 @@ namespace DM_Weight.ViewModels
|
|||
DrawerType = it.DrawerType,
|
||||
BoardType = it.BoardType,
|
||||
Id = Guid.NewGuid().ToString(),
|
||||
MachineId = ConfigurationManager.AppSettings["machineId"] ?? "DM1"
|
||||
MachineId = ConfigurationManager.AppSettings["machineId"] ?? "DM1",
|
||||
FillTime = DateTime.Now
|
||||
}).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));
|
||||
|
||||
Thread.Sleep(200);
|
||||
//singleChannels.ForEach(it =>
|
||||
//{
|
||||
// _portUtil.WriteQuantity(it.DrawerNo, it.ColNo, it.Quantity + it.AddQuantity);
|
||||
|
|
|
@ -291,7 +291,7 @@ namespace DM_Weight.ViewModels
|
|||
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 STATUS=0 AND 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)
|
||||
.AddParameters(new
|
||||
|
@ -306,7 +306,9 @@ namespace DM_Weight.ViewModels
|
|||
List<ChannelList> channelL = SqlSugarHelper.Db.Queryable<ChannelList>()
|
||||
.Includes(cl => cl.Drug, di => di.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;
|
||||
if (channelLst == null || channelLst.Id is null)
|
||||
{
|
||||
|
@ -321,13 +323,15 @@ namespace DM_Weight.ViewModels
|
|||
}
|
||||
//ChannelStock stock = new ChannelStock();
|
||||
//查询每种药有多少个批次
|
||||
var invoicesManuNo = SqlSugarHelper.Db.Queryable<InOutInvoice>()
|
||||
.Where(iManuNo => iManuNo.InvoiceNo == invoices[i].InvoiceNo && iManuNo.DrugId == invoices[i].DrugId && iManuNo.Status == 0 && iManuNo.Type != 2 && iManuNo.CancelFlag == 0).ToList();
|
||||
var invoicesManuNo = SqlSugarHelper.Db.Queryable<InOutInvoice>().Includes<DrugInfo>(oi=>oi.DrugInfo).InnerJoin<DrugInfo>((oi,di)=>oi.DrugId==di.DrugId)
|
||||
.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++)
|
||||
{
|
||||
//查询是否有库存
|
||||
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"))
|
||||
.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();
|
||||
if (stockList == null || stockList.Count <= 0)
|
||||
|
@ -354,7 +358,6 @@ namespace DM_Weight.ViewModels
|
|||
stock.ManuNo = invoicesManuNo[j].DrugManuNo;
|
||||
stock.EffDate = manuNoList[0].EffDate;
|
||||
stock.Chnguid = channelLst.Id;
|
||||
stock.InvoiceQuantity = invoicesManuNo[j].quantity;
|
||||
stockList.Add(stock);
|
||||
}
|
||||
//stock.AddQuantity = invoicesManuNo[j].quantity;
|
||||
|
@ -363,8 +366,7 @@ namespace DM_Weight.ViewModels
|
|||
.Select(it =>
|
||||
{
|
||||
var ret = it.First();
|
||||
ret.AddQuantity = invoicesManuNo[j].quantity;
|
||||
ret.InvoiceQuantity = invoicesManuNo[j].quantity;
|
||||
ret.AddQuantity = invoicesManuNo[j].Units== invoicesManuNo[j].DrugInfo.SmallUnit? invoicesManuNo[j].quantity: invoicesManuNo[j].quantity* invoicesManuNo[j].DrugInfo.ConvertRatio;
|
||||
return ret;
|
||||
})
|
||||
.ToList();
|
||||
|
@ -392,8 +394,7 @@ namespace DM_Weight.ViewModels
|
|||
ChannelStocks.Clear();
|
||||
foreach (ChannelList lst in ChannelLsts)
|
||||
{
|
||||
|
||||
ChannelStocks.AddRange(lst.channelStocks.Where(cs => cs.AddQuantity > 9));
|
||||
ChannelStocks.AddRange(lst.channelStocks);
|
||||
}
|
||||
AddChannels = ChannelStocks.FindAll(it => it.AddQuantity != 0);
|
||||
|
||||
|
@ -417,17 +418,17 @@ namespace DM_Weight.ViewModels
|
|||
_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;
|
||||
//}
|
||||
int totalNum = AddChannels.Sum(add => add.AddQuantity);
|
||||
if (totalNum != SelectedInvoice.Quantity)
|
||||
{
|
||||
AlertMsg alertMsg = new AlertMsg
|
||||
{
|
||||
Message = "各批次添加数量要与调拨单药品总数一致!",
|
||||
Type = MsgType.ERROR,
|
||||
};
|
||||
_eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
|
||||
return;
|
||||
}
|
||||
enumerator.MoveNext();
|
||||
Status = 1;
|
||||
OpenOneByOne();
|
||||
|
@ -509,51 +510,25 @@ namespace DM_Weight.ViewModels
|
|||
if (!_isFinishClick)
|
||||
{
|
||||
_isFinishClick = true;
|
||||
List<ChannelStock> record = ChannelStocks;//.ToList();
|
||||
List<ChannelStock> record = ChannelStocks.ToList();
|
||||
string InvoiceId = SelectedInvoice.InvoiceNo;
|
||||
var f = SqlSugarHelper.Db.UseTran(() =>
|
||||
{
|
||||
SqlSugarHelper.Db.Updateable(new InOutInvoice()
|
||||
{
|
||||
Status = 1,
|
||||
InvoiceNo = SelectedInvoice.InvoiceNo
|
||||
}).UpdateColumns(it => new { it.Status }).WhereColumns(it => new { it.InvoiceNo }).ExecuteCommand();
|
||||
|
||||
for (int i = 0; i < record.Count; i++)
|
||||
{
|
||||
//添加数量不能大于入库单上要加的数量
|
||||
if (record[i].AddQuantity > record[i].InvoiceQuantity)
|
||||
{
|
||||
AlertMsg alertMsg = new AlertMsg
|
||||
{
|
||||
Message = "添加数量不能大于调拨单中药品数量!",
|
||||
Type = MsgType.ERROR,
|
||||
};
|
||||
_eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
|
||||
return false;
|
||||
}
|
||||
//添加数量等于入库单上要加的数量则更新入库单状态
|
||||
if (record[i].AddQuantity == record[i].InvoiceQuantity)
|
||||
{
|
||||
SqlSugarHelper.Db.Updateable(new InOutInvoice()
|
||||
{
|
||||
Status = 1,
|
||||
InvoiceNo = SelectedInvoice.InvoiceNo,
|
||||
DrugManuNo = record[i].ManuNo,
|
||||
DrugId = record[i].DrugId
|
||||
|
||||
}).UpdateColumns(it => new { it.Status }).WhereColumns(it => new { it.InvoiceNo, it.DrugId, it.DrugManuNo }).ExecuteCommand();
|
||||
}
|
||||
else
|
||||
{
|
||||
//添加数量小于入库单上要加的数量则更新入库单中的数量
|
||||
SqlSugarHelper.Db.Updateable(new InOutInvoice()
|
||||
{
|
||||
quantity= record[i].InvoiceQuantity- record[i].AddQuantity,
|
||||
InvoiceNo = SelectedInvoice.InvoiceNo,
|
||||
DrugManuNo = record[i].ManuNo,
|
||||
DrugId = record[i].DrugId
|
||||
|
||||
}).UpdateColumns(it => new { it.Status }).WhereColumns(it => new { it.InvoiceNo, it.DrugId, it.DrugManuNo }).ExecuteCommand();
|
||||
|
||||
}
|
||||
|
||||
|
||||
ChannelStock it = record[i];
|
||||
if(it.AddQuantity<=0)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (it.BoardType == 6 && it.PosNo == 0)
|
||||
{
|
||||
_portUtil.SetNumCount(it.DrawerNo, it.ColNo, it.AddQuantity);
|
||||
|
@ -652,7 +627,7 @@ namespace DM_Weight.ViewModels
|
|||
{
|
||||
// 更新屏显库存
|
||||
//List<ChannelStock> singleChannels = record.FindAll(it => it.BoardType != 1);
|
||||
List<ChannelStock> singleChannels = record.Where(it => it.BoardType == 5)
|
||||
List<ChannelStock> singleChannels = record.Where(it => it.BoardType != 1&&it.AddQuantity>0)
|
||||
.GroupBy(it => new { it.DrawerNo, it.ColNo })
|
||||
.Select(it =>
|
||||
{
|
||||
|
@ -666,25 +641,24 @@ namespace DM_Weight.ViewModels
|
|||
{
|
||||
for (int i = 0; i < singleChannels.Count; i++)
|
||||
{
|
||||
//if (singleChannels[i].BoardType == 5)
|
||||
//{
|
||||
List<ChannelStock> channelStockEffDate = SqlSugarHelper.Db.Queryable<ChannelStock>()
|
||||
.Where(cs => cs.MachineId == singleChannels[i].MachineId)
|
||||
.Where(cs => cs.DrawerNo == singleChannels[i].DrawerNo)
|
||||
.Where(cs => cs.ColNo == singleChannels[i].ColNo)
|
||||
.Where(cs => cs.Quantity > 0)
|
||||
.OrderBy(cs => cs.EffDate).ToList();
|
||||
int totalQuantity = channelStockEffDate.Sum(it => it.Quantity);
|
||||
if (singleChannels[i].BoardType == 5)
|
||||
{
|
||||
List<ChannelStock> channelStockEffDate = SqlSugarHelper.Db.Queryable<ChannelStock>()
|
||||
.Where(cs => cs.MachineId == singleChannels[i].MachineId)
|
||||
.Where(cs => cs.DrawerNo == singleChannels[i].DrawerNo)
|
||||
.Where(cs => cs.ColNo == singleChannels[i].ColNo&&cs.Quantity>0)
|
||||
.OrderBy(cs => cs.EffDate).ToList();
|
||||
int totalQuantity = channelStockEffDate.Sum(it => it.Quantity);
|
||||
|
||||
//将库位多批次的总库存数更新标签
|
||||
_portUtil.WriteQuantity(channelStockEffDate[0].DrawerNo, channelStockEffDate[0].ColNo, totalQuantity);
|
||||
Thread.Sleep(200);
|
||||
_portUtil.WriteChannelInfo(6, channelStockEffDate[0].EffDate == null ? "" : channelStockEffDate[0].EffDate, channelStockEffDate[0].DrawerNo, channelStockEffDate[0].ColNo);
|
||||
Thread.Sleep(200);
|
||||
_portUtil.WriteChannelInfo(5, channelStockEffDate[0].ManuNo, channelStockEffDate[0].DrawerNo, channelStockEffDate[0].ColNo);
|
||||
Thread.Sleep(200);
|
||||
_portUtil.ShowContent(channelStockEffDate[0].DrawerNo, channelStockEffDate[0].ColNo);
|
||||
//}
|
||||
//将库位多批次的总库存数更新标签
|
||||
_portUtil.WriteQuantity(channelStockEffDate[0].DrawerNo, channelStockEffDate[0].ColNo, totalQuantity);
|
||||
Thread.Sleep(200);
|
||||
_portUtil.WriteChannelInfo(6, channelStockEffDate[0].EffDate == null ? "" : channelStockEffDate[0].EffDate, channelStockEffDate[0].DrawerNo, channelStockEffDate[0].ColNo);
|
||||
Thread.Sleep(200);
|
||||
_portUtil.WriteChannelInfo(5, channelStockEffDate[0].ManuNo, channelStockEffDate[0].DrawerNo, channelStockEffDate[0].ColNo);
|
||||
Thread.Sleep(200);
|
||||
_portUtil.ShowContent(channelStockEffDate[0].DrawerNo, channelStockEffDate[0].ColNo);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -697,11 +671,9 @@ namespace DM_Weight.ViewModels
|
|||
Type = MsgType.SUCCESS,
|
||||
};
|
||||
_eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
|
||||
RequestData();
|
||||
}
|
||||
if (!f.IsSuccess)
|
||||
{
|
||||
logger.Info($"调拨入库,库存更新失败!{f.ErrorMessage}");
|
||||
AlertMsg alertMsg = new AlertMsg
|
||||
{
|
||||
Message = "库存更新失败!",
|
||||
|
@ -713,6 +685,7 @@ namespace DM_Weight.ViewModels
|
|||
_isFinishClick = false;
|
||||
|
||||
}
|
||||
RequestData();
|
||||
});
|
||||
}
|
||||
// 取消按钮
|
||||
|
@ -775,11 +748,11 @@ namespace DM_Weight.ViewModels
|
|||
var sb = new StringBuilder();
|
||||
//sb.Append("select i.invoice_no as InvoiceNo, i.invoice_date as InvoiceDate, COUNT(i.id) as `Count`, SUM(i.quantity) as quantity, p1.pharmacy_name as PharmacyName1, p2.pharmacy_name as PharmacyName2 from in_out_invoice i");
|
||||
sb.Append(" 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(" FROM in_out_invoice where status=@Status and type!=@type and cancel_flag=@CancelFlag GROUP BY invoice_no,drug_id) i ");
|
||||
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 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(" left join pharmacy_info p1 on p1.pharmacy_id = i.in_pharmacy_id");
|
||||
sb.Append(" left join pharmacy_info p2 on p2.pharmacy_id = i.out_pharmacy_id where 1=1");
|
||||
sb.Append(" left join pharmacy_info p1 on p1.pharmacy = i.in_pharmacy_id");
|
||||
sb.Append(" left join pharmacy_info p2 on p2.pharmacy = i.out_pharmacy_id where 1=1");
|
||||
//sb.Append(" where i.status=@Status ");
|
||||
//sb.Append(" and i.type!=@type ");
|
||||
//sb.Append(" and i.cancel_flag=@CancelFlag ");
|
||||
|
@ -800,7 +773,7 @@ namespace DM_Weight.ViewModels
|
|||
Invoices = SqlSugarHelper.Db.SqlQueryable<dynamic>(sb.ToString())
|
||||
.AddParameters(new
|
||||
{
|
||||
Status = 0,
|
||||
Status = 2,
|
||||
type = 2,
|
||||
CancelFlag = 0,
|
||||
CreateTime = OrderDate,
|
||||
|
|
|
@ -214,8 +214,8 @@ namespace DM_Weight.ViewModels
|
|||
var sb = new StringBuilder();
|
||||
sb.Append("select i.invoice_no as InvoiceNo, i.invoice_date as InvoiceDate, COUNT(i.id) as `Count`, SUM(i.quantity) as quantity, p1.pharmacy_name as PharmacyName1, p2.pharmacy_name as PharmacyName2 from in_out_invoice i");
|
||||
sb.Append(" inner join ( select c.drug_id as drug_id from channel_stock c where c.machine_id = '" + (ConfigurationManager.AppSettings["machineId"] ?? "DM1") + "' group by c.drug_id ) di on di.drug_id = i.drug_id");
|
||||
sb.Append(" left join pharmacy_info p1 on p1.pharmacy_id = i.in_pharmacy_id");
|
||||
sb.Append(" left join pharmacy_info p2 on p2.pharmacy_id = i.out_pharmacy_id");
|
||||
sb.Append(" left join pharmacy_info p1 on p1.pharmacy = i.in_pharmacy_id");
|
||||
sb.Append(" left join pharmacy_info p2 on p2.pharmacy = i.out_pharmacy_id");
|
||||
sb.Append(" where i.status=@Status ");
|
||||
sb.Append(" and i.type!=@type ");
|
||||
sb.Append(" and i.cancel_flag=@CancelFlag ");
|
||||
|
|
|
@ -252,6 +252,54 @@ namespace DM_Weight.ViewModels
|
|||
{
|
||||
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);
|
||||
enumerator = enumerable.GetEnumerator();
|
||||
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));
|
||||
|
||||
Thread.Sleep(200);
|
||||
//singleChannels.ForEach(it =>
|
||||
//{
|
||||
// _portUtil.WriteQuantity(it.DrawerNo, it.ColNo, it.Quantity - it.TakeQuantity);
|
||||
|
|
|
@ -46,13 +46,15 @@ namespace DM_Weight.ViewModels
|
|||
|
||||
public bool SingleLogin
|
||||
{
|
||||
get => ReadAppSetting("loginMode") == "1";
|
||||
//get => ReadAppSetting("loginMode") == "1";
|
||||
//get => loginMode == 1;
|
||||
get;set;
|
||||
}
|
||||
public bool MultiLogin
|
||||
{
|
||||
//get => loginMode == 2;
|
||||
get => ReadAppSetting("loginMode") == "2";
|
||||
//get => ReadAppSetting("loginMode") == "2";
|
||||
get;set;
|
||||
}
|
||||
private FingerprintUtil _fingerprintUtil;
|
||||
|
||||
|
@ -158,23 +160,29 @@ _exitCommand ??= new DelegateCommand(Exit);
|
|||
|
||||
if (userList == null)
|
||||
{
|
||||
AlertMsg alertMsg = new AlertMsg
|
||||
System.Windows.Application.Current.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Send, new Action(() =>
|
||||
{
|
||||
Message = "无此用户",
|
||||
Type = MsgType.ERROR
|
||||
};
|
||||
_eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
|
||||
AlertMsg alertMsg = new AlertMsg
|
||||
{
|
||||
Message = "无此用户",
|
||||
Type = MsgType.ERROR
|
||||
};
|
||||
_eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
|
||||
}));
|
||||
Username = "";
|
||||
Password = "";
|
||||
}
|
||||
else if (userList.Role == null)
|
||||
{
|
||||
AlertMsg alertMsg = new AlertMsg
|
||||
System.Windows.Application.Current.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Send, new Action(() =>
|
||||
{
|
||||
Message = "用户还未设置权限,请联系管理员",
|
||||
Type = MsgType.ERROR
|
||||
};
|
||||
_eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
|
||||
AlertMsg alertMsg = new AlertMsg
|
||||
{
|
||||
Message = "用户还未设置权限,请联系管理员",
|
||||
Type = MsgType.ERROR
|
||||
};
|
||||
_eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
|
||||
}));
|
||||
Username = "";
|
||||
Password = "";
|
||||
}
|
||||
|
@ -187,12 +195,15 @@ _exitCommand ??= new DelegateCommand(Exit);
|
|||
}
|
||||
else
|
||||
{
|
||||
AlertMsg alertMsg = new AlertMsg
|
||||
System.Windows.Application.Current.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Send, new Action(() =>
|
||||
{
|
||||
Message = "密码错误",
|
||||
Type = MsgType.ERROR
|
||||
};
|
||||
_eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
|
||||
AlertMsg alertMsg = new AlertMsg
|
||||
{
|
||||
Message = "密码错误",
|
||||
Type = MsgType.ERROR
|
||||
};
|
||||
_eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
|
||||
}));
|
||||
Password = "";
|
||||
}
|
||||
}
|
||||
|
@ -200,12 +211,15 @@ _exitCommand ??= new DelegateCommand(Exit);
|
|||
}
|
||||
else
|
||||
{
|
||||
AlertMsg alertMsg = new AlertMsg
|
||||
System.Windows.Application.Current.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Send, new Action(() =>
|
||||
{
|
||||
Message = "请输入账号或密码",
|
||||
Type = MsgType.ERROR
|
||||
};
|
||||
_eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
|
||||
AlertMsg alertMsg = new AlertMsg
|
||||
{
|
||||
Message = "请输入账号或密码",
|
||||
Type = MsgType.ERROR
|
||||
};
|
||||
_eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
|
||||
}));
|
||||
}
|
||||
LoginBtnEnable = true;
|
||||
}
|
||||
|
@ -251,12 +265,15 @@ _exitCommand ??= new DelegateCommand(Exit);
|
|||
}
|
||||
else
|
||||
{
|
||||
AlertMsg alertMsg = new AlertMsg
|
||||
System.Windows.Application.Current.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Send, new Action(() =>
|
||||
{
|
||||
Message = "该发药人账号已登录,请输入不同账号",
|
||||
Type = MsgType.ERROR
|
||||
};
|
||||
_eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
|
||||
AlertMsg alertMsg = new AlertMsg
|
||||
{
|
||||
Message = "该发药人账号已登录,请输入不同账号",
|
||||
Type = MsgType.ERROR
|
||||
};
|
||||
_eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
|
||||
}));
|
||||
}
|
||||
}
|
||||
// 如果已经录入了审核人, 已经有一个用户登录
|
||||
|
@ -280,12 +297,15 @@ _exitCommand ??= new DelegateCommand(Exit);
|
|||
}
|
||||
else
|
||||
{
|
||||
AlertMsg alertMsg = new AlertMsg
|
||||
System.Windows.Application.Current.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Send, new Action(() =>
|
||||
{
|
||||
Message = "该审核人账号已登录,请输入不同账号",
|
||||
Type = MsgType.ERROR
|
||||
};
|
||||
_eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
|
||||
AlertMsg alertMsg = new AlertMsg
|
||||
{
|
||||
Message = "该审核人账号已登录,请输入不同账号",
|
||||
Type = MsgType.ERROR
|
||||
};
|
||||
_eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
|
||||
}));
|
||||
}
|
||||
}
|
||||
// 第一个用户登录
|
||||
|
@ -339,32 +359,38 @@ _exitCommand ??= new DelegateCommand(Exit);
|
|||
logger.Info($"msg.Message.Equals:{msg.Message}");
|
||||
if (msg.Message.Equals("LOGIN"))
|
||||
{
|
||||
//UserList userList = SqlSugarHelper.Db.Queryable<UserList>()
|
||||
//.Includes<RoleDm>(u => u.Role)
|
||||
//.First(u => u.Id == msg.Id);
|
||||
UserList userList = SqlSugarHelper.Db.Queryable<UserList>()
|
||||
.Includes<RoleDm>(u => u.Role)
|
||||
.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}");
|
||||
if (userList == null)
|
||||
{
|
||||
AlertMsg alertMsg = new AlertMsg
|
||||
System.Windows.Application.Current.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Send, new Action(() =>
|
||||
{
|
||||
Message = "无此用户",
|
||||
Type = MsgType.ERROR
|
||||
};
|
||||
_eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
|
||||
AlertMsg alertMsg = new AlertMsg
|
||||
{
|
||||
Message = "无此用户",
|
||||
Type = MsgType.ERROR
|
||||
};
|
||||
_eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
|
||||
}));
|
||||
Username = "";
|
||||
Password = "";
|
||||
}
|
||||
else if (userList.Role == null)
|
||||
{
|
||||
AlertMsg alertMsg = new AlertMsg
|
||||
System.Windows.Application.Current.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Send, new Action(() =>
|
||||
{
|
||||
Message = "用户还未设置权限,请联系管理员",
|
||||
Type = MsgType.ERROR
|
||||
};
|
||||
_eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
|
||||
AlertMsg alertMsg = new AlertMsg
|
||||
{
|
||||
Message = "用户还未设置权限,请联系管理员",
|
||||
Type = MsgType.ERROR
|
||||
};
|
||||
_eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
|
||||
}));
|
||||
Username = "";
|
||||
Password = "";
|
||||
}
|
||||
|
@ -393,6 +419,9 @@ _exitCommand ??= new DelegateCommand(Exit);
|
|||
//接收导航传过来的参数 现在是在此处初始化了表格数据
|
||||
public void OnNavigatedTo(NavigationContext navigationContext)
|
||||
{
|
||||
SingleLogin = navigationContext.Parameters.GetValue<bool>("SingleLogin");
|
||||
MultiLogin = !SingleLogin;
|
||||
|
||||
FingerMsg = !_fingerprintUtil.bIsConnected;//false;
|
||||
_eventAggregator.GetEvent<FingerprintEvent>().Subscribe(LoginEvent);
|
||||
}
|
||||
|
|
|
@ -341,6 +341,22 @@ namespace DM_Weight.ViewModels
|
|||
}
|
||||
|
||||
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 System.Runtime.CompilerServices;
|
||||
using SqlSugar;
|
||||
using System.Configuration;
|
||||
|
||||
namespace DM_Weight.ViewModels
|
||||
{
|
||||
|
@ -75,17 +76,23 @@ namespace DM_Weight.ViewModels
|
|||
_screenUtil = screenUtil;
|
||||
_regionManager = regionManager;
|
||||
_container = container;
|
||||
_portUtil = portUtil;
|
||||
_portUtil = portUtil;
|
||||
//this.SqlSugarHelper.Db=sqlSugarScope;
|
||||
|
||||
System.Windows.Application.Current.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Send, new Action(() =>
|
||||
{
|
||||
_container.RegisterType<object, LoginWindow>("LoginWindow");
|
||||
_regionManager.RequestNavigate("MainRegion", "LoginWindow");
|
||||
//_container.RegisterType<object, LoginWindow>("LoginWindow");
|
||||
//_regionManager.RequestNavigate("MainRegion", "LoginWindow");
|
||||
|
||||
_container.RegisterType<object, BeforeLogin>("BeforeLogin");
|
||||
_regionManager.RequestNavigate("MainRegion", "BeforeLogin");
|
||||
|
||||
}));
|
||||
|
||||
Task.Factory.StartNew(() => BindStock());
|
||||
string bAutoWriteNum = ConfigurationManager.AppSettings["AutoWriteNum"] ?? "false";
|
||||
if (bAutoWriteNum == "true")
|
||||
{
|
||||
Task.Factory.StartNew(() => BindStock());
|
||||
}
|
||||
}
|
||||
|
||||
void doMyPrismEvent2(AlertMsg msg)
|
||||
|
@ -107,9 +114,12 @@ namespace DM_Weight.ViewModels
|
|||
//写标签数量
|
||||
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 })
|
||||
.Select(cs => {
|
||||
.Select(cs =>
|
||||
{
|
||||
var ret = cs.First();
|
||||
ret.Quantity = cs.Sum(xt => xt.Quantity);
|
||||
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;
|
||||
//}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
|
@ -22,7 +22,6 @@ using DM_Weight.Port;
|
|||
using DM_Weight.select;
|
||||
using DM_Weight.util;
|
||||
using System.Threading;
|
||||
using System.Collections;
|
||||
|
||||
namespace DM_Weight.ViewModels
|
||||
{
|
||||
|
@ -248,6 +247,53 @@ namespace DM_Weight.ViewModels
|
|||
{
|
||||
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);
|
||||
enumerator = enumerable.GetEnumerator();
|
||||
enumerator.MoveNext();
|
||||
|
@ -266,13 +312,14 @@ namespace DM_Weight.ViewModels
|
|||
channelStocks.ForEach(it => it.process = 1);
|
||||
_portUtil.SpeakAsync("正在打开" + DrawerNo + "号抽屉");
|
||||
|
||||
|
||||
List<ChannelStock> singleChannels = new List<ChannelStock>();
|
||||
for (int i = 0; i < channelStocks.Count; i++)
|
||||
{
|
||||
ChannelStock copy = TransExpV2<ChannelStock, ChannelStock>.Trans(channelStocks[i]);
|
||||
ChannelStock copy=TransExpV2<ChannelStock, ChannelStock>.Trans(channelStocks[i]);
|
||||
singleChannels.Add(copy);
|
||||
}
|
||||
singleChannels = singleChannels
|
||||
singleChannels= singleChannels
|
||||
.GroupBy(it => new { it.DrawerNo, it.ColNo })
|
||||
.Select(it =>
|
||||
{
|
||||
|
@ -386,29 +433,32 @@ namespace DM_Weight.ViewModels
|
|||
{
|
||||
if (singleChannels[i].BoardType == 5)
|
||||
{
|
||||
List<ChannelStock> channels = 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)
|
||||
.OrderBy(cs => cs.EffDate).ToList();
|
||||
if (channels != null && channels.Count > 0)
|
||||
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)
|
||||
{
|
||||
if (channels[0].Quantity == 0)
|
||||
{
|
||||
//近效期的数量是0,则查该抽屉库位下库存不是0的,有则绑定
|
||||
ChannelStock cs = channels.Where(cs => cs.Quantity > 0).OrderBy(it => it.EffDate).FirstOrDefault();
|
||||
if (cs != null)
|
||||
{
|
||||
_portUtil.WriteChannelInfo(6, cs.EffDate == null ? "" : cs.EffDate, cs.DrawerNo, cs.ColNo);
|
||||
Thread.Sleep(200);
|
||||
_portUtil.WriteChannelInfo(5, cs.ManuNo, cs.DrawerNo, cs.ColNo);
|
||||
Thread.Sleep(200);
|
||||
_portUtil.ShowContent(cs.DrawerNo, cs.ColNo);
|
||||
}
|
||||
}
|
||||
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(singleChannels[i].DrawerNo, singleChannels[i].ColNo, channels.Sum(cs => cs.Quantity));
|
||||
_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,6 +35,15 @@ namespace DM_Weight.ViewModels
|
|||
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;
|
||||
|
@ -172,10 +181,19 @@ namespace DM_Weight.ViewModels
|
|||
public void RequestData()
|
||||
{
|
||||
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)
|
||||
.Where(od=>od.DMStatus==0)
|
||||
.Where(od => od.OrderNo == OrderInfo.OrderNo)
|
||||
.Where(od => od.OrderNo == OrderInfo.OrderNo&&od.DetailStatus==0)
|
||||
.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>();
|
||||
|
@ -184,6 +202,12 @@ namespace DM_Weight.ViewModels
|
|||
{
|
||||
OrderDetail orderDetail = orderDetails[i];
|
||||
|
||||
//bool bAdmin=false;
|
||||
////有开后8个抽屉的权限
|
||||
//if(App.CurrentFaUserList.Role.LastEightChecked=="1")
|
||||
//{
|
||||
// bAdmin = true;
|
||||
//}
|
||||
List<ChannelStock> HasQChannels = SqlSugarHelper.Db.Queryable<ChannelStock>()
|
||||
.Includes<DrugInfo>(cs => cs.DrugInfo)
|
||||
.InnerJoin<ChannelList>((cs, cl) => cs.Chnguid == cl.Id && cs.DrugId == cl.DrugId)
|
||||
|
@ -193,9 +217,12 @@ namespace DM_Weight.ViewModels
|
|||
.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.DrawerNo)
|
||||
//.OrderBy(cs => cs.ManuNo)
|
||||
.OrderBy(cs=>cs.FillTime)
|
||||
.ToList();
|
||||
int total = HasQChannels.Sum(it => it.Quantity);
|
||||
int TakeQ = orderDetail.Quantity;
|
||||
|
@ -207,14 +234,12 @@ namespace DM_Weight.ViewModels
|
|||
ChannelStock stock = HasQChannels[j];
|
||||
if (TakeQ > stock.Quantity)
|
||||
{
|
||||
stock.OrderQuantity= orderDetail.Quantity;
|
||||
stock.TakeQuantity = stock.Quantity;
|
||||
channelStocks.Add(stock);
|
||||
TakeQ -= stock.Quantity;
|
||||
}
|
||||
else
|
||||
{
|
||||
stock.OrderQuantity = orderDetail.Quantity;
|
||||
stock.TakeQuantity = TakeQ;
|
||||
channelStocks.Add(stock);
|
||||
TakeQ = 0;
|
||||
|
@ -223,16 +248,7 @@ namespace DM_Weight.ViewModels
|
|||
}
|
||||
else
|
||||
{
|
||||
//msg.Add($"药品【{orderDetail.DrugInfo.DrugName}】库存不足,应取【{TakeQ}】库存【{total}】");
|
||||
//数量不够就把全部数量取出
|
||||
for (int n = 0; n < HasQChannels.Count; n++)
|
||||
{
|
||||
ChannelStock stock = HasQChannels[n];
|
||||
stock.OrderQuantity = TakeQ;
|
||||
stock.TakeQuantity = stock.Quantity;
|
||||
channelStocks.Add(stock);
|
||||
}
|
||||
|
||||
msg.Add($"药品【{HasQChannels[0].DrugInfo.DrugName}】库存不足,应取【{TakeQ}】库存【{total}】");
|
||||
}
|
||||
}
|
||||
if (msg.Count > 0)
|
||||
|
@ -290,25 +306,25 @@ namespace DM_Weight.ViewModels
|
|||
ChannelStock copy = TransExpV2<ChannelStock, ChannelStock>.Trans(channelStocks[i]);
|
||||
singleChannels.Add(copy);
|
||||
}
|
||||
|
||||
singleChannels = singleChannels
|
||||
.GroupBy(it => new { it.DrawerNo, it.ColNo })
|
||||
.Select(it =>
|
||||
{
|
||||
var ret = it.First();
|
||||
ret.Quantity = it.Sum(it => it.Quantity);
|
||||
ret.TakeQuantity = it.Sum(it => it.TakeQuantity);
|
||||
return ret;
|
||||
})
|
||||
.ToList()
|
||||
.FindAll(it => it.BoardType != 1);
|
||||
.GroupBy(it => new { it.DrawerNo, it.ColNo })
|
||||
.Select(it =>
|
||||
{
|
||||
var ret = it.First();
|
||||
ret.Quantity = it.Sum(it => it.Quantity);
|
||||
ret.TakeQuantity = it.Sum(it => it.TakeQuantity);
|
||||
return ret;
|
||||
})
|
||||
.ToList()
|
||||
.FindAll(it => it.BoardType != 1);
|
||||
|
||||
// 发送取药数量
|
||||
singleChannels.ForEach(it =>
|
||||
{
|
||||
try
|
||||
{
|
||||
_portUtil.TakeQuantity(DrawerNo, it.ColNo, it.Quantity, it.Quantity - it.TakeQuantity);
|
||||
|
||||
_portUtil.TakeQuantity(DrawerNo, it.ColNo, it.TakeQuantity, it.Quantity - it.TakeQuantity);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
@ -340,56 +356,31 @@ namespace DM_Weight.ViewModels
|
|||
List<ChannelStock> record = ChannelStocks.FindAll(it => it.TakeQuantity > 0).ToList();
|
||||
if (record.Count > 0)
|
||||
{
|
||||
string InvoiceId = OrderInfo.OrderNo;
|
||||
try
|
||||
{
|
||||
SqlSugarHelper.Db.BeginTran();
|
||||
//如果处方下全部药品都取完则更新orderInfo,order_detail中的dm_status
|
||||
if (ChannelStocks.Sum(cs => cs.TakeQuantity) == ChannelStocks.Sum(cs => cs.OrderQuantity))
|
||||
{
|
||||
logger.Info($"更新OrderInfo:{InvoiceId}");
|
||||
SqlSugarHelper.Db.Updateable(new OrderInfo()
|
||||
{
|
||||
DmStatus = 1,
|
||||
OrderNo = OrderInfo.OrderNo
|
||||
}).UpdateColumns(it => new { it.DmStatus }).WhereColumns(it => new { it.OrderNo }).ExecuteCommand();
|
||||
SqlSugarHelper.Db.Updateable(new OrderDetail()
|
||||
{
|
||||
DMStatus = 1,
|
||||
OrderNo = OrderInfo.OrderNo
|
||||
}).UpdateColumns(it => new { it.DMStatus }).WhereColumns(it => new { it.OrderNo }).ExecuteCommand();
|
||||
}
|
||||
|
||||
logger.Info("进入record循环");
|
||||
string InvoiceId = OrderInfo.OrderNo;
|
||||
var f = SqlSugarHelper.Db.UseTran(() =>
|
||||
{
|
||||
SqlSugarHelper.Db.Updateable(new OrderInfo()
|
||||
{
|
||||
DmStatus = 1,
|
||||
OrderNo = OrderInfo.OrderNo
|
||||
}).UpdateColumns(it => new { it.DmStatus }).WhereColumns(it => new { it.OrderNo }).ExecuteCommand();
|
||||
|
||||
//SqlSugarHelper.Db.Insertable(new OrderFinish()
|
||||
//{
|
||||
// OrderNo = OrderInfo.OrderNo,
|
||||
// PatientId = OrderInfo.PatientId,
|
||||
// Pharmacy = OrderInfo.Pharmacy,
|
||||
// State = 1,
|
||||
// Operator = HomeWindowViewModel.Operator?.Nickname,
|
||||
//});
|
||||
|
||||
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];
|
||||
//该药品下的所有取出数量
|
||||
int alTakeQuantity=record.Where(rd=>rd.DrugId==it.DrugId).Sum(rd=>rd.TakeQuantity);
|
||||
//处方下某一个药品都取完则更新order_detail
|
||||
if(it.OrderQuantity==it.TakeQuantity|| it.OrderQuantity == alTakeQuantity)
|
||||
{
|
||||
SqlSugarHelper.Db.Updateable(new OrderDetail()
|
||||
{
|
||||
DMStatus = 1,
|
||||
OrderNo = OrderInfo.OrderNo,
|
||||
DrugId= it.DrugId,
|
||||
}).UpdateColumns(it => new { it.DMStatus }).WhereColumns(it => new { it.OrderNo,it.DrugId }).ExecuteCommand();
|
||||
}
|
||||
else
|
||||
{
|
||||
//处方下某一个药品没有取完则更新order_detail中的取药数量(应取-已取)
|
||||
SqlSugarHelper.Db.Updateable(new OrderDetail()
|
||||
{
|
||||
Quantity = it.OrderQuantity- alTakeQuantity,
|
||||
OrderNo = OrderInfo.OrderNo,
|
||||
DrugId = it.DrugId,
|
||||
}).UpdateColumns(it => new { it.Quantity }).WhereColumns(it => new { it.OrderNo, it.DrugId }).ExecuteCommand();
|
||||
}
|
||||
|
||||
logger.Info($"更新ChannelStock:{it.Id}");
|
||||
// 更新数据 库存信息
|
||||
SqlSugarHelper.Db.Updateable(new ChannelStock()
|
||||
{
|
||||
|
@ -398,14 +389,13 @@ namespace DM_Weight.ViewModels
|
|||
EffDate = it.EffDate,
|
||||
Id = it.Id,
|
||||
}).UpdateColumns(it => new { it.Quantity, it.ManuNo, it.EffDate }).ExecuteCommand();
|
||||
|
||||
// 获取更新完库存后的药品库存
|
||||
List<ChannelStock> nowChannels = SqlSugarHelper.Db.Queryable<ChannelStock>()
|
||||
.Where(cs => cs.MachineId.Equals(it.MachineId))
|
||||
.Where(cs => cs.DrugId.Equals(it.DrugId))
|
||||
.Where(cs => cs.DrawerType == 1)
|
||||
.ToList();
|
||||
logger.Info($"保存MachineRecord:{it.ManuNo}");
|
||||
|
||||
// 保存数据 出库记录
|
||||
SqlSugarHelper.Db.Insertable(new MachineRecord()
|
||||
{
|
||||
|
@ -424,73 +414,83 @@ namespace DM_Weight.ViewModels
|
|||
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.DeptName
|
||||
ReceiveDept = OrderInfo.DeptName,
|
||||
ReceivePerson = ReceivePerson,
|
||||
OrdinalNum = ordinalNum<=0?1:ordinalNum+ 1,
|
||||
}).ExecuteCommand();
|
||||
logger.Info("结束循环");
|
||||
}
|
||||
|
||||
SqlSugarHelper.Db.CommitTran();
|
||||
|
||||
logger.Info("事务已提交");
|
||||
//更新处方明细状态为已取药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;
|
||||
});
|
||||
if (f.Data)
|
||||
{
|
||||
// 更新屏显库存
|
||||
//List<ChannelStock> singleChannels = record.FindAll(it => it.BoardType != 1);
|
||||
Task.Factory.StartNew(() =>
|
||||
{
|
||||
List<ChannelStock> singleChannels = record.Where(it => it.BoardType == 5)
|
||||
.GroupBy(it => new { it.DrawerNo, it.ColNo })
|
||||
List<ChannelStock> singleChannels = record.Where(it => it.BoardType != 1)
|
||||
.GroupBy(it => it.ColNo)
|
||||
.Select(it =>
|
||||
{
|
||||
var ret = it.First();
|
||||
//ret.Quantity = it.Sum(itx => itx.Quantity);
|
||||
//ret.AddQuantity = it.Sum(itx => itx.AddQuantity);
|
||||
return ret;
|
||||
}).ToList();
|
||||
logger.Info("查询数据并写标签");
|
||||
if (singleChannels.Count > 0)
|
||||
//if ((singleChannels.Count > 0 ? singleChannels[0].BoardType : 1) == 5)
|
||||
//{
|
||||
//singleChannels.ForEach(it =>
|
||||
//{
|
||||
// _portUtil.WriteQuantity(it.DrawerNo, it.ColNo, it.Quantity - it.TakeQuantity);
|
||||
//});
|
||||
//}
|
||||
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)
|
||||
{
|
||||
List<ChannelStock> channel = SqlSugarHelper.Db.Queryable<ChannelStock>()
|
||||
.Where(cs => cs.MachineId == singleChannels[i].MachineId)
|
||||
.Where(cs => cs.DrawerNo == singleChannels[i].DrawerNo)
|
||||
.Where(cs => cs.ColNo == singleChannels[i].ColNo)
|
||||
//.Where(cs=>cs.Quantity>0)
|
||||
.OrderBy(cs => cs.EffDate)
|
||||
.ToList();
|
||||
//.Sum(it => it.Quantity);
|
||||
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);
|
||||
|
||||
//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(channel[0].DrawerNo, channel[0].ColNo, channel.Sum(c => c.Quantity));
|
||||
Thread.Sleep(500);
|
||||
//如果最近效期的批次库存为0则重新绑定批次效期标签为库存不为0的近效期的标签
|
||||
if (channel[0].Quantity == 0)
|
||||
{
|
||||
ChannelStock cs = channel.Where(cs => cs.Quantity > 0).OrderBy(it => it.EffDate).FirstOrDefault();
|
||||
if (cs != null)
|
||||
{
|
||||
_portUtil.WriteChannelInfo(6, cs.EffDate == null ? "" : cs.EffDate, cs.DrawerNo, cs.ColNo);
|
||||
Thread.Sleep(200);
|
||||
_portUtil.WriteChannelInfo(5, cs.ManuNo, cs.DrawerNo, cs.ColNo);
|
||||
Thread.Sleep(200);
|
||||
_portUtil.ShowContent(cs.DrawerNo, cs.ColNo);
|
||||
}
|
||||
}
|
||||
_portUtil.WriteQuantity(csList[i].DrawerNo, csList[i].ColNo, totalQuantity);
|
||||
Thread.Sleep(200);
|
||||
}
|
||||
}
|
||||
}
|
||||
System.Windows.Application.Current.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Send, new Action(() =>
|
||||
{
|
||||
logger.Info($"抽屉取药完成,库存已更新");
|
||||
AlertMsg alertMsg = new AlertMsg
|
||||
{
|
||||
Message = "抽屉取药完成,库存已更新",
|
||||
Type = MsgType.SUCCESS,
|
||||
};
|
||||
_eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
|
||||
}));
|
||||
});
|
||||
|
||||
}
|
||||
AlertMsg alertMsg = new AlertMsg
|
||||
{
|
||||
Message = "抽屉取药完成,库存已更新",
|
||||
Type = MsgType.SUCCESS,
|
||||
};
|
||||
_eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
|
||||
}
|
||||
catch (Exception ex)
|
||||
if (!f.IsSuccess)
|
||||
{
|
||||
SqlSugarHelper.Db.RollbackTran();
|
||||
logger.Info($"抽屉取药完成,库存更新失败!{ex.Message}");
|
||||
AlertMsg alertMsg = new AlertMsg
|
||||
{
|
||||
Message = "抽屉取药完成,库存更新失败!",
|
||||
|
@ -498,155 +498,6 @@ namespace DM_Weight.ViewModels
|
|||
};
|
||||
_eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
|
||||
}
|
||||
|
||||
//var f = SqlSugarHelper.Db.UseTran(() =>
|
||||
//{
|
||||
// logger.Info($"更新OrderInfo:{InvoiceId}");
|
||||
// SqlSugarHelper.Db.Updateable(new OrderInfo()
|
||||
// {
|
||||
// DmStatus = 1,
|
||||
// OrderNo = OrderInfo.OrderNo
|
||||
// }).UpdateColumns(it => new { it.DmStatus }).WhereColumns(it => new { it.OrderNo }).ExecuteCommand();
|
||||
|
||||
|
||||
// //SqlSugarHelper.Db.Insertable(new OrderFinish()
|
||||
// //{
|
||||
// // OrderNo = OrderInfo.OrderNo,
|
||||
// // PatientId = OrderInfo.PatientId,
|
||||
// // Pharmacy = OrderInfo.Pharmacy,
|
||||
// // State = 1,
|
||||
// // Operator = HomeWindowViewModel.Operator?.Nickname,
|
||||
// //});
|
||||
// logger.Info("进入record循环");
|
||||
// for (int i = 0; i < record.Count; i++)
|
||||
// {
|
||||
// ChannelStock it = record[i];
|
||||
|
||||
// logger.Info($"更新ChannelStock:{it.Id}");
|
||||
// // 更新数据 库存信息
|
||||
// SqlSugarHelper.Db.Updateable(new ChannelStock()
|
||||
// {
|
||||
// Quantity = it.Quantity - it.TakeQuantity,
|
||||
// ManuNo = it.ManuNo,
|
||||
// EffDate = it.EffDate,
|
||||
// Id = it.Id,
|
||||
// }).UpdateColumns(it => new { it.Quantity, it.ManuNo, it.EffDate }).ExecuteCommand();
|
||||
|
||||
// // 获取更新完库存后的药品库存
|
||||
// List<ChannelStock> nowChannels = SqlSugarHelper.Db.Queryable<ChannelStock>()
|
||||
// .Where(cs => cs.MachineId.Equals(it.MachineId))
|
||||
// .Where(cs => cs.DrugId.Equals(it.DrugId))
|
||||
// .Where(cs => cs.DrawerType == 1)
|
||||
// .ToList();
|
||||
// logger.Info($"保存MachineRecord:{it.ManuNo}");
|
||||
// // 保存数据 出库记录
|
||||
// SqlSugarHelper.Db.Insertable(new MachineRecord()
|
||||
// {
|
||||
// MachineId = it.MachineId,
|
||||
// DrawerNo = it.DrawerNo,
|
||||
// ColNo = it.ColNo,
|
||||
// DrugId = it.DrugId,
|
||||
// ManuNo = it.ManuNo,
|
||||
// EffDate = !String.IsNullOrEmpty(it.EffDate) ? DateTime.ParseExact(it.EffDate, "yyyy-MM-dd", System.Globalization.CultureInfo.CurrentCulture) : null,
|
||||
// Operator = HomeWindowViewModel.Operator?.Id,
|
||||
// Reviewer = HomeWindowViewModel.Reviewer?.Id,
|
||||
// OperationTime = DateTime.Now,
|
||||
// Quantity = it.TakeQuantity,
|
||||
// Type = 2,
|
||||
// InvoiceId = InvoiceId,
|
||||
// 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.DeptName
|
||||
// }).ExecuteCommand();
|
||||
// }
|
||||
// return true;
|
||||
//});
|
||||
//if (f.Data)
|
||||
//{
|
||||
// // 更新屏显库存
|
||||
// //List<ChannelStock> singleChannels = record.FindAll(it => it.BoardType != 1);
|
||||
// Task.Factory.StartNew(() =>
|
||||
// {
|
||||
// //List<ChannelStock> singleChannels = record.Where(it => it.BoardType != 1)
|
||||
// // .GroupBy(it =>new {it.DrawerNo, it.ColNo })
|
||||
// // .Select(it =>
|
||||
// // {
|
||||
// // var ret = it.First();
|
||||
// // ret.Quantity = it.Sum(itx => itx.Quantity);
|
||||
// // ret.TakeQuantity = it.Sum(itx => itx.TakeQuantity);
|
||||
// // ret.EffDate = it.Min(it => it.EffDate);
|
||||
// // ret.ManuNo = it.OrderBy(it => it.ManuNo).Select(it => it.ManuNo).First().ToString();
|
||||
|
||||
// // return ret;
|
||||
// // })
|
||||
// // .Where(it=>it.Quantity> 0)
|
||||
// // .OrderBy(it => it.EffDate)
|
||||
// // .ToList();
|
||||
|
||||
// List<ChannelStock> singleChannels = record.Where(it => it.BoardType != 1)
|
||||
// .GroupBy(it => new { it.DrawerNo, it.ColNo })
|
||||
// .Select(it =>
|
||||
// {
|
||||
// var ret = it.First();
|
||||
// return ret;
|
||||
// }).ToList();
|
||||
// if (singleChannels.Count > 0)
|
||||
// {
|
||||
// for (int i = 0; i < singleChannels.Count; i++)
|
||||
// {
|
||||
// if (singleChannels[i].BoardType == 5)
|
||||
// {
|
||||
// List<ChannelStock> channel = SqlSugarHelper.Db.Queryable<ChannelStock>()
|
||||
// .Where(cs => cs.MachineId == singleChannels[i].MachineId)
|
||||
// .Where(cs => cs.DrawerNo == singleChannels[i].DrawerNo)
|
||||
// .Where(cs => cs.ColNo == singleChannels[i].ColNo)
|
||||
// //.Where(cs=>cs.Quantity>0)
|
||||
// .OrderBy(cs => cs.EffDate)
|
||||
// .ToList();
|
||||
// //.Sum(it => it.Quantity);
|
||||
// //将库位多批次的总库存数更新标签
|
||||
// _portUtil.WriteQuantity(channel[0].DrawerNo, channel[0].ColNo, channel.Sum(c => c.Quantity));
|
||||
// Thread.Sleep(500);
|
||||
// //如果最近效期的批次库存为0则重新绑定批次效期标签为库存不为0的近效期的标签
|
||||
// if (channel[0].Quantity == 0)
|
||||
// {
|
||||
// ChannelStock cs = channel.Where(cs => cs.Quantity > 0).OrderBy(it => it.EffDate).FirstOrDefault();
|
||||
// if (cs != null)
|
||||
// {
|
||||
// _portUtil.WriteChannelInfo(6, cs.EffDate == null ? "" : cs.EffDate, cs.DrawerNo, cs.ColNo);
|
||||
// Thread.Sleep(200);
|
||||
// _portUtil.WriteChannelInfo(5, cs.ManuNo, cs.DrawerNo, cs.ColNo);
|
||||
// Thread.Sleep(200);
|
||||
// _portUtil.ShowContent(cs.DrawerNo, cs.ColNo);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// System.Windows.Application.Current.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Send, new Action(() =>
|
||||
// {
|
||||
// logger.Info($"抽屉取药完成,库存已更新");
|
||||
// AlertMsg alertMsg = new AlertMsg
|
||||
// {
|
||||
// Message = "抽屉取药完成,库存已更新",
|
||||
// Type = MsgType.SUCCESS,
|
||||
// };
|
||||
// _eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
|
||||
// }));
|
||||
// });
|
||||
//}
|
||||
//if (!f.IsSuccess)
|
||||
//{
|
||||
// logger.Info($"抽屉取药完成,库存更新失败!");
|
||||
// AlertMsg alertMsg = new AlertMsg
|
||||
// {
|
||||
// Message = "抽屉取药完成,库存更新失败!",
|
||||
// Type = MsgType.ERROR,
|
||||
// };
|
||||
// _eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
|
||||
// RequestData();
|
||||
//}
|
||||
Status = 0;
|
||||
_isFinishClick = false;
|
||||
//RequestClose?.Invoke(new DialogResult(ButtonResult.Cancel));
|
||||
|
|
|
@ -225,9 +225,10 @@ namespace DM_Weight.ViewModels
|
|||
logger.Info("开始OrderTakeDrugWindowViewModel_查询数据");
|
||||
OrderInfos.Clear();
|
||||
int totalCount = 0;
|
||||
|
||||
List<OrderInfo> queryData = SqlSugarHelper.Db.Queryable<OrderInfo>()
|
||||
.InnerJoin<OrderDetail>((oi, od) => oi.OrderNo == od.OrderNo)
|
||||
.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<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"] ?? "DM1")).GroupBy(cs => cs.DrugId), (oi, od, t) => od.DrugId == t.DrugId)
|
||||
.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("PatientId"), oi => oi.PatientId == SearchValue)
|
||||
|
@ -249,6 +250,7 @@ namespace DM_Weight.ViewModels
|
|||
//接收导航传过来的参数 现在是在此处初始化了表格数据
|
||||
public void OnNavigatedTo(NavigationContext navigationContext)
|
||||
{
|
||||
|
||||
logger.Info("进入OrderTakeDrugWindowViewModel_OnNavigatedTo");
|
||||
_eventAggregator.GetEvent<PortUtilEvent>().Subscribe(DoMyPrismEvent);
|
||||
//RequestData();
|
||||
|
|
|
@ -1,68 +0,0 @@
|
|||
using DM_Weight.Report;
|
||||
using Prism.Mvvm;
|
||||
using Prism.Services.Dialogs;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Dynamic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace DM_Weight.ViewModels
|
||||
{
|
||||
internal class PrintPdfViewModel: BindableBase , IDialogAware
|
||||
{
|
||||
private string _pdfFilePath;
|
||||
public string pdfFilePath
|
||||
{
|
||||
get=>_pdfFilePath;
|
||||
set =>SetProperty(ref _pdfFilePath, value);
|
||||
}
|
||||
public PrintPdfViewModel()
|
||||
{
|
||||
pdfFilePath = GridReportUtil.PrintReportStockNewTest(DateTime.Now.AddDays(-1),DateTime.Now).Result;
|
||||
}
|
||||
|
||||
private string _template;
|
||||
/// <summary>
|
||||
/// PDF 的 html 模板
|
||||
/// </summary>
|
||||
public string Template
|
||||
{
|
||||
get => _template;
|
||||
set => SetProperty(ref _template, value);
|
||||
}
|
||||
|
||||
private ExpandoObject _data;
|
||||
|
||||
public event Action<IDialogResult> RequestClose;
|
||||
|
||||
/// <summary>
|
||||
/// 传递给 pdf 的数据
|
||||
/// </summary>
|
||||
public ExpandoObject Data
|
||||
{
|
||||
get => _data;
|
||||
set => SetProperty(ref _data, value);
|
||||
}
|
||||
|
||||
public void OnDialogOpened(IDialogParameters parameters)
|
||||
{
|
||||
// 弹窗接收 template 和 data 两个参数
|
||||
//parameters.TryGetValue("template", out _template);
|
||||
//parameters.TryGetValue("data", out _data);
|
||||
}
|
||||
|
||||
public bool CanCloseDialog()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public void OnDialogClosed()
|
||||
{
|
||||
//throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public string Title => "预览 PDF";
|
||||
}
|
||||
}
|
|
@ -194,6 +194,53 @@ namespace DM_Weight.ViewModels
|
|||
{
|
||||
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)
|
||||
{
|
||||
Status = 1;
|
||||
|
@ -280,30 +327,17 @@ namespace DM_Weight.ViewModels
|
|||
// 更新屏显库存
|
||||
if (ChannelStock.BoardType == 5)
|
||||
{
|
||||
List<ChannelStock> channels = SqlSugarHelper.Db.Queryable<ChannelStock>()
|
||||
.Where(cs => cs.MachineId == ChannelStock.MachineId)
|
||||
.Where(cs => cs.DrawerNo == ChannelStock.DrawerNo)
|
||||
.Where(cs => cs.ColNo == ChannelStock.ColNo)
|
||||
.OrderBy(cs => cs.EffDate).ToList();
|
||||
if (channels != null && channels.Count > 0)
|
||||
{
|
||||
if (channels[0].Quantity == 0)
|
||||
{
|
||||
//近效期的数量是0,则查该抽屉库位下库存不是0的,有则绑定
|
||||
ChannelStock cs = channels.Where(cs => cs.Quantity > 0).OrderBy(it => it.EffDate).FirstOrDefault();
|
||||
if (cs != null)
|
||||
{
|
||||
_portUtil.WriteChannelInfo(6, cs.EffDate == null ? "" : cs.EffDate, cs.DrawerNo, cs.ColNo);
|
||||
Thread.Sleep(200);
|
||||
_portUtil.WriteChannelInfo(5, cs.ManuNo, cs.DrawerNo, cs.ColNo);
|
||||
Thread.Sleep(200);
|
||||
_portUtil.ShowContent(cs.DrawerNo, cs.ColNo);
|
||||
}
|
||||
}
|
||||
//将库位多批次的总库存数更新标签
|
||||
_portUtil.WriteQuantity(ChannelStock.DrawerNo, ChannelStock.ColNo, channels.Sum(cs => cs.Quantity));
|
||||
}
|
||||
//_portUtil.WriteQuantity(ChannelStock.DrawerNo, ChannelStock.ColNo, ChannelStock.Quantity + ReturnQuantity);
|
||||
int totalQuantity = SqlSugarHelper.Db.Queryable<ChannelStock>()
|
||||
.Where(cs => cs.MachineId.Equals(ChannelStock.MachineId))
|
||||
.Where(cs => cs.DrawerNo == ChannelStock.DrawerNo)
|
||||
.Where(cs => cs.ColNo == ChannelStock.ColNo)
|
||||
.Sum(it => it.Quantity);
|
||||
|
||||
_portUtil.WriteQuantity(ChannelStock.DrawerNo, ChannelStock.ColNo, totalQuantity);
|
||||
Thread.Sleep(200);
|
||||
}
|
||||
|
||||
AlertMsg alertMsg = new AlertMsg
|
||||
{
|
||||
Message = "操作完成,库存已更新",
|
||||
|
|
|
@ -182,7 +182,7 @@ namespace DM_Weight.ViewModels
|
|||
public async void OpenOrderDialog()
|
||||
{
|
||||
//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毫秒,等待页面渲染
|
||||
await Task.Delay(TimeSpan.FromMilliseconds(1));
|
||||
|
@ -218,13 +218,16 @@ namespace DM_Weight.ViewModels
|
|||
int totalCount = 0;
|
||||
List<OrderInfo> queryData = SqlSugarHelper.Db.Queryable<OrderInfo>()
|
||||
.InnerJoin<OrderDetail>((oi, od) => oi.OrderNo == od.OrderNo)
|
||||
.InnerJoin(SqlSugarHelper.Db.Queryable<ChannelStock>().Where(cs => cs.DrawerType == 1).Where(cs => cs.MachineId.Equals(ConfigurationManager.AppSettings["machineId"] ?? "DM1")).GroupBy(cs => cs.DrugId), (oi, od, t) => od.DrugId == t.DrugId)
|
||||
.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(!String.IsNullOrEmpty(SearchValue) && SelectedItem.Code.Equals("OrderNo"), oi => oi.OrderNo == SearchValue)
|
||||
.WhereIF(!String.IsNullOrEmpty(SearchValue) && SelectedItem.Code.Equals("PatientId"), oi => oi.PatientId == SearchValue)
|
||||
.WhereIF(!String.IsNullOrEmpty(ConfigurationManager.AppSettings["storage"]), oi => oi.Pharmacy == ConfigurationManager.AppSettings["storage"])
|
||||
.Where(oi => oi.DmStatus == 1)
|
||||
.Where(oi => oi.HisDispFlag == 1)
|
||||
//.Where(oi => oi.HisDispFlag == 1)
|
||||
.Where(oi => oi.CancelFlag == 1)
|
||||
.GroupBy(oi => oi.OrderDate)
|
||||
.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("PyCode"), (mr) => mr.DrugInfo.PyCode.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)
|
||||
.ToList();
|
||||
MachineRecords = queryData;
|
||||
|
|
|
@ -20,6 +20,8 @@ using DM_Weight.util;
|
|||
using DM_Weight.Views;
|
||||
using SqlSugar;
|
||||
using System.Threading.Channels;
|
||||
using DM_Weight.Report;
|
||||
using System.Threading;
|
||||
|
||||
namespace DM_Weight.ViewModels
|
||||
{
|
||||
|
@ -49,7 +51,7 @@ namespace DM_Weight.ViewModels
|
|||
|
||||
void DoMyPrismEvent(DeviceMsg msg)
|
||||
{
|
||||
|
||||
logger.Info($"msg.WindowName【{msg.WindowName}】WindowName【{WindowName}】Status【{Status}】EventType【{msg.EventType}】");
|
||||
if (msg.WindowName.Equals(WindowName))
|
||||
{
|
||||
|
||||
|
@ -135,6 +137,14 @@ namespace DM_Weight.ViewModels
|
|||
SetProperty(ref _machineRecords, value);
|
||||
}
|
||||
}
|
||||
|
||||
private MachineRecord _machineRecord=new();
|
||||
|
||||
public MachineRecord _MachineRecord
|
||||
{
|
||||
get=> _machineRecord;
|
||||
set=>SetProperty(ref _machineRecord, value);
|
||||
}
|
||||
|
||||
private ChannelStock _channelStock;
|
||||
|
||||
|
@ -144,6 +154,20 @@ namespace DM_Weight.ViewModels
|
|||
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()
|
||||
|
@ -170,8 +194,17 @@ namespace DM_Weight.ViewModels
|
|||
|
||||
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>()
|
||||
.Includes<UserList>(mr => mr.User)
|
||||
.Includes<OrderInfo>(mr => mr.orderInfo)
|
||||
.Where(mr => mr.DrugId == ChannelStock.DrugId)
|
||||
.Where(mr => mr.MachineId.Equals(ConfigurationManager.AppSettings["machineId"] ?? "DM1"))
|
||||
.Where(mr => mr.Type == 2)
|
||||
|
@ -181,6 +214,32 @@ namespace DM_Weight.ViewModels
|
|||
.ToList();
|
||||
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()
|
||||
{
|
||||
|
@ -199,6 +258,7 @@ namespace DM_Weight.ViewModels
|
|||
{
|
||||
get => new DelegateCommand(() =>
|
||||
{
|
||||
|
||||
if (ChannelStock != null)
|
||||
{
|
||||
if (Status == 0)
|
||||
|
@ -209,6 +269,54 @@ namespace DM_Weight.ViewModels
|
|||
}
|
||||
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;
|
||||
_portUtil.SpeakAsync("正在打开" + ChannelStock.DrawerNo + "号抽屉");
|
||||
_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,
|
||||
Operator = HomeWindowViewModel.Operator?.Id,
|
||||
Reviewer = HomeWindowViewModel.Reviewer?.Id,
|
||||
ReturnPerson = ReturnPerson,
|
||||
ReceivePerson = ReceivePerson,
|
||||
OperationTime = DateTime.Now,
|
||||
Quantity = ReturnQuantity,
|
||||
Quantity =_MachineRecord.Quantity, //ReturnQuantity,
|
||||
Type = 32,
|
||||
InvoiceId = InvoiceId,
|
||||
InvoiceId = _MachineRecord.InvoiceId, //InvoiceId,
|
||||
GetId = _MachineRecord.Id,
|
||||
StockQuantity = nowChannels.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)
|
||||
{
|
||||
_portUtil.WriteQuantity(ChannelStock.DrawerNo, ChannelStock.ColNo, ChannelStock.Quantity + ReturnQuantity);
|
||||
Thread.Sleep(200);
|
||||
}
|
||||
|
||||
AlertMsg alertMsg = new AlertMsg
|
||||
|
@ -372,5 +483,6 @@ namespace DM_Weight.ViewModels
|
|||
}
|
||||
|
||||
public bool KeepAlive => true;
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,6 +10,8 @@ using System.Text;
|
|||
using System.Threading.Tasks;
|
||||
using DM_Weight.Models;
|
||||
using DM_Weight.util;
|
||||
using DM_Weight.Report;
|
||||
using System.Configuration;
|
||||
|
||||
namespace DM_Weight.ViewModels
|
||||
{
|
||||
|
@ -42,16 +44,18 @@ namespace DM_Weight.ViewModels
|
|||
//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.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)
|
||||
{
|
||||
|
@ -103,8 +107,11 @@ namespace DM_Weight.ViewModels
|
|||
Channels = SqlSugarHelper.Db.Queryable<ChannelStock>()
|
||||
.LeftJoin<DrugInfo>((cs,di) => cs.DrugId == di.DrugId.ToString())
|
||||
.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{
|
||||
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
|
||||
{
|
||||
DrugId = di.DrugId,
|
||||
|
|
|
@ -30,6 +30,8 @@ namespace DM_Weight.ViewModels
|
|||
get { return _roleList; }
|
||||
set { SetProperty(ref _roleList, value); }
|
||||
}
|
||||
|
||||
|
||||
//private SqlSugarScope SqlSugarHelper.Db;
|
||||
public RoleManagerWindowViewModel(SqlSugarScope sqlSugarScope)
|
||||
{
|
||||
|
@ -197,7 +199,16 @@ namespace DM_Weight.ViewModels
|
|||
PremissionName = "取药记录",
|
||||
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(quyao2);
|
||||
quyaoChild.Add(quyao3);
|
||||
|
@ -247,7 +258,7 @@ namespace DM_Weight.ViewModels
|
|||
PremissionDm jiayao5 = new PremissionDm
|
||||
{
|
||||
Id = 24,
|
||||
PremissionName = "多批次抽屉加药",
|
||||
PremissionName = "批次抽屉加药",
|
||||
PremissionPath = "AddDrugControl",
|
||||
};
|
||||
jiayaoChild.Add(jiayao1);
|
||||
|
@ -341,11 +352,17 @@ namespace DM_Weight.ViewModels
|
|||
PremissionName = "交接班记录",
|
||||
PremissionPath = "ChangeShiftsListWindow",
|
||||
};
|
||||
//PremissionDm kuguan6 = new PremissionDm
|
||||
//{
|
||||
// Id = 46,
|
||||
// PremissionName = "账册",
|
||||
// PremissionPath = "AccountWindow",
|
||||
//};
|
||||
PremissionDm kuguan6 = new PremissionDm
|
||||
{
|
||||
Id = 46,
|
||||
PremissionName = "账册",
|
||||
PremissionPath = "AccountWindow",
|
||||
PremissionName = "专用账册",
|
||||
PremissionPath = "SpecialAccountWindow",
|
||||
};
|
||||
//PremissionDm kuguan7 = new PremissionDm
|
||||
//{
|
||||
|
@ -359,6 +376,7 @@ namespace DM_Weight.ViewModels
|
|||
kuguanChild.Add(kuguan4);
|
||||
kuguanChild.Add(kuguan5);
|
||||
kuguanChild.Add(kuguan6);
|
||||
//kuguanChild.Add(kuguan66);
|
||||
//kuguanChild.Add(kuguan7);
|
||||
kuguan.Children = kuguanChild;
|
||||
defaultAll.Add(kuguan);
|
||||
|
@ -697,6 +715,7 @@ namespace DM_Weight.ViewModels
|
|||
Role.Id = 0;
|
||||
Role.MachineId = ConfigurationManager.AppSettings["machineId"] ?? "DM1";
|
||||
Role.Permissions = RightPremissions.ToList();
|
||||
|
||||
List<RoleDm> roleList = SqlSugarHelper.Db.Queryable<RoleDm>().Where(r => r.RoleName == Role.RoleName).ToList();
|
||||
if(roleList.Count>0)
|
||||
{
|
||||
|
@ -743,8 +762,7 @@ namespace DM_Weight.ViewModels
|
|||
.Where(di => di.MachineId.Equals(ConfigurationManager.AppSettings["machineId"] ?? "DM1"))
|
||||
.WhereIF(!String.IsNullOrEmpty(SearchValue), (di) => di.RoleName.Contains(SearchValue??""))
|
||||
.Select(r => r)
|
||||
.ToList()
|
||||
;
|
||||
.ToList();
|
||||
}
|
||||
|
||||
//每次导航的时候,该实列用不用重新创建,true是不重新创建,false是重新创建
|
||||
|
|
|
@ -20,14 +20,38 @@ using DM_Weight.Views;
|
|||
using System.Threading;
|
||||
using SqlSugar;
|
||||
using System.Configuration;
|
||||
using System.Collections;
|
||||
using System.Threading.Channels;
|
||||
|
||||
namespace DM_Weight.ViewModels
|
||||
{
|
||||
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));
|
||||
public string Title => "自选加药";
|
||||
|
||||
|
@ -178,6 +202,53 @@ namespace DM_Weight.ViewModels
|
|||
{
|
||||
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();
|
||||
Status = 1;
|
||||
OpenOneByOne();
|
||||
|
@ -194,13 +265,14 @@ namespace DM_Weight.ViewModels
|
|||
channelStocks.ForEach(it => it.process = 1);
|
||||
_portUtil.SpeakAsync("正在打开" + DrawerNo + "号抽屉");
|
||||
|
||||
|
||||
List<ChannelStock> singleChannels = new List<ChannelStock>();
|
||||
for (int i = 0; i < channelStocks.Count; i++)
|
||||
{
|
||||
ChannelStock copy = TransExpV2<ChannelStock, ChannelStock>.Trans(channelStocks[i]);
|
||||
singleChannels.Add(copy);
|
||||
}
|
||||
singleChannels = singleChannels
|
||||
}
|
||||
singleChannels= singleChannels
|
||||
.GroupBy(it => new {
|
||||
it.DrawerNo, it.ColNo
|
||||
})
|
||||
|
@ -303,7 +375,7 @@ namespace DM_Weight.ViewModels
|
|||
Reviewer = HomeWindowViewModel.Reviewer?.Id,
|
||||
OperationTime = DateTime.Now,
|
||||
Quantity = it.AddQuantity,
|
||||
Type = 1,
|
||||
Type = SelectedItemUseFor.UseId == 0 ? 1 : SelectedItemUseFor.UseId,
|
||||
InvoiceId = InvoiceId,
|
||||
StockQuantity = nowChannels.Sum(it => it.Quantity),
|
||||
ManunoQuantity = nowChannels.FindAll(it2 => it2.ManuNo == it.ManuNo).Sum(it => it.Quantity),
|
||||
|
@ -317,7 +389,7 @@ namespace DM_Weight.ViewModels
|
|||
{
|
||||
// 更新屏显库存
|
||||
//List<ChannelStock> singleChannels = record.FindAll(it => it.BoardType != 1);
|
||||
List<ChannelStock> singleChannels = record.Where(it => it.BoardType == 5)
|
||||
List<ChannelStock> singleChannels = record.Where(it => it.BoardType != 1)
|
||||
.GroupBy(it => new { it.DrawerNo,it.ColNo })
|
||||
.Select(it =>
|
||||
{
|
||||
|
@ -342,43 +414,14 @@ namespace DM_Weight.ViewModels
|
|||
{
|
||||
if (singleChannels[i].BoardType == 5)
|
||||
{
|
||||
//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);
|
||||
|
||||
List<ChannelStock> channels = 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)
|
||||
.OrderBy(cs => cs.EffDate).ToList();
|
||||
if (channels != null && channels.Count > 0)
|
||||
{
|
||||
if (channels[0].Quantity==0)
|
||||
{
|
||||
//近效期的数量是0,则查该抽屉库位下库存不是0的,有则绑定
|
||||
ChannelStock cs = channels.Where(cs => cs.Quantity > 0).OrderBy(it => it.EffDate).FirstOrDefault();
|
||||
if(cs!=null)
|
||||
{
|
||||
_portUtil.WriteChannelInfo(6, cs.EffDate == null ? "" : cs.EffDate, cs.DrawerNo, cs.ColNo);
|
||||
Thread.Sleep(200);
|
||||
_portUtil.WriteChannelInfo(5, cs.ManuNo, cs.DrawerNo, cs.ColNo);
|
||||
Thread.Sleep(200);
|
||||
_portUtil.ShowContent(cs.DrawerNo, cs.ColNo);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_portUtil.WriteChannelInfo(6, channels[0].EffDate == null ? "" : channels[0].EffDate, channels[0].DrawerNo, channels[0].ColNo);
|
||||
Thread.Sleep(200);
|
||||
_portUtil.WriteChannelInfo(5, channels[0].ManuNo, channels[0].DrawerNo, channels[0].ColNo);
|
||||
Thread.Sleep(200);
|
||||
_portUtil.ShowContent(channels[0].DrawerNo, channels[0].ColNo);
|
||||
}
|
||||
//将库位多批次的总库存数更新标签
|
||||
_portUtil.WriteQuantity(singleChannels[i].DrawerNo, singleChannels[i].ColNo, channels.Sum(cs => cs.Quantity));
|
||||
}
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -393,7 +436,6 @@ namespace DM_Weight.ViewModels
|
|||
}
|
||||
if (!f.IsSuccess)
|
||||
{
|
||||
logger.Info($"自选加药,库存更新失败!{f.ErrorMessage}");
|
||||
AlertMsg alertMsg = new AlertMsg
|
||||
{
|
||||
Message = "库存更新失败!",
|
||||
|
|
|
@ -211,7 +211,10 @@ namespace DM_Weight.ViewModels
|
|||
// .ToList();
|
||||
//ChannelStocks = queryData;
|
||||
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("DrugName"), (cs) => cs.DrugName.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 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));
|
||||
public string Title => "自选取药";
|
||||
|
||||
|
@ -168,6 +195,53 @@ namespace DM_Weight.ViewModels
|
|||
{
|
||||
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();
|
||||
Status = 1;
|
||||
OpenOneByOne();
|
||||
|
@ -184,13 +258,14 @@ namespace DM_Weight.ViewModels
|
|||
channelStocks.ForEach(it => it.process = 1);
|
||||
_portUtil.SpeakAsync("正在打开" + DrawerNo + "号抽屉");
|
||||
|
||||
|
||||
List<ChannelStock> singleChannels = new List<ChannelStock>();
|
||||
for (int i = 0; i < channelStocks.Count; i++)
|
||||
{
|
||||
ChannelStock copy = TransExpV2<ChannelStock, ChannelStock>.Trans(channelStocks[i]);
|
||||
singleChannels.Add(copy);
|
||||
}
|
||||
singleChannels = singleChannels
|
||||
}
|
||||
singleChannels= singleChannels
|
||||
.GroupBy(it => new { it.DrawerNo, it.ColNo })
|
||||
.Select(it =>
|
||||
{
|
||||
|
@ -260,12 +335,13 @@ namespace DM_Weight.ViewModels
|
|||
OperationTime = DateTime.Now,
|
||||
Quantity = it.TakeQuantity,
|
||||
Reviewer = HomeWindowViewModel.Reviewer?.Id,
|
||||
Type = 2,
|
||||
Type = SelectedItem.UseId == 0 ? 2 : SelectedItem.UseId,
|
||||
InvoiceId = InvoiceId,
|
||||
StockQuantity = nowChannels.Sum(it => it.Quantity),
|
||||
ManunoQuantity = nowChannels.FindAll(it2 => it2.ManuNo == it.ManuNo).Sum(it => it.Quantity),
|
||||
SupplierDept = ConfigurationManager.AppSettings["supplierDept"].ToString(),
|
||||
ReceiveDept = ConfigurationManager.AppSettings["receiveDept"].ToString()
|
||||
ReceiveDept = ConfigurationManager.AppSettings["receiveDept"].ToString(),
|
||||
Status= SelectedItem.UseId==0?0:2 //不入账册(96)取药后不还空瓶
|
||||
}).ExecuteCommand();
|
||||
}
|
||||
return true;
|
||||
|
@ -274,7 +350,7 @@ namespace DM_Weight.ViewModels
|
|||
{
|
||||
// 更新屏显库存
|
||||
//List<ChannelStock> singleChannels = record.FindAll(it => it.BoardType != 1);
|
||||
List<ChannelStock> singleChannels = ChannelStocks.Where(it => it.BoardType == 5)
|
||||
List<ChannelStock> singleChannels = ChannelStocks.Where(it => it.BoardType != 1)
|
||||
.GroupBy(it =>new { it.DrawerNo, it.ColNo })
|
||||
.Select(it =>
|
||||
{
|
||||
|
@ -297,39 +373,34 @@ namespace DM_Weight.ViewModels
|
|||
{
|
||||
for (int i = 0; i < singleChannels.Count; i++)
|
||||
{
|
||||
//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);
|
||||
if (singleChannels[i].BoardType == 5)
|
||||
{
|
||||
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();
|
||||
|
||||
|
||||
List<ChannelStock> channel = SqlSugarHelper.Db.Queryable<ChannelStock>()
|
||||
.Where(cs => cs.MachineId == singleChannels[i].MachineId)
|
||||
.Where(cs => cs.DrawerNo == singleChannels[i].DrawerNo)
|
||||
.Where(cs => cs.ColNo == singleChannels[i].ColNo)
|
||||
//.Where(cs=>cs.Quantity>0)
|
||||
.OrderBy(cs => cs.EffDate)
|
||||
.ToList();
|
||||
//.Sum(it => it.Quantity);
|
||||
//将库位多批次的总库存数更新标签
|
||||
_portUtil.WriteQuantity(channel[0].DrawerNo, channel[0].ColNo, channel.Sum(c => c.Quantity));
|
||||
Thread.Sleep(500);
|
||||
//如果最近效期的批次库存为0则重新绑定批次效期标签为库存不为0的近效期的标签
|
||||
if (channel[0].Quantity == 0)
|
||||
if (csList != null && csList.Count > 0)
|
||||
{
|
||||
ChannelStock cs = channel.Where(cs => cs.Quantity > 0).OrderBy(it => it.EffDate).FirstOrDefault();
|
||||
if (cs != null)
|
||||
{
|
||||
_portUtil.WriteChannelInfo(6, cs.EffDate == null ? "" : cs.EffDate, cs.DrawerNo, cs.ColNo);
|
||||
Thread.Sleep(200);
|
||||
_portUtil.WriteChannelInfo(5, cs.ManuNo, cs.DrawerNo, cs.ColNo);
|
||||
Thread.Sleep(200);
|
||||
_portUtil.ShowContent(cs.DrawerNo, cs.ColNo);
|
||||
}
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -342,7 +413,6 @@ namespace DM_Weight.ViewModels
|
|||
}
|
||||
if (!f.IsSuccess)
|
||||
{
|
||||
logger.Info($"自选取药,库存更新失败!{f.ErrorMessage}");
|
||||
AlertMsg alertMsg = new AlertMsg
|
||||
{
|
||||
Message = "库存更新失败!",
|
||||
|
|
|
@ -197,6 +197,8 @@ namespace DM_Weight.ViewModels
|
|||
//ChannelStocks = queryData;
|
||||
List<DrugInfo> q = SqlSugarHelper.Db.Queryable<DrugInfo>()
|
||||
.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())
|
||||
.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))
|
||||
|
|
|
@ -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>()
|
||||
.Includes<ChannelStock>(di => di.channelStocks.Where(cs => cs.DrawerType == 1)
|
||||
.Where(cs => cs.MachineId.Equals(ConfigurationManager.AppSettings["machineId"] ?? "DM1") && cs.DrugId != null).OrderBy(cs => cs.DrawerNo).OrderBy(cs => cs.ColNo).ToList())
|
||||
.WhereIF(!String.IsNullOrEmpty(SearchValue) && SelectedItem.Code.Equals("DrugId"), (cs) => cs.DrugId.Contains(SearchValue))
|
||||
.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("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("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)
|
||||
.ToList();
|
||||
Drugs = q;
|
||||
|
|
|
@ -80,14 +80,14 @@
|
|||
</Style.Triggers>
|
||||
</Style>
|
||||
</Grid.Resources>
|
||||
<Button Grid.Row="0" Width="210" Content="1" Command="{Binding UpdateDrawerNo}" CommandParameter="1" />
|
||||
<Button Grid.Row="1" Width="210" Content="2" Command="{Binding UpdateDrawerNo}" CommandParameter="2" />
|
||||
<Button Grid.Row="2" Width="210" Content="3" Command="{Binding UpdateDrawerNo}" CommandParameter="3" />
|
||||
<Button Grid.Row="3" Width="210" Content="4" Command="{Binding UpdateDrawerNo}" CommandParameter="4" />
|
||||
<Button Grid.Row="4" Width="210" Content="5" Command="{Binding UpdateDrawerNo}" CommandParameter="5" />
|
||||
<Button Grid.Row="5" Width="210" Content="6" Command="{Binding UpdateDrawerNo}" CommandParameter="6" />
|
||||
<Button Grid.Row="6" Width="210" Content="7" Command="{Binding UpdateDrawerNo}" CommandParameter="7" />
|
||||
<Button Grid.Row="7" Width="210" Content="8" Command="{Binding UpdateDrawerNo}" CommandParameter="8" />
|
||||
<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}" IsEnabled="{Binding Is8Drawer}" CommandParameter="2" />
|
||||
<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}" IsEnabled="{Binding Is16Drawer}" CommandParameter="4" />
|
||||
<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}" IsEnabled="{Binding Is16Drawer}" CommandParameter="6" />
|
||||
<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}" IsEnabled="{Binding Is16Drawer}" CommandParameter="8" />
|
||||
|
||||
</Grid>
|
||||
</Grid>
|
||||
|
@ -141,23 +141,22 @@
|
|||
<ColumnDefinition />
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<Button Grid.Row="0" Grid.Column="0" Width="120" Content="1" Command="{Binding UpdateDrawerNo}" CommandParameter="1" />
|
||||
<Button Grid.Row="1" Grid.Column="0" Width="120" Content="2" Command="{Binding UpdateDrawerNo}" CommandParameter="2" />
|
||||
<Button Grid.Row="2" Grid.Column="0" Width="120" Content="3" Command="{Binding UpdateDrawerNo}" CommandParameter="3" />
|
||||
<Button Grid.Row="3" Grid.Column="0" Width="120" Content="4" Command="{Binding UpdateDrawerNo}" CommandParameter="4" />
|
||||
<Button Grid.Row="4" Grid.Column="0" Width="120" Content="5" Command="{Binding UpdateDrawerNo}" CommandParameter="5" />
|
||||
<Button Grid.Row="5" Grid.Column="0" Width="120" Content="6" Command="{Binding UpdateDrawerNo}" CommandParameter="6" />
|
||||
<Button Grid.Row="6" Grid.Column="0" Width="120" Content="7" Command="{Binding UpdateDrawerNo}" CommandParameter="7" />
|
||||
<Button Grid.Row="7" Grid.Column="0" Width="120" Content="8" Command="{Binding UpdateDrawerNo}" CommandParameter="8" />
|
||||
|
||||
<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}" CommandParameter="10" />
|
||||
<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}" CommandParameter="12" />
|
||||
<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}" CommandParameter="14" />
|
||||
<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}" CommandParameter="16" />
|
||||
<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}" IsEnabled="{Binding Is8Drawer}" CommandParameter="2" />
|
||||
<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}" IsEnabled="{Binding Is16Drawer}" CommandParameter="4" />
|
||||
<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}" IsEnabled="{Binding Is16Drawer}" CommandParameter="6" />
|
||||
<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}" 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="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}" IsEnabled="{Binding Is16Drawer}" CommandParameter="11" />
|
||||
<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}" IsEnabled="{Binding Is16Drawer}" CommandParameter="13" />
|
||||
<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}" IsEnabled="{Binding Is16Drawer}" CommandParameter="15" />
|
||||
<Button Grid.Row="7" Grid.Column="1" Width="120" Content="16" Command="{Binding UpdateDrawerNo}" IsEnabled="{Binding Is16Drawer}" CommandParameter="16" />
|
||||
|
||||
</Grid>
|
||||
</Grid>
|
||||
|
@ -176,7 +175,14 @@
|
|||
materialDesign:ButtonProgressAssist.IsIndeterminate="{Binding Status, Converter={StaticResource StatusConverter}, ConverterParameter=opearBtnLoading}"
|
||||
Style="{StaticResource MaterialDesignOutlinedLightButton}"
|
||||
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="凭证号"
|
||||
materialDesign:HintAssist.IsFloating="True" Width="100"
|
||||
Margin="0 0 3 0"
|
||||
|
@ -187,10 +193,21 @@
|
|||
Margin="0 0 3 0"
|
||||
VerticalAlignment="Center"
|
||||
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}"
|
||||
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
|
||||
Margin="0 0 6 0"
|
||||
VerticalAlignment="Center"
|
||||
|
@ -337,29 +354,7 @@
|
|||
</DataTemplate>
|
||||
</DataGridTemplateColumn.CellTemplate>
|
||||
</DataGridTemplateColumn>
|
||||
<!--<DataGridTemplateColumn Width="100" Header="操作">
|
||||
<DataGridTemplateColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
--><!--<TextBox Style="{StaticResource MaterialDesignDataGridTextColumnEditingStyle}" IsReadOnly="{Binding BoardType, Converter={StaticResource InputQuantityConverter}}">
|
||||
<TextBox.Text>
|
||||
<Binding Path="AddQuantity" Mode="TwoWay" UpdateSourceTrigger="PropertyChanged">
|
||||
<Binding.ValidationRules>
|
||||
<ExceptionValidationRule />
|
||||
</Binding.ValidationRules>
|
||||
</Binding>
|
||||
</TextBox.Text>
|
||||
</TextBox>--><!--
|
||||
<Button Grid.Row="2" Padding="0 0 0 1 " Style="{x:Null}" BorderBrush="{x:Null}" Background="{x:Null}" Click="Button_Click_1" CommandParameter="{Binding}">
|
||||
|
||||
<Button.Content>
|
||||
<Border Width="30" Height="30" CornerRadius="16" Background="Red" VerticalAlignment="Center" HorizontalAlignment="Center">
|
||||
<Path Data="M3 3 L20 20 M 20 3 L 3 20" Stroke="WhiteSmoke" StrokeThickness="4" VerticalAlignment="Center" HorizontalAlignment="Center"></Path>
|
||||
</Border>
|
||||
</Button.Content>
|
||||
</Button>
|
||||
</DataTemplate>
|
||||
</DataGridTemplateColumn.CellTemplate>
|
||||
</DataGridTemplateColumn>-->
|
||||
</DataGrid.Columns>
|
||||
</DataGrid>
|
||||
<!--<ListView Padding="0 6 0 0" Grid.Column="1"
|
||||
|
|
|
@ -37,17 +37,5 @@ namespace DM_Weight.Views
|
|||
//vms.AddAction(cls);
|
||||
_eventAggregator.GetEvent<AddDrugEvent>().Publish(cls);
|
||||
}
|
||||
//删除库存为0的批次
|
||||
private void Button_Click_1(object sender, RoutedEventArgs e)
|
||||
{
|
||||
Button delBtn= (Button)sender;
|
||||
ChannelStock cs = (ChannelStock)delBtn.CommandParameter;
|
||||
if(cs.Quantity> 0)
|
||||
{
|
||||
MessageBox.Show($"该批次{cs.ManuNo}库存不为0,不能删除","提示");
|
||||
}
|
||||
|
||||
_eventAggregator.GetEvent<DelDrugManoEvent>().Publish(cs);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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}"
|
||||
Style="{StaticResource MaterialDesignOutlinedLightButton}"
|
||||
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
|
||||
Margin="0 0 3 0"
|
||||
VerticalAlignment="Center"
|
||||
|
|
|
@ -65,23 +65,14 @@
|
|||
DisplayMemberPath="DrugName"
|
||||
/>-->
|
||||
<ComboBox
|
||||
Margin="6 0 6 0"
|
||||
Margin="6 0 6 0"
|
||||
Grid.Column="0"
|
||||
materialDesign:HintAssist.Hint="药品名称/拼音码/药品编码"
|
||||
ItemsSource="{Binding DrugInfos}"
|
||||
SelectedItem="{Binding DrugInfo}"
|
||||
DisplayMemberPath="drug_name_spec" IsEditable="True" IsTextSearchEnabled="False" KeyUp="ComboBox_KeyUp"
|
||||
/>
|
||||
<StackPanel HorizontalAlignment="Right" Grid.Column="3" Orientation="Horizontal">
|
||||
<!--<Button
|
||||
Style="{StaticResource MaterialDesignOutlinedLightButton}"
|
||||
ToolTip="渲染标签"
|
||||
Content="渲染标签"
|
||||
Command="{Binding ResetLabelCommand}"
|
||||
materialDesign:ButtonProgressAssist.IsIndicatorVisible="{Binding Status, Converter={StaticResource StatusConverter}, ConverterParameter=opearBtnLoading}"
|
||||
materialDesign:ButtonProgressAssist.IsIndeterminate="{Binding Status, Converter={StaticResource StatusConverter}, ConverterParameter=opearBtnLoading}"
|
||||
|
||||
/>-->
|
||||
<StackPanel HorizontalAlignment="Right" Grid.Column="2" Grid.ColumnSpan="2" Orientation="Horizontal">
|
||||
<Button
|
||||
Style="{StaticResource MaterialDesignOutlinedLightButton}"
|
||||
ToolTip="渲染标签"
|
||||
|
@ -104,7 +95,7 @@
|
|||
Content="解绑"
|
||||
Command="{Binding RemoveBinding}" />
|
||||
<Button
|
||||
Margin="0 0 6 0"
|
||||
Margin="6 0 6 0"
|
||||
Style="{StaticResource MaterialDesignOutlinedLightButton}"
|
||||
ToolTip="刷新"
|
||||
Command="{Binding Query}"
|
||||
|
@ -250,7 +241,7 @@
|
|||
InfoTextIsEnabel="True"
|
||||
/>
|
||||
<materialDesign:Snackbar
|
||||
Background="{Binding SnackbarBackground,UpdateSourceTrigger=PropertyChanged}"
|
||||
Background="{Binding SnackbarBackground}"
|
||||
MessageQueue="{Binding SnackbarMessageQueue}"/>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
|
|
|
@ -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>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="50" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="300" />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
<Grid Background="#03a9f4" Grid.Row="0">
|
||||
|
@ -107,6 +107,7 @@
|
|||
Text="{Binding OrderInfo.Age}" />
|
||||
</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" />
|
||||
|
@ -119,7 +120,7 @@
|
|||
<Style TargetType="{x:Type DataGridCell}" BasedOn="{StaticResource MaterialDesignDataGridCell}">
|
||||
<Setter Property="HorizontalAlignment" Value="left" />
|
||||
<Setter Property="Padding" Value="13" />
|
||||
</Style>
|
||||
</Style>
|
||||
</DataGrid.Resources>
|
||||
<DataGrid.Columns>
|
||||
|
||||
|
@ -144,6 +145,13 @@
|
|||
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"
|
||||
|
@ -159,36 +167,13 @@
|
|||
EditingElementStyle="{StaticResource MaterialDesignDataGridTextColumnEditingStyle}"
|
||||
/>
|
||||
<DataGridTextColumn Width="100"
|
||||
Header="库存数量"
|
||||
Header="取出数量"
|
||||
IsReadOnly="True"
|
||||
Binding="{Binding Quantity}"
|
||||
Binding="{Binding TakeQuantity}"
|
||||
ElementStyle="{StaticResource MaterialDesignDataGridTextColumnStyle}"
|
||||
EditingElementStyle="{StaticResource MaterialDesignDataGridTextColumnEditingStyle}"
|
||||
/>
|
||||
<DataGridTextColumn Width="100"
|
||||
Header="应取数量"
|
||||
IsReadOnly="True"
|
||||
Binding="{Binding OrderQuantity}"
|
||||
ElementStyle="{StaticResource MaterialDesignDataGridTextColumnStyle}"
|
||||
EditingElementStyle="{StaticResource MaterialDesignDataGridTextColumnEditingStyle}"
|
||||
/>
|
||||
<DataGridTemplateColumn Width="100"
|
||||
Header="取出数量">
|
||||
<DataGridTemplateColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<TextBox Width="100" Style="{StaticResource MaterialDesignDataGridTextColumnEditingStyle}">
|
||||
<TextBox.Text>
|
||||
<Binding Path="TakeQuantity" Mode="TwoWay" UpdateSourceTrigger="PropertyChanged">
|
||||
<Binding.ValidationRules>
|
||||
<ExceptionValidationRule />
|
||||
</Binding.ValidationRules>
|
||||
</Binding>
|
||||
</TextBox.Text>
|
||||
</TextBox>
|
||||
</DataTemplate>
|
||||
</DataGridTemplateColumn.CellTemplate>
|
||||
</DataGridTemplateColumn>
|
||||
</DataGrid.Columns>
|
||||
</DataGrid.Columns>
|
||||
</DataGrid>
|
||||
<Grid Grid.Row="3">
|
||||
<Grid.ColumnDefinitions>
|
||||
|
@ -207,6 +192,10 @@
|
|||
Content="取药"
|
||||
Command="{Binding OpenDrawer}">
|
||||
</Button>-->
|
||||
<TextBox Margin="6" Width="110"
|
||||
Style="{StaticResource MaterialDesignOutlinedTextBox}"
|
||||
VerticalAlignment="Top" Text="{Binding ReceivePerson}"
|
||||
materialDesign:HintAssist.Hint="取药人(科室)" />
|
||||
<Button
|
||||
Margin="2"
|
||||
Style="{StaticResource MaterialDesignRaisedAccentButton}"
|
||||
|
|
|
@ -1,19 +0,0 @@
|
|||
<UserControl x:Class="DM_Weight.Views.Dialog.PrintPdfView"
|
||||
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:wpf="clr-namespace:Microsoft.Web.WebView2.Wpf;assembly=Microsoft.Web.WebView2.Wpf"
|
||||
mc:Ignorable="d" MinHeight="750" MinWidth="1000"
|
||||
d:DesignHeight="450" d:DesignWidth="800">
|
||||
<Grid Margin="24">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
<Grid>
|
||||
<wpf:WebView2 x:Name="webView2" Source="{Binding pdfFilePath}" />
|
||||
</Grid>
|
||||
</Grid>
|
||||
</UserControl>
|
|
@ -1,61 +0,0 @@
|
|||
using DM_Weight.ViewModels;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Navigation;
|
||||
using System.Windows.Shapes;
|
||||
|
||||
namespace DM_Weight.Views.Dialog
|
||||
{
|
||||
/// <summary>
|
||||
/// PrintPdfView.xaml 的交互逻辑
|
||||
/// </summary>
|
||||
public partial class PrintPdfView : UserControl
|
||||
{
|
||||
public PrintPdfView()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
///// <summary>
|
||||
///// 配置 WebView2,加载 vuejs,加载 pdf 模板,传递数据到 html 中
|
||||
///// </summary>
|
||||
///// <returns></returns>
|
||||
//private async Task Load()
|
||||
//{
|
||||
// await webView2.EnsureCoreWebView2Async();
|
||||
// webView2.CoreWebView2.Settings.AreDefaultContextMenusEnabled = false; // 禁止右键菜单
|
||||
|
||||
// var assembly = Assembly.GetExecutingAssembly();
|
||||
// var resourceName = "PrintPdf.Views.vue.global.js";
|
||||
|
||||
// using var stream = assembly.GetManifestResourceStream(resourceName);
|
||||
// if (stream != null)
|
||||
// {
|
||||
// using var reader = new StreamReader(stream);
|
||||
// var vue = await reader.ReadToEndAsync();
|
||||
// await webView2.CoreWebView2.AddScriptToExecuteOnDocumentCreatedAsync(vue); // 加载 vuejs
|
||||
// }
|
||||
|
||||
// var vm = (PrintPdfViewModel)DataContext;
|
||||
|
||||
// webView2.CoreWebView2.NavigateToString(vm.Template); // 加载 pdf 模板
|
||||
|
||||
// webView2.CoreWebView2.NavigationCompleted += (sender, args) =>
|
||||
// {
|
||||
// var json = JsonSerializer.Serialize(vm.Data);
|
||||
// webView2.CoreWebView2.PostWebMessageAsJson(json); // 将数据传递到 html 中
|
||||
// };
|
||||
//}
|
||||
}
|
||||
}
|
|
@ -36,7 +36,7 @@
|
|||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="50" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="300" />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
<Grid Background="#03a9f4" Grid.Row="0">
|
||||
|
@ -58,6 +58,8 @@
|
|||
<ColumnDefinition Width="3*" />
|
||||
<ColumnDefinition Width="2*" />
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="2*" />
|
||||
<ColumnDefinition Width="2*" />
|
||||
<ColumnDefinition Width="3*" />
|
||||
|
@ -98,32 +100,47 @@
|
|||
VerticalAlignment="Center"
|
||||
HorizontalAlignment="Right"
|
||||
Style="{StaticResource MaterialDesignBody2TextBlock}"
|
||||
Text="厂家:" />
|
||||
Text="单位:" />
|
||||
<TextBlock
|
||||
Grid.Column="5"
|
||||
Margin="16 0 16 8"
|
||||
VerticalAlignment="Center"
|
||||
HorizontalAlignment="Left"
|
||||
Style="{StaticResource MaterialDesignBody2TextBlock}"
|
||||
Text="{Binding ChannelStock.DrugInfo.Manufactory}" />
|
||||
Text="{Binding ChannelStock.DrugInfo.BigUnit}" />
|
||||
<TextBlock
|
||||
Grid.Column="6"
|
||||
Margin="16 0 16 8"
|
||||
VerticalAlignment="Center"
|
||||
HorizontalAlignment="Right"
|
||||
Style="{StaticResource MaterialDesignBody2TextBlock}"
|
||||
Text="可还空瓶数:" />
|
||||
Text="厂家:" />
|
||||
<TextBlock
|
||||
Grid.Column="7"
|
||||
Margin="16 0 16 8"
|
||||
VerticalAlignment="Center"
|
||||
HorizontalAlignment="Left"
|
||||
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}" />
|
||||
</Grid>
|
||||
<ListView
|
||||
Grid.Row="2"
|
||||
ItemsSource="{Binding MachineRecords}"
|
||||
SelectedItem="{Binding _MachineRecord}"
|
||||
materialDesign:ListViewAssist.HeaderRowBackground="#31ccec"
|
||||
materialDesign:DataGridAssist.ColumnHeaderPadding="10"
|
||||
materialDesign:ListViewAssist.ListViewItemPadding="13">
|
||||
|
@ -131,31 +148,46 @@
|
|||
<Style TargetType="{x:Type GridViewColumnHeader}" BasedOn="{StaticResource {x:Type GridViewColumnHeader}}">
|
||||
<Setter Property="Foreground" Value="White" />
|
||||
</Style>
|
||||
<Style TargetType="ScrollViewer">
|
||||
<Setter Property="HorizontalScrollBarVisibility" Value="Visible"/>
|
||||
<Setter Property="VerticalScrollBarVisibility" Value="Visible"/>
|
||||
</Style>
|
||||
</ListView.Resources>
|
||||
<i:Interaction.Triggers>
|
||||
<i:EventTrigger EventName="SelectionChanged">
|
||||
<i:InvokeCommandAction Command="{Binding RowSelected}" />
|
||||
</i:EventTrigger>
|
||||
</i:Interaction.Triggers>
|
||||
<ListView.View>
|
||||
<GridView ColumnHeaderContainerStyle="{StaticResource st}">
|
||||
<GridViewColumn Header="选择" Width="100">
|
||||
<GridViewColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<CheckBox IsChecked="{Binding IsSelected}" Click="CheckBox_Click" />
|
||||
<CheckBox IsChecked="{Binding IsSelected}" />
|
||||
</DataTemplate>
|
||||
</GridViewColumn.CellTemplate>
|
||||
</GridViewColumn>
|
||||
<GridViewColumn Width="100"
|
||||
Header="患者姓名"
|
||||
DisplayMemberBinding="{Binding orderInfo.PName}"/>
|
||||
<GridViewColumn Width="100"
|
||||
Header="使用科室"
|
||||
DisplayMemberBinding="{Binding orderInfo.DeptName}"/>
|
||||
<!--<GridViewColumn Width="100"
|
||||
Header="操作人"
|
||||
DisplayMemberBinding="{Binding User.Nickname}"/>
|
||||
<GridViewColumn Width="150"
|
||||
DisplayMemberBinding="{Binding User.Nickname}"/>-->
|
||||
<!--<GridViewColumn Width="150"
|
||||
Header="时间"
|
||||
DisplayMemberBinding="{Binding OperationTime, StringFormat='yyyy-MM-dd HH:mm:ss'}" />
|
||||
DisplayMemberBinding="{Binding OperationTime, StringFormat='yyyy-MM-dd HH:mm:ss'}" />-->
|
||||
<GridViewColumn Width="100"
|
||||
DisplayMemberBinding="{Binding Quantity}"
|
||||
Header="数量"/>
|
||||
<GridViewColumn Width="150"
|
||||
DisplayMemberBinding="{Binding ManuNo}"
|
||||
Header="批次"/>
|
||||
<GridViewColumn Width="150"
|
||||
<!--<GridViewColumn Width="150"
|
||||
DisplayMemberBinding="{Binding EffDate, StringFormat=yyyy-MM-dd}"
|
||||
Header="效期"/>
|
||||
Header="效期"/>-->
|
||||
</GridView>
|
||||
</ListView.View>
|
||||
</ListView>
|
||||
|
@ -171,14 +203,28 @@
|
|||
<ColumnDefinition />
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBox
|
||||
Margin="0 6 0 6"
|
||||
Margin="26 6 26 6"
|
||||
Grid.Row="0"
|
||||
Grid.Column="1"
|
||||
Grid.Column="0"
|
||||
IsReadOnly="{Binding ChannelStock.BoardType, Converter={StaticResource InputQuantityConverter}}"
|
||||
Text="{Binding ReturnQuantity, UpdateSourceTrigger=PropertyChanged, ValidatesOnExceptions=True}"
|
||||
Style="{StaticResource MaterialDesignOutlinedTextBox}"
|
||||
VerticalAlignment="Top"
|
||||
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">
|
||||
|
||||
<Button
|
||||
|
|
|
@ -22,16 +22,16 @@ namespace DM_Weight.Views.Dialog
|
|||
/// </summary>
|
||||
public partial class ReturnEmptyDialog : UserControl
|
||||
{
|
||||
IEventAggregator _eventAggregator;
|
||||
//IEventAggregator _eventAggregator;
|
||||
public ReturnEmptyDialog(IEventAggregator eventAggregator)
|
||||
{
|
||||
InitializeComponent();
|
||||
this._eventAggregator= eventAggregator;
|
||||
//this._eventAggregator= eventAggregator;
|
||||
}
|
||||
|
||||
private void CheckBox_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
_eventAggregator.GetEvent<CheckBoxCheckEvent>().Publish();
|
||||
}
|
||||
//private void CheckBox_Click(object sender, RoutedEventArgs e)
|
||||
//{
|
||||
// _eventAggregator.GetEvent<CheckBoxCheckEvent>().Publish();
|
||||
//}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -121,6 +121,13 @@
|
|||
Content="加药"
|
||||
Command="{Binding OpenDrawer}">
|
||||
</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="凭证号"
|
||||
materialDesign:HintAssist.IsFloating="True" Width="100"
|
||||
Margin="2"
|
||||
|
|
|
@ -121,6 +121,14 @@
|
|||
Content="取药"
|
||||
Command="{Binding OpenDrawer}">
|
||||
</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
|
||||
Margin="2"
|
||||
Visibility="{Binding Status, Converter={StaticResource StatusConverter}, ConverterParameter=CompleteBtn}"
|
||||
|
|
|
@ -126,23 +126,23 @@
|
|||
<ColumnDefinition />
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<Button Grid.Row="0" Grid.Column="0" Width="120" Content="1" Command="{Binding UpdateDrawerNo}" CommandParameter="1" />
|
||||
<Button Grid.Row="1" Grid.Column="0" Width="120" Content="2" Command="{Binding UpdateDrawerNo}" CommandParameter="2" />
|
||||
<Button Grid.Row="2" Grid.Column="0" Width="120" Content="3" Command="{Binding UpdateDrawerNo}" CommandParameter="3" />
|
||||
<Button Grid.Row="3" Grid.Column="0" Width="120" Content="4" Command="{Binding UpdateDrawerNo}" CommandParameter="4" />
|
||||
<Button Grid.Row="4" Grid.Column="0" Width="120" Content="5" Command="{Binding UpdateDrawerNo}" CommandParameter="5" />
|
||||
<Button Grid.Row="5" Grid.Column="0" Width="120" Content="6" Command="{Binding UpdateDrawerNo}" CommandParameter="6" />
|
||||
<Button Grid.Row="6" Grid.Column="0" Width="120" Content="7" Command="{Binding UpdateDrawerNo}" CommandParameter="7" />
|
||||
<Button Grid.Row="7" Grid.Column="0" Width="120" Content="8" Command="{Binding UpdateDrawerNo}" CommandParameter="8" />
|
||||
<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}" IsEnabled="{Binding Is8Drawer}" CommandParameter="2" />
|
||||
<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}" IsEnabled="{Binding Is16Drawer}" CommandParameter="4" />
|
||||
<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}" IsEnabled="{Binding Is16Drawer}" CommandParameter="6" />
|
||||
<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}" IsEnabled="{Binding Is16Drawer}" CommandParameter="8" />
|
||||
|
||||
<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}" CommandParameter="10" />
|
||||
<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}" CommandParameter="12" />
|
||||
<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}" CommandParameter="14" />
|
||||
<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}" CommandParameter="16" />
|
||||
<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}" IsEnabled="{Binding Is16Drawer}" CommandParameter="10" />
|
||||
<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}" IsEnabled="{Binding Is16Drawer}" CommandParameter="12" />
|
||||
<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}" IsEnabled="{Binding Is16Drawer}" CommandParameter="14" />
|
||||
<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}" IsEnabled="{Binding Is16Drawer}" CommandParameter="16" />
|
||||
|
||||
</Grid>
|
||||
</Grid>
|
||||
|
@ -161,7 +161,13 @@
|
|||
materialDesign:ButtonProgressAssist.IsIndeterminate="{Binding Status, Converter={StaticResource StatusConverter}, ConverterParameter=opearBtnLoading}"
|
||||
Style="{StaticResource MaterialDesignOutlinedLightButton}"
|
||||
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="凭证号"
|
||||
materialDesign:HintAssist.IsFloating="True" Width="100"
|
||||
Margin="0 0 3 0"
|
||||
|
|
|
@ -122,23 +122,23 @@
|
|||
<ColumnDefinition />
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<Button Grid.Row="0" Grid.Column="0" Width="120" Content="1" Command="{Binding UpdateDrawerNo}" CommandParameter="1" />
|
||||
<Button Grid.Row="1" Grid.Column="0" Width="120" Content="2" Command="{Binding UpdateDrawerNo}" CommandParameter="2" />
|
||||
<Button Grid.Row="2" Grid.Column="0" Width="120" Content="3" Command="{Binding UpdateDrawerNo}" CommandParameter="3" />
|
||||
<Button Grid.Row="3" Grid.Column="0" Width="120" Content="4" Command="{Binding UpdateDrawerNo}" CommandParameter="4" />
|
||||
<Button Grid.Row="4" Grid.Column="0" Width="120" Content="5" Command="{Binding UpdateDrawerNo}" CommandParameter="5" />
|
||||
<Button Grid.Row="5" Grid.Column="0" Width="120" Content="6" Command="{Binding UpdateDrawerNo}" CommandParameter="6" />
|
||||
<Button Grid.Row="6" Grid.Column="0" Width="120" Content="7" Command="{Binding UpdateDrawerNo}" CommandParameter="7" />
|
||||
<Button Grid.Row="7" Grid.Column="0" Width="120" Content="8" Command="{Binding UpdateDrawerNo}" CommandParameter="8" />
|
||||
|
||||
<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}" CommandParameter="10" />
|
||||
<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}" CommandParameter="12" />
|
||||
<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}" CommandParameter="14" />
|
||||
<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}" CommandParameter="16" />
|
||||
<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}" IsEnabled="{Binding Is8Drawer}" CommandParameter="2" />
|
||||
<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}" IsEnabled="{Binding Is16Drawer}" CommandParameter="4" />
|
||||
<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}" IsEnabled="{Binding Is16Drawer}" CommandParameter="6" />
|
||||
<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}" 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="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}" IsEnabled="{Binding Is16Drawer}" CommandParameter="11" />
|
||||
<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}" IsEnabled="{Binding Is16Drawer}" CommandParameter="13" />
|
||||
<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}" IsEnabled="{Binding Is16Drawer}" CommandParameter="15" />
|
||||
<Button Grid.Row="7" Grid.Column="1" Width="120" Content="16" Command="{Binding UpdateDrawerNo}" IsEnabled="{Binding Is16Drawer}" CommandParameter="16" />
|
||||
|
||||
</Grid>
|
||||
</Grid>
|
||||
|
@ -157,6 +157,13 @@
|
|||
materialDesign:ButtonProgressAssist.IsIndeterminate="{Binding Status, Converter={StaticResource StatusConverter}, ConverterParameter=opearBtnLoading}"
|
||||
Style="{StaticResource MaterialDesignOutlinedLightButton}"
|
||||
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
|
||||
Margin="0 0 3 0"
|
||||
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,8 +26,8 @@
|
|||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Image Grid.Column="0" Margin="30 0 30 0" HorizontalAlignment="Left" Width="Auto" Height="26" Source="/Images/logo.png" />
|
||||
<!--<TextBlock Text="毒麻药品管理系统" Grid.Column="0" Margin="30 0 30 0" HorizontalAlignment="Left" Width="Auto" Height="26" Foreground="White" FontSize="20" FontWeight="Bold" />-->
|
||||
<!--<Image Grid.Column="0" Margin="30 0 30 0" HorizontalAlignment="Left" Width="Auto" Height="26" Source="/Images/logo.png" />-->
|
||||
<TextBlock Text="麻精药品管理系统" Grid.Column="0" Margin="30 0 30 0" HorizontalAlignment="Left" Width="Auto" Height="26" Foreground="White" FontSize="20" FontWeight="Bold" />
|
||||
|
||||
<ListBox Name="ListBoxName" Grid.Column="1" SelectedItem="{Binding SelectedMenu}" ItemsSource="{Binding PremissionDmList}" HorizontalAlignment="Right">
|
||||
<i:Interaction.Triggers>
|
||||
|
|
|
@ -56,7 +56,7 @@
|
|||
FontSize="28"
|
||||
Foreground="#31ccec"
|
||||
FontWeight="Bold"
|
||||
Text="欢迎登录毒麻药品管理系统">
|
||||
Text="欢迎登录麻精药品管理系统">
|
||||
</TextBlock>
|
||||
<TextBlock
|
||||
Grid.Row="2"
|
||||
|
|
|
@ -77,7 +77,23 @@
|
|||
</StackPanel>
|
||||
</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"
|
||||
Style="{StaticResource MaterialDesignOutlinedLightButton}"
|
||||
ToolTip="导出" Command="{Binding Download}">
|
||||
|
|
|
@ -19,9 +19,9 @@
|
|||
Topmost="False"
|
||||
prism:ViewModelLocator.AutoWireViewModel="True"
|
||||
Title="主窗口" Height="768" Width="1024" WindowStyle="None" WindowState="Maximized">
|
||||
<!--<WindowChrome.WindowChrome>
|
||||
<WindowChrome.WindowChrome>
|
||||
<WindowChrome CornerRadius="4" GlassFrameThickness="1" />
|
||||
</WindowChrome.WindowChrome>-->
|
||||
</WindowChrome.WindowChrome>
|
||||
|
||||
<materialDesign:DialogHost
|
||||
DialogMargin="0"
|
||||
|
|
|
@ -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 />
|
||||
</Grid.RowDefinitions>
|
||||
<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
|
||||
Margin="0 0 6 0"
|
||||
VerticalAlignment="Center"
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
xmlns:prism="http://prismlibrary.com/"
|
||||
mc:Ignorable="d">
|
||||
<UserControl.Resources>
|
||||
<convert:DrawerAuthorityConverter x:Key="DrawerAuthorityConverter" />
|
||||
<Style x:Key="st" TargetType="GridViewColumnHeader">
|
||||
<Style.Setters>
|
||||
<Setter Property="Height">
|
||||
|
@ -95,6 +96,7 @@
|
|||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition />
|
||||
<RowDefinition Height="0.2*" />
|
||||
</Grid.RowDefinitions>
|
||||
<Grid Grid.Row="0">
|
||||
<Grid.ColumnDefinitions>
|
||||
|
@ -190,6 +192,18 @@
|
|||
MessageQueue="{Binding SnackbarMessageQueue}"/>
|
||||
</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>
|
||||
</GroupBox>
|
||||
</Grid>
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue