添加时序清单功能

This commit is contained in:
MoYue 2024-04-16 17:58:37 +08:00
parent b4a89effd9
commit 6ca627a1ac
14 changed files with 242 additions and 15 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 718 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 358 KiB

View File

@ -23,6 +23,8 @@
<None Remove="Images\covers\yueA.jpg" />
<None Remove="Images\login_back.jpg" />
<None Remove="Images\Logo.png" />
<None Remove="Images\Snipaste.png" />
<None Remove="Images\海洋.jpg" />
</ItemGroup>
<ItemGroup>
@ -57,6 +59,12 @@
<Resource Include="Images\covers\yueA.jpg" />
<Resource Include="Images\login_back.jpg" />
<Resource Include="Images\Logo.png" />
<Resource Include="Images\Snipaste.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Resource>
<Resource Include="Images\海洋.jpg">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Resource>
</ItemGroup>
</Project>

View File

@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
@ -70,6 +71,19 @@ namespace InSituLaboratory.Entities
/// </summary>
public int? IsDelete { get; set; }
/// <summary>
/// 序号
/// </summary>
[NotMapped]
public int? DataIdNum { get; set; }
/// <summary>
/// 是否已删除
/// </summary>
[NotMapped]
public string? DeleteType { get; set; }
}
}

View File

@ -46,5 +46,16 @@ namespace InSituLaboratory.IService
SysSequentialDetails GetSequentialSequenceGroup(string SequenceGroup, string Sequential, int key);
/// <summary>
/// 获取历史时序清单
/// </summary>
/// <param name="key"></param>
/// <param name="pageSize"></param>
/// <param name="pageIndex"></param>
/// <param name="totalCount"></param>
/// <returns></returns>
IEnumerable<SysSequentialTotal> GetSysSequentialTotal(string key, int pageSize, int pageIndex, out int totalCount);
}
}

View File

@ -52,7 +52,7 @@ namespace InSituLaboratory.Service
/// <param name="Sequential"></param>
/// <param name="kind"></param>
/// <returns></returns>
public SysSequentialDetails GetSequentialSequenceGroup(string SequenceGroup, string Sequential,int key)
public SysSequentialDetails GetSequentialSequenceGroup(string SequenceGroup, string Sequential, int key)
{
var list = this.Query<SysSequentialDetails>(m => m.SequenceGroup == SequenceGroup && m.Sequential == Sequential && m.IsDelete == 0 && m.SysSquentialID == key).ToList();
if (list.Count == 0)
@ -65,5 +65,24 @@ namespace InSituLaboratory.Service
}
}
/// <summary>
/// 查询历史时序清单
/// </summary>
/// <param name="key"></param>
/// <param name="pageSize"></param>
/// <param name="pageIndex"></param>
/// <param name="totalCount"></param>
/// <returns></returns>
public IEnumerable<SysSequentialTotal> GetSysSequentialTotal(string key, int pageSize, int pageIndex, out int totalCount)
{
var pResult = this.QueryPage<SysSequentialTotal, string>(m => string.IsNullOrEmpty(key) || m.Sequential.Contains(key) || m.SequenceGroup.Contains(key) || m.SensorID.Contains(key), pageSize, pageIndex, order => order.CreateTime.ToString(), false);
totalCount = pResult.TotalCount;
return pResult.DataList;
}
}
}

View File

@ -69,6 +69,7 @@ namespace InSituLaboratory
containerRegistry.RegisterForNavigation<Views.Pages.History.CavityOtputCurrentView>();
containerRegistry.RegisterForNavigation<Views.Pages.History.CavityEnergyConversionView>();
containerRegistry.RegisterForNavigation<Views.Pages.History.CavityBatteryLevelView>();
containerRegistry.RegisterForNavigation<Views.Pages.History.SequentialHistoryView>();
containerRegistry.RegisterDialog<Views.Pages.Dialogs.ModifyMenuView>();
containerRegistry.RegisterDialog<Views.Pages.Dialogs.ModifyUserView>();

View File

@ -0,0 +1,71 @@
using InSituLaboratory.Controls;
using InSituLaboratory.Entities;
using InSituLaboratory.IService;
using Prism.Commands;
using Prism.Regions;
using Prism.Services.Dialogs;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace InSituLaboratory.ViewModels.Pages.History
{
/// <summary>
/// 历史时序
/// </summary>
public class SequentialHistoryViewModel : ViewModelBase
{
public PaginationModel PaginationModel { get; set; } = new PaginationModel();
IDialogService _dialogService;
ISysSequentialService _sysSequentialService;
public SequentialHistoryViewModel(IRegionManager regionManager, IDialogService dialogService, ISysSequentialService sysSequentialService) : base(regionManager)
{
PageTitle = "历史时序";
_dialogService = dialogService;
_sysSequentialService = sysSequentialService;
PaginationModel.NavCommand = new DelegateCommand<object>(index =>
{
PaginationModel.PageIndex = int.Parse(index.ToString());
this.Refresh();
});
Refresh();
}
public ObservableCollection<SysSequentialTotal> SequentialHistortyList { get; set; } = new ObservableCollection<SysSequentialTotal>();
public override void Refresh()
{
SequentialHistortyList.Clear();
var list = _sysSequentialService.GetSysSequentialTotal(SearchKey, PaginationModel.PageSize, PaginationModel.PageIndex, out int totalCount);
int index = 0;
foreach (var item in list)
{
index++;
SequentialHistortyList.Add(new SysSequentialTotal
{
DataIdNum = index + (PaginationModel.PageIndex - 1) * PaginationModel.PageSize,
StartTime = item.StartTime,
EndTime = item.EndTime,
SequenceGroup = item.SequenceGroup,
SensorID = item.SensorID,
WorkTime = item.WorkTime,
DurationTime = item.DurationTime,
CreateTime = item.CreateTime,
Sequential = item.Sequential,
DeleteType = item.IsDelete == 0 ? "未删除" : "已删除",
});
}
// 刷新分页组件的页码
PaginationModel.FillPageNumbers(totalCount);
}
}
}

View File

@ -24,26 +24,31 @@ namespace InSituLaboratory.ViewModels.Pages
public DelegateCommand<object> DeleteCommand { get; set; }
#region 1-5 /
#region 1-5 /
public DelegateCommand RefreshS1Command { get; set; }
public DelegateCommand SendS1Command { get; set; }
public DelegateCommand<object> ModifyS1Command { get; set; }
public DelegateCommand<object> DeleteS1Command { get; set; }
public DelegateCommand RefreshS2Command { get; set; }
public DelegateCommand SendS2Command { get; set; }
public DelegateCommand<object> ModifyS2Command { get; set; }
public DelegateCommand<object> DeleteS2Command { get; set; }
public DelegateCommand RefreshS3Command { get; set; }
public DelegateCommand SendS3Command { get; set; }
public DelegateCommand<object> ModifyS3Command { get; set; }
public DelegateCommand<object> DeleteS3Command { get; set; }
public DelegateCommand RefreshS4Command { get; set; }
public DelegateCommand SendS4Command { get; set; }
public DelegateCommand<object> ModifyS4Command { get; set; }
public DelegateCommand<object> DeleteS4Command { get; set; }
public DelegateCommand RefreshS5Command { get; set; }
public DelegateCommand SendS5Command { get; set; }
public DelegateCommand<object> ModifyS5Command { get; set; }
public DelegateCommand<object> DeleteS5Command { get; set; }
#endregion
@ -59,25 +64,30 @@ namespace InSituLaboratory.ViewModels.Pages
ModifyCommand = new DelegateCommand<object>(DoModify);
DeleteCommand = new DelegateCommand<object>(DoDelete);
#region 1-5 /
#region 1-5 /
RefreshS1Command = new DelegateCommand(RefreshS1);
SendS1Command = new DelegateCommand(SendS1);
ModifyS1Command = new DelegateCommand<object>(DoModifyS1);
DeleteS1Command = new DelegateCommand<object>(DoDeleteS1);
RefreshS2Command = new DelegateCommand(RefreshS2);
SendS2Command = new DelegateCommand(SendS2);
ModifyS2Command = new DelegateCommand<object>(DoModifyS2);
DeleteS2Command = new DelegateCommand<object>(DoDeleteS2);
RefreshS3Command = new DelegateCommand(RefreshS3);
SendS3Command = new DelegateCommand(SendS3);
ModifyS3Command = new DelegateCommand<object>(DoModifyS3);
DeleteS3Command = new DelegateCommand<object>(DoDeleteS3);
RefreshS4Command = new DelegateCommand(RefreshS4);
SendS4Command = new DelegateCommand(SendS4);
ModifyS4Command = new DelegateCommand<object>(DoModifyS4);
DeleteS4Command = new DelegateCommand<object>(DoDeleteS4);
RefreshS5Command = new DelegateCommand(RefreshS5);
SendS5Command = new DelegateCommand(SendS5);
ModifyS5Command = new DelegateCommand<object>(DoModifyS5);
DeleteS5Command = new DelegateCommand<object>(DoDeleteS5);
#endregion
@ -101,29 +111,34 @@ namespace InSituLaboratory.ViewModels.Pages
private string PageName { get; set; }
#region 1-5 /
#region 1-5 /
public virtual void RefreshS1() { }
public virtual void SendS1() { }
public virtual void DoModifyS1(object model) { }
public virtual void DoDeleteS1(object model) { }
public virtual void RefreshS2() { }
public virtual void SendS2() { }
public virtual void DoModifyS2(object model) { }
public virtual void DoDeleteS2(object model) { }
public virtual void RefreshS3() { }
public virtual void SendS3() { }
public virtual void DoModifyS3(object model) { }
public virtual void DoDeleteS3(object model) { }
public virtual void RefreshS4() { }
public virtual void SendS4() { }
public virtual void DoModifyS4(object model) { }
public virtual void DoDeleteS4(object model) { }
public virtual void RefreshS5() { }
public virtual void SendS5() { }
public virtual void DoModifyS5(object model) { }
public virtual void DoDeleteS5(object model) { }
#endregion

View File

@ -8,7 +8,7 @@
xmlns:c="clr-namespace:InSituLaboratory.Controls;assembly=InSituLaboratory.Controls"
mc:Ignorable="d"
FontFamily="{StaticResource DigitalDisplay}"
Height="400" Width="650">
Height="380" Width="680">
<UserControl.Resources>
<Style TargetType="TextBox">
<Setter Property="FontSize" Value="14"/>
@ -119,15 +119,15 @@
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<Image Source="/InSituLaboratory.Assets;component/Images/login_back.jpg"/>
<Image Source="/InSituLaboratory.Assets;component/Images/海洋.jpg" Stretch="Fill"/>
<StackPanel VerticalAlignment="Top" HorizontalAlignment="Center" Margin="0,60,0,0">
<TextBlock Text="欢迎使用" Foreground="#AAFFFFFF"/>
<TextBlock Text="原位实验室主控系统" Foreground="White" FontSize="15" Margin="0,10"/>
<TextBlock Text="v1.0" Foreground="#5FFF"/>
<TextBlock Text="欢迎使用" Foreground="White" FontSize="15" Margin="5,0"/>
<TextBlock Text="原位实验室主控系统" Foreground="White" FontSize="20" Margin="0,10"/>
<TextBlock Text="v1.0" Foreground="White" FontSize="15" Margin="5,0"/>
</StackPanel>
<TextBlock Text="2024 © ZTT" Foreground="#88FFFFFF" VerticalAlignment="Bottom" HorizontalAlignment="Center" FontSize="8" Margin="0,5"/>
<TextBlock Text="2024 © ZTT" Foreground="White" VerticalAlignment="Bottom" HorizontalAlignment="Center" FontSize="10" Margin="0,5"/>
<Grid Grid.Column="1" VerticalAlignment="Center" Margin="30,0,30,20">
<Grid.RowDefinitions>

View File

@ -16,8 +16,6 @@
<RowDefinition Height="auto"/>
</Grid.RowDefinitions>
<Grid Grid.Row="1">
<!--第一列-->
<Border CornerRadius="5" Background="#FAFCFF" Margin="10">

View File

@ -35,7 +35,7 @@
<hc:ComboBox Grid.Row="0" Name="pb" Margin="0,9,0,8" Grid.Column="1" IsEditable="False" ItemsSource="{Binding DeviceNodes}" DisplayMemberPath="Id" SelectedValuePath="Id" SelectedValue="{Binding SequenceGroup}" RenderTransformOrigin="0.498,0.193"/>
<hc:ComboBox Grid.Row="1" Margin="0,9,0,8" Grid.Column="1" IsEditable="False" ItemsSource="{Binding DeviceNodes}" DisplayMemberPath="DeviceName" SelectedValuePath="DeviceName" SelectedValue="{Binding SensorID}" RenderTransformOrigin="0.498,0.193"/>
<TextBox Grid.Row="2" Grid.Column="1" Margin="0,2" Height="30" Text="{Binding WorkTime,Mode=TwoWay,ValidatesOnNotifyDataErrors=True}" Style="{StaticResource ValidationTextBoxStyle}"/>
<TextBox Grid.Row="3" Grid.Column="1" Margin="0,2" Height="30" Text="{Binding DurationTime}" Style="{StaticResource ValidationTextBoxStyle}"/>
<TextBox Grid.Row="2" Grid.Column="1" Margin="0,2" Height="30" Text="{Binding WorkTime}" Style="{StaticResource NormalTextBoxStyle}"/>
<TextBox Grid.Row="3" Grid.Column="1" Margin="0,2" Height="30" Text="{Binding DurationTime}" Style="{StaticResource NormalTextBoxStyle}"/>
</Grid>
</UserControl>

View File

@ -0,0 +1,36 @@
<UserControl x:Class="InSituLaboratory.Views.Pages.History.SequentialHistoryView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:InSituLaboratory.Views.Pages.History"
xmlns:zxc="clr-namespace:InSituLaboratory.Controls;assembly=InSituLaboratory.Controls"
FontFamily="{StaticResource DigitalDisplay}"
mc:Ignorable="d" Template="{StaticResource PageSearchTempalte}">
<Grid Grid.IsSharedSizeScope="True" Margin="0,5,0,10">
<Grid.RowDefinitions>
<RowDefinition/>
<RowDefinition Height="50"/>
</Grid.RowDefinitions>
<ScrollViewer ScrollViewer.HorizontalScrollBarVisibility="Auto" ScrollViewer.VerticalScrollBarVisibility="Hidden" x:Name="sv" CanContentScroll="False" PreviewMouseWheel="ScrollViewer_PreviewMouseWheel">
<DataGrid ItemsSource="{Binding SequentialHistortyList }" FontSize="12" FontWeight="Bold" IsReadOnly="True" >
<DataGrid.Columns>
<DataGridTextColumn Header="序号" Width="40" Binding="{Binding DataIdNum}" />
<DataGridTextColumn Header="当前时序" Width="80" Binding="{Binding Sequential}" />
<DataGridTextColumn Header="创建时间" Width="140" Binding="{Binding CreateTime,StringFormat=yyyy-MM-dd HH:mm:ss}"/>
<DataGridTextColumn Header="开始时间" Width="140" Binding="{Binding StartTime,StringFormat=yyyy-MM-dd HH:mm:ss}"/>
<DataGridTextColumn Header="结束时间" Width="140" Binding="{Binding EndTime,StringFormat=yyyy-MM-dd HH:mm:ss}"/>
<DataGridTextColumn Header="配置号" Width="70" Binding="{Binding SequenceGroup}"/>
<DataGridTextColumn Header="传感器" Width="100" Binding="{Binding SensorID}"/>
<DataGridTextColumn Header="工作时长/s" Width="100" Binding="{Binding WorkTime}"/>
<DataGridTextColumn Header="循环时长/s" Width="100" Binding="{Binding DurationTime}"/>
<DataGridTextColumn Header="是否已删除" Width="100" Binding="{Binding DeleteType}"/>
</DataGrid.Columns>
</DataGrid>
</ScrollViewer>
<zxc:Pagination DataContext="{Binding PaginationModel}" Grid.Row="2" HorizontalAlignment="Center"/>
</Grid>
</UserControl>

View File

@ -0,0 +1,54 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
namespace InSituLaboratory.Views.Pages.History
{
/// <summary>
/// SequentialHistory.xaml 的交互逻辑
/// </summary>
public partial class SequentialHistoryView : UserControl
{
public SequentialHistoryView()
{
InitializeComponent();
}
/// <summary>
/// 支持鼠标滚轮上下滚动
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void ScrollViewer_PreviewMouseWheel(object sender, MouseWheelEventArgs e)
{
ScrollViewer viewer = sv; //sv 为Scrollview的名字在Xaml文件中定义。
if (viewer == null) return;
double num = Math.Abs((int)(e.Delta / 2));
double offset = 0.0;
if (e.Delta > 0)
{
offset = Math.Max((double)0.0, (double)(viewer.VerticalOffset - num));//viewer.VerticalOffset获取包含滚动内容的垂直偏移量的值。
}
else
{
offset = Math.Min(viewer.ScrollableHeight, viewer.VerticalOffset + num);
}
if (offset != viewer.VerticalOffset)
{
viewer.ScrollToVerticalOffset(offset);//将 ScrollViewer 内的内容滚动到指定的垂直偏移量位置。
e.Handled = true;
}
}
}
}