change - 添加界面显示

master
wenjy 10 months ago
parent 34c7b76aaf
commit 728e78a539

@ -328,5 +328,17 @@ namespace SlnMesnac.Business.business
{
_logger.LogError($"客户端:{client};读取失败!!!!!!");
}
/// <summary>
/// 获取成品库指定区域的货道信息
/// </summary>
/// <param name="spaceArea"></param>
/// <returns></returns>
public List<BaseSpaceinfo> GetBaseSpaceinfos(string spaceArea)
{
_spaceinfoService.GetSpaceInfosByExpression(out List<BaseSpaceinfo> spaceinfos,x=>x.StoreCode == _appConfig.storeCode && x.SpaceArea == spaceArea);
return spaceinfos;
}
}
}

@ -13,7 +13,7 @@ namespace SlnMesnac.Model.domain
/// 主键标识
///</summary>
[SugarColumn(ColumnName="OBJ_ID" ,IsPrimaryKey = true )]
public decimal ObjId { get; set; }
public int ObjId { get; set; }
/// <summary>
/// 货道编号
///</summary>

@ -188,7 +188,7 @@
</Ellipse>
</StackPanel>
<StackPanel Grid.Column="1" VerticalAlignment="Center">
<TextBlock Text="箱壳扫码器" FontSize="15" Foreground="#FFFFFF" Margin="2,0,10,0"/>
<TextBlock Text="A区扫码器" FontSize="15" Foreground="#FFFFFF" Margin="2,0,10,0"/>
</StackPanel>
</Grid>
</StackPanel>
@ -219,7 +219,7 @@
</Ellipse>
</StackPanel>
<StackPanel Grid.Column="1" VerticalAlignment="Center">
<TextBlock Text="内胆扫码器" FontSize="15" Foreground="#FFFFFF" Margin="2,0,10,0"/>
<TextBlock Text="B区扫码器" FontSize="15" Foreground="#FFFFFF" Margin="2,0,10,0"/>
</StackPanel>
</Grid>
</StackPanel>

@ -0,0 +1,264 @@
<UserControl x:Class="SlnMesnac.WPF.Page.IndexControl"
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:SlnMesnac.WPF.Page"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800" Background="Transparent">
<UserControl.Resources>
<Style x:Key="DataGridTextColumnCenterSytle" TargetType="{x:Type TextBlock}">
<Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="FontSize" Value="20"/>
</Style>
<Style TargetType="DataGrid">
<!--网格线颜色-->
<Setter Property="CanUserResizeColumns" Value="false"/>
<Setter Property="Background" Value="#1152AC" />
<Setter Property="BorderBrush" Value="#4285DE" />
<Setter Property="HorizontalGridLinesBrush">
<Setter.Value>
<SolidColorBrush Color="#4285DE"/>
</Setter.Value>
</Setter>
<Setter Property="VerticalGridLinesBrush">
<Setter.Value>
<SolidColorBrush Color="#1152AC"/>
</Setter.Value>
</Setter>
</Style>
<!--列头标题栏样式-->
<Style TargetType="DataGridColumnHeader">
<!--<Setter Property="HorizontalContentAlignment" Value="Center"/>
<Setter Property="VerticalContentAlignment" Value="Center"/>-->
<!--<Setter Property="Background" Value="#dddddd"/>
<Setter Property="Foreground" Value="Black"/>-->
<!--<Setter Property="BorderThickness" Value="1" />-->
<Setter Property="HorizontalContentAlignment" Value="Center" />
<Setter Property="BorderBrush" Value="#4285DE" />
<Setter Property="Height" Value="40"/>
<Setter Property="FontSize" Value="18"/>
<Setter Property="Background" Value="#4285DE"/>
<Setter Property="Foreground" Value="White"/>
<Setter Property="FontFamily" Value="Microsoft YaHei"/>
</Style>
<!--单元格样式-->
<Style TargetType="DataGridCell">
<Setter Property="FocusVisualStyle" Value="{x:Null}" />
<Setter Property="BorderThickness" Value="0" />
<Setter Property="BorderBrush" Value="#4285DE" />
<Setter Property="Height" Value="40"/>
<Setter Property="FontSize" Value="18"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type DataGridCell}">
<Grid Background="{TemplateBinding Background}" >
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center" />
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
<Style.Triggers>
<Trigger Property="IsSelected" Value="True">
<Setter Property="Background" Value="#4285DE"/>
<Setter Property="Foreground" Value="White"/>
</Trigger>
<DataTrigger Binding="{Binding ExecuteStatus}" Value="2">
<Setter Property="Background" Value="Green" />
</DataTrigger>
</Style.Triggers>
</Style>
</UserControl.Resources>
<Grid Margin="1,1">
<Grid.RowDefinitions>
<RowDefinition Height="1*"/>
<RowDefinition Height="1*"/>
<RowDefinition Height="10*"/>
</Grid.RowDefinitions>
<Border Grid.Row="0" BorderBrush="Blue" BorderThickness="2" Margin="0,5,0,5"></Border>
<Border Grid.Row="1" BorderBrush="Blue" BorderThickness="2" Margin="0,5,0,5"></Border>
<Border Grid.Row="2" BorderBrush="Blue" BorderThickness="0" Margin="0,5,0,5">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="3*"/>
<ColumnDefinition Width="7*"/>
</Grid.ColumnDefinitions>
<Border Grid.Column="0" x:Name="areaA_outerBorder" BorderBrush="#1254AB" BorderThickness="2" CornerRadius="5" Margin="0,0,5,0" >
<Border.Effect>
<DropShadowEffect Color="#1254AB" Direction="270" BlurRadius="10" ShadowDepth="5" Opacity="0.5"/>
</Border.Effect>
<ItemsControl Grid.Column="0" ItemsSource="{Binding AreaA_SpaceInfo}" VerticalAlignment="Bottom" HorizontalAlignment="Center">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<WrapPanel Orientation="Vertical"></WrapPanel>
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<ItemsControl.ItemTemplate>
<DataTemplate>
<ContentControl x:Name="ctrl" Width="{Binding ActualWidth, ElementName=areaA_outerBorder}" Margin="5,5">
<ContentControl.Style>
<Style TargetType="ContentControl">
<Setter Property="Height" Value="40" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate>
<Border Background="#4D96E0" >
<!--<Label Content="{Binding SpaceName}" FontSize="18" Foreground="White" HorizontalAlignment="Center" VerticalAlignment="Center"/>-->
<Button Command="{Binding DataContext.UpdateInStoreFlagCommand, RelativeSource={RelativeSource AncestorType=ItemsControl}}" CommandParameter="{Binding ObjId}" Style="{StaticResource BUTTON_AGREE}" BorderBrush="Transparent" BorderThickness="0" Background="Transparent">
<TextBlock Text="{Binding MaterialType}" Foreground="White" FontSize="18" FontWeight="Bold" VerticalAlignment="Center" HorizontalAlignment="Center" />
</Button>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
<Style.Triggers>
<DataTrigger Binding="{Binding SpaceType}" Value="2">
<Setter Property="Height" Value="70" />
</DataTrigger>
</Style.Triggers>
</Style>
</ContentControl.Style>
</ContentControl>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</Border>
<Border Grid.Column="1" BorderBrush="Blue" BorderThickness="0" Margin="5,0,0,0">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="6*"/>
<RowDefinition Height="4*"/>
</Grid.RowDefinitions>
<Border Grid.Row="0" BorderBrush="Blue" BorderThickness="0" Margin="0,0,0,5">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="1*"/>
<RowDefinition Height="5*"/>
</Grid.RowDefinitions>
<Border Grid.Row="0" BorderBrush="#1254AB" BorderThickness="0" Margin="0,0,0,5">
<!--<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition/>
<ColumnDefinition/>
<ColumnDefinition/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<StackPanel Grid.Column="0" HorizontalAlignment="Center" VerticalAlignment="Center">
<Label Content="A区扫码成功" FontSize="20" Foreground="Green"/>
</StackPanel>
<StackPanel Grid.Column="1" HorizontalAlignment="Center" VerticalAlignment="Center">
<Label Content="B区扫码失败" FontSize="20" Foreground="Red" />
</StackPanel>
<Border Grid.Column="2" >
<Button Content="异常入库" FontSize="16" x:Name="Minimized" Command="{Binding FormControlCommand}" CommandParameter="{Binding Name,ElementName=Minimized}" Style="{StaticResource BUTTON_AGREE}" Width="100" Height="30" Background="#FF9900" BorderBrush="#FF9900" />
</Border>
</Grid>-->
<StackPanel Grid.Column="0" VerticalAlignment="Center" HorizontalAlignment="Left" Orientation="Horizontal" Margin="10,0,0,0">
<Button Content="异常入库" FontSize="18" x:Name="Minimized" Command="{Binding FormControlCommand}" CommandParameter="{Binding Name,ElementName=Minimized}" Style="{StaticResource BUTTON_AGREE}" Width="150" Height="40" Background="#FF9900" BorderBrush="#FF9900" Margin="0,0,10,0"/>
<Button Content="货道设置" FontSize="18" x:Name="Exit" Command="{Binding FormControlCommand}" CommandParameter="{Binding Name,ElementName=Exit}" Style="{StaticResource BUTTON_AGREE}" Width="150" Height="40" Background="#5283D7" BorderBrush="#5283D7" Margin="0,0,10,0"/>
<Button Content="{Binding InStoreAmount}" FontSize="18" CommandParameter="{Binding Name,ElementName=Exit}" Style="{StaticResource BUTTON_AGREE}" Width="150" Height="40" Background="Transparent" Margin="0,0,10,0"/>
</StackPanel>
</Border>
<Border Grid.Row="1" BorderBrush="Blue" BorderThickness="0" Margin="0,0,0,0">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="6*"/>
<ColumnDefinition Width="4*"/>
</Grid.ColumnDefinitions>
<DataGrid Grid.Column="0" Name="DG" ItemsSource="{Binding InstoreTask}" Background="Transparent"
FontSize="20" ColumnHeaderHeight="35"
RowHeight="31" AutoGenerateColumns="False" RowHeaderWidth="0"
GridLinesVisibility="None" ScrollViewer.HorizontalScrollBarVisibility="Hidden"
ScrollViewer.VerticalScrollBarVisibility="Hidden" BorderThickness="0" CanUserAddRows="False"
Foreground="#FFFFFF" >
<!--resourceStyle 399行修改选中字体颜色-->
<DataGrid.Columns>
<DataGridTextColumn Binding="{Binding taskCode}" Header="序号" Width="1*" IsReadOnly="True" ElementStyle="{StaticResource DataGridTextColumnCenterSytle}"/>
<DataGridTextColumn Binding="{Binding materialCode}" Header="物料编码" Width="2*" IsReadOnly="True" ElementStyle="{StaticResource DataGridTextColumnCenterSytle}"/>
<DataGridTextColumn Binding="{Binding materialType}" Header="物料类型" Width="2*" IsReadOnly="True" ElementStyle="{StaticResource DataGridTextColumnCenterSytle}"/>
<DataGridTextColumn Binding="{Binding spaceCode}" Header="入库货道" Width="1*" IsReadOnly="True" ElementStyle="{StaticResource DataGridTextColumnCenterSytle}"/>
<DataGridTextColumn Binding="{Binding createTime,StringFormat=\{0:MM月dd日 HH:mm\}}" Header="扫描时间" Width="2*" IsReadOnly="True" ElementStyle="{StaticResource DataGridTextColumnCenterSytle}"/>
</DataGrid.Columns>
</DataGrid>
<!--日志信息-->
<Border Grid.Column="1" BorderBrush="#1254AB" BorderThickness="2" CornerRadius="5" Background="Transparent" Margin="1,0,0,0">
<Border.Effect>
<DropShadowEffect Color="#1254AB" Direction="270" BlurRadius="10" ShadowDepth="5" Opacity="0.5"/>
</Border.Effect>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="1*"/>
<RowDefinition Height="9*"/>
</Grid.RowDefinitions>
<Border Grid.Row="0" BorderBrush="CadetBlue" BorderThickness="0,0,0,0" CornerRadius="0" Background="Transparent" Margin="1,1,5,5" >
<TextBlock Text="系统监控" FontSize="20" FontWeight="Bold" Foreground="#0288d1" VerticalAlignment="Center" HorizontalAlignment="Center"/>
</Border>
<!--日志信息-->
<Border Grid.Row="1" BorderBrush="Green" BorderThickness="0" CornerRadius="5" Background="Transparent" Margin="1,1,5,5">
<ListBox x:Name="listBox" ItemsSource="{Binding LogInfoListBox}" FontSize="15" Foreground="#FFFFFF" Background="Transparent" BorderBrush="Transparent" ScrollViewer.HorizontalScrollBarVisibility="Hidden" ScrollViewer.VerticalScrollBarVisibility="Hidden"/>
</Border>
</Grid>
</Border>
</Grid>
</Border>
</Grid>
</Border>
<!--<Border Grid.Row="1" BorderBrush="Blue" BorderThickness="2" Margin="0,5,0,0"></Border>-->
<Border Grid.Row="1" x:Name="areaB_outerBorder" BorderBrush="#1254AB" BorderThickness="2" CornerRadius="5" Margin="0,0,0,0" >
<Border.Effect>
<DropShadowEffect Color="#1254AB" Direction="270" BlurRadius="10" ShadowDepth="5" Opacity="0.5"/>
</Border.Effect>
<ItemsControl Grid.Column="0" ItemsSource="{Binding AreaB_SpaceInfo}" VerticalAlignment="Center" HorizontalAlignment="Right">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<WrapPanel Orientation="Vertical"></WrapPanel>
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<ItemsControl.ItemTemplate>
<DataTemplate>
<ContentControl x:Name="ctrl" Height="{Binding ActualHeight, ElementName=areaB_outerBorder}" Margin="5,5">
<ContentControl.Style>
<Style TargetType="ContentControl">
<Setter Property="Width" Value="40" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate>
<StackPanel Background="#4D96E0" Height="{Binding ActualHeight, ElementName=areaB_outerBorder}" Orientation="Vertical">
<!--<Label Content="{Binding SpaceName}" FontSize="18" Foreground="White" HorizontalAlignment="Center" VerticalAlignment="Center"/>-->
<Button Height="{Binding ActualHeight, ElementName=areaB_outerBorder}" Command="{Binding DataContext.UpdateInStoreFlagCommand, RelativeSource={RelativeSource AncestorType=ItemsControl}}" CommandParameter="{Binding ObjId}" Style="{StaticResource BUTTON_AGREE}" BorderBrush="Transparent" BorderThickness="0" Background="Transparent">
<TextBlock Text="{Binding MaterialType}" Foreground="White" FontSize="18" FontWeight="Bold" VerticalAlignment="Center" HorizontalAlignment="Center" TextWrapping="Wrap"/>
</Button>
</StackPanel>
</ControlTemplate>
</Setter.Value>
</Setter>
<Style.Triggers>
<DataTrigger Binding="{Binding SpaceType}" Value="2">
<Setter Property="Width" Value="70" />
</DataTrigger>
</Style.Triggers>
</Style>
</ContentControl.Style>
</ContentControl>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</Border>
</Grid>
</Border>
</Grid>
</Border>
</Grid>
</UserControl>

@ -0,0 +1,31 @@
using SlnMesnac.WPF.ViewModel;
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.Navigation;
using System.Windows.Shapes;
namespace SlnMesnac.WPF.Page
{
/// <summary>
/// IndexControl.xaml 的交互逻辑
/// </summary>
public partial class IndexControl : UserControl
{
public IndexControl()
{
InitializeComponent();
//CreateDynamicBorders();
this.DataContext = new IndexControlViewModel();
}
}
}

@ -33,7 +33,6 @@
</ItemGroup>
<ItemGroup>
<Folder Include="Page\" />
<Folder Include="Converter\" />
</ItemGroup>

@ -0,0 +1,113 @@
using GalaSoft.MvvmLight;
using GalaSoft.MvvmLight.Command;
using Microsoft.Extensions.DependencyInjection;
using SlnMesnac.Business.business;
using SlnMesnac.Config;
using SlnMesnac.Model.domain;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SlnMesnac.WPF.ViewModel
{
internal class IndexControlViewModel : ViewModelBase
{
private InStoreBusiness inStoreBusiness;
public IndexControlViewModel()
{
this.inStoreBusiness = App.ServiceProvider.GetService<InStoreBusiness>();
UpdateInStoreFlagCommand = new RelayCommand<Int32>(obj =>
{
Console.WriteLine($"{obj};设置");
});
this.Init();
InStoreAmount = inStoreAmount + "19";
}
#region 参数定义
public string inStoreAmount = "入库数量:";
public string InStoreAmount
{
get { return this.inStoreAmount; }
set
{
inStoreAmount = value;
RaisePropertyChanged(nameof(InStoreAmount));
}
}
/// <summary>
/// A区域货道集合
/// </summary>
public ObservableCollection<BaseSpaceinfo> _areaA_SpaceInfo;
public ObservableCollection<BaseSpaceinfo> AreaA_SpaceInfo
{
get { return _areaA_SpaceInfo; }
set { _areaA_SpaceInfo = value; RaisePropertyChanged(nameof(AreaA_SpaceInfo)); }
}
/// <summary>
/// B区域货道集合
/// </summary>
public ObservableCollection<BaseSpaceinfo> _areaB_SpaceInfo;
public ObservableCollection<BaseSpaceinfo> AreaB_SpaceInfo
{
get { return _areaB_SpaceInfo; }
set { _areaB_SpaceInfo = value; RaisePropertyChanged(nameof(AreaB_SpaceInfo)); }
}
#endregion
public RelayCommand<Int32> UpdateInStoreFlagCommand { get; set; }
private ObservableCollection<BaseSpaceinfo> spaceItems = new ObservableCollection<BaseSpaceinfo>();
private void Init()
{
App.Current.Dispatcher.BeginInvoke((Action)(() =>
{
var info = inStoreBusiness.GetBaseSpaceinfos("A");
if (info != null)
{
if (spaceItems.Count > 0)
{
spaceItems.Clear();
}
info = info.OrderByDescending(x=>x.SpaceName).ToList();
foreach (var item in info)
{
spaceItems.Add(item);
}
AreaA_SpaceInfo = spaceItems;
}
}));
App.Current.Dispatcher.BeginInvoke((Action)(() =>
{
var info = inStoreBusiness.GetBaseSpaceinfos("A");
if (info != null)
{
if (spaceItems.Count > 0)
{
spaceItems.Clear();
}
info = info.OrderByDescending(x => x.SpaceName).ToList();
foreach (var item in info)
{
spaceItems.Add(item);
}
AreaB_SpaceInfo = spaceItems;
}
}));
}
}
}

@ -15,12 +15,16 @@ using System.Threading;
using System.Threading.Tasks;
using System.Windows;
using SlnMesnac.Rfid;
using SlnMesnac.WPF.Page;
namespace SlnMesnac.WPF.ViewModel
{
public class MainWindowViewModel: ViewModelBase
{
private readonly ILogger<MainWindowViewModel> _logger;
private IndexControl indexControl = new IndexControl();
#region 参数定义
/// <summary>
/// PLC设备状态
@ -90,6 +94,8 @@ namespace SlnMesnac.WPF.ViewModel
ControlOnClickCommand = new RelayCommand<object>(obj => ControlOnClick(obj));
FormControlCommand = new RelayCommand<object>(x => FormControl(x));
UserContent = indexControl;
}
/// <summary>
@ -146,6 +152,11 @@ namespace SlnMesnac.WPF.ViewModel
{
string info = obj as string;
//UserContent = inStoreInfoControl;
if(info == "Index")
{
UserContent = indexControl;
}
}
catch (Exception ex)
{

@ -14,12 +14,13 @@
{
"configId": "mes",
"dbType": 3,
"connStr": "Data Source=10.100.72.20/ORCLCDB;User ID=c##aucma_mes;Password=aucma"
//"connStr": "Data Source=10.100.72.20/ORCLCDB;User ID=c##aucma_mes;Password=aucma",
"connStr": "Data Source=175.27.215.92/helowin;User ID=aucma_mes;Password=aucma"
},
{
"configId": "scada",
"dbType": 3,
"connStr": "Data Source=10.100.72.20/ORCLCDB;User ID=c##aucma_scada;Password=aucma"
"connStr": "Data Source=175.27.215.92/helowin;User ID=aucma_scada;Password=aucma"
}
],
"PlcConfig": [

Loading…
Cancel
Save