WeldMonitorPage.xaml 15.7 KB
<Page
    x:Class="HHECS.RobotTool.View.WeldMonitorPage"
    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:hc="https://handyorg.github.io/handycontrol"
    xmlns:local="clr-namespace:HHECS.RobotTool.View"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:viewmodel="clr-namespace:HHECS.RobotTool.ViewModel"
    xmlns:wv2="clr-namespace:Microsoft.Web.WebView2.Wpf;assembly=Microsoft.Web.WebView2.Wpf"
    Title="WeldMonitorPage"
    d:DataContext="{d:DesignInstance Type=viewmodel:WeldMonitorVM}"
    d:DesignHeight="450"
    d:DesignWidth="800"
    mc:Ignorable="d">
    <Grid>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="150" />
            <ColumnDefinition />
        </Grid.ColumnDefinitions>
        <TreeView
            Grid.Column="0"
            ItemsSource="{Binding EquipmentTreeViews}"
            SelectedItemChanged="TreeView_SelectedItemChanged">
            <TreeView.ContextMenu>
                <ContextMenu Style="{StaticResource ContextMenu.Small}">
                    <MenuItem
                        Width="100"
                        Command="{Binding InitialTreeViewCommand}"
                        Header="刷新列表" />
                </ContextMenu>
            </TreeView.ContextMenu>
            <TreeView.ItemTemplate>
                <HierarchicalDataTemplate ItemsSource="{Binding Childrens}">
                    <TextBlock Text="{Binding Name}" />
                </HierarchicalDataTemplate>
            </TreeView.ItemTemplate>
        </TreeView>
        <Grid Grid.Column="1">
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto" />
                <RowDefinition Height="Auto" />
                <RowDefinition Height="Auto" />
                <RowDefinition />
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
                <ColumnDefinition />
                <ColumnDefinition />
            </Grid.ColumnDefinitions>
            <GroupBox
                Grid.Row="0"
                Grid.ColumnSpan="2"
                hc:TitleElement.TitlePlacement="Left"
                Header="设备"
                Style="{StaticResource GroupBoxTab.Small}">
                <Border
                    VerticalAlignment="Center"
                    Background="{DynamicResource RegionBrush}"
                    CornerRadius="4">
                    <hc:UniformSpacingPanel ChildWrapping="Wrap" Spacing="30">
                        <hc:TextBox
                            MinWidth="120"
                            hc:InfoElement.Title="设备编号:"
                            hc:InfoElement.TitlePlacement="Left"
                            IsReadOnly="True"
                            Text="{Binding CurrentEquipment.Code}" />
                        <hc:TextBox
                            MinWidth="120"
                            hc:InfoElement.Title="设备名称:"
                            hc:InfoElement.TitlePlacement="Left"
                            IsReadOnly="True"
                            Text="{Binding CurrentEquipment.Name}" />
                        <hc:TextBox
                            MinWidth="120"
                            hc:InfoElement.Title="设备IP:"
                            hc:InfoElement.TitlePlacement="Left"
                            IsReadOnly="True"
                            Text="{Binding CurrentEquipment.IP}" />
                        <hc:TextBox
                            MinWidth="120"
                            hc:InfoElement.Title="参数编号:"
                            hc:InfoElement.TitlePlacement="Left"
                            IsReadOnly="True"
                            Text="{Binding CurrentEquipmentParameterCode}" />
                    </hc:UniformSpacingPanel>
                </Border>
            </GroupBox>
            <GroupBox
                Grid.Row="1"
                Grid.ColumnSpan="2"
                Margin="0,2,0,0"
                Padding="5"
                hc:TitleElement.TitlePlacement="Left"
                Header="请求参数"
                Style="{StaticResource GroupBoxTab.Small}">
                <Border
                    VerticalAlignment="Center"
                    Background="{DynamicResource RegionBrush}"
                    CornerRadius="4">
                    <hc:UniformSpacingPanel ChildWrapping="Wrap" Spacing="10">
                        <hc:ElementGroup
                            Height="30"
                            Margin="0,1"
                            VerticalAlignment="Center"
                            Layout="Stack">
                            <Border Padding="6,0" Style="{StaticResource BorderRegion}">
                                <TextBlock VerticalAlignment="Center" Text="坡口宽度(mm)" />
                            </Border>
                            <TextBox
                                MinWidth="104"
                                IsReadOnly="True"
                                Text="{Binding InputParameter.GrooveWidth, UpdateSourceTrigger=PropertyChanged}" />
                        </hc:ElementGroup>
                        <hc:ElementGroup
                            Height="30"
                            VerticalAlignment="Center"
                            Layout="Stack">
                            <Border Padding="6,0" Style="{StaticResource BorderRegion}">
                                <TextBlock VerticalAlignment="Center" Text="坡口深度(mm)" />
                            </Border>
                            <TextBox
                                MinWidth="104"
                                HorizontalAlignment="Stretch"
                                IsReadOnly="True"
                                Text="{Binding InputParameter.GrooveDepth, UpdateSourceTrigger=PropertyChanged}" />
                        </hc:ElementGroup>
                        <hc:ElementGroup
                            Height="30"
                            VerticalAlignment="Center"
                            Layout="Stack">
                            <Border Padding="6,0" Style="{StaticResource BorderRegion}">
                                <TextBlock VerticalAlignment="Center" Text="当前层" />
                            </Border>
                            <TextBox
                                MinWidth="104"
                                HorizontalAlignment="Stretch"
                                IsReadOnly="True"
                                Text="{Binding WeldMonitorModel.CurrentLayer, UpdateSourceTrigger=PropertyChanged}" />
                        </hc:ElementGroup>
                        <hc:ElementGroup
                            Height="30"
                            VerticalAlignment="Center"
                            Layout="Stack">
                            <Border Padding="6,0" Style="{StaticResource BorderRegion}">
                                <TextBlock VerticalAlignment="Center" Text="当前道" />
                            </Border>
                            <TextBox
                                MinWidth="104"
                                HorizontalAlignment="Stretch"
                                IsReadOnly="True"
                                Text="{Binding WeldMonitorModel.CurrentChannel, UpdateSourceTrigger=PropertyChanged}" />
                        </hc:ElementGroup>
                        <hc:ElementGroup
                            Height="30"
                            VerticalAlignment="Center"
                            Layout="Stack">
                            <Border Padding="6,0" Style="{StaticResource BorderRegion}">
                                <TextBlock VerticalAlignment="Center" Text="时间" />
                            </Border>
                            <TextBox
                                MinWidth="104"
                                HorizontalAlignment="Stretch"
                                IsReadOnly="True"
                                Text="{Binding WeldMonitorModel.UpdateTime, StringFormat={}{0:yyyy/MM/dd HH:mm:ss}, UpdateSourceTrigger=PropertyChanged}" />
                        </hc:ElementGroup>
                    </hc:UniformSpacingPanel>
                </Border>
            </GroupBox>
            <GroupBox
                Grid.Row="2"
                Grid.ColumnSpan="2"
                Margin="0,2"
                Padding="5"
                hc:TitleElement.TitlePlacement="Left"
                Header="默认参数"
                Style="{StaticResource GroupBoxTab.Small}">
                <Border Background="{DynamicResource RegionBrush}" CornerRadius="4">
                    <hc:UniformSpacingPanel ChildWrapping="Wrap" Spacing="10">
                        <hc:ElementGroup
                            Height="30"
                            VerticalAlignment="Center"
                            Layout="Stack">
                            <Border Padding="6,0" Style="{StaticResource BorderRegion}">
                                <TextBlock VerticalAlignment="Center" Text="盖面后单边所需增加余宽(mm)" />
                            </Border>
                            <TextBox
                                MinWidth="60"
                                HorizontalAlignment="Stretch"
                                IsReadOnly="True"
                                Text="{Binding InputParameter.WeldWidth, UpdateSourceTrigger=PropertyChanged}" />
                        </hc:ElementGroup>
                        <hc:ElementGroup
                            Height="30"
                            VerticalAlignment="Center"
                            Layout="Stack">
                            <Border Padding="6,0" Style="{StaticResource BorderRegion}">
                                <TextBlock VerticalAlignment="Center" Text="单层焊接高度(mm)" />
                            </Border>
                            <TextBox
                                MinWidth="123"
                                HorizontalAlignment="Stretch"
                                IsReadOnly="True"
                                Text="{Binding InputParameter.OneWeldHeight, UpdateSourceTrigger=PropertyChanged}" />
                        </hc:ElementGroup>
                        <hc:ElementGroup
                            Height="30"
                            VerticalAlignment="Center"
                            Layout="Stack">
                            <Border Padding="6,0" Style="{StaticResource BorderRegion}">
                                <TextBlock VerticalAlignment="Center" Text="盖面后所需焊缝余高(mm)" />
                            </Border>
                            <TextBox
                                MinWidth="83"
                                HorizontalAlignment="Stretch"
                                IsReadOnly="True"
                                Text="{Binding InputParameter.WeldHeight, UpdateSourceTrigger=PropertyChanged}" />
                        </hc:ElementGroup>
                        <hc:ElementGroup
                            Height="30"
                            VerticalAlignment="Center"
                            Layout="Stack">
                            <Border Padding="6,0" Style="{StaticResource BorderRegion}">
                                <TextBlock VerticalAlignment="Center" Text="焊丝直径(mm)" />
                            </Border>
                            <TextBox
                                MinWidth="104"
                                HorizontalAlignment="Stretch"
                                IsReadOnly="True"
                                Text="{Binding InputParameter.WeldingWire, UpdateSourceTrigger=PropertyChanged}" />
                        </hc:ElementGroup>
                        <hc:ElementGroup
                            Height="30"
                            VerticalAlignment="Center"
                            Layout="Stack">
                            <Border Padding="6,0" Style="{StaticResource BorderRegion}">
                                <TextBlock VerticalAlignment="Center" Text="焊缝长度(mm)" />
                            </Border>
                            <TextBox
                                MinWidth="147"
                                HorizontalAlignment="Stretch"
                                IsReadOnly="True"
                                Text="{Binding InputParameter.WeldLength, UpdateSourceTrigger=PropertyChanged}" />
                        </hc:ElementGroup>
                        <hc:ElementGroup
                            Height="30"
                            VerticalAlignment="Center"
                            Layout="Stack">
                            <Border Padding="6,0" Style="{StaticResource BorderRegion}">
                                <TextBlock VerticalAlignment="Center" Text="打底送丝速度(mm/s)" />
                            </Border>
                            <TextBox
                                MinWidth="147"
                                HorizontalAlignment="Stretch"
                                IsReadOnly="True"
                                Text="{Binding InputParameter.OneLayerWireFeedingSpeed, UpdateSourceTrigger=PropertyChanged}" />
                        </hc:ElementGroup>
                        <hc:ElementGroup
                            Height="30"
                            VerticalAlignment="Center"
                            Layout="Stack">
                            <Border Padding="6,0" Style="{StaticResource BorderRegion}">
                                <TextBlock VerticalAlignment="Center" Text="盖面送丝速度(mm/s)" />
                            </Border>
                            <TextBox
                                MinWidth="147"
                                HorizontalAlignment="Stretch"
                                IsReadOnly="True"
                                Text="{Binding InputParameter.WireFeedingSpeed, UpdateSourceTrigger=PropertyChanged}" />
                        </hc:ElementGroup>
                    </hc:UniformSpacingPanel>
                </Border>
            </GroupBox>
            <DataGrid
                Grid.Row="3"
                Grid.Column="0"
                hc:DataGridAttach.ShowRowNumber="True"
                AutoGenerateColumns="False"
                HeadersVisibility="All"
                IsReadOnly="True"
                ItemsSource="{Binding WeldMonitorDataGrids}"
                RowHeaderWidth="60"
                Style="{StaticResource DataGrid.Small}">
                <DataGrid.Columns>
                    <DataGridTextColumn
                        Binding="{Binding LayerChannel}"
                        Header="层-道"
                        IsReadOnly="True" />
                    <DataGridTextColumn Binding="{Binding LayerHeight, StringFormat={}{0}mm}" Header="层高" />
                    <DataGridTextColumn Binding="{Binding StartingPoint}" Header="焊接起点" />
                    <DataGridTextColumn Binding="{Binding EndingPoint}" Header="焊接终点" />
                    <DataGridTextColumn Binding="{Binding WeldSpeed, StringFormat={}{0}mm/s}" Header="焊接速度" />
                    <DataGridTextColumn Binding="{Binding Amplitude, StringFormat={}{0}mm}" Header="振幅" />
                    <DataGridTextColumn Binding="{Binding SwingFrequency, StringFormat={}{0}Hz}" Header="摆动频率" />
                    <DataGridTextColumn Binding="{Binding LeftAndRightDwellTime, StringFormat={}{0}s}" Header="左右停留时间" />
                </DataGrid.Columns>
            </DataGrid>
            <wv2:WebView2
                x:Name="webView"
                Grid.Row="3"
                Grid.Column="1"
                Source="{Binding MonitorSource}" />
        </Grid>
    </Grid>
</Page>