1118 lines
42 KiB
C#
1118 lines
42 KiB
C#
|
|
using DM_Weight.Models;
|
|||
|
|
using DM_Weight.msg;
|
|||
|
|
using DM_Weight.Port;
|
|||
|
|
using DM_Weight.util;
|
|||
|
|
using DM_Weight.Views;
|
|||
|
|
using log4net;
|
|||
|
|
using Prism.Commands;
|
|||
|
|
using Prism.Events;
|
|||
|
|
using Prism.Mvvm;
|
|||
|
|
using Prism.Regions;
|
|||
|
|
using System;
|
|||
|
|
using System.Collections;
|
|||
|
|
using System.Collections.Generic;
|
|||
|
|
using System.Configuration;
|
|||
|
|
using System.Linq;
|
|||
|
|
using System.Text;
|
|||
|
|
using System.Threading;
|
|||
|
|
using System.Threading.Tasks;
|
|||
|
|
using System.Timers;
|
|||
|
|
using System.Windows.Media;
|
|||
|
|
|
|||
|
|
namespace DM_Weight.ViewModels
|
|||
|
|
{
|
|||
|
|
internal class CheckSelfOrderWindowNewViewModel : BindableBase, INavigationAware, IRegionMemberLifetime
|
|||
|
|
{
|
|||
|
|
private readonly ILog logger = LogManager.GetLogger(typeof(CheckOrderNewWindowViewModel));
|
|||
|
|
//System.Timers.Timer CheckBoxStatusTimer;
|
|||
|
|
private int _drawerType = -1;
|
|||
|
|
|
|||
|
|
public int DrawerType
|
|||
|
|
{
|
|||
|
|
get => _drawerType;
|
|||
|
|
set => SetProperty(ref _drawerType, value);
|
|||
|
|
}
|
|||
|
|
public bool KeepAlive => false;
|
|||
|
|
|
|||
|
|
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 int _drawerNo = -1;
|
|||
|
|
|
|||
|
|
public int DrawerNo
|
|||
|
|
{
|
|||
|
|
get => _drawerNo;
|
|||
|
|
set => SetProperty(ref _drawerNo, value);
|
|||
|
|
}
|
|||
|
|
//所选药箱号
|
|||
|
|
private int _currentDrawerNo = -1;
|
|||
|
|
|
|||
|
|
public int CurrentDrawerNo
|
|||
|
|
{
|
|||
|
|
get => _currentDrawerNo;
|
|||
|
|
set => SetProperty(ref _currentDrawerNo, 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 string _orderDate = DateTime.Now.ToString("yyyy-MM-dd");
|
|||
|
|
//名下药箱状态
|
|||
|
|
private int _selfStatus = 0;
|
|||
|
|
public int SelfStatus { get => _selfStatus; set => SetProperty(ref _selfStatus, value); }
|
|||
|
|
//抽屉号列表
|
|||
|
|
public static List<ChannelList> iList = new List<ChannelList>();
|
|||
|
|
/// <summary>
|
|||
|
|
/// 查询条件 处方日期
|
|||
|
|
/// </summary>
|
|||
|
|
public string OrderDate
|
|||
|
|
{
|
|||
|
|
get { return _orderDate; }
|
|||
|
|
set
|
|||
|
|
{
|
|||
|
|
if (!String.IsNullOrEmpty(value))
|
|||
|
|
{
|
|||
|
|
SetProperty(ref _orderDate, DateTime.Parse(value).ToString("yyyy-MM-dd"));
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
SetProperty(ref _orderDate, value);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
RequestData();
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
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); } }
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
//private List<OrderInfo> _ordersList = new List<OrderInfo>();
|
|||
|
|
//public List<OrderInfo> OrderInfoList
|
|||
|
|
//{
|
|||
|
|
// get => _ordersList;
|
|||
|
|
// set => SetProperty(ref _ordersList, value);
|
|||
|
|
//}
|
|||
|
|
|
|||
|
|
//取余液表数据
|
|||
|
|
private List<SurgicalResidual> _surgicalResidualList = new List<SurgicalResidual>();
|
|||
|
|
public List<SurgicalResidual> SurgicalResidualList
|
|||
|
|
{
|
|||
|
|
get => _surgicalResidualList;
|
|||
|
|
set => SetProperty(ref _surgicalResidualList, value);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
private List<TotalDrug>? _totalDrugList = new List<TotalDrug>();
|
|||
|
|
public List<TotalDrug>? TotalDrugList
|
|||
|
|
{
|
|||
|
|
get => _totalDrugList;
|
|||
|
|
set => SetProperty(ref _totalDrugList, value);
|
|||
|
|
}
|
|||
|
|
//选中行数据
|
|||
|
|
private SurgicalResidual _surgicalResidual;
|
|||
|
|
public SurgicalResidual surgicalResidual
|
|||
|
|
{
|
|||
|
|
get => _surgicalResidual;
|
|||
|
|
set => SetProperty(ref _surgicalResidual, value);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//private OrderInfo _selectOrderInfo;
|
|||
|
|
//public OrderInfo selectOrderInfo { get => _selectOrderInfo; set => SetProperty(ref _selectOrderInfo, value); }
|
|||
|
|
|
|||
|
|
#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
|
|||
|
|
//设置按钮颜色
|
|||
|
|
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:
|
|||
|
|
Button10Color = Brushes.Yellow;
|
|||
|
|
break;
|
|||
|
|
case 11:
|
|||
|
|
Button11Color = 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, bool status)
|
|||
|
|
{
|
|||
|
|
switch (drawerNo)
|
|||
|
|
{
|
|||
|
|
case 1:
|
|||
|
|
Button1Enable = status;
|
|||
|
|
//SelfEnable=status;
|
|||
|
|
break;
|
|||
|
|
case 2:
|
|||
|
|
Button2Enable = status;
|
|||
|
|
//SelfEnable = status;
|
|||
|
|
break;
|
|||
|
|
case 3:
|
|||
|
|
Button3Enable = status;
|
|||
|
|
//SelfEnable = status;
|
|||
|
|
break;
|
|||
|
|
case 4:
|
|||
|
|
Button4Enable = status;
|
|||
|
|
//SelfEnable = status;
|
|||
|
|
break;
|
|||
|
|
case 5:
|
|||
|
|
Button5Enable = status;
|
|||
|
|
//SelfEnable = status;
|
|||
|
|
break;
|
|||
|
|
case 6:
|
|||
|
|
Button6Enable = status;
|
|||
|
|
//SelfEnable = status;
|
|||
|
|
break;
|
|||
|
|
case 7:
|
|||
|
|
Button7Enable = status;
|
|||
|
|
//SelfEnable = status;
|
|||
|
|
break;
|
|||
|
|
case 8:
|
|||
|
|
Button8Enable = status;
|
|||
|
|
//SelfEnable = status;
|
|||
|
|
break;
|
|||
|
|
case 9:
|
|||
|
|
Button9Enable = status;
|
|||
|
|
//SelfEnable = status;
|
|||
|
|
break;
|
|||
|
|
case 10:
|
|||
|
|
Button10Enable = status;
|
|||
|
|
//SelfEnable = status;
|
|||
|
|
break;
|
|||
|
|
case 11:
|
|||
|
|
Button11Enable = status;
|
|||
|
|
//SelfEnable = status;
|
|||
|
|
break;
|
|||
|
|
case 12:
|
|||
|
|
Button12Enable = status;
|
|||
|
|
//SelfEnable = status;
|
|||
|
|
break;
|
|||
|
|
case 13:
|
|||
|
|
Button13Enable = status;
|
|||
|
|
//SelfEnable = status;
|
|||
|
|
break;
|
|||
|
|
case 14:
|
|||
|
|
Button14Enable = status;
|
|||
|
|
//SelfEnable = status;
|
|||
|
|
break;
|
|||
|
|
case 15:
|
|||
|
|
Button15Enable = status;
|
|||
|
|
//SelfEnable = status;
|
|||
|
|
break;
|
|||
|
|
case 16:
|
|||
|
|
Button16Enable = status;
|
|||
|
|
//SelfEnable = status;
|
|||
|
|
break;
|
|||
|
|
case 17:
|
|||
|
|
Button17Enable = status;
|
|||
|
|
//SelfEnable = status;
|
|||
|
|
break;
|
|||
|
|
case 18:
|
|||
|
|
Button18Enable = status;
|
|||
|
|
//SelfEnable = status;
|
|||
|
|
break;
|
|||
|
|
default:
|
|||
|
|
break;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
IEventAggregator _eventAggregator;
|
|||
|
|
//private PortUtil _portUtil;
|
|||
|
|
|
|||
|
|
SocketHelper _socketHelper;
|
|||
|
|
public CheckSelfOrderWindowNewViewModel(IEventAggregator eventAggregator, SocketHelper socketHelper)
|
|||
|
|
{
|
|||
|
|
//_portUtil = portUtil;
|
|||
|
|
_eventAggregator = eventAggregator;
|
|||
|
|
_socketHelper = socketHelper;
|
|||
|
|
}
|
|||
|
|
private string? _searchValue;
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 查询条件 查询字段值
|
|||
|
|
/// </summary>
|
|||
|
|
public string? SearchValue
|
|||
|
|
{
|
|||
|
|
get { return _searchValue; }
|
|||
|
|
set
|
|||
|
|
{
|
|||
|
|
SetProperty(ref _searchValue, value);
|
|||
|
|
RequestData();
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
void RequestData()
|
|||
|
|
{
|
|||
|
|
int totalCount = 0;
|
|||
|
|
if (DrawerNo >= 0)
|
|||
|
|
{
|
|||
|
|
//查询当前药箱归属的药师
|
|||
|
|
ChannelList currentList = SqlSugarHelper.Db.Queryable<ChannelList>().Where(cl => cl.DrawerNo == DrawerNo && cl.MachineId == "DM5").First();//.Select(cl => cl.BelongUser).First();
|
|||
|
|
DrawerType = currentList.DrawerType;
|
|||
|
|
//string currentDrawerUser = currentList.BelongUser;
|
|||
|
|
string currentDrawerUser = HomeWindowViewModel.Operator.UserBarcode;
|
|||
|
|
//OrderInfoList = SqlSugarHelper.Db.Queryable<OrderInfo>()
|
|||
|
|
// .Includes(oi => oi._OrderDetail, od => od.DrugInfo)
|
|||
|
|
// .Includes(oi => oi._OrderDetail, od => od.surgicalResidual)
|
|||
|
|
// .WhereIF(OrderDate != null, oi => oi.RecvDate.ToString("yyyy-MM-dd") == OrderDate)
|
|||
|
|
// .WhereIF(!String.IsNullOrEmpty(ConfigurationManager.AppSettings["storage"]), oi => oi.Pharmacy == ConfigurationManager.AppSettings["storage"])
|
|||
|
|
// .Where(oi => oi.DmStatus == 0)
|
|||
|
|
// .Where(oi => oi.HisDispFlag == 0)
|
|||
|
|
// .Where(oi => oi.CancelFlag == 0)
|
|||
|
|
// .Where(oi => oi.DoctorCode == currentDrawerUser)
|
|||
|
|
// .Where(oi => oi._OrderDetail.SetManuNo != null&&oi._OrderDetail.SetManuNo!="null")
|
|||
|
|
// .Where(oi=>oi._OrderDetail.Quantity>0)
|
|||
|
|
// .Where(oi=>oi._OrderDetail.surgicalResidual.SendNo== DrawerNo.ToString())
|
|||
|
|
// .OrderBy(oi => oi.OrderId)
|
|||
|
|
// .ToPageList(PageNum, PageSize, ref totalCount);
|
|||
|
|
//if (OrderInfoList != null && OrderInfoList.Count() > 0)
|
|||
|
|
//{
|
|||
|
|
// OrderInfoList.ForEach(oi => oi.ItemIsChecked = true);
|
|||
|
|
// OrderInfoList.ForEach(oi => oi._OrderDetail.DrugInfo = oi._OrderDetail.DrugInfo ?? new DrugInfo());
|
|||
|
|
// //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).Select(OrderDetailList => OrderDetailList._OrderDetail).GroupBy(item => item.DrugInfo.DrugName).Select(group => new TotalDrug { DrugName = group.Key, TotalCount = group.Sum(item => item.Quantity) }).ToList();
|
|||
|
|
//}
|
|||
|
|
//else
|
|||
|
|
//{
|
|||
|
|
// TotalDrugList = null;
|
|||
|
|
//}
|
|||
|
|
|
|||
|
|
SurgicalResidualList = SqlSugarHelper.Db.Queryable<SurgicalResidual>()
|
|||
|
|
.Includes(sr => sr.DrugInfo)
|
|||
|
|
.WhereIF(OrderDate != null, sr => sr.CreateTime.ToString("yyyy-MM-dd") == OrderDate)
|
|||
|
|
.Where(sr => sr.SendNo == DrawerNo.ToString() && sr.DmStatus == 0 && sr.DoctorCode == currentDrawerUser)
|
|||
|
|
.OrderBy(sr => sr.OrderNo)
|
|||
|
|
.ToPageList(PageNum, PageSize, ref totalCount);
|
|||
|
|
if (SurgicalResidualList != null && SurgicalResidualList.Count > 0)
|
|||
|
|
{
|
|||
|
|
SurgicalResidualList.ForEach(sr => sr.ItemIsChecked = true);
|
|||
|
|
TotalDrugList = SurgicalResidualList.Where(sr => sr.ItemIsChecked)
|
|||
|
|
// .Select(OrderDetailList => OrderDetailList._OrderDetail)
|
|||
|
|
.GroupBy(item => item.DrugInfo.DrugName)
|
|||
|
|
.Select(group => new TotalDrug { DrugName = group.Key, TotalCount = group.Sum(item => item.Quantity) }).ToList();
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
TotalDrugList = null;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
TotalCount = totalCount;
|
|||
|
|
PageCount = (int)Math.Ceiling((double)TotalCount / PageSize);
|
|||
|
|
if (Convert.ToDateTime(currentList.EffDate).ToString("yyyy-MM-dd") == DateTime.Now.ToString("yyyy-MM-dd"))
|
|||
|
|
{
|
|||
|
|
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:
|
|||
|
|
_button10Color = Brushes.Yellow;
|
|||
|
|
break;
|
|||
|
|
case 11:
|
|||
|
|
_button11Color = 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;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
GetUseBox();
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
/// <summary>
|
|||
|
|
/// 选择药箱,打开药箱
|
|||
|
|
/// </summary>
|
|||
|
|
public DelegateCommand<string> UpdateDrawerNo
|
|||
|
|
{
|
|||
|
|
get => new DelegateCommand<string>(OpenBoxAction);
|
|||
|
|
}
|
|||
|
|
public void OpenBoxAction(string strDrawerNo)
|
|||
|
|
{
|
|||
|
|
//if (ModbusHelper.BoxOperate)
|
|||
|
|
//{
|
|||
|
|
// Task.Factory.StartNew(() => { ModbusHelper.SpeakAsync("请关闭药箱后再打开"); });
|
|||
|
|
// return;
|
|||
|
|
//}
|
|||
|
|
if (_socketHelper.OpenStatus)
|
|||
|
|
{
|
|||
|
|
_socketHelper.speechSynthesizer.SpeakAsyncCancelAll();
|
|||
|
|
_socketHelper.speechSynthesizer.Resume();
|
|||
|
|
_socketHelper.SpeakAsync("请关闭手术间后再打开");
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
//SetAllBtnEnableFalse();
|
|||
|
|
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();
|
|||
|
|
|
|||
|
|
DrawerNo = Convert.ToInt32(strDrawerNo);
|
|||
|
|
CurrentDrawerNo += DrawerNo + 1;
|
|||
|
|
MachineRecord machineRecord = new MachineRecord();
|
|||
|
|
machineRecord.MachineId = "DM5";
|
|||
|
|
machineRecord.DrawerNo = DrawerNo;
|
|||
|
|
machineRecord.Operator = HomeWindowViewModel.Operator?.Id;
|
|||
|
|
machineRecord.OperationTime = DateTime.Now;
|
|||
|
|
machineRecord.Type = 55;
|
|||
|
|
machineRecord.InvoiceId = $"麻醉师核对单,打开{DrawerNo}号手术间";
|
|||
|
|
|
|||
|
|
|
|||
|
|
if (DrawerNo > 0)
|
|||
|
|
{
|
|||
|
|
RequestData();
|
|||
|
|
Status = 1;
|
|||
|
|
_socketHelper.speechSynthesizer.SpeakAsyncCancelAll();
|
|||
|
|
_socketHelper.speechSynthesizer.Resume();
|
|||
|
|
_socketHelper.SpeakAsync($"正在打开{DrawerNo}号手术间");
|
|||
|
|
logger.Info($"正在打开{DrawerNo}号手术间");
|
|||
|
|
//记录开药箱日志
|
|||
|
|
SqlSugarHelper.Db.Insertable(machineRecord).ExecuteCommand();
|
|||
|
|
//ModbusHelper.GetInstance().OpenBoxDoor(DrawerNo-1);
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
_socketHelper.SendMessage(new MyBaseMessage() { lockNo = (short)(DrawerNo - 1) });
|
|||
|
|
_socketHelper.dateTime = DateTime.Now;
|
|||
|
|
}
|
|||
|
|
catch (Exception ex)
|
|||
|
|
{
|
|||
|
|
AlertMsg alertMsg = new AlertMsg
|
|||
|
|
{
|
|||
|
|
Message = $"网口连接异常,正在重试{ex.Message}",
|
|||
|
|
Type = MsgType.ERROR,
|
|||
|
|
};
|
|||
|
|
_eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
|
|||
|
|
logger.Info($"网口连接异常,正在重试{ex.Message}");
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
_socketHelper.OpenStatus = true;
|
|||
|
|
//SetBtnEnable(DrawerNo, false);
|
|||
|
|
//if (CheckBoxStatusTimer is null)
|
|||
|
|
//{
|
|||
|
|
// CheckBoxStatusTimer = new System.Timers.Timer();
|
|||
|
|
//}
|
|||
|
|
//if (!CheckBoxStatusTimer.Enabled)
|
|||
|
|
//{
|
|||
|
|
// CheckBoxStatusTimer.Elapsed += new System.Timers.ElapsedEventHandler(GetAllBoxState);
|
|||
|
|
// CheckBoxStatusTimer.Interval = 3000;
|
|||
|
|
// CheckBoxStatusTimer.Start();
|
|||
|
|
//}
|
|||
|
|
//记录药箱打开时间
|
|||
|
|
ChannelList channelList = SqlSugarHelper.Db.Queryable<ChannelList>().Where(cl => cl.MachineId == "DM5" && cl.DrawerNo == DrawerNo).First();
|
|||
|
|
if (channelList != null && (channelList.EffDate is null || Convert.ToDateTime(channelList.EffDate).ToString("yyyy-MM-dd") != DateTime.Now.ToString("yyyy-MM-dd")))
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
channelList.EffDate = DateTime.Now.ToString();
|
|||
|
|
SqlSugarHelper.Db.Updateable(channelList).UpdateColumns(it => new { it.EffDate }).ExecuteCommand();
|
|||
|
|
}
|
|||
|
|
//Task.Factory.StartNew(async () =>
|
|||
|
|
//{
|
|||
|
|
// bool loop = true;
|
|||
|
|
// while (loop)
|
|||
|
|
// {
|
|||
|
|
// await Task.Delay(1000);
|
|||
|
|
// bool[] boolsl = ModbusHelper.GetInstance().GetAllBoxState();
|
|||
|
|
// bool state = Array.TrueForAll(boolsl, b => b == false);
|
|||
|
|
// if (state)
|
|||
|
|
// {
|
|||
|
|
// loop = false;
|
|||
|
|
// ModbusHelper.BoxOperate = false;
|
|||
|
|
// }
|
|||
|
|
// else
|
|||
|
|
// {
|
|||
|
|
// ModbusHelper.BoxOperate = true;
|
|||
|
|
// //ModbusHelper.SpeakAsync("药箱已打开,请及时关闭");
|
|||
|
|
// }
|
|||
|
|
// }
|
|||
|
|
//});
|
|||
|
|
Thread.Sleep(200);
|
|||
|
|
int iException = 0;
|
|||
|
|
new PromiseUtil<int>().taskAsyncLoop(500, 0, async (options, next, stop) =>
|
|||
|
|
{
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
if (_socketHelper.OpenStatus)
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
//bool[] boolsl = ModbusHelper.GetInstance().GetAllBoxState();
|
|||
|
|
_socketHelper.SendMessage(new MyBaseMessage() { lockNo = 0x33, functionCode = 4, delay = 2 });
|
|||
|
|
|
|||
|
|
//ModbusHelper.SpeakAsync($"i为{i};状态为:{_socketHelper.OpenStatus}");
|
|||
|
|
//bool state = Array.TrueForAll(boolsl, b => b == false);
|
|||
|
|
if (_socketHelper.OpenStatus)
|
|||
|
|
{
|
|||
|
|
//if (i == 0)
|
|||
|
|
//{
|
|||
|
|
// ModbusHelper.SpeakAsync("请及时关闭药箱");
|
|||
|
|
// i = 10;
|
|||
|
|
//}
|
|||
|
|
next();
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
_socketHelper.IsMultiThread = false;
|
|||
|
|
_socketHelper.dateTime = DateTime.Now;
|
|||
|
|
stop();
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
_socketHelper.IsMultiThread = false;
|
|||
|
|
_socketHelper.dateTime = DateTime.Now;
|
|||
|
|
stop();
|
|||
|
|
}
|
|||
|
|
iException = 0;
|
|||
|
|
}
|
|||
|
|
catch (Exception ex)
|
|||
|
|
{
|
|||
|
|
iException++;
|
|||
|
|
if (iException >= 3)
|
|||
|
|
{
|
|||
|
|
_socketHelper.OpenStatus = false;
|
|||
|
|
}
|
|||
|
|
// _socketHelper.OpenStatus = false;
|
|||
|
|
AlertMsg alertMsg = new AlertMsg
|
|||
|
|
{
|
|||
|
|
Message = $"网口连接异常,正在重试{ex.Message}",
|
|||
|
|
Type = MsgType.ERROR,
|
|||
|
|
};
|
|||
|
|
_eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
|
|||
|
|
logger.Info($"网口连接异常,正在重试{ex.Message}");
|
|||
|
|
next();
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
}
|
|||
|
|
//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()
|
|||
|
|
//{
|
|||
|
|
|
|||
|
|
// SetAllBtnEnableFalse();
|
|||
|
|
// 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].DrawerNo}号药箱",
|
|||
|
|
// 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);
|
|||
|
|
// }
|
|||
|
|
|
|||
|
|
// SelfStatus = 0;
|
|||
|
|
// PublicEnable = true;
|
|||
|
|
// //SelfEnable = true;
|
|||
|
|
// DrawerType = -1;
|
|||
|
|
// }
|
|||
|
|
//}
|
|||
|
|
public DelegateCommand RowSelected
|
|||
|
|
{
|
|||
|
|
get => new DelegateCommand(() =>
|
|||
|
|
{
|
|||
|
|
if (surgicalResidual != null)
|
|||
|
|
{
|
|||
|
|
SurgicalResidualList = SurgicalResidualList.Select(x =>
|
|||
|
|
{
|
|||
|
|
if (x.OrderNo == surgicalResidual.OrderNo)
|
|||
|
|
{
|
|||
|
|
x.ItemIsChecked = !x.ItemIsChecked;
|
|||
|
|
}
|
|||
|
|
return x;
|
|||
|
|
}).ToList();
|
|||
|
|
if (SurgicalResidualList != null && SurgicalResidualList.Count() > 0)
|
|||
|
|
{
|
|||
|
|
//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();
|
|||
|
|
|
|||
|
|
TotalDrugList = SurgicalResidualList.Where(oi => oi.ItemIsChecked).GroupBy(item => item.DrugInfo.DrugName).Select(group => new TotalDrug { DrugName = group.Key, TotalCount = group.Sum(item => item.Quantity) }).ToList();
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
}
|
|||
|
|
public DelegateCommand Query
|
|||
|
|
{
|
|||
|
|
get => new DelegateCommand(() =>
|
|||
|
|
{
|
|||
|
|
RequestData();
|
|||
|
|
});
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//确认
|
|||
|
|
public DelegateCommand CheckOrder
|
|||
|
|
{
|
|||
|
|
get => new DelegateCommand(() =>
|
|||
|
|
{
|
|||
|
|
if (DrawerNo == -1)
|
|||
|
|
{
|
|||
|
|
AlertMsg alertMsg = new AlertMsg
|
|||
|
|
{
|
|||
|
|
Message = "请先选择手术间",
|
|||
|
|
Type = MsgType.ERROR,
|
|||
|
|
};
|
|||
|
|
_eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
GetUseBox();
|
|||
|
|
CheckOrderAction();
|
|||
|
|
});
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
void CheckOrderAction()
|
|||
|
|
{
|
|||
|
|
var confirmData = SurgicalResidualList.Where(oi => oi.ItemIsChecked == true).ToList();
|
|||
|
|
if (confirmData.Count > 0)
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
var f = SqlSugarHelper.Db.UseTran(() =>
|
|||
|
|
{
|
|||
|
|
for (int i = 0; i < confirmData.Count; i++)
|
|||
|
|
{
|
|||
|
|
//OrderInfo oi = confirmData[i];
|
|||
|
|
SurgicalResidual surgicalResidual = confirmData[i];
|
|||
|
|
//查询该药箱是否有该批次的药品,没有则无法确认(避免管理进行确认时确认不过去)
|
|||
|
|
|
|||
|
|
int drawerNo = DrawerNo;
|
|||
|
|
ChannelStock cs = SqlSugarHelper.Db.Queryable<ChannelStock>()
|
|||
|
|
.Where(cs => cs.DrugId ==surgicalResidual.DrugId
|
|||
|
|
&& cs.ManuNo == surgicalResidual.ManuNo
|
|||
|
|
&& cs.MachineId.Equals(ConfigurationManager.AppSettings["machineId"] ?? "DM5")
|
|||
|
|
&& cs.DrawerNo == drawerNo).First();
|
|||
|
|
if (cs == null)
|
|||
|
|
{
|
|||
|
|
AlertMsg alertMsg = new AlertMsg
|
|||
|
|
{
|
|||
|
|
Message = $"处方{surgicalResidual.OrderNo}因药品批次{surgicalResidual.ManuNo}无库存,无法确认",
|
|||
|
|
Type = MsgType.ERROR,
|
|||
|
|
};
|
|||
|
|
_eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
|
|||
|
|
return false;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
SqlSugarHelper.Db.Updateable(new SurgicalResidual()
|
|||
|
|
{
|
|||
|
|
DmStatus = 1,
|
|||
|
|
OrderNo = surgicalResidual.OrderNo
|
|||
|
|
}).UpdateColumns(it => it.DmStatus).WhereColumns(it => new { it.OrderNo }).ExecuteCommand();
|
|||
|
|
|
|||
|
|
SqlSugarHelper.Db.Insertable(new OrderFinish()
|
|||
|
|
{
|
|||
|
|
OrderNo = surgicalResidual.OrderNo,
|
|||
|
|
PatientId = surgicalResidual.PatientId,
|
|||
|
|
//Pharmacy = surgicalResidual.Pharmacy,
|
|||
|
|
State = 1,
|
|||
|
|
Operator = HomeWindowViewModel.Operator?.Nickname,
|
|||
|
|
}).ExecuteCommand();
|
|||
|
|
}
|
|||
|
|
return true;
|
|||
|
|
});
|
|||
|
|
if (f.Data)
|
|||
|
|
{
|
|||
|
|
RequestData();
|
|||
|
|
AlertMsg alertMsg = new AlertMsg
|
|||
|
|
{
|
|||
|
|
Message = "所选单子已确认",
|
|||
|
|
Type = MsgType.SUCCESS,
|
|||
|
|
};
|
|||
|
|
_eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
|
|||
|
|
RequestData();
|
|||
|
|
}
|
|||
|
|
if (!f.IsSuccess)
|
|||
|
|
{
|
|||
|
|
AlertMsg alertMsg = new AlertMsg
|
|||
|
|
{
|
|||
|
|
Message = "核对失败!",
|
|||
|
|
Type = MsgType.ERROR,
|
|||
|
|
};
|
|||
|
|
_eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
|
|||
|
|
}
|
|||
|
|
Status = 0;
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
AlertMsg alertMsg = new AlertMsg
|
|||
|
|
{
|
|||
|
|
Message = "请勾选要核对的数据",
|
|||
|
|
Type = MsgType.ERROR
|
|||
|
|
};
|
|||
|
|
_eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//取消
|
|||
|
|
public DelegateCommand CancleTake
|
|||
|
|
{
|
|||
|
|
get => new DelegateCommand(() =>
|
|||
|
|
{
|
|||
|
|
GetUseBox();
|
|||
|
|
});
|
|||
|
|
}
|
|||
|
|
private void GetUseBox()
|
|||
|
|
{
|
|||
|
|
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 (chl != null && chl.EffDate != null)
|
|||
|
|
{
|
|||
|
|
SetBtnColor(chl.DrawerNo);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//DrawerType== 1为公共药箱
|
|||
|
|
if (chl.DrawerType == 1)
|
|||
|
|
{
|
|||
|
|
SetBtnEnable(chl.DrawerNo, true);
|
|||
|
|
}
|
|||
|
|
if (!string.IsNullOrEmpty(chl.BelongUser) && chl.BelongUser == HomeWindowViewModel.Operator.UserBarcode)
|
|||
|
|
{
|
|||
|
|
if (DrawerType == -1)
|
|||
|
|
{
|
|||
|
|
DrawerType = chl.DrawerType;
|
|||
|
|
}
|
|||
|
|
SetBtnEnable(chl.DrawerNo, true);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
public void OnNavigatedTo(NavigationContext navigationContext)
|
|||
|
|
{
|
|||
|
|
logger.Info("进入OnNavigatedTo");
|
|||
|
|
RequestData();
|
|||
|
|
logger.Info("结束RequestData");
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
public bool IsNavigationTarget(NavigationContext navigationContext)
|
|||
|
|
{
|
|||
|
|
return true;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
public void OnNavigatedFrom(NavigationContext navigationContext)
|
|||
|
|
{
|
|||
|
|
// 取消消息订阅
|
|||
|
|
//_eventAggregator.GetEvent<PortUtilEvent>().Unsubscribe(DoMyPrismEvent);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|