NXX пре 2 година
родитељ
комит
797df0e248
38 измењених фајлова са 1563 додато и 269 уклоњено
  1. +24
    -0
      BPASmart.CustomResource/BPASmart.CustomResource.csproj
  2. BIN
     
  3. BIN
     
  4. +1
    -1
      BPASmart.Model/用户/UserPower.cs
  5. +176
    -0
      BPASmart.RecipeManagement/MainControl.xaml
  6. +51
    -0
      BPASmart.RecipeManagement/MainControl.xaml.cs
  7. +6
    -166
      BPASmart.RecipeManagement/MainWindow.xaml
  8. +1
    -20
      BPASmart.RecipeManagement/MainWindow.xaml.cs
  9. +6
    -3
      BPASmart.RecipeManagement/View/RecipeManager.xaml
  10. +20
    -0
      BPASmart.RecipeManagement/ViewModel/MainControl.cs
  11. +1
    -2
      BPASmart.RecipeManagement/ViewModel/MainWindowViewModel.cs
  12. +28
    -1
      BPASmart.RecipeManagement/ViewModel/RecipeManagerViewModel.cs
  13. +362
    -6
      BPASmart.UserManagement/App.xaml
  14. +13
    -0
      BPASmart.UserManagement/BPASmart.UserManagement.csproj
  15. +4
    -1
      BPASmart.UserManagement/Globle/GlobleData.cs
  16. BIN
     
  17. BIN
     
  18. BIN
     
  19. BIN
     
  20. BIN
     
  21. BIN
     
  22. +50
    -0
      BPASmart.UserManagement/MainControl.xaml
  23. +54
    -0
      BPASmart.UserManagement/MainControl.xaml.cs
  24. +2
    -38
      BPASmart.UserManagement/MainWindow.xaml
  25. +1
    -24
      BPASmart.UserManagement/MainWindow.xaml.cs
  26. +266
    -3
      BPASmart.UserManagement/View/EditPower.xaml
  27. +2
    -1
      BPASmart.UserManagement/ViewModel/AddNewUserViewModel.cs
  28. +115
    -0
      BPASmart.UserManagement/ViewModel/EditPowerViewModel.cs
  29. +1
    -1
      BPASmart.UserManagement/ViewModel/MainWindowViewModel.cs
  30. +3
    -1
      BPASmart.UserManagement/ViewModel/UserListViewModel.cs
  31. BIN
     
  32. +13
    -0
      BPASmartClient.MorkMOC/BPASmartClient.MorkMOC.csproj
  33. +200
    -0
      BPASmartClient.MorkMOC/Control_MorkMOC.cs
  34. +26
    -0
      BPASmartClient.MorkMOC/GVL_MorkMOC.cs
  35. +16
    -0
      BPASmartClient.MorkMOC/OrderLocInfo.cs
  36. +52
    -0
      BPASmartClient.MorkMOC/PolymerBatching.cs
  37. +1
    -1
      PermissionManagement/MainWindow.xaml
  38. +68
    -0
      SmartClient.sln

+ 24
- 0
BPASmart.CustomResource/BPASmart.CustomResource.csproj Прегледај датотеку

@@ -0,0 +1,24 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0-windows</TargetFramework>
<Nullable>enable</Nullable>
<UseWPF>true</UseWPF>
</PropertyGroup>

<ItemGroup>
<None Remove="Image\方形背景2.png" />
<None Remove="Image\方形背景3.png" />
<None Remove="Image\背景边框\方形背景3.png" />
</ItemGroup>

<ItemGroup>
<Resource Include="Image\方形背景2.png" />
<Resource Include="Image\方形背景3.png" />
</ItemGroup>

<ItemGroup>
<Folder Include="Image\背景边框\" />
</ItemGroup>

</Project>



+ 1
- 1
BPASmart.Model/用户/UserPower.cs Прегледај датотеку

@@ -4,7 +4,7 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BPASmart.Model.用户
namespace BPASmart.Model
{
public enum UserPower
{


+ 176
- 0
BPASmart.RecipeManagement/MainControl.xaml Прегледај датотеку

@@ -0,0 +1,176 @@
<UserControl x:Class="BPASmart.RecipeManagement.MainControl"
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:BPASmart.RecipeManagement"
xmlns:view="clr-namespace:BPASmart.RecipeManagement.View"
xmlns:vm="clr-namespace:BPASmart.RecipeManagement.ViewModel"
mc:Ignorable="d"
d:DesignHeight="800" d:DesignWidth="1400">
<UserControl.DataContext>
<vm:MainControl/>
</UserControl.DataContext>
<UserControl.Resources>
<Style x:Key="RadioNavigation" TargetType="RadioButton">
<Setter Property="Margin" Value="-4,0"/>
<Setter Property="Background" Value="Transparent"/>
<Setter Property="GroupName" Value="Navigation"/>
<Setter Property="VerticalAlignment" Value="Center"/>
<Setter Property="HorizontalAlignment" Value="Center"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="RadioButton">
<Border x:Name="_borderOver" Background="Transparent" Width="200" BorderBrush="Transparent" BorderThickness="0,1">
<Grid Background="{TemplateBinding Background}" Margin="{TemplateBinding Margin}">

<TextBlock Foreground="White" Text="{TemplateBinding Content}" FontSize="24" Background="Transparent"
VerticalAlignment="Center" HorizontalAlignment="Center"/>

</Grid>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="BorderBrush" TargetName="_borderOver" Value="#1971B6"/>
<Setter Property="Background" TargetName="_borderOver">
<Setter.Value>
<LinearGradientBrush StartPoint="0,1" EndPoint="1,1">
<GradientStop Color="#104E8B" Offset="0"/>
<GradientStop Color="#1874CD" Offset="0.4"/>
<GradientStop Color="#1874CD" Offset="0.6"/>
<GradientStop Color="#27408B" Offset="1"/>
</LinearGradientBrush>
</Setter.Value>
</Setter>
</Trigger>
<Trigger Property="IsChecked" Value="True">

<Setter Property="Background" TargetName="_borderOver" >
<Setter.Value>
<ImageBrush ImageSource="../Image/leftImage.png"/>
</Setter.Value>
</Setter>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<ControlTemplate x:Key="butonTempalte" TargetType="RadioButton">
<Border x:Name="_borderOver" Background="Transparent" Width="200" Height="60" BorderBrush="Transparent" BorderThickness="0,1">
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center" />
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="BorderBrush" TargetName="_borderOver" Value="#1971B6"/>
<Setter Property="Background" TargetName="_borderOver">
<Setter.Value>
<LinearGradientBrush StartPoint="0,1" EndPoint="1,1">
<GradientStop Color="#104E8B" Offset="0"/>
<GradientStop Color="#1874CD" Offset="0.4"/>
<GradientStop Color="#1874CD" Offset="0.6"/>
<GradientStop Color="#27408B" Offset="1"/>
</LinearGradientBrush>
</Setter.Value>
</Setter>
</Trigger>
<Trigger Property="IsChecked" Value="True">

<Setter Property="Background" TargetName="_borderOver" >
<Setter.Value>
<ImageBrush ImageSource="../Image/leftImage.png"/>
</Setter.Value>
</Setter>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
<Style x:Key="fonticon" TargetType="{x:Type TextBlock}">
<Setter Property="FontFamily" Value="pack://application:,,,/Font/#iconfont"/>
<Setter Property="FontSize" Value="24"/>
<Setter Property="Foreground" Value="White"/>
<Setter Property="HorizontalAlignment" Value="Center"/>
<Setter Property="VerticalAlignment" Value="Center"/>
<Setter Property="Margin" Value="0,0,20,0"/>


</Style>
</UserControl.Resources>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="6*"/>
</Grid.ColumnDefinitions>
<Border Grid.Row="1" Grid.RowSpan="2" BorderBrush="#1E90FF" BorderThickness="0,0,2,0">
<Border.Background>
<LinearGradientBrush StartPoint="0,1" EndPoint="1,1">
<GradientStop Color="#01003B" Offset="0.2"/>

<GradientStop Color="#010050" Offset="1"/>
</LinearGradientBrush>
</Border.Background>
</Border>
<StackPanel x:Name="mylistview" Background="Transparent" Grid.RowSpan="1" Grid.Row="1"
ScrollViewer.VerticalScrollBarVisibility="Hidden" ScrollViewer.HorizontalScrollBarVisibility="Hidden"
MouseLeftButtonDown="mylistview_MouseDown" >
<RadioButton Style="{DynamicResource RadioNavigation}" IsChecked="True" Template="{DynamicResource butonTempalte }"
Click="NavButton_Click" Tag="OrderManager">
<Grid Background="Transparent" >
<Grid.ColumnDefinitions>
<ColumnDefinition Width="auto"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<TextBlock Text="&#xe737;" Style="{DynamicResource fonticon}"/>
<TextBlock Grid.Column="1" Foreground="White" Text="订单管理" FontSize="24" Background="Transparent"
VerticalAlignment="Center" HorizontalAlignment="Center" FontFamily="楷体"/>

</Grid>
</RadioButton>
<RadioButton Style="{DynamicResource RadioNavigation}" Template="{DynamicResource butonTempalte }"
Click="NavButton_Click" Tag="RecipeManager">
<Grid Background="Transparent" >
<Grid.ColumnDefinitions>
<ColumnDefinition Width="auto"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<TextBlock Text="&#xe683;" Style="{DynamicResource fonticon}"/>
<TextBlock Grid.Column="1" Foreground="White" Text="配方管理" FontSize="24" Background="Transparent"
VerticalAlignment="Center" HorizontalAlignment="Center" FontFamily="楷体"/>

</Grid>
</RadioButton>
<RadioButton Style="{DynamicResource RadioNavigation}" Template="{DynamicResource butonTempalte }"
Click="NavButton_Click" Tag="MaterialManager">
<Grid Background="Transparent" >
<Grid.ColumnDefinitions>
<ColumnDefinition Width="auto"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<TextBlock Text="&#xe63b;" Style="{DynamicResource fonticon}"/>
<TextBlock Grid.Column="1" Foreground="White" Text="原料管理" FontSize="24" Background="Transparent"
VerticalAlignment="Center" HorizontalAlignment="Center" FontFamily="楷体"/>

</Grid>
</RadioButton>

<RadioButton Style="{DynamicResource RadioNavigation}" Template="{DynamicResource butonTempalte }"
Click="NavButton_Click" Tag="PowerManager">
<Grid Background="Transparent" >
<Grid.ColumnDefinitions>
<ColumnDefinition Width="auto"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<TextBlock Text="&#xe60c;" Style="{DynamicResource fonticon}"/>
<TextBlock Grid.Column="1" Foreground="White" Text="权限分配" FontSize="24" Background="Transparent"
VerticalAlignment="Center" HorizontalAlignment="Center" FontFamily="楷体"/>

</Grid>
</RadioButton>
</StackPanel>



<ContentControl x:Name="contentRegion" Grid.Column="1" Grid.Row="1" Background="#01003B" BorderBrush="Transparent">
<view:OrderManager/>
</ContentControl>
</Grid>
</UserControl>

+ 51
- 0
BPASmart.RecipeManagement/MainControl.xaml.cs Прегледај датотеку

@@ -0,0 +1,51 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
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 BPASmart.RecipeManagement
{
/// <summary>
/// MainControl.xaml 的交互逻辑
/// </summary>
public partial class MainControl : UserControl
{
public MainControl()
{
InitializeComponent();
}

private void mylistview_MouseDown(object sender, MouseButtonEventArgs e)
{

}

private void NavButton_Click(object sender, RoutedEventArgs e)
{
try
{
if (sender is RadioButton bt)
{
Type type = Type.GetType($"BPASmart.RecipeManagement.View.{bt.Tag?.ToString()}");
ConstructorInfo cti = type.GetConstructor(System.Type.EmptyTypes);
contentRegion.Content = (FrameworkElement)cti.Invoke(null);
}
}
catch (Exception ex)
{

}
}
}
}

+ 6
- 166
BPASmart.RecipeManagement/MainWindow.xaml Прегледај датотеку

@@ -12,88 +12,9 @@
<vm:MainWindowViewModel/>
</Window.DataContext>
<Window.Resources>
<Style x:Key="fonticon" TargetType="{x:Type TextBlock}">
<Setter Property="FontFamily" Value="pack://application:,,,/Font/#iconfont"/>
<Setter Property="FontSize" Value="24"/>
<Setter Property="Foreground" Value="White"/>
<Setter Property="HorizontalAlignment" Value="Center"/>
<Setter Property="VerticalAlignment" Value="Center"/>
<Setter Property="Margin" Value="0,0,20,0"/>


</Style>
<Style x:Key="RadioNavigation" TargetType="RadioButton">
<Setter Property="Margin" Value="-4,0"/>
<Setter Property="Background" Value="Transparent"/>
<Setter Property="GroupName" Value="Navigation"/>
<Setter Property="VerticalAlignment" Value="Center"/>
<Setter Property="HorizontalAlignment" Value="Center"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="RadioButton">
<Border x:Name="_borderOver" Background="Transparent" Width="200" BorderBrush="Transparent" BorderThickness="0,1">
<Grid Background="{TemplateBinding Background}" Margin="{TemplateBinding Margin}">

<TextBlock Foreground="White" Text="{TemplateBinding Content}" FontSize="24" Background="Transparent"
VerticalAlignment="Center" HorizontalAlignment="Center"/>

</Grid>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="BorderBrush" TargetName="_borderOver" Value="#1971B6"/>
<Setter Property="Background" TargetName="_borderOver">
<Setter.Value>
<LinearGradientBrush StartPoint="0,1" EndPoint="1,1">
<GradientStop Color="#104E8B" Offset="0"/>
<GradientStop Color="#1874CD" Offset="0.4"/>
<GradientStop Color="#1874CD" Offset="0.6"/>
<GradientStop Color="#27408B" Offset="1"/>
</LinearGradientBrush>
</Setter.Value>
</Setter>
</Trigger>
<Trigger Property="IsChecked" Value="True">

<Setter Property="Background" TargetName="_borderOver" >
<Setter.Value>
<ImageBrush ImageSource="../Image/leftImage.png"/>
</Setter.Value>
</Setter>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<ControlTemplate x:Key="butonTempalte" TargetType="RadioButton">
<Border x:Name="_borderOver" Background="Transparent" Width="200" Height="60" BorderBrush="Transparent" BorderThickness="0,1">
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center" />
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="BorderBrush" TargetName="_borderOver" Value="#1971B6"/>
<Setter Property="Background" TargetName="_borderOver">
<Setter.Value>
<LinearGradientBrush StartPoint="0,1" EndPoint="1,1">
<GradientStop Color="#104E8B" Offset="0"/>
<GradientStop Color="#1874CD" Offset="0.4"/>
<GradientStop Color="#1874CD" Offset="0.6"/>
<GradientStop Color="#27408B" Offset="1"/>
</LinearGradientBrush>
</Setter.Value>
</Setter>
</Trigger>
<Trigger Property="IsChecked" Value="True">

<Setter Property="Background" TargetName="_borderOver" >
<Setter.Value>
<ImageBrush ImageSource="../Image/leftImage.png"/>
</Setter.Value>
</Setter>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Window.Resources>
<Grid >
<Grid.ColumnDefinitions>
@@ -150,91 +71,10 @@
</Style>
</Button.Style>
</Button>
<Grid Grid.Row="1" Grid.ColumnSpan="2">
<local:MainControl/>
</Grid>


<Border Grid.Row="1" Grid.RowSpan="2" BorderBrush="#1E90FF" BorderThickness="0,0,2,0">
<Border.Background>
<LinearGradientBrush StartPoint="0,1" EndPoint="1,1">
<GradientStop Color="#01003B" Offset="0.2"/>

<GradientStop Color="#010050" Offset="1"/>
</LinearGradientBrush>
</Border.Background>
</Border>
<StackPanel x:Name="mylistview" Background="Transparent" Grid.RowSpan="1" Grid.Row="1"
ScrollViewer.VerticalScrollBarVisibility="Hidden" ScrollViewer.HorizontalScrollBarVisibility="Hidden"
MouseLeftButtonDown="mylistview_MouseDown" >
<RadioButton Style="{DynamicResource RadioNavigation}" IsChecked="True" Template="{DynamicResource butonTempalte }"
Click="NavButton_Click" Tag="OrderManager">
<Grid Background="Transparent" >
<Grid.ColumnDefinitions>
<ColumnDefinition Width="auto"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<TextBlock Text="&#xe737;" Style="{DynamicResource fonticon}"/>
<TextBlock Grid.Column="1" Foreground="White" Text="订单管理" FontSize="24" Background="Transparent"
VerticalAlignment="Center" HorizontalAlignment="Center" FontFamily="楷体"/>

</Grid>
</RadioButton>
<RadioButton Style="{DynamicResource RadioNavigation}" Template="{DynamicResource butonTempalte }"
Click="NavButton_Click" Tag="RecipeManager">
<Grid Background="Transparent" >
<Grid.ColumnDefinitions>
<ColumnDefinition Width="auto"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<TextBlock Text="&#xe683;" Style="{DynamicResource fonticon}"/>
<TextBlock Grid.Column="1" Foreground="White" Text="配方管理" FontSize="24" Background="Transparent"
VerticalAlignment="Center" HorizontalAlignment="Center" FontFamily="楷体"/>
</Grid>
</RadioButton>
<RadioButton Style="{DynamicResource RadioNavigation}" Template="{DynamicResource butonTempalte }"
Click="NavButton_Click" Tag="MaterialManager">
<Grid Background="Transparent" >
<Grid.ColumnDefinitions>
<ColumnDefinition Width="auto"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<TextBlock Text="&#xe63b;" Style="{DynamicResource fonticon}"/>
<TextBlock Grid.Column="1" Foreground="White" Text="原料管理" FontSize="24" Background="Transparent"
VerticalAlignment="Center" HorizontalAlignment="Center" FontFamily="楷体"/>

</Grid>
</RadioButton>
<!--<RadioButton Style="{DynamicResource RadioNavigation}" Template="{DynamicResource butonTempalte }"
Click="NavButton_Click" Tag="TechnologySetting">
<Grid Background="Transparent" >
<Grid.ColumnDefinitions>
<ColumnDefinition Width="auto"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<TextBlock Text="&#xe69b;" Style="{DynamicResource fonticon}"/>
<TextBlock Grid.Column="1" Foreground="White" Text="工艺参数" FontSize="24" Background="Transparent"
VerticalAlignment="Center" HorizontalAlignment="Center" FontFamily="楷体"/>

</Grid>
</RadioButton>-->
<RadioButton Style="{DynamicResource RadioNavigation}" Template="{DynamicResource butonTempalte }"
Click="NavButton_Click" Tag="PowerManager">
<Grid Background="Transparent" >
<Grid.ColumnDefinitions>
<ColumnDefinition Width="auto"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<TextBlock Text="&#xe60c;" Style="{DynamicResource fonticon}"/>
<TextBlock Grid.Column="1" Foreground="White" Text="权限分配" FontSize="24" Background="Transparent"
VerticalAlignment="Center" HorizontalAlignment="Center" FontFamily="楷体"/>

</Grid>
</RadioButton>
</StackPanel>

<ContentControl x:Name="contentRegion" Grid.Column="1" Grid.Row="1" Background="#01003B" BorderBrush="Transparent">
<view:OrderManager/>
</ContentControl>
</Grid>
</Window>

+ 1
- 20
BPASmart.RecipeManagement/MainWindow.xaml.cs Прегледај датотеку

@@ -38,10 +38,6 @@ namespace BPASmart.RecipeManagement

}

private void mylistview_MouseDown(object sender, MouseButtonEventArgs e)
{
this.DragMove();
}

private void Button_Click(object sender, RoutedEventArgs e)
{
@@ -49,22 +45,7 @@ namespace BPASmart.RecipeManagement
}


private void NavButton_Click(object sender, RoutedEventArgs e)
{
try
{
if (sender is RadioButton bt)
{
Type type = Type.GetType($"BPASmart.RecipeManagement.View.{bt.Tag?.ToString()}");
ConstructorInfo cti = type.GetConstructor(System.Type.EmptyTypes);
contentRegion.Content = (FrameworkElement)cti.Invoke(null);
}
}
catch (Exception ex)
{
}
}

private void Border_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
{


+ 6
- 3
BPASmart.RecipeManagement/View/RecipeManager.xaml Прегледај датотеку

@@ -117,9 +117,12 @@
</Grid>

</ScrollViewer>

<Button Grid.Row="4" Content="配方工艺" Style="{DynamicResource ButtonStyle}"
Height="20" Width="80" HorizontalAlignment="Right" VerticalAlignment="Top"
<Button Grid.Row="4" Content="配方下发" Style="{DynamicResource GreenButton}" BorderBrush="Green" BorderThickness="1"
Height="20" Width="70" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="0,0,5,0"
Command="{Binding RelativeSource={RelativeSource AncestorType=UserControl,Mode=FindAncestor},Path=DataContext.PecipeStartCommand}"
CommandParameter="{Binding ID}"/>
<Button Grid.Row="4" Content="配方工艺" Style="{DynamicResource ButtonStyle}"
Height="20" Width="70" HorizontalAlignment="Right" VerticalAlignment="Top" Margin="5,0,0,0"
Command="{Binding RelativeSource={RelativeSource AncestorType=UserControl,Mode=FindAncestor},Path=DataContext.PecipeSettingCommand}"
CommandParameter="{Binding ID}"/>
</Grid>


+ 20
- 0
BPASmart.RecipeManagement/ViewModel/MainControl.cs Прегледај датотеку

@@ -0,0 +1,20 @@
using BPASmart.Model;
using BPASmartClient.Helper;
using Microsoft.Toolkit.Mvvm.ComponentModel;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BPASmart.RecipeManagement.ViewModel
{
public class MainControl:ObservableObject
{
public MainControl()
{
Json<LocalMaterails>.Read();
Json<LocalRecipes>.Read();
}
}
}

+ 1
- 2
BPASmart.RecipeManagement/ViewModel/MainWindowViewModel.cs Прегледај датотеку

@@ -14,8 +14,7 @@ namespace BPASmart.RecipeManagement.ViewModel

public MainWindowViewModel()
{
Json<LocalMaterails>.Read();
Json<LocalRecipes>.Read();
}

}


+ 28
- 1
BPASmart.RecipeManagement/ViewModel/RecipeManagerViewModel.cs Прегледај датотеку

@@ -16,12 +16,22 @@ namespace BPASmart.RecipeManagement.ViewModel
public class RecipeManagerViewModel : ObservableObject
{
public ObservableCollection<Recipes> RecipeList { get; set; } = Json<LocalRecipes>.Data.locaRecipes;

/// <summary>
/// 创建配方
/// </summary>
public RelayCommand CreateRecipeCommand { get; set; }

public RelayCommand<object> EditRecipeCommand { get; set; }
public RelayCommand<object> DeleteRecipeCommand { get; set; }

/// <summary>
/// 配方工艺
/// </summary>
public RelayCommand<object> PecipeSettingCommand { get; set; }
/// <summary>
/// 配方下发
/// </summary>
public RelayCommand<object> PecipeStartCommand { get; set; }

private void EditRecipe(object o)
{
@@ -62,6 +72,21 @@ namespace BPASmart.RecipeManagement.ViewModel
}
}

private void PecipeStart(object o)
{

if (o == null) return;
if (o is string id)
{
var res = Json<LocalRecipes>.Data.locaRecipes.FirstOrDefault(p => p.ID == id);
if (res != null)
{
//下发配方

}
}
}

public RecipeManagerViewModel()
{
CreateRecipeCommand = new RelayCommand(() =>
@@ -77,6 +102,8 @@ namespace BPASmart.RecipeManagement.ViewModel

PecipeSettingCommand = new RelayCommand<object>(PecipeSetting);

PecipeStartCommand = new RelayCommand<object>(PecipeStart);

}
}
}

+ 362
- 6
BPASmart.UserManagement/App.xaml Прегледај датотеку

@@ -6,17 +6,23 @@
<Application.Resources>
<SolidColorBrush x:Key="commanTextblock" Color="#FF2AB2E7"/>
<SolidColorBrush x:Key="selectedColor" Color=" #4169E1"/>
<SolidColorBrush x:Key="ScrollBarDisabledBackground" Color="#F4F4F4"/>
<!--#region ScrollViewer-->

<Style x:Key="ScrollBarThumb" TargetType="{x:Type Thumb}">
<Setter Property="SnapsToDevicePixels" Value="True" />
<Setter Property="OverridesDefaultStyle" Value="true" />
<Setter Property="IsTabStop" Value="false" />
<Setter Property="Focusable" Value="false" />
<Setter Property="OverridesDefaultStyle" Value="true"/>
<Setter Property="IsTabStop" Value="false"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type Thumb}">
<Border CornerRadius="2" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="1" />
<!--滚动条颜色和圆角设置-->
<Rectangle Name="thumbRect" Fill="#03ffea" RadiusX="3" RadiusY="3"/>
<!--鼠标拉动滚动条时的颜色-->
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Fill" Value="CornflowerBlue" TargetName="thumbRect" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
@@ -69,7 +75,40 @@
<ScrollBar x:Name="PART_HorizontalScrollBar" AutomationProperties.AutomationId="HorizontalScrollBar" Cursor="Arrow" Grid.Column="0" Maximum="{TemplateBinding ScrollableWidth}" Minimum="0" Orientation="Horizontal" Grid.Row="1" Visibility="{TemplateBinding ComputedHorizontalScrollBarVisibility}" Value="{Binding HorizontalOffset, Mode=OneWay, RelativeSource={RelativeSource TemplatedParent}}" ViewportSize="{TemplateBinding ViewportWidth}"/>
</Grid>
</ControlTemplate>
<ControlTemplate x:Key="MyScrollViewer" TargetType="{x:Type ScrollViewer}">
<!--View区域背景色-->
<Grid x:Name="Grid" Background="{TemplateBinding Background}">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Rectangle x:Name="Corner" Grid.Column="1" Fill="White" Grid.Row="1"/>
<ScrollContentPresenter x:Name="PART_ScrollContentPresenter" CanContentScroll="{TemplateBinding CanContentScroll}" CanHorizontallyScroll="False" CanVerticallyScroll="False" ContentTemplate="{TemplateBinding ContentTemplate}" Content="{TemplateBinding Content}" Grid.Column="0" Margin="{TemplateBinding Padding}" Grid.Row="0"/>
<ScrollBar x:Name="PART_VerticalScrollBar" AutomationProperties.AutomationId="VerticalScrollBar" Cursor="Arrow" Grid.Column="1" Maximum="{TemplateBinding ScrollableHeight}" Minimum="0" Grid.Row="0" Visibility="{TemplateBinding ComputedVerticalScrollBarVisibility}" Value="{Binding VerticalOffset, Mode=OneWay, RelativeSource={RelativeSource TemplatedParent}}" ViewportSize="{TemplateBinding ViewportHeight}" Style="{DynamicResource MyScrollBarStyle}"/>
<ScrollBar x:Name="PART_HorizontalScrollBar" AutomationProperties.AutomationId="HorizontalScrollBar" Cursor="Arrow" Grid.Column="0" Maximum="{TemplateBinding ScrollableWidth}" Minimum="0" Orientation="Horizontal" Grid.Row="1" Visibility="{TemplateBinding ComputedHorizontalScrollBarVisibility}" Value="{Binding HorizontalOffset, Mode=OneWay, RelativeSource={RelativeSource TemplatedParent}}" ViewportSize="{TemplateBinding ViewportWidth}" Style="{DynamicResource MyScrollBarStyle}"/>
</Grid>
</ControlTemplate>

<Style x:Key="VerticalScrollBarPageButton" TargetType="{x:Type RepeatButton}">
<Setter Property="OverridesDefaultStyle" Value="true"/>
<Setter Property="Background" Value="Transparent"/>
<Setter Property="Focusable" Value="false"/>
<Setter Property="IsTabStop" Value="false"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type RepeatButton}">
<Rectangle Fill="{TemplateBinding Background}" Height="{TemplateBinding Height}" Width="{TemplateBinding Width}"/>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!--#endregion-->
<!--#region右键菜单-->
<Style TargetType="{x:Type ContextMenu}">
<Setter Property="Template">
@@ -201,6 +240,28 @@
</Setter.Value>
</Setter>
</Style>
<Style x:Key="ButtontextStyle" TargetType="Button">
<Setter Property="Background" Value="Transparent"/>
<Setter Property="Foreground" Value="#FF2AB2E7"/>
<Setter Property="BorderBrush" Value="Transparent"/>
<Setter Property="BorderThickness" Value="0"/>
<Setter Property="FontSize" Value="14"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type Button}">
<Border x:Name="border" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}">
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="border" Property="Background" Value="Transparent"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!--#endregion-->
<!--#region 用户输入框样式-->
@@ -281,7 +342,8 @@
</Setter.Value>
</Setter>
</Style>

<!--#endregion-->
<!--#region 密码输入框样式-->
<Style x:Key="PasswordBoxStyle" TargetType="{x:Type PasswordBox}">
<Setter Property="Background" Value="Transparent" />
@@ -372,6 +434,300 @@
</Style>
<!--#endregion-->

<!--#region Combox-->
<ControlTemplate x:Key="ComboBoxToggleButton" TargetType="{x:Type ToggleButton}">
<Grid Height="25" HorizontalAlignment="Stretch" Background="Transparent">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="30" />
</Grid.ColumnDefinitions>
<Border
Grid.ColumnSpan="2"
Background="White"
Opacity="0" />

<Path
x:Name="Arrow"
Grid.Column="1"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Data="M 0 0 6 6 12 0 Z"
Fill="#FF2AB2E7"
Stretch="None">
<Path.Effect>
<DropShadowEffect
BlurRadius="10"
Direction="90"
Opacity="1"
RenderingBias="Quality"
ShadowDepth="0"
Color="Transparent" />
</Path.Effect>
</Path>
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="IsChecked" Value="true">
<Setter TargetName="Arrow" Property="RenderTransform">
<Setter.Value>
<RotateTransform Angle="180" CenterX="6" CenterY="3" />
</Setter.Value>
</Setter>
<Setter TargetName="Arrow" Property="Margin" Value="0,0,0,2" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>


<Style x:Key="CommonCombox" TargetType="{x:Type ComboBox}">
<Setter Property="BorderThickness" Value="1" />
<Setter Property="Background" Value=" #041039"/>
<Setter Property="BorderBrush" Value="#FF2AB2E7"/>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="ItemContainerStyle">
<Setter.Value>
<Style TargetType="ComboBoxItem">
<Setter Property="Height" Value="25" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ComboBoxItem}">
<Grid Width="{TemplateBinding Width}" Height="{TemplateBinding Height}" >
<Border x:Name="_borderbg" Background=" #041039" BorderBrush="#FF2AB2E7" BorderThickness="0"/>
<TextBlock
x:Name="_txt"
Margin="5,0,3,0"
HorizontalAlignment="Left"
VerticalAlignment="Center"
Foreground="#FF2AB2E7"
Text="{Binding Content, RelativeSource={RelativeSource TemplatedParent}}" />

<Border
x:Name="_border"
Background="Transparent"
Opacity="0" />
</Grid>
<ControlTemplate.Triggers>
<MultiTrigger>
<MultiTrigger.Conditions>
<Condition Property="IsSelected" Value="false" />
<Condition Property="IsMouseOver" Value="true" />
</MultiTrigger.Conditions>
<Setter TargetName="_borderbg" Property="Background" Value="#37405E" />
<Setter TargetName="_borderbg" Property="BorderBrush" Value="white" />
<Setter TargetName="_borderbg" Property="BorderThickness" Value="1" />
<Setter TargetName="_txt" Property="Foreground" Value="white" />
</MultiTrigger>
<MultiTrigger>
<MultiTrigger.Conditions>
<Condition Property="IsSelected" Value="true" />
</MultiTrigger.Conditions>
<Setter TargetName="_borderbg" Property="Background" Value="#022352" />
<Setter TargetName="_borderbg" Property="BorderBrush" Value=" #00BFFF" />
<Setter TargetName="_borderbg" Property="BorderThickness" Value="1" />
<Setter TargetName="_txt" Property="Foreground" Value="white" />
</MultiTrigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</Setter.Value>
</Setter>


<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ComboBox}">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="0.7*" />
<ColumnDefinition Width="0.3*" MaxWidth="30" />
</Grid.ColumnDefinitions>
<Border
x:Name="_prybr"
Grid.Column="0"
Grid.ColumnSpan="2"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="0" />
<ContentPresenter
x:Name="ContentSite"
Margin="3,3,0,3"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Content="{TemplateBinding SelectionBoxItem}"
ContentTemplate="{TemplateBinding SelectionBoxItemTemplate}"
ContentTemplateSelector="{TemplateBinding ItemTemplateSelector}"
IsHitTestVisible="False" />

<!-- ToggleButton 已数据绑定到 ComboBox 本身以切换 IsDropDownOpen -->
<ToggleButton
Background="Transparent"
x:Name="ToggleButton"
Grid.Column="0"
Grid.ColumnSpan="2"
ClickMode="Press"
Focusable="false"
IsChecked="{Binding Path=IsDropDownOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}"
Template="{StaticResource ComboBoxToggleButton}" />
<!-- 必须将 TextBox 命名为 PART_EditableTextBox,否则 ComboBox 将无法识别它 -->
<TextBox
x:Name="PART_EditableTextBox"
Margin="2,0,0,0"
VerticalAlignment="Center"
Background="Transparent"
BorderThickness="0"
CaretBrush="{TemplateBinding Foreground}"
Focusable="True"
Foreground="{TemplateBinding Foreground}"
IsReadOnly="{TemplateBinding IsReadOnly}"
Visibility="Hidden" />

<!-- Popup 可显示 ComboBox 中的项列表。IsOpen 已数据绑定到通过 ComboBoxToggleButton 来切换的 IsDropDownOpen -->
<Popup
x:Name="Popup"
AllowsTransparency="True"
Focusable="False"
IsOpen="{TemplateBinding IsDropDownOpen}"
Placement="Bottom"
PopupAnimation="Slide">
<Grid
x:Name="DropDown"
MinWidth="{TemplateBinding ActualWidth}"
MaxHeight="150"
SnapsToDevicePixels="True">
<Border
x:Name="DropDownBorder"
BorderBrush="Black"
BorderThickness="0" />
<ScrollViewer
Margin="1"
CanContentScroll="True"
HorizontalScrollBarVisibility="Hidden"
SnapsToDevicePixels="True"
VerticalScrollBarVisibility="Auto"
Template="{DynamicResource MyScrollViewer }">
<!-- StackPanel 用于显示子级,方法是将 IsItemsHost 设置为 True -->
<!-- 一下可以设置列表背景色 -->
<StackPanel
Background="{TemplateBinding Background}"
IsItemsHost="True"
KeyboardNavigation.DirectionalNavigation="Contained"/>
</ScrollViewer>
</Grid>
</Popup>
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="IsEditable" Value="true">
<Setter TargetName="PART_EditableTextBox" Property="Visibility" Value="Visible" />
</Trigger>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="_prybr" Property="BorderBrush" Value="#aa3ba7f2" />

</Trigger>
<Trigger Property="IsEnabled" Value="False">
<Setter TargetName="ContentSite" Property="Opacity" Value="0.6" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>


<!--滚动条颜色、圆角等设置-->
<Style x:Key="HorizontalScrollBarPageButton" TargetType="{x:Type RepeatButton}">
<Setter Property="OverridesDefaultStyle" Value="true"/>
<Setter Property="Background" Value="Transparent"/>
<Setter Property="Focusable" Value="false"/>
<Setter Property="IsTabStop" Value="false"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type RepeatButton}">
<Rectangle Fill="{TemplateBinding Background}" Height="{TemplateBinding Height}" Width="{TemplateBinding Width}"/>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style x:Key="MyScrollBarStyle" TargetType="{x:Type ScrollBar}">
<Setter Property="Background" Value="AliceBlue"/>
<Setter Property="Stylus.IsPressAndHoldEnabled" Value="false"/>
<Setter Property="Stylus.IsFlicksEnabled" Value="false"/>
<!--滚动条宽度-->
<Setter Property="Width" Value="8"/>
<Setter Property="MinWidth" Value="6"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ScrollBar}">
<!--滚动条背景色-->
<Grid x:Name="Bg" Background="#001f55" SnapsToDevicePixels="true" Width="8">
<Grid.RowDefinitions>
<RowDefinition />
</Grid.RowDefinitions>
<Track x:Name="PART_Track" IsDirectionReversed="true" IsEnabled="{TemplateBinding IsMouseOver}">
<Track.DecreaseRepeatButton>
<RepeatButton Command="{x:Static ScrollBar.PageUpCommand}" Style="{StaticResource VerticalScrollBarPageButton}"/>
</Track.DecreaseRepeatButton>
<Track.IncreaseRepeatButton>
<RepeatButton Command="{x:Static ScrollBar.PageDownCommand}" Style="{StaticResource VerticalScrollBarPageButton}"/>
</Track.IncreaseRepeatButton>
<Track.Thumb>
<Thumb Style="{StaticResource ScrollBarThumb}"/>
</Track.Thumb>
</Track>
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="IsEnabled" Value="false">
<Setter Property="Background" TargetName="Bg" Value="{StaticResource ScrollBarDisabledBackground}"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
<Style.Triggers>
<Trigger Property="Orientation" Value="Horizontal">
<Setter Property="Width" Value="Auto"/>
<Setter Property="MinWidth" Value="0"/>
<Setter Property="Height" Value="6"/>
<Setter Property="MinHeight" Value="6"/>
<Setter Property="Background" Value="AliceBlue"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ScrollBar}">
<Grid x:Name="Bg" Background="Red" SnapsToDevicePixels="true">
<Grid.ColumnDefinitions>
<ColumnDefinition />
</Grid.ColumnDefinitions>
<Track x:Name="PART_Track" IsEnabled="{TemplateBinding IsMouseOver}">
<Track.DecreaseRepeatButton>
<RepeatButton Command="{x:Static ScrollBar.PageLeftCommand}" Style="{StaticResource HorizontalScrollBarPageButton}"/>
</Track.DecreaseRepeatButton>
<Track.IncreaseRepeatButton>
<RepeatButton Command="{x:Static ScrollBar.PageRightCommand}" Style="{StaticResource HorizontalScrollBarPageButton}"/>
</Track.IncreaseRepeatButton>
<Track.Thumb>
<Thumb Style="{StaticResource ScrollBarThumb}" />
</Track.Thumb>
</Track>
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="IsEnabled" Value="false">
<Setter Property="Background" TargetName="Bg" Value="{StaticResource ScrollBarDisabledBackground}"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Trigger>
</Style.Triggers>
</Style>



<!--#endregion-->


<Style x:Key="CommonTextBox" TargetType="{x:Type TextBox}">
<Setter Property="Foreground" Value="Orange"/>
<Setter Property="Background" Value="Transparent"/>


+ 13
- 0
BPASmart.UserManagement/BPASmart.UserManagement.csproj Прегледај датотеку

@@ -17,12 +17,18 @@
<None Remove="Image\信息边框.png" />
<None Remove="Image\图层1.png" />
<None Remove="Image\图层2.png" />
<None Remove="Image\圆形按钮背景.png" />
<None Remove="Image\圆形按钮背景1.png" />
<None Remove="Image\圆形按钮背景2.png" />
<None Remove="Image\容器边框.png" />
<None Remove="Image\尺条框.png" />
<None Remove="Image\成功提示.png" />
<None Remove="Image\按钮背景.png" />
<None Remove="Image\文字背景1.png" />
<None Remove="Image\文字背景2.png" />
<None Remove="Image\方形.png" />
<None Remove="Image\方形背景.png" />
<None Remove="Image\方形背景3.png" />
<None Remove="Image\权限背景.png" />
<None Remove="Image\用户名边框.png" />
<None Remove="Image\用户名边框1.png" />
@@ -41,12 +47,18 @@
<Resource Include="Image\信息边框.png" />
<Resource Include="Image\图层1.png" />
<Resource Include="Image\图层2.png" />
<Resource Include="Image\圆形按钮背景.png" />
<Resource Include="Image\圆形按钮背景1.png" />
<Resource Include="Image\圆形按钮背景2.png" />
<Resource Include="Image\容器边框.png" />
<Resource Include="Image\尺条框.png" />
<Resource Include="Image\成功提示.png" />
<Resource Include="Image\按钮背景.png" />
<Resource Include="Image\文字背景1.png" />
<Resource Include="Image\文字背景2.png" />
<Resource Include="Image\方形.png" />
<Resource Include="Image\方形背景.png" />
<Resource Include="Image\方形背景3.png" />
<Resource Include="Image\权限背景.png" />
<Resource Include="Image\用户名边框.png" />
<Resource Include="Image\用户名边框1.png" />
@@ -61,6 +73,7 @@
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\BPASmart.CustomResource\BPASmart.CustomResource.csproj" />
<ProjectReference Include="..\BPASmart.Model\BPASmart.Model.csproj" />
<ProjectReference Include="..\BPASmartClient.Helper\BPASmartClient.Helper.csproj" />
</ItemGroup>


+ 4
- 1
BPASmart.UserManagement/Globle/GlobleData.cs Прегледај датотеку

@@ -1,4 +1,5 @@
using System;
using BPASmart.Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
@@ -9,5 +10,7 @@ namespace BPASmart.UserManagement.Globle
public static class GlobleData
{
public static UserManager ChangeUser = new UserManager();

public static UserManager EditUser = new UserManager();
}
}







+ 50
- 0
BPASmart.UserManagement/MainControl.xaml Прегледај датотеку

@@ -0,0 +1,50 @@
<UserControl x:Class="BPASmart.UserManagement.MainControl"
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:BPASmart.UserManagement"
xmlns:view="clr-namespace:BPASmart.UserManagement.View"
mc:Ignorable="d"
d:DesignHeight="600" d:DesignWidth="1000">
<Grid >
<Grid.ColumnDefinitions>
<ColumnDefinition Width="200"/>
<ColumnDefinition Width="81*"/>
<ColumnDefinition Width="319*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="40"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Border Grid.RowSpan="2" Background="Transparent" BorderBrush="#1E90FF" BorderThickness="0,0,1,0">
<view:UserList/>
</Border>


<Border Grid.RowSpan="2" Grid.Column="1" Grid.ColumnSpan="2">
<Border.Background>
<ImageBrush ImageSource="../Image/背景4.png"/>
</Border.Background>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="40"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<StackPanel Grid.Column="1" Orientation="Horizontal" VerticalAlignment="Center" HorizontalAlignment="Right" Margin="0,0,10,0">
<Image Source="../Image/图层2.png" Width="100" Height="40"/>
<Button HorizontalAlignment="Right" VerticalAlignment="Center" Margin="10,0" Padding="10,3" FontSize="18"
Content="注册新用户" Style="{DynamicResource ButtonStyle}" Click="NewUser_Click" />
<Image Source="../Image/图层2.png" Width="100"/>
</StackPanel>

<ContentControl Grid.Row="1" x:Name="mainContent" Background="Transparent" >


</ContentControl>
</Grid>

</Border>

</Grid>
</UserControl>

+ 54
- 0
BPASmart.UserManagement/MainControl.xaml.cs Прегледај датотеку

@@ -0,0 +1,54 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
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 BPASmart.UserManagement
{
/// <summary>
/// MainControl.xaml 的交互逻辑
/// </summary>
public partial class MainControl : UserControl
{
public MainControl()
{
InitializeComponent();
ActionManage.GetInstance.Register(new Action<object>((o) => {
if (o == null)
{
return;
}
if (o == string.Empty)
{
mainContent.Content = null;
return;
}
if (o is string pageName)
{
Type type = Type.GetType($"BPASmart.UserManagement.View.{pageName}");
if (type == null) { return; }
ConstructorInfo cti = type.GetConstructor(System.Type.EmptyTypes);
mainContent.Content = (FrameworkElement)cti.Invoke(null);

}

}), "ChangeMianContent");
}

private void NewUser_Click(object sender, RoutedEventArgs e)
{
ActionManage.GetInstance.Send("ChangeMianContent", "AddNewUser");
}
}
}

+ 2
- 38
BPASmart.UserManagement/MainWindow.xaml Прегледај датотеку

@@ -66,47 +66,11 @@
</Grid>
</Border>
<Grid Grid.Row="1">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="200"/>
<ColumnDefinition Width="81*"/>
<ColumnDefinition Width="319*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="40"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Border Grid.RowSpan="2" Background="Transparent" BorderBrush="#1E90FF" BorderThickness="0,0,1,0">
<view:UserList/>
</Border>
<local:MainControl/>


<Border Grid.RowSpan="2" Grid.Column="1" Grid.ColumnSpan="2">
<Border.Background>
<ImageBrush ImageSource="../Image/背景4.png"/>
</Border.Background>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="40"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<StackPanel Grid.Column="1" Orientation="Horizontal" VerticalAlignment="Center" HorizontalAlignment="Right" Margin="0,0,10,0">
<Image Source="../Image/图层2.png" Width="100" Height="40"/>
<Button HorizontalAlignment="Right" VerticalAlignment="Center" Margin="10,0" Padding="10,3" FontSize="18"
Content="注册新用户" Style="{DynamicResource ButtonStyle}" Click="NewUser_Click" />
<Image Source="../Image/图层2.png" Width="100"/>
</StackPanel>

<ContentControl Grid.Row="1" x:Name="mainContent" Background="Transparent" >


</ContentControl>
</Grid>

</Border>

</Grid>
</Grid>

</Grid>

</Border>



+ 1
- 24
BPASmart.UserManagement/MainWindow.xaml.cs Прегледај датотеку

@@ -36,26 +36,6 @@ namespace BPASmart.UserManagement
}

};
ActionManage.GetInstance.Register(new Action<object>((o) => {
if (o == null)
{
return;
}
if(o == string.Empty)
{
mainContent.Content = null;
return;
}
if(o is string pageName)
{
Type type = Type.GetType($"BPASmart.UserManagement.View.{pageName}");
if (type == null) { return; }
ConstructorInfo cti = type.GetConstructor(System.Type.EmptyTypes);
mainContent.Content = (FrameworkElement)cti.Invoke(null);

}
}), "ChangeMianContent");
}

private void Border_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
@@ -70,9 +50,6 @@ namespace BPASmart.UserManagement


private void NewUser_Click(object sender, RoutedEventArgs e)
{
ActionManage.GetInstance.Send("ChangeMianContent", "AddNewUser");
}
}
}

+ 266
- 3
BPASmart.UserManagement/View/EditPower.xaml Прегледај датотеку

@@ -4,15 +4,278 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:BPASmart.UserManagement.View"
xmlns:vm="clr-namespace:BPASmart.UserManagement.ViewModel"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800" FontFamily="楷体">
<Border>
<UserControl.DataContext>
<vm:EditPowerViewModel/>
</UserControl.DataContext>
<UserControl.Resources>
<Style x:Key="ItemContainer" TargetType="{x:Type ListBoxItem}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ListBoxItem}">
<Border x:Name="IconBorder" Background="Transparent" CornerRadius="4" BorderThickness="0">
<ContentPresenter />
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsSelected" Value="true">
<Setter TargetName="IconBorder" Property="BitmapEffect">
<Setter.Value>
<OuterGlowBitmapEffect GlowColor="Transparent" GlowSize="5" />
</Setter.Value>
</Setter>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</UserControl.Resources>
<Border Margin="10,20">
<Border.Background>
<ImageBrush ImageSource="../image/方形背景.png"/>
<ImageBrush ImageSource="pack://application:,,,/BPASmart.CustomResource;component/Image/方形背景2.png"/>
</Border.Background>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="18*"/>
<RowDefinition Height="391*"/>
</Grid.RowDefinitions>
<TextBlock Text="权限编辑"
FontSize="18" Foreground="#F0FFF0"
HorizontalAlignment="Center" VerticalAlignment="Center" Width="72"/>
<Grid Grid.Row="1">
<Grid.RowDefinitions>
<RowDefinition Height="3*"/>
<RowDefinition Height="40*"/>
<RowDefinition Height="328*"/>
</Grid.RowDefinitions>
<StackPanel Grid.Row="1" Orientation="Horizontal" Margin="0,0,0,2"
HorizontalAlignment="Center" VerticalAlignment="Center">
<TextBlock Text="用户名:" Foreground="{DynamicResource commanTextblock}" FontSize="18"
HorizontalAlignment="Center" VerticalAlignment="Center"/>
<ComboBox Width="120" Margin="20,0" ItemsSource="{Binding UserNames}" SelectedItem="{Binding CurrentUserName}" FontSize="16" Foreground="{DynamicResource commanTextblock}"
Style="{DynamicResource CommonCombox}"/>
<Button Content="保存" Style="{DynamicResource CommonButton}" Width="100" FontSize="18" Command="{Binding SaveUserPowerCommand}" Margin="10,0"/>
<Button Content="取消" Style="{DynamicResource CommonButton}" Width="100" FontSize="18" Command="{Binding CancelCommand}" Margin="10,0"/>
</StackPanel>
<Grid Grid.Row="2" Margin="5">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="0.15*"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="0.35*"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="0.15*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="14*"/>
<RowDefinition Height="1*"/>
</Grid.RowDefinitions>
<!--#region 界面列表-->
<Border Grid.Column="1" Margin="20,0,20,0">
<Border.Background>
<ImageBrush ImageSource="../Image/方形背景3.png"/>
</Border.Background>
<ScrollViewer CanContentScroll="True" Template="{DynamicResource ScrollViewerControlTemplate1}"
Width="auto" Margin="10" HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto">
<ListBox Background="Transparent" ItemContainerStyle="{StaticResource ItemContainer}" FocusVisualStyle="{x:Null}"
ItemsSource="{Binding pageList}" >
<ListBox.Template>
<ControlTemplate>
<StackPanel Background="Transparent" IsItemsHost="True"></StackPanel>
</ControlTemplate>
</ListBox.Template>
<ListBox.ItemTemplate>
<DataTemplate>
<Button Background="Transparent" BorderBrush="Transparent" BorderThickness="0" Style="{DynamicResource ButtontextStyle}"
Command="{Binding DataContext.AddPageCommand, RelativeSource={RelativeSource AncestorType=UserControl,Mode=FindAncestor}}"
CommandParameter="{Binding Name}">
<Border x:Name="leftborder" Width="130" HorizontalAlignment="Center" Margin="5">
<Border.Background>
<ImageBrush ImageSource="../Image/文字背景2.png"/>
</Border.Background>
<TextBlock Text="{Binding Name}" Margin="8"
FontSize="18" Foreground="white" HorizontalAlignment="Center" VerticalAlignment="Center"/>
</Border>
</Button>
<DataTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="true">
<Setter Property="Width" Value="160" TargetName="leftborder"/>
</Trigger>
</DataTemplate.Triggers>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</ScrollViewer>
</Border>
<!--#endregion-->

<Grid Grid.Column="2">
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>
<Button Width="80" Height="80" Command="{Binding AddAllPageCommand}">
<Button.Template>
<ControlTemplate TargetType="{x:Type Button}">
<Border >
<Grid>
<StackPanel Orientation="Vertical" Margin="5" HorizontalAlignment="Center" VerticalAlignment="Center" >
<TextBlock Text="全部" FontSize="20" Foreground="{DynamicResource commanTextblock}"/>
<TextBlock Text="添加" FontSize="20" Foreground="{DynamicResource commanTextblock}"/>
</StackPanel>
<Border>
<Border.Background>
<ImageBrush x:Name="image" ImageSource="../Image/圆形按钮背景2.png">
</ImageBrush>
</Border.Background>
<Border.Style>
<Style TargetType="Border">
<Setter Property="RenderTransformOrigin" Value="0.5,0.5"/>
<Setter Property="RenderTransform">
<Setter.Value>
<TransformGroup>
<RotateTransform/>
</TransformGroup>
</Setter.Value>
</Setter>
<Style.Triggers>
<EventTrigger RoutedEvent="Loaded" >
<EventTrigger.Actions>
<BeginStoryboard x:Name="run1">
<Storyboard RepeatBehavior="Forever" Storyboard.TargetProperty="RenderTransform.Children[0].Angle">
<DoubleAnimation From="0" To="360" Duration="0:0:6"/>
</Storyboard>
</BeginStoryboard>
<PauseStoryboard BeginStoryboardName="run1"/>
</EventTrigger.Actions>
</EventTrigger>
<Trigger Property="IsMouseOver" Value="True">
<Trigger.EnterActions>
<ResumeStoryboard BeginStoryboardName="run1"/>
</Trigger.EnterActions>
</Trigger>
<Trigger Property="IsMouseOver" Value="False">
<Trigger.EnterActions>
<PauseStoryboard BeginStoryboardName="run1"/>
</Trigger.EnterActions>
</Trigger>

</Style.Triggers>
</Style>
</Border.Style>
</Border>
</Grid>
</Border>
</ControlTemplate>
</Button.Template>
</Button>

<Button Grid.Row="1" Width="80" Height="80" Command="{Binding DeleteAllPageCommand}">
<Button.Template>
<ControlTemplate TargetType="{x:Type Button}">
<Border >
<Grid>
<StackPanel Orientation="Vertical" Margin="5" HorizontalAlignment="Center" VerticalAlignment="Center" >
<TextBlock Text="全部" FontSize="20" Foreground="{DynamicResource commanTextblock}"/>
<TextBlock Text="移除" FontSize="20" Foreground="{DynamicResource commanTextblock}"/>
</StackPanel>

<Border x:Name="myborder">
<Border.Background>
<ImageBrush x:Name="image" ImageSource="../Image/圆形按钮背景1.png">

</ImageBrush>
</Border.Background>
<Border.Style>
<Style TargetType="Border">
<Setter Property="RenderTransformOrigin" Value="0.5,0.5"/>
<Setter Property="RenderTransform">
<Setter.Value>
<TransformGroup>
<RotateTransform/>
</TransformGroup>
</Setter.Value>
</Setter>
<Style.Triggers>
<EventTrigger RoutedEvent="Loaded" >
<EventTrigger.Actions>
<BeginStoryboard x:Name="run1">
<Storyboard RepeatBehavior="Forever" Storyboard.TargetProperty="RenderTransform.Children[0].Angle">
<DoubleAnimation From="360" To="0" Duration="0:0:6"/>
</Storyboard>
</BeginStoryboard>
<PauseStoryboard BeginStoryboardName="run1"/>
</EventTrigger.Actions>
</EventTrigger>
<Trigger Property="IsMouseOver" Value="True">
<Trigger.EnterActions>
<ResumeStoryboard BeginStoryboardName="run1"/>

</Trigger.EnterActions>
</Trigger>
<Trigger Property="IsMouseOver" Value="False">
<Trigger.EnterActions>
<PauseStoryboard BeginStoryboardName="run1" />
</Trigger.EnterActions>
</Trigger>

</Style.Triggers>
</Style>
</Border.Style>
</Border>

</Grid>
</Border>
</ControlTemplate>
</Button.Template>
</Button>
</Grid>
<!--#region 用户界面列表-->
<Border Grid.Column="3" Margin="20,0,20,0">
<Border.Background>
<ImageBrush ImageSource="../Image/方形背景3.png"/>
</Border.Background>
<ScrollViewer CanContentScroll="True" Template="{DynamicResource ScrollViewerControlTemplate1}"
Width="auto" Margin="10" HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto">
<ListBox Background="Transparent" ItemContainerStyle="{StaticResource ItemContainer}" FocusVisualStyle="{x:Null}" Width="auto"
ItemsSource="{Binding userPageList}" >
<ListBox.Template>
<ControlTemplate>
<StackPanel Background="Transparent" IsItemsHost="True"></StackPanel>
</ControlTemplate>
</ListBox.Template>
<ListBox.ItemTemplate>
<DataTemplate>
<Button Background="Transparent" BorderBrush="Transparent" BorderThickness="0" Style="{DynamicResource ButtontextStyle}"
Command="{Binding DataContext.DeletePageCommand, RelativeSource={RelativeSource AncestorType=UserControl,Mode=FindAncestor}}"
CommandParameter="{Binding Name}">
<Border x:Name="leftborder" Width="130" HorizontalAlignment="Center" Margin="5">
<Border.Background>
<ImageBrush ImageSource="../Image/文字背景2.png"/>
</Border.Background>
<TextBlock Text="{Binding Name}" Margin="8"
FontSize="18" Foreground="white" HorizontalAlignment="Center" VerticalAlignment="Center"/>
</Border>
</Button>
<DataTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="true">
<Setter Property="Width" Value="160" TargetName="leftborder"/>
</Trigger>
</DataTemplate.Triggers>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</ScrollViewer>
</Border>
<!--#endregion-->
</Grid>
</Grid>
</Grid>
</Border>
</UserControl>

+ 2
- 1
BPASmart.UserManagement/ViewModel/AddNewUserViewModel.cs Прегледај датотеку

@@ -1,4 +1,5 @@
using BPASmart.Model.用户;
using BPASmart.Model;
using BPASmart.Model;
using BPASmartClient.Helper;
using System;
using System.Collections.Generic;


+ 115
- 0
BPASmart.UserManagement/ViewModel/EditPowerViewModel.cs Прегледај датотеку

@@ -0,0 +1,115 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BPASmart.UserManagement.ViewModel
{
[INotifyPropertyChanged]
partial class EditPowerViewModel
{
/// <summary>
/// 全部页面
/// </summary>
public ObservableCollection<pageName> pageList { get; set; } = new ObservableCollection<pageName>();
/// <summary>
/// 用户权限页面
/// </summary>
public ObservableCollection<pageName> userPageList { get; set; } = new ObservableCollection<pageName>();

public ObservableCollection<string> UserNames { get; set; } = new ObservableCollection<string>();

[ObservableProperty]
private string _currentUserName;
/// <summary>
/// 保存
/// </summary>
[RelayCommand]
private void SaveUserPower()
{

Globle.GlobleData.EditUser = null;
ActionManage.GetInstance.Send("ChangeMianContent", string.Empty);
}
/// <summary>
/// 取消
/// </summary>
[RelayCommand]
private void Cancel()
{
ActionManage.GetInstance.Send("ChangeMianContent", string.Empty);
}

/// <summary>
/// 添加全部界面
/// </summary>
[RelayCommand]
private void AddAllPage()
{
userPageList.Clear();
foreach(var item in pageList)
{
userPageList.Add(item);
}
}
/// <summary>
/// 删除全部界面
/// </summary>
[RelayCommand]
private void DeleteAllPage()
{
userPageList.Clear();
}
[RelayCommand]
private void AddPage(object o)
{
if (o == null) return;
if (o is string materail)
{
var res = pageList.FirstOrDefault(p => p.Name == materail);
if (userPageList.FirstOrDefault(p => p.Name == res.Name) == null)
{
userPageList.Add(res);
}
}
}
[RelayCommand]
private void DeletePage(object o)
{
if (o == null) return;
if (o is string materail)
{
var res = userPageList.FirstOrDefault(p => p.Name == materail);
userPageList.Remove(res);
}
}

public EditPowerViewModel()
{
pageList.Add(new pageName { Name = "主界面" });
pageList.Add(new pageName { Name = "控制界面" });
pageList.Add(new pageName { Name = "调试界面" });
pageList.Add(new pageName { Name = "日志界面" });
pageList.Add(new pageName { Name = "参数界面"});
pageList.Add(new pageName { Name = "调试界面" });
pageList.Add(new pageName { Name = "日志界面" });
pageList.Add(new pageName { Name = "参数界面" });

foreach(var item in Json<LocalUser>.Data.UserManagers)
{
UserNames.Add(item.UserName);
}
if (Globle.GlobleData.EditUser != null)
{
CurrentUserName = Globle.GlobleData.EditUser.UserName;
}
}
}

public class pageName
{
public string Name { get; set; }
}
}

+ 1
- 1
BPASmart.UserManagement/ViewModel/MainWindowViewModel.cs Прегледај датотеку

@@ -7,7 +7,7 @@ global using System.Collections.Generic;
global using System.Linq;
global using System.Text;
global using System.Threading.Tasks;
global using BPASmart.Model.用户;
global using BPASmart.Model;

namespace BPASmart.UserManagement.ViewModel
{


+ 3
- 1
BPASmart.UserManagement/ViewModel/UserListViewModel.cs Прегледај датотеку

@@ -1,4 +1,4 @@
using BPASmart.Model.用户;
using BPASmart.Model;
using BPASmart.UserManagement.View;
using BPASmartClient.Helper;
using System;
@@ -54,6 +54,8 @@ namespace BPASmart.UserManagement.ViewModel
{
if (userManagers.Contains(user))
{
Globle.GlobleData.EditUser = null;
Globle.GlobleData.EditUser = user;
ActionManage.GetInstance.Send("ChangeMianContent", "EditPower");
}




+ 13
- 0
BPASmartClient.MorkMOC/BPASmartClient.MorkMOC.csproj Прегледај датотеку

@@ -0,0 +1,13 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\BPASmartClient.Device\BPASmartClient.Device.csproj" />
</ItemGroup>

</Project>

+ 200
- 0
BPASmartClient.MorkMOC/Control_MorkMOC.cs Прегледај датотеку

@@ -0,0 +1,200 @@
using BPA.Message.Enum;
using BPASmartClient.Device;
using BPASmartClient.EventBus;
using BPASmartClient.Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using static BPASmartClient.EventBus.EventBus;

namespace BPASmartClient.MorkMOC
{
public class Control_MorkMOC : BaseDevice
{
GVL_MorkMOC morkMoc = new GVL_MorkMOC();

PolymerBatching polymerBatching = new PolymerBatching();

//放大倍数
const int expand = 10;

public override DeviceClientType DeviceType => throw new NotImplementedException();

public override void DoMain()
{
ServerInit();
DataParse();
}

private void ServerInit()
{
//物料信息
EventBus.EventBus.GetInstance().Subscribe<MaterialDeliveryEvent>(DeviceId, delegate (IEvent @event, EventCallBackHandle callBack)
{
if (@event == null) return;
if (@event is MaterialDeliveryEvent material)
{
orderMaterialDelivery = material.orderMaterialDelivery;
}
});

//配方数据信息
EventBus.EventBus.GetInstance().Subscribe<RecipeBomEvent>(DeviceId, delegate (IEvent @event, EventCallBackHandle callBack)
{
if (@event == null) return;
if (@event is RecipeBomEvent recipe)
{
recipeBoms = recipe.recipeBoms;
}
});
}

private void DataParse()
{
EventBus.EventBus.GetInstance().Subscribe<DoOrderEvent>(DeviceId, delegate (IEvent @event, EventCallBackHandle callBack)
{
if (@event == null) return;
if (@event is DoOrderEvent order)
{
if (order.MorkOrder.GoodBatchings == null) return;
OrderCount++;
morkMoc.doOrderEvents.Add(order);
OrderChange(order.MorkOrder.SuborderId, ORDER_STATUS.WAIT);
DeviceProcessLogShow($"接收到{OrderCount}次订单");
Dictionary<int, int> OrderPushes = new Dictionary<int, int>();
foreach (var item in order.MorkOrder.GoodBatchings)
{
var res = orderMaterialDelivery?.BatchingInfo?.FirstOrDefault(p => p.BatchingId == item.BatchingId);
if (res != null)
{
OrderPushes.TryAdd(int.Parse(res.BatchingLoc), item.BatchingCount);
}
}

morkMoc.morkOrderPushes.Enqueue(new OrderLocInfo()
{
GoodName = order.MorkOrder.GoodsName,
SuborderId = order.MorkOrder.SuborderId,
GoodPushes = OrderPushes
});
}
});
}

/// <summary>
/// 订单改变通知
/// </summary>
/// <param name="subid"></param>
/// <param name="oRDER_STATUS"></param>
private void OrderChange(string subid, ORDER_STATUS oRDER_STATUS)
{
var res = morkMoc.doOrderEvents.FirstOrDefault(p => p.MorkOrder.SuborderId == subid);
string goodName = string.Empty;
string SortNum = string.Empty;
EventBus.EventBus.GetInstance().Publish(new OrderStatusChangedEvent()
{
SortNum = res.MorkOrder.SortNum.ToString(),
GoodName = res.MorkOrder.GoodsName,
Status = oRDER_STATUS,
SubOrderId = res.MorkOrder.SuborderId,
deviceClientType = DeviceType
});
if (oRDER_STATUS == ORDER_STATUS.COMPLETED_COOK) morkMoc.doOrderEvents.Remove(res);
}

public override void MainTask()
{
MakeProcess();
}
/// <summary>
/// 制作流程
/// </summary>
private void MakeProcess()
{
if (morkMoc.morkOrderPushes.Count > 0)
{
if (morkMoc.morkOrderPushes.TryDequeue(out OrderLocInfo orderLoc))
{
// 第一步:设置每个仓的出料量
SetMaterialsWeight(orderLoc.GoodPushes);
DeviceProcessLogShow("设置出料量完成");
//第二步:循环出料
OutMaterials(orderLoc.GoodPushes);
DeviceProcessLogShow($"{orderLoc.GoodName}制作完成");
}
}

}
/// <summary>
/// 设定出料重量
/// </summary>
/// <param name="goodPushes"></param>
private void SetMaterialsWeight(Dictionary<int,int> goodPushes)
{
foreach(var good in goodPushes)
{
WriteControl(polymerBatching.plcData[good.Key - 1].WeightVar, good.Value * expand);
DeviceProcessLogShow($"{good.Key}号通道出料量:{good.Value}g");
Thread.Sleep(300);
}
}

/// <summary>
/// 循环出料
/// </summary>
private void OutMaterials(Dictionary<int, int> goodPushes)
{
foreach (var good in goodPushes)
{
WriteControl(polymerBatching.plcData[good.Key - 1].StartUpVar, true);
Thread.Sleep(3000);//写入PLC开启通道后 PLC会先把完成信号置0,等待出料完成后置1
while(!morkMoc.OutMaterailCompelete)//接收到完成信号后退出循环
{
Thread.Sleep(1000);
//需要加入超时提示或处理
}
DeviceProcessLogShow($"{good.Key}号通道出料完成");
}

}

public override void ReadData()
{
GetStatus("M10.0", new Action<object>((obj) =>
{
if (obj is bool[] bools && bools.Length > 0 )
{
morkMoc.OutMaterailCompelete = bools[0];
}
}));
}

public override void ResetProgram()
{
throw new NotImplementedException();
}

public override void SimOrder()
{
throw new NotImplementedException();
}

public override void Stop()
{
throw new NotImplementedException();
}

private void GetStatus(string key, Action<object> action)
{
if (peripheralStatus.ContainsKey(key))
{
if (peripheralStatus[key] != null)
{
action?.Invoke(peripheralStatus[key]);
}
}
}
}
}

+ 26
- 0
BPASmartClient.MorkMOC/GVL_MorkMOC.cs Прегледај датотеку

@@ -0,0 +1,26 @@
using BPASmartClient.Model;
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BPASmartClient.MorkMOC
{
public class GVL_MorkMOC
{
/// <summary>
/// 订单队列
/// </summary>
public ConcurrentQueue<OrderLocInfo> morkOrderPushes = new ConcurrentQueue<OrderLocInfo>();

/// <summary>
/// 订单暂存列表
/// </summary>
public List<DoOrderEvent> doOrderEvents { get; set; } = new List<DoOrderEvent>();


public bool OutMaterailCompelete = false;
}
}

+ 16
- 0
BPASmartClient.MorkMOC/OrderLocInfo.cs Прегледај датотеку

@@ -0,0 +1,16 @@
using System;
using System.Collections.Generic;
using System.Text;

namespace BPASmartClient.MorkMOC
{
public class OrderLocInfo
{
public string SuborderId { get; set; }
public ushort RecipeNumber { get; set; }
public string GoodName { get; set; }
public Dictionary<int, int> GoodPushes { get; set; }
}

}

+ 52
- 0
BPASmartClient.MorkMOC/PolymerBatching.cs Прегледај датотеку

@@ -0,0 +1,52 @@
using BPASmartClient.Helper;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BPASmartClient.MorkMOC
{
public class PolymerBatching
{
public List<PLCData> plcData = new List<PLCData>();
public PolymerBatching()
{
plcData.Add(new PLCData { Positon = 1,WeightVar = "VW200", StartUpVar = "M4.0" });
plcData.Add(new PLCData { Positon = 2, WeightVar = "VW202", StartUpVar = "M4.1" });
plcData.Add(new PLCData { Positon = 3, WeightVar = "VW204", StartUpVar = "M4.2" });
plcData.Add(new PLCData { Positon = 4, WeightVar = "VW206", StartUpVar = "M4.3" });
plcData.Add(new PLCData { Positon = 5, WeightVar = "VW208", StartUpVar = "M4.4" });
plcData.Add(new PLCData { Positon = 6, WeightVar = "VW210", StartUpVar = "M4.5" });
plcData.Add(new PLCData { Positon = 7, WeightVar = "VW212", StartUpVar = "M4.6" });
plcData.Add(new PLCData { Positon = 8, WeightVar = "VW214", StartUpVar = "M4.7" });
plcData.Add(new PLCData { Positon = 9, WeightVar = "VW216", StartUpVar = "M5.0" });
plcData.Add(new PLCData { Positon = 10, WeightVar = "VW218", StartUpVar = "M5.1" });
plcData.Add(new PLCData { Positon = 11, WeightVar = "VW220", StartUpVar = "M5.2" });
plcData.Add(new PLCData { Positon = 12, WeightVar = "VW222", StartUpVar = "M5.3" });
plcData.Add(new PLCData { Positon = 13, WeightVar = "VW224", StartUpVar = "M5.4" });
plcData.Add(new PLCData { Positon = 14, WeightVar = "VW226", StartUpVar = "M5.5" });
}
}

public class PLCData
{
/// <summary>
/// 通道位置
/// </summary>
public int Positon;
/// <summary>
/// PLC通道重量点位
/// </summary>
public string WeightVar;
/// <summary>
/// PLC通道启动点位
/// </summary>
public string StartUpVar;
}


}

+ 1
- 1
PermissionManagement/MainWindow.xaml Прегледај датотеку

@@ -6,7 +6,7 @@
xmlns:local="clr-namespace:PermissionManagement"
mc:Ignorable="d"
Title="MainWindow" Height="450" Width="800" WindowStartupLocation="CenterScreen" WindowStyle="None" AllowsTransparency="True" >
<Grid Background="">
<Grid >

</Grid>
</Window>

+ 68
- 0
SmartClient.sln Прегледај датотеку

@@ -176,6 +176,12 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BPASmart.UserManagement", "
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BPASmart.PageLoad", "BPASmart.PageLoad\BPASmart.PageLoad.csproj", "{2DB084E8-B951-4D71-A203-FD0902EBA2C6}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BPASmart.CustomResource", "BPASmart.CustomResource\BPASmart.CustomResource.csproj", "{E7CC45BF-7393-4BA7-A9AD-B1A1F5B265F3}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "HK-Advertisement", "..\..\TEST\HK-Advertisement\HK-Advertisement.csproj", "{CE98BFD2-9D96-4AB4-A727-662BB341200C}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BPASmartClient.MorkMOC", "BPASmartClient.MorkMOC\BPASmartClient.MorkMOC.csproj", "{D5081D7B-3EBB-42C7-8FB9-A889870D08C2}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -1630,6 +1636,66 @@ Global
{2DB084E8-B951-4D71-A203-FD0902EBA2C6}.Release|x64.Build.0 = Release|Any CPU
{2DB084E8-B951-4D71-A203-FD0902EBA2C6}.Release|x86.ActiveCfg = Release|Any CPU
{2DB084E8-B951-4D71-A203-FD0902EBA2C6}.Release|x86.Build.0 = Release|Any CPU
{E7CC45BF-7393-4BA7-A9AD-B1A1F5B265F3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E7CC45BF-7393-4BA7-A9AD-B1A1F5B265F3}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E7CC45BF-7393-4BA7-A9AD-B1A1F5B265F3}.Debug|ARM.ActiveCfg = Debug|Any CPU
{E7CC45BF-7393-4BA7-A9AD-B1A1F5B265F3}.Debug|ARM.Build.0 = Debug|Any CPU
{E7CC45BF-7393-4BA7-A9AD-B1A1F5B265F3}.Debug|ARM64.ActiveCfg = Debug|Any CPU
{E7CC45BF-7393-4BA7-A9AD-B1A1F5B265F3}.Debug|ARM64.Build.0 = Debug|Any CPU
{E7CC45BF-7393-4BA7-A9AD-B1A1F5B265F3}.Debug|x64.ActiveCfg = Debug|Any CPU
{E7CC45BF-7393-4BA7-A9AD-B1A1F5B265F3}.Debug|x64.Build.0 = Debug|Any CPU
{E7CC45BF-7393-4BA7-A9AD-B1A1F5B265F3}.Debug|x86.ActiveCfg = Debug|Any CPU
{E7CC45BF-7393-4BA7-A9AD-B1A1F5B265F3}.Debug|x86.Build.0 = Debug|Any CPU
{E7CC45BF-7393-4BA7-A9AD-B1A1F5B265F3}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E7CC45BF-7393-4BA7-A9AD-B1A1F5B265F3}.Release|Any CPU.Build.0 = Release|Any CPU
{E7CC45BF-7393-4BA7-A9AD-B1A1F5B265F3}.Release|ARM.ActiveCfg = Release|Any CPU
{E7CC45BF-7393-4BA7-A9AD-B1A1F5B265F3}.Release|ARM.Build.0 = Release|Any CPU
{E7CC45BF-7393-4BA7-A9AD-B1A1F5B265F3}.Release|ARM64.ActiveCfg = Release|Any CPU
{E7CC45BF-7393-4BA7-A9AD-B1A1F5B265F3}.Release|ARM64.Build.0 = Release|Any CPU
{E7CC45BF-7393-4BA7-A9AD-B1A1F5B265F3}.Release|x64.ActiveCfg = Release|Any CPU
{E7CC45BF-7393-4BA7-A9AD-B1A1F5B265F3}.Release|x64.Build.0 = Release|Any CPU
{E7CC45BF-7393-4BA7-A9AD-B1A1F5B265F3}.Release|x86.ActiveCfg = Release|Any CPU
{E7CC45BF-7393-4BA7-A9AD-B1A1F5B265F3}.Release|x86.Build.0 = Release|Any CPU
{CE98BFD2-9D96-4AB4-A727-662BB341200C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{CE98BFD2-9D96-4AB4-A727-662BB341200C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{CE98BFD2-9D96-4AB4-A727-662BB341200C}.Debug|ARM.ActiveCfg = Debug|Any CPU
{CE98BFD2-9D96-4AB4-A727-662BB341200C}.Debug|ARM.Build.0 = Debug|Any CPU
{CE98BFD2-9D96-4AB4-A727-662BB341200C}.Debug|ARM64.ActiveCfg = Debug|Any CPU
{CE98BFD2-9D96-4AB4-A727-662BB341200C}.Debug|ARM64.Build.0 = Debug|Any CPU
{CE98BFD2-9D96-4AB4-A727-662BB341200C}.Debug|x64.ActiveCfg = Debug|Any CPU
{CE98BFD2-9D96-4AB4-A727-662BB341200C}.Debug|x64.Build.0 = Debug|Any CPU
{CE98BFD2-9D96-4AB4-A727-662BB341200C}.Debug|x86.ActiveCfg = Debug|Any CPU
{CE98BFD2-9D96-4AB4-A727-662BB341200C}.Debug|x86.Build.0 = Debug|Any CPU
{CE98BFD2-9D96-4AB4-A727-662BB341200C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{CE98BFD2-9D96-4AB4-A727-662BB341200C}.Release|Any CPU.Build.0 = Release|Any CPU
{CE98BFD2-9D96-4AB4-A727-662BB341200C}.Release|ARM.ActiveCfg = Release|Any CPU
{CE98BFD2-9D96-4AB4-A727-662BB341200C}.Release|ARM.Build.0 = Release|Any CPU
{CE98BFD2-9D96-4AB4-A727-662BB341200C}.Release|ARM64.ActiveCfg = Release|Any CPU
{CE98BFD2-9D96-4AB4-A727-662BB341200C}.Release|ARM64.Build.0 = Release|Any CPU
{CE98BFD2-9D96-4AB4-A727-662BB341200C}.Release|x64.ActiveCfg = Release|Any CPU
{CE98BFD2-9D96-4AB4-A727-662BB341200C}.Release|x64.Build.0 = Release|Any CPU
{CE98BFD2-9D96-4AB4-A727-662BB341200C}.Release|x86.ActiveCfg = Release|Any CPU
{CE98BFD2-9D96-4AB4-A727-662BB341200C}.Release|x86.Build.0 = Release|Any CPU
{D5081D7B-3EBB-42C7-8FB9-A889870D08C2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{D5081D7B-3EBB-42C7-8FB9-A889870D08C2}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D5081D7B-3EBB-42C7-8FB9-A889870D08C2}.Debug|ARM.ActiveCfg = Debug|Any CPU
{D5081D7B-3EBB-42C7-8FB9-A889870D08C2}.Debug|ARM.Build.0 = Debug|Any CPU
{D5081D7B-3EBB-42C7-8FB9-A889870D08C2}.Debug|ARM64.ActiveCfg = Debug|Any CPU
{D5081D7B-3EBB-42C7-8FB9-A889870D08C2}.Debug|ARM64.Build.0 = Debug|Any CPU
{D5081D7B-3EBB-42C7-8FB9-A889870D08C2}.Debug|x64.ActiveCfg = Debug|Any CPU
{D5081D7B-3EBB-42C7-8FB9-A889870D08C2}.Debug|x64.Build.0 = Debug|Any CPU
{D5081D7B-3EBB-42C7-8FB9-A889870D08C2}.Debug|x86.ActiveCfg = Debug|Any CPU
{D5081D7B-3EBB-42C7-8FB9-A889870D08C2}.Debug|x86.Build.0 = Debug|Any CPU
{D5081D7B-3EBB-42C7-8FB9-A889870D08C2}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D5081D7B-3EBB-42C7-8FB9-A889870D08C2}.Release|Any CPU.Build.0 = Release|Any CPU
{D5081D7B-3EBB-42C7-8FB9-A889870D08C2}.Release|ARM.ActiveCfg = Release|Any CPU
{D5081D7B-3EBB-42C7-8FB9-A889870D08C2}.Release|ARM.Build.0 = Release|Any CPU
{D5081D7B-3EBB-42C7-8FB9-A889870D08C2}.Release|ARM64.ActiveCfg = Release|Any CPU
{D5081D7B-3EBB-42C7-8FB9-A889870D08C2}.Release|ARM64.Build.0 = Release|Any CPU
{D5081D7B-3EBB-42C7-8FB9-A889870D08C2}.Release|x64.ActiveCfg = Release|Any CPU
{D5081D7B-3EBB-42C7-8FB9-A889870D08C2}.Release|x64.Build.0 = Release|Any CPU
{D5081D7B-3EBB-42C7-8FB9-A889870D08C2}.Release|x86.ActiveCfg = Release|Any CPU
{D5081D7B-3EBB-42C7-8FB9-A889870D08C2}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@@ -1711,6 +1777,8 @@ Global
{897F8379-3301-4CBE-9BCA-AF7FD2F963A9} = {CDC1E762-5E1D-4AE1-9DF2-B85761539086}
{06F30619-AD37-4CA0-838F-0431867E0932} = {CDC1E762-5E1D-4AE1-9DF2-B85761539086}
{2DB084E8-B951-4D71-A203-FD0902EBA2C6} = {CDC1E762-5E1D-4AE1-9DF2-B85761539086}
{E7CC45BF-7393-4BA7-A9AD-B1A1F5B265F3} = {CDC1E762-5E1D-4AE1-9DF2-B85761539086}
{D5081D7B-3EBB-42C7-8FB9-A889870D08C2} = {9FB27073-61A0-4FE3-94DB-5FDDE062332F}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {9AEC9B81-0222-4DE9-B642-D915C29222AC}


Loading…
Откажи
Сачувај