替换sqlsugar
This commit is contained in:
parent
d423350e06
commit
d6066ef0ca
|
@ -16,7 +16,7 @@
|
||||||
<!--2023/7/13 药房代码 有则写无则空 -->
|
<!--2023/7/13 药房代码 有则写无则空 -->
|
||||||
<add key="storage" value="" />
|
<add key="storage" value="" />
|
||||||
<!-- 登录模式 1单人登录2双人登录 -->
|
<!-- 登录模式 1单人登录2双人登录 -->
|
||||||
<add key="loginMode" value="2" />
|
<add key="loginMode" value="1" />
|
||||||
<!-- 登录顺序,指定先登录的人的名称有效值,只有在登录模式等于2时才会生效; 发药人:【operator】审核人:【reviewer】 -->
|
<!-- 登录顺序,指定先登录的人的名称有效值,只有在登录模式等于2时才会生效; 发药人:【operator】审核人:【reviewer】 -->
|
||||||
<add key="firstLogin" value="operator" />
|
<add key="firstLogin" value="operator" />
|
||||||
<!-- 按处方还药或者按取药记录还药 1:处方2:药品-->
|
<!-- 按处方还药或者按取药记录还药 1:处方2:药品-->
|
||||||
|
@ -38,7 +38,7 @@
|
||||||
<!-- 抽屉串口的串口号 -->
|
<!-- 抽屉串口的串口号 -->
|
||||||
<add key="DrawerPortPath" value="COM1" />
|
<add key="DrawerPortPath" value="COM1" />
|
||||||
<!-- can总线串口的串口号 -->
|
<!-- can总线串口的串口号 -->
|
||||||
<add key="CanBusPortPath" value="COM6" />
|
<add key="CanBusPortPath" value="COM5" />
|
||||||
<!-- 条码枪串口的串口号 -->
|
<!-- 条码枪串口的串口号 -->
|
||||||
<add key="ScanCodePortPath" value="COM8" />
|
<add key="ScanCodePortPath" value="COM8" />
|
||||||
<!-- 抽屉串口的串口号 --><!--
|
<!-- 抽屉串口的串口号 --><!--
|
||||||
|
|
|
@ -24,6 +24,8 @@ using System.Windows.Interop;
|
||||||
using System.Windows.Threading;
|
using System.Windows.Threading;
|
||||||
using System.Timers;
|
using System.Timers;
|
||||||
using DM_Weight.Models;
|
using DM_Weight.Models;
|
||||||
|
using SqlSugar;
|
||||||
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
|
|
||||||
namespace DM_Weight
|
namespace DM_Weight
|
||||||
{
|
{
|
||||||
|
@ -235,6 +237,23 @@ namespace DM_Weight
|
||||||
//交接班
|
//交接班
|
||||||
containerRegistry.RegisterForNavigation<ChangeShiftsDialog, ChangeShiftsDialogViewModel>();
|
containerRegistry.RegisterForNavigation<ChangeShiftsDialog, ChangeShiftsDialogViewModel>();
|
||||||
|
|
||||||
|
containerRegistry.RegisterSingleton<SqlSugarScope>(() => SqlSugarHelperNew.GetInstance());
|
||||||
|
|
||||||
|
containerRegistry.RegisterForNavigation<TestCheckBox, TestCheckBoxViewModel>();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
//protected IServiceProvider ConfigureServices(IServiceCollection services)
|
||||||
|
//{
|
||||||
|
// // 创建 SqlSugar 实例
|
||||||
|
// var db = new SqlSugarClient(new ConnectionConfig()
|
||||||
|
// {
|
||||||
|
// ConnectionString = "server=127.0.0.1;uid=root;pwd=123456;database=mydb",
|
||||||
|
// DbType = DbType.MySql,
|
||||||
|
// IsAutoCloseConnection = true,
|
||||||
|
// InitKeyType = InitKeyType.Attribute
|
||||||
|
// });
|
||||||
|
// // 将实例注册到 IServiceCollection 中
|
||||||
|
// services.AddSingleton(db);
|
||||||
|
//}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,8 +12,11 @@ namespace DM_Weight.Converter
|
||||||
{
|
{
|
||||||
public object Convert(object[] value, Type targetType, object parameter, CultureInfo culture)
|
public object Convert(object[] value, Type targetType, object parameter, CultureInfo culture)
|
||||||
{
|
{
|
||||||
int BoardType = int.Parse(value[0].ToString());
|
int BoardType, DrawerType;
|
||||||
int DrawerType = int.Parse(value[1].ToString());
|
bool boardBool = int.TryParse(value[0].ToString(), out BoardType);
|
||||||
|
bool drawerBool = int.TryParse(value[1].ToString(), out DrawerType);
|
||||||
|
//int BoardType = int.Parse(value[0].ToString());
|
||||||
|
//int DrawerType = int.Parse(value[1].ToString());
|
||||||
switch (BoardType)
|
switch (BoardType)
|
||||||
{
|
{
|
||||||
case 1:
|
case 1:
|
||||||
|
|
|
@ -13,7 +13,7 @@ namespace DM_Weight.Converter
|
||||||
{
|
{
|
||||||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||||
{
|
{
|
||||||
bool status = bool.Parse(value.ToString());
|
//bool status = bool.Parse(value.ToString());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -13,9 +13,19 @@ namespace DM_Weight.Converter
|
||||||
{
|
{
|
||||||
public object Convert(object[] value, Type targetType, object parameter, CultureInfo culture)
|
public object Convert(object[] value, Type targetType, object parameter, CultureInfo culture)
|
||||||
{
|
{
|
||||||
int ButtonDrawerNo = int.Parse(value[0].ToString());
|
if (value != null && value.Length > 0)
|
||||||
int SelectedDrawerNo = int.Parse(value[1].ToString());
|
{
|
||||||
return ButtonDrawerNo == SelectedDrawerNo;
|
//int ButtonDrawerNo = int.Parse(value[0].ToString());
|
||||||
|
//int SelectedDrawerNo = int.Parse(value[1].ToString());
|
||||||
|
int ButtonDrawerNo, SelectedDrawerNo;
|
||||||
|
int.TryParse(value[0].ToString(), out ButtonDrawerNo);
|
||||||
|
int.TryParse(value[1].ToString(), out SelectedDrawerNo);
|
||||||
|
return ButtonDrawerNo == SelectedDrawerNo;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture)
|
public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture)
|
||||||
|
|
|
@ -15,7 +15,10 @@ namespace DM_Weight.Converter
|
||||||
|
|
||||||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||||
{
|
{
|
||||||
return int.Parse(value.ToString()) == 2 || int.Parse(value.ToString()) == 6 ? ReadOnlyValue : NotReadOnlyValue;
|
int iResult;
|
||||||
|
int.TryParse(value.ToString(), out iResult);
|
||||||
|
//return int.Parse(value.ToString()) == 2 || int.Parse(value.ToString()) == 6 ? ReadOnlyValue : NotReadOnlyValue;
|
||||||
|
return iResult == 2 || iResult == 6 ? ReadOnlyValue : NotReadOnlyValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||||
|
|
|
@ -13,9 +13,12 @@ namespace DM_Weight.Converter
|
||||||
{
|
{
|
||||||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||||
{
|
{
|
||||||
int status = int.Parse(value.ToString());
|
//int status = int.Parse(value.ToString());
|
||||||
|
int status;
|
||||||
|
int.TryParse(value.ToString(), out status);
|
||||||
|
string para = parameter?.ToString() ?? "";
|
||||||
//完成
|
//完成
|
||||||
if (parameter.ToString().Equals("drugNameSearch"))
|
if (para.Equals("drugNameSearch"))
|
||||||
{
|
{
|
||||||
if ((status == 1) || (status == 2))
|
if ((status == 1) || (status == 2))
|
||||||
{
|
{
|
||||||
|
@ -26,7 +29,7 @@ namespace DM_Weight.Converter
|
||||||
return Visibility.Collapsed;
|
return Visibility.Collapsed;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(parameter.ToString().Equals("saveBtn"))
|
if(para.Equals("saveBtn"))
|
||||||
{
|
{
|
||||||
if(status==1)
|
if(status==1)
|
||||||
{
|
{
|
||||||
|
@ -37,7 +40,7 @@ namespace DM_Weight.Converter
|
||||||
return Visibility.Collapsed;
|
return Visibility.Collapsed;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(parameter.ToString().Equals("gridviewColumn"))
|
if(para.Equals("gridviewColumn"))
|
||||||
{
|
{
|
||||||
if(status== 1)
|
if(status== 1)
|
||||||
{
|
{
|
||||||
|
@ -48,6 +51,28 @@ namespace DM_Weight.Converter
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if(para.Equals("gridviewCheckQuantity"))
|
||||||
|
{
|
||||||
|
if(status== 4)
|
||||||
|
{
|
||||||
|
return 150;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (para.Equals("gridviewQuantity"))
|
||||||
|
{
|
||||||
|
if (status == 4)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return 100;
|
||||||
|
}
|
||||||
|
}
|
||||||
return Visibility.Collapsed;
|
return Visibility.Collapsed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -13,9 +13,12 @@ namespace DM_Weight.Converter
|
||||||
{
|
{
|
||||||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||||
{
|
{
|
||||||
int status = int.Parse(value.ToString());
|
//int status = int.Parse(value.ToString());
|
||||||
|
int status;
|
||||||
|
int.TryParse(value.ToString(),out status);
|
||||||
|
string para = parameter?.ToString()??"";
|
||||||
//完成
|
//完成
|
||||||
if (parameter.ToString().Equals("CompleteBtn"))
|
if (para.Equals("CompleteBtn"))
|
||||||
{
|
{
|
||||||
if (status == 3)
|
if (status == 3)
|
||||||
{
|
{
|
||||||
|
@ -27,7 +30,7 @@ namespace DM_Weight.Converter
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//关闭
|
//关闭
|
||||||
if (parameter.ToString().Equals("CloseBtn"))
|
if (para.Equals("CloseBtn"))
|
||||||
{
|
{
|
||||||
if (status > 0 && status < 3)
|
if (status > 0 && status < 3)
|
||||||
{
|
{
|
||||||
|
@ -38,7 +41,7 @@ namespace DM_Weight.Converter
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (parameter.ToString().Equals("opearBtnLoading"))
|
if (para.Equals("opearBtnLoading"))
|
||||||
{
|
{
|
||||||
if (status > 0 && status < 3)
|
if (status > 0 && status < 3)
|
||||||
{
|
{
|
||||||
|
@ -50,7 +53,7 @@ namespace DM_Weight.Converter
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//取药
|
//取药
|
||||||
if (parameter.ToString().Equals("opearBtnVisible"))
|
if (para.Equals("opearBtnVisible"))
|
||||||
{
|
{
|
||||||
if (status < 3)
|
if (status < 3)
|
||||||
{
|
{
|
||||||
|
@ -62,7 +65,7 @@ namespace DM_Weight.Converter
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//取消
|
//取消
|
||||||
if (parameter.ToString().Equals("CancelBtn"))
|
if (para.Equals("CancelBtn"))
|
||||||
{
|
{
|
||||||
if (status > 0)
|
if (status > 0)
|
||||||
{
|
{
|
||||||
|
|
|
@ -68,6 +68,7 @@
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="log4net" Version="2.0.15" />
|
<PackageReference Include="log4net" Version="2.0.15" />
|
||||||
<PackageReference Include="MaterialDesignThemes" Version="4.8.0" />
|
<PackageReference Include="MaterialDesignThemes" Version="4.8.0" />
|
||||||
|
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="8.0.0" />
|
||||||
<PackageReference Include="Microsoft.Xaml.Behaviors.Wpf" Version="1.1.39" />
|
<PackageReference Include="Microsoft.Xaml.Behaviors.Wpf" Version="1.1.39" />
|
||||||
<PackageReference Include="Prism.Unity" Version="8.1.97" />
|
<PackageReference Include="Prism.Unity" Version="8.1.97" />
|
||||||
<PackageReference Include="SqlSugarCore" Version="5.1.4.67" />
|
<PackageReference Include="SqlSugarCore" Version="5.1.4.67" />
|
||||||
|
|
|
@ -23,10 +23,10 @@ namespace DM_Weight.Finger
|
||||||
public zkemkeeper.CZKEMClass axCZKEM1; //= new zkemkeeper.CZKEMClass();
|
public zkemkeeper.CZKEMClass axCZKEM1; //= new zkemkeeper.CZKEMClass();
|
||||||
public bool bIsConnected = false;
|
public bool bIsConnected = false;
|
||||||
|
|
||||||
private string fingerIp = ConfigurationManager.AppSettings["fingerIp"].ToString();
|
private string fingerIp = ConfigurationManager.AppSettings["fingerIp"]?.ToString()??"";
|
||||||
private int fingerPort = 4370;
|
private int fingerPort = 4370;
|
||||||
private int machineNumber = Convert.ToInt32(ConfigurationManager.AppSettings["machineNumber"].ToString());
|
private int machineNumber = Convert.ToInt32(ConfigurationManager.AppSettings["machineNumber"]?.ToString()??"0");
|
||||||
private int machineType = Convert.ToInt32(ConfigurationManager.AppSettings["machineType"].ToString());
|
private int machineType = Convert.ToInt32(ConfigurationManager.AppSettings["machineType"]?.ToString()??"0");
|
||||||
private readonly IEventAggregator _eventAggregator;
|
private readonly IEventAggregator _eventAggregator;
|
||||||
public FingerprintUtil(IEventAggregator eventAggregator)
|
public FingerprintUtil(IEventAggregator eventAggregator)
|
||||||
{
|
{
|
||||||
|
|
|
@ -110,7 +110,7 @@ namespace DM_Weight.Port
|
||||||
// 失能
|
// 失能
|
||||||
await BoxLockLightOff2();
|
await BoxLockLightOff2();
|
||||||
}
|
}
|
||||||
if(BoardType==5)
|
if (BoardType == 5)
|
||||||
{
|
{
|
||||||
await WriteQuantityArray();
|
await WriteQuantityArray();
|
||||||
}
|
}
|
||||||
|
@ -141,6 +141,7 @@ namespace DM_Weight.Port
|
||||||
byte[] result = await OpenStorage();
|
byte[] result = await OpenStorage();
|
||||||
|
|
||||||
int[] r = result.Select(it => Convert.ToInt32(it)).ToArray();
|
int[] r = result.Select(it => Convert.ToInt32(it)).ToArray();
|
||||||
|
logger.Info($"储物箱使能返回:" + string.Join("", r));
|
||||||
if (r[4] != 0)
|
if (r[4] != 0)
|
||||||
{
|
{
|
||||||
logger.Info($"储物箱使能成功");
|
logger.Info($"储物箱使能成功");
|
||||||
|
@ -159,8 +160,8 @@ namespace DM_Weight.Port
|
||||||
EventType = util.EventType.OPENERROR,
|
EventType = util.EventType.OPENERROR,
|
||||||
WindowName = _WindowName,
|
WindowName = _WindowName,
|
||||||
Message = "储物箱使能失败"
|
Message = "储物箱使能失败"
|
||||||
});
|
});
|
||||||
logger.Info($"储物箱使能失败r:"+string.Join("",r));
|
logger.Info($"储物箱使能失败r:" + string.Join("", r));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -516,6 +517,7 @@ namespace DM_Weight.Port
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
logger.Info($"Operate:{Operate}");
|
||||||
if (Operate)
|
if (Operate)
|
||||||
{
|
{
|
||||||
byte[] result = await BackDoorState();
|
byte[] result = await BackDoorState();
|
||||||
|
@ -523,6 +525,7 @@ namespace DM_Weight.Port
|
||||||
int[] r = result.Select(it => Convert.ToInt32(it)).ToArray();
|
int[] r = result.Select(it => Convert.ToInt32(it)).ToArray();
|
||||||
int[] lockStates = CheckStorageStatus(r.Skip(3).Take(2).ToArray());
|
int[] lockStates = CheckStorageStatus(r.Skip(3).Take(2).ToArray());
|
||||||
int[] lightStates = CheckStorageStatus(r.Skip(5).Take(2).ToArray());
|
int[] lightStates = CheckStorageStatus(r.Skip(5).Take(2).ToArray());
|
||||||
|
logger.Info($"GetBackDoorState,lockStates:{string.Join(",", lockStates)},lightStates:{string.Join(",", lightStates)},_storageBoxAddr:{_storageBoxAddr},statue{statue}");
|
||||||
|
|
||||||
// 锁处于关闭状态
|
// 锁处于关闭状态
|
||||||
if (lockStates[_storageBoxAddr - 1] == 0)
|
if (lockStates[_storageBoxAddr - 1] == 0)
|
||||||
|
@ -652,19 +655,19 @@ namespace DM_Weight.Port
|
||||||
byte[] buffer = new byte[length];
|
byte[] buffer = new byte[length];
|
||||||
//try
|
//try
|
||||||
//{
|
//{
|
||||||
int _length = 0;
|
int _length = 0;
|
||||||
DateTime start = DateTime.Now;
|
DateTime start = DateTime.Now;
|
||||||
DateTime end = DateTime.Now;
|
DateTime end = DateTime.Now;
|
||||||
while (_length != length && end.Subtract(start).TotalMilliseconds < timeout)
|
while (_length != length && end.Subtract(start).TotalMilliseconds < timeout)
|
||||||
{
|
{
|
||||||
_length = serialPort.BytesToRead;
|
_length = serialPort.BytesToRead;
|
||||||
end = DateTime.Now;
|
end = DateTime.Now;
|
||||||
}
|
}
|
||||||
if (_length != length)
|
if (_length != length)
|
||||||
{
|
{
|
||||||
throw new TimeoutException($"串口【{serialPort.PortName}】交互超时");
|
throw new TimeoutException($"串口【{serialPort.PortName}】交互超时");
|
||||||
}
|
}
|
||||||
serialPort.Read(buffer, 0, length);
|
serialPort.Read(buffer, 0, length);
|
||||||
//}
|
//}
|
||||||
//catch (Exception ex)
|
//catch (Exception ex)
|
||||||
//{
|
//{
|
||||||
|
@ -761,7 +764,7 @@ namespace DM_Weight.Port
|
||||||
canBusSerial.DiscardInBuffer();
|
canBusSerial.DiscardInBuffer();
|
||||||
byte[] buffer = new byte[] { 0xaa, (byte)(_doorAddr), 0x01, (byte)_storageBoxAddr, 0x00, 0x00, 0x00, 0xee };
|
byte[] buffer = new byte[] { 0xaa, (byte)(_doorAddr), 0x01, (byte)_storageBoxAddr, 0x00, 0x00, 0x00, 0xee };
|
||||||
canBusSerial.Write(buffer, 0, 8);
|
canBusSerial.Write(buffer, 0, 8);
|
||||||
|
logger.Info($"OpenStorage:{string.Join("", buffer)}");
|
||||||
|
|
||||||
return await GetBufferByPort(canBusSerial, 8);
|
return await GetBufferByPort(canBusSerial, 8);
|
||||||
}
|
}
|
||||||
|
@ -798,12 +801,30 @@ namespace DM_Weight.Port
|
||||||
private int[] Decimal2Chunks(int d)
|
private int[] Decimal2Chunks(int d)
|
||||||
{
|
{
|
||||||
string s = Convert.ToString(d, 2);
|
string s = Convert.ToString(d, 2);
|
||||||
List<int> t = s.Split().Select(it => Convert.ToInt32(it)).Reverse().ToList();
|
int[] chars = new int[8];
|
||||||
while (t.Count < 8)
|
char[] schar = s.ToCharArray();
|
||||||
|
Array.Reverse(schar);
|
||||||
|
int[] iArray = Array.ConvertAll(schar, c => (int)Char.GetNumericValue(c));
|
||||||
|
int[] addArray = new int[8 - iArray.Length];
|
||||||
|
if(iArray.Length<8)
|
||||||
{
|
{
|
||||||
t.Add(0);
|
for (int i = 0; i < 8- iArray.Length; i++)
|
||||||
|
{
|
||||||
|
addArray[i] = 0;
|
||||||
|
}
|
||||||
|
chars = iArray.Concat(addArray).ToArray();
|
||||||
}
|
}
|
||||||
return t.ToArray();
|
else
|
||||||
|
{
|
||||||
|
chars = iArray[0..iArray.Length];
|
||||||
|
}
|
||||||
|
return chars;
|
||||||
|
//List<int> t = s.Split().Select(it => Convert.ToInt32(it)).Reverse().ToList();
|
||||||
|
//while (t.Count < 8)
|
||||||
|
//{
|
||||||
|
// t.Add(0);
|
||||||
|
//}
|
||||||
|
//return t.ToArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
@ -920,14 +941,14 @@ namespace DM_Weight.Port
|
||||||
|
|
||||||
}
|
}
|
||||||
// 以抽屉为单位药盒指示灯开启使能开锁
|
// 以抽屉为单位药盒指示灯开启使能开锁
|
||||||
public async Task BoxLockLightOnByDrawer()
|
public void BoxLockLightOnByDrawer()
|
||||||
{
|
{
|
||||||
canBusSerial.DiscardInBuffer();
|
canBusSerial.DiscardInBuffer();
|
||||||
byte[] buffer = new byte[] { 0xaa, (byte)(0xf0 + DrawerNo), 0x04, 0x00, 0x00, 0x00, 0x00, 0xee };
|
byte[] buffer = new byte[] { 0xaa, (byte)(0xf0 + DrawerNo), 0x04, 0x00, 0x00, 0x00, 0x00, 0xee };
|
||||||
canBusSerial.Write(buffer, 0, 8);
|
canBusSerial.Write(buffer, 0, 8);
|
||||||
}
|
}
|
||||||
// 以抽屉为单位药盒指示灯开启失能开锁
|
// 以抽屉为单位药盒指示灯开启失能开锁
|
||||||
public async Task BoxLockLightOffByDrawer()
|
public void BoxLockLightOffByDrawer()
|
||||||
{
|
{
|
||||||
canBusSerial.DiscardInBuffer();
|
canBusSerial.DiscardInBuffer();
|
||||||
byte[] buffer = new byte[] { 0xaa, (byte)(0xf0 + DrawerNo), 0x05, 0x00, 0x00, 0x00, 0x00, 0xee };
|
byte[] buffer = new byte[] { 0xaa, (byte)(0xf0 + DrawerNo), 0x05, 0x00, 0x00, 0x00, 0x00, 0xee };
|
||||||
|
@ -1035,7 +1056,7 @@ namespace DM_Weight.Port
|
||||||
canBusSerial.Write(buffer, 0, 8);
|
canBusSerial.Write(buffer, 0, 8);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
@ -1076,7 +1097,7 @@ namespace DM_Weight.Port
|
||||||
for (int i = 0; i < ColNos.Length; i++)
|
for (int i = 0; i < ColNos.Length; i++)
|
||||||
{
|
{
|
||||||
WriteQuantity(DrawerNo, ColNos[i], Stocks[i]);
|
WriteQuantity(DrawerNo, ColNos[i], Stocks[i]);
|
||||||
await Task.Delay(TimeSpan.FromMilliseconds(20));
|
await Task.Delay(TimeSpan.FromMilliseconds(20));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1106,7 +1127,7 @@ namespace DM_Weight.Port
|
||||||
logger.Info($"操作发生异常:ex:{ex.Message}");
|
logger.Info($"操作发生异常:ex:{ex.Message}");
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
// 回收箱状态查询
|
// 回收箱状态查询
|
||||||
public async Task<byte[]> CheckRecoverStatus()
|
public async Task<byte[]> CheckRecoverStatus()
|
||||||
|
@ -1243,7 +1264,7 @@ namespace DM_Weight.Port
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public async void ClearCount(int DrawerNo, int ColNo)
|
public void ClearCount(int DrawerNo, int ColNo)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -1266,10 +1287,10 @@ namespace DM_Weight.Port
|
||||||
});
|
});
|
||||||
logger.Info($"操作发生异常:ex:{ex.Message},方法名:ClearCount;参数:{DrawerNo},{ColNo}");
|
logger.Info($"操作发生异常:ex:{ex.Message},方法名:ClearCount;参数:{DrawerNo},{ColNo}");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public async void SetNumCount(int DrawerNo, int ColNo, int Quantity)
|
public void SetNumCount(int DrawerNo, int ColNo, int Quantity)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -1297,7 +1318,7 @@ namespace DM_Weight.Port
|
||||||
});
|
});
|
||||||
logger.Info($"操作发生异常:ex:{ex.Message},方法名:SetNumCount;参数:{DrawerNo},{ColNo},{Quantity}");
|
logger.Info($"操作发生异常:ex:{ex.Message},方法名:SetNumCount;参数:{DrawerNo},{ColNo},{Quantity}");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
|
@ -142,14 +142,16 @@ namespace DM_Weight.Report
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Report.LoadFromFile(new FileInfo(AppDomain.CurrentDomain.BaseDirectory) + "ReportTemp//" + "machine_log_check.grf");
|
Report.LoadFromFile(new FileInfo(AppDomain.CurrentDomain.BaseDirectory) + "ReportTemp//" + "machine_log_check.grf");
|
||||||
SQL = $@" SELECT dmr.`drawer_no` AS drawerNo,dmr.`col_no` AS colNo,dmr.`type` AS `type`,dmr.`quantity` AS quantity,
|
SQL = $@" SELECT dmr.`drawer_no` AS drawerNo,dmr.`col_no` AS colNo,dmr.`type` AS `type`,dmr.`check_quantity` AS quantity,
|
||||||
dmr.`manu_no` AS manuNo,dmr.`eff_date` AS effDate,dmr.`operation_time` AS operationTime,
|
dmr.`manu_no` AS manuNo,dmr.`eff_date` AS effDate,dmr.`operation_time` AS operationTime,
|
||||||
di.`drug_name` AS drugName,di.`drug_spec` AS drugSpec,di.`pack_unit` AS packUnit,
|
di.`drug_name` AS drugName,di.`drug_spec` AS drugSpec,di.`pack_unit` AS packUnit,
|
||||||
di.`manufactory` AS manuFactory,di.`max_stock` AS baseQuantity,dmr.`drug_id` AS drugId,
|
di.`manufactory` AS manuFactory,di.`max_stock` AS baseQuantity,dmr.`drug_id` AS drugId,
|
||||||
ul.`user_name` AS nickname FROM dm_machine_record dmr LEFT JOIN drug_info di ON di.`drug_id` = dmr.`drug_id`
|
ul.`user_name` AS nickname,u2.`user_name` as reviewer FROM dm_machine_record dmr
|
||||||
LEFT JOIN user_list ul ON ul.`id` = dmr.`Operator` WHERE dmr.`type` = 4
|
LEFT JOIN drug_info di ON di.`drug_id` = dmr.`drug_id`
|
||||||
AND dmr.`machine_id` = '{p_machine_id}' AND dmr.`operation_time` > '{p_startDate}'
|
LEFT JOIN user_list ul ON ul.`id` = dmr.`Operator`
|
||||||
AND dmr.`operation_time` < '{p_endDate}'";
|
LEFT JOIN user_list u2 ON dmr.`reviewer` = u2.`id` WHERE dmr.`type` = 4
|
||||||
|
AND dmr.`machine_id` = '{p_machine_id}' AND dmr.`operation_time` > '{p_startDate}'
|
||||||
|
AND dmr.`operation_time` < '{p_endDate}'";
|
||||||
}
|
}
|
||||||
|
|
||||||
Report.DetailGrid.Recordset.ConnectionString = gridConnectionString;
|
Report.DetailGrid.Recordset.ConnectionString = gridConnectionString;
|
||||||
|
|
|
@ -239,7 +239,7 @@
|
||||||
"Name":"StaticBox7",
|
"Name":"StaticBox7",
|
||||||
"Dock":"Fill",
|
"Dock":"Fill",
|
||||||
"TextAlign":"MiddleCenter",
|
"TextAlign":"MiddleCenter",
|
||||||
"Text":"门诊药房"
|
"Text":"门诊药房11"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,7 +48,6 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"Name":"批号",
|
"Name":"批号",
|
||||||
"Type":"Integer",
|
|
||||||
"DBFieldName":"manu_no"
|
"DBFieldName":"manu_no"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
|
@ -21,6 +21,10 @@
|
||||||
"Name":"操作人",
|
"Name":"操作人",
|
||||||
"DBFieldName":"Nickname"
|
"DBFieldName":"Nickname"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"Name":"审核人",
|
||||||
|
"DBFieldName":"reviewer"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"Name":"时间",
|
"Name":"时间",
|
||||||
"Type":"DateTime",
|
"Type":"DateTime",
|
||||||
|
@ -64,6 +68,10 @@
|
||||||
"Name":"操作人",
|
"Name":"操作人",
|
||||||
"Width":2.38125
|
"Width":2.38125
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"Name":"审核人",
|
||||||
|
"Width":2.19604
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"Name":"时间",
|
"Name":"时间",
|
||||||
"Width":3.78354
|
"Width":3.78354
|
||||||
|
@ -86,7 +94,7 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"Name":"库位",
|
"Name":"库位",
|
||||||
"Width":2.59292
|
"Width":1.79917
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"ColumnContent":{
|
"ColumnContent":{
|
||||||
|
@ -97,6 +105,10 @@
|
||||||
"TextAlign":"MiddleCenter",
|
"TextAlign":"MiddleCenter",
|
||||||
"DataField":"操作人"
|
"DataField":"操作人"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"Column":"审核人",
|
||||||
|
"DataField":"审核人"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"Column":"时间",
|
"Column":"时间",
|
||||||
"TextAlign":"MiddleCenter",
|
"TextAlign":"MiddleCenter",
|
||||||
|
@ -162,6 +174,18 @@
|
||||||
"TextAlign":"MiddleCenter",
|
"TextAlign":"MiddleCenter",
|
||||||
"Text":"操作人"
|
"Text":"操作人"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"GroupTitle":false,
|
||||||
|
"Column":"审核人",
|
||||||
|
"Font":{
|
||||||
|
"Name":"宋体",
|
||||||
|
"Size":120000,
|
||||||
|
"Bold":true,
|
||||||
|
"Charset":134
|
||||||
|
},
|
||||||
|
"TextAlign":"MiddleCenter",
|
||||||
|
"Text":"审核人"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"GroupTitle":false,
|
"GroupTitle":false,
|
||||||
"Column":"时间",
|
"Column":"时间",
|
||||||
|
@ -274,7 +298,7 @@
|
||||||
"Charset":134
|
"Charset":134
|
||||||
},
|
},
|
||||||
"TextAlign":"MiddleCenter",
|
"TextAlign":"MiddleCenter",
|
||||||
"Text":"盘点记录"
|
"Text":"盘点表"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"RepeatOnPage":true
|
"RepeatOnPage":true
|
||||||
|
|
|
@ -50,13 +50,14 @@ namespace DM_Weight.ViewModels
|
||||||
IEventAggregator _eventAggregator;
|
IEventAggregator _eventAggregator;
|
||||||
PortUtil _portUtil;
|
PortUtil _portUtil;
|
||||||
//ScreenUtil _screenUtil;
|
//ScreenUtil _screenUtil;
|
||||||
|
private SqlSugarScope _sqlSugarScope1;
|
||||||
public BindingChannelDialogViewModel(IEventAggregator eventAggregator, PortUtil portUtil//, ScreenUtil screenUtil
|
public BindingChannelDialogViewModel(IEventAggregator eventAggregator, PortUtil portUtil, SqlSugarScope sqlSugarScope//, ScreenUtil screenUtil
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
_eventAggregator = eventAggregator;
|
_eventAggregator = eventAggregator;
|
||||||
_portUtil = portUtil;
|
_portUtil = portUtil;
|
||||||
//_screenUtil = screenUtil;
|
//_screenUtil = screenUtil;
|
||||||
|
this._sqlSugarScope1 = sqlSugarScope;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int DrawerNo
|
public int DrawerNo
|
||||||
|
@ -92,7 +93,7 @@ namespace DM_Weight.ViewModels
|
||||||
{
|
{
|
||||||
|
|
||||||
SetProperty(ref _durgInfo_for_py, value);
|
SetProperty(ref _durgInfo_for_py, value);
|
||||||
if(_durgInfo_for_py!=null)
|
if (_durgInfo_for_py != null)
|
||||||
{
|
{
|
||||||
DrugInfos = GetDrugByDrugPY(_durgInfo_for_py.PyCode);
|
DrugInfos = GetDrugByDrugPY(_durgInfo_for_py.PyCode);
|
||||||
}
|
}
|
||||||
|
@ -109,11 +110,13 @@ namespace DM_Weight.ViewModels
|
||||||
List<DrugInfo> DrugList = null;
|
List<DrugInfo> DrugList = null;
|
||||||
if (!string.IsNullOrEmpty(pycode))
|
if (!string.IsNullOrEmpty(pycode))
|
||||||
{
|
{
|
||||||
DrugList = SqlSugarHelper.Db.Queryable<DrugInfo>().Includes<DrugManuNo>(di => di.DrugManuNos).Where(di => di.PyCode.Contains(pycode)).OrderBy(di => di.DrugId).ToList();
|
//DrugList = _sqlSugarScope1.Queryable<DrugInfo>().Includes<DrugManuNo>(di => di.DrugManuNos).Where(di => di.PyCode.Contains(pycode)).OrderBy(di => di.DrugId).ToList();
|
||||||
|
DrugList = _sqlSugarScope1.Queryable<DrugInfo>().Includes<DrugManuNo>(di => di.DrugManuNos).Where(di => di.PyCode.Contains(pycode)).OrderBy(di => di.DrugId).ToList();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
DrugList = SqlSugarHelper.Db.Queryable<DrugInfo>().Includes<DrugManuNo>(di => di.DrugManuNos).OrderBy(di => di.DrugId).ToList();
|
//DrugList = _sqlSugarScope1.Queryable<DrugInfo>().Includes<DrugManuNo>(di => di.DrugManuNos).OrderBy(di => di.DrugId).ToList();
|
||||||
|
DrugList = _sqlSugarScope1.Queryable<DrugInfo>().Includes<DrugManuNo>(di => di.DrugManuNos).OrderBy(di => di.DrugId).ToList();
|
||||||
}
|
}
|
||||||
return DrugList;
|
return DrugList;
|
||||||
}
|
}
|
||||||
|
@ -206,7 +209,8 @@ namespace DM_Weight.ViewModels
|
||||||
|
|
||||||
private void GetAllDrugInfos()
|
private void GetAllDrugInfos()
|
||||||
{
|
{
|
||||||
var list = SqlSugarHelper.Db.Queryable<DrugInfo>().Includes<DrugManuNo>(di => di.DrugManuNos).OrderBy(di => di.DrugId).ToList();
|
//var list = _sqlSugarScope1.Queryable<DrugInfo>().Includes<DrugManuNo>(di => di.DrugManuNos).OrderBy(di => di.DrugId).ToList();
|
||||||
|
var list = _sqlSugarScope1.Queryable<DrugInfo>().Includes<DrugManuNo>(di => di.DrugManuNos).OrderBy(di => di.DrugId).ToList();
|
||||||
DrugInfos = list;
|
DrugInfos = list;
|
||||||
DrugInfos_PY = list;
|
DrugInfos_PY = list;
|
||||||
}
|
}
|
||||||
|
@ -215,13 +219,20 @@ namespace DM_Weight.ViewModels
|
||||||
{
|
{
|
||||||
Channels?.Clear();
|
Channels?.Clear();
|
||||||
int totalCount = 0;
|
int totalCount = 0;
|
||||||
var list = SqlSugarHelper.Db.Queryable<ChannelStock>()
|
//var list = _sqlSugarScope1.Queryable<ChannelStock>()
|
||||||
.Includes<DrugInfo>(cs => cs.DrugInfo)
|
// .Includes<DrugInfo>(cs => cs.DrugInfo)
|
||||||
.WhereIF(DrawerNo > 0, cs => cs.DrawerNo == DrawerNo)
|
// .WhereIF(DrawerNo > 0, cs => cs.DrawerNo == DrawerNo)
|
||||||
.Where(cs => cs.MachineId.Equals(ConfigurationManager.AppSettings["machineId"] ?? "DM1"))
|
// .Where(cs => cs.MachineId.Equals(ConfigurationManager.AppSettings["machineId"] ?? "DM1"))
|
||||||
.OrderBy(cs => cs.DrawerNo)
|
// .OrderBy(cs => cs.DrawerNo)
|
||||||
.OrderBy(cs => cs.ColNo)
|
// .OrderBy(cs => cs.ColNo)
|
||||||
.ToPageList(PageNum, PageSize, ref totalCount);
|
// .ToPageList(PageNum, PageSize, ref totalCount);
|
||||||
|
var list = _sqlSugarScope1.Queryable<ChannelStock>()
|
||||||
|
.Includes<DrugInfo>(cs => cs.DrugInfo)
|
||||||
|
.WhereIF(DrawerNo > 0, cs => cs.DrawerNo == DrawerNo)
|
||||||
|
.Where(cs => cs.MachineId.Equals(ConfigurationManager.AppSettings["machineId"] ?? "DM1"))
|
||||||
|
.OrderBy(cs => cs.DrawerNo)
|
||||||
|
.OrderBy(cs => cs.ColNo)
|
||||||
|
.ToPageList(PageNum, PageSize, ref totalCount);
|
||||||
Channels = list;
|
Channels = list;
|
||||||
TotalCount = totalCount;
|
TotalCount = totalCount;
|
||||||
}
|
}
|
||||||
|
@ -257,7 +268,7 @@ namespace DM_Weight.ViewModels
|
||||||
{
|
{
|
||||||
if (DrugInfo != null)
|
if (DrugInfo != null)
|
||||||
{
|
{
|
||||||
int count = SqlSugarHelper.Db.Queryable<ChannelStock>().Where(cs => cs.DrugId.Equals(DrugInfo.DrugId.ToString())).Where(cs => cs.DrawerType != 1).Where(cs => cs.MachineId.Equals(ConfigurationManager.AppSettings["machineId"] ?? "DM1")).Count();
|
int count = _sqlSugarScope1.Queryable<ChannelStock>().Where(cs => cs.DrugId.Equals(DrugInfo.DrugId.ToString())).Where(cs => cs.DrawerType != 1).Where(cs => cs.MachineId.Equals(ConfigurationManager.AppSettings["machineId"] ?? "DM1")).Count();
|
||||||
if (count == 0)
|
if (count == 0)
|
||||||
{
|
{
|
||||||
var item = SelectChannels[0];
|
var item = SelectChannels[0];
|
||||||
|
@ -267,7 +278,8 @@ namespace DM_Weight.ViewModels
|
||||||
item.PosNo = 0;
|
item.PosNo = 0;
|
||||||
}
|
}
|
||||||
item.DrugId = DrugInfo.DrugId.ToString();
|
item.DrugId = DrugInfo.DrugId.ToString();
|
||||||
SqlSugarHelper.Db.Updateable(item).UpdateColumns(it => new { it.DrugId, it.PosNo }).ExecuteCommand();
|
//_sqlSugarScope1.Updateable(item).UpdateColumns(it => new { it.DrugId, it.PosNo }).ExecuteCommand();
|
||||||
|
_sqlSugarScope1.Updateable(item).UpdateColumns(it => new { it.DrugId, it.PosNo }).ExecuteCommand();
|
||||||
GetChannelsByDrawerNo();
|
GetChannelsByDrawerNo();
|
||||||
|
|
||||||
if (item.BoardType == 5)
|
if (item.BoardType == 5)
|
||||||
|
@ -280,7 +292,7 @@ namespace DM_Weight.ViewModels
|
||||||
await Task.Delay(200);
|
await Task.Delay(200);
|
||||||
_portUtil.WriteChannelInfo(8, DrugInfo.Manufactory, item.DrawerNo, item.ColNo);
|
_portUtil.WriteChannelInfo(8, DrugInfo.Manufactory, item.DrawerNo, item.ColNo);
|
||||||
await Task.Delay(200);
|
await Task.Delay(200);
|
||||||
_portUtil.WriteChannelInfo(6, DrugManuNo.EffDate==null?"": DrugManuNo.EffDate, item.DrawerNo, item.ColNo);
|
_portUtil.WriteChannelInfo(6, DrugManuNo.EffDate == null ? "" : DrugManuNo.EffDate, item.DrawerNo, item.ColNo);
|
||||||
await Task.Delay(200);
|
await Task.Delay(200);
|
||||||
_portUtil.WriteChannelInfo(5, DrugManuNo.ManuNo, item.DrawerNo, item.ColNo);
|
_portUtil.WriteChannelInfo(5, DrugManuNo.ManuNo, item.DrawerNo, item.ColNo);
|
||||||
await Task.Delay(200);
|
await Task.Delay(200);
|
||||||
|
@ -327,7 +339,7 @@ namespace DM_Weight.ViewModels
|
||||||
// item.ManuNo = DrugManuNo.ManuNo;
|
// item.ManuNo = DrugManuNo.ManuNo;
|
||||||
// item.DrugInfo = DrugInfo;
|
// item.DrugInfo = DrugInfo;
|
||||||
// item.EffDate = String.Format("{0:yyyy-MM-dd}", DrugManuNo.EffDate);
|
// item.EffDate = String.Format("{0:yyyy-MM-dd}", DrugManuNo.EffDate);
|
||||||
// SqlSugarHelper.Db.Updateable(item).UpdateColumns(it => new { it.DrugId, it.ManuNo, it.EffDate, it.PosNo }).ExecuteCommand();
|
// _sqlSugarScope1.Updateable(item).UpdateColumns(it => new { it.DrugId, it.ManuNo, it.EffDate, it.PosNo }).ExecuteCommand();
|
||||||
|
|
||||||
// if (item.BoardType == 5)
|
// if (item.BoardType == 5)
|
||||||
// {
|
// {
|
||||||
|
@ -357,7 +369,7 @@ namespace DM_Weight.ViewModels
|
||||||
// item.ManuNo = DrugManuNo.ManuNo;
|
// item.ManuNo = DrugManuNo.ManuNo;
|
||||||
// item.DrugInfo = DrugInfo;
|
// item.DrugInfo = DrugInfo;
|
||||||
// item.EffDate = String.Format("{0:yyyy-MM-dd}", DrugManuNo.EffDate);
|
// item.EffDate = String.Format("{0:yyyy-MM-dd}", DrugManuNo.EffDate);
|
||||||
// SqlSugarHelper.Db.Updateable(item).UpdateColumns(it => new { it.DrugId, it.ManuNo, it.EffDate, it.PosNo }).ExecuteCommand();
|
// _sqlSugarScope1.Updateable(item).UpdateColumns(it => new { it.DrugId, it.ManuNo, it.EffDate, it.PosNo }).ExecuteCommand();
|
||||||
|
|
||||||
// if (item.BoardType == 5)
|
// if (item.BoardType == 5)
|
||||||
// {
|
// {
|
||||||
|
@ -390,7 +402,8 @@ namespace DM_Weight.ViewModels
|
||||||
item.ManuNo = DrugManuNo.ManuNo;
|
item.ManuNo = DrugManuNo.ManuNo;
|
||||||
item.DrugInfo = DrugInfo;
|
item.DrugInfo = DrugInfo;
|
||||||
item.EffDate = String.Format("{0:yyyy-MM-dd}", DrugManuNo.EffDate);
|
item.EffDate = String.Format("{0:yyyy-MM-dd}", DrugManuNo.EffDate);
|
||||||
SqlSugarHelper.Db.Updateable(item).UpdateColumns(it => new { it.DrugId, it.ManuNo, it.EffDate, it.PosNo }).ExecuteCommand();
|
//_sqlSugarScope1.Updateable(item).UpdateColumns(it => new { it.DrugId, it.ManuNo, it.EffDate, it.PosNo }).ExecuteCommand();
|
||||||
|
_sqlSugarScope1.Updateable(item).UpdateColumns(it => new { it.DrugId, it.ManuNo, it.EffDate, it.PosNo }).ExecuteCommand();
|
||||||
|
|
||||||
if (item.BoardType == 5)
|
if (item.BoardType == 5)
|
||||||
{
|
{
|
||||||
|
@ -447,7 +460,47 @@ namespace DM_Weight.ViewModels
|
||||||
item.ManuNo = null;
|
item.ManuNo = null;
|
||||||
item.EffDate = null;
|
item.EffDate = null;
|
||||||
item.DrugInfo = null;
|
item.DrugInfo = null;
|
||||||
SqlSugarHelper.Db.Updateable(item).UpdateColumns(it => new { it.DrugId, it.ManuNo, it.EffDate }).ExecuteCommand();
|
//_sqlSugarScope1.Updateable(item).UpdateColumns(it => new { it.DrugId, it.ManuNo, it.EffDate }).ExecuteCommand();
|
||||||
|
_sqlSugarScope1.Updateable(item).UpdateColumns(it => new { it.DrugId, it.ManuNo, it.EffDate }).ExecuteCommand();
|
||||||
|
if (item.BoardType == 5)
|
||||||
|
{
|
||||||
|
// 清除显示屏库位信息
|
||||||
|
_portUtil.ClearContent(item.DrawerNo, item.ColNo);
|
||||||
|
await Task.Delay(200);
|
||||||
|
_portUtil.ShowContent(item.DrawerNo, item.ColNo);
|
||||||
|
}
|
||||||
|
|
||||||
|
//_screenUtil.SetStockInfo(item, 1);
|
||||||
|
});
|
||||||
|
GetChannelsByDrawerNo();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
SnackbarBackground = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#b71c1c"));
|
||||||
|
SnackbarMessageQueue.Enqueue("所选库位中无可解绑库位【库位还存在药品】");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
public DelegateCommand MoveBindingNew
|
||||||
|
{
|
||||||
|
get => new DelegateCommand(moveBindingAction);
|
||||||
|
}
|
||||||
|
private async void moveBindingAction()
|
||||||
|
{
|
||||||
|
await Task.Run(() =>
|
||||||
|
{
|
||||||
|
var SelectChannels = Channels.FindAll(item => item.IsSelected && item.Quantity == 0);
|
||||||
|
var c = SelectChannels.Count;
|
||||||
|
if (c > 0)
|
||||||
|
{
|
||||||
|
SelectChannels.ForEach(async item =>
|
||||||
|
{
|
||||||
|
item.DrugId = null;
|
||||||
|
item.ManuNo = null;
|
||||||
|
item.EffDate = null;
|
||||||
|
item.DrugInfo = null;
|
||||||
|
//_sqlSugarScope1.Updateable(item).UpdateColumns(it => new { it.DrugId, it.ManuNo, it.EffDate }).ExecuteCommand();
|
||||||
|
_sqlSugarScope1.Updateable(item).UpdateColumns(it => new { it.DrugId, it.ManuNo, it.EffDate }).ExecuteCommand();
|
||||||
if (item.BoardType == 5)
|
if (item.BoardType == 5)
|
||||||
{
|
{
|
||||||
// 清除显示屏库位信息
|
// 清除显示屏库位信息
|
||||||
|
|
|
@ -9,6 +9,7 @@ using Prism.Events;
|
||||||
using Prism.Mvvm;
|
using Prism.Mvvm;
|
||||||
using Prism.Regions;
|
using Prism.Regions;
|
||||||
using Prism.Services.Dialogs;
|
using Prism.Services.Dialogs;
|
||||||
|
using SqlSugar;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Collections.ObjectModel;
|
using System.Collections.ObjectModel;
|
||||||
|
@ -96,7 +97,7 @@ namespace DM_Weight.ViewModels
|
||||||
get => ReadAppSetting("loginMode") == "2";
|
get => ReadAppSetting("loginMode") == "2";
|
||||||
}
|
}
|
||||||
|
|
||||||
private PortUtil _portUtil;
|
//private PortUtil _portUtil;
|
||||||
private Boolean _loginBtnEnable = true;
|
private Boolean _loginBtnEnable = true;
|
||||||
public Boolean LoginBtnEnable { get { return _loginBtnEnable; } set { SetProperty(ref _loginBtnEnable, value); } }
|
public Boolean LoginBtnEnable { get { return _loginBtnEnable; } set { SetProperty(ref _loginBtnEnable, value); } }
|
||||||
public string Password { get { return password; } set { SetProperty(ref password, value); } }
|
public string Password { get { return password; } set { SetProperty(ref password, value); } }
|
||||||
|
@ -163,9 +164,10 @@ namespace DM_Weight.ViewModels
|
||||||
//{
|
//{
|
||||||
DateTime dt = DateTime.Now;
|
DateTime dt = DateTime.Now;
|
||||||
//保存交接班信息(查询当前值班人的最后一条交接班信息(如有则修改状态,没有则插入一条)并写入一条接班人信息)
|
//保存交接班信息(查询当前值班人的最后一条交接班信息(如有则修改状态,没有则插入一条)并写入一条接班人信息)
|
||||||
var f = SqlSugarHelper.Db.UseTran(() =>
|
//var f = _sqlSugarScope1.UseTran(() =>
|
||||||
|
var f = _sqlSugarScope1.UseTran(() =>
|
||||||
{
|
{
|
||||||
List<HkcChangeShifts> listHkcChangeShifts = SqlSugarHelper.Db.Queryable<HkcChangeShifts>()
|
List<HkcChangeShifts> listHkcChangeShifts = _sqlSugarScope1.Queryable<HkcChangeShifts>()
|
||||||
.Where(cs => cs.State == "0")
|
.Where(cs => cs.State == "0")
|
||||||
.WhereIF(Operator != null && !string.IsNullOrEmpty(Operator.UserName), cs => cs.FromOperator == Operator.UserName)
|
.WhereIF(Operator != null && !string.IsNullOrEmpty(Operator.UserName), cs => cs.FromOperator == Operator.UserName)
|
||||||
.WhereIF(Reviewer != null && !string.IsNullOrEmpty(Reviewer.UserName), cs => cs.FromRviewer == Reviewer.UserName)
|
.WhereIF(Reviewer != null && !string.IsNullOrEmpty(Reviewer.UserName), cs => cs.FromRviewer == Reviewer.UserName)
|
||||||
|
@ -175,7 +177,7 @@ namespace DM_Weight.ViewModels
|
||||||
if (listHkcChangeShifts != null && listHkcChangeShifts.Count > 0)
|
if (listHkcChangeShifts != null && listHkcChangeShifts.Count > 0)
|
||||||
{
|
{
|
||||||
//存在则修改,不存在则插入一条
|
//存在则修改,不存在则插入一条
|
||||||
SqlSugarHelper.Db.Updateable(new HkcChangeShifts()
|
_sqlSugarScope1.Updateable(new HkcChangeShifts()
|
||||||
{
|
{
|
||||||
Id = listHkcChangeShifts[0].Id,
|
Id = listHkcChangeShifts[0].Id,
|
||||||
ToOperator = JieOperator == null ? "" : JieOperator.UserName,
|
ToOperator = JieOperator == null ? "" : JieOperator.UserName,
|
||||||
|
@ -186,7 +188,7 @@ namespace DM_Weight.ViewModels
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
SqlSugarHelper.Db.Insertable(new HkcChangeShifts()
|
_sqlSugarScope1.Insertable(new HkcChangeShifts()
|
||||||
{
|
{
|
||||||
FromOperator = Operator == null ? "" : Operator.UserName,
|
FromOperator = Operator == null ? "" : Operator.UserName,
|
||||||
FromRviewer = Reviewer == null ? "" : Reviewer.UserName,
|
FromRviewer = Reviewer == null ? "" : Reviewer.UserName,
|
||||||
|
@ -199,7 +201,7 @@ namespace DM_Weight.ViewModels
|
||||||
}).ExecuteCommand();
|
}).ExecuteCommand();
|
||||||
|
|
||||||
}
|
}
|
||||||
SqlSugarHelper.Db.Insertable(new HkcChangeShifts()
|
_sqlSugarScope1.Insertable(new HkcChangeShifts()
|
||||||
{
|
{
|
||||||
FromOperator = JieOperator == null ? "" : JieOperator.UserName,
|
FromOperator = JieOperator == null ? "" : JieOperator.UserName,
|
||||||
FromRviewer = JieReviewer == null ? "" : JieReviewer.UserName,
|
FromRviewer = JieReviewer == null ? "" : JieReviewer.UserName,
|
||||||
|
@ -223,7 +225,7 @@ namespace DM_Weight.ViewModels
|
||||||
ORDER BY d2.operation_time DESC,d2.id DESC LIMIT 1) AS beforeNum from (SELECT drug_id,manu_no, SUM(IF(d1.`type` = 1, d1.quantity, 0)) AS getNum,SUM(IF(d1.`type` = 2, d1.quantity, 0)) AS useNum FROM dm_machine_record d1
|
ORDER BY d2.operation_time DESC,d2.id DESC LIMIT 1) AS beforeNum from (SELECT drug_id,manu_no, SUM(IF(d1.`type` = 1, d1.quantity, 0)) AS getNum,SUM(IF(d1.`type` = 2, d1.quantity, 0)) AS useNum FROM dm_machine_record d1
|
||||||
WHERE d1.`type` IN (1, 2) AND d1.`operation_time` >= @startDate and d1.`operation_time` <=@endDate and d1.machine_id=@machineId GROUP BY d1.Drug_ID ,d1.manu_no) d
|
WHERE d1.`type` IN (1, 2) AND d1.`operation_time` >= @startDate and d1.`operation_time` <=@endDate and d1.machine_id=@machineId GROUP BY d1.Drug_ID ,d1.manu_no) d
|
||||||
LEFT JOIN drug_info drug on d.drug_id=drug.drug_id left JOIN channel_stock c on c.drug_id=d.drug_id and c.manu_no=d.manu_no AND c.machine_id=@machineId GROUP BY d.Drug_ID ,d.manu_no ";
|
LEFT JOIN drug_info drug on d.drug_id=drug.drug_id left JOIN channel_stock c on c.drug_id=d.drug_id and c.manu_no=d.manu_no AND c.machine_id=@machineId GROUP BY d.Drug_ID ,d.manu_no ";
|
||||||
List<ShiftsReport> shiftsReports = SqlSugarHelper.Db.SqlQueryable<dynamic>(strSql)
|
List<ShiftsReport> shiftsReports = _sqlSugarScope1.SqlQueryable<dynamic>(strSql)
|
||||||
.AddParameters(new
|
.AddParameters(new
|
||||||
{
|
{
|
||||||
machineId = ConfigurationManager.AppSettings["machineId"] ?? "DM1",
|
machineId = ConfigurationManager.AppSettings["machineId"] ?? "DM1",
|
||||||
|
@ -238,7 +240,7 @@ namespace DM_Weight.ViewModels
|
||||||
for (int i = 0; i < shiftsReports.Count; i++)
|
for (int i = 0; i < shiftsReports.Count; i++)
|
||||||
{
|
{
|
||||||
|
|
||||||
SqlSugarHelper.Db.Insertable(new ShiftsReport()
|
_sqlSugarScope1.Insertable(new ShiftsReport()
|
||||||
{
|
{
|
||||||
OptDate = dt,
|
OptDate = dt,
|
||||||
DrugName = shiftsReports[i].DrugName,
|
DrugName = shiftsReports[i].DrugName,
|
||||||
|
@ -310,7 +312,7 @@ namespace DM_Weight.ViewModels
|
||||||
LoginBtnEnable = false;
|
LoginBtnEnable = false;
|
||||||
if (!string.IsNullOrEmpty(Username) && !string.IsNullOrEmpty(Password))
|
if (!string.IsNullOrEmpty(Username) && !string.IsNullOrEmpty(Password))
|
||||||
{
|
{
|
||||||
UserList userList = SqlSugarHelper.Db.Queryable<UserList>()
|
UserList userList = _sqlSugarScope1.Queryable<UserList>()
|
||||||
.Includes<RoleDm>(u => u.Role)
|
.Includes<RoleDm>(u => u.Role)
|
||||||
.InnerJoin<RoleDm>((u, r) => u.RoleId == r.Id)
|
.InnerJoin<RoleDm>((u, r) => u.RoleId == r.Id)
|
||||||
.First(u => u.UserName == username && ConfigurationManager.AppSettings["machineId"].ToString().Equals(u.MachineId));
|
.First(u => u.UserName == username && ConfigurationManager.AppSettings["machineId"].ToString().Equals(u.MachineId));
|
||||||
|
@ -506,7 +508,7 @@ namespace DM_Weight.ViewModels
|
||||||
{
|
{
|
||||||
if (msg.Message.Equals("LOGIN"))
|
if (msg.Message.Equals("LOGIN"))
|
||||||
{
|
{
|
||||||
UserList userList = SqlSugarHelper.Db.Queryable<UserList>()
|
UserList userList = _sqlSugarScope1.Queryable<UserList>()
|
||||||
.Includes<RoleDm>(u => u.Role)
|
.Includes<RoleDm>(u => u.Role)
|
||||||
.First(u => u.Id == msg.Id);
|
.First(u => u.Id == msg.Id);
|
||||||
|
|
||||||
|
@ -607,9 +609,11 @@ namespace DM_Weight.ViewModels
|
||||||
|
|
||||||
}
|
}
|
||||||
IEventAggregator _eventAggregator;
|
IEventAggregator _eventAggregator;
|
||||||
public ChangeShiftsDialogViewModel(IEventAggregator eventAggregator)
|
private SqlSugarScope _sqlSugarScope1;
|
||||||
|
public ChangeShiftsDialogViewModel(IEventAggregator eventAggregator,SqlSugarScope sqlSugarScope)
|
||||||
{
|
{
|
||||||
_eventAggregator = eventAggregator;
|
_eventAggregator = eventAggregator;
|
||||||
|
this._sqlSugarScope1 = sqlSugarScope;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool CanCloseDialog()
|
public bool CanCloseDialog()
|
||||||
|
@ -627,8 +631,8 @@ namespace DM_Weight.ViewModels
|
||||||
HkcChangeShifts changeOperator = GetOperator();
|
HkcChangeShifts changeOperator = GetOperator();
|
||||||
if (changeOperator != null)
|
if (changeOperator != null)
|
||||||
{
|
{
|
||||||
Operator = SqlSugarHelper.Db.Queryable<UserList>().Where(u => u.MachineId.Equals(ConfigurationManager.AppSettings["machineId"] ?? "DM1")).Single(u => u.UserName == changeOperator.FromOperator);
|
Operator = _sqlSugarScope1.Queryable<UserList>().Where(u => u.MachineId.Equals(ConfigurationManager.AppSettings["machineId"] ?? "DM1")).Single(u => u.UserName == changeOperator.FromOperator);
|
||||||
Reviewer = SqlSugarHelper.Db.Queryable<UserList>().Where(u => u.MachineId.Equals(ConfigurationManager.AppSettings["machineId"] ?? "DM1")).Single(u => u.UserName == changeOperator.FromRviewer);
|
Reviewer = _sqlSugarScope1.Queryable<UserList>().Where(u => u.MachineId.Equals(ConfigurationManager.AppSettings["machineId"] ?? "DM1")).Single(u => u.UserName == changeOperator.FromRviewer);
|
||||||
}
|
}
|
||||||
|
|
||||||
FingerMsg = false;// !_fingerprintUtil.bIsConnected;
|
FingerMsg = false;// !_fingerprintUtil.bIsConnected;
|
||||||
|
@ -638,11 +642,11 @@ namespace DM_Weight.ViewModels
|
||||||
private HkcChangeShifts GetOperator()
|
private HkcChangeShifts GetOperator()
|
||||||
{
|
{
|
||||||
//查询发药人及审核人
|
//查询发药人及审核人
|
||||||
HkcChangeShifts changeOperator = SqlSugarHelper.Db.Queryable<HkcChangeShifts>().Single(change => change.State == "0");
|
HkcChangeShifts changeOperator = _sqlSugarScope1.Queryable<HkcChangeShifts>().Single(change => change.State == "0");
|
||||||
//if (changeOperator != null)
|
//if (changeOperator != null)
|
||||||
//{
|
//{
|
||||||
// Operator = SqlSugarHelper.Db.Queryable<UserList>().Single(u => u.UserName == changeOperator.FromOperator);
|
// Operator = _sqlSugarScope1.Queryable<UserList>().Single(u => u.UserName == changeOperator.FromOperator);
|
||||||
// Reviewer = SqlSugarHelper.Db.Queryable<UserList>().Single(u => u.UserName == changeOperator.ToOperator);
|
// Reviewer = _sqlSugarScope1.Queryable<UserList>().Single(u => u.UserName == changeOperator.ToOperator);
|
||||||
//}
|
//}
|
||||||
return changeOperator;
|
return changeOperator;
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,6 +5,7 @@ using Prism.Commands;
|
||||||
using Prism.Mvvm;
|
using Prism.Mvvm;
|
||||||
using Prism.Regions;
|
using Prism.Regions;
|
||||||
using Prism.Services.Dialogs;
|
using Prism.Services.Dialogs;
|
||||||
|
using SqlSugar;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Configuration;
|
using System.Configuration;
|
||||||
|
@ -123,10 +124,11 @@ namespace DM_Weight.ViewModels
|
||||||
{
|
{
|
||||||
GridReportUtil.PrintChangeShiftsReport(StartDate, EndDate);
|
GridReportUtil.PrintChangeShiftsReport(StartDate, EndDate);
|
||||||
}
|
}
|
||||||
|
private SqlSugarScope _sqlSugarScope1;
|
||||||
public ChangeShiftsListWindowViewModel(IDialogService dialogService)
|
public ChangeShiftsListWindowViewModel(IDialogService dialogService,SqlSugarScope sqlSugarScope)
|
||||||
{
|
{
|
||||||
_dialogService = dialogService;
|
_dialogService = dialogService;
|
||||||
|
this._sqlSugarScope1 = sqlSugarScope;
|
||||||
}
|
}
|
||||||
void RequestData()
|
void RequestData()
|
||||||
{
|
{
|
||||||
|
@ -145,7 +147,7 @@ namespace DM_Weight.ViewModels
|
||||||
sqlStr += " and c.optdate<=@endOptDate ";
|
sqlStr += " and c.optdate<=@endOptDate ";
|
||||||
}
|
}
|
||||||
sqlStr+=" group by c.id";
|
sqlStr+=" group by c.id";
|
||||||
HkcChangeShifts = SqlSugarHelper.Db.SqlQueryable<dynamic>(sqlStr)
|
HkcChangeShifts = _sqlSugarScope1.SqlQueryable<dynamic>(sqlStr)
|
||||||
.AddParameters(new
|
.AddParameters(new
|
||||||
{
|
{
|
||||||
machineId = machineId,
|
machineId = machineId,
|
||||||
|
|
|
@ -124,7 +124,7 @@ namespace DM_Weight.ViewModels
|
||||||
{
|
{
|
||||||
int totalCount = 0;
|
int totalCount = 0;
|
||||||
string machineId = ConfigurationManager.AppSettings["machineId"] ?? "DM1";
|
string machineId = ConfigurationManager.AppSettings["machineId"] ?? "DM1";
|
||||||
//MachineRecords = SqlSugarHelper.Db.Queryable<MachineRecord>()
|
//MachineRecords = _sqlSugarScope1.Queryable<MachineRecord>()
|
||||||
// .Includes<DrugInfo>(mr => mr.DrugInfo)
|
// .Includes<DrugInfo>(mr => mr.DrugInfo)
|
||||||
// .Includes<UserList>(mr => mr.User)
|
// .Includes<UserList>(mr => mr.User)
|
||||||
// .Where(mr => mr.MachineId == machineId)
|
// .Where(mr => mr.MachineId == machineId)
|
||||||
|
|
|
@ -88,12 +88,13 @@ namespace DM_Weight.ViewModels
|
||||||
get => _fingerMsg;
|
get => _fingerMsg;
|
||||||
set => SetProperty(ref _fingerMsg, value);
|
set => SetProperty(ref _fingerMsg, value);
|
||||||
}
|
}
|
||||||
|
private SqlSugarScope _sqlSugarScope1;
|
||||||
public ChangeShiftsWindowViewModel(IRegionManager regionManager, IEventAggregator eventAggregator, PortUtil portUtil)
|
public ChangeShiftsWindowViewModel(IRegionManager regionManager, IEventAggregator eventAggregator, PortUtil portUtil,SqlSugarScope sqlSugarScope)
|
||||||
{
|
{
|
||||||
_portUtil = portUtil;
|
_portUtil = portUtil;
|
||||||
_regionManager = regionManager;
|
_regionManager = regionManager;
|
||||||
_eventAggregator = eventAggregator;
|
_eventAggregator = eventAggregator;
|
||||||
|
this._sqlSugarScope1 = sqlSugarScope;
|
||||||
}
|
}
|
||||||
|
|
||||||
#region 交班确认按钮
|
#region 交班确认按钮
|
||||||
|
@ -187,22 +188,22 @@ namespace DM_Weight.ViewModels
|
||||||
if ((JiaoBanFYRFlag || JiaoBanSHRFlag) && (JieBanFYRFlag || JieBanSHRFlag))
|
if ((JiaoBanFYRFlag || JiaoBanSHRFlag) && (JieBanFYRFlag || JieBanSHRFlag))
|
||||||
{
|
{
|
||||||
//保存交接班信息(查询当前值班人的最后一条交接班信息(如有则修改状态,没有则插入一条)并写入一条接班人信息)
|
//保存交接班信息(查询当前值班人的最后一条交接班信息(如有则修改状态,没有则插入一条)并写入一条接班人信息)
|
||||||
var f = SqlSugarHelper.Db.UseTran(() =>
|
var f = _sqlSugarScope1.UseTran(() =>
|
||||||
{
|
{
|
||||||
List<HkcChangeShifts> listHkcChangeShifts = SqlSugarHelper.Db.Queryable<HkcChangeShifts>()
|
List<HkcChangeShifts> listHkcChangeShifts = _sqlSugarScope1.Queryable<HkcChangeShifts>()
|
||||||
.Where(cs => cs.State == "0")
|
.Where(cs => cs.State == "0")
|
||||||
.WhereIF(App.CurrentFaUserList != null && !string.IsNullOrEmpty(App.CurrentFaUserList.UserName), cs => cs.FromOperator == App.CurrentFaUserList.UserName)
|
.WhereIF(App.CurrentFaUserList != null && !string.IsNullOrEmpty(App.CurrentFaUserList.UserName), cs => cs.FromOperator == App.CurrentFaUserList.UserName)
|
||||||
.WhereIF(App.CurrentShenUserList != null && !string.IsNullOrEmpty(App.CurrentShenUserList.UserName), cs => cs.FromRviewer == App.CurrentShenUserList.UserName)
|
.WhereIF(App.CurrentShenUserList != null && !string.IsNullOrEmpty(App.CurrentShenUserList.UserName), cs => cs.FromRviewer == App.CurrentShenUserList.UserName)
|
||||||
.OrderByDescending(cs => cs.OptState)
|
.OrderByDescending(cs => cs.OptState)
|
||||||
.ToList();
|
.ToList();
|
||||||
|
|
||||||
//List<MachineRecord> listMachineRecord=SqlSugarHelper.Db.Queryable<MachineRecord>()
|
//List<MachineRecord> listMachineRecord=_sqlSugarScope1.Queryable<MachineRecord>()
|
||||||
//.Where(m=>)
|
//.Where(m=>)
|
||||||
|
|
||||||
if (listHkcChangeShifts != null && listHkcChangeShifts.Count > 0)
|
if (listHkcChangeShifts != null && listHkcChangeShifts.Count > 0)
|
||||||
{
|
{
|
||||||
//存在则修改,不存在则插入一条
|
//存在则修改,不存在则插入一条
|
||||||
SqlSugarHelper.Db.Updateable(new HkcChangeShifts()
|
_sqlSugarScope1.Updateable(new HkcChangeShifts()
|
||||||
{
|
{
|
||||||
Id = listHkcChangeShifts[0].Id,
|
Id = listHkcChangeShifts[0].Id,
|
||||||
ToOperator = Operator == null ? "" : Operator.UserName,
|
ToOperator = Operator == null ? "" : Operator.UserName,
|
||||||
|
@ -214,7 +215,7 @@ namespace DM_Weight.ViewModels
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
SqlSugarHelper.Db.Insertable(new HkcChangeShifts()
|
_sqlSugarScope1.Insertable(new HkcChangeShifts()
|
||||||
{
|
{
|
||||||
FromOperator = App.CurrentFaUserList.UserName,
|
FromOperator = App.CurrentFaUserList.UserName,
|
||||||
FromRviewer = App.CurrentShenUserList.UserName,
|
FromRviewer = App.CurrentShenUserList.UserName,
|
||||||
|
@ -226,7 +227,7 @@ namespace DM_Weight.ViewModels
|
||||||
}).ExecuteCommand();
|
}).ExecuteCommand();
|
||||||
|
|
||||||
}
|
}
|
||||||
SqlSugarHelper.Db.Insertable(new HkcChangeShifts()
|
_sqlSugarScope1.Insertable(new HkcChangeShifts()
|
||||||
{
|
{
|
||||||
FromOperator = App.CurrentFaUserList.UserName,
|
FromOperator = App.CurrentFaUserList.UserName,
|
||||||
FromRviewer = App.CurrentShenUserList.UserName,
|
FromRviewer = App.CurrentShenUserList.UserName,
|
||||||
|
@ -265,7 +266,7 @@ namespace DM_Weight.ViewModels
|
||||||
if (!string.IsNullOrEmpty(userName) && !string.IsNullOrEmpty(passWord))
|
if (!string.IsNullOrEmpty(userName) && !string.IsNullOrEmpty(passWord))
|
||||||
{
|
{
|
||||||
{
|
{
|
||||||
UserList userList = SqlSugarHelper.Db.Queryable<UserList>()
|
UserList userList = _sqlSugarScope1.Queryable<UserList>()
|
||||||
.Includes<RoleDm>(u => u.Role)
|
.Includes<RoleDm>(u => u.Role)
|
||||||
.InnerJoin<RoleDm>((u, r) => u.RoleId == r.Id)
|
.InnerJoin<RoleDm>((u, r) => u.RoleId == r.Id)
|
||||||
.First(u => u.UserName == userName && ConfigurationManager.AppSettings["machineId"].ToString().Equals(u.MachineId));
|
.First(u => u.UserName == userName && ConfigurationManager.AppSettings["machineId"].ToString().Equals(u.MachineId));
|
||||||
|
@ -349,7 +350,7 @@ namespace DM_Weight.ViewModels
|
||||||
if (!string.IsNullOrEmpty(userName) && !string.IsNullOrEmpty(passWord))
|
if (!string.IsNullOrEmpty(userName) && !string.IsNullOrEmpty(passWord))
|
||||||
{
|
{
|
||||||
{
|
{
|
||||||
UserList userList = SqlSugarHelper.Db.Queryable<UserList>()
|
UserList userList = _sqlSugarScope1.Queryable<UserList>()
|
||||||
.Includes<RoleDm>(u => u.Role)
|
.Includes<RoleDm>(u => u.Role)
|
||||||
.InnerJoin<RoleDm>((u, r) => u.RoleId == r.Id)
|
.InnerJoin<RoleDm>((u, r) => u.RoleId == r.Id)
|
||||||
.First(u => u.UserName == userName && ConfigurationManager.AppSettings["machineId"].ToString().Equals(u.MachineId));
|
.First(u => u.UserName == userName && ConfigurationManager.AppSettings["machineId"].ToString().Equals(u.MachineId));
|
||||||
|
@ -418,7 +419,7 @@ namespace DM_Weight.ViewModels
|
||||||
{
|
{
|
||||||
if (msg.Message.Equals("LOGIN"))
|
if (msg.Message.Equals("LOGIN"))
|
||||||
{
|
{
|
||||||
UserList userList = SqlSugarHelper.Db.Queryable<UserList>()
|
UserList userList = _sqlSugarScope1.Queryable<UserList>()
|
||||||
.Includes<RoleDm>(u => u.Role)
|
.Includes<RoleDm>(u => u.Role)
|
||||||
.First(u => u.Id == msg.Id);
|
.First(u => u.Id == msg.Id);
|
||||||
|
|
||||||
|
|
|
@ -33,11 +33,12 @@ namespace DM_Weight.ViewModels
|
||||||
|
|
||||||
private PortUtil _portUtil;
|
private PortUtil _portUtil;
|
||||||
IEventAggregator _eventAggregator;
|
IEventAggregator _eventAggregator;
|
||||||
|
private SqlSugarScope _sqlSugarScope1;
|
||||||
public CheckStockWindowViewModel(PortUtil portUtil, IEventAggregator eventAggregator)
|
public CheckStockWindowViewModel(PortUtil portUtil, IEventAggregator eventAggregator,SqlSugarScope sqlSugarScope)
|
||||||
{
|
{
|
||||||
_portUtil = portUtil;
|
_portUtil = portUtil;
|
||||||
_eventAggregator = eventAggregator;
|
_eventAggregator = eventAggregator;
|
||||||
|
this._sqlSugarScope1= sqlSugarScope;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DoMyPrismEvent(DeviceMsg msg)
|
void DoMyPrismEvent(DeviceMsg msg)
|
||||||
|
@ -150,7 +151,7 @@ namespace DM_Weight.ViewModels
|
||||||
if (record.Count > 0)
|
if (record.Count > 0)
|
||||||
{
|
{
|
||||||
string InvoiceId = "CHECK_" + CurrentTimeMillis();
|
string InvoiceId = "CHECK_" + CurrentTimeMillis();
|
||||||
var f = SqlSugarHelper.Db.UseTran(() =>
|
var f = _sqlSugarScope1.UseTran(() =>
|
||||||
{
|
{
|
||||||
|
|
||||||
for (int i = 0; i < record.Count; i++)
|
for (int i = 0; i < record.Count; i++)
|
||||||
|
@ -159,7 +160,7 @@ namespace DM_Weight.ViewModels
|
||||||
|
|
||||||
|
|
||||||
// 更新数据 库存信息
|
// 更新数据 库存信息
|
||||||
SqlSugarHelper.Db.Updateable(new ChannelStock()
|
_sqlSugarScope1.Updateable(new ChannelStock()
|
||||||
{
|
{
|
||||||
Quantity = it.CheckQuantity,
|
Quantity = it.CheckQuantity,
|
||||||
ManuNo = it.ManuNo,
|
ManuNo = it.ManuNo,
|
||||||
|
@ -167,14 +168,14 @@ namespace DM_Weight.ViewModels
|
||||||
Id = it.Id,
|
Id = it.Id,
|
||||||
}).UpdateColumns(it => new { it.Quantity, it.ManuNo, it.EffDate }).ExecuteCommand();
|
}).UpdateColumns(it => new { it.Quantity, it.ManuNo, it.EffDate }).ExecuteCommand();
|
||||||
// 获取更新完库存后的药品库存
|
// 获取更新完库存后的药品库存
|
||||||
List<ChannelStock> nowChannels = SqlSugarHelper.Db.Queryable<ChannelStock>()
|
List<ChannelStock> nowChannels = _sqlSugarScope1.Queryable<ChannelStock>()
|
||||||
.Where(cs => cs.MachineId.Equals(it.MachineId))
|
.Where(cs => cs.MachineId.Equals(it.MachineId))
|
||||||
.Where(cs => cs.DrugId.Equals(it.DrugId))
|
.Where(cs => cs.DrugId.Equals(it.DrugId))
|
||||||
.Where(cs => cs.DrawerType == 1)
|
.Where(cs => cs.DrawerType == 1)
|
||||||
.ToList();
|
.ToList();
|
||||||
|
|
||||||
// 保存数据 盘点记录
|
// 保存数据 盘点记录
|
||||||
SqlSugarHelper.Db.Insertable(new MachineRecord()
|
_sqlSugarScope1.Insertable(new MachineRecord()
|
||||||
{
|
{
|
||||||
MachineId = it.MachineId,
|
MachineId = it.MachineId,
|
||||||
DrawerNo = it.DrawerNo,
|
DrawerNo = it.DrawerNo,
|
||||||
|
@ -266,7 +267,7 @@ namespace DM_Weight.ViewModels
|
||||||
|
|
||||||
public void FindDrawerCount()
|
public void FindDrawerCount()
|
||||||
{
|
{
|
||||||
int count = SqlSugarHelper.Db.Queryable<ChannelStock>().Where(cs => cs.DrawerType != 3)
|
int count = _sqlSugarScope1.Queryable<ChannelStock>().Where(cs => cs.DrawerType != 3)
|
||||||
.Where(cs => cs.MachineId.Equals(ConfigurationManager.AppSettings["machineId"] ?? "DM1")).GroupBy(cs => cs.DrawerNo).Select(cs => SqlFunc.AggregateCount(cs.DrawerNo)).Count();
|
.Where(cs => cs.MachineId.Equals(ConfigurationManager.AppSettings["machineId"] ?? "DM1")).GroupBy(cs => cs.DrawerNo).Select(cs => SqlFunc.AggregateCount(cs.DrawerNo)).Count();
|
||||||
Is8Drawer = count < 9;
|
Is8Drawer = count < 9;
|
||||||
Is16Drawer = count >= 16;
|
Is16Drawer = count >= 16;
|
||||||
|
@ -283,7 +284,7 @@ namespace DM_Weight.ViewModels
|
||||||
|
|
||||||
public void RequestData()
|
public void RequestData()
|
||||||
{
|
{
|
||||||
List<ChannelStock> queryData = SqlSugarHelper.Db.Queryable<ChannelStock>()
|
List<ChannelStock> queryData = _sqlSugarScope1.Queryable<ChannelStock>()
|
||||||
.Includes(cs => cs.DrugInfo)
|
.Includes(cs => cs.DrugInfo)
|
||||||
.Where(cs => cs.DrawerNo == DrawerNo)
|
.Where(cs => cs.DrawerNo == DrawerNo)
|
||||||
.Where(cs => cs.DrugId != null)
|
.Where(cs => cs.DrugId != null)
|
||||||
|
|
|
@ -49,11 +49,12 @@ namespace DM_Weight.ViewModels
|
||||||
|
|
||||||
private PortUtil _portUtil;
|
private PortUtil _portUtil;
|
||||||
IEventAggregator _eventAggregator;
|
IEventAggregator _eventAggregator;
|
||||||
|
private SqlSugarScope _sqlSugarScope1;
|
||||||
public DrawerAddDrugWindowViewModel(PortUtil portUtil, IEventAggregator eventAggregator)
|
public DrawerAddDrugWindowViewModel(PortUtil portUtil, IEventAggregator eventAggregator,SqlSugarScope sqlSugarScope)
|
||||||
{
|
{
|
||||||
_portUtil = portUtil;
|
_portUtil = portUtil;
|
||||||
_eventAggregator = eventAggregator;
|
_eventAggregator = eventAggregator;
|
||||||
|
this._sqlSugarScope1= sqlSugarScope;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DoMyPrismEvent(DeviceMsg msg)
|
void DoMyPrismEvent(DeviceMsg msg)
|
||||||
|
@ -176,7 +177,7 @@ namespace DM_Weight.ViewModels
|
||||||
{
|
{
|
||||||
//string InvoiceId = "DRAWER_" + CurrentTimeMillis();
|
//string InvoiceId = "DRAWER_" + CurrentTimeMillis();
|
||||||
string InvoiceId = PZH;
|
string InvoiceId = PZH;
|
||||||
var f = SqlSugarHelper.Db.UseTran(() =>
|
var f = _sqlSugarScope1.UseTran(() =>
|
||||||
{
|
{
|
||||||
|
|
||||||
for (int i = 0; i < record.Count; i++)
|
for (int i = 0; i < record.Count; i++)
|
||||||
|
@ -186,7 +187,7 @@ namespace DM_Weight.ViewModels
|
||||||
it.EffDate = it.drugManuNo.EffDate;
|
it.EffDate = it.drugManuNo.EffDate;
|
||||||
|
|
||||||
// 更新数据 库存信息
|
// 更新数据 库存信息
|
||||||
SqlSugarHelper.Db.Updateable(new ChannelStock()
|
_sqlSugarScope1.Updateable(new ChannelStock()
|
||||||
{
|
{
|
||||||
Quantity = it.Quantity + it.AddQuantity,
|
Quantity = it.Quantity + it.AddQuantity,
|
||||||
ManuNo = it.ManuNo,
|
ManuNo = it.ManuNo,
|
||||||
|
@ -194,14 +195,14 @@ namespace DM_Weight.ViewModels
|
||||||
Id = it.Id,
|
Id = it.Id,
|
||||||
}).UpdateColumns(it => new { it.Quantity, it.ManuNo, it.EffDate }).ExecuteCommand();
|
}).UpdateColumns(it => new { it.Quantity, it.ManuNo, it.EffDate }).ExecuteCommand();
|
||||||
// 获取更新完库存后的药品库存
|
// 获取更新完库存后的药品库存
|
||||||
List<ChannelStock> nowChannels = SqlSugarHelper.Db.Queryable<ChannelStock>()
|
List<ChannelStock> nowChannels = _sqlSugarScope1.Queryable<ChannelStock>()
|
||||||
.Where(cs => cs.MachineId.Equals(it.MachineId))
|
.Where(cs => cs.MachineId.Equals(it.MachineId))
|
||||||
.Where(cs => cs.DrugId.Equals(it.DrugId))
|
.Where(cs => cs.DrugId.Equals(it.DrugId))
|
||||||
.Where(cs => cs.DrawerType == 1)
|
.Where(cs => cs.DrawerType == 1)
|
||||||
.ToList();
|
.ToList();
|
||||||
|
|
||||||
// 保存数据 入库记录
|
// 保存数据 入库记录
|
||||||
SqlSugarHelper.Db.Insertable(new MachineRecord()
|
_sqlSugarScope1.Insertable(new MachineRecord()
|
||||||
{
|
{
|
||||||
MachineId = it.MachineId,
|
MachineId = it.MachineId,
|
||||||
DrawerNo = it.DrawerNo,
|
DrawerNo = it.DrawerNo,
|
||||||
|
@ -295,7 +296,7 @@ namespace DM_Weight.ViewModels
|
||||||
|
|
||||||
public void FindDrawerCount()
|
public void FindDrawerCount()
|
||||||
{
|
{
|
||||||
int count = SqlSugarHelper.Db.Queryable<ChannelStock>().Where(cs => cs.DrawerType != 3)
|
int count = _sqlSugarScope1.Queryable<ChannelStock>().Where(cs => cs.DrawerType != 3)
|
||||||
.Where(cs => cs.MachineId.Equals(ConfigurationManager.AppSettings["machineId"] ?? "DM1")).GroupBy(cs => cs.DrawerNo).Select(cs => SqlFunc.AggregateCount(cs.DrawerNo)).Count();
|
.Where(cs => cs.MachineId.Equals(ConfigurationManager.AppSettings["machineId"] ?? "DM1")).GroupBy(cs => cs.DrawerNo).Select(cs => SqlFunc.AggregateCount(cs.DrawerNo)).Count();
|
||||||
Is8Drawer = count < 9;
|
Is8Drawer = count < 9;
|
||||||
Is16Drawer = count >= 16;
|
Is16Drawer = count >= 16;
|
||||||
|
@ -313,7 +314,7 @@ namespace DM_Weight.ViewModels
|
||||||
|
|
||||||
public void RequestData()
|
public void RequestData()
|
||||||
{
|
{
|
||||||
List<ChannelStock> queryData = SqlSugarHelper.Db.Queryable<ChannelStock>()
|
List<ChannelStock> queryData = _sqlSugarScope1.Queryable<ChannelStock>()
|
||||||
.Includes(cs => cs.DrugInfo,di=>di.DrugManuNos)
|
.Includes(cs => cs.DrugInfo,di=>di.DrugManuNos)
|
||||||
.Where(cs => cs.DrawerNo == DrawerNo)
|
.Where(cs => cs.DrawerNo == DrawerNo)
|
||||||
.Where(cs => cs.DrawerType == 1)
|
.Where(cs => cs.DrawerType == 1)
|
||||||
|
|
|
@ -44,11 +44,12 @@ namespace DM_Weight.ViewModels
|
||||||
private PortUtil _portUtil;
|
private PortUtil _portUtil;
|
||||||
IEventAggregator _eventAggregator;
|
IEventAggregator _eventAggregator;
|
||||||
|
|
||||||
|
private SqlSugarScope _sqlSugarScope1;
|
||||||
public DrawerTakeDrugWindowViewModel(PortUtil portUtil, IEventAggregator eventAggregator)
|
public DrawerTakeDrugWindowViewModel(PortUtil portUtil, IEventAggregator eventAggregator,SqlSugarScope sqlSugarScope)
|
||||||
{
|
{
|
||||||
_portUtil = portUtil;
|
_portUtil = portUtil;
|
||||||
_eventAggregator = eventAggregator;
|
_eventAggregator = eventAggregator;
|
||||||
|
this._sqlSugarScope1= sqlSugarScope;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DoMyPrismEvent(DeviceMsg msg)
|
void DoMyPrismEvent(DeviceMsg msg)
|
||||||
|
@ -168,7 +169,7 @@ namespace DM_Weight.ViewModels
|
||||||
if (record.Count > 0)
|
if (record.Count > 0)
|
||||||
{
|
{
|
||||||
string InvoiceId = "DRAWER_" + CurrentTimeMillis();
|
string InvoiceId = "DRAWER_" + CurrentTimeMillis();
|
||||||
var f = SqlSugarHelper.Db.UseTran(() =>
|
var f = _sqlSugarScope1.UseTran(() =>
|
||||||
{
|
{
|
||||||
|
|
||||||
for (int i = 0; i < record.Count; i++)
|
for (int i = 0; i < record.Count; i++)
|
||||||
|
@ -177,7 +178,7 @@ namespace DM_Weight.ViewModels
|
||||||
|
|
||||||
|
|
||||||
// 更新数据 库存信息
|
// 更新数据 库存信息
|
||||||
SqlSugarHelper.Db.Updateable(new ChannelStock()
|
_sqlSugarScope1.Updateable(new ChannelStock()
|
||||||
{
|
{
|
||||||
Quantity = it.Quantity - it.TakeQuantity,
|
Quantity = it.Quantity - it.TakeQuantity,
|
||||||
ManuNo = it.ManuNo,
|
ManuNo = it.ManuNo,
|
||||||
|
@ -185,14 +186,14 @@ namespace DM_Weight.ViewModels
|
||||||
Id = it.Id,
|
Id = it.Id,
|
||||||
}).UpdateColumns(it => new { it.Quantity, it.ManuNo, it.EffDate }).ExecuteCommand();
|
}).UpdateColumns(it => new { it.Quantity, it.ManuNo, it.EffDate }).ExecuteCommand();
|
||||||
// 获取更新完库存后的药品库存
|
// 获取更新完库存后的药品库存
|
||||||
List<ChannelStock> nowChannels = SqlSugarHelper.Db.Queryable<ChannelStock>()
|
List<ChannelStock> nowChannels = _sqlSugarScope1.Queryable<ChannelStock>()
|
||||||
.Where(cs => cs.MachineId.Equals(it.MachineId))
|
.Where(cs => cs.MachineId.Equals(it.MachineId))
|
||||||
.Where(cs => cs.DrugId.Equals(it.DrugId))
|
.Where(cs => cs.DrugId.Equals(it.DrugId))
|
||||||
.Where(cs => cs.DrawerType == 1)
|
.Where(cs => cs.DrawerType == 1)
|
||||||
.ToList();
|
.ToList();
|
||||||
|
|
||||||
// 保存数据 出库记录
|
// 保存数据 出库记录
|
||||||
SqlSugarHelper.Db.Insertable(new MachineRecord()
|
_sqlSugarScope1.Insertable(new MachineRecord()
|
||||||
{
|
{
|
||||||
MachineId = it.MachineId,
|
MachineId = it.MachineId,
|
||||||
DrawerNo = it.DrawerNo,
|
DrawerNo = it.DrawerNo,
|
||||||
|
@ -280,7 +281,7 @@ namespace DM_Weight.ViewModels
|
||||||
|
|
||||||
public void FindDrawerCount()
|
public void FindDrawerCount()
|
||||||
{
|
{
|
||||||
int count = SqlSugarHelper.Db.Queryable<ChannelStock>().Where(cs => cs.DrawerType != 3)
|
int count = _sqlSugarScope1.Queryable<ChannelStock>().Where(cs => cs.DrawerType != 3)
|
||||||
.Where(cs => cs.MachineId.Equals(ConfigurationManager.AppSettings["machineId"] ?? "DM1")).GroupBy(cs => cs.DrawerNo).Select(cs => SqlFunc.AggregateCount(cs.DrawerNo)).Count();
|
.Where(cs => cs.MachineId.Equals(ConfigurationManager.AppSettings["machineId"] ?? "DM1")).GroupBy(cs => cs.DrawerNo).Select(cs => SqlFunc.AggregateCount(cs.DrawerNo)).Count();
|
||||||
Is8Drawer = count < 9;
|
Is8Drawer = count < 9;
|
||||||
Is16Drawer = count >= 16;
|
Is16Drawer = count >= 16;
|
||||||
|
@ -297,7 +298,7 @@ namespace DM_Weight.ViewModels
|
||||||
|
|
||||||
public void RequestData()
|
public void RequestData()
|
||||||
{
|
{
|
||||||
List<ChannelStock> queryData = SqlSugarHelper.Db.Queryable<ChannelStock>()
|
List<ChannelStock> queryData = _sqlSugarScope1.Queryable<ChannelStock>()
|
||||||
.Includes(cs => cs.DrugInfo)
|
.Includes(cs => cs.DrugInfo)
|
||||||
.Where(cs => cs.DrawerNo == DrawerNo)
|
.Where(cs => cs.DrawerNo == DrawerNo)
|
||||||
.Where(cs => cs.DrugId != null)
|
.Where(cs => cs.DrugId != null)
|
||||||
|
|
|
@ -12,6 +12,7 @@ using DM_Weight.select;
|
||||||
using DM_Weight.util;
|
using DM_Weight.util;
|
||||||
using log4net.Repository.Hierarchy;
|
using log4net.Repository.Hierarchy;
|
||||||
using log4net;
|
using log4net;
|
||||||
|
using SqlSugar;
|
||||||
|
|
||||||
namespace DM_Weight.ViewModels
|
namespace DM_Weight.ViewModels
|
||||||
{
|
{
|
||||||
|
@ -165,7 +166,11 @@ namespace DM_Weight.ViewModels
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool KeepAlive => false;
|
public bool KeepAlive => false;
|
||||||
|
private SqlSugarScope _sqlSugarScope1;
|
||||||
|
public DrugListWindowViewModel(SqlSugarScope sqlSugarScope)
|
||||||
|
{
|
||||||
|
this._sqlSugarScope1 = sqlSugarScope;
|
||||||
|
}
|
||||||
|
|
||||||
public DelegateCommand Query
|
public DelegateCommand Query
|
||||||
{
|
{
|
||||||
|
@ -183,7 +188,7 @@ namespace DM_Weight.ViewModels
|
||||||
{
|
{
|
||||||
|
|
||||||
//SelectedDrug.DrugId = 0;
|
//SelectedDrug.DrugId = 0;
|
||||||
SqlSugarHelper.Db.Insertable(SelectedDrug).ExecuteCommand();
|
_sqlSugarScope1.Insertable(SelectedDrug).ExecuteCommand();
|
||||||
RequestData();
|
RequestData();
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
|
@ -199,7 +204,7 @@ namespace DM_Weight.ViewModels
|
||||||
{
|
{
|
||||||
get => new DelegateCommand(() =>
|
get => new DelegateCommand(() =>
|
||||||
{
|
{
|
||||||
SqlSugarHelper.Db.Updateable(SelectedDrug).UpdateColumns(d => new { d.DrugName, d.Manufactory, d.PyCode, d.PackUnit, d.MaxStock, d.DrugSpec }).ExecuteCommand();
|
_sqlSugarScope1.Updateable(SelectedDrug).UpdateColumns(d => new { d.DrugName, d.Manufactory, d.PyCode, d.PackUnit, d.MaxStock, d.DrugSpec }).ExecuteCommand();
|
||||||
RequestData();
|
RequestData();
|
||||||
}, () => SelectedDrug.DrugId !=null).ObservesProperty(() => SelectedDrug);
|
}, () => SelectedDrug.DrugId !=null).ObservesProperty(() => SelectedDrug);
|
||||||
}
|
}
|
||||||
|
@ -213,7 +218,7 @@ namespace DM_Weight.ViewModels
|
||||||
SelectedManuno.Id = Guid.NewGuid().ToString();
|
SelectedManuno.Id = Guid.NewGuid().ToString();
|
||||||
SelectedManuno.DrugId = SelectedDrug.DrugId.ToString();
|
SelectedManuno.DrugId = SelectedDrug.DrugId.ToString();
|
||||||
SelectedManuno.EffDate = DateTime.Parse(SelectedManuno.EffDate).ToString("yyyy-MM-dd");
|
SelectedManuno.EffDate = DateTime.Parse(SelectedManuno.EffDate).ToString("yyyy-MM-dd");
|
||||||
SqlSugarHelper.Db.Insertable(SelectedManuno).ExecuteCommand();
|
_sqlSugarScope1.Insertable(SelectedManuno).ExecuteCommand();
|
||||||
GetManuNos();
|
GetManuNos();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -225,7 +230,7 @@ namespace DM_Weight.ViewModels
|
||||||
get => new DelegateCommand(() =>
|
get => new DelegateCommand(() =>
|
||||||
{
|
{
|
||||||
SelectedManuno.EffDate = DateTime.Parse(SelectedManuno.EffDate).ToString("yyyy-MM-dd");
|
SelectedManuno.EffDate = DateTime.Parse(SelectedManuno.EffDate).ToString("yyyy-MM-dd");
|
||||||
SqlSugarHelper.Db.Updateable(SelectedManuno).UpdateColumns(m => new { m.ManuNo, m.EffDate }).ExecuteCommand();
|
_sqlSugarScope1.Updateable(SelectedManuno).UpdateColumns(m => new { m.ManuNo, m.EffDate }).ExecuteCommand();
|
||||||
GetManuNos();
|
GetManuNos();
|
||||||
}, () => !string.IsNullOrEmpty(SelectedManuno.DrugId)).ObservesProperty(() => SelectedManuno);
|
}, () => !string.IsNullOrEmpty(SelectedManuno.DrugId)).ObservesProperty(() => SelectedManuno);
|
||||||
}
|
}
|
||||||
|
@ -247,7 +252,7 @@ namespace DM_Weight.ViewModels
|
||||||
|
|
||||||
void GetManuNos()
|
void GetManuNos()
|
||||||
{
|
{
|
||||||
Manunos = SqlSugarHelper.Db.Queryable<DrugManuNo>()
|
Manunos = _sqlSugarScope1.Queryable<DrugManuNo>()
|
||||||
.WhereIF(SelectedDrug != null, (di) => di.DrugId.Equals(SelectedDrug.DrugId))
|
.WhereIF(SelectedDrug != null, (di) => di.DrugId.Equals(SelectedDrug.DrugId))
|
||||||
.Select(di => di)
|
.Select(di => di)
|
||||||
.ToList();
|
.ToList();
|
||||||
|
@ -256,7 +261,7 @@ namespace DM_Weight.ViewModels
|
||||||
void RequestData()
|
void RequestData()
|
||||||
{
|
{
|
||||||
int totalCount = 0;
|
int totalCount = 0;
|
||||||
DrugInfos = SqlSugarHelper.Db.Queryable<DrugInfo>()
|
DrugInfos = _sqlSugarScope1.Queryable<DrugInfo>()
|
||||||
.WhereIF(!String.IsNullOrEmpty(SearchValue) && SelectedItem.Code.Equals("DrugId"), (di) => di.DrugId.ToString().Contains(SearchValue))
|
.WhereIF(!String.IsNullOrEmpty(SearchValue) && SelectedItem.Code.Equals("DrugId"), (di) => di.DrugId.ToString().Contains(SearchValue))
|
||||||
.WhereIF(!String.IsNullOrEmpty(SearchValue) && SelectedItem.Code.Equals("DrugName"), (di) => di.DrugName.Contains(SearchValue))
|
.WhereIF(!String.IsNullOrEmpty(SearchValue) && SelectedItem.Code.Equals("DrugName"), (di) => di.DrugName.Contains(SearchValue))
|
||||||
.WhereIF(!String.IsNullOrEmpty(SearchValue) && SelectedItem.Code.Equals("PyCode"), (di) => di.PyCode.Contains(SearchValue))
|
.WhereIF(!String.IsNullOrEmpty(SearchValue) && SelectedItem.Code.Equals("PyCode"), (di) => di.PyCode.Contains(SearchValue))
|
||||||
|
|
|
@ -14,6 +14,7 @@ using DM_Weight.Finger;
|
||||||
using DM_Weight.Models;
|
using DM_Weight.Models;
|
||||||
using DM_Weight.msg;
|
using DM_Weight.msg;
|
||||||
using DM_Weight.util;
|
using DM_Weight.util;
|
||||||
|
using SqlSugar;
|
||||||
|
|
||||||
namespace DM_Weight.ViewModels
|
namespace DM_Weight.ViewModels
|
||||||
{
|
{
|
||||||
|
@ -22,10 +23,12 @@ namespace DM_Weight.ViewModels
|
||||||
|
|
||||||
private readonly FingerprintUtil _fingerprintUtil;
|
private readonly FingerprintUtil _fingerprintUtil;
|
||||||
IEventAggregator _eventAggregator;
|
IEventAggregator _eventAggregator;
|
||||||
public EditUserDialogViewModel(FingerprintUtil fingerprintUtil, IEventAggregator eventAggregator)
|
private SqlSugarScope _sqlSugarScope1;
|
||||||
|
public EditUserDialogViewModel(FingerprintUtil fingerprintUtil, IEventAggregator eventAggregator,SqlSugarScope sqlSugarScope)
|
||||||
{
|
{
|
||||||
_fingerprintUtil = fingerprintUtil;
|
_fingerprintUtil = fingerprintUtil;
|
||||||
_eventAggregator = eventAggregator;
|
_eventAggregator = eventAggregator;
|
||||||
|
this._sqlSugarScope1 = sqlSugarScope;
|
||||||
}
|
}
|
||||||
|
|
||||||
private UserList _userList = new UserList();
|
private UserList _userList = new UserList();
|
||||||
|
@ -102,7 +105,7 @@ namespace DM_Weight.ViewModels
|
||||||
{
|
{
|
||||||
// 旧密码输入正确
|
// 旧密码输入正确
|
||||||
UserList.PassWord = MD5.GetMD5Hash(NewPass);
|
UserList.PassWord = MD5.GetMD5Hash(NewPass);
|
||||||
SqlSugarHelper.Db.Updateable<UserList>(UserList).UpdateColumns(u => new { u.PassWord }).ExecuteCommand();
|
_sqlSugarScope1.Updateable<UserList>(UserList).UpdateColumns(u => new { u.PassWord }).ExecuteCommand();
|
||||||
// 关闭当前窗口
|
// 关闭当前窗口
|
||||||
RequestClose?.Invoke(new DialogResult(ButtonResult.OK));
|
RequestClose?.Invoke(new DialogResult(ButtonResult.OK));
|
||||||
}
|
}
|
||||||
|
@ -120,13 +123,13 @@ namespace DM_Weight.ViewModels
|
||||||
// 没有写密码
|
// 没有写密码
|
||||||
if (string.IsNullOrEmpty(NewPass))
|
if (string.IsNullOrEmpty(NewPass))
|
||||||
{
|
{
|
||||||
SqlSugarHelper.Db.Updateable<UserList>(UserList).UpdateColumns(u => new { u.Nickname, u.UserName, u.UserBarcode, u.RoleId }).ExecuteCommand();
|
_sqlSugarScope1.Updateable<UserList>(UserList).UpdateColumns(u => new { u.Nickname, u.UserName, u.UserBarcode, u.RoleId }).ExecuteCommand();
|
||||||
}
|
}
|
||||||
// 更改了密码
|
// 更改了密码
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
UserList.PassWord = MD5.GetMD5Hash(NewPass);
|
UserList.PassWord = MD5.GetMD5Hash(NewPass);
|
||||||
SqlSugarHelper.Db.Updateable<UserList>(UserList).UpdateColumns(u => new { u.Nickname, u.UserName, u.PassWord, u.UserBarcode, u.RoleId }).ExecuteCommand();
|
_sqlSugarScope1.Updateable<UserList>(UserList).UpdateColumns(u => new { u.Nickname, u.UserName, u.PassWord, u.UserBarcode, u.RoleId }).ExecuteCommand();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -134,7 +137,7 @@ namespace DM_Weight.ViewModels
|
||||||
UserList.PassWord = MD5.GetMD5Hash(NewPass);
|
UserList.PassWord = MD5.GetMD5Hash(NewPass);
|
||||||
UserList.MachineId = ConfigurationManager.AppSettings["machineId"] ?? "DM1";
|
UserList.MachineId = ConfigurationManager.AppSettings["machineId"] ?? "DM1";
|
||||||
// 插入
|
// 插入
|
||||||
SqlSugarHelper.Db.Insertable<UserList>(UserList).InsertColumns(u => new { u.Id, u.Nickname, u.UserName, u.PassWord, u.UserBarcode, u.RoleId, u.MachineId }).ExecuteCommand();
|
_sqlSugarScope1.Insertable<UserList>(UserList).InsertColumns(u => new { u.Id, u.Nickname, u.UserName, u.PassWord, u.UserBarcode, u.RoleId, u.MachineId }).ExecuteCommand();
|
||||||
}
|
}
|
||||||
RequestClose?.Invoke(new DialogResult(ButtonResult.OK));
|
RequestClose?.Invoke(new DialogResult(ButtonResult.OK));
|
||||||
}
|
}
|
||||||
|
@ -154,7 +157,7 @@ namespace DM_Weight.ViewModels
|
||||||
|
|
||||||
void GetAllRole()
|
void GetAllRole()
|
||||||
{
|
{
|
||||||
Roles = SqlSugarHelper.Db.Queryable<RoleDm>().Where(r => r.MachineId == (ConfigurationManager.AppSettings["machineId"] ?? "DM1")).OrderBy(r => r.Id).ToList();
|
Roles = _sqlSugarScope1.Queryable<RoleDm>().Where(r => r.MachineId == (ConfigurationManager.AppSettings["machineId"] ?? "DM1")).OrderBy(r => r.Id).ToList();
|
||||||
RaisePropertyChanged("Roles");
|
RaisePropertyChanged("Roles");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -21,6 +21,9 @@ using System.Timers;
|
||||||
using Unity;
|
using Unity;
|
||||||
using System.Windows.Threading;
|
using System.Windows.Threading;
|
||||||
using Newtonsoft.Json.Linq;
|
using Newtonsoft.Json.Linq;
|
||||||
|
using System.Threading;
|
||||||
|
using DM_Weight.msg;
|
||||||
|
using log4net.Core;
|
||||||
|
|
||||||
namespace DM_Weight.ViewModels
|
namespace DM_Weight.ViewModels
|
||||||
{
|
{
|
||||||
|
@ -113,20 +116,20 @@ namespace DM_Weight.ViewModels
|
||||||
get { return _selectedMenu; }
|
get { return _selectedMenu; }
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
if (value != null)
|
//if (value != null)
|
||||||
{
|
//{
|
||||||
if (value.PremissionName == "退出")
|
// if (value.PremissionName == "退出")
|
||||||
{
|
// {
|
||||||
logger.Info($"用户【{Operator?.Nickname}】退出登录");
|
// logger.Info($"用户【{Operator?.Nickname}】退出登录");
|
||||||
Operator = null;
|
// Operator = null;
|
||||||
Reviewer = null;
|
// Reviewer = null;
|
||||||
_regionManager.RequestNavigate("MainRegion", "LoginWindow");
|
// _regionManager.RequestNavigate("MainRegion", "LoginWindow");
|
||||||
}
|
// }
|
||||||
else
|
// else
|
||||||
{
|
// {
|
||||||
SelectedChildMenu = value.Children[0];
|
// SelectedChildMenu = value.Children[0];
|
||||||
}
|
// }
|
||||||
}
|
//}
|
||||||
SetProperty(ref _selectedMenu, value);
|
SetProperty(ref _selectedMenu, value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -148,7 +151,7 @@ namespace DM_Weight.ViewModels
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
SelectedMenu.Children = SelectedMenu.Children;
|
//SelectedMenu.Children = SelectedMenu.Children;
|
||||||
SelectedChildMenu = SelectedMenu.Children[0];
|
SelectedChildMenu = SelectedMenu.Children[0];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -168,12 +171,16 @@ namespace DM_Weight.ViewModels
|
||||||
public bool Is16Drawer { get => _is16Drawer; set => SetProperty(ref _is16Drawer, value); }
|
public bool Is16Drawer { get => _is16Drawer; set => SetProperty(ref _is16Drawer, value); }
|
||||||
public bool KeepAlive => false;
|
public bool KeepAlive => false;
|
||||||
private PortUtil _portUtil;
|
private PortUtil _portUtil;
|
||||||
public HomeWindowViewModel(IRegionManager iRegionManager, PortUtil portUtil, IDialogService dialogService, IUnityContainer container)
|
private SqlSugarScope _sqlSugarScope1;
|
||||||
|
IEventAggregator _eventAggregator;
|
||||||
|
public HomeWindowViewModel(IRegionManager iRegionManager, PortUtil portUtil, IDialogService dialogService, IUnityContainer container, SqlSugarScope sqlSugarScope, IEventAggregator eventAggregator)
|
||||||
{
|
{
|
||||||
_portUtil = portUtil;
|
_portUtil = portUtil;
|
||||||
_regionManager = iRegionManager;
|
_regionManager = iRegionManager;
|
||||||
_dialogService = dialogService;
|
_dialogService = dialogService;
|
||||||
_container = container;
|
_container = container;
|
||||||
|
this._sqlSugarScope1 = sqlSugarScope;
|
||||||
|
this._eventAggregator = eventAggregator;
|
||||||
}
|
}
|
||||||
|
|
||||||
public DelegateCommand<string> OpenFingerDialog
|
public DelegateCommand<string> OpenFingerDialog
|
||||||
|
@ -237,7 +244,7 @@ namespace DM_Weight.ViewModels
|
||||||
|
|
||||||
public void FindDrawerCount()
|
public void FindDrawerCount()
|
||||||
{
|
{
|
||||||
int count = SqlSugarHelper.Db.Queryable<ChannelStock>().Where(cs => cs.DrawerType != 3)
|
int count = _sqlSugarScope1.Queryable<ChannelStock>().Where(cs => cs.DrawerType != 3)
|
||||||
.Where(cs => cs.MachineId.Equals(ConfigurationManager.AppSettings["machineId"] ?? "DM1")).GroupBy(cs => cs.DrawerNo).Select(cs => SqlFunc.AggregateCount(cs.DrawerNo)).Count();
|
.Where(cs => cs.MachineId.Equals(ConfigurationManager.AppSettings["machineId"] ?? "DM1")).GroupBy(cs => cs.DrawerNo).Select(cs => SqlFunc.AggregateCount(cs.DrawerNo)).Count();
|
||||||
|
|
||||||
Is16Drawer = count == 16;
|
Is16Drawer = count == 16;
|
||||||
|
@ -266,17 +273,33 @@ namespace DM_Weight.ViewModels
|
||||||
}
|
}
|
||||||
|
|
||||||
List<PremissionDm> premissions = UserList.Role.Permissions;
|
List<PremissionDm> premissions = UserList.Role.Permissions;
|
||||||
|
if (premissions.Count <= 0)
|
||||||
//SqlSugarHelper.Db.SqlQueryable<PremissionDm>(sql)
|
{
|
||||||
|
Operator = null;
|
||||||
|
Reviewer = null;
|
||||||
|
Application.Current.Dispatcher.Invoke(() =>
|
||||||
|
{
|
||||||
|
_regionManager.RequestNavigate("MainRegion", "LoginWindow");
|
||||||
|
});
|
||||||
|
AlertMsg alertMsg = new AlertMsg
|
||||||
|
{
|
||||||
|
Message = "用户还未设置权限,请联系管理员",
|
||||||
|
Type = MsgType.ERROR
|
||||||
|
};
|
||||||
|
_eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
//_sqlSugarScope1.SqlQueryable<PremissionDm>(sql)
|
||||||
//.ToTree(pd => pd.Children, pd => pd.ParentId, 0);
|
//.ToTree(pd => pd.Children, pd => pd.ParentId, 0);
|
||||||
PremissionDmList = premissions;
|
PremissionDmList = premissions;
|
||||||
SelectedMenu = premissions[0];
|
SelectedMenu = premissions[0];
|
||||||
|
SelectedChildMenu = premissions[0].Children[0];
|
||||||
FindDrawerCount();
|
FindDrawerCount();
|
||||||
|
|
||||||
int autoExit = Convert.ToInt32(ConfigurationManager.AppSettings["autoExit"] ?? "0");
|
int autoExit = Convert.ToInt32(ConfigurationManager.AppSettings["autoExit"] ?? "0");
|
||||||
if (autoExit > 0)
|
if (autoExit > 0)
|
||||||
{
|
{
|
||||||
Timer timer = new Timer();
|
System.Timers.Timer timer = new System.Timers.Timer();
|
||||||
timer.Interval = 1000;
|
timer.Interval = 1000;
|
||||||
timer.Elapsed += (sender, e) =>
|
timer.Elapsed += (sender, e) =>
|
||||||
{
|
{
|
||||||
|
@ -310,7 +333,6 @@ namespace DM_Weight.ViewModels
|
||||||
//这个方法用于拦截请求
|
//这个方法用于拦截请求
|
||||||
public void OnNavigatedFrom(NavigationContext navigationContext)
|
public void OnNavigatedFrom(NavigationContext navigationContext)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,6 +9,7 @@ using Prism.Events;
|
||||||
using Prism.Mvvm;
|
using Prism.Mvvm;
|
||||||
using Prism.Regions;
|
using Prism.Regions;
|
||||||
using Prism.Services.Dialogs;
|
using Prism.Services.Dialogs;
|
||||||
|
using SqlSugar;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
@ -33,11 +34,12 @@ namespace DM_Weight.ViewModels
|
||||||
|
|
||||||
private PortUtil _portUtil;
|
private PortUtil _portUtil;
|
||||||
IEventAggregator _eventAggregator;
|
IEventAggregator _eventAggregator;
|
||||||
|
private SqlSugarScope _sqlSugarScope1;
|
||||||
public InvoiceAddDialogViewModel(PortUtil portUtil, IEventAggregator eventAggregator)
|
public InvoiceAddDialogViewModel(PortUtil portUtil, IEventAggregator eventAggregator, SqlSugarScope sqlSugarScope)
|
||||||
{
|
{
|
||||||
_portUtil = portUtil;
|
_portUtil = portUtil;
|
||||||
_eventAggregator = eventAggregator;
|
_eventAggregator = eventAggregator;
|
||||||
|
this._sqlSugarScope1 = sqlSugarScope;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DoMyPrismEvent(DeviceMsg msg)
|
void DoMyPrismEvent(DeviceMsg msg)
|
||||||
|
@ -230,9 +232,9 @@ namespace DM_Weight.ViewModels
|
||||||
_isFinishClick = true;
|
_isFinishClick = true;
|
||||||
List<ChannelStock> record = ChannelStocks.ToList();
|
List<ChannelStock> record = ChannelStocks.ToList();
|
||||||
string InvoiceId = Invoice.InvoiceNo;
|
string InvoiceId = Invoice.InvoiceNo;
|
||||||
var f = SqlSugarHelper.Db.UseTran(() =>
|
var f = _sqlSugarScope1.UseTran(() =>
|
||||||
{
|
{
|
||||||
SqlSugarHelper.Db.Updateable(new InOutInvoice()
|
_sqlSugarScope1.Updateable(new InOutInvoice()
|
||||||
{
|
{
|
||||||
Status = 1,
|
Status = 1,
|
||||||
InvoiceNo = Invoice.InvoiceNo
|
InvoiceNo = Invoice.InvoiceNo
|
||||||
|
@ -246,7 +248,7 @@ namespace DM_Weight.ViewModels
|
||||||
_portUtil.SetNumCount(it.DrawerNo, it.ColNo, it.AddQuantity);
|
_portUtil.SetNumCount(it.DrawerNo, it.ColNo, it.AddQuantity);
|
||||||
}
|
}
|
||||||
// 更新数据 库存信息
|
// 更新数据 库存信息
|
||||||
SqlSugarHelper.Db.Updateable(new ChannelStock()
|
_sqlSugarScope1.Updateable(new ChannelStock()
|
||||||
{
|
{
|
||||||
Quantity = it.Quantity + it.AddQuantity,
|
Quantity = it.Quantity + it.AddQuantity,
|
||||||
PosNo = 1,
|
PosNo = 1,
|
||||||
|
@ -255,14 +257,14 @@ namespace DM_Weight.ViewModels
|
||||||
Id = it.Id,
|
Id = it.Id,
|
||||||
}).UpdateColumns(it => new { it.Quantity, it.ManuNo, it.EffDate, it.PosNo }).ExecuteCommand();
|
}).UpdateColumns(it => new { it.Quantity, it.ManuNo, it.EffDate, it.PosNo }).ExecuteCommand();
|
||||||
// 获取更新完库存后的药品库存
|
// 获取更新完库存后的药品库存
|
||||||
List<ChannelStock> nowChannels = SqlSugarHelper.Db.Queryable<ChannelStock>()
|
List<ChannelStock> nowChannels = _sqlSugarScope1.Queryable<ChannelStock>()
|
||||||
.Where(cs => cs.MachineId.Equals(it.MachineId))
|
.Where(cs => cs.MachineId.Equals(it.MachineId))
|
||||||
.Where(cs => cs.DrugId.Equals(it.DrugId))
|
.Where(cs => cs.DrugId.Equals(it.DrugId))
|
||||||
.Where(cs => cs.DrawerType == 1)
|
.Where(cs => cs.DrawerType == 1)
|
||||||
.ToList();
|
.ToList();
|
||||||
|
|
||||||
// 保存数据 出/入库记录
|
// 保存数据 出/入库记录
|
||||||
SqlSugarHelper.Db.Insertable(new MachineRecord()
|
_sqlSugarScope1.Insertable(new MachineRecord()
|
||||||
{
|
{
|
||||||
MachineId = it.MachineId,
|
MachineId = it.MachineId,
|
||||||
DrawerNo = it.DrawerNo,
|
DrawerNo = it.DrawerNo,
|
||||||
|
|
|
@ -8,6 +8,7 @@ using Prism.Events;
|
||||||
using Prism.Mvvm;
|
using Prism.Mvvm;
|
||||||
using Prism.Regions;
|
using Prism.Regions;
|
||||||
using Prism.Services.Dialogs;
|
using Prism.Services.Dialogs;
|
||||||
|
using SqlSugar;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Collections.ObjectModel;
|
using System.Collections.ObjectModel;
|
||||||
|
@ -76,11 +77,12 @@ namespace DM_Weight.ViewModels
|
||||||
private DelegateCommand _rowSelected;
|
private DelegateCommand _rowSelected;
|
||||||
|
|
||||||
public DelegateCommand RowSelected => _rowSelected ??= new DelegateCommand(GetChannelByInvoice);
|
public DelegateCommand RowSelected => _rowSelected ??= new DelegateCommand(GetChannelByInvoice);
|
||||||
|
private SqlSugarScope _sqlSugarScope1;
|
||||||
public InvoiceInWindowViewModel(IDialogService DialogService, IEventAggregator eventAggregator)
|
public InvoiceInWindowViewModel(IDialogService DialogService, IEventAggregator eventAggregator,SqlSugarScope sqlSugarScope)
|
||||||
{
|
{
|
||||||
_dialogService = DialogService;
|
_dialogService = DialogService;
|
||||||
_eventAggregator = eventAggregator;
|
_eventAggregator = eventAggregator;
|
||||||
|
this._sqlSugarScope1= sqlSugarScope;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static List<OrderTakeSelect> StaticOrderTakeSelects = new()
|
public static List<OrderTakeSelect> StaticOrderTakeSelects = new()
|
||||||
|
@ -196,14 +198,14 @@ namespace DM_Weight.ViewModels
|
||||||
List<ChannelStock> i = new List<ChannelStock>();
|
List<ChannelStock> i = new List<ChannelStock>();
|
||||||
if (SelectedInvoice != null)
|
if (SelectedInvoice != null)
|
||||||
{
|
{
|
||||||
var invoices = SqlSugarHelper.Db.Queryable<InOutInvoice>()
|
var invoices = _sqlSugarScope1.Queryable<InOutInvoice>()
|
||||||
.Includes<DrugInfo>(i => i.DrugInfo)
|
.Includes<DrugInfo>(i => i.DrugInfo)
|
||||||
.InnerJoin(SqlSugarHelper.Db.Queryable<ChannelStock>().Where(cs => cs.DrawerType == 1).Where(cs => cs.MachineId.Equals(ConfigurationManager.AppSettings["machineId"] ?? "DM1")).GroupBy(cs => cs.DrugId), (i, t) => i.DrugId == t.DrugId)
|
.InnerJoin(_sqlSugarScope1.Queryable<ChannelStock>().Where(cs => cs.DrawerType == 1).Where(cs => cs.MachineId.Equals(ConfigurationManager.AppSettings["machineId"] ?? "DM1")).GroupBy(cs => cs.DrugId), (i, t) => i.DrugId == t.DrugId)
|
||||||
.Where(i => i.InvoiceNo == SelectedInvoice.InvoiceNo)
|
.Where(i => i.InvoiceNo == SelectedInvoice.InvoiceNo)
|
||||||
.ToList();
|
.ToList();
|
||||||
foreach (var invoice in invoices)
|
foreach (var invoice in invoices)
|
||||||
{
|
{
|
||||||
List<ChannelStock> q = SqlSugarHelper.Db.Queryable<ChannelStock>()
|
List<ChannelStock> q = _sqlSugarScope1.Queryable<ChannelStock>()
|
||||||
.Includes<DrugInfo>(cs => cs.DrugInfo)
|
.Includes<DrugInfo>(cs => cs.DrugInfo)
|
||||||
.WhereIF(!string.IsNullOrEmpty(invoice.DrugEffDate), cs => cs.EffDate.Equals(invoice.DrugEffDate))
|
.WhereIF(!string.IsNullOrEmpty(invoice.DrugEffDate), cs => cs.EffDate.Equals(invoice.DrugEffDate))
|
||||||
.WhereIF(!string.IsNullOrEmpty(invoice.DrugManuNo), cs => cs.ManuNo.Equals(invoice.DrugManuNo))
|
.WhereIF(!string.IsNullOrEmpty(invoice.DrugManuNo), cs => cs.ManuNo.Equals(invoice.DrugManuNo))
|
||||||
|
@ -344,7 +346,7 @@ namespace DM_Weight.ViewModels
|
||||||
}
|
}
|
||||||
sb.Append(" group by i.invoice_no");
|
sb.Append(" group by i.invoice_no");
|
||||||
sb.Append(" order by i.invoice_date ");
|
sb.Append(" order by i.invoice_date ");
|
||||||
Invoices = SqlSugarHelper.Db.SqlQueryable<dynamic>(sb.ToString())
|
Invoices = _sqlSugarScope1.SqlQueryable<dynamic>(sb.ToString())
|
||||||
.AddParameters(new
|
.AddParameters(new
|
||||||
{
|
{
|
||||||
Status = 0,
|
Status = 0,
|
||||||
|
|
|
@ -6,6 +6,7 @@ using Prism.Commands;
|
||||||
using Prism.Mvvm;
|
using Prism.Mvvm;
|
||||||
using Prism.Regions;
|
using Prism.Regions;
|
||||||
using Prism.Services.Dialogs;
|
using Prism.Services.Dialogs;
|
||||||
|
using SqlSugar;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
@ -66,10 +67,11 @@ namespace DM_Weight.ViewModels
|
||||||
private DelegateCommand _rowSelected;
|
private DelegateCommand _rowSelected;
|
||||||
|
|
||||||
public DelegateCommand RowSelected => _rowSelected ??= new DelegateCommand(OpenOrderDialog);
|
public DelegateCommand RowSelected => _rowSelected ??= new DelegateCommand(OpenOrderDialog);
|
||||||
|
private SqlSugarScope _sqlSugarScope1;
|
||||||
public InvoiceOutWindowViewModel(IDialogService DialogService)
|
public InvoiceOutWindowViewModel(IDialogService DialogService,SqlSugarScope sqlSugarScope)
|
||||||
{
|
{
|
||||||
_dialogService = DialogService;
|
_dialogService = DialogService;
|
||||||
|
this._sqlSugarScope1= sqlSugarScope;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static List<OrderTakeSelect> StaticOrderTakeSelects = new()
|
public static List<OrderTakeSelect> StaticOrderTakeSelects = new()
|
||||||
|
@ -230,7 +232,7 @@ namespace DM_Weight.ViewModels
|
||||||
}
|
}
|
||||||
sb.Append(" group by i.invoice_no");
|
sb.Append(" group by i.invoice_no");
|
||||||
sb.Append(" order by i.invoice_date ");
|
sb.Append(" order by i.invoice_date ");
|
||||||
Invoices = SqlSugarHelper.Db.SqlQueryable<dynamic>(sb.ToString())
|
Invoices = _sqlSugarScope1.SqlQueryable<dynamic>(sb.ToString())
|
||||||
.AddParameters(new
|
.AddParameters(new
|
||||||
{
|
{
|
||||||
Status = 0,
|
Status = 0,
|
||||||
|
|
|
@ -38,12 +38,13 @@ namespace DM_Weight.ViewModels
|
||||||
private PortUtil _portUtil;
|
private PortUtil _portUtil;
|
||||||
IEventAggregator _eventAggregator;
|
IEventAggregator _eventAggregator;
|
||||||
IDialogService _dialogService;
|
IDialogService _dialogService;
|
||||||
|
private SqlSugarScope _sqlSugarScope1;
|
||||||
public InvoiceTakeDialogViewModel(PortUtil portUtil, IEventAggregator eventAggregator, IDialogService DialogService)
|
public InvoiceTakeDialogViewModel(PortUtil portUtil, IEventAggregator eventAggregator, IDialogService DialogService, SqlSugarScope sqlSugarScope)
|
||||||
{
|
{
|
||||||
_dialogService = DialogService;
|
_dialogService = DialogService;
|
||||||
_portUtil = portUtil;
|
_portUtil = portUtil;
|
||||||
_eventAggregator = eventAggregator;
|
_eventAggregator = eventAggregator;
|
||||||
|
this._sqlSugarScope1 = sqlSugarScope;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DoMyPrismEvent(DeviceMsg msg)
|
void DoMyPrismEvent(DeviceMsg msg)
|
||||||
|
@ -170,9 +171,9 @@ namespace DM_Weight.ViewModels
|
||||||
|
|
||||||
public void RequestData()
|
public void RequestData()
|
||||||
{
|
{
|
||||||
invoices = SqlSugarHelper.Db.Queryable<InOutInvoice>()
|
invoices = _sqlSugarScope1.Queryable<InOutInvoice>()
|
||||||
.Includes<DrugInfo>(i => i.DrugInfo)
|
.Includes<DrugInfo>(i => i.DrugInfo)
|
||||||
.InnerJoin(SqlSugarHelper.Db.Queryable<ChannelStock>().Where(cs => cs.DrawerType == 1).Where(cs => cs.MachineId.Equals(ConfigurationManager.AppSettings["machineId"] ?? "DM1")).GroupBy(cs =>cs.DrugId),(i,t) => i.DrugId == t.DrugId)
|
.InnerJoin(_sqlSugarScope1.Queryable<ChannelStock>().Where(cs => cs.DrawerType == 1).Where(cs => cs.MachineId.Equals(ConfigurationManager.AppSettings["machineId"] ?? "DM1")).GroupBy(cs =>cs.DrugId),(i,t) => i.DrugId == t.DrugId)
|
||||||
.Where(i => i.InvoiceNo == Invoice.InvoiceNo)
|
.Where(i => i.InvoiceNo == Invoice.InvoiceNo)
|
||||||
.ToList();
|
.ToList();
|
||||||
|
|
||||||
|
@ -182,7 +183,7 @@ namespace DM_Weight.ViewModels
|
||||||
{
|
{
|
||||||
InOutInvoice invoice = invoices[i];
|
InOutInvoice invoice = invoices[i];
|
||||||
|
|
||||||
List<ChannelStock> HasQChannels = SqlSugarHelper.Db.Queryable<ChannelStock>()
|
List<ChannelStock> HasQChannels = _sqlSugarScope1.Queryable<ChannelStock>()
|
||||||
.Includes<DrugInfo>(cs => cs.DrugInfo)
|
.Includes<DrugInfo>(cs => cs.DrugInfo)
|
||||||
.Where(cs => cs.Quantity > 0)
|
.Where(cs => cs.Quantity > 0)
|
||||||
.Where(cs => cs.DrawerType == 1)
|
.Where(cs => cs.DrawerType == 1)
|
||||||
|
@ -246,7 +247,7 @@ namespace DM_Weight.ViewModels
|
||||||
|
|
||||||
public DelegateCommand OpenDrawer
|
public DelegateCommand OpenDrawer
|
||||||
{
|
{
|
||||||
get => new DelegateCommand(async () =>
|
get => new DelegateCommand(() =>
|
||||||
{
|
{
|
||||||
if (Status == 0)
|
if (Status == 0)
|
||||||
{
|
{
|
||||||
|
@ -297,9 +298,9 @@ namespace DM_Weight.ViewModels
|
||||||
if (record.Count > 0)
|
if (record.Count > 0)
|
||||||
{
|
{
|
||||||
string InvoiceId = Invoice.InvoiceNo;
|
string InvoiceId = Invoice.InvoiceNo;
|
||||||
var f = SqlSugarHelper.Db.UseTran(() =>
|
var f = _sqlSugarScope1.UseTran(() =>
|
||||||
{
|
{
|
||||||
SqlSugarHelper.Db.Updateable(new InOutInvoice()
|
_sqlSugarScope1.Updateable(new InOutInvoice()
|
||||||
{
|
{
|
||||||
Status = 1,
|
Status = 1,
|
||||||
InvoiceNo = Invoice.InvoiceNo
|
InvoiceNo = Invoice.InvoiceNo
|
||||||
|
@ -309,7 +310,7 @@ namespace DM_Weight.ViewModels
|
||||||
{
|
{
|
||||||
ChannelStock it = record[i];
|
ChannelStock it = record[i];
|
||||||
// 更新数据 库存信息
|
// 更新数据 库存信息
|
||||||
SqlSugarHelper.Db.Updateable(new ChannelStock()
|
_sqlSugarScope1.Updateable(new ChannelStock()
|
||||||
{
|
{
|
||||||
Quantity = it.Quantity - it.TakeQuantity,
|
Quantity = it.Quantity - it.TakeQuantity,
|
||||||
ManuNo = it.ManuNo,
|
ManuNo = it.ManuNo,
|
||||||
|
@ -317,14 +318,14 @@ namespace DM_Weight.ViewModels
|
||||||
Id = it.Id,
|
Id = it.Id,
|
||||||
}).UpdateColumns(it => new { it.Quantity, it.ManuNo, it.EffDate }).ExecuteCommand();
|
}).UpdateColumns(it => new { it.Quantity, it.ManuNo, it.EffDate }).ExecuteCommand();
|
||||||
// 获取更新完库存后的药品库存
|
// 获取更新完库存后的药品库存
|
||||||
List<ChannelStock> nowChannels = SqlSugarHelper.Db.Queryable<ChannelStock>()
|
List<ChannelStock> nowChannels = _sqlSugarScope1.Queryable<ChannelStock>()
|
||||||
.Where(cs => cs.MachineId.Equals(it.MachineId))
|
.Where(cs => cs.MachineId.Equals(it.MachineId))
|
||||||
.Where(cs => cs.DrugId.Equals(it.DrugId))
|
.Where(cs => cs.DrugId.Equals(it.DrugId))
|
||||||
.Where(cs => cs.DrawerType == 1)
|
.Where(cs => cs.DrawerType == 1)
|
||||||
.ToList();
|
.ToList();
|
||||||
|
|
||||||
// 保存数据 出库记录
|
// 保存数据 出库记录
|
||||||
SqlSugarHelper.Db.Insertable(new MachineRecord()
|
_sqlSugarScope1.Insertable(new MachineRecord()
|
||||||
{
|
{
|
||||||
MachineId = it.MachineId,
|
MachineId = it.MachineId,
|
||||||
DrawerNo = it.DrawerNo,
|
DrawerNo = it.DrawerNo,
|
||||||
|
|
|
@ -24,6 +24,7 @@ using System.Collections.ObjectModel;
|
||||||
using Microsoft.Win32;
|
using Microsoft.Win32;
|
||||||
using System.Xml;
|
using System.Xml;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
|
using SqlSugar;
|
||||||
|
|
||||||
namespace DM_Weight.ViewModels
|
namespace DM_Weight.ViewModels
|
||||||
{
|
{
|
||||||
|
@ -80,6 +81,7 @@ namespace DM_Weight.ViewModels
|
||||||
get => _fingerMsg;
|
get => _fingerMsg;
|
||||||
set => SetProperty(ref _fingerMsg, value);
|
set => SetProperty(ref _fingerMsg, value);
|
||||||
}
|
}
|
||||||
|
private SqlSugarScope _sqlSugarScope1;
|
||||||
//public LoginWindowViewModel(IRegionManager regionManager, IEventAggregator eventAggregator, PortUtil portUtil, FingerprintUtil fingerprintUtil)
|
//public LoginWindowViewModel(IRegionManager regionManager, IEventAggregator eventAggregator, PortUtil portUtil, FingerprintUtil fingerprintUtil)
|
||||||
//{
|
//{
|
||||||
// _fingerprintUtil = fingerprintUtil;
|
// _fingerprintUtil = fingerprintUtil;
|
||||||
|
@ -87,12 +89,13 @@ namespace DM_Weight.ViewModels
|
||||||
// _regionManager = regionManager;
|
// _regionManager = regionManager;
|
||||||
// _eventAggregator = eventAggregator;
|
// _eventAggregator = eventAggregator;
|
||||||
//}
|
//}
|
||||||
public LoginWindowViewModel(IRegionManager regionManager, IEventAggregator eventAggregator, PortUtil portUtil)
|
public LoginWindowViewModel(IRegionManager regionManager, IEventAggregator eventAggregator, PortUtil portUtil,SqlSugarScope sqlSugarScope)
|
||||||
{
|
{
|
||||||
//_fingerprintUtil = fingerprintUtil;
|
//_fingerprintUtil = fingerprintUtil;
|
||||||
_portUtil = portUtil;
|
_portUtil = portUtil;
|
||||||
_regionManager = regionManager;
|
_regionManager = regionManager;
|
||||||
_eventAggregator = eventAggregator;
|
_eventAggregator = eventAggregator;
|
||||||
|
_sqlSugarScope1= sqlSugarScope;
|
||||||
}
|
}
|
||||||
private DelegateCommand? _loginCommand;
|
private DelegateCommand? _loginCommand;
|
||||||
|
|
||||||
|
@ -139,12 +142,12 @@ _exitCommand ??= new DelegateCommand(Exit);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
//UserList userList = SqlSugarHelper.Db.Queryable<UserList>()
|
//UserList userList = _sqlSugarScope1.Queryable<UserList>()
|
||||||
|
|
||||||
// .Includes<RoleDm>(u => u.Role)
|
// .Includes<RoleDm>(u => u.Role)
|
||||||
// .First(u => u.UserName == username && ConfigurationManager.AppSettings["machineId"].ToString().Equals(u.MachineId));
|
// .First(u => u.UserName == username && ConfigurationManager.AppSettings["machineId"].ToString().Equals(u.MachineId));
|
||||||
|
|
||||||
UserList userList = SqlSugarHelper.Db.Queryable<UserList>()
|
UserList userList = _sqlSugarScope1.Queryable<UserList>()
|
||||||
.Includes<RoleDm>(u => u.Role)
|
.Includes<RoleDm>(u => u.Role)
|
||||||
.InnerJoin<RoleDm>((u,r) => u.RoleId==r.Id)
|
.InnerJoin<RoleDm>((u,r) => u.RoleId==r.Id)
|
||||||
.First(u => u.UserName == username && ConfigurationManager.AppSettings["machineId"].ToString().Equals(u.MachineId));
|
.First(u => u.UserName == username && ConfigurationManager.AppSettings["machineId"].ToString().Equals(u.MachineId));
|
||||||
|
@ -314,7 +317,7 @@ _exitCommand ??= new DelegateCommand(Exit);
|
||||||
{
|
{
|
||||||
if (msg.Message.Equals("LOGIN"))
|
if (msg.Message.Equals("LOGIN"))
|
||||||
{
|
{
|
||||||
UserList userList = SqlSugarHelper.Db.Queryable<UserList>()
|
UserList userList = _sqlSugarScope1.Queryable<UserList>()
|
||||||
|
|
||||||
.Includes<RoleDm>(u => u.Role)
|
.Includes<RoleDm>(u => u.Role)
|
||||||
.First(u => u.Id == msg.Id);
|
.First(u => u.Id == msg.Id);
|
||||||
|
|
|
@ -143,10 +143,13 @@ namespace DM_Weight.ViewModels
|
||||||
get { return machineRecords; }
|
get { return machineRecords; }
|
||||||
set { SetProperty(ref machineRecords, value); }
|
set { SetProperty(ref machineRecords, value); }
|
||||||
}
|
}
|
||||||
public MachineRecordWindowViewModel(IEventAggregator eventAggregator)
|
public List<string>? OldInvoiceIdLst = new List<string>();
|
||||||
|
private SqlSugarScope _sqlSugarScope1;
|
||||||
|
public MachineRecordWindowViewModel(IEventAggregator eventAggregator, SqlSugarScope sqlSugarScope)
|
||||||
{
|
{
|
||||||
vm = this;
|
vm = this;
|
||||||
_eventAggregator = eventAggregator;
|
_eventAggregator = eventAggregator;
|
||||||
|
this._sqlSugarScope1 = sqlSugarScope;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool KeepAlive => false;
|
public bool KeepAlive => false;
|
||||||
|
@ -172,7 +175,7 @@ namespace DM_Weight.ViewModels
|
||||||
{
|
{
|
||||||
get => new DelegateCommand(() =>
|
get => new DelegateCommand(() =>
|
||||||
{
|
{
|
||||||
GridReportUtil.PrintReportAccountBook(StartDate, EndDate, DrugInfo==null?"":DrugInfo.DrugId);
|
GridReportUtil.PrintReportAccountBook(StartDate, EndDate, DrugInfo == null ? "" : DrugInfo.DrugId);
|
||||||
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -187,16 +190,18 @@ namespace DM_Weight.ViewModels
|
||||||
}
|
}
|
||||||
private void UpdatPZHSave()
|
private void UpdatPZHSave()
|
||||||
{
|
{
|
||||||
var f = SqlSugarHelper.Db.UseTran(() =>
|
var f = _sqlSugarScope1.UseTran(() =>
|
||||||
{
|
{
|
||||||
for (int i = 0; i < MachineRecords.Count; i++)
|
for (int i = 0; i < MachineRecords.Count; i++)
|
||||||
{
|
{
|
||||||
|
string oldInvoiceId = OldInvoiceIdLst[i];
|
||||||
|
|
||||||
// 更新数据 库存信息
|
// 更新数据 库存信息
|
||||||
SqlSugarHelper.Db.Updateable(new MachineRecord()
|
_sqlSugarScope1.Updateable(new MachineRecord()
|
||||||
{
|
{
|
||||||
Id = MachineRecords[i].Id,
|
Id = MachineRecords[i].Id,
|
||||||
InvoiceId = MachineRecords[i].InvoiceId
|
InvoiceId = MachineRecords[i].InvoiceId
|
||||||
}).UpdateColumns(it => new { it.InvoiceId }).WhereColumns(it => new { it.Id }).ExecuteCommand();
|
}).UpdateColumns(it => new { it.InvoiceId }).Where(it => it.InvoiceId == oldInvoiceId).ExecuteCommand();
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
|
@ -207,7 +212,8 @@ namespace DM_Weight.ViewModels
|
||||||
Message = "保存成功",
|
Message = "保存成功",
|
||||||
Type = MsgType.SUCCESS
|
Type = MsgType.SUCCESS
|
||||||
};
|
};
|
||||||
_eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
|
_eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
|
||||||
|
RequestData();
|
||||||
}
|
}
|
||||||
if (!f.IsSuccess)
|
if (!f.IsSuccess)
|
||||||
{
|
{
|
||||||
|
@ -248,7 +254,7 @@ namespace DM_Weight.ViewModels
|
||||||
{
|
{
|
||||||
int totalCount = 0;
|
int totalCount = 0;
|
||||||
string machineId = ConfigurationManager.AppSettings["machineId"] ?? "DM1";
|
string machineId = ConfigurationManager.AppSettings["machineId"] ?? "DM1";
|
||||||
MachineRecords = SqlSugarHelper.Db.Queryable<MachineRecord>()
|
MachineRecords = _sqlSugarScope1.Queryable<MachineRecord>()
|
||||||
.Includes<DrugInfo>(mr => mr.DrugInfo)
|
.Includes<DrugInfo>(mr => mr.DrugInfo)
|
||||||
.Includes<UserList>(mr => mr.User)
|
.Includes<UserList>(mr => mr.User)
|
||||||
.Where(mr => mr.MachineId == machineId)
|
.Where(mr => mr.MachineId == machineId)
|
||||||
|
@ -261,6 +267,7 @@ namespace DM_Weight.ViewModels
|
||||||
.ToPageList(PageNum, PageSize, ref totalCount);
|
.ToPageList(PageNum, PageSize, ref totalCount);
|
||||||
//.ToList();
|
//.ToList();
|
||||||
TotalCount = totalCount;
|
TotalCount = totalCount;
|
||||||
|
OldInvoiceIdLst = MachineRecords.Select(mr => mr.InvoiceId).ToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
//每次导航的时候,该实列用不用重新创建,true是不重新创建,false是重新创建
|
//每次导航的时候,该实列用不用重新创建,true是不重新创建,false是重新创建
|
||||||
|
@ -278,7 +285,7 @@ namespace DM_Weight.ViewModels
|
||||||
private void GetAllDrugInfos()
|
private void GetAllDrugInfos()
|
||||||
{
|
{
|
||||||
string str = "SELECT d.drug_id,d.py_code,d.drug_barcode,d.drug_name,d.drug_brand_name,d.drug_spec,d.dosage,d.pack_unit,d.manufactory,d.max_stock,CONCAT(drug_name,' ',drug_spec)as drug_name_spec FROM `drug_info` d";
|
string str = "SELECT d.drug_id,d.py_code,d.drug_barcode,d.drug_name,d.drug_brand_name,d.drug_spec,d.dosage,d.pack_unit,d.manufactory,d.max_stock,CONCAT(drug_name,' ',drug_spec)as drug_name_spec FROM `drug_info` d";
|
||||||
DrugInfos = SqlSugarHelper.Db.SqlQueryable<DrugInfo>(str).OrderBy(di => di.DrugName).OrderBy(di => di.DrugId).ToList();
|
DrugInfos = _sqlSugarScope1.SqlQueryable<DrugInfo>(str).OrderBy(di => di.DrugName).OrderBy(di => di.DrugId).ToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void UpdateComboBoxItems(string text)
|
public void UpdateComboBoxItems(string text)
|
||||||
|
@ -287,7 +294,7 @@ namespace DM_Weight.ViewModels
|
||||||
d.manufactory,d.max_stock,CONCAT(drug_name,' ',drug_spec)as drug_name_spec FROM `drug_info` d";
|
d.manufactory,d.max_stock,CONCAT(drug_name,' ',drug_spec)as drug_name_spec FROM `drug_info` d";
|
||||||
if (string.IsNullOrEmpty(text))
|
if (string.IsNullOrEmpty(text))
|
||||||
{
|
{
|
||||||
DrugInfos = SqlSugarHelper.Db.SqlQueryable<DrugInfo>(str).OrderBy(di => di.DrugName).OrderBy(di => di.DrugId).ToList();
|
DrugInfos = _sqlSugarScope1.SqlQueryable<DrugInfo>(str).OrderBy(di => di.DrugName).OrderBy(di => di.DrugId).ToList();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (DrugInfos != null)
|
if (DrugInfos != null)
|
||||||
|
@ -295,7 +302,7 @@ namespace DM_Weight.ViewModels
|
||||||
DrugInfos.Clear();
|
DrugInfos.Clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
DrugInfos = SqlSugarHelper.Db.SqlQueryable<DrugInfo>(str).Where(di => di.DrugName.Contains(text) || di.PyCode.Contains(text) || di.DrugId.Contains(text)).OrderBy(di => di.DrugName).OrderBy(di => di.DrugId).ToList();
|
DrugInfos = _sqlSugarScope1.SqlQueryable<DrugInfo>(str).Where(di => di.DrugName.Contains(text) || di.PyCode.Contains(text) || di.DrugId.Contains(text)).OrderBy(di => di.DrugName).OrderBy(di => di.DrugId).ToList();
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,6 +17,7 @@ using DM_Weight.Views;
|
||||||
using Unity;
|
using Unity;
|
||||||
using DM_Weight.Models;
|
using DM_Weight.Models;
|
||||||
using System.Runtime.CompilerServices;
|
using System.Runtime.CompilerServices;
|
||||||
|
using SqlSugar;
|
||||||
|
|
||||||
namespace DM_Weight.ViewModels
|
namespace DM_Weight.ViewModels
|
||||||
{
|
{
|
||||||
|
@ -66,7 +67,8 @@ namespace DM_Weight.ViewModels
|
||||||
IUnityContainer _container;
|
IUnityContainer _container;
|
||||||
PortUtil _portUtil;
|
PortUtil _portUtil;
|
||||||
private List<ChannelStock> _channelStocks = new List<ChannelStock>();
|
private List<ChannelStock> _channelStocks = new List<ChannelStock>();
|
||||||
public MainWindowViewModel(IRegionManager regionManager, IUnityContainer container, IEventAggregator eventAggregator, FingerprintUtil fingerprintUtil, ScreenUtil screenUtil, PortUtil portUtil)
|
private SqlSugarScope _sqlSugarScope1;
|
||||||
|
public MainWindowViewModel(IRegionManager regionManager, IUnityContainer container, IEventAggregator eventAggregator, FingerprintUtil fingerprintUtil, ScreenUtil screenUtil, PortUtil portUtil,SqlSugarScope sqlSugarScope)
|
||||||
{
|
{
|
||||||
//_portUtil = portUtil;
|
//_portUtil = portUtil;
|
||||||
this.eventAggregator = eventAggregator;
|
this.eventAggregator = eventAggregator;
|
||||||
|
@ -76,8 +78,7 @@ namespace DM_Weight.ViewModels
|
||||||
_regionManager = regionManager;
|
_regionManager = regionManager;
|
||||||
_container = container;
|
_container = container;
|
||||||
_portUtil = portUtil;
|
_portUtil = portUtil;
|
||||||
|
this._sqlSugarScope1=sqlSugarScope;
|
||||||
Task.Factory.StartNew(()=>BindStock()); ;
|
|
||||||
|
|
||||||
System.Windows.Application.Current.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Send, new Action(() =>
|
System.Windows.Application.Current.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Send, new Action(() =>
|
||||||
{
|
{
|
||||||
|
@ -86,6 +87,8 @@ namespace DM_Weight.ViewModels
|
||||||
_regionManager.RequestNavigate("MainRegion", "LoginWindow");
|
_regionManager.RequestNavigate("MainRegion", "LoginWindow");
|
||||||
|
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
Task.Factory.StartNew(()=>BindStock());
|
||||||
}
|
}
|
||||||
|
|
||||||
void doMyPrismEvent2(AlertMsg msg)
|
void doMyPrismEvent2(AlertMsg msg)
|
||||||
|
@ -107,7 +110,7 @@ namespace DM_Weight.ViewModels
|
||||||
//写标签数量
|
//写标签数量
|
||||||
async Task BindStock()
|
async Task BindStock()
|
||||||
{
|
{
|
||||||
List<ChannelStock> singleChannels = SqlSugarHelper.Db.Queryable<ChannelStock>().Where(cs => cs.BoardType == 5).Where(cs => cs.DrugId !=null).ToList();
|
List<ChannelStock> singleChannels = _sqlSugarScope1.Queryable<ChannelStock>().Where(cs => cs.BoardType == 5).Where(cs => cs.DrugId !=null).ToList();
|
||||||
|
|
||||||
for (int i = 0; i < singleChannels.Count; i++)
|
for (int i = 0; i < singleChannels.Count; i++)
|
||||||
{
|
{
|
||||||
|
|
|
@ -38,11 +38,13 @@ namespace DM_Weight.ViewModels
|
||||||
private PortUtil _portUtil;
|
private PortUtil _portUtil;
|
||||||
IEventAggregator _eventAggregator;
|
IEventAggregator _eventAggregator;
|
||||||
IDialogService _dialogService;
|
IDialogService _dialogService;
|
||||||
public OrderReturnDialogViewModel(PortUtil portUtil, IEventAggregator eventAggregator, IDialogService DialogService)
|
private SqlSugarScope _sqlSugarScope1;
|
||||||
|
public OrderReturnDialogViewModel(PortUtil portUtil, IEventAggregator eventAggregator, IDialogService DialogService, SqlSugarScope sqlSugarScope)
|
||||||
{
|
{
|
||||||
_dialogService = DialogService;
|
_dialogService = DialogService;
|
||||||
_portUtil = portUtil;
|
_portUtil = portUtil;
|
||||||
_eventAggregator = eventAggregator;
|
_eventAggregator = eventAggregator;
|
||||||
|
this._sqlSugarScope1 = sqlSugarScope;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DoMyPrismEvent(DeviceMsg msg)
|
void DoMyPrismEvent(DeviceMsg msg)
|
||||||
|
@ -170,9 +172,9 @@ namespace DM_Weight.ViewModels
|
||||||
|
|
||||||
public void RequestData()
|
public void RequestData()
|
||||||
{
|
{
|
||||||
orderDetails = SqlSugarHelper.Db.Queryable<OrderDetail>()
|
orderDetails = _sqlSugarScope1.Queryable<OrderDetail>()
|
||||||
.Includes<DrugInfo>(od => od.DrugInfo)
|
.Includes<DrugInfo>(od => od.DrugInfo)
|
||||||
.InnerJoin(SqlSugarHelper.Db.Queryable<ChannelStock>().Where(cs => cs.DrawerType == 1).Where(cs => cs.MachineId.Equals(ConfigurationManager.AppSettings["machineId"] ?? "DM1")).GroupBy(cs => cs.DrugId), (od, t) => od.DrugId == t.DrugId)
|
.InnerJoin(_sqlSugarScope1.Queryable<ChannelStock>().Where(cs => cs.DrawerType == 1).Where(cs => cs.MachineId.Equals(ConfigurationManager.AppSettings["machineId"] ?? "DM1")).GroupBy(cs => cs.DrugId), (od, t) => od.DrugId == t.DrugId)
|
||||||
.Where(od => od.OrderNo == OrderInfo.OrderNo)
|
.Where(od => od.OrderNo == OrderInfo.OrderNo)
|
||||||
.ToList();
|
.ToList();
|
||||||
|
|
||||||
|
@ -182,7 +184,7 @@ namespace DM_Weight.ViewModels
|
||||||
{
|
{
|
||||||
OrderDetail orderDetail = orderDetails[i];
|
OrderDetail orderDetail = orderDetails[i];
|
||||||
|
|
||||||
List<ChannelStock> HasQChannels = SqlSugarHelper.Db.Queryable<ChannelStock>()
|
List<ChannelStock> HasQChannels = _sqlSugarScope1.Queryable<ChannelStock>()
|
||||||
.Includes<DrugInfo>(cs => cs.DrugInfo)
|
.Includes<DrugInfo>(cs => cs.DrugInfo)
|
||||||
.Where(cs => cs.DrawerType == 1)
|
.Where(cs => cs.DrawerType == 1)
|
||||||
.Where(cs => cs.MachineId.Equals(ConfigurationManager.AppSettings["machineId"] ?? "DM1"))
|
.Where(cs => cs.MachineId.Equals(ConfigurationManager.AppSettings["machineId"] ?? "DM1"))
|
||||||
|
@ -241,7 +243,7 @@ namespace DM_Weight.ViewModels
|
||||||
|
|
||||||
public DelegateCommand OpenDrawer
|
public DelegateCommand OpenDrawer
|
||||||
{
|
{
|
||||||
get => new DelegateCommand(async () =>
|
get => new DelegateCommand(() =>
|
||||||
{
|
{
|
||||||
if (Status == 0)
|
if (Status == 0)
|
||||||
{
|
{
|
||||||
|
@ -293,9 +295,9 @@ namespace DM_Weight.ViewModels
|
||||||
//if (record.Count > 0)
|
//if (record.Count > 0)
|
||||||
//{
|
//{
|
||||||
string InvoiceId = OrderInfo.OrderNo;
|
string InvoiceId = OrderInfo.OrderNo;
|
||||||
var f = SqlSugarHelper.Db.UseTran(() =>
|
var f = _sqlSugarScope1.UseTran(() =>
|
||||||
{
|
{
|
||||||
SqlSugarHelper.Db.Updateable(new OrderInfo()
|
_sqlSugarScope1.Updateable(new OrderInfo()
|
||||||
{
|
{
|
||||||
DmStatus = 2,
|
DmStatus = 2,
|
||||||
OrderNo = OrderInfo.OrderNo
|
OrderNo = OrderInfo.OrderNo
|
||||||
|
@ -304,7 +306,7 @@ namespace DM_Weight.ViewModels
|
||||||
{
|
{
|
||||||
ChannelStock it = record[i];
|
ChannelStock it = record[i];
|
||||||
// 更新数据 库存信息
|
// 更新数据 库存信息
|
||||||
SqlSugarHelper.Db.Updateable(new ChannelStock()
|
_sqlSugarScope1.Updateable(new ChannelStock()
|
||||||
{
|
{
|
||||||
//Quantity = it.Quantity + it.TakeQuantity,
|
//Quantity = it.Quantity + it.TakeQuantity,
|
||||||
Quantity = it.Quantity + it.ReturnQuantity,
|
Quantity = it.Quantity + it.ReturnQuantity,
|
||||||
|
@ -313,14 +315,14 @@ namespace DM_Weight.ViewModels
|
||||||
Id = it.Id,
|
Id = it.Id,
|
||||||
}).UpdateColumns(it => new { it.Quantity, it.ManuNo, it.EffDate }).ExecuteCommand();
|
}).UpdateColumns(it => new { it.Quantity, it.ManuNo, it.EffDate }).ExecuteCommand();
|
||||||
// 获取更新完库存后的药品库存
|
// 获取更新完库存后的药品库存
|
||||||
List<ChannelStock> nowChannels = SqlSugarHelper.Db.Queryable<ChannelStock>()
|
List<ChannelStock> nowChannels = _sqlSugarScope1.Queryable<ChannelStock>()
|
||||||
.Where(cs => cs.MachineId.Equals(it.MachineId))
|
.Where(cs => cs.MachineId.Equals(it.MachineId))
|
||||||
.Where(cs => cs.DrugId.Equals(it.DrugId))
|
.Where(cs => cs.DrugId.Equals(it.DrugId))
|
||||||
.Where(cs => cs.DrawerType == 1)
|
.Where(cs => cs.DrawerType == 1)
|
||||||
.ToList();
|
.ToList();
|
||||||
|
|
||||||
// 保存数据 还药记录
|
// 保存数据 还药记录
|
||||||
SqlSugarHelper.Db.Insertable(new MachineRecord()
|
_sqlSugarScope1.Insertable(new MachineRecord()
|
||||||
{
|
{
|
||||||
MachineId = it.MachineId,
|
MachineId = it.MachineId,
|
||||||
DrawerNo = it.DrawerNo,
|
DrawerNo = it.DrawerNo,
|
||||||
|
|
|
@ -37,12 +37,14 @@ namespace DM_Weight.ViewModels
|
||||||
|
|
||||||
private PortUtil _portUtil;
|
private PortUtil _portUtil;
|
||||||
IEventAggregator _eventAggregator;
|
IEventAggregator _eventAggregator;
|
||||||
IDialogService _dialogService;
|
IDialogService _dialogService;
|
||||||
public OrderTakeDialogViewModel(PortUtil portUtil, IEventAggregator eventAggregator, IDialogService DialogService)
|
private SqlSugarScope _sqlSugarScope1;
|
||||||
|
public OrderTakeDialogViewModel(PortUtil portUtil, IEventAggregator eventAggregator, IDialogService DialogService, SqlSugarScope sqlSugarScope)
|
||||||
{
|
{
|
||||||
_dialogService = DialogService;
|
_dialogService = DialogService;
|
||||||
_portUtil = portUtil;
|
_portUtil = portUtil;
|
||||||
_eventAggregator = eventAggregator;
|
_eventAggregator = eventAggregator;
|
||||||
|
this._sqlSugarScope1 = sqlSugarScope;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DoMyPrismEvent(DeviceMsg msg)
|
void DoMyPrismEvent(DeviceMsg msg)
|
||||||
|
@ -167,11 +169,11 @@ namespace DM_Weight.ViewModels
|
||||||
RequestData();
|
RequestData();
|
||||||
}
|
}
|
||||||
|
|
||||||
public async void RequestData()
|
public void RequestData()
|
||||||
{
|
{
|
||||||
orderDetails = SqlSugarHelper.Db.Queryable<OrderDetail>()
|
orderDetails = _sqlSugarScope1.Queryable<OrderDetail>()
|
||||||
.Includes<DrugInfo>(od => od.DrugInfo)
|
.Includes<DrugInfo>(od => od.DrugInfo)
|
||||||
.InnerJoin(SqlSugarHelper.Db.Queryable<ChannelStock>().Where(cs => cs.DrawerType == 1).Where(cs => cs.MachineId.Equals(ConfigurationManager.AppSettings["machineId"] ?? "DM1")).GroupBy(cs => cs.DrugId), (od, t) => od.DrugId == t.DrugId)
|
.InnerJoin(_sqlSugarScope1.Queryable<ChannelStock>().Where(cs => cs.DrawerType == 1).Where(cs => cs.MachineId.Equals(ConfigurationManager.AppSettings["machineId"] ?? "DM1")).GroupBy(cs => cs.DrugId), (od, t) => od.DrugId == t.DrugId)
|
||||||
.Where(od => od.OrderNo == OrderInfo.OrderNo)
|
.Where(od => od.OrderNo == OrderInfo.OrderNo)
|
||||||
.ToList();
|
.ToList();
|
||||||
|
|
||||||
|
@ -181,7 +183,7 @@ namespace DM_Weight.ViewModels
|
||||||
{
|
{
|
||||||
OrderDetail orderDetail = orderDetails[i];
|
OrderDetail orderDetail = orderDetails[i];
|
||||||
|
|
||||||
List<ChannelStock> HasQChannels = SqlSugarHelper.Db.Queryable<ChannelStock>()
|
List<ChannelStock> HasQChannels = _sqlSugarScope1.Queryable<ChannelStock>()
|
||||||
.Includes<DrugInfo>(cs => cs.DrugInfo)
|
.Includes<DrugInfo>(cs => cs.DrugInfo)
|
||||||
.Where(cs => cs.Quantity > 0)
|
.Where(cs => cs.Quantity > 0)
|
||||||
.Where(cs => cs.DrawerType == 1)
|
.Where(cs => cs.DrawerType == 1)
|
||||||
|
@ -308,15 +310,15 @@ namespace DM_Weight.ViewModels
|
||||||
if (record.Count > 0)
|
if (record.Count > 0)
|
||||||
{
|
{
|
||||||
string InvoiceId = OrderInfo.OrderNo;
|
string InvoiceId = OrderInfo.OrderNo;
|
||||||
var f = SqlSugarHelper.Db.UseTran(() =>
|
var f = _sqlSugarScope1.UseTran(() =>
|
||||||
{
|
{
|
||||||
SqlSugarHelper.Db.Updateable(new OrderInfo()
|
_sqlSugarScope1.Updateable(new OrderInfo()
|
||||||
{
|
{
|
||||||
DmStatus = 1,
|
DmStatus = 1,
|
||||||
OrderNo = OrderInfo.OrderNo
|
OrderNo = OrderInfo.OrderNo
|
||||||
}).UpdateColumns(it => new { it.DmStatus }).WhereColumns(it => new { it.OrderNo }).ExecuteCommand();
|
}).UpdateColumns(it => new { it.DmStatus }).WhereColumns(it => new { it.OrderNo }).ExecuteCommand();
|
||||||
|
|
||||||
SqlSugarHelper.Db.Insertable(new OrderFinish()
|
_sqlSugarScope1.Insertable(new OrderFinish()
|
||||||
{
|
{
|
||||||
OrderNo = OrderInfo.OrderNo,
|
OrderNo = OrderInfo.OrderNo,
|
||||||
PatientId = OrderInfo.PatientId,
|
PatientId = OrderInfo.PatientId,
|
||||||
|
@ -329,7 +331,7 @@ namespace DM_Weight.ViewModels
|
||||||
{
|
{
|
||||||
ChannelStock it = record[i];
|
ChannelStock it = record[i];
|
||||||
// 更新数据 库存信息
|
// 更新数据 库存信息
|
||||||
SqlSugarHelper.Db.Updateable(new ChannelStock()
|
_sqlSugarScope1.Updateable(new ChannelStock()
|
||||||
{
|
{
|
||||||
Quantity = it.Quantity - it.TakeQuantity,
|
Quantity = it.Quantity - it.TakeQuantity,
|
||||||
ManuNo = it.ManuNo,
|
ManuNo = it.ManuNo,
|
||||||
|
@ -337,14 +339,14 @@ namespace DM_Weight.ViewModels
|
||||||
Id = it.Id,
|
Id = it.Id,
|
||||||
}).UpdateColumns(it => new { it.Quantity, it.ManuNo, it.EffDate }).ExecuteCommand();
|
}).UpdateColumns(it => new { it.Quantity, it.ManuNo, it.EffDate }).ExecuteCommand();
|
||||||
// 获取更新完库存后的药品库存
|
// 获取更新完库存后的药品库存
|
||||||
List<ChannelStock> nowChannels = SqlSugarHelper.Db.Queryable<ChannelStock>()
|
List<ChannelStock> nowChannels = _sqlSugarScope1.Queryable<ChannelStock>()
|
||||||
.Where(cs => cs.MachineId.Equals(it.MachineId))
|
.Where(cs => cs.MachineId.Equals(it.MachineId))
|
||||||
.Where(cs => cs.DrugId.Equals(it.DrugId))
|
.Where(cs => cs.DrugId.Equals(it.DrugId))
|
||||||
.Where(cs => cs.DrawerType == 1)
|
.Where(cs => cs.DrawerType == 1)
|
||||||
.ToList();
|
.ToList();
|
||||||
|
|
||||||
// 保存数据 出库记录
|
// 保存数据 出库记录
|
||||||
SqlSugarHelper.Db.Insertable(new MachineRecord()
|
_sqlSugarScope1.Insertable(new MachineRecord()
|
||||||
{
|
{
|
||||||
MachineId = it.MachineId,
|
MachineId = it.MachineId,
|
||||||
DrawerNo = it.DrawerNo,
|
DrawerNo = it.DrawerNo,
|
||||||
|
|
|
@ -15,6 +15,7 @@ using DM_Weight.select;
|
||||||
using DM_Weight.util;
|
using DM_Weight.util;
|
||||||
using DM_Weight.msg;
|
using DM_Weight.msg;
|
||||||
using Prism.Events;
|
using Prism.Events;
|
||||||
|
using SqlSugar;
|
||||||
|
|
||||||
namespace DM_Weight.ViewModels
|
namespace DM_Weight.ViewModels
|
||||||
{
|
{
|
||||||
|
@ -69,11 +70,12 @@ namespace DM_Weight.ViewModels
|
||||||
private DelegateCommand _rowSelected;
|
private DelegateCommand _rowSelected;
|
||||||
|
|
||||||
public DelegateCommand RowSelected => _rowSelected ??= new DelegateCommand(OpenOrderDialog);
|
public DelegateCommand RowSelected => _rowSelected ??= new DelegateCommand(OpenOrderDialog);
|
||||||
|
private SqlSugarScope _sqlSugarScope1;
|
||||||
public OrderTakeDrugWindowViewModel(IDialogService DialogService, IEventAggregator eventAggregator)
|
public OrderTakeDrugWindowViewModel(IDialogService DialogService, IEventAggregator eventAggregator,SqlSugarScope sqlSugarScope)
|
||||||
{
|
{
|
||||||
_dialogService = DialogService;
|
_dialogService = DialogService;
|
||||||
_eventAggregator = eventAggregator;
|
_eventAggregator = eventAggregator;
|
||||||
|
this._sqlSugarScope1= sqlSugarScope;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static List<OrderTakeSelect> StaticOrderTakeSelects = new()
|
public static List<OrderTakeSelect> StaticOrderTakeSelects = new()
|
||||||
|
@ -213,9 +215,9 @@ namespace DM_Weight.ViewModels
|
||||||
{
|
{
|
||||||
OrderInfos.Clear();
|
OrderInfos.Clear();
|
||||||
int totalCount = 0;
|
int totalCount = 0;
|
||||||
List<OrderInfo> queryData = SqlSugarHelper.Db.Queryable<OrderInfo>()
|
List<OrderInfo> queryData = _sqlSugarScope1.Queryable<OrderInfo>()
|
||||||
.InnerJoin<OrderDetail>((oi, od) => oi.OrderNo == od.OrderNo)
|
.InnerJoin<OrderDetail>((oi, od) => oi.OrderNo == od.OrderNo)
|
||||||
.InnerJoin(SqlSugarHelper.Db.Queryable<ChannelStock>().Where(cs => cs.DrawerType == 1).Where(cs => cs.MachineId.Equals(ConfigurationManager.AppSettings["machineId"] ?? "DM1")).GroupBy(cs => cs.DrugId), (oi, od, t) => od.DrugId == t.DrugId)
|
.InnerJoin(_sqlSugarScope1.Queryable<ChannelStock>().Where(cs => cs.DrawerType == 1).Where(cs => cs.MachineId.Equals(ConfigurationManager.AppSettings["machineId"] ?? "DM1")).GroupBy(cs => cs.DrugId), (oi, od, t) => od.DrugId == t.DrugId)
|
||||||
.WhereIF(OrderDate != null, oi => oi.RecvDate.ToString("yyyy-MM-dd") == OrderDate)
|
.WhereIF(OrderDate != null, oi => oi.RecvDate.ToString("yyyy-MM-dd") == OrderDate)
|
||||||
.WhereIF(!String.IsNullOrEmpty(SearchValue) && SelectedItem.Code.Equals("OrderNo"), oi => oi.OrderNo == SearchValue)
|
.WhereIF(!String.IsNullOrEmpty(SearchValue) && SelectedItem.Code.Equals("OrderNo"), oi => oi.OrderNo == SearchValue)
|
||||||
.WhereIF(!String.IsNullOrEmpty(SearchValue) && SelectedItem.Code.Equals("PatientId"), oi => oi.PatientId == SearchValue)
|
.WhereIF(!String.IsNullOrEmpty(SearchValue) && SelectedItem.Code.Equals("PatientId"), oi => oi.PatientId == SearchValue)
|
||||||
|
|
|
@ -16,6 +16,7 @@ using DM_Weight.Models;
|
||||||
using DM_Weight.msg;
|
using DM_Weight.msg;
|
||||||
using DM_Weight.Port;
|
using DM_Weight.Port;
|
||||||
using DM_Weight.util;
|
using DM_Weight.util;
|
||||||
|
using SqlSugar;
|
||||||
|
|
||||||
namespace DM_Weight.ViewModels
|
namespace DM_Weight.ViewModels
|
||||||
{
|
{
|
||||||
|
@ -41,11 +42,12 @@ namespace DM_Weight.ViewModels
|
||||||
get { return _machineRecord; }
|
get { return _machineRecord; }
|
||||||
set { SetProperty(ref _machineRecord, value); }
|
set { SetProperty(ref _machineRecord, value); }
|
||||||
}
|
}
|
||||||
|
private SqlSugarScope _sqlSugarScope1;
|
||||||
public ReturnDrugDialogViewModel(PortUtil portUtil, IEventAggregator eventAggregator)
|
public ReturnDrugDialogViewModel(PortUtil portUtil, IEventAggregator eventAggregator, SqlSugarScope sqlSugarScope)
|
||||||
{
|
{
|
||||||
_portUtil = portUtil;
|
_portUtil = portUtil;
|
||||||
_eventAggregator = eventAggregator;
|
_eventAggregator = eventAggregator;
|
||||||
|
this._sqlSugarScope1 = sqlSugarScope;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DoMyPrismEvent(DeviceMsg msg)
|
void DoMyPrismEvent(DeviceMsg msg)
|
||||||
|
@ -173,7 +175,7 @@ namespace DM_Weight.ViewModels
|
||||||
|
|
||||||
public void RequestData()
|
public void RequestData()
|
||||||
{
|
{
|
||||||
List<ChannelStock> queryData = SqlSugarHelper.Db.Queryable<ChannelStock>()
|
List<ChannelStock> queryData = _sqlSugarScope1.Queryable<ChannelStock>()
|
||||||
.Where(cs => cs.DrugId == MachineRecord.DrugId)
|
.Where(cs => cs.DrugId == MachineRecord.DrugId)
|
||||||
.Where(cs => cs.MachineId.Equals(ConfigurationManager.AppSettings["machineId"] ?? "DM1"))
|
.Where(cs => cs.MachineId.Equals(ConfigurationManager.AppSettings["machineId"] ?? "DM1"))
|
||||||
.WhereIF(MachineRecord.ManuNo != null,cs => cs.ManuNo == MachineRecord.ManuNo)
|
.WhereIF(MachineRecord.ManuNo != null,cs => cs.ManuNo == MachineRecord.ManuNo)
|
||||||
|
@ -227,24 +229,24 @@ namespace DM_Weight.ViewModels
|
||||||
{
|
{
|
||||||
IsFinishClick = true;
|
IsFinishClick = true;
|
||||||
string InvoiceId = "RETURN_" + CurrentTimeMillis();
|
string InvoiceId = "RETURN_" + CurrentTimeMillis();
|
||||||
var f = SqlSugarHelper.Db.UseTran(() =>
|
var f = _sqlSugarScope1.UseTran(() =>
|
||||||
{
|
{
|
||||||
|
|
||||||
// 更新数据 库存信息
|
// 更新数据 库存信息
|
||||||
SqlSugarHelper.Db.Updateable(new ChannelStock()
|
_sqlSugarScope1.Updateable(new ChannelStock()
|
||||||
{
|
{
|
||||||
Quantity = ChannelStock.Quantity + ReturnQuantity,
|
Quantity = ChannelStock.Quantity + ReturnQuantity,
|
||||||
Id = ChannelStock.Id,
|
Id = ChannelStock.Id,
|
||||||
}).UpdateColumns(it => new { it.Quantity }).ExecuteCommand();
|
}).UpdateColumns(it => new { it.Quantity }).ExecuteCommand();
|
||||||
|
|
||||||
// 获取更新完库存后的药品库存
|
// 获取更新完库存后的药品库存
|
||||||
List<ChannelStock> nowChannels = SqlSugarHelper.Db.Queryable<ChannelStock>()
|
List<ChannelStock> nowChannels = _sqlSugarScope1.Queryable<ChannelStock>()
|
||||||
.Where(cs => cs.MachineId.Equals(ChannelStock.MachineId))
|
.Where(cs => cs.MachineId.Equals(ChannelStock.MachineId))
|
||||||
.Where(cs => cs.DrugId.Equals(ChannelStock.DrugId))
|
.Where(cs => cs.DrugId.Equals(ChannelStock.DrugId))
|
||||||
.Where(cs => cs.DrawerType == 1)
|
.Where(cs => cs.DrawerType == 1)
|
||||||
.ToList();
|
.ToList();
|
||||||
// 更新数据 取药记录 设置还药数量、状态
|
// 更新数据 取药记录 设置还药数量、状态
|
||||||
SqlSugarHelper.Db.Updateable(new MachineRecord()
|
_sqlSugarScope1.Updateable(new MachineRecord()
|
||||||
{
|
{
|
||||||
ReturnQuantity1 = MachineRecord.ReturnQuantity1 + ReturnQuantity,
|
ReturnQuantity1 = MachineRecord.ReturnQuantity1 + ReturnQuantity,
|
||||||
Id = MachineRecord.Id,
|
Id = MachineRecord.Id,
|
||||||
|
@ -252,7 +254,7 @@ namespace DM_Weight.ViewModels
|
||||||
}).UpdateColumns(it => new { it.ReturnQuantity1, it.Status }).ExecuteCommand();
|
}).UpdateColumns(it => new { it.ReturnQuantity1, it.Status }).ExecuteCommand();
|
||||||
|
|
||||||
// 保存数据 还药记录
|
// 保存数据 还药记录
|
||||||
SqlSugarHelper.Db.Insertable(new MachineRecord()
|
_sqlSugarScope1.Insertable(new MachineRecord()
|
||||||
{
|
{
|
||||||
MachineId = ChannelStock.MachineId,
|
MachineId = ChannelStock.MachineId,
|
||||||
DrawerNo = ChannelStock.DrawerNo,
|
DrawerNo = ChannelStock.DrawerNo,
|
||||||
|
|
|
@ -16,6 +16,7 @@ using DM_Weight.msg;
|
||||||
using DM_Weight.Port;
|
using DM_Weight.Port;
|
||||||
using DM_Weight.select;
|
using DM_Weight.select;
|
||||||
using DM_Weight.util;
|
using DM_Weight.util;
|
||||||
|
using SqlSugar;
|
||||||
|
|
||||||
namespace DM_Weight.ViewModels
|
namespace DM_Weight.ViewModels
|
||||||
{
|
{
|
||||||
|
@ -75,10 +76,11 @@ namespace DM_Weight.ViewModels
|
||||||
private DelegateCommand _rowSelected;
|
private DelegateCommand _rowSelected;
|
||||||
|
|
||||||
public DelegateCommand RowSelected => _rowSelected ??= new DelegateCommand(OpenOrderDialog);
|
public DelegateCommand RowSelected => _rowSelected ??= new DelegateCommand(OpenOrderDialog);
|
||||||
|
private SqlSugarScope _sqlSugarScope1;
|
||||||
public ReturnDrugWindow2ViewModel(IDialogService DialogService)
|
public ReturnDrugWindow2ViewModel(IDialogService DialogService,SqlSugarScope sqlSugarScope)
|
||||||
{
|
{
|
||||||
_dialogService = DialogService;
|
_dialogService = DialogService;
|
||||||
|
this._sqlSugarScope1 = sqlSugarScope;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static List<OrderTakeSelect> StaticOrderTakeSelects = new()
|
public static List<OrderTakeSelect> StaticOrderTakeSelects = new()
|
||||||
|
@ -214,9 +216,9 @@ namespace DM_Weight.ViewModels
|
||||||
{
|
{
|
||||||
OrderInfos.Clear();
|
OrderInfos.Clear();
|
||||||
int totalCount = 0;
|
int totalCount = 0;
|
||||||
List<OrderInfo> queryData = SqlSugarHelper.Db.Queryable<OrderInfo>()
|
List<OrderInfo> queryData = _sqlSugarScope1.Queryable<OrderInfo>()
|
||||||
.InnerJoin<OrderDetail>((oi, od) => oi.OrderNo == od.OrderNo)
|
.InnerJoin<OrderDetail>((oi, od) => oi.OrderNo == od.OrderNo)
|
||||||
.InnerJoin(SqlSugarHelper.Db.Queryable<ChannelStock>().Where(cs => cs.DrawerType == 1).Where(cs => cs.MachineId.Equals(ConfigurationManager.AppSettings["machineId"] ?? "DM1")).GroupBy(cs => cs.DrugId), (oi, od, t) => od.DrugId == t.DrugId)
|
.InnerJoin(_sqlSugarScope1.Queryable<ChannelStock>().Where(cs => cs.DrawerType == 1).Where(cs => cs.MachineId.Equals(ConfigurationManager.AppSettings["machineId"] ?? "DM1")).GroupBy(cs => cs.DrugId), (oi, od, t) => od.DrugId == t.DrugId)
|
||||||
.WhereIF(OrderDate != null, oi => oi.OrderDate.ToString("yyyy-MM-dd") == OrderDate)
|
.WhereIF(OrderDate != null, oi => oi.OrderDate.ToString("yyyy-MM-dd") == OrderDate)
|
||||||
.WhereIF(!String.IsNullOrEmpty(SearchValue) && SelectedItem.Code.Equals("OrderNo"), oi => oi.OrderNo == SearchValue)
|
.WhereIF(!String.IsNullOrEmpty(SearchValue) && SelectedItem.Code.Equals("OrderNo"), oi => oi.OrderNo == SearchValue)
|
||||||
.WhereIF(!String.IsNullOrEmpty(SearchValue) && SelectedItem.Code.Equals("PatientId"), oi => oi.PatientId == SearchValue)
|
.WhereIF(!String.IsNullOrEmpty(SearchValue) && SelectedItem.Code.Equals("PatientId"), oi => oi.PatientId == SearchValue)
|
||||||
|
|
|
@ -11,6 +11,7 @@ using System.Threading.Tasks;
|
||||||
using DM_Weight.Models;
|
using DM_Weight.Models;
|
||||||
using DM_Weight.select;
|
using DM_Weight.select;
|
||||||
using DM_Weight.util;
|
using DM_Weight.util;
|
||||||
|
using SqlSugar;
|
||||||
|
|
||||||
namespace DM_Weight.ViewModels
|
namespace DM_Weight.ViewModels
|
||||||
{
|
{
|
||||||
|
@ -22,10 +23,11 @@ namespace DM_Weight.ViewModels
|
||||||
private DelegateCommand _rowSelected;
|
private DelegateCommand _rowSelected;
|
||||||
|
|
||||||
public DelegateCommand RowSelected => _rowSelected ??= new DelegateCommand(OpenOrderDialog);
|
public DelegateCommand RowSelected => _rowSelected ??= new DelegateCommand(OpenOrderDialog);
|
||||||
|
private SqlSugarScope _sqlSugarScope1;
|
||||||
public ReturnDrugWindowViewModel(IDialogService DialogService)
|
public ReturnDrugWindowViewModel(IDialogService DialogService, SqlSugarScope sqlSugarScope)
|
||||||
{
|
{
|
||||||
_dialogService = DialogService;
|
_dialogService = DialogService;
|
||||||
|
this._sqlSugarScope1 = sqlSugarScope;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static List<OrderTakeSelect> StaticSelects = new()
|
public static List<OrderTakeSelect> StaticSelects = new()
|
||||||
|
@ -171,7 +173,7 @@ namespace DM_Weight.ViewModels
|
||||||
|
|
||||||
public void RequestData()
|
public void RequestData()
|
||||||
{
|
{
|
||||||
List<MachineRecord> queryData = SqlSugarHelper.Db.Queryable<MachineRecord>()
|
List<MachineRecord> queryData = _sqlSugarScope1.Queryable<MachineRecord>()
|
||||||
.Includes<DrugInfo>(mr => mr.DrugInfo)
|
.Includes<DrugInfo>(mr => mr.DrugInfo)
|
||||||
.Includes<UserList>(mr => mr.User)
|
.Includes<UserList>(mr => mr.User)
|
||||||
.Where(mr => mr.Type == 2)
|
.Where(mr => mr.Type == 2)
|
||||||
|
|
|
@ -18,6 +18,8 @@ using DM_Weight.msg;
|
||||||
using DM_Weight.Port;
|
using DM_Weight.Port;
|
||||||
using DM_Weight.util;
|
using DM_Weight.util;
|
||||||
using DM_Weight.Views;
|
using DM_Weight.Views;
|
||||||
|
using SqlSugar;
|
||||||
|
using System.Threading.Channels;
|
||||||
|
|
||||||
namespace DM_Weight.ViewModels
|
namespace DM_Weight.ViewModels
|
||||||
{
|
{
|
||||||
|
@ -37,11 +39,12 @@ namespace DM_Weight.ViewModels
|
||||||
private PortUtil _portUtil;
|
private PortUtil _portUtil;
|
||||||
IEventAggregator _eventAggregator;
|
IEventAggregator _eventAggregator;
|
||||||
|
|
||||||
|
private SqlSugarScope _sqlSugarScope1;
|
||||||
public ReturnEmptyDialogViewModel(PortUtil portUtil, IEventAggregator eventAggregator)
|
public ReturnEmptyDialogViewModel(PortUtil portUtil, IEventAggregator eventAggregator, SqlSugarScope sqlSugarScope)
|
||||||
{
|
{
|
||||||
_portUtil = portUtil;
|
_portUtil = portUtil;
|
||||||
_eventAggregator = eventAggregator;
|
_eventAggregator = eventAggregator;
|
||||||
|
this._sqlSugarScope1 = sqlSugarScope;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DoMyPrismEvent(DeviceMsg msg)
|
void DoMyPrismEvent(DeviceMsg msg)
|
||||||
|
@ -65,7 +68,7 @@ namespace DM_Weight.ViewModels
|
||||||
if (Status == 2)
|
if (Status == 2)
|
||||||
{
|
{
|
||||||
Status = 3;
|
Status = 3;
|
||||||
if(ChannelStock.DrawerType == 3)
|
if (ChannelStock.DrawerType == 3)
|
||||||
{
|
{
|
||||||
ReturnQuantity = msg.Quantitys[0];
|
ReturnQuantity = msg.Quantitys[0];
|
||||||
logger.Info($"抽屉【{ChannelStock.DrawerNo}】回收库位药品数量增加【{msg.Quantitys[0]}】");
|
logger.Info($"抽屉【{ChannelStock.DrawerNo}】回收库位药品数量增加【{msg.Quantitys[0]}】");
|
||||||
|
@ -141,7 +144,7 @@ namespace DM_Weight.ViewModels
|
||||||
set => SetProperty(ref _channelStock, value);
|
set => SetProperty(ref _channelStock, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public bool CanCloseDialog()
|
public bool CanCloseDialog()
|
||||||
{
|
{
|
||||||
|
@ -152,12 +155,13 @@ namespace DM_Weight.ViewModels
|
||||||
{
|
{
|
||||||
// 取消消息订阅
|
// 取消消息订阅
|
||||||
_eventAggregator.GetEvent<PortUtilEvent>().Unsubscribe(DoMyPrismEvent);
|
_eventAggregator.GetEvent<PortUtilEvent>().Unsubscribe(DoMyPrismEvent);
|
||||||
|
_eventAggregator.GetEvent<CheckBoxCheckEvent>().Unsubscribe(CheckboxChecked);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void OnDialogOpened(IDialogParameters parameters)
|
public void OnDialogOpened(IDialogParameters parameters)
|
||||||
{
|
{
|
||||||
_eventAggregator.GetEvent<PortUtilEvent>().Subscribe(DoMyPrismEvent);
|
_eventAggregator.GetEvent<PortUtilEvent>().Subscribe(DoMyPrismEvent);
|
||||||
|
_eventAggregator.GetEvent<CheckBoxCheckEvent>().Subscribe(CheckboxChecked);
|
||||||
ChannelStock _record = parameters.GetValue<ChannelStock>("channel");
|
ChannelStock _record = parameters.GetValue<ChannelStock>("channel");
|
||||||
ChannelStock = _record;
|
ChannelStock = _record;
|
||||||
|
|
||||||
|
@ -166,7 +170,7 @@ namespace DM_Weight.ViewModels
|
||||||
|
|
||||||
public void RequestData()
|
public void RequestData()
|
||||||
{
|
{
|
||||||
List<MachineRecord> queryData = SqlSugarHelper.Db.Queryable<MachineRecord>()
|
List<MachineRecord> queryData = _sqlSugarScope1.Queryable<MachineRecord>()
|
||||||
.Includes<UserList>(mr => mr.User)
|
.Includes<UserList>(mr => mr.User)
|
||||||
.Where(mr => mr.DrugId == ChannelStock.DrugId)
|
.Where(mr => mr.DrugId == ChannelStock.DrugId)
|
||||||
.Where(mr => mr.MachineId.Equals(ConfigurationManager.AppSettings["machineId"] ?? "DM1"))
|
.Where(mr => mr.MachineId.Equals(ConfigurationManager.AppSettings["machineId"] ?? "DM1"))
|
||||||
|
@ -177,6 +181,19 @@ namespace DM_Weight.ViewModels
|
||||||
.ToList();
|
.ToList();
|
||||||
MachineRecords = queryData;
|
MachineRecords = queryData;
|
||||||
}
|
}
|
||||||
|
//选中药品将要返还的数量添加到文本框
|
||||||
|
private void CheckboxChecked()
|
||||||
|
{
|
||||||
|
List<MachineRecord> records = MachineRecords.FindAll(it => it.IsSelected).ToList();
|
||||||
|
if (records != null && records.Count > 0)
|
||||||
|
{
|
||||||
|
ReturnQuantity = records.Sum(it => it.Quantity - it.ReturnQuantity1);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ReturnQuantity = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public DelegateCommand OpenDrawer
|
public DelegateCommand OpenDrawer
|
||||||
{
|
{
|
||||||
|
@ -188,7 +205,7 @@ namespace DM_Weight.ViewModels
|
||||||
{
|
{
|
||||||
if (ChannelStock.DrawerType == 3 && ChannelStock.BoardType == 1)
|
if (ChannelStock.DrawerType == 3 && ChannelStock.BoardType == 1)
|
||||||
{
|
{
|
||||||
Status = 3 ;
|
Status = 3;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -196,7 +213,7 @@ namespace DM_Weight.ViewModels
|
||||||
_portUtil.SpeakAsync("正在打开" + ChannelStock.DrawerNo + "号抽屉");
|
_portUtil.SpeakAsync("正在打开" + ChannelStock.DrawerNo + "号抽屉");
|
||||||
_portUtil.WindowName = WindowName;
|
_portUtil.WindowName = WindowName;
|
||||||
_portUtil.ColNos = new int[] { ChannelStock.ColNo };
|
_portUtil.ColNos = new int[] { ChannelStock.ColNo };
|
||||||
_portUtil.Stocks = new int[] { ChannelStock.Quantity };
|
_portUtil.Stocks = new int[] { ChannelStock.Quantity };
|
||||||
_portUtil.DrawerNo = ChannelStock.DrawerNo;
|
_portUtil.DrawerNo = ChannelStock.DrawerNo;
|
||||||
_portUtil.DrawerType = ChannelStock.DrawerType;
|
_portUtil.DrawerType = ChannelStock.DrawerType;
|
||||||
_portUtil.BoardType = ChannelStock.BoardType;
|
_portUtil.BoardType = ChannelStock.BoardType;
|
||||||
|
@ -227,21 +244,21 @@ namespace DM_Weight.ViewModels
|
||||||
{
|
{
|
||||||
IsFinishClick = true;
|
IsFinishClick = true;
|
||||||
List<MachineRecord> records = MachineRecords.FindAll(it => it.IsSelected).ToList();
|
List<MachineRecord> records = MachineRecords.FindAll(it => it.IsSelected).ToList();
|
||||||
if (records.Count > 0 && records.Sum(it => it.Quantity - it.ReturnQuantity1) == ReturnQuantity)
|
if (records.Count > 0 && records.Sum(it => it.Quantity - it.ReturnQuantity1) == ReturnQuantity)
|
||||||
{
|
{
|
||||||
string InvoiceId = "RETURN_" + CurrentTimeMillis();
|
string InvoiceId = "RETURN_" + CurrentTimeMillis();
|
||||||
var f = SqlSugarHelper.Db.UseTran(() =>
|
var f = _sqlSugarScope1.UseTran(() =>
|
||||||
{
|
{
|
||||||
|
|
||||||
// 更新数据 库存信息
|
// 更新数据 库存信息
|
||||||
SqlSugarHelper.Db.Updateable(new ChannelStock()
|
_sqlSugarScope1.Updateable(new ChannelStock()
|
||||||
{
|
{
|
||||||
Quantity = ChannelStock.Quantity + ReturnQuantity,
|
Quantity = ChannelStock.Quantity + ReturnQuantity,
|
||||||
Id = ChannelStock.Id,
|
Id = ChannelStock.Id,
|
||||||
}).UpdateColumns(it => new { it.Quantity }).ExecuteCommand();
|
}).UpdateColumns(it => new { it.Quantity }).ExecuteCommand();
|
||||||
|
|
||||||
// 获取更新完库存后的药品库存
|
// 获取更新完库存后的药品库存
|
||||||
List<ChannelStock> nowChannels = SqlSugarHelper.Db.Queryable<ChannelStock>()
|
List<ChannelStock> nowChannels = _sqlSugarScope1.Queryable<ChannelStock>()
|
||||||
.Where(cs => cs.MachineId.Equals(ChannelStock.MachineId))
|
.Where(cs => cs.MachineId.Equals(ChannelStock.MachineId))
|
||||||
.Where(cs => cs.DrugId.Equals(ChannelStock.DrugId))
|
.Where(cs => cs.DrugId.Equals(ChannelStock.DrugId))
|
||||||
.Where(cs => cs.DrawerType == 1)
|
.Where(cs => cs.DrawerType == 1)
|
||||||
|
@ -251,7 +268,7 @@ namespace DM_Weight.ViewModels
|
||||||
{
|
{
|
||||||
MachineRecord _MachineRecord = records[i];
|
MachineRecord _MachineRecord = records[i];
|
||||||
// 更新数据 取药记录 设置还药数量、状态
|
// 更新数据 取药记录 设置还药数量、状态
|
||||||
SqlSugarHelper.Db.Updateable(new MachineRecord()
|
_sqlSugarScope1.Updateable(new MachineRecord()
|
||||||
{
|
{
|
||||||
ReturnQuantity2 = _MachineRecord.Quantity - _MachineRecord.ReturnQuantity1,
|
ReturnQuantity2 = _MachineRecord.Quantity - _MachineRecord.ReturnQuantity1,
|
||||||
Id = _MachineRecord.Id,
|
Id = _MachineRecord.Id,
|
||||||
|
@ -259,13 +276,13 @@ namespace DM_Weight.ViewModels
|
||||||
}).UpdateColumns(it => new { it.ReturnQuantity1, it.Status }).ExecuteCommand();
|
}).UpdateColumns(it => new { it.ReturnQuantity1, it.Status }).ExecuteCommand();
|
||||||
|
|
||||||
// 保存数据 还药空瓶记录
|
// 保存数据 还药空瓶记录
|
||||||
SqlSugarHelper.Db.Insertable(new MachineRecord()
|
_sqlSugarScope1.Insertable(new MachineRecord()
|
||||||
{
|
{
|
||||||
MachineId = ChannelStock.MachineId,
|
MachineId = ChannelStock.MachineId,
|
||||||
DrawerNo = ChannelStock.DrawerNo,
|
DrawerNo = ChannelStock.DrawerNo,
|
||||||
ColNo = ChannelStock.ColNo,
|
ColNo = ChannelStock.ColNo,
|
||||||
DrugId = ChannelStock.DrugId,
|
DrugId = ChannelStock.DrugId,
|
||||||
ManuNo = ChannelStock.ManuNo,
|
ManuNo = _MachineRecord.ManuNo,// ChannelStock.ManuNo,
|
||||||
EffDate = !String.IsNullOrEmpty(ChannelStock.EffDate) ? DateTime.ParseExact(ChannelStock.EffDate, "yyyy-MM-dd", System.Globalization.CultureInfo.CurrentCulture) : null,
|
EffDate = !String.IsNullOrEmpty(ChannelStock.EffDate) ? DateTime.ParseExact(ChannelStock.EffDate, "yyyy-MM-dd", System.Globalization.CultureInfo.CurrentCulture) : null,
|
||||||
Operator = HomeWindowViewModel.Operator?.Id,
|
Operator = HomeWindowViewModel.Operator?.Id,
|
||||||
Reviewer = HomeWindowViewModel.Reviewer?.Id,
|
Reviewer = HomeWindowViewModel.Reviewer?.Id,
|
||||||
|
@ -308,7 +325,8 @@ namespace DM_Weight.ViewModels
|
||||||
Status = 0;
|
Status = 0;
|
||||||
IsFinishClick = false;
|
IsFinishClick = false;
|
||||||
RequestClose?.Invoke(new DialogResult(ButtonResult.OK));
|
RequestClose?.Invoke(new DialogResult(ButtonResult.OK));
|
||||||
} else
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
AlertMsg alertMsg = new AlertMsg
|
AlertMsg alertMsg = new AlertMsg
|
||||||
{
|
{
|
||||||
|
|
|
@ -35,9 +35,11 @@ namespace DM_Weight.ViewModels
|
||||||
}
|
}
|
||||||
|
|
||||||
IDialogService _dialogService;
|
IDialogService _dialogService;
|
||||||
public ReturnEmptyWindowViewModel(IDialogService dialogService)
|
private SqlSugarScope _sqlSugarScope1;
|
||||||
|
public ReturnEmptyWindowViewModel(IDialogService dialogService, SqlSugarScope sqlSugarScope)
|
||||||
{
|
{
|
||||||
_dialogService = dialogService;
|
_dialogService = dialogService;
|
||||||
|
this._sqlSugarScope1 = sqlSugarScope;
|
||||||
}
|
}
|
||||||
|
|
||||||
public DelegateCommand RowSelected
|
public DelegateCommand RowSelected
|
||||||
|
@ -97,7 +99,7 @@ namespace DM_Weight.ViewModels
|
||||||
void RequestData()
|
void RequestData()
|
||||||
{
|
{
|
||||||
|
|
||||||
Channels = SqlSugarHelper.Db.Queryable<ChannelStock>()
|
Channels = _sqlSugarScope1.Queryable<ChannelStock>()
|
||||||
.LeftJoin<DrugInfo>((cs,di) => cs.DrugId == di.DrugId.ToString())
|
.LeftJoin<DrugInfo>((cs,di) => cs.DrugId == di.DrugId.ToString())
|
||||||
.Where((cs) => cs.DrawerType != 1)
|
.Where((cs) => cs.DrawerType != 1)
|
||||||
.Select((cs, di) => new ChannelStock{
|
.Select((cs, di) => new ChannelStock{
|
||||||
|
|
|
@ -18,6 +18,7 @@ using System.Data;
|
||||||
using System.Configuration;
|
using System.Configuration;
|
||||||
using MaterialDesignThemes.Wpf;
|
using MaterialDesignThemes.Wpf;
|
||||||
using System.Windows.Media;
|
using System.Windows.Media;
|
||||||
|
using SqlSugar;
|
||||||
|
|
||||||
namespace DM_Weight.ViewModels
|
namespace DM_Weight.ViewModels
|
||||||
{
|
{
|
||||||
|
@ -29,12 +30,13 @@ namespace DM_Weight.ViewModels
|
||||||
get { return _roleList; }
|
get { return _roleList; }
|
||||||
set { SetProperty(ref _roleList, value); }
|
set { SetProperty(ref _roleList, value); }
|
||||||
}
|
}
|
||||||
|
private SqlSugarScope _sqlSugarScope1;
|
||||||
|
public RoleManagerWindowViewModel(SqlSugarScope sqlSugarScope)
|
||||||
|
{
|
||||||
|
//_allPremissions = Clone<PremissionDm>(defaultAll);
|
||||||
|
this._sqlSugarScope1 = sqlSugarScope;
|
||||||
|
}
|
||||||
|
|
||||||
//public RoleManagerWindowViewModel()
|
|
||||||
//{
|
|
||||||
// _allPremissions = Clone<PremissionDm>(defaultAll);
|
|
||||||
//}
|
|
||||||
|
|
||||||
public static ObservableCollection<T> Clone<T>(object List)
|
public static ObservableCollection<T> Clone<T>(object List)
|
||||||
{
|
{
|
||||||
using (Stream objectStream = new MemoryStream())
|
using (Stream objectStream = new MemoryStream())
|
||||||
|
@ -98,7 +100,7 @@ namespace DM_Weight.ViewModels
|
||||||
RightPremissions.Clear();
|
RightPremissions.Clear();
|
||||||
if (Role != null && Role.Permissions != null)
|
if (Role != null && Role.Permissions != null)
|
||||||
{
|
{
|
||||||
List<PremissionDm> Permissions = Role.Permissions;
|
List<PremissionDm>? Permissions = Role.Permissions;
|
||||||
Permissions.ForEach(it =>
|
Permissions.ForEach(it =>
|
||||||
{
|
{
|
||||||
// 父菜单
|
// 父菜单
|
||||||
|
@ -169,6 +171,7 @@ namespace DM_Weight.ViewModels
|
||||||
Id = 11,
|
Id = 11,
|
||||||
PremissionName = "处方取药",
|
PremissionName = "处方取药",
|
||||||
PremissionPath = "OrderTakeDrugWindow",
|
PremissionPath = "OrderTakeDrugWindow",
|
||||||
|
//PremissionPath = "TestCheckBox",
|
||||||
};
|
};
|
||||||
PremissionDm quyao2 = new PremissionDm
|
PremissionDm quyao2 = new PremissionDm
|
||||||
{
|
{
|
||||||
|
@ -369,8 +372,8 @@ namespace DM_Weight.ViewModels
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
|
|
||||||
private ObservableCollection<PremissionDm> _allPremissions = Clone<PremissionDm>(defaultAll);
|
private ObservableCollection<PremissionDm>? _allPremissions = Clone<PremissionDm>(defaultAll);
|
||||||
public ObservableCollection<PremissionDm> AllPremissions
|
public ObservableCollection<PremissionDm>? AllPremissions
|
||||||
{
|
{
|
||||||
get => _allPremissions;
|
get => _allPremissions;
|
||||||
set => SetProperty(ref _allPremissions, value);
|
set => SetProperty(ref _allPremissions, value);
|
||||||
|
@ -576,7 +579,7 @@ namespace DM_Weight.ViewModels
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// 查找所选子菜单的父菜单
|
// 查找所选子菜单的父菜单
|
||||||
PremissionDm item = RightPremissions.ToList().Find(it => (int)(RightPremission.Id / 10) == it.Id);
|
PremissionDm? item = RightPremissions.ToList().Find(it => (int)(RightPremission.Id / 10) == it.Id);
|
||||||
// 查找父菜单是否在左侧
|
// 查找父菜单是否在左侧
|
||||||
int index = AllPremissions.ToList().FindIndex(it => it.Id == item.Id);
|
int index = AllPremissions.ToList().FindIndex(it => it.Id == item.Id);
|
||||||
// 存在
|
// 存在
|
||||||
|
@ -661,14 +664,14 @@ namespace DM_Weight.ViewModels
|
||||||
Role.Id = 0;
|
Role.Id = 0;
|
||||||
Role.MachineId = ConfigurationManager.AppSettings["machineId"] ?? "DM1";
|
Role.MachineId = ConfigurationManager.AppSettings["machineId"] ?? "DM1";
|
||||||
Role.Permissions = RightPremissions.ToList();
|
Role.Permissions = RightPremissions.ToList();
|
||||||
List<RoleDm> roleList = SqlSugarHelper.Db.Queryable<RoleDm>().Where(r => r.RoleName == Role.RoleName).ToList();
|
List<RoleDm> roleList = _sqlSugarScope1.Queryable<RoleDm>().Where(r => r.RoleName == Role.RoleName).ToList();
|
||||||
if(roleList.Count>0)
|
if(roleList.Count>0)
|
||||||
{
|
{
|
||||||
SnackbarBackground = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#b71c1c"));
|
SnackbarBackground = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#b71c1c"));
|
||||||
SnackbarMessageQueue.Enqueue("该角色已存在!");
|
SnackbarMessageQueue.Enqueue("该角色已存在!");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
SqlSugarHelper.Db.Insertable<RoleDm>(Role).ExecuteCommand();
|
_sqlSugarScope1.Insertable<RoleDm>(Role).ExecuteCommand();
|
||||||
RequestData();
|
RequestData();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -678,7 +681,7 @@ namespace DM_Weight.ViewModels
|
||||||
get => new DelegateCommand(() =>
|
get => new DelegateCommand(() =>
|
||||||
{
|
{
|
||||||
Role.Permissions = RightPremissions.ToList();
|
Role.Permissions = RightPremissions.ToList();
|
||||||
SqlSugarHelper.Db.Updateable<RoleDm>(Role).ExecuteCommand();
|
_sqlSugarScope1.Updateable<RoleDm>(Role).ExecuteCommand();
|
||||||
RequestData();
|
RequestData();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -701,7 +704,7 @@ namespace DM_Weight.ViewModels
|
||||||
|
|
||||||
void RequestData()
|
void RequestData()
|
||||||
{
|
{
|
||||||
RoleList = SqlSugarHelper.Db.Queryable<RoleDm>()
|
RoleList = _sqlSugarScope1.Queryable<RoleDm>()
|
||||||
.Where(di => di.MachineId.Equals(ConfigurationManager.AppSettings["machineId"] ?? "DM1"))
|
.Where(di => di.MachineId.Equals(ConfigurationManager.AppSettings["machineId"] ?? "DM1"))
|
||||||
.WhereIF(!String.IsNullOrEmpty(SearchValue), (di) => di.RoleName.Contains(SearchValue??""))
|
.WhereIF(!String.IsNullOrEmpty(SearchValue), (di) => di.RoleName.Contains(SearchValue??""))
|
||||||
.Select(r => r)
|
.Select(r => r)
|
||||||
|
|
|
@ -18,6 +18,7 @@ using DM_Weight.Port;
|
||||||
using DM_Weight.util;
|
using DM_Weight.util;
|
||||||
using DM_Weight.Views;
|
using DM_Weight.Views;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
|
using SqlSugar;
|
||||||
|
|
||||||
namespace DM_Weight.ViewModels
|
namespace DM_Weight.ViewModels
|
||||||
{
|
{
|
||||||
|
@ -40,11 +41,12 @@ namespace DM_Weight.ViewModels
|
||||||
|
|
||||||
private PortUtil _portUtil;
|
private PortUtil _portUtil;
|
||||||
IEventAggregator _eventAggregator;
|
IEventAggregator _eventAggregator;
|
||||||
|
private SqlSugarScope _sqlSugarScope1;
|
||||||
public SelfAddDialogViewModel(PortUtil portUtil, IEventAggregator eventAggregator)
|
public SelfAddDialogViewModel(PortUtil portUtil, IEventAggregator eventAggregator, SqlSugarScope sqlSugarScope)
|
||||||
{
|
{
|
||||||
_portUtil = portUtil;
|
_portUtil = portUtil;
|
||||||
_eventAggregator = eventAggregator;
|
_eventAggregator = eventAggregator;
|
||||||
|
this._sqlSugarScope1 = sqlSugarScope;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DoMyPrismEvent(DeviceMsg msg)
|
void DoMyPrismEvent(DeviceMsg msg)
|
||||||
|
@ -130,9 +132,9 @@ namespace DM_Weight.ViewModels
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private List<ChannelStock> _channelStocks;
|
private List<ChannelStock>? _channelStocks=new List<ChannelStock>();
|
||||||
|
|
||||||
public List<ChannelStock> ChannelStocks
|
public List<ChannelStock>? ChannelStocks
|
||||||
{
|
{
|
||||||
get => _channelStocks;
|
get => _channelStocks;
|
||||||
set => SetProperty(ref _channelStocks, value);
|
set => SetProperty(ref _channelStocks, value);
|
||||||
|
@ -232,7 +234,7 @@ namespace DM_Weight.ViewModels
|
||||||
List<ChannelStock> record = ChannelStocks.ToList();
|
List<ChannelStock> record = ChannelStocks.ToList();
|
||||||
//string InvoiceId = "SELF_" + CurrentTimeMillis();
|
//string InvoiceId = "SELF_" + CurrentTimeMillis();
|
||||||
string InvoiceId = PZH;
|
string InvoiceId = PZH;
|
||||||
var f = SqlSugarHelper.Db.UseTran(() =>
|
var f = _sqlSugarScope1.UseTran(() =>
|
||||||
{
|
{
|
||||||
for (int i = 0; i < record.Count; i++)
|
for (int i = 0; i < record.Count; i++)
|
||||||
{
|
{
|
||||||
|
@ -242,7 +244,7 @@ namespace DM_Weight.ViewModels
|
||||||
_portUtil.SetNumCount(it.DrawerNo, it.ColNo, it.AddQuantity);
|
_portUtil.SetNumCount(it.DrawerNo, it.ColNo, it.AddQuantity);
|
||||||
}
|
}
|
||||||
// 更新数据 库存信息
|
// 更新数据 库存信息
|
||||||
SqlSugarHelper.Db.Updateable(new ChannelStock()
|
_sqlSugarScope1.Updateable(new ChannelStock()
|
||||||
{
|
{
|
||||||
Quantity = it.Quantity + it.AddQuantity,
|
Quantity = it.Quantity + it.AddQuantity,
|
||||||
PosNo = 1,
|
PosNo = 1,
|
||||||
|
@ -251,14 +253,14 @@ namespace DM_Weight.ViewModels
|
||||||
Id = it.Id,
|
Id = it.Id,
|
||||||
}).UpdateColumns(it => new { it.Quantity, it.ManuNo, it.EffDate, it.PosNo }).ExecuteCommand();
|
}).UpdateColumns(it => new { it.Quantity, it.ManuNo, it.EffDate, it.PosNo }).ExecuteCommand();
|
||||||
// 获取更新完库存后的药品库存
|
// 获取更新完库存后的药品库存
|
||||||
List<ChannelStock> nowChannels = SqlSugarHelper.Db.Queryable<ChannelStock>()
|
List<ChannelStock> nowChannels = _sqlSugarScope1.Queryable<ChannelStock>()
|
||||||
.Where(cs => cs.MachineId.Equals(it.MachineId))
|
.Where(cs => cs.MachineId.Equals(it.MachineId))
|
||||||
.Where(cs => cs.DrugId.Equals(it.DrugId))
|
.Where(cs => cs.DrugId.Equals(it.DrugId))
|
||||||
.Where(cs => cs.DrawerType == 1)
|
.Where(cs => cs.DrawerType == 1)
|
||||||
.ToList();
|
.ToList();
|
||||||
|
|
||||||
// 保存数据 出/入库记录
|
// 保存数据 出/入库记录
|
||||||
SqlSugarHelper.Db.Insertable(new MachineRecord()
|
_sqlSugarScope1.Insertable(new MachineRecord()
|
||||||
{
|
{
|
||||||
MachineId = it.MachineId,
|
MachineId = it.MachineId,
|
||||||
DrawerNo = it.DrawerNo,
|
DrawerNo = it.DrawerNo,
|
||||||
|
|
|
@ -45,11 +45,12 @@ namespace DM_Weight.ViewModels
|
||||||
Name = "药品编码"
|
Name = "药品编码"
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
private SqlSugarScope _sqlSugarScope1;
|
||||||
public SelfAddWindowViewModel(IDialogService DialogService,IEventAggregator eventAggregator)
|
public SelfAddWindowViewModel(IDialogService DialogService,IEventAggregator eventAggregator, SqlSugarScope sqlSugarScope)
|
||||||
{
|
{
|
||||||
_dialogService = DialogService;
|
_dialogService = DialogService;
|
||||||
_eventAggregator = eventAggregator;
|
_eventAggregator = eventAggregator;
|
||||||
|
this._sqlSugarScope1 = sqlSugarScope;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -164,7 +165,7 @@ namespace DM_Weight.ViewModels
|
||||||
|
|
||||||
public void RequestChannelData()
|
public void RequestChannelData()
|
||||||
{
|
{
|
||||||
List<ChannelStock> queryData = SqlSugarHelper.Db.Queryable<ChannelStock>()
|
List<ChannelStock> queryData = _sqlSugarScope1.Queryable<ChannelStock>()
|
||||||
.Includes<DrugInfo>(cs => cs.DrugInfo)
|
.Includes<DrugInfo>(cs => cs.DrugInfo)
|
||||||
.Where(cs => cs.DrugId != null)
|
.Where(cs => cs.DrugId != null)
|
||||||
.Where(cs => cs.DrawerType == 1)
|
.Where(cs => cs.DrawerType == 1)
|
||||||
|
|
|
@ -16,6 +16,7 @@ using DM_Weight.msg;
|
||||||
using DM_Weight.Port;
|
using DM_Weight.Port;
|
||||||
using DM_Weight.util;
|
using DM_Weight.util;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
|
using SqlSugar;
|
||||||
|
|
||||||
namespace DM_Weight.ViewModels
|
namespace DM_Weight.ViewModels
|
||||||
{
|
{
|
||||||
|
@ -34,11 +35,12 @@ namespace DM_Weight.ViewModels
|
||||||
|
|
||||||
private PortUtil _portUtil;
|
private PortUtil _portUtil;
|
||||||
IEventAggregator _eventAggregator;
|
IEventAggregator _eventAggregator;
|
||||||
|
private SqlSugarScope _sqlSugarScope1;
|
||||||
public SelfTakeDialogViewModel(PortUtil portUtil, IEventAggregator eventAggregator)
|
public SelfTakeDialogViewModel(PortUtil portUtil, IEventAggregator eventAggregator, SqlSugarScope sqlSugarScope)
|
||||||
{
|
{
|
||||||
_portUtil = portUtil;
|
_portUtil = portUtil;
|
||||||
_eventAggregator = eventAggregator;
|
_eventAggregator = eventAggregator;
|
||||||
|
this._sqlSugarScope1 = sqlSugarScope;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DoMyPrismEvent(DeviceMsg msg)
|
void DoMyPrismEvent(DeviceMsg msg)
|
||||||
|
@ -209,13 +211,13 @@ namespace DM_Weight.ViewModels
|
||||||
_isFinishClick = true;
|
_isFinishClick = true;
|
||||||
List<ChannelStock> record = ChannelStocks.ToList();
|
List<ChannelStock> record = ChannelStocks.ToList();
|
||||||
string InvoiceId = "SELF_" + CurrentTimeMillis();
|
string InvoiceId = "SELF_" + CurrentTimeMillis();
|
||||||
var f = SqlSugarHelper.Db.UseTran(() =>
|
var f = _sqlSugarScope1.UseTran(() =>
|
||||||
{
|
{
|
||||||
for (int i = 0; i < record.Count; i++)
|
for (int i = 0; i < record.Count; i++)
|
||||||
{
|
{
|
||||||
ChannelStock it = record[i];
|
ChannelStock it = record[i];
|
||||||
// 更新数据 库存信息
|
// 更新数据 库存信息
|
||||||
SqlSugarHelper.Db.Updateable(new ChannelStock()
|
_sqlSugarScope1.Updateable(new ChannelStock()
|
||||||
{
|
{
|
||||||
Quantity = it.Quantity - it.TakeQuantity,
|
Quantity = it.Quantity - it.TakeQuantity,
|
||||||
ManuNo = it.ManuNo,
|
ManuNo = it.ManuNo,
|
||||||
|
@ -223,14 +225,14 @@ namespace DM_Weight.ViewModels
|
||||||
Id = it.Id,
|
Id = it.Id,
|
||||||
}).UpdateColumns(it => new { it.Quantity, it.ManuNo, it.EffDate }).ExecuteCommand();
|
}).UpdateColumns(it => new { it.Quantity, it.ManuNo, it.EffDate }).ExecuteCommand();
|
||||||
// 获取更新完库存后的药品库存
|
// 获取更新完库存后的药品库存
|
||||||
List<ChannelStock> nowChannels = SqlSugarHelper.Db.Queryable<ChannelStock>()
|
List<ChannelStock> nowChannels = _sqlSugarScope1.Queryable<ChannelStock>()
|
||||||
.Where(cs => cs.MachineId.Equals(it.MachineId))
|
.Where(cs => cs.MachineId.Equals(it.MachineId))
|
||||||
.Where(cs => cs.DrugId.Equals(it.DrugId))
|
.Where(cs => cs.DrugId.Equals(it.DrugId))
|
||||||
.Where(cs => cs.DrawerType == 1)
|
.Where(cs => cs.DrawerType == 1)
|
||||||
.ToList();
|
.ToList();
|
||||||
|
|
||||||
// 保存数据 出/入库记录
|
// 保存数据 出/入库记录
|
||||||
SqlSugarHelper.Db.Insertable(new MachineRecord()
|
_sqlSugarScope1.Insertable(new MachineRecord()
|
||||||
{
|
{
|
||||||
MachineId = it.MachineId,
|
MachineId = it.MachineId,
|
||||||
DrawerNo = it.DrawerNo,
|
DrawerNo = it.DrawerNo,
|
||||||
|
|
|
@ -13,6 +13,7 @@ using DM_Weight.select;
|
||||||
using DM_Weight.util;
|
using DM_Weight.util;
|
||||||
using DM_Weight.msg;
|
using DM_Weight.msg;
|
||||||
using Prism.Events;
|
using Prism.Events;
|
||||||
|
using SqlSugar;
|
||||||
|
|
||||||
namespace DM_Weight.ViewModels
|
namespace DM_Weight.ViewModels
|
||||||
{
|
{
|
||||||
|
@ -44,11 +45,12 @@ namespace DM_Weight.ViewModels
|
||||||
Name = "药品编码"
|
Name = "药品编码"
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
private SqlSugarScope _sqlSugarScope1;
|
||||||
public SelfTakeDrugWindowViewModel(IDialogService DialogService, IEventAggregator eventAggregator)
|
public SelfTakeDrugWindowViewModel(IDialogService DialogService, IEventAggregator eventAggregator, SqlSugarScope sqlSugarScope)
|
||||||
{
|
{
|
||||||
_dialogService = DialogService;
|
_dialogService = DialogService;
|
||||||
_eventAggregator= eventAggregator;
|
_eventAggregator= eventAggregator;
|
||||||
|
this._sqlSugarScope1 = sqlSugarScope;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -154,7 +156,7 @@ namespace DM_Weight.ViewModels
|
||||||
|
|
||||||
public void RequestChannelData()
|
public void RequestChannelData()
|
||||||
{
|
{
|
||||||
List<ChannelStock> queryData = SqlSugarHelper.Db.Queryable<ChannelStock>()
|
List<ChannelStock> queryData = _sqlSugarScope1.Queryable<ChannelStock>()
|
||||||
.Includes<DrugInfo>(cs => cs.DrugInfo)
|
.Includes<DrugInfo>(cs => cs.DrugInfo)
|
||||||
.Where(cs => cs.DrugId != null)
|
.Where(cs => cs.DrugId != null)
|
||||||
.Where(cs => cs.DrawerType == 1)
|
.Where(cs => cs.DrawerType == 1)
|
||||||
|
|
|
@ -16,10 +16,10 @@ namespace DM_Weight.ViewModels
|
||||||
{
|
{
|
||||||
public string Title => strPara;
|
public string Title => strPara;
|
||||||
|
|
||||||
private string _msg;
|
private string _msg=string.Empty;
|
||||||
public string Msg { get => _msg; set { SetProperty(ref _msg, value); } }
|
public string Msg { get => _msg; set { SetProperty(ref _msg, value); } }
|
||||||
|
|
||||||
public event Action<IDialogResult> RequestClose;
|
public event Action<IDialogResult>? RequestClose;
|
||||||
|
|
||||||
public bool CanCloseDialog()
|
public bool CanCloseDialog()
|
||||||
{
|
{
|
||||||
|
|
|
@ -87,9 +87,11 @@ namespace DM_Weight.ViewModels
|
||||||
}
|
}
|
||||||
|
|
||||||
IDialogService _dialogService;
|
IDialogService _dialogService;
|
||||||
public StockListWindowViewModel(IDialogService dialogService)
|
private SqlSugarScope _sqlSugarScope1;
|
||||||
|
public StockListWindowViewModel(IDialogService dialogService, SqlSugarScope sqlSugarScope)
|
||||||
{
|
{
|
||||||
_dialogService = dialogService;
|
_dialogService = dialogService;
|
||||||
|
this._sqlSugarScope1 = sqlSugarScope;
|
||||||
}
|
}
|
||||||
private ChannelStock? _selectedChannel;
|
private ChannelStock? _selectedChannel;
|
||||||
|
|
||||||
|
@ -159,7 +161,7 @@ namespace DM_Weight.ViewModels
|
||||||
public void RequestData()
|
public void RequestData()
|
||||||
{
|
{
|
||||||
ChannelStocks.Clear();
|
ChannelStocks.Clear();
|
||||||
List<ChannelStock> q = SqlSugarHelper.Db.Queryable<ChannelStock>()
|
List<ChannelStock> q = _sqlSugarScope1.Queryable<ChannelStock>()
|
||||||
.Includes<DrugInfo>(cs => cs.DrugInfo)
|
.Includes<DrugInfo>(cs => cs.DrugInfo)
|
||||||
.Where(cs => cs.DrawerType == 1)
|
.Where(cs => cs.DrawerType == 1)
|
||||||
.Where(cs =>cs.DrugId != null)
|
.Where(cs =>cs.DrugId != null)
|
||||||
|
|
|
@ -0,0 +1,22 @@
|
||||||
|
using Prism.Commands;
|
||||||
|
using Prism.Mvvm;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace DM_Weight.ViewModels
|
||||||
|
{
|
||||||
|
public class TestCheckBoxViewModel:BindableBase
|
||||||
|
{
|
||||||
|
public DelegateCommand cbxCommand
|
||||||
|
{
|
||||||
|
get =>new DelegateCommand(()=>{
|
||||||
|
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -15,6 +15,7 @@ using System.Windows.Controls;
|
||||||
using DM_Weight.Models;
|
using DM_Weight.Models;
|
||||||
using DM_Weight.select;
|
using DM_Weight.select;
|
||||||
using DM_Weight.util;
|
using DM_Weight.util;
|
||||||
|
using SqlSugar;
|
||||||
|
|
||||||
namespace DM_Weight.ViewModels
|
namespace DM_Weight.ViewModels
|
||||||
{
|
{
|
||||||
|
@ -73,10 +74,12 @@ namespace DM_Weight.ViewModels
|
||||||
set { SetProperty(ref _user, value); }
|
set { SetProperty(ref _user, value); }
|
||||||
}
|
}
|
||||||
private readonly IDialogService _dialogService;
|
private readonly IDialogService _dialogService;
|
||||||
|
private SqlSugarScope _sqlSugarScope1;
|
||||||
public UserManagerWindowViewModel(IDialogService dialogService)
|
public UserManagerWindowViewModel(IDialogService dialogService, SqlSugarScope sqlSugarScope)
|
||||||
{
|
{
|
||||||
_dialogService = dialogService;
|
_dialogService = dialogService;
|
||||||
|
this._sqlSugarScope1 = sqlSugarScope;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private string? _searchValue;
|
private string? _searchValue;
|
||||||
|
@ -173,7 +176,7 @@ namespace DM_Weight.ViewModels
|
||||||
void RequestData()
|
void RequestData()
|
||||||
{
|
{
|
||||||
int totalcount = 0;
|
int totalcount = 0;
|
||||||
UserList = SqlSugarHelper.Db.Queryable<UserList>()
|
UserList = _sqlSugarScope1.Queryable<UserList>()
|
||||||
.Includes<RoleDm>(ul => ul.Role)
|
.Includes<RoleDm>(ul => ul.Role)
|
||||||
.Where(ul => ul.MachineId.Equals(ConfigurationManager.AppSettings["machineId"] ?? "DM1"))
|
.Where(ul => ul.MachineId.Equals(ConfigurationManager.AppSettings["machineId"] ?? "DM1"))
|
||||||
.WhereIF(!String.IsNullOrEmpty(SearchValue) , (di) => di.Nickname.Contains(SearchValue))
|
.WhereIF(!String.IsNullOrEmpty(SearchValue) , (di) => di.Nickname.Contains(SearchValue))
|
||||||
|
|
|
@ -82,7 +82,7 @@
|
||||||
Style="{StaticResource MaterialDesignOutlinedLightButton}"
|
Style="{StaticResource MaterialDesignOutlinedLightButton}"
|
||||||
ToolTip="解除绑定"
|
ToolTip="解除绑定"
|
||||||
Content="解绑"
|
Content="解绑"
|
||||||
Command="{Binding RemoveBinding}" />
|
Command="{Binding MoveBindingNew}" />
|
||||||
<Button
|
<Button
|
||||||
Margin="0 0 6 0"
|
Margin="0 0 6 0"
|
||||||
Style="{StaticResource MaterialDesignOutlinedLightButton}"
|
Style="{StaticResource MaterialDesignOutlinedLightButton}"
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
xmlns:local="clr-namespace:DM_Weight.Views.Dialog"
|
xmlns:local="clr-namespace:DM_Weight.Views.Dialog"
|
||||||
xmlns:prism="http://prismlibrary.com/"
|
xmlns:prism="http://prismlibrary.com/"
|
||||||
|
xmlns:i="http://schemas.microsoft.com/xaml/behaviors"
|
||||||
prism:ViewModelLocator.AutoWireViewModel="True"
|
prism:ViewModelLocator.AutoWireViewModel="True"
|
||||||
xmlns:convert="clr-namespace:DM_Weight.Converter"
|
xmlns:convert="clr-namespace:DM_Weight.Converter"
|
||||||
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
|
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
|
||||||
|
@ -136,7 +137,7 @@
|
||||||
<GridViewColumn Header="选择" Width="100">
|
<GridViewColumn Header="选择" Width="100">
|
||||||
<GridViewColumn.CellTemplate>
|
<GridViewColumn.CellTemplate>
|
||||||
<DataTemplate>
|
<DataTemplate>
|
||||||
<CheckBox IsChecked="{Binding IsSelected}" />
|
<CheckBox IsChecked="{Binding IsSelected}" Click="CheckBox_Click" />
|
||||||
</DataTemplate>
|
</DataTemplate>
|
||||||
</GridViewColumn.CellTemplate>
|
</GridViewColumn.CellTemplate>
|
||||||
</GridViewColumn>
|
</GridViewColumn>
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
using System;
|
using DM_Weight.msg;
|
||||||
|
using Prism.Events;
|
||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
@ -20,9 +22,16 @@ namespace DM_Weight.Views.Dialog
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public partial class ReturnEmptyDialog : UserControl
|
public partial class ReturnEmptyDialog : UserControl
|
||||||
{
|
{
|
||||||
public ReturnEmptyDialog()
|
IEventAggregator _eventAggregator;
|
||||||
|
public ReturnEmptyDialog(IEventAggregator eventAggregator)
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
this._eventAggregator= eventAggregator;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void CheckBox_Click(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
_eventAggregator.GetEvent<CheckBoxCheckEvent>().Publish();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -130,9 +130,12 @@
|
||||||
<GridViewColumn Width="100"
|
<GridViewColumn Width="100"
|
||||||
DisplayMemberBinding="{Binding DrugInfo.DrugSpec}"
|
DisplayMemberBinding="{Binding DrugInfo.DrugSpec}"
|
||||||
Header="规格"/>
|
Header="规格"/>
|
||||||
<GridViewColumn Width="100"
|
<GridViewColumn Width="{Binding Type,Converter={StaticResource MachineTypeConverter},ConverterParameter=gridviewQuantity}"
|
||||||
DisplayMemberBinding="{Binding Quantity}"
|
DisplayMemberBinding="{Binding Quantity}"
|
||||||
Header="数量"/>
|
Header="数量"/>
|
||||||
|
<GridViewColumn Width="{Binding Type,Converter={StaticResource MachineTypeConverter},ConverterParameter=gridviewCheckQuantity}"
|
||||||
|
DisplayMemberBinding="{Binding CheckQuantity}"
|
||||||
|
Header="数量"/>
|
||||||
<GridViewColumn Width="180"
|
<GridViewColumn Width="180"
|
||||||
DisplayMemberBinding="{Binding ManuNo}"
|
DisplayMemberBinding="{Binding ManuNo}"
|
||||||
Header="批次"/>
|
Header="批次"/>
|
||||||
|
|
|
@ -0,0 +1,29 @@
|
||||||
|
<UserControl x:Class="DM_Weight.Views.TestCheckBox"
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
|
xmlns:local="clr-namespace:DM_Weight.Views"
|
||||||
|
mc:Ignorable="d"
|
||||||
|
d:DesignHeight="450" d:DesignWidth="800">
|
||||||
|
<Border BorderBrush="Orange" BorderThickness="3" CornerRadius="6" Background="Yellow">
|
||||||
|
<Grid>
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="Auto"/>
|
||||||
|
<RowDefinition Height="*"/>
|
||||||
|
<RowDefinition Height="Auto"/>
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
<Border BorderBrush="Orange" BorderThickness="1" CornerRadius="1" Padding="4">
|
||||||
|
<StackPanel>
|
||||||
|
<StackPanel Orientation="Horizontal">
|
||||||
|
<StackPanel.Effect>
|
||||||
|
<DropShadowEffect Color="LightGray"/>
|
||||||
|
</StackPanel.Effect>
|
||||||
|
<TextBlock Text="欢迎光临" FontSize="60" FontFamily="LiShu"/>
|
||||||
|
<CheckBox Command="{Binding cbxCommand}"></CheckBox>
|
||||||
|
</StackPanel>
|
||||||
|
</StackPanel>
|
||||||
|
</Border>
|
||||||
|
</Grid>
|
||||||
|
</Border>
|
||||||
|
</UserControl>
|
|
@ -0,0 +1,28 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows;
|
||||||
|
using System.Windows.Controls;
|
||||||
|
using System.Windows.Data;
|
||||||
|
using System.Windows.Documents;
|
||||||
|
using System.Windows.Input;
|
||||||
|
using System.Windows.Media;
|
||||||
|
using System.Windows.Media.Imaging;
|
||||||
|
using System.Windows.Navigation;
|
||||||
|
using System.Windows.Shapes;
|
||||||
|
|
||||||
|
namespace DM_Weight.Views
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// TestCheckBox.xaml 的交互逻辑
|
||||||
|
/// </summary>
|
||||||
|
public partial class TestCheckBox : UserControl
|
||||||
|
{
|
||||||
|
public TestCheckBox()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,13 @@
|
||||||
|
using Prism.Events;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace DM_Weight.msg
|
||||||
|
{
|
||||||
|
public class CheckBoxCheckEvent:PubSubEvent
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
|
@ -7,12 +7,12 @@ namespace DM_Weight.util
|
||||||
public class SqlSugarHelper
|
public class SqlSugarHelper
|
||||||
{
|
{
|
||||||
public static SqlSugarScope Db = new SqlSugarScope(new ConnectionConfig()
|
public static SqlSugarScope Db = new SqlSugarScope(new ConnectionConfig()
|
||||||
{
|
{
|
||||||
|
|
||||||
ConnectionString = ConfigurationManager.ConnectionStrings["database"].ToString(),
|
ConnectionString = ConfigurationManager.ConnectionStrings["database"].ToString(),
|
||||||
DbType = DbType.MySql,
|
DbType = DbType.MySql,
|
||||||
IsAutoCloseConnection = true
|
IsAutoCloseConnection = true
|
||||||
},
|
},
|
||||||
db =>
|
db =>
|
||||||
{
|
{
|
||||||
db.Aop.OnLogExecuting = (sql, pars) =>
|
db.Aop.OnLogExecuting = (sql, pars) =>
|
||||||
|
@ -21,5 +21,6 @@ namespace DM_Weight.util
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -0,0 +1,51 @@
|
||||||
|
using SqlSugar;
|
||||||
|
using System;
|
||||||
|
using System.Configuration;
|
||||||
|
|
||||||
|
namespace DM_Weight.util
|
||||||
|
{
|
||||||
|
public class SqlSugarHelperNew
|
||||||
|
{
|
||||||
|
//private static readonly Lazy<SqlSugarClient> _instance = new Lazy<SqlSugarClient>(() =>
|
||||||
|
//{
|
||||||
|
// var db = new SqlSugarClient(
|
||||||
|
// new ConnectionConfig()
|
||||||
|
// {
|
||||||
|
// ConnectionString = ConfigurationManager.ConnectionStrings["database"].ToString(),
|
||||||
|
// DbType = DbType.MySql,
|
||||||
|
// IsAutoCloseConnection = true
|
||||||
|
// },
|
||||||
|
// db =>
|
||||||
|
// {
|
||||||
|
// db.Aop.OnLogExecuting = (sql, pars) =>
|
||||||
|
// {
|
||||||
|
// Console.WriteLine(sql);
|
||||||
|
// };
|
||||||
|
// }
|
||||||
|
// );
|
||||||
|
// return db;
|
||||||
|
//});
|
||||||
|
//public static SqlSugarClient Instance => _instance.Value;
|
||||||
|
|
||||||
|
|
||||||
|
private static readonly string connectionString = ConfigurationManager.ConnectionStrings["database"].ToString();
|
||||||
|
public static SqlSugarScope GetInstance()
|
||||||
|
{
|
||||||
|
var db = new SqlSugarScope(new ConnectionConfig()
|
||||||
|
{
|
||||||
|
ConnectionString = connectionString,
|
||||||
|
DbType = DbType.MySql,
|
||||||
|
IsAutoCloseConnection = true
|
||||||
|
|
||||||
|
},
|
||||||
|
db =>
|
||||||
|
{
|
||||||
|
db.Aop.OnLogExecuting = (sql, pars) =>
|
||||||
|
{
|
||||||
|
Console.WriteLine(sql);
|
||||||
|
};
|
||||||
|
});
|
||||||
|
return db;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue