Compare commits
18 Commits
SanYa_ZhuYuan
...
master
Author | SHA1 | Date | |
---|---|---|---|
|
ed833f7991 |
|
|
|
ff7716f63d |
|
|
|
2ef1c185e3 |
|
|
|
4f0297f4bc |
|
|
|
db02d51934 |
|
|
|
35695d2094 |
|
|
|
c36cbf4a1f |
|
|
|
a05d131dec |
|
|
|
358f5e57fd |
|
|
|
2f9e86fb75 |
|
|
|
9696d374b9 |
|
|
|
a450ef661d |
|
|
|
2f891bd446 |
|
|
|
e8e7bfc36d |
|
|
|
c9ff369dcf |
|
|
|
adf92e852d |
|
|
|
2d5dabf977 |
|
|
|
3bb1ef457a |
|
|
@ -3,7 +3,7 @@
|
||||||
<connectionStrings>
|
<connectionStrings>
|
||||||
<!-- 数据库连接字符串 -->
|
<!-- 数据库连接字符串 -->
|
||||||
<!--<add name="database" connectionString="server=127.0.0.1;database=wpf_dm_program;userid=root;password=qq1223" />-->
|
<!--<add name="database" connectionString="server=127.0.0.1;database=wpf_dm_program;userid=root;password=qq1223" />-->
|
||||||
<add name="database" connectionString="server=127.0.0.1;port=3306;database=hunanxianchang_db;userid=root;password=root" />
|
<add name="database" connectionString="server=127.0.0.1;port=3306;database=hunanxianchang_db;userid=root;password=root;Pooling=false; ConnectionLifeTime=0;" />
|
||||||
</connectionStrings>
|
</connectionStrings>
|
||||||
<!--<runtime>
|
<!--<runtime>
|
||||||
--><!--配置之后,Appdomain.CurrentDomain.UnhandledException 事件的 IsTerminating 就变成了 false 啦!也就是说,程序并不会因为这次的异常而崩溃退出。--><!--
|
--><!--配置之后,Appdomain.CurrentDomain.UnhandledException 事件的 IsTerminating 就变成了 false 啦!也就是说,程序并不会因为这次的异常而崩溃退出。--><!--
|
||||||
|
@ -20,7 +20,7 @@
|
||||||
<!--2023/7/13 药房代码 有则写无则空 -->
|
<!--2023/7/13 药房代码 有则写无则空 -->
|
||||||
<add key="storage" value="" />
|
<add key="storage" value="" />
|
||||||
<!-- 登录模式 1单人登录2双人登录 -->
|
<!-- 登录模式 1单人登录2双人登录 -->
|
||||||
<add key="loginMode" value="2" />
|
<add key="loginMode" value="1" />
|
||||||
<!-- 登录顺序,指定先登录的人的名称有效值,只有在登录模式等于2时才会生效; 发药人:【operator】审核人:【reviewer】 -->
|
<!-- 登录顺序,指定先登录的人的名称有效值,只有在登录模式等于2时才会生效; 发药人:【operator】审核人:【reviewer】 -->
|
||||||
<add key="firstLogin" value="operator" />
|
<add key="firstLogin" value="operator" />
|
||||||
<!-- 按处方还药或者按取药记录还药 1:处方2:药品-->
|
<!-- 按处方还药或者按取药记录还药 1:处方2:药品-->
|
||||||
|
@ -44,7 +44,7 @@
|
||||||
<!-- can总线串口的串口号 -->
|
<!-- can总线串口的串口号 -->
|
||||||
<add key="CanBusPortPath" value="COM9" />
|
<add key="CanBusPortPath" value="COM9" />
|
||||||
<!-- 条码枪串口的串口号 -->
|
<!-- 条码枪串口的串口号 -->
|
||||||
<add key="ScanCodePortPath" value="COM11" />
|
<add key="ScanCodePortPath" value="COM111" />
|
||||||
<!-- 抽屉串口的串口号 --><!--
|
<!-- 抽屉串口的串口号 --><!--
|
||||||
<add key="DrawerPortPath" value="COM11" />
|
<add key="DrawerPortPath" value="COM11" />
|
||||||
--><!-- can总线串口的串口号 --><!--
|
--><!-- can总线串口的串口号 --><!--
|
||||||
|
@ -61,6 +61,8 @@
|
||||||
<add key="fingerIp" value="192.168.50.201"/>
|
<add key="fingerIp" value="192.168.50.201"/>
|
||||||
<!--一个抽屉对应标签数-->
|
<!--一个抽屉对应标签数-->
|
||||||
<add key="labelCount" value="2"/>
|
<add key="labelCount" value="2"/>
|
||||||
|
<!--库存盘点17号库位线程等待时间(毫秒)-->
|
||||||
|
<add key="CheckSleepMilliseconds" value="500"/>
|
||||||
|
|
||||||
</appSettings>
|
</appSettings>
|
||||||
</configuration>
|
</configuration>
|
|
@ -59,9 +59,9 @@ namespace DM_Weight
|
||||||
private readonly ILog logger = LogManager.GetLogger(typeof(App));
|
private readonly ILog logger = LogManager.GetLogger(typeof(App));
|
||||||
public App()
|
public App()
|
||||||
{
|
{
|
||||||
//TabTipAutomation.IgnoreHardwareKeyboard = HardwareKeyboardIgnoreOptions.IgnoreAll;
|
TabTipAutomation.IgnoreHardwareKeyboard = HardwareKeyboardIgnoreOptions.IgnoreAll;
|
||||||
//TabTipAutomation.BindTo<TextBox>();
|
TabTipAutomation.BindTo<TextBox>();
|
||||||
//TabTipAutomation.BindTo<PasswordBox>();
|
TabTipAutomation.BindTo<PasswordBox>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -252,12 +252,12 @@ namespace DM_Weight
|
||||||
//交接班记录
|
//交接班记录
|
||||||
containerRegistry.RegisterForNavigation<ChangeShiftsListWindow, ChangeShiftsListWindowViewModel>();
|
containerRegistry.RegisterForNavigation<ChangeShiftsListWindow, ChangeShiftsListWindowViewModel>();
|
||||||
|
|
||||||
|
containerRegistry.RegisterForNavigation<PrintPdfView, PrintPdfViewModel>();
|
||||||
|
|
||||||
//交接班
|
//交接班
|
||||||
containerRegistry.RegisterForNavigation<ChangeShiftsDialog, ChangeShiftsDialogViewModel>();
|
containerRegistry.RegisterForNavigation<ChangeShiftsDialog, ChangeShiftsDialogViewModel>();
|
||||||
|
|
||||||
containerRegistry.RegisterSingleton<SqlSugarScope>(() => SqlSugarHelperNew.GetInstance());
|
//containerRegistry.RegisterSingleton<SqlSugarScope>(() => SqlSugarHelperNew.GetInstance());
|
||||||
|
|
||||||
//账册页面
|
//账册页面
|
||||||
containerRegistry.RegisterForNavigation<AccountWindow,AccountWindowViewModel>();
|
containerRegistry.RegisterForNavigation<AccountWindow,AccountWindowViewModel>();
|
||||||
|
|
|
@ -0,0 +1,41 @@
|
||||||
|
using DM_Weight.Models;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Globalization;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows.Data;
|
||||||
|
using System.Windows.Media;
|
||||||
|
|
||||||
|
namespace DM_Weight.Converter
|
||||||
|
{
|
||||||
|
internal class ColorCountConverter : 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 (count <= 0)
|
||||||
|
{
|
||||||
|
return "Red";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return "black";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return "black";
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -69,7 +69,9 @@
|
||||||
<PackageReference Include="log4net" Version="2.0.15" />
|
<PackageReference Include="log4net" Version="2.0.15" />
|
||||||
<PackageReference Include="MaterialDesignThemes" Version="4.8.0" />
|
<PackageReference Include="MaterialDesignThemes" Version="4.8.0" />
|
||||||
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="8.0.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="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="Newtonsoft.Json" Version="13.0.2" />
|
||||||
<PackageReference Include="Prism.Unity" Version="8.1.97" />
|
<PackageReference Include="Prism.Unity" Version="8.1.97" />
|
||||||
<PackageReference Include="SqlSugarCore" Version="5.1.4.67" />
|
<PackageReference Include="SqlSugarCore" Version="5.1.4.67" />
|
||||||
|
|
|
@ -73,6 +73,8 @@ namespace DM_Weight.Models
|
||||||
[SugarColumn(ColumnName = "quantity")]
|
[SugarColumn(ColumnName = "quantity")]
|
||||||
public int Quantity { get; set; }
|
public int Quantity { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// 默认值: 1
|
/// 默认值: 1
|
||||||
|
@ -110,9 +112,19 @@ namespace DM_Weight.Models
|
||||||
get => _addQuantity;
|
get => _addQuantity;
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
|
if (value < 0)
|
||||||
|
{
|
||||||
|
throw new ArgumentException("加药数量不能小于0");
|
||||||
|
}
|
||||||
SetProperty(ref _addQuantity, value);
|
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;
|
private int _takeQuantity = 0;
|
||||||
|
|
||||||
|
@ -126,9 +138,29 @@ namespace DM_Weight.Models
|
||||||
{
|
{
|
||||||
throw new ArgumentException("取药数量不能大于库存");
|
throw new ArgumentException("取药数量不能大于库存");
|
||||||
}
|
}
|
||||||
|
if(value< 0)
|
||||||
|
{
|
||||||
|
throw new ArgumentException("取药数量不能小于0");
|
||||||
|
}
|
||||||
|
if(OrderQuantity>0&&value>OrderQuantity)
|
||||||
|
{
|
||||||
|
throw new ArgumentException("取药数量不能大于应取数量");
|
||||||
|
}
|
||||||
SetProperty(ref _takeQuantity, value);
|
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;
|
//private string _tipMessage=string.Empty;
|
||||||
//[SugarColumn(IsIgnore = true)]
|
//[SugarColumn(IsIgnore = true)]
|
||||||
//public string TipMessage
|
//public string TipMessage
|
||||||
|
|
|
@ -72,7 +72,7 @@ namespace DM_Weight.Models
|
||||||
[SugarColumn(ColumnName = "eff_date")]
|
[SugarColumn(ColumnName = "eff_date")]
|
||||||
public DateTime? EffDate { get; set; }
|
public DateTime? EffDate { get; set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 出库入库类型(1入库2出库31还药32还空瓶)
|
/// 出库入库类型(1入库2出库31还药32还空瓶4盘点5日结存)
|
||||||
///</summary>
|
///</summary>
|
||||||
[SugarColumn(ColumnName = "type")]
|
[SugarColumn(ColumnName = "type")]
|
||||||
public int Type { get; set; }
|
public int Type { get; set; }
|
||||||
|
@ -106,13 +106,15 @@ namespace DM_Weight.Models
|
||||||
/// 退药量
|
/// 退药量
|
||||||
/// 默认值: 0
|
/// 默认值: 0
|
||||||
///</summary>
|
///</summary>
|
||||||
[SugarColumn(ColumnName = "return_quantity1", IsOnlyIgnoreInsert = true)]
|
//[SugarColumn(ColumnName = "return_quantity1", IsOnlyIgnoreInsert = true)]
|
||||||
|
[SugarColumn(ColumnName = "return_quantity1")]
|
||||||
public int ReturnQuantity1 { get; set; }
|
public int ReturnQuantity1 { get; set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 退空瓶量
|
/// 退空瓶量
|
||||||
/// 默认值: 0
|
/// 默认值: 0
|
||||||
///</summary>
|
///</summary>
|
||||||
[SugarColumn(ColumnName = "return_quantity2", IsOnlyIgnoreInsert = true)]
|
//[SugarColumn(ColumnName = "return_quantity2", IsOnlyIgnoreInsert = true
|
||||||
|
[SugarColumn(ColumnName = "return_quantity2")]
|
||||||
public int ReturnQuantity2 { get; set; }
|
public int ReturnQuantity2 { get; set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 取药记录id
|
/// 取药记录id
|
||||||
|
|
|
@ -127,5 +127,10 @@ namespace DM_Weight.Models
|
||||||
///</summary>
|
///</summary>
|
||||||
[SugarColumn(ColumnName = "use_dosage")]
|
[SugarColumn(ColumnName = "use_dosage")]
|
||||||
public string UseDosage { get; set; }
|
public string UseDosage { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 处方中该药品状态是否已全部取出0未取1已取(针对处方可取部分药)
|
||||||
|
/// </summary>
|
||||||
|
[SugarColumn(ColumnName = "dm_status")]
|
||||||
|
public int? DMStatus { get;set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1041,6 +1041,7 @@ namespace DM_Weight.Port
|
||||||
Array.Resize(ref contentBuf, contentBuf.Length + 1);
|
Array.Resize(ref contentBuf, contentBuf.Length + 1);
|
||||||
}
|
}
|
||||||
byte[] buffer = new byte[] { 0xaa, (byte)channel, 1, (byte)type, 0, 0, 0, 0xee };
|
byte[] buffer = new byte[] { 0xaa, (byte)channel, 1, (byte)type, 0, 0, 0, 0xee };
|
||||||
|
logger.Info($"buffer:{Convert.ToHexString(buffer)}");
|
||||||
canBusSerial.Write(buffer, 0, 8);
|
canBusSerial.Write(buffer, 0, 8);
|
||||||
//await Task.Delay(20);
|
//await Task.Delay(20);
|
||||||
Thread.Sleep(20);
|
Thread.Sleep(20);
|
||||||
|
@ -1050,6 +1051,7 @@ namespace DM_Weight.Port
|
||||||
buffer[5] = contentBuf[i];
|
buffer[5] = contentBuf[i];
|
||||||
buffer[6] = contentBuf[i + 1];
|
buffer[6] = contentBuf[i + 1];
|
||||||
canBusSerial.Write(buffer, 0, 8);
|
canBusSerial.Write(buffer, 0, 8);
|
||||||
|
logger.Info($"buffer:{Convert.ToHexString(buffer)}");
|
||||||
//await Task.Delay(20);
|
//await Task.Delay(20);
|
||||||
Thread.Sleep(20);
|
Thread.Sleep(20);
|
||||||
}
|
}
|
||||||
|
@ -1089,6 +1091,7 @@ namespace DM_Weight.Port
|
||||||
canBusSerial.DiscardInBuffer();
|
canBusSerial.DiscardInBuffer();
|
||||||
int channel = ((drawerNo > 8 ? (drawerNo - 8) * 2 : (drawerNo * 2 - 1)) - 1) * this.labelCount + 10 + colNo;
|
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 };
|
byte[] buffer = new byte[] { 0xaa, (byte)channel, 2, 0, 0, 0, 0, 0xee };
|
||||||
|
logger.Info($"刷新显示内容buffer:{Convert.ToHexString(buffer)}");
|
||||||
canBusSerial.Write(buffer, 0, 8);
|
canBusSerial.Write(buffer, 0, 8);
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
|
@ -1107,6 +1110,7 @@ namespace DM_Weight.Port
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
logger.Info($"TakeQuantity{drawerNo}-{colNo},操作数量{quantity},操作后数量{stock}");
|
||||||
|
|
||||||
canBusSerial.DiscardInBuffer();
|
canBusSerial.DiscardInBuffer();
|
||||||
//int channel = (drawerNo * 10 + colNo);
|
//int channel = (drawerNo * 10 + colNo);
|
||||||
|
@ -1145,14 +1149,14 @@ namespace DM_Weight.Port
|
||||||
buffer[6] = (byte)(quantity & 0xff);
|
buffer[6] = (byte)(quantity & 0xff);
|
||||||
logger.Info($"写入数量buffer:{Convert.ToHexString(buffer)}");
|
logger.Info($"写入数量buffer:{Convert.ToHexString(buffer)}");
|
||||||
canBusSerial.Write(buffer, 0, 8);
|
canBusSerial.Write(buffer, 0, 8);
|
||||||
Task<byte[]> task = GetBufferByPort(canBusSerial, 8);
|
//Task<byte[]> task = GetBufferByPort(canBusSerial, 8);
|
||||||
if (task.Status == TaskStatus.Created)
|
//if (task.Status == TaskStatus.Created)
|
||||||
{
|
//{
|
||||||
task.Start();
|
// task.Start();
|
||||||
|
|
||||||
}
|
//}
|
||||||
byte[] bytes = task.Result;
|
//byte[] bytes = task.Result;
|
||||||
logger.Info($"写入数量返回:" + Convert.ToHexString(bytes));
|
//logger.Info($"写入数量返回:" + Convert.ToHexString(bytes));
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
|
|
@ -9,6 +9,11 @@ using System.Threading.Tasks;
|
||||||
using DM_Weight.Models;
|
using DM_Weight.Models;
|
||||||
using System.Configuration;
|
using System.Configuration;
|
||||||
using DM_Weight.util;
|
using DM_Weight.util;
|
||||||
|
using DM_Weight.Views;
|
||||||
|
using System.Diagnostics;
|
||||||
|
using log4net;
|
||||||
|
using log4net.Repository.Hierarchy;
|
||||||
|
using DM_Weight.ViewModels;
|
||||||
|
|
||||||
namespace DM_Weight.Report
|
namespace DM_Weight.Report
|
||||||
{
|
{
|
||||||
|
@ -17,7 +22,7 @@ namespace DM_Weight.Report
|
||||||
|
|
||||||
// 定义Grid++Report报表主对象
|
// 定义Grid++Report报表主对象
|
||||||
public static GridppReport Report = new GridppReport();
|
public static GridppReport Report = new GridppReport();
|
||||||
public static string gridConnectionString = ConfigurationManager.AppSettings["gridConnectionString"];
|
public static string gridConnectionString = ConfigurationManager.AppSettings["gridConnectionString"];
|
||||||
/**
|
/**
|
||||||
* 打印预览
|
* 打印预览
|
||||||
* tempname: 模板文件名称
|
* tempname: 模板文件名称
|
||||||
|
@ -43,7 +48,7 @@ namespace DM_Weight.Report
|
||||||
{
|
{
|
||||||
Report.ParameterByName("machine_id").Value = (ConfigurationManager.AppSettings["machineId"] ?? "DM1");
|
Report.ParameterByName("machine_id").Value = (ConfigurationManager.AppSettings["machineId"] ?? "DM1");
|
||||||
});
|
});
|
||||||
string machine_id=(ConfigurationManager.AppSettings["machineId"] ?? "DM1");
|
string machine_id = (ConfigurationManager.AppSettings["machineId"] ?? "DM1");
|
||||||
string SQL = $@"SELECT cl.`row_no` AS drawerNo,cl.`col_no` AS colNo,cl.`quantity` AS quantity,cl.`manu_no` AS manuNo,cl.`eff_date` AS effDate,
|
string SQL = $@"SELECT cl.`row_no` AS drawerNo,cl.`col_no` AS colNo,cl.`quantity` AS quantity,cl.`manu_no` AS manuNo,cl.`eff_date` AS effDate,
|
||||||
di.`drug_name` AS drugName,di.`drug_spec` AS drugSpec,di.`pack_unit` AS packUnit,di.`manufactory` AS manuFactory,di.`max_stock` AS baseQuantity,
|
di.`drug_name` AS drugName,di.`drug_spec` AS drugSpec,di.`pack_unit` AS packUnit,di.`manufactory` AS manuFactory,di.`max_stock` AS baseQuantity,
|
||||||
cl.`drug_id` AS drugId FROM channel_stock cl INNER JOIN drug_info di ON di.`drug_id` = cl.`drug_id` WHERE cl.`machine_id` = '{machine_id}' AND cl.`drawer_type` = 1 ORDER BY cl.`drug_id`";
|
cl.`drug_id` AS drugId FROM channel_stock cl INNER JOIN drug_info di ON di.`drug_id` = cl.`drug_id` WHERE cl.`machine_id` = '{machine_id}' AND cl.`drawer_type` = 1 ORDER BY cl.`drug_id`";
|
||||||
|
@ -51,7 +56,22 @@ namespace DM_Weight.Report
|
||||||
Report.LoadFromFile(new FileInfo(AppDomain.CurrentDomain.BaseDirectory) + "ReportTemp//" + "stock_template.grf");
|
Report.LoadFromFile(new FileInfo(AppDomain.CurrentDomain.BaseDirectory) + "ReportTemp//" + "stock_template.grf");
|
||||||
Report.DetailGrid.Recordset.ConnectionString = gridConnectionString;
|
Report.DetailGrid.Recordset.ConnectionString = gridConnectionString;
|
||||||
Report.DetailGrid.Recordset.QuerySQL = SQL;
|
Report.DetailGrid.Recordset.QuerySQL = SQL;
|
||||||
Report.PrintPreview(true);
|
//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);
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 导出盘点后库存信息
|
/// 导出盘点后库存信息
|
||||||
|
@ -76,15 +96,64 @@ namespace DM_Weight.Report
|
||||||
Report.LoadFromFile(new FileInfo(AppDomain.CurrentDomain.BaseDirectory) + "ReportTemp//" + "machine_log_check_new2.grf");
|
Report.LoadFromFile(new FileInfo(AppDomain.CurrentDomain.BaseDirectory) + "ReportTemp//" + "machine_log_check_new2.grf");
|
||||||
Report.DetailGrid.Recordset.ConnectionString = gridConnectionString;
|
Report.DetailGrid.Recordset.ConnectionString = gridConnectionString;
|
||||||
Report.DetailGrid.Recordset.QuerySQL = SQL;
|
Report.DetailGrid.Recordset.QuerySQL = SQL;
|
||||||
Report.PrintPreview(true);
|
// Report.PrintPreview(true);
|
||||||
|
|
||||||
|
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 void PrintReportAccountBook(DateTime? startDate, DateTime? endDate,int type,string drug_id)
|
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;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
public static void PrintReportAccountBook(DateTime? startDate, DateTime? endDate, int type, string drug_id)
|
||||||
{
|
{
|
||||||
DateTime? p_startDate = startDate ?? Convert.ToDateTime("2010-1-1");
|
DateTime? p_startDate = startDate ?? Convert.ToDateTime("2010-1-1");
|
||||||
DateTime? p_endDate = endDate ?? DateTime.Now.AddDays(1);
|
DateTime? p_endDate = endDate ?? DateTime.Now.AddDays(1);
|
||||||
string p_machine_id= (ConfigurationManager.AppSettings["machineId"] ?? "DM1");
|
string p_machine_id = (ConfigurationManager.AppSettings["machineId"] ?? "DM1");
|
||||||
// 定义Grid++Report报表主对象
|
// 定义Grid++Report报表主对象
|
||||||
GridppReport Report = new GridppReport();
|
GridppReport Report = new GridppReport();
|
||||||
// 加载模板文件
|
// 加载模板文件
|
||||||
Report.LoadFromFile(new FileInfo(AppDomain.CurrentDomain.BaseDirectory) + "ReportTemp//" + "account_book_temp.grf");
|
Report.LoadFromFile(new FileInfo(AppDomain.CurrentDomain.BaseDirectory) + "ReportTemp//" + "account_book_temp.grf");
|
||||||
string SQL = string.Empty;
|
string SQL = string.Empty;
|
||||||
|
@ -98,19 +167,20 @@ namespace DM_Weight.Report
|
||||||
//Report.DetailGrid.Recordset.QuerySQL = SQL;
|
//Report.DetailGrid.Recordset.QuerySQL = SQL;
|
||||||
SQL = $@"SELECT TYPE, stockQuantity,inQuantity,outQuantity,operationTime,invoiceId,drugName,drugId,drugSpec,packUnit,dosage,manufactory,manuNo,effDate,
|
SQL = $@"SELECT TYPE, stockQuantity,inQuantity,outQuantity,operationTime,invoiceId,drugName,drugId,drugSpec,packUnit,dosage,manufactory,manuNo,effDate,
|
||||||
operatorName,reviewerName,supplierDept,receiveDept,bigUnit FROM
|
operatorName,reviewerName,supplierDept,receiveDept,bigUnit FROM
|
||||||
(SELECT mr.type, mr.`stock_quantity` AS `stockQuantity`, IF(mr.`type` IN (1, 31), mr.`quantity`, IF(mr.`type` = 4 AND mr.`quantity` > 0, mr.`quantity`, 0))
|
(SELECT mr.type, mr.`stock_quantity` AS `stockQuantity`,
|
||||||
AS `inQuantity`, IF(mr.`type` = 2, mr.`quantity`, IF(mr.`type` = 4 AND mr.`quantity` < 0, (0 - mr.`quantity`), 0)) AS `outQuantity`,
|
IF(mr.`type` IN (1, 31), mr.`quantity`, IF(mr.`type` = 4 AND mr.`quantity` > 0, mr.`quantity`, IF(mr.`type` = 5,mr.return_quantity1,0))) AS `inQuantity`,
|
||||||
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`,
|
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`,
|
di.`drug_spec` AS `drugSpec`, di.`pack_unit` AS `packUnit`,di.big_unit as bigUnit, di.`dosage` AS `dosage`, di.`manufactory` AS `manufactory`,
|
||||||
mr.`manu_no` AS `manuNo`, mr.`eff_date` AS `effDate`, u1.`user_name` AS `operatorName`, u2.`user_name` AS `reviewerName`,mr.supplierDept,mr.receiveDept FROM
|
mr.`manu_no` AS `manuNo`, mr.`eff_date` AS `effDate`, u1.`user_name` AS `operatorName`, u2.`user_name` AS `reviewerName`,mr.supplierDept,mr.receiveDept FROM
|
||||||
dm_machine_record mr LEFT JOIN drug_info di ON mr.`drug_id` = di.`drug_id` LEFT JOIN user_list u1 ON mr.`operator` = u1.`id`
|
dm_machine_record mr LEFT JOIN drug_info di ON mr.`drug_id` = di.`drug_id` LEFT JOIN user_list u1 ON mr.`operator` = u1.`id`
|
||||||
LEFT JOIN user_list u2 ON mr.`reviewer` = u2.`id` WHERE mr.`machine_id` = '{p_machine_id}' AND mr.`operation_time` > '{p_startDate}'
|
LEFT JOIN user_list u2 ON mr.`reviewer` = u2.`id` WHERE mr.`machine_id` = '{p_machine_id}' AND mr.`operation_time` > '{p_startDate}'
|
||||||
AND mr.`operation_time` < '{p_endDate}' and IF(mr.`type` = 4 AND mr.`quantity` = 0, 99999, mr.`quantity`) <>99999 ";
|
AND mr.`operation_time` < '{p_endDate}' and IF(mr.`type` = 4 AND mr.`quantity` = 0, 99999, mr.`quantity`) <>99999 ";
|
||||||
if(!string.IsNullOrEmpty(drug_id))
|
if (!string.IsNullOrEmpty(drug_id))
|
||||||
{
|
{
|
||||||
SQL+= " AND mr.drug_id='"+ drug_id+"' ";
|
SQL += " AND mr.drug_id='" + drug_id + "' ";
|
||||||
}
|
}
|
||||||
SQL+= " ORDER BY mr.`drug_id`, mr.`operation_time`, mr.`id`) AS T";
|
SQL += " ORDER BY mr.`drug_id`, mr.`operation_time`, mr.`id`) AS T";
|
||||||
if (type > 0)
|
if (type > 0)
|
||||||
{
|
{
|
||||||
if (type == 1)
|
if (type == 1)
|
||||||
|
@ -127,11 +197,27 @@ namespace DM_Weight.Report
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Report.DetailGrid.Recordset.QuerySQL = SQL;
|
Report.DetailGrid.Recordset.QuerySQL = SQL;
|
||||||
Report.PrintPreview(true);
|
//Report.PrintPreview(true);
|
||||||
|
string filePath = AppDomain.CurrentDomain.BaseDirectory + "ReportTemp//" + "account_book_temp.pdf";
|
||||||
|
if (File.Exists(filePath))
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
|
||||||
|
File.Delete(filePath);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
FindAndKillProcess();
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Report.ExportDirect(GRExportType.gretPDF, filePath, false, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void PrintReportMechineRecord(int type, DateTime? startDate, DateTime? endDate)
|
public static void PrintReportMechineRecord(int type, DateTime? startDate, DateTime? endDate)
|
||||||
{
|
{
|
||||||
|
string saveFileName = string.Empty;
|
||||||
// 定义Grid++Report报表主对象
|
// 定义Grid++Report报表主对象
|
||||||
GridppReport Report = new GridppReport();
|
GridppReport Report = new GridppReport();
|
||||||
DateTime? p_startDate = startDate ?? Convert.ToDateTime("2010-1-1");
|
DateTime? p_startDate = startDate ?? Convert.ToDateTime("2010-1-1");
|
||||||
|
@ -147,6 +233,7 @@ namespace DM_Weight.Report
|
||||||
// 加载模板文件
|
// 加载模板文件
|
||||||
if (type == 1)
|
if (type == 1)
|
||||||
{
|
{
|
||||||
|
saveFileName = "machine_log_add.pdf";
|
||||||
Report.LoadFromFile(new FileInfo(AppDomain.CurrentDomain.BaseDirectory) + "ReportTemp//" + "machine_log_add.grf");
|
Report.LoadFromFile(new FileInfo(AppDomain.CurrentDomain.BaseDirectory) + "ReportTemp//" + "machine_log_add.grf");
|
||||||
SQL = $@"SELECT dmr.`drawer_no` AS drawerNo,dmr.`col_no` AS colNo,dmr.`type` AS `type`,dmr.`quantity` AS quantity,
|
SQL = $@"SELECT dmr.`drawer_no` AS drawerNo,dmr.`col_no` AS colNo,dmr.`type` AS `type`,dmr.`quantity` AS quantity,
|
||||||
dmr.`manu_no` AS manuNo,dmr.`eff_date` AS effDate,dmr.`operation_time` AS operationTime,
|
dmr.`manu_no` AS manuNo,dmr.`eff_date` AS effDate,dmr.`operation_time` AS operationTime,
|
||||||
|
@ -158,6 +245,8 @@ namespace DM_Weight.Report
|
||||||
}
|
}
|
||||||
else if (type == 2)
|
else if (type == 2)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
saveFileName = "machine_log_take.pdf";
|
||||||
Report.LoadFromFile(new FileInfo(AppDomain.CurrentDomain.BaseDirectory) + "ReportTemp//" + "machine_log_take.grf");
|
Report.LoadFromFile(new FileInfo(AppDomain.CurrentDomain.BaseDirectory) + "ReportTemp//" + "machine_log_take.grf");
|
||||||
SQL = $@" SELECT dmr.`drawer_no` AS drawerNo,dmr.`col_no` AS colNo,dmr.`type` AS `type`,dmr.`quantity` AS quantity,
|
SQL = $@" SELECT dmr.`drawer_no` AS drawerNo,dmr.`col_no` AS colNo,dmr.`type` AS `type`,dmr.`quantity` AS quantity,
|
||||||
dmr.`manu_no` AS manuNo,dmr.`eff_date` AS effDate,dmr.`operation_time` AS operationTime,
|
dmr.`manu_no` AS manuNo,dmr.`eff_date` AS effDate,dmr.`operation_time` AS operationTime,
|
||||||
|
@ -170,6 +259,8 @@ namespace DM_Weight.Report
|
||||||
}
|
}
|
||||||
else if (type == 3)
|
else if (type == 3)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
saveFileName = "machine_log_return.pdf";
|
||||||
Report.LoadFromFile(new FileInfo(AppDomain.CurrentDomain.BaseDirectory) + "ReportTemp//" + "machine_log_return.grf");
|
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`,
|
SQL = $@" SELECT dmr.`drawer_no` AS drawerNo,dmr.`col_no` AS colNo,dmr.`type` AS `type`,
|
||||||
CONCAT(dmr.`quantity`,IF(dmr.`type`=32,""(空瓶)"","""")) AS quantity,dmr.`manu_no` AS manuNo,
|
CONCAT(dmr.`quantity`,IF(dmr.`type`=32,""(空瓶)"","""")) AS quantity,dmr.`manu_no` AS manuNo,
|
||||||
|
@ -183,6 +274,7 @@ namespace DM_Weight.Report
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
saveFileName = "machine_log_check.pdf";
|
||||||
Report.LoadFromFile(new FileInfo(AppDomain.CurrentDomain.BaseDirectory) + "ReportTemp//" + "machine_log_check.grf");
|
Report.LoadFromFile(new FileInfo(AppDomain.CurrentDomain.BaseDirectory) + "ReportTemp//" + "machine_log_check.grf");
|
||||||
SQL = $@" SELECT dmr.`drawer_no` AS drawerNo,dmr.`col_no` AS colNo,dmr.`type` AS `type`,dmr.`check_quantity` AS quantity,
|
SQL = $@" SELECT dmr.`drawer_no` AS drawerNo,dmr.`col_no` AS colNo,dmr.`type` AS `type`,dmr.`check_quantity` AS quantity,
|
||||||
dmr.`manu_no` AS manuNo,dmr.`eff_date` AS effDate,dmr.`operation_time` AS operationTime,
|
dmr.`manu_no` AS manuNo,dmr.`eff_date` AS effDate,dmr.`operation_time` AS operationTime,
|
||||||
|
@ -195,14 +287,41 @@ namespace DM_Weight.Report
|
||||||
AND dmr.`machine_id` = '{p_machine_id}' AND dmr.`operation_time` > '{p_startDate}'
|
AND dmr.`machine_id` = '{p_machine_id}' AND dmr.`operation_time` > '{p_startDate}'
|
||||||
AND dmr.`operation_time` < '{p_endDate}'";
|
AND dmr.`operation_time` < '{p_endDate}'";
|
||||||
}
|
}
|
||||||
|
|
||||||
Report.DetailGrid.Recordset.ConnectionString = gridConnectionString;
|
|
||||||
Report.DetailGrid.Recordset.QuerySQL= SQL;
|
|
||||||
|
|
||||||
Report.PrintPreview(true);
|
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 打印预览
|
* 打印预览
|
||||||
|
@ -215,13 +334,28 @@ namespace DM_Weight.Report
|
||||||
GridppReport Report = new GridppReport();
|
GridppReport Report = new GridppReport();
|
||||||
// 加载模板文件
|
// 加载模板文件
|
||||||
Report.LoadFromFile(new FileInfo(AppDomain.CurrentDomain.BaseDirectory) + "ReportTemp//machine_log.grf");
|
Report.LoadFromFile(new FileInfo(AppDomain.CurrentDomain.BaseDirectory) + "ReportTemp//machine_log.grf");
|
||||||
|
|
||||||
// 加载数据
|
// 加载数据
|
||||||
Report.ParameterByName("type").AsInteger = 1;
|
Report.ParameterByName("type").AsInteger = 1;
|
||||||
Report.PrintPreview(true);
|
//Report.PrintPreview(true);
|
||||||
|
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);
|
||||||
}
|
}
|
||||||
//交接班记录报表
|
//交接班记录报表
|
||||||
public static void PrintChangeShiftsReport(DateTime? startDate,DateTime? endDate)
|
public static void PrintChangeShiftsReport(DateTime? startDate, DateTime? endDate)
|
||||||
{
|
{
|
||||||
DateTime? p_startDate = startDate ?? Convert.ToDateTime("2010-1-1");
|
DateTime? p_startDate = startDate ?? Convert.ToDateTime("2010-1-1");
|
||||||
DateTime? p_endDate = endDate ?? DateTime.Now.AddDays(1);
|
DateTime? p_endDate = endDate ?? DateTime.Now.AddDays(1);
|
||||||
|
@ -243,7 +377,23 @@ namespace DM_Weight.Report
|
||||||
from `hkc_shiftsreport` WHERE `machineid` = '{p_machine_id}' AND `opt_date` > '{p_startDate}'
|
from `hkc_shiftsreport` WHERE `machineid` = '{p_machine_id}' AND `opt_date` > '{p_startDate}'
|
||||||
AND opt_date < '{p_endDate}' ORDER BY opt_date";
|
AND opt_date < '{p_endDate}' ORDER BY opt_date";
|
||||||
Report.DetailGrid.Recordset.QuerySQL = SQL;
|
Report.DetailGrid.Recordset.QuerySQL = SQL;
|
||||||
Report.PrintPreview(true);
|
//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);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -258,12 +408,27 @@ namespace DM_Weight.Report
|
||||||
GridppReport Report = new GridppReport();
|
GridppReport Report = new GridppReport();
|
||||||
// 加载模板文件
|
// 加载模板文件
|
||||||
Report.LoadFromFile(new FileInfo(AppDomain.CurrentDomain.BaseDirectory) + "ReportTemp//machine_log_check.grf");
|
Report.LoadFromFile(new FileInfo(AppDomain.CurrentDomain.BaseDirectory) + "ReportTemp//machine_log_check.grf");
|
||||||
Dictionary<string,List<MachineRecord>> records = new Dictionary<string,List<MachineRecord>>();
|
Dictionary<string, List<MachineRecord>> records = new Dictionary<string, List<MachineRecord>>();
|
||||||
records.Add("table", data);
|
records.Add("table", data);
|
||||||
string str= JsonConvert.SerializeObject(records);
|
string str = JsonConvert.SerializeObject(records);
|
||||||
Report.LoadDataFromXML(str);
|
Report.LoadDataFromXML(str);
|
||||||
// 加载数据
|
// 加载数据
|
||||||
Report.PrintPreview(true);
|
//Report.PrintPreview(true);
|
||||||
|
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -166,7 +166,9 @@
|
||||||
"ColumnContentCell":[
|
"ColumnContentCell":[
|
||||||
{
|
{
|
||||||
"Column":"日期",
|
"Column":"日期",
|
||||||
|
"WordWrap":true,
|
||||||
"TextAlign":"MiddleCenter",
|
"TextAlign":"MiddleCenter",
|
||||||
|
"ShrinkFontToFit":true,
|
||||||
"DataField":"日期"
|
"DataField":"日期"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
|
@ -91,6 +91,7 @@
|
||||||
"ColumnContentCell":[
|
"ColumnContentCell":[
|
||||||
{
|
{
|
||||||
"Column":"盘点日期",
|
"Column":"盘点日期",
|
||||||
|
"WordWrap":true,
|
||||||
"DataField":"盘点日期"
|
"DataField":"盘点日期"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
|
@ -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,
|
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,
|
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
|
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<ChannelStockCount> accountList = SqlSugarHelper.Db.SqlQueryable<ChannelStockCount>(SQL).ToList();
|
||||||
//List<ChannelStock> accountList = SqlSugarHelper.Db.Queryable<ChannelStock>().Includes<DrugInfo>(cs=>cs.DrugInfo)
|
//List<ChannelStock> accountList = SqlSugarHelper.Db.Queryable<ChannelStock>().Includes<DrugInfo>(cs=>cs.DrugInfo)
|
||||||
|
|
|
@ -30,9 +30,9 @@ namespace DM_Weight.Services
|
||||||
string p_machine_id = (ConfigurationManager.AppSettings["machineId"] ?? "DM1");
|
string p_machine_id = (ConfigurationManager.AppSettings["machineId"] ?? "DM1");
|
||||||
string SQL = $@"SELECT TYPE, stockQuantity,inQuantity,outQuantity,operationTime,invoiceId,drugName,drugId,drugSpec,packUnit,dosage,manufactory,manuNo,effDate,
|
string SQL = $@"SELECT TYPE, stockQuantity,inQuantity,outQuantity,operationTime,invoiceId,drugName,drugId,drugSpec,packUnit,dosage,manufactory,manuNo,effDate,
|
||||||
operatorName,reviewerName,supplierDept,receiveDept FROM
|
operatorName,reviewerName,supplierDept,receiveDept FROM
|
||||||
(SELECT mr.type,mr.`stock_quantity` AS `stockQuantity`, IF(mr.`type` IN (1, 31), mr.`quantity`, IF(mr.`type` = 4 AND mr.`quantity` > 0, mr.`quantity`, 0))
|
(SELECT mr.type,mr.`stock_quantity` AS `stockQuantity`, 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`), 0)) AS `outQuantity`,
|
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.`invoice_id`,NULL) AS `invoiceId`, di.`drug_name` AS `drugName`, di.`drug_id` AS `drugId`,
|
DATE_FORMAT(mr.`operation_time`,'%m/%d') AS `operationTime`,IF(mr.`type`=1||mr.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.`dosage` AS `dosage`, di.`manufactory` AS `manufactory`,
|
di.`drug_spec` AS `drugSpec`, di.`pack_unit` AS `packUnit`, di.`dosage` AS `dosage`, di.`manufactory` AS `manufactory`,
|
||||||
mr.`manu_no` AS `manuNo`, DATE_FORMAT(mr.`eff_date`,'%y/%m/%d') AS `effDate`, u1.`user_name` AS `operatorName`, u2.`user_name` AS `reviewerName`,mr.supplierDept,mr.receiveDept FROM
|
mr.`manu_no` AS `manuNo`, DATE_FORMAT(mr.`eff_date`,'%y/%m/%d') AS `effDate`, u1.`user_name` AS `operatorName`, u2.`user_name` AS `reviewerName`,mr.supplierDept,mr.receiveDept FROM
|
||||||
dm_machine_record mr LEFT JOIN drug_info di ON mr.`drug_id` = di.`drug_id` LEFT JOIN user_list u1 ON mr.`operator` = u1.`id`
|
dm_machine_record mr LEFT JOIN drug_info di ON mr.`drug_id` = di.`drug_id` LEFT JOIN user_list u1 ON mr.`operator` = u1.`id`
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
using DM_Weight.Models;
|
using DM_Weight.Models;
|
||||||
|
using log4net;
|
||||||
|
using log4net.Repository.Hierarchy;
|
||||||
using MySqlConnector;
|
using MySqlConnector;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using System;
|
using System;
|
||||||
|
@ -6,49 +8,98 @@ using System.Collections.Generic;
|
||||||
using System.Configuration;
|
using System.Configuration;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace DM_Weight.Services
|
namespace DM_Weight.Services
|
||||||
{
|
{
|
||||||
public class UserService
|
public class UserService
|
||||||
{
|
{
|
||||||
|
private readonly ILog logger = LogManager.GetLogger(typeof(UserService));
|
||||||
//public static string connStr = ConfigurationManager.AppSettings["database"].ToString();
|
//public static string connStr = ConfigurationManager.AppSettings["database"].ToString();
|
||||||
public static string connStr = ConfigurationManager.ConnectionStrings["database"].ToString();
|
public static string connStr = ConfigurationManager.ConnectionStrings["database"].ToString();
|
||||||
public UserList CheckUserByFingerPrinter(int fingerPrinterId)
|
public UserList CheckUserByFingerPrinter(int fingerPrinterId)
|
||||||
{
|
{
|
||||||
UserList? user = null;
|
UserList? user = null;
|
||||||
|
|
||||||
using (MySqlConnection con = new MySqlConnection(connStr))
|
using (MySqlConnection con = new MySqlConnection(connStr))
|
||||||
{
|
{
|
||||||
con.Open();
|
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("数据库连接已打开");
|
||||||
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
|
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;";
|
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);
|
MySqlCommand cmd = new MySqlCommand(sql, con);
|
||||||
cmd.Parameters.Clear();
|
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);
|
cmd.Parameters.AddRange(mySqlParameter);
|
||||||
//执行语句
|
//执行语句
|
||||||
MySqlDataReader reader = cmd.ExecuteReader();
|
MySqlDataReader reader = cmd.ExecuteReader();
|
||||||
|
logger.Info("MySqlDataReader读数据");
|
||||||
while (reader.Read())
|
while (reader.Read())
|
||||||
{
|
{
|
||||||
user = new UserList();
|
user = new UserList();
|
||||||
user.Id = reader.GetInt32("id");
|
user.Id = reader.GetInt32("id");
|
||||||
user.UserName = reader["userName"] is DBNull ? "" : reader.GetString("userName");
|
user.UserName = reader["userName"] is DBNull ? "" : reader.GetString("userName");
|
||||||
//user.UserName = reader["id"] is DBNull ? "" : reader.GetString("id");
|
//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");
|
user.MachineId = reader["machine_id"] is DBNull ? "" : reader.GetString("machine_id");
|
||||||
RoleDm role= new RoleDm();
|
RoleDm role = new RoleDm();
|
||||||
role.Id= reader.GetInt32("id");
|
role.Id = reader.GetInt32("id");
|
||||||
//role.Permissions = reader["permissions"] is DBNull ? "" : reader.GetString("permissions");
|
//role.Permissions = reader["permissions"] is DBNull ? "" : reader.GetString("permissions");
|
||||||
role.RoleName = reader["role_name"] is DBNull ? "" : reader.GetString("role_name");
|
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();
|
role.Permissions = JsonConvert.DeserializeObject<List<PremissionDm>>(reader["permissions"] is DBNull ? "" : reader.GetString("permissions")); // JsonConvert.SerializeObject(reader.GetString("permissions")).ToList();
|
||||||
user.Role = role;
|
user.Role = role;
|
||||||
}
|
}
|
||||||
reader.Close();
|
|
||||||
|
|
||||||
|
reader.Close();
|
||||||
|
logger.Info($"sql:{sql}");
|
||||||
return user;
|
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}");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -237,8 +237,13 @@ namespace DM_Weight.ViewModels
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
string machineId = ConfigurationManager.AppSettings["machineId"] ?? "DM1";
|
||||||
//查询账册中所有记录,与库存中的记录做比校,如果账册中没有,则添加一条
|
//删除已生成的日结存记录
|
||||||
|
int deleteNum = SqlSugarHelper.Db.Deleteable<MachineRecord>()
|
||||||
|
.Where(cs => cs.Type.Equals(5) && cs.OperationTime.ToString("yyyy-MM-dd") == DateTime.Now.ToString("yyyy-MM-dd") && cs.MachineId.Equals(machineId)).ExecuteCommand();
|
||||||
|
int inQuantity = 0; //当日入库量
|
||||||
|
int outQuantity = 0; //当日出库量
|
||||||
|
//查询账册中所有记录,与库存中的记录做比校,如果账册中没有,则添加一条,有则添加一条总日结存
|
||||||
List<AccountModel> accountList = _machineRecordService.ReportAccountBook(nowDate, null, 0);
|
List<AccountModel> accountList = _machineRecordService.ReportAccountBook(nowDate, null, 0);
|
||||||
//库存中的记录
|
//库存中的记录
|
||||||
List<ChannelStockCount> channelStockList = _channelStockService.GetAll();
|
List<ChannelStockCount> channelStockList = _channelStockService.GetAll();
|
||||||
|
@ -249,33 +254,47 @@ namespace DM_Weight.ViewModels
|
||||||
|
|
||||||
for (int i = 0; i < channelStockList.Count; i++)
|
for (int i = 0; i < channelStockList.Count; i++)
|
||||||
{
|
{
|
||||||
int Count = accountList.Where(cs => cs.DrugId == channelStockList[i].DrugId && cs.ManuNo == channelStockList[i].ManuNo).Count();
|
int Count = accountList.Where(cs => cs.DrugId == channelStockList[i].DrugId).Count();
|
||||||
|
|
||||||
if (Count <= 0)
|
if (Count <= 0)
|
||||||
{
|
{
|
||||||
//没有直接插入
|
inQuantity = 0;
|
||||||
// 保存数据 出/入库记录
|
outQuantity = 0;
|
||||||
string InvoiceId = "Account_" + CurrentTimeMillis();
|
|
||||||
SqlSugarHelper.Db.Insertable(new MachineRecord()
|
|
||||||
{
|
|
||||||
MachineId = channelStockList[i].MachineId,
|
|
||||||
DrawerNo = 0,//channelStockList[i].DrawerNo,
|
|
||||||
ColNo = 0,// channelStockList[i].ColNo,FV
|
|
||||||
DrugId = channelStockList[i].DrugId,
|
|
||||||
ManuNo = channelStockList[i].ManuNo,
|
|
||||||
EffDate = !String.IsNullOrEmpty(channelStockList[i].EffDate) ? DateTime.ParseExact(channelStockList[i].EffDate, "yyyy-MM-dd", System.Globalization.CultureInfo.CurrentCulture) : null,
|
|
||||||
Operator = HomeWindowViewModel.Operator?.Id,
|
|
||||||
Reviewer = HomeWindowViewModel.Reviewer?.Id,
|
|
||||||
OperationTime = DateTime.Now,
|
|
||||||
Quantity = 0,
|
|
||||||
Type = 5,
|
|
||||||
InvoiceId = string.Empty,//InvoiceId,
|
|
||||||
StockQuantity = channelStockList[i].Quantity,
|
|
||||||
ManunoQuantity = 0,
|
|
||||||
SupplierDept = ConfigurationManager.AppSettings["supplierDept"].ToString(),
|
|
||||||
ReceiveDept = ConfigurationManager.AppSettings["receiveDept"].ToString()
|
|
||||||
}).ExecuteCommand();
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
inQuantity = accountList.Where(cs => cs.DrugId == channelStockList[i].DrugId).Sum(cs => cs.InQuantity);
|
||||||
|
outQuantity= accountList.Where(cs => cs.DrugId == channelStockList[i].DrugId).Sum(cs => cs.OutQuantity);
|
||||||
|
}
|
||||||
|
// 获取药品总库存
|
||||||
|
int channelStockQuantity = SqlSugarHelper.Db.Queryable<ChannelStock>()
|
||||||
|
.Where(cs => cs.DrugId.Equals(channelStockList[i].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 = channelStockList[i].DrugId,
|
||||||
|
ManuNo = "",//channelStockList[i].ManuNo,
|
||||||
|
EffDate = null,// !String.IsNullOrEmpty(channelStockList[i].EffDate) ? DateTime.ParseExact(channelStockList[i].EffDate, "yyyy-MM-dd", System.Globalization.CultureInfo.CurrentCulture) : null,
|
||||||
|
Operator = HomeWindowViewModel.Operator?.Id,
|
||||||
|
Reviewer = HomeWindowViewModel.Reviewer?.Id,
|
||||||
|
OperationTime = DateTime.Now,
|
||||||
|
Quantity = 0,
|
||||||
|
Type = 5,
|
||||||
|
InvoiceId = "日结存",//InvoiceId,
|
||||||
|
ReturnQuantity1 = inQuantity, //当日入库量总数
|
||||||
|
ReturnQuantity2 = outQuantity, //当日出库量总数
|
||||||
|
StockQuantity = channelStockQuantity,
|
||||||
|
ManunoQuantity = 0,
|
||||||
|
SupplierDept =string.Empty,// ConfigurationManager.AppSettings["supplierDept"].ToString(),
|
||||||
|
ReceiveDept = string.Empty,//ConfigurationManager.AppSettings["receiveDept"].ToString()
|
||||||
|
}).ExecuteCommand();
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -284,6 +303,11 @@ namespace DM_Weight.ViewModels
|
||||||
{
|
{
|
||||||
//账册中没有记录则把库存中的所有数据都要生成一条账册记录
|
//账册中没有记录则把库存中的所有数据都要生成一条账册记录
|
||||||
// 保存数据 出/入库记录
|
// 保存数据 出/入库记录
|
||||||
|
// 获取药品总库存
|
||||||
|
int channelStockQuantity = SqlSugarHelper.Db.Queryable<ChannelStock>()
|
||||||
|
.Where(cs => cs.DrugId.Equals(channelStockList[i].DrugId)).Sum(it => it.Quantity);
|
||||||
|
|
||||||
|
|
||||||
string InvoiceId = "Account_" + CurrentTimeMillis();
|
string InvoiceId = "Account_" + CurrentTimeMillis();
|
||||||
SqlSugarHelper.Db.Insertable(new MachineRecord()
|
SqlSugarHelper.Db.Insertable(new MachineRecord()
|
||||||
{
|
{
|
||||||
|
@ -291,18 +315,20 @@ namespace DM_Weight.ViewModels
|
||||||
DrawerNo = 0,//channelStockList[i].DrawerNo,
|
DrawerNo = 0,//channelStockList[i].DrawerNo,
|
||||||
ColNo = 0,//channelStockList[i].ColNo,
|
ColNo = 0,//channelStockList[i].ColNo,
|
||||||
DrugId = channelStockList[i].DrugId,
|
DrugId = channelStockList[i].DrugId,
|
||||||
ManuNo = channelStockList[i].ManuNo,
|
ManuNo = "",// channelStockList[i].ManuNo,
|
||||||
EffDate = !String.IsNullOrEmpty(channelStockList[i].EffDate) ? DateTime.ParseExact(channelStockList[i].EffDate, "yyyy-MM-dd", System.Globalization.CultureInfo.CurrentCulture) : null,
|
EffDate = null,// !String.IsNullOrEmpty(channelStockList[i].EffDate) ? DateTime.ParseExact(channelStockList[i].EffDate, "yyyy-MM-dd", System.Globalization.CultureInfo.CurrentCulture) : null,
|
||||||
Operator = HomeWindowViewModel.Operator?.Id,
|
Operator = HomeWindowViewModel.Operator?.Id,
|
||||||
Reviewer = HomeWindowViewModel.Reviewer?.Id,
|
Reviewer = HomeWindowViewModel.Reviewer?.Id,
|
||||||
OperationTime = DateTime.Now,
|
OperationTime = DateTime.Now,
|
||||||
Quantity = 0,
|
Quantity = 0,
|
||||||
Type = 5,
|
Type = 5,
|
||||||
InvoiceId = string.Empty,//InvoiceId,
|
InvoiceId = "日结存",// string.Empty,//InvoiceId,
|
||||||
StockQuantity = channelStockList[i].Quantity,
|
ReturnQuantity1 = inQuantity, //当日入库量总数
|
||||||
|
ReturnQuantity2 = outQuantity, //当日出库量总数
|
||||||
|
StockQuantity = channelStockQuantity,
|
||||||
ManunoQuantity = 0,
|
ManunoQuantity = 0,
|
||||||
SupplierDept = ConfigurationManager.AppSettings["supplierDept"].ToString(),
|
SupplierDept = string.Empty,//ConfigurationManager.AppSettings["supplierDept"].ToString(),
|
||||||
ReceiveDept = ConfigurationManager.AppSettings["receiveDept"].ToString()
|
ReceiveDept = string.Empty,//ConfigurationManager.AppSettings["receiveDept"].ToString()
|
||||||
}).ExecuteCommand();
|
}).ExecuteCommand();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,7 @@ using DM_Weight.msg;
|
||||||
using DM_Weight.Port;
|
using DM_Weight.Port;
|
||||||
using DM_Weight.util;
|
using DM_Weight.util;
|
||||||
using log4net;
|
using log4net;
|
||||||
|
using log4net.Repository.Hierarchy;
|
||||||
using Prism.Commands;
|
using Prism.Commands;
|
||||||
using Prism.Events;
|
using Prism.Events;
|
||||||
using Prism.Mvvm;
|
using Prism.Mvvm;
|
||||||
|
@ -170,6 +171,7 @@ namespace DM_Weight.ViewModels
|
||||||
|
|
||||||
public bool Is17Drawer { get => _is17Drawer; set => SetProperty(ref _is17Drawer, value); }
|
public bool Is17Drawer { get => _is17Drawer; set => SetProperty(ref _is17Drawer, value); }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public DelegateCommand<string> UpdateDrawerNo
|
public DelegateCommand<string> UpdateDrawerNo
|
||||||
{
|
{
|
||||||
|
@ -248,7 +250,8 @@ namespace DM_Weight.ViewModels
|
||||||
ManuNo = it.ManuNo,
|
ManuNo = it.ManuNo,
|
||||||
EffDate = it.EffDate,
|
EffDate = it.EffDate,
|
||||||
Id = it.Id,
|
Id = it.Id,
|
||||||
}).UpdateColumns(it => new { it.Quantity, it.ManuNo, it.EffDate }).ExecuteCommand();
|
DrugId= it.DrugId,
|
||||||
|
}).UpdateColumns(it => new { it.Quantity, it.ManuNo, it.EffDate,it.DrugId }).ExecuteCommand();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -339,7 +342,7 @@ namespace DM_Weight.ViewModels
|
||||||
}
|
}
|
||||||
// 更新屏显库存
|
// 更新屏显库存
|
||||||
//List<ChannelStock> singleChannels = record.FindAll(it => it.BoardType != 1);
|
//List<ChannelStock> singleChannels = record.FindAll(it => it.BoardType != 1);
|
||||||
List<ChannelStock> singleChannels = ChannelStocks.Where(it => it.BoardType != 1)
|
List<ChannelStock> singleChannels = ChannelStocks.Where(it => it.BoardType ==5&&(it.Quantity>0||it.AddQuantity>0))
|
||||||
.GroupBy(it => it.ColNo)
|
.GroupBy(it => it.ColNo)
|
||||||
.Select(it =>
|
.Select(it =>
|
||||||
{
|
{
|
||||||
|
@ -384,6 +387,7 @@ namespace DM_Weight.ViewModels
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
logger.Info($"多批次抽屉加药,库存更新失败!{f.ErrorMessage}");
|
||||||
AlertMsg alertMsg = new AlertMsg
|
AlertMsg alertMsg = new AlertMsg
|
||||||
{
|
{
|
||||||
Message = "更新库存失败",
|
Message = "更新库存失败",
|
||||||
|
@ -425,7 +429,7 @@ namespace DM_Weight.ViewModels
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool KeepAlive => true;
|
public bool KeepAlive => false;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -474,7 +478,34 @@ namespace DM_Weight.ViewModels
|
||||||
channelLS.channelStocks = stockList;
|
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()
|
public long CurrentTimeMillis()
|
||||||
{
|
{
|
||||||
return (long)(DateTime.UtcNow - Jan1st1970).TotalMilliseconds;
|
return (long)(DateTime.UtcNow - Jan1st1970).TotalMilliseconds;
|
||||||
|
@ -505,11 +536,12 @@ namespace DM_Weight.ViewModels
|
||||||
.Where(cl => cl.DrugId != null)
|
.Where(cl => cl.DrugId != null)
|
||||||
.OrderBy(cl => cl.ColNo)
|
.OrderBy(cl => cl.ColNo)
|
||||||
.ToList();
|
.ToList();
|
||||||
ChannelLsts = queryData.Select(cl =>
|
ChannelLsts = queryData.AsParallel().Select(cl =>
|
||||||
{
|
{
|
||||||
cl.channelStocks = cl.channelStocks.Select(cs =>
|
cl.channelStocks = cl.channelStocks.Select(cs =>
|
||||||
{
|
{
|
||||||
cs.drugManuNo = cl.Drug.DrugManuNos.Find(it => it.ManuNo.Equals(cs.ManuNo));
|
cs.drugManuNo = cl.Drug.DrugManuNos.Find(it => it.ManuNo.Equals(cs.ManuNo));
|
||||||
|
cs.DrugId=cl.DrugId;
|
||||||
return cs;
|
return cs;
|
||||||
}).ToList();
|
}).ToList();
|
||||||
return cl;
|
return cl;
|
||||||
|
@ -523,6 +555,7 @@ namespace DM_Weight.ViewModels
|
||||||
{
|
{
|
||||||
_eventAggregator.GetEvent<PortUtilEvent>().Subscribe(DoMyPrismEvent);
|
_eventAggregator.GetEvent<PortUtilEvent>().Subscribe(DoMyPrismEvent);
|
||||||
_eventAggregator.GetEvent<AddDrugEvent>().Subscribe(AddAction);
|
_eventAggregator.GetEvent<AddDrugEvent>().Subscribe(AddAction);
|
||||||
|
_eventAggregator.GetEvent<DelDrugManoEvent>().Subscribe(DelManuNO);
|
||||||
FindDrawerCount();
|
FindDrawerCount();
|
||||||
RequestData();
|
RequestData();
|
||||||
}
|
}
|
||||||
|
@ -540,6 +573,7 @@ namespace DM_Weight.ViewModels
|
||||||
// 取消消息订阅
|
// 取消消息订阅
|
||||||
_eventAggregator.GetEvent<PortUtilEvent>().Unsubscribe(DoMyPrismEvent);
|
_eventAggregator.GetEvent<PortUtilEvent>().Unsubscribe(DoMyPrismEvent);
|
||||||
_eventAggregator.GetEvent<AddDrugEvent>().Unsubscribe(AddAction);
|
_eventAggregator.GetEvent<AddDrugEvent>().Unsubscribe(AddAction);
|
||||||
|
_eventAggregator.GetEvent<DelDrugManoEvent>().Unsubscribe(DelManuNO);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,6 +19,8 @@ using DM_Weight.util;
|
||||||
using log4net;
|
using log4net;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Reflection.Metadata.Ecma335;
|
using System.Reflection.Metadata.Ecma335;
|
||||||
|
using System.Windows.Threading;
|
||||||
|
using System.Windows;
|
||||||
|
|
||||||
namespace DM_Weight.ViewModels
|
namespace DM_Weight.ViewModels
|
||||||
{
|
{
|
||||||
|
@ -218,7 +220,15 @@ namespace DM_Weight.ViewModels
|
||||||
SetProperty(ref _pageSize, value);
|
SetProperty(ref _pageSize, value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 渲染标签状态
|
||||||
|
/// </summary>
|
||||||
|
private bool _status = false;
|
||||||
|
public bool Status
|
||||||
|
{
|
||||||
|
get => _status;
|
||||||
|
set => SetProperty(ref _status, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public bool CanCloseDialog()
|
public bool CanCloseDialog()
|
||||||
|
@ -253,11 +263,11 @@ namespace DM_Weight.ViewModels
|
||||||
.OrderBy(cl => cl.DrawerNo)
|
.OrderBy(cl => cl.DrawerNo)
|
||||||
.OrderBy(cl => cl.ColNo)
|
.OrderBy(cl => cl.ColNo)
|
||||||
.ToPageList(PageNum, PageSize, ref totalCount);
|
.ToPageList(PageNum, PageSize, ref totalCount);
|
||||||
if(list!=null&&list.Count>0)
|
if (list != null && list.Count > 0)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < list.Count; i++)
|
for (int i = 0; i < list.Count; i++)
|
||||||
{
|
{
|
||||||
if(list[i].channelStocks!=null&& list[i].channelStocks.Count>0)
|
if (list[i].channelStocks != null && list[i].channelStocks.Count > 0)
|
||||||
{
|
{
|
||||||
for (int j = 0; j < list[i].channelStocks.Count; j++)
|
for (int j = 0; j < list[i].channelStocks.Count; j++)
|
||||||
{
|
{
|
||||||
|
@ -322,7 +332,7 @@ namespace DM_Weight.ViewModels
|
||||||
await Task.Delay(200);
|
await Task.Delay(200);
|
||||||
_portUtil.WriteChannelInfo(2, DrugInfo.DrugSpec, item.DrawerNo, item.ColNo);
|
_portUtil.WriteChannelInfo(2, DrugInfo.DrugSpec, item.DrawerNo, item.ColNo);
|
||||||
await Task.Delay(200);
|
await Task.Delay(200);
|
||||||
_portUtil.WriteChannelInfo(8, DrugInfo.Manufactory.Length>10? DrugInfo.Manufactory.Substring(0, 10): DrugInfo.Manufactory, item.DrawerNo, item.ColNo);
|
_portUtil.WriteChannelInfo(8, DrugInfo.Manufactory.Length > 10 ? DrugInfo.Manufactory.Substring(0, 10) : DrugInfo.Manufactory, item.DrawerNo, item.ColNo);
|
||||||
await Task.Delay(200);
|
await Task.Delay(200);
|
||||||
//_portUtil.WriteChannelInfo(6, DrugManuNo.EffDate==null?"": DrugManuNo.EffDate, item.DrawerNo, item.ColNo);
|
//_portUtil.WriteChannelInfo(6, DrugManuNo.EffDate==null?"": DrugManuNo.EffDate, item.DrawerNo, item.ColNo);
|
||||||
//await Task.Delay(200);
|
//await Task.Delay(200);
|
||||||
|
@ -360,7 +370,7 @@ namespace DM_Weight.ViewModels
|
||||||
|
|
||||||
if (c > 0)
|
if (c > 0)
|
||||||
{
|
{
|
||||||
if(c>1)
|
if (c > 1)
|
||||||
{
|
{
|
||||||
SnackbarBackground = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#b71c1c"));
|
SnackbarBackground = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#b71c1c"));
|
||||||
SnackbarMessageQueue.Enqueue("同一药品不可绑多个库位");
|
SnackbarMessageQueue.Enqueue("同一药品不可绑多个库位");
|
||||||
|
@ -399,8 +409,8 @@ namespace DM_Weight.ViewModels
|
||||||
SnackbarMessageQueue.Enqueue("该药品已绑定库位,不可绑定多个库位");
|
SnackbarMessageQueue.Enqueue("该药品已绑定库位,不可绑定多个库位");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var channelStock = SqlSugarHelper.Db.Queryable<ChannelStock>().Where(cs => cs.Chnguid == item.Id&&cs.Quantity>0).ToList();
|
var channelStock = SqlSugarHelper.Db.Queryable<ChannelStock>().Where(cs => cs.Chnguid == item.Id && cs.Quantity > 0).ToList();
|
||||||
if(channelStock.Count>0)
|
if (channelStock.Count > 0)
|
||||||
{
|
{
|
||||||
//有库存,不能解绑
|
//有库存,不能解绑
|
||||||
|
|
||||||
|
@ -459,7 +469,6 @@ namespace DM_Weight.ViewModels
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public DelegateCommand RemoveBinding
|
public DelegateCommand RemoveBinding
|
||||||
{
|
{
|
||||||
get => new DelegateCommand(async () =>
|
get => new DelegateCommand(async () =>
|
||||||
|
@ -485,7 +494,7 @@ namespace DM_Weight.ViewModels
|
||||||
//item.EffDate = null;
|
//item.EffDate = null;
|
||||||
item.Drug = null;
|
item.Drug = null;
|
||||||
SqlSugarHelper.Db.Updateable(item).UpdateColumns(it => new { it.DrugId }).ExecuteCommand();
|
SqlSugarHelper.Db.Updateable(item).UpdateColumns(it => new { it.DrugId }).ExecuteCommand();
|
||||||
SqlSugarHelper.Db.Updateable<ChannelStock>().SetColumns(it =>new ChannelStock { DrugId = null, ManuNo = null, EffDate = null} ).Where(it=>it.Chnguid==item.Id).ExecuteCommand();
|
SqlSugarHelper.Db.Updateable<ChannelStock>().SetColumns(it => new ChannelStock { DrugId = null, ManuNo = null, EffDate = null }).Where(it => it.Chnguid == item.Id).ExecuteCommand();
|
||||||
if (item.BoardType == 5)
|
if (item.BoardType == 5)
|
||||||
{
|
{
|
||||||
// 清除显示屏库位信息
|
// 清除显示屏库位信息
|
||||||
|
@ -505,7 +514,91 @@ namespace DM_Weight.ViewModels
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 渲染标签
|
||||||
|
/// </summary>
|
||||||
|
public DelegateCommand ResetLabelCommand
|
||||||
|
{
|
||||||
|
get => new DelegateCommand(ResetLabelMethod, () => Status == false);
|
||||||
|
}
|
||||||
|
private void ResetLabelMethod()
|
||||||
|
{
|
||||||
|
if (Channels != null)
|
||||||
|
{
|
||||||
|
Task t = new Task(() =>
|
||||||
|
{
|
||||||
|
var SelectChannels = Channels.FindAll(item => item.IsSelected && item.BoardType == 5);
|
||||||
|
var c = SelectChannels.Count;
|
||||||
|
if (c > 0)
|
||||||
|
{
|
||||||
|
Status = true;
|
||||||
|
SelectChannels.ForEach(item =>
|
||||||
|
{
|
||||||
|
if (item.DrugId == null)
|
||||||
|
{
|
||||||
|
// 清除显示屏库位信息
|
||||||
|
_portUtil.ClearContent(item.DrawerNo, item.ColNo);
|
||||||
|
Thread.Sleep(200);
|
||||||
|
_portUtil.ShowContent(item.DrawerNo, item.ColNo);
|
||||||
|
Thread.Sleep(200);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
DrugInfo drugSelected = item.Drug ?? new DrugInfo();
|
||||||
|
_portUtil.WindowName = "BindingChannelDialog";
|
||||||
|
// 向显示屏写入库位信息
|
||||||
|
_portUtil.WriteChannelInfo(1, drugSelected.DrugName ?? "", item.DrawerNo, item.ColNo);
|
||||||
|
Thread.Sleep(200);
|
||||||
|
_portUtil.WriteChannelInfo(2, drugSelected.DrugSpec ?? "", item.DrawerNo, item.ColNo);
|
||||||
|
Thread.Sleep(200);
|
||||||
|
_portUtil.WriteChannelInfo(8, drugSelected.Manufactory == null ? "" : drugSelected.Manufactory.Length > 10 ? drugSelected.Manufactory.Substring(0, 10) : drugSelected.Manufactory, item.DrawerNo, item.ColNo);
|
||||||
|
Thread.Sleep(200);
|
||||||
|
//查询该库存下库存不为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);
|
||||||
|
Thread.Sleep(200);
|
||||||
|
_portUtil.ShowContent(item.DrawerNo, item.ColNo);
|
||||||
|
Thread.Sleep(200);
|
||||||
|
_portUtil.WriteQuantity(item.DrawerNo, item.ColNo, item.totalCount);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Application.Current.Dispatcher.Invoke(() =>
|
||||||
|
{
|
||||||
|
SnackbarBackground = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#b71c1c"));
|
||||||
|
SnackbarMessageQueue.Enqueue("未选择库位或所选库位无标签");
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
t.Start();
|
||||||
|
t.ContinueWith(task =>
|
||||||
|
{
|
||||||
|
if (Status.Equals(true))
|
||||||
|
{
|
||||||
|
Status = false;
|
||||||
|
Application.Current.Dispatcher.Invoke(() =>
|
||||||
|
{
|
||||||
|
|
||||||
|
SnackbarBackground = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#00e676"));
|
||||||
|
SnackbarMessageQueue.Enqueue("操作完成!");
|
||||||
|
GetChannelsByDrawerNo();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//static Task TaskSleep()
|
||||||
|
//{
|
||||||
|
// //await Task.Delay(200);
|
||||||
|
// Thread.Sleep(200);
|
||||||
|
//}
|
||||||
public DelegateCommand BtnCloseCommand
|
public DelegateCommand BtnCloseCommand
|
||||||
{
|
{
|
||||||
get => new DelegateCommand(() =>
|
get => new DelegateCommand(() =>
|
||||||
|
|
|
@ -132,8 +132,16 @@ namespace DM_Weight.ViewModels
|
||||||
{
|
{
|
||||||
GridReportUtil.PrintReportStockNew(StartDate, EndDate);
|
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(() =>
|
get => new DelegateCommand(() =>
|
||||||
{
|
{
|
||||||
|
|
|
@ -278,7 +278,14 @@ namespace DM_Weight.ViewModels
|
||||||
channelStocks.ForEach(it => it.process = 1);
|
channelStocks.ForEach(it => it.process = 1);
|
||||||
_portUtil.SpeakAsync("正在打开" + DrawerNo + "号抽屉");
|
_portUtil.SpeakAsync("正在打开" + DrawerNo + "号抽屉");
|
||||||
|
|
||||||
List<ChannelStock> singleChannels = channelStocks.GroupBy(it => new
|
|
||||||
|
List<ChannelStock> singleChannels = new List<ChannelStock>();
|
||||||
|
for (int i = 0; i < channelStocks.Count; i++)
|
||||||
|
{
|
||||||
|
ChannelStock copy = TransExpV2<ChannelStock, ChannelStock>.Trans(channelStocks[i]);
|
||||||
|
singleChannels.Add(copy);
|
||||||
|
}
|
||||||
|
singleChannels = singleChannels.GroupBy(it => new
|
||||||
{
|
{
|
||||||
it.DrawerNo,
|
it.DrawerNo,
|
||||||
it.ColNo
|
it.ColNo
|
||||||
|
|
|
@ -170,8 +170,8 @@ namespace DM_Weight.ViewModels
|
||||||
|
|
||||||
if (msg.WindowName == "CheckStockNewWindow")
|
if (msg.WindowName == "CheckStockNewWindow")
|
||||||
{
|
{
|
||||||
IGrouping<string, ChannelStock> grouping = enumerator.Current;
|
IGrouping<int, ChannelStock> grouping = enumerator.Current;
|
||||||
int DrawerNo =Convert.ToInt32(grouping.Key.Substring(0, grouping.Key.IndexOf('-')));
|
int DrawerNo = grouping.Key;// Convert.ToInt32(grouping.Key.Substring(0, grouping.Key.IndexOf('-')));
|
||||||
List<ChannelStock> channelStocks = grouping.ToList();
|
List<ChannelStock> channelStocks = grouping.ToList();
|
||||||
|
|
||||||
switch (msg.EventType)
|
switch (msg.EventType)
|
||||||
|
@ -198,34 +198,36 @@ namespace DM_Weight.ViewModels
|
||||||
{
|
{
|
||||||
channelStocks.ForEach(it => it.process = 3);
|
channelStocks.ForEach(it => it.process = 3);
|
||||||
}
|
}
|
||||||
IGrouping<string, ChannelStock> groupingBefore = enumerator.Current;
|
IGrouping<int, ChannelStock> groupingBefore = enumerator.Current;
|
||||||
int DrawerNoBefore = Convert.ToInt32(groupingBefore.Key.Substring(0, groupingBefore.Key.IndexOf('-')));
|
int DrawerNoBefore = groupingBefore.Key; //Convert.ToInt32(groupingBefore.Key.Substring(0, groupingBefore.Key.IndexOf('-')));
|
||||||
if (enumerator.MoveNext())
|
if (enumerator.MoveNext())
|
||||||
{
|
{
|
||||||
IGrouping<string, ChannelStock> groupingAfter = enumerator.Current;
|
IGrouping<int, ChannelStock> groupingAfter = enumerator.Current;
|
||||||
int DrawerNoAfter = Convert.ToInt32(groupingAfter.Key.Substring(0, groupingAfter.Key.IndexOf('-')));
|
int DrawerNoAfter = groupingAfter.Key;//Convert.ToInt32(groupingAfter.Key.Substring(0, groupingAfter.Key.IndexOf('-')));
|
||||||
//if (DrawerNoBefore < 9 && DrawerNoAfter > 8)
|
//if (DrawerNoBefore < 9 && DrawerNoAfter > 8)
|
||||||
//{
|
//{
|
||||||
// Thread.Sleep(50);
|
// Thread.Sleep(50);
|
||||||
//}
|
//}
|
||||||
|
|
||||||
logger.Info($"抽屉号DrawerNoBefore【{DrawerNoBefore}】抽屉号DrawerNoAfter【{DrawerNoAfter}】");
|
logger.Info($"抽屉号DrawerNoBefore【{DrawerNoBefore}】抽屉号DrawerNoAfter【{DrawerNoAfter}】");
|
||||||
if (DrawerNoAfter == 17)
|
if (DrawerNoAfter == 17 || DrawerNoBefore == 17)
|
||||||
{
|
{
|
||||||
if (DrawerNoBefore == 17)
|
//if (DrawerNoBefore == 17)
|
||||||
{
|
{
|
||||||
Thread.Sleep(1000);
|
int sleepMilliseconds = Convert.ToInt32(ConfigurationManager.AppSettings["CheckSleepMilliseconds"] ?? "500");
|
||||||
}
|
Thread.Sleep(sleepMilliseconds);
|
||||||
else
|
|
||||||
{
|
|
||||||
Thread.Sleep(500);
|
|
||||||
}
|
}
|
||||||
|
//else
|
||||||
|
//{
|
||||||
|
// Thread.Sleep(500);
|
||||||
|
//}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Thread.Sleep(80);
|
//Thread.Sleep(80);
|
||||||
|
Thread.Sleep(500);
|
||||||
}
|
}
|
||||||
logger.Info($"抽屉号DrawerNoBefore【{DrawerNoBefore}】抽屉号DrawerNoAfter【{DrawerNoAfter}】");
|
//logger.Info($"抽屉号DrawerNoBefore【{DrawerNoBefore}】抽屉号DrawerNoAfter【{DrawerNoAfter}】");
|
||||||
OpenOneByOne();
|
OpenOneByOne();
|
||||||
}
|
}
|
||||||
// 已经全部取出
|
// 已经全部取出
|
||||||
|
@ -272,8 +274,8 @@ namespace DM_Weight.ViewModels
|
||||||
set => SetProperty(ref _channelStocks, value);
|
set => SetProperty(ref _channelStocks, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
private IEnumerable<IGrouping<string, ChannelStock>> enumerable;
|
private IEnumerable<IGrouping<int, ChannelStock>> enumerable;
|
||||||
private IEnumerator<IGrouping<string, ChannelStock>> enumerator;
|
private IEnumerator<IGrouping<int, ChannelStock>> enumerator;
|
||||||
|
|
||||||
public DelegateCommand BindingChannelDialog
|
public DelegateCommand BindingChannelDialog
|
||||||
{
|
{
|
||||||
|
@ -301,8 +303,8 @@ namespace DM_Weight.ViewModels
|
||||||
{
|
{
|
||||||
if (Status == 0)
|
if (Status == 0)
|
||||||
{
|
{
|
||||||
//enumerable = ChannelStocks.GroupBy(cs => cs.DrawerNo, cs => cs);
|
enumerable = ChannelStocks.GroupBy(cs => cs.DrawerNo, cs => cs);
|
||||||
enumerable = ChannelStocks.GroupBy(cs => cs.Location, cs => cs);
|
//enumerable = ChannelStocks.GroupBy(cs => cs.Location, cs => cs);
|
||||||
enumerator = enumerable.GetEnumerator();
|
enumerator = enumerable.GetEnumerator();
|
||||||
enumerator.MoveNext();
|
enumerator.MoveNext();
|
||||||
Status = 1;
|
Status = 1;
|
||||||
|
@ -312,21 +314,27 @@ namespace DM_Weight.ViewModels
|
||||||
}
|
}
|
||||||
private void OpenOneByOne()
|
private void OpenOneByOne()
|
||||||
{
|
{
|
||||||
IGrouping<string, ChannelStock> grouping = enumerator.Current;
|
IGrouping<int, ChannelStock> grouping = enumerator.Current;
|
||||||
int DrawerNo =Convert.ToInt32(grouping.Key.Substring(0,grouping.Key.IndexOf('-')));
|
//int DrawerNo =Convert.ToInt32(grouping.Key.Substring(0,grouping.Key.IndexOf('-')));
|
||||||
List<ChannelStock> channelStocks = grouping.ToList();
|
int DrawerNo = grouping.Key;
|
||||||
channelStocks.ForEach(it => it.process = 1);
|
List<ChannelStock> Stocks = grouping.ToList();
|
||||||
|
Stocks.ForEach(it => it.process = 1);
|
||||||
_portUtil.SpeakAsync("正在打开" + DrawerNo + "号抽屉");
|
_portUtil.SpeakAsync("正在打开" + DrawerNo + "号抽屉");
|
||||||
|
List<ChannelStock> singleChannels = new List<ChannelStock>();
|
||||||
List<ChannelStock> singleChannels = channelStocks.GroupBy(it => new
|
for (int i = 0; i < Stocks.Count; i++)
|
||||||
|
{
|
||||||
|
ChannelStock copy = TransExpV2<ChannelStock, ChannelStock>.Trans(Stocks[i]);
|
||||||
|
singleChannels.Add(copy);
|
||||||
|
}
|
||||||
|
singleChannels = singleChannels.GroupBy(it => new
|
||||||
{
|
{
|
||||||
it.DrawerNo,
|
it.DrawerNo,
|
||||||
it.ColNo
|
it.ColNo
|
||||||
}).Select(it =>
|
}).Select(it =>
|
||||||
{
|
{
|
||||||
var ret = it.First();
|
var ret = it.First();
|
||||||
ret.Quantity = it.Sum(itx => itx.Quantity);
|
//ret.Quantity = it.Sum(itx => itx.Quantity);
|
||||||
ret.AddQuantity = it.Sum(itx => itx.AddQuantity);
|
//ret.AddQuantity = it.Sum(itx => itx.AddQuantity);
|
||||||
return ret;
|
return ret;
|
||||||
}).ToList().FindAll(it => it.BoardType != 1);
|
}).ToList().FindAll(it => it.BoardType != 1);
|
||||||
|
|
||||||
|
@ -352,7 +360,7 @@ namespace DM_Weight.ViewModels
|
||||||
_portUtil.Operate = true;
|
_portUtil.Operate = true;
|
||||||
_portUtil.BoardType = singleChannels.Count > 0 ? singleChannels[0].BoardType : 1;
|
_portUtil.BoardType = singleChannels.Count > 0 ? singleChannels[0].BoardType : 1;
|
||||||
_portUtil.ColNos = singleChannels.Select(it => it.ColNo).ToArray();
|
_portUtil.ColNos = singleChannels.Select(it => it.ColNo).ToArray();
|
||||||
_portUtil.Stocks = singleChannels.Select(it => it.Quantity).ToArray();
|
//_portUtil.Stocks = singleChannels.Select(it => it.Quantity).ToArray();
|
||||||
_portUtil.DrawerNo = DrawerNo;
|
_portUtil.DrawerNo = DrawerNo;
|
||||||
_portUtil.Start();
|
_portUtil.Start();
|
||||||
}
|
}
|
||||||
|
@ -372,7 +380,6 @@ namespace DM_Weight.ViewModels
|
||||||
string InvoiceId = "CHECK_" + CurrentTimeMillis();
|
string InvoiceId = "CHECK_" + CurrentTimeMillis();
|
||||||
var f = SqlSugarHelper.Db.UseTran(() =>
|
var f = SqlSugarHelper.Db.UseTran(() =>
|
||||||
{
|
{
|
||||||
|
|
||||||
for (int i = 0; i < record.Count; i++)
|
for (int i = 0; i < record.Count; i++)
|
||||||
{
|
{
|
||||||
ChannelStock it = record[i];
|
ChannelStock it = record[i];
|
||||||
|
@ -393,31 +400,35 @@ namespace DM_Weight.ViewModels
|
||||||
.Where(cs => cs.DrawerType == 1)
|
.Where(cs => cs.DrawerType == 1)
|
||||||
.ToList();
|
.ToList();
|
||||||
|
|
||||||
// 保存数据 盘点记录
|
//盘点时不记录盘点库存为0且盘点后库存仍为0的记录(该批次可能不再用了)
|
||||||
SqlSugarHelper.Db.Insertable(new MachineRecord()
|
if (!it.Quantity.Equals(0) || !it.CheckQuantity.Equals(0))
|
||||||
{
|
{
|
||||||
MachineId = it.MachineId,
|
// 保存数据 盘点记录
|
||||||
DrawerNo = it.DrawerNo,
|
SqlSugarHelper.Db.Insertable(new MachineRecord()
|
||||||
ColNo = it.ColNo,
|
{
|
||||||
DrugId = it.DrugId,
|
MachineId = it.MachineId,
|
||||||
ManuNo = it.ManuNo,
|
DrawerNo = it.DrawerNo,
|
||||||
EffDate = !String.IsNullOrEmpty(it.EffDate) ? DateTime.ParseExact(it.EffDate, "yyyy-MM-dd", System.Globalization.CultureInfo.CurrentCulture) : null,
|
ColNo = it.ColNo,
|
||||||
Operator = HomeWindowViewModel.Operator?.Id,
|
DrugId = it.DrugId,
|
||||||
Reviewer = HomeWindowViewModel.Reviewer?.Id,
|
ManuNo = it.ManuNo,
|
||||||
OperationTime = DateTime.Now,
|
EffDate = !String.IsNullOrEmpty(it.EffDate) ? DateTime.ParseExact(it.EffDate, "yyyy-MM-dd", System.Globalization.CultureInfo.CurrentCulture) : null,
|
||||||
Quantity = it.CheckQuantity - it.Quantity,
|
Operator = HomeWindowViewModel.Operator?.Id,
|
||||||
Type = 4,
|
Reviewer = HomeWindowViewModel.Reviewer?.Id,
|
||||||
InvoiceId = InvoiceId,
|
OperationTime = DateTime.Now,
|
||||||
StockQuantity = nowChannels.Sum(it => it.Quantity),
|
Quantity = it.CheckQuantity - it.Quantity,
|
||||||
CheckQuantity = it.CheckQuantity,
|
Type = 4,
|
||||||
ManunoQuantity = nowChannels.FindAll(it2 => it2.ManuNo == it.ManuNo).Sum(it => it.Quantity)
|
InvoiceId = InvoiceId,
|
||||||
}).ExecuteCommand();
|
StockQuantity = nowChannels.Sum(it => it.Quantity),
|
||||||
|
CheckQuantity = it.CheckQuantity,
|
||||||
|
ManunoQuantity = nowChannels.FindAll(it2 => it2.ManuNo == it.ManuNo).Sum(it => it.Quantity)
|
||||||
|
}).ExecuteCommand();
|
||||||
|
|
||||||
|
logger.Info($"库存盘点->库位【{it.DrawerNo}-{it.ColNo}】药品【{it.DrugInfo.DrugName}】盘点前库存【{it.Quantity}】,更改后【{it.CheckQuantity}】");
|
||||||
|
|
||||||
logger.Info($"库存盘点->库位【{it.DrawerNo}-{it.ColNo}】药品【{it.DrugInfo.DrugName}】盘点前库存【{it.Quantity}】,更改后【{it.CheckQuantity}】");
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Task.Factory.StartNew(()=> SaveCheckRecord());
|
||||||
string machine_id = (ConfigurationManager.AppSettings["machineId"] ?? "DM1");
|
string machine_id = (ConfigurationManager.AppSettings["machineId"] ?? "DM1");
|
||||||
string strSql = $@"SELECT cl.`row_no` AS rowNo,cl.`col_no` AS colNo,cl.`quantity` AS quantity,cl.`manu_no` AS manuNo,cl.`eff_date` AS effDate,
|
string strSql = $@"SELECT cl.`row_no` AS rowNo,cl.`col_no` AS colNo,cl.`quantity` AS quantity,cl.`manu_no` AS manuNo,cl.`eff_date` AS effDate,
|
||||||
di.`drug_name` AS drugName,di.`drug_spec` AS drugSpec,di.`pack_unit` AS packUnit,di.`manufactory` AS manufactory,di.`max_stock` maxStock,
|
di.`drug_name` AS drugName,di.`drug_spec` AS drugSpec,di.`pack_unit` AS packUnit,di.`manufactory` AS manufactory,di.`max_stock` maxStock,
|
||||||
|
@ -429,6 +440,9 @@ namespace DM_Weight.ViewModels
|
||||||
})
|
})
|
||||||
.Select(it => new CheckRecordStock())
|
.Select(it => new CheckRecordStock())
|
||||||
.ToList();
|
.ToList();
|
||||||
|
|
||||||
|
logger.Info("已完成-查询channel_stock关联drug_info表信息查询");
|
||||||
|
|
||||||
List<CheckRecordStock> insertList = new List<CheckRecordStock>();
|
List<CheckRecordStock> insertList = new List<CheckRecordStock>();
|
||||||
|
|
||||||
if (checkRecordStockList != null && checkRecordStockList.Count > 0)
|
if (checkRecordStockList != null && checkRecordStockList.Count > 0)
|
||||||
|
@ -443,39 +457,40 @@ namespace DM_Weight.ViewModels
|
||||||
for (int j = 0; j < insertList.Count; j++)
|
for (int j = 0; j < insertList.Count; j++)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
//盘点时不记录盘点库存为0且盘点后库存仍为0的记录(该批次可能不再用了)
|
||||||
CheckRecordStock cStock = insertList[j];
|
if (!insertList[j].quantity.Equals(0))
|
||||||
// 保存数据 盘点后药品总库存及批次库存数
|
|
||||||
SqlSugarHelper.Db.Insertable(new CheckRecordStock()
|
|
||||||
{
|
{
|
||||||
rowNo = cStock.rowNo,
|
CheckRecordStock cStock = insertList[j];
|
||||||
colNo = cStock.colNo,
|
// 保存数据 盘点后药品总库存及批次库存数
|
||||||
ManuQuantity = checkRecordStockList.Where(it => it.drugId == cStock.drugId && it.manuNo == cStock.manuNo).Sum(it => it.quantity),
|
SqlSugarHelper.Db.Insertable(new CheckRecordStock()
|
||||||
manuNo = cStock.manuNo,
|
{
|
||||||
effDate = cStock.effDate,
|
rowNo = cStock.rowNo,
|
||||||
drugName = cStock.drugName,
|
colNo = cStock.colNo,
|
||||||
manufactory = cStock.manufactory,
|
ManuQuantity = checkRecordStockList.Where(it => it.drugId == cStock.drugId && it.manuNo == cStock.manuNo).Sum(it => it.quantity),
|
||||||
drugSpec = cStock.drugSpec,
|
manuNo = cStock.manuNo,
|
||||||
packUnit = cStock.packUnit,
|
effDate = cStock.effDate,
|
||||||
maxStock = cStock.maxStock,
|
drugName = cStock.drugName,
|
||||||
drugId = cStock.drugId,
|
manufactory = cStock.manufactory,
|
||||||
MachineId = cStock.MachineId,
|
drugSpec = cStock.drugSpec,
|
||||||
quantity = checkRecordStockList.Where(it => it.drugId == cStock.drugId).Sum(it => it.quantity),
|
packUnit = cStock.packUnit,
|
||||||
optdate = DateTime.Now.ToString(),
|
maxStock = cStock.maxStock,
|
||||||
operatorUser = HomeWindowViewModel.Operator?.Id.ToString(),
|
drugId = cStock.drugId,
|
||||||
reviewerUser = HomeWindowViewModel.Reviewer?.Id.ToString()
|
MachineId = cStock.MachineId,
|
||||||
}).ExecuteCommand();
|
quantity = checkRecordStockList.Where(it => it.drugId == cStock.drugId).Sum(it => it.quantity),
|
||||||
|
optdate = DateTime.Now.ToString(),
|
||||||
|
operatorUser = HomeWindowViewModel.Operator?.Id.ToString(),
|
||||||
|
reviewerUser = HomeWindowViewModel.Reviewer?.Id.ToString()
|
||||||
|
}).ExecuteCommand();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
logger.Info("已完成-保存数据 盘点后药品总库存及批次库存数");
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
if (f.Data)
|
if (f.Data)
|
||||||
{
|
{
|
||||||
// 更新屏显库存
|
// 更新屏显库存
|
||||||
//List<ChannelStock> singleChannels = record.FindAll(it => it.BoardType != 1);
|
List<ChannelStock> singleChannels = record.FindAll(it => it.BoardType == 5)
|
||||||
List<ChannelStock> singleChannels = record.FindAll(it => it.BoardType != 1)
|
|
||||||
.GroupBy(it => new
|
.GroupBy(it => new
|
||||||
{
|
{
|
||||||
it.DrawerNo,
|
it.DrawerNo,
|
||||||
|
@ -484,26 +499,73 @@ namespace DM_Weight.ViewModels
|
||||||
{
|
{
|
||||||
var ret = it.First();
|
var ret = it.First();
|
||||||
ret.CheckQuantity = it.Sum(itx => itx.CheckQuantity);
|
ret.CheckQuantity = it.Sum(itx => itx.CheckQuantity);
|
||||||
//ret.AddQuantity = it.Sum(itx => itx.AddQuantity);
|
ret.Quantity = it.Sum(itx => itx.Quantity);
|
||||||
return ret;
|
return ret;
|
||||||
}).ToList();
|
}).OrderBy(it => it.EffDate).ToList();
|
||||||
if ((singleChannels.Count > 0 ? singleChannels[0].BoardType : 1) == 5)
|
if (singleChannels != null && singleChannels.Count > 0)
|
||||||
{
|
{
|
||||||
singleChannels.ForEach(it =>
|
for (int i = 0; i < singleChannels.Count; i++)
|
||||||
{
|
{
|
||||||
// 将库位多批次的总库存数更新标签
|
|
||||||
_portUtil.WriteQuantity(it.DrawerNo, it.ColNo, it.CheckQuantity);
|
|
||||||
|
|
||||||
});
|
|
||||||
|
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);
|
||||||
|
|
||||||
RequestData();
|
//});
|
||||||
|
|
||||||
|
logger.Info("已完成-更新标签");
|
||||||
AlertMsg alertMsg = new AlertMsg
|
AlertMsg alertMsg = new AlertMsg
|
||||||
{
|
{
|
||||||
Message = "抽屉盘点完成,库存已更新",
|
Message = "抽屉盘点完成,库存已更新",
|
||||||
Type = MsgType.SUCCESS,
|
Type = MsgType.SUCCESS,
|
||||||
};
|
};
|
||||||
_eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
|
_eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
|
||||||
|
|
||||||
|
RequestData();
|
||||||
}
|
}
|
||||||
if (!f.IsSuccess)
|
if (!f.IsSuccess)
|
||||||
{
|
{
|
||||||
|
@ -533,7 +595,64 @@ namespace DM_Weight.ViewModels
|
||||||
|
|
||||||
}, () => Status == 3 && !_isFinishClick).ObservesProperty(() => Status);
|
}, () => Status == 3 && !_isFinishClick).ObservesProperty(() => Status);
|
||||||
}
|
}
|
||||||
|
public void SaveCheckRecord()
|
||||||
|
{
|
||||||
|
string machine_id = (ConfigurationManager.AppSettings["machineId"] ?? "DM1");
|
||||||
|
string strSql = $@"SELECT cl.`row_no` AS rowNo,cl.`col_no` AS colNo,cl.`quantity` AS quantity,cl.`manu_no` AS manuNo,cl.`eff_date` AS effDate,
|
||||||
|
di.`drug_name` AS drugName,di.`drug_spec` AS drugSpec,di.`pack_unit` AS packUnit,di.`manufactory` AS manufactory,di.`max_stock` maxStock,
|
||||||
|
cl.`drug_id` AS drugId,cl.`machine_id` AS MachineId FROM channel_stock cl INNER JOIN drug_info di ON di.`drug_id` = cl.`drug_id` WHERE cl.`machine_id` = '{machine_id}' AND cl.`drawer_type` = 1 ORDER BY cl.`drug_id`";
|
||||||
|
List<CheckRecordStock> checkRecordStockList = SqlSugarHelper.Db.SqlQueryable<dynamic>(strSql)
|
||||||
|
.AddParameters(new
|
||||||
|
{
|
||||||
|
machineId = ConfigurationManager.AppSettings["machineId"] ?? "DM1"
|
||||||
|
})
|
||||||
|
.Select(it => new CheckRecordStock())
|
||||||
|
.ToList();
|
||||||
|
|
||||||
|
logger.Info("已完成-查询channel_stock关联drug_info表信息查询");
|
||||||
|
|
||||||
|
List<CheckRecordStock> insertList = new List<CheckRecordStock>();
|
||||||
|
|
||||||
|
if (checkRecordStockList != null && checkRecordStockList.Count > 0)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < checkRecordStockList.Count; i++)
|
||||||
|
{
|
||||||
|
if (!(insertList.Where(it => it.drugId == checkRecordStockList[i].drugId && it.manuNo == checkRecordStockList[i].manuNo).Count() > 0))
|
||||||
|
{
|
||||||
|
insertList.Add(checkRecordStockList[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (int j = 0; j < insertList.Count; j++)
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
CheckRecordStock cStock = insertList[j];
|
||||||
|
// 保存数据 盘点后药品总库存及批次库存数
|
||||||
|
SqlSugarHelper.Db.Insertable(new CheckRecordStock()
|
||||||
|
{
|
||||||
|
rowNo = cStock.rowNo,
|
||||||
|
colNo = cStock.colNo,
|
||||||
|
ManuQuantity = checkRecordStockList.Where(it => it.drugId == cStock.drugId && it.manuNo == cStock.manuNo).Sum(it => it.quantity),
|
||||||
|
manuNo = cStock.manuNo,
|
||||||
|
effDate = cStock.effDate,
|
||||||
|
drugName = cStock.drugName,
|
||||||
|
manufactory = cStock.manufactory,
|
||||||
|
drugSpec = cStock.drugSpec,
|
||||||
|
packUnit = cStock.packUnit,
|
||||||
|
maxStock = cStock.maxStock,
|
||||||
|
drugId = cStock.drugId,
|
||||||
|
MachineId = cStock.MachineId,
|
||||||
|
quantity = checkRecordStockList.Where(it => it.drugId == cStock.drugId).Sum(it => it.quantity),
|
||||||
|
optdate = DateTime.Now.ToString(),
|
||||||
|
operatorUser = HomeWindowViewModel.Operator?.Id.ToString(),
|
||||||
|
reviewerUser = HomeWindowViewModel.Reviewer?.Id.ToString()
|
||||||
|
}).ExecuteCommand();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
logger.Info("已完成-插入check_stock表信息");
|
||||||
|
}
|
||||||
// 取消按钮
|
// 取消按钮
|
||||||
public DelegateCommand CancleTake
|
public DelegateCommand CancleTake
|
||||||
{
|
{
|
||||||
|
@ -544,7 +663,7 @@ namespace DM_Weight.ViewModels
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool KeepAlive => true;
|
public bool KeepAlive => false;
|
||||||
|
|
||||||
private void DoDialogResult(IDialogResult dialogResult)
|
private void DoDialogResult(IDialogResult dialogResult)
|
||||||
{
|
{
|
||||||
|
@ -613,6 +732,7 @@ namespace DM_Weight.ViewModels
|
||||||
|
|
||||||
.WhereIF(!String.IsNullOrEmpty(SearchValue), cs => cs.DrugInfo.DrugName == SearchValue)
|
.WhereIF(!String.IsNullOrEmpty(SearchValue), cs => cs.DrugInfo.DrugName == SearchValue)
|
||||||
.OrderBy(cs => cs.DrawerNo)
|
.OrderBy(cs => cs.DrawerNo)
|
||||||
|
//.OrderByDescending(cs => cs.DrawerNo)
|
||||||
.OrderBy(cs => cs.ColNo)
|
.OrderBy(cs => cs.ColNo)
|
||||||
//.OrderBy(cs => cs.DrugId)
|
//.OrderBy(cs => cs.DrugId)
|
||||||
.ToList();
|
.ToList();
|
||||||
|
|
|
@ -17,6 +17,7 @@ using DM_Weight.msg;
|
||||||
using DM_Weight.Port;
|
using DM_Weight.Port;
|
||||||
using DM_Weight.util;
|
using DM_Weight.util;
|
||||||
using System.Collections.ObjectModel;
|
using System.Collections.ObjectModel;
|
||||||
|
using System.Threading;
|
||||||
|
|
||||||
namespace DM_Weight.ViewModels
|
namespace DM_Weight.ViewModels
|
||||||
{
|
{
|
||||||
|
@ -186,7 +187,7 @@ namespace DM_Weight.ViewModels
|
||||||
if (!_isFinishClick)
|
if (!_isFinishClick)
|
||||||
{
|
{
|
||||||
_isFinishClick = true;
|
_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)
|
if (record.Count > 0)
|
||||||
{
|
{
|
||||||
//string InvoiceId = "DRAWER_" + CurrentTimeMillis();
|
//string InvoiceId = "DRAWER_" + CurrentTimeMillis();
|
||||||
|
@ -241,21 +242,44 @@ namespace DM_Weight.ViewModels
|
||||||
if (f.Data)
|
if (f.Data)
|
||||||
{
|
{
|
||||||
// 更新屏显库存
|
// 更新屏显库存
|
||||||
List<ChannelStock> singleChannels = ChannelStocks.Where(it => it.BoardType != 1)
|
//List<ChannelStock> singleChannels = ChannelStocks.Where(it => it.BoardType == 5 && (it.Quantity > 0 || it.AddQuantity > 0))
|
||||||
.GroupBy(it => it.ColNo)
|
// .GroupBy(it => it.ColNo)
|
||||||
.Select(it =>
|
// .Select(it =>
|
||||||
{
|
// {
|
||||||
var ret = it.First();
|
// var ret = it.First();
|
||||||
ret.Quantity = it.Sum(it => it.Quantity);
|
// ret.Quantity = it.Sum(it => it.Quantity);
|
||||||
ret.AddQuantity = it.Sum(it => it.AddQuantity);
|
// ret.AddQuantity = it.Sum(it => it.AddQuantity);
|
||||||
return ret;
|
// return ret;
|
||||||
}).ToList();
|
// })
|
||||||
singleChannels = singleChannels.Where(it => it.AddQuantity > 0).ToList();
|
// .OrderBy(it => it.EffDate).ToList();
|
||||||
if ((singleChannels.Count > 0 ? singleChannels[0].BoardType : 1) == 5)
|
|
||||||
|
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)
|
||||||
{
|
{
|
||||||
//将库位多批次的总库存数更新标签
|
//将库位多批次的总库存数更新标签
|
||||||
singleChannels.ForEach(it =>
|
singleChannels.ForEach(it =>
|
||||||
{
|
{
|
||||||
|
_portUtil.WriteChannelInfo(6, it.EffDate == null ? "" : it.EffDate, it.DrawerNo, it.ColNo);
|
||||||
|
Thread.Sleep(200);
|
||||||
|
_portUtil.WriteChannelInfo(5, it.ManuNo, it.DrawerNo, it.ColNo);
|
||||||
|
Thread.Sleep(200);
|
||||||
|
_portUtil.ShowContent(it.DrawerNo, it.ColNo);
|
||||||
|
|
||||||
|
Thread.Sleep(500);
|
||||||
_portUtil.WriteQuantity(it.DrawerNo, it.ColNo, it.Quantity + it.AddQuantity);
|
_portUtil.WriteQuantity(it.DrawerNo, it.ColNo, it.Quantity + it.AddQuantity);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -269,6 +293,7 @@ namespace DM_Weight.ViewModels
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
logger.Info($"抽屉加药,库存更新失败!{f.ErrorMessage}");
|
||||||
AlertMsg alertMsg = new AlertMsg
|
AlertMsg alertMsg = new AlertMsg
|
||||||
{
|
{
|
||||||
Message = "更新库存失败",
|
Message = "更新库存失败",
|
||||||
|
|
|
@ -21,6 +21,7 @@ using DM_Weight.util;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using System.Windows.Controls;
|
using System.Windows.Controls;
|
||||||
|
using System.Threading.Channels;
|
||||||
|
|
||||||
namespace DM_Weight.ViewModels
|
namespace DM_Weight.ViewModels
|
||||||
{
|
{
|
||||||
|
@ -35,11 +36,11 @@ namespace DM_Weight.ViewModels
|
||||||
get => _channelStocks;
|
get => _channelStocks;
|
||||||
set => SetProperty(ref _channelStocks, value);
|
set => SetProperty(ref _channelStocks, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static readonly DateTime Jan1st1970 = new DateTime
|
private static readonly DateTime Jan1st1970 = new DateTime
|
||||||
(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);
|
(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private PortUtil _portUtil;
|
private PortUtil _portUtil;
|
||||||
IEventAggregator _eventAggregator;
|
IEventAggregator _eventAggregator;
|
||||||
|
@ -93,7 +94,7 @@ namespace DM_Weight.ViewModels
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private int _status;
|
private int _status;
|
||||||
|
@ -129,7 +130,7 @@ namespace DM_Weight.ViewModels
|
||||||
}, (DrawerNo) => Status == 0
|
}, (DrawerNo) => Status == 0
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public DelegateCommand OpenDrawer
|
public DelegateCommand OpenDrawer
|
||||||
{
|
{
|
||||||
|
@ -144,7 +145,7 @@ namespace DM_Weight.ViewModels
|
||||||
// group t by new { t.ColNo, t.BoardType }
|
// group t by new { t.ColNo, t.BoardType }
|
||||||
// into grp
|
// into grp
|
||||||
// select new { grp.Key.ColNo, grp.Key.BoardType, quantity = grp.Sum(t => t.Quantity) }).ToList();
|
// select new { grp.Key.ColNo, grp.Key.BoardType, quantity = grp.Sum(t => t.Quantity) }).ToList();
|
||||||
|
|
||||||
List<ChannelStock> singleChannels = ChannelStocks.FindAll(it => it.BoardType != 1);
|
List<ChannelStock> singleChannels = ChannelStocks.FindAll(it => it.BoardType != 1);
|
||||||
|
|
||||||
_portUtil.WindowName = "DrawerTakeDrugWindow";
|
_portUtil.WindowName = "DrawerTakeDrugWindow";
|
||||||
|
@ -167,7 +168,7 @@ namespace DM_Weight.ViewModels
|
||||||
if (!_isFinishClick)
|
if (!_isFinishClick)
|
||||||
{
|
{
|
||||||
_isFinishClick = true;
|
_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));
|
logger.Info("点击完成按钮,库位数据:" + JsonConvert.SerializeObject(record));
|
||||||
if (record.Count > 0)
|
if (record.Count > 0)
|
||||||
{
|
{
|
||||||
|
@ -206,7 +207,7 @@ namespace DM_Weight.ViewModels
|
||||||
ColNo = it.ColNo,
|
ColNo = it.ColNo,
|
||||||
DrugId = it.DrugId,
|
DrugId = it.DrugId,
|
||||||
ManuNo = it.ManuNo,
|
ManuNo = it.ManuNo,
|
||||||
EffDate = !String.IsNullOrEmpty(it.EffDate) ?DateTime.ParseExact(it.EffDate, "yyyy-MM-dd", System.Globalization.CultureInfo.CurrentCulture):null,
|
EffDate = !String.IsNullOrEmpty(it.EffDate) ? DateTime.ParseExact(it.EffDate, "yyyy-MM-dd", System.Globalization.CultureInfo.CurrentCulture) : null,
|
||||||
Operator = HomeWindowViewModel.Operator?.Id,
|
Operator = HomeWindowViewModel.Operator?.Id,
|
||||||
Reviewer = HomeWindowViewModel.Reviewer?.Id,
|
Reviewer = HomeWindowViewModel.Reviewer?.Id,
|
||||||
OperationTime = DateTime.Now,
|
OperationTime = DateTime.Now,
|
||||||
|
@ -224,12 +225,19 @@ namespace DM_Weight.ViewModels
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
if (f.Data)
|
if (f.Data)
|
||||||
{
|
{
|
||||||
logger.Info("更新屏显库存singleChannels");
|
logger.Info("更新屏显库存singleChannels");
|
||||||
// 更新屏显库存
|
// 更新屏显库存
|
||||||
//List<ChannelStock> singleChannels = record.FindAll(it => it.BoardType != 1);
|
//List<ChannelStock> singleChannels = record.FindAll(it => it.BoardType != 1);
|
||||||
List<ChannelStock> singleChannels = ChannelStocks.Where(it => it.BoardType != 1)
|
|
||||||
|
List<ChannelStock> singleChannels = 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)
|
||||||
.GroupBy(it => it.ColNo)
|
.GroupBy(it => it.ColNo)
|
||||||
.Select(it =>
|
.Select(it =>
|
||||||
{
|
{
|
||||||
|
@ -237,7 +245,7 @@ namespace DM_Weight.ViewModels
|
||||||
ret.Quantity = it.Sum(itx => itx.Quantity);
|
ret.Quantity = it.Sum(itx => itx.Quantity);
|
||||||
ret.TakeQuantity = it.Sum(itx => itx.TakeQuantity);
|
ret.TakeQuantity = it.Sum(itx => itx.TakeQuantity);
|
||||||
return ret;
|
return ret;
|
||||||
}).ToList();
|
}).OrderBy(it => it.Quantity).ToList();
|
||||||
singleChannels = singleChannels.Where(it => it.TakeQuantity > 0).ToList();
|
singleChannels = singleChannels.Where(it => it.TakeQuantity > 0).ToList();
|
||||||
if ((singleChannels.Count > 0 ? singleChannels[0].BoardType : 1) == 5)
|
if ((singleChannels.Count > 0 ? singleChannels[0].BoardType : 1) == 5)
|
||||||
{
|
{
|
||||||
|
@ -248,6 +256,46 @@ namespace DM_Weight.ViewModels
|
||||||
{
|
{
|
||||||
_portUtil.WriteQuantityAsync(it.DrawerNo, it.ColNo, it.Quantity - it.TakeQuantity);
|
_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_完成");
|
logger.Info("更新屏显库存singleChannels_完成");
|
||||||
RequestData();
|
RequestData();
|
||||||
|
@ -260,6 +308,7 @@ namespace DM_Weight.ViewModels
|
||||||
}
|
}
|
||||||
if (!f.IsSuccess)
|
if (!f.IsSuccess)
|
||||||
{
|
{
|
||||||
|
logger.Info($"抽屉取药,库存更新失败!{f.ErrorMessage}");
|
||||||
AlertMsg alertMsg = new AlertMsg
|
AlertMsg alertMsg = new AlertMsg
|
||||||
{
|
{
|
||||||
Message = $"抽屉取药完成,库存更新失败!{f.ErrorMessage}",
|
Message = $"抽屉取药完成,库存更新失败!{f.ErrorMessage}",
|
||||||
|
@ -282,7 +331,7 @@ namespace DM_Weight.ViewModels
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -330,6 +379,7 @@ namespace DM_Weight.ViewModels
|
||||||
.Where(cs => cs.DrawerType == 1)
|
.Where(cs => cs.DrawerType == 1)
|
||||||
.Where(cs => cs.Quantity > 0)
|
.Where(cs => cs.Quantity > 0)
|
||||||
.OrderBy(cs => cs.ColNo)
|
.OrderBy(cs => cs.ColNo)
|
||||||
|
.OrderBy(cs => cs.EffDate)
|
||||||
.ToList();
|
.ToList();
|
||||||
ChannelStocks = queryData;
|
ChannelStocks = queryData;
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,6 +11,7 @@ using Prism.Regions;
|
||||||
using Prism.Services.Dialogs;
|
using Prism.Services.Dialogs;
|
||||||
using SqlSugar;
|
using SqlSugar;
|
||||||
using System;
|
using System;
|
||||||
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Collections.ObjectModel;
|
using System.Collections.ObjectModel;
|
||||||
using System.Configuration;
|
using System.Configuration;
|
||||||
|
@ -18,6 +19,7 @@ using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows.Documents;
|
||||||
|
|
||||||
namespace DM_Weight.ViewModels
|
namespace DM_Weight.ViewModels
|
||||||
{
|
{
|
||||||
|
@ -289,7 +291,7 @@ namespace DM_Weight.ViewModels
|
||||||
if (SelectedInvoice != null)
|
if (SelectedInvoice != null)
|
||||||
{
|
{
|
||||||
//先查询有几种药
|
//先查询有几种药
|
||||||
string strSql = @"SELECT sum(Quantity) AS SumQuantity, COUNT(ID) AS CountNum,INVOICE_NO AS InvoiceNo,drug_id AS DrugId,QUANTITY AS quantity,drug_manu_no AS drugManuNo FROM IN_OUT_INVOICE WHERE INVOICE_NO=@INVOICE_NO GROUP BY INVOICE_NO,DRUG_ID";
|
string strSql = @"SELECT sum(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";
|
||||||
|
|
||||||
var invoices = SqlSugarHelper.Db.SqlQueryable<InOutInvoice>(strSql)
|
var invoices = SqlSugarHelper.Db.SqlQueryable<InOutInvoice>(strSql)
|
||||||
.AddParameters(new
|
.AddParameters(new
|
||||||
|
@ -317,18 +319,18 @@ namespace DM_Weight.ViewModels
|
||||||
//_eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
|
//_eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
ChannelStock stock = new ChannelStock();
|
//ChannelStock stock = new ChannelStock();
|
||||||
//查询每种药有多少个批次
|
//查询每种药有多少个批次
|
||||||
var invoicesManuNo = SqlSugarHelper.Db.Queryable<InOutInvoice>()
|
var invoicesManuNo = SqlSugarHelper.Db.Queryable<InOutInvoice>()
|
||||||
.Where(iManuNo => iManuNo.InvoiceNo == invoices[i].InvoiceNo && iManuNo.DrugId == invoices[i].DrugId).ToList();
|
.Where(iManuNo => iManuNo.InvoiceNo == invoices[i].InvoiceNo && iManuNo.DrugId == invoices[i].DrugId && iManuNo.Status == 0 && iManuNo.Type != 2 && iManuNo.CancelFlag == 0).ToList();
|
||||||
for (int j = 0; j < invoicesManuNo.Count; j++)
|
for (int j = 0; j < invoicesManuNo.Count; j++)
|
||||||
{
|
{
|
||||||
//查询是否有库存
|
//查询是否有库存
|
||||||
List<ChannelStock> stockList = SqlSugarHelper.Db.Queryable<ChannelStock>()
|
List<ChannelStock> stockList = SqlSugarHelper.Db.Queryable<ChannelStock>()
|
||||||
.Where(cs => cs.ManuNo == invoicesManuNo[j].DrugManuNo && cs.DrugId == invoicesManuNo[j].DrugId && cs.MachineId == (ConfigurationManager.AppSettings["machineId"] ?? "DM1")).ToList();
|
.Where(cs => cs.ManuNo == invoicesManuNo[j].DrugManuNo && cs.DrugId == invoicesManuNo[j].DrugId && cs.MachineId == (ConfigurationManager.AppSettings["machineId"] ?? "DM1")).ToList();
|
||||||
stock = stockList.Count > 0 ? stockList[0] : new ChannelStock();
|
//stock = stockList.Count > 0 ? stockList[0] : new ChannelStock();
|
||||||
List<DrugManuNo> manuNoList = SqlSugarHelper.Db.Queryable<DrugManuNo>().Where(dm => dm.ManuNo == invoicesManuNo[j].DrugManuNo && dm.DrugId == invoicesManuNo[j].DrugId).ToList();
|
List<DrugManuNo> manuNoList = SqlSugarHelper.Db.Queryable<DrugManuNo>().Where(dm => dm.ManuNo == invoicesManuNo[j].DrugManuNo && dm.DrugId == invoicesManuNo[j].DrugId).ToList();
|
||||||
if (stock == null || stock.Id is null)
|
if (stockList == null || stockList.Count <= 0)
|
||||||
{
|
{
|
||||||
if (manuNoList == null || manuNoList.Count <= 0)
|
if (manuNoList == null || manuNoList.Count <= 0)
|
||||||
{
|
{
|
||||||
|
@ -341,6 +343,7 @@ namespace DM_Weight.ViewModels
|
||||||
_eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
|
_eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
ChannelStock stock = new ChannelStock();
|
||||||
//没有库存写入一条数据
|
//没有库存写入一条数据
|
||||||
stock.MachineId = ConfigurationManager.AppSettings["machineId"] ?? "DM1";
|
stock.MachineId = ConfigurationManager.AppSettings["machineId"] ?? "DM1";
|
||||||
stock.DrawerNo = channelLst.DrawerNo;
|
stock.DrawerNo = channelLst.DrawerNo;
|
||||||
|
@ -351,13 +354,26 @@ namespace DM_Weight.ViewModels
|
||||||
stock.ManuNo = invoicesManuNo[j].DrugManuNo;
|
stock.ManuNo = invoicesManuNo[j].DrugManuNo;
|
||||||
stock.EffDate = manuNoList[0].EffDate;
|
stock.EffDate = manuNoList[0].EffDate;
|
||||||
stock.Chnguid = channelLst.Id;
|
stock.Chnguid = channelLst.Id;
|
||||||
|
stock.InvoiceQuantity = invoicesManuNo[j].quantity;
|
||||||
|
stockList.Add(stock);
|
||||||
}
|
}
|
||||||
stock.AddQuantity = invoicesManuNo[j].quantity;
|
//stock.AddQuantity = invoicesManuNo[j].quantity;
|
||||||
|
//stockList.ForEach(s => s.AddQuantity = invoicesManuNo[j].quantity);
|
||||||
|
stockList.GroupBy(x => x.ManuNo)
|
||||||
|
.Select(it =>
|
||||||
|
{
|
||||||
|
var ret = it.First();
|
||||||
|
ret.AddQuantity = invoicesManuNo[j].quantity;
|
||||||
|
ret.InvoiceQuantity = invoicesManuNo[j].quantity;
|
||||||
|
return ret;
|
||||||
|
})
|
||||||
|
.ToList();
|
||||||
|
|
||||||
if (channelLst.channelStocks == null)
|
if (channelLst.channelStocks == null)
|
||||||
{
|
{
|
||||||
channelLst.channelStocks = new List<ChannelStock>();
|
channelLst.channelStocks = new List<ChannelStock>();
|
||||||
}
|
}
|
||||||
channelLst.channelStocks.Add(stock);
|
channelLst.channelStocks.AddRange(stockList);
|
||||||
}
|
}
|
||||||
|
|
||||||
InOutInvoice copy = TransExpV2<InOutInvoice, InOutInvoice>.Trans(invoices[i]);
|
InOutInvoice copy = TransExpV2<InOutInvoice, InOutInvoice>.Trans(invoices[i]);
|
||||||
|
@ -376,7 +392,8 @@ namespace DM_Weight.ViewModels
|
||||||
ChannelStocks.Clear();
|
ChannelStocks.Clear();
|
||||||
foreach (ChannelList lst in ChannelLsts)
|
foreach (ChannelList lst in ChannelLsts)
|
||||||
{
|
{
|
||||||
ChannelStocks.AddRange(lst.channelStocks);
|
|
||||||
|
ChannelStocks.AddRange(lst.channelStocks.Where(cs => cs.AddQuantity > 9));
|
||||||
}
|
}
|
||||||
AddChannels = ChannelStocks.FindAll(it => it.AddQuantity != 0);
|
AddChannels = ChannelStocks.FindAll(it => it.AddQuantity != 0);
|
||||||
|
|
||||||
|
@ -390,6 +407,27 @@ namespace DM_Weight.ViewModels
|
||||||
{
|
{
|
||||||
if (Status == 0)
|
if (Status == 0)
|
||||||
{
|
{
|
||||||
|
if (AddChannels == null || AddChannels.Count <= 0)
|
||||||
|
{
|
||||||
|
AlertMsg alertMsg = new AlertMsg
|
||||||
|
{
|
||||||
|
Message = "请输入入库数量",
|
||||||
|
Type = MsgType.ERROR,
|
||||||
|
};
|
||||||
|
_eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
//int totalNum = AddChannels.Sum(add => add.AddQuantity);
|
||||||
|
//if (totalNum != SelectedInvoice.Quantity)
|
||||||
|
//{
|
||||||
|
// AlertMsg alertMsg = new AlertMsg
|
||||||
|
// {
|
||||||
|
// Message = "各批次添加数量要与调拨单药品总数一致!",
|
||||||
|
// Type = MsgType.ERROR,
|
||||||
|
// };
|
||||||
|
// _eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
|
||||||
|
// return;
|
||||||
|
//}
|
||||||
enumerator.MoveNext();
|
enumerator.MoveNext();
|
||||||
Status = 1;
|
Status = 1;
|
||||||
OpenOneByOne();
|
OpenOneByOne();
|
||||||
|
@ -402,7 +440,13 @@ namespace DM_Weight.ViewModels
|
||||||
List<ChannelStock> channelStocks = grouping.ToList();
|
List<ChannelStock> channelStocks = grouping.ToList();
|
||||||
channelStocks.ForEach(it => it.process = 1);
|
channelStocks.ForEach(it => it.process = 1);
|
||||||
_portUtil.SpeakAsync("正在打开" + DrawerNo + "号抽屉");
|
_portUtil.SpeakAsync("正在打开" + DrawerNo + "号抽屉");
|
||||||
List<ChannelStock> singleChannels = channelStocks.GroupBy(it => new
|
List<ChannelStock> singleChannels = new List<ChannelStock>();
|
||||||
|
for (int i = 0; i < channelStocks.Count; i++)
|
||||||
|
{
|
||||||
|
ChannelStock copy = TransExpV2<ChannelStock, ChannelStock>.Trans(channelStocks[i]);
|
||||||
|
singleChannels.Add(copy);
|
||||||
|
}
|
||||||
|
singleChannels = singleChannels.GroupBy(it => new
|
||||||
{
|
{
|
||||||
it.DrawerNo,
|
it.DrawerNo,
|
||||||
it.ColNo
|
it.ColNo
|
||||||
|
@ -422,7 +466,13 @@ namespace DM_Weight.ViewModels
|
||||||
|
|
||||||
if ((singleChannels.Count > 0 ? singleChannels[0].BoardType : 1) == 5)
|
if ((singleChannels.Count > 0 ? singleChannels[0].BoardType : 1) == 5)
|
||||||
{
|
{
|
||||||
List<ChannelStock> ChannelLst = channelStocks.Where(it => it.BoardType != 1)
|
List<ChannelStock> ChannelLst = new List<ChannelStock>();
|
||||||
|
for (int i = 0; i < channelStocks.Count; i++)
|
||||||
|
{
|
||||||
|
ChannelStock copy = TransExpV2<ChannelStock, ChannelStock>.Trans(channelStocks[i]);
|
||||||
|
singleChannels.Add(copy);
|
||||||
|
}
|
||||||
|
ChannelLst = ChannelLst.Where(it => it.BoardType != 1)
|
||||||
.GroupBy(it => it.ColNo)
|
.GroupBy(it => it.ColNo)
|
||||||
.Select(it =>
|
.Select(it =>
|
||||||
{
|
{
|
||||||
|
@ -459,18 +509,48 @@ namespace DM_Weight.ViewModels
|
||||||
if (!_isFinishClick)
|
if (!_isFinishClick)
|
||||||
{
|
{
|
||||||
_isFinishClick = true;
|
_isFinishClick = true;
|
||||||
List<ChannelStock> record = ChannelStocks.ToList();
|
List<ChannelStock> record = ChannelStocks;//.ToList();
|
||||||
string InvoiceId = SelectedInvoice.InvoiceNo;
|
string InvoiceId = SelectedInvoice.InvoiceNo;
|
||||||
var f = SqlSugarHelper.Db.UseTran(() =>
|
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++)
|
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];
|
ChannelStock it = record[i];
|
||||||
|
@ -501,7 +581,7 @@ namespace DM_Weight.ViewModels
|
||||||
}
|
}
|
||||||
//查询现有库位中是否有库存为0的记录,如果有直接update
|
//查询现有库位中是否有库存为0的记录,如果有直接update
|
||||||
ChannelStock recordHistory = SqlSugarHelper.Db.Queryable<ChannelStock>().Where(cs => cs.DrawerNo == it.DrawerNo && cs.ColNo == it.ColNo && cs.MachineId.Equals(ConfigurationManager.AppSettings["machineId"] ?? "DM1") && cs.Quantity <= 0).First();
|
ChannelStock recordHistory = SqlSugarHelper.Db.Queryable<ChannelStock>().Where(cs => cs.DrawerNo == it.DrawerNo && cs.ColNo == it.ColNo && cs.MachineId.Equals(ConfigurationManager.AppSettings["machineId"] ?? "DM1") && cs.Quantity <= 0).First();
|
||||||
if (recordHistory!=null&& recordHistory.Id!=null)
|
if (recordHistory != null && recordHistory.Id != null)
|
||||||
{
|
{
|
||||||
SqlSugarHelper.Db.Updateable<ChannelStock>().SetColumns(item => new ChannelStock()
|
SqlSugarHelper.Db.Updateable<ChannelStock>().SetColumns(item => new ChannelStock()
|
||||||
{
|
{
|
||||||
|
@ -563,7 +643,7 @@ namespace DM_Weight.ViewModels
|
||||||
{
|
{
|
||||||
//根据ChannelLsts中的库位,删除该库位库存为0的记录
|
//根据ChannelLsts中的库位,删除该库位库存为0的记录
|
||||||
SqlSugarHelper.Db.Deleteable<ChannelStock>()
|
SqlSugarHelper.Db.Deleteable<ChannelStock>()
|
||||||
.Where(cs => cs.Quantity <= 0 && cs.DrawerNo == ChannelLsts[i].channelStocks[0].DrawerNo && cs.ColNo == ChannelLsts[i].channelStocks[0].ColNo).ExecuteCommand();
|
.Where(cs => cs.Quantity <= 0 && cs.DrugId == ChannelLsts[i].DrugId && cs.MachineId == ChannelLsts[i].MachineId).ExecuteCommand();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
@ -572,7 +652,7 @@ namespace DM_Weight.ViewModels
|
||||||
{
|
{
|
||||||
// 更新屏显库存
|
// 更新屏显库存
|
||||||
//List<ChannelStock> singleChannels = record.FindAll(it => it.BoardType != 1);
|
//List<ChannelStock> singleChannels = record.FindAll(it => it.BoardType != 1);
|
||||||
List<ChannelStock> singleChannels = record.Where(it => it.BoardType != 1)
|
List<ChannelStock> singleChannels = record.Where(it => it.BoardType == 5)
|
||||||
.GroupBy(it => new { it.DrawerNo, it.ColNo })
|
.GroupBy(it => new { it.DrawerNo, it.ColNo })
|
||||||
.Select(it =>
|
.Select(it =>
|
||||||
{
|
{
|
||||||
|
@ -586,24 +666,25 @@ namespace DM_Weight.ViewModels
|
||||||
{
|
{
|
||||||
for (int i = 0; i < singleChannels.Count; i++)
|
for (int i = 0; i < singleChannels.Count; i++)
|
||||||
{
|
{
|
||||||
if (singleChannels[i].BoardType == 5)
|
//if (singleChannels[i].BoardType == 5)
|
||||||
{
|
//{
|
||||||
List<ChannelStock> channelStockEffDate = SqlSugarHelper.Db.Queryable<ChannelStock>()
|
List<ChannelStock> channelStockEffDate = SqlSugarHelper.Db.Queryable<ChannelStock>()
|
||||||
.Where(cs => cs.MachineId==singleChannels[i].MachineId)
|
.Where(cs => cs.MachineId == singleChannels[i].MachineId)
|
||||||
.Where(cs => cs.DrawerNo == singleChannels[i].DrawerNo)
|
.Where(cs => cs.DrawerNo == singleChannels[i].DrawerNo)
|
||||||
.Where(cs => cs.ColNo == singleChannels[i].ColNo)
|
.Where(cs => cs.ColNo == singleChannels[i].ColNo)
|
||||||
.OrderBy(cs => cs.EffDate).ToList();
|
.Where(cs => cs.Quantity > 0)
|
||||||
int totalQuantity = channelStockEffDate.Sum(it => it.Quantity);
|
.OrderBy(cs => cs.EffDate).ToList();
|
||||||
|
int totalQuantity = channelStockEffDate.Sum(it => it.Quantity);
|
||||||
|
|
||||||
//将库位多批次的总库存数更新标签
|
//将库位多批次的总库存数更新标签
|
||||||
_portUtil.WriteQuantity(channelStockEffDate[0].DrawerNo, channelStockEffDate[0].ColNo, totalQuantity);
|
_portUtil.WriteQuantity(channelStockEffDate[0].DrawerNo, channelStockEffDate[0].ColNo, totalQuantity);
|
||||||
Thread.Sleep(200);
|
Thread.Sleep(200);
|
||||||
_portUtil.WriteChannelInfo(6, channelStockEffDate[0].EffDate == null ? "" : channelStockEffDate[0].EffDate, channelStockEffDate[0].DrawerNo, channelStockEffDate[0].ColNo);
|
_portUtil.WriteChannelInfo(6, channelStockEffDate[0].EffDate == null ? "" : channelStockEffDate[0].EffDate, channelStockEffDate[0].DrawerNo, channelStockEffDate[0].ColNo);
|
||||||
Thread.Sleep(200);
|
Thread.Sleep(200);
|
||||||
_portUtil.WriteChannelInfo(5, channelStockEffDate[0].ManuNo, channelStockEffDate[0].DrawerNo, channelStockEffDate[0].ColNo);
|
_portUtil.WriteChannelInfo(5, channelStockEffDate[0].ManuNo, channelStockEffDate[0].DrawerNo, channelStockEffDate[0].ColNo);
|
||||||
Thread.Sleep(200);
|
Thread.Sleep(200);
|
||||||
_portUtil.ShowContent(channelStockEffDate[0].DrawerNo, channelStockEffDate[0].ColNo);
|
_portUtil.ShowContent(channelStockEffDate[0].DrawerNo, channelStockEffDate[0].ColNo);
|
||||||
}
|
//}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -616,9 +697,11 @@ namespace DM_Weight.ViewModels
|
||||||
Type = MsgType.SUCCESS,
|
Type = MsgType.SUCCESS,
|
||||||
};
|
};
|
||||||
_eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
|
_eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
|
||||||
|
RequestData();
|
||||||
}
|
}
|
||||||
if (!f.IsSuccess)
|
if (!f.IsSuccess)
|
||||||
{
|
{
|
||||||
|
logger.Info($"调拨入库,库存更新失败!{f.ErrorMessage}");
|
||||||
AlertMsg alertMsg = new AlertMsg
|
AlertMsg alertMsg = new AlertMsg
|
||||||
{
|
{
|
||||||
Message = "库存更新失败!",
|
Message = "库存更新失败!",
|
||||||
|
@ -630,7 +713,6 @@ namespace DM_Weight.ViewModels
|
||||||
_isFinishClick = false;
|
_isFinishClick = false;
|
||||||
|
|
||||||
}
|
}
|
||||||
RequestData();
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
// 取消按钮
|
// 取消按钮
|
||||||
|
|
|
@ -339,11 +339,11 @@ _exitCommand ??= new DelegateCommand(Exit);
|
||||||
logger.Info($"msg.Message.Equals:{msg.Message}");
|
logger.Info($"msg.Message.Equals:{msg.Message}");
|
||||||
if (msg.Message.Equals("LOGIN"))
|
if (msg.Message.Equals("LOGIN"))
|
||||||
{
|
{
|
||||||
UserList userList = SqlSugarHelper.Db.Queryable<UserList>()
|
//UserList userList = SqlSugarHelper.Db.Queryable<UserList>()
|
||||||
.Includes<RoleDm>(u => u.Role)
|
//.Includes<RoleDm>(u => u.Role)
|
||||||
.First(u => u.Id == msg.Id);
|
//.First(u => u.Id == msg.Id);
|
||||||
|
|
||||||
//UserList userList = new UserService().CheckUserByFingerPrinter(msg.Id);
|
UserList userList = new UserService().CheckUserByFingerPrinter(msg.Id);
|
||||||
|
|
||||||
logger.Info($"userList是空?{userList == null}");
|
logger.Info($"userList是空?{userList == null}");
|
||||||
if (userList == null)
|
if (userList == null)
|
||||||
|
|
|
@ -22,6 +22,7 @@ using DM_Weight.Port;
|
||||||
using DM_Weight.select;
|
using DM_Weight.select;
|
||||||
using DM_Weight.util;
|
using DM_Weight.util;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
|
using System.Collections;
|
||||||
|
|
||||||
namespace DM_Weight.ViewModels
|
namespace DM_Weight.ViewModels
|
||||||
{
|
{
|
||||||
|
@ -265,8 +266,13 @@ namespace DM_Weight.ViewModels
|
||||||
channelStocks.ForEach(it => it.process = 1);
|
channelStocks.ForEach(it => it.process = 1);
|
||||||
_portUtil.SpeakAsync("正在打开" + DrawerNo + "号抽屉");
|
_portUtil.SpeakAsync("正在打开" + DrawerNo + "号抽屉");
|
||||||
|
|
||||||
|
List<ChannelStock> singleChannels = new List<ChannelStock>();
|
||||||
List<ChannelStock> singleChannels = channelStocks
|
for (int i = 0; i < channelStocks.Count; i++)
|
||||||
|
{
|
||||||
|
ChannelStock copy = TransExpV2<ChannelStock, ChannelStock>.Trans(channelStocks[i]);
|
||||||
|
singleChannels.Add(copy);
|
||||||
|
}
|
||||||
|
singleChannels = singleChannels
|
||||||
.GroupBy(it => new { it.DrawerNo, it.ColNo })
|
.GroupBy(it => new { it.DrawerNo, it.ColNo })
|
||||||
.Select(it =>
|
.Select(it =>
|
||||||
{
|
{
|
||||||
|
@ -380,13 +386,29 @@ namespace DM_Weight.ViewModels
|
||||||
{
|
{
|
||||||
if (singleChannels[i].BoardType == 5)
|
if (singleChannels[i].BoardType == 5)
|
||||||
{
|
{
|
||||||
int totalQuantity = SqlSugarHelper.Db.Queryable<ChannelStock>()
|
List<ChannelStock> channels = SqlSugarHelper.Db.Queryable<ChannelStock>()
|
||||||
.Where(cs => cs.MachineId == singleChannels[i].MachineId)
|
.Where(cs => cs.MachineId == singleChannels[i].MachineId)
|
||||||
.Where(cs => cs.DrawerNo == singleChannels[i].DrawerNo)
|
.Where(cs => cs.DrawerNo == singleChannels[i].DrawerNo)
|
||||||
.Where(cs => cs.ColNo == singleChannels[i].ColNo)
|
.Where(cs => cs.ColNo == singleChannels[i].ColNo)
|
||||||
.Sum(it => it.Quantity);
|
.OrderBy(cs => cs.EffDate).ToList();
|
||||||
//将库位多批次的总库存数更新标签
|
if (channels != null && channels.Count > 0)
|
||||||
_portUtil.WriteQuantity(singleChannels[i].DrawerNo, singleChannels[i].ColNo, totalQuantity);
|
{
|
||||||
|
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(singleChannels[i].DrawerNo, singleChannels[i].ColNo, channels.Sum(cs => cs.Quantity));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,7 +37,7 @@ namespace DM_Weight.ViewModels
|
||||||
|
|
||||||
private PortUtil _portUtil;
|
private PortUtil _portUtil;
|
||||||
IEventAggregator _eventAggregator;
|
IEventAggregator _eventAggregator;
|
||||||
IDialogService _dialogService;
|
IDialogService _dialogService;
|
||||||
//private SqlSugarScope SqlSugarHelper.Db;
|
//private SqlSugarScope SqlSugarHelper.Db;
|
||||||
public OrderTakeDialogViewModel(PortUtil portUtil, IEventAggregator eventAggregator, IDialogService DialogService, SqlSugarScope sqlSugarScope)
|
public OrderTakeDialogViewModel(PortUtil portUtil, IEventAggregator eventAggregator, IDialogService DialogService, SqlSugarScope sqlSugarScope)
|
||||||
{
|
{
|
||||||
|
@ -171,11 +171,12 @@ namespace DM_Weight.ViewModels
|
||||||
|
|
||||||
public void RequestData()
|
public void RequestData()
|
||||||
{
|
{
|
||||||
orderDetails = SqlSugarHelper.Db.Queryable<OrderDetail>()
|
orderDetails = SqlSugarHelper.Db.Queryable<OrderDetail>()
|
||||||
.Includes<DrugInfo>(od => od.DrugInfo)
|
.Includes<DrugInfo>(od => od.DrugInfo)
|
||||||
.InnerJoin(SqlSugarHelper.Db.Queryable<ChannelStock>().Where(cs => cs.DrawerType == 1).Where(cs => cs.MachineId.Equals(ConfigurationManager.AppSettings["machineId"] ?? "DM1")).GroupBy(cs => cs.DrugId), (od, t) => od.DrugId == t.DrugId)
|
.InnerJoin(SqlSugarHelper.Db.Queryable<ChannelStock>().Where(cs => cs.DrawerType == 1).Where(cs => cs.MachineId.Equals(ConfigurationManager.AppSettings["machineId"] ?? "DM1")).GroupBy(cs => cs.DrugId), (od, t) => od.DrugId == t.DrugId)
|
||||||
.Where(od => od.OrderNo == OrderInfo.OrderNo)
|
.Where(od=>od.DMStatus==0)
|
||||||
.ToList();
|
.Where(od => od.OrderNo == OrderInfo.OrderNo)
|
||||||
|
.ToList();
|
||||||
|
|
||||||
List<ChannelStock> channelStocks = new List<ChannelStock>();
|
List<ChannelStock> channelStocks = new List<ChannelStock>();
|
||||||
List<string> msg = new List<string>();
|
List<string> msg = new List<string>();
|
||||||
|
@ -194,7 +195,7 @@ namespace DM_Weight.ViewModels
|
||||||
.Where(cs => cs.DrugId == orderDetail.DrugId)
|
.Where(cs => cs.DrugId == orderDetail.DrugId)
|
||||||
.OrderBy(cs => cs.EffDate)
|
.OrderBy(cs => cs.EffDate)
|
||||||
.OrderBy(cs => cs.DrawerNo)
|
.OrderBy(cs => cs.DrawerNo)
|
||||||
.OrderBy(cs=> cs.ManuNo)
|
.OrderBy(cs => cs.ManuNo)
|
||||||
.ToList();
|
.ToList();
|
||||||
int total = HasQChannels.Sum(it => it.Quantity);
|
int total = HasQChannels.Sum(it => it.Quantity);
|
||||||
int TakeQ = orderDetail.Quantity;
|
int TakeQ = orderDetail.Quantity;
|
||||||
|
@ -206,12 +207,14 @@ namespace DM_Weight.ViewModels
|
||||||
ChannelStock stock = HasQChannels[j];
|
ChannelStock stock = HasQChannels[j];
|
||||||
if (TakeQ > stock.Quantity)
|
if (TakeQ > stock.Quantity)
|
||||||
{
|
{
|
||||||
|
stock.OrderQuantity= orderDetail.Quantity;
|
||||||
stock.TakeQuantity = stock.Quantity;
|
stock.TakeQuantity = stock.Quantity;
|
||||||
channelStocks.Add(stock);
|
channelStocks.Add(stock);
|
||||||
TakeQ -= stock.Quantity;
|
TakeQ -= stock.Quantity;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
stock.OrderQuantity = orderDetail.Quantity;
|
||||||
stock.TakeQuantity = TakeQ;
|
stock.TakeQuantity = TakeQ;
|
||||||
channelStocks.Add(stock);
|
channelStocks.Add(stock);
|
||||||
TakeQ = 0;
|
TakeQ = 0;
|
||||||
|
@ -220,7 +223,16 @@ namespace DM_Weight.ViewModels
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
msg.Add($"药品【{orderDetail.DrugInfo.DrugName}】库存不足,应取【{TakeQ}】库存【{total}】");
|
//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);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (msg.Count > 0)
|
if (msg.Count > 0)
|
||||||
|
@ -230,7 +242,7 @@ namespace DM_Weight.ViewModels
|
||||||
DialogParameters dialogParameters = new DialogParameters();
|
DialogParameters dialogParameters = new DialogParameters();
|
||||||
dialogParameters.Add("msgInfo", msg);
|
dialogParameters.Add("msgInfo", msg);
|
||||||
DialogServiceExtensions.ShowDialogHost(_dialogService, "ShowMessageDialog", dialogParameters, "RootDialog");
|
DialogServiceExtensions.ShowDialogHost(_dialogService, "ShowMessageDialog", dialogParameters, "RootDialog");
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -272,25 +284,31 @@ namespace DM_Weight.ViewModels
|
||||||
_portUtil.SpeakAsync("正在打开" + DrawerNo + "号抽屉");
|
_portUtil.SpeakAsync("正在打开" + DrawerNo + "号抽屉");
|
||||||
|
|
||||||
//List<ChannelStock> singleChannels = channelStocks.FindAll(it => it.BoardType != 1);
|
//List<ChannelStock> singleChannels = channelStocks.FindAll(it => it.BoardType != 1);
|
||||||
List<ChannelStock> singleChannels = channelStocks
|
List<ChannelStock> singleChannels = new List<ChannelStock>();
|
||||||
.GroupBy(it => new { it.DrawerNo, it.ColNo })
|
for (int i = 0; i < channelStocks.Count; i++)
|
||||||
.Select(it =>
|
{
|
||||||
{
|
ChannelStock copy = TransExpV2<ChannelStock, ChannelStock>.Trans(channelStocks[i]);
|
||||||
var ret = it.First();
|
singleChannels.Add(copy);
|
||||||
ret.Quantity = it.Sum(it => it.Quantity);
|
}
|
||||||
ret.TakeQuantity = it.Sum(it => it.TakeQuantity);
|
|
||||||
return ret;
|
singleChannels = singleChannels
|
||||||
})
|
.GroupBy(it => new { it.DrawerNo, it.ColNo })
|
||||||
.ToList()
|
.Select(it =>
|
||||||
.FindAll(it => it.BoardType != 1);
|
{
|
||||||
|
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 =>
|
singleChannels.ForEach(it =>
|
||||||
{
|
{
|
||||||
try
|
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)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
@ -323,26 +341,55 @@ namespace DM_Weight.ViewModels
|
||||||
if (record.Count > 0)
|
if (record.Count > 0)
|
||||||
{
|
{
|
||||||
string InvoiceId = OrderInfo.OrderNo;
|
string InvoiceId = OrderInfo.OrderNo;
|
||||||
var f = SqlSugarHelper.Db.UseTran(() =>
|
try
|
||||||
{
|
{
|
||||||
SqlSugarHelper.Db.Updateable(new OrderInfo()
|
SqlSugarHelper.Db.BeginTran();
|
||||||
|
//如果处方下全部药品都取完则更新orderInfo,order_detail中的dm_status
|
||||||
|
if (ChannelStocks.Sum(cs => cs.TakeQuantity) == ChannelStocks.Sum(cs => cs.OrderQuantity))
|
||||||
{
|
{
|
||||||
DmStatus = 1,
|
logger.Info($"更新OrderInfo:{InvoiceId}");
|
||||||
OrderNo = OrderInfo.OrderNo
|
SqlSugarHelper.Db.Updateable(new OrderInfo()
|
||||||
}).UpdateColumns(it => new { it.DmStatus }).WhereColumns(it => new { it.OrderNo }).ExecuteCommand();
|
{
|
||||||
|
DmStatus = 1,
|
||||||
SqlSugarHelper.Db.Insertable(new OrderFinish()
|
OrderNo = OrderInfo.OrderNo
|
||||||
{
|
}).UpdateColumns(it => new { it.DmStatus }).WhereColumns(it => new { it.OrderNo }).ExecuteCommand();
|
||||||
OrderNo = OrderInfo.OrderNo,
|
SqlSugarHelper.Db.Updateable(new OrderDetail()
|
||||||
PatientId = OrderInfo.PatientId,
|
{
|
||||||
Pharmacy = OrderInfo.Pharmacy,
|
DMStatus = 1,
|
||||||
State = 1,
|
OrderNo = OrderInfo.OrderNo
|
||||||
Operator = HomeWindowViewModel.Operator?.Nickname,
|
}).UpdateColumns(it => new { it.DMStatus }).WhereColumns(it => new { it.OrderNo }).ExecuteCommand();
|
||||||
});
|
}
|
||||||
|
|
||||||
|
logger.Info("进入record循环");
|
||||||
for (int i = 0; i < record.Count; i++)
|
for (int i = 0; i < record.Count; i++)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
ChannelStock it = record[i];
|
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()
|
SqlSugarHelper.Db.Updateable(new ChannelStock()
|
||||||
{
|
{
|
||||||
|
@ -351,13 +398,14 @@ namespace DM_Weight.ViewModels
|
||||||
EffDate = it.EffDate,
|
EffDate = it.EffDate,
|
||||||
Id = it.Id,
|
Id = it.Id,
|
||||||
}).UpdateColumns(it => new { it.Quantity, it.ManuNo, it.EffDate }).ExecuteCommand();
|
}).UpdateColumns(it => new { it.Quantity, it.ManuNo, it.EffDate }).ExecuteCommand();
|
||||||
|
|
||||||
// 获取更新完库存后的药品库存
|
// 获取更新完库存后的药品库存
|
||||||
List<ChannelStock> nowChannels = SqlSugarHelper.Db.Queryable<ChannelStock>()
|
List<ChannelStock> nowChannels = SqlSugarHelper.Db.Queryable<ChannelStock>()
|
||||||
.Where(cs => cs.MachineId.Equals(it.MachineId))
|
.Where(cs => cs.MachineId.Equals(it.MachineId))
|
||||||
.Where(cs => cs.DrugId.Equals(it.DrugId))
|
.Where(cs => cs.DrugId.Equals(it.DrugId))
|
||||||
.Where(cs => cs.DrawerType == 1)
|
.Where(cs => cs.DrawerType == 1)
|
||||||
.ToList();
|
.ToList();
|
||||||
|
logger.Info($"保存MachineRecord:{it.ManuNo}");
|
||||||
// 保存数据 出库记录
|
// 保存数据 出库记录
|
||||||
SqlSugarHelper.Db.Insertable(new MachineRecord()
|
SqlSugarHelper.Db.Insertable(new MachineRecord()
|
||||||
{
|
{
|
||||||
|
@ -378,54 +426,71 @@ namespace DM_Weight.ViewModels
|
||||||
SupplierDept = ConfigurationManager.AppSettings["receiveDept"].ToString(),
|
SupplierDept = ConfigurationManager.AppSettings["receiveDept"].ToString(),
|
||||||
ReceiveDept = OrderInfo.DeptName
|
ReceiveDept = OrderInfo.DeptName
|
||||||
}).ExecuteCommand();
|
}).ExecuteCommand();
|
||||||
|
logger.Info("结束循环");
|
||||||
}
|
}
|
||||||
return true;
|
|
||||||
});
|
SqlSugarHelper.Db.CommitTran();
|
||||||
if (f.Data)
|
|
||||||
{
|
logger.Info("事务已提交");
|
||||||
// 更新屏显库存
|
// 更新屏显库存
|
||||||
//List<ChannelStock> singleChannels = record.FindAll(it => it.BoardType != 1);
|
//List<ChannelStock> singleChannels = record.FindAll(it => it.BoardType != 1);
|
||||||
List<ChannelStock> singleChannels = record.Where(it => it.BoardType != 1)
|
Task.Factory.StartNew(() =>
|
||||||
.GroupBy(it => it.ColNo)
|
{
|
||||||
|
List<ChannelStock> singleChannels = record.Where(it => it.BoardType == 5)
|
||||||
|
.GroupBy(it => new { it.DrawerNo, it.ColNo })
|
||||||
.Select(it =>
|
.Select(it =>
|
||||||
{
|
{
|
||||||
var ret = it.First();
|
var ret = it.First();
|
||||||
//ret.Quantity = it.Sum(itx => itx.Quantity);
|
|
||||||
//ret.AddQuantity = it.Sum(itx => itx.AddQuantity);
|
|
||||||
return ret;
|
return ret;
|
||||||
}).ToList();
|
}).ToList();
|
||||||
//if ((singleChannels.Count > 0 ? singleChannels[0].BoardType : 1) == 5)
|
logger.Info("查询数据并写标签");
|
||||||
//{
|
if (singleChannels.Count > 0)
|
||||||
//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++)
|
|
||||||
{
|
{
|
||||||
if (singleChannels[i].BoardType == 5)
|
for (int i = 0; i < singleChannels.Count; i++)
|
||||||
{
|
{
|
||||||
int totalQuantity = SqlSugarHelper.Db.Queryable<ChannelStock>()
|
List<ChannelStock> channel = SqlSugarHelper.Db.Queryable<ChannelStock>()
|
||||||
.Where(cs => cs.MachineId == singleChannels[i].MachineId)
|
.Where(cs => cs.MachineId == singleChannels[i].MachineId)
|
||||||
.Where(cs => cs.DrawerNo == singleChannels[i].DrawerNo)
|
.Where(cs => cs.DrawerNo == singleChannels[i].DrawerNo)
|
||||||
.Where(cs => cs.ColNo == singleChannels[i].ColNo)
|
.Where(cs => cs.ColNo == singleChannels[i].ColNo)
|
||||||
.Sum(it => it.Quantity);
|
//.Where(cs=>cs.Quantity>0)
|
||||||
//将库位多批次的总库存数更新标签
|
.OrderBy(cs => cs.EffDate)
|
||||||
_portUtil.WriteQuantity(singleChannels[i].DrawerNo, singleChannels[i].ColNo, totalQuantity);
|
.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(() =>
|
||||||
AlertMsg alertMsg = new AlertMsg
|
{
|
||||||
{
|
logger.Info($"抽屉取药完成,库存已更新");
|
||||||
Message = "抽屉取药完成,库存已更新",
|
AlertMsg alertMsg = new AlertMsg
|
||||||
Type = MsgType.SUCCESS,
|
{
|
||||||
};
|
Message = "抽屉取药完成,库存已更新",
|
||||||
_eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
|
Type = MsgType.SUCCESS,
|
||||||
|
};
|
||||||
|
_eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
|
||||||
|
}));
|
||||||
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
if(!f.IsSuccess)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
SqlSugarHelper.Db.RollbackTran();
|
||||||
|
logger.Info($"抽屉取药完成,库存更新失败!{ex.Message}");
|
||||||
AlertMsg alertMsg = new AlertMsg
|
AlertMsg alertMsg = new AlertMsg
|
||||||
{
|
{
|
||||||
Message = "抽屉取药完成,库存更新失败!",
|
Message = "抽屉取药完成,库存更新失败!",
|
||||||
|
@ -433,6 +498,155 @@ namespace DM_Weight.ViewModels
|
||||||
};
|
};
|
||||||
_eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
|
_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;
|
Status = 0;
|
||||||
_isFinishClick = false;
|
_isFinishClick = false;
|
||||||
//RequestClose?.Invoke(new DialogResult(ButtonResult.Cancel));
|
//RequestClose?.Invoke(new DialogResult(ButtonResult.Cancel));
|
||||||
|
|
|
@ -249,7 +249,6 @@ namespace DM_Weight.ViewModels
|
||||||
//接收导航传过来的参数 现在是在此处初始化了表格数据
|
//接收导航传过来的参数 现在是在此处初始化了表格数据
|
||||||
public void OnNavigatedTo(NavigationContext navigationContext)
|
public void OnNavigatedTo(NavigationContext navigationContext)
|
||||||
{
|
{
|
||||||
|
|
||||||
logger.Info("进入OrderTakeDrugWindowViewModel_OnNavigatedTo");
|
logger.Info("进入OrderTakeDrugWindowViewModel_OnNavigatedTo");
|
||||||
_eventAggregator.GetEvent<PortUtilEvent>().Subscribe(DoMyPrismEvent);
|
_eventAggregator.GetEvent<PortUtilEvent>().Subscribe(DoMyPrismEvent);
|
||||||
//RequestData();
|
//RequestData();
|
||||||
|
|
|
@ -0,0 +1,68 @@
|
||||||
|
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";
|
||||||
|
}
|
||||||
|
}
|
|
@ -17,6 +17,7 @@ using DM_Weight.msg;
|
||||||
using DM_Weight.Port;
|
using DM_Weight.Port;
|
||||||
using DM_Weight.util;
|
using DM_Weight.util;
|
||||||
using SqlSugar;
|
using SqlSugar;
|
||||||
|
using System.Threading;
|
||||||
|
|
||||||
namespace DM_Weight.ViewModels
|
namespace DM_Weight.ViewModels
|
||||||
{
|
{
|
||||||
|
@ -279,16 +280,30 @@ namespace DM_Weight.ViewModels
|
||||||
// 更新屏显库存
|
// 更新屏显库存
|
||||||
if (ChannelStock.BoardType == 5)
|
if (ChannelStock.BoardType == 5)
|
||||||
{
|
{
|
||||||
//_portUtil.WriteQuantity(ChannelStock.DrawerNo, ChannelStock.ColNo, ChannelStock.Quantity + ReturnQuantity);
|
List<ChannelStock> channels = SqlSugarHelper.Db.Queryable<ChannelStock>()
|
||||||
int totalQuantity = SqlSugarHelper.Db.Queryable<ChannelStock>()
|
.Where(cs => cs.MachineId == ChannelStock.MachineId)
|
||||||
.Where(cs => cs.MachineId.Equals(ChannelStock.MachineId))
|
.Where(cs => cs.DrawerNo == ChannelStock.DrawerNo)
|
||||||
.Where(cs => cs.DrawerNo == ChannelStock.DrawerNo)
|
.Where(cs => cs.ColNo == ChannelStock.ColNo)
|
||||||
.Where(cs => cs.ColNo == ChannelStock.ColNo)
|
.OrderBy(cs => cs.EffDate).ToList();
|
||||||
.Sum(it => it.Quantity);
|
if (channels != null && channels.Count > 0)
|
||||||
|
{
|
||||||
_portUtil.WriteQuantity(ChannelStock.DrawerNo, ChannelStock.ColNo, totalQuantity);
|
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));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
AlertMsg alertMsg = new AlertMsg
|
AlertMsg alertMsg = new AlertMsg
|
||||||
{
|
{
|
||||||
Message = "操作完成,库存已更新",
|
Message = "操作完成,库存已更新",
|
||||||
|
|
|
@ -20,6 +20,8 @@ using DM_Weight.Views;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using SqlSugar;
|
using SqlSugar;
|
||||||
using System.Configuration;
|
using System.Configuration;
|
||||||
|
using System.Collections;
|
||||||
|
using System.Threading.Channels;
|
||||||
|
|
||||||
namespace DM_Weight.ViewModels
|
namespace DM_Weight.ViewModels
|
||||||
{
|
{
|
||||||
|
@ -192,8 +194,13 @@ namespace DM_Weight.ViewModels
|
||||||
channelStocks.ForEach(it => it.process = 1);
|
channelStocks.ForEach(it => it.process = 1);
|
||||||
_portUtil.SpeakAsync("正在打开" + DrawerNo + "号抽屉");
|
_portUtil.SpeakAsync("正在打开" + DrawerNo + "号抽屉");
|
||||||
|
|
||||||
|
List<ChannelStock> singleChannels = new List<ChannelStock>();
|
||||||
List<ChannelStock> singleChannels = channelStocks
|
for (int i = 0; i < channelStocks.Count; i++)
|
||||||
|
{
|
||||||
|
ChannelStock copy = TransExpV2<ChannelStock, ChannelStock>.Trans(channelStocks[i]);
|
||||||
|
singleChannels.Add(copy);
|
||||||
|
}
|
||||||
|
singleChannels = singleChannels
|
||||||
.GroupBy(it => new {
|
.GroupBy(it => new {
|
||||||
it.DrawerNo, it.ColNo
|
it.DrawerNo, it.ColNo
|
||||||
})
|
})
|
||||||
|
@ -310,7 +317,7 @@ namespace DM_Weight.ViewModels
|
||||||
{
|
{
|
||||||
// 更新屏显库存
|
// 更新屏显库存
|
||||||
//List<ChannelStock> singleChannels = record.FindAll(it => it.BoardType != 1);
|
//List<ChannelStock> singleChannels = record.FindAll(it => it.BoardType != 1);
|
||||||
List<ChannelStock> singleChannels = record.Where(it => it.BoardType != 1)
|
List<ChannelStock> singleChannels = record.Where(it => it.BoardType == 5)
|
||||||
.GroupBy(it => new { it.DrawerNo,it.ColNo })
|
.GroupBy(it => new { it.DrawerNo,it.ColNo })
|
||||||
.Select(it =>
|
.Select(it =>
|
||||||
{
|
{
|
||||||
|
@ -335,13 +342,43 @@ namespace DM_Weight.ViewModels
|
||||||
{
|
{
|
||||||
if (singleChannels[i].BoardType == 5)
|
if (singleChannels[i].BoardType == 5)
|
||||||
{
|
{
|
||||||
int totalQuantity = SqlSugarHelper.Db.Queryable<ChannelStock>()
|
//int totalQuantity = SqlSugarHelper.Db.Queryable<ChannelStock>()
|
||||||
.Where(cs => cs.MachineId == singleChannels[i].MachineId)
|
// .Where(cs => cs.MachineId == singleChannels[i].MachineId)
|
||||||
.Where(cs => cs.DrawerNo == singleChannels[i].DrawerNo)
|
// .Where(cs => cs.DrawerNo == singleChannels[i].DrawerNo)
|
||||||
.Where(cs => cs.ColNo == singleChannels[i].ColNo)
|
// .Where(cs => cs.ColNo == singleChannels[i].ColNo)
|
||||||
.Sum(it => it.Quantity);
|
// .Sum(it => it.Quantity);
|
||||||
//将库位多批次的总库存数更新标签
|
|
||||||
_portUtil.WriteQuantity(singleChannels[i].DrawerNo, singleChannels[i].ColNo, totalQuantity);
|
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));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -356,6 +393,7 @@ namespace DM_Weight.ViewModels
|
||||||
}
|
}
|
||||||
if (!f.IsSuccess)
|
if (!f.IsSuccess)
|
||||||
{
|
{
|
||||||
|
logger.Info($"自选加药,库存更新失败!{f.ErrorMessage}");
|
||||||
AlertMsg alertMsg = new AlertMsg
|
AlertMsg alertMsg = new AlertMsg
|
||||||
{
|
{
|
||||||
Message = "库存更新失败!",
|
Message = "库存更新失败!",
|
||||||
|
|
|
@ -184,8 +184,13 @@ namespace DM_Weight.ViewModels
|
||||||
channelStocks.ForEach(it => it.process = 1);
|
channelStocks.ForEach(it => it.process = 1);
|
||||||
_portUtil.SpeakAsync("正在打开" + DrawerNo + "号抽屉");
|
_portUtil.SpeakAsync("正在打开" + DrawerNo + "号抽屉");
|
||||||
|
|
||||||
|
List<ChannelStock> singleChannels = new List<ChannelStock>();
|
||||||
List<ChannelStock> singleChannels = channelStocks
|
for (int i = 0; i < channelStocks.Count; i++)
|
||||||
|
{
|
||||||
|
ChannelStock copy = TransExpV2<ChannelStock, ChannelStock>.Trans(channelStocks[i]);
|
||||||
|
singleChannels.Add(copy);
|
||||||
|
}
|
||||||
|
singleChannels = singleChannels
|
||||||
.GroupBy(it => new { it.DrawerNo, it.ColNo })
|
.GroupBy(it => new { it.DrawerNo, it.ColNo })
|
||||||
.Select(it =>
|
.Select(it =>
|
||||||
{
|
{
|
||||||
|
@ -269,7 +274,7 @@ namespace DM_Weight.ViewModels
|
||||||
{
|
{
|
||||||
// 更新屏显库存
|
// 更新屏显库存
|
||||||
//List<ChannelStock> singleChannels = record.FindAll(it => it.BoardType != 1);
|
//List<ChannelStock> singleChannels = record.FindAll(it => it.BoardType != 1);
|
||||||
List<ChannelStock> singleChannels = ChannelStocks.Where(it => it.BoardType != 1)
|
List<ChannelStock> singleChannels = ChannelStocks.Where(it => it.BoardType == 5)
|
||||||
.GroupBy(it =>new { it.DrawerNo, it.ColNo })
|
.GroupBy(it =>new { it.DrawerNo, it.ColNo })
|
||||||
.Select(it =>
|
.Select(it =>
|
||||||
{
|
{
|
||||||
|
@ -292,16 +297,39 @@ namespace DM_Weight.ViewModels
|
||||||
{
|
{
|
||||||
for (int i = 0; i < singleChannels.Count; i++)
|
for (int i = 0; i < singleChannels.Count; i++)
|
||||||
{
|
{
|
||||||
if (singleChannels[i].BoardType == 5)
|
//int totalQuantity = SqlSugarHelper.Db.Queryable<ChannelStock>()
|
||||||
{
|
// .Where(cs => cs.MachineId == singleChannels[i].MachineId)
|
||||||
int totalQuantity = SqlSugarHelper.Db.Queryable<ChannelStock>()
|
// .Where(cs => cs.DrawerNo == singleChannels[i].DrawerNo)
|
||||||
.Where(cs => cs.MachineId == singleChannels[i].MachineId)
|
// .Where(cs => cs.ColNo == singleChannels[i].ColNo)
|
||||||
.Where(cs => cs.DrawerNo == singleChannels[i].DrawerNo)
|
// .Sum(it => it.Quantity);
|
||||||
.Where(cs => cs.ColNo == singleChannels[i].ColNo)
|
////将库位多批次的总库存数更新标签
|
||||||
.Sum(it => it.Quantity);
|
//_portUtil.WriteQuantity(singleChannels[i].DrawerNo, singleChannels[i].ColNo, totalQuantity);
|
||||||
|
|
||||||
|
|
||||||
|
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(singleChannels[i].DrawerNo, singleChannels[i].ColNo, totalQuantity);
|
_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);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -314,6 +342,7 @@ namespace DM_Weight.ViewModels
|
||||||
}
|
}
|
||||||
if (!f.IsSuccess)
|
if (!f.IsSuccess)
|
||||||
{
|
{
|
||||||
|
logger.Info($"自选取药,库存更新失败!{f.ErrorMessage}");
|
||||||
AlertMsg alertMsg = new AlertMsg
|
AlertMsg alertMsg = new AlertMsg
|
||||||
{
|
{
|
||||||
Message = "库存更新失败!",
|
Message = "库存更新失败!",
|
||||||
|
|
|
@ -337,7 +337,29 @@
|
||||||
</DataTemplate>
|
</DataTemplate>
|
||||||
</DataGridTemplateColumn.CellTemplate>
|
</DataGridTemplateColumn.CellTemplate>
|
||||||
</DataGridTemplateColumn>
|
</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.Columns>
|
||||||
</DataGrid>
|
</DataGrid>
|
||||||
<!--<ListView Padding="0 6 0 0" Grid.Column="1"
|
<!--<ListView Padding="0 6 0 0" Grid.Column="1"
|
||||||
|
|
|
@ -37,5 +37,17 @@ namespace DM_Weight.Views
|
||||||
//vms.AddAction(cls);
|
//vms.AddAction(cls);
|
||||||
_eventAggregator.GetEvent<AddDrugEvent>().Publish(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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -73,7 +73,26 @@
|
||||||
DisplayMemberPath="drug_name_spec" IsEditable="True" IsTextSearchEnabled="False" KeyUp="ComboBox_KeyUp"
|
DisplayMemberPath="drug_name_spec" IsEditable="True" IsTextSearchEnabled="False" KeyUp="ComboBox_KeyUp"
|
||||||
/>
|
/>
|
||||||
<StackPanel HorizontalAlignment="Right" Grid.Column="3" Orientation="Horizontal">
|
<StackPanel HorizontalAlignment="Right" Grid.Column="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}"
|
||||||
|
|
||||||
|
/>-->
|
||||||
|
<Button
|
||||||
|
Style="{StaticResource MaterialDesignOutlinedLightButton}"
|
||||||
|
ToolTip="渲染标签"
|
||||||
|
Content="渲染标签"
|
||||||
|
Command="{Binding ResetLabelCommand}"
|
||||||
|
materialDesign:ButtonProgressAssist.IsIndicatorVisible="{Binding Status, UpdateSourceTrigger=PropertyChanged}"
|
||||||
|
materialDesign:ButtonProgressAssist.IsIndeterminate="{Binding Status, UpdateSourceTrigger=PropertyChanged}"
|
||||||
|
|
||||||
|
/>
|
||||||
<Button
|
<Button
|
||||||
|
Margin="6 0 6 0"
|
||||||
Style="{StaticResource MaterialDesignOutlinedLightButton}"
|
Style="{StaticResource MaterialDesignOutlinedLightButton}"
|
||||||
ToolTip="绑定库位"
|
ToolTip="绑定库位"
|
||||||
Content="绑定"
|
Content="绑定"
|
||||||
|
@ -231,7 +250,7 @@
|
||||||
InfoTextIsEnabel="True"
|
InfoTextIsEnabel="True"
|
||||||
/>
|
/>
|
||||||
<materialDesign:Snackbar
|
<materialDesign:Snackbar
|
||||||
Background="{Binding SnackbarBackground}"
|
Background="{Binding SnackbarBackground,UpdateSourceTrigger=PropertyChanged}"
|
||||||
MessageQueue="{Binding SnackbarMessageQueue}"/>
|
MessageQueue="{Binding SnackbarMessageQueue}"/>
|
||||||
</Grid>
|
</Grid>
|
||||||
</UserControl>
|
</UserControl>
|
||||||
|
|
|
@ -144,13 +144,6 @@
|
||||||
ElementStyle="{StaticResource MaterialDesignDataGridTextColumnStyle}"
|
ElementStyle="{StaticResource MaterialDesignDataGridTextColumnStyle}"
|
||||||
EditingElementStyle="{StaticResource MaterialDesignDataGridTextColumnEditingStyle}"
|
EditingElementStyle="{StaticResource MaterialDesignDataGridTextColumnEditingStyle}"
|
||||||
/>
|
/>
|
||||||
<DataGridTextColumn Width="100"
|
|
||||||
Header="数量"
|
|
||||||
IsReadOnly="True"
|
|
||||||
Binding="{Binding Quantity}"
|
|
||||||
ElementStyle="{StaticResource MaterialDesignDataGridTextColumnStyle}"
|
|
||||||
EditingElementStyle="{StaticResource MaterialDesignDataGridTextColumnEditingStyle}"
|
|
||||||
/>
|
|
||||||
<DataGridTextColumn Width="130"
|
<DataGridTextColumn Width="130"
|
||||||
Header="批次"
|
Header="批次"
|
||||||
IsReadOnly="True"
|
IsReadOnly="True"
|
||||||
|
@ -166,13 +159,36 @@
|
||||||
EditingElementStyle="{StaticResource MaterialDesignDataGridTextColumnEditingStyle}"
|
EditingElementStyle="{StaticResource MaterialDesignDataGridTextColumnEditingStyle}"
|
||||||
/>
|
/>
|
||||||
<DataGridTextColumn Width="100"
|
<DataGridTextColumn Width="100"
|
||||||
Header="取出数量"
|
Header="库存数量"
|
||||||
IsReadOnly="True"
|
IsReadOnly="True"
|
||||||
Binding="{Binding TakeQuantity}"
|
Binding="{Binding Quantity}"
|
||||||
ElementStyle="{StaticResource MaterialDesignDataGridTextColumnStyle}"
|
ElementStyle="{StaticResource MaterialDesignDataGridTextColumnStyle}"
|
||||||
EditingElementStyle="{StaticResource MaterialDesignDataGridTextColumnEditingStyle}"
|
EditingElementStyle="{StaticResource MaterialDesignDataGridTextColumnEditingStyle}"
|
||||||
/>
|
/>
|
||||||
</DataGrid.Columns>
|
<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>
|
</DataGrid>
|
||||||
<Grid Grid.Row="3">
|
<Grid Grid.Row="3">
|
||||||
<Grid.ColumnDefinitions>
|
<Grid.ColumnDefinitions>
|
||||||
|
|
|
@ -0,0 +1,19 @@
|
||||||
|
<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>
|
|
@ -0,0 +1,61 @@
|
||||||
|
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 中
|
||||||
|
// };
|
||||||
|
//}
|
||||||
|
}
|
||||||
|
}
|
|
@ -27,6 +27,8 @@
|
||||||
<ColumnDefinition />
|
<ColumnDefinition />
|
||||||
</Grid.ColumnDefinitions>
|
</Grid.ColumnDefinitions>
|
||||||
<Image Grid.Column="0" Margin="30 0 30 0" HorizontalAlignment="Left" Width="Auto" Height="26" Source="/Images/logo.png" />
|
<Image Grid.Column="0" Margin="30 0 30 0" HorizontalAlignment="Left" Width="Auto" Height="26" Source="/Images/logo.png" />
|
||||||
|
<!--<TextBlock Text="毒麻药品管理系统" Grid.Column="0" Margin="30 0 30 0" HorizontalAlignment="Left" Width="Auto" Height="26" Foreground="White" FontSize="20" FontWeight="Bold" />-->
|
||||||
|
|
||||||
<ListBox Name="ListBoxName" Grid.Column="1" SelectedItem="{Binding SelectedMenu}" ItemsSource="{Binding PremissionDmList}" HorizontalAlignment="Right">
|
<ListBox Name="ListBoxName" Grid.Column="1" SelectedItem="{Binding SelectedMenu}" ItemsSource="{Binding PremissionDmList}" HorizontalAlignment="Right">
|
||||||
<i:Interaction.Triggers>
|
<i:Interaction.Triggers>
|
||||||
<i:EventTrigger EventName="SelectionChanged">
|
<i:EventTrigger EventName="SelectionChanged">
|
||||||
|
|
|
@ -272,12 +272,12 @@
|
||||||
Binding="{Binding Quantity}"
|
Binding="{Binding Quantity}"
|
||||||
Header="库存"
|
Header="库存"
|
||||||
ElementStyle="{StaticResource MaterialDesignDataGridTextColumnStyle}"/>
|
ElementStyle="{StaticResource MaterialDesignDataGridTextColumnStyle}"/>
|
||||||
<DataGridTextColumn Width="100"
|
<!--<DataGridTextColumn Width="100"
|
||||||
Binding="{Binding AddQuantity}"
|
Binding="{Binding AddQuantity}"
|
||||||
Header="添加数量"
|
Header="添加数量"
|
||||||
IsReadOnly="True"
|
IsReadOnly="True"
|
||||||
ElementStyle="{StaticResource MaterialDesignDataGridTextColumnStyle}"/>
|
ElementStyle="{StaticResource MaterialDesignDataGridTextColumnStyle}"/>-->
|
||||||
<!--<DataGridTemplateColumn Width="60">
|
<DataGridTemplateColumn Width="60">
|
||||||
<DataGridTemplateColumn.Header>
|
<DataGridTemplateColumn.Header>
|
||||||
<TextBlock Text="添加数量" TextWrapping="Wrap"/>
|
<TextBlock Text="添加数量" TextWrapping="Wrap"/>
|
||||||
</DataGridTemplateColumn.Header>
|
</DataGridTemplateColumn.Header>
|
||||||
|
@ -294,7 +294,7 @@
|
||||||
</TextBox>
|
</TextBox>
|
||||||
</DataTemplate>
|
</DataTemplate>
|
||||||
</DataGridTemplateColumn.CellTemplate>
|
</DataGridTemplateColumn.CellTemplate>
|
||||||
</DataGridTemplateColumn>-->
|
</DataGridTemplateColumn>
|
||||||
|
|
||||||
</DataGrid.Columns>
|
</DataGrid.Columns>
|
||||||
</DataGrid>
|
</DataGrid>
|
||||||
|
|
|
@ -19,9 +19,9 @@
|
||||||
Topmost="False"
|
Topmost="False"
|
||||||
prism:ViewModelLocator.AutoWireViewModel="True"
|
prism:ViewModelLocator.AutoWireViewModel="True"
|
||||||
Title="主窗口" Height="768" Width="1024" WindowStyle="None" WindowState="Maximized">
|
Title="主窗口" Height="768" Width="1024" WindowStyle="None" WindowState="Maximized">
|
||||||
<WindowChrome.WindowChrome>
|
<!--<WindowChrome.WindowChrome>
|
||||||
<WindowChrome CornerRadius="4" GlassFrameThickness="1" />
|
<WindowChrome CornerRadius="4" GlassFrameThickness="1" />
|
||||||
</WindowChrome.WindowChrome>
|
</WindowChrome.WindowChrome>-->
|
||||||
|
|
||||||
<materialDesign:DialogHost
|
<materialDesign:DialogHost
|
||||||
DialogMargin="0"
|
DialogMargin="0"
|
||||||
|
|
|
@ -22,6 +22,7 @@
|
||||||
<convert:DrawerSelectConverter x:Key="DrawerSelectConverter" />
|
<convert:DrawerSelectConverter x:Key="DrawerSelectConverter" />
|
||||||
<convert:StatusConverter x:Key="StatusConverter" />-->
|
<convert:StatusConverter x:Key="StatusConverter" />-->
|
||||||
<convert:TotalCountConverter x:Key="TotalCountConverter" />
|
<convert:TotalCountConverter x:Key="TotalCountConverter" />
|
||||||
|
<convert:ColorCountConverter x:Key="ColorCountConverter" />
|
||||||
</Grid.Resources>
|
</Grid.Resources>
|
||||||
<Grid.RowDefinitions>
|
<Grid.RowDefinitions>
|
||||||
<RowDefinition Height="Auto" />
|
<RowDefinition Height="Auto" />
|
||||||
|
@ -120,7 +121,9 @@
|
||||||
<!--GroupStyle to group data-->
|
<!--GroupStyle to group data-->
|
||||||
<!--<DataGrid.GroupStyle>
|
<!--<DataGrid.GroupStyle>
|
||||||
<GroupStyle>
|
<GroupStyle>
|
||||||
--><!--Group DataItems into DataGroup--><!--
|
-->
|
||||||
|
<!--Group DataItems into DataGroup-->
|
||||||
|
<!--
|
||||||
<GroupStyle.ContainerStyle>
|
<GroupStyle.ContainerStyle>
|
||||||
<Style TargetType="{x:Type GroupItem}">
|
<Style TargetType="{x:Type GroupItem}">
|
||||||
<Setter Property="Template">
|
<Setter Property="Template">
|
||||||
|
@ -184,6 +187,20 @@
|
||||||
</DataTemplate>
|
</DataTemplate>
|
||||||
</DataGridTemplateColumn.CellTemplate>
|
</DataGridTemplateColumn.CellTemplate>
|
||||||
</DataGridTemplateColumn>
|
</DataGridTemplateColumn>
|
||||||
|
<!--<DataGridTemplateColumn Header="库存" IsReadOnly="True">
|
||||||
|
<DataGridTemplateColumn.CellTemplate>
|
||||||
|
<DataTemplate>
|
||||||
|
<ListBox ItemsSource="{Binding channelStocks}" materialDesign:ListBoxItemAssist.ShowSelection="False" >
|
||||||
|
<ItemsControl.ItemTemplate>
|
||||||
|
<DataTemplate>
|
||||||
|
<TextBlock Text="{Binding Quantity}" Foreground="{Binding Path=Quantity,Converter={StaticResource ColorCountConverter} }" />
|
||||||
|
</DataTemplate>
|
||||||
|
</ItemsControl.ItemTemplate>
|
||||||
|
</ListBox>
|
||||||
|
|
||||||
|
</DataTemplate>
|
||||||
|
</DataGridTemplateColumn.CellTemplate>
|
||||||
|
</DataGridTemplateColumn>-->
|
||||||
</DataGrid.Columns>
|
</DataGrid.Columns>
|
||||||
</DataGrid>
|
</DataGrid>
|
||||||
<!--<ListView Grid.Row="1"
|
<!--<ListView Grid.Row="1"
|
||||||
|
|
|
@ -0,0 +1,14 @@
|
||||||
|
using DM_Weight.Models;
|
||||||
|
using Prism.Events;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace DM_Weight.msg
|
||||||
|
{
|
||||||
|
internal class DelDrugManoEvent:PubSubEvent<ChannelStock>
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue