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