Procházet zdrojové kódy

小炒

样式分支
NXX před 2 roky
rodič
revize
7f1bb0ae7c
100 změnil soubory, kde provedl 7119 přidání a 540 odebrání
  1. +1
    -1
      BPASmart.ConfigurationSoftware/BPASmart.ConfigurationSoftware.csproj
  2. +8
    -0
      BPASmart.MenuLoad/App.xaml
  3. +74
    -0
      BPASmart.MenuLoad/App.xaml.cs
  4. +10
    -0
      BPASmart.MenuLoad/AssemblyInfo.cs
  5. +28
    -0
      BPASmart.MenuLoad/BPASmart.MenuLoad.csproj
  6. +12
    -0
      BPASmart.MenuLoad/MainWindow.xaml
  7. +28
    -0
      BPASmart.MenuLoad/MainWindow.xaml.cs
  8. binární
     
  9. +0
    -0
      BPASmart.Model/Interfaces/IRecipeMaterials.cs
  10. +1
    -1
      BPASmart.PageLoad/BPASmart.PageLoad.csproj
  11. +2
    -2
      BPASmart.PageLoad/MainWindow.xaml
  12. +1
    -2
      BPASmart.RecipeManagement/ViewModel/RecipeManagerViewModel.cs
  13. +1
    -1
      BPASmart.Server/BPASmart.Server.csproj
  14. +1
    -7
      BPASmart.Server/CommunicationServer.cs
  15. +1
    -1
      BPASmart.VariableManager/BPASmart.VariableManager.csproj
  16. +459
    -413
      BPASmartClient.AGV/AGVHelper.cs
  17. +2
    -2
      BPASmartClient.AGV/AGVLoadInteracteModel.cs
  18. +2
    -2
      BPASmartClient.AGV/AGVModel.cs
  19. +2
    -2
      BPASmartClient.AGV/AGVTaskCancelModel.cs
  20. +2
    -2
      BPASmartClient.AGV/AGVTaskCompleteNotifyModel.cs
  21. +2
    -2
      BPASmartClient.AGV/AGV_PointRollerJobData.cs
  22. +2
    -2
      BPASmartClient.AGV/AGV_SlotRollerJobData.cs
  23. +2
    -2
      BPASmartClient.AGV/HttpRequestHeaderModel.cs
  24. +11
    -0
      BPASmartClient.CustomResource/BPASmartClient.CustomResource.csproj
  25. binární
     
  26. +276
    -0
      BPASmartClient.CustomResource/Fonts/new/demo_index.html
  27. binární
     
  28. binární
     
  29. binární
     
  30. binární
     
  31. binární
     
  32. +1
    -1
      BPASmartClient.CustomResource/Pages/Model/MenuManage.cs
  33. +52
    -11
      BPASmartClient.CustomResource/Pages/Model/MessageLog.cs
  34. +26
    -15
      BPASmartClient.CustomResource/Pages/View/DebugLogView.xaml
  35. +23
    -8
      BPASmartClient.CustomResource/Pages/View/LoginView.xaml
  36. +8
    -1
      BPASmartClient.CustomResource/Pages/View/LoginView.xaml.cs
  37. +5
    -1
      BPASmartClient.CustomResource/Pages/View/MainView.xaml.cs
  38. +107
    -0
      BPASmartClient.CustomResource/Pages/View/PromptView.xaml
  39. +74
    -0
      BPASmartClient.CustomResource/Pages/View/PromptView.xaml.cs
  40. +11
    -45
      BPASmartClient.CustomResource/Pages/View/RunLogView.xaml
  41. +29
    -12
      BPASmartClient.CustomResource/Pages/ViewModel/DebugLogViewModel.cs
  42. +35
    -2
      BPASmartClient.CustomResource/Pages/ViewModel/MainViewModel.cs
  43. +1
    -1
      BPASmartClient.CustomResource/Pages/ViewModel/UserManageViewModel.cs
  44. +1
    -1
      BPASmartClient.CustomResource/RecDictionarys/RecComboBox.xaml
  45. +84
    -0
      BPASmartClient.CustomResource/UserControls/ConveyBelt2.xaml
  46. +130
    -0
      BPASmartClient.CustomResource/UserControls/ConveyBelt2.xaml.cs
  47. +287
    -0
      BPASmartClient.CustomResource/UserControls/MaterialStock.xaml
  48. +120
    -0
      BPASmartClient.CustomResource/UserControls/MaterialStock.xaml.cs
  49. +230
    -0
      BPASmartClient.CustomResource/UserControls/NumberTextBox.xaml
  50. +81
    -0
      BPASmartClient.CustomResource/UserControls/NumberTextBox.xaml.cs
  51. +6
    -0
      BPASmartClient.DosingProject/App.config
  52. +36
    -0
      BPASmartClient.DosingProject/App.xaml
  53. +252
    -0
      BPASmartClient.DosingProject/App.xaml.cs
  54. +10
    -0
      BPASmartClient.DosingProject/AssemblyInfo.cs
  55. +76
    -0
      BPASmartClient.DosingProject/BPASmartClient.DosingHKProject.csproj
  56. +12
    -0
      BPASmartClient.DosingProject/MainWindow.xaml
  57. +28
    -0
      BPASmartClient.DosingProject/MainWindow.xaml.cs
  58. +31
    -0
      BPASmartClient.DosingProject/Model/Converter/DataTableRedundantConverter.cs
  59. +68
    -0
      BPASmartClient.DosingProject/Model/Converter/RunStatusConvert.cs
  60. +12
    -0
      BPASmartClient.DosingProject/Model/GVL/GVL.cs
  61. +117
    -0
      BPASmartClient.DosingProject/Model/GVL/ReadSmallMaterial.cs
  62. +185
    -0
      BPASmartClient.DosingProject/Model/GVL/WriteSmallMaterial.cs
  63. +99
    -0
      BPASmartClient.DosingProject/Model/GVL_SmallStation.cs
  64. +34
    -0
      BPASmartClient.DosingProject/Model/HK_PLC/HKDeviceStatus.cs
  65. +63
    -0
      BPASmartClient.DosingProject/Model/HK_PLC/HKPlcCommRead.cs
  66. +49
    -0
      BPASmartClient.DosingProject/Model/HK_PLC/HKPlcCommWrite.cs
  67. +563
    -0
      BPASmartClient.DosingProject/Model/ProcessControl.cs
  68. +28
    -0
      BPASmartClient.DosingProject/Model/RawMaterial/ActionMenu.cs
  69. +48
    -0
      BPASmartClient.DosingProject/Model/RawMaterial/AlarmInfo.cs
  70. +17
    -0
      BPASmartClient.DosingProject/Model/RawMaterial/ConveyorServer.cs
  71. +27
    -0
      BPASmartClient.DosingProject/Model/RawMaterial/CylinderStatusModel.cs
  72. +105
    -0
      BPASmartClient.DosingProject/Model/RawMaterial/DeviceAddress.cs
  73. +30
    -0
      BPASmartClient.DosingProject/Model/RawMaterial/DeviceCurrentStatus.cs
  74. +363
    -0
      BPASmartClient.DosingProject/Model/RawMaterial/DeviceInquire.cs
  75. +15
    -0
      BPASmartClient.DosingProject/Model/RawMaterial/DevicePar.cs
  76. +75
    -0
      BPASmartClient.DosingProject/Model/RawMaterial/DeviceParModel.cs
  77. +15
    -0
      BPASmartClient.DosingProject/Model/RawMaterial/GlobalData.cs
  78. +16
    -0
      BPASmartClient.DosingProject/Model/RawMaterial/LocaPar.cs
  79. +99
    -0
      BPASmartClient.DosingProject/Model/RawMaterial/RawMaterialColl.cs
  80. +65
    -0
      BPASmartClient.DosingProject/Model/RawMaterial/RawMaterialDeviceStatus.cs
  81. +56
    -0
      BPASmartClient.DosingProject/Model/RawMaterial/RecipeModel.cs
  82. +14
    -0
      BPASmartClient.DosingProject/Model/Recipes/LocalRecipeDataColl.cs
  83. +32
    -0
      BPASmartClient.DosingProject/Model/Recipes/RemoteRecipeData.cs
  84. +14
    -0
      BPASmartClient.DosingProject/Model/Recipes/RemoteRecipeDataColl.cs
  85. +51
    -0
      BPASmartClient.DosingProject/Model/Recipes/RemoteRecipeRawMaterial.cs
  86. +122
    -0
      BPASmartClient.DosingProject/View/ChangeDeviceNameView.xaml
  87. +31
    -0
      BPASmartClient.DosingProject/View/ChangeDeviceNameView.xaml.cs
  88. +168
    -0
      BPASmartClient.DosingProject/View/DeviceListView.xaml
  89. +28
    -0
      BPASmartClient.DosingProject/View/DeviceListView.xaml.cs
  90. +370
    -0
      BPASmartClient.DosingProject/View/DeviceMaterialParView.xaml
  91. +28
    -0
      BPASmartClient.DosingProject/View/DeviceMaterialParView.xaml.cs
  92. +205
    -0
      BPASmartClient.DosingProject/View/HardwareStatusView.xaml
  93. +28
    -0
      BPASmartClient.DosingProject/View/HardwareStatusView.xaml.cs
  94. +450
    -0
      BPASmartClient.DosingProject/View/ManualControlView.xaml
  95. +28
    -0
      BPASmartClient.DosingProject/View/ManualControlView.xaml.cs
  96. +236
    -0
      BPASmartClient.DosingProject/View/NewLocalRecipeView.xaml
  97. +33
    -0
      BPASmartClient.DosingProject/View/NewLocalRecipeView.xaml.cs
  98. +175
    -0
      BPASmartClient.DosingProject/View/NewMaterialView.xaml
  99. +35
    -0
      BPASmartClient.DosingProject/View/NewMaterialView.xaml.cs
  100. +238
    -0
      BPASmartClient.DosingProject/View/NewRecipeView.xaml

+ 1
- 1
BPASmart.ConfigurationSoftware/BPASmart.ConfigurationSoftware.csproj Zobrazit soubor

@@ -20,7 +20,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="BPA.Helper" Version="1.0.15" />
<PackageReference Include="BPA.Helper" Version="1.0.17" />
</ItemGroup>

<ItemGroup>


+ 8
- 0
BPASmart.MenuLoad/App.xaml Zobrazit soubor

@@ -0,0 +1,8 @@
<Application x:Class="BPASmart.MenuLoad.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:BPASmart.MenuLoad">
<Application.Resources>
</Application.Resources>
</Application>

+ 74
- 0
BPASmart.MenuLoad/App.xaml.cs Zobrazit soubor

@@ -0,0 +1,74 @@
using BeDesignerSCADA.Helper;
using BeDesignerSCADA.View;
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices;
using System.Threading;
using System.Threading.Tasks;
using System.Windows;

namespace BPASmart.MenuLoad
{
/// <summary>
/// Interaction logic for App.xaml
/// </summary>
public partial class App : Application
{
bool isShow = false;
[DllImport("kernel32.dll")]
private static extern bool SetProcessWorkingSetSize(IntPtr proc, int min, int max);
string _path = $"{System.AppDomain.CurrentDomain.BaseDirectory}Layouts\\可视化界面菜单布局.yf";
private void FlushMemory()
{
GC.Collect();
GC.WaitForPendingFinalizers();
if (Environment.OSVersion.Platform == PlatformID.Win32NT)
SetProcessWorkingSetSize(Process.GetCurrentProcess().Handle, -1, -1);
}

protected override void OnStartup(StartupEventArgs e)
{
base.OnStartup(e);

RunWindows run = new RunWindows();
_ = Task.Factory.StartNew(delegate
{
while (true)
{
try
{
if (!isShow)
{
this.Dispatcher.Invoke(() => {
if (File.Exists(_path))
{
SystemHelperNew.GetInstance.CreateShortcutOnDesktop();
SystemHelperNew.GetInstance.CreateShortcutOnDesktop("可视化配置工具");
//SystemHelperNew.GetInstance.CreateDesktopShortcut();
run.LoadingData(_path);
run.Show();
isShow = true;
}
else
{
MessageBox.Show("未布局应用程序!");
System.Windows.Application.Current.Shutdown(0);
}
});
}
FlushMemory();
Thread.Sleep(TimeSpan.FromSeconds((double)1000));
}
catch { }
}
});

}
}
}

+ 10
- 0
BPASmart.MenuLoad/AssemblyInfo.cs Zobrazit soubor

@@ -0,0 +1,10 @@
using System.Windows;

[assembly: ThemeInfo(
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
//(used if a resource is not found in the page,
// or application resource dictionaries)
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
//(used if a resource is not found in the page,
// app, or any theme specific resource dictionaries)
)]

+ 28
- 0
BPASmart.MenuLoad/BPASmart.MenuLoad.csproj Zobrazit soubor

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

<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net6.0-windows</TargetFramework>
<Nullable>enable</Nullable>
<UseWPF>true</UseWPF>
<AssemblyName>可视化应用</AssemblyName>
<ApplicationIcon>fyf.ico</ApplicationIcon>
</PropertyGroup>

<ItemGroup>
<None Remove="fyf.ico" />
</ItemGroup>

<ItemGroup>
<Content Include="fyf.ico" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\BeDesignerSCADA\BeDesignerSCADA.csproj" />
</ItemGroup>

<ItemGroup>
<Resource Include="fyf.ico" />
</ItemGroup>

</Project>

+ 12
- 0
BPASmart.MenuLoad/MainWindow.xaml Zobrazit soubor

@@ -0,0 +1,12 @@
<Window x:Class="BPASmart.MenuLoad.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:BPASmart.MenuLoad"
mc:Ignorable="d"
Title="MainWindow" Height="450" Width="800">
<Grid>

</Grid>
</Window>

+ 28
- 0
BPASmart.MenuLoad/MainWindow.xaml.cs Zobrazit soubor

@@ -0,0 +1,28 @@
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 BPASmart.MenuLoad
{
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
}
}
}

binární
Zobrazit soubor


BPASmart.Model/IRecipeMaterials.cs → BPASmart.Model/Interfaces/IRecipeMaterials.cs Zobrazit soubor


+ 1
- 1
BPASmart.PageLoad/BPASmart.PageLoad.csproj Zobrazit soubor

@@ -8,7 +8,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="BPA.Helper" Version="1.0.15" />
<PackageReference Include="BPA.Helper" Version="1.0.17" />
</ItemGroup>

<ItemGroup>


+ 2
- 2
BPASmart.PageLoad/MainWindow.xaml Zobrazit soubor

@@ -2,7 +2,7 @@
x:Class="BPASmart.PageLoad.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:ctrl="clr-namespace:BeDesignerSCADA.Controls;assembly=BeDesignerSCADA"
xmlns:ctrl="clr-namespace:BeDesignerSCADA.Controls;assembly=可视化配置工具"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:BPASmart.PageLoad"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
@@ -13,7 +13,7 @@
mc:Ignorable="d">
<Grid>
<Grid.Background>
<ImageBrush ImageSource="/BeDesignerSCADA;component/Images/bj.png" />
<ImageBrush ImageSource="/可视化配置工具;component/Images/bj.png" />
</Grid.Background>
<ctrl:RunCanvas x:Name="runCanvas" />
</Grid>


+ 1
- 2
BPASmart.RecipeManagement/ViewModel/RecipeManagerViewModel.cs Zobrazit soubor

@@ -34,7 +34,7 @@ namespace BPASmart.RecipeManagement.ViewModel
/// <summary>
/// 配方下发
/// </summary>
public RelayCommand<object> PecipeStartCommand { get; set; }
public RelayCommand<object> PecipeStartCommand { get; set; }

private void EditRecipe(object o)
{
@@ -77,7 +77,6 @@ namespace BPASmart.RecipeManagement.ViewModel

private void PecipeStart(object o)
{

if (o == null) return;
if (o is string id)
{


+ 1
- 1
BPASmart.Server/BPASmart.Server.csproj Zobrazit soubor

@@ -9,7 +9,7 @@

<ItemGroup>
<PackageReference Include="BPA.Communication" Version="1.0.19" />
<PackageReference Include="BPA.Helper" Version="1.0.15" />
<PackageReference Include="BPA.Helper" Version="1.0.17" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="6.0.9" />
</ItemGroup>



+ 1
- 7
BPASmart.Server/CommunicationServer.cs Zobrazit soubor

@@ -122,11 +122,6 @@ namespace BPASmart.Server

private void DeviceControl(PublishInfo publishInfo)
{
//if (msg.TryDequeue(out string s))
//{
// var res = JsonConvert.DeserializeObject<PublishInfo>(s);
// if (res != null)
// {
publishInfo.PublishModels.ForEach(item =>
{
if (CommunicationDevices.ContainsKey(item.DeviceName))
@@ -171,8 +166,7 @@ namespace BPASmart.Server

}
});
//}
//}

}

private void SetValue(Array arrays, string DeviceName, ReadDataModel readDataModel, EDataType eDataType)


+ 1
- 1
BPASmart.VariableManager/BPASmart.VariableManager.csproj Zobrazit soubor

@@ -30,7 +30,7 @@

<ItemGroup>
<PackageReference Include="BPA.Communication" Version="1.0.19" />
<PackageReference Include="BPA.Helper" Version="1.0.15" />
<PackageReference Include="BPA.Helper" Version="1.0.17" />
</ItemGroup>

<ItemGroup>


+ 459
- 413
BPASmartClient.AGV/AGVHelper.cs
Diff nebyl zobrazen, protože je příliš veliký
Zobrazit soubor


+ 2
- 2
BPASmartClient.AGV/AGVLoadInteracteModel.cs Zobrazit soubor

@@ -11,8 +11,8 @@ namespace BPASmartClient.AGV
/// </summary>
internal class AGVLoadInteracteModel
{
private static AGVLoadInteracteModel _instance;
public static AGVLoadInteracteModel GetInstance=>_instance ??= new AGVLoadInteracteModel();
//private static AGVLoadInteracteModel _instance;
//public static AGVLoadInteracteModel GetInstance=>_instance ??= new AGVLoadInteracteModel();
public string agvCode { get; set;}
public string jobId { get; set; }
public string msgId { get; set; }


+ 2
- 2
BPASmartClient.AGV/AGVModel.cs Zobrazit soubor

@@ -11,8 +11,8 @@ namespace BPASmartClient.AGV
/// </summary>
internal class AGVModel
{
private static AGVModel _instance;
public static AGVModel GetInstance => _instance ??= new AGVModel();
//private static AGVModel _instance;
//public static AGVModel GetInstance => _instance ??= new AGVModel();
/// <summary>
/// 必填项


+ 2
- 2
BPASmartClient.AGV/AGVTaskCancelModel.cs Zobrazit soubor

@@ -11,8 +11,8 @@ namespace BPASmartClient.AGV
/// </summary>
internal class AGVTaskCancelModel
{
private static AGVTaskCancelModel _instance;
public static AGVTaskCancelModel GetInstance => _instance ??= new AGVTaskCancelModel();
//private static AGVTaskCancelModel _instance;
//public static AGVTaskCancelModel GetInstance => _instance ??= new AGVTaskCancelModel();
public string robotJobId { get; set; }
public long warehouseId { get; set; }
public string? executeMode { get; set; }


+ 2
- 2
BPASmartClient.AGV/AGVTaskCompleteNotifyModel.cs Zobrazit soubor

@@ -11,8 +11,8 @@ namespace BPASmartClient.AGV
/// </summary>
internal class AGVTaskCompleteNotifyModel
{
private static AGVTaskCompleteNotifyModel _instance;
public static AGVTaskCompleteNotifyModel GetInstance=>_instance ??= new AGVTaskCompleteNotifyModel();
//private static AGVTaskCompleteNotifyModel _instance;
//public static AGVTaskCompleteNotifyModel GetInstance=>_instance ??= new AGVTaskCompleteNotifyModel();
public string? robotJobId { get; set; }
public string? bucketCode { get; set; }
public string? bucketslotCode { get; set; }


+ 2
- 2
BPASmartClient.AGV/AGV_PointRollerJobData.cs Zobrazit soubor

@@ -11,8 +11,8 @@ namespace BPASmartClient.AGV
/// </summary>
internal class AGV_PointRollerJobData:IJobData
{
private static AGV_PointRollerJobData _instance;
public static AGV_PointRollerJobData GetInstance => _instance ??= new AGV_PointRollerJobData();
//private static AGV_PointRollerJobData _instance;
//public static AGV_PointRollerJobData GetInstance => _instance ??= new AGV_PointRollerJobData();
public string? containerCode { get; set; }
public string startPoint { get; set; }
public string endPoint { get; set; }


+ 2
- 2
BPASmartClient.AGV/AGV_SlotRollerJobData.cs Zobrazit soubor

@@ -11,8 +11,8 @@ namespace BPASmartClient.AGV
/// </summary>
internal class AGV_SlotRollerJobData:IJobData
{
private static AGV_SlotRollerJobData _instance;
public static AGV_SlotRollerJobData GetInstance => _instance ??= new AGV_SlotRollerJobData();
//private static AGV_SlotRollerJobData _instance;
//public static AGV_SlotRollerJobData GetInstance => _instance ??= new AGV_SlotRollerJobData();
public string? containerCode { get; set; }
public string startSlotCode { get; set; }
public string endSlotCode { get; set; }


+ 2
- 2
BPASmartClient.AGV/HttpRequestHeaderModel.cs Zobrazit soubor

@@ -8,8 +8,8 @@ namespace BPASmartClient.AGV
{
internal class HttpRequestHeaderModel
{
private static HttpRequestHeaderModel _instance;
public static HttpRequestHeaderModel GetInstance => _instance ??= new HttpRequestHeaderModel();
//private static HttpRequestHeaderModel _instance;
//public static HttpRequestHeaderModel GetInstance => _instance ??= new HttpRequestHeaderModel();
public string? appKey { get; set; }
public string? appSecret { get; set; }
public string? requestId { get; set; }


+ 11
- 0
BPASmartClient.CustomResource/BPASmartClient.CustomResource.csproj Zobrazit soubor

@@ -24,6 +24,7 @@
<None Remove="Fonts\iconfont.ttf" />
<None Remove="Fonts\MT\iconfont.ttf" />
<None Remove="Fonts\naicha.ttf" />
<None Remove="Fonts\new\iconfont.ttf" />
<None Remove="Fonts\Quartz Regular.ttf" />
<None Remove="Image\AGV\agv.png" />
<None Remove="Image\AGV\AGV小车.png" />
@@ -87,6 +88,10 @@
<None Remove="Image\WindowImages.png" />
<None Remove="Image\上箭头.png" />
<None Remove="Image\不规则矩形.png" />
<None Remove="Image\不锈钢纹理.jpg" />
<None Remove="Image\不锈钢纹理1.png" />
<None Remove="Image\不锈钢纹理2.jpeg" />
<None Remove="Image\不锈钢纹理3.jpeg" />
<None Remove="Image\个人信息.png" />
<None Remove="Image\中间.png" />
<None Remove="Image\临时模板.png" />
@@ -276,6 +281,7 @@
<Resource Include="Fonts\iconfont.ttf" />
<Resource Include="Fonts\MT\iconfont.ttf" />
<Resource Include="Fonts\naicha.ttf" />
<Resource Include="Fonts\new\iconfont.ttf" />
<Resource Include="Fonts\Quartz Regular.ttf" />
<Resource Include="Image\AGV\agv.png" />
<Resource Include="Image\AGV\AGV小车.png" />
@@ -301,6 +307,10 @@
<Resource Include="Image\textBox.png" />
<Resource Include="Image\WindowImages.png" />
<Resource Include="Image\上箭头.png" />
<Resource Include="Image\不锈钢纹理.jpg" />
<Resource Include="Image\不锈钢纹理1.png" />
<Resource Include="Image\不锈钢纹理2.jpeg" />
<Resource Include="Image\不锈钢纹理3.jpeg" />
<Resource Include="Image\中间.png" />
<Resource Include="Image\临时模板.png" />
<Resource Include="Image\产品制作.png" />
@@ -385,6 +395,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="BPA.Helper" Version="1.0.17" />
<PackageReference Include="BPA.Message" Version="1.0.46" />
<PackageReference Include="MahApps.Metro.IconPacks.FontAwesome" Version="4.11.0" />
<PackageReference Include="Microsoft.Toolkit.Mvvm" Version="7.1.2" />


binární
Zobrazit soubor


+ 276
- 0
BPASmartClient.CustomResource/Fonts/new/demo_index.html Zobrazit soubor

@@ -0,0 +1,276 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<title>iconfont Demo</title>
<link rel="shortcut icon" href="//img.alicdn.com/imgextra/i4/O1CN01Z5paLz1O0zuCC7osS_!!6000000001644-55-tps-83-82.svg" type="image/x-icon"/>
<link rel="icon" type="image/svg+xml" href="//img.alicdn.com/imgextra/i4/O1CN01Z5paLz1O0zuCC7osS_!!6000000001644-55-tps-83-82.svg"/>
<link rel="stylesheet" href="https://g.alicdn.com/thx/cube/1.3.2/cube.min.css">
<link rel="stylesheet" href="demo.css">
<link rel="stylesheet" href="iconfont.css">
<script src="iconfont.js"></script>
<!-- jQuery -->
<script src="https://a1.alicdn.com/oss/uploads/2018/12/26/7bfddb60-08e8-11e9-9b04-53e73bb6408b.js"></script>
<!-- 代码高亮 -->
<script src="https://a1.alicdn.com/oss/uploads/2018/12/26/a3f714d0-08e6-11e9-8a15-ebf944d7534c.js"></script>
<style>
.main .logo {
margin-top: 0;
height: auto;
}

.main .logo a {
display: flex;
align-items: center;
}

.main .logo .sub-title {
margin-left: 0.5em;
font-size: 22px;
color: #fff;
background: linear-gradient(-45deg, #3967FF, #B500FE);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
}
</style>
</head>
<body>
<div class="main">
<h1 class="logo"><a href="https://www.iconfont.cn/" title="iconfont 首页" target="_blank">
<img width="200" src="https://img.alicdn.com/imgextra/i3/O1CN01Mn65HV1FfSEzR6DKv_!!6000000000514-55-tps-228-59.svg">
</a></h1>
<div class="nav-tabs">
<ul id="tabs" class="dib-box">
<li class="dib active"><span>Unicode</span></li>
<li class="dib"><span>Font class</span></li>
<li class="dib"><span>Symbol</span></li>
</ul>
</div>
<div class="tab-container">
<div class="content unicode" style="display: block;">
<ul class="icon_lists dib-box">
<li class="dib">
<span class="icon iconfont">&#xe79e;</span>
<div class="name">open-l</div>
<div class="code-name">&amp;#xe79e;</div>
</li>
<li class="dib">
<span class="icon iconfont">&#xe63f;</span>
<div class="name">进行中</div>
<div class="code-name">&amp;#xe63f;</div>
</li>
<li class="dib">
<span class="icon iconfont">&#xe746;</span>
<div class="name">启动</div>
<div class="code-name">&amp;#xe746;</div>
</li>
<li class="dib">
<span class="icon iconfont">&#xe631;</span>
<div class="name">停止刷新</div>
<div class="code-name">&amp;#xe631;</div>
</li>
</ul>
<div class="article markdown">
<h2 id="unicode-">Unicode 引用</h2>
<hr>

<p>Unicode 是字体在网页端最原始的应用方式,特点是:</p>
<ul>
<li>支持按字体的方式去动态调整图标大小,颜色等等。</li>
<li>默认情况下不支持多色,直接添加多色图标会自动去色。</li>
</ul>
<blockquote>
<p>注意:新版 iconfont 支持两种方式引用多色图标:SVG symbol 引用方式和彩色字体图标模式。(使用彩色字体图标需要在「编辑项目」中开启「彩色」选项后并重新生成。)</p>
</blockquote>
<p>Unicode 使用步骤如下:</p>
<h3 id="-font-face">第一步:拷贝项目下面生成的 <code>@font-face</code></h3>
<pre><code class="language-css"
>@font-face {
font-family: 'iconfont';
src: url('iconfont.ttf?t=1665539385316') format('truetype');
}
</code></pre>
<h3 id="-iconfont-">第二步:定义使用 iconfont 的样式</h3>
<pre><code class="language-css"
>.iconfont {
font-family: "iconfont" !important;
font-size: 16px;
font-style: normal;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
</code></pre>
<h3 id="-">第三步:挑选相应图标并获取字体编码,应用于页面</h3>
<pre>
<code class="language-html"
>&lt;span class="iconfont"&gt;&amp;#x33;&lt;/span&gt;
</code></pre>
<blockquote>
<p>"iconfont" 是你项目下的 font-family。可以通过编辑项目查看,默认是 "iconfont"。</p>
</blockquote>
</div>
</div>
<div class="content font-class">
<ul class="icon_lists dib-box">
<li class="dib">
<span class="icon iconfont icon-openl"></span>
<div class="name">
open-l
</div>
<div class="code-name">.icon-openl
</div>
</li>
<li class="dib">
<span class="icon iconfont icon-shouye"></span>
<div class="name">
进行中
</div>
<div class="code-name">.icon-shouye
</div>
</li>
<li class="dib">
<span class="icon iconfont icon-qidong"></span>
<div class="name">
启动
</div>
<div class="code-name">.icon-qidong
</div>
</li>
<li class="dib">
<span class="icon iconfont icon-tingzhishuaxin"></span>
<div class="name">
停止刷新
</div>
<div class="code-name">.icon-tingzhishuaxin
</div>
</li>
</ul>
<div class="article markdown">
<h2 id="font-class-">font-class 引用</h2>
<hr>

<p>font-class 是 Unicode 使用方式的一种变种,主要是解决 Unicode 书写不直观,语意不明确的问题。</p>
<p>与 Unicode 使用方式相比,具有如下特点:</p>
<ul>
<li>相比于 Unicode 语意明确,书写更直观。可以很容易分辨这个 icon 是什么。</li>
<li>因为使用 class 来定义图标,所以当要替换图标时,只需要修改 class 里面的 Unicode 引用。</li>
</ul>
<p>使用步骤如下:</p>
<h3 id="-fontclass-">第一步:引入项目下面生成的 fontclass 代码:</h3>
<pre><code class="language-html">&lt;link rel="stylesheet" href="./iconfont.css"&gt;
</code></pre>
<h3 id="-">第二步:挑选相应图标并获取类名,应用于页面:</h3>
<pre><code class="language-html">&lt;span class="iconfont icon-xxx"&gt;&lt;/span&gt;
</code></pre>
<blockquote>
<p>"
iconfont" 是你项目下的 font-family。可以通过编辑项目查看,默认是 "iconfont"。</p>
</blockquote>
</div>
</div>
<div class="content symbol">
<ul class="icon_lists dib-box">
<li class="dib">
<svg class="icon svg-icon" aria-hidden="true">
<use xlink:href="#icon-openl"></use>
</svg>
<div class="name">open-l</div>
<div class="code-name">#icon-openl</div>
</li>
<li class="dib">
<svg class="icon svg-icon" aria-hidden="true">
<use xlink:href="#icon-shouye"></use>
</svg>
<div class="name">进行中</div>
<div class="code-name">#icon-shouye</div>
</li>
<li class="dib">
<svg class="icon svg-icon" aria-hidden="true">
<use xlink:href="#icon-qidong"></use>
</svg>
<div class="name">启动</div>
<div class="code-name">#icon-qidong</div>
</li>
<li class="dib">
<svg class="icon svg-icon" aria-hidden="true">
<use xlink:href="#icon-tingzhishuaxin"></use>
</svg>
<div class="name">停止刷新</div>
<div class="code-name">#icon-tingzhishuaxin</div>
</li>
</ul>
<div class="article markdown">
<h2 id="symbol-">Symbol 引用</h2>
<hr>

<p>这是一种全新的使用方式,应该说这才是未来的主流,也是平台目前推荐的用法。相关介绍可以参考这篇<a href="">文章</a>
这种用法其实是做了一个 SVG 的集合,与另外两种相比具有如下特点:</p>
<ul>
<li>支持多色图标了,不再受单色限制。</li>
<li>通过一些技巧,支持像字体那样,通过 <code>font-size</code>, <code>color</code> 来调整样式。</li>
<li>兼容性较差,支持 IE9+,及现代浏览器。</li>
<li>浏览器渲染 SVG 的性能一般,还不如 png。</li>
</ul>
<p>使用步骤如下:</p>
<h3 id="-symbol-">第一步:引入项目下面生成的 symbol 代码:</h3>
<pre><code class="language-html">&lt;script src="./iconfont.js"&gt;&lt;/script&gt;
</code></pre>
<h3 id="-css-">第二步:加入通用 CSS 代码(引入一次就行):</h3>
<pre><code class="language-html">&lt;style&gt;
.icon {
width: 1em;
height: 1em;
vertical-align: -0.15em;
fill: currentColor;
overflow: hidden;
}
&lt;/style&gt;
</code></pre>
<h3 id="-">第三步:挑选相应图标并获取类名,应用于页面:</h3>
<pre><code class="language-html">&lt;svg class="icon" aria-hidden="true"&gt;
&lt;use xlink:href="#icon-xxx"&gt;&lt;/use&gt;
&lt;/svg&gt;
</code></pre>
</div>
</div>

</div>
</div>
<script>
$(document).ready(function () {
$('.tab-container .content:first').show()

$('#tabs li').click(function (e) {
var tabContent = $('.tab-container .content')
var index = $(this).index()

if ($(this).hasClass('active')) {
return
} else {
$('#tabs li').removeClass('active')
$(this).addClass('active')

tabContent.hide().eq(index).fadeIn()
}
})
})
</script>
</body>
</html>

binární
Zobrazit soubor


binární
Zobrazit soubor


binární
Zobrazit soubor


binární
Zobrazit soubor


binární
Zobrazit soubor


+ 1
- 1
BPASmartClient.CustomResource/Pages/Model/MenuManage.cs Zobrazit soubor

@@ -96,7 +96,7 @@ namespace BPASmartClient.CustomResource.Pages.Model
/// 子菜单权限管理
/// </summary>
public Permission[] SubMenuPermission { get { return _mSubMenuPermission; } set { _mSubMenuPermission = value; OnPropertyChanged(); } }
private Permission[] _mSubMenuPermission;
private Permission[] _mSubMenuPermission = new Permission[] { Permission.管理员 };

/// <summary>
/// 切换界面路径


+ 52
- 11
BPASmartClient.CustomResource/Pages/Model/MessageLog.cs Zobrazit soubor

@@ -8,6 +8,7 @@ using System.Threading.Tasks;
using System.Windows;
using BPASmartClient.Model;
using System.Windows.Media;
using BPASmartClient.CustomResource.Pages.View;

namespace BPASmartClient.CustomResource.Pages.Model
{
@@ -44,17 +45,20 @@ namespace BPASmartClient.CustomResource.Pages.Model
{
lock (userlock)
{
UserLog userLog = new UserLog()
if (!string.IsNullOrEmpty(Global.userInfo.UserName) && !string.IsNullOrEmpty(Global.userInfo.permission.ToString()) && !string.IsNullOrEmpty(info))
{
Date = DateTime.Now.ToString("yyyy-MM-dd"),
Time = DateTime.Now.ToString("HH:mm:ss"),
Permission = Global.userInfo.permission.ToString(),
UserName = Global.userInfo.UserName,
LogInfo = info
};
Sqlite<UserLog>.GetInstance.Base.Add(userLog);
Application.Current.Dispatcher.Invoke(new Action(() => { userLogs.Insert(0, userLog); }));
UserLog?.Invoke(info);
UserLog userLog = new UserLog()
{
Date = DateTime.Now.ToString("yyyy-MM-dd"),
Time = DateTime.Now.ToString("HH:mm:ss"),
Permission = Global.userInfo.permission.ToString(),
UserName = Global.userInfo.UserName,
LogInfo = info
};
Sqlite<UserLog>.GetInstance.Base.Add(userLog);
Application.Current.Dispatcher.Invoke(new Action(() => { userLogs.Insert(0, userLog); }));
UserLog?.Invoke(info);
}
}
}

@@ -73,7 +77,7 @@ namespace BPASmartClient.CustomResource.Pages.Model
RunLog?.Invoke(info);
}
}
int AlarmID;
public void ShowAlarmLog(string info, string AlarmNumber = "_", AlarmLevel level = AlarmLevel.一般报警)
{
@@ -94,5 +98,42 @@ namespace BPASmartClient.CustomResource.Pages.Model
AlarmLog?.Invoke(info);
}
}

public bool ShowDialog(string info, DialogType dialogType = DialogType.Information)
{
PromptView PV = new PromptView();
switch (dialogType)
{
case DialogType.Warning:
PV.TextBlockIcon = "&#xe61f;";
PV.TextBlockForeground = Brushes.Yellow;
PV.TextBlockInfo = $"警告:{info}";
PV.Cancel.Visibility = Visibility.Collapsed;
break;
case DialogType.Error:
PV.TextBlockIcon = "&#xed1a;";
PV.TextBlockForeground = Brushes.Red;
PV.TextBlockInfo = $"错误:{info}";
PV.Cancel.Visibility = Visibility.Collapsed;
break;
case DialogType.Information:
PV.TextBlockIcon = "&#xe657;";
PV.TextBlockForeground = Brushes.DeepSkyBlue;
PV.TextBlockInfo = $"提示:{info}";
PV.Cancel.Visibility = Visibility.Visible;
break;
default:
break;
}
var res = PV.ShowDialog();
return res == null ? false : (bool)res;
}
}

public enum DialogType
{
Warning,
Error,
Information,
}
}

+ 26
- 15
BPASmartClient.CustomResource/Pages/View/DebugLogView.xaml Zobrazit soubor

@@ -19,21 +19,32 @@
Margin="20"
HorizontalScrollBarVisibility="Hidden"
VerticalScrollBarVisibility="Hidden">
<TextBlock
FontFamily="黑体"
FontSize="16"
Foreground="#20FDFA"
LineHeight="30"
Text="{Binding Message}"
TextWrapping="Wrap">
<TextBlock.Effect>
<DropShadowEffect
Direction="0"
Opacity="0.5"
ShadowDepth="5"
Color="#20aefe" />
</TextBlock.Effect>
</TextBlock>

<ItemsControl ItemsSource="{Binding MessageModels}">
<ItemsControl.ItemTemplate>
<DataTemplate>
<Grid>
<TextBlock
FontFamily="黑体"
FontSize="16"
Foreground="{Binding Forground}"
LineHeight="30"
Text="{Binding LogInfo}"
TextWrapping="Wrap">
<!--<TextBlock.Effect>
<DropShadowEffect
Direction="0"
Opacity="0.5"
ShadowDepth="5"
Color="#20aefe" />
</TextBlock.Effect>-->
</TextBlock>
</Grid>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>


</ScrollViewer>

</Grid>


+ 23
- 8
BPASmartClient.CustomResource/Pages/View/LoginView.xaml Zobrazit soubor

@@ -8,13 +8,13 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:vm="clr-namespace:BPASmartClient.CustomResource.Pages.ViewModel"
Title="LoginView"
Width="1920"
Height="1080"
Width="1366"
Height="768"
AllowsTransparency="True"
Background="{x:Null}"
Topmost="False"
WindowStartupLocation="CenterScreen"
WindowState="Normal"
WindowState="Maximized"
WindowStyle="None"
mc:Ignorable="d">

@@ -194,7 +194,7 @@

<!--#region 操作按钮样式-->
<Style x:Key="ButtonStyle" TargetType="Button">
<Setter Property="Margin" Value="20,20" />
<Setter Property="Margin" Value="20,0" />
<Setter Property="Background" Value="#cc009DFF" />
<Setter Property="BorderThickness" Value="0" />
<Setter Property="FontSize" Value="30" />
@@ -228,7 +228,7 @@

<Grid>
<Grid.Background>
<ImageBrush ImageSource="/BPASmartClient.CustomResource;component/Image/Login.png"/>
<ImageBrush ImageSource="/BPASmartClient.CustomResource;component/Image/Login.png" />
</Grid.Background>
<!--<MediaElement
Name="player"
@@ -236,9 +236,24 @@
VerticalAlignment="Center"
LoadedBehavior="Manual" />-->

<Grid x:Name="grid" Margin="400,180">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="0.4*" />
<ColumnDefinition />
<ColumnDefinition Width="0.4*" />
</Grid.ColumnDefinitions>

<Grid.RowDefinitions>
<RowDefinition Height="0.25*" />
<RowDefinition />
<RowDefinition Height="0.25*" />
</Grid.RowDefinitions>
<!-- Margin="400,180" -->
<Grid
x:Name="grid"
Grid.Row="1"
Grid.Column="1">
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition Height="0.8*"/>
<RowDefinition />
<RowDefinition />
<RowDefinition />
@@ -300,7 +315,7 @@
Text="请输入账号密码"
Visibility="Visible" />

<Grid Grid.Row="3">
<Grid Margin="0 20" Grid.Row="3">
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition />


+ 8
- 1
BPASmartClient.CustomResource/Pages/View/LoginView.xaml.cs Zobrazit soubor

@@ -28,7 +28,7 @@ namespace BPASmartClient.CustomResource.Pages.View
{
InitializeComponent();
//grid.Visibility = Visibility.Collapsed;
Username.Focus();
//Username.Focus();
Username.SelectionStart = Username.Text.Trim().Length;
this.Loaded += LoginView_Loaded;
ActionManage.GetInstance.Register(new Action(() =>
@@ -55,6 +55,13 @@ namespace BPASmartClient.CustomResource.Pages.View
//player.Unloaded += new RoutedEventHandler(media_Unloaded);// 添加元素卸载完成事件 -- 停止播放
//player.MediaOpened += Player_MediaOpened;//已播放事件
}
Task.Factory.StartNew(() =>
{
Thread.Sleep(100);
Application.Current.Dispatcher.Invoke(() => { Username.Focus(); });
//grid.Visibility = Visibility.Visible;
});

}

private void Player_MediaOpened(object sender, RoutedEventArgs e)


+ 5
- 1
BPASmartClient.CustomResource/Pages/View/MainView.xaml.cs Zobrazit soubor

@@ -20,13 +20,17 @@ namespace BPASmartClient.CustomResource.Pages.View
/// </summary>
public partial class MainView : Window
{

public string TitleName { get { return _mTitleName; } set { _mTitleName = value; this.tbTitle.Text = value; } }
private string _mTitleName;

public MainView()
{
InitializeComponent();
this.WindowState = WindowState.Maximized;
this.ButMin.Click += (o, e) => { this.WindowState = WindowState.Minimized; };
this.ButMax.Click += (o, e) => { this.WindowState = this.WindowState == WindowState.Maximized ? WindowState.Normal : WindowState.Maximized; };
this.ButClose.Click += (o, e) => { this.Close(); };
this.ButClose.Click += (o, e) => { this.Close(); Application.Current.Shutdown(); };
this.MoveBorder.MouseLeftButtonDown += (o, e) =>
{
if (e.ClickCount > 1)


+ 107
- 0
BPASmartClient.CustomResource/Pages/View/PromptView.xaml Zobrazit soubor

@@ -0,0 +1,107 @@
<Window
x:Class="BPASmartClient.CustomResource.Pages.View.PromptView"
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:local="clr-namespace:BPASmartClient.CustomResource.Pages.View"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
Title="PromptView"
Width="400"
Height="200"
AllowsTransparency="True"
Background="{x:Null}"
WindowStartupLocation="CenterScreen"
WindowStyle="None"
mc:Ignorable="d">

<Window.Resources>
<Style x:Key="buttonStyle" TargetType="Button">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate>
<Border
BorderBrush="DeepSkyBlue"
BorderThickness="2"
CornerRadius="8" />
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</Window.Resources>

<Grid>
<Grid.Background>
<ImageBrush ImageSource="/BPASmartClient.CustomResource;component/Image/弹窗.png" Stretch="Fill" />
</Grid.Background>

<Grid Margin="18,16">
<Button
Width="30"
Height="20"
HorizontalAlignment="Right"
VerticalAlignment="Top"
Background="Transparent"
BorderThickness="0"
Click="Button_Click" />

<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="0.2*" />
<ColumnDefinition />
</Grid.ColumnDefinitions>

<TextBlock
Name="icon"
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontFamily="../../Fonts/#iconfont"
FontSize="30"
Foreground="DeepSkyBlue"
Text="&#xe61f;" />
<TextBlock
Name="info"
Grid.Column="1"
VerticalAlignment="Center"
Foreground="DeepSkyBlue"
Text="警告:"
TextWrapping="Wrap" />
</Grid>

<StackPanel
Grid.Row="1"
Margin="0,0,10,0"
HorizontalAlignment="Right"
Orientation="Horizontal">
<Button
Name="Cancel"
Width="90"
Height="30"
Margin="5,0,5,0"
Click="Cancel_Click"
Content="取消"
FontSize="20"
Style="{StaticResource ImageButtonStyle}" />

<Button
Name="ok"
Width="90"
Height="30"
Margin="5,0,5,0"
Click="ok_Click"
Content="确定"
FontSize="20"
Style="{StaticResource ImageButtonStyle}" />
</StackPanel>

<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition Height="0.5*" />
</Grid.RowDefinitions>
</Grid>





</Grid>
</Window>

+ 74
- 0
BPASmartClient.CustomResource/Pages/View/PromptView.xaml.cs Zobrazit soubor

@@ -0,0 +1,74 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;

namespace BPASmartClient.CustomResource.Pages.View
{
/// <summary>
/// PromptView.xaml 的交互逻辑
/// </summary>
public partial class PromptView : Window
{
public PromptView()
{
InitializeComponent();
}

public string TextBlockIcon
{
get { return this.icon.Text.Trim(); }
set { this.icon.Text = Regex.Unescape(StringToUnicode(value.ToString())); }
}

public Brush TextBlockForeground
{
get { return this.icon.Foreground; }
set { this.icon.Foreground = value; this.info.Foreground = value; }
}

public string TextBlockInfo
{
get { return this.info.Text.Trim(); }
set { this.info.Text = value; }
}

private string StringToUnicode(string s)
{
if (!string.IsNullOrEmpty(s))
{
//这里把格式&#xe625; 转为 \ue625
return s.Replace(@"&#x", @"\u").Replace(";", "");
}
return s;
}

private void Button_Click(object sender, RoutedEventArgs e)
{
this.DialogResult = false;
this.Close();
}

private void Cancel_Click(object sender, RoutedEventArgs e)
{
this.DialogResult = false;
this.Close();
}

private void ok_Click(object sender, RoutedEventArgs e)
{
this.DialogResult = true;
this.Close();
}
}
}

+ 11
- 45
BPASmartClient.CustomResource/Pages/View/RunLogView.xaml Zobrazit soubor

@@ -51,7 +51,7 @@
<Setter Property="HorizontalAlignment" Value="Center" />
<Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="Background" Value="Transparent" />
<Setter Property="Foreground" Value="Red" />
<Setter Property="Foreground" Value="#FF2BD06F" />
<Setter Property="FontSize" Value="14" />
</Style>

@@ -160,8 +160,8 @@
<!--#region 表格标题栏设置-->
<Grid Grid.Row="1" Background="#ff0C255F">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="0.7*" />
<ColumnDefinition Width="0.7*" />
<ColumnDefinition Width="0.2*" />
<ColumnDefinition Width="0.2*" />
<ColumnDefinition />
</Grid.ColumnDefinitions>

@@ -243,8 +243,8 @@
<DataTemplate>
<Grid x:Name="gr" Height="30">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="0.7*" />
<ColumnDefinition Width="0.7*" />
<ColumnDefinition Width="0.2*" />
<ColumnDefinition Width="0.2*" />
<ColumnDefinition />
</Grid.ColumnDefinitions>

@@ -260,28 +260,11 @@

<TextBlock
Grid.Column="2"
Margin="10,0,0,0"
HorizontalAlignment="Left"
Style="{StaticResource DataTextBlockStyle}"
Text="{Binding RunLogInfo}" />

<!--<Grid Grid.Column="3">
<TextBlock
Margin="10,0,0,0"
HorizontalAlignment="Left"
Style="{StaticResource DataTextBlockStyle}"
Text="{Binding Info}" />
<Border BorderBrush="{StaticResource BorderSolid}" BorderThickness="1,0,1,0" />
</Grid>

<TextBlock
Grid.Column="4"
Style="{StaticResource DataTextBlockStyle}"
Text="{Binding Value}" />

<Grid Grid.Column="5">
<TextBlock Style="{StaticResource DataTextBlockStyle}" Text="{Binding Grade}" />
<Border BorderBrush="{StaticResource BorderSolid}" BorderThickness="1,0,1,0" />
</Grid>-->

<Border
Grid.ColumnSpan="6"
BorderBrush="{StaticResource BorderSolid}"
@@ -306,8 +289,8 @@
<DataTemplate>
<Grid x:Name="gr" Height="30">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="0.7*" />
<ColumnDefinition Width="0.7*" />
<ColumnDefinition Width="0.2*" />
<ColumnDefinition Width="0.2*" />
<ColumnDefinition />
</Grid.ColumnDefinitions>

@@ -323,28 +306,11 @@

<TextBlock
Grid.Column="2"
Margin="10,0,0,0"
HorizontalAlignment="Left"
Style="{StaticResource DataTextBlockStyle}"
Text="{Binding RunLogInfo}" />

<!--<Grid Grid.Column="3">
<TextBlock
Margin="10,0,0,0"
HorizontalAlignment="Left"
Style="{StaticResource DataTextBlockStyle}"
Text="{Binding Info}" />
<Border BorderBrush="{StaticResource BorderSolid}" BorderThickness="1,0,1,0" />
</Grid>

<TextBlock
Grid.Column="4"
Style="{StaticResource DataTextBlockStyle}"
Text="{Binding Value}" />

<Grid Grid.Column="5">
<TextBlock Style="{StaticResource DataTextBlockStyle}" Text="{Binding Grade}" />
<Border BorderBrush="{StaticResource BorderSolid}" BorderThickness="1,0,1,0" />
</Grid>-->

<Border
Grid.ColumnSpan="6"
BorderBrush="{StaticResource BorderSolid}"


+ 29
- 12
BPASmartClient.CustomResource/Pages/ViewModel/DebugLogViewModel.cs Zobrazit soubor

@@ -5,8 +5,10 @@ using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;
using System.Threading.Tasks;
using BPASmartClient.Message;
using Microsoft.Toolkit.Mvvm.ComponentModel;
using BPA.Helper;
using System.Collections.ObjectModel;
using System.Windows.Media;

namespace BPASmartClient.CustomResource.Pages.ViewModel
{
@@ -14,21 +16,36 @@ namespace BPASmartClient.CustomResource.Pages.ViewModel
{
public DebugLogViewModel()
{
MessageLog.GetInstance.DebugLog = new Action<string>((o) =>
{
Message = MessageLog.GetInstance.DebugLogInfo;
});

//MessageLog.GetInstance.NotifyShow = new Action<string>((o) => { });
//MessageLog.GetInstance.DebugLog = new Action<string>((o) =>
// {
// Message = MessageLog.GetInstance.DebugLogInfo;
// });
}

public static string Message { get { return _mMessage; } set { _mMessage = value; OnStaticPropertyChanged(); } }
private static string _mMessage = string.Empty;
public static ObservableCollection<MessageModel> MessageModels { get; set; } = new ObservableCollection<MessageModel>();

//public static string Message { get { return _mMessage; } set { _mMessage = value; OnStaticPropertyChanged(); } }
//private static string _mMessage = string.Empty;

//public static event EventHandler<PropertyChangedEventArgs> StaticPropertyChanged;
//private static void OnStaticPropertyChanged([CallerMemberName] string PropName = "")
//{
// StaticPropertyChanged?.Invoke(null, new PropertyChangedEventArgs(PropName));
//}

public static event EventHandler<PropertyChangedEventArgs> StaticPropertyChanged;
private static void OnStaticPropertyChanged([CallerMemberName] string PropName = "")
{
StaticPropertyChanged?.Invoke(null, new PropertyChangedEventArgs(PropName));
}

}

public class MessageModel : ObservableObject
{
public string LogInfo { get { return _mLogInfo; } set { _mLogInfo = value; OnPropertyChanged(); } }
private string _mLogInfo;

public Brush Forground { get { return _mForground; } set { _mForground = value; OnPropertyChanged(); } }
private Brush _mForground;

}

}

+ 35
- 2
BPASmartClient.CustomResource/Pages/ViewModel/MainViewModel.cs Zobrazit soubor

@@ -6,6 +6,7 @@ using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Media;
using BPASmartClient.CustomResource.Pages.Model;
using BPASmartClient.Helper;
using BPASmartClient.Model;
@@ -19,6 +20,40 @@ namespace BPASmartClient.CustomResource.Pages.ViewModel
public MainViewModel()
{
NavChangedCommand = new RelayCommand<object>(DoNavChanged);
BPA.Helper.MessageLog.GetInstance.NotifyShow = new Action<string>((o) =>
{
Application.Current.Dispatcher.Invoke(() =>
{
//ff20aefe
var temp = new MessageModel()
{
LogInfo = o,
Forground = new SolidColorBrush(Color.FromArgb(255, 32, 174, 254))
};
if (DebugLogViewModel.MessageModels.Count > 0)
DebugLogViewModel.MessageModels.Insert(0, temp);
else
DebugLogViewModel.MessageModels.Add(temp);
});
});
BPA.Helper.MessageLog.GetInstance.NotifyShowEx = new Action<string>((o) =>
{
Application.Current.Dispatcher.Invoke(() =>
{
//FFF53F62
var temp = new MessageModel()
{
LogInfo = o,
Forground = new SolidColorBrush(Color.FromArgb(255, 245, 63, 98))
};
if (DebugLogViewModel.MessageModels.Count > 0)
DebugLogViewModel.MessageModels.Insert(0, temp);
else
DebugLogViewModel.MessageModels.Add(temp);
});


});
menuModels = MenuManage.GetInstance.menuModels;
PermissionChange();
ActionManage.GetInstance.Register(new Action(() =>
@@ -45,8 +80,6 @@ namespace BPASmartClient.CustomResource.Pages.ViewModel

private void DoNavChanged(object obj)
{

if (obj != null && obj is SubMenumodel menumodel)
{
DisplayName = menumodel.SubMenuName;


+ 1
- 1
BPASmartClient.CustomResource/Pages/ViewModel/UserManageViewModel.cs Zobrazit soubor

@@ -59,7 +59,7 @@ namespace BPASmartClient.CustomResource.Pages.ViewModel
}
else
{
MessageBox.Show("用户名为空或输入后未回车确认", "提示", MessageBoxButton.OK, MessageBoxImage.Information);
MessageBox.Show("保存失败,用户名为空或输入后未回车确认", "提示", MessageBoxButton.OK, MessageBoxImage.Warning);
}
});
DeleteCommand = new RelayCommand<string>((str) =>


+ 1
- 1
BPASmartClient.CustomResource/RecDictionarys/RecComboBox.xaml Zobrazit soubor

@@ -123,7 +123,7 @@
<ContentPresenter
x:Name="ContentSite"
Margin="3,3,0,3"
HorizontalAlignment="Center"
HorizontalAlignment="{TemplateBinding HorizontalAlignment}"
VerticalAlignment="Center"
Content="{TemplateBinding SelectionBoxItem}"
ContentTemplate="{TemplateBinding SelectionBoxItemTemplate}"


+ 84
- 0
BPASmartClient.CustomResource/UserControls/ConveyBelt2.xaml Zobrazit soubor

@@ -0,0 +1,84 @@
<UserControl x:Class="BPASmartClient.CustomResource.UserControls.ConveyBelt2"
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:BPASmartClient.CustomResource.UserControls"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800">
<Border x:Name="br" >
<VisualStateManager.VisualStateGroups>
<VisualStateGroup Name="StockGroup">
<VisualState Name="RunState">
<Storyboard RepeatBehavior="Forever">
<DoubleAnimation
Storyboard.TargetName="belt"
Storyboard.TargetProperty="StrokeDashOffset"
From="0"
To="-100"
Duration="0:0:20" />
</Storyboard>
</VisualState>
<VisualState Name="Stop">
</VisualState>
</VisualStateGroup>
<VisualStateGroup Name="DirectionGroup">
<VisualState Name="LeftState">
<Storyboard RepeatBehavior="Forever">
<DoubleAnimation
Storyboard.TargetName="belt"
Storyboard.TargetProperty="StrokeDashOffset"
From="0"
To="100"
Duration="0:0:20" />
</Storyboard>
</VisualState>
<VisualState Name="RightState">
<Storyboard RepeatBehavior="Forever">
<DoubleAnimation
Storyboard.TargetName="belt"
Storyboard.TargetProperty="StrokeDashOffset"
From="0"
To="-100"
Duration="0:0:20" />
</Storyboard>
</VisualState>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
<Viewbox HorizontalAlignment="Center" VerticalAlignment="Center">

<Canvas Width="{Binding ElementName=br, Path=ActualWidth}" Height="{Binding ElementName=br, Path=ActualHeight}" Margin="5">

<Rectangle HorizontalAlignment="Center" Width="{Binding ElementName=br, Path=ActualWidth}" Height="5" Canvas.Top="20" RadiusX="1" RadiusY="1">
<Rectangle.Fill>
<LinearGradientBrush >
<GradientStop Color="LightGray" Offset="0"/>
<GradientStop Color="White" Offset="0.5"/>
<GradientStop Color="LightGray" Offset="1"/>
</LinearGradientBrush>
</Rectangle.Fill>
</Rectangle>
<Rectangle HorizontalAlignment="Center" x:Name="recDown" Width="{Binding ElementName=br, Path=ActualWidth}" Height="5" RadiusX="1" RadiusY="1" Margin="0,80,0,0">
<Rectangle.Fill>
<LinearGradientBrush >
<GradientStop Color="LightGray" Offset="0"/>
<GradientStop Color="White" Offset="0.5"/>
<GradientStop Color="LightGray" Offset="1"/>
</LinearGradientBrush>
</Rectangle.Fill>
</Rectangle>
<Path x:Name="belt" Canvas.Top="20" Canvas.Left="10"
StrokeDashArray="2" StrokeThickness="20">
<Path.Stroke>
<LinearGradientBrush>
<GradientStop Color="SlateGray" Offset="0"/>
<GradientStop Color="White" Offset="0.5"/>
<GradientStop Color="SlateGray" Offset="1"/>
</LinearGradientBrush>
</Path.Stroke>
</Path>
</Canvas>
</Viewbox>
</Border>
</UserControl>

+ 130
- 0
BPASmartClient.CustomResource/UserControls/ConveyBelt2.xaml.cs Zobrazit soubor

@@ -0,0 +1,130 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Runtime.CompilerServices;
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 BPASmartClient.CustomResource.UserControls
{
/// <summary>
/// ConveyBelt2.xaml 的交互逻辑
/// </summary>
public partial class ConveyBelt2 : UserControl
{
public ConveyBelt2()
{
InitializeComponent();
}
[Category("运行状态")]
public bool IsRun
{
get { return (bool)GetValue(IsRunProperty); }
set { SetValue(IsRunProperty, value); }
}
public static readonly DependencyProperty IsRunProperty =
DependencyProperty.Register("IsRun", typeof(bool), typeof(ConveyBelt2), new PropertyMetadata(default(bool), new PropertyChangedCallback(OnRunningChanged)));

private static void OnRunningChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
VisualStateManager.GoToState(d as ConveyBelt2, (bool)e.NewValue ? "RunState" : "Stop", false);
}

public double BeltWidth
{
get { return (double)GetValue(BeltWidthProperty); }
set { SetValue(BeltWidthProperty, value); }
}
public static readonly DependencyProperty BeltWidthProperty =
DependencyProperty.Register("BeltWidth", typeof(double), typeof(ConveyBelt2), new PropertyMetadata(default(double), new PropertyChangedCallback(OnPropertyChanged)));

private static void OnPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
(d as ConveyBelt2)?.Refresh();
}
public void Refresh()
{
PathGeometry geometry = new PathGeometry();
PathFigure pathFigure = new PathFigure();
if (BeltHeight > 100)
{
pathFigure.StartPoint = new Point(0, 35 + (BeltHeight - 100) / 2);
pathFigure.Segments.Add(new LineSegment(new Point(BeltWidth - 10, 35 + (BeltHeight - 100)/2), true));
}
else
{
pathFigure.StartPoint = new Point(0, 35);
pathFigure.Segments.Add(new LineSegment(new Point(BeltWidth - 10, 35), true));
}
geometry.Figures.Add(pathFigure);
this.belt.Data = geometry;
this.belt.StrokeDashOffset = BeltDashOffset;
this.br.Width = BeltWidth;
if (BeltHeight > 100)
{
this.recDown.Margin = new Thickness(0, BeltHeight - 20, 0, 0);
}
else
{
this.recDown.Margin = new Thickness(0, 80, 0, 0);
}

this.belt.StrokeThickness = BeltDashThickess;
}

public double BeltHeight
{
get { return (double)GetValue(BeltHeightProperty); }
set { SetValue(BeltHeightProperty, value); }
}
public static readonly DependencyProperty BeltHeightProperty =
DependencyProperty.Register("BeltHeight", typeof(double), typeof(ConveyBelt2), new PropertyMetadata(default(double), new PropertyChangedCallback(OnPropertyChanged)));

public double BeltDashOffset
{
get { return (double)GetValue(BeltDashOffsetProperty); }
set { SetValue(BeltDashOffsetProperty, value); }
}
public static readonly DependencyProperty BeltDashOffsetProperty =
DependencyProperty.Register("BeltDashOffset", typeof(double), typeof(ConveyBelt2), new PropertyMetadata(default(double), new PropertyChangedCallback(OnPropertyChanged)));

public double BeltDashThickess
{
get { return (double)GetValue(BeltDashThickessProperty); }
set { SetValue(BeltDashThickessProperty, value); }
}
public static readonly DependencyProperty BeltDashThickessProperty =
DependencyProperty.Register("BeltDashThickess", typeof(double), typeof(ConveyBelt2), new PropertyMetadata(default(double), new PropertyChangedCallback(OnPropertyChanged)));
public int BeltDirection
{
get { return (int)GetValue(BeltDirectionProperty); }
set { SetValue(BeltDirectionProperty, value); }
}
public static readonly DependencyProperty BeltDirectionProperty =
DependencyProperty.Register("BeltDirection", typeof(int), typeof(ConveyBelt2), new PropertyMetadata(default(int), new PropertyChangedCallback(OnDirectionChanged)));

private static void OnDirectionChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{

if ((d as ConveyBelt2)?.BeltDirection == 0)
{
VisualStateManager.GoToState(d as ConveyBelt2, "RightState", false);
}
else
{
VisualStateManager.GoToState(d as ConveyBelt2, "LeftState", false);
}

}
}
}

+ 287
- 0
BPASmartClient.CustomResource/UserControls/MaterialStock.xaml Zobrazit soubor

@@ -0,0 +1,287 @@
<UserControl x:Class="BPASmartClient.CustomResource.UserControls.MaterialStock"
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:BPASmartClient.CustomResource.UserControls"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800">
<UserControl.Resources>
<PathGeometry x:Key="move" Figures="M 0,0 L 0,10"/>
</UserControl.Resources>
<Border HorizontalAlignment="Center">
<VisualStateManager.VisualStateGroups>
<VisualStateGroup Name="StockGroup">
<VisualState Name="OpenState">
<Storyboard>
<DoubleAnimation Duration="00:0:1" From="0" To="200"
Storyboard.TargetProperty="Width"
Storyboard.TargetName="stock"/>
<DoubleAnimation Duration="00:0:1" From="0" To="70"
Storyboard.TargetProperty="Height"
Storyboard.TargetName="stock"/>
</Storyboard>
</VisualState>
<VisualState Name="CloseState">
<Storyboard>
<DoubleAnimation Duration="00:0:1" From="200" To="0"
Storyboard.TargetProperty="Width"
Storyboard.TargetName="stock"/>
<DoubleAnimation Duration="00:0:1" From="70" To="0"
Storyboard.TargetProperty="Height"
Storyboard.TargetName="stock"/>
</Storyboard>
</VisualState>
</VisualStateGroup>
<VisualStateGroup Name="RunStateGroup">
<VisualState Name="RunState">
<Storyboard>
<ColorAnimationUsingKeyFrames
Storyboard.TargetName="gsGreen"
Storyboard.TargetProperty="Color">
<DiscreteColorKeyFrame Value="Green" KeyTime="0"/>
</ColorAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
<VisualState Name="Stop"/>
</VisualStateGroup>
<VisualStateGroup x:Name="FaultStateGroup">
<VisualState Name="FaultState">
<Storyboard>
<ColorAnimationUsingKeyFrames RepeatBehavior="Forever"
Storyboard.TargetName="gsRed1"
Storyboard.TargetProperty="Color">
<DiscreteColorKeyFrame Value="Red" KeyTime="0:0:0.5"/>
<DiscreteColorKeyFrame Value="Gray" KeyTime="0:0:1"/>
</ColorAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
<VisualState Name="NormalState"/>
</VisualStateGroup>
<VisualStateGroup x:Name="LayOffStateGroup">
<VisualState Name="LayOffState">
<Storyboard>
<DoubleAnimationUsingPath Duration="0:0:1" PathGeometry="{StaticResource move}" RepeatBehavior="Forever"
Storyboard.TargetName="arrow" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[1].(Y)" Source="Y"></DoubleAnimationUsingPath>
</Storyboard>
</VisualState>
<VisualState Name="LayStopState">
</VisualState>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
<Viewbox VerticalAlignment="Center" HorizontalAlignment="Center">

<Canvas Width="205" Height="245" Margin="5">
<Polygon Points="0,80 20,40 205,40 185,80" Canvas.Left="67">
<Polygon.RenderTransform>
<SkewTransform AngleX="-40" />
</Polygon.RenderTransform>
<Polygon.Fill>
<!--<LinearGradientBrush StartPoint="1,0" EndPoint="1,1">
<GradientStop Color="LightGray" Offset="0"/>
<GradientStop Color="WhiteSmoke" Offset="0.85"/>
<GradientStop Color="LightGray" Offset="1"/>
</LinearGradientBrush>-->
<ImageBrush ImageSource="/BPASmartClient.CustomResource;component/Image/不锈钢纹理2.jpeg" Stretch="Fill"/>
</Polygon.Fill>
</Polygon>
<Polygon Width="200" Height="70" Points="45,70 60,50 170,50 155,70" Stroke="Gray" StrokeThickness="2" Canvas.Left="67">
<Polygon.RenderTransform>
<SkewTransform AngleX="-40" />
</Polygon.RenderTransform>
</Polygon>
<Polygon x:Name="stock" Width="0" Height="0" Points="45,70 60,50 170,50 155,70" Canvas.Left="67" >
<Polygon.Fill>
<SolidColorBrush Color="DimGray"/>
</Polygon.Fill>
<Polygon.RenderTransform>
<SkewTransform AngleX="-40" />
</Polygon.RenderTransform>
</Polygon>
<Polygon Points="-5,90 0,80 185,80 180,90" Panel.ZIndex="1" >
<Polygon.Fill>
<LinearGradientBrush>
<GradientStop Color="LightGray" Offset="0"/>
<GradientStop Color="White" Offset="0.66"/>
<GradientStop Color="LightGray" Offset="0.95"/>
</LinearGradientBrush>
</Polygon.Fill>

</Polygon>
<Grid Width="185" Height="160" Canvas.Top="80">
<Grid.Background>
<ImageBrush ImageSource="/BPASmartClient.CustomResource;component/Image/不锈钢纹理.jpg" Stretch="Fill"/>
</Grid.Background>
<!--<Grid VerticalAlignment="Bottom" Height="20" Margin="5">
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<Button Width="60">
<Button.Template>
<ControlTemplate TargetType="{x:Type Button}">
<Border x:Name="br" BorderThickness="2" BorderBrush="DimGray" CornerRadius="5" Background="Orange">
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" >
<TextBlock VerticalAlignment="Center" Text="&#xe79e;" FontFamily="/BPASmartClient.CustomResource;component/Fonts/new/#iconfont" Margin="0,0,5,0"/>
<TextBlock Text="开盖" HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="14"/>
</StackPanel>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsPressed" Value="True">
<Setter Property="Background" Value="yellow" TargetName="br"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Button.Template>
</Button>
<Button Width="60" Grid.Column="1">
<Button.Template>
<ControlTemplate TargetType="{x:Type Button}">
<Border x:Name="br1" BorderThickness="2" BorderBrush="DimGray" CornerRadius="5" Background="yellowgreen">
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" >
<TextBlock VerticalAlignment="Center" Text="&#xe63f;" FontFamily="/BPASmartClient.CustomResource;component/Fonts/new/#iconfont" Margin="0,0,5,0"/>
<TextBlock Text="出料" HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="14"/>
</StackPanel>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsPressed" Value="True">
<Setter Property="Background" Value="lawngreen" TargetName="br1"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Button.Template>
</Button>
</Grid>-->
</Grid>
<Grid Width="185" Height="60" Canvas.Top="90">
<Grid.Background>
<ImageBrush ImageSource="/BPASmartClient.CustomResource;component/Image/不锈钢纹理2.jpeg"/>
</Grid.Background>
<Grid.RenderTransform>
<TranslateTransform X="-5"/>
</Grid.RenderTransform>
<TextBox x:Name="stockName" Width="58" Height="50" HorizontalAlignment="Left" HorizontalContentAlignment="Center" Background="Transparent"
BorderThickness="0" VerticalContentAlignment="Center" FontSize="13" Foreground="DarkSlateGray">
</TextBox>


<Border Width="80" Height="50" BorderBrush="DimGray " BorderThickness="2" CornerRadius="5" Margin="15,0,0,0">
<StackPanel >
<TextBlock HorizontalAlignment="Center" FontSize="12" Text="剩余重量" FontFamily="幼圆" Margin="0,2,0,5"/>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
<TextBlock x:Name="stockWeight" HorizontalAlignment="Center" FontSize="16" />
<TextBlock Text="Kg" FontSize="16"/>
</StackPanel>
</StackPanel>
</Border>
</Grid>
<Grid Width="40" Height="60" Canvas.Top="90" Canvas.Left="180">
<Grid.Background>
<ImageBrush ImageSource="/BPASmartClient.CustomResource;component/Image/不锈钢纹理3.jpeg" Stretch="UniformToFill"/>
</Grid.Background>
<Grid.RenderTransform>
<TransformGroup>
<ScaleTransform ScaleX="0.119"/>
<SkewTransform AngleY="-65.5"/>
</TransformGroup>
</Grid.RenderTransform>
<!--<Border VerticalAlignment="Top" Height="140" BorderThickness="10">
<Border.Background>
<SolidColorBrush Color="BlueViolet"/>
</Border.Background>
</Border>-->
<!--<Grid VerticalAlignment="Bottom" Height="40" Margin="5">
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<Border Background="#FFAAAAAA" Margin="2"/>
<Border Background="#FFAAAAAA" Margin="2" Grid.Column="1"/>
</Grid>-->
</Grid >
<Path x:Name="arrow" Canvas.Top="175" Canvas.Left="113" Visibility="Collapsed" Data="M -15,8 L 17,17 C 17,17 19,18 17,19 L 17,19 L -15,28 C -15,28 -17,28.2 -16,26 L -16,26 L -5,18 L -16,10 C -16,10 -17,8.5 -15,8 Z">
<Path.RenderTransform>
<TransformGroup>
<RotateTransform Angle="90"/>
<TranslateTransform Y="0"/>
</TransformGroup>
</Path.RenderTransform>
<Path.Fill>
<LinearGradientBrush>
<LinearGradientBrush.RelativeTransform>
<RotateTransform Angle="-15"/>
</LinearGradientBrush.RelativeTransform>
<GradientStop Color="LightGray" Offset="0"/>
<GradientStop Color="White" Offset="0.4"/>
<GradientStop Color="AntiqueWhite" Offset="1"/>
</LinearGradientBrush>
</Path.Fill>
</Path>
<!--<Path Data="M 95,190 L 95,200" Stroke="Red"/>-->

<Grid Width="185" Height="160" Canvas.Top="80" Canvas.Left="185">
<Grid.Background>
<ImageBrush ImageSource="/BPASmartClient.CustomResource;component/Image/不锈钢纹理.jpg"/>
</Grid.Background>
<Grid.RenderTransform>
<TransformGroup>
<ScaleTransform ScaleX="0.288"/>
<SkewTransform AngleY="-36.8"/>
</TransformGroup>
</Grid.RenderTransform>
<!--<Border VerticalAlignment="Top" Height="140" BorderThickness="10">
<Border.Background>
<DrawingBrush TileMode="Tile" ViewportUnits="Absolute" Viewport="1,0,25,1">
<DrawingBrush.Drawing>
<GeometryDrawing>
<GeometryDrawing.Pen>
<Pen Brush="#EEE"/>
</GeometryDrawing.Pen>
<GeometryDrawing.Geometry>
<PathGeometry>
<PathFigure>
<LineSegment Point="10,0"/>
<LineSegment Point="10,10"/>
</PathFigure>
</PathGeometry>
</GeometryDrawing.Geometry>
</GeometryDrawing>
</DrawingBrush.Drawing>
</DrawingBrush>
</Border.Background>
</Border>-->
<!--<Grid VerticalAlignment="Bottom" Height="40" Margin="5">
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<Border Background="#FFAAAAAA" Margin="2"/>
<Border Background="#FFAAAAAA" Margin="2" Grid.Column="1"/>
</Grid>-->
</Grid>

<Border Width="18" Height="18" CornerRadius="10" Canvas.Left="150" Canvas.Top="100">
<Border.Background>
<RadialGradientBrush>
<GradientStop Color="Gray" Offset="0.6" x:Name="gsGreen"/>
<GradientStop Color="White"/>
</RadialGradientBrush>
</Border.Background>
</Border>
<Border Width="18" Height="18" CornerRadius="10" Canvas.Left="150" Canvas.Top="125" >
<Border.Background>
<RadialGradientBrush>
<GradientStop Color="Gray" Offset="0.6" x:Name="gsRed1"/>
<GradientStop Color="White"/>
</RadialGradientBrush>
</Border.Background>
</Border>
</Canvas>
</Viewbox>
</Border>
</UserControl>

+ 120
- 0
BPASmartClient.CustomResource/UserControls/MaterialStock.xaml.cs Zobrazit soubor

@@ -0,0 +1,120 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
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 BPASmartClient.CustomResource.UserControls
{
/// <summary>
/// MaterialStock.xaml 的交互逻辑
/// </summary>
public partial class MaterialStock : UserControl
{
public MaterialStock()
{
InitializeComponent();
}
[Category("运行状态")]
public bool IsRunning
{
get { return (bool)GetValue(IsRunningProperty); }
set { SetValue(IsRunningProperty, value); }
}
public static readonly DependencyProperty IsRunningProperty =
DependencyProperty.Register("IsRunning", typeof(bool), typeof(MaterialStock), new PropertyMetadata(default(bool), new PropertyChangedCallback(OnRunningChanged)));

private static void OnRunningChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
VisualStateManager.GoToState(d as MaterialStock, (bool)e.NewValue ? "RunState" : "Stop", false);
}

[Category("报警状态")]
public bool IsFaultState
{
get { return (bool)GetValue(IsFaultStateProperty); }
set { SetValue(IsFaultStateProperty, value); }
}
public static readonly DependencyProperty IsFaultStateProperty =
DependencyProperty.Register("IsFaultState", typeof(bool), typeof(MaterialStock), new PropertyMetadata(default(bool), new PropertyChangedCallback(OnFaultStateChanged)));

private static void OnFaultStateChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
VisualStateManager.GoToState(d as MaterialStock, (bool)e.NewValue ? "FaultState" : "NormalState", false);
}

[Category("料仓打开状态")]
public bool IsOpenState
{
get { return (bool)GetValue(IsOpenStateProperty); }
set { SetValue(IsOpenStateProperty, value); }
}
public static readonly DependencyProperty IsOpenStateProperty =
DependencyProperty.Register("IsOpenState", typeof(bool), typeof(MaterialStock), new PropertyMetadata(default(bool), new PropertyChangedCallback(OnOpenStateChanged)));

private static void OnOpenStateChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
VisualStateManager.GoToState(d as MaterialStock, (bool)e.NewValue ? "OpenState" : "CloseState", false);
}


[Category("下料状态")]
public bool IsLayOffState
{
get { return (bool)GetValue(IsLayOffStateProperty); }
set { SetValue(IsLayOffStateProperty, value); }
}
public static readonly DependencyProperty IsLayOffStateProperty =
DependencyProperty.Register("IsLayOffState", typeof(bool), typeof(MaterialStock), new PropertyMetadata(default(bool), new PropertyChangedCallback(OnLayOffStateChanged)));

private static void OnLayOffStateChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
VisualStateManager.GoToState(d as MaterialStock, (bool)e.NewValue ? "LayOffState" : "LayStopState", false);
if ((d as MaterialStock)?.IsLayOffState == true)
{
(d as MaterialStock).arrow.Visibility = Visibility.Visible;
}
else if ((d as MaterialStock)?.IsLayOffState == false)
{
(d as MaterialStock).arrow.Visibility = Visibility.Collapsed;
}
}

[Category("物料重量")]
public double MaterialWeight
{
get { return (double)GetValue(MaterialWeightProperty); }
set { SetValue(MaterialWeightProperty, value); }
}
public static readonly DependencyProperty MaterialWeightProperty =
DependencyProperty.Register("MaterialWeight", typeof(double), typeof(MaterialStock), new PropertyMetadata(default(double), new PropertyChangedCallback(OnWeightChanged)));
private static void OnWeightChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
(d as MaterialStock).stockWeight.Text = e.NewValue.ToString();

}
[Category("物料名称")]
public string MaterialName
{
get { return (string)GetValue(MaterialNameProperty); }
set { SetValue(MaterialNameProperty, value); }
}
public static readonly DependencyProperty MaterialNameProperty =
DependencyProperty.Register("MaterialName", typeof(string), typeof(MaterialStock), new PropertyMetadata(default(string), new PropertyChangedCallback(OnNameChanged)));
private static void OnNameChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
(d as MaterialStock).stockName.Text = e.NewValue.ToString();
}

}
}

+ 230
- 0
BPASmartClient.CustomResource/UserControls/NumberTextBox.xaml Zobrazit soubor

@@ -0,0 +1,230 @@
<UserControl
x:Class="BPASmartClient.CustomResource.UserControls.NumberTextBox"
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:local="clr-namespace:BPASmartClient.CustomResource.UserControls"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
d:DesignHeight="35"
d:DesignWidth="150"
mc:Ignorable="d">


<UserControl.Resources>

<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="/BPASmartClient.CustomResource;component/RecDictionarys/RecButtonStyle.xaml" />

<ResourceDictionary>
<Style x:Key="TextBoxStyle" TargetType="TextBox">
<Setter Property="FontFamily" Value="楷体" />
<Setter Property="FontSize" Value="22" />
<Setter Property="VerticalContentAlignment" Value="Center" />
<Setter Property="Width" Value="188" />
<Setter Property="Padding" Value="6,0,0,0" />
<Setter Property="Height" Value="37" />
<Setter Property="BorderThickness" Value="0" />
<Setter Property="Foreground" Value="#009dff" />
<Setter Property="BorderBrush" Value="#009dff" />
<Setter Property="CaretBrush" Value="#009dff" />
<Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="Background">
<Setter.Value>
<ImageBrush ImageSource="/BPASmartClient.CustomResource;component/Image/textBox.png" Stretch="Fill" />
</Setter.Value>
</Setter>
</Style>
</ResourceDictionary>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>


</UserControl.Resources>

<Grid>
<Viewbox>
<Grid>
<TextBox
Name="outLoc"
Width="180"
Height="35"
FontSize="20"
GotFocus="outLoc_GotFocus"
Style="{StaticResource TextBoxStyle}" />

<Popup
Name="pp"
AllowsTransparency="True"
Focusable="False"
Placement="Bottom"
PlacementTarget="{Binding ElementName=outLoc}"
StaysOpen="True">
<Border
Width="260"
Height="300"
Background="#081424"
ClipToBounds="True">
<Grid Margin="0">
<Grid.RowDefinitions>
<RowDefinition Height="35" />
<RowDefinition />
</Grid.RowDefinitions>

<TextBox
Name="input"
Width="267"
Height="36"
Margin="-4,0,0,0"
VerticalContentAlignment="Center"
FontSize="18"
GotFocus="input_GotFocus"
Style="{StaticResource TextBoxStyle}" />

<Grid Grid.Row="1">
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>

<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition />
</Grid.ColumnDefinitions>

<Button
Grid.Row="0"
Grid.Column="0"
Margin="2"
Click="Button_Click"
Content="1"
FontSize="20"
Style="{StaticResource ImageButtonStyle}" />
<Button
Grid.Row="0"
Grid.Column="1"
Margin="2"
Click="Button_Click"
Content="2"
FontSize="20"
Style="{StaticResource ImageButtonStyle}" />
<Button
Grid.Row="0"
Grid.Column="2"
Margin="2"
Click="Button_Click"
Content="3"
FontSize="20"
Style="{StaticResource ImageButtonStyle}" />
<Button
Grid.Row="0"
Grid.Column="3"
Margin="2"
Click="Button_Click"
Content="ESC"
FontSize="20"
Style="{StaticResource ImageButtonStyle}" />
<Button
Grid.Row="1"
Grid.Column="0"
Margin="2"
Click="Button_Click"
Content="4"
FontSize="20"
Style="{StaticResource ImageButtonStyle}" />
<Button
Grid.Row="1"
Grid.Column="1"
Margin="2"
Click="Button_Click"
Content="5"
FontSize="20"
Style="{StaticResource ImageButtonStyle}" />
<Button
Grid.Row="1"
Grid.Column="2"
Margin="2"
Click="Button_Click"
Content="6"
FontSize="20"
Style="{StaticResource ImageButtonStyle}" />
<Button
Grid.Row="1"
Grid.Column="3"
Margin="2"
Click="Button_Click"
Content="BR"
FontSize="20"
Style="{StaticResource ImageButtonStyle}" />
<Button
Grid.Row="2"
Grid.Column="0"
Margin="2"
Click="Button_Click"
Content="7"
FontSize="20"
Style="{StaticResource ImageButtonStyle}" />
<Button
Grid.Row="2"
Grid.Column="1"
Margin="2"
Click="Button_Click"
Content="8"
FontSize="20"
Style="{StaticResource ImageButtonStyle}" />
<Button
Grid.Row="2"
Grid.Column="2"
Margin="2"
Click="Button_Click"
Content="9"
FontSize="20"
Style="{StaticResource ImageButtonStyle}" />
<Button
Grid.Row="2"
Grid.Column="3"
Margin="2"
Click="Button_Click"
Content="Clear"
FontSize="20"
Style="{StaticResource ImageButtonStyle}" />
<Button
Grid.Row="3"
Grid.Column="0"
Margin="2"
Click="Button_Click"
Content="0"
FontSize="20"
Style="{StaticResource ImageButtonStyle}" />
<Button
Grid.Row="3"
Grid.Column="1"
Margin="2"
Click="Button_Click"
Content="."
FontSize="20"
Style="{StaticResource ImageButtonStyle}" />
<Button
Grid.Row="3"
Grid.Column="2"
Grid.ColumnSpan="2"
Margin="2"
Click="Button_Click"
Content="Deter"
FontSize="20"
Style="{StaticResource ImageButtonStyle}" />
</Grid>


</Grid>
</Border>
</Popup>

</Grid>
</Viewbox>
</Grid>
</UserControl>

+ 81
- 0
BPASmartClient.CustomResource/UserControls/NumberTextBox.xaml.cs Zobrazit soubor

@@ -0,0 +1,81 @@
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 BPASmartClient.CustomResource.UserControls
{
/// <summary>
/// NumberTextBox.xaml 的交互逻辑
/// </summary>
public partial class NumberTextBox : UserControl
{
public NumberTextBox()
{
InitializeComponent();
}


private void outLoc_GotFocus(object sender, RoutedEventArgs e)
{
this.pp.IsOpen = outLoc.Focusable;
}

private void Button_Click(object sender, RoutedEventArgs e)
{
var obj = (Button)sender;
switch (obj.Content)
{
case "0":
case "1":
case "2":
case "3":
case "4":
case "5":
case "6":
case "7":
case "8":
case "9":
input.Text = input.Text.Trim() + obj.Content.ToString();
break;
case ".":
if (!string.IsNullOrEmpty(input.Text) && input.Text.Length > 0)
input.Text = input.Text.Trim() + obj.Content.ToString();
break;
case "ESC":
this.pp.IsOpen = false;
break;
case "BR":
if (!string.IsNullOrEmpty(input.Text) && input.Text.Length > 0)
input.Text = input.Text.Remove(input.Text.Length - 1);
break;
case "Clear":
input.Text = string.Empty;
break;
case "Deter":
outLoc.Text = input.Text;
this.pp.IsOpen = false;
break;
default:
break;
}
}

private void input_GotFocus(object sender, RoutedEventArgs e)
{

}


}
}

+ 6
- 0
BPASmartClient.DosingProject/App.config Zobrazit soubor

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<appSettings>
<add key="HKPlc_IP" value="192.168.0.15"/>
</appSettings>
</configuration>

+ 36
- 0
BPASmartClient.DosingProject/App.xaml Zobrazit soubor

@@ -0,0 +1,36 @@
<Application x:Class="BPASmartClient.DosingProject.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:BPASmartClient.DosingProject"
xmlns:con="clr-namespace:BPASmartClient.CustomResource.Converters;assembly=BPASmartClient.CustomResource">
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>

<ResourceDictionary Source="/BPASmartClient.CustomResource;component/RecDictionarys/RecCheckBox.xaml" />
<ResourceDictionary Source="/BPASmartClient.CustomResource;component/RecDictionarys/RecTitleBarButton.xaml" />
<ResourceDictionary Source="/BPASmartClient.CustomResource;component/RecDictionarys/GlobalStyle.xaml" />
<ResourceDictionary Source="/BPASmartClient.CustomResource;component/RecDictionarys/RecComboBox.xaml" />
<ResourceDictionary Source="/BPASmartClient.CustomResource;component/RecDictionarys/RecIcoButtonStyle.xaml" />
<ResourceDictionary Source="/BPASmartClient.CustomResource;component/RecDictionarys/RecToggleButton.xaml" />
<ResourceDictionary Source="/BPASmartClient.CustomResource;component/RecDictionarys/BeveledRadioButtonStyle.xaml" />
<ResourceDictionary Source="/BPASmartClient.CustomResource;component/RecDictionarys/DatePickeerDictionary.xaml" />
<ResourceDictionary Source="/BPASmartClient.CustomResource;component/RecDictionarys/RecButtonStyle.xaml" />

<ResourceDictionary>
<con:ColorConverter x:Key="ColorConverter" />
<con:TextConverter x:Key="TextConverter" />
<con:VisibleTypeConverter x:Key="VisibleTypeConverter" />
<con:StatusConverter x:Key="StatusConverter" />
<con:StringToIconConverter x:Key="StringToIconConverter" />
</ResourceDictionary>

<ResourceDictionary>
<ImageBrush x:Key="hbl" ImageSource="/BPASmartClient.CustomResource;component/Image/HBL.png" />
<ImageBrush x:Key="dbxt" ImageSource="/BPASmartClient.CustomResource;component/Image/顶部线条.png" />
</ResourceDictionary>

</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>
</Application>

+ 252
- 0
BPASmartClient.DosingProject/App.xaml.cs Zobrazit soubor

@@ -0,0 +1,252 @@
using BPASmartClient.CustomResource.Pages.Enums;
using BPASmartClient.CustomResource.Pages.Model;
using BPASmartClient.CustomResource.Pages.View;
using BPASmartClient.DosingHKProject.Model;
using BPASmartClient.Helper;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Threading.Tasks;
using System.Windows;

namespace BPASmartClient.DosingProject
{
/// <summary>
/// Interaction logic for App.xaml
/// </summary>
public partial class App : Application
{
public static Window MainWindow;
protected override void OnStartup(StartupEventArgs e)
{
base.OnStartup(e);
MenuInit();
DataInit();
DeviceInquire.GetInstance.Init();//配料机设备上线监听,设备列表初始化
ProcessControl.GetInstance.Init();
MainView mv = new MainView();
LoginView lv = new LoginView();
var res = lv.ShowDialog();
if (res != null && res == true)
{
MessageLog.GetInstance.ShowUserLog("用户登录");
mv.Show();
}
else
mv.Close();
MainWindow = mv;
}

protected override void OnExit(ExitEventArgs e)
{
base.OnExit(e);
Json<LocaPar>.Save();
MessageLog.GetInstance.LogSave();
ThreadManage.GetInstance().Dispose();
}

private void MenuInit()
{
//NfcServer.GetInstance.Init();

#region 配方管理菜单
ObservableCollection<SubMenumodel> RecipeManage = new ObservableCollection<SubMenumodel>();
RecipeManage.Add(new SubMenumodel()
{
SubMenuName = "味魔方配方管理",
SubMenuPermission = new Permission[] { Permission.管理员 },
AssemblyName = "BPASmartClient.DosingHKProject",
ToggleWindowPath = "View.RecipeSettingsView"
});

RecipeManage.Add(new SubMenumodel()
{
SubMenuName = "味魔方配方下发",
SubMenuPermission = new Permission[] { Permission.操作员, Permission.管理员 },
AssemblyName = "BPASmartClient.DosingHKProject",
ToggleWindowPath = "View.RecipeControlView"
});
RecipeManage.Add(new SubMenumodel()
{
SubMenuName = "本地配方管理",
SubMenuPermission = new Permission[] { Permission.管理员 },
AssemblyName = "BPASmartClient.DosingHKProject",
ToggleWindowPath = "View.RecipeReceiveView"
});
RecipeManage.Add(new SubMenumodel()
{
SubMenuName = "西门子配方管理",
SubMenuPermission = new Permission[] { Permission.管理员 },
AssemblyName = "BPASmartClient.DosingHKProject",
ToggleWindowPath = "View.SiemensRecipeReceiveView"
});
MenuManage.GetInstance.menuModels.Add(new MenuModel()
{
MainMenuIcon = "&#xe683;",
MainMenuName = "配方管理",
Alias = "Recipe Management",
subMenumodels = RecipeManage,
});
#endregion

#region 参数设置
ObservableCollection<SubMenumodel> ParSet = new ObservableCollection<SubMenumodel>();
ParSet.Add(new SubMenumodel()
{
SubMenuName = "柔性味魔方参数设置",
SubMenuPermission = new Permission[] { Permission.管理员 },
AssemblyName = "BPASmartClient.DosingHKProject",
ToggleWindowPath = "View.DeviceMaterialParView"
});
MenuManage.GetInstance.menuModels.Add(new MenuModel()
{
MainMenuIcon = "&#xe62d;",
MainMenuName = "参数设置",
Alias = "Parameter Set",
subMenumodels = ParSet,
});
#endregion

#region 手动控制
ObservableCollection<SubMenumodel> ManualControl = new ObservableCollection<SubMenumodel>();
ManualControl.Add(new SubMenumodel()
{
SubMenuName = "手动控制",
SubMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.技术员 },
AssemblyName = "BPASmartClient.DosingHKProject",
ToggleWindowPath = "View.ManualControlView"
});

MenuManage.GetInstance.menuModels.Add(new MenuModel()
{
MainMenuIcon = "&#xe622;",
MainMenuName = "手动控制",
Alias = "Parameter Set",
subMenumodels = ManualControl,
});
#endregion

#region 消息日志
ObservableCollection<SubMenumodel> InfoLog = new ObservableCollection<SubMenumodel>();
InfoLog.Add(new SubMenumodel()
{
SubMenuName = "操作日志",
SubMenuPermission = new Permission[] { Permission.操作员, Permission.管理员, Permission.技术员 },
AssemblyName = "BPASmartClient.CustomResource",
ToggleWindowPath = "Pages.View.UserLogView"
});

InfoLog.Add(new SubMenumodel()
{
SubMenuName = "运行日志",
SubMenuPermission = new Permission[] { Permission.操作员, Permission.管理员, Permission.技术员 },
AssemblyName = "BPASmartClient.CustomResource",
ToggleWindowPath = "Pages.View.RunLogView"
});

InfoLog.Add(new SubMenumodel()
{
SubMenuName = "报警记录",
SubMenuPermission = new Permission[] { Permission.操作员, Permission.管理员, Permission.技术员 },
AssemblyName = "BPASmartClient.CustomResource",
ToggleWindowPath = "Pages.View.AlarmView"
});

InfoLog.Add(new SubMenumodel()
{
SubMenuName = "调试日志",
SubMenuPermission = new Permission[] { Permission.操作员, Permission.管理员, Permission.技术员, Permission.技术员 },
AssemblyName = "BPASmartClient.CustomResource",
ToggleWindowPath = "Pages.View.DebugLogView"
});

MenuManage.GetInstance.menuModels.Add(new MenuModel()
{
MainMenuIcon = "&#xe668;",
MainMenuName = "消息日志",
Alias = "Message Log",
subMenumodels = InfoLog,
});
#endregion

#region 硬件设备监控
ObservableCollection<SubMenumodel> DeviceMonitor = new ObservableCollection<SubMenumodel>();
DeviceMonitor.Add(new SubMenumodel()
{
SubMenuName = "原料设备列表",
SubMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.技术员 },
AssemblyName = "BPASmartClient.DosingHKProject",
ToggleWindowPath = "View.DeviceListView"
});

DeviceMonitor.Add(new SubMenumodel()
{
SubMenuName = "设备状态",
SubMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.技术员 },
AssemblyName = "BPASmartClient.DosingHKProject",
ToggleWindowPath = "View.HardwareStatusView"
});

MenuManage.GetInstance.menuModels.Add(new MenuModel()
{
MainMenuIcon = "&#xe603;",
MainMenuName = "设备监控",
Alias = "Device Monitor",
subMenumodels = DeviceMonitor,
});
#endregion

#region 用户管理
ObservableCollection<SubMenumodel> UserManager = new ObservableCollection<SubMenumodel>();
UserManager.Add(new SubMenumodel()
{
SubMenuName = "用户登录",
SubMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.技术员 },
AssemblyName = "BPASmartClient.CustomResource",
ToggleWindowPath = "Pages.View.SubPagLoginView"
});

UserManager.Add(new SubMenumodel()
{
SubMenuName = "密码修改",
SubMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.技术员 },
AssemblyName = "BPASmartClient.CustomResource",
ToggleWindowPath = "Pages.View.PasswordChangeView"
});
UserManager.Add(new SubMenumodel()
{
SubMenuName = "用户管理",
SubMenuPermission = new Permission[] { Permission.管理员 },
AssemblyName = "BPASmartClient.CustomResource",
ToggleWindowPath = "Pages.View.UserManagerView"
});

/* UserManager.Add(new SubMenumodel()
{
SubMenuName = "NFC登录设置",
SubMenuPermission = new Permission[] { Permission.管理员 },
AssemblyName = "BPASmartClient.CustomResource",
ToggleWindowPath = "Pages.View.NfcSetView"
});*/

MenuManage.GetInstance.menuModels.Add(new MenuModel()
{
MainMenuIcon = "&#xe66d;",
MainMenuName = "用户管理",
Alias = "User Management",
subMenumodels = UserManager,
});
#endregion
}

private void DataInit()
{
//Config.GetInstance.Init();
Json<LocaPar>.Read();
Json<DevicePar>.Read();
}
}
}

+ 10
- 0
BPASmartClient.DosingProject/AssemblyInfo.cs Zobrazit soubor

@@ -0,0 +1,10 @@
using System.Windows;

[assembly: ThemeInfo(
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
//(used if a resource is not found in the page,
// or application resource dictionaries)
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
//(used if a resource is not found in the page,
// app, or any theme specific resource dictionaries)
)]

+ 76
- 0
BPASmartClient.DosingProject/BPASmartClient.DosingHKProject.csproj Zobrazit soubor

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

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

<ItemGroup>
<PackageReference Include="BPA.Message" Version="1.0.60" />
<PackageReference Include="Microsoft.Toolkit.Mvvm" Version="7.1.2" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\BPASmartClient.CustomResource\BPASmartClient.CustomResource.csproj" />
<ProjectReference Include="..\BPASmartClient.Modbus\BPASmartClient.Modbus.csproj" />
<ProjectReference Include="..\BPASmartClient.S7Net\BPASmartClient.S7Net.csproj" />
</ItemGroup>

<ItemGroup>
<Page Update="View\ChangeDeviceNameView.xaml">
<XamlRuntime>$(DefaultXamlRuntime)</XamlRuntime>
<SubType>Designer</SubType>
</Page>
<Page Update="View\DeviceListView.xaml">
<XamlRuntime>$(DefaultXamlRuntime)</XamlRuntime>
<SubType>Designer</SubType>
</Page>
<Page Update="View\DeviceMaterialParView.xaml">
<XamlRuntime>$(DefaultXamlRuntime)</XamlRuntime>
<SubType>Designer</SubType>
</Page>
<Page Update="View\HardwareStatusView.xaml">
<XamlRuntime>$(DefaultXamlRuntime)</XamlRuntime>
<SubType>Designer</SubType>
</Page>
<Page Update="View\ManualControlView.xaml">
<XamlRuntime>$(DefaultXamlRuntime)</XamlRuntime>
<SubType>Designer</SubType>
</Page>
<Page Update="View\NewLocalRecipeView.xaml">
<XamlRuntime>$(DefaultXamlRuntime)</XamlRuntime>
<SubType>Designer</SubType>
</Page>
<Page Update="View\NewMaterialView.xaml">
<XamlRuntime>$(DefaultXamlRuntime)</XamlRuntime>
<SubType>Designer</SubType>
</Page>
<Page Update="View\NewRecipeView.xaml">
<XamlRuntime>$(DefaultXamlRuntime)</XamlRuntime>
<SubType>Designer</SubType>
</Page>
<Page Update="View\RecipeControlView.xaml">
<XamlRuntime>$(DefaultXamlRuntime)</XamlRuntime>
<SubType>Designer</SubType>
</Page>
<Page Update="View\RecipeInfosView.xaml">
<XamlRuntime>$(DefaultXamlRuntime)</XamlRuntime>
<SubType>Designer</SubType>
</Page>
<Page Update="View\RecipeReceiveView.xaml">
<XamlRuntime>$(DefaultXamlRuntime)</XamlRuntime>
<SubType>Designer</SubType>
</Page>
<Page Update="View\RecipeSettingsView.xaml">
<XamlRuntime>$(DefaultXamlRuntime)</XamlRuntime>
<SubType>Designer</SubType>
</Page>
<Page Update="View\SiemensRecipeReceiveView.xaml">
<XamlRuntime>$(DefaultXamlRuntime)</XamlRuntime>
<SubType>Designer</SubType>
</Page>
</ItemGroup>

</Project>

+ 12
- 0
BPASmartClient.DosingProject/MainWindow.xaml Zobrazit soubor

@@ -0,0 +1,12 @@
<Window x:Class="BPASmartClient.DosingProject.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:BPASmartClient.DosingProject"
mc:Ignorable="d"
Title="MainWindow" Height="450" Width="800">
<Grid>

</Grid>
</Window>

+ 28
- 0
BPASmartClient.DosingProject/MainWindow.xaml.cs Zobrazit soubor

@@ -0,0 +1,28 @@
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 BPASmartClient.DosingProject
{
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
}
}
}

+ 31
- 0
BPASmartClient.DosingProject/Model/Converter/DataTableRedundantConverter.cs Zobrazit soubor

@@ -0,0 +1,31 @@
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Data;
using System.Windows.Media;

namespace BPASmartClient.DosingHKProject.Converter
{
public class DataTableRedundantConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if (value != null && value is bool bit)
{
if (bit)
return new SolidColorBrush(Color.FromArgb(255, 245, 63, 98));
else
return new SolidColorBrush(Color.FromArgb(255, 42, 178, 231));
}
return default;
}

public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}
}

+ 68
- 0
BPASmartClient.DosingProject/Model/Converter/RunStatusConvert.cs Zobrazit soubor

@@ -0,0 +1,68 @@
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Data;

namespace BPASmartClient.DosingHKProject.Converter
{
public class RunStatusConvert : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if (value is ushort tempValue)
{
if (tempValue == 1) return "等待配料";
if (tempValue == 2) return "配料中";
if (tempValue == 3) return "配料完成";
}
return "等待配料";
}

public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}

public class EnbleConvert : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if (value is ushort tempValue)
{
if (tempValue == 0) return true;
if (tempValue == 1) return false;
}
return true;
}

public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}

public class IntToSourceConvert : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if (value is ushort tempValue)
{
if (tempValue == 0) return "本地原料";
if (tempValue == 1) return "设备原料";

}
return "未知";
}

public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}

}

+ 12
- 0
BPASmartClient.DosingProject/Model/GVL/GVL.cs Zobrazit soubor

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

namespace BPASmartClient.DosingHKProject.Model.GVL
{
public class GVL
{
}
}

+ 117
- 0
BPASmartClient.DosingProject/Model/GVL/ReadSmallMaterial.cs Zobrazit soubor

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

namespace BPASmartClient.DosingHKProject.Model.GVL
{
public class ReadSmallMaterial
{
/// <summary>
/// PLC到上位机心跳
/// </summary>
public bool Heart { get; set; }
public bool Agv1 { get; set; }
public bool Agv2 { get; set; }
public bool Agv3 { get; set; }
public bool Agv4 { get; set; }
public bool Agv5 { get; set; }
public bool Agv6 { get; set; }
/// <summary>
/// 1#托盘工位占用
/// </summary>
public bool Tray1BeOccupied { get; set; }
/// <summary>
/// 2#托盘工位占用
/// </summary>
public bool Tray2BeOccupied { get; set; }
/// <summary>
/// 1#托盘工位配料完成
/// </summary>
public bool Tray1MaterialFinish { get; set; }
/// <summary>
/// 2#托盘工位配料完成
/// </summary>
public bool Tray2MaterialFinish { get; set; }
/// <summary>
/// 接收托盘1配方数据完成
/// </summary>
public bool Tray1ReceiveFinish { get; set; }
/// <summary>
/// 接收托盘2配方数据完成
/// </summary>
public bool Tray2ReceiveFinish { get; set; }

public int Reserve1 { get; set; }
public int Receive2 { get; set; }
/// <summary>
/// 托盘1_1#桶位置反馈
/// </summary>
public float Tray1Barrel1Location { get; set; }
/// <summary>
/// 托盘1_2#桶位置反馈
/// </summary>
public float Tray1Barrel2Location { get; set; }
/// <summary>
/// 托盘1_3#桶位置反馈
/// </summary>
public float Tray1Barrel3Location { get; set; }
/// <summary>
/// 托盘1_4#桶位置反馈
/// </summary>
public float Tray1Barrel4Location { get; set; }
/// <summary>
/// 托盘2_1#桶位置反馈
/// </summary>
public float Tray2Barrel1Location { get; set; }
/// <summary>
/// 托盘2_2#桶位置反馈
/// </summary>
public float Tray2Barrel2Location { get; set; }
/// <summary>
/// 托盘2_3#桶位置反馈
/// </summary>
public float Tray2Barrel3Location { get; set; }
/// <summary>
/// 托盘2_4#桶位置反馈
/// </summary>
public float Tray2Barrel4Location { get; set; }

public int Reserve3 { get; set; }
public int Receive4 { get; set; }
/// <summary>
/// 托盘1_1#桶允许配料
/// </summary>
public float Tray1Barrel1AllowDosing { get; set; }
/// <summary>
/// 托盘1_2#桶允许配料
/// </summary>
public float Tray1Barrel2AllowDosing { get; set; }
/// <summary>
/// 托盘1_3#桶允许配料
/// </summary>
public float Tray1Barrel3AllowDosing { get; set; }
/// <summary>
/// 托盘1_4#桶允许配料
/// </summary>
public float Tray1Barrel4AllowDosing { get; set; }
/// <summary>
/// 托盘2_1#桶允许配料
/// </summary>
public float Tray2Barrel1AllowDosing { get; set; }
/// <summary>
/// 托盘2_2#桶允许配料
/// </summary>
public float Tray2Barrel2AllowDosing { get; set; }
/// <summary>
/// 托盘2_3#桶允许配料
/// </summary>
public float Tray2Barrel3AllowDosing { get; set; }
/// <summary>
/// 托盘2_4#桶允许配料
/// </summary>
public float Tray2Barrel4AllowDosing { get; set; }

}
}

+ 185
- 0
BPASmartClient.DosingProject/Model/GVL/WriteSmallMaterial.cs Zobrazit soubor

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

namespace BPASmartClient.DosingHKProject.Model.GVL
{
public class WriteSmallMaterial
{
/// <summary>
/// PLC到上位机心跳
/// </summary>
public bool Heart { get; set; }
public bool Agv1 { get; set; }
public bool Agv2 { get; set; }
public bool Agv3 { get; set; }
public bool Agv4{ get; set; }
public bool Agv5 { get; set; }
public bool Agv6 { get; set; }
public bool Agv7 { get; set; }
public bool Agv8 { get; set; }
public bool Agv9 { get; set; }
public bool Agv10 { get; set; }
/// <summary>
/// 下发配方到托盘1
/// </summary>
public bool Tray1IssueRecipe { get; set; }
/// <summary>
/// 下发配方到托盘2
/// </summary>
public bool Tray2IssueRecipe { get; set; }
public int Reserve1 { get; set; }
public int Receive2 { get; set; }


public bool Tray1Barrel1IsDosing1;
public bool Tray1Barrel1IsDosing2;
public bool Tray1Barrel1IsDosing3;
public bool Tray1Barrel1IsDosing4;
public bool Tray1Barrel1IsDosing5;
public bool Tray1Barrel1IsDosing6;
public bool Tray1Barrel1IsDosing7;
public bool Tray1Barrel1IsDosing8;
public bool Tray1Barrel1IsDosing9;
public bool Tray1Barrel1IsDosing10;
public bool Tray1Barrel1IsDosing11;
public bool Tray1Barrel1IsDosing12;
public bool Tray1Barrel1IsDosing13;
public bool Tray1Barrel1IsDosing14;
public bool Tray1Barrel1IsDosing15;
public bool Receive3;
public bool Tray1Barrel2IsDosing1;
public bool Tray1Barrel2IsDosing2;
public bool Tray1Barrel2IsDosing3;
public bool Tray1Barrel2IsDosing4;
public bool Tray1Barrel2IsDosing5;
public bool Tray1Barrel2IsDosing6;
public bool Tray1Barrel2IsDosing7;
public bool Tray1Barrel2IsDosing8;
public bool Tray1Barrel2IsDosing9;
public bool Tray1Barrel2IsDosing10;
public bool Tray1Barrel2IsDosing11;
public bool Tray1Barrel2IsDosing12;
public bool Tray1Barrel2IsDosing13;
public bool Tray1Barrel2IsDosing14;
public bool Tray1Barrel2IsDosing15;
public bool Receive4;
public bool Tray1Barrel3IsDosing1;
public bool Tray1Barrel3IsDosing2;
public bool Tray1Barrel3IsDosing3;
public bool Tray1Barrel3IsDosing4;
public bool Tray1Barrel3IsDosing5;
public bool Tray1Barrel3IsDosing6;
public bool Tray1Barrel3IsDosing7;
public bool Tray1Barrel3IsDosing8;
public bool Tray1Barrel3IsDosing9;
public bool Tray1Barrel3IsDosing10;
public bool Tray1Barrel3IsDosing11;
public bool Tray1Barrel3IsDosing12;
public bool Tray1Barrel3IsDosing13;
public bool Tray1Barrel3IsDosing14;
public bool Tray1Barrel3IsDosing15;
public bool Receive5;
public bool Tray1Barrel4IsDosing1;
public bool Tray1Barrel4IsDosing2;
public bool Tray1Barrel4IsDosing3;
public bool Tray1Barrel4IsDosing4;
public bool Tray1Barrel4IsDosing5;
public bool Tray1Barrel4IsDosing6;
public bool Tray1Barrel4IsDosing7;
public bool Tray1Barrel4IsDosing8;
public bool Tray1Barrel4IsDosing9;
public bool Tray1Barrel4IsDosing10;
public bool Tray1Barrel4IsDosing11;
public bool Tray1Barrel4IsDosing12;
public bool Tray1Barrel4IsDosing13;
public bool Tray1Barrel4IsDosing14;
public bool Tray1Barrel4IsDosing15;
public bool Receive6;

public bool Tray2Barrel1IsDosing1;
public bool Tray2Barrel1IsDosing2;
public bool Tray2Barrel1IsDosing3;
public bool Tray2Barrel1IsDosing4;
public bool Tray2Barrel1IsDosing5;
public bool Tray2Barrel1IsDosing6;
public bool Tray2Barrel1IsDosing7;
public bool Tray2Barrel1IsDosing8;
public bool Tray2Barrel1IsDosing9;
public bool Tray2Barrel1IsDosing10;
public bool Tray2Barrel1IsDosing11;
public bool Tray2Barrel1IsDosing12;
public bool Tray2Barrel1IsDosing13;
public bool Tray2Barrel1IsDosing14;
public bool Tray2Barrel1IsDosing15;
public bool Receive7;
public bool Tray2Barrel2IsDosing1;
public bool Tray2Barrel2IsDosing2;
public bool Tray2Barrel2IsDosing3;
public bool Tray2Barrel2IsDosing4;
public bool Tray2Barrel2IsDosing5;
public bool Tray2Barrel2IsDosing6;
public bool Tray2Barrel2IsDosing7;
public bool Tray2Barrel2IsDosing8;
public bool Tray2Barrel2IsDosing9;
public bool Tray2Barrel2IsDosing10;
public bool Tray2Barrel2IsDosing11;
public bool Tray2Barrel2IsDosing12;
public bool Tray2Barrel2IsDosing13;
public bool Tray2Barrel2IsDosing14;
public bool Tray2Barrel2IsDosing15;
public bool Receive8;
public bool Tray2Barrel3IsDosing1;
public bool Tray2Barrel3IsDosing2;
public bool Tray2Barrel3IsDosing3;
public bool Tray2Barrel3IsDosing4;
public bool Tray2Barrel3IsDosing5;
public bool Tray2Barrel3IsDosing6;
public bool Tray2Barrel3IsDosing7;
public bool Tray2Barrel3IsDosing8;
public bool Tray2Barrel3IsDosing9;
public bool Tray2Barrel3IsDosing10;
public bool Tray2Barrel3IsDosing11;
public bool Tray2Barrel3IsDosing12;
public bool Tray2Barrel3IsDosing13;
public bool Tray2Barrel3IsDosing14;
public bool Tray2Barrel3IsDosing15;
public bool Receive9;
public bool Tray2Barrel4IsDosing1;
public bool Tray2Barrel4IsDosing2;
public bool Tray2Barrel4IsDosing3;
public bool Tray2Barrel4IsDosing4;
public bool Tray2Barrel4IsDosing5;
public bool Tray2Barrel4IsDosing6;
public bool Tray2Barrel4IsDosing7;
public bool Tray2Barrel4IsDosing8;
public bool Tray2Barrel4IsDosing9;
public bool Tray2Barrel4IsDosing10;
public bool Tray2Barrel4IsDosing11;
public bool Tray2Barrel4IsDosing12;
public bool Tray2Barrel4IsDosing13;
public bool Tray2Barrel4IsDosing14;
public bool Tray2Barrel4IsDosing15;
public bool Receive10;
public int Receive11;

public bool StockIn1DosingFinish;
public bool StockIn2DosingFinish;
public bool StockIn3DosingFinish;
public bool StockIn4DosingFinish;
public bool StockIn5DosingFinish;
public bool StockIn6DosingFinish;
public bool StockIn7DosingFinish;
public bool StockIn8DosingFinish;
public bool StockIn9DosingFinish;
public bool StockIn10DosingFinish;
public bool StockIn11DosingFinish;
public bool StockIn12DosingFinish;
public bool StockIn13DosingFinish;
public bool StockIn14DosingFinish;
public bool StockIn15DosingFinish;
public bool Receive12;
}
}

+ 99
- 0
BPASmartClient.DosingProject/Model/GVL_SmallStation.cs Zobrazit soubor

@@ -0,0 +1,99 @@
using BPASmartClient.DosingHKProject.Model.HK_PLC;
using BPASmartClient.DosingHKProject.Model.Siemens;
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BPASmartClient.DosingHKProject.Model
{
public class GVL_SmallStation
{
private volatile static GVL_SmallStation SmallStation;
public static GVL_SmallStation GetInstance => SmallStation ?? (SmallStation = new GVL_SmallStation());
private GVL_SmallStation() { }
/// <summary>
/// 配方下发状态 =0:配方未下发 ,1:配方下发给plc ,2:plc成功接收配方
/// </summary>
public int RecipeStatusID { get; set; } = 0;

/// <summary>
/// Tray1的柔性味魔方配料标志(下发配方时,若柔性味魔方的状态=3,复位该状态)
/// </summary>
public bool DosingTray1 { get; set; } = true;//默认为true,初始时,判断柔性味魔方的状态。
/// <summary>
/// Tray2的柔性味魔方配料标志
/// </summary>
public bool DosingTray2 { get; set; } = true;
/// <summary>
/// 配方下发状态 =0:配方未下发 ,1:配方下发给plc ,2:plc成功接收配方
/// </summary>
public int RecipeStatusIDTray2 { get; set; } = 0;
/// <summary>
/// 往输送带下发配方完成
/// </summary>
public bool IssueRecipeFinishStation2 { get; set; } = false;

public bool IsAllow { get; set; } = false;

public bool IsAllowOut { set; get; } = false;
/// <summary>
/// 当前料仓的位置
/// </summary>
public int StockInIsWork { get; set; } = 0;
/// <summary>
/// 单个配方执行完成标志
/// </summary>
public bool RecipeFinish { get; set; } = false;

/// <summary>
/// 记录AGV进站送货的指令顺序
/// </summary>
public int AgvDeliveryPosition { get; set; }= 0;
/// <summary>
/// 记录AGV进站取货的指令顺序
/// </summary>
public int AgvPickUpPosition { get; set; } = 0;

/// <summary>
/// 是否使用粉仓
/// </summary>
public bool IsUseWindSend;
/// <summary>
/// 风送配料完成标志
/// </summary>
public bool WindSendDosingFinish;

/// <summary>
/// 是否占用托盘1
/// </summary>
public bool IsOccupationTray1 { get; set; } = true;
/// <summary>
/// 是否占用托盘2
/// </summary>
public bool IsOccupationTray2 { get; set; } = true;

public HKPlcCommRead plcRead = new HKPlcCommRead();
public HKPlcCommWrite plcWrite = new HKPlcCommWrite();
/// <summary>
/// 0:无意义,1=load位,2=1号位,3=2号位,4=3号位,5=4号位,6=5号位,7=6号位,8=unload位
/// </summary>
public int[] Barrel_Location = new int[MaxBarrelNum];
public bool[] AllowDosing_Pos = new bool[MaxBarrelNum];
public bool[] AllowDosing_Sign = new bool[MaxBarrelNum];
public const int MaxBarrelNum = 6;
#region 本地模拟配方
/// <summary>
/// 是否使用本地模拟配方
/// </summary>
public bool IsUseLocalRecipe { get; set; }
/// <summary>
/// 是否使用本地模拟订单+风送配方
/// </summary>
public bool IsUseWindSendDosing { get; set; }
#endregion
}
}

+ 34
- 0
BPASmartClient.DosingProject/Model/HK_PLC/HKDeviceStatus.cs Zobrazit soubor

@@ -0,0 +1,34 @@
using BPASmartClient.Helper;
using BPASmartClient.Modbus;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using BPASmartClient.S7Net;
using BPASmartClient.CustomResource.Pages.Model;
using System.Threading;

namespace BPASmartClient.DosingHKProject.Model.HK_PLC
{
public class HKDeviceStatus
{
public SiemensHelper HK_PLC_S7 = new SiemensHelper();
public bool IsConnected => HK_PLC_S7.IsConnected;
public void Init()
{
if (IsConnected)
{
ThreadManage.GetInstance().StartLong(new Action(() =>
{
var res = this.HK_PLC_S7.ReadClass<HKPlcCommRead>(1);
if (res != null && res is HKPlcCommRead data)
{
GVL_SmallStation.GetInstance.plcRead = data;
}
Thread.Sleep(10);
}),"信号交互");
}
}
}
}

+ 63
- 0
BPASmartClient.DosingProject/Model/HK_PLC/HKPlcCommRead.cs Zobrazit soubor

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

namespace BPASmartClient.DosingHKProject.Model.HK_PLC
{
/// <summary>
/// DB1 ReadOnly模块
/// </summary>
public class HKPlcCommRead
{
public bool LocalEStop { get; set; }
public bool RemoteEStop { get; set; }
public bool Sensor_Load { get; set; }
public bool Sensor_Station1 { get; set; }
public bool Sensor_Station2 { get; set; }
public bool Sensor_Station3 { get; set; }
public bool Sensor_Station4 { get; set; }
public bool Sensor_Station5 { get; set; }
public bool Sensor_Station6 { get; set; }
public bool Sensor_Unload { get; set; }
public bool Reserve1 { get; set; }
public bool Reserve2 { get; set; }
public bool Reserve3 { get; set; }
public bool Reserve4 { get; set; }
public bool Reserve5 { get; set; }
public bool Reserve6 { get; set; }
public bool Cylinder_LoadBase { get; set; }
public bool Cylinder_Station1Base { get; set; }
public bool Cylinder_Station2Base { get; set; }
public bool Cylinder_Station3Base { get; set; }
public bool Cylinder_Station4Base { get; set; }
public bool Cylinder_Station5Base { get; set; }
public bool Cylinder_Station6Base { get; set; }
public bool Cylinder_UnloadBase { get; set; }
public bool Cylinder_LoadWork { get; set; }
public bool Cylinder_Station1Work { get; set; }
public bool Cylinder_Station2Work { get; set; }
public bool Cylinder_Station3Work { get; set; }
public bool Cylinder_Station4Work { get; set; }
public bool Cylinder_Station5Work { get; set; }
public bool Cylinder_Station6Work { get; set; }
public bool Cylinder_UnloadWork { get; set; }
public bool Reserve7 { get; set; }
public bool Reserve8 { get; set; }
public bool Reserve9 { get; set; }
public bool Reserve10 { get; set; }
public bool Reserve11 { get; set; }
public bool Reserve12 { get; set; }
public bool Reserve13 { get; set; }
public bool Reserve14 { get; set; }
public bool Axis1_Alarm { get; set; }
public bool Axis2_Alarm { get; set; }
public bool Reserve15 { get; set; }
public bool Reserve16 { get; set; }
public bool Reserve17 { get; set; }
public bool Reserve18 { get; set; }
public bool Reserve19 { get; set; }
public bool Reserve20 { get; set; }
}
}

+ 49
- 0
BPASmartClient.DosingProject/Model/HK_PLC/HKPlcCommWrite.cs Zobrazit soubor

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

namespace BPASmartClient.DosingHKProject.Model.HK_PLC
{
/// <summary>
/// DB1 Write模块
/// </summary>
public class HKPlcCommWrite
{
public bool Reserve1 { get; set; }
public bool Reserve2{ get; set; }
public bool Cylinder_LoadOutput{ get; set; }
public bool Cylinder_Station1Output{ get; set; }
public bool Cylinder_Station2Output{ get; set; }
public bool Cylinder_Station3Output{ get; set; }
public bool Cylinder_Station4Output{ get; set; }
public bool Cylinder_Station5Output{ get; set; }
public bool Cylinder_Station6Output{ get; set; }
public bool Cylinder_UnloadOutput{ get; set; }
public bool Reserve3{ get; set; }
public bool Reserve4{ get; set; }
public bool Reserve5{ get; set; }
public bool Reserve6{ get; set; }
public bool Reserve7{ get; set; }
public bool Reserve8{ get; set; }
public bool TriColourLight_Yellow{ get; set; }
public bool TriColourLight_Green{ get; set; }
public bool TriColourLight_Red{ get; set; }
public bool Buzzer{ get; set; }
public bool Reserve9{ get; set; }
public bool Reserve10{ get; set; }
public bool Reserve11{ get; set; }
public bool Reserve12{ get; set; }
public bool Axis1_Start{ get; set; }
public bool Axis2_Start{ get; set; }
public bool Axis1_Stop{ get; set; }
public bool Axis2_Stop{ get; set; }
public bool Axis1_Reset{ get; set; }
public bool Axis2_Reset{ get; set; }
public bool Reserve13{ get; set; }
public bool Reserve14{ get; set; }
public short Axis1_Speed{ get; set; }
public short Axis2_Speed{ get; set; }
}
}

+ 563
- 0
BPASmartClient.DosingProject/Model/ProcessControl.cs Zobrazit soubor

@@ -0,0 +1,563 @@
using BPASmartClient.CustomResource.Pages.Model;
using BPASmartClient.Helper;
using BPASmartClient.DosingHKProject.Model.HK_PLC;
using BPASmartClient.DosingHKProject.Model.Siemens;
using BPASmartClient.Modbus;
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Configuration;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using BPASmartClient.DosingProject;

namespace BPASmartClient.DosingHKProject.Model
{
public class ProcessControl
{
private volatile static ProcessControl _Instance;
public static ProcessControl GetInstance => _Instance ?? (_Instance = new ProcessControl());
private ProcessControl() { }

/// <summary>
/// 配方数据
/// </summary>
public ObservableCollection<RemoteRecipeData> RemoteRecipes = new ObservableCollection<RemoteRecipeData>();
/// <summary>
/// 原料的名称和料仓的位置对应
/// </summary>
public Dictionary<string, short> RawMaterialsNamePos = new Dictionary<string, short>();
/// <summary>
/// 配方队列
/// </summary>
public ConcurrentQueue<string> RecipeQueue = new ConcurrentQueue<string>();
public ConcurrentQueue<string> RecipeQueueTray2 = new ConcurrentQueue<string>();

public HKDeviceStatus HKDevice = new HKDeviceStatus();
public void Init()
{
for (int i = 0; i < 16; i++)
{
if (DeviceInquire.GetInstance.GetDevice(i).DeviceName != null)
{
if (!RawMaterialsNamePos.ContainsKey(DeviceInquire.GetInstance.GetDevice(i).DeviceName))
{
RawMaterialsNamePos.Add(DeviceInquire.GetInstance.GetDevice(i).DeviceName, (short)DeviceInquire.GetInstance.GetDevice(i).deviceStatus.DeviceNum);
}
}
}
string HK_PLC_IP = ConfigurationManager.AppSettings["HKPlc_IP"];
try
{
//HKDevice.HK_PLC_S7.Connect(S7.Net.CpuType.S71200, HK_PLC_IP);
if (HKDevice.IsConnected)
{
HKDevice.Init();
MessageLog.GetInstance.ShowUserLog("海科plc连接成功,并初始化完成");
}
}
catch(Exception ex)
{
}
RecipeQueue.Clear();
ThreadManage.GetInstance().StartLong(new Action(() =>
{
ReceviceData();
RecipeInfoToHKPLC();
Thread.Sleep(10);
}), "流程处理", true);
ThreadManage.GetInstance().StartLong(new Action(() =>
{
if (HKDevice.IsConnected)
{
GetStatus();
ManualOpen();
ManualClose();
}
Thread.Sleep(10);
}), "手动操作", true);
}
private void GetStatus()
{
for (int i = 0; i < 8; i++)
{
HKDevice.HK_PLC_S7.Read<bool>("DB5.DBX0." + i);
}
for (int i = 0; i < 8; i++)
{
HKDevice.HK_PLC_S7.Read<bool>("DB5.DBX1." + i);
}
}
private void ManualOpen()
{
ActionManage.GetInstance.Register(new Action<object>((o) =>
{
if (o != null)
{
if (o.ToString().Contains("升降气缸"))
{
int index = Convert.ToInt16(o.ToString().Substring(o.ToString().Length - 1));
switch (index)
{
case 1:
HKDevice.HK_PLC_S7.Write<bool>("DB5.DBX0.0", true);
break;
case 2:
HKDevice.HK_PLC_S7.Write<bool>("DB5.DBX0.1", true);
break;
case 3:
HKDevice.HK_PLC_S7.Write<bool>("DB5.DBX0.2", true);
break;
case 4:
HKDevice.HK_PLC_S7.Write<bool>("DB5.DBX0.3", true);
break;
case 5:
HKDevice.HK_PLC_S7.Write<bool>("DB5.DBX0.4", true);
break;
case 6:
HKDevice.HK_PLC_S7.Write<bool>("DB5.DBX0.5", true);
break;
default:
break;

}
}
}
}), "ManualOpen", true);//根据下发的配方ID将 托盘的位置信息添加到配方中
}
private void ManualClose()
{
ActionManage.GetInstance.Register(new Action<object>((o) =>
{
if (o != null)
{
if (o.ToString().Contains("升降气缸"))
{
int index = Convert.ToInt16(o.ToString().Substring(o.ToString().Length - 1));
switch (index)
{
case 1:
HKDevice.HK_PLC_S7.Write("DB5.DBX0.0", false);
break;
case 2:
HKDevice.HK_PLC_S7.Write("DB5.DBX0.1", false);
break;
case 3:
HKDevice.HK_PLC_S7.Write("DB5.DBX0.2", false);
break;
case 4:
HKDevice.HK_PLC_S7.Write("DB5.DBX0.3", false);
break;
case 5:
HKDevice.HK_PLC_S7.Write("DB5.DBX0.4", false);
break;
case 6:
HKDevice.HK_PLC_S7.Write("DB5.DBX0.5", false);
break;
default:
break;

}
}
}
}), "ManualClose", true);//根据下发的配方ID将 托盘的位置信息添加到配方中
}
/// <summary>
/// 将配方添加到配方队列中
/// </summary>
private void ReceviceData()
{
RemoteRecipes = Json<RemoteRecipeDataColl>.Data.Recipes;
if (RemoteRecipes.Count > 0)
{
foreach (var data in RemoteRecipes)
{
if (!(RecipeQueue.Contains(data.RecipeCode)))
{
RecipeQueue.Enqueue(data.RecipeCode);
}
}
}
else
{
RecipeQueue.Clear();
GVL_SmallStation.GetInstance.RecipeStatusID = 0;
}
}

int cnt_sensor1 = 0;
int cnt_sensor2 = 0;
int cnt_sensor3 = 0;
int cnt_sensor4 = 0;
int cnt_sensor5 = 0;
int cnt_sensor6 = 0;
int cnt_sensor7 = 0;
int cnt_sensor8 = 0;
int barrel1 = 0;
/// <summary>
/// 执行配方队列中的第一个配方
/// </summary>
private void RecipeInfoToHKPLC()
{
if (RecipeQueue.Count > 0)
{
int index = Array.FindIndex(RemoteRecipes.ToArray(), p => p.RecipeCode == RecipeQueue.ElementAt(0));
if (index >= 0 && index < RemoteRecipes.Count)
{
string code = RemoteRecipes.ElementAt(index).RecipeCode;
string recipeName = RemoteRecipes.ElementAt(index).RecipeName;
#region sensor处理
if (GVL_SmallStation.GetInstance.plcRead.Sensor_Load)
{
cnt_sensor1++;
}
else
{
if (cnt_sensor1 >= 50)
{
if (barrel1 >= 0 && barrel1 < GVL_SmallStation.MaxBarrelNum)
{
if (GVL_SmallStation.GetInstance.Barrel_Location[barrel1] == 0)
{
GVL_SmallStation.GetInstance.Barrel_Location[barrel1] = 1;
barrel1++;
}
}
else
{
//报错,超过最大的桶号数
}
}
cnt_sensor1 = 0;
}
if (GVL_SmallStation.GetInstance.plcRead.Sensor_Station1)
{
cnt_sensor2++;
}
else
{
if (cnt_sensor2 >= 50)
{
for (int i = 0; i < GVL_SmallStation.GetInstance.Barrel_Location.Length; i++)
{
if (GVL_SmallStation.GetInstance.Barrel_Location[i] == 1)
{
GVL_SmallStation.GetInstance.Barrel_Location[i] = 2;
}
}
}
cnt_sensor2 = 0;
}
if (GVL_SmallStation.GetInstance.plcRead.Sensor_Station2)
{
cnt_sensor3++;
}
else
{
if (cnt_sensor3 >= 50)
{
for (int i = 0; i < GVL_SmallStation.GetInstance.Barrel_Location.Length; i++)
{
if (GVL_SmallStation.GetInstance.Barrel_Location[i] == 2)
{
GVL_SmallStation.GetInstance.Barrel_Location[i] = 3;
}
}
}
cnt_sensor3 = 0;
}
if (GVL_SmallStation.GetInstance.plcRead.Sensor_Station3)
{
cnt_sensor4++;
}
else
{
if (cnt_sensor4 >= 50)
{
for (int i = 0; i < GVL_SmallStation.GetInstance.Barrel_Location.Length; i++)
{
if (GVL_SmallStation.GetInstance.Barrel_Location[i] == 3)
{
GVL_SmallStation.GetInstance.Barrel_Location[i] = 4;
}
}
}
cnt_sensor4 = 0;
}
if (GVL_SmallStation.GetInstance.plcRead.Sensor_Station4)
{
cnt_sensor5++;
}
else
{
if (cnt_sensor5 >= 50)
{
for (int i = 0; i < GVL_SmallStation.GetInstance.Barrel_Location.Length; i++)
{
if (GVL_SmallStation.GetInstance.Barrel_Location[i] == 4)
{
GVL_SmallStation.GetInstance.Barrel_Location[i] = 5;
}
}
}
cnt_sensor5 = 0;
}
if (GVL_SmallStation.GetInstance.plcRead.Sensor_Station5)
{
cnt_sensor6++;
}
else
{
if (cnt_sensor6 >= 50)
{
for (int i = 0; i < GVL_SmallStation.GetInstance.Barrel_Location.Length; i++)
{
if (GVL_SmallStation.GetInstance.Barrel_Location[i] == 5)
{
GVL_SmallStation.GetInstance.Barrel_Location[i] = 6;
}
}
}
cnt_sensor6 = 0;
}
if (GVL_SmallStation.GetInstance.plcRead.Sensor_Station6)
{
cnt_sensor7++;
}
else
{
if (cnt_sensor7 >= 50)
{
for (int i = 0; i < GVL_SmallStation.GetInstance.Barrel_Location.Length; i++)
{
if (GVL_SmallStation.GetInstance.Barrel_Location[i] == 6)
{
GVL_SmallStation.GetInstance.Barrel_Location[i] = 7;
}
}
}
cnt_sensor7 = 0;
}
if (GVL_SmallStation.GetInstance.plcRead.Sensor_Unload)
{
HKDevice.HK_PLC_S7.Write<bool>("DB2.DBX3.0", false);
HKDevice.HK_PLC_S7.Write<bool>("DB2.DBX3.1", false);
MessageLog.GetInstance.ShowRunLog($"下料桶堵料,线体不运行");
cnt_sensor8++;
}
else
{
if (cnt_sensor8 >= 50)
{
for (int i = 0; i < GVL_SmallStation.GetInstance.Barrel_Location.Length; i++)
{
if (GVL_SmallStation.GetInstance.Barrel_Location[i] == 7)
{
GVL_SmallStation.GetInstance.Barrel_Location[i] = 0;
}
}
}
cnt_sensor8 = 0;
}
#endregion
for (int i = 0; i < GVL_SmallStation.GetInstance.Barrel_Location.Length; i++)
{
if (GVL_SmallStation.GetInstance.plcRead.Sensor_Station1 && GVL_SmallStation.GetInstance.Barrel_Location[i] == 1)
{
foreach (var item in RemoteRecipes.ElementAt(index).RawMaterial)
{
if ((item.RawMaterialLocation == i+1 || item.RawMaterialLocation == i+7) && item.IsDosingFinish == false && item.RawMaterialBarrelNum == i+1)
{
GVL_SmallStation.GetInstance.AllowDosing_Pos[i] = true;
}
}
}
}
if (GVL_SmallStation.GetInstance.plcRead.Sensor_Station1 && GVL_SmallStation.GetInstance.Barrel_Location[0] == 1)
{
foreach (var item in RemoteRecipes.ElementAt(index).RawMaterial)
{
if ((item.RawMaterialLocation == 1 || item.RawMaterialLocation == 7) && item.IsDosingFinish == false && item.RawMaterialBarrelNum == 1)
{
GVL_SmallStation.GetInstance.AllowDosing_Pos[0] = true;
}
}
}
if (GVL_SmallStation.GetInstance.plcRead.Sensor_Station2 && GVL_SmallStation.GetInstance.Barrel_Location[1] == 1)
{
GVL_SmallStation.GetInstance.AllowDosing_Pos[1] = true;
}
if (GVL_SmallStation.GetInstance.plcRead.Sensor_Station3 && GVL_SmallStation.GetInstance.Barrel_Location[2] == 1)
{
GVL_SmallStation.GetInstance.AllowDosing_Pos[2] = true;
}
if (GVL_SmallStation.GetInstance.plcRead.Sensor_Station4 && GVL_SmallStation.GetInstance.Barrel_Location[3] == 1)
{
GVL_SmallStation.GetInstance.AllowDosing_Pos[3] = true;
}
if (GVL_SmallStation.GetInstance.plcRead.Sensor_Station5 && GVL_SmallStation.GetInstance.Barrel_Location[4] == 1)
{
GVL_SmallStation.GetInstance.AllowDosing_Pos[4] = true;
}
if (GVL_SmallStation.GetInstance.plcRead.Sensor_Station6 && GVL_SmallStation.GetInstance.Barrel_Location[5] == 1)
{
GVL_SmallStation.GetInstance.AllowDosing_Pos[5] = true;
}
foreach (var item in RemoteRecipes.ElementAt(index).RawMaterial)
{
}
if (GVL_SmallStation.GetInstance.RecipeStatusID == 0)
{
if (RunInit() == 1)
{
GVL_SmallStation.GetInstance.RecipeStatusID = 1;
}
}
if (GVL_SmallStation.GetInstance.RecipeStatusID == 1)
{
HKDevice.HK_PLC_S7.Write<bool>("DB2.DBX3.0", true);
HKDevice.HK_PLC_S7.Write<bool>("DB2.DBX3.1", true);
GVL_SmallStation.GetInstance.RecipeStatusID = 2;
}
if (HKDevice.HK_PLC_S7.Read<bool>("DB2.DBX3.0") && HKDevice.HK_PLC_S7.Read<bool>("DB2.DBX3.1") && GVL_SmallStation.GetInstance.RecipeStatusID == 2)
{
GVL_SmallStation.GetInstance.RecipeStatusID = 3;
}
if (GVL_SmallStation.GetInstance.RecipeStatusID == 3)
{
for (int i = 0; i < 6; i++)
{

}
if (GVL_SmallStation.GetInstance.AllowDosing_Pos[0])
{
int res = 1;
MessageLog.GetInstance.ShowRunLog($"配方:{recipeName},1号桶,{res}料仓,允许配料");
if (res > 0 )
{
int loc_index = Array.FindIndex(RemoteRecipes.ElementAt(index).RawMaterial.ToArray(), p => p.RawMaterialLocation == res);
float weight = RemoteRecipes.ElementAt(index).RawMaterial.ElementAt(loc_index).RawMaterialWeight;
if (loc_index >= 0)
{
DeviceInquire.GetInstance.GetDevice((int)res)?.Start(weight);//根据料仓编号 启动并写入每个原料重量
GVL_SmallStation.GetInstance.StockInIsWork = (int)res;
}
GVL_SmallStation.GetInstance.DosingTray1 = true;
MessageLog.GetInstance.ShowRunLog($"托盘1,配方:{recipeName},1号桶,{(int)res}号仓,配料完成");
}
}
else if(RTrig.GetInstance("DB3.DBX50.1").Start(HKDevice.HK_PLC_S7.Read<bool>("DB3.DBX50.1")))
{
var res = HKDevice.HK_PLC_S7.Read<float>("DB3.DBD14");
MessageLog.GetInstance.ShowRunLog($"托盘1,配方:{recipeName},2号桶,{res}料仓,允许配料");
if (res > 0 && res is float loc)
{
int loc_index = Array.FindIndex(RemoteRecipes.ElementAt(index).RawMaterial.ToArray(), p => p.RawMaterialLocation == loc);
float weight = RemoteRecipes.ElementAt(index).RawMaterial.ElementAt(loc_index).RawMaterialWeight;
if (loc_index >= 0)
{
DeviceInquire.GetInstance.GetDevice((int)loc)?.Start(weight);//启动并写入每个原料重量
GVL_SmallStation.GetInstance.StockInIsWork = (int)loc;
}
GVL_SmallStation.GetInstance.DosingTray1 = true;
MessageLog.GetInstance.ShowRunLog($"托盘1,配方:{recipeName},2号桶,{(int)loc}号仓,配料完成");
}
}
else if (RTrig.GetInstance("DB3.DBX50.2").Start(HKDevice.HK_PLC_S7.Read<bool>("DB3.DBX50.2")))
{
var res = HKDevice.HK_PLC_S7.Read<float>("DB3.DBD18");
MessageLog.GetInstance.ShowRunLog($"托盘1,配方:{recipeName},3号桶,{res}料仓,允许配料");
if (res > 0 && res is float loc)
{
int loc_index = Array.FindIndex(RemoteRecipes.ElementAt(index).RawMaterial.ToArray(), p => p.RawMaterialLocation == loc);
float weight = RemoteRecipes.ElementAt(index).RawMaterial.ElementAt(loc_index).RawMaterialWeight;
if (loc_index >= 0)
{
DeviceInquire.GetInstance.GetDevice((int)loc)?.Start(weight);//启动并写入每个原料重量
GVL_SmallStation.GetInstance.StockInIsWork = (int)loc;
}
GVL_SmallStation.GetInstance.DosingTray1 = true;
MessageLog.GetInstance.ShowRunLog($"托盘1,配方:{recipeName},3号桶,{(int)loc}号仓,配料完成");
}
}
else if (RTrig.GetInstance("DB3.DBX50.3").Start(HKDevice.HK_PLC_S7.Read<bool>("DB3.DBX50.3")))
{
var res = HKDevice.HK_PLC_S7.Read<float>("DB3.DBD22");
MessageLog.GetInstance.ShowRunLog($"托盘1,配方:{recipeName},4号桶,{res}料仓,允许配料");
if (res > 0 && res is float loc)
{
int loc_index = Array.FindIndex(RemoteRecipes.ElementAt(index).RawMaterial.ToArray(), p => p.RawMaterialLocation == loc);
float weight = RemoteRecipes.ElementAt(index).RawMaterial.ElementAt(loc_index).RawMaterialWeight;
if (loc_index >= 0)
{
DeviceInquire.GetInstance.GetDevice((int)loc)?.Start(weight);//启动并写入每个原料重量
GVL_SmallStation.GetInstance.StockInIsWork = (int)loc;
}
GVL_SmallStation.GetInstance.DosingTray1 = true;
MessageLog.GetInstance.ShowRunLog($"托盘1,配方:{recipeName},4号桶,{(int)loc}号仓,配料完成");
}
}
if (GVL_SmallStation.GetInstance.DosingTray1)
{
for (int i = 1; i < 16; i++)
{
if (RTrig.GetInstance("GetDeviceRunStatus").Start(DeviceInquire.GetInstance.GetDevice(i).deviceStatus.RunStatus == 3))
{
MessageLog.GetInstance.ShowRunLog($"柔性味魔方,托盘1,配方:{recipeName},{i}号仓,配料完成");
int res = Array.FindIndex(RemoteRecipes.ElementAt(index).RawMaterial.ToArray(), p => p.RawMaterialLocation == i);
RemoteRecipes.ElementAt(index).RawMaterial.ElementAt(res).Laying_Off_Weight = DeviceInquire.GetInstance.GetDevice(i).deviceStatus.CutWeightFeedback;
DeviceInquire.GetInstance.GetDevice(i).StatusReset();
if (i >= 1 && i <= 8)
{
HKDevice.HK_PLC_S7.Write("DB4.DBX30." + (i - 1), true);
}
else if (i >= 9 && i <= 15)
{
HKDevice.HK_PLC_S7.Write("DB4.DBX31." + (i - 9), true);
}
GVL_SmallStation.GetInstance.DosingTray1 = false;
}
}
}
if (RTrig.GetInstance("配方配料完成").Start(HKDevice.HK_PLC_S7.Read<bool>("DB3.DBX1.1")) && (GVL_SmallStation.GetInstance.WindSendDosingFinish || !GVL_SmallStation.GetInstance.IsUseWindSend))
{
var res = Json<RemoteRecipeDataColl>.Data.Recipes.FirstOrDefault(p => p.RecipeCode == code);
MessageLog.GetInstance.ShowRunLog($"托盘1,配方{res.RecipeName},配料完成");
App.Current.Dispatcher.Invoke(() =>
{
Json<RemoteRecipeDataColl>.Data.Recipes.Remove(res);
});
RecipeQueue.TryDequeue(out code);
HKDevice.HK_PLC_S7.Write("DB3.DBX1.1", false);
GVL_SmallStation.GetInstance.RecipeStatusID = 0;
}
}
}
}
}
private int RunInit()
{
if (HKDevice.IsConnected)
{
try
{
HKPlcCommWrite signReset = new HKPlcCommWrite();
HKDevice.HK_PLC_S7.WriteClass<HKPlcCommWrite>(signReset, 2);
return 1;
}
catch (Exception ex)
{
return 2;
}
}else
{
return 2;
}
}
}
}

+ 28
- 0
BPASmartClient.DosingProject/Model/RawMaterial/ActionMenu.cs Zobrazit soubor

@@ -0,0 +1,28 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.Toolkit.Mvvm.ComponentModel;
using Microsoft.Toolkit.Mvvm.Input;

namespace BPASmartClient.DosingHKProject.Model
{
public class ActionMenu : ObservableObject
{
public string CommandParameter { get { return _mCommandParameter; } set { _mCommandParameter = value; OnPropertyChanged(); } }
private string _mCommandParameter;

//public Permission[] permission { get { return _mpermission; } set { _mpermission = value; OnPropertyChanged(); } }
//private Permission[] _mpermission;

public string MenuName { get { return _mMenuName; } set { _mMenuName = value; OnPropertyChanged(); } }
private string _mMenuName;


//public string NameSpace { get { return _mNameSpace; } set { _mNameSpace = value; OnPropertyChanged(); } }
//private string _mNameSpace;


}
}

+ 48
- 0
BPASmartClient.DosingProject/Model/RawMaterial/AlarmInfo.cs Zobrazit soubor

@@ -0,0 +1,48 @@
using BPASmartClient.CustomResource.Pages.Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BPASmartClient.DosingHKProject.Model
{
public class AlarmInfo
{
/// <summary>
/// 1#急停
/// </summary>
[Alarm("1#急停")]
public bool EStop1 { get; set; }

/// <summary>
/// 伺服故障
/// </summary>
[Alarm("伺服故障")]
public bool Servo { get; set; }

/// <summary>
/// 变频器故障
/// </summary>
[Alarm("变频器故障")]
public bool Inverter { get; set; }

/// <summary>
/// 2#急停
/// </summary>
[Alarm("2#急停")]
public bool EStop2 { get; set; }

/// <summary>
/// 料仓上限
/// </summary>
[Alarm("料仓上限")]
public bool SiloUpperLimit { get; set; }

/// <summary>
/// 料仓下限
/// </summary>
[Alarm("料仓下限")]
public bool SiloLowerLimit { get; set; }
}
}

+ 17
- 0
BPASmartClient.DosingProject/Model/RawMaterial/ConveyorServer.cs Zobrazit soubor

@@ -0,0 +1,17 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.Toolkit.Mvvm.ComponentModel;

namespace BPASmartClient.DosingHKProject.Model
{
public class ConveyorServer
{
public ConveyorServer()
{

}
}
}

+ 27
- 0
BPASmartClient.DosingProject/Model/RawMaterial/CylinderStatusModel.cs Zobrazit soubor

@@ -0,0 +1,27 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.Toolkit.Mvvm.ComponentModel;

namespace BPASmartClient.DosingHKProject.Model
{
public class CylinderStatusModel : ObservableObject
{
/// <summary>
/// 气缸原点信号
/// </summary>
public bool HomeStatus { get { return _mHomeStatus; } set { _mHomeStatus = value; OnPropertyChanged(); } }
private bool _mHomeStatus;

/// <summary>
/// 气缸到位信号
/// </summary>
public bool InPlace { get { return _mInPlace; } set { _mInPlace = value; OnPropertyChanged(); } }
private bool _mInPlace;



}
}

+ 105
- 0
BPASmartClient.DosingProject/Model/RawMaterial/DeviceAddress.cs Zobrazit soubor

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

namespace BPASmartClient.DosingHKProject.Model
{
public class DeviceAddress
{
/// <summary>
/// 设备名称起始地址
/// </summary>
public static string DeviceName { get; set; } = "LW0";

/// <summary>
/// 料仓重量反馈起始地址
/// </summary>
public static string WeightFeedback { get; set; } = "LW52";

/// <summary>
/// 重量设置地址
/// </summary>
public static string WeightSet { get; set; } = "LW21";

/// <summary>
/// 启动信号地址
/// </summary>
public static string Start { get; set; } = "LW20";

/// <summary>
/// 下料重量反馈地址
/// </summary>
public static string CutWeightFeedback { get; set; } = "LW54";

/// <summary>
/// 设备编号
/// </summary>
public static string DeviceNum { get; set; } = "LW57";

/// <summary>
/// 设备故障编码
/// </summary>
public static string DeviceAlarmCode { get; set; } = "LW51";

/// <summary>
/// 原料设备类型
/// 1:膏体,2:液体,3:粉体
/// </summary>
public static string MaterialDeviceType { get; set; } = "LW56";

/// <summary>
/// 设备运行状态地址
/// </summary>
public static string RunStatus { get; set; } = "LW60";

/// <summary>
/// 出料完成,置位该信号,plc复位运行状态
/// </summary>
public static string FinfishStatus { get; set; } = "LW40";

/// <summary>
/// 慢加重量
/// </summary>
public static string SlowlyAddWeight { get; set; } = "LW23";

/// <summary>
/// 提前关阀重量
/// </summary>
public static string PreCloseValveWeight { get; set; } = "LW25";

/// <summary>
/// 快加速度
/// </summary>
public static string RapidAcceleration { get; set; } = "LW27";

/// <summary>
/// 慢加速度
/// </summary>
public static string SlowAcceleration { get; set; } = "LW29";

/// <summary>
/// 伺服手动速度
/// </summary>
public static string ServoManualSpeed { get; set; } = "LW31";

/// <summary>
/// 料仓上限重量
/// </summary>
public static string SiloUpperLimitWeight { get; set; } = "LW33";

/// <summary>
/// 料仓下限重量
/// </summary>
public static string LowerLimitWeightOfSilo { get; set; } = "LW35";

/// <summary>
/// 搅拌速度
/// </summary>
public static string StirringSpeed { get; set; } = "LW37";
}



}

+ 30
- 0
BPASmartClient.DosingProject/Model/RawMaterial/DeviceCurrentStatus.cs Zobrazit soubor

@@ -0,0 +1,30 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.Toolkit.Mvvm.ComponentModel;

namespace BPASmartClient.DosingHKProject.Model
{
public class DeviceCurrentStatus : ObservableObject
{

public double Weight { get { return _mWeight; } set { _mWeight = value; OnPropertyChanged(); } }
private double _mWeight;


public bool RunStatus { get { return _mRunStatus; } set { _mRunStatus = value; OnPropertyChanged(); } }
private bool _mRunStatus;


public int DeviceNum { get { return _mDeviceNum; } set { _mDeviceNum = value; OnPropertyChanged(); } }
private int _mDeviceNum;

public string DeviceName { get { return _mDeviceName; } set { _mDeviceName = value; OnPropertyChanged(); } }
private string _mDeviceName;



}
}

+ 363
- 0
BPASmartClient.DosingProject/Model/RawMaterial/DeviceInquire.cs Zobrazit soubor

@@ -0,0 +1,363 @@
using BPASmartClient.CustomResource.Pages.Model;
using BPASmartClient.DosingHKProject.ViewModel;
using BPASmartClient.DosingProject;
using BPASmartClient.Helper;
using BPASmartClient.Modbus;
using BPASmartClient.Model;
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Net.NetworkInformation;
using System.Threading;
using System.Threading.Tasks;

namespace BPASmartClient.DosingHKProject.Model
{
public class DeviceInquire
{
private volatile static DeviceInquire _Instance;
public static DeviceInquire GetInstance => _Instance ?? (_Instance = new DeviceInquire());
private DeviceInquire() { }

string IPSegment = "192.168.0.";

ConcurrentDictionary<string, DeviceStatus> DeviceLists = new ConcurrentDictionary<string, DeviceStatus>();
List<string> InvalidIP = new List<string>();//无效 IP 集合
List<string> IPLists = new List<string>();//启动 Ping 任务IP集合
ConcurrentQueue<string> IPQueues = new ConcurrentQueue<string>();//pincomplete 完成队列

public ObservableCollection<DeviceCurrentStatus> TopDeviceCurrentStatuses { get; set; } = new ObservableCollection<DeviceCurrentStatus>();
public ObservableCollection<DeviceCurrentStatus> BottomDeviceCurrentStatuses { get; set; } = new ObservableCollection<DeviceCurrentStatus>();
public ObservableCollection<Devices> devices { get; set; } = new ObservableCollection<Devices>();
private void DeviceDataInit()
{
ThreadManage.GetInstance().StartLong(new Action(() =>
{
for (int i = 0; i < DeviceLists.Count; i++)
{
string deviceName = DeviceLists.ElementAt(i).Value.DeviceName;
int TopIndex = Array.FindIndex(TopDeviceCurrentStatuses.ToArray(), p => p.DeviceName == deviceName);
int BottomIndex = Array.FindIndex(BottomDeviceCurrentStatuses.ToArray(), p => p.DeviceName == deviceName);
if (TopIndex >= 0 && TopIndex < TopDeviceCurrentStatuses.Count)
{
TopDeviceCurrentStatuses.ElementAt(TopIndex).Weight = DeviceLists.ElementAt(i).Value.deviceStatus.WeightFeedback;
TopDeviceCurrentStatuses.ElementAt(TopIndex).DeviceNum = DeviceLists.ElementAt(i).Value.deviceStatus.DeviceNum;
}

if (BottomIndex >= 0 && BottomIndex < BottomDeviceCurrentStatuses.Count)
{
BottomDeviceCurrentStatuses.ElementAt(BottomIndex).Weight = DeviceLists.ElementAt(i).Value.deviceStatus.WeightFeedback;
BottomDeviceCurrentStatuses.ElementAt(BottomIndex).DeviceNum = DeviceLists.ElementAt(i).Value.deviceStatus.DeviceNum;
}

int deviceIndex = Array.FindIndex(devices.ToArray(), p => p.IpAddress == DeviceLists.ElementAt(i).Key && p.DeviceName != DeviceLists.ElementAt(i).Value.DeviceName);
if (deviceIndex >= 0 && deviceIndex < devices.Count)
{
devices.ElementAt(deviceIndex).DeviceName = DeviceLists.ElementAt(i).Value.DeviceName;
}
}
Thread.Sleep(200);
}), "设备状态监听");
}
private void TestData()
{
for (int i = 0; i < 8; i++)
{
TopDeviceCurrentStatuses.Add(new DeviceCurrentStatus()
{
DeviceName = $"测试设备{i + 1}",
DeviceNum = i + 1,
Weight = new Random().Next(100, 10000) / 100.0
});

devices.Add(new Devices()
{
DeviceName = $"测试设备{i + 1}",
IpAddress = $"192.168.1.{i + 1}",
});
}

for (int i = 8; i < 16; i++)
{
BottomDeviceCurrentStatuses.Add(new DeviceCurrentStatus()
{
DeviceName = $"测试设备{i + 1}",
DeviceNum = i + 1,
Weight = new Random().Next(100, 10000) / 100.0
});

devices.Add(new Devices()
{
DeviceName = $"测试设备{i + 1}",
IpAddress = $"192.168.1.{i + 1}",
});
}
}
public void Init()
{
//TestData();
IpAddressLines();
DeviceDataInit();
ThreadManage.GetInstance().StartLong(new Action(() =>
{
if (IPQueues.Count >= IPLists.Count)
IpAddressLines();
Thread.Sleep(5000);
}), "配料机设备上线监听", true);
}

public void Rescan()
{
InvalidIP.Clear();
}

public DeviceStatus GetDevice(string ip)
{
if (ip != null)
{
var res = DeviceLists.Values.FirstOrDefault(p => p.IpAddress == ip);
if (res != null) return res;
}
return new DeviceStatus();
}
public DeviceStatus GetDevice(int location)
{
if (location > 0 && location < 16)
{
var res = DeviceLists.Values.FirstOrDefault(p => p.deviceStatus.DeviceNum == location);
if (res != null) return res;
}
return new DeviceStatus();
}

public List<DeviceStatus> GetDevice()
{
List<DeviceStatus> deviceStatuses = new List<DeviceStatus>();
foreach (var device in DeviceLists)
{
deviceStatuses.Add(device.Value);
}
return deviceStatuses;
}

private void IpAddressLines()
{
IPLists.Clear();
IPQueues.Clear();
for (int i = 1; i <= 255; i++)
{
if (!InvalidIP.Contains($"{IPSegment}{i}") && !DeviceLists.ContainsKey($"{IPSegment}{i}"))
{
IPLists.Add($"{IPSegment}{i}");
}
}

IPLists.ForEach((item) =>
{
Ping myPing = new Ping();
myPing.PingCompleted += new PingCompletedEventHandler(_myPing_PingCompleted);
myPing.SendAsync(item, 1000, null);
});
}

private void _myPing_PingCompleted(object sender, PingCompletedEventArgs e)
{
if (e.Reply.Status == IPStatus.Success)
{
string ip = e.Reply.Address.ToString();
if (!DeviceLists.ContainsKey(ip))
{
DeviceStatus DS = new DeviceStatus();
DS.modbusTcp.IsReconnect = false;

DS.modbusTcp.ConnectOk = new Action(() =>
{
string DeviceName = DS.modbusTcp.GetString(DeviceAddress.DeviceName, 20).Trim()?.Replace(" ", "");//读取设备名称
if (DeviceName.Length > 0)
{
DeviceLists.TryAdd(ip, DS);
DeviceLists[ip].Init(DeviceName);
DeviceLists[ip].modbusTcp.IsReconnect = false;
App.Current.Dispatcher.Invoke(new Action(() =>
{
//DeviceListViewModel.devices.Add(new Devices()
//{
// DeviceName = DeviceName,
// IpAddress = ip
//});//加入连接的(有名称的)设备列表

devices.Add(new Devices() { DeviceName = DeviceName, IpAddress = ip });

if (TopDeviceCurrentStatuses.Count <= 7)
TopDeviceCurrentStatuses.Add(new DeviceCurrentStatus() { DeviceName = DeviceName });
else
BottomDeviceCurrentStatuses.Add(new DeviceCurrentStatus() { DeviceName = DeviceName });


for (int i = 0; i < Json<LocaPar>.Data.Recipes.Count; i++)
{
for (int m = 0; m < Json<LocaPar>.Data.Recipes.ElementAt(i).RawMaterials.Count; m++)
{
if (Json<LocaPar>.Data.Recipes.ElementAt(i).RawMaterials.ElementAt(m).DeviceIp == ip)
{
Json<LocaPar>.Data.Recipes.ElementAt(i).RawMaterials.ElementAt(m).RawMaterialName = DeviceName;
}
}
}
if (Global.DeviceRawMaterials.Count > 0)
{
if (Global.DeviceRawMaterials.FirstOrDefault(p => p.RawMaterialName == DeviceName) == null)
{
Global.DeviceRawMaterials.Add(new RawMaterialModel() { RawMaterialName = DeviceName, DeviceIp = ip, RawMaterialSource = 1});
}
}
else
{
Global.DeviceRawMaterials.Add(new RawMaterialModel() { RawMaterialName = DeviceName, DeviceIp = ip, RawMaterialSource = 1 });
}

}));
}
else
{
if (!InvalidIP.Contains(ip)) InvalidIP.Add(ip);
}
});

DS.modbusTcp.ConnectFail = new Action(() =>
{
if (!InvalidIP.Contains(ip)) InvalidIP.Add(ip);
//MessageLog.GetInstance.ShowAlarmLog($"设备{ip}连接失败");
});

DS.modbusTcp.Disconnect = new Action(() =>
{
if (InvalidIP.Contains(ip)) InvalidIP.Remove(ip);
//var res = DeviceListViewModel.devices.FirstOrDefault(P => P.IpAddress == ip);
var res = devices.FirstOrDefault(P => P.IpAddress == ip);
//if (res != null && DeviceListViewModel.devices.Contains(res))
if (res != null && devices.Contains(res))
{
App.Current.Dispatcher.Invoke(new Action(() =>
{
//DeviceListViewModel.devices.Remove(res);
devices.Remove(res);
var item = Global.DeviceRawMaterials.FirstOrDefault(P => P.RawMaterialName == res.DeviceName);
if (item != null) Global.DeviceRawMaterials.Remove(item);

var topRes = TopDeviceCurrentStatuses.FirstOrDefault(p => p.DeviceName == res.DeviceName);
var bottomRes = BottomDeviceCurrentStatuses.FirstOrDefault(p => p.DeviceName == res.DeviceName);
if (topRes != null) TopDeviceCurrentStatuses.Remove(topRes);
if (bottomRes != null) BottomDeviceCurrentStatuses.Remove(bottomRes);
}));
}

if (DeviceLists.ContainsKey(ip)) DeviceLists[ip].Dispose();
});

Task.Run(new Action(() =>
{
DS.modbusTcp.ModbusTcpConnect(ip, 502);//PLC连接
IPQueues.Enqueue(e.Reply.Address.ToString());
}));
}
else IPQueues.Enqueue(e.Reply.Address.ToString());
}
else IPQueues.Enqueue(e.Reply.Address.ToString());
}
}

public class DeviceStatus
{

#region 对象属性声明
public string DeviceName = String.Empty;
public string IpAddress => modbusTcp.IPAdress;
/// <summary>
/// 设备状态
/// </summary>
public RawMaterialDeviceStatus deviceStatus { get; set; } = new RawMaterialDeviceStatus();



public ModbusTcp modbusTcp = new ModbusTcp();

public bool IsConnected => modbusTcp.Connected;
#endregion

public void Init(string DeviceName)
{
this.DeviceName = DeviceName;
AlarmHelper<AlarmInfo>.Init();
if (modbusTcp.Connected)
{
ThreadManage.GetInstance().StartLong(new Action(() =>
{
//获取设备运行状态
//var res = this.modbusTcp.Read(DeviceAddress.RunStatus);
//if (res != null && res is ushort[] ushortValue)
//{
// if (ushortValue.Length >= 1) deviceStatus.RunStatus = ushortValue[0];
//}
deviceStatus.RunStatus = (ushort)this.modbusTcp.ReadShort(DeviceAddress.RunStatus); //获取设备运行状态
deviceStatus.WeightFeedback = (float)this.modbusTcp.GetUint(DeviceAddress.WeightFeedback);//获取设备料仓剩余重量
deviceStatus.NowWeightFeedback = (float)this.modbusTcp.GetUint(DeviceAddress.CutWeightFeedback);//获取下料重量
deviceStatus.DeviceNum = (ushort)this.modbusTcp.ReadShort(DeviceAddress.DeviceNum);//获取设备编号
deviceStatus.DeviceAlarmCode = (ushort)this.modbusTcp.ReadShort(DeviceAddress.DeviceAlarmCode);//获取设备故障编码

AlarmHelper<AlarmInfo>.Alarm.EStop1 = deviceStatus.DeviceAlarmCode.Get16bitValue(1);
AlarmHelper<AlarmInfo>.Alarm.Servo = deviceStatus.DeviceAlarmCode.Get16bitValue(2);
AlarmHelper<AlarmInfo>.Alarm.Inverter = deviceStatus.DeviceAlarmCode.Get16bitValue(3);
AlarmHelper<AlarmInfo>.Alarm.EStop2 = deviceStatus.DeviceAlarmCode.Get16bitValue(7);
AlarmHelper<AlarmInfo>.Alarm.SiloUpperLimit = deviceStatus.DeviceAlarmCode.Get16bitValue(8);
AlarmHelper<AlarmInfo>.Alarm.SiloLowerLimit = deviceStatus.DeviceAlarmCode.Get16bitValue(9);
AlarmHelper<AlarmInfo>.Alarm.EStop1 = true;
Thread.Sleep(10);
}), $"{DeviceName} 开始监听", true);
}
}

public void SetDeviceName(string name)
{
this.modbusTcp.Write(DeviceAddress.DeviceName, new ushort[20]);
this.modbusTcp.SetString(DeviceAddress.DeviceName, name);
}

public void StatusReset()
{
this.modbusTcp.Write(DeviceAddress.FinfishStatus, (ushort)1);
//var res = modbusTcp.Read(DeviceAddress.RunStatus);
}

public void Dispose()
{
ThreadManage.GetInstance().StopTask($"{DeviceName} 开始监听");
}

public void Start(float Value)
{
if (modbusTcp.Connected)
{
modbusTcp.SetReal(DeviceAddress.WeightSet, Value);//写入配方量
modbusTcp.Write(DeviceAddress.Start, (ushort)1);//设备启动写入
MessageLog.GetInstance.ShowRunLog($"开始配料");
//配料设备参数写入
var res = Json<DevicePar>.Data.deviceParModels.FirstOrDefault(p => p.MaterialName == DeviceName);
if (res != null)
{
modbusTcp.SetReal(DeviceAddress.SlowlyAddWeight, res.SlowlyAddWeight);
modbusTcp.SetReal(DeviceAddress.PreCloseValveWeight, res.PreCloseValveWeight);
modbusTcp.SetUint(DeviceAddress.RapidAcceleration, (uint)res.RapidAcceleration);
modbusTcp.SetUint(DeviceAddress.SlowAcceleration, (uint)res.SlowAcceleration);
modbusTcp.SetUint(DeviceAddress.ServoManualSpeed, (uint)res.ServoManualSpeed);
modbusTcp.SetUint(DeviceAddress.SiloUpperLimitWeight, (uint)res.SiloUpperLimitWeight);
modbusTcp.SetUint(DeviceAddress.LowerLimitWeightOfSilo, (uint)res.LowerLimitWeightOfSilo);
modbusTcp.SetUint(DeviceAddress.StirringSpeed, (uint)res.StirringSpeed * 100);
MessageLog.GetInstance.ShowRunLog($"参数下发完成");
}
}
}
}
}

+ 15
- 0
BPASmartClient.DosingProject/Model/RawMaterial/DevicePar.cs Zobrazit soubor

@@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.Toolkit.Mvvm.ComponentModel;
using System.Collections.ObjectModel;

namespace BPASmartClient.DosingHKProject.Model
{
public class DevicePar
{
public ObservableCollection<DeviceParMode> deviceParModels { get; set; } = new ObservableCollection<DeviceParMode>();
}
}

+ 75
- 0
BPASmartClient.DosingProject/Model/RawMaterial/DeviceParModel.cs Zobrazit soubor

@@ -0,0 +1,75 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.Toolkit.Mvvm.ComponentModel;

namespace BPASmartClient.DosingHKProject.Model
{
public class DeviceParMode : ObservableObject
{

/// <summary>
/// 原料名称
/// </summary>
public string MaterialName { get { return _mMaterialName; } set { _mMaterialName = value; OnPropertyChanged(); } }
private string _mMaterialName = string.Empty;

/// <summary>
/// 慢加重量
/// </summary>
public float SlowlyAddWeight { get { return _mSlowlyAddWeight; } set { _mSlowlyAddWeight = value; OnPropertyChanged(); } }
private float _mSlowlyAddWeight;

/// <summary>
/// 提前关阀重量
/// </summary>
public float PreCloseValveWeight { get { return _mPreCloseValveWeight; } set { _mPreCloseValveWeight = value; OnPropertyChanged(); } }
private float _mPreCloseValveWeight;

/// <summary>
/// 快加速度
/// </summary>
public int RapidAcceleration { get { return _mRapidAcceleration; } set { _mRapidAcceleration = value; OnPropertyChanged(); } }
private int _mRapidAcceleration;

/// <summary>
/// 慢加速度
/// </summary>
public int SlowAcceleration { get { return _mSlowAcceleration; } set { _mSlowAcceleration = value; OnPropertyChanged(); } }
private int _mSlowAcceleration;

/// <summary>
/// 伺服手动速度
/// </summary>
public int ServoManualSpeed { get { return _mServoManualSpeed; } set { _mServoManualSpeed = value; OnPropertyChanged(); } }
private int _mServoManualSpeed;

/// <summary>
/// 料仓上限重量
/// </summary>
public int SiloUpperLimitWeight { get { return _mSiloUpperLimitWeight; } set { _mSiloUpperLimitWeight = value; OnPropertyChanged(); } }
private int _mSiloUpperLimitWeight;

/// <summary>
/// 料仓下限重量
/// </summary>
public int LowerLimitWeightOfSilo { get { return _mLowerLimitWeightOfSilo; } set { _mLowerLimitWeightOfSilo = value; OnPropertyChanged(); } }
private int _mLowerLimitWeightOfSilo;

/// <summary>
/// 搅拌速度
/// </summary>
public int StirringSpeed { get { return _mStirringSpeed; } set { _mStirringSpeed = value; OnPropertyChanged(); } }
private int _mStirringSpeed;

/// <summary>
/// 是否重复
/// </summary>
[Newtonsoft.Json.JsonIgnore]
public bool IsRedundant { get { return _mIsRedundant; } set { _mIsRedundant = value; OnPropertyChanged(); } }
private bool _mIsRedundant;

}
}

+ 15
- 0
BPASmartClient.DosingProject/Model/RawMaterial/GlobalData.cs Zobrazit soubor

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

namespace BPASmartClient.DosingHKProject.Model
{
public class GlobalData
{
}
}

+ 16
- 0
BPASmartClient.DosingProject/Model/RawMaterial/LocaPar.cs Zobrazit soubor

@@ -0,0 +1,16 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Collections.ObjectModel;
using BPASmartClient.DosingHKProject.ViewModel;
using BPASmartClient.Model;

namespace BPASmartClient.DosingHKProject.Model
{
public class LocaPar
{
public ObservableCollection<RecipeModel> Recipes { get; set; } = new ObservableCollection<RecipeModel>();
}
}

+ 99
- 0
BPASmartClient.DosingProject/Model/RawMaterial/RawMaterialColl.cs Zobrazit soubor

@@ -0,0 +1,99 @@
using Microsoft.Toolkit.Mvvm.ComponentModel;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BPASmartClient.DosingHKProject.Model.RawMaterial
{
public class RawMaterialColl : ObservableObject
{
/// <summary>
/// 原料设备IP
/// </summary>
public string DeviceIp { get; set; }

/// <summary>
/// 原料名称
/// </summary>
public string RawMaterialName { get { return _mRawMaterialName; } set { _mRawMaterialName = value; OnPropertyChanged(); } }
private string _mRawMaterialName;

/// <summary>
/// 原料重量设置
/// </summary>
public uint RawMaterialWeight { get { return _mRawMaterialWeight; } set { _mRawMaterialWeight = value; OnPropertyChanged(); } }
private uint _mRawMaterialWeight;


/// <summary>
/// 原料来源
/// 0:本地
/// 1:设备
/// </summary>
public ushort RawMaterialSource { get { return _mRawMaterialSource; } set { _mRawMaterialSource = value; OnPropertyChanged(); } }
private ushort _mRawMaterialSource;

/// <summary>
/// 原料类型 MW18
/// 1:液体
/// 2:膏体
/// 3:粉体
/// </summary>
[Newtonsoft.Json.JsonIgnore]
public ushort RawMaterialType { get { return _mRawMaterialType; } set { _mRawMaterialType = value; OnPropertyChanged(); } }
private ushort _mRawMaterialType;

/// <summary>
/// 料仓重量反馈 MD40
/// </summary>
[Newtonsoft.Json.JsonIgnore]
public float WeightFeedback { get { return _mWeightFeedback; } set { _mWeightFeedback = value; OnPropertyChanged(); } }
private float _mWeightFeedback;

/// <summary>
/// 上限反馈
/// </summary>
[Newtonsoft.Json.JsonIgnore]
public bool UpLimtFeedback { get { return _mUpLimtFeedback; } set { _mUpLimtFeedback = value; OnPropertyChanged(); } }
private bool _mUpLimtFeedback;

/// <summary>
/// 下限反馈
/// </summary>
[Newtonsoft.Json.JsonIgnore]
public bool DownLimtFeedback { get { return _mDownLimtFeedback; } set { _mDownLimtFeedback = value; OnPropertyChanged(); } }
private bool _mDownLimtFeedback;

/// <summary>
/// 下料重量反馈 MD52
/// </summary>
[Newtonsoft.Json.JsonIgnore]
public float UpLimtWeightFeedback { get { return _mUpLimtWeightFeedback; } set { _mUpLimtWeightFeedback = value; OnPropertyChanged(); } }
private float _mUpLimtWeightFeedback;


/// <summary>
/// 原料ID
/// </summary>
public string RawMaterialId { get { return _mRawMaterialId; } set { _mRawMaterialId = value; OnPropertyChanged(); } }
private string _mRawMaterialId;

/// <summary>
/// 原料设备执行状态
/// 1:等待配料
/// 2:下料中
/// 3:下料完成
/// </summary>
[Newtonsoft.Json.JsonIgnore]
public ushort RecipeStatus { get { return _mRecipeStatus; } set { _mRecipeStatus = value; OnPropertyChanged(); } }
private ushort _mRecipeStatus = 1;

/// <summary>
/// 原料对应的桶号
/// </summary>
public ushort BarrelNum { get { return _mBarrelNum; } set { _mBarrelNum = value; OnPropertyChanged(); } }
private ushort _mBarrelNum = 1;
}
}

+ 65
- 0
BPASmartClient.DosingProject/Model/RawMaterial/RawMaterialDeviceStatus.cs Zobrazit soubor

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

namespace BPASmartClient.DosingHKProject.Model
{
public class RawMaterialDeviceStatus
{

/// <summary>
/// 原料类型
/// 1:膏体
/// 2:液体
/// 3:粉体
/// </summary>
public ushort RawMaterialType { get; set; }

/// <summary>
/// 料仓重量反馈
/// </summary>
public float WeightFeedback { get; set; }

/// <summary>
/// 当前出料重量反馈
/// </summary>
public float NowWeightFeedback { get; set; }

/// <summary>
/// 上限反馈
/// </summary>
public bool UpLimitFeedback { get; set; }

/// <summary>
/// 下限反馈
/// </summary>
public bool DownLimitFeedback { get; set; }

/// <summary>
/// 下料重量反馈
/// </summary>
public float CutWeightFeedback { get; set; }

/// <summary>
/// 设备运行状态
/// 0:未知
/// 1:等待配料
/// 2:配料中
/// 3:配料完成
/// </summary>
public ushort RunStatus { get; set; }

/// <summary>
/// 设备故障编码
/// </summary>
public ushort DeviceAlarmCode { get; set; }

/// <summary>
/// 设备料仓编号
/// </summary>
public ushort DeviceNum { get; set; }

}
}

+ 56
- 0
BPASmartClient.DosingProject/Model/RawMaterial/RecipeModel.cs Zobrazit soubor

@@ -0,0 +1,56 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using BPASmartClient.DosingHKProject.Model.RawMaterial;
using BPASmartClient.Model;
using Microsoft.Toolkit.Mvvm.ComponentModel;

namespace BPASmartClient.DosingHKProject.Model
{
/// <summary>
/// 配方模块
/// </summary>
public class RecipeModel : ObservableObject
{
[Newtonsoft.Json.JsonIgnore]
public bool IsEnable { get { return _mIsEnable; } set { _mIsEnable = value; OnPropertyChanged(); } }
private bool _mIsEnable = true;

/// <summary>
/// 序号
/// </summary>
public int SerialNum { get { return _mSerialNum; } set { _mSerialNum = value; OnPropertyChanged(); } }
private int _mSerialNum;

/// <summary>
/// 配方名称
/// </summary>
public string RecipeName { get { return _mRecipeName; } set { _mRecipeName = value; OnPropertyChanged(); } }
private string _mRecipeName;

/// <summary>
/// 配方编码
/// </summary>
public string RecipCode { get { return _mRecipCode; } set { _mRecipCode = value; OnPropertyChanged(); } }
private string _mRecipCode;

[Newtonsoft.Json.JsonIgnore]
public AutoResetEvent Are { get; set; } = new AutoResetEvent(false);

/// <summary>
/// 托盘编号
/// </summary>
public int TrayCode { get { return _mTrayCode; } set { _mTrayCode = value; OnPropertyChanged(); } }
private int _mTrayCode;

/// <summary>
/// 原料集合
/// </summary>
public ObservableCollection<RawMaterialModel> RawMaterials { get; set; } = new ObservableCollection<RawMaterialModel>();

}
}

+ 14
- 0
BPASmartClient.DosingProject/Model/Recipes/LocalRecipeDataColl.cs Zobrazit soubor

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

namespace BPASmartClient.DosingHKProject.Model.Siemens
{
internal class LocalRecipeDataColl
{
public ObservableCollection<RemoteRecipeData> Recipes { get; set; } = new ObservableCollection<RemoteRecipeData>();
}
}

+ 32
- 0
BPASmartClient.DosingProject/Model/Recipes/RemoteRecipeData.cs Zobrazit soubor

@@ -0,0 +1,32 @@
using Microsoft.Toolkit.Mvvm.ComponentModel;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BPASmartClient.DosingHKProject.Model
{
public class RemoteRecipeData:ObservableObject
{
/// <summary>
/// 配方名称
/// </summary>
public string RecipeName { get { return _mRecipeName; } set { _mRecipeName = value; OnPropertyChanged(); } }
private string _mRecipeName;

/// <summary>
/// 配方ID
/// </summary>
public string RecipeCode { get { return _mRecipeCode; } set { _mRecipeCode = value;OnPropertyChanged(); } }
private string _mRecipeCode;

/// <summary>
/// 原料数据
/// </summary>
public ObservableCollection<RemoteRecipeRawMaterial> RawMaterial { get; set; } = new ObservableCollection<RemoteRecipeRawMaterial>();


}
}

+ 14
- 0
BPASmartClient.DosingProject/Model/Recipes/RemoteRecipeDataColl.cs Zobrazit soubor

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

namespace BPASmartClient.DosingHKProject.Model.Siemens
{
public class RemoteRecipeDataColl
{
public ObservableCollection<RemoteRecipeData> Recipes { get; set; } = new ObservableCollection<RemoteRecipeData>();
}
}

+ 51
- 0
BPASmartClient.DosingProject/Model/Recipes/RemoteRecipeRawMaterial.cs Zobrazit soubor

@@ -0,0 +1,51 @@
using Microsoft.Toolkit.Mvvm.ComponentModel;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BPASmartClient.DosingHKProject.Model
{
public class RemoteRecipeRawMaterial:ObservableObject
{
public int DeviceIp { get { return _mIp; } set { _mIp = value; }}
private int _mIp;

public string RawMaterialName { get { return _mRawMaterialName; } set { _mRawMaterialName = value; OnPropertyChanged(); } }
private string _mRawMaterialName;

/// <summary>
/// 原料对应的桶号
/// </summary>
public short RawMaterialBarrelNum { get { return _mRawMaterialBarrelNum; } set { _mRawMaterialBarrelNum = value; OnPropertyChanged(); } }
private short _mRawMaterialBarrelNum;

/// <summary>
/// 需要原料重量
/// </summary>
public float RawMaterialWeight { get { return _mRawMaterialWeight; } set { _mRawMaterialWeight = value; OnPropertyChanged(); } }
private float _mRawMaterialWeight;

/// <summary>
/// 实际的下料中重量
/// </summary>
public float Laying_Off_Weight { get { return _mLaying_Off_Weight; } set { _mLaying_Off_Weight = value; } }
private float _mLaying_Off_Weight;

/// <summary>
/// 料仓剩余重量
/// </summary>
public float StockBinRemainingWeight { get { return _mStockBinRemainingWeight; } set { _mStockBinRemainingWeight = value; } }
private float _mStockBinRemainingWeight;

/// <summary>
/// 原料对应料仓的位置
/// </summary>
public int RawMaterialLocation { get { return _mRawMaterialLocation; } set { _mRawMaterialLocation = value;OnPropertyChanged(); } }
private int _mRawMaterialLocation;

public bool IsDosingFinish { get { return _mDosingFinish; } set { _mDosingFinish = value; } }
private bool _mDosingFinish;
}
}

+ 122
- 0
BPASmartClient.DosingProject/View/ChangeDeviceNameView.xaml Zobrazit soubor

@@ -0,0 +1,122 @@
<Window
x:Class="BPASmartClient.DosingHKProject.View.ChangeDeviceNameView"
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:local="clr-namespace:BPASmartClient.DosingHKProject.View"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:vm="clr-namespace:BPASmartClient.DosingHKProject.ViewModel"
Title="ChangeDeviceNameView"
Width="400"
Height="200"
AllowsTransparency="True"
Background="{x:Null}"
Topmost="True"
WindowStartupLocation="CenterScreen"
WindowStyle="None"
mc:Ignorable="d">

<Window.DataContext>
<vm:ChangeDeviceNameViewModel />
</Window.DataContext>

<Window.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="/BPASmartClient.CustomResource;component/Themes/GenricStyle.xaml" />
<ResourceDictionary Source="/BPASmartClient.CustomResource;component/Themes/MyStyle.xaml" />

<ResourceDictionary>
<!--#region ListBox样式-->
<Style x:Key="ListBoxItemStyle1" TargetType="{x:Type ListBoxItem}">
<Setter Property="OverridesDefaultStyle" Value="True" />
<Setter Property="SnapsToDevicePixels" Value="True" />
<Setter Property="BorderBrush" Value="{x:Null}" />
<Setter Property="Foreground" Value="White" />
<Setter Property="FontSize" Value="20" />
<Setter Property="HorizontalContentAlignment" Value="Center" />
<Setter Property="VerticalContentAlignment" Value="Center" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ListBoxItem}">
<Border x:Name="border" CornerRadius="8">
<ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" />
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!--#endregion-->
</ResourceDictionary>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Window.Resources>

<Border
Name="br"
Background="#FF0B2F5F"
BorderThickness="1">
<Grid>
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition Height="0.5*" />
<RowDefinition />
</Grid.RowDefinitions>

<StackPanel
HorizontalAlignment="Center"
VerticalAlignment="Center"
Orientation="Horizontal">
<TextBlock
Margin="10,0,0,0"
Background="Transparent"
FontSize="20"
Foreground="#FF2AB2E7"
Text="请输入新设备名称:" />

<TextBox
Grid.Column="1"
Width="200"
Height="30"
Margin="0,0,7,0"
FontSize="16"
Text="{Binding DeviceName}" />

</StackPanel>

<TextBlock
Grid.Row="1"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Background="Transparent"
FontSize="16"
Foreground="Red"
Text="{Binding ErrorInfo}" />

<Grid Grid.Row="2">
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition />
</Grid.ColumnDefinitions>

<Button
Grid.Column="1"
Width="148"
Height="30"
Margin="0,0,7,0"
Command="{Binding ConfirmCommand}"
Content="确认" />

<Button
Name="btClose"
Width="148"
Height="30"
Command="{Binding CancleCommand}"
Content="取消" />

</Grid>

</Grid>
</Border>

</Window>

+ 31
- 0
BPASmartClient.DosingProject/View/ChangeDeviceNameView.xaml.cs Zobrazit soubor

@@ -0,0 +1,31 @@
using BPASmartClient.Helper;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;

namespace BPASmartClient.DosingHKProject.View
{
/// <summary>
/// ChangeDeviceNameView.xaml 的交互逻辑
/// </summary>
public partial class ChangeDeviceNameView : Window
{
public ChangeDeviceNameView()
{
InitializeComponent();
ActionManage.GetInstance.CancelRegister("ChangeDeviceNameViewClose");
ActionManage.GetInstance.Register(new Action(() => { this.Close(); }), "ChangeDeviceNameViewClose");
this.br.MouseLeftButtonDown += (o, e) => { if (e.LeftButton == MouseButtonState.Pressed) this.DragMove(); };
}
}
}

+ 168
- 0
BPASmartClient.DosingProject/View/DeviceListView.xaml Zobrazit soubor

@@ -0,0 +1,168 @@
<UserControl
x:Class="BPASmartClient.DosingHKProject.View.DeviceListView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:control="clr-namespace:BPASmartClient.CustomResource.UserControls;assembly=BPASmartClient.CustomResource"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:BPASmartClient.DosingHKProject.View"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:pry="clr-namespace:BPASmartClient.CustomResource.UserControls;assembly=BPASmartClient.CustomResource"
xmlns:vm="clr-namespace:BPASmartClient.DosingHKProject.ViewModel"
d:DesignHeight="450"
d:DesignWidth="800"
mc:Ignorable="d">

<UserControl.DataContext>
<vm:DeviceListViewModel />
</UserControl.DataContext>

<UserControl.Resources>
<Style x:Key="UserItemContainerStyle" TargetType="ListBoxItem">
<Style.Resources>
<!-- SelectedItem with focus -->
<SolidColorBrush
x:Key="{x:Static SystemColors.HighlightBrushKey}"
Opacity=".4"
Color="White" />
<!-- SelectedItem without focus -->
<SolidColorBrush
x:Key="{x:Static SystemColors.ControlBrushKey}"
Opacity=".4"
Color="White" />
</Style.Resources>
<!-- 设置触发器 -->
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="true">
<Setter Property="Background" Value="White" />
<Setter Property="Foreground" Value="White" />
</Trigger>
<Trigger Property="IsFocused" Value="true">
<Setter Property="Background" Value="White" />
<Setter Property="Foreground" Value="White" />
</Trigger>
</Style.Triggers>
</Style>
</UserControl.Resources>

<Grid Margin="-5,0,5,0">

<Grid>
<ListView
Grid.Column="1"
Margin="10"
Background="Transparent"
BorderBrush="#00BEFA"
BorderThickness="0"
ItemsSource="{Binding devices}"
ScrollViewer.HorizontalScrollBarVisibility="Disabled">
<ListView.ItemsPanel>
<ItemsPanelTemplate>
<!--<UniformGrid
HorizontalAlignment="Left"
VerticalAlignment="Top"
Columns="8" />-->
<WrapPanel Orientation="Horizontal" />
</ItemsPanelTemplate>
</ListView.ItemsPanel>

<ListView.ItemTemplate>
<DataTemplate>
<Border
Name="ShadowElement"
Width="180"
Height="150"
Margin="10"
VerticalAlignment="Top"
BorderBrush="#00BEFA"
BorderThickness="0"
ClipToBounds="True"
CornerRadius="0">
<Border.Background>
<ImageBrush ImageSource="/BPASmartClient.CustomResource;component/Image/蓝色背景.png" />
</Border.Background>

<Grid Margin="20,0,20,0">

<!--<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>

<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition />
</Grid.ColumnDefinitions>-->

<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>

<TextBlock
Grid.Row="0"
Grid.ColumnSpan="2"
Margin="0,10,0,0"
VerticalAlignment="Center"
FontSize="20"
Foreground="#00BEFA"
Text="{Binding DeviceName}" />

<StackPanel
Grid.Row="1"
VerticalAlignment="Center"
Orientation="Horizontal">
<TextBlock
Grid.Row="1"
FontSize="14"
Foreground="#aa00BEFA"
Text="设备IP:" />
<TextBlock
Grid.Row="1"
FontSize="14"
Foreground="#aa00BEFA"
Text="{Binding IpAddress}" />
</StackPanel>

<Button
Grid.Row="2"
Width="130"
Height="30"
Margin="0,0,0,0"
VerticalAlignment="Top"
Command="{Binding DataContext.ChangeNameCommand, RelativeSource={RelativeSource AncestorType=ListView, Mode=FindAncestor}}"
CommandParameter="{Binding IpAddress}"
Content="修改原料名称"
FontSize="16"
IsEnabled="{Binding IsEnable}"
Style="{StaticResource ImageButtonStyle}" />

<!--<Button
Grid.Row="1"
Grid.Column="0"
Grid.ColumnSpan="2"
Foreground="#00BEFA"
Width="130"
Height="30"
Margin="0,0,0,10"
HorizontalAlignment="Left"
VerticalAlignment="Bottom"
Command="{Binding DataContext.ChangeNameCommand, RelativeSource={RelativeSource AncestorType=ListView, Mode=FindAncestor}}"
CommandParameter="{Binding IpAddress}"
Content="修改原料名称"
IsEnabled="{Binding IsEnable}">
<Button.Background>
<ImageBrush ImageSource="/BPASmartClient.CustomResource;component/Image/系统名称.png" />
</Button.Background>
</Button>-->


</Grid>
</Border>

</DataTemplate>
</ListView.ItemTemplate>
</ListView>
</Grid>
</Grid>
</UserControl>

+ 28
- 0
BPASmartClient.DosingProject/View/DeviceListView.xaml.cs Zobrazit soubor

@@ -0,0 +1,28 @@
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 BPASmartClient.DosingHKProject.View
{
/// <summary>
/// DeviceListView.xaml 的交互逻辑
/// </summary>
public partial class DeviceListView : UserControl
{
public DeviceListView()
{
InitializeComponent();
}
}
}

+ 370
- 0
BPASmartClient.DosingProject/View/DeviceMaterialParView.xaml Zobrazit soubor

@@ -0,0 +1,370 @@
<UserControl
x:Class="BPASmartClient.DosingHKProject.View.DeviceMaterialParView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:con="clr-namespace:BPASmartClient.DosingHKProject.Converter"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:BPASmartClient.DosingHKProject.View"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:vm="clr-namespace:BPASmartClient.DosingHKProject.ViewModel"
d:DesignHeight="1080"
d:DesignWidth="1920"
mc:Ignorable="d">

<UserControl.DataContext>
<vm:DeviceMaterialParViewModel />
</UserControl.DataContext>

<UserControl.Resources>
<SolidColorBrush x:Key="tabColor" Color="#FF2AB2E7" />
<!--<SolidColorBrush x:Key="bordColor" Color="#33ffffff" />-->
<SolidColorBrush x:Key="bordColor" Color="#332AB2E7" />
<con:DataTableRedundantConverter x:Key="tabConvert" />

<Style x:Key="RowRadioButtonStyle" TargetType="{x:Type RadioButton}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type RadioButton}">
<Border
x:Name="NvaBor"
Background="Transparent"
BorderBrush="#FF2AB2E7"
BorderThickness="0">
<ContentControl
Margin="10,4"
HorizontalAlignment="Center"
VerticalAlignment="Center"
HorizontalContentAlignment="Center"
VerticalContentAlignment="Center"
Content="{TemplateBinding Content}"
FontSize="16" />
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsChecked" Value="True">
<Setter TargetName="NvaBor" Property="Background" Value="#22ffffff" />
<Setter TargetName="NvaBor" Property="BorderThickness" Value="0" />
</Trigger>
<MultiTrigger>
<MultiTrigger.Conditions>
<Condition Property="IsChecked" Value="false" />
<Condition Property="IsMouseOver" Value="True" />
</MultiTrigger.Conditions>
<MultiTrigger.Setters>
<Setter TargetName="NvaBor" Property="Background" Value="#22ffffff" />
</MultiTrigger.Setters>
</MultiTrigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>

<Style x:Key="InputTextboxStyle" TargetType="TextBox">
<Setter Property="Margin" Value="5,0,0,0" />
<Setter Property="BorderThickness" Value="0" />
<Setter Property="HorizontalAlignment" Value="Left" />
<Setter Property="Width" Value="150" />
<Setter Property="Height" Value="40" />
<Setter Property="CaretBrush" Value="{StaticResource TitleBorderColor}" />
<Setter Property="Foreground" Value="{StaticResource TitleBorderColor}" />
<Setter Property="VerticalContentAlignment" Value="Center" />
<Setter Property="FontSize" Value="14" />
<Setter Property="Background" Value="Transparent" />
<Setter Property="VerticalAlignment" Value="Center" />
</Style>

<Style x:Key="ControlButtonStyle" TargetType="Button">
<Setter Property="Margin" Value="0" />
<Setter Property="FontSize" Value="18" />
<Setter Property="Foreground" Value="#FFF53F62" />
<Setter Property="FontWeight" Value="SemiBold" />
<Setter Property="FontFamily" Value="楷体" />
<Setter Property="VerticalContentAlignment" Value="Center" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Border
Name="TitleBarBr"
BorderBrush="#00c2f4"
BorderThickness="0"
CornerRadius="0"
Opacity="0.8">

<ContentPresenter
Margin="{TemplateBinding Margin}"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}" />
<Border.Background>
<ImageBrush
ImageSource="/BPASmartClient.CustomResource;component/Image/组合边框1.1.png"
Opacity="0.8"
Stretch="Fill" />
</Border.Background>

</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="true">
<Setter TargetName="TitleBarBr" Property="Opacity" Value="1" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>

<Style x:Key="TitleTextblockStyle" TargetType="TextBlock">
<Setter Property="FontSize" Value="16" />
<Setter Property="HorizontalAlignment" Value="Center" />
<Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="Foreground" Value="{StaticResource tabColor}" />
<Setter Property="FontFamily" Value="楷体" />
<Setter Property="FontWeight" Value="SemiBold" />
</Style>

</UserControl.Resources>

<Grid Margin="10">
<Grid.RowDefinitions>
<RowDefinition Height="40" />
<RowDefinition Height="40" />
<RowDefinition />
</Grid.RowDefinitions>

<StackPanel HorizontalAlignment="Right" Orientation="Horizontal">
<Button
Width="150"
Height="40"
Margin="10,0,10,0"
Command="{Binding AddCommand}"
Content="添加原料参数"
FontSize="20"
Style="{StaticResource ImageButtonStyle}" />
<Button
Width="150"
Height="40"
Margin="10,0,10,0"
Command="{Binding SaveCommand}"
Content="保存参数"
FontSize="20"
Style="{StaticResource ImageButtonStyle}" />
</StackPanel>

<!--#region 表格标题栏设置-->
<Grid
Grid.Row="1"
Margin="0,10,0,0"
Background="#ff0C255F">

<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition />
</Grid.ColumnDefinitions>


<TextBlock
Grid.Column="0"
Style="{StaticResource TitleTextblockStyle}"
Text="原料名称" />

<Grid Grid.Column="1">
<TextBlock Style="{StaticResource TitleTextblockStyle}" Text="慢加重量(g)" />
<Border
BorderBrush="{StaticResource bordColor}"
BorderThickness="1,0,1,0"
Cursor="SizeWE" />
</Grid>

<TextBlock
Grid.Column="2"
Style="{StaticResource TitleTextblockStyle}"
Text="提前关阀重量" />

<Grid Grid.Column="3">
<TextBlock Style="{StaticResource TitleTextblockStyle}" Text="快加速度" />
<Border
BorderBrush="{StaticResource bordColor}"
BorderThickness="1,0,1,0"
Cursor="SizeWE" />
</Grid>

<TextBlock
Grid.Column="4"
Style="{StaticResource TitleTextblockStyle}"
Text="慢加速度" />

<Grid Grid.Column="5">
<TextBlock Style="{StaticResource TitleTextblockStyle}" Text="伺服手动速度" />
<Border
BorderBrush="{StaticResource bordColor}"
BorderThickness="1,0,1,0"
Cursor="SizeWE" />
</Grid>

<TextBlock
Grid.Column="6"
Style="{StaticResource TitleTextblockStyle}"
Text="料仓上限重量" />

<Grid Grid.Column="7">
<TextBlock Style="{StaticResource TitleTextblockStyle}" Text="料仓下限重量" />
<Border
BorderBrush="{StaticResource bordColor}"
BorderThickness="1,0,1,0"
Cursor="SizeWE" />
</Grid>

<TextBlock
Grid.Column="8"
Style="{StaticResource TitleTextblockStyle}"
Text="搅拌速度" />

<Grid Grid.Column="9">
<TextBlock Style="{StaticResource TitleTextblockStyle}" Text="功能操作" />
<Border
BorderBrush="{StaticResource bordColor}"
BorderThickness="1,0,1,0"
Cursor="SizeWE" />
</Grid>

<Border
Grid.ColumnSpan="10"
BorderBrush="{StaticResource bordColor}"
BorderThickness="1,0,1,0" />

</Grid>
<!--#endregion-->

<Grid Grid.Row="2">
<ScrollViewer HorizontalScrollBarVisibility="Hidden" VerticalScrollBarVisibility="Hidden">
<ItemsControl ItemsSource="{Binding deviceParModels}">
<ItemsControl.ItemTemplate>
<DataTemplate>
<Grid Name="gr" Height="30">
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition />
</Grid.ColumnDefinitions>

<TextBox
Grid.Column="0"
Foreground="{Binding IsRedundant, Converter={StaticResource tabConvert}}"
Style="{StaticResource InputTextboxStyle}"
Text="{Binding MaterialName}" />

<Grid Grid.Column="1">
<TextBox
Foreground="{Binding IsRedundant, Converter={StaticResource tabConvert}}"
Style="{StaticResource InputTextboxStyle}"
Text="{Binding SlowlyAddWeight}" />
<Border
BorderBrush="{StaticResource bordColor}"
BorderThickness="1,0,1,0"
Cursor="SizeWE" />
</Grid>

<TextBox
Grid.Column="2"
Foreground="{Binding IsRedundant, Converter={StaticResource tabConvert}}"
Style="{StaticResource InputTextboxStyle}"
Text="{Binding PreCloseValveWeight}" />

<Grid Grid.Column="3">
<TextBox
Foreground="{Binding IsRedundant, Converter={StaticResource tabConvert}}"
Style="{StaticResource InputTextboxStyle}"
Text="{Binding RapidAcceleration}" />
<Border
BorderBrush="{StaticResource bordColor}"
BorderThickness="1,0,1,0"
Cursor="SizeWE" />
</Grid>

<TextBox
Grid.Column="4"
Foreground="{Binding IsRedundant, Converter={StaticResource tabConvert}}"
Style="{StaticResource InputTextboxStyle}"
Text="{Binding SlowAcceleration}" />

<Grid Grid.Column="5">
<TextBox
Foreground="{Binding IsRedundant, Converter={StaticResource tabConvert}}"
Style="{StaticResource InputTextboxStyle}"
Text="{Binding ServoManualSpeed}" />
<Border
BorderBrush="{StaticResource bordColor}"
BorderThickness="1,0,1,0"
Cursor="SizeWE" />
</Grid>

<TextBox
Grid.Column="6"
Foreground="{Binding IsRedundant, Converter={StaticResource tabConvert}}"
Style="{StaticResource InputTextboxStyle}"
Text="{Binding SiloUpperLimitWeight}" />

<Grid Grid.Column="7">
<TextBox
Foreground="{Binding IsRedundant, Converter={StaticResource tabConvert}}"
Style="{StaticResource InputTextboxStyle}"
Text="{Binding LowerLimitWeightOfSilo}" />
<Border
BorderBrush="{StaticResource bordColor}"
BorderThickness="1,0,1,0"
Cursor="SizeWE" />
</Grid>

<TextBox
Grid.Column="8"
Foreground="{Binding IsRedundant, Converter={StaticResource tabConvert}}"
Style="{StaticResource InputTextboxStyle}"
Text="{Binding StirringSpeed}" />

<Grid Grid.Column="9">
<Button
Command="{Binding DataContext.RemoveCommand, RelativeSource={RelativeSource AncestorType=ItemsControl, Mode=FindAncestor}}"
CommandParameter="{Binding MaterialName}"
Content="删除"
FontSize="16"
Style="{StaticResource ControlButtonStyle}" />
<Border
BorderBrush="{StaticResource bordColor}"
BorderThickness="1,0,1,0"
Cursor="SizeWE" />
</Grid>

<Border
Grid.ColumnSpan="10"
BorderBrush="{StaticResource bordColor}"
BorderThickness="1,0,1,1" />

</Grid>
<DataTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="true">
<Setter TargetName="gr" Property="Background" Value="#112AB2E7" />
</Trigger>
</DataTemplate.Triggers>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</ScrollViewer>
</Grid>


</Grid>
</UserControl>

+ 28
- 0
BPASmartClient.DosingProject/View/DeviceMaterialParView.xaml.cs Zobrazit soubor

@@ -0,0 +1,28 @@
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 BPASmartClient.DosingHKProject.View
{
/// <summary>
/// DeviceMaterialParView.xaml 的交互逻辑
/// </summary>
public partial class DeviceMaterialParView : UserControl
{
public DeviceMaterialParView()
{
InitializeComponent();
}
}
}

+ 205
- 0
BPASmartClient.DosingProject/View/HardwareStatusView.xaml Zobrazit soubor

@@ -0,0 +1,205 @@
<UserControl
x:Class="BPASmartClient.DosingHKProject.View.HardwareStatusView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:control="clr-namespace:BPASmartClient.CustomResource.UserControls;assembly=BPASmartClient.CustomResource"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:BPASmartClient.DosingHKProject.View"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:pry="clr-namespace:BPASmartClient.CustomResource.UserControls;assembly=BPASmartClient.CustomResource"
xmlns:vm="clr-namespace:BPASmartClient.DosingHKProject.ViewModel"
d:DesignHeight="1080"
d:DesignWidth="1920"
mc:Ignorable="d">

<UserControl.DataContext>
<vm:HardwareStatusViewModel />
</UserControl.DataContext>

<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="0.5*" />
<RowDefinition />
<RowDefinition Height="0.5*" />
</Grid.RowDefinitions>

<!--#region 顶部料仓-->
<Grid Name="TopGrid">
<ListView
Height="{Binding ElementName=TopGrid, Path=ActualHeight}"
VerticalAlignment="Center"
Background="Transparent"
BorderThickness="0"
ItemsSource="{Binding TopDeviceCurrentStatuses}"
ScrollViewer.HorizontalScrollBarVisibility="Disabled">
<ListView.ItemsPanel>
<ItemsPanelTemplate>
<!--<WrapPanel Orientation="Horizontal" IsItemsHost="True"/>-->
<UniformGrid
HorizontalAlignment="Left"
VerticalAlignment="Top"
Columns="8"
Rows="1" />
</ItemsPanelTemplate>
</ListView.ItemsPanel>

<ListView.ItemTemplate>
<DataTemplate>
<Border Margin="5" Background="Transparent">
<Grid Height="220">
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>

<TextBlock
Margin="0,0,0,35"
HorizontalAlignment="Center"
VerticalAlignment="Bottom"
FontSize="25"
Foreground="#ffccd61f"
Text="{Binding DeviceName}" />

<StackPanel
Grid.Row="1"
Margin="0,25,0,0"
HorizontalAlignment="Center"
Orientation="Horizontal">
<TextBlock
FontSize="20"
Foreground="#FF0084FF"
Text="{Binding Weight}" />

<TextBlock
FontSize="20"
Foreground="#FF0084FF"
Text=" kg" />
</StackPanel>


<StackPanel
Grid.Row="1"
Margin="0,70,0,0"
HorizontalAlignment="Center"
Orientation="Horizontal">
<TextBlock
FontSize="20"
Foreground="#FF0084FF"
Text="{Binding DeviceNum}" />

<TextBlock
FontSize="20"
Foreground="#FF0084FF"
Text=" 号仓" />
</StackPanel>

<Image
Grid.RowSpan="2"
Source="/BPASmartClient.CustomResource;component/Image/光柱.png"
Stretch="Fill" />

</Grid>
</Border>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
</Grid>
<!--#endregion-->

<Grid x:Name="gr" Grid.Row="1">
<pry:ConveyorBelt
Grid.Row="1"
Width="{Binding ElementName=gr, Path=ActualWidth}"
Height="{Binding ElementName=gr, Path=ActualHeight}"
Margin="10,0,400,0"
ConveyorBeltWidth="70"
Direction="0"
StrokeBrush="#00BEFA"
StrokeDashArray="1.5 1.5"
StrokeFillBrush="#00BEFA"
StrokeThickness="2" />
</Grid>

<!--#region 底部料仓-->
<Grid Grid.Row="2">
<ListView
VerticalAlignment="Center"
Background="Transparent"
BorderThickness="0"
ItemsSource="{Binding BottomDeviceCurrentStatuses}"
ScrollViewer.HorizontalScrollBarVisibility="Disabled">
<ListView.ItemsPanel>
<ItemsPanelTemplate>
<UniformGrid
HorizontalAlignment="Left"
VerticalAlignment="Top"
Columns="8"
Rows="1" />
</ItemsPanelTemplate>
</ListView.ItemsPanel>

<ListView.ItemTemplate>
<DataTemplate>
<Border Margin="5" Background="Transparent">
<Grid Height="220">
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>

<TextBlock
Margin="0,0,0,35"
HorizontalAlignment="Center"
VerticalAlignment="Bottom"
FontSize="25"
Foreground="#ffccd61f"
Text="{Binding DeviceName}" />

<StackPanel
Grid.Row="1"
Margin="0,25,0,0"
HorizontalAlignment="Center"
Orientation="Horizontal">
<TextBlock
FontSize="20"
Foreground="#FF0084FF"
Text="{Binding Weight}" />

<TextBlock
FontSize="20"
Foreground="#FF0084FF"
Text=" kg" />
</StackPanel>


<StackPanel
Grid.Row="1"
Margin="0,70,0,0"
HorizontalAlignment="Center"
Orientation="Horizontal">
<TextBlock
FontSize="20"
Foreground="#FF0084FF"
Text="{Binding DeviceNum}" />

<TextBlock
FontSize="20"
Foreground="#FF0084FF"
Text=" 号仓" />
</StackPanel>

<Image
Grid.RowSpan="2"
Source="/BPASmartClient.CustomResource;component/Image/光柱.png"
Stretch="Fill" />

</Grid>
</Border>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
</Grid>
<!--#endregion-->

</Grid>
</UserControl>

+ 28
- 0
BPASmartClient.DosingProject/View/HardwareStatusView.xaml.cs Zobrazit soubor

@@ -0,0 +1,28 @@
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 BPASmartClient.DosingHKProject.View
{
/// <summary>
/// HardwareStatusView.xaml 的交互逻辑
/// </summary>
public partial class HardwareStatusView : UserControl
{
public HardwareStatusView()
{
InitializeComponent();
}
}
}

+ 450
- 0
BPASmartClient.DosingProject/View/ManualControlView.xaml Zobrazit soubor

@@ -0,0 +1,450 @@
<UserControl
x:Class="BPASmartClient.DosingHKProject.View.ManualControlView"
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:local="clr-namespace:BPASmartClient.DosingHKProject.View"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:pry="clr-namespace:BPASmartClient.CustomResource.UserControls;assembly=BPASmartClient.CustomResource"
xmlns:vm="clr-namespace:BPASmartClient.DosingHKProject.ViewModel"
d:DesignHeight="850"
d:DesignWidth="1200"
mc:Ignorable="d">

<UserControl.Resources>
<Style x:Key="radioButtonStyle" TargetType="RadioButton">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="RadioButton">
<Grid Name="gr" Opacity="0.8">
<ContentControl
Margin="{TemplateBinding Margin}"
HorizontalAlignment="Center"
VerticalAlignment="Center"
HorizontalContentAlignment="Center"
VerticalContentAlignment="Center"
Content="{TemplateBinding Content}"
FontSize="{TemplateBinding FontSize}"
Foreground="{TemplateBinding Foreground}" />
<Image
Name="image"
Source="/BPASmartClient.CustomResource;component/Image/边框线.png"
Stretch="Fill" />

</Grid>
<ControlTemplate.Triggers>
<Trigger Property="IsChecked" Value="False">
<Setter TargetName="image" Property="Source" Value="/BPASmartClient.CustomResource;component/Image/边框线.png" />
</Trigger>
<Trigger Property="IsChecked" Value="True">
<Setter TargetName="image" Property="Source" Value="/BPASmartClient.CustomResource;component/Image/透明背景.png" />
</Trigger>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="gr" Property="Opacity" Value="1" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</UserControl.Resources>

<UserControl.DataContext>
<vm:ManualControlViewModel />
</UserControl.DataContext>

<Grid Margin="8">
<Grid.RowDefinitions>
<RowDefinition Height="3*"/>
<RowDefinition Height="3*"/>
<RowDefinition Height="3*"/>
<!--<RowDefinition Height="2*"/>-->
</Grid.RowDefinitions>
<Grid
Name="jiu"
Grid.Row="0"
Margin="5">
<Grid.RowDefinitions>
<RowDefinition Height="20" />
<RowDefinition />
</Grid.RowDefinitions>
<pry:ImageBorder
Grid.RowSpan="2"
Width="{Binding ElementName=tp, Path=ActualWidth}"
Height="{Binding ElementName=tp, Path=ActualHeight}" />

<Image
Margin="2,3,0,0"
HorizontalAlignment="Left"
Source="/BPASmartClient.CustomResource;component/Image/标签.png" />
<TextBlock
Margin="10,0,0,0"
VerticalAlignment="Center"
FontSize="16"
Foreground="Aqua"
Text="总控制" />
<Grid Grid.Row="1">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*"></ColumnDefinition>
<ColumnDefinition Width="1*"></ColumnDefinition>
<ColumnDefinition Width="1*"></ColumnDefinition>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
</Grid.RowDefinitions>
<pry:IcoButton
Grid.Row="0"
Grid.Column="0"
Margin="20"
Command="{Binding StartCommand}"
Content="启动"
FontSize="32"
Foreground="Aqua"
Style="{StaticResource IcoButtonStyle}" />
<pry:IcoButton
Grid.Row="1"
Margin="20"
Command="{Binding CloseCommand}"
Content="停止"
FontSize="32"
Foreground="Aqua"
Style="{StaticResource IcoButtonStyle}" />
<pry:IcoButton
Grid.Row="0"
Grid.Column="1"
Margin="20"
Command="{Binding StartCommand}"
Content="暂停"
FontSize="32"
Foreground="Aqua"
Style="{StaticResource IcoButtonStyle}" />
<pry:IcoButton
Grid.Row="1"
Grid.Column="1"
Margin="20"
Command="{Binding StartCommand}"
Content="恢复"
FontSize="32"
Foreground="Aqua"
Style="{StaticResource IcoButtonStyle}" />
</Grid>
</Grid>

<!--#region 升降气缸-->
<Grid
Name="cy"
Grid.Row="1"
Margin="5">
<Grid.RowDefinitions>
<RowDefinition Height="40" />
<RowDefinition />
</Grid.RowDefinitions>
<pry:ImageBorder
Grid.RowSpan="2"
Width="{Binding ElementName=cy, Path=ActualWidth}"
Height="{Binding ElementName=cy, Path=ActualHeight}" />

<Image
Margin="2,3,0,0"
HorizontalAlignment="Left"
Source="/BPASmartClient.CustomResource;component/Image/标签.png" />
<TextBlock
Margin="10,0,0,0"
VerticalAlignment="Center"
FontSize="16"
Foreground="Aqua"
Text="升降气缸控制" />
<ListView
Grid.Row="1"
Background="Transparent"
BorderBrush="#00BEFA"
BorderThickness="0"
ItemsSource="{Binding cylinderModels}"
ScrollViewer.HorizontalScrollBarVisibility="Disabled">
<ListView.ItemsPanel>
<ItemsPanelTemplate>
<UniformGrid
HorizontalAlignment="Left"
VerticalAlignment="Top"
Columns="8" />
</ItemsPanelTemplate>
</ListView.ItemsPanel>

<ListView.ItemTemplate>
<DataTemplate>
<Grid
Width="200"
Height="100"
Margin="0,0,0,15"
Background="Transparent">
<Grid.RowDefinitions>
<RowDefinition Height="30" />
<RowDefinition />
<RowDefinition Height="30" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="0.5*" />
<ColumnDefinition />
<ColumnDefinition />
</Grid.ColumnDefinitions>

<TextBlock
Grid.Column="1"
Grid.ColumnSpan="2"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Foreground="Aqua"
Text="{Binding Name}" />

<pry:Cylinder
Grid.Row="1"
Grid.ColumnSpan="3"
Width="200"
Height="50"
HorizontalAlignment="Center"
VerticalAlignment="Center"
LeftTogIsChecked="{Binding LeftTog}"
RightTogIsChecked="{Binding RightTog}" />

<RadioButton
Grid.Row="2"
Grid.Column="1"
Command="{Binding DataContext.Open, RelativeSource={RelativeSource AncestorType=ListView, Mode=FindAncestor}}"
CommandParameter="{Binding Name}"
Content="伸出"
Foreground="Aqua"
IsChecked="True"
Style="{StaticResource radioButtonStyle}" />

<RadioButton
Grid.Row="2"
Grid.Column="2"
Command="{Binding DataContext.Close, RelativeSource={RelativeSource AncestorType=ListView, Mode=FindAncestor}}"
CommandParameter="{Binding Name}"
Content="缩回"
Foreground="Aqua"
IsChecked="False"
Style="{StaticResource radioButtonStyle}" />
</Grid>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
</Grid>
<!--#endregion-->

<!--#region 阻挡气缸-->
<!--<Grid
Name="zd"
Grid.Row="2"
Margin="5">
<Grid.RowDefinitions>
<RowDefinition Height="40" />
<RowDefinition />
</Grid.RowDefinitions>
<pry:ImageBorder
Grid.RowSpan="2"
Width="{Binding ElementName=zd, Path=ActualWidth}"
Height="{Binding ElementName=zd, Path=ActualHeight}" />

<Image
Margin="2,3,0,0"
HorizontalAlignment="Left"
Source="/BPASmartClient.CustomResource;component/Image/标签.png" />
<TextBlock
Margin="10,0,0,0"
VerticalAlignment="Center"
FontSize="16"
Foreground="Aqua"
Text="阻挡气缸控制" />
<ListView
Grid.Row="1"
Margin="10"
Background="Transparent"
BorderBrush="#00BEFA"
BorderThickness="0"
ItemsSource="{Binding BlockCylinders}"
ScrollViewer.HorizontalScrollBarVisibility="Disabled">
<ListView.ItemsPanel>
<ItemsPanelTemplate>
<UniformGrid
HorizontalAlignment="Left"
VerticalAlignment="Top"
Columns="8" />
</ItemsPanelTemplate>
</ListView.ItemsPanel>

<ListView.ItemTemplate>
<DataTemplate>
<Grid
Width="200"
Height="100"
Margin="0,0,0,15"
Background="Transparent">
<Grid.RowDefinitions>
<RowDefinition Height="30" />
<RowDefinition />
<RowDefinition Height="30" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="0.5*" />
<ColumnDefinition />
<ColumnDefinition />
</Grid.ColumnDefinitions>

<TextBlock
Grid.Column="1"
Grid.ColumnSpan="2"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Foreground="Aqua"
Text="{Binding Name}" />

<pry:Cylinder
Grid.Row="1"
Grid.ColumnSpan="3"
Width="200"
Height="50"
HorizontalAlignment="Center"
VerticalAlignment="Center"
LeftTogIsChecked="{Binding LeftTog}"
RightTogIsChecked="{Binding RightTog}" />

<RadioButton
Grid.Row="2"
Grid.Column="1"
Command="{Binding DataContext.Open, RelativeSource={RelativeSource AncestorType=ListView, Mode=FindAncestor}}"
CommandParameter="{Binding Name}"
Content="伸出"
Foreground="Aqua"
IsChecked="True"
Style="{StaticResource radioButtonStyle}" />
<RadioButton
Grid.Row="2"
Grid.Column="2"
Command="{Binding DataContext.Close, RelativeSource={RelativeSource AncestorType=ListView, Mode=FindAncestor}}"
CommandParameter="{Binding Name}"
Content="缩回"
Foreground="Aqua"
IsChecked="False"
Style="{StaticResource radioButtonStyle}" />
</Grid>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
</Grid>-->
<!--#endregion-->

<!--#region 托盘气缸-->
<Grid
Name="tp"
Grid.Row="2"
Margin="5">
<Grid.RowDefinitions>
<RowDefinition Height="40" />
<RowDefinition />
</Grid.RowDefinitions>
<pry:ImageBorder
Grid.RowSpan="2"
Width="{Binding ElementName=tp, Path=ActualWidth}"
Height="{Binding ElementName=tp, Path=ActualHeight}" />

<Image
Margin="2,3,0,0"
HorizontalAlignment="Left"
Source="/BPASmartClient.CustomResource;component/Image/标签.png" />
<TextBlock
Margin="10,0,0,0"
VerticalAlignment="Center"
FontSize="16"
Foreground="Aqua"
Text="其他气缸控制" />
<ListView
Grid.Row="2"
Margin="10"
Background="Transparent"
BorderBrush="#00BEFA"
BorderThickness="0"
ItemsSource="{Binding PalletCylinders}"
ScrollViewer.HorizontalScrollBarVisibility="Disabled">
<ListView.ItemsPanel>
<ItemsPanelTemplate>
<UniformGrid
HorizontalAlignment="Left"
VerticalAlignment="Top"
Columns="8" />
</ItemsPanelTemplate>
</ListView.ItemsPanel>

<ListView.ItemTemplate>
<DataTemplate>
<Grid
Width="200"
Height="100"
Margin="0,0,0,15"
Background="Transparent">
<Grid.RowDefinitions>
<RowDefinition Height="30" />
<RowDefinition />
<RowDefinition Height="30" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="0.5*" />
<ColumnDefinition />
<ColumnDefinition />
</Grid.ColumnDefinitions>

<TextBlock
Grid.Column="1"
Grid.ColumnSpan="2"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Foreground="Aqua"
Text="{Binding Name}" />

<pry:Cylinder
Grid.Row="1"
Grid.ColumnSpan="3"
Width="200"
Height="50"
HorizontalAlignment="Center"
VerticalAlignment="Center"
LeftTogIsChecked="{Binding LeftTog}"
RightTogIsChecked="{Binding RightTog}" />

<RadioButton
Grid.Row="2"
Grid.Column="1"
Command="{Binding DataContext.Open, RelativeSource={RelativeSource AncestorType=ListView, Mode=FindAncestor}}"
CommandParameter="{Binding Name}"
Content="伸出"
Foreground="Aqua"
IsChecked="True"
Style="{StaticResource radioButtonStyle}" />

<RadioButton
Grid.Row="2"
Grid.Column="2"
Command="{Binding DataContext.Close, RelativeSource={RelativeSource AncestorType=ListView, Mode=FindAncestor}}"
CommandParameter="{Binding Name}"
Content="缩回"
Foreground="Aqua"
IsChecked="False"
Style="{StaticResource radioButtonStyle}" />
</Grid>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
</Grid>
<!--#endregion-->








</Grid>
</UserControl>

+ 28
- 0
BPASmartClient.DosingProject/View/ManualControlView.xaml.cs Zobrazit soubor

@@ -0,0 +1,28 @@
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 BPASmartClient.DosingHKProject.View
{
/// <summary>
/// ManualControlView.xaml 的交互逻辑
/// </summary>
public partial class ManualControlView : UserControl
{
public ManualControlView()
{
InitializeComponent();
}
}
}

+ 236
- 0
BPASmartClient.DosingProject/View/NewLocalRecipeView.xaml Zobrazit soubor

@@ -0,0 +1,236 @@
<Window
x:Class="BPASmartClient.DosingHKProject.View.NewLocalRecipeView"
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:local="clr-namespace:BPASmartClient.DosingHKProject.View"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:vm="clr-namespace:BPASmartClient.DosingHKProject.ViewModel"
Title="NewRemoteRecipeView"
Width="700"
Height="520"
AllowsTransparency="True"
Background="{x:Null}"
Topmost="True"
WindowStartupLocation="CenterScreen"
WindowStyle="None"
mc:Ignorable="d">

<Window.DataContext>
<vm:NewLocalRecipeViewModel />
</Window.DataContext>

<Window.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="/BPASmartClient.CustomResource;component/Themes/GenricStyle.xaml" />
<ResourceDictionary Source="/BPASmartClient.CustomResource;component/Themes/MyStyle.xaml" />

<ResourceDictionary>
<!--#region ListBox样式-->
<Style x:Key="ListBoxItemStyle1" TargetType="{x:Type ListBoxItem}">
<Setter Property="OverridesDefaultStyle" Value="True" />
<Setter Property="SnapsToDevicePixels" Value="True" />
<Setter Property="BorderBrush" Value="{x:Null}" />
<Setter Property="Foreground" Value="White" />
<Setter Property="FontSize" Value="20" />
<Setter Property="HorizontalContentAlignment" Value="Center" />
<Setter Property="VerticalContentAlignment" Value="Center" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ListBoxItem}">
<Border x:Name="border" CornerRadius="8">
<ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" />
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!--#endregion-->
</ResourceDictionary>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Window.Resources>

<Border
Name="br"
BorderBrush="#0CADF5"
BorderThickness="2">
<Border.Background>
<ImageBrush ImageSource="/BPASmartClient.CustomResource;component/Image/bg.png" />
<!--<ImageBrush ImageSource="/BPASmartClient.CustomResource;component/Image/弹窗2.png" />-->
</Border.Background>
<Grid Margin="10">
<Grid.RowDefinitions>
<RowDefinition Height="40" />
<RowDefinition Height="40" />
<RowDefinition Height="40" />
<RowDefinition />
</Grid.RowDefinitions>
<Grid Grid.Row="0">
<Grid.ColumnDefinitions>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
</Grid.ColumnDefinitions>
<StackPanel VerticalAlignment="Center" Grid.Column="0" Orientation="Horizontal">
<TextBlock
Width="100"
Margin="10,0,10,0"
Background="Transparent"
FontSize="20"
Foreground="#FF2AB2E7"
Text="配方名称:" />
<TextBox
Width="120"
Height="30"
FontSize="16"
Text="{Binding RecipeName}" />
</StackPanel>
<WrapPanel VerticalAlignment="Center" Grid.Column="1">
</WrapPanel>
</Grid>
<Grid Grid.Row="1">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*" />
<ColumnDefinition Width="1*" />
</Grid.ColumnDefinitions>
<WrapPanel VerticalAlignment="Center" Grid.Column="0">
<TextBlock
Width="100"
Margin="10,0,10,0"
Background="Transparent"
FontSize="20"
Foreground="#FF2AB2E7"
Text="配方编码:" />
<TextBox
Width="120"
Height="30"
FontSize="16"
Text="{Binding RecipeCode}" />
</WrapPanel>
<WrapPanel HorizontalAlignment="Right" Orientation="Horizontal" Grid.Column="1">
<Button
Width="100"
Height="40"
Margin="5,0,5,0"
Command="{Binding AddCommand}"
Content="添加原料"
FontSize="20"
Style="{StaticResource ImageButtonStyle}" />
<Button
Width="100"
Height="40"
Margin="5,0,10,0"
Command="{Binding SaveCommand}"
Content="保存配方"
FontSize="20"
Style="{StaticResource ImageButtonStyle}" />
<Button
Name ="Close"
Width="100"
Height="40"
Margin="5,0,5,0"
Content="取消"
FontSize="20"
Style="{StaticResource ImageButtonStyle}" />
</WrapPanel>
</Grid>


<!--#region 表格标题栏设置-->
<Grid
Grid.Row="2"
Margin="0,10,0,0"
Background="#ff0C255F">

<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
</Grid.ColumnDefinitions>
<Grid Grid.Column="0">
<TextBlock Text="原料名称" HorizontalAlignment="Center" />
<Border BorderThickness="1,0,1,0" Cursor="SizeWE" />
</Grid>
<TextBlock Grid.Column="1" Text="原料位置" HorizontalAlignment="Center" />
<Grid Grid.Column="2">
<TextBlock Text="原料桶号" HorizontalAlignment="Center" />
<Border BorderThickness="1,0,1,0" Cursor="SizeWE" />
</Grid>
<TextBlock Grid.Column="3" Text="原料重量" HorizontalAlignment="Center" />
<Grid Grid.Column="4">
<TextBlock Text="功能操作" HorizontalAlignment="Center" />
<Border BorderThickness="1,0,1,0" Cursor="SizeWE" />
</Grid>
<Border Grid.ColumnSpan="10" BorderThickness="1,0,1,0" />
</Grid>
<Grid Grid.Row="3">
<ScrollViewer HorizontalScrollBarVisibility="Hidden" VerticalScrollBarVisibility="Hidden">
<ItemsControl ItemsSource="{Binding RawMaterial}">
<ItemsControl.ItemTemplate>
<DataTemplate>
<Grid Name="gr">
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<Grid Grid.Column="0">
<TextBox
Text="{Binding RawMaterialName}" />
<Border
BorderThickness="1,0,1,0"
Cursor="SizeWE" />
</Grid>
<TextBox
Grid.Column="1"
Text="{Binding RawMaterialLocation }" />

<Grid Grid.Column="2">
<TextBox
Text="{Binding RawMaterialBarrelNum}" />
<Border
BorderThickness="1,0,1,0"
Cursor="SizeWE" />
</Grid>

<TextBox
Grid.Column="3"
Text="{Binding RawMaterialWeight}" />

<Grid Grid.Column="4">
<Button
Command="{Binding DataContext.RemoveCommand, RelativeSource={RelativeSource AncestorType=ItemsControl, Mode=FindAncestor}}"
CommandParameter="{Binding RawMaterialLocation}"
Content="删除"
FontSize="16" />
<Border
BorderThickness="1,0,1,0"
Cursor="SizeWE" />
</Grid>

<Border
Grid.ColumnSpan="10"
BorderThickness="1,0,1,1" />

</Grid>
<DataTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="true">
<Setter TargetName="gr" Property="Background" Value="#112AB2E7" />
</Trigger>
</DataTemplate.Triggers>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</ScrollViewer>
</Grid>


</Grid>
</Border>
</Window>

+ 33
- 0
BPASmartClient.DosingProject/View/NewLocalRecipeView.xaml.cs Zobrazit soubor

@@ -0,0 +1,33 @@
using BPASmartClient.Helper;
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 BPASmartClient.DosingHKProject.View
{
/// <summary>
/// DeviceMaterialParView.xaml 的交互逻辑
/// </summary>
public partial class NewLocalRecipeView : Window
{
public NewLocalRecipeView()
{
InitializeComponent();
this.Close.Click += (o, e) => { this.Close(); };
this.br.MouseLeftButtonDown += (o, e) => { if (e.LeftButton == MouseButtonState.Pressed) this.DragMove(); };
ActionManage.GetInstance.CancelRegister("CloseNewRemoteRecipeView");
ActionManage.GetInstance.Register(new Action(() => { this.Close(); }), "CloseNewRemoteRecipeView");
}
}
}

+ 175
- 0
BPASmartClient.DosingProject/View/NewMaterialView.xaml Zobrazit soubor

@@ -0,0 +1,175 @@
<Window
x:Class="BPASmartClient.DosingHKProject.View.NewMaterialView"
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:local="clr-namespace:BPASmartClient.DosingHKProject.View"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:vm="clr-namespace:BPASmartClient.DosingHKProject.ViewModel"
Title="NewMateritalView"
Width="600"
Height="600"
AllowsTransparency="True"
Background="{x:Null}"
Topmost="True"
WindowStartupLocation="CenterScreen"
WindowStyle="None"
mc:Ignorable="d">
<Window.DataContext>
<vm:NewMaterialViewModel />
</Window.DataContext>
<Window.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="/BPASmartClient.CustomResource;component/Themes/GenricStyle.xaml" />
<ResourceDictionary Source="/BPASmartClient.CustomResource;component/Themes/MyStyle.xaml" />

<ResourceDictionary>

<!--#region ListBox样式-->
<Style x:Key="ListBoxItemStyle1" TargetType="{x:Type ListBoxItem}">
<Setter Property="OverridesDefaultStyle" Value="True" />
<Setter Property="SnapsToDevicePixels" Value="True" />
<Setter Property="BorderBrush" Value="{x:Null}" />
<Setter Property="Foreground" Value="White" />
<Setter Property="FontSize" Value="20" />
<Setter Property="HorizontalContentAlignment" Value="Center" />
<Setter Property="VerticalContentAlignment" Value="Center" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ListBoxItem}">
<Border x:Name="border" CornerRadius="8">
<ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" />
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!--#endregion-->
</ResourceDictionary>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Window.Resources>

<Border Name="br" BorderThickness="1">
<Border.Background>
<ImageBrush ImageSource="/BPASmartClient.CustomResource;component/Image/bg.png" />
</Border.Background>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="5" />
<RowDefinition Height="*" />
<RowDefinition Height="40" />
<RowDefinition Height="5" />
<RowDefinition Height="5*" />
</Grid.RowDefinitions>
<StackPanel
Grid.Row="1"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Orientation="Horizontal">
<TextBlock
Margin="10,0,0,0"
Background="Transparent"
FontSize="20"
Foreground="#FF2AB2E7"
Text="请输入原料名称:" />



<TextBox
Grid.Column="1"
Width="200"
Height="30"
Margin="10"
FontSize="16"
Text="{Binding MaterialName}" />

<Button
Width="80"
Height="30"
Margin="10"
Command="{Binding SaveCommand}"
Content="保存"
Cursor="Hand" />
<Button
Name="btClose"
Width="80"
Height="30"
Margin="10"
Click="btClose_Click"
Content="取消" />

</StackPanel>
<TextBlock
Grid.Row="2"
Margin="0,0,5,0"
HorizontalAlignment="Center"
Background="Transparent"
FontSize="16"
Foreground="Red"
Text="{Binding ErrorInfo}" />
<Grid Grid.Row="4">
<Grid.RowDefinitions>
<RowDefinition Height="40" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<TextBlock
HorizontalAlignment="Center"
FontSize="25"
Foreground="#FF2AB2E7"
Text="本地原料" />
<Border
Grid.Row="1"
Margin="100,10"
BorderBrush="#FF2AB2E7"
BorderThickness="1">
<ScrollViewer
Grid.Row="1"
BorderBrush="#FF2AB2E7"
BorderThickness="1">
<ItemsControl Margin="10" ItemsSource="{Binding Materials}">
<ItemsControl.ItemTemplate>
<DataTemplate>
<RadioButton GroupName="all">
<RadioButton.Template>
<ControlTemplate TargetType="RadioButton">
<Grid Name="gr" Height="40">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="2*" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<TextBlock
Name="tb"
Grid.Column="0"
Width="150"
Height="29"
Margin="3,1"
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="20"
Text="{Binding RawMaterialName}" />

<Button
Grid.Column="1"
Margin="10,0,10,0"
Command="{Binding DataContext.RemoveCommand, RelativeSource={RelativeSource AncestorType=ItemsControl, Mode=FindAncestor}}"
CommandParameter="{Binding RawMaterialId}"
Content="删除" />
</Grid>


</ControlTemplate>
</RadioButton.Template>
</RadioButton>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</ScrollViewer>
</Border>
</Grid>

</Grid>

</Border>
</Window>

+ 35
- 0
BPASmartClient.DosingProject/View/NewMaterialView.xaml.cs Zobrazit soubor

@@ -0,0 +1,35 @@
using BPASmartClient.Helper;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;

namespace BPASmartClient.DosingHKProject.View
{
/// <summary>
/// NewMateritalView.xaml 的交互逻辑
/// </summary>
public partial class NewMaterialView : Window
{
public NewMaterialView()
{
InitializeComponent();
this.btClose.Click += (o, e) => { this.Close(); };
this.br.MouseLeftButtonDown += (o, e) => { if (e.LeftButton == MouseButtonState.Pressed) this.DragMove(); };
}

private void btClose_Click(object sender, RoutedEventArgs e)
{
this.Close();
}
}
}

+ 238
- 0
BPASmartClient.DosingProject/View/NewRecipeView.xaml Zobrazit soubor

@@ -0,0 +1,238 @@
<Window
x:Class="BPASmartClient.DosingHKProject.View.NewRecipeView"
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:local="clr-namespace:BPASmartClient.DosingHKProject.View"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:vm="clr-namespace:BPASmartClient.DosingHKProject.ViewModel"
Title="NewRecipeView"
Width="550"
Height="450"
AllowsTransparency="True"
Background="{x:Null}"
Topmost="True"
WindowStartupLocation="CenterScreen"
WindowStyle="None"
mc:Ignorable="d">

<Window.DataContext>
<vm:NewRecipeViewModel />
</Window.DataContext>

<Window.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="/BPASmartClient.CustomResource;component/Themes/GenricStyle.xaml" />
<ResourceDictionary Source="/BPASmartClient.CustomResource;component/Themes/MyStyle.xaml" />

<ResourceDictionary>
<!--#region ListBox样式-->
<Style x:Key="ListBoxItemStyle1" TargetType="{x:Type ListBoxItem}">
<Setter Property="OverridesDefaultStyle" Value="True" />
<Setter Property="SnapsToDevicePixels" Value="True" />
<Setter Property="BorderBrush" Value="{x:Null}" />
<Setter Property="Foreground" Value="White" />
<Setter Property="FontSize" Value="20" />
<Setter Property="HorizontalContentAlignment" Value="Center" />
<Setter Property="VerticalContentAlignment" Value="Center" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ListBoxItem}">
<Border x:Name="border" CornerRadius="8">
<ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" />
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!--#endregion-->
</ResourceDictionary>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Window.Resources>

<Border
Name="br"
BorderBrush="#0CADF5"
BorderThickness="2">
<Border.Background>
<ImageBrush ImageSource="/BPASmartClient.CustomResource;component/Image/bg.png" />
<!--<ImageBrush ImageSource="/BPASmartClient.CustomResource;component/Image/弹窗2.png" />-->
</Border.Background>
<Grid>

<!--<Grid.Background>
<ImageBrush ImageSource="/BPASmartClient.CustomResource;component/Image/弹窗.png" />
</Grid.Background>-->

<Grid.RowDefinitions>
<RowDefinition Height="5" />
<RowDefinition />
</Grid.RowDefinitions>

<!--<Button
Name="btClose"
Margin="0,0,5,0"
Padding="10,5"
HorizontalAlignment="Right"
VerticalAlignment="Center"
Background="Transparent"
BorderThickness="0"
Content="X"
FontSize="18"
Foreground="White" />

<Border BorderBrush="#88DDDDDD" BorderThickness="0,0,0,1" />-->

<Grid Grid.Row="1">
<Grid.RowDefinitions>
<RowDefinition Height="40" />
<RowDefinition Height="40" />
<RowDefinition />
</Grid.RowDefinitions>

<TextBlock
Margin="10,0,0,0"
Background="Transparent"
FontSize="20"
Foreground="#FF2AB2E7"
Text="请输入配方名称:" />

<TextBlock
Margin="0,0,10,0"
HorizontalAlignment="Right"
Background="Transparent"
FontSize="16"
Foreground="Red"
Text="{Binding ErrorInfo}" />

<StackPanel
Grid.Row="1"
Margin="10,0,0,0"
Orientation="Horizontal">

<TextBox
Grid.Column="1"
Width="200"
Height="30"
Margin="0,0,7,0"
FontSize="16"
Text="{Binding RecipeName}" />

<Button
Width="148"
Height="30"
Margin="0,0,7,0"
Command="{Binding AddCommand}"
Content="添加原料"
Cursor="Hand" />

<Button
Width="80"
Height="30"
Command="{Binding SaveCommand}"
Content="确认" />

<Button
Name="btClose"
Width="80"
Height="30"
Margin="7,0,0,0"
Content="取消" />

</StackPanel>

<ScrollViewer
Grid.Row="2"
Margin="5"
HorizontalScrollBarVisibility="Hidden"
VerticalScrollBarVisibility="Hidden">
<ItemsControl ItemsSource="{Binding RawMaterials}">
<ItemsControl.ItemTemplate>
<DataTemplate>
<RadioButton GroupName="all">
<RadioButton.Template>
<ControlTemplate TargetType="RadioButton">
<Grid Name="gr" Height="40">
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition Width="0.5*" />
</Grid.ColumnDefinitions>

<ComboBox
Name="cb"
Grid.Column="0"
Margin="3,1"
VerticalAlignment="Center"
BorderBrush="#FF074B92"
BorderThickness="1"
FontFamily="楷体"
FontSize="20"
Foreground="#FF2AB2E7"
IsEditable="False"
ItemsSource="{Binding DataContext.RawMaterialNames, RelativeSource={RelativeSource AncestorType=ItemsControl, Mode=FindAncestor}}"
SelectedIndex="0"
Style="{StaticResource ComboBoxStyle}"
Text="{Binding RawMaterialName}" />

<!--<TextBox
Name="cb"
Grid.Column="0"
Margin="3,1"
VerticalAlignment="Center"
BorderBrush="#FF074B92"
BorderThickness="1"
FontFamily="楷体"
FontSize="20"
Foreground="#FF2AB2E7"
Text="{Binding RawMaterialName}" />-->
<StackPanel
Grid.Column="1"
VerticalAlignment="Center"
Orientation="Horizontal">
<TextBox
Name="tb"
Grid.Column="1"
Width="150"
Height="29"
Margin="3,1"
VerticalAlignment="Center"
FontSize="20"
Text="{Binding RawMaterialWeight}" />

<TextBlock
Grid.Column="1"
Margin="0,0,8,4"
HorizontalAlignment="Right"
VerticalAlignment="Center"
FontSize="20"
Text="g" />

</StackPanel>

<Button
Grid.Column="2"
Width="80"
Margin="25,0,0,0"
Command="{Binding DataContext.RemoveCommand, RelativeSource={RelativeSource AncestorType=ItemsControl, Mode=FindAncestor}}"
CommandParameter="{Binding RawMaterialId}"
Content="删除" />

</Grid>


</ControlTemplate>
</RadioButton.Template>
</RadioButton>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</ScrollViewer>

</Grid>

</Grid>
</Border>
</Window>

Některé soubory nejsou zobrazny, neboť je v této revizi změněno mnoho souborů

Načítá se…
Zrušit
Uložit