add-添加停机记录界面分页条

dev
liuwf 21 hours ago
parent 49740c4f51
commit daa3ed6b80

@ -68,7 +68,9 @@ namespace SlnMesnac.Extensions
}
SqlSugarScope Db = new SqlSugarScope(connectConfigList, db =>
{
db.Aop.OnLogExecuting = (sql, pars) => { };
db.Aop.OnLogExecuting = (sql, pars) => {
Console.WriteLine($"{DateTime.Now}==>{sql}\n");
};
});
return Db;

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>WinExe</OutputType>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0-windows</TargetFramework>
<Nullable>enable</Nullable>
<UseWPF>true</UseWPF>

@ -6,22 +6,25 @@
xmlns:local="clr-namespace:SlnMesnac.WPF.Templates"
xmlns:hc="https://handyorg.github.io/handycontrol"
mc:Ignorable="d"
Background="Transparent" Height="75" Width="880">
Background="Transparent" Height="75" Width="1080">
<StackPanel Orientation="Horizontal" Margin="10" VerticalAlignment="Center" >
<TextBlock FontSize="20" Text="共计:" VerticalAlignment="Center" Foreground="White" Background="Transparent" />
<TextBlock FontSize="20" Text="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=Total}" Margin="20,0,0,0"
Foreground="White" Background="Transparent" VerticalAlignment="Center"/>
<TextBlock FontSize="20" Text="条数据" Margin="20,0,0,0" Foreground="White" Background="Transparent" VerticalAlignment="Center"/>
<TextBlock FontSize="20" Text="共" Margin="20,0,0,0" Foreground="White" Background="Transparent" VerticalAlignment="Center"/>
<!--<TextBlock FontSize="20" Text="共" Margin="40,0,0,0" Foreground="White" Background="Transparent" VerticalAlignment="Center"/>
<TextBlock FontSize="20" Text="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=Page, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" Margin="10,0,0,0"
Foreground="White" Background="Transparent" VerticalAlignment="Center"/>
<TextBlock FontSize="20" Text="页" Margin="10,0,0,0" Foreground="White" Background="Transparent" VerticalAlignment="Center"/>
<TextBlock FontSize="20" Text="页" Margin="10,0,0,0" Foreground="White" Background="Transparent" VerticalAlignment="Center"/>-->
<!--<TextBlock FontSize="20" Text="第" Margin="30,0,0,0" Foreground="White" Background="Transparent" VerticalAlignment="Center"/>
<TextBox FontSize="20" Text="{Binding RelativeSource={RelativeSource AncestorType=UserControl}, Path=Current, Mode=OneWay}"
Margin="20,0,0,0" Width="60" Foreground="White" Background="Transparent" VerticalAlignment="Center"/>
Margin="5,0,0,0" Width="60" Foreground="White" Background="Transparent" VerticalAlignment="Center"/>
<TextBlock FontSize="20" Text="页" Margin="5,0,0,0" Foreground="White" Background="Transparent" VerticalAlignment="Center"/>
<Button FontSize="20" Command="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=GoCommand}"
Content="跳转" Margin="20,0,0,0" Width="100" Foreground="White" Background="Transparent" VerticalAlignment="Center"/>
Content="跳转" Margin="20,0,0,0" Width="100" Foreground="White" Background="Transparent" VerticalAlignment="Center"/>-->
<Button FontSize="20" Command="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=PreCommand}"
Content="上一页" Margin="20,0,0,0" Width="100" Foreground="White" Background="Transparent" VerticalAlignment="Center"/>
Content="上一页" Margin="40,0,0,0" Width="100" Foreground="White" Background="Transparent" VerticalAlignment="Center"/>
<Button FontSize="20" Command="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=NextCommand}"
Content="下一页" Margin="20,0,0,0" Width="100" Foreground="White" Background="Transparent" VerticalAlignment="Center"/>
<ComboBox Width="100" Foreground="Green" Background="Transparent" Margin="30,0,0,0"

@ -18,6 +18,8 @@ using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using static DevExpress.Drawing.Printing.Internal.DXPageSizeInfo;
#region << 版 本 注 释 >>
/*--------------------------------------------------------------------
@ -57,7 +59,6 @@ namespace SlnMesnac.WPF.ViewModel
{
PagenationModel = new PagenationModel<T>()
{
PageSize = 20,
FindPreCommand = new RelayCommand(OnPreCommand),
FindNextCommand = new RelayCommand(OnNextCommand),
FindTargetCommand = new RelayCommand(OnGoCommand)
@ -69,24 +70,31 @@ namespace SlnMesnac.WPF.ViewModel
}
#region 事件定义
private void OnPreCommand()
{
// 处理下一页逻辑
Task.Run(async () => await RefreshWcsTaskDataGrid(PagenationModel.Current - 1, PagenationModel.PageSize));
if (PagenationModel.Current == 1) return;
// 处理前一页逻辑
PagenationModel.Current = PagenationModel.Current - 1;
Task.Run(async () => await RefreshWcsTaskDataGrid(PagenationModel.Current, PagenationModel.PageSize));
}
private void OnNextCommand()
{
// 处理下一页逻辑
Task.Run(async () => await RefreshWcsTaskDataGrid(PagenationModel.Current + 1, PagenationModel.PageSize));
PagenationModel.Current = PagenationModel.Current + 1;
Task.Run(async () => await RefreshWcsTaskDataGrid(PagenationModel.Current, PagenationModel.PageSize));
}
private void OnGoCommand()
{
// 处理跳转到指定页逻辑
// 处理下一页逻辑
Task.Run(async () => await RefreshWcsTaskDataGrid(PagenationModel.Current, PagenationModel.PageSize));
}
#endregion
@ -98,9 +106,17 @@ namespace SlnMesnac.WPF.ViewModel
machineNameDic.Add(1019, "2楼烘干机");
machineNameDic.Add(1020, "2楼除尘机");
machineNameDic.Add(1021, "2楼喷码机");
PagenationModel.Total = await getListTotal();
PagenationModel.computePage();
await RefreshWcsTaskDataGrid(PagenationModel.Current, PagenationModel.PageSize);
}
private async Task<int> getListTotal()
{
List<int> deviceIds = new List<int> { 1016, 1017, 1018, 1019, 1020, 1021 };
int aa = await sqlSugarClient.AsTenant().GetConnection("mes").Queryable<DmsRecordShutDown>().Where(x => deviceIds.Contains(x.DeviceId)).CountAsync();
return aa;
}
#region 参数定义
@ -126,8 +142,10 @@ namespace SlnMesnac.WPF.ViewModel
/// <param name="palletTasks"></param>
private async Task RefreshWcsTaskDataGrid(int pageNumber=1,int pageSize=0)
{
try
{
PagenationModel.computePage();
List<int> deviceIds = new List<int> { 1016, 1017, 1018, 1019, 1020, 1021 };
List<DmsRecordShutDown> list = await sqlSugarClient.AsTenant().GetConnection("mes").Queryable<DmsRecordShutDown>().Where(x=>deviceIds.Contains(x.DeviceId)).OrderByDescending(x=>x.ShutBeginTime).ToPageListAsync(pageNumber,pageSize);
@ -153,6 +171,7 @@ namespace SlnMesnac.WPF.ViewModel
}catch(Exception ex)
{
Msg.MsgShow($"刷新停机记录信息{ex.Message}", 2, 3);
}
}

Loading…
Cancel
Save