Compare commits
	
		
			12 Commits
		
	
	
		
			master
			...
			secondMaster
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 
							
							
								
								 | 
						85360a675c | 
							 | 
					|
| 
							
							
								
								 | 
						5451dd490a | 
							 | 
					|
| 
							
							
								
								 | 
						134f15941a | 
							 | 
					|
| 
							
							
								
								 | 
						636bc9cd57 | 
							 | 
					|
| 
							
							
								
								 | 
						9c40f72157 | 
							 | 
					|
| 
							
							
								
								 | 
						0ae94e65ef | 
							 | 
					|
| 
							
							
								
								 | 
						7fb942977a | 
							 | 
					|
| 
							
							
								
								 | 
						4d26252cad | 
							 | 
					|
| 
							
							
								
								 | 
						d776e7d724 | 
							 | 
					|
| 
							
							
								
								 | 
						4d916016d7 | 
							 | 
					|
| 
							
							
								
								 | 
						840879b994 | 
							 | 
					|
| 
							
							
								
								 | 
						26caaaac1e | 
							 | 
					
| 
						 | 
				
			
			@ -361,3 +361,4 @@ MigrationBackup/
 | 
			
		|||
 | 
			
		||||
# Fody - auto-generated XML schema
 | 
			
		||||
FodyWeavers.xsd
 | 
			
		||||
/readme.txt
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -3,7 +3,7 @@
 | 
			
		|||
  <connectionStrings>
 | 
			
		||||
	<!-- 数据库连接字符串 -->
 | 
			
		||||
	<!--<add name="database" connectionString="server=127.0.0.1;database=wpf_dm_program;userid=root;password=qq1223" />-->
 | 
			
		||||
	<add name="database" connectionString="server=127.0.0.1;port=3306;database=hunanxianchang_db;userid=root;password=root;Pooling=false; ConnectionLifeTime=0;" />
 | 
			
		||||
	<add name="database" connectionString="server=127.0.0.1;port=3306;database=hunanxianchang_db;userid=root;password=root;SslMode=none;Command Timeout=61;" />
 | 
			
		||||
  </connectionStrings>
 | 
			
		||||
	<!--<runtime>
 | 
			
		||||
		--><!--配置之后,Appdomain.CurrentDomain.UnhandledException 事件的 IsTerminating 就变成了 false 啦!也就是说,程序并不会因为这次的异常而崩溃退出。--><!--
 | 
			
		||||
| 
						 | 
				
			
			@ -20,13 +20,13 @@
 | 
			
		|||
		<!--2023/7/13 药房代码 有则写无则空 -->
 | 
			
		||||
		<add key="storage" value="" />
 | 
			
		||||
		<!-- 登录模式 1单人登录2双人登录 -->
 | 
			
		||||
		<add key="loginMode" value="1" />
 | 
			
		||||
		<add key="loginMode" value="2" />
 | 
			
		||||
		<!-- 登录顺序,指定先登录的人的名称有效值,只有在登录模式等于2时才会生效; 发药人:【operator】审核人:【reviewer】 -->
 | 
			
		||||
		<add key="firstLogin" value="operator" />
 | 
			
		||||
		<!-- 按处方还药或者按取药记录还药 1:处方2:药品-->
 | 
			
		||||
		<add key="returnDrugMode" value="1" />
 | 
			
		||||
		<add key="returnDrugMode" value="2" />
 | 
			
		||||
		<!-- 自动退出时间,单位秒,为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;"/>
 | 
			
		||||
		<!-- 查询处方是orderNo还是orderGroupNo -->
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -38,17 +38,17 @@ namespace DM_Weight
 | 
			
		|||
    public partial class App : PrismApplication
 | 
			
		||||
    {
 | 
			
		||||
        #region 当前登录用户的发药人信息
 | 
			
		||||
        private static UserList _currentFaUserList=new UserList();
 | 
			
		||||
        private static UserList _currentFaUserList = new UserList();
 | 
			
		||||
        public static UserList CurrentFaUserList
 | 
			
		||||
        {
 | 
			
		||||
            get => _currentFaUserList;
 | 
			
		||||
            set=> _currentFaUserList = value;
 | 
			
		||||
            set => _currentFaUserList = value;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        #endregion 当前登录用户的发药人信息
 | 
			
		||||
 | 
			
		||||
        #region 当前登录用户的审核人信息
 | 
			
		||||
        private static UserList _currentShenUserList= new UserList();
 | 
			
		||||
        private static UserList _currentShenUserList = new UserList();
 | 
			
		||||
        public static UserList CurrentShenUserList
 | 
			
		||||
        {
 | 
			
		||||
            get => _currentShenUserList;
 | 
			
		||||
| 
						 | 
				
			
			@ -89,7 +89,11 @@ namespace DM_Weight
 | 
			
		|||
 | 
			
		||||
            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.RegisterForNavigation<AccountWindow,AccountWindowViewModel>();
 | 
			
		||||
            containerRegistry.RegisterForNavigation<AccountWindow, AccountWindowViewModel>();
 | 
			
		||||
            //账册服务类
 | 
			
		||||
            containerRegistry.Register<MachineRecordService>();
 | 
			
		||||
        }
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,4 +1,4 @@
 | 
			
		|||
using NetTaste;
 | 
			
		||||
//using NetTaste;
 | 
			
		||||
using Prism.Commands;
 | 
			
		||||
using System;
 | 
			
		||||
using System.Collections.Generic;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,41 +0,0 @@
 | 
			
		|||
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();
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -71,10 +71,9 @@
 | 
			
		|||
    <PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="8.0.0" />
 | 
			
		||||
    <PackageReference Include="Microsoft.Web.WebView2" Version="1.0.2365.46" />
 | 
			
		||||
    <PackageReference Include="Microsoft.Xaml.Behaviors.Wpf" Version="1.1.39" />
 | 
			
		||||
    <PackageReference Include="MySqlConnector" Version="2.3.6" />
 | 
			
		||||
    <PackageReference Include="Newtonsoft.Json" Version="13.0.2" />
 | 
			
		||||
    <PackageReference Include="Prism.Unity" Version="8.1.97" />
 | 
			
		||||
    <PackageReference Include="SqlSugarCore" Version="5.1.4.67" />
 | 
			
		||||
    <PackageReference Include="SqlSugarCore" Version="5.1.4.152" />
 | 
			
		||||
    <PackageReference Include="SuperSimpleTcp" Version="3.0.10" />
 | 
			
		||||
    <PackageReference Include="System.Drawing.Common" Version="7.0.0" />
 | 
			
		||||
    <PackageReference Include="System.IO.Ports" Version="7.0.0" />
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -20,7 +20,7 @@ namespace DM_Weight.Finger
 | 
			
		|||
    {
 | 
			
		||||
 | 
			
		||||
        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;
 | 
			
		||||
 | 
			
		||||
        private string fingerIp = ConfigurationManager.AppSettings["fingerIp"]?.ToString() ?? "";
 | 
			
		||||
| 
						 | 
				
			
			@ -42,7 +42,7 @@ namespace DM_Weight.Finger
 | 
			
		|||
        {
 | 
			
		||||
            try
 | 
			
		||||
            {
 | 
			
		||||
                axCZKEM1 = new CZKEMClass();
 | 
			
		||||
                //axCZKEM1 = new CZKEMClass();
 | 
			
		||||
                bIsConnected = axCZKEM1.Connect_Net(fingerIp, fingerPort);
 | 
			
		||||
                logger.Info($"连接指纹机,IP:{fingerIp},端口:{fingerPort},机器号:{machineNumber},连接结果:{bIsConnected}");
 | 
			
		||||
                if (bIsConnected)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -119,12 +119,6 @@ namespace DM_Weight.Models
 | 
			
		|||
                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;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -142,25 +136,9 @@ namespace DM_Weight.Models
 | 
			
		|||
                {
 | 
			
		||||
                    throw new ArgumentException("取药数量不能小于0");
 | 
			
		||||
                }
 | 
			
		||||
                if(OrderQuantity>0&&value>OrderQuantity)
 | 
			
		||||
                {
 | 
			
		||||
                    throw new ArgumentException("取药数量不能大于应取数量");
 | 
			
		||||
                }
 | 
			
		||||
                SetProperty(ref _takeQuantity, value);
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        private int _orderQuantity = 0;
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// 处方取药数量
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        [SugarColumn(IsIgnore =true)]
 | 
			
		||||
        public int OrderQuantity
 | 
			
		||||
        {
 | 
			
		||||
            get => _orderQuantity;
 | 
			
		||||
            set=>SetProperty(ref _orderQuantity, value);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        //private string _tipMessage=string.Empty;
 | 
			
		||||
        //[SugarColumn(IsIgnore = true)]
 | 
			
		||||
        //public string TipMessage
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -127,10 +127,5 @@ namespace DM_Weight.Models
 | 
			
		|||
        ///</summary>
 | 
			
		||||
        [SugarColumn(ColumnName = "use_dosage")]
 | 
			
		||||
        public string UseDosage { get; set; }
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// 处方中该药品状态是否已全部取出0未取1已取(针对处方可取部分药)
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        [SugarColumn(ColumnName = "dm_status")]
 | 
			
		||||
        public int? DMStatus { get;set; }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -39,6 +39,10 @@ namespace DM_Weight.Port
 | 
			
		|||
        public SerialPort scanCodeSerial;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
        // 抽屉串口协议232 | 485
 | 
			
		||||
        private int _drawerProtocol = Convert.ToInt32(ConfigurationManager.AppSettings["DrawerProtocol"]);
 | 
			
		||||
        // can总线耗材板地址
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,7 +1,9 @@
 | 
			
		|||
using DM_Weight.Models;
 | 
			
		||||
using log4net;
 | 
			
		||||
using log4net.Repository.Hierarchy;
 | 
			
		||||
using MySqlConnector;
 | 
			
		||||
//using MySql.Data.MySqlClient;
 | 
			
		||||
//using MySql.Data.MySqlClient;
 | 
			
		||||
//using MySqlConnector;
 | 
			
		||||
using Newtonsoft.Json;
 | 
			
		||||
using System;
 | 
			
		||||
using System.Collections.Generic;
 | 
			
		||||
| 
						 | 
				
			
			@ -15,91 +17,86 @@ namespace DM_Weight.Services
 | 
			
		|||
{
 | 
			
		||||
    public class UserService
 | 
			
		||||
    {
 | 
			
		||||
        private readonly ILog logger = LogManager.GetLogger(typeof(UserService));
 | 
			
		||||
        //public static string connStr = ConfigurationManager.AppSettings["database"].ToString();
 | 
			
		||||
        public static string connStr = ConfigurationManager.ConnectionStrings["database"].ToString();
 | 
			
		||||
        public  UserList CheckUserByFingerPrinter(int fingerPrinterId)
 | 
			
		||||
        {
 | 
			
		||||
            UserList? user = null;
 | 
			
		||||
        //private readonly ILog logger = LogManager.GetLogger(typeof(UserService));
 | 
			
		||||
        ////public static string connStr = ConfigurationManager.AppSettings["database"].ToString();
 | 
			
		||||
        //public static string connStr = ConfigurationManager.ConnectionStrings["database"].ToString();
 | 
			
		||||
        //public UserList CheckUserByFingerPrinter(int fingerPrinterId)
 | 
			
		||||
        //{
 | 
			
		||||
        //    UserList? user = null;
 | 
			
		||||
 | 
			
		||||
            using (MySqlConnection con = new MySqlConnection(connStr))
 | 
			
		||||
            {
 | 
			
		||||
                logger.Info($"connStr:{connStr}");
 | 
			
		||||
                //try
 | 
			
		||||
                //{
 | 
			
		||||
                //    con.Open();
 | 
			
		||||
                //}
 | 
			
		||||
                //catch (Exception ex)
 | 
			
		||||
                //{
 | 
			
		||||
                //    logger.Info($"Open失败:{ex.ToString()}");
 | 
			
		||||
                //    if (con.State == System.Data.ConnectionState.Open)
 | 
			
		||||
                //    {
 | 
			
		||||
                //        con.Close();
 | 
			
		||||
                //    }
 | 
			
		||||
                //    Thread.Sleep(200);
 | 
			
		||||
                //    logger.Info("再次Open");
 | 
			
		||||
                //    con.Open();
 | 
			
		||||
                //}
 | 
			
		||||
               connOpen(con);
 | 
			
		||||
                Thread.Sleep(100);
 | 
			
		||||
                while(con.State != System.Data.ConnectionState.Open)
 | 
			
		||||
                {
 | 
			
		||||
                    logger.Info($"再次Open:{con.State}");
 | 
			
		||||
                    connOpen(con);
 | 
			
		||||
                    Thread.Sleep(100);
 | 
			
		||||
                }
 | 
			
		||||
        //    //using (MySqlConnection con = new MySqlConnection(connStr))
 | 
			
		||||
        //    //{
 | 
			
		||||
        //    //    logger.Info($"connStr:{connStr}");
 | 
			
		||||
        //    //    try
 | 
			
		||||
        //    //    {
 | 
			
		||||
        //    //        con.Open();
 | 
			
		||||
        //    //    }
 | 
			
		||||
        //    //    catch (Exception ex)
 | 
			
		||||
        //    //    {
 | 
			
		||||
        //    //        con.Close();
 | 
			
		||||
        //    //        logger.Info($"Open失败:{ex.ToString()};连接状态:{con.State}");
 | 
			
		||||
        //    //        logger.Info("再次Open");
 | 
			
		||||
        //    //        con.Open();
 | 
			
		||||
        //    //    }
 | 
			
		||||
        //        //connOpen(con);
 | 
			
		||||
        //        //Thread.Sleep(10);
 | 
			
		||||
        //        //while (con.State != System.Data.ConnectionState.Open)
 | 
			
		||||
        //        //{
 | 
			
		||||
        //        //    logger.Info($"再次Open:{con.State}");
 | 
			
		||||
        //        //    connOpen(con);
 | 
			
		||||
        //        //    Thread.Sleep(10);
 | 
			
		||||
        //        //}
 | 
			
		||||
 | 
			
		||||
                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 
 | 
			
		||||
                                INNER JOIN role r on ul.machine_role_id=r.id where ul.Id=@ID and ul.machine_id=@machine_id and r.machine_id=@machine_id;";
 | 
			
		||||
                MySqlCommand cmd = new MySqlCommand(sql, con);
 | 
			
		||||
                cmd.Parameters.Clear();
 | 
			
		||||
                MySqlParameter[] mySqlParameter = new MySqlParameter[] { new MySqlParameter("ID", fingerPrinterId), new MySqlParameter("machine_id", (ConfigurationManager.AppSettings["machineId"] ?? "DM1")) };
 | 
			
		||||
                cmd.Parameters.AddRange(mySqlParameter);
 | 
			
		||||
                //执行语句
 | 
			
		||||
                MySqlDataReader reader = cmd.ExecuteReader();
 | 
			
		||||
                logger.Info("MySqlDataReader读数据");
 | 
			
		||||
                while (reader.Read())
 | 
			
		||||
                {
 | 
			
		||||
                    user = new UserList();
 | 
			
		||||
                    user.Id = reader.GetInt32("id");
 | 
			
		||||
                    user.UserName = reader["userName"] is DBNull ? "" : reader.GetString("userName");
 | 
			
		||||
                    //user.UserName = reader["id"] is DBNull ? "" : reader.GetString("id");
 | 
			
		||||
                    user.Nickname = reader["userName"] is DBNull ? "" : reader.GetString("userName");
 | 
			
		||||
                    user.MachineId = reader["machine_id"] is DBNull ? "" : reader.GetString("machine_id");
 | 
			
		||||
                    RoleDm role = new RoleDm();
 | 
			
		||||
                    role.Id = reader.GetInt32("id");
 | 
			
		||||
                    //role.Permissions = reader["permissions"] is DBNull ? "" : reader.GetString("permissions");
 | 
			
		||||
                    role.RoleName = reader["role_name"] is DBNull ? "" : reader.GetString("role_name");
 | 
			
		||||
                    role.Permissions = JsonConvert.DeserializeObject<List<PremissionDm>>(reader["permissions"] is DBNull ? "" : reader.GetString("permissions"));  // JsonConvert.SerializeObject(reader.GetString("permissions")).ToList();
 | 
			
		||||
                    user.Role = role;
 | 
			
		||||
                }
 | 
			
		||||
        //        //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 
 | 
			
		||||
        //        //                INNER JOIN role r on ul.machine_role_id=r.id where ul.Id=@ID and ul.machine_id=@machine_id and r.machine_id=@machine_id;";
 | 
			
		||||
        //        //MySqlCommand cmd = new MySqlCommand(sql, con);
 | 
			
		||||
        //        //cmd.Parameters.Clear();
 | 
			
		||||
        //        //MySqlParameter[] mySqlParameter = new MySqlParameter[] { new MySqlParameter("ID", fingerPrinterId), new MySqlParameter("machine_id", (ConfigurationManager.AppSettings["machineId"] ?? "DM1")) };
 | 
			
		||||
        //        //cmd.Parameters.AddRange(mySqlParameter);
 | 
			
		||||
        //        ////执行语句
 | 
			
		||||
        //        //MySqlDataReader reader = cmd.ExecuteReader();
 | 
			
		||||
        //        //logger.Info("MySqlDataReader读数据");
 | 
			
		||||
        //        //while (reader.Read())
 | 
			
		||||
        //        //{
 | 
			
		||||
        //        //    user = new UserList();
 | 
			
		||||
        //        //    user.Id = reader.GetInt32("id");
 | 
			
		||||
        //        //    user.UserName = reader["userName"] is DBNull ? "" : reader.GetString("userName");
 | 
			
		||||
        //        //    //user.UserName = reader["id"] is DBNull ? "" : reader.GetString("id");
 | 
			
		||||
        //        //    user.Nickname = reader["userName"] is DBNull ? "" : reader.GetString("userName");
 | 
			
		||||
        //        //    user.MachineId = reader["machine_id"] is DBNull ? "" : reader.GetString("machine_id");
 | 
			
		||||
        //        //    RoleDm role = new RoleDm();
 | 
			
		||||
        //        //    role.Id = reader.GetInt32("id");
 | 
			
		||||
        //        //    //role.Permissions = reader["permissions"] is DBNull ? "" : reader.GetString("permissions");
 | 
			
		||||
        //        //    role.RoleName = reader["role_name"] is DBNull ? "" : reader.GetString("role_name");
 | 
			
		||||
        //        //    role.Permissions = JsonConvert.DeserializeObject<List<PremissionDm>>(reader["permissions"] is DBNull ? "" : reader.GetString("permissions"));  // JsonConvert.SerializeObject(reader.GetString("permissions")).ToList();
 | 
			
		||||
        //        //    user.Role = role;
 | 
			
		||||
        //        //}
 | 
			
		||||
 | 
			
		||||
                reader.Close();
 | 
			
		||||
                logger.Info($"sql:{sql}");
 | 
			
		||||
                return user;
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
        }
 | 
			
		||||
        private Task connOpen(MySqlConnection con)
 | 
			
		||||
        {
 | 
			
		||||
            return Task.Run(() =>
 | 
			
		||||
            {
 | 
			
		||||
                if (con.State == System.Data.ConnectionState.Open)
 | 
			
		||||
                {
 | 
			
		||||
                    con.Close();
 | 
			
		||||
                }
 | 
			
		||||
                try
 | 
			
		||||
                {
 | 
			
		||||
                    con.Open();
 | 
			
		||||
                }
 | 
			
		||||
                catch (Exception ex)
 | 
			
		||||
                {
 | 
			
		||||
                    logger.Info($"Open失败:{ex.Message}");
 | 
			
		||||
                }
 | 
			
		||||
            });
 | 
			
		||||
        }
 | 
			
		||||
        //        //reader.Close();
 | 
			
		||||
        //        //logger.Info($"sql:{sql}");
 | 
			
		||||
        //        return user;
 | 
			
		||||
        //    }
 | 
			
		||||
 | 
			
		||||
        //}
 | 
			
		||||
        //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}");
 | 
			
		||||
        //        }
 | 
			
		||||
        //    });
 | 
			
		||||
        //}
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -252,11 +252,13 @@ namespace DM_Weight.ViewModels
 | 
			
		|||
                                        Id = it.Id,
 | 
			
		||||
                                        DrugId= it.DrugId,
 | 
			
		||||
                                    }).UpdateColumns(it => new { it.Quantity, it.ManuNo, it.EffDate,it.DrugId }).ExecuteCommand();
 | 
			
		||||
                                   
 | 
			
		||||
                                }
 | 
			
		||||
                                else
 | 
			
		||||
                                {
 | 
			
		||||
                                    //如果批号重复则不让添加
 | 
			
		||||
                                    List<ChannelStock> csCount = SqlSugarHelper.Db.Queryable<ChannelStock>().Where(cs => cs.DrawerNo == it.DrawerNo && cs.ManuNo == it.ManuNo && cs.MachineId.Equals(ConfigurationManager.AppSettings["machineId"] ?? "DM1")).ToList();
 | 
			
		||||
 | 
			
		||||
                                    if (csCount.Count > 0)
 | 
			
		||||
                                    {
 | 
			
		||||
                                        //repeatList.Add(it.ManuNo);
 | 
			
		||||
| 
						 | 
				
			
			@ -279,6 +281,8 @@ namespace DM_Weight.ViewModels
 | 
			
		|||
                                        Id = Guid.NewGuid().ToString(),
 | 
			
		||||
                                        MachineId = ConfigurationManager.AppSettings["machineId"] ?? "DM1"
 | 
			
		||||
                                    }).ExecuteCommand();
 | 
			
		||||
                                    
 | 
			
		||||
 | 
			
		||||
                                }
 | 
			
		||||
                                // 获取更新完库存后的药品库存
 | 
			
		||||
                                List<ChannelStock> nowChannels = SqlSugarHelper.Db.Queryable<ChannelStock>()
 | 
			
		||||
| 
						 | 
				
			
			@ -308,6 +312,7 @@ namespace DM_Weight.ViewModels
 | 
			
		|||
                            }
 | 
			
		||||
                            return true;
 | 
			
		||||
                        }); 
 | 
			
		||||
                        
 | 
			
		||||
                        //ChannelStocks.Clear();
 | 
			
		||||
                        if (stockRepeats.Count == record.Count)
 | 
			
		||||
                        {
 | 
			
		||||
| 
						 | 
				
			
			@ -388,6 +393,7 @@ namespace DM_Weight.ViewModels
 | 
			
		|||
                            else
 | 
			
		||||
                            {
 | 
			
		||||
                                logger.Info($"多批次抽屉加药,库存更新失败!{f.ErrorMessage}");
 | 
			
		||||
 | 
			
		||||
                                AlertMsg alertMsg = new AlertMsg
 | 
			
		||||
                                {
 | 
			
		||||
                                    Message = "更新库存失败",
 | 
			
		||||
| 
						 | 
				
			
			@ -485,7 +491,9 @@ namespace DM_Weight.ViewModels
 | 
			
		|||
            {
 | 
			
		||||
                //删除ChannelStock表中该批次数据
 | 
			
		||||
                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},");
 | 
			
		||||
                    AlertMsg alertMsg = new AlertMsg
 | 
			
		||||
| 
						 | 
				
			
			@ -518,6 +526,8 @@ namespace DM_Weight.ViewModels
 | 
			
		|||
            Is8Drawer = count < 9;
 | 
			
		||||
            Is16Drawer = count >= 16;
 | 
			
		||||
            Is17Drawer = count > 16;
 | 
			
		||||
            
 | 
			
		||||
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        //这个方法用于拦截请求,continuationCallback(true)就是不拦截,continuationCallback(false)拦截本次操作
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -23,7 +23,7 @@ namespace DM_Weight.ViewModels
 | 
			
		|||
{
 | 
			
		||||
    public class BindingChannelDialogViewModel : BindableBase, IDialogAware
 | 
			
		||||
    {
 | 
			
		||||
 | 
			
		||||
        private readonly ILog logger = LogManager.GetLogger(typeof(HomeWindowViewModel));
 | 
			
		||||
        public string Title => "库位绑定";
 | 
			
		||||
 | 
			
		||||
        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();
 | 
			
		||||
 | 
			
		||||
                
 | 
			
		||||
            }
 | 
			
		||||
            else
 | 
			
		||||
            {
 | 
			
		||||
| 
						 | 
				
			
			@ -213,6 +215,7 @@ namespace DM_Weight.ViewModels
 | 
			
		|||
            var list = SqlSugarHelper.Db.Queryable<DrugInfo>().Includes<DrugManuNo>(di => di.DrugManuNos).OrderBy(di => di.DrugId).ToList();
 | 
			
		||||
            DrugInfos = list;
 | 
			
		||||
            DrugInfos_PY = list; 
 | 
			
		||||
            
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        private void GetChannelsByDrawerNo()
 | 
			
		||||
| 
						 | 
				
			
			@ -235,6 +238,7 @@ namespace DM_Weight.ViewModels
 | 
			
		|||
        .ToPageList(PageNum, PageSize, ref totalCount);
 | 
			
		||||
            Channels = list;
 | 
			
		||||
            TotalCount = totalCount;
 | 
			
		||||
            
 | 
			
		||||
        }
 | 
			
		||||
        public void OnDialogOpened(IDialogParameters parameters)
 | 
			
		||||
        {
 | 
			
		||||
| 
						 | 
				
			
			@ -269,6 +273,7 @@ namespace DM_Weight.ViewModels
 | 
			
		|||
                        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();
 | 
			
		||||
                            
 | 
			
		||||
                            if (count == 0)
 | 
			
		||||
                            {
 | 
			
		||||
                                var item = SelectChannels[0];
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -26,6 +26,7 @@ namespace DM_Weight.ViewModels
 | 
			
		|||
{
 | 
			
		||||
    public class BindingChannelNewDialogViewModel : BindableBase, IDialogAware, IRegionMemberLifetime
 | 
			
		||||
    {
 | 
			
		||||
        private readonly ILog logger = LogManager.GetLogger(typeof(HomeWindowViewModel));
 | 
			
		||||
 | 
			
		||||
        public string Title => "库位绑定";
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -145,6 +146,7 @@ namespace DM_Weight.ViewModels
 | 
			
		|||
            if (string.IsNullOrEmpty(text))
 | 
			
		||||
            {
 | 
			
		||||
                DrugInfos = SqlSugarHelper.Db.SqlQueryable<DrugInfo>(str).OrderBy(di => di.DrugName).OrderBy(di => di.DrugId).ToList();
 | 
			
		||||
                
 | 
			
		||||
                return;
 | 
			
		||||
            }
 | 
			
		||||
            if (DrugInfos != null)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -3,6 +3,7 @@ using DM_Weight.msg;
 | 
			
		|||
using DM_Weight.Port;
 | 
			
		||||
using DM_Weight.Report;
 | 
			
		||||
using DM_Weight.util;
 | 
			
		||||
using log4net;
 | 
			
		||||
using Prism.Commands;
 | 
			
		||||
using Prism.Events;
 | 
			
		||||
using Prism.Mvvm;
 | 
			
		||||
| 
						 | 
				
			
			@ -22,6 +23,8 @@ namespace DM_Weight.ViewModels
 | 
			
		|||
{
 | 
			
		||||
    public class CheckRecordDetailDialogViewModel : BindableBase, IDialogAware, IRegionMemberLifetime
 | 
			
		||||
    {
 | 
			
		||||
        private readonly ILog logger = LogManager.GetLogger(typeof(CheckRecordDetailDialogViewModel));
 | 
			
		||||
 | 
			
		||||
        public string Title => "盘点记录明细";
 | 
			
		||||
        private int _pageNum = 1;
 | 
			
		||||
        public int PageNum
 | 
			
		||||
| 
						 | 
				
			
			@ -159,6 +162,7 @@ namespace DM_Weight.ViewModels
 | 
			
		|||
            List<CheckRecordStock> checkList = SqlSugarHelper.Db.Queryable<CheckRecordStock>()
 | 
			
		||||
                .Includes<DrugInfo>(cs => cs.DrugInfo)
 | 
			
		||||
                .Where(cs => cs.optdate == OptDate).OrderByDescending(cs => cs.optdate).ToList();
 | 
			
		||||
            
 | 
			
		||||
            ICollectionView vw = CollectionViewSource.GetDefaultView(checkList);
 | 
			
		||||
            vw.GroupDescriptions.Add(new PropertyGroupDescription("DrugInfo"));
 | 
			
		||||
            obsCheckRecordStock = new ObservableCollection<CheckRecordStock>(checkList);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -2,6 +2,7 @@
 | 
			
		|||
using DM_Weight.Port;
 | 
			
		||||
using DM_Weight.Report;
 | 
			
		||||
using DM_Weight.util;
 | 
			
		||||
using log4net;
 | 
			
		||||
using Prism.Commands;
 | 
			
		||||
using Prism.Events;
 | 
			
		||||
using Prism.Mvvm;
 | 
			
		||||
| 
						 | 
				
			
			@ -21,6 +22,8 @@ namespace DM_Weight.ViewModels
 | 
			
		|||
{
 | 
			
		||||
    public class CheckRecordNewWindowViewModel : BindableBase, INavigationAware, IRegionMemberLifetime
 | 
			
		||||
    {
 | 
			
		||||
        private readonly ILog logger = LogManager.GetLogger(typeof(CheckRecordNewWindowViewModel));
 | 
			
		||||
 | 
			
		||||
        private int _pageNum = 1;
 | 
			
		||||
        public int PageNum
 | 
			
		||||
        {
 | 
			
		||||
| 
						 | 
				
			
			@ -168,6 +171,7 @@ namespace DM_Weight.ViewModels
 | 
			
		|||
                    OPTSTARTDATE = StartDate,
 | 
			
		||||
                    OPTENDDATE = EndDate
 | 
			
		||||
                }).ToPageList(PageNum, PageSize, ref totalCount);
 | 
			
		||||
            
 | 
			
		||||
            //SqlSugarHelper.Db.ThenMapper(checkList, item =>
 | 
			
		||||
            //{
 | 
			
		||||
            //    //item.drugDetails = SqlSugarHelper.Db.Queryable<CheckRecordStock>().SetContext(x => x.optdate, () => item.optdate, item).ToList();
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -590,8 +590,8 @@ namespace DM_Weight.ViewModels
 | 
			
		|||
        public void OnNavigatedTo(NavigationContext navigationContext)
 | 
			
		||||
        {
 | 
			
		||||
            _eventAggregator.GetEvent<PortUtilEvent>().Subscribe(DoMyPrismEvent);
 | 
			
		||||
            Task.Factory.StartNew(() => { RequestData(); });
 | 
			
		||||
            //RequestData();
 | 
			
		||||
            //Task.Factory.StartNew(() => { RequestData(); });
 | 
			
		||||
            RequestData();
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -721,8 +721,6 @@ namespace DM_Weight.ViewModels
 | 
			
		|||
        {
 | 
			
		||||
            ChannelStocks.Clear();
 | 
			
		||||
 | 
			
		||||
            ChannelStocks.Clear();
 | 
			
		||||
 | 
			
		||||
            List<ChannelStock> q = SqlSugarHelper.Db.Queryable<ChannelStock>()
 | 
			
		||||
                .Includes<DrugInfo>(cs => cs.DrugInfo)
 | 
			
		||||
                .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)
 | 
			
		||||
        {
 | 
			
		||||
            _eventAggregator.GetEvent<PortUtilEvent>().Subscribe(DoMyPrismEvent);
 | 
			
		||||
            Task.Factory.StartNew(() => { RequestData(); });
 | 
			
		||||
            //RequestData();
 | 
			
		||||
            //Task.Factory.StartNew(() => { RequestData(); });
 | 
			
		||||
            RequestData();
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -385,6 +385,7 @@ namespace DM_Weight.ViewModels
 | 
			
		|||
 | 
			
		||||
                return cs;
 | 
			
		||||
            }).ToList();
 | 
			
		||||
            
 | 
			
		||||
            //obChannelStock = new ObservableCollection<ChannelStock>(ChannelStocks);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -382,6 +382,7 @@ namespace DM_Weight.ViewModels
 | 
			
		|||
                .OrderBy(cs => cs.EffDate)
 | 
			
		||||
                .ToList();
 | 
			
		||||
            ChannelStocks = queryData;
 | 
			
		||||
            
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        //接收导航传过来的参数  现在是在此处初始化了表格数据
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -35,6 +35,8 @@ namespace DM_Weight.ViewModels
 | 
			
		|||
        private UserList? _userList;
 | 
			
		||||
        private UserList? _userList2;
 | 
			
		||||
 | 
			
		||||
        
 | 
			
		||||
 | 
			
		||||
        private int loginMode = Convert.ToInt32(ConfigurationManager.AppSettings["loginMode"]?.ToString() ?? "1");
 | 
			
		||||
        public bool MultiLogin
 | 
			
		||||
        {
 | 
			
		||||
| 
						 | 
				
			
			@ -389,14 +391,22 @@ namespace DM_Weight.ViewModels
 | 
			
		|||
                        // 30秒内无人操作鼠标键盘
 | 
			
		||||
                        if ((DateTime.Now - _portUtil.dateTime).TotalSeconds > autoExit && CheckComputerFreeState.GetLastInputTime() > autoExit)
 | 
			
		||||
                        {
 | 
			
		||||
                            logger.Info($"设备30秒内无人操作,用户【{Operator?.Nickname}】自动退出登录");
 | 
			
		||||
                            Operator = null;
 | 
			
		||||
                            Reviewer = null;
 | 
			
		||||
                            Application.Current.Dispatcher.Invoke(() =>
 | 
			
		||||
                            if (Operator is null)
 | 
			
		||||
                            {
 | 
			
		||||
                                _regionManager.RequestNavigate("MainRegion", "LoginWindow");
 | 
			
		||||
                                timer.Stop();
 | 
			
		||||
                            });
 | 
			
		||||
                            }
 | 
			
		||||
                            else
 | 
			
		||||
                            {
 | 
			
		||||
                                logger.Info($"设备{autoExit}秒内无人操作,用户【{Operator?.Nickname}】自动退出登录");
 | 
			
		||||
                                Operator = null;
 | 
			
		||||
                                Reviewer = null;
 | 
			
		||||
                                timer.Stop();
 | 
			
		||||
                                Application.Current.Dispatcher.Invoke(() =>
 | 
			
		||||
                                {
 | 
			
		||||
                                    _regionManager.RequestNavigate("MainRegion", "LoginWindow");
 | 
			
		||||
                                    timer.Stop();
 | 
			
		||||
                                });
 | 
			
		||||
                            }
 | 
			
		||||
                        }
 | 
			
		||||
                    }
 | 
			
		||||
                };
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -291,7 +291,7 @@ namespace DM_Weight.ViewModels
 | 
			
		|||
            if (SelectedInvoice != null)
 | 
			
		||||
            {
 | 
			
		||||
                //先查询有几种药
 | 
			
		||||
                string strSql = @"SELECT sum(Quantity) AS SumQuantity, COUNT(ID) AS CountNum,INVOICE_NO AS InvoiceNo,drug_id AS DrugId,QUANTITY AS quantity,drug_manu_no AS drugManuNo FROM IN_OUT_INVOICE WHERE STATUS=0 AND INVOICE_NO=@INVOICE_NO  GROUP BY INVOICE_NO,DRUG_ID";
 | 
			
		||||
                string strSql = @"SELECT sum(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";
 | 
			
		||||
 | 
			
		||||
                var invoices = SqlSugarHelper.Db.SqlQueryable<InOutInvoice>(strSql)
 | 
			
		||||
                                                    .AddParameters(new
 | 
			
		||||
| 
						 | 
				
			
			@ -308,7 +308,7 @@ namespace DM_Weight.ViewModels
 | 
			
		|||
                                                 //.Includes(cl => cl.channelStocks, dr => dr.DrugInfo, d => d.DrugManuNos)
 | 
			
		||||
                                                 .Where(cl => cl.DrugId == invoices[i].DrugId && cl.MachineId == (ConfigurationManager.AppSettings["machineId"] ?? "DM1")).ToList();
 | 
			
		||||
                    ChannelList channelLst = channelL.Count > 0 ? channelL[0] : null;
 | 
			
		||||
                    if (channelLst == null || channelLst.Id is null)
 | 
			
		||||
                    if (channelL.Count <= 0)
 | 
			
		||||
                    {
 | 
			
		||||
                        //药品未绑定库位,需要先绑药
 | 
			
		||||
                        //AlertMsg alertMsg = new AlertMsg
 | 
			
		||||
| 
						 | 
				
			
			@ -343,19 +343,45 @@ namespace DM_Weight.ViewModels
 | 
			
		|||
                                _eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
 | 
			
		||||
                                continue;
 | 
			
		||||
                            }
 | 
			
		||||
                            ChannelStock stock = new ChannelStock();
 | 
			
		||||
                            //没有库存写入一条数据
 | 
			
		||||
                            stock.MachineId = ConfigurationManager.AppSettings["machineId"] ?? "DM1";
 | 
			
		||||
                            stock.DrawerNo = channelLst.DrawerNo;
 | 
			
		||||
                            stock.BoardType = channelLst.BoardType;
 | 
			
		||||
                            stock.DrawerType = channelLst.DrawerType;
 | 
			
		||||
                            stock.ColNo = channelLst.ColNo;
 | 
			
		||||
                            stock.DrugId = channelLst.DrugId;
 | 
			
		||||
                            stock.ManuNo = invoicesManuNo[j].DrugManuNo;
 | 
			
		||||
                            stock.EffDate = manuNoList[0].EffDate;
 | 
			
		||||
                            stock.Chnguid = channelLst.Id;
 | 
			
		||||
                            stock.InvoiceQuantity = invoicesManuNo[j].quantity;
 | 
			
		||||
                            stockList.Add(stock);
 | 
			
		||||
                            //没有根据药品绑定库位写入数据
 | 
			
		||||
                            for (int k = 0; k < channelL.Count; k++)
 | 
			
		||||
                            {
 | 
			
		||||
 | 
			
		||||
                                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);
 | 
			
		||||
                            }
 | 
			
		||||
                        }
 | 
			
		||||
                        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;
 | 
			
		||||
                        //stockList.ForEach(s => s.AddQuantity = invoicesManuNo[j].quantity);
 | 
			
		||||
| 
						 | 
				
			
			@ -364,7 +390,6 @@ namespace DM_Weight.ViewModels
 | 
			
		|||
                           {
 | 
			
		||||
                               var ret = it.First();
 | 
			
		||||
                               ret.AddQuantity = invoicesManuNo[j].quantity;
 | 
			
		||||
                               ret.InvoiceQuantity = invoicesManuNo[j].quantity;
 | 
			
		||||
                               return ret;
 | 
			
		||||
                           })
 | 
			
		||||
                           .ToList();
 | 
			
		||||
| 
						 | 
				
			
			@ -392,8 +417,7 @@ namespace DM_Weight.ViewModels
 | 
			
		|||
                ChannelStocks.Clear();
 | 
			
		||||
                foreach (ChannelList lst in ChannelLsts)
 | 
			
		||||
                {
 | 
			
		||||
 | 
			
		||||
                    ChannelStocks.AddRange(lst.channelStocks.Where(cs => cs.AddQuantity > 9));
 | 
			
		||||
                    ChannelStocks.AddRange(lst.channelStocks);
 | 
			
		||||
                }
 | 
			
		||||
                AddChannels = ChannelStocks.FindAll(it => it.AddQuantity != 0);
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -417,17 +441,17 @@ namespace DM_Weight.ViewModels
 | 
			
		|||
                    _eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
 | 
			
		||||
                    return;
 | 
			
		||||
                }
 | 
			
		||||
                //int totalNum = AddChannels.Sum(add => add.AddQuantity);
 | 
			
		||||
                //if (totalNum != SelectedInvoice.Quantity)
 | 
			
		||||
                //{
 | 
			
		||||
                //    AlertMsg alertMsg = new AlertMsg
 | 
			
		||||
                //    {
 | 
			
		||||
                //        Message = "各批次添加数量要与调拨单药品总数一致!",
 | 
			
		||||
                //        Type = MsgType.ERROR,
 | 
			
		||||
                //    };
 | 
			
		||||
                //    _eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
 | 
			
		||||
                //    return;
 | 
			
		||||
                //}
 | 
			
		||||
                int totalNum = AddChannels.Sum(add => add.AddQuantity);
 | 
			
		||||
                if (totalNum != SelectedInvoice.Quantity)
 | 
			
		||||
                {
 | 
			
		||||
                    AlertMsg alertMsg = new AlertMsg
 | 
			
		||||
                    {
 | 
			
		||||
                        Message = "各批次添加数量要与调拨单药品总数一致!",
 | 
			
		||||
                        Type = MsgType.ERROR,
 | 
			
		||||
                    };
 | 
			
		||||
                    _eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
 | 
			
		||||
                    return;
 | 
			
		||||
                }
 | 
			
		||||
                enumerator.MoveNext();
 | 
			
		||||
                Status = 1;
 | 
			
		||||
                OpenOneByOne();
 | 
			
		||||
| 
						 | 
				
			
			@ -509,48 +533,18 @@ namespace DM_Weight.ViewModels
 | 
			
		|||
                if (!_isFinishClick)
 | 
			
		||||
                {
 | 
			
		||||
                    _isFinishClick = true;
 | 
			
		||||
                    List<ChannelStock> record = ChannelStocks;//.ToList();
 | 
			
		||||
                    List<ChannelStock> record = ChannelStocks.Where(it=>it.AddQuantity>0).ToList();
 | 
			
		||||
                    string InvoiceId = SelectedInvoice.InvoiceNo;
 | 
			
		||||
                    var f = SqlSugarHelper.Db.UseTran(() =>
 | 
			
		||||
                    {
 | 
			
		||||
                        SqlSugarHelper.Db.Updateable(new InOutInvoice()
 | 
			
		||||
                        {
 | 
			
		||||
                            Status = 1,
 | 
			
		||||
                            InvoiceNo = SelectedInvoice.InvoiceNo
 | 
			
		||||
                        }).UpdateColumns(it => new { it.Status }).WhereColumns(it => new { it.InvoiceNo }).ExecuteCommand();
 | 
			
		||||
 | 
			
		||||
                        for (int i = 0; i < record.Count; i++)
 | 
			
		||||
                        {
 | 
			
		||||
                            //添加数量不能大于入库单上要加的数量
 | 
			
		||||
                            if (record[i].AddQuantity > record[i].InvoiceQuantity)
 | 
			
		||||
                            {
 | 
			
		||||
                                AlertMsg alertMsg = new AlertMsg
 | 
			
		||||
                                {
 | 
			
		||||
                                    Message = "添加数量不能大于调拨单中药品数量!",
 | 
			
		||||
                                    Type = MsgType.ERROR,
 | 
			
		||||
                                };
 | 
			
		||||
                                _eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
 | 
			
		||||
                                return false;
 | 
			
		||||
                            }
 | 
			
		||||
                            //添加数量等于入库单上要加的数量则更新入库单状态
 | 
			
		||||
                            if (record[i].AddQuantity == record[i].InvoiceQuantity)
 | 
			
		||||
                            {
 | 
			
		||||
                                SqlSugarHelper.Db.Updateable(new InOutInvoice()
 | 
			
		||||
                                {
 | 
			
		||||
                                    Status = 1,
 | 
			
		||||
                                    InvoiceNo = SelectedInvoice.InvoiceNo,
 | 
			
		||||
                                    DrugManuNo = record[i].ManuNo,
 | 
			
		||||
                                    DrugId = record[i].DrugId
 | 
			
		||||
 | 
			
		||||
                                }).UpdateColumns(it => new { it.Status }).WhereColumns(it => new { it.InvoiceNo, it.DrugId, it.DrugManuNo }).ExecuteCommand();
 | 
			
		||||
                            }
 | 
			
		||||
                            else
 | 
			
		||||
                            {
 | 
			
		||||
                                //添加数量小于入库单上要加的数量则更新入库单中的数量
 | 
			
		||||
                                SqlSugarHelper.Db.Updateable(new InOutInvoice()
 | 
			
		||||
                                {
 | 
			
		||||
                                    quantity= record[i].InvoiceQuantity- record[i].AddQuantity,
 | 
			
		||||
                                    InvoiceNo = SelectedInvoice.InvoiceNo,
 | 
			
		||||
                                    DrugManuNo = record[i].ManuNo,
 | 
			
		||||
                                    DrugId = record[i].DrugId
 | 
			
		||||
 | 
			
		||||
                                }).UpdateColumns(it => new { it.Status }).WhereColumns(it => new { it.InvoiceNo, it.DrugId, it.DrugManuNo }).ExecuteCommand();
 | 
			
		||||
 | 
			
		||||
                            }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
                            ChannelStock it = record[i];
 | 
			
		||||
| 
						 | 
				
			
			@ -575,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();
 | 
			
		||||
                                if (csCount.Count > 0)
 | 
			
		||||
                                {
 | 
			
		||||
                                    logger.Info($"批号重复:{it.DrawerNo}-{it.ColNo}-{it.ManuNo}");
 | 
			
		||||
                                    //repeatList.Add(it.ManuNo);
 | 
			
		||||
                                    //stockRepeats.Add(it);
 | 
			
		||||
                                    continue;
 | 
			
		||||
| 
						 | 
				
			
			@ -697,7 +692,6 @@ namespace DM_Weight.ViewModels
 | 
			
		|||
                            Type = MsgType.SUCCESS,
 | 
			
		||||
                        };
 | 
			
		||||
                        _eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
 | 
			
		||||
                        RequestData();
 | 
			
		||||
                    }
 | 
			
		||||
                    if (!f.IsSuccess)
 | 
			
		||||
                    {
 | 
			
		||||
| 
						 | 
				
			
			@ -713,6 +707,7 @@ namespace DM_Weight.ViewModels
 | 
			
		|||
                    _isFinishClick = false;
 | 
			
		||||
 | 
			
		||||
                }
 | 
			
		||||
                RequestData();
 | 
			
		||||
            });
 | 
			
		||||
        }
 | 
			
		||||
        // 取消按钮
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,6 +1,6 @@
 | 
			
		|||
using log4net;
 | 
			
		||||
using Microsoft.Xaml.Behaviors;
 | 
			
		||||
using NetTaste;
 | 
			
		||||
//using NetTaste;
 | 
			
		||||
using Prism.Commands;
 | 
			
		||||
using Prism.Events;
 | 
			
		||||
using Prism.Mvvm;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -150,7 +150,7 @@ _exitCommand ??= new DelegateCommand(Exit);
 | 
			
		|||
 | 
			
		||||
                                        .Includes<RoleDm>(u => u.Role)
 | 
			
		||||
                                        .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>()
 | 
			
		||||
                    //                    .Includes<RoleDm>(u => u.Role)
 | 
			
		||||
                    //                   .InnerJoin<RoleDm>((u, r) => u.RoleId == r.Id)
 | 
			
		||||
| 
						 | 
				
			
			@ -339,11 +339,11 @@ _exitCommand ??= new DelegateCommand(Exit);
 | 
			
		|||
                    logger.Info($"msg.Message.Equals:{msg.Message}");
 | 
			
		||||
                    if (msg.Message.Equals("LOGIN"))
 | 
			
		||||
                    {
 | 
			
		||||
                        //UserList userList = SqlSugarHelper.Db.Queryable<UserList>()
 | 
			
		||||
                        //.Includes<RoleDm>(u => u.Role)
 | 
			
		||||
                        //.First(u => u.Id == msg.Id);
 | 
			
		||||
                        UserList userList = SqlSugarHelper.Db.Queryable<UserList>()
 | 
			
		||||
                        .Includes<RoleDm>(u => u.Role)
 | 
			
		||||
                        .First(u => u.Id == msg.Id);
 | 
			
		||||
                        
 | 
			
		||||
                        UserList userList = new UserService().CheckUserByFingerPrinter(msg.Id);
 | 
			
		||||
                        //UserList userList = new UserService().CheckUserByFingerPrinter(msg.Id);
 | 
			
		||||
 | 
			
		||||
                        logger.Info($"userList是空?{userList == null}");
 | 
			
		||||
                        if (userList == null)
 | 
			
		||||
| 
						 | 
				
			
			@ -378,7 +378,11 @@ _exitCommand ??= new DelegateCommand(Exit);
 | 
			
		|||
            }
 | 
			
		||||
            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);
 | 
			
		||||
                //}
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -85,7 +85,7 @@ namespace DM_Weight.ViewModels
 | 
			
		|||
 | 
			
		||||
            }));
 | 
			
		||||
 | 
			
		||||
            Task.Factory.StartNew(() => BindStock());
 | 
			
		||||
            //Task.Factory.StartNew(() => BindStock());
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        void doMyPrismEvent2(AlertMsg msg)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,7 +1,7 @@
 | 
			
		|||
using log4net;
 | 
			
		||||
using log4net.Repository.Hierarchy;
 | 
			
		||||
using Microsoft.Xaml.Behaviors;
 | 
			
		||||
using NetTaste;
 | 
			
		||||
//using NetTaste;
 | 
			
		||||
using Prism.Commands;
 | 
			
		||||
using Prism.Events;
 | 
			
		||||
using Prism.Mvvm;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,6 +1,6 @@
 | 
			
		|||
using log4net;
 | 
			
		||||
using Microsoft.Xaml.Behaviors;
 | 
			
		||||
using NetTaste;
 | 
			
		||||
//using NetTaste;
 | 
			
		||||
using Prism.Commands;
 | 
			
		||||
using Prism.Events;
 | 
			
		||||
using Prism.Mvvm;
 | 
			
		||||
| 
						 | 
				
			
			@ -21,6 +21,7 @@ using DM_Weight.Port;
 | 
			
		|||
using DM_Weight.select;
 | 
			
		||||
using DM_Weight.util;
 | 
			
		||||
using System.Threading;
 | 
			
		||||
using System.Windows.Controls.Primitives;
 | 
			
		||||
 | 
			
		||||
namespace DM_Weight.ViewModels
 | 
			
		||||
{
 | 
			
		||||
| 
						 | 
				
			
			@ -171,10 +172,10 @@ namespace DM_Weight.ViewModels
 | 
			
		|||
 | 
			
		||||
        public void RequestData()
 | 
			
		||||
        {
 | 
			
		||||
            //
 | 
			
		||||
            orderDetails = SqlSugarHelper.Db.Queryable<OrderDetail>()
 | 
			
		||||
                  .Includes<DrugInfo>(od => od.DrugInfo)
 | 
			
		||||
                  .InnerJoin(SqlSugarHelper.Db.Queryable<ChannelStock>().Where(cs => cs.DrawerType == 1).Where(cs => cs.MachineId.Equals(ConfigurationManager.AppSettings["machineId"] ?? "DM1")).GroupBy(cs => cs.DrugId), (od, t) => od.DrugId == t.DrugId)
 | 
			
		||||
                  .Where(od=>od.DMStatus==0)
 | 
			
		||||
                  .Where(od => od.OrderNo == OrderInfo.OrderNo)
 | 
			
		||||
                  .ToList();
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -207,14 +208,12 @@ namespace DM_Weight.ViewModels
 | 
			
		|||
                        ChannelStock stock = HasQChannels[j];
 | 
			
		||||
                        if (TakeQ > stock.Quantity)
 | 
			
		||||
                        {
 | 
			
		||||
                            stock.OrderQuantity= orderDetail.Quantity;
 | 
			
		||||
                            stock.TakeQuantity = stock.Quantity;
 | 
			
		||||
                            channelStocks.Add(stock);
 | 
			
		||||
                            TakeQ -= stock.Quantity;
 | 
			
		||||
                        }
 | 
			
		||||
                        else
 | 
			
		||||
                        {
 | 
			
		||||
                            stock.OrderQuantity = orderDetail.Quantity;
 | 
			
		||||
                            stock.TakeQuantity = TakeQ;
 | 
			
		||||
                            channelStocks.Add(stock);
 | 
			
		||||
                            TakeQ = 0;
 | 
			
		||||
| 
						 | 
				
			
			@ -223,16 +222,7 @@ namespace DM_Weight.ViewModels
 | 
			
		|||
                }
 | 
			
		||||
                else
 | 
			
		||||
                {
 | 
			
		||||
                    //msg.Add($"药品【{orderDetail.DrugInfo.DrugName}】库存不足,应取【{TakeQ}】库存【{total}】");
 | 
			
		||||
                    //数量不够就把全部数量取出
 | 
			
		||||
                    for (int n = 0; n < HasQChannels.Count; n++)
 | 
			
		||||
                    {
 | 
			
		||||
                        ChannelStock stock = HasQChannels[n];
 | 
			
		||||
                        stock.OrderQuantity = TakeQ;
 | 
			
		||||
                        stock.TakeQuantity = stock.Quantity;
 | 
			
		||||
                        channelStocks.Add(stock);
 | 
			
		||||
                    }
 | 
			
		||||
 | 
			
		||||
                    msg.Add($"药品【{orderDetail.DrugInfo.DrugName}】库存不足,应取【{TakeQ}】库存【{total}】");
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
            if (msg.Count > 0)
 | 
			
		||||
| 
						 | 
				
			
			@ -344,50 +334,19 @@ namespace DM_Weight.ViewModels
 | 
			
		|||
                        try
 | 
			
		||||
                        { 
 | 
			
		||||
                            SqlSugarHelper.Db.BeginTran();
 | 
			
		||||
                            //如果处方下全部药品都取完则更新orderInfo,order_detail中的dm_status
 | 
			
		||||
                            if (ChannelStocks.Sum(cs => cs.TakeQuantity) == ChannelStocks.Sum(cs => cs.OrderQuantity))
 | 
			
		||||
                            logger.Info($"更新OrderInfo:{InvoiceId}");
 | 
			
		||||
                            SqlSugarHelper.Db.Updateable(new OrderInfo()
 | 
			
		||||
                            {
 | 
			
		||||
                                logger.Info($"更新OrderInfo:{InvoiceId}");
 | 
			
		||||
                                SqlSugarHelper.Db.Updateable(new OrderInfo()
 | 
			
		||||
                                {
 | 
			
		||||
                                    DmStatus = 1,
 | 
			
		||||
                                    OrderNo = OrderInfo.OrderNo
 | 
			
		||||
                                }).UpdateColumns(it => new { it.DmStatus }).WhereColumns(it => new { it.OrderNo }).ExecuteCommand();
 | 
			
		||||
                                SqlSugarHelper.Db.Updateable(new OrderDetail()
 | 
			
		||||
                                {
 | 
			
		||||
                                    DMStatus = 1,
 | 
			
		||||
                                    OrderNo = OrderInfo.OrderNo
 | 
			
		||||
                                }).UpdateColumns(it => new { it.DMStatus }).WhereColumns(it => new { it.OrderNo }).ExecuteCommand();
 | 
			
		||||
                            }
 | 
			
		||||
 | 
			
		||||
                                DmStatus = 1,
 | 
			
		||||
                                OrderNo = OrderInfo.OrderNo
 | 
			
		||||
                            }).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循环");
 | 
			
		||||
                            for (int i = 0; i < record.Count; 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}");
 | 
			
		||||
                                // 更新数据 库存信息
 | 
			
		||||
| 
						 | 
				
			
			@ -434,8 +393,8 @@ namespace DM_Weight.ViewModels
 | 
			
		|||
                            logger.Info("事务已提交");
 | 
			
		||||
                            // 更新屏显库存
 | 
			
		||||
                            //List<ChannelStock> singleChannels = record.FindAll(it => it.BoardType != 1);
 | 
			
		||||
                            Task.Factory.StartNew(() =>
 | 
			
		||||
                            {
 | 
			
		||||
                            //Task.Run(() =>
 | 
			
		||||
                            //{
 | 
			
		||||
                                List<ChannelStock> singleChannels = record.Where(it => it.BoardType == 5)
 | 
			
		||||
                                                                         .GroupBy(it => new { it.DrawerNo, it.ColNo })
 | 
			
		||||
                                                                         .Select(it =>
 | 
			
		||||
| 
						 | 
				
			
			@ -484,7 +443,7 @@ namespace DM_Weight.ViewModels
 | 
			
		|||
                                    };
 | 
			
		||||
                                    _eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
 | 
			
		||||
                                }));
 | 
			
		||||
                            });
 | 
			
		||||
                            //});
 | 
			
		||||
 | 
			
		||||
                        }
 | 
			
		||||
                        catch (Exception ex)
 | 
			
		||||
| 
						 | 
				
			
			@ -497,6 +456,7 @@ namespace DM_Weight.ViewModels
 | 
			
		|||
                                Type = MsgType.ERROR,
 | 
			
		||||
                            };
 | 
			
		||||
                            _eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg); 
 | 
			
		||||
                            _isFinishClick = false;
 | 
			
		||||
                        }
 | 
			
		||||
 | 
			
		||||
                        //var f = SqlSugarHelper.Db.UseTran(() =>
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -225,6 +225,8 @@ namespace DM_Weight.ViewModels
 | 
			
		|||
            logger.Info("开始OrderTakeDrugWindowViewModel_查询数据");
 | 
			
		||||
            OrderInfos.Clear();
 | 
			
		||||
            int totalCount = 0;
 | 
			
		||||
            //logger.Info($"SqlSugarHelper.Db.Ado.Connection.GetHashCode():{_db.Ado.Connection.GetHashCode()}");
 | 
			
		||||
            
 | 
			
		||||
            List<OrderInfo> queryData = SqlSugarHelper.Db.Queryable<OrderInfo>()
 | 
			
		||||
                .InnerJoin<OrderDetail>((oi, od) => oi.OrderNo == od.OrderNo)
 | 
			
		||||
                .InnerJoin(SqlSugarHelper.Db.Queryable<ChannelList>().Where(cs => cs.DrawerType == 1).Where(cs => cs.MachineId.Equals(ConfigurationManager.AppSettings["machineId"] ?? "DM1")).GroupBy(cs => cs.DrugId), (oi, od, t) => od.DrugId == t.DrugId)
 | 
			
		||||
| 
						 | 
				
			
			@ -242,7 +244,7 @@ namespace DM_Weight.ViewModels
 | 
			
		|||
            OrderInfos = queryData;
 | 
			
		||||
            TotalCount = totalCount;
 | 
			
		||||
            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_查询数据");
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -251,8 +253,8 @@ namespace DM_Weight.ViewModels
 | 
			
		|||
        {
 | 
			
		||||
            logger.Info("进入OrderTakeDrugWindowViewModel_OnNavigatedTo");
 | 
			
		||||
            _eventAggregator.GetEvent<PortUtilEvent>().Subscribe(DoMyPrismEvent);
 | 
			
		||||
            //RequestData();
 | 
			
		||||
            Task.Factory.StartNew(() => RequestData());
 | 
			
		||||
            RequestData();
 | 
			
		||||
            //Task.Factory.StartNew(() => RequestData());
 | 
			
		||||
 | 
			
		||||
            logger.Info("结束OrderTakeDrugWindowViewModel_OnNavigatedTo");
 | 
			
		||||
            //Task t = new Task(() => { RequestData(); });
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -238,7 +238,8 @@ namespace DM_Weight.ViewModels
 | 
			
		|||
        //接收导航传过来的参数  现在是在此处初始化了表格数据
 | 
			
		||||
        public void OnNavigatedTo(NavigationContext navigationContext)
 | 
			
		||||
        {
 | 
			
		||||
            Task.Factory.StartNew(() => RequestData());
 | 
			
		||||
            //Task.Factory.StartNew(() => RequestData());
 | 
			
		||||
            RequestData();
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        //每次导航的时候,该实列用不用重新创建,true是不重新创建,false是重新创建
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -192,7 +192,8 @@ namespace DM_Weight.ViewModels
 | 
			
		|||
        //接收导航传过来的参数  现在是在此处初始化了表格数据
 | 
			
		||||
        public void OnNavigatedTo(NavigationContext navigationContext)
 | 
			
		||||
        {
 | 
			
		||||
            Task.Factory.StartNew(() => RequestData());
 | 
			
		||||
            //Task.Factory.StartNew(() => RequestData());
 | 
			
		||||
            RequestData();
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        //每次导航的时候,该实列用不用重新创建,true是不重新创建,false是重新创建
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -192,7 +192,8 @@ namespace DM_Weight.ViewModels
 | 
			
		|||
        public void OnNavigatedTo(NavigationContext navigationContext)
 | 
			
		||||
        {
 | 
			
		||||
            logger.Info("进入SelfAddWindowViewModel_OnNavigatedTo");
 | 
			
		||||
            Task.Factory.StartNew(() => RequestChannelData());
 | 
			
		||||
            //Task.Factory.StartNew(() => RequestChannelData());
 | 
			
		||||
            RequestChannelData();
 | 
			
		||||
            logger.Info("结束SelfAddWindowViewModel_OnNavigatedTo");
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -21,6 +21,48 @@ namespace DM_Weight.ViewModels
 | 
			
		|||
{
 | 
			
		||||
    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;
 | 
			
		||||
        IEventAggregator _eventAggregator;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -210,24 +252,28 @@ namespace DM_Weight.ViewModels
 | 
			
		|||
            //    .OrderBy(cs => cs.ColNo)
 | 
			
		||||
            //    .ToList();
 | 
			
		||||
            //ChannelStocks = queryData;
 | 
			
		||||
            int totalCount = 0;
 | 
			
		||||
            List<DrugInfo> q = SqlSugarHelper.Db.Queryable<DrugInfo>()
 | 
			
		||||
                .Includes<ChannelStock>(di => di.channelStocks.Where(cs => cs.DrawerType == 1).Where(cs => cs.MachineId.Equals(ConfigurationManager.AppSettings["machineId"] ?? "DM1") && cs.DrugId != null).OrderBy(cs => cs.DrawerNo).OrderBy(cs => cs.ColNo).ToList())
 | 
			
		||||
                .WhereIF(!String.IsNullOrEmpty(SearchValue) && SelectedItem.Code.Equals("DrugId"), (cs) => cs.DrugId.Contains(SearchValue))
 | 
			
		||||
                
 | 
			
		||||
               .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("PyCode"), (cs) => cs.PyCode.Contains(SearchValue))
 | 
			
		||||
                .WhereIF(!String.IsNullOrEmpty(SearchValue) && SelectedItem.Code.Equals("DrugBarcode"), (cs) => cs.DrugBarcode.Contains(SearchValue))
 | 
			
		||||
               .Where(di => di.channelStocks.Any(cs => cs.MachineId.Equals(ConfigurationManager.AppSettings["machineId"] ?? "DM1") && cs.DrugId != null))
 | 
			
		||||
               .OrderBy(cs => cs.DrugId)
 | 
			
		||||
               .ToList();
 | 
			
		||||
               .ToPageList(PageNum, PageSize, ref totalCount);
 | 
			
		||||
            Drugs = q;
 | 
			
		||||
            TotalCount = totalCount;
 | 
			
		||||
            PageCount = (int)Math.Ceiling((double)TotalCount / PageSize);
 | 
			
		||||
            logger.Info("结束SelfAddWindowViewModel_查询数据");
 | 
			
		||||
            
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        //接收导航传过来的参数  现在是在此处初始化了表格数据
 | 
			
		||||
        public void OnNavigatedTo(NavigationContext navigationContext)
 | 
			
		||||
        {
 | 
			
		||||
            logger.Info("进入SelfAddWindowViewModel_OnNavigatedTo");
 | 
			
		||||
            Task.Factory.StartNew(() => RequestChannelData());
 | 
			
		||||
            RequestChannelData();
 | 
			
		||||
            logger.Info("结束SelfAddWindowViewModel_OnNavigatedTo");
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -14,14 +14,59 @@ using DM_Weight.util;
 | 
			
		|||
using DM_Weight.msg;
 | 
			
		||||
using Prism.Events;
 | 
			
		||||
using SqlSugar;
 | 
			
		||||
using log4net;
 | 
			
		||||
using System.Drawing.Printing;
 | 
			
		||||
 | 
			
		||||
namespace DM_Weight.ViewModels
 | 
			
		||||
{
 | 
			
		||||
    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;
 | 
			
		||||
        IEventAggregator _eventAggregator;
 | 
			
		||||
 | 
			
		||||
        public static List<OrderTakeSelect> StaticSelects = new()
 | 
			
		||||
        {
 | 
			
		||||
            new OrderTakeSelect
 | 
			
		||||
| 
						 | 
				
			
			@ -49,7 +94,7 @@ namespace DM_Weight.ViewModels
 | 
			
		|||
        public SelfTakeDrugWindowViewModel(IDialogService DialogService, IEventAggregator eventAggregator, SqlSugarScope sqlSugarScope)
 | 
			
		||||
        {
 | 
			
		||||
            _dialogService = DialogService;
 | 
			
		||||
            _eventAggregator= eventAggregator;
 | 
			
		||||
            _eventAggregator = eventAggregator;
 | 
			
		||||
            //this.SqlSugarHelper.Db = sqlSugarScope;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -195,6 +240,7 @@ namespace DM_Weight.ViewModels
 | 
			
		|||
            //    .OrderBy(cs => cs.ColNo)
 | 
			
		||||
            //    .ToList();
 | 
			
		||||
            //ChannelStocks = queryData;
 | 
			
		||||
            int totalCount = 0;
 | 
			
		||||
            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&&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("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)
 | 
			
		||||
              .ToList();
 | 
			
		||||
               .ToPageList(PageNum, PageSize, ref totalCount);
 | 
			
		||||
            //.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()}");
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        //接收导航传过来的参数  现在是在此处初始化了表格数据
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -25,6 +25,47 @@ namespace DM_Weight.ViewModels
 | 
			
		|||
{
 | 
			
		||||
    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 string drugId;
 | 
			
		||||
        public static List<OrderTakeSelect> StaticSelects = new()
 | 
			
		||||
| 
						 | 
				
			
			@ -240,7 +281,7 @@ namespace DM_Weight.ViewModels
 | 
			
		|||
            // .OrderBy(cs => cs.DrugId)
 | 
			
		||||
            // .ToList();
 | 
			
		||||
            //Drugs = q;
 | 
			
		||||
 | 
			
		||||
            int totalCount = 0;
 | 
			
		||||
            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())
 | 
			
		||||
| 
						 | 
				
			
			@ -250,9 +291,10 @@ namespace DM_Weight.ViewModels
 | 
			
		|||
               .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)
 | 
			
		||||
             .ToList();
 | 
			
		||||
             .ToPageList(PageNum, PageSize, ref totalCount);
 | 
			
		||||
            Drugs = q;
 | 
			
		||||
 | 
			
		||||
            TotalCount = totalCount;
 | 
			
		||||
            PageCount = (int)Math.Ceiling((double)TotalCount / PageSize);
 | 
			
		||||
            logger.Info("结束StockListWindowViewModel_查询数据");
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -261,7 +303,7 @@ namespace DM_Weight.ViewModels
 | 
			
		|||
        {
 | 
			
		||||
            logger.Info("进入StockListWindowViewModel_OnNavigatedTo");
 | 
			
		||||
            //RequestData();
 | 
			
		||||
            Task.Factory.StartNew(() => RequestData());
 | 
			
		||||
            RequestData();
 | 
			
		||||
            logger.Info("结束StockListWindowViewModel_OnNavigatedTo");
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -144,6 +144,13 @@
 | 
			
		|||
                            ElementStyle="{StaticResource MaterialDesignDataGridTextColumnStyle}"
 | 
			
		||||
                            EditingElementStyle="{StaticResource MaterialDesignDataGridTextColumnEditingStyle}"
 | 
			
		||||
                         />
 | 
			
		||||
                    <DataGridTextColumn  Width="100"
 | 
			
		||||
                            Header="数量" 
 | 
			
		||||
                            IsReadOnly="True"
 | 
			
		||||
                            Binding="{Binding Quantity}"
 | 
			
		||||
                            ElementStyle="{StaticResource MaterialDesignDataGridTextColumnStyle}"
 | 
			
		||||
                            EditingElementStyle="{StaticResource MaterialDesignDataGridTextColumnEditingStyle}"
 | 
			
		||||
                        />
 | 
			
		||||
                    <DataGridTextColumn  Width="130"
 | 
			
		||||
                            Header="批次"
 | 
			
		||||
                            IsReadOnly="True"
 | 
			
		||||
| 
						 | 
				
			
			@ -159,36 +166,13 @@
 | 
			
		|||
                            EditingElementStyle="{StaticResource MaterialDesignDataGridTextColumnEditingStyle}"
 | 
			
		||||
                        />
 | 
			
		||||
                    <DataGridTextColumn  Width="100"
 | 
			
		||||
                            Header="库存数量" 
 | 
			
		||||
                            Header="取出数量"
 | 
			
		||||
                            IsReadOnly="True"
 | 
			
		||||
                            Binding="{Binding Quantity}"
 | 
			
		||||
                            Binding="{Binding TakeQuantity}"
 | 
			
		||||
                            ElementStyle="{StaticResource MaterialDesignDataGridTextColumnStyle}"
 | 
			
		||||
                            EditingElementStyle="{StaticResource MaterialDesignDataGridTextColumnEditingStyle}"
 | 
			
		||||
                        />
 | 
			
		||||
                    <DataGridTextColumn  Width="100"
 | 
			
		||||
                            Header="应取数量"
 | 
			
		||||
                            IsReadOnly="True"
 | 
			
		||||
                            Binding="{Binding OrderQuantity}"
 | 
			
		||||
                            ElementStyle="{StaticResource MaterialDesignDataGridTextColumnStyle}"
 | 
			
		||||
                            EditingElementStyle="{StaticResource MaterialDesignDataGridTextColumnEditingStyle}"
 | 
			
		||||
                        />
 | 
			
		||||
                    <DataGridTemplateColumn Width="100"
 | 
			
		||||
                        Header="取出数量">
 | 
			
		||||
                        <DataGridTemplateColumn.CellTemplate>
 | 
			
		||||
                            <DataTemplate>
 | 
			
		||||
                                <TextBox  Width="100" Style="{StaticResource MaterialDesignDataGridTextColumnEditingStyle}">
 | 
			
		||||
                                    <TextBox.Text>
 | 
			
		||||
                                        <Binding Path="TakeQuantity" Mode="TwoWay" UpdateSourceTrigger="PropertyChanged">
 | 
			
		||||
                                            <Binding.ValidationRules>
 | 
			
		||||
                                                <ExceptionValidationRule />
 | 
			
		||||
                                            </Binding.ValidationRules>
 | 
			
		||||
                                        </Binding>
 | 
			
		||||
                                    </TextBox.Text>
 | 
			
		||||
                                </TextBox>
 | 
			
		||||
                            </DataTemplate>
 | 
			
		||||
                        </DataGridTemplateColumn.CellTemplate>
 | 
			
		||||
                    </DataGridTemplateColumn>
 | 
			
		||||
                </DataGrid.Columns>
 | 
			
		||||
                    </DataGrid.Columns>
 | 
			
		||||
            </DataGrid>
 | 
			
		||||
            <Grid Grid.Row="3">
 | 
			
		||||
                <Grid.ColumnDefinitions>
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -8,6 +8,7 @@
 | 
			
		|||
             xmlns:i="http://schemas.microsoft.com/xaml/behaviors"
 | 
			
		||||
             xmlns:convert="clr-namespace:DM_Weight.Converter"
 | 
			
		||||
             xmlns:prism="http://prismlibrary.com/"
 | 
			
		||||
             xmlns:pagination="clr-namespace:DM_Weight.Components.pagination"
 | 
			
		||||
             mc:Ignorable="d">
 | 
			
		||||
    <Grid>
 | 
			
		||||
        <Grid.Resources>
 | 
			
		||||
| 
						 | 
				
			
			@ -20,6 +21,7 @@
 | 
			
		|||
            <convert:TotalCountConverter x:Key="TotalCountConverter" />
 | 
			
		||||
        </Grid.Resources>
 | 
			
		||||
        <Grid.RowDefinitions>
 | 
			
		||||
            <RowDefinition Height="Auto" />
 | 
			
		||||
            <RowDefinition Height="Auto" />
 | 
			
		||||
            <RowDefinition />
 | 
			
		||||
        </Grid.RowDefinitions>
 | 
			
		||||
| 
						 | 
				
			
			@ -254,7 +256,12 @@
 | 
			
		|||
            </ListView>
 | 
			
		||||
 | 
			
		||||
        </Grid>-->
 | 
			
		||||
        
 | 
			
		||||
        <pagination:Pagination Grid.Row="2"  
 | 
			
		||||
                                   CurrentPage="{Binding PageNum}"
 | 
			
		||||
                                   PageSize="{Binding PageSize}"
 | 
			
		||||
                                   TotalPages="{Binding TotalCount}"
 | 
			
		||||
                                   InfoTextIsEnabel="True"
 | 
			
		||||
                                />
 | 
			
		||||
 | 
			
		||||
    </Grid>
 | 
			
		||||
</UserControl>
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -9,6 +9,7 @@
 | 
			
		|||
             xmlns:i="http://schemas.microsoft.com/xaml/behaviors"
 | 
			
		||||
             xmlns:convert="clr-namespace:DM_Weight.Converter"
 | 
			
		||||
             xmlns:prism="http://prismlibrary.com/"
 | 
			
		||||
             xmlns:pagination="clr-namespace:DM_Weight.Components.pagination"
 | 
			
		||||
             mc:Ignorable="d">
 | 
			
		||||
    <Grid>
 | 
			
		||||
        <Grid.Resources>
 | 
			
		||||
| 
						 | 
				
			
			@ -22,6 +23,7 @@
 | 
			
		|||
        </Grid.Resources>
 | 
			
		||||
        <Grid.RowDefinitions>
 | 
			
		||||
            <RowDefinition Height="Auto" />
 | 
			
		||||
            <RowDefinition Height="Auto"/>
 | 
			
		||||
            <RowDefinition />
 | 
			
		||||
        </Grid.RowDefinitions>
 | 
			
		||||
        <Grid Margin="0 6 0 6" Grid.Row="0">
 | 
			
		||||
| 
						 | 
				
			
			@ -103,7 +105,9 @@
 | 
			
		|||
            <!--GroupStyle to group data-->
 | 
			
		||||
            <!--<DataGrid.GroupStyle>
 | 
			
		||||
                <GroupStyle>
 | 
			
		||||
                    --><!--Group DataItems into DataGroup--><!--
 | 
			
		||||
                    -->
 | 
			
		||||
            <!--Group DataItems into DataGroup-->
 | 
			
		||||
            <!--
 | 
			
		||||
                    <GroupStyle.ContainerStyle>
 | 
			
		||||
                        <Style TargetType="{x:Type GroupItem}">
 | 
			
		||||
                            <Setter Property="Template">
 | 
			
		||||
| 
						 | 
				
			
			@ -187,6 +191,11 @@
 | 
			
		|||
            </DataGrid.Columns>
 | 
			
		||||
        </DataGrid>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    <pagination:Pagination Grid.Row="2"  
 | 
			
		||||
                                   CurrentPage="{Binding PageNum}"
 | 
			
		||||
                                   PageSize="{Binding PageSize}"
 | 
			
		||||
                                   TotalPages="{Binding TotalCount}"
 | 
			
		||||
                                   InfoTextIsEnabel="True"
 | 
			
		||||
                                />
 | 
			
		||||
    </Grid>
 | 
			
		||||
</UserControl>
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -10,6 +10,7 @@
 | 
			
		|||
             xmlns:convert="clr-namespace:DM_Weight.Converter"
 | 
			
		||||
             xmlns:prism="http://prismlibrary.com/"
 | 
			
		||||
             mc:Ignorable="d"
 | 
			
		||||
             xmlns:pagination="clr-namespace:DM_Weight.Components.pagination"
 | 
			
		||||
             d:DesignHeight="450" d:DesignWidth="800">
 | 
			
		||||
    <Grid>
 | 
			
		||||
        <Grid.Resources>
 | 
			
		||||
| 
						 | 
				
			
			@ -22,9 +23,9 @@
 | 
			
		|||
            <convert:DrawerSelectConverter x:Key="DrawerSelectConverter" />
 | 
			
		||||
            <convert:StatusConverter x:Key="StatusConverter" />-->
 | 
			
		||||
            <convert:TotalCountConverter x:Key="TotalCountConverter" />
 | 
			
		||||
            <convert:ColorCountConverter x:Key="ColorCountConverter" />
 | 
			
		||||
        </Grid.Resources>
 | 
			
		||||
        <Grid.RowDefinitions>
 | 
			
		||||
            <RowDefinition Height="Auto" />
 | 
			
		||||
            <RowDefinition Height="Auto" />
 | 
			
		||||
            <RowDefinition />
 | 
			
		||||
        </Grid.RowDefinitions>
 | 
			
		||||
| 
						 | 
				
			
			@ -121,9 +122,7 @@
 | 
			
		|||
            <!--GroupStyle to group data-->
 | 
			
		||||
            <!--<DataGrid.GroupStyle>
 | 
			
		||||
                <GroupStyle>
 | 
			
		||||
                    -->
 | 
			
		||||
            <!--Group DataItems into DataGroup-->
 | 
			
		||||
            <!--
 | 
			
		||||
                    --><!--Group DataItems into DataGroup--><!--
 | 
			
		||||
                    <GroupStyle.ContainerStyle>
 | 
			
		||||
                        <Style TargetType="{x:Type GroupItem}">
 | 
			
		||||
                            <Setter Property="Template">
 | 
			
		||||
| 
						 | 
				
			
			@ -187,20 +186,6 @@
 | 
			
		|||
                        </DataTemplate>
 | 
			
		||||
                    </DataGridTemplateColumn.CellTemplate>
 | 
			
		||||
                </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>
 | 
			
		||||
        <!--<ListView Grid.Row="1"
 | 
			
		||||
| 
						 | 
				
			
			@ -272,6 +257,12 @@
 | 
			
		|||
                </GridView>
 | 
			
		||||
            </ListView.View>
 | 
			
		||||
        </ListView>-->
 | 
			
		||||
        <pagination:Pagination Grid.Row="2"  
 | 
			
		||||
                                   CurrentPage="{Binding PageNum}"
 | 
			
		||||
                                   PageSize="{Binding PageSize}"
 | 
			
		||||
                                   TotalPages="{Binding TotalCount}"
 | 
			
		||||
                                   InfoTextIsEnabel="True"
 | 
			
		||||
                                />
 | 
			
		||||
 | 
			
		||||
    </Grid>
 | 
			
		||||
</UserControl>
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -11,7 +11,7 @@ namespace DM_Weight.util
 | 
			
		|||
 | 
			
		||||
            ConnectionString = ConfigurationManager.ConnectionStrings["database"].ToString(),
 | 
			
		||||
            DbType = DbType.MySql,
 | 
			
		||||
            IsAutoCloseConnection = true
 | 
			
		||||
            IsAutoCloseConnection = false
 | 
			
		||||
        },
 | 
			
		||||
            db =>
 | 
			
		||||
            {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1 +0,0 @@
 | 
			
		|||
湖南省儿童医院16个抽屉,每个抽屉2个库位,带两个三色灯标签
 | 
			
		||||
		Loading…
	
		Reference in New Issue