channel_list添加药箱状态标识,药箱在不在

machine_record添加操作类型,取药箱、还药箱
修改开药箱页面,显示全部药箱,根据当前登录人权限显示药箱号按钮是否可点击
This commit is contained in:
maqiao 2024-09-19 10:28:38 +08:00
parent 9707453c98
commit 85821c040f
11 changed files with 1337 additions and 46 deletions

View File

@ -164,6 +164,7 @@ namespace DM_Weight
//containerRegistry.RegisterForNavigation<AddSurgeryDialog, AddSurgeryDialogViewModel>();
//开药箱
containerRegistry.RegisterForNavigation<OpenBoxWindow, OpenBoxWindowViewModel>();
containerRegistry.RegisterForNavigation<OpenBoxNewWindow, OpenBoxNewWindowViewModel>();
//核对处方
containerRegistry.RegisterForNavigation<CheckOrderWindow, CheckOrderWindowViewModel>();
//管理员根据药箱进行核对处方

View File

@ -80,6 +80,12 @@ namespace DM_Weight.Models
public int DrawerType { get; set; }
/// <summary>
///
/// 药箱状态 1药箱在0药箱不在药箱在时开药箱为取药箱药箱不在时开药箱为还药箱
///</summary>
[SugarColumn(ColumnName = "drawer_state")]
public int DrawerState { get; set; }
/// <summary>
///
/// 默认值: 1
///</summary>
[SugarColumn(IsIgnore =true)]

View File

@ -78,6 +78,11 @@ namespace DM_Weight.Models
[SugarColumn(ColumnName = "type")]
public int Type { get; set; }
/// <summary>
///操作类型(1放入药箱0取走药箱)
///</summary>
[SugarColumn(ColumnName = "option_type")]
public int OptionType { get; set; }
/// <summary>
/// 出入库调拨单id
///</summary>
[SugarColumn(ColumnName = "invoice_id")]

View File

@ -0,0 +1,558 @@
{
"Version":"6.8.1.1",
"Font":{
"Name":"宋体",
"Size":105000,
"Weight":400,
"Charset":134
},
"Printer":{
"Oriention":"Landscape",
"LeftMargin":1,
"TopMargin":1.42875,
"RightMargin":1,
"BottomMargin":1.8
},
"DetailGrid":{
"CenterView":true,
"IsCrossTab":true,
"FixCols":2,
"AppendBlankRow":true,
"Recordset":{
"Field":[
{
"Name":"DMYear"
},
{
"Name":"DMMonth"
},
{
"Name":"DMDay"
},
{
"Name":"TotalBaseNum"
},
{
"Name":"OperationTime"
},
{
"Name":"SendUser"
},
{
"Name":"ReceiveUser"
},
{
"Name":"SendNum"
},
{
"Name":"InfactNum"
},
{
"Name":"EmptyNum"
},
{
"Name":"ReturnTime"
},
{
"Name":"ReturnUser"
},
{
"Name":"ReturnReceiveUser"
},
{
"Name":"AddUser"
},
{
"Name":"AddCheckUser"
},
{
"Name":"drugId"
},
{
"Name":"drugName"
},
{
"Name":"drugSpec"
}
]
},
"Column":[
{
"Name":"Column4"
},
{
"Name":"Column6"
},
{
"Name":"Column31"
},
{
"Name":"Column14"
},
{
"Name":"Column19"
},
{
"Name":"Column20"
},
{
"Name":"Column22"
},
{
"Name":"Column23"
},
{
"Name":"Column24"
}
],
"ColumnContent":{
"Height":2.19604,
"ColumnContentCell":[
{
"Column":"Column4",
"TextAlign":"MiddleCenter",
"DataField":"OperationTime"
},
{
"Column":"Column6",
"TextAlign":"MiddleCenter",
"DataField":"SendUser"
},
{
"Column":"Column31",
"TextAlign":"MiddleCenter",
"DataField":"ReceiveUser"
},
{
"Column":"Column14",
"TextAlign":"MiddleCenter",
"DataField":"SendNum"
},
{
"Column":"Column19",
"TextAlign":"MiddleCenter",
"DataField":"InfactNum"
},
{
"Column":"Column20",
"TextAlign":"MiddleCenter",
"DataField":"EmptyNum"
},
{
"Column":"Column22",
"TextAlign":"MiddleCenter",
"DataField":"ReturnTime"
},
{
"Column":"Column23",
"TextAlign":"MiddleCenter",
"DataField":"ReturnUser"
},
{
"Column":"Column24",
"DataField":"ReturnReceiveUser"
}
]
},
"ColumnTitle":{
"Height":3.96875,
"RepeatStyle":"OnGroupHeaderPage",
"ColumnTitleCell":[
{
"GroupTitle":true,
"Name":"Column3",
"ColumnTitleCell":[
{
"GroupTitle":true,
"Name":"Column12",
"ColumnTitleCell":[
{
"GroupTitle":true,
"Name":"Column25",
"ColumnTitleCell":[
{
"GroupTitle":true,
"Name":"Column26",
"ColumnTitleCell":[
{
"GroupTitle":false,
"Column":"Column4",
"TextAlign":"BottomCenter",
"Text":"发药时间"
},
{
"GroupTitle":false,
"Column":"Column6",
"TextAlign":"BottomCenter",
"Text":"发药者"
}
],
"TextAlign":"MiddleRight",
"Text":"交接状态",
"BorderCustom":true,
"Border":{
"Styles":"[DrawBottom]"
}
}
]
}
],
"TextAlign":"MiddleCenter",
"Text":"药品信息",
"BorderCustom":true,
"Border":{
"Styles":"[DrawRight]"
}
}
],
"BorderCustom":true,
"Border":{
"Styles":"[DrawRight]"
}
},
{
"GroupTitle":true,
"Name":"Column27",
"ColumnTitleCell":[
{
"GroupTitle":true,
"Name":"Column28",
"ColumnTitleCell":[
{
"GroupTitle":true,
"Name":"Column29",
"ColumnTitleCell":[
{
"GroupTitle":true,
"Name":"Column30",
"ColumnTitleCell":[
{
"GroupTitle":false,
"Column":"Column31",
"TextAlign":"BottomCenter",
"Text":"领药者"
}
]
}
],
"TextAlign":"MiddleCenter",
"Text":"总基数"
}
],
"TextAlign":"MiddleCenter",
"Text":"规格"
}
],
"TextAlign":"MiddleCenter",
"Text":"品名"
},
{
"GroupTitle":true,
"Name":"Column32",
"ColumnTitleCell":[
{
"GroupTitle":true,
"Name":"Column33",
"ColumnTitleCell":[
{
"GroupTitle":true,
"Name":"Column34",
"ColumnTitleCell":[
{
"GroupTitle":true,
"Name":"Column35",
"ColumnTitleCell":[
{
"GroupTitle":false,
"Column":"Column14",
"TextAlign":"BottomCenter",
"Text":"实发数"
},
{
"GroupTitle":false,
"Column":"Column19",
"TextAlign":"BottomCenter",
"Text":"实物数"
},
{
"GroupTitle":false,
"Column":"Column20",
"TextAlign":"BottomCenter",
"Text":"空安瓿"
}
],
"FreeCell":true,
"Control":[
{
"Type":"StaticBox",
"Name":"StaticBox1",
"Width":2.98979,
"Height":1.00542,
"Border":{
"Styles":"[DrawRight]"
},
"TextAlign":"MiddleCenter",
"Text":"发药"
},
{
"Type":"StaticBox",
"Name":"StaticBox2",
"Left":2.98979,
"Width":6.00604,
"Height":1.00542,
"TextAlign":"MiddleCenter",
"Text":"还药"
}
]
}
],
"Text":"[#TotalNum#]"
}
],
"Text":"[#drugSpec#]"
}
],
"Text":"[drugName]"
},
{
"GroupTitle":false,
"Column":"Column22",
"TextAlign":"BottomCenter",
"Text":"还药时间"
},
{
"GroupTitle":false,
"Column":"Column23",
"TextAlign":"BottomCenter",
"Text":"还药者"
},
{
"GroupTitle":false,
"Column":"Column24",
"TextAlign":"BottomCenter",
"Text":"接收者"
}
]
},
"Group":[
{
"Name":"Group1",
"ByFields":"drugId",
"GroupHeader":{
},
"GroupFooter":{
"Height":2.40771,
"Control":[
{
"Type":"StaticBox",
"Name":"StaticBox4",
"AlignColumn":"Column31",
"AlignColumnEx":"Column4",
"Width":8.96938,
"Height":2,
"Border":{
"Styles":"[DrawRight]"
},
"TextAlign":"MiddleCenter",
"Text":"日消耗总计(支)"
},
{
"Type":"StaticBox",
"Name":"StaticBox5",
"AlignColumn":"Column14",
"Left":8.96938,
"Width":2.98979,
"Height":1,
"Border":{
"Styles":"[DrawRight|DrawBottom]"
},
"TextAlign":"BottomCenter",
"Text":"安瓿"
},
{
"Type":"StaticBox",
"Name":"StaticBox6",
"AlignColumn":"Column19",
"Left":11.9592,
"Width":2.99,
"Height":1,
"Border":{
"Styles":"[DrawRight|DrawBottom]"
},
"TextAlign":"BottomCenter",
"Text":"处方"
},
{
"Type":"StaticBox",
"Name":"StaticBox7",
"AlignColumn":"Column20",
"Left":14.949,
"Width":2.99,
"Height":1,
"Border":{
"Styles":"[DrawRight|DrawBottom]"
},
"TextAlign":"BottomCenter",
"Text":"补充"
},
{
"Type":"MemoBox",
"Name":"MemoBox2",
"AlignColumn":"Column14",
"Left":8.96938,
"Top":1.00542,
"Width":2.9898,
"Height":1,
"Border":{
"Styles":"[DrawRight]"
},
"TextAlign":"MiddleCenter",
"Text":"[#Sum(EmptyNum)#]"
},
{
"Type":"MemoBox",
"Name":"MemoBox3",
"AlignColumn":"Column19",
"Left":11.9592,
"Top":1.0054,
"Width":2.98979,
"Height":1,
"Border":{
"Styles":"[DrawRight]"
},
"TextAlign":"MiddleCenter",
"Text":"[#Sum(SendNum-InfactNum)#]"
},
{
"Type":"MemoBox",
"Name":"MemoBox4",
"AlignColumn":"Column20",
"Left":14.949,
"Top":1.0054,
"Width":2.98979,
"Height":1,
"Border":{
"Styles":"[DrawRight]"
},
"TextAlign":"MiddleCenter",
"Text":"[#Sum(SendNum-InfactNum)#]"
},
{
"Type":"StaticBox",
"Name":"StaticBox8",
"AlignColumn":"Column22",
"AlignColumnEx":"Column23",
"Left":17.9388,
"Width":5.97958,
"Height":1,
"Border":{
"Styles":"[DrawRight|DrawBottom]"
},
"TextAlign":"BottomCenter",
"Text":"补充者"
},
{
"Type":"StaticBox",
"Name":"StaticBox9",
"AlignColumn":"Column24",
"Left":23.9183,
"Width":2.98979,
"Height":1,
"Border":{
"Styles":"[DrawRight|DrawBottom]"
},
"TextAlign":"BottomCenter",
"Text":"核对者"
},
{
"Type":"MemoBox",
"Name":"MemoBox5",
"AlignColumn":"Column22",
"AlignColumnEx":"Column23",
"Left":17.9388,
"Top":1.0054,
"Width":5.97958,
"Height":1.00542,
"Border":{
"Styles":"[DrawRight]"
},
"TextAlign":"MiddleCenter",
"Text":"[#AddUser#]"
},
{
"Type":"MemoBox",
"Name":"MemoBox6",
"AlignColumn":"Column24",
"Left":23.9183,
"Top":1.00542,
"Width":2.96333,
"Height":1.00542,
"Border":{
"Styles":"[DrawRight]"
},
"TextAlign":"MiddleCenter",
"Text":"[#AddCheckUser#]"
}
]
}
}
],
"CrossTab":{
"PercentFormat":"0.##%",
"HCrossFields":"drugId",
"VCrossFields":"OperationTime",
"ListCols":3,
"TotalCols":3
}
},
"Parameter":[
{
"Name":"machine_id"
},
{
"Name":"startDate",
"DataType":"DateTime"
},
{
"Name":"endDate",
"DataType":"DateTime"
}
],
"ReportHeader":[
{
"Name":"ReportHeader1",
"Height":1.79917,
"Control":[
{
"Type":"MemoBox",
"Name":"MemoBox1",
"Dock":"Fill",
"Center":"Both",
"Font":{
"Name":"宋体",
"Size":262500,
"Bold":true,
"Charset":134
},
"TextAlign":"MiddleCenter",
"Text":"麻醉科小药箱麻醉、精神药品(注射剂)使用与交接记录([#Year#])年"
}
],
"RepeatOnPage":true
},
{
"Name":"ReportHeader2",
"Height":0.608542,
"Control":[
{
"Type":"StaticBox",
"Name":"StaticBox3",
"Left":24.7915,
"Width":4.81542,
"Height":0.608542,
"Text":"[#DMYear#]年[#DMMonth#]月"
}
]
}
]
}

View File

@ -110,7 +110,7 @@ namespace DM_Weight.ViewModels
set => SetProperty(ref _ordersList, value);
}
private List<TotalDrug>? _totalDrugList=new List<TotalDrug>();
private List<TotalDrug>? _totalDrugList = new List<TotalDrug>();
public List<TotalDrug>? TotalDrugList
{
get => _totalDrugList;
@ -124,110 +124,110 @@ namespace DM_Weight.ViewModels
private Brush _button1Color = Brushes.White;
public Brush Button1Color
{
get => _button1Color;
set =>SetProperty(ref _button1Color, value);
get => _button1Color;
set => SetProperty(ref _button1Color, value);
}
private Brush _button2Color = Brushes.White;
public Brush Button2Color
{
get => _button2Color;
set =>SetProperty(ref _button2Color, value);
get => _button2Color;
set => SetProperty(ref _button2Color, value);
}
private Brush _button3Color = Brushes.White;
public Brush Button3Color
{
get => _button3Color;
set =>SetProperty(ref _button3Color, value);
get => _button3Color;
set => SetProperty(ref _button3Color, value);
}
private Brush _button4Color = Brushes.White;
public Brush Button4Color
{
get => _button4Color;
set =>SetProperty(ref _button4Color, value);
get => _button4Color;
set => SetProperty(ref _button4Color, value);
}
private Brush _button5Color = Brushes.White;
public Brush Button5Color
{
get => _button5Color;
set =>SetProperty(ref _button5Color, value);
get => _button5Color;
set => SetProperty(ref _button5Color, value);
}
private Brush _button6Color = Brushes.White;
public Brush Button6Color
{
get => _button6Color;
set =>SetProperty(ref _button6Color, value);
get => _button6Color;
set => SetProperty(ref _button6Color, value);
}
private Brush _button7Color = Brushes.White;
public Brush Button7Color
{
get => _button7Color;
set =>SetProperty(ref _button7Color, value);
get => _button7Color;
set => SetProperty(ref _button7Color, value);
}
private Brush _button8Color = Brushes.White;
public Brush Button8Color
{
get => _button8Color;
set =>SetProperty(ref _button8Color, value);
get => _button8Color;
set => SetProperty(ref _button8Color, value);
}
private Brush _button9Color = Brushes.White;
public Brush Button9Color
{
get => _button9Color;
set =>SetProperty(ref _button9Color, value);
get => _button9Color;
set => SetProperty(ref _button9Color, value);
}
private Brush _button10Color = Brushes.White;
public Brush Button10Color
{
get => _button10Color;
set =>SetProperty(ref _button10Color, value);
get => _button10Color;
set => SetProperty(ref _button10Color, value);
}
private Brush _button11Color = Brushes.White;
public Brush Button11Color
{
get => _button11Color;
set =>SetProperty(ref _button11Color, value);
get => _button11Color;
set => SetProperty(ref _button11Color, value);
}
private Brush _button12Color = Brushes.White;
public Brush Button12Color
{
get => _button12Color;
set =>SetProperty(ref _button12Color, value);
get => _button12Color;
set => SetProperty(ref _button12Color, value);
}
private Brush _button13Color = Brushes.White;
public Brush Button13Color
{
get => _button13Color;
set =>SetProperty(ref _button13Color, value);
get => _button13Color;
set => SetProperty(ref _button13Color, value);
}
private Brush _button14Color = Brushes.White;
public Brush Button14Color
{
get => _button14Color;
set =>SetProperty(ref _button14Color, value);
get => _button14Color;
set => SetProperty(ref _button14Color, value);
}
private Brush _button15Color = Brushes.White;
public Brush Button15Color
{
get => _button15Color;
set =>SetProperty(ref _button15Color, value);
get => _button15Color;
set => SetProperty(ref _button15Color, value);
}
private Brush _button16Color = Brushes.White;
public Brush Button16Color
{
get => _button16Color;
set =>SetProperty(ref _button16Color, value);
get => _button16Color;
set => SetProperty(ref _button16Color, value);
}
private Brush _button17Color = Brushes.White;
public Brush Button17Color
{
get => _button17Color;
set =>SetProperty(ref _button17Color, value);
get => _button17Color;
set => SetProperty(ref _button17Color, value);
}
private Brush _button18Color = Brushes.White;
public Brush Button18Color
{
get => _button18Color;
set =>SetProperty(ref _button18Color, value);
get => _button18Color;
set => SetProperty(ref _button18Color, value);
}
IEventAggregator _eventAggregator;
@ -278,7 +278,7 @@ namespace DM_Weight.ViewModels
{
OrderInfoList.ForEach(oi => oi.ItemIsChecked = true);
//TotalDrugList = OrderInfoList.Where(oi => oi.ItemIsChecked).GroupBy(oi => oi.OrderDetailList.DrugInfo.DrugName).Select(oi => new TotalDrug { DrugName = oi.Key, TotalCount = oi.Sum(item => item.OrderDetailList.Quantity) }).ToList();
TotalDrugList = OrderInfoList.Where(oi => oi.ItemIsChecked).SelectMany(OrderDetailList => OrderDetailList.OrderDetailList).GroupBy(item=>item.DrugInfo.DrugName).Select(group => new TotalDrug { DrugName = group.Key, TotalCount = group.Sum(item => item.Quantity) }).ToList();
TotalDrugList = OrderInfoList.Where(oi => oi.ItemIsChecked).SelectMany(OrderDetailList => OrderDetailList.OrderDetailList).GroupBy(item => item.DrugInfo.DrugName).Select(group => new TotalDrug { DrugName = group.Key, TotalCount = group.Sum(item => item.Quantity) }).ToList();
}
else
@ -288,7 +288,7 @@ namespace DM_Weight.ViewModels
TotalCount = totalCount;
PageCount = (int)Math.Ceiling((double)TotalCount / PageSize);
if(currentList.EffDate== DateTime.Now.ToString("yyyy-MM-dd"))
if (Convert.ToDateTime(currentList.EffDate).ToString("yyyy-MM-dd") == DateTime.Now.ToString("yyyy-MM-dd"))
{
switch (DrawerNo)
{
@ -357,7 +357,7 @@ namespace DM_Weight.ViewModels
for (int i = 0; i < chlList.Count; i++)
{
ChannelList chl = chlList[i];
if (chl.EffDate == DateTime.Now.ToString("yyyy-MM-dd"))
if (Convert.ToDateTime(chl.EffDate).ToString("yyyy-MM-dd") == DateTime.Now.ToString("yyyy-MM-dd"))
{
switch (chl.DrawerNo)
{
@ -528,6 +528,12 @@ namespace DM_Weight.ViewModels
InvoiceId = oi.OrderNo
//, StockQuantity = nowChannels.Sum(it => it.Quantity)
}).ExecuteCommand();
#region 使
//1查询取走药箱时间
DateTime? strEffDate= SqlSugarHelper.Db.Queryable<MachineRecord>().Where(mr => mr.DrawerNo == cs.DrawerNo && mr.Type == 55 && mr.OptionType == 0).Select(mr => mr.EffDate).First();
#endregion
}
//保存账册
int iInsertResult = SqlSugarHelper.Db.Insertable(new AccountBookG2()

View File

@ -0,0 +1,554 @@
using DM_Weight.Models;
using DM_Weight.Port;
using DM_Weight.util;
using log4net;
using log4net.Repository.Hierarchy;
using Prism.Commands;
using Prism.Events;
using Prism.Mvvm;
using Prism.Regions;
using System;
using System.Collections.Generic;
using System.Drawing.Printing;
using System.Linq;
using System.Security.Cryptography.Pkcs;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Media;
namespace DM_Weight.ViewModels
{
public class OpenBoxNewWindowViewModel : BindableBase, INavigationAware, IRegionMemberLifetime
{
private readonly ILog logger = LogManager.GetLogger(typeof(CheckOrderNewWindowViewModel));
private int _drawerType = -1;
public int DrawerType
{
get => _drawerType;
set => SetProperty(ref _drawerType, value);
}
//所选药箱号
private int _drawerNo = -1;
public int DrawerNo
{
get => _drawerNo;
set => SetProperty(ref _drawerNo, value);
}
//开名下药箱按钮的显示状态
private bool _selfEnable = false;
public bool SelfEnable { get => _selfEnable; set => SetProperty(ref _selfEnable, value); }
//名下药箱按钮显示内容
private string _selfContent="打开药箱";
public string SelfContent { get => _selfContent; set => SetProperty(ref _selfContent, value); }
//开公共药箱按钮的显示状态
private bool _publicEnable = true;
public bool PublicEnable { get => _publicEnable; set => SetProperty(ref _publicEnable, value); }
//公共药箱按钮显示内容
private string _publicContent;
public string PublicContent { get => _publicContent; set => SetProperty(ref _publicContent, value); }
//公共药箱状态
//private int _publicStatus = 0;
//public int PublicStatus { get => _publicStatus; set => SetProperty(ref _publicStatus, value); }
//名下药箱状态
private int _selfStatus = 0;
public int SelfStatus { get => _selfStatus; set => SetProperty(ref _selfStatus, value); }
//抽屉号列表
public static List<ChannelList> iList = new List<ChannelList>();
//第几个抽屉号
//public static int iNumber = 1;
private PortUtil _portUtil;
IEventAggregator _eventAggregator;
public OpenBoxNewWindowViewModel(PortUtil portUtil, IEventAggregator eventAggregator)
{
_portUtil = portUtil;
_eventAggregator = eventAggregator;
}
#region
private Brush _button1Color = Brushes.White;
public Brush Button1Color
{
get => _button1Color;
set => SetProperty(ref _button1Color, value);
}
private Brush _button2Color = Brushes.White;
public Brush Button2Color
{
get => _button2Color;
set => SetProperty(ref _button2Color, value);
}
private Brush _button3Color = Brushes.White;
public Brush Button3Color
{
get => _button3Color;
set => SetProperty(ref _button3Color, value);
}
private Brush _button4Color = Brushes.White;
public Brush Button4Color
{
get => _button4Color;
set => SetProperty(ref _button4Color, value);
}
private Brush _button5Color = Brushes.White;
public Brush Button5Color
{
get => _button5Color;
set => SetProperty(ref _button5Color, value);
}
private Brush _button6Color = Brushes.White;
public Brush Button6Color
{
get => _button6Color;
set => SetProperty(ref _button6Color, value);
}
private Brush _button7Color = Brushes.White;
public Brush Button7Color
{
get => _button7Color;
set => SetProperty(ref _button7Color, value);
}
private Brush _button8Color = Brushes.White;
public Brush Button8Color
{
get => _button8Color;
set => SetProperty(ref _button8Color, value);
}
private Brush _button9Color = Brushes.White;
public Brush Button9Color
{
get => _button9Color;
set => SetProperty(ref _button9Color, value);
}
private Brush _button10Color = Brushes.White;
public Brush Button10Color
{
get => _button10Color;
set => SetProperty(ref _button10Color, value);
}
private Brush _button11Color = Brushes.White;
public Brush Button11Color
{
get => _button11Color;
set => SetProperty(ref _button11Color, value);
}
private Brush _button12Color = Brushes.White;
public Brush Button12Color
{
get => _button12Color;
set => SetProperty(ref _button12Color, value);
}
private Brush _button13Color = Brushes.White;
public Brush Button13Color
{
get => _button13Color;
set => SetProperty(ref _button13Color, value);
}
private Brush _button14Color = Brushes.White;
public Brush Button14Color
{
get => _button14Color;
set => SetProperty(ref _button14Color, value);
}
private Brush _button15Color = Brushes.White;
public Brush Button15Color
{
get => _button15Color;
set => SetProperty(ref _button15Color, value);
}
private Brush _button16Color = Brushes.White;
public Brush Button16Color
{
get => _button16Color;
set => SetProperty(ref _button16Color, value);
}
private Brush _button17Color = Brushes.White;
public Brush Button17Color
{
get => _button17Color;
set => SetProperty(ref _button17Color, value);
}
private Brush _button18Color = Brushes.White;
public Brush Button18Color
{
get => _button18Color;
set => SetProperty(ref _button18Color, value);
}
private bool _button1Enable = false;
public bool Button1Enable
{
get => _button1Enable;
set => SetProperty(ref _button1Enable, value);
}
private bool _button2Enable = false;
public bool Button2Enable
{
get => _button2Enable;
set => SetProperty(ref _button2Enable, value);
}
private bool _button3Enable = false;
public bool Button3Enable
{
get => _button3Enable;
set => SetProperty(ref _button3Enable, value);
}
private bool _button4Enable = false;
public bool Button4Enable
{
get => _button4Enable;
set => SetProperty(ref _button4Enable, value);
}
private bool _button5Enable = false;
public bool Button5Enable
{
get => _button5Enable;
set => SetProperty(ref _button5Enable, value);
}
private bool _button6Enable = false;
public bool Button6Enable
{
get => _button6Enable;
set => SetProperty(ref _button6Enable, value);
}
private bool _button7Enable = false;
public bool Button7Enable
{
get => _button7Enable;
set => SetProperty(ref _button7Enable, value);
}
private bool _button8Enable = false;
public bool Button8Enable
{
get => _button8Enable;
set => SetProperty(ref _button8Enable, value);
}
private bool _button9Enable = false;
public bool Button9Enable
{
get => _button9Enable;
set => SetProperty(ref _button9Enable, value);
}
private bool _button10Enable = false;
public bool Button10Enable
{
get => _button10Enable;
set => SetProperty(ref _button10Enable, value);
}
private bool _button11Enable = false;
public bool Button11Enable
{
get => _button11Enable;
set => SetProperty(ref _button11Enable, value);
}
private bool _button12Enable = false;
public bool Button12Enable
{
get => _button12Enable;
set => SetProperty(ref _button12Enable, value);
}
private bool _button13Enable = false;
public bool Button13Enable
{
get => _button13Enable;
set => SetProperty(ref _button13Enable, value);
}
private bool _button14Enable = false;
public bool Button14Enable
{
get => _button14Enable;
set => SetProperty(ref _button14Enable, value);
}
private bool _button15Enable = false;
public bool Button15Enable
{
get => _button15Enable;
set => SetProperty(ref _button15Enable, value);
}
private bool _button16Enable = false;
public bool Button16Enable
{
get => _button16Enable;
set => SetProperty(ref _button16Enable, value);
}
private bool _button17Enable = false;
public bool Button17Enable
{
get => _button17Enable;
set => SetProperty(ref _button17Enable, value);
}
private bool _button18Enable = false;
public bool Button18Enable
{
get => _button18Enable;
set => SetProperty(ref _button18Enable, value);
}
#endregion
public bool KeepAlive => false;
//设置按钮颜色
private void SetBtnColor(int drawerNo)
{
switch (drawerNo)
{
case 1:
Button1Color = Brushes.Yellow;
break;
case 2:
Button2Color = Brushes.Yellow;
break;
case 3:
Button3Color = Brushes.Yellow;
break;
case 4:
Button4Color = Brushes.Yellow;
break;
case 5:
Button5Color = Brushes.Yellow;
break;
case 6:
Button6Color = Brushes.Yellow;
break;
case 7:
Button7Color = Brushes.Yellow;
break;
case 8:
Button8Color = Brushes.Yellow;
break;
case 9:
Button9Color = Brushes.Yellow;
break;
case 10:
Button9Color = Brushes.Yellow;
break;
case 11:
Button9Color = Brushes.Yellow;
break;
case 12:
Button12Color = Brushes.Yellow;
break;
case 13:
Button13Color = Brushes.Yellow;
break;
case 14:
Button14Color = Brushes.Yellow;
break;
case 15:
Button15Color = Brushes.Yellow;
break;
case 16:
Button16Color = Brushes.Yellow;
break;
case 17:
Button17Color = Brushes.Yellow;
break;
case 18:
Button18Color = Brushes.Yellow;
break;
default:
break;
}
}
//设置按钮可用状态
private void SetBtnEnable(int drawerNo)
{
switch (drawerNo)
{
case 1:
Button1Enable = true;
break;
case 2:
Button2Enable = true;
break;
case 3:
Button3Enable = true;
break;
case 4:
Button4Enable = true;
break;
case 5:
Button5Enable = true;
break;
case 6:
Button6Enable = true;
break;
case 7:
Button7Enable = true;
break;
case 8:
Button8Enable = true;
break;
case 9:
Button9Enable = true;
break;
case 10:
Button10Enable = true;
break;
case 11:
Button11Enable = true;
break;
case 12:
Button12Enable = true;
break;
case 13:
Button13Enable = true;
break;
case 14:
Button14Enable = true;
break;
case 15:
Button15Enable = true;
break;
case 16:
Button16Enable = true;
break;
case 17:
Button17Enable = true;
break;
case 18:
Button18Enable = true;
break;
default:
break;
}
}
void RequestData()
{
List<ChannelList> chlList = SqlSugarHelper.Db.Queryable<ChannelList>().Where(cl => cl.MachineId == "DM5").ToList();//.Select(cl => cl.BelongUser).First();
if (chlList != null && chlList.Count > 0)
{
for (int i = 0; i < chlList.Count; i++)
{
ChannelList chl = chlList[i];
if (Convert.ToDateTime(chl.EffDate).ToString("yyyy-MM-dd") == DateTime.Now.ToString("yyyy-MM-dd"))
{
SetBtnColor(chl.DrawerNo);
}
//DrawerType== 1为公共药箱
if (chl.DrawerType == 1)
{
SetBtnEnable(chl.DrawerNo);
}
if (chl.BelongUser == HomeWindowViewModel.Operator.UserBarcode)
{
SetBtnEnable(chl.DrawerNo);
}
}
}
}
/// <summary>
/// 选择药箱,打开药箱
/// </summary>
public DelegateCommand<string> UpdateDrawerNo
{
get => new DelegateCommand<string>(OpenBoxAction);
}
public async void OpenBoxAction(string strDrawerNo)
{
DrawerNo = Convert.ToInt32(strDrawerNo);
DrawerType = SqlSugarHelper.Db.Queryable<ChannelList>().Where(cl => cl.MachineId == "DM5" && cl.DrawerNo == Convert.ToInt32(strDrawerNo)).Select(cl => cl.DrawerType).First();
SelfEnable = true;
//int listSelfState = SqlSugarHelper.Db.Queryable<ChannelList>().Where(cl => cl.MachineId == "DM5")
// .WhereIf(cl => cl.BelongUser == HomeWindowViewModel.Operator.UserBarcode).Select(cl => cl.DrawerState).First();
int listDrawerState = SqlSugarHelper.Db.Queryable<ChannelList>().Where(cl => cl.MachineId == "DM5" && cl.DrawerType == this.DrawerType)
.WhereIF(this.DrawerType == 0, cl => cl.BelongUser == HomeWindowViewModel.Operator.UserBarcode).Select(cl => cl.DrawerState).First();
if (DrawerType == 1) //公共药箱
{
if (listDrawerState == 0)
{
SelfContent = "还公共药箱";
}
else
{
SelfContent = "取公共药箱";
}
}
else
{
if (listDrawerState == 0)
{
SelfContent = "还名下药箱";
}
else
{
SelfContent = "取名下药箱";
}
}
}
public DelegateCommand<string> OpenBoxDelegate
{
get => new DelegateCommand<string>((DrawerType) =>
{
SearchBox();
}
);
}
private void SearchBox()
{
iList = SqlSugarHelper.Db.Queryable<ChannelList>().Where(cl => cl.MachineId == "DM5" && cl.DrawerType == this.DrawerType)
.WhereIF(this.DrawerType == 0, cl => cl.BelongUser == HomeWindowViewModel.Operator.UserBarcode).ToList();
// .Select(cl => cl.DrawerNo).ToList();
if (iList.Count > 0)
{
//_portUtil.SpeakAsync("正在打开药箱");
//_portUtil.DrawerNo = iList[iNumber];
//iNumber++;
//_portUtil.OpenBox();
for (int i = 0; i < iList.Count; i++)
{
ChannelList channelList = iList[i];
//记录开药箱日志
SqlSugarHelper.Db.Insertable(new MachineRecord()
{
MachineId = "DM5",
DrawerNo = channelList.DrawerNo,
Operator = HomeWindowViewModel.Operator?.Id,
OperationTime = DateTime.Now,
Type = 55,
InvoiceId = $"打开{iList[i]}号药箱",
OptionType= SelfContent.Substring(0,1)=="取"? 0:1
}).ExecuteCommand();
//记录药箱打开时间
channelList.EffDate = DateTime.Now.ToString();
channelList.DrawerState = SelfContent.Substring(0, 1) == "取" ? 0 : 1;
SqlSugarHelper.Db.Updateable(channelList).UpdateColumns(it => new { it.EffDate, it.DrawerState }).ExecuteCommand();
_portUtil.SpeakAsync($"正在打开{channelList.DrawerNo}号药箱");
logger.Info($"正在打开{channelList.DrawerNo}号药箱");
ModbusHelper.GetInstance().OpenBoxDoor(channelList.DrawerNo - 1);
Thread.Sleep(1000);
}
SelfStatus = 0;
PublicEnable = true;
SelfEnable = true;
DrawerType = -1;
}
}
public void OnNavigatedTo(NavigationContext navigationContext)
{
RequestData();
}
public bool IsNavigationTarget(NavigationContext navigationContext)
{
return true;
}
public void OnNavigatedFrom(NavigationContext navigationContext)
{
}
}
}

View File

@ -37,10 +37,21 @@ namespace DM_Weight.ViewModels
private bool _selfEnable = true;
public bool SelfEnable { get => _selfEnable; set => SetProperty(ref _selfEnable, value); }
//名下药箱按钮显示内容
private string _selfContent;
public string SelfContent { get => _selfContent; set => SetProperty(ref _selfContent, value); }
//开公共药箱按钮的显示状态
private bool _publicEnable = true;
public bool PublicEnable { get => _publicEnable; set => SetProperty(ref _publicEnable, value); }
//公共药箱按钮显示内容
private string _publicContent;
public string PublicContent { get => _publicContent; set => SetProperty(ref _publicContent, value); }
//公共药箱状态
private int _publicStatus = 0;
public int PublicStatus { get => _publicStatus; set => SetProperty(ref _publicStatus, value); }
@ -94,7 +105,7 @@ namespace DM_Weight.ViewModels
for (int i = 0; i < iList.Count; i++)
{
ChannelList channelList= iList[i];
ChannelList channelList = iList[i];
//记录开药箱日志
SqlSugarHelper.Db.Insertable(new MachineRecord()
{
@ -107,7 +118,8 @@ namespace DM_Weight.ViewModels
}).ExecuteCommand();
//记录药箱打开时间
channelList.EffDate = DateTime.Now.ToString("yyyy-MM-dd");
SqlSugarHelper.Db.Updateable(channelList).UpdateColumns(it=>new { it.EffDate }).ExecuteCommand();
channelList.DrawerState = 0;
SqlSugarHelper.Db.Updateable(channelList).UpdateColumns(it => new { it.EffDate, it.DrawerState }).ExecuteCommand();
_portUtil.SpeakAsync($"正在打开{channelList.DrawerNo}号药箱");
logger.Info($"正在打开{channelList.DrawerNo}号药箱");
@ -225,11 +237,28 @@ namespace DM_Weight.ViewModels
{
// 取消消息订阅
//_eventAggregator.GetEvent<PortUtilEvent>().Unsubscribe(DoMyPrismEvent);
CheckDrawerState();
}
public void OnNavigatedTo(NavigationContext navigationContext)
{
//_eventAggregator.GetEvent<PortUtilEvent>().Subscribe(DoMyPrismEvent);
}
//查询名下药箱与公共药箱状态
private void CheckDrawerState()
{
PublicContent = "开公共药箱";
int listSelfState = SqlSugarHelper.Db.Queryable<ChannelList>().Where(cl => cl.MachineId == "DM5")
.Where(cl => cl.BelongUser == HomeWindowViewModel.Operator.UserBarcode).Select(cl => cl.DrawerState).First();
if (listSelfState > 0)
{
SelfContent = "还名下药箱";
}
else
{
SelfContent = "取名下药箱";
}
}
}
}

View File

@ -181,12 +181,19 @@ namespace DM_Weight.ViewModels
// PremissionPath = "OrderTakeDrugNewWindow",
//};
//开药箱
//PremissionDm openBox = new PremissionDm
//{
// Id = 11,
// PremissionName = "开药箱",
// PremissionPath = "OpenBoxWindow",
//};
//开药箱
PremissionDm openBox = new PremissionDm
{
Id = 11,
PremissionName = "开药箱",
PremissionPath = "OpenBoxWindow",
PremissionPath = "OpenBoxNewWindow",
};
//核对处方
PremissionDm checkOrder = new PremissionDm

View File

@ -0,0 +1,97 @@
<UserControl x:Class="DM_Weight.Views.OpenBoxNewWindow"
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"
mc:Ignorable="d"
xmlns:convert="clr-namespace:DM_Weight.Converter"
d:DesignHeight="450" d:DesignWidth="800">
<UserControl.Resources>
<convert:OrderStatusConverter x:Key="OrderStatusConverter" />
<convert:DrawerSelectConverter x:Key="DrawerSelectConverter" />
<convert:BoxNumConverter x:Key="BoxNumConverter" />
<convert:StatusConverter x:Key="StatusConverter" />
</UserControl.Resources>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Grid Margin="6" Grid.Column="0">
<Grid.Resources>
<Style TargetType="{x:Type Button}" BasedOn="{StaticResource MaterialDesignPaperLightButton}">
<Setter Property="Foreground" Value="#00a0ea" />
<Setter Property="BorderBrush" Value="#00a0ea" />
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" Value="#d1e7f5" />
<Setter Property="BorderBrush" Value="#d1e7f5" />
</Trigger>
<DataTrigger Value="True">
<DataTrigger.Binding>
<MultiBinding Converter="{StaticResource DrawerSelectConverter}">
<Binding RelativeSource="{ RelativeSource Mode=Self }" Path="Content" />
<Binding Path="DrawerNo" />
</MultiBinding>
</DataTrigger.Binding>
<Setter Property="Background" Value="#d1e7f5" />
<Setter Property="BorderBrush" Value="#d1e7f5" />
</DataTrigger>
</Style.Triggers>
</Style>
</Grid.Resources>
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
<RowDefinition />
<RowDefinition />
<RowDefinition />
<RowDefinition />
<RowDefinition />
<RowDefinition />
<RowDefinition />
<!--<RowDefinition />-->
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<Button Margin="0 0 3 0" Grid.Row="0" Grid.Column="0" Width="120" Content="1号药箱" Background="{Binding Button1Color}" Command="{Binding UpdateDrawerNo,ConverterParameter=1}" CommandParameter="1" IsEnabled="{Binding Button1Enable}"/>
<Button Margin="0 0 3 0" Grid.Row="1" Grid.Column="0" Width="120" Content="2号药箱" Background="{Binding Button2Color}" Command="{Binding UpdateDrawerNo}" CommandParameter="2" IsEnabled="{Binding Button2Enable}"/>
<Button Margin="0 0 3 0" Grid.Row="2" Grid.Column="0" Width="120" Content="3号药箱" Background="{Binding Button3Color}" Command="{Binding UpdateDrawerNo}" CommandParameter="3" IsEnabled="{Binding Button3Enable}"/>
<Button Margin="0 0 3 0" Grid.Row="3" Grid.Column="0" Width="120" Content="4号药箱" Background="{Binding Button4Color}" Command="{Binding UpdateDrawerNo}" CommandParameter="4" IsEnabled="{Binding Button4Enable}"/>
<Button Margin="0 0 3 0" Grid.Row="4" Grid.Column="0" Width="120" Content="5号药箱" Background="{Binding Button5Color}" Command="{Binding UpdateDrawerNo}" CommandParameter="5" IsEnabled="{Binding Button5Enable}"/>
<Button Margin="0 0 3 0" Grid.Row="5" Grid.Column="0" Width="120" Content="6号药箱" Background="{Binding Button6Color}" Command="{Binding UpdateDrawerNo}" CommandParameter="6" IsEnabled="{Binding Button6Enable}"/>
<Button Margin="0 0 3 0" Grid.Row="6" Grid.Column="0" Width="120" Content="7号药箱" Background="{Binding Button7Color}" Command="{Binding UpdateDrawerNo}" CommandParameter="7" IsEnabled="{Binding Button7Enable}"/>
<Button Margin="0 0 3 0" Grid.Row="7" Grid.Column="0" Width="120" Content="8号药箱" Background="{Binding Button8Color}" Command="{Binding UpdateDrawerNo}" CommandParameter="8" IsEnabled="{Binding Button8Enable}"/>
<Button Margin="0 0 3 0" Grid.Row="8" Grid.Column="0" Width="120" Content="9号药箱" Background="{Binding Button9Color}" Command="{Binding UpdateDrawerNo}" CommandParameter="9" IsEnabled="{Binding Button9Enable}"/>
<Button Margin="0 0 3 0" Grid.Row="0" Grid.Column="1" Width="120" Content="10号药箱" Background="{Binding Button10Color}" Command="{Binding UpdateDrawerNo}" CommandParameter="10" IsEnabled="{Binding Button10Enable}"/>
<Button Grid.Row="1" Grid.Column="1" Width="120" Content="11号药箱" Background="{Binding Button11Color}" Command="{Binding UpdateDrawerNo}" CommandParameter="11" IsEnabled="{Binding Button11Enable}"/>
<Button Grid.Row="2" Grid.Column="1" Width="120" Content="12号药箱" Background="{Binding Button12Color}" Command="{Binding UpdateDrawerNo}" CommandParameter="12" IsEnabled="{Binding Button12Enable}"/>
<Button Grid.Row="3" Grid.Column="1" Width="120" Content="13号药箱" Background="{Binding Button13Color}" Command="{Binding UpdateDrawerNo}" CommandParameter="13" IsEnabled="{Binding Button13Enable}"/>
<Button Grid.Row="4" Grid.Column="1" Width="120" Content="14号药箱" Background="{Binding Button14Color}" Command="{Binding UpdateDrawerNo}" CommandParameter="14" IsEnabled="{Binding Button14Enable}"/>
<Button Grid.Row="5" Grid.Column="1" Width="120" Content="15号药箱" Background="{Binding Button15Color}" Command="{Binding UpdateDrawerNo}" CommandParameter="15" IsEnabled="{Binding Button15Enable}"/>
<Button Grid.Row="6" Grid.Column="1" Width="120" Content="16号药箱" Background="{Binding Button16Color}" Command="{Binding UpdateDrawerNo}" CommandParameter="16" IsEnabled="{Binding Button16Enable}"/>
<Button Grid.Row="7" Grid.Column="1" Width="120" Content="17号药箱" Background="{Binding Button17Color}" Command="{Binding UpdateDrawerNo}" CommandParameter="17" IsEnabled="{Binding Button17Enable}"/>
<Button Grid.Row="8" Grid.Column="1" Width="120" Content="18号药箱" Background="{Binding Button18Color}" Command="{Binding UpdateDrawerNo}" CommandParameter="18" IsEnabled="{Binding Button18Enable}"/>
<!--<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">
<materialDesign:Card Foreground="{DynamicResource PrimaryHueLightForegroundBrush}" Padding="8">
<Button Width="120" Content="{Binding SelfContent}" Command="{Binding OpenBoxDelegate}" CommandParameter="0"
IsEnabled="{Binding SelfEnable}"
materialDesign:ButtonProgressAssist.IsIndicatorVisible="{Binding SelfStatus, Converter={StaticResource StatusConverter}, ConverterParameter=opearBtnLoading}"
materialDesign:ButtonProgressAssist.IsIndeterminate="{Binding SelfStatus, Converter={StaticResource StatusConverter}, ConverterParameter=opearBtnLoading}"
Style="{StaticResource MaterialDesignOutlinedLightButton}"/>
</materialDesign:Card>
</Grid>
</Grid>
</UserControl>

View File

@ -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>
/// OpenBoxNewWindow.xaml 的交互逻辑
/// </summary>
public partial class OpenBoxNewWindow : UserControl
{
public OpenBoxNewWindow()
{
InitializeComponent();
}
}
}

View File

@ -44,8 +44,8 @@
</Grid.ColumnDefinitions>
<materialDesign:Card Grid.Column="0" Foreground="{DynamicResource PrimaryHueLightForegroundBrush}" Padding="8">
<Button Width="120" Content="开名下药箱" Command="{Binding OpenBoxDelegate}" CommandParameter="0"
IsEnabled="{Binding PublicEnable}"
<Button Width="120" Content="{Binding SelfContent}" Command="{Binding OpenBoxDelegate}" CommandParameter="0"
IsEnabled="{Binding SelfEnable}"
materialDesign:ButtonProgressAssist.IsIndicatorVisible="{Binding PublicStatus, Converter={StaticResource StatusConverter}, ConverterParameter=opearBtnLoading}"
materialDesign:ButtonProgressAssist.IsIndeterminate="{Binding PublicStatus, Converter={StaticResource StatusConverter}, ConverterParameter=opearBtnLoading}"
Style="{StaticResource MaterialDesignOutlinedLightButton}"/>
@ -53,7 +53,7 @@
</materialDesign:Card>
<materialDesign:Card Grid.Column="1" Foreground="{DynamicResource PrimaryHueLightForegroundBrush}" Padding="8">
<Button Width="120" Content="开公共药箱" Command="{Binding OpenBoxDelegate}" CommandParameter="1"
<Button Width="120" Content="{Binding PublicContent}" Command="{Binding OpenBoxDelegate}" CommandParameter="1"
IsEnabled="{Binding PublicEnable}"
materialDesign:ButtonProgressAssist.IsIndicatorVisible="{Binding SelfStatus, Converter={StaticResource StatusConverter}, ConverterParameter=opearBtnLoading}"
materialDesign:ButtonProgressAssist.IsIndeterminate="{Binding SelfStatus, Converter={StaticResource StatusConverter}, ConverterParameter=opearBtnLoading}"