liuwf 1 year ago
commit c01aecda16

@ -0,0 +1,27 @@
<UserControl x:Class="Khd.Core.Wpf.CSS.PageControl"
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:Khd.Core.Wpf.CSS"
mc:Ignorable="d"
d:DesignHeight="35" d:DesignWidth="700">
<Viewbox>
<Grid x:Name="PageControlGrid">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="2*" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<StackPanel Grid.Column="1" Orientation="Horizontal" VerticalAlignment="Center" HorizontalAlignment="Center">
<Button x:Name="PreviousPageButton" Content="上一页" Style="{StaticResource ButtonPrimary}" VerticalAlignment="Center" Click="PreviousPageButton_Click"/>
<TextBlock Text="第" Foreground="White" VerticalAlignment="Center" Margin="5,0"/>
<TextBlock x:Name="CurrentPageControl" Text="{Binding CurrentPage,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" Foreground="White" VerticalAlignment="Center" Margin="5,0"/>
<TextBlock Text="页 / 共" Foreground="White" VerticalAlignment="Center" Margin="5,0"/>
<TextBlock x:Name="TotalPageControl" Text="{Binding TotalPage,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" Foreground="White" VerticalAlignment="Center" Margin="5,0"/>
<TextBlock Text="页" Foreground="White" VerticalAlignment="Center" Margin="5,0"/>
<Button x:Name="NextPageButton" Content="下一页" Style="{StaticResource ButtonPrimary}" VerticalAlignment="Center" Margin="5,0" Click="NextPageButton_Click"/>
</StackPanel>
</Grid>
</Viewbox>
</UserControl>

@ -0,0 +1,101 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
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 Khd.Core.Wpf.CSS
{
/// <summary>
/// PageControl.xaml 的交互逻辑
/// </summary>
public partial class PageControl : UserControl
{
public event RoutedEventHandler? PreviousPageClicked;
public event RoutedEventHandler? NextPageClicked;
public event SelectionChangedEventHandler? PageSizeComboBoxSelectionChanged;
public readonly PageInfo PageInfo = new();
public PageControl()
{
InitializeComponent();
this.PageControlGrid.DataContext = PageInfo;
}
private void PreviousPageButton_Click(object sender, RoutedEventArgs e)
{
PreviousPageClicked?.Invoke(this, e);
}
private void NextPageButton_Click(object sender, RoutedEventArgs e)
{
NextPageClicked?.Invoke(this, e);
}
}
#region PageInfo
public class PageInfo : INotifyPropertyChanged
{
private int _pageSize = 10;
private int _currentPage = 1;
private int _totalPage = 0;
public int PageSize
{
get => _pageSize;
set
{
if (_pageSize != value)
{
_pageSize = value;
OnPropertyChanged(nameof(PageSize));
}
}
}
public int CurrentPage
{
get => _currentPage;
set
{
if (_currentPage != value)
{
_currentPage = value;
OnPropertyChanged(nameof(CurrentPage));
}
}
}
public int TotalPage
{
get => _totalPage;
set
{
if (_totalPage != value)
{
_totalPage = value;
OnPropertyChanged(nameof(TotalPage));
}
}
}
public event PropertyChangedEventHandler? PropertyChanged;
protected void OnPropertyChanged(string propertyName)
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
}
#endregion
}

@ -4,6 +4,7 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:Khd.Core.Wpf.myConverter"
xmlns:pg="clr-namespace:Khd.Core.Wpf.CSS"
mc:Ignorable="d"
WindowStyle="None"
Closing="Window_Closing"
@ -1260,7 +1261,8 @@
</DataGrid>
</Grid>
<Grid Grid.Row="1" HorizontalAlignment="Center">
<hc:Pagination x:Name="Pagination1" MaxWidth="1500" MaxPageCount="1" Margin="0,0,0,15" PageUpdated="Pagination_PageUpdated" IsJumpEnabled="True" HorizontalAlignment="Center" Width="339" />
<pg:PageControl x:Name="PageControl1" Height="65" Margin="0,10" PreviousPageClicked="PageControl1_PreviousPageClicked" NextPageClicked="PageControl1_NextPageClicked"/>
<!--<hc:Pagination x:Name="Pagination1" MaxWidth="1500" Margin="0,0,0,15" PageUpdated="Pagination_PageUpdated" IsJumpEnabled="True" HorizontalAlignment="Center" Width="339" />-->
</Grid>
</Grid>
</StackPanel>
@ -1774,7 +1776,7 @@
<RowDefinition Height="0.8*"/>
<RowDefinition Height="5*"/>
<RowDefinition Height="0.4*"/>
<RowDefinition Height="0.7*"/>
</Grid.RowDefinitions>
<Border Background="#213269" BorderBrush="Silver" BorderThickness="2" CornerRadius="10" Margin="0,5,0,0">
@ -1966,7 +1968,9 @@
</DataGrid.ColumnHeaderStyle>
</DataGrid>
<StackPanel Grid.Row="3" VerticalAlignment="Center" HorizontalAlignment="Center" Orientation="Horizontal">
<hc:Pagination x:Name="Pagination2" Visibility="Visible" Height="50" MaxPageCount="1" Margin="0,0,0,15" PageUpdated="Pagination2_PageUpdated" HorizontalAlignment="Center" Width="339" />
<pg:PageControl x:Name="PageControl2" Height="65" PreviousPageClicked="PageControl2_PreviousPageClicked" NextPageClicked="PageControl2_NextPageClicked"/>
<!--<hc:Pagination x:Name="Pagination2" Visibility="Visible" Height="50" MaxPageCount="1" Margin="0,0,0,15" PageUpdated="Pagination2_PageUpdated" HorizontalAlignment="Center" Width="339" />-->
</StackPanel>
</Grid>
</TabItem>
@ -2130,7 +2134,11 @@
</Style>
</DataGrid.ColumnHeaderStyle>
</DataGrid>
<hc:Pagination x:Name="Pagination3" Grid.Row="3" MaxWidth="1500" MaxPageCount="1" Margin="0,0,0,15" PageUpdated="Pagination3_PageUpdated" IsJumpEnabled="True" HorizontalAlignment="Center" Width="339" />
<Grid Grid.Row="3" Height="100">
<pg:PageControl x:Name="PageControl3" VerticalAlignment="Center" Height="65" PreviousPageClicked="PageControl3_PreviousPageClicked" NextPageClicked="PageControl3_NextPageClicked"/>
</Grid>
<!--<hc:Pagination x:Name="Pagination3" Grid.Row="3" MaxWidth="1500" MaxPageCount="1" Margin="0,0,0,15" PageUpdated="Pagination3_PageUpdated" IsJumpEnabled="True" HorizontalAlignment="Center" Width="339" />-->
</Grid>
</TabItem>
<TabItem x:Name="ScanInManager" Header="扫描入库" Style="{StaticResource DefaultItem}" FontSize="25" HorizontalContentAlignment="Center" Background="#213269" VerticalContentAlignment="Center" Foreground="White" Width="160" Height="80" Margin="5">

@ -1149,7 +1149,8 @@ namespace Khd.Core.Wpf.Form
/// <param name="e"></param>
private void btnGetStocK_Click(object sender, RoutedEventArgs e)
{
Pagination1.PageIndex = 1;
//Pagination1.PageIndex = 1;
this.PageControl1.PageInfo.CurrentPage = 1;
this.EquipListSelectDy.SelectedIndex = -1;
locationDtos.Clear();
GetBaseLocations();
@ -1206,12 +1207,12 @@ namespace Khd.Core.Wpf.Form
}
var data = dbContext.ExecuteSqlQuery<LocationDto>(sql);
int sum = data.Count;
data = data.Skip((this.Pagination1.PageIndex - 1) * this.pageCount).Take(this.pageCount).ToList();
data = data.Skip((this.PageControl1.PageInfo.CurrentPage - 1) * this.pageCount).Take(this.pageCount).ToList();
data.ForEach(t =>
{
t.LocationStatus = SystemData.LocationStatusDic.GetValueOrDefault(t.LocationStatus, "未知");
});
Pagination1.MaxPageCount = (sum / pageCount) + (sum % pageCount == 0 ? 0 : 1);
this.PageControl1.PageInfo.TotalPage = (sum / pageCount) + (sum % pageCount == 0 ? 0 : 1);
this.LoadMaterial1.ItemsSource = null;
this.LoadMaterial1.ItemsSource = data;
this.LoadMaterial1.Items.Refresh();
@ -3258,19 +3259,20 @@ namespace Khd.Core.Wpf.Form
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private async void SelectButton_Click(object sender, RoutedEventArgs e)
private void SelectButton_Click(object sender, RoutedEventArgs e)
{
this.PageControl2.PageInfo.CurrentPage = 1;
CallSelectedItem.Clear();
await GetPersonCallMaterialData();
GetPersonCallMaterialData();
}
/// <summary>
/// 获取人员呼叫的物料数据
/// </summary>
private async Task GetPersonCallMaterialData()
private void GetPersonCallMaterialData()
{
try
{
int pageNumber = this.Pagination2.PageIndex;
int pageNumber = this.PageControl2.PageInfo.CurrentPage;
// 计算跳过的记录数
int skip = (pageNumber - 1) * pageCount;
@ -3301,7 +3303,7 @@ namespace Khd.Core.Wpf.Form
});
int totalRecords = groupWmsRawStock.Count();
Pagination2.MaxPageCount = (totalRecords / pageCount) + (totalRecords % pageCount == 0 ? 0 : 1);
this.PageControl2.PageInfo.TotalPage = (totalRecords / pageCount) + (totalRecords % pageCount == 0 ? 0 : 1);
groupWmsRawStock = groupWmsRawStock.Skip(skip).Take(pageCount);
//.GroupBy(t => t.palletInfoCode)
//.Select(t => new
@ -3312,14 +3314,14 @@ namespace Khd.Core.Wpf.Form
// materialId = string.Join("\n", t.Select(x => x.materialId)),
//}).ToList();
var palletInfoCodes = groupWmsRawStock.Select(t => t.palletInfoCode).Distinct().ToList();
var wmsBaseLocations = await dbContext.WmsBaseLocation
var wmsBaseLocations = dbContext.WmsBaseLocation
.Where(t => t.ContainerStatus == "1")
.Where(t => t.warehouseId == 512)
.Where(t => palletInfoCodes.Contains(t.containerCode)).ToListAsync();
.Where(t => palletInfoCodes.Contains(t.containerCode)).ToList();
if (string.IsNullOrEmpty(MaterialName.Text))
{
var tempMaterialIds = groupWmsRawStock.Select(x => x.materialId).Distinct().ToList();
materialInfos = await dbContext.MesBaseMaterialInfo.Where(x => tempMaterialIds.Contains(x.MaterialId)).ToListAsync();
materialInfos = dbContext.MesBaseMaterialInfo.Where(x => tempMaterialIds.Contains(x.MaterialId)).ToList();
}
var bill = from a in wmsBaseLocations
from b in groupWmsRawStock
@ -3382,7 +3384,7 @@ namespace Khd.Core.Wpf.Form
/// <param name="e"></param>
private async void Pagination2_PageUpdated(object sender, HandyControl.Data.FunctionEventArgs<int> e)
{
await GetPersonCallMaterialData();
GetPersonCallMaterialData();
}
/// <summary>
/// 页码改变时
@ -3925,7 +3927,7 @@ namespace Khd.Core.Wpf.Form
dbContext.AddRange(addList);
dbContext.SaveChanges();
transaction.Commit();
// HandyControl.Controls.MessageBox.Show("创建出库任务成功!");
// HandyControl.Controls.MessageBox.Show("创建出库任务成功!");
itemsControlItems.Clear();
CallSelectedItem.Clear();
GetPersonCallMaterialData();
@ -4872,6 +4874,7 @@ namespace Khd.Core.Wpf.Form
private void SelectInventoryButton_Click(object sender, RoutedEventArgs e)
{
this.PageControl3.PageInfo.CurrentPage = 1;
GetInvertoryData();
}
@ -4893,9 +4896,12 @@ namespace Khd.Core.Wpf.Form
using var dbContext = scope.ServiceProvider.GetRequiredService<DefaultDbContext>();
try
{
int totalCount = dbContext.WmsInventoryCheck
.Where(t => t.WarehouseId == 512).Count();
var list = dbContext.WmsInventoryCheck
.Where(t => t.WarehouseId == 512)
.OrderByDescending(t => t.CreateTime).Skip((this.Pagination3.PageIndex - 1) * this.pageCount).Take(this.pageCount).ToList();
.OrderByDescending(t => t.CreateTime).Skip((this.PageControl3.PageInfo.CurrentPage - 1) * this.pageCount).Take(this.pageCount).ToList();
this.PageControl3.PageInfo.TotalPage = totalCount / this.pageCount + totalCount % this.pageCount == 0 ? 0 : 1;
this.InventoryMaterial.ItemsSource = list.Select(t =>
new
{
@ -5763,6 +5769,65 @@ namespace Khd.Core.Wpf.Form
}
}
private void PageControl1_PreviousPageClicked(object sender, RoutedEventArgs e)
{
this.PageControl1.PageInfo.CurrentPage--;
if (this.PageControl1.PageInfo.CurrentPage < 1)
{
this.PageControl1.PageInfo.CurrentPage = 1;
}
GetLocations();
}
private void PageControl1_NextPageClicked(object sender, RoutedEventArgs e)
{
this.PageControl1.PageInfo.CurrentPage++;
if (this.PageControl1.PageInfo.CurrentPage > this.PageControl1.PageInfo.TotalPage)
{
this.PageControl1.PageInfo.CurrentPage = this.PageControl1.PageInfo.TotalPage;
}
GetLocations();
}
private void PageControl2_PreviousPageClicked(object sender, RoutedEventArgs e)
{
this.PageControl2.PageInfo.CurrentPage--;
if (this.PageControl2.PageInfo.CurrentPage < 1)
{
this.PageControl2.PageInfo.CurrentPage = 1;
}
GetPersonCallMaterialData();
}
private void PageControl2_NextPageClicked(object sender, RoutedEventArgs e)
{
this.PageControl2.PageInfo.CurrentPage++;
if (this.PageControl2.PageInfo.CurrentPage > this.PageControl2.PageInfo.TotalPage)
{
this.PageControl2.PageInfo.CurrentPage = this.PageControl2.PageInfo.TotalPage;
}
GetPersonCallMaterialData();
}
private void PageControl3_PreviousPageClicked(object sender, RoutedEventArgs e)
{
this.PageControl3.PageInfo.CurrentPage--;
if (this.PageControl3.PageInfo.CurrentPage < 1)
{
this.PageControl3.PageInfo.CurrentPage = 1;
}
GetInvertoryData();
}
private void PageControl3_NextPageClicked(object sender, RoutedEventArgs e)
{
this.PageControl3.PageInfo.CurrentPage++;
if (this.PageControl3.PageInfo.CurrentPage > this.PageControl3.PageInfo.TotalPage)
{
this.PageControl3.PageInfo.CurrentPage = this.PageControl3.PageInfo.TotalPage;
}
GetInvertoryData();
}
}
}

@ -3,8 +3,8 @@
//mysql
//"DefaultConnection": "server=106.12.13.113;port=3306;database=khd_jyhb;uid=root;pwd=root;charset='utf8';persistsecurityinfo=True;SslMode=none;Allow User Variables=True"
//khd
"DefaultConnection": "server=172.16.12.100;port=3306;database=hwjy-cloud;uid=kehaida;pwd=khdrkjy2024...;charset='utf8';persistsecurityinfo=True;SslMode=None;Allow User Variables=True"
//"DefaultConnection": "server=175.27.215.92;port=3306;database=hwjy-cloud;uid=kehaida;pwd=khd2024;charset='utf8';persistsecurityinfo=True;SslMode=none;Allow User Variables=True"
//"DefaultConnection": "server=172.16.12.100;port=3306;database=hwjy-cloud;uid=kehaida;pwd=khdrkjy2024...;charset='utf8';persistsecurityinfo=True;SslMode=None;Allow User Variables=True"
"DefaultConnection": "server=175.27.215.92;port=3306;database=hwjy-cloud;uid=kehaida;pwd=khd2024;charset='utf8';persistsecurityinfo=True;SslMode=none;Allow User Variables=True"
// "DefaultConnection": "server=localhost;port=3306;database=jyhb;uid=root;pwd=root;charset='utf8';persistsecurityinfo=True;SslMode=None;Allow User Variables=True"
},
"PlcConfigs": [

Loading…
Cancel
Save