add-wpf界面添加任务记录历史界面

master
liuwf 1 year ago
parent 07254718cf
commit c119f7fcc5

@ -830,11 +830,14 @@ namespace Khd.Core.Wcs.Wcs
{
var AgvCardStatus = reponse.data.First(t => t.RobotCode == "2034");
AgvCardStatus.DateNow = DateTime.Now;
AgvCardStatus.AgvName = "5楼叉车";
dbContext.Update(AgvCardStatus);
var BearCardStatus = reponse.data.First(t => t.RobotCode == "6011");
BearCardStatus.AgvName = "5楼背负式";
BearCardStatus.DateNow = DateTime.Now;
dbContext.Update(BearCardStatus);
var CtuCardStatus = reponse.data.First(t => t.RobotCode == "8161");
CtuCardStatus.AgvName = "5楼CTU";
CtuCardStatus.DateNow = DateTime.Now;
dbContext.Update(CtuCardStatus);
dbContext.SaveChanges();
@ -969,6 +972,7 @@ namespace Khd.Core.Wcs.Wcs
{
var cardStatus = reponse.data.First(t => t.RobotCode == "2032");
cardStatus.DateNow = DateTime.Now;
cardStatus.AgvName = "3楼叉车 ";
dbContext.Update(cardStatus);
dbContext.SaveChanges();
var quantityPlc = basePlcs.First(t => t.Name.Contains("电量"));
@ -1033,6 +1037,7 @@ namespace Khd.Core.Wcs.Wcs
{
var cardStatus = reponse.data.First(t => t.RobotCode == "2033");
cardStatus.DateNow = DateTime.Now;
cardStatus.AgvName = "2楼叉车";
dbContext.Update(cardStatus);
dbContext.SaveChanges();
var quantityPlc = basePlcs.First(t => t.Name.Contains("电量"));

@ -513,6 +513,17 @@
</ControlTemplate>
</Button.Template>
</Button>
<Button Content="任务历史" FontSize="25" Foreground="White" Margin="60 0 0 0 " Height="50" Width="132" Click="btnTaskHistory_Click">
<Button.Template >
<ControlTemplate TargetType="{x:Type Button}" >
<Border BorderBrush="{TemplateBinding Control.BorderBrush}" BorderThickness="1" CornerRadius="4,4,4,4">
<Border.Background>YellowGreen</Border.Background>
<ContentPresenter Content="{TemplateBinding ContentControl.Content}" HorizontalAlignment="Center" VerticalAlignment="Center" ></ContentPresenter>
</Border>
</ControlTemplate>
</Button.Template>
</Button>
<!--<Button Content="手动完成" Margin="800,-8,0,-100" Foreground="White" Height="50" Width="132" Click="btnFinishTask_Click">
<Button.Template >
<ControlTemplate TargetType="{x:Type Button}" >

@ -1819,6 +1819,31 @@ namespace Khd.Core.Wpf.Form
}
}
/// <summary>
/// 打开任务历史记录界面
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void btnTaskHistory_Click(object sender, RoutedEventArgs e)
{
try
{
TaskHistoryWindow taskHistoryWindow = new TaskHistoryWindow(_host);
taskHistoryWindow.ShowDialog();
}
catch (Exception ex)
{
HandyControl.Controls.MessageBox.Error(ex.Message);
}
}
/// <summary>
/// 单选
/// </summary>

@ -0,0 +1,240 @@
<Window x:Class="Khd.Core.Wpf.WindowPage.TaskHistoryWindow"
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:local="clr-namespace:Khd.Core.Wpf.WindowPage"
xmlns:localConverter="clr-namespace:Khd.Core.Wpf.myConverter"
mc:Ignorable="d"
Title="任务历史记录" Height="1080" Width="1880" WindowStartupLocation="CenterScreen" Background="#172557">
<Window.Resources>
<ResourceDictionary>
<Style x:Key="XingHaoBianMaYangShi" TargetType="{x:Type TextBox}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="TextBox">
<Border BorderThickness="1" BorderBrush="Gray" CornerRadius="8" Background="{TemplateBinding Background}">
<ScrollViewer x:Name="PART_ContentHost" VerticalAlignment="Center" BorderThickness="0" IsTabStop="False"></ScrollViewer>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
<Setter Property="VerticalContentAlignment" Value="Center"></Setter>
<Setter Property="HorizontalContentAlignment" Value="Left"></Setter>
</Style>
<localConverter:TypeDataConverter x:Key="taskTypeConverter"/>
<localConverter:EquipConverter x:Key="EquipConverter"/>
<localConverter:AgvTaskStatusConverter x:Key="AgvTaskStatusConverter"/>
<Style x:Key="dgCell" TargetType="TextBlock" BasedOn="{x:Null}">
<Setter Property="TextAlignment" Value="Center" />
<Setter Property="HorizontalAlignment" Value="Center" />
<Setter Property="VerticalAlignment" Value="Center" />
</Style>
<ResourceDictionary.MergedDictionaries>
<!--<hc:ThemeResources/>
<hc:Theme/>-->
<ResourceDictionary Source="/CSS/SearchBtnClass.xaml" />
<ResourceDictionary Source="/CSS/SearchTextClass.xaml" />
<ResourceDictionary Source="/CSS/DataGridClass.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Window.Resources>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
<RowDefinition Height="10*"/>
</Grid.RowDefinitions>
<Grid Grid.Row="0">
<StackPanel Orientation="Horizontal" Margin="10">
</StackPanel>
</Grid>
<Grid Grid.Row="1">
<Grid Margin="0,5,0,0" HorizontalAlignment="Left">
<Grid Background="#172557" Grid.Row="1" ></Grid>
<Grid Grid.Row="2">
<DataGrid
x:Name="LoadMaterial0"
AlternationCount="2"
AutoGenerateColumns="False"
Background="#172557"
CanUserAddRows="False"
CanUserReorderColumns="False"
CanUserResizeColumns="False"
CanUserResizeRows="False"
Focusable="False"
HeadersVisibility="Column"
IsReadOnly="True"
LoadingRow="dgData_LoadingRow"
RowHeaderWidth="0"
SelectionMode="Single" FontSize="16" HorizontalAlignment="Left" >
<DataGrid.Columns>
<DataGridTemplateColumn
x:Name="orderControlData0"
Width="100"
MinWidth="10"
Header=" 序号"
IsReadOnly="True">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<TextBlock
Margin="0"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Focusable="False"
FontSize="20"
Text="{Binding Header, RelativeSource={RelativeSource AncestorType={x:Type DataGridRow}, Mode=FindAncestor}}" />
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTextColumn
Width="200*"
Binding="{Binding serialNo}"
CanUserSort="False"
ElementStyle="{StaticResource dgCell}"
FontSize="20"
Header="流水号"
IsReadOnly="True" Visibility="Hidden" />
<DataGridTextColumn
Width="250*"
Binding="{Binding equipmentNo}"
CanUserSort="False"
ElementStyle="{StaticResource dgCell}"
FontSize="20"
Header="设备编号"
IsReadOnly="True" Visibility="Hidden"/>
<DataGridTextColumn
Width="300*"
Binding="{Binding containerNo}"
CanUserSort="False"
ElementStyle="{StaticResource dgCell}"
FontSize="20"
Header="容器号"
IsReadOnly="True" />
<DataGridTextColumn
Width="300*"
Binding="{Binding taskType,Converter={StaticResource taskTypeConverter}}"
CanUserSort="False"
ElementStyle="{StaticResource dgCell}"
FontSize="20"
Header="任务类型"
IsReadOnly="True" />
<DataGridTextColumn
Width="300*"
Binding="{Binding ., Converter={StaticResource AgvTaskStatusConverter}}"
CanUserSort="False"
ElementStyle="{StaticResource dgCell}"
FontSize="20"
Header="任务状态"
IsReadOnly="True" />
<DataGridTextColumn
Width="180*"
Binding="{Binding qty}"
CanUserSort="False"
ElementStyle="{StaticResource dgCell}"
FontSize="20"
Header="数量"
IsReadOnly="True" Visibility="Hidden"/>
<DataGridTextColumn
Width="300*"
Binding="{Binding currPointNo,Converter={StaticResource EquipConverter}}"
CanUserSort="False"
ElementStyle="{StaticResource dgCell}"
FontSize="20"
Header="起始站点"
IsReadOnly="True"/>
<DataGridTextColumn
Width="300*"
Binding="{Binding endPointNo,Converter={StaticResource EquipConverter}}"
CanUserSort="False"
ElementStyle="{StaticResource dgCell}"
FontSize="20"
Header="目的站点"
IsReadOnly="True" />
<DataGridTextColumn
Width="230*"
Binding="{Binding fromFloorNo}"
CanUserSort="False"
ElementStyle="{StaticResource dgCell}"
FontSize="20"
Header="起始楼层"
IsReadOnly="True" />
<DataGridTextColumn
Width="230*"
Binding="{Binding floorNo}"
CanUserSort="False"
ElementStyle="{StaticResource dgCell}"
FontSize="20"
Header="目的楼层"
IsReadOnly="True" />
<DataGridTextColumn
Width="350*"
Binding="{Binding createTime,StringFormat='{}{0:yyyy-MM-dd HH:mm:ss}'}"
CanUserSort="False"
ElementStyle="{StaticResource dgCell}"
FontSize="20"
Header="创建时间"
IsReadOnly="True" />
</DataGrid.Columns>
<DataGrid.CellStyle>
<Style TargetType="{x:Type DataGridCell}">
<Setter Property="Background" Value="#213269" />
<Setter Property="Foreground" Value="White" />
<Setter Property="Height" Value="50" />
<Setter Property="HorizontalContentAlignment" Value="Center" />
</Style>
</DataGrid.CellStyle>
<DataGrid.RowStyle>
<Style TargetType="{x:Type DataGridRow}">
<Setter Property="Background" Value="#213269" />
<Setter Property="Foreground" Value="White" />
<Setter Property="Height" Value="50" />
</Style>
</DataGrid.RowStyle>
<DataGrid.RowHeaderStyle>
<Style TargetType="{x:Type DataGridRowHeader}">
<Setter Property="Background" Value="#213269" />
<Setter Property="Foreground" Value="White" />
<Setter Property="Height" Value="50" />
<Setter Property="HorizontalContentAlignment" Value="Center" />
</Style>
</DataGrid.RowHeaderStyle>
<DataGrid.ColumnHeaderStyle>
<Style TargetType="{x:Type DataGridColumnHeader}">
<Setter Property="Background" Value="#172560" />
<Setter Property="Foreground" Value="White" />
<Setter Property="Height" Value="50" />
<Setter Property="HorizontalContentAlignment" Value="Center" />
<Setter Property="Margin" Value="0,0,0,0" />
<Setter Property="BorderThickness" Value="5" />
<Setter Property="BorderBrush" Value="#172540" />
<Setter Property="FontSize" Value="30" />
</Style>
</DataGrid.ColumnHeaderStyle>
</DataGrid>
</Grid>
</Grid>
</Grid>
</Grid>
</Window>

@ -0,0 +1,82 @@
using Khd.Core.Domain.Models;
using Khd.Core.EntityFramework;
using Khd.Core.Library.Mapper;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
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 Khd.Core.Wpf.dto;
namespace Khd.Core.Wpf.WindowPage
{
/// <summary>
/// TaskHistoryWindow.xaml 的交互逻辑
/// </summary>
public partial class TaskHistoryWindow : Window
{
private IHost _host;
public TaskHistoryWindow(IHost host)
{
_host = host;
InitializeComponent();
GetTask();
}
/// <summary>
/// 显示序号事件
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void dgData_LoadingRow(object sender, DataGridRowEventArgs e)
{
e.Row.Header = e.Row.GetIndex() + 1;
}
private void GetTask()
{
using var scope = _host.Services.CreateScope();
using var dbContext = scope.ServiceProvider.GetRequiredService<DefaultDbContext>();
Dispatcher.Invoke(() =>
{
long? nextPointId = 0;
var data = dbContext.WcsTaskLog.ToList();
List<taskModel> taskModel = CoreMapper.Map<List<taskModel>>(data);
//foreach (var item in taskModel)
//{
// SelectedItem.Add(item.objid, false);
// if (item.nextPointId == 6)
// {
// item.isShow = Visibility.Visible;
// }
// else
// {
// item.isShow = Visibility.Collapsed;
// }
//}
this.LoadMaterial0.ItemsSource = null;
this.LoadMaterial0.ItemsSource = taskModel;
this.LoadMaterial0.Items.Refresh();
});
}
}
}
Loading…
Cancel
Save