pry il y a 2 ans
Parent
révision
80e862d83d
18 fichiers modifiés avec 409 ajouts et 90 suppressions
  1. +2
    -2
      BPASmartClient.AgvApi/Controllers/robotjobController.cs
  2. +1
    -0
      BPASmartClient.Compiler/BPASmartClient.Compiler.csproj
  3. +59
    -15
      BPASmartClient.Compiler/CSharpConfig.cs
  4. +1
    -1
      BPASmartClient.CustomResource/UserControls/MessageShow/Notifiaction.xaml.cs
  5. +8
    -2
      BPASmartClient.DATABUS/Class_DataBus.cs
  6. +51
    -13
      BPASmartClient.SCADAControl/CustomerControls/TheAPI.xaml.cs
  7. +125
    -26
      BPASmartClient.SCADAControl/CustomerControls/TheDataGrid.xaml.cs
  8. +33
    -14
      BPASmartClient.SCADAControl/Themes/Generic.xaml
  9. +1
    -0
      BeDesignerSCADA/Controls/MainCanvasPanel.xaml
  10. +2
    -4
      BeDesignerSCADA/Controls/MainCanvasPanel.xaml.cs
  11. +2
    -0
      BeDesignerSCADA/MainWindow.xaml
  12. +84
    -0
      BeDesignerSCADA/ViewModel/DataBusModel.cs
  13. +24
    -0
      BeDesignerSCADA/ViewModel/MainViewModelNew.cs
  14. +1
    -1
      DosingSystem/Model/DeviceInquire.cs
  15. +1
    -1
      FryPot_DosingSystem/App.xaml.cs
  16. +10
    -10
      FryPot_DosingSystem/Control/DosingLogicControl.cs
  17. +1
    -1
      FryPot_DosingSystem/View/AgvView.xaml
  18. +3
    -0
      FryPot_DosingSystem/ViewModel/NewRecipeViewModel.cs

+ 2
- 2
BPASmartClient.AgvApi/Controllers/robotjobController.cs Voir le fichier

@@ -31,7 +31,7 @@ namespace BPASmartClient.AgvApi.Controllers
AGVToUpSystem s = JsonConvert.DeserializeObject<AGVToUpSystem>(body);
if (s != null)
{
Factory.GetInstance.SendReport(s);
await Factory.GetInstance.SendReport(s);
return "SUCCESS";
}

@@ -70,7 +70,7 @@ namespace BPASmartClient.AgvApi.Controllers
var res = JsonConvert.DeserializeObject<Upstreamrequest>(body);
if (res != null)
{
Factory.GetInstance.SendUpstreamrequest(res);
await Factory.GetInstance.SendUpstreamrequest(res);
return "SUCCESS";
}
}


+ 1
- 0
BPASmartClient.Compiler/BPASmartClient.Compiler.csproj Voir le fichier

@@ -13,6 +13,7 @@
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
<PackageReference Include="ServiceStack.Redis" Version="6.3.0" />
<PackageReference Include="StackExchange.Redis" Version="2.6.66" />
<PackageReference Include="Vse.Web.Serialization.ControlledSerializationJsonConverter" Version="1.0.4" />
</ItemGroup>

<ItemGroup>


+ 59
- 15
BPASmartClient.Compiler/CSharpConfig.cs Voir le fichier

@@ -9,6 +9,10 @@ using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using System.Runtime;
using System.Runtime.CompilerServices;

namespace BPASmartClient.Compiler
{
@@ -36,6 +40,8 @@ namespace BPASmartClient.Compiler

}



public object RunCSharp(string code,object[] objValue,string error = "")
{
object strretu = string.Empty;
@@ -43,23 +49,63 @@ namespace BPASmartClient.Compiler
{
string funName = "main";
StringBuilder builder = new StringBuilder();
//builder.Append("using System;\n");
//builder.Append("using System.Linq;\n");
builder.Append("using Newtonsoft.Json;\n");
builder.Append("using Newtonsoft.Json.Linq;\n");
//builder.Append("using System.IO;\n");
//builder.Append("using System.Runtime;\n");
//builder.Append("using System.Text;\n");
builder.Append("using System.Collections.Generic;\n");
builder.Append("namespace YF \n{\n class CSharpConfigRun\n");
builder.Append(" {\n");
builder.Append(code);
builder.Append(" }\n}\n");



//1.添加要引用的程序集
string output = Path.GetTempFileName();
string assemblyName = Path.GetFileName(output);
var refPaths = new[] {
Assembly.GetExecutingAssembly().Location,
typeof(object).GetTypeInfo().Assembly.Location,
Path.Combine(Path.GetDirectoryName(typeof(System.Runtime.GCSettings).GetTypeInfo().Assembly.Location), "System.dll"),
Path.Combine(Path.GetDirectoryName(typeof(System.Runtime.GCSettings).GetTypeInfo().Assembly.Location), "System.Collections.dll"),
Path.Combine(Path.GetDirectoryName(typeof(System.Runtime.GCSettings).GetTypeInfo().Assembly.Location), "System.Threading.dll"),
Path.Combine(Path.GetDirectoryName(typeof(System.Runtime.GCSettings).GetTypeInfo().Assembly.Location), "System.Runtime.dll"),
Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "Newtonsoft.Json.dll"),
typeof(DynamicAttribute).GetTypeInfo().Assembly.Location,
};
MetadataReference[] references = refPaths.Select(r => MetadataReference.CreateFromFile(r)).ToArray();

List<MetadataReference> refs = new List<MetadataReference>() {
MetadataReference.CreateFromFile (typeof (object).Assembly.Location),
MetadataReference.CreateFromFile (typeof (List<int>).Assembly.Location),
MetadataReference.CreateFromFile (typeof (ASCIIEncoding).Assembly.Location),
MetadataReference.CreateFromFile (typeof (JsonConvert).Assembly.Location),
MetadataReference.CreateFromFile (typeof (JObject).Assembly.Location),
MetadataReference.CreateFromFile (typeof (Object).Assembly.Location),
MetadataReference.CreateFromFile (typeof (JContainer).Assembly.Location),
MetadataReference.CreateFromFile (typeof (JToken).Assembly.Location),
MetadataReference.CreateFromFile (typeof (Enumerable).Assembly.Location),
};
//2.需要编辑的C#代码
SyntaxTree tree = CSharpSyntaxTree.ParseText(builder.ToString());
var compilation =
CSharpCompilation.Create("YF")
.AddReferences(
MetadataReference.CreateFromFile(
typeof(object).Assembly.Location)
)
.AddSyntaxTrees(tree)
.WithOptions(new CSharpCompilationOptions(OutputKind.DynamicallyLinkedLibrary));

//3.生成C#编译
var compilation = CSharpCompilation.Create(Guid.NewGuid().ToString() + ".dll")
.WithOptions(new CSharpCompilationOptions(
Microsoft.CodeAnalysis.OutputKind.DynamicallyLinkedLibrary
,
usings: null,
optimizationLevel: OptimizationLevel.Debug, // TODO
checkOverflow: false, // TODO
allowUnsafe: true, // TODO
platform: Platform.AnyCpu,
warningLevel: 4,
xmlReferenceResolver: null
))
.AddReferences(references)
.AddSyntaxTrees(tree);

//var emitResult = compilation.Emit(output);
EmitResult emitResult;
byte[] dllBytes;
using (var stream = new MemoryStream())
@@ -67,15 +113,13 @@ namespace BPASmartClient.Compiler
emitResult = compilation.Emit(stream);
dllBytes = stream.ToArray();
}

if (emitResult.Success)
{

// Assembly assembly = Assembly.LoadFrom("d:\\test.dll");
Assembly assembly = Assembly.Load(dllBytes);
var obj = assembly.CreateInstance("YF.CSharpConfigRun");
var method = obj.GetType().GetMethod("main",new Type[] { typeof(string) });
strretu = method.Invoke(obj,objValue);
}




+ 1
- 1
BPASmartClient.CustomResource/UserControls/MessageShow/Notifiaction.xaml.cs Voir le fichier

@@ -23,7 +23,7 @@ namespace BPASmartClient.CustomResource.UserControls
/// </summary>
public partial class Notifiaction :Window
{
private const byte MAX_NOTIFICATIONS = 3;
private const byte MAX_NOTIFICATIONS = 10;
private readonly ObservableCollection<NotifiactionModel> buffer = new ObservableCollection<NotifiactionModel>();
private ObservableCollection<NotifiactionModel> NotifiactionList = new ObservableCollection<NotifiactionModel>();
private const double topOffset = 40;


+ 8
- 2
BPASmartClient.DATABUS/Class_DataBus.cs Voir le fichier

@@ -32,7 +32,14 @@ namespace BPASmartClient.DATABUS
/// <summary>
/// API数据
/// </summary>
public ConcurrentDictionary<string,string> Dic_APIData = new ConcurrentDictionary<string,string>();
public ConcurrentDictionary<string,string> Dic_APIData = new ConcurrentDictionary<string,string>();
#endregion

#region 配置数据


//Json<CommunicationPar>.Read();
#endregion
}

@@ -42,7 +49,6 @@ namespace BPASmartClient.DATABUS
public string VarName { get; set; }
public string VarVaule { get; set; }
public string DataType { get; set; }

}

}

+ 51
- 13
BPASmartClient.SCADAControl/CustomerControls/TheAPI.xaml.cs Voir le fichier

@@ -4,8 +4,10 @@ using BPASmartClient.DATABUS;
using BPASmartClient.MessageName.EnumHelp;
using BPASmartClient.SCADAControl;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using StackExchange.Redis;
using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
@@ -86,7 +88,6 @@ namespace BPASmartClient.SCADAControl.CustomerControls
if (IsExecuteState)
{
Register();
//Style = null;
}
}
}
@@ -94,7 +95,7 @@ namespace BPASmartClient.SCADAControl.CustomerControls
DispatcherTimer timer = new DispatcherTimer();
public void Register()
{
timer.Interval = TimeSpan.FromSeconds(TimeCount);
timer.Interval = TimeSpan.FromMilliseconds(TimeCount);
timer.Tick += Timer_Tick;
timer.Start();

@@ -118,7 +119,28 @@ namespace BPASmartClient.SCADAControl.CustomerControls
if (!string.IsNullOrEmpty(DataSouceInformation))
{
Direction = 1;
FDataSouce = HttpRequestHelper.HttpGetRequest(DataSouceInformation);
string returndata=string.Empty;
string obj_data= HttpRequestHelper.HttpGetRequest(DataSouceInformation);
Dictionary<string, object> obj = JsonConvert.DeserializeObject<Dictionary<string, object>>(obj_data);
if (obj.ContainsKey("data"))
{
returndata = obj_data.ToString();
} else
{
foreach (var item in obj)
{
if(item.Value is JObject)
{
Dictionary<string, object> itemkey = JsonConvert.DeserializeObject<Dictionary<string, object>>(item.Value.ToString());
if (itemkey.ContainsKey("data"))
{
returndata = item.Value.ToString();
}
}
}
}
//List<Dictionary<string, object>> obj2 = JsonConvert.DeserializeObject<List<Dictionary<string, object>>>(obj1["data"].ToString());
FDataSouce = returndata;
}
break;
case InterfaceModeEnum.PUT:
@@ -206,7 +228,7 @@ namespace BPASmartClient.SCADAControl.CustomerControls
set { SetValue(TimeCountProperty,value); }
}
public static readonly DependencyProperty TimeCountProperty =
DependencyProperty.Register("TimeCount",typeof(int),typeof(TheAPI),new PropertyMetadata(5));
DependencyProperty.Register("TimeCount",typeof(int),typeof(TheAPI),new PropertyMetadata(2000));
[Category("数据绑定-数据来源")]
public InterfaceModeEnum InterfaceMode
{
@@ -231,15 +253,15 @@ namespace BPASmartClient.SCADAControl.CustomerControls
set { SetValue(DataSouceInformationProperty,value); }
}
public static readonly DependencyProperty DataSouceInformationProperty =
DependencyProperty.Register("DataSouceInformation",typeof(string),typeof(TheAPI),new PropertyMetadata("http://localhost:9092/api/User/UsersTestSwagger"));
[Category("数据绑定-数据来源")]
public string DeviceName
{
get { return (string)GetValue(DeviceNameProperty); }
set { SetValue(DeviceNameProperty,value); }
}
public static readonly DependencyProperty DeviceNameProperty =
DependencyProperty.Register("DeviceName",typeof(string),typeof(TheAPI),new PropertyMetadata(string.Empty));
DependencyProperty.Register("DataSouceInformation",typeof(string),typeof(TheAPI),new PropertyMetadata("http://datav.dev1.com/api/Alarm/Query"));
//[Category("数据绑定-数据来源")]
//public string DeviceName
//{
// get { return (string)GetValue(DeviceNameProperty); }
// set { SetValue(DeviceNameProperty,value); }
//}
//public static readonly DependencyProperty DeviceNameProperty =
// DependencyProperty.Register("DeviceName",typeof(string),typeof(TheAPI),new PropertyMetadata(string.Empty));
[Category("数据绑定")]
public string FDataSouce
{
@@ -278,6 +300,19 @@ namespace BPASmartClient.SCADAControl.CustomerControls
public static readonly DependencyProperty CodeProperty =
DependencyProperty.Register("Code",typeof(string),typeof(TheAPI),new PropertyMetadata(_code));
[Category("数据绑定")]
public bool IsRun
{
get { return (bool)GetValue(RunProperty); }
set { SetValue(RunProperty, value); }
}
public static readonly DependencyProperty RunProperty =
DependencyProperty.Register("IsRun", typeof(bool), typeof(TheAPI), new PropertyMetadata(false, new PropertyChangedCallback(onIsRunChanged)));
private static void onIsRunChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) => (d as TheAPI)?.IsRunRefresh();
public void IsRunRefresh()
{
//测试运行
}
[Category("数据绑定")]
public string GenerateData
{
get { return (string)GetValue(GenerateDataProperty); }
@@ -289,5 +324,8 @@ namespace BPASmartClient.SCADAControl.CustomerControls




}
}



+ 125
- 26
BPASmartClient.SCADAControl/CustomerControls/TheDataGrid.xaml.cs Voir le fichier

@@ -8,6 +8,7 @@ using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
@@ -32,21 +33,34 @@ namespace BPASmartClient.SCADAControl.CustomerControls
public TheDataGrid()
{
InitializeComponent();
ResourceDictionary languageResDic = new ResourceDictionary();
languageResDic.Source = new Uri(@"/BPASmartClient.SCADAControl;component/Themes/Generic.xaml",UriKind.RelativeOrAbsolute);
this.Resources.MergedDictionaries.Add(languageResDic);
//ResourceDictionary languageResDic = new ResourceDictionary();
//languageResDic.Source = new Uri(@"/BPASmartClient.SCADAControl;component/Themes/Generic.xaml", UriKind.RelativeOrAbsolute);
//this.Resources.MergedDictionaries.Add(languageResDic);
MinWidth = 100;
MinHeight = 100;
Width = 100;
Height = 100;
this.Loaded += TheDataGrid_Loaded; ;
}

public DataSouceModel ItemsString
private void TheDataGrid_Loaded(object sender, RoutedEventArgs e)
{
get { return (DataSouceModel)GetValue(ItemsStringProperty); }
set { SetValue(ItemsStringProperty,value); }
TabItems.CollectionChanged += TabItems_CollectionChanged;
}

public static readonly DependencyProperty ItemsStringProperty =
DependencyProperty.Register("ItemsString",typeof(DataSouceModel),typeof(TheDataGrid),new PropertyMetadata(new DataSouceModel()));
private void TabItems_CollectionChanged(object? sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e)
{
if (TabItems.Count > 0)
{
try
{
TabItemsStr = JsonConvert.SerializeObject(TabItems);
}
catch (Exception ex)
{
}
}
}

public string ControlType => "控件";

@@ -64,17 +78,31 @@ namespace BPASmartClient.SCADAControl.CustomerControls
}
}
}

DispatcherTimer timer = new DispatcherTimer();
/// <summary>
/// 注册需要处理的事件
/// </summary>
public void Register()
{
if (!string.IsNullOrEmpty(TabItemsStr))
{
try
{
TabItems = JsonConvert.DeserializeObject<ObservableCollection<列显示设置>>(TabItemsStr);
}
catch (Exception ex)
{

timer.Interval = TimeSpan.FromMilliseconds(TimeCount);
timer.Tick += Timer_Tick; ;
timer.Start();
}
}

if (DataSouceType == DataTypeEnum.API接口)
{
timer.Interval = TimeSpan.FromMilliseconds(TimeCount);
timer.Tick += Timer_Tick; ;
timer.Start();
}
}

private void Timer_Tick(object? sender,EventArgs e)
@@ -90,6 +118,22 @@ namespace BPASmartClient.SCADAControl.CustomerControls


#region 数据绑定模块
[Category("名称[自动生成]")]
private string TabItemsStr
{
get { return (string)GetValue(TabItemsStrProperty); }
set { SetValue(TabItemsStrProperty, value); }
}
private static readonly DependencyProperty TabItemsStrProperty =
DependencyProperty.Register("TabItemsStr", typeof(string), typeof(TheDataGrid), new PropertyMetadata(string.Empty));
[Category("集合")]
public ObservableCollection<列显示设置> TabItems
{
get { return (ObservableCollection<列显示设置>)GetValue(TabItemsProperty); }
set { SetValue(TabItemsProperty, value); }
}
private static readonly DependencyProperty TabItemsProperty =
DependencyProperty.Register("TabItems", typeof(ObservableCollection<列显示设置>), typeof(TheDataGrid), new PropertyMetadata(new ObservableCollection<列显示设置>()));
public event EventHandler PropertyChange; //声明一个事件
[Category("数据绑定-数据来源")]
public DataTypeEnum DataSouceType
@@ -114,9 +158,7 @@ namespace BPASmartClient.SCADAControl.CustomerControls
set { SetValue(DataSouceInformationProperty,value); }
}
public static readonly DependencyProperty DataSouceInformationProperty =
DependencyProperty.Register("DataSouceInformation",typeof(string),typeof(TheDataGrid),new PropertyMetadata(string.Empty));


DependencyProperty.Register("DataSouceInformation",typeof(string),typeof(TheDataGrid),new PropertyMetadata("api0"));
[Category("数据绑定")]
public string FDataSouce
{
@@ -168,12 +210,17 @@ namespace BPASmartClient.SCADAControl.CustomerControls
{
try
{
ItemsString = JsonConvert.DeserializeObject<DataSouceModel>(GenerateData);
Dictionary<string, object> keys= JsonConvert.DeserializeObject<Dictionary<string, object>>(GenerateData);
List<Dictionary<string, object>> obj2 = JsonConvert.DeserializeObject<List<Dictionary<string, object>>>(keys["data"].ToString());
//ItemsString = JsonConvert.DeserializeObject<DataSouceModel>(GenerateData);
// 运行时进行项目绑定
Binding binding = new Binding();
binding.RelativeSource = new RelativeSource() { Mode = RelativeSourceMode.Self };
binding.Path = new PropertyPath("ItemsString.data");
SetBinding(ItemsSourceProperty,binding);
//this.AutoGenerateColumns = false;
this.CanUserAddRows = false;
this.CanUserDeleteRows = false;
this.RowHeaderWidth = 0;
this.GridLinesVisibility = DataGridGridLinesVisibility.None;
//this.BorderThickness = new Thickness(0);
this.ItemsSource = ListToDataTable(obj2).DefaultView;
}
catch (Exception ex)
{
@@ -182,17 +229,69 @@ namespace BPASmartClient.SCADAControl.CustomerControls
}
}

public DataTable ListToDataTable(List<Dictionary<string, object>> arrayList)
{
DataTable dataTable = new DataTable(); //实例化
DataTable result;
try
{
if (arrayList.Count > 0)
{

foreach (Dictionary<string, object> dictionary in arrayList)
{
if (dictionary.Keys.Count<string>() == 0)
{
result = dataTable;
return result;
}

if (TabItems == null || TabItems.Count == 0)
{
foreach (string current in dictionary.Keys)
{
TabItems.Add(new 列显示设置 { 列标题 = current, 是否显示 = true, 显示名称 = current });
}
}

//在第一次循环时确定datatable的列名,后续循环无需再更改
if (dataTable.Columns.Count == 0)
{
//此处仅考虑一层json字符串的形式,多层结构需要深入得到叶子节点的key
foreach (var current in TabItems)
{
if(current.是否显示)
dataTable.Columns.Add(current.显示名称);//, dictionary[current].GetType());
}
}
//每次循环增加datatable的Rows
DataRow dataRow = dataTable.NewRow();
foreach (var current in TabItems)
{
if (current.是否显示)
dataRow[current.显示名称] = dictionary[current.列标题];
}
dataTable.Rows.Add(dataRow); //循环添加行到DataTable中
}
}
}
catch
{
}
result = dataTable;
return result;
}
#endregion


}

public class DataSouceModel
public class 列显示设置
{
public List<object> data {get; set; }
public DataSouceModel()
{
data = new List<object>();
}
public string 列标题 { get; set; }
public string 显示名称 { get; set; }
public bool 是否显示 { get; set; }
}
}

+ 33
- 14
BPASmartClient.SCADAControl/Themes/Generic.xaml Voir le fichier

@@ -295,6 +295,9 @@
<Style.Setters>
<Setter Property="VerticalContentAlignment" Value="Center" />
<Setter Property="Cursor" Value="Hand" />
<Setter Property="BorderThickness" Value="0"/>
<Setter Property="FontSize" Value="14"/>
<Setter Property="BorderBrush" Value="Transparent"/>
<Setter Property="Background">
<Setter.Value>
<ImageBrush ImageSource="../Images/button2.png" />
@@ -305,7 +308,7 @@
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ctrl:TheButton}">
<Border x:Name="BD" Cursor="Hand">
<Border x:Name="BD" Cursor="Hand" Background="{TemplateBinding Background}" BorderThickness="{TemplateBinding BorderThickness}" BorderBrush="{TemplateBinding BorderBrush}">
<StackPanel
HorizontalAlignment="Center"
Cursor="Hand"
@@ -315,19 +318,21 @@
Margin="10,0,10,0"
VerticalAlignment="Center"
Cursor="Hand"
FontSize="14"
FontSize="{TemplateBinding FontSize}"
FontWeight="{TemplateBinding FontWeight}"
FontFamily="{TemplateBinding FontFamily}"
Foreground="{TemplateBinding Foreground}"
Text="{TemplateBinding Content}" />
</StackPanel>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="true">
<!--<Trigger Property="IsMouseOver" Value="true">
<Setter TargetName="BD" Property="Background" >
<Setter.Value>
<ImageBrush ImageSource="../Images/button2.png" />
</Setter.Value>
</Setter>
<!--<Setter TargetName="textBlock" Property="Foreground" Value="{TemplateBinding Foreground}" />-->
--><!--<Setter TargetName="textBlock" Property="Foreground" Value="{TemplateBinding Foreground}" />--><!--
</Trigger>
<Trigger Property="IsMouseOver" Value="False">
<Setter TargetName="BD" Property="Background" >
@@ -335,8 +340,8 @@
<ImageBrush ImageSource="../Images/button2.png" />
</Setter.Value>
</Setter>
<!--<Setter TargetName="textBlock" Property="Foreground" Value="{TemplateBinding Foreground}" />-->
</Trigger>
--><!--<Setter TargetName="textBlock" Property="Foreground" Value="{TemplateBinding Foreground}" />--><!--
</Trigger>-->
<Trigger Property="IsEnabled" Value="False">
<Setter TargetName="textBlock" Property="Foreground" Value="{DynamicResource ButtonUnSelectForeground}" />
</Trigger>
@@ -351,12 +356,20 @@
<Style.Setters>
<Setter Property="VerticalContentAlignment" Value="Center" />
<Setter Property="Cursor" Value="Hand" />
<Setter Property="BorderThickness" Value="0"/>
<Setter Property="FontSize" Value="14"/>
<Setter Property="BorderBrush" Value="Transparent"/>
<Setter Property="Background">
<Setter.Value>
<ImageBrush ImageSource="../Images/button2.png" />
</Setter.Value>
</Setter>
<Setter Property="Foreground" Value="{DynamicResource ButtonSelectForeground}" />
<Setter Property="Height" Value="25" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ctrl:TheToggleButton}">
<Border x:Name="BD" Cursor="Hand">
<Border x:Name="BD" Cursor="Hand" Background="{TemplateBinding Background}" BorderThickness="{TemplateBinding BorderThickness}" BorderBrush="{TemplateBinding BorderBrush}">
<StackPanel
HorizontalAlignment="Center"
Cursor="Hand"
@@ -366,8 +379,10 @@
Margin="10,0,10,0"
VerticalAlignment="Center"
Cursor="Hand"
FontSize="14"
Foreground="{DynamicResource ButtonSelectForeground}"
FontSize="{TemplateBinding FontSize}"
FontWeight="{TemplateBinding FontWeight}"
FontFamily="{TemplateBinding FontFamily}"
Foreground="{TemplateBinding Foreground}"
Text="{TemplateBinding Content}" />
</StackPanel>
</Border>
@@ -399,7 +414,7 @@
</Style>

<Style TargetType="{x:Type ctrl:TheTextBox}">
<Setter Property="BorderBrush" Value="{x:Static Themes1:ClassicBorderDecorator.ClassicBorderBrush}" />
<Setter Property="BorderBrush" Value="{DynamicResource borderBrush}" />
<Setter Property="BorderThickness" Value="1" />
<Setter Property="Padding" Value="0" />
<Setter Property="Foreground" Value="{DynamicResource foreground}" />
@@ -418,9 +433,10 @@
<ControlTemplate TargetType="{x:Type TextBox}">
<Themes1:ClassicBorderDecorator
x:Name="Bd"
BorderBrush="{DynamicResource borderBrush}"
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderStyle="None"
BorderThickness="1">
BorderThickness="{TemplateBinding BorderThickness}">
<ScrollViewer x:Name="PART_ContentHost" />
</Themes1:ClassicBorderDecorator>
<ControlTemplate.Triggers>
@@ -1121,10 +1137,11 @@
<Style TargetType="{x:Type DataGridRow}">
<Setter Property="Background" Value="Transparent" />
<Setter Property="HorizontalContentAlignment" Value="Center" />
<Setter Property="HorizontalAlignment" Value="Right"/>
<Setter Property="SnapsToDevicePixels" Value="true" />
<Setter Property="Foreground" Value="#abf4ff" />
<Setter Property="BorderBrush" Value="#abf4ff" />
<Setter Property="FontSize" Value="10" />
<Setter Property="FontSize" Value="14" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type DataGridRow}">
@@ -1969,8 +1986,10 @@
x:Name="Bd"
Height="35"
Margin="5"
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
Padding="{TemplateBinding Padding}"
BorderThickness="1"
BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="2">
<ContentPresenter
x:Name="Content"


+ 1
- 0
BeDesignerSCADA/Controls/MainCanvasPanel.xaml Voir le fichier

@@ -228,6 +228,7 @@
<mypro:PropertyDefinition DisplayName="左边距" Category="基本属性" DisplayOrder="4" Name="(Canvas.Left)"/>
<mypro:PropertyDefinition DisplayName="上边距" Category="基本属性" DisplayOrder="4" Name="(Canvas.Top)"/>

<mypro:PropertyDefinition DisplayName="数据来源类型" Category="数据绑定模块" DisplayOrder="0" Name="DataSouceType"/>
<mypro:PropertyDefinition DisplayName="设备名称" Category="数据绑定模块" DisplayOrder="0" Name="DeviceName"/>
<mypro:PropertyDefinition DisplayName="接口类型" Category="数据绑定模块" DisplayOrder="1" Name="InterfaceMode"/>
<mypro:PropertyDefinition DisplayName="接口参数" Category="数据绑定模块" DisplayOrder="2" Name="InterfaceParameters"/>


+ 2
- 4
BeDesignerSCADA/Controls/MainCanvasPanel.xaml.cs Voir le fichier

@@ -35,7 +35,7 @@ namespace BeDesignerSCADA.Controls
/// 布局文件路径
/// </summary>
public string Path=string.Empty;
public string VariablePath = string.Empty;
MainViewModelNew viewModel = new MainViewModelNew();
public MainCanvasPanel(string _Path)
{
@@ -60,7 +60,6 @@ namespace BeDesignerSCADA.Controls
// var controls = assembly.GetTypes().Where(t => t.GetInterface("IExecutable") != null).OrderBy(o => o.Name);
// CtlList.ItemsSource = controls;
//}

#region 位置调整
/// <summary>
/// 左对齐
@@ -182,7 +181,6 @@ namespace BeDesignerSCADA.Controls
{
cav.Load(path);


DoubleAnimation da = new DoubleAnimation(-200, 0, new Duration(TimeSpan.FromMilliseconds(250)));
da.EasingFunction = new CubicEase() { EasingMode = EasingMode.EaseOut };
CanvasTranslate.BeginAnimation(TranslateTransform.XProperty, da);
@@ -212,7 +210,7 @@ namespace BeDesignerSCADA.Controls
{
try
{
VariablePath = path;
viewModel.VariablePath = path;
}
catch (Exception ex)
{


+ 2
- 0
BeDesignerSCADA/MainWindow.xaml Voir le fichier

@@ -231,6 +231,8 @@
<mypro:PropertyDefinition DisplayName="左边距" Category="基本属性" DisplayOrder="4" Name="(Canvas.Left)"/>
<mypro:PropertyDefinition DisplayName="上边距" Category="基本属性" DisplayOrder="4" Name="(Canvas.Top)"/>


<mypro:PropertyDefinition DisplayName="数据来源类型" Category="数据绑定模块" DisplayOrder="0" Name="DataSouceType"/>
<mypro:PropertyDefinition DisplayName="设备名称" Category="数据绑定模块" DisplayOrder="0" Name="DeviceName"/>
<mypro:PropertyDefinition DisplayName="接口类型" Category="数据绑定模块" DisplayOrder="1" Name="InterfaceMode"/>
<mypro:PropertyDefinition DisplayName="接口参数" Category="数据绑定模块" DisplayOrder="2" Name="InterfaceParameters"/>


+ 84
- 0
BeDesignerSCADA/ViewModel/DataBusModel.cs Voir le fichier

@@ -0,0 +1,84 @@
using BPASmart.Model;
using Newtonsoft.Json;
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BeDesignerSCADA.ViewModel
{
public class DataBusModel
{
#region 单例模式
public static DataBusModel dataBus = null;

public static DataBusModel GetInstance()
{
if (dataBus == null)
{
dataBus = new DataBusModel();
}
return dataBus;
}
#endregion

#region 变量
/// <summary>
/// 变量地址保存
/// key:地址
/// value:变量
/// </summary>
private ConcurrentDictionary<string, CommunicationPar> _KeyValues { get; set; } = new ConcurrentDictionary<string, CommunicationPar>();
public ConcurrentDictionary<string, CommunicationPar> KeyValues
{
get
{
return _KeyValues;
}
set
{
_KeyValues = value;

}
}
#endregion
/// <summary>
/// 刷新界面
/// </summary>
public Action<string> RefreshTheVariableManagerAction;
/// <summary>
/// 刷新界面管理器
/// </summary>
/// <param name="path"></param>
public bool RefreshVariableManager(string path="")
{
bool IsSucess=false;
try
{
if (File.Exists(path))
{
CommunicationPar val = JsonConvert.DeserializeObject<CommunicationPar>(File.ReadAllText(path));
if (val != null)
{
if (KeyValues == null)
{
KeyValues = new ConcurrentDictionary<string, CommunicationPar>();
}
KeyValues[path] = val;
RefreshTheVariableManagerAction?.Invoke(path);
IsSucess = true;
}
}
}
catch (Exception ex)
{

}
return IsSucess;
}

}
}

+ 24
- 0
BeDesignerSCADA/ViewModel/MainViewModelNew.cs Voir le fichier

@@ -35,9 +35,15 @@ namespace BeDesignerSCADA.ViewModel
{
IsRunning = !IsRunning;
});
DataBusModel.GetInstance().RefreshTheVariableManagerAction += RefreshTheVariableManagerActionHader;
}

#region 变量
/// <summary>
/// 变量管理器地址
/// </summary>
public string VariablePath = string.Empty;

/// <summary>
/// 是否正在运行状态
/// </summary>
@@ -195,6 +201,24 @@ namespace BeDesignerSCADA.ViewModel
{
textEditor.Text = canvasPanel.Save();
}
/// <summary>
/// 刷新变量
/// </summary>
/// <param name="path"></param>
public void RefreshTheVariableManagerActionHader(string path)
{
try
{
if (path == VariablePath && !string.IsNullOrEmpty(VariablePath))
{
}
}
catch (Exception ex)
{

}
}
#endregion

#region 脚本编辑数据


+ 1
- 1
DosingSystem/Model/DeviceInquire.cs Voir le fichier

@@ -98,7 +98,7 @@ namespace BPASmartClient.DosingSystem.Model

public void Init()
{
// TestData();
//TestData();
IpAddressLines();
DeviceDataInit();
ThreadManage.GetInstance().StartLong(new Action(() =>


+ 1
- 1
FryPot_DosingSystem/App.xaml.cs Voir le fichier

@@ -41,7 +41,7 @@ namespace FryPot_DosingSystem
MessageLog.GetInstance.ShowUserLog("用户登录");
DeviceOperate deviceOperate = DeviceOperate.GetInstance;//开启实时PLC数据读取
DosingLogicControl logigControl = DosingLogicControl.GetInstance;//开启逻辑控制任务程序
HubHelper.GetInstance.Connect("192.168.1.40", 8089);
HubHelper.GetInstance.Connect("192.168.1.20", 8089);
AlarmHelper<AlarmInfo>.Init();//报警实时监控
}
else


+ 10
- 10
FryPot_DosingSystem/Control/DosingLogicControl.cs Voir le fichier

@@ -1634,7 +1634,7 @@ namespace FryPot_DosingSystem.Control
using (FileStream writeStream = new FileStream("AccessFile\\" + "DB\\" + "炒锅1状态数据\\" + DateTime.Now.ToShortDateString() + "\\" + DateTime.Now.ToString("HH:mm").Replace(':', '.') + fryOneRecipe + ".bin", FileMode.OpenOrCreate, FileAccess.Write))
{
writeStream.Position = writeStream.Length;
PotOneStatus p1 = new PotOneStatus { Temperature = FryPotMonitorManage.GetInstance.fryOne.Temperature, HotPower = FryPotMonitorManage.GetInstance.fryOne.HotPower, Speed = FryPotMonitorManage.GetInstance.fryOne.Speed, FryPotWeight = FryPotMonitorManage.GetInstance.fryOne.FryPotWeight, OilCapacity = FryPotMonitorManage.GetInstance.fryOne.OilCapacity, TotalOilCapactiy = FryPotMonitorManage.GetInstance.fryOne.TotalOilCapactiy, TotalProduct = FryPotMonitorManage.GetInstance.fryOne.TotalProduct, RecipeName = fryOneRecipe, Time = DateTime.Now.ToShortDateString() };
PotOneStatus p1 = new PotOneStatus { Temperature = FryPotMonitorManage.GetInstance.fryOne.Temperature, HotPower = FryPotMonitorManage.GetInstance.fryOne.HotPower, Speed = FryPotMonitorManage.GetInstance.fryOne.Speed, FryPotWeight = FryPotMonitorManage.GetInstance.fryOne.FryPotWeight, OilCapacity = FryPotMonitorManage.GetInstance.fryOne.OilCapacity, TotalOilCapactiy = FryPotMonitorManage.GetInstance.fryOne.TotalOilCapactiy, TotalProduct = FryPotMonitorManage.GetInstance.fryOne.TotalProduct, RecipeName = fryOneRecipe, Time = DateTime.Now.ToString("yyyy-MM-dd-HH-mm") };
BinaryFormatter bf = new BinaryFormatter();
bf.Serialize(writeStream, p1);

@@ -1650,7 +1650,7 @@ namespace FryPot_DosingSystem.Control
using (FileStream writeStream = new FileStream("AccessFile\\" + "DB\\" + "炒锅1状态数据\\" + DateTime.Now.ToShortDateString() + "\\" + DateTime.Now.ToString("HH:mm").Replace(':', '.') + fryOneRecipe + ".bin", FileMode.OpenOrCreate, FileAccess.Write))
{
writeStream.Position = writeStream.Length;
PotOneStatus p1 = new PotOneStatus { Temperature = FryPotMonitorManage.GetInstance.fryOne.Temperature, HotPower = FryPotMonitorManage.GetInstance.fryOne.HotPower, Speed = FryPotMonitorManage.GetInstance.fryOne.Speed, FryPotWeight = FryPotMonitorManage.GetInstance.fryOne.FryPotWeight, OilCapacity = FryPotMonitorManage.GetInstance.fryOne.OilCapacity, TotalOilCapactiy = FryPotMonitorManage.GetInstance.fryOne.TotalOilCapactiy, TotalProduct = FryPotMonitorManage.GetInstance.fryOne.TotalProduct, RecipeName = fryOneRecipe, Time = DateTime.Now.ToShortDateString() };
PotOneStatus p1 = new PotOneStatus { Temperature = FryPotMonitorManage.GetInstance.fryOne.Temperature, HotPower = FryPotMonitorManage.GetInstance.fryOne.HotPower, Speed = FryPotMonitorManage.GetInstance.fryOne.Speed, FryPotWeight = FryPotMonitorManage.GetInstance.fryOne.FryPotWeight, OilCapacity = FryPotMonitorManage.GetInstance.fryOne.OilCapacity, TotalOilCapactiy = FryPotMonitorManage.GetInstance.fryOne.TotalOilCapactiy, TotalProduct = FryPotMonitorManage.GetInstance.fryOne.TotalProduct, RecipeName = fryOneRecipe, Time = DateTime.Now.ToString("yyyy-MM-dd-HH-mm") };
BinaryFormatter bf = new BinaryFormatter();
bf.Serialize(writeStream, p1);

@@ -1670,7 +1670,7 @@ namespace FryPot_DosingSystem.Control
using (FileStream writeStream = new FileStream("AccessFile\\" + "DB\\" + "炒锅2状态数据\\" + DateTime.Now.ToShortDateString() + "\\" + DateTime.Now.ToString("HH:mm").Replace(':', '.') + fryTwoRecipe + ".bin", FileMode.OpenOrCreate, FileAccess.Write))
{
writeStream.Position = writeStream.Length;
PotTwoStatus p1 = new PotTwoStatus { Temperature = FryPotMonitorManage.GetInstance.fryTwo.Temperature, HotPower = FryPotMonitorManage.GetInstance.fryTwo.HotPower, Speed = FryPotMonitorManage.GetInstance.fryTwo.Speed, FryPotWeight = FryPotMonitorManage.GetInstance.fryTwo.FryPotWeight, OilCapacity = FryPotMonitorManage.GetInstance.fryTwo.OilCapacity, TotalOilCapactiy = FryPotMonitorManage.GetInstance.fryTwo.TotalOilCapactiy, TotalProduct = FryPotMonitorManage.GetInstance.fryTwo.TotalProduct, RecipeName = fryTwoRecipe, Time = DateTime.Now.ToShortDateString() };
PotTwoStatus p1 = new PotTwoStatus { Temperature = FryPotMonitorManage.GetInstance.fryTwo.Temperature, HotPower = FryPotMonitorManage.GetInstance.fryTwo.HotPower, Speed = FryPotMonitorManage.GetInstance.fryTwo.Speed, FryPotWeight = FryPotMonitorManage.GetInstance.fryTwo.FryPotWeight, OilCapacity = FryPotMonitorManage.GetInstance.fryTwo.OilCapacity, TotalOilCapactiy = FryPotMonitorManage.GetInstance.fryTwo.TotalOilCapactiy, TotalProduct = FryPotMonitorManage.GetInstance.fryTwo.TotalProduct, RecipeName = fryTwoRecipe, Time = DateTime.Now.ToString("yyyy-MM-dd-HH-mm") };
BinaryFormatter bf = new BinaryFormatter();
bf.Serialize(writeStream, p1);

@@ -1686,7 +1686,7 @@ namespace FryPot_DosingSystem.Control
using (FileStream writeStream = new FileStream("AccessFile\\" + "DB\\" + "炒锅2状态数据\\" + DateTime.Now.ToShortDateString() + "\\" + DateTime.Now.ToString("HH:mm").Replace(':', '.') + fryTwoRecipe + ".bin", FileMode.OpenOrCreate, FileAccess.Write))
{
writeStream.Position = writeStream.Length;
PotTwoStatus p1 = new PotTwoStatus { Temperature = FryPotMonitorManage.GetInstance.fryTwo.Temperature, HotPower = FryPotMonitorManage.GetInstance.fryTwo.HotPower, Speed = FryPotMonitorManage.GetInstance.fryTwo.Speed, FryPotWeight = FryPotMonitorManage.GetInstance.fryTwo.FryPotWeight, OilCapacity = FryPotMonitorManage.GetInstance.fryTwo.OilCapacity, TotalOilCapactiy = FryPotMonitorManage.GetInstance.fryTwo.TotalOilCapactiy, TotalProduct = FryPotMonitorManage.GetInstance.fryTwo.TotalProduct, RecipeName = fryTwoRecipe, Time = DateTime.Now.ToShortDateString() };
PotTwoStatus p1 = new PotTwoStatus { Temperature = FryPotMonitorManage.GetInstance.fryTwo.Temperature, HotPower = FryPotMonitorManage.GetInstance.fryTwo.HotPower, Speed = FryPotMonitorManage.GetInstance.fryTwo.Speed, FryPotWeight = FryPotMonitorManage.GetInstance.fryTwo.FryPotWeight, OilCapacity = FryPotMonitorManage.GetInstance.fryTwo.OilCapacity, TotalOilCapactiy = FryPotMonitorManage.GetInstance.fryTwo.TotalOilCapactiy, TotalProduct = FryPotMonitorManage.GetInstance.fryTwo.TotalProduct, RecipeName = fryTwoRecipe, Time = DateTime.Now.ToString("yyyy-MM-dd-HH-mm") };
BinaryFormatter bf = new BinaryFormatter();
bf.Serialize(writeStream, p1);

@@ -1706,7 +1706,7 @@ namespace FryPot_DosingSystem.Control
using (FileStream writeStream = new FileStream("AccessFile\\" + "DB\\" + "炒锅3状态数据\\" + DateTime.Now.ToShortDateString() + "\\" + DateTime.Now.ToString("HH:mm").Replace(':', '.') + fryThreeRecipe + ".bin", FileMode.OpenOrCreate, FileAccess.Write))
{
writeStream.Position = writeStream.Length;
PotThreeStatus p1 = new PotThreeStatus { Temperature = FryPotMonitorManage.GetInstance.fryThree.Temperature, HotPower = FryPotMonitorManage.GetInstance.fryThree.HotPower, Speed = FryPotMonitorManage.GetInstance.fryThree.Speed, FryPotWeight = FryPotMonitorManage.GetInstance.fryThree.FryPotWeight, OilCapacity = FryPotMonitorManage.GetInstance.fryThree.OilCapacity, TotalOilCapactiy = FryPotMonitorManage.GetInstance.fryThree.TotalOilCapactiy, TotalProduct = FryPotMonitorManage.GetInstance.fryThree.TotalProduct, RecipeName = fryThreeRecipe, Time = DateTime.Now.ToShortDateString() };
PotThreeStatus p1 = new PotThreeStatus { Temperature = FryPotMonitorManage.GetInstance.fryThree.Temperature, HotPower = FryPotMonitorManage.GetInstance.fryThree.HotPower, Speed = FryPotMonitorManage.GetInstance.fryThree.Speed, FryPotWeight = FryPotMonitorManage.GetInstance.fryThree.FryPotWeight, OilCapacity = FryPotMonitorManage.GetInstance.fryThree.OilCapacity, TotalOilCapactiy = FryPotMonitorManage.GetInstance.fryThree.TotalOilCapactiy, TotalProduct = FryPotMonitorManage.GetInstance.fryThree.TotalProduct, RecipeName = fryThreeRecipe, Time = DateTime.Now.ToString("yyyy-MM-dd-HH-mm") };
BinaryFormatter bf = new BinaryFormatter();
bf.Serialize(writeStream, p1);

@@ -1722,7 +1722,7 @@ namespace FryPot_DosingSystem.Control
using (FileStream writeStream = new FileStream("AccessFile\\" + "DB\\" + "炒锅3状态数据\\" + DateTime.Now.ToShortDateString() + "\\" + DateTime.Now.ToString("HH:mm").Replace(':', '.') + fryThreeRecipe + ".bin", FileMode.OpenOrCreate, FileAccess.Write))
{
writeStream.Position = writeStream.Length;
PotThreeStatus p1 = new PotThreeStatus { Temperature = FryPotMonitorManage.GetInstance.fryThree.Temperature, HotPower = FryPotMonitorManage.GetInstance.fryThree.HotPower, Speed = FryPotMonitorManage.GetInstance.fryThree.Speed, FryPotWeight = FryPotMonitorManage.GetInstance.fryThree.FryPotWeight, OilCapacity = FryPotMonitorManage.GetInstance.fryThree.OilCapacity, TotalOilCapactiy = FryPotMonitorManage.GetInstance.fryThree.TotalOilCapactiy, TotalProduct = FryPotMonitorManage.GetInstance.fryThree.TotalProduct, RecipeName = fryThreeRecipe, Time = DateTime.Now.ToShortDateString() };
PotThreeStatus p1 = new PotThreeStatus { Temperature = FryPotMonitorManage.GetInstance.fryThree.Temperature, HotPower = FryPotMonitorManage.GetInstance.fryThree.HotPower, Speed = FryPotMonitorManage.GetInstance.fryThree.Speed, FryPotWeight = FryPotMonitorManage.GetInstance.fryThree.FryPotWeight, OilCapacity = FryPotMonitorManage.GetInstance.fryThree.OilCapacity, TotalOilCapactiy = FryPotMonitorManage.GetInstance.fryThree.TotalOilCapactiy, TotalProduct = FryPotMonitorManage.GetInstance.fryThree.TotalProduct, RecipeName = fryThreeRecipe, Time = DateTime.Now.ToString("yyyy-MM-dd-HH-mm") };
BinaryFormatter bf = new BinaryFormatter();
bf.Serialize(writeStream, p1);

@@ -1742,7 +1742,7 @@ namespace FryPot_DosingSystem.Control
using (FileStream writeStream = new FileStream("AccessFile\\" + "DB\\" + "炒锅4状态数据\\" + DateTime.Now.ToShortDateString() + "\\" + DateTime.Now.ToString("HH:mm").Replace(':', '.') + fryFourRecipe + ".bin", FileMode.OpenOrCreate, FileAccess.Write))
{
writeStream.Position = writeStream.Length;
PotFourStatus p1 = new PotFourStatus { Temperature = FryPotMonitorManage.GetInstance.fryFour.Temperature, HotPower = FryPotMonitorManage.GetInstance.fryFour.HotPower, Speed = FryPotMonitorManage.GetInstance.fryFour.Speed, FryPotWeight = FryPotMonitorManage.GetInstance.fryFour.FryPotWeight, OilCapacity = FryPotMonitorManage.GetInstance.fryFour.OilCapacity, TotalOilCapactiy = FryPotMonitorManage.GetInstance.fryFour.TotalOilCapactiy, TotalProduct = FryPotMonitorManage.GetInstance.fryFour.TotalProduct, RecipeName = fryFourRecipe, Time = DateTime.Now.ToShortDateString() };
PotFourStatus p1 = new PotFourStatus { Temperature = FryPotMonitorManage.GetInstance.fryFour.Temperature, HotPower = FryPotMonitorManage.GetInstance.fryFour.HotPower, Speed = FryPotMonitorManage.GetInstance.fryFour.Speed, FryPotWeight = FryPotMonitorManage.GetInstance.fryFour.FryPotWeight, OilCapacity = FryPotMonitorManage.GetInstance.fryFour.OilCapacity, TotalOilCapactiy = FryPotMonitorManage.GetInstance.fryFour.TotalOilCapactiy, TotalProduct = FryPotMonitorManage.GetInstance.fryFour.TotalProduct, RecipeName = fryFourRecipe,Time= DateTime.Now.ToString("yyyy-MM-dd-HH-mm") };
BinaryFormatter bf = new BinaryFormatter();
bf.Serialize(writeStream, p1);

@@ -1758,7 +1758,7 @@ namespace FryPot_DosingSystem.Control
using (FileStream writeStream = new FileStream("AccessFile\\" + "DB\\" + "炒锅4状态数据\\" + DateTime.Now.ToShortDateString() + "\\" + DateTime.Now.ToString("HH:mm").Replace(':', '.') + fryFourRecipe + ".bin", FileMode.OpenOrCreate, FileAccess.Write))
{
writeStream.Position = writeStream.Length;
PotFourStatus p1 = new PotFourStatus { Temperature = FryPotMonitorManage.GetInstance.fryFour.Temperature, HotPower = FryPotMonitorManage.GetInstance.fryFour.HotPower, Speed = FryPotMonitorManage.GetInstance.fryFour.Speed, FryPotWeight = FryPotMonitorManage.GetInstance.fryFour.FryPotWeight, OilCapacity = FryPotMonitorManage.GetInstance.fryFour.OilCapacity, TotalOilCapactiy = FryPotMonitorManage.GetInstance.fryFour.TotalOilCapactiy, TotalProduct = FryPotMonitorManage.GetInstance.fryFour.TotalProduct, RecipeName = fryFourRecipe, Time = DateTime.Now.ToShortDateString() };
PotFourStatus p1 = new PotFourStatus { Temperature = FryPotMonitorManage.GetInstance.fryFour.Temperature, HotPower = FryPotMonitorManage.GetInstance.fryFour.HotPower, Speed = FryPotMonitorManage.GetInstance.fryFour.Speed, FryPotWeight = FryPotMonitorManage.GetInstance.fryFour.FryPotWeight, OilCapacity = FryPotMonitorManage.GetInstance.fryFour.OilCapacity, TotalOilCapactiy = FryPotMonitorManage.GetInstance.fryFour.TotalOilCapactiy, TotalProduct = FryPotMonitorManage.GetInstance.fryFour.TotalProduct, RecipeName = fryFourRecipe, Time = DateTime.Now.ToString("yyyy-MM-dd-HH-mm") };
BinaryFormatter bf = new BinaryFormatter();
bf.Serialize(writeStream, p1);

@@ -1778,7 +1778,7 @@ namespace FryPot_DosingSystem.Control
using (FileStream writeStream = new FileStream("AccessFile\\" + "DB\\" + "炒锅5状态数据\\" + DateTime.Now.ToShortDateString() + "\\" + DateTime.Now.ToString("HH:mm").Replace(':', '.') + fryFiveRecipe + ".bin", FileMode.OpenOrCreate, FileAccess.Write))
{
writeStream.Position = writeStream.Length;
PotFiveStatus p1 = new PotFiveStatus { Temperature = FryPotMonitorManage.GetInstance.fryFive.Temperature, HotPower = FryPotMonitorManage.GetInstance.fryFive.HotPower, Speed = FryPotMonitorManage.GetInstance.fryFive.Speed, FryPotWeight = FryPotMonitorManage.GetInstance.fryFive.FryPotWeight, OilCapacity = FryPotMonitorManage.GetInstance.fryFive.OilCapacity, TotalOilCapactiy = FryPotMonitorManage.GetInstance.fryFive.TotalOilCapactiy, TotalProduct = FryPotMonitorManage.GetInstance.fryFive.TotalProduct, RecipeName = fryFiveRecipe, Time = DateTime.Now.ToShortDateString() };
PotFiveStatus p1 = new PotFiveStatus { Temperature = FryPotMonitorManage.GetInstance.fryFive.Temperature, HotPower = FryPotMonitorManage.GetInstance.fryFive.HotPower, Speed = FryPotMonitorManage.GetInstance.fryFive.Speed, FryPotWeight = FryPotMonitorManage.GetInstance.fryFive.FryPotWeight, OilCapacity = FryPotMonitorManage.GetInstance.fryFive.OilCapacity, TotalOilCapactiy = FryPotMonitorManage.GetInstance.fryFive.TotalOilCapactiy, TotalProduct = FryPotMonitorManage.GetInstance.fryFive.TotalProduct, RecipeName = fryFiveRecipe, Time = DateTime.Now.ToString("yyyy-MM-dd-HH-mm") };
BinaryFormatter bf = new BinaryFormatter();
bf.Serialize(writeStream, p1);

@@ -1794,7 +1794,7 @@ namespace FryPot_DosingSystem.Control
using (FileStream writeStream = new FileStream("AccessFile\\" + "DB\\" + "炒锅5状态数据\\" + DateTime.Now.ToShortDateString() + "\\" + DateTime.Now.ToString("HH:mm").Replace(':', '.') + fryFiveRecipe + ".bin", FileMode.OpenOrCreate, FileAccess.Write))
{
writeStream.Position = writeStream.Length;
PotFiveStatus p1 = new PotFiveStatus { Temperature = FryPotMonitorManage.GetInstance.fryFive.Temperature, HotPower = FryPotMonitorManage.GetInstance.fryFive.HotPower, Speed = FryPotMonitorManage.GetInstance.fryFive.Speed, FryPotWeight = FryPotMonitorManage.GetInstance.fryFive.FryPotWeight, OilCapacity = FryPotMonitorManage.GetInstance.fryFive.OilCapacity, TotalOilCapactiy = FryPotMonitorManage.GetInstance.fryFive.TotalOilCapactiy, TotalProduct = FryPotMonitorManage.GetInstance.fryFive.TotalProduct, RecipeName = fryFiveRecipe, Time = DateTime.Now.ToShortDateString() };
PotFiveStatus p1 = new PotFiveStatus { Temperature = FryPotMonitorManage.GetInstance.fryFive.Temperature, HotPower = FryPotMonitorManage.GetInstance.fryFive.HotPower, Speed = FryPotMonitorManage.GetInstance.fryFive.Speed, FryPotWeight = FryPotMonitorManage.GetInstance.fryFive.FryPotWeight, OilCapacity = FryPotMonitorManage.GetInstance.fryFive.OilCapacity, TotalOilCapactiy = FryPotMonitorManage.GetInstance.fryFive.TotalOilCapactiy, TotalProduct = FryPotMonitorManage.GetInstance.fryFive.TotalProduct, RecipeName = fryFiveRecipe, Time = DateTime.Now.ToString("yyyy-MM-dd-HH-mm") };
BinaryFormatter bf = new BinaryFormatter();
bf.Serialize(writeStream, p1);



+ 1
- 1
FryPot_DosingSystem/View/AgvView.xaml Voir le fichier

@@ -1668,7 +1668,7 @@
<!--#region 滚筒线,IsEnabled True代表有菜 false 空碗.Text:Start 执行动画 Tag:代表传输带上有几个菜碗-->
<StackPanel Orientation="Horizontal" Height="240" Width="580" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="290,0,0,0">
<TextBlock Style="{DynamicResource 80号字体样式}" FontSize="16" Width="18" HorizontalAlignment="Right">满料桶滚筒线</TextBlock>
<TextBox Style="{StaticResource 传送带}" IsEnabled="True" Text="{Binding RollerLines_1.Text,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" Tag="{Binding RollerLines_1.DishesNum,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" Margin="0,0,0,0" ></TextBox>
<TextBox Style="{StaticResource 传送带}" IsEnabled="True" Text="{Binding RollerLines_1.Text,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" Tag="{Binding RollerLines_1.DishesNum,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" Margin="0,0,0,0" ></TextBox>
<TextBlock Style="{DynamicResource 80号字体样式}" FontSize="16" Width="18" HorizontalAlignment="Right">(1)满料桶滚筒线</TextBlock>
<TextBox Style="{StaticResource 传送带}" IsEnabled="True" Text="{Binding RollerLines_2.Text,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" Tag="{Binding RollerLines_2.DishesNum,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" Margin="80,0,0,0"></TextBox>
<TextBlock Style="{DynamicResource 80号字体样式}" FontSize="16" Width="18" HorizontalAlignment="Right">(2)满料桶滚筒线</TextBlock>


+ 3
- 0
FryPot_DosingSystem/ViewModel/NewRecipeViewModel.cs Voir le fichier

@@ -111,6 +111,7 @@ namespace FryPot_DosingSystem.ViewModel
goto prop;
}
MessageLog.GetInstance.ShowUserLog($"配方【{RecipeName}】新建成功");
NoticeDemoViewModel.OpenMsg(EnumPromptType.Success, App.MainWindow, "提示", $"新建配方【{RecipeName}】成功");
}
else
{
@@ -134,6 +135,7 @@ namespace FryPot_DosingSystem.ViewModel
bom.UpdateTime = DateTime.Now.ToShortDateString();
Json<RecipeManage>.Save();
MessageLog.GetInstance.ShowUserLog($"配方【{RecipeName}】修改成功");
NoticeDemoViewModel.OpenMsg(EnumPromptType.Success, App.MainWindow, "提示", $"修改配方【{RecipeName}】成功");
}
else
{
@@ -163,6 +165,7 @@ namespace FryPot_DosingSystem.ViewModel
goto prop;
}
MessageLog.GetInstance.ShowUserLog("另存配方成功");
NoticeDemoViewModel.OpenMsg(EnumPromptType.Success, App.MainWindow, "提示", $"另存配方【{RecipeName}】成功");
}
else
{


Chargement…
Annuler
Enregistrer