修改核对处方与开抽屉窗口
This commit is contained in:
parent
bdd640775d
commit
eb7fc78760
|
@ -73,7 +73,7 @@ namespace DM_Weight.Models
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// 默认值: 1
|
/// 默认值: 1 (公共药箱值为1,归属个人药箱值为0)
|
||||||
///</summary>
|
///</summary>
|
||||||
[SugarColumn(ColumnName = "drawer_type")]
|
[SugarColumn(ColumnName = "drawer_type")]
|
||||||
public int DrawerType { get; set; }
|
public int DrawerType { get; set; }
|
||||||
|
|
|
@ -17,6 +17,7 @@ using System.Linq;
|
||||||
using System.Linq.Expressions;
|
using System.Linq.Expressions;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows;
|
||||||
|
|
||||||
namespace DM_Weight.ViewModels
|
namespace DM_Weight.ViewModels
|
||||||
{
|
{
|
||||||
|
@ -94,12 +95,13 @@ namespace DM_Weight.ViewModels
|
||||||
RequestData();
|
RequestData();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private bool _isEnable = true;
|
private Visibility _isEnableList = Visibility.Collapsed;
|
||||||
public bool IsEnable { get => _isEnable; set => SetProperty(ref _isEnable, value); }
|
public Visibility IsEnableList { get => _isEnableList; set => SetProperty(ref _isEnableList, value); }
|
||||||
private int _status = 0;
|
private int _status = 0;
|
||||||
public int Status { get => _status; set { SetProperty(ref _status, value); } }
|
public int Status { get => _status; set { SetProperty(ref _status, value); } }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private List<OrderInfo> _ordersList = new List<OrderInfo>();
|
private List<OrderInfo> _ordersList = new List<OrderInfo>();
|
||||||
public List<OrderInfo> OrderInfoList
|
public List<OrderInfo> OrderInfoList
|
||||||
{
|
{
|
||||||
|
@ -146,11 +148,12 @@ namespace DM_Weight.ViewModels
|
||||||
int totalCount = 0;
|
int totalCount = 0;
|
||||||
if (DrawerNo >= 0)
|
if (DrawerNo >= 0)
|
||||||
{
|
{
|
||||||
|
IsEnableList = Visibility.Visible;
|
||||||
//查询当前药箱归属的药师
|
//查询当前药箱归属的药师
|
||||||
string currentDrawerUser = SqlSugarHelper.Db.Queryable<ChannelList>().Where(cl => cl.DrawerNo == DrawerNo && cl.MachineId == "DM5").Select(cl => cl.BelongUser).First();
|
string currentDrawerUser = SqlSugarHelper.Db.Queryable<ChannelList>().Where(cl => cl.DrawerNo == DrawerNo + 1 && cl.MachineId == "DM5").Select(cl => cl.BelongUser).First();
|
||||||
|
|
||||||
OrderInfoList = SqlSugarHelper.Db.Queryable<OrderInfo>()
|
OrderInfoList = SqlSugarHelper.Db.Queryable<OrderInfo>()
|
||||||
.Includes(oi=>oi._OrderDetail,od=>od.DrugInfo)
|
.Includes(oi => oi._OrderDetail, od => od.DrugInfo)
|
||||||
//.Includes(cl => cl.channelStocks, cs => cs.DrugInfo,di=>di.drugBase)
|
//.Includes(cl => cl.channelStocks, cs => cs.DrugInfo,di=>di.drugBase)
|
||||||
//.InnerJoin<OrderDetail>((oi, od) => oi.OrderNo == od.OrderNo)
|
//.InnerJoin<OrderDetail>((oi, od) => oi.OrderNo == od.OrderNo)
|
||||||
//.InnerJoin<DrugInfo>((oi, od, di) => od.DrugId == di.DrugId.ToString())
|
//.InnerJoin<DrugInfo>((oi, od, di) => od.DrugId == di.DrugId.ToString())
|
||||||
|
@ -159,7 +162,7 @@ namespace DM_Weight.ViewModels
|
||||||
.Where(oi => oi.DmStatus == 0)
|
.Where(oi => oi.DmStatus == 0)
|
||||||
.Where(oi => oi.HisDispFlag == 0)
|
.Where(oi => oi.HisDispFlag == 0)
|
||||||
.Where(oi => oi.CancelFlag == 0)
|
.Where(oi => oi.CancelFlag == 0)
|
||||||
.WhereIF(currentDrawerUser != null, oi => oi.DoctorCode == currentDrawerUser)
|
.Where(oi => oi.DoctorCode == currentDrawerUser)
|
||||||
.OrderBy(oi => oi.OrderId)
|
.OrderBy(oi => oi.OrderId)
|
||||||
.ToPageList(PageNum, PageSize, ref totalCount);
|
.ToPageList(PageNum, PageSize, ref totalCount);
|
||||||
|
|
||||||
|
@ -251,7 +254,7 @@ namespace DM_Weight.ViewModels
|
||||||
|
|
||||||
//Expression<Func<ChannelStock, bool>> updateExp = it => it.ManuNo == oi._OrderDetail.SetManuNo && it.EffDate == oi._OrderDetail.SetEffDate;
|
//Expression<Func<ChannelStock, bool>> updateExp = it => it.ManuNo == oi._OrderDetail.SetManuNo && it.EffDate == oi._OrderDetail.SetEffDate;
|
||||||
|
|
||||||
ChannelStock cs = SqlSugarHelper.Db.Queryable<ChannelStock>().Where(cs => cs.DrugId == oi._OrderDetail.DrugId && cs.ManuNo == oi._OrderDetail.SetManuNo && cs.EffDate == oi._OrderDetail.SetEffDate && cs.MachineId.Equals(ConfigurationManager.AppSettings["machineId"] ?? "DM5")&&cs.DrawerNo==DrawerNo).First();
|
ChannelStock cs = SqlSugarHelper.Db.Queryable<ChannelStock>().Where(cs => cs.DrugId == oi._OrderDetail.DrugId && cs.ManuNo == oi._OrderDetail.SetManuNo && cs.EffDate == oi._OrderDetail.SetEffDate && cs.MachineId.Equals(ConfigurationManager.AppSettings["machineId"] ?? "DM5") && cs.DrawerNo == DrawerNo).First();
|
||||||
if (cs == null)
|
if (cs == null)
|
||||||
{
|
{
|
||||||
empChannelStock += $"{oi.OrderNo},{oi._OrderDetail.DrugId},{oi._OrderDetail.SetManuNo},{oi._OrderDetail.SetEffDate}";
|
empChannelStock += $"{oi.OrderNo},{oi._OrderDetail.DrugId},{oi._OrderDetail.SetManuNo},{oi._OrderDetail.SetEffDate}";
|
||||||
|
@ -429,9 +432,8 @@ namespace DM_Weight.ViewModels
|
||||||
{
|
{
|
||||||
DrawerNo -= 1;
|
DrawerNo -= 1;
|
||||||
RequestData();
|
RequestData();
|
||||||
IsEnable = false;
|
|
||||||
Status = 1;
|
Status = 1;
|
||||||
_portUtil.SpeakAsync($"正在打开{DrawerNo+1}号药箱");
|
_portUtil.SpeakAsync($"正在打开{DrawerNo + 1}号药箱");
|
||||||
//记录开药箱日志
|
//记录开药箱日志
|
||||||
SqlSugarHelper.Db.Insertable(new MachineRecord()
|
SqlSugarHelper.Db.Insertable(new MachineRecord()
|
||||||
{
|
{
|
||||||
|
@ -440,7 +442,7 @@ namespace DM_Weight.ViewModels
|
||||||
Operator = HomeWindowViewModel.Operator?.Id,
|
Operator = HomeWindowViewModel.Operator?.Id,
|
||||||
OperationTime = DateTime.Now,
|
OperationTime = DateTime.Now,
|
||||||
Type = 55,
|
Type = 55,
|
||||||
InvoiceId = $"打开{DrawerNo+1}号药箱",
|
InvoiceId = $"打开{DrawerNo + 1}号药箱",
|
||||||
}).ExecuteCommand();
|
}).ExecuteCommand();
|
||||||
ModbusHelper.GetInstance().OpenBoxDoor(DrawerNo);
|
ModbusHelper.GetInstance().OpenBoxDoor(DrawerNo);
|
||||||
}
|
}
|
||||||
|
@ -501,7 +503,6 @@ namespace DM_Weight.ViewModels
|
||||||
{
|
{
|
||||||
Status = 3;
|
Status = 3;
|
||||||
}
|
}
|
||||||
IsEnable = true;
|
|
||||||
_portUtil.Operate = false;
|
_portUtil.Operate = false;
|
||||||
break;
|
break;
|
||||||
// 打开失败
|
// 打开失败
|
||||||
|
@ -513,7 +514,6 @@ namespace DM_Weight.ViewModels
|
||||||
};
|
};
|
||||||
_eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
|
_eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
|
||||||
|
|
||||||
IsEnable = true;
|
|
||||||
Status = 0;
|
Status = 0;
|
||||||
|
|
||||||
//记录药箱操作日志
|
//记录药箱操作日志
|
||||||
|
|
|
@ -21,12 +21,12 @@ namespace DM_Weight.ViewModels
|
||||||
public class OpenBoxWindowViewModel : BindableBase, INavigationAware, IRegionMemberLifetime
|
public class OpenBoxWindowViewModel : BindableBase, INavigationAware, IRegionMemberLifetime
|
||||||
{
|
{
|
||||||
private readonly ILog logger = LogManager.GetLogger(typeof(CheckOrderNewWindowViewModel));
|
private readonly ILog logger = LogManager.GetLogger(typeof(CheckOrderNewWindowViewModel));
|
||||||
private int _drawerNo = -1;
|
private int _drawerType = -1;
|
||||||
|
|
||||||
public int DrawerNo
|
public int DrawerType
|
||||||
{
|
{
|
||||||
get => _drawerNo;
|
get => _drawerType;
|
||||||
set => SetProperty(ref _drawerNo, value);
|
set => SetProperty(ref _drawerType, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
private int status = 0;
|
private int status = 0;
|
||||||
|
@ -43,10 +43,10 @@ namespace DM_Weight.ViewModels
|
||||||
|
|
||||||
//公共药箱状态
|
//公共药箱状态
|
||||||
private int _publicStatus = 0;
|
private int _publicStatus = 0;
|
||||||
public int PublicStatus { get => _publicStatus;set=>SetProperty(ref _publicStatus, value); }
|
public int PublicStatus { get => _publicStatus; set => SetProperty(ref _publicStatus, value); }
|
||||||
//名下药箱状态
|
//名下药箱状态
|
||||||
private int _selfStatus = 0;
|
private int _selfStatus = 0;
|
||||||
public int SelfStatus { get => _publicStatus;set=>SetProperty(ref _publicStatus,value); }
|
public int SelfStatus { get => _publicStatus; set => SetProperty(ref _publicStatus, value); }
|
||||||
|
|
||||||
|
|
||||||
//抽屉号列表
|
//抽屉号列表
|
||||||
|
@ -55,21 +55,21 @@ namespace DM_Weight.ViewModels
|
||||||
//public static int iNumber = 1;
|
//public static int iNumber = 1;
|
||||||
private PortUtil _portUtil;
|
private PortUtil _portUtil;
|
||||||
IEventAggregator _eventAggregator;
|
IEventAggregator _eventAggregator;
|
||||||
public OpenBoxWindowViewModel(PortUtil portUtil,IEventAggregator eventAggregator)
|
public OpenBoxWindowViewModel(PortUtil portUtil, IEventAggregator eventAggregator)
|
||||||
{
|
{
|
||||||
_portUtil = portUtil;
|
_portUtil = portUtil;
|
||||||
_eventAggregator = eventAggregator;
|
_eventAggregator = eventAggregator;
|
||||||
}
|
}
|
||||||
public DelegateCommand<string> OpenBoxDelegate
|
public DelegateCommand<string> OpenBoxDelegate
|
||||||
{
|
{
|
||||||
get => new DelegateCommand<string>((DrawerNo) =>
|
get => new DelegateCommand<string>((DrawerType) =>
|
||||||
{
|
{
|
||||||
this.DrawerNo = Convert.ToInt32(DrawerNo);
|
this.DrawerType = Convert.ToInt32(DrawerType);
|
||||||
switch (this.DrawerNo)
|
switch (this.DrawerType)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
PublicEnable = false;
|
PublicEnable = false;
|
||||||
PublicStatus=1;
|
PublicStatus = 1;
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
SelfEnable = false;
|
SelfEnable = false;
|
||||||
|
@ -82,8 +82,8 @@ namespace DM_Weight.ViewModels
|
||||||
}
|
}
|
||||||
private void SearchBox()
|
private void SearchBox()
|
||||||
{
|
{
|
||||||
iList = SqlSugarHelper.Db.Queryable<ChannelList>().Where(cl => cl.MachineId == "DM5" && cl.DrawerType == this.DrawerNo)
|
iList = SqlSugarHelper.Db.Queryable<ChannelList>().Where(cl => cl.MachineId == "DM5" && cl.DrawerType == this.DrawerType)
|
||||||
.WhereIF(this.DrawerNo==0,cl=> cl.BelongUser == HomeWindowViewModel.Operator.UserBarcode)
|
.WhereIF(this.DrawerType == 0, cl => cl.BelongUser == HomeWindowViewModel.Operator.UserBarcode)
|
||||||
.Select(cl => cl.DrawerNo).ToList();
|
.Select(cl => cl.DrawerNo).ToList();
|
||||||
if (iList.Count > 0)
|
if (iList.Count > 0)
|
||||||
{
|
{
|
||||||
|
@ -91,7 +91,6 @@ namespace DM_Weight.ViewModels
|
||||||
//_portUtil.DrawerNo = iList[iNumber];
|
//_portUtil.DrawerNo = iList[iNumber];
|
||||||
//iNumber++;
|
//iNumber++;
|
||||||
//_portUtil.OpenBox();
|
//_portUtil.OpenBox();
|
||||||
logger.Info("");
|
|
||||||
|
|
||||||
for (int i = 0; i < iList.Count; i++)
|
for (int i = 0; i < iList.Count; i++)
|
||||||
{
|
{
|
||||||
|
@ -106,6 +105,7 @@ namespace DM_Weight.ViewModels
|
||||||
InvoiceId = $"打开{iList[i]}号药箱",
|
InvoiceId = $"打开{iList[i]}号药箱",
|
||||||
}).ExecuteCommand();
|
}).ExecuteCommand();
|
||||||
_portUtil.SpeakAsync($"正在打开{iList[i]}号药箱");
|
_portUtil.SpeakAsync($"正在打开{iList[i]}号药箱");
|
||||||
|
logger.Info($"正在打开{iList[i]}号药箱");
|
||||||
ModbusHelper.GetInstance().OpenBoxDoor(iList[i] - 1);
|
ModbusHelper.GetInstance().OpenBoxDoor(iList[i] - 1);
|
||||||
Thread.Sleep(1000);
|
Thread.Sleep(1000);
|
||||||
}
|
}
|
||||||
|
@ -114,7 +114,7 @@ namespace DM_Weight.ViewModels
|
||||||
SelfStatus = 0;
|
SelfStatus = 0;
|
||||||
PublicEnable = true;
|
PublicEnable = true;
|
||||||
SelfEnable = true;
|
SelfEnable = true;
|
||||||
DrawerNo = -1;
|
DrawerType = -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
void DoMyPrismEvent(DeviceMsg msg)
|
void DoMyPrismEvent(DeviceMsg msg)
|
||||||
|
@ -138,7 +138,7 @@ namespace DM_Weight.ViewModels
|
||||||
//{
|
//{
|
||||||
//_portUtil.DrawerNo = iList[iNumber];
|
//_portUtil.DrawerNo = iList[iNumber];
|
||||||
//iNumber++;
|
//iNumber++;
|
||||||
if(PublicStatus==1)
|
if (PublicStatus == 1)
|
||||||
{
|
{
|
||||||
PublicStatus = 2;
|
PublicStatus = 2;
|
||||||
}
|
}
|
||||||
|
@ -177,7 +177,7 @@ namespace DM_Weight.ViewModels
|
||||||
}
|
}
|
||||||
PublicEnable = true;
|
PublicEnable = true;
|
||||||
SelfEnable = true;
|
SelfEnable = true;
|
||||||
DrawerNo = -1;
|
DrawerType = -1;
|
||||||
//_portUtil.Operate = false;
|
//_portUtil.Operate = false;
|
||||||
break;
|
break;
|
||||||
// 打开失败
|
// 打开失败
|
||||||
|
@ -191,7 +191,7 @@ namespace DM_Weight.ViewModels
|
||||||
|
|
||||||
PublicEnable = true;
|
PublicEnable = true;
|
||||||
SelfEnable = true;
|
SelfEnable = true;
|
||||||
DrawerNo = -1;
|
DrawerType = -1;
|
||||||
PublicStatus = 0;
|
PublicStatus = 0;
|
||||||
SelfStatus = 0;
|
SelfStatus = 0;
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,7 @@ using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace DM_Weight.ViewModels
|
namespace DM_Weight.ViewModels
|
||||||
{
|
{
|
||||||
public class WSDRecordWindowViewModel : BindableBase, IRegionMemberLifetime
|
public class WSDRecordWindowViewModel : BindableBase, INavigationAware, IRegionMemberLifetime
|
||||||
{
|
{
|
||||||
private int _pageNum = 1;
|
private int _pageNum = 1;
|
||||||
public int PageNum
|
public int PageNum
|
||||||
|
@ -122,5 +122,20 @@ namespace DM_Weight.ViewModels
|
||||||
//.ToList();
|
//.ToList();
|
||||||
TotalCount = totalCount;
|
TotalCount = totalCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void OnNavigatedTo(NavigationContext navigationContext)
|
||||||
|
{
|
||||||
|
RequestData();
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool IsNavigationTarget(NavigationContext navigationContext)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void OnNavigatedFrom(NavigationContext navigationContext)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -99,7 +99,7 @@
|
||||||
<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="9" Grid.Column="1" Width="120" Content="20号药箱" Command="{Binding UpdateDrawerNo}" CommandParameter="20" IsEnabled="{Binding DrawerNo, Converter={StaticResource BoxNumConverter}, ConverterParameter=20}"/>-->
|
||||||
|
|
||||||
</Grid>
|
</Grid>
|
||||||
<Grid Grid.Column="1" Margin="6">
|
<Grid Grid.Column="1" Margin="6" Visibility="{Binding IsEnableList}">
|
||||||
<Grid.ColumnDefinitions>
|
<Grid.ColumnDefinitions>
|
||||||
<ColumnDefinition Width="Auto"/>
|
<ColumnDefinition Width="Auto"/>
|
||||||
<ColumnDefinition Width="Auto"/>
|
<ColumnDefinition Width="Auto"/>
|
||||||
|
@ -196,7 +196,8 @@
|
||||||
</ListView>
|
</ListView>
|
||||||
<!--</Grid>-->
|
<!--</Grid>-->
|
||||||
<!--<Grid Grid.Column="1" Grid.Row="1" Margin="0 0 0 0" HorizontalAlignment="Right">-->
|
<!--<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}"
|
<ListView Grid.Column="1" Grid.Row="1" Margin="0 0 0 0"
|
||||||
|
ItemsSource="{Binding TotalDrugList,UpdateSourceTrigger=PropertyChanged,Mode=TwoWay}"
|
||||||
materialDesign:ListViewAssist.HeaderRowBackground="#31ccec"
|
materialDesign:ListViewAssist.HeaderRowBackground="#31ccec"
|
||||||
materialDesign:DataGridAssist.ColumnHeaderPadding="10"
|
materialDesign:DataGridAssist.ColumnHeaderPadding="10"
|
||||||
materialDesign:ListViewAssist.ListViewItemPadding="13">
|
materialDesign:ListViewAssist.ListViewItemPadding="13">
|
||||||
|
|
|
@ -78,14 +78,14 @@
|
||||||
</ListView.Resources>
|
</ListView.Resources>
|
||||||
<ListView.View>
|
<ListView.View>
|
||||||
<GridView ColumnHeaderContainerStyle="{StaticResource st}">
|
<GridView ColumnHeaderContainerStyle="{StaticResource st}">
|
||||||
<GridViewColumn Width="100"
|
|
||||||
Header="检测时间"
|
|
||||||
DisplayMemberBinding="{Binding OperationTime, StringFormat='yyyy-MM-dd HH:mm:ss'}" />
|
|
||||||
<GridViewColumn Width="180"
|
<GridViewColumn Width="180"
|
||||||
DisplayMemberBinding="{Binding DrawerNo}"
|
Header="检测时间"
|
||||||
|
DisplayMemberBinding="{Binding AddTime, StringFormat='yyyy-MM-dd HH:mm:ss'}" />
|
||||||
|
<GridViewColumn Width="150"
|
||||||
|
DisplayMemberBinding="{Binding Temp}"
|
||||||
Header="温度"/>
|
Header="温度"/>
|
||||||
<GridViewColumn Width="100"
|
<GridViewColumn Width="150"
|
||||||
DisplayMemberBinding="{Binding InvoiceId}"
|
DisplayMemberBinding="{Binding Humi}"
|
||||||
Header="湿度"/>
|
Header="湿度"/>
|
||||||
</GridView>
|
</GridView>
|
||||||
</ListView.View>
|
</ListView.View>
|
||||||
|
|
Loading…
Reference in New Issue