配置文件添加test,是测试则开药箱及查状态直接返回。核对处方去掉查询数据库

This commit is contained in:
maqiao 2024-11-28 11:15:40 +08:00
parent fd77a36296
commit 1ba351b659
4 changed files with 42 additions and 33 deletions

View File

@ -124,5 +124,6 @@
<add key="wsdSerialPort" value="COM1"/>
<!--温度查询定时执行时间-->
<add key="Interval" value="60000"/>
<add key="test" value="Y"/>
</appSettings>
</configuration>

View File

@ -57,6 +57,10 @@ namespace DM_Weight.Port
public bool[] GetAllBoxState()
{
if (ConfigurationManager.AppSettings["test"] != null && ConfigurationManager.AppSettings["test"].ToString() == "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) =>
{
@ -85,6 +89,10 @@ namespace DM_Weight.Port
}
public bool OpenBoxDoor(int boxNum)
{
if (ConfigurationManager.AppSettings["test"]!=null&& ConfigurationManager.AppSettings["test"].ToString()=="Y")
{
return true;
}
bool bFlag=false;
Policy.Handle<Exception>().Retry(3, ((exception, retryCount) =>
{

View File

@ -360,36 +360,36 @@ namespace DM_Weight.ViewModels
int totalCount = 0;
if (DrawerNo >= 0)
{
//查询当前药箱归属的药师
////查询当前药箱归属的药师
ChannelList currentList = SqlSugarHelper.Db.Queryable<ChannelList>().Where(cl => cl.DrawerNo == DrawerNo + 1 && cl.MachineId == "DM5").First();//.Select(cl => cl.BelongUser).First();
string currentDrawerUser = currentList.BelongUser;
OrderInfoList = SqlSugarHelper.Db.Queryable<OrderInfo>()
.Includes(oi => oi.OrderDetailList, 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())
.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)
.OrderBy(oi => oi.OrderId)
.ToPageList(PageNum, PageSize, ref totalCount);
//string currentDrawerUser = currentList.BelongUser;
//OrderInfoList = SqlSugarHelper.Db.Queryable<OrderInfo>()
// .Includes(oi => oi.OrderDetailList, 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())
// .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)
// .OrderBy(oi => oi.OrderId)
// .ToPageList(PageNum, PageSize, ref totalCount);
if (OrderInfoList != null && OrderInfoList.Count() > 0)
{
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();
//if (OrderInfoList != null && OrderInfoList.Count() > 0)
//{
// 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();
}
else
{
TotalDrugList = null;
}
//}
//else
//{
// TotalDrugList = null;
//}
TotalCount = totalCount;
//TotalCount = totalCount;
PageCount = (int)Math.Ceiling((double)TotalCount / PageSize);
if (Convert.ToDateTime(currentList.EffDate).ToString("yyyy-MM-dd") == DateTime.Now.ToString("yyyy-MM-dd"))
{
@ -562,7 +562,7 @@ namespace DM_Weight.ViewModels
{
get => new DelegateCommand(() =>
{
CheckOrderAction();
//CheckOrderAction();
});
}

View File

@ -34,7 +34,7 @@
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<Grid Margin="6" Grid.Column="0">
<Grid.Resources>
@ -153,11 +153,11 @@
<Setter Property="Foreground" Value="White" />
</Style>
</ListView.Resources>
<i:Interaction.Triggers>
<!--<i:Interaction.Triggers>
<i:EventTrigger EventName="SelectionChanged">
<i:InvokeCommandAction Command="{Binding RowSelected}" />
</i:EventTrigger>
</i:Interaction.Triggers>
</i:Interaction.Triggers>-->
<ListView.View>
<GridView ColumnHeaderContainerStyle="{StaticResource st}">
<GridViewColumn Header="选择" Width="30">
@ -199,21 +199,21 @@
</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="30" Header="数量">
<GridViewColumn.CellTemplate>
<DataTemplate>
<ListBox ItemsSource="{Binding OrderDetailList}" DisplayMemberPath="Quantity" materialDesign:ListBoxItemAssist.ShowSelection="False"></ListBox>