麻醉师确认页面按钮保存单子状态
This commit is contained in:
parent
e74cd29702
commit
79f6ec12fa
|
@ -124,5 +124,6 @@
|
|||
<add key="wsdSerialPort" value="COM1"/>
|
||||
<!--温度查询定时执行时间-->
|
||||
<add key="Interval" value="60000"/>
|
||||
<add key="test" value="Y"/>
|
||||
</appSettings>
|
||||
</configuration>
|
|
@ -13,10 +13,11 @@ namespace DM_Weight.Converter
|
|||
{
|
||||
public object Convert(object[] value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
int iLength = value[0].ToString().Length;
|
||||
int ButtonDrawerNo = int.Parse(value[0].ToString().Substring(0, iLength-3));
|
||||
//int iLength = value[0].ToString().Length;
|
||||
int iLength = value[0].ToString().IndexOf("号药箱");
|
||||
int ButtonDrawerNo = int.Parse(value[0].ToString().Substring(0, iLength));
|
||||
int SelectedDrawerNo = int.Parse(value[1].ToString());
|
||||
return ButtonDrawerNo == SelectedDrawerNo+1;
|
||||
return ButtonDrawerNo == SelectedDrawerNo;
|
||||
}
|
||||
|
||||
public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture)
|
||||
|
|
|
@ -56,6 +56,10 @@ namespace DM_Weight.Port
|
|||
|
||||
public bool[] GetAllBoxState()
|
||||
{
|
||||
if (ConfigurationManager.AppSettings["test"]!=null&&ConfigurationManager.AppSettings["test"].ToString().Equals("Y"))
|
||||
{
|
||||
return new bool[] { false,false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false};
|
||||
}
|
||||
bool[] bools = Policy.Handle<Exception>()
|
||||
.Retry(3, (exception, retryCount) =>
|
||||
{
|
||||
|
@ -82,6 +86,10 @@ namespace DM_Weight.Port
|
|||
}
|
||||
public bool OpenBoxDoor(int boxNum)
|
||||
{
|
||||
if (ConfigurationManager.AppSettings["test"] != null && ConfigurationManager.AppSettings["test"].ToString().Equals("Y"))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
bool bFlag=false;
|
||||
Policy.Handle<Exception>().Retry(3, ((exception, retryCount) =>
|
||||
{
|
||||
|
|
|
@ -775,7 +775,7 @@ namespace DM_Weight.ViewModels
|
|||
RequestData();
|
||||
Status = 1;
|
||||
_portUtil.SpeakAsync($"正在打开{DrawerNo + 1}号药箱");
|
||||
logger.Info($"正在打开{DrawerNo + 1}号药箱");
|
||||
//logger.Info($"正在打开{DrawerNo + 1}号药箱");
|
||||
//记录开药箱日志
|
||||
SqlSugarHelper.Db.Insertable(machineRecord).ExecuteCommand();
|
||||
ModbusHelper.GetInstance().OpenBoxDoor(DrawerNo);
|
||||
|
|
|
@ -24,7 +24,7 @@ namespace DM_Weight.ViewModels
|
|||
internal class CheckSelfOrderWindowViewModel : BindableBase, INavigationAware, IRegionMemberLifetime
|
||||
{
|
||||
private readonly ILog logger = LogManager.GetLogger(typeof(CheckOrderNewWindowViewModel));
|
||||
System.Timers.Timer CheckBoxStatusTimer;
|
||||
//System.Timers.Timer CheckBoxStatusTimer;
|
||||
private int _drawerType = -1;
|
||||
|
||||
public int DrawerType
|
||||
|
@ -755,16 +755,16 @@ namespace DM_Weight.ViewModels
|
|||
SqlSugarHelper.Db.Insertable(machineRecord).ExecuteCommand();
|
||||
ModbusHelper.GetInstance().OpenBoxDoor(DrawerNo);
|
||||
SetBtnEnable(DrawerNo + 1, 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();
|
||||
}
|
||||
//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 + 1).First();
|
||||
if (channelList != null && (channelList.EffDate is null || Convert.ToDateTime(channelList.EffDate).ToString("yyyy-MM-dd") != DateTime.Now.ToString("yyyy-MM-dd")))
|
||||
|
@ -890,6 +890,7 @@ namespace DM_Weight.ViewModels
|
|||
get => new DelegateCommand(() =>
|
||||
{
|
||||
GetUseBox();
|
||||
CheckOrderAction();
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -1112,7 +1113,7 @@ namespace DM_Weight.ViewModels
|
|||
RequestData();
|
||||
AlertMsg alertMsg = new AlertMsg
|
||||
{
|
||||
Message = "所选单子已核对完成",
|
||||
Message = "所选单子已确认",
|
||||
Type = MsgType.SUCCESS,
|
||||
};
|
||||
_eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
|
||||
|
@ -1204,16 +1205,16 @@ namespace DM_Weight.ViewModels
|
|||
logger.Info($"正在打开{drawerNo}号药箱");
|
||||
ModbusHelper.GetInstance().OpenBoxDoor(drawerNo - 1);
|
||||
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();
|
||||
}
|
||||
//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")))
|
||||
|
@ -1225,24 +1226,24 @@ namespace DM_Weight.ViewModels
|
|||
|
||||
}
|
||||
}
|
||||
private void GetAllBoxState(object sender, ElapsedEventArgs e)
|
||||
{
|
||||
//查询药箱是否关闭,如果已经关闭则按钮可用,可继续开该编号的药箱
|
||||
if (DrawerNo >= 0)
|
||||
{
|
||||
bool[] boolArrs = ModbusHelper.GetInstance().GetAllBoxState();
|
||||
bool allFalse = Array.TrueForAll(boolArrs, b => b == false);
|
||||
if (allFalse)
|
||||
{
|
||||
if (CheckBoxStatusTimer.Enabled)
|
||||
{
|
||||
CheckBoxStatusTimer.Stop();
|
||||
}
|
||||
}
|
||||
//设置对应药箱按钮可用状态
|
||||
SetBtnEnable(DrawerNo, !boolArrs[DrawerNo]);
|
||||
}
|
||||
}
|
||||
//private void GetAllBoxState(object sender, ElapsedEventArgs e)
|
||||
//{
|
||||
// //查询药箱是否关闭,如果已经关闭则按钮可用,可继续开该编号的药箱
|
||||
// if (DrawerNo >= 0)
|
||||
// {
|
||||
// bool[] boolArrs = ModbusHelper.GetInstance().GetAllBoxState();
|
||||
// bool allFalse = Array.TrueForAll(boolArrs, b => b == false);
|
||||
// if (allFalse)
|
||||
// {
|
||||
// if (CheckBoxStatusTimer.Enabled)
|
||||
// {
|
||||
// CheckBoxStatusTimer.Stop();
|
||||
// }
|
||||
// }
|
||||
// //设置对应药箱按钮可用状态
|
||||
// SetBtnEnable(DrawerNo, !boolArrs[DrawerNo]);
|
||||
// }
|
||||
//}
|
||||
|
||||
public bool IsNavigationTarget(NavigationContext navigationContext)
|
||||
{
|
||||
|
|
|
@ -33,7 +33,7 @@
|
|||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid Margin="6" Grid.Column="0">
|
||||
<Grid.Resources>
|
||||
|
@ -156,7 +156,7 @@
|
|||
SelectedItem="{Binding selectOrderInfo}"
|
||||
materialDesign:ListViewAssist.HeaderRowBackground="#31ccec"
|
||||
materialDesign:DataGridAssist.ColumnHeaderPadding="10"
|
||||
materialDesign:ListViewAssist.ListViewItemPadding="13">
|
||||
materialDesign:ListViewAssist.ListViewItemPadding="3">
|
||||
<ListView.Resources>
|
||||
<Style TargetType="{x:Type GridViewColumnHeader}" BasedOn="{StaticResource {x:Type GridViewColumnHeader}}">
|
||||
<Setter Property="Foreground" Value="White" />
|
||||
|
@ -176,13 +176,13 @@
|
|||
</DataTemplate>
|
||||
</GridViewColumn.CellTemplate>
|
||||
</GridViewColumn>
|
||||
<GridViewColumn Width="80"
|
||||
<GridViewColumn Width="60"
|
||||
Header="姓名"
|
||||
DisplayMemberBinding="{Binding PName}" />
|
||||
<GridViewColumn Width="30"
|
||||
DisplayMemberBinding="{Binding Sex}"
|
||||
Header="性别"/>
|
||||
<GridViewColumn Width="100"
|
||||
<GridViewColumn Width="80"
|
||||
DisplayMemberBinding="{Binding OrderNo}"
|
||||
Header="单号"/>
|
||||
<!--<GridViewColumn Width="240"
|
||||
|
@ -201,28 +201,28 @@
|
|||
DisplayMemberBinding="{Binding _OrderDetail.Quantity}"
|
||||
Header="数量"/>-->
|
||||
|
||||
<GridViewColumn Width="100" Header="药品名称">
|
||||
<GridViewColumn Width="80" Header="药品名称">
|
||||
<GridViewColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<ListBox ItemsSource="{Binding OrderDetailList}" DisplayMemberPath="DrugInfo.DrugName" materialDesign:ListBoxItemAssist.ShowSelection="False"></ListBox>
|
||||
</DataTemplate>
|
||||
</GridViewColumn.CellTemplate>
|
||||
</GridViewColumn>
|
||||
<GridViewColumn Width="100" Header="药品批次">
|
||||
<GridViewColumn Width="80" Header="药品批次">
|
||||
<GridViewColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<ListBox ItemsSource="{Binding OrderDetailList}" DisplayMemberPath="SetManuNo" materialDesign:ListBoxItemAssist.ShowSelection="False"></ListBox>
|
||||
</DataTemplate>
|
||||
</GridViewColumn.CellTemplate>
|
||||
</GridViewColumn>
|
||||
<GridViewColumn Width="100" Header="药品效期">
|
||||
<GridViewColumn Width="80" Header="药品效期">
|
||||
<GridViewColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<ListBox ItemsSource="{Binding OrderDetailList}" DisplayMemberPath="SetEffDate" materialDesign:ListBoxItemAssist.ShowSelection="False"></ListBox>
|
||||
</DataTemplate>
|
||||
</GridViewColumn.CellTemplate>
|
||||
</GridViewColumn>
|
||||
<GridViewColumn Width="100" Header="数量">
|
||||
<GridViewColumn Width="40" Header="数量">
|
||||
<GridViewColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<ListBox ItemsSource="{Binding OrderDetailList}" DisplayMemberPath="Quantity" materialDesign:ListBoxItemAssist.ShowSelection="False"></ListBox>
|
||||
|
|
Loading…
Reference in New Issue