库位区域建表

This commit is contained in:
hehaibing-1996
2025-01-11 19:05:57 +08:00
parent 94aa92f536
commit f9a1dab76a
10 changed files with 814 additions and 14 deletions

View File

@ -0,0 +1,22 @@
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace WCS.BLL.DbModels
{
/// <summary>
/// 库位区域
/// </summary>
[SugarTable("wcs_location_area")]
public class LocationAreaInfo
{
[SugarColumn(ColumnName = "id", IsPrimaryKey = true, IsNullable = false, IsIdentity = true)]
public int Id { get; set; }
[SugarColumn(ColumnName = "location_area", Length = 64, IsNullable = false, ColumnDescription = "库位区域")]
public string LocationArea { get; set; }
}
}

View File

@ -24,9 +24,14 @@ namespace WCS.DAL.DbModels
public string LocationCode { get; set; } public string LocationCode { get; set; }
/// <summary> /// <summary>
/// 位区域 /// 位区域
/// </summary>
[SugarColumn(ColumnName = "location_area_id", IsNullable = true, ColumnDescription = "库位区域Id")]
public int LocationAreaId { get; set; }
/// <summary>
/// 库位区域
/// </summary> /// </summary>
[SugarColumn(ColumnName = "location_area", Length = 64, IsNullable = false, ColumnDescription = "位置区域")] [SugarColumn(ColumnName = "location_area", Length = 64, IsNullable = false, ColumnDescription = "库位区域名称")]
public string LocationArea { get; set; } public string LocationArea { get; set; }
/// <summary> /// <summary>

View File

@ -70,9 +70,10 @@ namespace WCS.BLL.Manager
DbHelp.dbLog.DbMaintenance.CreateDatabase(); DbHelp.dbLog.DbMaintenance.CreateDatabase();
Logs.Write("【初始化数据库】创建数据库", LogsType.StartBoot); Logs.Write("【初始化数据库】创建数据库", LogsType.StartBoot);
DbHelp.db.CodeFirst.InitTables(typeof(ShelfInfo), typeof(StoreInfo), typeof(ShelfTypeInfo) DbHelp.db.CodeFirst.InitTables(typeof(ShelfInfo), typeof(MatBaseInfo), typeof(ShelfTypeInfo)
,typeof(LocationInfo), typeof(LocationAreaInfo)
, typeof(InventoryDetail), typeof(OutOrder), typeof(OutOrderDetail), typeof(OutOrderMatDetail) , typeof(InventoryDetail), typeof(OutOrder), typeof(OutOrderDetail), typeof(OutOrderMatDetail)
, typeof(MatBaseInfo), typeof(MatInfo) , typeof(MatInfo), typeof(StoreInfo)
, typeof(StockTakingOrder), typeof(StockTakingOrderMatDetail), typeof(InOutRecord) , typeof(StockTakingOrder), typeof(StockTakingOrderMatDetail), typeof(InOutRecord)
, typeof(DocumentSerialNumber), typeof(MatInfoLog) , typeof(DocumentSerialNumber), typeof(MatInfoLog)
, typeof(AppVersion) , typeof(AppVersion)

View File

@ -0,0 +1,13 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace WCS.Model.ApiModel
{
public class LocationAreaModel
{
public int? Id { get; set; }
public string LocationAreaName { get; set; }
}
}

View File

@ -281,7 +281,7 @@ namespace 智慧物流软件系统.ViewModel
// StoreCode = StoreCode, // StoreCode = StoreCode,
// Direction = SelectedDirection, // Direction = SelectedDirection,
// ShelfTypeId = SelectedShelfTypeItem == null ? 0 : SelectedShelfTypeItem.Id, // ShelfTypeId = SelectedLocationAreaItems == null ? 0 : SelectedLocationAreaItems.Id,
// UserName = LocalStatic.CurrentUser, // UserName = LocalStatic.CurrentUser,
// DeviceType = LocalFile.Config.DeviceType, // DeviceType = LocalFile.Config.DeviceType,

View File

@ -0,0 +1,359 @@
using HandyControl.Controls;
using MiniExcelLibs;
using Ping9719.WpfEx.Mvvm;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Input;
using .Views.Controls;
using .Api;
using WCS.Model;
using WCS.Model.ApiModel.Home;
using WCS.Model.ApiModel.StoreInfo;
using WCS.BLL.DbModels;
using WCS.Model.ApiModel.MatBaseInfo;
using WCS.Model.ApiModel.User;
using WCS.Model.ApiModel;
using Newtonsoft.Json.Bson;
namespace .ViewModel
{
public class LocaionInfoViewModel : BindableBase
{
public LocaionInfoViewModel()
{
}
#region Property
private List<ShelfInfoModel> dataGridItemSource;
public List<ShelfInfoModel> DataGridItemSource
{
get { return dataGridItemSource; }
set
{
SetProperty(ref dataGridItemSource, value);
}
}
private ShelfInfoModel selectedataGridItem;
public ShelfInfoModel SelectedataGridItem
{
get { return selectedataGridItem; }
set
{
SetProperty(ref selectedataGridItem, value);
}
}
/// <summary>
/// 货架编号
/// </summary>
private string locationCode;
public string LocationCode
{
get { return locationCode; }
set
{
SetProperty(ref locationCode, value);
}
}
private List<ShelfTypeModel> locationAreaItems;
public List<ShelfTypeModel> LocationAreaItems
{
get { return locationAreaItems; }
set
{
SetProperty(ref locationAreaItems, value);
}
}
private ShelfTypeModel? selectedLocationAreaItems;
public ShelfTypeModel? SelectedLocationAreaItems
{
get { return selectedLocationAreaItems; }
set
{
SetProperty(ref selectedLocationAreaItems, value);
}
}
public void InitLocationAreaItems()
{
//调用接口更新!
Task.Run(() =>
{
LocationAreaItems = new List<ShelfTypeModel>();
LocationAreaItems.Add(new ShelfTypeModel { Id = null, ShelfTypeName = "全部" });
var body = new RequestBase()
{
UserName = LocalStatic.CurrentUser,
DeviceType = LocalFile.Config.DeviceType,
};
var Result = ApiHelp.GetDataFromHttp<PageQueryResponse<ShelfTypeModel>>(LocalFile.Config.ApiIpHost + "home/getShelfTypes", body, "POST");
if (Result != null && Result.Data != null && Result.Data.Lists.Count() > 0)
{
LocationAreaItems.AddRange(Result.Data.Lists);
}
SelectedLocationAreaItems = LocationAreaItems.FirstOrDefault();
});
}
/// <summary>
/// 启用状态
/// </summary>
private bool? isEnable;
public bool? IsEnable
{
get { return isEnable; }
set
{
SetProperty(ref isEnable, value);
}
}
#endregion
#region Command
public ICommand BtnResetCommand { get => new DelegateCommand(BtnReset); }
public void BtnReset()
{
if (LocationAreaItems != null)
{
SelectedLocationAreaItems = LocationAreaItems.FirstOrDefault();
}
LocationCode = string.Empty;
IsEnable = null;
}
public ICommand BtnSearchCommand { get => new DelegateCommand(BtnSearchReset); }
public void BtnSearchReset()
{
BtnSearch(true);
}
public void BtnSearch(bool IsPageReset = true)
{
if (CurrentPage == 0 || IsPageReset)
{
CurrentPage = 1;
return;
}
#region
var dia = Dialog.Show(new TextDialog());
try
{
var body = new GetShelvesRequest()
{
ShelfTypeId = SelectedLocationAreaItems == null ? null : SelectedLocationAreaItems.Id,
ShelfCode = LocationCode,
IsEnable = IsEnable,
UserName = LocalStatic.CurrentUser,
DeviceType = LocalFile.Config.DeviceType,
PageNumber = CurrentPage,
PageSize = PageSize,
};
var Result = ApiHelp.GetDataFromHttp<PageQueryResponse<ShelfInfoModel>>(LocalFile.Config.ApiIpHost + "storeInfo/getShelves", body, "POST");
if (Result != null && Result.Data != null && Result.Data.Lists != null)
{
DataGridItemSource = Result.Data.Lists;
MaxPage = Result.Data.MaxPage;
TotalCount = Result.Data.TotalCount;
}
}
catch (Exception ex)
{
Growl.Error("加载数据失败:" + ex.Message);
}
finally
{
dia.Close();
}
#endregion
}
/// <summary>
/// 物料新增操作
/// </summary>
public ICommand BtnAddCommand { get => new DelegateCommand(BtnAdd); }
public async void BtnAdd()
{
var addView = new ShelfInfoAddOrUpdateView("新增货架");
addView.ShowDialog();
if (addView.DialogResult == true)
{
//添加或修改成功后重新查询
CurrentPage = 1;
}
}
public ICommand BtnEditCommand { get => new DelegateCommand(BtnEdit); }
public async void BtnEdit()
{
//查询勾选的第一个数据
var shelfInfo = DataGridItemSource?.Where(t => t.IsSelected == true).FirstOrDefault();
if (shelfInfo == null)
{
Growl.Warning("请选择需要修改的数据!");
}
else
{
var addView = new ShelfInfoAddOrUpdateView("修改货架", shelfInfo);
addView.ShowDialog();
if (addView.DialogResult == true)
{
CurrentPage = 1;
}
}
}
public ICommand BtnDeleteCommand { get => new DelegateCommand(BtnDelete); }
public void BtnDelete()
{
Growl.Ask($"是否删除所有勾选的数据?", isConfirmed =>
{
if (isConfirmed)
{
//查询勾选的第一个数据
var matBaseInfoIds = DataGridItemSource?.Where(t => t.IsSelected == true)
.Select(t => t.Id)
.ToList();
if (matBaseInfoIds == null)
{
Growl.Warning("请选择需要修改的数据!");
}
else
{
var body = new DeleteInfosRequest()
{
UserName = LocalStatic.CurrentUser,
DeviceType = LocalFile.Config.DeviceType,
MatBaseInfoIds = matBaseInfoIds,
};
var Result = ApiHelp.GetDataFromHttp<ResponseBase<UserModel>>(LocalFile.Config.ApiIpHost + "storeInfo/deleteShelfInfo", body, "POST");
if (Result != null && Result.Code == 200)
{
BtnSearch();
Growl.Success("删除成功!" + Result?.Message);
}
else
{
Growl.Error($"{Result?.Message?.ToString()}");
}
}
}
return true;
});
////查询勾选的第一个数据
//var shelfInfo = DataGridItemSource?.Where(t => t.IsSelected == true).FirstOrDefault();
//if (shelfInfo == null)
//{
// Growl.Warning("请选择需要删除的数据!");
//}
//else
//{
// var body = new AddShelfInfoRequest<ShelfInfoModel>()
// {
// UserName = LocalStatic.CurrentUser,
// DeviceType = LocalFile.Config.DeviceType,
// ShelfInfo = shelfInfo,
// AddOrUpdate = AddOrUpdate.Delete
// };
// var Result = ApiHelp.GetDataFromHttp<ResponseBase<object>>(LocalFile.Config.ApiIpHost + "storeInfo/addOrUpdateShelfInfo", body, "POST");
// if (Result != null && Result.Code == 200)
// {
// Growl.Success("删除成功!");
// CurrentPage = 1;
// }
// else
// {
// Growl.Error($"{Result?.Message?.ToString()}");
// }
//}
}
#endregion
#region PageOperation
private int currentPage;
public int CurrentPage
{
get { return currentPage; }
set
{
SetProperty(ref currentPage, value);
BtnSearch(false);
}
}
private int maxPage;
public int MaxPage
{
get { return maxPage; }
set { SetProperty(ref maxPage, value); }
}
//总数量
private int totalCount;
public int TotalCount
{
get { return totalCount; }
set { SetProperty(ref totalCount, value); }
}
private int pageSize = 10;
public int PageSize
{
get => pageSize;
set
{
SetProperty(ref pageSize, value);
BtnSearch(true);
}
}
public ICommand BtnFirstPageCommand { get => new DelegateCommand(BtnFirstPage); }
public void BtnFirstPage()
{
CurrentPage = 1;
}
public ICommand BtnPrePageCommand { get => new DelegateCommand(BtnPrePage); }
public void BtnPrePage()
{
if (CurrentPage > 1)
{
CurrentPage--;
}
}
public ICommand BtnNextPageCommand { get => new DelegateCommand(BtnNextPage); }
public void BtnNextPage()
{
if (CurrentPage < MaxPage)
{
CurrentPage++;
}
}
public ICommand BtnLastPageCommand { get => new DelegateCommand(BtnLastPage); }
public void BtnLastPage()
{
if (CurrentPage != MaxPage)
{
CurrentPage = MaxPage;
}
}
#endregion
}
}

View File

@ -253,8 +253,8 @@ namespace 智慧物流软件系统.ViewModel
// MatCode = MatCode, // MatCode = MatCode,
// StoreCode = StoreCode, // StoreCode = StoreCode,
// ShelfTypeId = SelectedShelfTypeItem == null ? 0 : SelectedShelfTypeItem.Id, // ShelfTypeId = SelectedLocationAreaItems == null ? 0 : SelectedLocationAreaItems.Id,
// ShelfCode = ShelfCode, // LocationCode = LocationCode,
// UserName = LocalStatic.CurrentUser, // UserName = LocalStatic.CurrentUser,
// DeviceType = LocalFile.Config.DeviceType, // DeviceType = LocalFile.Config.DeviceType,
@ -342,8 +342,8 @@ namespace 智慧物流软件系统.ViewModel
// MatCode = MatCode, // MatCode = MatCode,
// StoreCode = StoreCode, // StoreCode = StoreCode,
// ShelfTypeId = SelectedShelfTypeItem == null ? 0 : SelectedShelfTypeItem.Id, // ShelfTypeId = SelectedLocationAreaItems == null ? 0 : SelectedLocationAreaItems.Id,
// ShelfCode = ShelfCode, // LocationCode = LocationCode,
// UserName = LocalStatic.CurrentUser, // UserName = LocalStatic.CurrentUser,
// DeviceType = LocalFile.Config.DeviceType, // DeviceType = LocalFile.Config.DeviceType,
@ -443,8 +443,8 @@ namespace 智慧物流软件系统.ViewModel
// MatCode = MatCode, // MatCode = MatCode,
// StoreCode = StoreCode, // StoreCode = StoreCode,
// ShelfTypeId = SelectedShelfTypeItem == null ? 0 : SelectedShelfTypeItem.Id, // ShelfTypeId = SelectedLocationAreaItems == null ? 0 : SelectedLocationAreaItems.Id,
// ShelfCode = ShelfCode, // LocationCode = LocationCode,
// UserName = LocalStatic.CurrentUser, // UserName = LocalStatic.CurrentUser,
// DeviceType = LocalFile.Config.DeviceType, // DeviceType = LocalFile.Config.DeviceType,

View File

@ -115,7 +115,7 @@ namespace 智慧物流软件系统.ViewModels
{ {
HandyControl.Controls.MessageBox.Show("请选择货架类型!"); HandyControl.Controls.MessageBox.Show("请选择货架类型!");
} }
//var window = new OutInventoryAddMatView(SelectedShelfTypeItem.Id); //var window = new OutInventoryAddMatView(SelectedLocationAreaItems.Id);
//window.Owner = Application.Current.MainWindow; //window.Owner = Application.Current.MainWindow;
//window.Topmost = true; //window.Topmost = true;
@ -192,8 +192,8 @@ namespace 智慧物流软件系统.ViewModels
// { // {
// OrderType = "出库", // OrderType = "出库",
// OrderSource = "WCS前端", // OrderSource = "WCS前端",
// ShelfTypeId = SelectedShelfTypeItem.Id, // ShelfTypeId = SelectedLocationAreaItems.Id,
// ShelfTypeName = SelectedShelfTypeItem.ShelfTypeName, // ShelfTypeName = SelectedLocationAreaItems.ShelfTypeName,
// ItemList = DataGridItemSource.Select(t => new MatCodeItemList() // ItemList = DataGridItemSource.Select(t => new MatCodeItemList()
// { // {
// MatCode = t.MatCode, // MatCode = t.MatCode,

View File

@ -0,0 +1,312 @@
<pi:UserControlBase
xmlns:pi="https://github.com/ping9719/wpfex"
x:Class="智慧物流软件系统.LocationInfoView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:hc="https://handyorg.github.io/handycontrol"
mc:Ignorable="d"
d:DesignHeight="737" d:DesignWidth="1192" LoadedVisibleFirst="LoadedVisible">
<Border Margin="0" Background="AliceBlue" CornerRadius="3" Padding="0">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="1*"></RowDefinition>
<RowDefinition Height="10*"></RowDefinition>
</Grid.RowDefinitions>
<Border Grid.Row="0" Margin="5 5 5 0" Background="AliceBlue" CornerRadius="5" Padding="0">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1.9*"></ColumnDefinition>
<ColumnDefinition Width="2*"></ColumnDefinition>
<ColumnDefinition Width="1.9*"></ColumnDefinition>
<ColumnDefinition Width="2*"></ColumnDefinition>
<ColumnDefinition Width="1.9*"></ColumnDefinition>
<ColumnDefinition Width="2*"></ColumnDefinition>
<ColumnDefinition Width="1.9*"></ColumnDefinition>
<ColumnDefinition Width="2*"></ColumnDefinition>
<ColumnDefinition Width="2*"></ColumnDefinition>
<ColumnDefinition Width="2*"></ColumnDefinition>
<ColumnDefinition Width="2*"></ColumnDefinition>
</Grid.ColumnDefinitions>
<TextBlock Grid.Column="0"
VerticalAlignment="Center" HorizontalAlignment="Right"
Text="位置编号:" FontSize="18" ></TextBlock>
<TextBox Grid.Column="1"
VerticalAlignment="Center" HorizontalAlignment="Stretch"
FontSize="18" MinWidth="90" Text="{Binding LocationCode}"></TextBox>
<TextBlock Grid.Column="2"
VerticalAlignment="Center" HorizontalAlignment="Right"
Text="库位区域:" FontSize="18" ></TextBlock>
<ComboBox Grid.Row="0" Grid.Column="3"
DisplayMemberPath="LocationAreaName"
ItemsSource="{Binding LocationAreaItems}"
SelectedItem="{Binding SelectedLocationAreaItem}"
Height="30"
FontSize="18"
IsEditable="False"/>
<TextBlock Grid.Column="4"
VerticalAlignment="Center" HorizontalAlignment="Right"
Text="启用状态:" FontSize="18" ></TextBlock>
<ComboBox Grid.Column="5"
VerticalAlignment="Center" HorizontalAlignment="Stretch"
FontSize="18" MinWidth="90"
SelectedValuePath="Tag" SelectedValue="{Binding IsEnable}">
<ComboBoxItem IsSelected="True" Tag="{x:Null}" >全部</ComboBoxItem>
<ComboBoxItem Tag="True">启用</ComboBoxItem>
<ComboBoxItem Tag="False">禁用</ComboBoxItem>
</ComboBox>
<Button Style="{StaticResource ButtonSuccess}" hc:BorderElement.CornerRadius="15"
Grid.Column="9" MinHeight="40" FontSize="18" Content="&#xe8b9; 搜索" FontFamily="{StaticResource IconFont}"
Command="{Binding BtnSearchCommand}">
</Button>
<Button Style="{StaticResource ButtonWarning}" hc:BorderElement.CornerRadius="15"
Grid.Column="10" MinHeight="40" FontSize="18" Content="&#xe652; 重置" FontFamily="{StaticResource IconFont}"
Command="{Binding BtnResetCommand}">
</Button>
</Grid>
</Border>
<Border Grid.Row="1" Margin="5" Background="AliceBlue" CornerRadius="5" Padding="0">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="0.8*"></RowDefinition>
<RowDefinition Height="9*"></RowDefinition>
<RowDefinition Height="0.8*"></RowDefinition>
</Grid.RowDefinitions>
<StackPanel Grid.Row="0" Orientation="Horizontal">
<Button MinHeight="40" FontSize="18" Margin="5"
Content="&#xe604;新 增" FontFamily="{StaticResource IconFont}"
Foreground="WhiteSmoke"
Background="HotPink"
Command="{Binding BtnAddCommand}"
>
</Button>
<Button MinHeight="40" FontSize="18" Margin="5"
Content="&#xe612;修 改" FontFamily="{StaticResource IconFont}"
Foreground="WhiteSmoke"
Background="CadetBlue"
Command="{Binding BtnEditCommand}">
</Button>
<Button MinHeight="40" FontSize="18" Margin="5"
Content="&#xe8c1;删 除" FontFamily="{StaticResource IconFont}"
Foreground="WhiteSmoke"
Command="{Binding BtnDeleteCommand}"
Style="{StaticResource ButtonDanger}">
</Button>
<!--<Button MinHeight="40" FontSize="18" Margin="5"
Content="&#xe613;导 入" FontFamily="{StaticResource IconFont}"
Command="{Binding BtnImportCommand}"
Foreground="WhiteSmoke"
Background="Green"
>
</Button>-->
<!--<Button MinHeight="40" FontSize="18" Margin="5"
Content="&#xe866;导 出" FontFamily="{StaticResource IconFont}"
Command="{Binding BtnExportCommand}"
Foreground="WhiteSmoke"
Background="DarkOrange">
</Button>-->
</StackPanel>
<DataGrid Grid.Row="1"
SelectionChanged="DataGrid_SelectionChanged"
SelectedItem="{Binding SelectedataGridItem}"
Name="dataGrid"
SelectedCellsChanged="DataGrid_SelectedCellsChanged"
ItemsSource="{Binding DataGridItemSource}"
RowHeight="39"
AutoGenerateColumns="False" FontSize="13">
<DataGrid.Columns>
<DataGridTemplateColumn CanUserResize="False">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<CheckBox Width="30" Height="30" IsHitTestVisible="False" IsChecked="{Binding IsSelected}"/>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
<DataGridTemplateColumn.HeaderTemplate>
<DataTemplate>
<CheckBox Width="30" Height="30" Unchecked="allChecked_Unchecked" Checked="allChecked_Checked" Name="allChecked"/>
</DataTemplate>
</DataGridTemplateColumn.HeaderTemplate>
</DataGridTemplateColumn>
<DataGridTextColumn IsReadOnly="True" Header="序号" Binding="{Binding RowNumber}"></DataGridTextColumn>
<DataGridTextColumn Header="物料编码" Binding="{Binding MatCode}"></DataGridTextColumn>
<DataGridTextColumn Header="名称" MaxWidth="150" Binding="{Binding MatName}"></DataGridTextColumn>
<DataGridTextColumn Header="规格" MaxWidth="150" Binding="{Binding MatSpec}"></DataGridTextColumn>
<DataGridTextColumn Header="单位" Binding="{Binding MatUnit}"></DataGridTextColumn>
<DataGridTextColumn Header="客户" Binding="{Binding MatCustomer}"></DataGridTextColumn>
<DataGridTextColumn IsReadOnly="True" Header="状态" Binding="{Binding IsEnableStr}"></DataGridTextColumn>
<DataGridTextColumn IsReadOnly="True" Header="更新人" Binding="{Binding ModifyUser}"></DataGridTextColumn>
<DataGridTextColumn IsReadOnly="True" Header="更新时间" Binding="{Binding ModifyTime ,StringFormat='yyyy-MM-dd HH:mm:ss'}"></DataGridTextColumn>
</DataGrid.Columns>
</DataGrid>
<Grid Grid.Row="2">
<Border CornerRadius="3" Background="Transparent" VerticalAlignment="Center" >
<Grid HorizontalAlignment="Stretch" Margin="0" VerticalAlignment="Top" Width="Auto" MinHeight="26">
<Grid.RowDefinitions>
<RowDefinition/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="5*"></ColumnDefinition>
<ColumnDefinition Width="5*"></ColumnDefinition>
<ColumnDefinition Width="5*"></ColumnDefinition>
</Grid.ColumnDefinitions>
<StackPanel Orientation="Horizontal" VerticalAlignment="Center" Margin="5">
<TextBlock FontSize="14" VerticalAlignment="Center" Text="共"></TextBlock>
<TextBlock FontSize="14" VerticalAlignment="Center" Text="{Binding TotalCount ,FallbackValue=0}"></TextBlock>
<TextBlock FontSize="14" VerticalAlignment="Center" Text="条记录 "></TextBlock>
<TextBlock FontSize="14" VerticalAlignment="Center" Text="第"></TextBlock>
<TextBlock FontSize="14" VerticalAlignment="Center" Text="{Binding CurrentPage,FallbackValue=0}"></TextBlock>
<TextBlock FontSize="14" VerticalAlignment="Center" Text="/"></TextBlock>
<TextBlock FontSize="14" VerticalAlignment="Center" Text="{Binding MaxPage,FallbackValue=0}"></TextBlock>
<TextBlock FontSize="14" VerticalAlignment="Center" Text="页 "></TextBlock>
<ComboBox FontSize="14" VerticalAlignment="Center" SelectedValue="{Binding PageSize}" SelectedValuePath="Tag">
<ComboBoxItem Tag="10" IsSelected="True">10条/页</ComboBoxItem>
<ComboBoxItem Tag="20">20条/页</ComboBoxItem>
<ComboBoxItem Tag="50">50条/页</ComboBoxItem>
<ComboBoxItem Tag="100">100条/页</ComboBoxItem>
<ComboBoxItem Tag="500">500条/页</ComboBoxItem>
</ComboBox>
</StackPanel>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" Grid.Column="1">
<Grid>
<Grid.RowDefinitions >
<RowDefinition Height="30"></RowDefinition>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="auto"/>
<ColumnDefinition Width="auto"/>
<ColumnDefinition Width="auto"/>
<ColumnDefinition Width="auto"/>
<ColumnDefinition Width="auto"/>
</Grid.ColumnDefinitions>
<Button BorderBrush="Transparent" Background="Transparent" Grid.Column="0" Name="btnFirst" Content="首页" Foreground="Black" FontSize="14"
Command="{Binding BtnFirstPageCommand}"/>
<Button BorderBrush="Transparent" Background="Transparent" Grid.Column="1" Name="btnPrev" Content="上一页" FontSize="14"
Command="{Binding BtnPrePageCommand}"/>
<TextBox BorderBrush="Transparent" Grid.Column="2" FontSize="14" MinWidth="50" HorizontalAlignment="Center" VerticalAlignment="Center" Cursor="IBeam" IsEnabled="False"
Text ="{Binding CurrentPage}" TextAlignment="Center"/>
<Button BorderBrush="Transparent" Background="Transparent" Grid.Column="3" Name="btnNext" Content="下一页" FontSize="14"
Command="{Binding BtnNextPageCommand}"/>
<Button BorderBrush="Transparent" Background="Transparent" Grid.Column="4" Name="btnLast" Content="末页" FontSize="14"
Command="{Binding BtnLastPageCommand}"/>
</Grid>
</StackPanel>
</Grid>
</Border>
</Grid>
</Grid>
</Border>
<!--<Border Grid.Row="1" Margin="3" Background="AliceBlue" CornerRadius="3" Padding="0">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="0.8*"></RowDefinition>
<RowDefinition Height="8*"></RowDefinition>
<RowDefinition Height="0.7*"></RowDefinition>
</Grid.RowDefinitions>
<StackPanel Grid.Row="0" Orientation="Horizontal">
<Button MinHeight="40" FontSize="18" Margin="5" Command="{Binding BtnExportCommand}"
Content="&#xe866; 导 出" FontFamily="{StaticResource IconFont}"
Style="{StaticResource ButtonWarning}" Background="DarkOrange">
</Button>
</StackPanel>
<DataGrid Grid.Row="1"
SelectedCellsChanged="DataGrid_SelectedCellsChanged"
ItemsSource="{Binding DataGridItemSource}"
RowHeight="39"
AutoGenerateColumns="False"
FontSize="13">
<DataGrid.Columns>
<DataGridTextColumn Header="序号" Binding="{Binding RowNumber}"></DataGridTextColumn>
<DataGridTextColumn Header="接口地址" Binding="{Binding RequestUrl}"></DataGridTextColumn>
<DataGridTextColumn Header="设备IP" Binding="{Binding DeviceIp}"></DataGridTextColumn>
<DataGridTextColumn Header="请求参数" Binding="{Binding RequestBody}" MaxWidth="100"></DataGridTextColumn>
<DataGridTextColumn Header="QueryString" Binding="{Binding QueryString}" MaxWidth="100"></DataGridTextColumn>
<DataGridTextColumn Header="请求时间" Binding="{Binding RequestTime,StringFormat='yyyy-MM-dd HH:mm:ss'}"></DataGridTextColumn>
<DataGridTextColumn Header="返回参数" Binding="{Binding ResponseJson}" MaxWidth="100"></DataGridTextColumn>
<DataGridTextColumn Header="返回时间" Binding="{Binding ResponseTime,StringFormat='yyyy-MM-dd HH:mm:ss'}"></DataGridTextColumn>
<DataGridTextColumn Header="耗时(ms)" Binding="{Binding ExecutionTime}"></DataGridTextColumn>
</DataGrid.Columns>
</DataGrid>
<Grid Grid.Row="2">
<Border CornerRadius="3" Background="Transparent" VerticalAlignment="Center" >
<Grid HorizontalAlignment="Stretch" Margin="0" VerticalAlignment="Top" Width="Auto" MinHeight="26">
<Grid.RowDefinitions>
<RowDefinition/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="5*"></ColumnDefinition>
<ColumnDefinition Width="5*"></ColumnDefinition>
<ColumnDefinition Width="5*"></ColumnDefinition>
</Grid.ColumnDefinitions>
<StackPanel Orientation="Horizontal" Margin="5">
<TextBlock FontSize="14" Text="共"></TextBlock>
<TextBlock FontSize="14" Text="{Binding TotalCount ,FallbackValue=0}"></TextBlock>
<TextBlock FontSize="14" Text="条记录 "></TextBlock>
<TextBlock FontSize="14" Text="第"></TextBlock>
<TextBlock FontSize="14" Text="{Binding CurrentPage,FallbackValue=0}"></TextBlock>
<TextBlock FontSize="14" Text="/"></TextBlock>
<TextBlock FontSize="14" Text="{Binding MaxPage,FallbackValue=0}"></TextBlock>
<TextBlock FontSize="14" Text="页"></TextBlock>
</StackPanel>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" Grid.Column="1">
<Grid>
<Grid.RowDefinitions >
<RowDefinition Height="30"></RowDefinition>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="auto"/>
<ColumnDefinition Width="auto"/>
<ColumnDefinition Width="auto"/>
<ColumnDefinition Width="auto"/>
<ColumnDefinition Width="auto"/>
</Grid.ColumnDefinitions>
<Button BorderBrush="Transparent" Background="Transparent" Grid.Column="0" Name="btnFirst" Content="首页" Foreground="Black" FontSize="14"
Command="{Binding BtnFirstPageCommand}"/>
<Button BorderBrush="Transparent" Background="Transparent" Grid.Column="1" Name="btnPrev" Content="上一页" FontSize="14"
Command="{Binding BtnPrePageCommand}"/>
<TextBox BorderBrush="Transparent" Grid.Column="2" FontSize="14" MinWidth="50" HorizontalAlignment="Center" VerticalAlignment="Center" Cursor="IBeam" IsEnabled="False"
Text ="{Binding CurrentPage}" TextAlignment="Center"
/>
<Button BorderBrush="Transparent" Background="Transparent" Grid.Column="3" Name="btnNext" Content="下一页" FontSize="14"
Command="{Binding BtnNextPageCommand}"/>
<Button BorderBrush="Transparent" Background="Transparent" Grid.Column="4" Name="btnLast" Content="末页" FontSize="14"
Command="{Binding BtnLastPageCommand}"/>
</Grid>
</StackPanel>
</Grid>
</Border>
</Grid>
</Grid>
</Border>-->
</Grid>
</Border>
</pi:UserControlBase>

View File

@ -0,0 +1,88 @@
using Ping9719.WpfEx;
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.Shapes;
using .ViewModel;
namespace
{
public partial class LocationInfoView : UserControlBase
{
public MatBaseInfoViewModel viewModel { get; set; } = new MatBaseInfoViewModel();
public LocationInfoView()
{
InitializeComponent();
this.DataContext = viewModel;
}
private void LoadedVisible(object sender, EventArgs e)
{
viewModel.BtnReset();
viewModel.BtnSearchReset();
}
private void DataGrid_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
try
{
if (viewModel.SelectedataGridItem != null)
{
viewModel.SelectedataGridItem.IsSelected = !viewModel.SelectedataGridItem.IsSelected;
dataGrid.UnselectAllCells();//取消选中 避免手动点击check选项时反选失败 和重新点击该项时反选失败
}
}
catch
{
}
}
private void DataGrid_SelectedCellsChanged(object sender, SelectedCellsChangedEventArgs e)
{
//try
//{
// if (viewModel.SelectedataGridItem != null)
// {
// viewModel.SelectedataGridItem.IsSelected = !viewModel.SelectedataGridItem.IsSelected;
// }
//}
//catch
//{
//}
}
private void allChecked_Checked(object sender, RoutedEventArgs e)
{
if (viewModel != null && viewModel.DataGridItemSource != null && viewModel.DataGridItemSource.Count() > 0)
{
foreach (var item in viewModel.DataGridItemSource)
{
item.IsSelected = true;
}
}
}
private void allChecked_Unchecked(object sender, RoutedEventArgs e)
{
if (viewModel != null && viewModel.DataGridItemSource != null && viewModel.DataGridItemSource.Count() > 0)
{
foreach (var item in viewModel.DataGridItemSource)
{
item.IsSelected = false;
}
}
}
}
}