parent
23c5af868e
commit
1ec7054a8c
|
@ -116,5 +116,13 @@
|
|||
<!--海康威视密码-->
|
||||
<add key="HIKPassword" value="HKC123456"/>
|
||||
|
||||
<!--交接柜网口地址及端口-->
|
||||
<add key="modbusIp" value="127.0.0.1"/>
|
||||
<add key="modbusPort" value="4002"/>
|
||||
|
||||
<!--温湿度串口-->
|
||||
<add key="wsdSerialPort" value="COM5"/>
|
||||
<!--温度查询定时执行时间-->
|
||||
<add key="Interval" value="60000"/>
|
||||
</appSettings>
|
||||
</configuration>
|
|
@ -275,6 +275,11 @@ namespace DM_Weight
|
|||
//药箱设置
|
||||
containerRegistry.RegisterForNavigation<SettingBoxWindow, SettingBoxWindowViewModel>();
|
||||
|
||||
//操作记录
|
||||
containerRegistry.RegisterForNavigation<MachineRecordWindow, MachineRecordWindowViewModel>();
|
||||
//温湿度记录
|
||||
containerRegistry.RegisterForNavigation<WSDRecordWindow, WSDRecordWindowViewModel>();
|
||||
|
||||
#endregion
|
||||
|
||||
// 设备记录页面
|
||||
|
|
|
@ -70,6 +70,8 @@
|
|||
<PackageReference Include="log4net" Version="2.0.15" />
|
||||
<PackageReference Include="MaterialDesignThemes" Version="4.8.0" />
|
||||
<PackageReference Include="Microsoft.Xaml.Behaviors.Wpf" Version="1.1.39" />
|
||||
<PackageReference Include="NModbus4.NetCore" Version="2.0.1" />
|
||||
<PackageReference Include="Polly" Version="8.4.1" />
|
||||
<PackageReference Include="Prism.Unity" Version="8.1.97" />
|
||||
<PackageReference Include="SqlSugarCore" Version="5.1.4.67" />
|
||||
<PackageReference Include="SuperSimpleTcp" Version="3.0.10" />
|
||||
|
|
|
@ -0,0 +1,32 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using SqlSugar;
|
||||
|
||||
namespace DM_Weight.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// 温湿度
|
||||
/// </summary>
|
||||
[SugarTable("temperature_humidity")]
|
||||
public class TemperatureHumidityInfo
|
||||
{
|
||||
|
||||
[SugarColumn(ColumnName = "id", IsPrimaryKey = true)]
|
||||
public int ID { get; set; }
|
||||
|
||||
[SugarColumn(ColumnName = "groupNo")]
|
||||
public string GroupNo { get; set; }
|
||||
|
||||
[SugarColumn(ColumnName = "temp")]
|
||||
public string Temp { get; set; }
|
||||
|
||||
[SugarColumn(ColumnName = "humi")]
|
||||
public string Humi { get; set; }
|
||||
|
||||
[SugarColumn(ColumnName = "addTime")]
|
||||
public DateTime AddTime { get; set; }
|
||||
}
|
||||
}
|
|
@ -0,0 +1,126 @@
|
|||
using Modbus.Device;
|
||||
using Polly;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Configuration;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Net.Sockets;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace DM_Weight.Port
|
||||
{
|
||||
public class ModbusHelper
|
||||
{
|
||||
private ModbusIpMaster master;
|
||||
private Socket socket;
|
||||
private TcpClient client;
|
||||
private static ModbusHelper instance;
|
||||
private static readonly object objLock = new object();
|
||||
public ModbusHelper()
|
||||
{
|
||||
socket = MakeKeepALiveSocket();
|
||||
client = new TcpClient();
|
||||
client.Client = socket;
|
||||
master = ModbusIpMaster.CreateIp(client);
|
||||
|
||||
}
|
||||
public static ModbusHelper GetInstance()
|
||||
{
|
||||
if (instance == null)
|
||||
{
|
||||
lock (objLock)
|
||||
{
|
||||
if (instance == null)
|
||||
instance = new ModbusHelper();
|
||||
}
|
||||
}
|
||||
|
||||
return instance;
|
||||
}
|
||||
private void SetModusIpMaster()
|
||||
{
|
||||
Debug.WriteLine("SetModusIpMaster");
|
||||
socket = MakeKeepALiveSocket();
|
||||
client = new TcpClient();
|
||||
client.Client = socket;
|
||||
master = ModbusIpMaster.CreateIp(client);
|
||||
}
|
||||
|
||||
public bool[] GetAllBoxState()
|
||||
{
|
||||
bool[] bools = Policy.Handle<Exception>()
|
||||
.Retry(3, (exception, retryCount) =>
|
||||
{
|
||||
this.Dispose();
|
||||
Debug.WriteLine($"获取所有箱子门状态出错,第{retryCount}次重试", exception);
|
||||
this.SetModusIpMaster();
|
||||
// return TimeSpan.FromSeconds (1);
|
||||
}).Execute<bool[]>(() =>
|
||||
{
|
||||
bool[] flags = new bool[18];
|
||||
var result = master.ReadInputRegisters(1, 0x0033, 2);
|
||||
var r1 = Convert.ToString(((int)result[0] >> 14) | ((int)result[1] << 2), 2).PadLeft(18, '0');
|
||||
var r2 = r1.ToCharArray();
|
||||
Debug.WriteLine("r2=>" + string.Join(", ", r2));
|
||||
for (int i = 0; i < 18; i++)
|
||||
{
|
||||
flags[i] = r2[17 - i] == '1' ? true : false;
|
||||
}
|
||||
return flags;
|
||||
});
|
||||
return bools;
|
||||
}
|
||||
public void OpenBoxDoor(int boxNum)
|
||||
{
|
||||
Policy.Handle<Exception>().Retry(3, ((exception, retryCount) =>
|
||||
{
|
||||
this.Dispose();
|
||||
Debug.WriteLine($"打开箱子出错,第{retryCount}次重试", exception);
|
||||
this.SetModusIpMaster();
|
||||
//return TimeSpan.FromSeconds (1);
|
||||
})).Execute(() =>
|
||||
{
|
||||
master.WriteSingleRegister(1, (ushort)boxNum, 14);
|
||||
Console.WriteLine($"开门指令已发送{(ushort)boxNum}");
|
||||
});
|
||||
}
|
||||
private void Dispose()
|
||||
{
|
||||
socket.Shutdown(SocketShutdown.Both);
|
||||
socket.Close();
|
||||
client.Close();
|
||||
master.Dispose();
|
||||
}
|
||||
public static Socket MakeKeepALiveSocket()
|
||||
{
|
||||
uint dummy = 0;
|
||||
byte[] inOptionValues = new byte[Marshal.SizeOf(dummy) * 3];
|
||||
BitConverter.GetBytes((uint)1).CopyTo(inOptionValues, 0);//启用Keep-Alive
|
||||
BitConverter.GetBytes((uint)10000).CopyTo(inOptionValues, Marshal.SizeOf(dummy));//在这个时间间隔内没有数据交互,则发送探测包
|
||||
BitConverter.GetBytes((uint)10000).CopyTo(inOptionValues, Marshal.SizeOf(dummy) * 2);//发探测包时间间隔
|
||||
//IPEndPoint iep = new IPEndPoint(IPAddress.Parse("192.168.1.13"), 502);
|
||||
string modbusIp = ConfigurationManager.AppSettings["modbusIp"].ToString();
|
||||
int modbusPort =Convert.ToInt32(ConfigurationManager.AppSettings["modbusPort"]);
|
||||
IPEndPoint iep = new IPEndPoint(IPAddress.Parse(modbusIp), modbusPort);
|
||||
Socket _socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
|
||||
_socket = Policy.Handle<Exception>()
|
||||
.Retry(3, (exception, retryCount) =>
|
||||
{
|
||||
Console.WriteLine($"建立Socket,第{retryCount}次重试", exception);
|
||||
// return TimeSpan.FromSeconds (1);
|
||||
})
|
||||
.Execute<Socket>(() =>
|
||||
{
|
||||
_socket.IOControl(IOControlCode.KeepAliveValues, inOptionValues, null);
|
||||
_socket.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.KeepAlive, true);
|
||||
_socket.Connect(iep);
|
||||
return _socket;
|
||||
});
|
||||
return _socket;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -29,6 +29,9 @@ using System.Runtime.InteropServices;
|
|||
using DM_Weight.Common;
|
||||
using System.Net;
|
||||
using System.Text.RegularExpressions;
|
||||
using Modbus.Device;
|
||||
using Polly;
|
||||
using DM_Weight.Models;
|
||||
|
||||
namespace DM_Weight.Port
|
||||
{
|
||||
|
@ -46,6 +49,9 @@ namespace DM_Weight.Port
|
|||
// 冰箱串口
|
||||
public SerialPort fridgeSerial;
|
||||
|
||||
// 温湿度串口
|
||||
public SerialPort wsdSerial;
|
||||
|
||||
|
||||
// 抽屉串口协议232 | 485
|
||||
private int _drawerProtocol = Convert.ToInt32(ConfigurationManager.AppSettings["DrawerProtocol"]);
|
||||
|
@ -167,7 +173,7 @@ namespace DM_Weight.Port
|
|||
{
|
||||
_eventAggregator.GetEvent<PortUtilEvent>().Publish(new util.DeviceMsg()
|
||||
{
|
||||
EventType = util.EventType.OPENERROR,
|
||||
EventType = util.EventType.OPENERROR,
|
||||
Message = $"打开药箱异常{ex.Message}"
|
||||
});
|
||||
logger.Info($"打开药箱{DrawerNo}异常:{ex.Message}");
|
||||
|
@ -743,6 +749,18 @@ namespace DM_Weight.Port
|
|||
}
|
||||
|
||||
}
|
||||
try
|
||||
{
|
||||
string wsdSerialPort = ConfigurationManager.AppSettings["wsdSerialPort"];
|
||||
logger.Info($"打开温湿度串口【{wsdSerialPort}】");
|
||||
wsdSerial = new SerialPort(wsdSerialPort, 9600, Parity.None, 8);
|
||||
wsdSerial.Open();
|
||||
logger.Info($"温湿度串口打开结果【{wsdSerial.IsOpen}】");
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
logger.Error("温湿度串口打开错误" + e.Message);
|
||||
}
|
||||
_chkFunction = chkFunction;
|
||||
}
|
||||
|
||||
|
@ -1856,7 +1874,36 @@ namespace DM_Weight.Port
|
|||
}
|
||||
//FridgeOperate = false;
|
||||
}
|
||||
#endregion
|
||||
#endregion
|
||||
|
||||
#region 温湿度
|
||||
public TemperatureHumidityInfo GetWSD()
|
||||
{
|
||||
TemperatureHumidityInfo temperatureHumidityInfo = new TemperatureHumidityInfo();
|
||||
var master = ModbusSerialMaster.CreateRtu(wsdSerial);
|
||||
int no = 1;
|
||||
var r = master.ReadHoldingRegisters((byte)no, 00, 2);
|
||||
|
||||
if (r != null && r.Length > 0)
|
||||
{
|
||||
var result = string.Join("", r);
|
||||
var result1 = result.Substring(0, 3);
|
||||
var result2 = result.Substring(3, 3);
|
||||
float temp = Int32.Parse(result2) / 10.0F;
|
||||
float humi = Int32.Parse(result1) / 10.0F;
|
||||
temperatureHumidityInfo.GroupNo = "DM5";
|
||||
temperatureHumidityInfo.Temp = temp.ToString();
|
||||
temperatureHumidityInfo.Humi = humi.ToString();
|
||||
|
||||
}
|
||||
//if (wsdSerial.IsOpen)
|
||||
//{
|
||||
// wsdSerial.Close();
|
||||
//}
|
||||
master.Dispose();
|
||||
return temperatureHumidityInfo;
|
||||
}
|
||||
#endregion
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,92 @@
|
|||
using DM_Weight.Models;
|
||||
using log4net.Repository.Hierarchy;
|
||||
using Modbus.Device;
|
||||
using Polly;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO.Ports;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace DM_Weight.Port
|
||||
{
|
||||
public class TemperatureHumidityJob
|
||||
{
|
||||
|
||||
public TemperatureHumidityJob()
|
||||
{
|
||||
//try
|
||||
//{
|
||||
// using (SerialPort serialPort = new SerialPort("com1"))
|
||||
// {
|
||||
// serialPort.BaudRate = 9600;
|
||||
// serialPort.DataBits = 8;
|
||||
// serialPort.Parity = Parity.None;
|
||||
// serialPort.StopBits = StopBits.One;
|
||||
// if (!serialPort.IsOpen)
|
||||
// {
|
||||
// serialPort.Open();
|
||||
// }
|
||||
// var master = ModbusSerialMaster.CreateRtu(wsdSerial);
|
||||
// int no = 1;
|
||||
// switch (Global.CabinetNo)
|
||||
// {
|
||||
// case "1":
|
||||
// no = 1;
|
||||
// break;
|
||||
// case "2":
|
||||
// no = 9;
|
||||
// break;
|
||||
// case "3":
|
||||
// no = 5;
|
||||
// break;
|
||||
// case "4":
|
||||
// no = 3;
|
||||
// break;
|
||||
// case "5":
|
||||
// no = 2;
|
||||
// break;
|
||||
// case "6":
|
||||
// no = 6;
|
||||
// break;
|
||||
// case "7":
|
||||
// no = 8;
|
||||
// break;
|
||||
// case "8":
|
||||
// no = 4;
|
||||
// break;
|
||||
// case "9":
|
||||
// no = 7;
|
||||
// break;
|
||||
|
||||
// }
|
||||
// var r = master.ReadHoldingRegisters((byte)no, 00, 2);
|
||||
|
||||
// if (r != null && r.Length > 0)
|
||||
// {
|
||||
// var result = string.Join("", r);
|
||||
// var result1 = result.Substring(0, 3);
|
||||
// var result2 = result.Substring(3, 3);
|
||||
// float temp = Int32.Parse(result2) / 10.0F;
|
||||
// float humi = Int32.Parse(result1) / 10.0F;
|
||||
// TemperatureHumidityInfo temperatureHumidityInfo = new TemperatureHumidityInfo();
|
||||
// temperatureHumidityInfo.GroupNo = "DM1"
|
||||
// temperatureHumidityInfo.Temp = temp;
|
||||
// temperatureHumidityInfo.Humi = humi;
|
||||
// _temperatureHumidityService.SaveTemperatureAndHumidity(temperatureHumidityInfo);
|
||||
// }
|
||||
// if (serialPort.IsOpen)
|
||||
// {
|
||||
// serialPort.Close();
|
||||
// }
|
||||
// master.Dispose();
|
||||
// }
|
||||
//}
|
||||
//catch (Exception ex)
|
||||
//{
|
||||
// logger.LogError(ex.Message);
|
||||
//}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -88,22 +88,22 @@ namespace DM_Weight.ViewModels
|
|||
private bool _isEnable = true;
|
||||
public bool IsEnable { get => _isEnable; set => SetProperty(ref _isEnable, value); }
|
||||
private int _status = 0;
|
||||
public int Status { get => _status; set { SetProperty(ref _status, value); } }
|
||||
public int Status { get => _status; set { SetProperty(ref _status, value); } }
|
||||
|
||||
|
||||
|
||||
public bool KeepAlive => false;
|
||||
//抽屉号列表
|
||||
public static List<int> iList = new List<int>();
|
||||
//第几个抽屉号
|
||||
public static int iNumber = 1;
|
||||
//第几个抽屉号下标
|
||||
//public static int iNumber = 0;
|
||||
|
||||
private PortUtil _portUtil;
|
||||
//private PortUtil _portUtil;
|
||||
IEventAggregator _eventAggregator;
|
||||
public BindBoxPackageWindowViewModel(PortUtil portUtil, IEventAggregator eventAggregator)
|
||||
public BindBoxPackageWindowViewModel(IEventAggregator eventAggregator)
|
||||
{
|
||||
vm = this;
|
||||
_portUtil = portUtil;
|
||||
//_portUtil = portUtil;
|
||||
_eventAggregator = eventAggregator;
|
||||
}
|
||||
|
||||
|
@ -120,13 +120,16 @@ namespace DM_Weight.ViewModels
|
|||
{
|
||||
Channels = list;
|
||||
}
|
||||
else
|
||||
{
|
||||
Channels = null;
|
||||
}
|
||||
}
|
||||
|
||||
public void OnNavigatedTo(NavigationContext navigationContext)
|
||||
{
|
||||
RequestDrug();
|
||||
RequestData();
|
||||
_eventAggregator.GetEvent<PortUtilEvent>().Subscribe(DoMyPrismEvent);
|
||||
}
|
||||
|
||||
public bool IsNavigationTarget(NavigationContext navigationContext)
|
||||
|
@ -137,7 +140,7 @@ namespace DM_Weight.ViewModels
|
|||
public void OnNavigatedFrom(NavigationContext navigationContext)
|
||||
{
|
||||
// 取消消息订阅
|
||||
_eventAggregator.GetEvent<PortUtilEvent>().Unsubscribe(DoMyPrismEvent);
|
||||
//_eventAggregator.GetEvent<PortUtilEvent>().Unsubscribe(DoMyPrismEvent);
|
||||
}
|
||||
|
||||
|
||||
|
@ -190,10 +193,10 @@ namespace DM_Weight.ViewModels
|
|||
}
|
||||
var f = SqlSugarHelper.Db.UseTran(() =>
|
||||
{
|
||||
string chnguid=SqlSugarHelper.Db.Queryable<ChannelList>().Where(cs => cs.MachineId == ConfigurationManager.AppSettings[""].ToString()&&cs.DrawerNo==DrawerNo).Select(cs=>cs.Id).First();
|
||||
string chnguid = SqlSugarHelper.Db.Queryable<ChannelList>().Where(cs => cs.MachineId == ConfigurationManager.AppSettings["machineId"].ToString() && cs.DrawerNo == DrawerNo).Select(cs => cs.Id).First();
|
||||
SqlSugarHelper.Db.Insertable(new ChannelStock()
|
||||
{
|
||||
Chnguid=chnguid,
|
||||
Chnguid = chnguid,
|
||||
DrawerNo = DrawerNo,
|
||||
DrugId = DrugInfo.DrugId.ToString(),
|
||||
BaseQuantity = baseQuantity,
|
||||
|
@ -328,13 +331,33 @@ namespace DM_Weight.ViewModels
|
|||
.Select(cl => cl.DrawerNo).ToList();
|
||||
if (iList.Count > 0)
|
||||
{
|
||||
IsEnable = false;
|
||||
Status = 1;
|
||||
_portUtil.SpeakAsync("正在打开药箱");
|
||||
_portUtil.DrawerNo = iList[iNumber];
|
||||
iNumber++;
|
||||
_portUtil.OpenBox();
|
||||
for (int i = 0; i < iList.Count; i++)
|
||||
{
|
||||
//记录开药箱日志
|
||||
SqlSugarHelper.Db.Insertable(new MachineRecord()
|
||||
{
|
||||
MachineId = "DM5",
|
||||
DrawerNo = DrawerNo,
|
||||
Operator = HomeWindowViewModel.Operator?.Id,
|
||||
OperationTime = DateTime.Now,
|
||||
Type = 55,
|
||||
InvoiceId = $"打开{DrawerNo}号药箱",
|
||||
}).ExecuteCommand();
|
||||
IsEnable = false;
|
||||
Status = 1;
|
||||
Console.WriteLine($"正在打开{iList[i]}号药箱");
|
||||
ModbusHelper.GetInstance().OpenBoxDoor(iList[i]-1);
|
||||
//iNumber++;
|
||||
}
|
||||
|
||||
ModbusHelper.GetInstance().GetAllBoxState();
|
||||
if (Status == 2)
|
||||
{
|
||||
Status = 3;
|
||||
}
|
||||
IsEnable = true;
|
||||
}
|
||||
|
||||
}
|
||||
void DoMyPrismEvent(DeviceMsg msg)
|
||||
{
|
||||
|
@ -346,27 +369,27 @@ namespace DM_Weight.ViewModels
|
|||
SqlSugarHelper.Db.Insertable(new MachineRecord()
|
||||
{
|
||||
MachineId = "DM5",
|
||||
DrawerNo = _portUtil.DrawerNo,
|
||||
//DrawerNo = _portUtil.DrawerNo,
|
||||
Operator = HomeWindowViewModel.Operator?.Id,
|
||||
OperationTime = DateTime.Now,
|
||||
Type = 55,
|
||||
InvoiceId = "药箱打开",
|
||||
}).ExecuteCommand();
|
||||
|
||||
if (iNumber < iList.Count)
|
||||
//if (iNumber < iList.Count)
|
||||
//{
|
||||
// //_portUtil.DrawerNo = iList[iNumber];
|
||||
// iNumber++;
|
||||
// if (Status == 1)
|
||||
// {
|
||||
// Status = 2;
|
||||
// }
|
||||
// //_portUtil.OpenBox();
|
||||
//}
|
||||
//else
|
||||
{
|
||||
_portUtil.DrawerNo = iList[iNumber];
|
||||
iNumber++;
|
||||
if (Status == 1)
|
||||
{
|
||||
Status = 2;
|
||||
}
|
||||
_portUtil.OpenBox();
|
||||
}
|
||||
else
|
||||
{
|
||||
iNumber = 0;
|
||||
_portUtil.GetBoxStatus();
|
||||
//iNumber = 0;
|
||||
//_portUtil.GetBoxStatus();
|
||||
}
|
||||
break;
|
||||
// 药箱关闭
|
||||
|
@ -375,7 +398,7 @@ namespace DM_Weight.ViewModels
|
|||
SqlSugarHelper.Db.Insertable(new MachineRecord()
|
||||
{
|
||||
MachineId = "DM5",
|
||||
DrawerNo = _portUtil.DrawerNo,
|
||||
//DrawerNo = _portUtil.DrawerNo,
|
||||
Operator = HomeWindowViewModel.Operator?.Id,
|
||||
OperationTime = DateTime.Now,
|
||||
Type = 55,
|
||||
|
@ -388,7 +411,7 @@ namespace DM_Weight.ViewModels
|
|||
}
|
||||
IsEnable = true;
|
||||
DrawerNo = -1;
|
||||
_portUtil.Operate = false;
|
||||
//_portUtil.Operate = false;
|
||||
break;
|
||||
// 打开失败
|
||||
case EventType.OPENERROR:
|
||||
|
@ -407,13 +430,13 @@ namespace DM_Weight.ViewModels
|
|||
SqlSugarHelper.Db.Insertable(new MachineRecord()
|
||||
{
|
||||
MachineId = "DM5",
|
||||
DrawerNo = _portUtil.DrawerNo,
|
||||
//DrawerNo = _portUtil.DrawerNo,
|
||||
Operator = HomeWindowViewModel.Operator?.Id,
|
||||
OperationTime = DateTime.Now,
|
||||
Type = 55,
|
||||
InvoiceId = "药箱打开失败",
|
||||
}).ExecuteCommand();
|
||||
_portUtil.Operate = false;
|
||||
//_portUtil.Operate = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -168,6 +168,10 @@ namespace DM_Weight.ViewModels
|
|||
OrderInfoList.ForEach(oi => oi.ItemIsChecked = true);
|
||||
TotalDrugList = OrderInfoList.Where(oi => oi.ItemIsChecked).GroupBy(oi => oi._OrderDetail.DrugInfo.DrugName).Select(oi => new TotalDrug { DrugName = oi.Key, TotalCount = oi.Sum(item => item._OrderDetail.Quantity) }).ToList();
|
||||
}
|
||||
else
|
||||
{
|
||||
TotalDrugList = null;
|
||||
}
|
||||
|
||||
TotalCount = totalCount;
|
||||
PageCount = (int)Math.Ceiling((double)TotalCount / PageSize);
|
||||
|
@ -420,22 +424,31 @@ namespace DM_Weight.ViewModels
|
|||
|
||||
public async void OpenBoxAction(string strDrawerNo)
|
||||
{
|
||||
DrawerNo = Convert.ToInt32(strDrawerNo);
|
||||
DrawerNo = Convert.ToInt32(strDrawerNo)-1;
|
||||
if (DrawerNo > 0)
|
||||
{
|
||||
RequestData();
|
||||
IsEnable = false;
|
||||
Status = 1;
|
||||
_portUtil.SpeakAsync("正在打开药箱");
|
||||
_portUtil.DrawerNo = DrawerNo;
|
||||
_portUtil.OpenBox();
|
||||
_portUtil.SpeakAsync($"正在打开{DrawerNo}号药箱");
|
||||
//记录开药箱日志
|
||||
SqlSugarHelper.Db.Insertable(new MachineRecord()
|
||||
{
|
||||
MachineId = "DM5",
|
||||
DrawerNo = DrawerNo,
|
||||
Operator = HomeWindowViewModel.Operator?.Id,
|
||||
OperationTime = DateTime.Now,
|
||||
Type = 55,
|
||||
InvoiceId = $"打开{DrawerNo}号药箱",
|
||||
}).ExecuteCommand();
|
||||
ModbusHelper.GetInstance().OpenBoxDoor(DrawerNo);
|
||||
}
|
||||
}
|
||||
|
||||
public void OnNavigatedTo(NavigationContext navigationContext)
|
||||
{
|
||||
RequestData();
|
||||
_eventAggregator.GetEvent<PortUtilEvent>().Subscribe(DoMyPrismEvent);
|
||||
//_eventAggregator.GetEvent<PortUtilEvent>().Subscribe(DoMyPrismEvent);
|
||||
}
|
||||
|
||||
public bool IsNavigationTarget(NavigationContext navigationContext)
|
||||
|
@ -446,7 +459,7 @@ namespace DM_Weight.ViewModels
|
|||
public void OnNavigatedFrom(NavigationContext navigationContext)
|
||||
{
|
||||
// 取消消息订阅
|
||||
_eventAggregator.GetEvent<PortUtilEvent>().Unsubscribe(DoMyPrismEvent);
|
||||
//_eventAggregator.GetEvent<PortUtilEvent>().Unsubscribe(DoMyPrismEvent);
|
||||
}
|
||||
void DoMyPrismEvent(DeviceMsg msg)
|
||||
{
|
||||
|
@ -466,7 +479,7 @@ namespace DM_Weight.ViewModels
|
|||
Operator = HomeWindowViewModel.Operator?.Id,
|
||||
OperationTime = DateTime.Now,
|
||||
Type = 55,
|
||||
InvoiceId = "药箱打开",
|
||||
InvoiceId = $"打开{DrawerNo}号药箱",
|
||||
}).ExecuteCommand();
|
||||
_portUtil.GetBoxStatus();
|
||||
break;
|
||||
|
|
|
@ -43,6 +43,8 @@ namespace DM_Weight.ViewModels
|
|||
public string WD { get => _wd; set => SetProperty(ref _wd, value); }
|
||||
System.Timers.Timer WDTimer;
|
||||
|
||||
System.Timers.Timer WSDTimer;
|
||||
|
||||
/// <summary>
|
||||
/// 是否有冰箱抽屉
|
||||
/// </summary>
|
||||
|
@ -320,6 +322,24 @@ namespace DM_Weight.ViewModels
|
|||
}
|
||||
}
|
||||
}
|
||||
//保存温湿度信息
|
||||
private async void GetWSD(object sender,ElapsedEventArgs e)
|
||||
{
|
||||
TemperatureHumidityInfo temp = _portUtil.GetWSD();
|
||||
if(temp != null)
|
||||
{
|
||||
SqlSugarHelper.Db.Insertable(new TemperatureHumidityInfo()
|
||||
{
|
||||
GroupNo = temp.GroupNo,
|
||||
Temp = temp.Temp,
|
||||
Humi = temp.Humi,
|
||||
AddTime = temp.AddTime
|
||||
}).ExecuteCommand();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 将收到的返回转换成具体温度数值
|
||||
/// </summary>
|
||||
|
@ -436,20 +456,19 @@ namespace DM_Weight.ViewModels
|
|||
};
|
||||
timer.Start();
|
||||
}
|
||||
//#region 温度查询定时
|
||||
//int interval = Convert.ToInt32(ConfigurationManager.AppSettings["Interval"]);
|
||||
//if (interval > 0)
|
||||
//{
|
||||
// WDTimer = new System.Timers.Timer();
|
||||
#region 温度查询定时
|
||||
int interval = Convert.ToInt32(ConfigurationManager.AppSettings["Interval"]);
|
||||
if (interval > 0)
|
||||
{
|
||||
WSDTimer = new System.Timers.Timer();
|
||||
|
||||
// WDTimer.Elapsed += new System.Timers.ElapsedEventHandler(GetWD);
|
||||
// WDTimer.Interval = interval;
|
||||
// //WDTimer.Start();
|
||||
// //WDTimer.AutoReset = true;
|
||||
// //WDTimer.Enabled = true;
|
||||
//}
|
||||
//#endregion
|
||||
//GetWD();
|
||||
WSDTimer.Elapsed += new System.Timers.ElapsedEventHandler(GetWSD);
|
||||
WSDTimer.Interval = interval;
|
||||
WSDTimer.Start();
|
||||
//WDTimer.AutoReset = true;
|
||||
//WDTimer.Enabled = true;
|
||||
}
|
||||
#endregion
|
||||
if (stopRecord > 0)
|
||||
{
|
||||
System.Timers.Timer timer = new System.Timers.Timer();
|
||||
|
|
|
@ -95,6 +95,11 @@ namespace DM_Weight.ViewModels
|
|||
{
|
||||
get => !_portUtil.fridgeSerial.IsOpen;
|
||||
}
|
||||
//温湿度
|
||||
public bool WSDPortMsg
|
||||
{
|
||||
get => !_portUtil.wsdSerial.IsOpen;
|
||||
}
|
||||
//录像机登录状态
|
||||
private bool _hikMsg;
|
||||
public bool HIKMsg
|
||||
|
|
|
@ -0,0 +1,144 @@
|
|||
using DM_Weight.Models;
|
||||
using DM_Weight.util;
|
||||
using Prism.Commands;
|
||||
using Prism.Events;
|
||||
using Prism.Mvvm;
|
||||
using Prism.Regions;
|
||||
using SqlSugar;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Configuration;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace DM_Weight.ViewModels
|
||||
{
|
||||
internal class MachineRecordWindowViewModel : BindableBase, INavigationAware, IRegionMemberLifetime
|
||||
{
|
||||
private int _pageNum = 1;
|
||||
public int PageNum
|
||||
{
|
||||
get => _pageNum;
|
||||
set
|
||||
{
|
||||
SetProperty(ref _pageNum, value);
|
||||
RequestData();
|
||||
}
|
||||
}
|
||||
|
||||
private int _pageCount = 1;
|
||||
public int PageCount
|
||||
{
|
||||
get => _pageCount;
|
||||
set
|
||||
{
|
||||
SetProperty(ref _pageCount, value);
|
||||
}
|
||||
}
|
||||
|
||||
private int _pageSize = 8;
|
||||
public int PageSize
|
||||
{
|
||||
get => _pageSize;
|
||||
set
|
||||
{
|
||||
SetProperty(ref _pageSize, value);
|
||||
}
|
||||
}
|
||||
|
||||
private int _totalCount = 0;
|
||||
public int TotalCount
|
||||
{
|
||||
get => _totalCount;
|
||||
set
|
||||
{
|
||||
SetProperty(ref _totalCount, value);
|
||||
}
|
||||
}
|
||||
private DateTime? _startDate = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day);
|
||||
|
||||
public DateTime? StartDate
|
||||
{
|
||||
get => _startDate;
|
||||
set
|
||||
{
|
||||
if (value != null)
|
||||
{
|
||||
SetProperty(ref _startDate, new DateTime(value?.Year ?? 0, value?.Month ?? 0, value?.Day ?? 0));
|
||||
}
|
||||
else
|
||||
{
|
||||
SetProperty(ref _startDate, value);
|
||||
}
|
||||
RequestData();
|
||||
}
|
||||
}
|
||||
|
||||
private DateTime? _endDate = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, 23, 59, 59);
|
||||
|
||||
public DateTime? EndDate
|
||||
{
|
||||
get => _endDate;
|
||||
set
|
||||
{
|
||||
if (value != null)
|
||||
{
|
||||
TimeSpan ershisi = new TimeSpan(23, 59, 59);
|
||||
SetProperty(ref _endDate, new DateTime(value?.Year ?? 0, value?.Month ?? 0, value?.Day ?? 0, 23, 59, 59));
|
||||
}
|
||||
else
|
||||
{
|
||||
SetProperty(ref _endDate, value);
|
||||
}
|
||||
|
||||
RequestData();
|
||||
}
|
||||
}
|
||||
private List<MachineRecord>? machineRecords;
|
||||
|
||||
public List<MachineRecord>? MachineRecords
|
||||
{
|
||||
get { return machineRecords; }
|
||||
set { SetProperty(ref machineRecords, value); }
|
||||
}
|
||||
public DelegateCommand Query
|
||||
{
|
||||
get => new DelegateCommand(() =>
|
||||
{
|
||||
RequestData();
|
||||
});
|
||||
}
|
||||
public bool KeepAlive => false;
|
||||
|
||||
public bool IsNavigationTarget(NavigationContext navigationContext)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public void OnNavigatedFrom(NavigationContext navigationContext)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void OnNavigatedTo(NavigationContext navigationContext)
|
||||
{
|
||||
//查询表格数据
|
||||
RequestData();
|
||||
}
|
||||
void RequestData()
|
||||
{
|
||||
int totalCount = 0;
|
||||
string machineId = ConfigurationManager.AppSettings["machineId"] ?? "DM5";
|
||||
MachineRecords = SqlSugarHelper.Db.Queryable<MachineRecord>()
|
||||
.Includes<DrugInfo>(mr => mr.DrugInfo)
|
||||
.Includes<UserList>(mr => mr.User)
|
||||
.Where(mr => mr.MachineId == machineId)
|
||||
.WhereIF(StartDate != null, (mr) => mr.OperationTime > StartDate)
|
||||
.WhereIF(EndDate != null, (mr) => mr.OperationTime < EndDate).OrderByDescending(mr=>mr.OperationTime)
|
||||
.ToPageList(PageNum, PageSize, ref totalCount);
|
||||
//.ToList();
|
||||
TotalCount = totalCount;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -2,6 +2,7 @@
|
|||
using DM_Weight.msg;
|
||||
using DM_Weight.Port;
|
||||
using DM_Weight.util;
|
||||
using log4net;
|
||||
using log4net.Repository.Hierarchy;
|
||||
using Prism.Commands;
|
||||
using Prism.Events;
|
||||
|
@ -19,6 +20,7 @@ namespace DM_Weight.ViewModels
|
|||
{
|
||||
public class OpenBoxWindowViewModel : BindableBase, INavigationAware, IRegionMemberLifetime
|
||||
{
|
||||
private readonly ILog logger = LogManager.GetLogger(typeof(CheckOrderNewWindowViewModel));
|
||||
private int _drawerNo = -1;
|
||||
|
||||
public int DrawerNo
|
||||
|
@ -50,10 +52,10 @@ namespace DM_Weight.ViewModels
|
|||
//抽屉号列表
|
||||
public static List<int> iList = new List<int>();
|
||||
//第几个抽屉号
|
||||
public static int iNumber = 1;
|
||||
//public static int iNumber = 1;
|
||||
private PortUtil _portUtil;
|
||||
IEventAggregator _eventAggregator;
|
||||
public OpenBoxWindowViewModel(PortUtil portUtil, IEventAggregator eventAggregator)
|
||||
public OpenBoxWindowViewModel(PortUtil portUtil,IEventAggregator eventAggregator)
|
||||
{
|
||||
_portUtil = portUtil;
|
||||
_eventAggregator = eventAggregator;
|
||||
|
@ -81,14 +83,38 @@ namespace DM_Weight.ViewModels
|
|||
private void SearchBox()
|
||||
{
|
||||
iList = SqlSugarHelper.Db.Queryable<ChannelList>().Where(cl => cl.MachineId == "DM5" && cl.DrawerType == this.DrawerNo)
|
||||
.WhereIF(this.DrawerNo==0,cl=> cl.BelongUser == HomeWindowViewModel.Operator.UserName)
|
||||
.WhereIF(this.DrawerNo==0,cl=> cl.BelongUser == HomeWindowViewModel.Operator.UserBarcode)
|
||||
.Select(cl => cl.DrawerNo).ToList();
|
||||
if (iList.Count > 0)
|
||||
{
|
||||
_portUtil.SpeakAsync("正在打开药箱");
|
||||
_portUtil.DrawerNo = iList[iNumber];
|
||||
iNumber++;
|
||||
_portUtil.OpenBox();
|
||||
//_portUtil.SpeakAsync("正在打开药箱");
|
||||
//_portUtil.DrawerNo = iList[iNumber];
|
||||
//iNumber++;
|
||||
//_portUtil.OpenBox();
|
||||
logger.Info("");
|
||||
|
||||
for (int i = 0; i < iList.Count; i++)
|
||||
{
|
||||
//记录开药箱日志
|
||||
SqlSugarHelper.Db.Insertable(new MachineRecord()
|
||||
{
|
||||
MachineId = "DM5",
|
||||
DrawerNo = iList[i],
|
||||
Operator = HomeWindowViewModel.Operator?.Id,
|
||||
OperationTime = DateTime.Now,
|
||||
Type = 55,
|
||||
InvoiceId = $"打开{iList[i]}号药箱",
|
||||
}).ExecuteCommand();
|
||||
_portUtil.SpeakAsync($"正在打开{iList[i]}号药箱");
|
||||
ModbusHelper.GetInstance().OpenBoxDoor(iList[i] - 1);
|
||||
Thread.Sleep(1000);
|
||||
}
|
||||
|
||||
PublicStatus = 0;
|
||||
SelfStatus = 0;
|
||||
PublicEnable = true;
|
||||
SelfEnable = true;
|
||||
DrawerNo = -1;
|
||||
}
|
||||
}
|
||||
void DoMyPrismEvent(DeviceMsg msg)
|
||||
|
@ -101,17 +127,17 @@ namespace DM_Weight.ViewModels
|
|||
SqlSugarHelper.Db.Insertable(new MachineRecord()
|
||||
{
|
||||
MachineId = "DM5",
|
||||
DrawerNo = _portUtil.DrawerNo,
|
||||
//DrawerNo = _portUtil.DrawerNo,
|
||||
Operator = HomeWindowViewModel.Operator?.Id,
|
||||
OperationTime = DateTime.Now,
|
||||
Type = 55,
|
||||
InvoiceId = "药箱打开",
|
||||
}).ExecuteCommand();
|
||||
|
||||
if (iNumber < iList.Count)
|
||||
{
|
||||
_portUtil.DrawerNo = iList[iNumber];
|
||||
iNumber++;
|
||||
//if (iNumber < iList.Count)
|
||||
//{
|
||||
//_portUtil.DrawerNo = iList[iNumber];
|
||||
//iNumber++;
|
||||
if(PublicStatus==1)
|
||||
{
|
||||
PublicStatus = 2;
|
||||
|
@ -120,13 +146,13 @@ namespace DM_Weight.ViewModels
|
|||
{
|
||||
SelfStatus = 2;
|
||||
}
|
||||
_portUtil.OpenBox();
|
||||
}
|
||||
else
|
||||
{
|
||||
iNumber = 0;
|
||||
_portUtil.GetBoxStatus();
|
||||
}
|
||||
//_portUtil.OpenBox();
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
//iNumber = 0;
|
||||
//_portUtil.GetBoxStatus();
|
||||
//}
|
||||
break;
|
||||
// 药箱关闭
|
||||
case EventType.DRAWERCLOSE:
|
||||
|
@ -134,7 +160,7 @@ namespace DM_Weight.ViewModels
|
|||
SqlSugarHelper.Db.Insertable(new MachineRecord()
|
||||
{
|
||||
MachineId = "DM5",
|
||||
DrawerNo = _portUtil.DrawerNo,
|
||||
//DrawerNo = _portUtil.DrawerNo,
|
||||
Operator = HomeWindowViewModel.Operator?.Id,
|
||||
OperationTime = DateTime.Now,
|
||||
Type = 55,
|
||||
|
@ -152,7 +178,7 @@ namespace DM_Weight.ViewModels
|
|||
PublicEnable = true;
|
||||
SelfEnable = true;
|
||||
DrawerNo = -1;
|
||||
_portUtil.Operate = false;
|
||||
//_portUtil.Operate = false;
|
||||
break;
|
||||
// 打开失败
|
||||
case EventType.OPENERROR:
|
||||
|
@ -173,13 +199,13 @@ namespace DM_Weight.ViewModels
|
|||
SqlSugarHelper.Db.Insertable(new MachineRecord()
|
||||
{
|
||||
MachineId = "DM5",
|
||||
DrawerNo = _portUtil.DrawerNo,
|
||||
//DrawerNo = _portUtil.DrawerNo,
|
||||
Operator = HomeWindowViewModel.Operator?.Id,
|
||||
OperationTime = DateTime.Now,
|
||||
Type = 55,
|
||||
InvoiceId = "药箱打开失败",
|
||||
}).ExecuteCommand();
|
||||
_portUtil.Operate = false;
|
||||
//_portUtil.Operate = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -193,12 +219,12 @@ namespace DM_Weight.ViewModels
|
|||
public void OnNavigatedFrom(NavigationContext navigationContext)
|
||||
{
|
||||
// 取消消息订阅
|
||||
_eventAggregator.GetEvent<PortUtilEvent>().Unsubscribe(DoMyPrismEvent);
|
||||
//_eventAggregator.GetEvent<PortUtilEvent>().Unsubscribe(DoMyPrismEvent);
|
||||
}
|
||||
|
||||
public void OnNavigatedTo(NavigationContext navigationContext)
|
||||
{
|
||||
_eventAggregator.GetEvent<PortUtilEvent>().Subscribe(DoMyPrismEvent);
|
||||
//_eventAggregator.GetEvent<PortUtilEvent>().Subscribe(DoMyPrismEvent);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -456,6 +456,18 @@ namespace DM_Weight.ViewModels
|
|||
PremissionName = "药箱设置",
|
||||
PremissionPath = "SettingBoxWindow",
|
||||
};
|
||||
PremissionDm machineRecord= new PremissionDm
|
||||
{
|
||||
Id = 54,
|
||||
PremissionName = "操作记录",
|
||||
PremissionPath = "MachineRecordWindow",
|
||||
};
|
||||
PremissionDm wSDRecord= new PremissionDm
|
||||
{
|
||||
Id = 54,
|
||||
PremissionName = "温湿度记录",
|
||||
PremissionPath = "WSDRecordWindow",
|
||||
};
|
||||
//PremissionDm sysset3;
|
||||
//if (Convert.ToInt32(ConfigurationManager.AppSettings["hasFridge"]) > 0)
|
||||
//{
|
||||
|
@ -477,10 +489,13 @@ namespace DM_Weight.ViewModels
|
|||
// PremissionPath = "SettingWindow",
|
||||
// };
|
||||
//}
|
||||
|
||||
syssetChild.Add(sysset1);
|
||||
syssetChild.Add(sysset2);
|
||||
syssetChild.Add(sysset3);
|
||||
syssetChild.Add(settingBox);
|
||||
syssetChild.Add(machineRecord);
|
||||
syssetChild.Add(wSDRecord);
|
||||
sysset.Children = syssetChild;
|
||||
defaultAll.Add(sysset);
|
||||
#endregion
|
||||
|
|
|
@ -9,6 +9,7 @@ using Prism.Regions;
|
|||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Configuration;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
@ -74,16 +75,16 @@ namespace DM_Weight.ViewModels
|
|||
}
|
||||
}
|
||||
|
||||
static List<BindUserList> StaticUserList = SqlSugarHelper.Db.Queryable<UserList>().Where(us => us.MachineId == "DM3").Select(us => new BindUserList() { UserId =Convert.ToInt32(us.UserBarcode), UserName = us.Nickname }).ToList();
|
||||
//static List<BindUserList> StaticUserList = SqlSugarHelper.Db.Queryable<UserList>().Where(us => us.MachineId == "DM3").Select(us => new BindUserList() { UserId =Convert.ToInt32(us.UserBarcode), UserName = us.Nickname }).ToList();
|
||||
//药师
|
||||
private List<BindUserList> _userLists = StaticUserList;
|
||||
private List<BindUserList> _userLists;// = StaticUserList;
|
||||
public List<BindUserList> UserLists
|
||||
{
|
||||
get => _userLists;
|
||||
set => SetProperty(ref _userLists, value);
|
||||
}
|
||||
|
||||
private BindUserList _userListSelectedItem = StaticUserList[0];
|
||||
private BindUserList _userListSelectedItem;// = _userLists[0];
|
||||
public BindUserList UserListSelectedItem { get => _userListSelectedItem; set => SetProperty(ref _userListSelectedItem, value); }
|
||||
|
||||
private PortUtil _portUtil;
|
||||
|
@ -93,6 +94,15 @@ namespace DM_Weight.ViewModels
|
|||
|
||||
_portUtil = portUtil;
|
||||
_eventAggregator = eventAggregator;
|
||||
BindUserList();
|
||||
}
|
||||
private void BindUserList()
|
||||
{
|
||||
if (_userLists == null)
|
||||
{
|
||||
_userLists = SqlSugarHelper.Db.Queryable<UserList>().Where(us => us.MachineId == (ConfigurationManager.AppSettings["machineId"] ??"DM5")).Select(us => new BindUserList() { UserId = Convert.ToInt32(us.UserBarcode), UserName = us.Nickname }).ToList();
|
||||
_userListSelectedItem = _userLists[0];
|
||||
}
|
||||
}
|
||||
public bool KeepAlive => false;
|
||||
|
||||
|
@ -105,7 +115,7 @@ namespace DM_Weight.ViewModels
|
|||
{
|
||||
|
||||
// 取消消息订阅
|
||||
_eventAggregator.GetEvent<PortUtilEvent>().Unsubscribe(DoMyPrismEvent);
|
||||
//_eventAggregator.GetEvent<PortUtilEvent>().Unsubscribe(DoMyPrismEvent);
|
||||
}
|
||||
private void BindBoxTypeList()
|
||||
{
|
||||
|
@ -114,7 +124,7 @@ namespace DM_Weight.ViewModels
|
|||
}
|
||||
public void OnNavigatedTo(NavigationContext navigationContext)
|
||||
{
|
||||
_eventAggregator.GetEvent<PortUtilEvent>().Subscribe(DoMyPrismEvent);
|
||||
//_eventAggregator.GetEvent<PortUtilEvent>().Subscribe(DoMyPrismEvent);
|
||||
}
|
||||
//点击药箱
|
||||
public DelegateCommand<string> UpdateDrawerNo
|
||||
|
@ -133,10 +143,10 @@ namespace DM_Weight.ViewModels
|
|||
{
|
||||
//药箱归属药师,把药师信息显示出来
|
||||
UserStatus = Visibility.Visible;
|
||||
UserListSelectedItem = StaticUserList.Where(sul => sul.UserId.ToString() == cnl.BelongUser).FirstOrDefault();
|
||||
if (UserListSelectedItem == null && StaticUserList != null)
|
||||
UserListSelectedItem = _userLists.Where(sul => sul.UserId.ToString() == cnl.BelongUser).FirstOrDefault();
|
||||
if (UserListSelectedItem == null && _userLists != null)
|
||||
{
|
||||
UserListSelectedItem = StaticUserList[0];
|
||||
UserListSelectedItem = _userLists[0];
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -160,9 +170,20 @@ namespace DM_Weight.ViewModels
|
|||
{
|
||||
IsEnable = false;
|
||||
Status = 1;
|
||||
_portUtil.SpeakAsync("正在打开药箱");
|
||||
_portUtil.DrawerNo = DrawerNo;
|
||||
_portUtil.OpenBox();
|
||||
//_portUtil.SpeakAsync("正在打开药箱");
|
||||
//_portUtil.DrawerNo = DrawerNo;
|
||||
//_portUtil.OpenBox();
|
||||
_portUtil.SpeakAsync($"正在打开{DrawerNo}号药箱");//记录开药箱日志
|
||||
SqlSugarHelper.Db.Insertable(new MachineRecord()
|
||||
{
|
||||
MachineId = "DM5",
|
||||
DrawerNo = DrawerNo,
|
||||
Operator = HomeWindowViewModel.Operator?.Id,
|
||||
OperationTime = DateTime.Now,
|
||||
Type = 55,
|
||||
InvoiceId = $"打开{DrawerNo}号药箱",
|
||||
}).ExecuteCommand();
|
||||
ModbusHelper.GetInstance().OpenBoxDoor(DrawerNo-1);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -273,6 +294,7 @@ namespace DM_Weight.ViewModels
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
/// <summary>
|
||||
/// 药箱类型
|
||||
|
|
|
@ -0,0 +1,126 @@
|
|||
using DM_Weight.Models;
|
||||
using DM_Weight.util;
|
||||
using Prism.Commands;
|
||||
using Prism.Mvvm;
|
||||
using Prism.Regions;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Configuration;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace DM_Weight.ViewModels
|
||||
{
|
||||
public class WSDRecordWindowViewModel : BindableBase, IRegionMemberLifetime
|
||||
{
|
||||
private int _pageNum = 1;
|
||||
public int PageNum
|
||||
{
|
||||
get => _pageNum;
|
||||
set
|
||||
{
|
||||
SetProperty(ref _pageNum, value);
|
||||
RequestData();
|
||||
}
|
||||
}
|
||||
|
||||
private int _pageCount = 1;
|
||||
public int PageCount
|
||||
{
|
||||
get => _pageCount;
|
||||
set
|
||||
{
|
||||
SetProperty(ref _pageCount, value);
|
||||
}
|
||||
}
|
||||
|
||||
private int _pageSize = 8;
|
||||
public int PageSize
|
||||
{
|
||||
get => _pageSize;
|
||||
set
|
||||
{
|
||||
SetProperty(ref _pageSize, value);
|
||||
}
|
||||
}
|
||||
|
||||
private int _totalCount = 0;
|
||||
public int TotalCount
|
||||
{
|
||||
get => _totalCount;
|
||||
set
|
||||
{
|
||||
SetProperty(ref _totalCount, value);
|
||||
}
|
||||
}
|
||||
private DateTime? _startDate = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day);
|
||||
|
||||
public DateTime? StartDate
|
||||
{
|
||||
get => _startDate;
|
||||
set
|
||||
{
|
||||
if (value != null)
|
||||
{
|
||||
SetProperty(ref _startDate, new DateTime(value?.Year ?? 0, value?.Month ?? 0, value?.Day ?? 0));
|
||||
}
|
||||
else
|
||||
{
|
||||
SetProperty(ref _startDate, value);
|
||||
}
|
||||
RequestData();
|
||||
}
|
||||
}
|
||||
|
||||
private DateTime? _endDate = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, 23, 59, 59);
|
||||
|
||||
public DateTime? EndDate
|
||||
{
|
||||
get => _endDate;
|
||||
set
|
||||
{
|
||||
if (value != null)
|
||||
{
|
||||
TimeSpan ershisi = new TimeSpan(23, 59, 59);
|
||||
SetProperty(ref _endDate, new DateTime(value?.Year ?? 0, value?.Month ?? 0, value?.Day ?? 0, 23, 59, 59));
|
||||
}
|
||||
else
|
||||
{
|
||||
SetProperty(ref _endDate, value);
|
||||
}
|
||||
|
||||
RequestData();
|
||||
}
|
||||
}
|
||||
private List<TemperatureHumidityInfo>? _temperatureHumidityInfos;
|
||||
|
||||
public List<TemperatureHumidityInfo>? TemperatureHumidityInfos
|
||||
{
|
||||
get { return _temperatureHumidityInfos; }
|
||||
set { SetProperty(ref _temperatureHumidityInfos, value); }
|
||||
}
|
||||
public DelegateCommand Query
|
||||
{
|
||||
get => new DelegateCommand(() =>
|
||||
{
|
||||
RequestData();
|
||||
});
|
||||
}
|
||||
|
||||
public bool KeepAlive => false;
|
||||
|
||||
void RequestData()
|
||||
{
|
||||
int totalCount = 0;
|
||||
string machineId = ConfigurationManager.AppSettings["machineId"] ?? "DM5";
|
||||
TemperatureHumidityInfos = SqlSugarHelper.Db.Queryable<TemperatureHumidityInfo>()
|
||||
.Where(mr => mr.GroupNo == machineId)
|
||||
.WhereIF(StartDate != null, (mr) => mr.AddTime > StartDate)
|
||||
.WhereIF(EndDate != null, (mr) => mr.AddTime < EndDate).OrderByDescending(mr => mr.AddTime)
|
||||
.ToPageList(PageNum, PageSize, ref totalCount);
|
||||
//.ToList();
|
||||
TotalCount = totalCount;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -112,7 +112,7 @@
|
|||
<RowDefinition />
|
||||
<RowDefinition />
|
||||
<RowDefinition />
|
||||
<RowDefinition />
|
||||
<!--<RowDefinition />-->
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition />
|
||||
|
@ -129,17 +129,17 @@
|
|||
<Button Grid.Row="7" Grid.Column="0" Width="120" Content="8号药箱" Command="{Binding UpdateDrawerNo}" CommandParameter="8" />
|
||||
|
||||
<Button Grid.Row="8" Grid.Column="0" Width="120" Content="9号药箱" Command="{Binding UpdateDrawerNo}" CommandParameter="9" />
|
||||
<Button Grid.Row="9" Grid.Column="0" Width="120" Content="10号药箱" Command="{Binding UpdateDrawerNo}" CommandParameter="10" />
|
||||
<Button Grid.Row="0" Grid.Column="1" Width="120" Content="11号药箱" Command="{Binding UpdateDrawerNo}" CommandParameter="11" />
|
||||
<Button Grid.Row="1" Grid.Column="1" Width="120" Content="12号药箱" Command="{Binding UpdateDrawerNo}" CommandParameter="12" />
|
||||
<Button Grid.Row="2" Grid.Column="1" Width="120" Content="13号药箱" Command="{Binding UpdateDrawerNo}" CommandParameter="13" />
|
||||
<Button Grid.Row="3" Grid.Column="1" Width="120" Content="14号药箱" Command="{Binding UpdateDrawerNo}" CommandParameter="14" />
|
||||
<Button Grid.Row="4" Grid.Column="1" Width="120" Content="15号药箱" Command="{Binding UpdateDrawerNo}" CommandParameter="15" />
|
||||
<Button Grid.Row="5" Grid.Column="1" Width="120" Content="16号药箱" Command="{Binding UpdateDrawerNo}" CommandParameter="16" />
|
||||
<Button Grid.Row="6" Grid.Column="1" Width="120" Content="17号药箱" Command="{Binding UpdateDrawerNo}" CommandParameter="17" />
|
||||
<Button Grid.Row="7" Grid.Column="1" Width="120" Content="18号药箱" Command="{Binding UpdateDrawerNo}" CommandParameter="18" />
|
||||
<Button Grid.Row="8" Grid.Column="1" Width="120" Content="19号药箱" Command="{Binding UpdateDrawerNo}" CommandParameter="19" />
|
||||
<Button Grid.Row="9" Grid.Column="1" Width="120" Content="20号药箱" Command="{Binding UpdateDrawerNo}" CommandParameter="20" />
|
||||
<Button Grid.Row="0" Grid.Column="1" Width="120" Content="10号药箱" Command="{Binding UpdateDrawerNo}" CommandParameter="10" />
|
||||
<Button Grid.Row="1" Grid.Column="1" Width="120" Content="11号药箱" Command="{Binding UpdateDrawerNo}" CommandParameter="11" />
|
||||
<Button Grid.Row="2" Grid.Column="1" Width="120" Content="12号药箱" Command="{Binding UpdateDrawerNo}" CommandParameter="12" />
|
||||
<Button Grid.Row="3" Grid.Column="1" Width="120" Content="13号药箱" Command="{Binding UpdateDrawerNo}" CommandParameter="13" />
|
||||
<Button Grid.Row="4" Grid.Column="1" Width="120" Content="14号药箱" Command="{Binding UpdateDrawerNo}" CommandParameter="14" />
|
||||
<Button Grid.Row="5" Grid.Column="1" Width="120" Content="15号药箱" Command="{Binding UpdateDrawerNo}" CommandParameter="15" />
|
||||
<Button Grid.Row="6" Grid.Column="1" Width="120" Content="16号药箱" Command="{Binding UpdateDrawerNo}" CommandParameter="16" />
|
||||
<Button Grid.Row="7" Grid.Column="1" Width="120" Content="17号药箱" Command="{Binding UpdateDrawerNo}" CommandParameter="17" />
|
||||
<Button Grid.Row="8" Grid.Column="1" Width="120" Content="18号药箱" Command="{Binding UpdateDrawerNo}" CommandParameter="18" />
|
||||
<!--<Button Grid.Row="8" Grid.Column="1" Width="120" Content="19号药箱" Command="{Binding UpdateDrawerNo}" CommandParameter="19" />
|
||||
<Button Grid.Row="9" Grid.Column="1" Width="120" Content="20号药箱" Command="{Binding UpdateDrawerNo}" CommandParameter="20" />-->
|
||||
|
||||
</Grid>
|
||||
</Grid>
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
</Style.Setters>
|
||||
</Style>
|
||||
</UserControl.Resources>
|
||||
<Grid>
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
|
@ -68,7 +68,7 @@
|
|||
<RowDefinition />
|
||||
<RowDefinition />
|
||||
<RowDefinition />
|
||||
<RowDefinition />
|
||||
<!--<RowDefinition />-->
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition />
|
||||
|
@ -85,18 +85,18 @@
|
|||
<Button Margin="0 0 3 0" Grid.Row="7" Grid.Column="0" Width="120" Content="8号药箱" Command="{Binding UpdateDrawerNo}" CommandParameter="8" IsEnabled="{Binding DrawerNo, Converter={StaticResource BoxNumConverter}, ConverterParameter=8}"/>
|
||||
|
||||
<Button Margin="0 0 3 0" Grid.Row="8" Grid.Column="0" Width="120" Content="9号药箱" Command="{Binding UpdateDrawerNo}" CommandParameter="9" IsEnabled="{Binding DrawerNo, Converter={StaticResource BoxNumConverter}, ConverterParameter=9}"/>
|
||||
<Button Margin="0 0 3 0" Grid.Row="9" Grid.Column="0" Width="120" Content="10号药箱" Command="{Binding UpdateDrawerNo}" CommandParameter="10" IsEnabled="{Binding DrawerNo, Converter={StaticResource BoxNumConverter}, ConverterParameter=10}"/>
|
||||
<Button Margin="0 0 3 0" Grid.Row="0" Grid.Column="1" Width="120" Content="10号药箱" Command="{Binding UpdateDrawerNo}" CommandParameter="10" IsEnabled="{Binding DrawerNo, Converter={StaticResource BoxNumConverter}, ConverterParameter=10}"/>
|
||||
|
||||
<Button Grid.Row="0" Grid.Column="1" Width="120" Content="11号药箱" Command="{Binding UpdateDrawerNo}" CommandParameter="11" IsEnabled="{Binding DrawerNo, Converter={StaticResource BoxNumConverter}, ConverterParameter=11}"/>
|
||||
<Button Grid.Row="1" Grid.Column="1" Width="120" Content="12号药箱" Command="{Binding UpdateDrawerNo}" CommandParameter="12" IsEnabled="{Binding DrawerNo, Converter={StaticResource BoxNumConverter}, ConverterParameter=12}"/>
|
||||
<Button Grid.Row="2" Grid.Column="1" Width="120" Content="13号药箱" Command="{Binding UpdateDrawerNo}" CommandParameter="13" IsEnabled="{Binding DrawerNo, Converter={StaticResource BoxNumConverter}, ConverterParameter=13}"/>
|
||||
<Button Grid.Row="3" Grid.Column="1" Width="120" Content="14号药箱" Command="{Binding UpdateDrawerNo}" CommandParameter="14" IsEnabled="{Binding DrawerNo, Converter={StaticResource BoxNumConverter}, ConverterParameter=14}"/>
|
||||
<Button Grid.Row="4" Grid.Column="1" Width="120" Content="15号药箱" Command="{Binding UpdateDrawerNo}" CommandParameter="15" IsEnabled="{Binding DrawerNo, Converter={StaticResource BoxNumConverter}, ConverterParameter=15}"/>
|
||||
<Button Grid.Row="5" Grid.Column="1" Width="120" Content="16号药箱" Command="{Binding UpdateDrawerNo}" CommandParameter="16" IsEnabled="{Binding DrawerNo, Converter={StaticResource BoxNumConverter}, ConverterParameter=16}"/>
|
||||
<Button Grid.Row="6" Grid.Column="1" Width="120" Content="17号药箱" Command="{Binding UpdateDrawerNo}" CommandParameter="17" IsEnabled="{Binding DrawerNo, Converter={StaticResource BoxNumConverter}, ConverterParameter=17}"/>
|
||||
<Button Grid.Row="7" Grid.Column="1" Width="120" Content="18号药箱" Command="{Binding UpdateDrawerNo}" CommandParameter="18" IsEnabled="{Binding DrawerNo, Converter={StaticResource BoxNumConverter}, ConverterParameter=18}"/>
|
||||
<Button Grid.Row="8" Grid.Column="1" Width="120" Content="19号药箱" Command="{Binding UpdateDrawerNo}" CommandParameter="19" IsEnabled="{Binding DrawerNo, Converter={StaticResource BoxNumConverter}, ConverterParameter=19}"/>
|
||||
<Button Grid.Row="9" Grid.Column="1" Width="120" Content="20号药箱" Command="{Binding UpdateDrawerNo}" CommandParameter="20" IsEnabled="{Binding DrawerNo, Converter={StaticResource BoxNumConverter}, ConverterParameter=20}"/>
|
||||
<Button Grid.Row="1" Grid.Column="1" Width="120" Content="11号药箱" Command="{Binding UpdateDrawerNo}" CommandParameter="11" IsEnabled="{Binding DrawerNo, Converter={StaticResource BoxNumConverter}, ConverterParameter=11}"/>
|
||||
<Button Grid.Row="2" Grid.Column="1" Width="120" Content="12号药箱" Command="{Binding UpdateDrawerNo}" CommandParameter="12" IsEnabled="{Binding DrawerNo, Converter={StaticResource BoxNumConverter}, ConverterParameter=12}"/>
|
||||
<Button Grid.Row="3" Grid.Column="1" Width="120" Content="13号药箱" Command="{Binding UpdateDrawerNo}" CommandParameter="13" IsEnabled="{Binding DrawerNo, Converter={StaticResource BoxNumConverter}, ConverterParameter=13}"/>
|
||||
<Button Grid.Row="4" Grid.Column="1" Width="120" Content="14号药箱" Command="{Binding UpdateDrawerNo}" CommandParameter="14" IsEnabled="{Binding DrawerNo, Converter={StaticResource BoxNumConverter}, ConverterParameter=14}"/>
|
||||
<Button Grid.Row="5" Grid.Column="1" Width="120" Content="15号药箱" Command="{Binding UpdateDrawerNo}" CommandParameter="15" IsEnabled="{Binding DrawerNo, Converter={StaticResource BoxNumConverter}, ConverterParameter=15}"/>
|
||||
<Button Grid.Row="6" Grid.Column="1" Width="120" Content="16号药箱" Command="{Binding UpdateDrawerNo}" CommandParameter="16" IsEnabled="{Binding DrawerNo, Converter={StaticResource BoxNumConverter}, ConverterParameter=16}"/>
|
||||
<Button Grid.Row="7" Grid.Column="1" Width="120" Content="17号药箱" Command="{Binding UpdateDrawerNo}" CommandParameter="17" IsEnabled="{Binding DrawerNo, Converter={StaticResource BoxNumConverter}, ConverterParameter=17}"/>
|
||||
<Button Grid.Row="8" Grid.Column="1" Width="120" Content="18号药箱" Command="{Binding UpdateDrawerNo}" CommandParameter="18" IsEnabled="{Binding DrawerNo, Converter={StaticResource BoxNumConverter}, ConverterParameter=18}"/>
|
||||
<!--<Button Grid.Row="8" Grid.Column="1" Width="120" Content="19号药箱" Command="{Binding UpdateDrawerNo}" CommandParameter="19" IsEnabled="{Binding DrawerNo, Converter={StaticResource BoxNumConverter}, ConverterParameter=19}"/>
|
||||
<Button Grid.Row="9" Grid.Column="1" Width="120" Content="20号药箱" Command="{Binding UpdateDrawerNo}" CommandParameter="20" IsEnabled="{Binding DrawerNo, Converter={StaticResource BoxNumConverter}, ConverterParameter=20}"/>-->
|
||||
|
||||
</Grid>
|
||||
<Grid Grid.Column="1" Margin="6">
|
||||
|
@ -109,7 +109,7 @@
|
|||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
</Grid.RowDefinitions>
|
||||
<Grid Margin="0 6 0 6" Grid.Row="0" Grid.ColumnSpan="2">
|
||||
<Grid Margin="0 6 0 6" Grid.Row="0" Grid.ColumnSpan="3">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="2*" />
|
||||
<ColumnDefinition Width="8*" />
|
||||
|
@ -141,9 +141,8 @@
|
|||
</Button>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
<Grid
|
||||
Grid.Row="1" Grid.Column="0" Margin="0 0 6 0">
|
||||
<ListView
|
||||
<!--<Grid Grid.Row="1" Grid.Column="0" Margin="0 0 -100 0">-->
|
||||
<ListView Grid.Row="1" Grid.Column="0" Margin="0 0 6 0"
|
||||
ItemsSource="{Binding OrderInfoList, UpdateSourceTrigger=PropertyChanged, Mode=TwoWay}"
|
||||
SelectedItem="{Binding selectOrderInfo}"
|
||||
materialDesign:ListViewAssist.HeaderRowBackground="#31ccec"
|
||||
|
@ -161,28 +160,19 @@
|
|||
</i:Interaction.Triggers>
|
||||
<ListView.View>
|
||||
<GridView ColumnHeaderContainerStyle="{StaticResource st}">
|
||||
<GridViewColumn Header="选择" Width="50">
|
||||
<GridViewColumn Header="选择" Width="30">
|
||||
<GridViewColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<CheckBox IsChecked="{Binding ItemIsChecked}" />
|
||||
</DataTemplate>
|
||||
</GridViewColumn.CellTemplate>
|
||||
</GridViewColumn>
|
||||
<!--<GridViewColumn Width="100"
|
||||
Header="患者ID"
|
||||
DisplayMemberBinding="{Binding PatientId}"/>-->
|
||||
<GridViewColumn Width="80"
|
||||
Header="姓名"
|
||||
DisplayMemberBinding="{Binding PName}" />
|
||||
<GridViewColumn Width="30"
|
||||
DisplayMemberBinding="{Binding Sex}"
|
||||
Header="性别"/>
|
||||
<!--<GridViewColumn Width="50"
|
||||
DisplayMemberBinding="{Binding Age}"
|
||||
Header="年龄"/>
|
||||
<GridViewColumn Width="180"
|
||||
DisplayMemberBinding="{Binding IdNumber}"
|
||||
Header="身份证"/>-->
|
||||
<GridViewColumn Width="100"
|
||||
DisplayMemberBinding="{Binding OrderNo}"
|
||||
Header="处方号"/>
|
||||
|
@ -192,10 +182,10 @@
|
|||
<GridViewColumn Width="100"
|
||||
DisplayMemberBinding="{Binding _OrderDetail.DrugInfo.DrugName}"
|
||||
Header="药品名称"/>
|
||||
<GridViewColumn Width="100"
|
||||
<GridViewColumn Width="80"
|
||||
DisplayMemberBinding="{Binding _OrderDetail.SetManuNo}"
|
||||
Header="药品批次"/>
|
||||
<GridViewColumn Width="100"
|
||||
<GridViewColumn Width="80"
|
||||
DisplayMemberBinding="{Binding _OrderDetail.SetEffDate}"
|
||||
Header="药品效期"/>
|
||||
<GridViewColumn Width="30"
|
||||
|
@ -204,9 +194,9 @@
|
|||
</GridView>
|
||||
</ListView.View>
|
||||
</ListView>
|
||||
</Grid>
|
||||
<Grid Grid.Column="1" Grid.Row="1" Margin="6 0 0 0" HorizontalAlignment="Right">
|
||||
<ListView ItemsSource="{Binding TotalDrugList,UpdateSourceTrigger=PropertyChanged,Mode=TwoWay}"
|
||||
<!--</Grid>-->
|
||||
<!--<Grid Grid.Column="1" Grid.Row="1" Margin="0 0 0 0" HorizontalAlignment="Right">-->
|
||||
<ListView Grid.Column="1" Grid.Row="1" Margin="0 0 0 0" ItemsSource="{Binding TotalDrugList,UpdateSourceTrigger=PropertyChanged,Mode=TwoWay}"
|
||||
materialDesign:ListViewAssist.HeaderRowBackground="#31ccec"
|
||||
materialDesign:DataGridAssist.ColumnHeaderPadding="10"
|
||||
materialDesign:ListViewAssist.ListViewItemPadding="13">
|
||||
|
@ -226,7 +216,7 @@
|
|||
</GridView>
|
||||
</ListView.View>
|
||||
</ListView>
|
||||
</Grid>
|
||||
<!--</Grid>-->
|
||||
|
||||
<pagination:Pagination Grid.Row="2" Grid.Column="2"
|
||||
CurrentPage="{Binding PageNum}"
|
||||
|
|
|
@ -200,6 +200,7 @@
|
|||
<TextBlock Visibility="{Binding FingerMsg, Converter={StaticResource BooleanToVisibilityConverter}}" Text="指纹机连接失败" />
|
||||
<TextBlock Visibility="{Binding HIKMsg, Converter={StaticResource BooleanToVisibilityConverter}}" Text="录像机登录失败" />
|
||||
<TextBlock Visibility="{Binding FridgePortMsg, Converter={StaticResource BooleanToVisibilityConverter}}" Text="冰箱串口连接失败" />
|
||||
<TextBlock Visibility="{Binding WSDPortMsg, Converter={StaticResource BooleanToVisibilityConverter}}" Text="温湿度串口连接失败" />
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
|
|
|
@ -0,0 +1,103 @@
|
|||
<UserControl x:Class="DM_Weight.Views.MachineRecordWindow"
|
||||
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"
|
||||
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
|
||||
xmlns:pagination="clr-namespace:DM_Weight.Components.pagination"
|
||||
xmlns:i="http://schemas.microsoft.com/xaml/behaviors"
|
||||
xmlns:prism="http://prismlibrary.com/"
|
||||
xmlns:convert="clr-namespace:DM_Weight.Converter"
|
||||
mc:Ignorable="d">
|
||||
<UserControl.Resources>
|
||||
<Style x:Key="st" TargetType="GridViewColumnHeader">
|
||||
<Style.Setters>
|
||||
<Setter Property="Height">
|
||||
<Setter.Value>55</Setter.Value>
|
||||
</Setter>
|
||||
<Setter Property="Background">
|
||||
<Setter.Value>#31ccec</Setter.Value>
|
||||
</Setter>
|
||||
<Setter Property="Foreground">
|
||||
<Setter.Value>white</Setter.Value>
|
||||
</Setter>
|
||||
</Style.Setters>
|
||||
</Style>
|
||||
</UserControl.Resources>
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
<Grid Margin="0 6 0 6" Grid.Row="0">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="1.5*" />
|
||||
<ColumnDefinition Width="1.5*" />
|
||||
<ColumnDefinition Width="2*" />
|
||||
<ColumnDefinition Width="2*" />
|
||||
<ColumnDefinition Width="5*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<DatePicker
|
||||
Grid.Column="0"
|
||||
SelectedDate="{Binding StartDate, TargetNullValue=''}"
|
||||
Margin="6 0 0 0"
|
||||
materialDesign:HintAssist.Hint="开始时间"
|
||||
Style="{StaticResource MaterialDesignOutlinedDatePicker}"
|
||||
/>
|
||||
<DatePicker
|
||||
Grid.Column="1"
|
||||
SelectedDate="{Binding EndDate}"
|
||||
Margin="6 0 0 0"
|
||||
materialDesign:HintAssist.Hint="结束时间"
|
||||
Style="{StaticResource MaterialDesignOutlinedDatePicker}"
|
||||
/>
|
||||
<StackPanel Grid.Column="4" Orientation="Horizontal" HorizontalAlignment="Right">
|
||||
<Button
|
||||
Margin="0 0 6 0"
|
||||
VerticalAlignment="Center"
|
||||
Style="{StaticResource MaterialDesignOutlinedLightButton}"
|
||||
ToolTip="刷新" Command="{Binding Query}">
|
||||
<materialDesign:PackIcon
|
||||
Kind="Refresh" />
|
||||
</Button>
|
||||
</StackPanel>
|
||||
|
||||
|
||||
</Grid>
|
||||
<ListView Grid.Row="1" ItemsSource="{Binding MachineRecords}"
|
||||
materialDesign:ListViewAssist.HeaderRowBackground="#31ccec"
|
||||
materialDesign:DataGridAssist.ColumnHeaderPadding="10"
|
||||
materialDesign:ListViewAssist.ListViewItemPadding="13">
|
||||
|
||||
<ListView.Resources>
|
||||
<Style TargetType="{x:Type GridViewColumnHeader}" BasedOn="{StaticResource {x:Type GridViewColumnHeader}}">
|
||||
<Setter Property="Foreground" Value="White" />
|
||||
</Style>
|
||||
</ListView.Resources>
|
||||
<ListView.View>
|
||||
<GridView ColumnHeaderContainerStyle="{StaticResource st}">
|
||||
<GridViewColumn Width="100"
|
||||
Header="操作人"
|
||||
DisplayMemberBinding="{Binding User.Nickname}"/>
|
||||
<GridViewColumn Width="100"
|
||||
Header="时间"
|
||||
DisplayMemberBinding="{Binding OperationTime, StringFormat='yyyy-MM-dd HH:mm:ss'}" />
|
||||
<GridViewColumn Width="180"
|
||||
DisplayMemberBinding="{Binding DrawerNo}"
|
||||
Header="药箱号"/>
|
||||
<GridViewColumn Width="100"
|
||||
DisplayMemberBinding="{Binding InvoiceId}"
|
||||
Header="操作内容"/>
|
||||
</GridView>
|
||||
</ListView.View>
|
||||
</ListView>
|
||||
<pagination:Pagination Grid.Row="2"
|
||||
CurrentPage="{Binding PageNum}"
|
||||
PageSize="{Binding PageSize}"
|
||||
TotalPages="{Binding TotalCount}"
|
||||
InfoTextIsEnabel="True"
|
||||
/>
|
||||
</Grid>
|
||||
</UserControl>
|
|
@ -0,0 +1,28 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Navigation;
|
||||
using System.Windows.Shapes;
|
||||
|
||||
namespace DM_Weight.Views
|
||||
{
|
||||
/// <summary>
|
||||
/// MachineRecordWindowViewModel.xaml 的交互逻辑
|
||||
/// </summary>
|
||||
public partial class MachineRecordWindow : UserControl
|
||||
{
|
||||
public MachineRecordWindow()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -62,7 +62,7 @@
|
|||
<RowDefinition />
|
||||
<RowDefinition />
|
||||
<RowDefinition />
|
||||
<RowDefinition />
|
||||
<!--<RowDefinition />-->
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition />
|
||||
|
@ -79,17 +79,17 @@
|
|||
<Button Grid.Row="7" Grid.Column="0" Width="120" Content="8号药箱" Command="{Binding UpdateDrawerNo}" CommandParameter="8" />
|
||||
|
||||
<Button Grid.Row="8" Grid.Column="0" Width="120" Content="9号药箱" Command="{Binding UpdateDrawerNo}" CommandParameter="9" />
|
||||
<Button Grid.Row="9" Grid.Column="0" Width="120" Content="10号药箱" Command="{Binding UpdateDrawerNo}" CommandParameter="10" />
|
||||
<Button Grid.Row="0" Grid.Column="1" Width="120" Content="11号药箱" Command="{Binding UpdateDrawerNo}" CommandParameter="11" />
|
||||
<Button Grid.Row="1" Grid.Column="1" Width="120" Content="12号药箱" Command="{Binding UpdateDrawerNo}" CommandParameter="12" />
|
||||
<Button Grid.Row="2" Grid.Column="1" Width="120" Content="13号药箱" Command="{Binding UpdateDrawerNo}" CommandParameter="13" />
|
||||
<Button Grid.Row="3" Grid.Column="1" Width="120" Content="14号药箱" Command="{Binding UpdateDrawerNo}" CommandParameter="14" />
|
||||
<Button Grid.Row="4" Grid.Column="1" Width="120" Content="15号药箱" Command="{Binding UpdateDrawerNo}" CommandParameter="15" />
|
||||
<Button Grid.Row="5" Grid.Column="1" Width="120" Content="16号药箱" Command="{Binding UpdateDrawerNo}" CommandParameter="16" />
|
||||
<Button Grid.Row="6" Grid.Column="1" Width="120" Content="17号药箱" Command="{Binding UpdateDrawerNo}" CommandParameter="17" />
|
||||
<Button Grid.Row="7" Grid.Column="1" Width="120" Content="18号药箱" Command="{Binding UpdateDrawerNo}" CommandParameter="18" />
|
||||
<Button Grid.Row="8" Grid.Column="1" Width="120" Content="19号药箱" Command="{Binding UpdateDrawerNo}" CommandParameter="19" />
|
||||
<Button Grid.Row="9" Grid.Column="1" Width="120" Content="20号药箱" Command="{Binding UpdateDrawerNo}" CommandParameter="20" />
|
||||
<Button Grid.Row="0" Grid.Column="1" Width="120" Content="10号药箱" Command="{Binding UpdateDrawerNo}" CommandParameter="10" />
|
||||
<Button Grid.Row="1" Grid.Column="1" Width="120" Content="11号药箱" Command="{Binding UpdateDrawerNo}" CommandParameter="11" />
|
||||
<Button Grid.Row="2" Grid.Column="1" Width="120" Content="12号药箱" Command="{Binding UpdateDrawerNo}" CommandParameter="12" />
|
||||
<Button Grid.Row="3" Grid.Column="1" Width="120" Content="13号药箱" Command="{Binding UpdateDrawerNo}" CommandParameter="13" />
|
||||
<Button Grid.Row="4" Grid.Column="1" Width="120" Content="14号药箱" Command="{Binding UpdateDrawerNo}" CommandParameter="14" />
|
||||
<Button Grid.Row="5" Grid.Column="1" Width="120" Content="15号药箱" Command="{Binding UpdateDrawerNo}" CommandParameter="15" />
|
||||
<Button Grid.Row="6" Grid.Column="1" Width="120" Content="16号药箱" Command="{Binding UpdateDrawerNo}" CommandParameter="16" />
|
||||
<Button Grid.Row="7" Grid.Column="1" Width="120" Content="17号药箱" Command="{Binding UpdateDrawerNo}" CommandParameter="17" />
|
||||
<Button Grid.Row="8" Grid.Column="1" Width="120" Content="18号药箱" Command="{Binding UpdateDrawerNo}" CommandParameter="18" />
|
||||
<!--<Button Grid.Row="8" Grid.Column="1" Width="120" Content="19号药箱" Command="{Binding UpdateDrawerNo}" CommandParameter="19" />
|
||||
<Button Grid.Row="9" Grid.Column="1" Width="120" Content="20号药箱" Command="{Binding UpdateDrawerNo}" CommandParameter="20" />-->
|
||||
|
||||
</Grid>
|
||||
</Grid>
|
||||
|
|
|
@ -0,0 +1,100 @@
|
|||
<UserControl x:Class="DM_Weight.Views.WSDRecordWindow"
|
||||
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"
|
||||
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
|
||||
xmlns:pagination="clr-namespace:DM_Weight.Components.pagination"
|
||||
xmlns:i="http://schemas.microsoft.com/xaml/behaviors"
|
||||
xmlns:prism="http://prismlibrary.com/"
|
||||
xmlns:convert="clr-namespace:DM_Weight.Converter"
|
||||
mc:Ignorable="d">
|
||||
<UserControl.Resources>
|
||||
<Style x:Key="st" TargetType="GridViewColumnHeader">
|
||||
<Style.Setters>
|
||||
<Setter Property="Height">
|
||||
<Setter.Value>55</Setter.Value>
|
||||
</Setter>
|
||||
<Setter Property="Background">
|
||||
<Setter.Value>#31ccec</Setter.Value>
|
||||
</Setter>
|
||||
<Setter Property="Foreground">
|
||||
<Setter.Value>white</Setter.Value>
|
||||
</Setter>
|
||||
</Style.Setters>
|
||||
</Style>
|
||||
</UserControl.Resources>
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
<Grid Margin="0 6 0 6" Grid.Row="0">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="1.5*" />
|
||||
<ColumnDefinition Width="1.5*" />
|
||||
<ColumnDefinition Width="2*" />
|
||||
<ColumnDefinition Width="2*" />
|
||||
<ColumnDefinition Width="5*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<DatePicker
|
||||
Grid.Column="0"
|
||||
SelectedDate="{Binding StartDate, TargetNullValue=''}"
|
||||
Margin="6 0 0 0"
|
||||
materialDesign:HintAssist.Hint="开始时间"
|
||||
Style="{StaticResource MaterialDesignOutlinedDatePicker}"
|
||||
/>
|
||||
<DatePicker
|
||||
Grid.Column="1"
|
||||
SelectedDate="{Binding EndDate}"
|
||||
Margin="6 0 0 0"
|
||||
materialDesign:HintAssist.Hint="结束时间"
|
||||
Style="{StaticResource MaterialDesignOutlinedDatePicker}"
|
||||
/>
|
||||
<StackPanel Grid.Column="4" Orientation="Horizontal" HorizontalAlignment="Right">
|
||||
<Button
|
||||
Margin="0 0 6 0"
|
||||
VerticalAlignment="Center"
|
||||
Style="{StaticResource MaterialDesignOutlinedLightButton}"
|
||||
ToolTip="刷新" Command="{Binding Query}">
|
||||
<materialDesign:PackIcon
|
||||
Kind="Refresh" />
|
||||
</Button>
|
||||
</StackPanel>
|
||||
|
||||
|
||||
</Grid>
|
||||
<ListView Grid.Row="1" ItemsSource="{Binding TemperatureHumidityInfos}"
|
||||
materialDesign:ListViewAssist.HeaderRowBackground="#31ccec"
|
||||
materialDesign:DataGridAssist.ColumnHeaderPadding="10"
|
||||
materialDesign:ListViewAssist.ListViewItemPadding="13">
|
||||
|
||||
<ListView.Resources>
|
||||
<Style TargetType="{x:Type GridViewColumnHeader}" BasedOn="{StaticResource {x:Type GridViewColumnHeader}}">
|
||||
<Setter Property="Foreground" Value="White" />
|
||||
</Style>
|
||||
</ListView.Resources>
|
||||
<ListView.View>
|
||||
<GridView ColumnHeaderContainerStyle="{StaticResource st}">
|
||||
<GridViewColumn Width="100"
|
||||
Header="检测时间"
|
||||
DisplayMemberBinding="{Binding OperationTime, StringFormat='yyyy-MM-dd HH:mm:ss'}" />
|
||||
<GridViewColumn Width="180"
|
||||
DisplayMemberBinding="{Binding DrawerNo}"
|
||||
Header="温度"/>
|
||||
<GridViewColumn Width="100"
|
||||
DisplayMemberBinding="{Binding InvoiceId}"
|
||||
Header="湿度"/>
|
||||
</GridView>
|
||||
</ListView.View>
|
||||
</ListView>
|
||||
<pagination:Pagination Grid.Row="2"
|
||||
CurrentPage="{Binding PageNum}"
|
||||
PageSize="{Binding PageSize}"
|
||||
TotalPages="{Binding TotalCount}"
|
||||
InfoTextIsEnabel="True"
|
||||
/>
|
||||
</Grid>
|
||||
</UserControl>
|
|
@ -0,0 +1,28 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Navigation;
|
||||
using System.Windows.Shapes;
|
||||
|
||||
namespace DM_Weight.Views
|
||||
{
|
||||
/// <summary>
|
||||
/// WSDRecordWindow.xaml 的交互逻辑
|
||||
/// </summary>
|
||||
public partial class WSDRecordWindow : UserControl
|
||||
{
|
||||
public WSDRecordWindow()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue