Compare commits

...

12 Commits

39 changed files with 435 additions and 185 deletions

3
.gitignore vendored
View File

@ -360,4 +360,5 @@ MigrationBackup/
.ionide/ .ionide/
# Fody - auto-generated XML schema # Fody - auto-generated XML schema
FodyWeavers.xsd FodyWeavers.xsd
/readme.txt

View File

@ -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;Pooling=false; ConnectionLifeTime=0;" /> <add name="database" connectionString="server=127.0.0.1;port=3306;database=hunanxianchang_db;userid=root;password=root;SslMode=none;Command Timeout=61;" />
</connectionStrings> </connectionStrings>
<!--<runtime> <!--<runtime>
--><!--配置之后Appdomain.CurrentDomain.UnhandledException 事件的 IsTerminating 就变成了 false 啦!也就是说,程序并不会因为这次的异常而崩溃退出。--><!-- --><!--配置之后Appdomain.CurrentDomain.UnhandledException 事件的 IsTerminating 就变成了 false 啦!也就是说,程序并不会因为这次的异常而崩溃退出。--><!--
@ -20,13 +20,13 @@
<!--2023/7/13 药房代码 有则写无则空 --> <!--2023/7/13 药房代码 有则写无则空 -->
<add key="storage" value="" /> <add key="storage" value="" />
<!-- 登录模式 1单人登录2双人登录 --> <!-- 登录模式 1单人登录2双人登录 -->
<add key="loginMode" value="1" /> <add key="loginMode" value="2" />
<!-- 登录顺序,指定先登录的人的名称有效值只有在登录模式等于2时才会生效 发药人【operator】审核人【reviewer】 --> <!-- 登录顺序,指定先登录的人的名称有效值只有在登录模式等于2时才会生效 发药人【operator】审核人【reviewer】 -->
<add key="firstLogin" value="operator" /> <add key="firstLogin" value="operator" />
<!-- 按处方还药或者按取药记录还药 1:处方2药品--> <!-- 按处方还药或者按取药记录还药 1:处方2药品-->
<add key="returnDrugMode" value="1" /> <add key="returnDrugMode" value="2" />
<!-- 自动退出时间单位秒为0时不自动退出 --> <!-- 自动退出时间单位秒为0时不自动退出 -->
<add key="autoExit" value="0"/> <add key="autoExit" value="300"/>
<!--报表数据库连接--> <!--报表数据库连接-->
<add key="gridConnectionString" value="MYSQL; Database=hunanxianchang_db; Password=root; Port=3306; Server=127.0.0.1; User=root;"/> <add key="gridConnectionString" value="MYSQL; Database=hunanxianchang_db; Password=root; Port=3306; Server=127.0.0.1; User=root;"/>
<!-- 查询处方是orderNo还是orderGroupNo --> <!-- 查询处方是orderNo还是orderGroupNo -->

View File

@ -38,17 +38,17 @@ namespace DM_Weight
public partial class App : PrismApplication public partial class App : PrismApplication
{ {
#region #region
private static UserList _currentFaUserList=new UserList(); private static UserList _currentFaUserList = new UserList();
public static UserList CurrentFaUserList public static UserList CurrentFaUserList
{ {
get => _currentFaUserList; get => _currentFaUserList;
set=> _currentFaUserList = value; set => _currentFaUserList = value;
} }
#endregion #endregion
#region #region
private static UserList _currentShenUserList= new UserList(); private static UserList _currentShenUserList = new UserList();
public static UserList CurrentShenUserList public static UserList CurrentShenUserList
{ {
get => _currentShenUserList; get => _currentShenUserList;
@ -89,7 +89,11 @@ namespace DM_Weight
foreach (Exception item in e.Exception.InnerExceptions) foreach (Exception item in e.Exception.InnerExceptions)
{ {
logger.Error($"异常类型:{item.GetType()}{Environment.NewLine}来自:{item.Source}{Environment.NewLine}异常内容:{item.Message}"); logger.Error($"异常类型:{item.StackTrace};{item.GetType()}{Environment.NewLine}来自:{item.Source}{Environment.NewLine}异常内容:{item.Message}");
//if (item.GetType() == typeof(SqlSugar.SqlSugarException))
//{
// UserList userList = new UserService().CheckUserByFingerPrinter(1);
//}
} }
//将异常标识为已经观察到 //将异常标识为已经观察到
@ -260,7 +264,7 @@ namespace DM_Weight
//containerRegistry.RegisterSingleton<SqlSugarScope>(() => SqlSugarHelperNew.GetInstance()); //containerRegistry.RegisterSingleton<SqlSugarScope>(() => SqlSugarHelperNew.GetInstance());
//账册页面 //账册页面
containerRegistry.RegisterForNavigation<AccountWindow,AccountWindowViewModel>(); containerRegistry.RegisterForNavigation<AccountWindow, AccountWindowViewModel>();
//账册服务类 //账册服务类
containerRegistry.Register<MachineRecordService>(); containerRegistry.Register<MachineRecordService>();
} }

View File

@ -1,4 +1,4 @@
using NetTaste; //using NetTaste;
using Prism.Commands; using Prism.Commands;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;

View File

@ -71,10 +71,9 @@
<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.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.152" />
<PackageReference Include="SuperSimpleTcp" Version="3.0.10" /> <PackageReference Include="SuperSimpleTcp" Version="3.0.10" />
<PackageReference Include="System.Drawing.Common" Version="7.0.0" /> <PackageReference Include="System.Drawing.Common" Version="7.0.0" />
<PackageReference Include="System.IO.Ports" Version="7.0.0" /> <PackageReference Include="System.IO.Ports" Version="7.0.0" />

View File

@ -20,7 +20,7 @@ namespace DM_Weight.Finger
{ {
private readonly ILog logger = LogManager.GetLogger(typeof(FingerprintUtil)); private readonly ILog logger = LogManager.GetLogger(typeof(FingerprintUtil));
public zkemkeeper.CZKEMClass axCZKEM1;// = new zkemkeeper.CZKEMClass(); public zkemkeeper.CZKEMClass axCZKEM1= new zkemkeeper.CZKEMClass();
public bool bIsConnected = false; public bool bIsConnected = false;
private string fingerIp = ConfigurationManager.AppSettings["fingerIp"]?.ToString() ?? ""; private string fingerIp = ConfigurationManager.AppSettings["fingerIp"]?.ToString() ?? "";
@ -42,7 +42,7 @@ namespace DM_Weight.Finger
{ {
try try
{ {
axCZKEM1 = new CZKEMClass(); //axCZKEM1 = new CZKEMClass();
bIsConnected = axCZKEM1.Connect_Net(fingerIp, fingerPort); bIsConnected = axCZKEM1.Connect_Net(fingerIp, fingerPort);
logger.Info($"连接指纹机,IP:{fingerIp},端口:{fingerPort},机器号:{machineNumber},连接结果:{bIsConnected}"); logger.Info($"连接指纹机,IP:{fingerIp},端口:{fingerPort},机器号:{machineNumber},连接结果:{bIsConnected}");
if (bIsConnected) if (bIsConnected)

View File

@ -39,6 +39,10 @@ namespace DM_Weight.Port
public SerialPort scanCodeSerial; public SerialPort scanCodeSerial;
// 抽屉串口协议232 | 485 // 抽屉串口协议232 | 485
private int _drawerProtocol = Convert.ToInt32(ConfigurationManager.AppSettings["DrawerProtocol"]); private int _drawerProtocol = Convert.ToInt32(ConfigurationManager.AppSettings["DrawerProtocol"]);
// can总线耗材板地址 // can总线耗材板地址

View File

@ -1,7 +1,9 @@
using DM_Weight.Models; using DM_Weight.Models;
using log4net; using log4net;
using log4net.Repository.Hierarchy; using log4net.Repository.Hierarchy;
using MySqlConnector; //using MySql.Data.MySqlClient;
//using MySql.Data.MySqlClient;
//using MySqlConnector;
using Newtonsoft.Json; using Newtonsoft.Json;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
@ -15,91 +17,86 @@ namespace DM_Weight.Services
{ {
public class UserService public class UserService
{ {
private readonly ILog logger = LogManager.GetLogger(typeof(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))
{ // //{
logger.Info($"connStr{connStr}"); // // logger.Info($"connStr{connStr}");
//try // // try
//{ // // {
// con.Open(); // // con.Open();
//} // // }
//catch (Exception ex) // // catch (Exception ex)
//{ // // {
// logger.Info($"Open失败{ex.ToString()}"); // // con.Close();
// if (con.State == System.Data.ConnectionState.Open) // // logger.Info($"Open失败{ex.ToString()};连接状态:{con.State}");
// { // // logger.Info("再次Open");
// con.Close(); // // con.Open();
// } // // }
// Thread.Sleep(200); // //connOpen(con);
// logger.Info("再次Open"); // //Thread.Sleep(10);
// con.Open(); // //while (con.State != System.Data.ConnectionState.Open)
//} // //{
connOpen(con); // // logger.Info($"再次Open:{con.State}");
Thread.Sleep(100); // // connOpen(con);
while(con.State != System.Data.ConnectionState.Open) // // Thread.Sleep(10);
{ // //}
logger.Info($"再次Open:{con.State}");
connOpen(con);
Thread.Sleep(100);
}
logger.Info("数据库连接已打开"); // //logger.Info($"数据库连接状态{con.State}");
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读数据"); // //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}"); // //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}");
}
});
}
//}
//private Task connOpen(MySqlConnection con)
//{
// return Task.Run(() =>
// {
// if (con.State != System.Data.ConnectionState.Closed)
// {
// con.Close();
// }
// try
// {
// con.Open();
// }
// catch (Exception ex)
// {
// logger.Info($"Open失败{ex.Message}");
// }
// });
//}
} }
} }

View File

@ -252,11 +252,13 @@ namespace DM_Weight.ViewModels
Id = it.Id, Id = it.Id,
DrugId= it.DrugId, DrugId= it.DrugId,
}).UpdateColumns(it => new { it.Quantity, it.ManuNo, it.EffDate,it.DrugId }).ExecuteCommand(); }).UpdateColumns(it => new { it.Quantity, it.ManuNo, it.EffDate,it.DrugId }).ExecuteCommand();
} }
else else
{ {
//如果批号重复则不让添加 //如果批号重复则不让添加
List<ChannelStock> csCount = SqlSugarHelper.Db.Queryable<ChannelStock>().Where(cs => cs.DrawerNo == it.DrawerNo && cs.ManuNo == it.ManuNo && cs.MachineId.Equals(ConfigurationManager.AppSettings["machineId"] ?? "DM1")).ToList(); List<ChannelStock> csCount = SqlSugarHelper.Db.Queryable<ChannelStock>().Where(cs => cs.DrawerNo == it.DrawerNo && cs.ManuNo == it.ManuNo && cs.MachineId.Equals(ConfigurationManager.AppSettings["machineId"] ?? "DM1")).ToList();
if (csCount.Count > 0) if (csCount.Count > 0)
{ {
//repeatList.Add(it.ManuNo); //repeatList.Add(it.ManuNo);
@ -279,6 +281,8 @@ namespace DM_Weight.ViewModels
Id = Guid.NewGuid().ToString(), Id = Guid.NewGuid().ToString(),
MachineId = ConfigurationManager.AppSettings["machineId"] ?? "DM1" MachineId = ConfigurationManager.AppSettings["machineId"] ?? "DM1"
}).ExecuteCommand(); }).ExecuteCommand();
} }
// 获取更新完库存后的药品库存 // 获取更新完库存后的药品库存
List<ChannelStock> nowChannels = SqlSugarHelper.Db.Queryable<ChannelStock>() List<ChannelStock> nowChannels = SqlSugarHelper.Db.Queryable<ChannelStock>()
@ -307,7 +311,8 @@ namespace DM_Weight.ViewModels
}).ExecuteCommand(); }).ExecuteCommand();
} }
return true; return true;
}); });
//ChannelStocks.Clear(); //ChannelStocks.Clear();
if (stockRepeats.Count == record.Count) if (stockRepeats.Count == record.Count)
{ {
@ -387,6 +392,8 @@ namespace DM_Weight.ViewModels
} }
else else
{ {
logger.Info($"多批次抽屉加药,库存更新失败!{f.ErrorMessage}");
AlertMsg alertMsg = new AlertMsg AlertMsg alertMsg = new AlertMsg
{ {
Message = "更新库存失败", Message = "更新库存失败",
@ -484,7 +491,9 @@ namespace DM_Weight.ViewModels
{ {
//删除ChannelStock表中该批次数据 //删除ChannelStock表中该批次数据
int isOk = SqlSugarHelper.Db.Deleteable<ChannelStock>().Where(cs => cs.DrugId == cstock.DrugId && cs.ManuNo == cs.ManuNo).ExecuteCommand(); int isOk = SqlSugarHelper.Db.Deleteable<ChannelStock>().Where(cs => cs.DrugId == cstock.DrugId && cs.ManuNo == cs.ManuNo).ExecuteCommand();
if(isOk>0 )
if (isOk>0 )
{ {
logger.Info($"删除{cstock.DrawerNo}-{cstock.ColNo}抽屉中药品{cstock.DrugId}下的批次{cstock.ManuNo},"); logger.Info($"删除{cstock.DrawerNo}-{cstock.ColNo}抽屉中药品{cstock.DrugId}下的批次{cstock.ManuNo},");
AlertMsg alertMsg = new AlertMsg AlertMsg alertMsg = new AlertMsg
@ -517,6 +526,8 @@ namespace DM_Weight.ViewModels
Is8Drawer = count < 9; Is8Drawer = count < 9;
Is16Drawer = count >= 16; Is16Drawer = count >= 16;
Is17Drawer = count > 16; Is17Drawer = count > 16;
} }
//这个方法用于拦截请求,continuationCallback(true)就是不拦截continuationCallback(false)拦截本次操作 //这个方法用于拦截请求,continuationCallback(true)就是不拦截continuationCallback(false)拦截本次操作

View File

@ -23,7 +23,7 @@ namespace DM_Weight.ViewModels
{ {
public class BindingChannelDialogViewModel : BindableBase, IDialogAware public class BindingChannelDialogViewModel : BindableBase, IDialogAware
{ {
private readonly ILog logger = LogManager.GetLogger(typeof(HomeWindowViewModel));
public string Title => "库位绑定"; public string Title => "库位绑定";
public event Action<IDialogResult> RequestClose; public event Action<IDialogResult> RequestClose;
@ -112,6 +112,8 @@ namespace DM_Weight.ViewModels
{ {
//DrugList = SqlSugarHelper.Db.Queryable<DrugInfo>().Includes<DrugManuNo>(di => di.DrugManuNos).Where(di => di.PyCode.Contains(pycode)).OrderBy(di => di.DrugId).ToList(); //DrugList = SqlSugarHelper.Db.Queryable<DrugInfo>().Includes<DrugManuNo>(di => di.DrugManuNos).Where(di => di.PyCode.Contains(pycode)).OrderBy(di => di.DrugId).ToList();
DrugList = SqlSugarHelper.Db.Queryable<DrugInfo>().Includes<DrugManuNo>(di => di.DrugManuNos).Where(di => di.PyCode.Contains(pycode)).OrderBy(di => di.DrugId).ToList(); DrugList = SqlSugarHelper.Db.Queryable<DrugInfo>().Includes<DrugManuNo>(di => di.DrugManuNos).Where(di => di.PyCode.Contains(pycode)).OrderBy(di => di.DrugId).ToList();
} }
else else
{ {
@ -212,7 +214,8 @@ namespace DM_Weight.ViewModels
//var list = SqlSugarHelper.Db.Queryable<DrugInfo>().Includes<DrugManuNo>(di => di.DrugManuNos).OrderBy(di => di.DrugId).ToList(); //var list = SqlSugarHelper.Db.Queryable<DrugInfo>().Includes<DrugManuNo>(di => di.DrugManuNos).OrderBy(di => di.DrugId).ToList();
var list = SqlSugarHelper.Db.Queryable<DrugInfo>().Includes<DrugManuNo>(di => di.DrugManuNos).OrderBy(di => di.DrugId).ToList(); var list = SqlSugarHelper.Db.Queryable<DrugInfo>().Includes<DrugManuNo>(di => di.DrugManuNos).OrderBy(di => di.DrugId).ToList();
DrugInfos = list; DrugInfos = list;
DrugInfos_PY = list; DrugInfos_PY = list;
} }
private void GetChannelsByDrawerNo() private void GetChannelsByDrawerNo()
@ -235,6 +238,7 @@ namespace DM_Weight.ViewModels
.ToPageList(PageNum, PageSize, ref totalCount); .ToPageList(PageNum, PageSize, ref totalCount);
Channels = list; Channels = list;
TotalCount = totalCount; TotalCount = totalCount;
} }
public void OnDialogOpened(IDialogParameters parameters) public void OnDialogOpened(IDialogParameters parameters)
{ {
@ -269,6 +273,7 @@ namespace DM_Weight.ViewModels
if (DrugInfo != null) if (DrugInfo != null)
{ {
int count = SqlSugarHelper.Db.Queryable<ChannelStock>().Where(cs => cs.DrugId.Equals(DrugInfo.DrugId.ToString())).Where(cs => cs.DrawerType != 1).Where(cs => cs.MachineId.Equals(ConfigurationManager.AppSettings["machineId"] ?? "DM1")).Count(); int count = SqlSugarHelper.Db.Queryable<ChannelStock>().Where(cs => cs.DrugId.Equals(DrugInfo.DrugId.ToString())).Where(cs => cs.DrawerType != 1).Where(cs => cs.MachineId.Equals(ConfigurationManager.AppSettings["machineId"] ?? "DM1")).Count();
if (count == 0) if (count == 0)
{ {
var item = SelectChannels[0]; var item = SelectChannels[0];

View File

@ -26,6 +26,7 @@ namespace DM_Weight.ViewModels
{ {
public class BindingChannelNewDialogViewModel : BindableBase, IDialogAware, IRegionMemberLifetime public class BindingChannelNewDialogViewModel : BindableBase, IDialogAware, IRegionMemberLifetime
{ {
private readonly ILog logger = LogManager.GetLogger(typeof(HomeWindowViewModel));
public string Title => "库位绑定"; public string Title => "库位绑定";
@ -145,6 +146,7 @@ namespace DM_Weight.ViewModels
if (string.IsNullOrEmpty(text)) if (string.IsNullOrEmpty(text))
{ {
DrugInfos = SqlSugarHelper.Db.SqlQueryable<DrugInfo>(str).OrderBy(di => di.DrugName).OrderBy(di => di.DrugId).ToList(); DrugInfos = SqlSugarHelper.Db.SqlQueryable<DrugInfo>(str).OrderBy(di => di.DrugName).OrderBy(di => di.DrugId).ToList();
return; return;
} }
if (DrugInfos != null) if (DrugInfos != null)
@ -153,7 +155,7 @@ namespace DM_Weight.ViewModels
} }
DrugInfos = SqlSugarHelper.Db.SqlQueryable<DrugInfo>(str).Where(di => di.DrugName.Contains(text) || di.PyCode.Contains(text) || di.DrugId.Contains(text)).OrderBy(di => di.DrugName).OrderBy(di => di.DrugId).ToList(); DrugInfos = SqlSugarHelper.Db.SqlQueryable<DrugInfo>(str).Where(di => di.DrugName.Contains(text) || di.PyCode.Contains(text) || di.DrugId.Contains(text)).OrderBy(di => di.DrugName).OrderBy(di => di.DrugId).ToList();
} }
//private List<DrugInfo>? _drugInfos; //private List<DrugInfo>? _drugInfos;

View File

@ -3,6 +3,7 @@ using DM_Weight.msg;
using DM_Weight.Port; using DM_Weight.Port;
using DM_Weight.Report; using DM_Weight.Report;
using DM_Weight.util; using DM_Weight.util;
using log4net;
using Prism.Commands; using Prism.Commands;
using Prism.Events; using Prism.Events;
using Prism.Mvvm; using Prism.Mvvm;
@ -22,6 +23,8 @@ namespace DM_Weight.ViewModels
{ {
public class CheckRecordDetailDialogViewModel : BindableBase, IDialogAware, IRegionMemberLifetime public class CheckRecordDetailDialogViewModel : BindableBase, IDialogAware, IRegionMemberLifetime
{ {
private readonly ILog logger = LogManager.GetLogger(typeof(CheckRecordDetailDialogViewModel));
public string Title => "盘点记录明细"; public string Title => "盘点记录明细";
private int _pageNum = 1; private int _pageNum = 1;
public int PageNum public int PageNum
@ -159,6 +162,7 @@ namespace DM_Weight.ViewModels
List<CheckRecordStock> checkList = SqlSugarHelper.Db.Queryable<CheckRecordStock>() List<CheckRecordStock> checkList = SqlSugarHelper.Db.Queryable<CheckRecordStock>()
.Includes<DrugInfo>(cs => cs.DrugInfo) .Includes<DrugInfo>(cs => cs.DrugInfo)
.Where(cs => cs.optdate == OptDate).OrderByDescending(cs => cs.optdate).ToList(); .Where(cs => cs.optdate == OptDate).OrderByDescending(cs => cs.optdate).ToList();
ICollectionView vw = CollectionViewSource.GetDefaultView(checkList); ICollectionView vw = CollectionViewSource.GetDefaultView(checkList);
vw.GroupDescriptions.Add(new PropertyGroupDescription("DrugInfo")); vw.GroupDescriptions.Add(new PropertyGroupDescription("DrugInfo"));
obsCheckRecordStock = new ObservableCollection<CheckRecordStock>(checkList); obsCheckRecordStock = new ObservableCollection<CheckRecordStock>(checkList);

View File

@ -2,6 +2,7 @@
using DM_Weight.Port; using DM_Weight.Port;
using DM_Weight.Report; using DM_Weight.Report;
using DM_Weight.util; using DM_Weight.util;
using log4net;
using Prism.Commands; using Prism.Commands;
using Prism.Events; using Prism.Events;
using Prism.Mvvm; using Prism.Mvvm;
@ -21,6 +22,8 @@ namespace DM_Weight.ViewModels
{ {
public class CheckRecordNewWindowViewModel : BindableBase, INavigationAware, IRegionMemberLifetime public class CheckRecordNewWindowViewModel : BindableBase, INavigationAware, IRegionMemberLifetime
{ {
private readonly ILog logger = LogManager.GetLogger(typeof(CheckRecordNewWindowViewModel));
private int _pageNum = 1; private int _pageNum = 1;
public int PageNum public int PageNum
{ {
@ -168,6 +171,7 @@ namespace DM_Weight.ViewModels
OPTSTARTDATE = StartDate, OPTSTARTDATE = StartDate,
OPTENDDATE = EndDate OPTENDDATE = EndDate
}).ToPageList(PageNum, PageSize, ref totalCount); }).ToPageList(PageNum, PageSize, ref totalCount);
//SqlSugarHelper.Db.ThenMapper(checkList, item => //SqlSugarHelper.Db.ThenMapper(checkList, item =>
//{ //{
// //item.drugDetails = SqlSugarHelper.Db.Queryable<CheckRecordStock>().SetContext(x => x.optdate, () => item.optdate, item).ToList(); // //item.drugDetails = SqlSugarHelper.Db.Queryable<CheckRecordStock>().SetContext(x => x.optdate, () => item.optdate, item).ToList();

View File

@ -590,8 +590,8 @@ namespace DM_Weight.ViewModels
public void OnNavigatedTo(NavigationContext navigationContext) public void OnNavigatedTo(NavigationContext navigationContext)
{ {
_eventAggregator.GetEvent<PortUtilEvent>().Subscribe(DoMyPrismEvent); _eventAggregator.GetEvent<PortUtilEvent>().Subscribe(DoMyPrismEvent);
Task.Factory.StartNew(() => { RequestData(); }); //Task.Factory.StartNew(() => { RequestData(); });
//RequestData(); RequestData();
} }

View File

@ -721,8 +721,6 @@ namespace DM_Weight.ViewModels
{ {
ChannelStocks.Clear(); ChannelStocks.Clear();
ChannelStocks.Clear();
List<ChannelStock> q = SqlSugarHelper.Db.Queryable<ChannelStock>() List<ChannelStock> q = SqlSugarHelper.Db.Queryable<ChannelStock>()
.Includes<DrugInfo>(cs => cs.DrugInfo) .Includes<DrugInfo>(cs => cs.DrugInfo)
.InnerJoin<ChannelList>((cs, cl) => cs.Chnguid == cl.Id && cs.DrugId == cl.DrugId) .InnerJoin<ChannelList>((cs, cl) => cs.Chnguid == cl.Id && cs.DrugId == cl.DrugId)
@ -746,8 +744,8 @@ namespace DM_Weight.ViewModels
public void OnNavigatedTo(NavigationContext navigationContext) public void OnNavigatedTo(NavigationContext navigationContext)
{ {
_eventAggregator.GetEvent<PortUtilEvent>().Subscribe(DoMyPrismEvent); _eventAggregator.GetEvent<PortUtilEvent>().Subscribe(DoMyPrismEvent);
Task.Factory.StartNew(() => { RequestData(); }); //Task.Factory.StartNew(() => { RequestData(); });
//RequestData(); RequestData();
} }

View File

@ -293,6 +293,7 @@ namespace DM_Weight.ViewModels
} }
else else
{ {
logger.Info($"抽屉加药,库存更新失败!{f.ErrorMessage}");
AlertMsg alertMsg = new AlertMsg AlertMsg alertMsg = new AlertMsg
{ {
Message = "更新库存失败", Message = "更新库存失败",
@ -384,6 +385,7 @@ namespace DM_Weight.ViewModels
return cs; return cs;
}).ToList(); }).ToList();
//obChannelStock = new ObservableCollection<ChannelStock>(ChannelStocks); //obChannelStock = new ObservableCollection<ChannelStock>(ChannelStocks);
} }

View File

@ -308,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}",
@ -381,6 +382,7 @@ namespace DM_Weight.ViewModels
.OrderBy(cs => cs.EffDate) .OrderBy(cs => cs.EffDate)
.ToList(); .ToList();
ChannelStocks = queryData; ChannelStocks = queryData;
} }
//接收导航传过来的参数 现在是在此处初始化了表格数据 //接收导航传过来的参数 现在是在此处初始化了表格数据

View File

@ -35,6 +35,8 @@ namespace DM_Weight.ViewModels
private UserList? _userList; private UserList? _userList;
private UserList? _userList2; private UserList? _userList2;
private int loginMode = Convert.ToInt32(ConfigurationManager.AppSettings["loginMode"]?.ToString() ?? "1"); private int loginMode = Convert.ToInt32(ConfigurationManager.AppSettings["loginMode"]?.ToString() ?? "1");
public bool MultiLogin public bool MultiLogin
{ {
@ -389,14 +391,22 @@ namespace DM_Weight.ViewModels
// 30秒内无人操作鼠标键盘 // 30秒内无人操作鼠标键盘
if ((DateTime.Now - _portUtil.dateTime).TotalSeconds > autoExit && CheckComputerFreeState.GetLastInputTime() > autoExit) if ((DateTime.Now - _portUtil.dateTime).TotalSeconds > autoExit && CheckComputerFreeState.GetLastInputTime() > autoExit)
{ {
logger.Info($"设备30秒内无人操作用户【{Operator?.Nickname}】自动退出登录"); if (Operator is null)
Operator = null;
Reviewer = null;
Application.Current.Dispatcher.Invoke(() =>
{ {
_regionManager.RequestNavigate("MainRegion", "LoginWindow");
timer.Stop(); timer.Stop();
}); }
else
{
logger.Info($"设备{autoExit}秒内无人操作,用户【{Operator?.Nickname}】自动退出登录");
Operator = null;
Reviewer = null;
timer.Stop();
Application.Current.Dispatcher.Invoke(() =>
{
_regionManager.RequestNavigate("MainRegion", "LoginWindow");
timer.Stop();
});
}
} }
} }
}; };

View File

@ -308,7 +308,7 @@ namespace DM_Weight.ViewModels
//.Includes(cl => cl.channelStocks, dr => dr.DrugInfo, d => d.DrugManuNos) //.Includes(cl => cl.channelStocks, dr => dr.DrugInfo, d => d.DrugManuNos)
.Where(cl => cl.DrugId == invoices[i].DrugId && cl.MachineId == (ConfigurationManager.AppSettings["machineId"] ?? "DM1")).ToList(); .Where(cl => cl.DrugId == invoices[i].DrugId && cl.MachineId == (ConfigurationManager.AppSettings["machineId"] ?? "DM1")).ToList();
ChannelList channelLst = channelL.Count > 0 ? channelL[0] : null; ChannelList channelLst = channelL.Count > 0 ? channelL[0] : null;
if (channelLst == null || channelLst.Id is null) if (channelL.Count <= 0)
{ {
//药品未绑定库位,需要先绑药 //药品未绑定库位,需要先绑药
//AlertMsg alertMsg = new AlertMsg //AlertMsg alertMsg = new AlertMsg
@ -343,18 +343,45 @@ namespace DM_Weight.ViewModels
_eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg); _eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
continue; continue;
} }
ChannelStock stock = new ChannelStock(); //没有根据药品绑定库位写入数据
//没有库存写入一条数据 for (int k = 0; k < channelL.Count; k++)
stock.MachineId = ConfigurationManager.AppSettings["machineId"] ?? "DM1"; {
stock.DrawerNo = channelLst.DrawerNo;
stock.BoardType = channelLst.BoardType; ChannelStock stock = new ChannelStock();
stock.DrawerType = channelLst.DrawerType; stock.MachineId = ConfigurationManager.AppSettings["machineId"] ?? "DM1";
stock.ColNo = channelLst.ColNo; stock.DrawerNo = channelL[k].DrawerNo;
stock.DrugId = channelLst.DrugId; stock.BoardType = channelL[k].BoardType;
stock.ManuNo = invoicesManuNo[j].DrugManuNo; stock.DrawerType = channelL[k].DrawerType;
stock.EffDate = manuNoList[0].EffDate; stock.ColNo = channelL[k].ColNo;
stock.Chnguid = channelLst.Id; stock.DrugId = channelL[k].DrugId;
stockList.Add(stock); stock.ManuNo = invoicesManuNo[j].DrugManuNo;
stock.EffDate = manuNoList[0].EffDate;
stock.Chnguid = channelL[k].Id;
stockList.Add(stock);
}
}
else
{
//药品有库存,则除了将对应药品批次数据列出来外,还要将当前已绑定的药品下添加上该批次
for (int k = 0; k < channelL.Count; k++)
{
//有库存且批次抽屉库位与将要插入的批次抽屉库位一致则跳过
if(stockList.Where(t=>t.ManuNo== invoicesManuNo[j].DrugManuNo&&t.ColNo== channelL[k].ColNo&&t.DrawerNo== channelL[k].DrawerNo).FirstOrDefault()!=null)
{
continue;
}
ChannelStock stock = new ChannelStock();
stock.MachineId = ConfigurationManager.AppSettings["machineId"] ?? "DM1";
stock.DrawerNo = channelL[k].DrawerNo;
stock.BoardType = channelL[k].BoardType;
stock.DrawerType = channelL[k].DrawerType;
stock.ColNo = channelL[k].ColNo;
stock.DrugId = channelL[k].DrugId;
stock.ManuNo = invoicesManuNo[j].DrugManuNo;
stock.EffDate = manuNoList[0].EffDate;
stock.Chnguid = channelL[k].Id;
stockList.Add(stock);
}
} }
//stock.AddQuantity = invoicesManuNo[j].quantity; //stock.AddQuantity = invoicesManuNo[j].quantity;
//stockList.ForEach(s => s.AddQuantity = invoicesManuNo[j].quantity); //stockList.ForEach(s => s.AddQuantity = invoicesManuNo[j].quantity);
@ -506,7 +533,7 @@ namespace DM_Weight.ViewModels
if (!_isFinishClick) if (!_isFinishClick)
{ {
_isFinishClick = true; _isFinishClick = true;
List<ChannelStock> record = ChannelStocks.ToList(); List<ChannelStock> record = ChannelStocks.Where(it=>it.AddQuantity>0).ToList();
string InvoiceId = SelectedInvoice.InvoiceNo; string InvoiceId = SelectedInvoice.InvoiceNo;
var f = SqlSugarHelper.Db.UseTran(() => var f = SqlSugarHelper.Db.UseTran(() =>
{ {
@ -542,6 +569,7 @@ namespace DM_Weight.ViewModels
List<ChannelStock> csCount = SqlSugarHelper.Db.Queryable<ChannelStock>().Where(cs => cs.DrawerNo == it.DrawerNo && cs.ColNo == it.ColNo && cs.ManuNo == it.ManuNo && cs.MachineId.Equals(ConfigurationManager.AppSettings["machineId"] ?? "DM1") && cs.Quantity > 0).ToList(); List<ChannelStock> csCount = SqlSugarHelper.Db.Queryable<ChannelStock>().Where(cs => cs.DrawerNo == it.DrawerNo && cs.ColNo == it.ColNo && cs.ManuNo == it.ManuNo && cs.MachineId.Equals(ConfigurationManager.AppSettings["machineId"] ?? "DM1") && cs.Quantity > 0).ToList();
if (csCount.Count > 0) if (csCount.Count > 0)
{ {
logger.Info($"批号重复:{it.DrawerNo}-{it.ColNo}-{it.ManuNo}");
//repeatList.Add(it.ManuNo); //repeatList.Add(it.ManuNo);
//stockRepeats.Add(it); //stockRepeats.Add(it);
continue; continue;
@ -635,22 +663,22 @@ namespace DM_Weight.ViewModels
{ {
//if (singleChannels[i].BoardType == 5) //if (singleChannels[i].BoardType == 5)
//{ //{
List<ChannelStock> channelStockEffDate = SqlSugarHelper.Db.Queryable<ChannelStock>() List<ChannelStock> channelStockEffDate = SqlSugarHelper.Db.Queryable<ChannelStock>()
.Where(cs => cs.MachineId == singleChannels[i].MachineId) .Where(cs => cs.MachineId == singleChannels[i].MachineId)
.Where(cs => cs.DrawerNo == singleChannels[i].DrawerNo) .Where(cs => cs.DrawerNo == singleChannels[i].DrawerNo)
.Where(cs => cs.ColNo == singleChannels[i].ColNo) .Where(cs => cs.ColNo == singleChannels[i].ColNo)
.Where(cs=>cs.Quantity>0) .Where(cs => cs.Quantity > 0)
.OrderBy(cs => cs.EffDate).ToList(); .OrderBy(cs => cs.EffDate).ToList();
int totalQuantity = channelStockEffDate.Sum(it => it.Quantity); int totalQuantity = channelStockEffDate.Sum(it => it.Quantity);
//将库位多批次的总库存数更新标签 //将库位多批次的总库存数更新标签
_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);
//} //}
} }
} }
@ -667,6 +695,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 = "库存更新失败!",
@ -776,7 +805,7 @@ namespace DM_Weight.ViewModels
.Select(it => new Invoice()) .Select(it => new Invoice())
.Select("*") .Select("*")
.ToPageList(PageNum, PageSize, ref totalCount); .ToPageList(PageNum, PageSize, ref totalCount);
TotalCount = totalCount; TotalCount = totalCount;
PageCount = (int)Math.Ceiling((double)TotalCount / PageSize); PageCount = (int)Math.Ceiling((double)TotalCount / PageSize);
} }

View File

@ -1,6 +1,6 @@
using log4net; using log4net;
using Microsoft.Xaml.Behaviors; using Microsoft.Xaml.Behaviors;
using NetTaste; //using NetTaste;
using Prism.Commands; using Prism.Commands;
using Prism.Events; using Prism.Events;
using Prism.Mvvm; using Prism.Mvvm;

View File

@ -43,7 +43,7 @@ namespace DM_Weight.ViewModels
private int loginMode = Convert.ToInt32(ConfigurationManager.AppSettings["loginMode"]?.ToString() ?? "1"); private int loginMode = Convert.ToInt32(ConfigurationManager.AppSettings["loginMode"]?.ToString() ?? "1");
private string firstLogin = ConfigurationManager.AppSettings["firstLogin"]?.ToString() ?? "operator"; private string firstLogin = ConfigurationManager.AppSettings["firstLogin"]?.ToString() ?? "operator";
public bool SingleLogin public bool SingleLogin
{ {
get => ReadAppSetting("loginMode") == "1"; get => ReadAppSetting("loginMode") == "1";
@ -150,7 +150,7 @@ _exitCommand ??= new DelegateCommand(Exit);
.Includes<RoleDm>(u => u.Role) .Includes<RoleDm>(u => u.Role)
.First(u => u.UserName == username && ConfigurationManager.AppSettings["machineId"].ToString().Equals(u.MachineId)); .First(u => u.UserName == username && ConfigurationManager.AppSettings["machineId"].ToString().Equals(u.MachineId));
//UserList userList =new UserService().CheckUserByFingerPrinter(msg.Id);
//UserList userList = SqlSugarHelper.Db.Queryable<UserList>() //UserList userList = SqlSugarHelper.Db.Queryable<UserList>()
// .Includes<RoleDm>(u => u.Role) // .Includes<RoleDm>(u => u.Role)
// .InnerJoin<RoleDm>((u, r) => u.RoleId == r.Id) // .InnerJoin<RoleDm>((u, r) => u.RoleId == r.Id)
@ -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)
@ -378,7 +378,11 @@ _exitCommand ??= new DelegateCommand(Exit);
} }
catch (Exception e) catch (Exception e)
{ {
logger.Info($"LoginEvent存在异常:{e.Message}"); logger.Info($"LoginEvent存在异常:{e.Message};数据库连接字符串:{ConfigurationManager.ConnectionStrings["database"].ToString()}");
//if(e.GetType().Name== "SqlSugarException")
//{
// UserList userList = new UserService().CheckUserByFingerPrinter(1);
//}
} }
} }

View File

@ -85,7 +85,7 @@ namespace DM_Weight.ViewModels
})); }));
Task.Factory.StartNew(() => BindStock()); //Task.Factory.StartNew(() => BindStock());
} }
void doMyPrismEvent2(AlertMsg msg) void doMyPrismEvent2(AlertMsg msg)

View File

@ -1,7 +1,7 @@
using log4net; using log4net;
using log4net.Repository.Hierarchy; using log4net.Repository.Hierarchy;
using Microsoft.Xaml.Behaviors; using Microsoft.Xaml.Behaviors;
using NetTaste; //using NetTaste;
using Prism.Commands; using Prism.Commands;
using Prism.Events; using Prism.Events;
using Prism.Mvvm; using Prism.Mvvm;

View File

@ -1,6 +1,6 @@
using log4net; using log4net;
using Microsoft.Xaml.Behaviors; using Microsoft.Xaml.Behaviors;
using NetTaste; //using NetTaste;
using Prism.Commands; using Prism.Commands;
using Prism.Events; using Prism.Events;
using Prism.Mvvm; using Prism.Mvvm;
@ -21,6 +21,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.Windows.Controls.Primitives;
namespace DM_Weight.ViewModels namespace DM_Weight.ViewModels
{ {
@ -171,6 +172,7 @@ 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)
@ -330,7 +332,7 @@ namespace DM_Weight.ViewModels
{ {
string InvoiceId = OrderInfo.OrderNo; string InvoiceId = OrderInfo.OrderNo;
try try
{ {
SqlSugarHelper.Db.BeginTran(); SqlSugarHelper.Db.BeginTran();
logger.Info($"更新OrderInfo:{InvoiceId}"); logger.Info($"更新OrderInfo:{InvoiceId}");
SqlSugarHelper.Db.Updateable(new OrderInfo() SqlSugarHelper.Db.Updateable(new OrderInfo()
@ -338,7 +340,9 @@ namespace DM_Weight.ViewModels
DmStatus = 1, DmStatus = 1,
OrderNo = OrderInfo.OrderNo OrderNo = OrderInfo.OrderNo
}).UpdateColumns(it => new { it.DmStatus }).WhereColumns(it => new { it.OrderNo }).ExecuteCommand(); }).UpdateColumns(it => new { it.DmStatus }).WhereColumns(it => new { it.OrderNo }).ExecuteCommand();
logger.Info($"Task.Delay前:{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff")}");
Task.Delay(4000).Wait();
logger.Info($"Task.Delay后:{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff")}");
logger.Info("进入record循环"); logger.Info("进入record循环");
for (int i = 0; i < record.Count; i++) for (int i = 0; i < record.Count; i++)
{ {
@ -389,8 +393,8 @@ namespace DM_Weight.ViewModels
logger.Info("事务已提交"); logger.Info("事务已提交");
// 更新屏显库存 // 更新屏显库存
//List<ChannelStock> singleChannels = record.FindAll(it => it.BoardType != 1); //List<ChannelStock> singleChannels = record.FindAll(it => it.BoardType != 1);
Task.Factory.StartNew(() => //Task.Run(() =>
{ //{
List<ChannelStock> singleChannels = record.Where(it => it.BoardType == 5) 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 =>
@ -439,7 +443,7 @@ namespace DM_Weight.ViewModels
}; };
_eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg); _eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
})); }));
}); //});
} }
catch (Exception ex) catch (Exception ex)
@ -451,7 +455,8 @@ namespace DM_Weight.ViewModels
Message = "抽屉取药完成,库存更新失败!", Message = "抽屉取药完成,库存更新失败!",
Type = MsgType.ERROR, Type = MsgType.ERROR,
}; };
_eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg); _eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
_isFinishClick = false;
} }
//var f = SqlSugarHelper.Db.UseTran(() => //var f = SqlSugarHelper.Db.UseTran(() =>

View File

@ -225,6 +225,8 @@ namespace DM_Weight.ViewModels
logger.Info("开始OrderTakeDrugWindowViewModel_查询数据"); logger.Info("开始OrderTakeDrugWindowViewModel_查询数据");
OrderInfos.Clear(); OrderInfos.Clear();
int totalCount = 0; int totalCount = 0;
//logger.Info($"SqlSugarHelper.Db.Ado.Connection.GetHashCode():{_db.Ado.Connection.GetHashCode()}");
List<OrderInfo> queryData = SqlSugarHelper.Db.Queryable<OrderInfo>() List<OrderInfo> queryData = SqlSugarHelper.Db.Queryable<OrderInfo>()
.InnerJoin<OrderDetail>((oi, od) => oi.OrderNo == od.OrderNo) .InnerJoin<OrderDetail>((oi, od) => oi.OrderNo == od.OrderNo)
.InnerJoin(SqlSugarHelper.Db.Queryable<ChannelList>().Where(cs => cs.DrawerType == 1).Where(cs => cs.MachineId.Equals(ConfigurationManager.AppSettings["machineId"] ?? "DM1")).GroupBy(cs => cs.DrugId), (oi, od, t) => od.DrugId == t.DrugId) .InnerJoin(SqlSugarHelper.Db.Queryable<ChannelList>().Where(cs => cs.DrawerType == 1).Where(cs => cs.MachineId.Equals(ConfigurationManager.AppSettings["machineId"] ?? "DM1")).GroupBy(cs => cs.DrugId), (oi, od, t) => od.DrugId == t.DrugId)
@ -242,7 +244,7 @@ namespace DM_Weight.ViewModels
OrderInfos = queryData; OrderInfos = queryData;
TotalCount = totalCount; TotalCount = totalCount;
PageCount = (int)Math.Ceiling((double)TotalCount / PageSize); PageCount = (int)Math.Ceiling((double)TotalCount / PageSize);
logger.Info($"_db.Ado.Connection.GetHashCode():{SqlSugarHelper.Db.Ado.Connection.GetHashCode()};{SqlSugarHelper.Db.Ado.GetHashCode()}");
logger.Info("结束OrderTakeDrugWindowViewModel_查询数据"); logger.Info("结束OrderTakeDrugWindowViewModel_查询数据");
} }
@ -251,8 +253,8 @@ namespace DM_Weight.ViewModels
{ {
logger.Info("进入OrderTakeDrugWindowViewModel_OnNavigatedTo"); logger.Info("进入OrderTakeDrugWindowViewModel_OnNavigatedTo");
_eventAggregator.GetEvent<PortUtilEvent>().Subscribe(DoMyPrismEvent); _eventAggregator.GetEvent<PortUtilEvent>().Subscribe(DoMyPrismEvent);
//RequestData(); RequestData();
Task.Factory.StartNew(() => RequestData()); //Task.Factory.StartNew(() => RequestData());
logger.Info("结束OrderTakeDrugWindowViewModel_OnNavigatedTo"); logger.Info("结束OrderTakeDrugWindowViewModel_OnNavigatedTo");
//Task t = new Task(() => { RequestData(); }); //Task t = new Task(() => { RequestData(); });

View File

@ -238,7 +238,8 @@ namespace DM_Weight.ViewModels
//接收导航传过来的参数 现在是在此处初始化了表格数据 //接收导航传过来的参数 现在是在此处初始化了表格数据
public void OnNavigatedTo(NavigationContext navigationContext) public void OnNavigatedTo(NavigationContext navigationContext)
{ {
Task.Factory.StartNew(() => RequestData()); //Task.Factory.StartNew(() => RequestData());
RequestData();
} }
//每次导航的时候该实列用不用重新创建true是不重新创建,false是重新创建 //每次导航的时候该实列用不用重新创建true是不重新创建,false是重新创建

View File

@ -192,7 +192,8 @@ namespace DM_Weight.ViewModels
//接收导航传过来的参数 现在是在此处初始化了表格数据 //接收导航传过来的参数 现在是在此处初始化了表格数据
public void OnNavigatedTo(NavigationContext navigationContext) public void OnNavigatedTo(NavigationContext navigationContext)
{ {
Task.Factory.StartNew(() => RequestData()); //Task.Factory.StartNew(() => RequestData());
RequestData();
} }
//每次导航的时候该实列用不用重新创建true是不重新创建,false是重新创建 //每次导航的时候该实列用不用重新创建true是不重新创建,false是重新创建

View File

@ -393,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 = "库存更新失败!",

View File

@ -192,7 +192,8 @@ namespace DM_Weight.ViewModels
public void OnNavigatedTo(NavigationContext navigationContext) public void OnNavigatedTo(NavigationContext navigationContext)
{ {
logger.Info("进入SelfAddWindowViewModel_OnNavigatedTo"); logger.Info("进入SelfAddWindowViewModel_OnNavigatedTo");
Task.Factory.StartNew(() => RequestChannelData()); //Task.Factory.StartNew(() => RequestChannelData());
RequestChannelData();
logger.Info("结束SelfAddWindowViewModel_OnNavigatedTo"); logger.Info("结束SelfAddWindowViewModel_OnNavigatedTo");
} }

View File

@ -21,6 +21,48 @@ namespace DM_Weight.ViewModels
{ {
public class SelfAddWindowViewModel : BindableBase, IConfirmNavigationRequest, IRegionMemberLifetime public class SelfAddWindowViewModel : BindableBase, IConfirmNavigationRequest, IRegionMemberLifetime
{ {
private int _pageNum = 1;
public int PageNum
{
get => _pageNum;
set
{
SetProperty(ref _pageNum, value);
RequestChannelData();
}
}
private int _pageCount = 1;
public int PageCount
{
get => _pageCount;
set
{
SetProperty(ref _pageCount, value);
}
}
private int _pageSize = 3;
public int PageSize
{
get => _pageSize;
set
{
SetProperty(ref _pageSize, value);
}
}
private int _totalCount = 0;
public int TotalCount
{
get => _totalCount;
set
{
SetProperty(ref _totalCount, value);
}
}
IDialogService _dialogService; IDialogService _dialogService;
IEventAggregator _eventAggregator; IEventAggregator _eventAggregator;
@ -210,24 +252,28 @@ namespace DM_Weight.ViewModels
// .OrderBy(cs => cs.ColNo) // .OrderBy(cs => cs.ColNo)
// .ToList(); // .ToList();
//ChannelStocks = queryData; //ChannelStocks = queryData;
int totalCount = 0;
List<DrugInfo> q = SqlSugarHelper.Db.Queryable<DrugInfo>() List<DrugInfo> q = SqlSugarHelper.Db.Queryable<DrugInfo>()
.Includes<ChannelStock>(di => di.channelStocks.Where(cs => cs.DrawerType == 1).Where(cs => cs.MachineId.Equals(ConfigurationManager.AppSettings["machineId"] ?? "DM1") && cs.DrugId != null).OrderBy(cs => cs.DrawerNo).OrderBy(cs => cs.ColNo).ToList()) .Includes<ChannelStock>(di => di.channelStocks.Where(cs => cs.DrawerType == 1).Where(cs => cs.MachineId.Equals(ConfigurationManager.AppSettings["machineId"] ?? "DM1") && cs.DrugId != null).OrderBy(cs => cs.DrawerNo).OrderBy(cs => cs.ColNo).ToList())
.WhereIF(!String.IsNullOrEmpty(SearchValue) && SelectedItem.Code.Equals("DrugId"), (cs) => cs.DrugId.Contains(SearchValue))
.Where(di => di.channelStocks.Any(cs => cs.MachineId.Equals(ConfigurationManager.AppSettings["machineId"] ?? "DM1") && cs.DrugId != null)).WhereIF(!String.IsNullOrEmpty(SearchValue) && SelectedItem.Code.Equals("DrugId"), (cs) => cs.DrugId.Contains(SearchValue))
.WhereIF(!String.IsNullOrEmpty(SearchValue) && SelectedItem.Code.Equals("DrugName"), (cs) => cs.DrugName.Contains(SearchValue)) .WhereIF(!String.IsNullOrEmpty(SearchValue) && SelectedItem.Code.Equals("DrugName"), (cs) => cs.DrugName.Contains(SearchValue))
.WhereIF(!String.IsNullOrEmpty(SearchValue) && SelectedItem.Code.Equals("PyCode"), (cs) => cs.PyCode.Contains(SearchValue)) .WhereIF(!String.IsNullOrEmpty(SearchValue) && SelectedItem.Code.Equals("PyCode"), (cs) => cs.PyCode.Contains(SearchValue))
.WhereIF(!String.IsNullOrEmpty(SearchValue) && SelectedItem.Code.Equals("DrugBarcode"), (cs) => cs.DrugBarcode.Contains(SearchValue)) .WhereIF(!String.IsNullOrEmpty(SearchValue) && SelectedItem.Code.Equals("DrugBarcode"), (cs) => cs.DrugBarcode.Contains(SearchValue))
.Where(di => di.channelStocks.Any(cs => cs.MachineId.Equals(ConfigurationManager.AppSettings["machineId"] ?? "DM1") && cs.DrugId != null))
.OrderBy(cs => cs.DrugId) .OrderBy(cs => cs.DrugId)
.ToList(); .ToPageList(PageNum, PageSize, ref totalCount);
Drugs = q; Drugs = q;
TotalCount = totalCount;
PageCount = (int)Math.Ceiling((double)TotalCount / PageSize);
logger.Info("结束SelfAddWindowViewModel_查询数据"); logger.Info("结束SelfAddWindowViewModel_查询数据");
} }
//接收导航传过来的参数 现在是在此处初始化了表格数据 //接收导航传过来的参数 现在是在此处初始化了表格数据
public void OnNavigatedTo(NavigationContext navigationContext) public void OnNavigatedTo(NavigationContext navigationContext)
{ {
logger.Info("进入SelfAddWindowViewModel_OnNavigatedTo"); logger.Info("进入SelfAddWindowViewModel_OnNavigatedTo");
Task.Factory.StartNew(() => RequestChannelData()); RequestChannelData();
logger.Info("结束SelfAddWindowViewModel_OnNavigatedTo"); logger.Info("结束SelfAddWindowViewModel_OnNavigatedTo");
} }

View File

@ -342,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 = "库存更新失败!",

View File

@ -14,14 +14,59 @@ using DM_Weight.util;
using DM_Weight.msg; using DM_Weight.msg;
using Prism.Events; using Prism.Events;
using SqlSugar; using SqlSugar;
using log4net;
using System.Drawing.Printing;
namespace DM_Weight.ViewModels namespace DM_Weight.ViewModels
{ {
public class SelfTakeDrugWindowViewModel : BindableBase, IConfirmNavigationRequest, IRegionMemberLifetime public class SelfTakeDrugWindowViewModel : BindableBase, IConfirmNavigationRequest, IRegionMemberLifetime
{ {
private int _pageNum = 1;
public int PageNum
{
get => _pageNum;
set
{
SetProperty(ref _pageNum, value);
RequestChannelData();
}
}
private int _pageCount = 1;
public int PageCount
{
get => _pageCount;
set
{
SetProperty(ref _pageCount, value);
}
}
private int _pageSize = 3;
public int PageSize
{
get => _pageSize;
set
{
SetProperty(ref _pageSize, value);
}
}
private int _totalCount = 0;
public int TotalCount
{
get => _totalCount;
set
{
SetProperty(ref _totalCount, value);
}
}
private readonly ILog logger = LogManager.GetLogger(typeof(SelfTakeDrugWindowViewModel));
IDialogService _dialogService; IDialogService _dialogService;
IEventAggregator _eventAggregator; IEventAggregator _eventAggregator;
public static List<OrderTakeSelect> StaticSelects = new() public static List<OrderTakeSelect> StaticSelects = new()
{ {
new OrderTakeSelect new OrderTakeSelect
@ -49,7 +94,7 @@ namespace DM_Weight.ViewModels
public SelfTakeDrugWindowViewModel(IDialogService DialogService, IEventAggregator eventAggregator, SqlSugarScope sqlSugarScope) public SelfTakeDrugWindowViewModel(IDialogService DialogService, IEventAggregator eventAggregator, SqlSugarScope sqlSugarScope)
{ {
_dialogService = DialogService; _dialogService = DialogService;
_eventAggregator= eventAggregator; _eventAggregator = eventAggregator;
//this.SqlSugarHelper.Db = sqlSugarScope; //this.SqlSugarHelper.Db = sqlSugarScope;
} }
@ -195,6 +240,7 @@ namespace DM_Weight.ViewModels
// .OrderBy(cs => cs.ColNo) // .OrderBy(cs => cs.ColNo)
// .ToList(); // .ToList();
//ChannelStocks = queryData; //ChannelStocks = queryData;
int totalCount = 0;
List<DrugInfo> q = SqlSugarHelper.Db.Queryable<DrugInfo>() List<DrugInfo> q = SqlSugarHelper.Db.Queryable<DrugInfo>()
.Includes<ChannelStock>(di => di.channelStocks.Where(cs => cs.DrawerType == 1) .Includes<ChannelStock>(di => di.channelStocks.Where(cs => cs.DrawerType == 1)
.Where(cs => cs.MachineId.Equals(ConfigurationManager.AppSettings["machineId"] ?? "DM1") && cs.DrugId != null&&cs.Quantity>0).OrderBy(cs => cs.DrawerNo).OrderBy(cs => cs.ColNo).ToList()) .Where(cs => cs.MachineId.Equals(ConfigurationManager.AppSettings["machineId"] ?? "DM1") && cs.DrugId != null&&cs.Quantity>0).OrderBy(cs => cs.DrawerNo).OrderBy(cs => cs.ColNo).ToList())
@ -202,11 +248,16 @@ namespace DM_Weight.ViewModels
.WhereIF(!String.IsNullOrEmpty(SearchValue) && SelectedItem.Code.Equals("DrugName"), (cs) => cs.DrugName.Contains(SearchValue)) .WhereIF(!String.IsNullOrEmpty(SearchValue) && SelectedItem.Code.Equals("DrugName"), (cs) => cs.DrugName.Contains(SearchValue))
.WhereIF(!String.IsNullOrEmpty(SearchValue) && SelectedItem.Code.Equals("PyCode"), (cs) => cs.PyCode.Contains(SearchValue)) .WhereIF(!String.IsNullOrEmpty(SearchValue) && SelectedItem.Code.Equals("PyCode"), (cs) => cs.PyCode.Contains(SearchValue))
.WhereIF(!String.IsNullOrEmpty(SearchValue) && SelectedItem.Code.Equals("DrugBarcode"), (cs) => cs.DrugBarcode.Contains(SearchValue)) .WhereIF(!String.IsNullOrEmpty(SearchValue) && SelectedItem.Code.Equals("DrugBarcode"), (cs) => cs.DrugBarcode.Contains(SearchValue))
.WhereIF(!String.IsNullOrEmpty(SearchValue) && SelectedItem.Code.Equals("DrugBarcode"), (cs) => cs.DrugBarcode.Contains(SearchValue))
.Where(di => di.channelStocks.Any(cs => cs.MachineId.Equals(ConfigurationManager.AppSettings["machineId"] ?? "DM1") && cs.DrugId != null)) .Where(di => di.channelStocks.Any(cs => cs.MachineId.Equals(ConfigurationManager.AppSettings["machineId"] ?? "DM1") && cs.DrugId != null))
.OrderBy(cs => cs.DrugId) .OrderBy(cs => cs.DrugId)
.ToList(); .ToPageList(PageNum, PageSize, ref totalCount);
//.ToList();
Drugs = q.Where(di => di.channelStocks.Count() > 0).ToList(); Drugs = q.Where(di => di.channelStocks.Count() > 0).ToList();
TotalCount = totalCount;
PageCount = (int)Math.Ceiling((double)TotalCount / PageSize);
logger.Info($"_db.Ado.Connection.GetHashCode():{SqlSugarHelper.Db.Ado.Connection.GetHashCode()};{SqlSugarHelper.Db.Ado.GetHashCode()}");
} }
//接收导航传过来的参数 现在是在此处初始化了表格数据 //接收导航传过来的参数 现在是在此处初始化了表格数据

View File

@ -25,6 +25,47 @@ namespace DM_Weight.ViewModels
{ {
public class StockListWindowViewModel : BindableBase, IConfirmNavigationRequest, IRegionMemberLifetime public class StockListWindowViewModel : BindableBase, IConfirmNavigationRequest, IRegionMemberLifetime
{ {
private int _pageNum = 1;
public int PageNum
{
get => _pageNum;
set
{
SetProperty(ref _pageNum, value);
RequestData();
}
}
private int _pageCount = 1;
public int PageCount
{
get => _pageCount;
set
{
SetProperty(ref _pageCount, value);
}
}
private int _pageSize = 3;
public int PageSize
{
get => _pageSize;
set
{
SetProperty(ref _pageSize, value);
}
}
private int _totalCount = 0;
public int TotalCount
{
get => _totalCount;
set
{
SetProperty(ref _totalCount, value);
}
}
//public static StockListWindowViewModel vm; //public static StockListWindowViewModel vm;
public string drugId; public string drugId;
public static List<OrderTakeSelect> StaticSelects = new() public static List<OrderTakeSelect> StaticSelects = new()
@ -240,7 +281,7 @@ namespace DM_Weight.ViewModels
// .OrderBy(cs => cs.DrugId) // .OrderBy(cs => cs.DrugId)
// .ToList(); // .ToList();
//Drugs = q; //Drugs = q;
int totalCount = 0;
List<DrugInfo> q = SqlSugarHelper.Db.Queryable<DrugInfo>() List<DrugInfo> q = SqlSugarHelper.Db.Queryable<DrugInfo>()
.Includes<ChannelStock>(di => di.channelStocks.Where(cs => cs.DrawerType == 1) .Includes<ChannelStock>(di => di.channelStocks.Where(cs => cs.DrawerType == 1)
.Where(cs => cs.MachineId.Equals(ConfigurationManager.AppSettings["machineId"] ?? "DM1") && cs.DrugId != null).OrderBy(cs => cs.DrawerNo).OrderBy(cs => cs.ColNo).ToList()) .Where(cs => cs.MachineId.Equals(ConfigurationManager.AppSettings["machineId"] ?? "DM1") && cs.DrugId != null).OrderBy(cs => cs.DrawerNo).OrderBy(cs => cs.ColNo).ToList())
@ -250,9 +291,10 @@ namespace DM_Weight.ViewModels
.WhereIF(!String.IsNullOrEmpty(SearchValue) && SelectedItem.Code.Equals("DrugBarcode"), (cs) => cs.DrugBarcode.Contains(SearchValue)) .WhereIF(!String.IsNullOrEmpty(SearchValue) && SelectedItem.Code.Equals("DrugBarcode"), (cs) => cs.DrugBarcode.Contains(SearchValue))
.Where(di => di.channelStocks.Any(cs => cs.MachineId.Equals(ConfigurationManager.AppSettings["machineId"] ?? "DM1") && cs.DrugId != null)) .Where(di => di.channelStocks.Any(cs => cs.MachineId.Equals(ConfigurationManager.AppSettings["machineId"] ?? "DM1") && cs.DrugId != null))
.OrderBy(cs => cs.DrugId) .OrderBy(cs => cs.DrugId)
.ToList(); .ToPageList(PageNum, PageSize, ref totalCount);
Drugs = q; Drugs = q;
TotalCount = totalCount;
PageCount = (int)Math.Ceiling((double)TotalCount / PageSize);
logger.Info("结束StockListWindowViewModel_查询数据"); logger.Info("结束StockListWindowViewModel_查询数据");
} }
@ -261,7 +303,7 @@ namespace DM_Weight.ViewModels
{ {
logger.Info("进入StockListWindowViewModel_OnNavigatedTo"); logger.Info("进入StockListWindowViewModel_OnNavigatedTo");
//RequestData(); //RequestData();
Task.Factory.StartNew(() => RequestData()); RequestData();
logger.Info("结束StockListWindowViewModel_OnNavigatedTo"); logger.Info("结束StockListWindowViewModel_OnNavigatedTo");
} }

View File

@ -196,7 +196,7 @@
</materialDesign:Card> </materialDesign:Card>
<StackPanel Orientation="Vertical" Grid.Row="3" Grid.Column="2"> <StackPanel Orientation="Vertical" Grid.Row="3" Grid.Column="2">
<TextBlock Visibility="{Binding DrawerPortMsg, Converter={StaticResource BooleanToVisibilityConverter}}" Text="抽屉串口连接失败" /> <TextBlock Visibility="{Binding DrawerPortMsg, Converter={StaticResource BooleanToVisibilityConverter}}" Text="抽屉串口连接失败" />
<TextBlock Visibility="{Binding CanBusPortMsg, Converter={StaticResource BooleanToVisibilityConverter}}" Text="can总线串口连接失败" /> <TextBlock Visibility="{Binding CanBusPortMsg, Converter={StaticResource BooleanToVisibilityConverter}}" Text="can总线串口连接失败" />
<TextBlock Visibility="{Binding FingerMsg, Converter={StaticResource BooleanToVisibilityConverter}}" Text="指纹机连接失败" /> <TextBlock Visibility="{Binding FingerMsg, Converter={StaticResource BooleanToVisibilityConverter}}" Text="指纹机连接失败" />
</StackPanel> </StackPanel>
</Grid> </Grid>

View File

@ -8,6 +8,7 @@
xmlns:i="http://schemas.microsoft.com/xaml/behaviors" xmlns:i="http://schemas.microsoft.com/xaml/behaviors"
xmlns:convert="clr-namespace:DM_Weight.Converter" xmlns:convert="clr-namespace:DM_Weight.Converter"
xmlns:prism="http://prismlibrary.com/" xmlns:prism="http://prismlibrary.com/"
xmlns:pagination="clr-namespace:DM_Weight.Components.pagination"
mc:Ignorable="d"> mc:Ignorable="d">
<Grid> <Grid>
<Grid.Resources> <Grid.Resources>
@ -20,6 +21,7 @@
<convert:TotalCountConverter x:Key="TotalCountConverter" /> <convert:TotalCountConverter x:Key="TotalCountConverter" />
</Grid.Resources> </Grid.Resources>
<Grid.RowDefinitions> <Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" /> <RowDefinition Height="Auto" />
<RowDefinition /> <RowDefinition />
</Grid.RowDefinitions> </Grid.RowDefinitions>
@ -254,7 +256,12 @@
</ListView> </ListView>
</Grid>--> </Grid>-->
<pagination:Pagination Grid.Row="2"
CurrentPage="{Binding PageNum}"
PageSize="{Binding PageSize}"
TotalPages="{Binding TotalCount}"
InfoTextIsEnabel="True"
/>
</Grid> </Grid>
</UserControl> </UserControl>

View File

@ -9,6 +9,7 @@
xmlns:i="http://schemas.microsoft.com/xaml/behaviors" xmlns:i="http://schemas.microsoft.com/xaml/behaviors"
xmlns:convert="clr-namespace:DM_Weight.Converter" xmlns:convert="clr-namespace:DM_Weight.Converter"
xmlns:prism="http://prismlibrary.com/" xmlns:prism="http://prismlibrary.com/"
xmlns:pagination="clr-namespace:DM_Weight.Components.pagination"
mc:Ignorable="d"> mc:Ignorable="d">
<Grid> <Grid>
<Grid.Resources> <Grid.Resources>
@ -22,6 +23,7 @@
</Grid.Resources> </Grid.Resources>
<Grid.RowDefinitions> <Grid.RowDefinitions>
<RowDefinition Height="Auto" /> <RowDefinition Height="Auto" />
<RowDefinition Height="Auto"/>
<RowDefinition /> <RowDefinition />
</Grid.RowDefinitions> </Grid.RowDefinitions>
<Grid Margin="0 6 0 6" Grid.Row="0"> <Grid Margin="0 6 0 6" Grid.Row="0">
@ -103,7 +105,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">
@ -187,6 +191,11 @@
</DataGrid.Columns> </DataGrid.Columns>
</DataGrid> </DataGrid>
<pagination:Pagination Grid.Row="2"
CurrentPage="{Binding PageNum}"
PageSize="{Binding PageSize}"
TotalPages="{Binding TotalCount}"
InfoTextIsEnabel="True"
/>
</Grid> </Grid>
</UserControl> </UserControl>

View File

@ -10,6 +10,7 @@
xmlns:convert="clr-namespace:DM_Weight.Converter" xmlns:convert="clr-namespace:DM_Weight.Converter"
xmlns:prism="http://prismlibrary.com/" xmlns:prism="http://prismlibrary.com/"
mc:Ignorable="d" mc:Ignorable="d"
xmlns:pagination="clr-namespace:DM_Weight.Components.pagination"
d:DesignHeight="450" d:DesignWidth="800"> d:DesignHeight="450" d:DesignWidth="800">
<Grid> <Grid>
<Grid.Resources> <Grid.Resources>
@ -24,6 +25,7 @@
<convert:TotalCountConverter x:Key="TotalCountConverter" /> <convert:TotalCountConverter x:Key="TotalCountConverter" />
</Grid.Resources> </Grid.Resources>
<Grid.RowDefinitions> <Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" /> <RowDefinition Height="Auto" />
<RowDefinition /> <RowDefinition />
</Grid.RowDefinitions> </Grid.RowDefinitions>
@ -255,6 +257,12 @@
</GridView> </GridView>
</ListView.View> </ListView.View>
</ListView>--> </ListView>-->
<pagination:Pagination Grid.Row="2"
CurrentPage="{Binding PageNum}"
PageSize="{Binding PageSize}"
TotalPages="{Binding TotalCount}"
InfoTextIsEnabel="True"
/>
</Grid> </Grid>
</UserControl> </UserControl>

View File

@ -11,7 +11,7 @@ namespace DM_Weight.util
ConnectionString = ConfigurationManager.ConnectionStrings["database"].ToString(), ConnectionString = ConfigurationManager.ConnectionStrings["database"].ToString(),
DbType = DbType.MySql, DbType = DbType.MySql,
IsAutoCloseConnection = true IsAutoCloseConnection = false
}, },
db => db =>
{ {

View File

@ -1 +0,0 @@
湖南省儿童医院16个抽屉每个抽屉2个库位带两个三色灯标签