Commit be2ae018 authored by 潘栩锋's avatar 潘栩锋 🚴

添加 称重服务器添加吸料

parent b3d1346e
......@@ -109,10 +109,5 @@ namespace FLY.DownBlowing.UI.Server
/// 路径
/// </summary>
public string Path { get; set; }
/// <summary>
/// 版本
/// </summary>
public int Version { get; set; }
}
}
......@@ -339,7 +339,9 @@ namespace FLY.DownBlowing.Client
public string[] GetSyncPropNames()
{
return new string[]{
nameof(TAreasCnt)
nameof(TAreasCnt),
nameof(FeederCntOfEachs),
nameof(Version)
};
}
......
......@@ -74,6 +74,9 @@
<Compile Include="PgMain.xaml.cs">
<DependentUpon>PgMain.xaml</DependentUpon>
</Compile>
<Compile Include="WdSetupFeeder.xaml.cs">
<DependentUpon>WdSetupFeeder.xaml</DependentUpon>
</Compile>
<Compile Include="WdSetup.xaml.cs">
<DependentUpon>WdSetup.xaml</DependentUpon>
</Compile>
......@@ -101,6 +104,10 @@
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="WdSetupFeeder.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="WdSetup.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
......
......@@ -37,6 +37,9 @@ namespace FLY.Weight.UI.Server
this.itemcontrol.ItemsSource = plsos.PLCs;
sp_sysParam.DataContext = gage.mSysParam;
if (gage.mFeederSystem != null) {
this.itemcontrol_feeder.ItemsSource = gage.mFeederSystem.plcos.PLCs;
}
}
private void btnSetupClick(object sender, RoutedEventArgs e)
{
......@@ -55,6 +58,14 @@ namespace FLY.Weight.UI.Server
w.Init(plc);
w.ShowDialog();
}
private void btnFeederSetupClick(object sender, RoutedEventArgs e)
{
WdSetupFeeder w = new WdSetupFeeder();
w.Init(gage);
w.Owner = App.Current.MainWindow;
w.ShowDialog();
}
}
public class PgMainVmUt : INotifyPropertyChanged
......
......@@ -14,7 +14,7 @@
</Window.Resources>
<Grid>
<StackPanel>
<GroupBox Header="配置文件">
<GroupBox Header="称重配置文件">
<StackPanel Orientation="Horizontal">
<StackPanel>
<StackPanel Margin="5">
......@@ -54,6 +54,5 @@
</GroupBox>
</StackPanel>
</Grid>
</Window>
<Window x:Class="FLY.Weight.UI.Server.WdSetupFeeder"
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:FLY.Weight.UI.Server"
mc:Ignorable="d"
Title="WdSetup" SizeToContent="WidthAndHeight" >
<Window.Resources>
</Window.Resources>
<Grid>
<StackPanel>
<StackPanel x:Name="sp_sysParam" Orientation="Horizontal" Grid.Column="1" Margin="5">
<CheckBox Content="有吸料"
IsChecked="{Binding HasFeeder}"/>
</StackPanel>
<GroupBox Header="吸料配置文件">
<StackPanel Orientation="Horizontal">
<StackPanel Margin="5">
<TextBlock Text="plcgroup配置文件" Margin="2"/>
<ComboBox MinWidth="200" Margin="2" x:Name="comboBox" >
<ComboBox.ItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding Name}"/>
</DataTemplate>
</ComboBox.ItemTemplate>
</ComboBox>
</StackPanel>
<Button Content="确定" Padding="20,5" Margin="5" VerticalAlignment="Bottom"
Click="btnOkClick" />
</StackPanel>
</GroupBox>
</StackPanel>
</Grid>
</Window>
using FLY.Modbus;
using FLY.OBJComponents.Common;
using FLY.Weight.IService;
using FLY.Weight.Server;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Security.Cryptography;
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 FLY.Weight.UI.Server
{
/// <summary>
/// WdSetup.xaml 的交互逻辑
/// </summary>
public partial class WdSetupFeeder : Window
{
public event PropertyChangedEventHandler PropertyChanged;
string plcgroups_dirPath = "feeder_plcgroups";
string plcgroup_filePath = "feeder_plcgroup.json";
TDGage gage;
public WdSetupFeeder()
{
InitializeComponent();
}
public void Init(TDGage gage)
{
this.gage = gage;
var items = new List<PlcGroupItem>();
//查找 脚本/称重 下的全部 设备连接变量表_xxx 的文件夹
DirectoryInfo directoryInfo = new DirectoryInfo(plcgroups_dirPath);
if (!directoryInfo.Exists)
{
//异常
return;
}
var dirs = directoryInfo.GetDirectories();
foreach (var dir in dirs)
{
if (dir.Name.StartsWith("设备连接变量表_"))
{
PlcGroupItem item = new PlcGroupItem();
item.Name = dir.Name.Substring("设备连接变量表_".Length);
item.Path = System.IO.Path.Combine(dir.FullName, "Generated", "plcgroup.json");
items.Add(item);
}
}
comboBox.ItemsSource = items;
foreach (var item in items)
{
if (IsSameContent(item.Path, plcgroup_filePath))
{
//找到了
comboBox.SelectedItem = item;
break;
}
}
sp_sysParam.DataContext = gage.mSysParam;
}
public static bool IsSameContent(string filePath1, string filePath2)
{
//创建一个哈希算法对象
using (HashAlgorithm hash = HashAlgorithm.Create())
{
using (FileStream file1 = new FileStream(filePath1, FileMode.Open), file2 = new FileStream(filePath2, FileMode.Open))
{
byte[] hashByte1 = hash.ComputeHash(file1);//哈希算法根据文本得到哈希码的字节数组
byte[] hashByte2 = hash.ComputeHash(file2);
return Enumerable.SequenceEqual(hashByte1, hashByte2);
//string str1 = BitConverter.ToString(hashByte1);//将字节数组装换为字符串
//string str2 = BitConverter.ToString(hashByte2);
//return (str1 == str2);//比较哈希码
}
}
}
private void btnOkClick(object sender, RoutedEventArgs e)
{
var item = comboBox.SelectedItem as PlcGroupItem;
if (item == null)
{
MessageBox.Show("请选择型号!!!");
return;
}
if (MessageBox.Show("需要重启,才能生效", "提示", MessageBoxButton.OKCancel) == MessageBoxResult.OK)
{
File.Copy(item.Path, plcgroup_filePath, true);
gage.mSysParam.Save();
//切换为exe的目录,这样程序再次进入时,才能 进入Gage1 文件夹
System.Environment.CurrentDirectory = "../";
//重启软件
AppHelper.AppJustOne.Restart();
}
}
}
}
using FLY.OBJComponents.Client;
using FLY.OBJComponents.IService;
using FLY.Weight.Common;
using FLY.Weight.IService;
using FObjBase;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace FLY.Weight.Client
{
public class FeederSystemServiceClient : FObjServiceClient, IFeederSystemService, IPropertyOpt
{
#region IFeederSystemService
#region 吸料
/// <summary>
/// 吸料
/// </summary>
public ObservableCollection<FeederData> FeederDatas { get; } = new ObservableCollection<FeederData>();
public FeederAccessory FeederAccy { get; } = new FeederAccessory();
/// <summary>
/// 每层吸料的吸料数量
/// </summary>
public int[] FeederCntOfEachs { get; set; }
#endregion
PLCProxySystemServiceClient plcos;
public IPLCProxySystemService PLCos => plcos;
/// <summary>
/// 版本
/// </summary>
public string Version { get; set; } = "1";
#endregion
SyncPropServiceClient syncPropServiceClient;
public event Action ResetFeederDatasEvent;
/// <summary>
/// 当前 INotifyPropertyChanged 对象 引发了 PropertyChanged, 是由于 接收到数据导致的
/// </summary>
public bool IsInPushValue
{
get
{
return syncPropServiceClient.IsInPushValue;
}
}
public FeederSystemServiceClient(UInt32 serviceId) : base(serviceId)
{
Init();
}
public FeederSystemServiceClient(UInt32 serviceId, string connName) : base(serviceId)
{
Init();
ConnName = connName;
FObjServiceClientManager.Instance.Connect_to_Another_OBJSys(connName, this);
}
string FeederIndex2Number(int index)
{
string number = ((char)('A' + (index))).ToString();
return number;
}
void FeederDatasAdd(int i, int feederCnt) {
string number = FeederIndex2Number(i);
var feederData = new FeederData();
feederData.Init(number, feederCnt);
FeederDatas.Add(feederData);
}
void Init()
{
Load();
for (int i = 0; i < FeederCntOfEachs.Count(); i++)
{
FeederDatasAdd(i, FeederCntOfEachs[i]);
}
//--------------------------------------------------------------
//属性同步
Dictionary<string, INotifyPropertyChanged> objnames = GetObjNames();
objnames.Add(".", this);
syncPropServiceClient = new SyncPropServiceClient(mServerID + 1, objnames);
//--------------------------------------------------------------
//PLC代理,用于添加更新任务
objnames = GetObjNames();
plcos = new PLCProxySystemServiceClient(mServerID + 2);
this.PropertyChanged += DownBlowingSystemServiceClient_PropertyChanged;
}
Dictionary<string, INotifyPropertyChanged> GetObjNames()
{
Dictionary<string, INotifyPropertyChanged> objnames = new Dictionary<string, INotifyPropertyChanged>();
objnames.Add(nameof(FeederAccy), FeederAccy);
for (int i = 0; i < FeederDatas.Count(); i++)
objnames.Add($"{nameof(FeederDatas)}[{i}]", FeederDatas[i]);
return objnames;
}
string filePath = "feederSystemClient.json";
void Save()
{
FeederSystemServiceClientJsonDb.Save(this, filePath);
}
void Load()
{
FeederSystemServiceClientJsonDb.Load(this, filePath);
}
private void DownBlowingSystemServiceClient_PropertyChanged(object sender, PropertyChangedEventArgs e)
{
if (e.PropertyName == nameof(FeederCntOfEachs))
{
if (IsFeederCntOfEachsChanged())
{
ResetFeederDatas();
Save();
}
}
}
bool IsFeederCntOfEachsChanged()
{
var feederCnts = FeederDatas.Select(i => i.FeederCnt).ToArray();
return !Enumerable.SequenceEqual(FeederCntOfEachs, feederCnts);
}
/// <summary>
/// 重新创建 FeederDatas
/// </summary>
void ResetFeederDatas()
{
int remove_cnt = FeederDatas.Count() - FeederCntOfEachs.Count();
if (remove_cnt > 0)
{
//多出来的Item 都要删除
for (int i = 0; i < remove_cnt; i++)
{
int index = FeederDatas.Count() - 1;
FeederDatas.RemoveAt(index);
string objname = $"{nameof(FeederDatas)}[{index}]";
syncPropServiceClient.Remove(objname);
}
}
else if (remove_cnt < 0)
{
//少了,需要添加
for (int i = 0; i < -remove_cnt; i++)
{
int index = FeederDatas.Count();
FeederDatasAdd(index, FeederCntOfEachs[index]);
string objname = $"{nameof(FeederDatas)}[{index}]";
syncPropServiceClient.Add(objname, FeederDatas[index]);
}
}
//现在数量一样, 重新初始化每层的吸料数量
for (int i = 0; i < FeederCntOfEachs.Count(); i++)
{
if (FeederDatas[i].FeederCnt != FeederCntOfEachs[i])
{
FeederDatas[i].Init(FeederIndex2Number(i), FeederCntOfEachs[i]);
}
}
ResetFeederDatasEvent?.Invoke();
return;
}
/// <summary>
///
/// </summary>
/// <returns></returns>
public override UInt32[] GetIDs()
{
List<UInt32> IDs = new List<uint>();
IDs.Add(ID);
IDs.Add(syncPropServiceClient.ID);
IDs.AddRange(((PLCProxySystemServiceClient)PLCos).GetIDs());
return IDs.ToArray();
}
public override void ConnectNotify(IFConn from)
{
base.ConnectNotify(from);
if (from.IsConnected)
{
CurrObjSys.SenseConfigEx(mConn, mServerID, ID,
0xffffffff, SENSE_CONFIG.ADD);
}
}
public string[] GetSyncPropNames()
{
return new string[]{
nameof(FeederCntOfEachs),
nameof(Version)
};
}
public string[] GetNoSyncPropNames()
{
return null;
}
}
public class FeederSystemServiceClientJsonDb
{
/// <summary>
/// 每层吸料的吸料数量
/// </summary>
public int[] FeederCntOfEachs = new int[] { 4, 4, 4, 4, 4 };
public string Version = "1";
public static bool Save(FeederSystemServiceClient src, string filePath)
{
try
{
FeederSystemServiceClientJsonDb jsonDb = new FeederSystemServiceClientJsonDb()
{
FeederCntOfEachs = src.FeederCntOfEachs,
Version = src.Version
};
string json = Newtonsoft.Json.JsonConvert.SerializeObject(jsonDb);
File.WriteAllText(filePath, json);
return true;
}
catch {
return false;
}
}
public static bool Load(FeederSystemServiceClient src, string filePath)
{
if (!File.Exists(filePath))
return false;
try
{
string json = File.ReadAllText(filePath);
var p = Newtonsoft.Json.JsonConvert.DeserializeObject<FeederSystemServiceClientJsonDb>(json);
src.FeederCntOfEachs = p.FeederCntOfEachs;
src.Version = p.Version;
return true;
}
catch
{
//失败就算了。。。
return false;
}
}
}
}
using Misc;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace FLY.Weight.Common
{
public class FeederAccessory : INotifyPropertyChanged
{
public FeederAccessory()
{
}
#region 辅助代码生成
/// <summary>
/// 1号电机运行时间
/// </summary>
[Description("1号电机运行时间")]
public float No1MotorRunTime { get; set; }
/// <summary>
/// 2号电机运行时间
/// </summary>
[Description("2号电机运行时间")]
public float No2MotorRunTime { get; set; }
/// <summary>
/// 吸料急停开启!!!请检查
/// </summary>
[Description("吸料急停开启!!!请检查")]
[IsError()]
public bool Warning001 { get; set; }
/// <summary>
/// 吸料1号电机过载!!!请检查
/// </summary>
[Description("吸料1号电机过载!!!请检查")]
[IsError()]
public bool Warning002 { get; set; }
/// <summary>
/// 吸料2号电机过载!!!请检查
/// </summary>
[Description("吸料2号电机过载!!!请检查")]
[IsError()]
public bool Warning003 { get; set; }
#endregion
public event PropertyChangedEventHandler PropertyChanged;
}
}
This diff is collapsed.
......@@ -49,17 +49,23 @@
<ItemGroup>
<Compile Include="Client\BulkDbMixServiceClient.cs" />
<Compile Include="Client\BulkDbFlowServiceClient.cs" />
<Compile Include="Client\FeederSystemServiceClient.cs" />
<Compile Include="Client\MixBufferCollection.cs" />
<Compile Include="Common\FeederAccessory.cs" />
<Compile Include="Common\FeederData.cs" />
<Compile Include="Common\WeighterAccessory.cs" />
<Compile Include="IService\IBulkDbMixService.cs" />
<Compile Include="IService\IBulkDbFlowService.cs" />
<Compile Include="IService\IFeederSystemService.cs" />
<Compile Include="OBJ_INTERFACE\OBJ_INTERFACE.cs" />
<Compile Include="Common\WeighterC.cs" />
<Compile Include="Client\WeightSystemServiceClient.cs" />
<Compile Include="IService\IWeightSystemService.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Server.OBJProxy\FeederSystem_OBJProxy.cs" />
<Compile Include="Server.OBJProxy\OBJProxy.cs" />
<Compile Include="Server.OBJProxy\WeightSystem_OBJProxy.cs" />
<Compile Include="Server\FeederSystem.cs" />
<Compile Include="Server\Model\BulkDbMix.cs" />
<Compile Include="Server\Model\DbModel.cs" />
<Compile Include="Server\Model\DbTable.cs" />
......
using FLY.OBJComponents.IService;
using FLY.Weight.Common;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace FLY.Weight.IService
{
public interface IFeederSystemService : INotifyPropertyChanged
{
/// <summary>
/// 吸料
/// </summary>
ObservableCollection<FeederData> FeederDatas { get; }
/// <summary>
/// 吸料其它附件
/// </summary>
FeederAccessory FeederAccy { get; }
/// <summary>
/// 每层吸料的吸料数量
/// </summary>
int[] FeederCntOfEachs { get; }
/// <summary>
/// 吸料版本
/// </summary>
string Version { get; }
/// <summary>
/// PLC代理系统
/// </summary>
IPLCProxySystemService PLCos { get; }
}
}
......@@ -20,6 +20,12 @@ namespace FLY.Weight.OBJ_INTERFACE
public const UInt32 WEIGHTS_OBJ_FLOW_ID = 35004;
public const UInt32 WEIGHTS_OBJ_MIX_BASE_ID = 35005;
/// <summary>
/// 4个
/// </summary>
public const UInt32 FEEDER_OBJ_ID = 35050;
/// <summary>
/// 每次配料记录列表, 1~5
/// </summary>
......
using FLY.OBJComponents.IService;
using FLY.OBJComponents.Server.OBJProxy;
using FLY.Weight.Server;
using FObjBase;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace FLY.Weight.Server.OBJProxy
{
class FeederSystem_OBJProxy : FObj
{
FeederSystem data;
public FeederSystem_OBJProxy(int objsys_idx, FeederSystem data) : base(objsys_idx)
{
ID = FLY.Weight.OBJ_INTERFACE.OBJ_INTERFACE.FEEDER_OBJ_ID;
this.data = data;
//--------------------------------------------------------------
//属性同步
Dictionary<string, INotifyPropertyChanged> objnames = new Dictionary<string, INotifyPropertyChanged>();
objnames.Add(".", data);
objnames.Add(nameof(FeederSystem.FeederAccy), data.FeederAccy);
for (int i = 0; i < data.FeederDatas.Count(); i++)
objnames.Add($"{nameof(FeederSystem.FeederDatas)}[{i}]", data.FeederDatas[i]);
var syncProp_OBJProxy = new SyncProp_OBJProxy(
objsys_idx, ID + 1, objnames);
var plcOS_OBJProxy = new FObjBase.Reflect.Reflect_Proxy(
objsys_idx,
ID + 2,
typeof(IPLCProxySystemService),
data.PLCos
);
}
}
}
......@@ -42,6 +42,12 @@ namespace FLY.Weight.Server.OBJProxy
typeof(IWarningSystem2Service),
gage.mWarning);
if (gage.mFeederSystem != null) {
var feederSystemOBJProxy = new FeederSystem_OBJProxy(objsys_idx, gage.mFeederSystem);
}
weightSystemOBJProxy.CurrObjSys.Start_Conn_Server(
new IPEndPoint(IPAddress.Any, gage.mSysParam.OBJ_Port));
}
......
using FLY.Modbus;
using FLY.OBJComponents.IService;
using FLY.OBJComponents.Server;
using FLY.Weight.Common;
using FLY.Weight.IService;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.IO;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
namespace FLY.Weight.Server
{
public class FeederSystem : IFeederSystemService, IPropertyOpt
{
/// <summary>
/// 吸料
/// </summary>
public ObservableCollection<FeederData> FeederDatas { get; } = new ObservableCollection<FeederData>();
/// <summary>
/// 吸料其它附件
/// </summary>
public FeederAccessory FeederAccy { get; } = new FeederAccessory();
/// <summary>
/// 每层吸料的吸料数量
/// </summary>
public int[] FeederCntOfEachs { get; private set; }
/// <summary>
/// 吸料版本
/// </summary>
public string Version { get; set; } = "1";
public PLCProxySystem plcos = new PLCProxySystem();
/// <summary>
/// PLC代理系统
/// </summary>
public IPLCProxySystemService PLCos { get { return plcos; } }
/// <summary>
/// 报警系统
/// </summary>
WarningSystem2 warning;
/// <summary>
/// 报警配置
/// </summary>
ErrorConf errorConf;
public event PropertyChangedEventHandler PropertyChanged;
PLCGroup plcgroup;
public FeederSystem()
{
}
public void Init(WarningSystem2 warning)
{
this.warning = warning;
//--------------------------------------------------------------------------------
//step 1 加载PLC寄存器 文件
AddConfigFile();
//--------------------------------------------------------------------------------
//step 2 报警配置
errorConf = new ErrorConf(plcos, this.warning, plcgroup.Devices.Select(d => d.PlcName).ToArray());
errorConf.AddErrorAction(FeederAccy);
foreach (var feederdata in FeederDatas)
{
errorConf.AddErrorAction(feederdata,
(ref string description, object state) => {
var fd = state as FeederData;
description = fd.Number + "层 " + description;
},
feederdata);
}
errorConf.InitError();
Misc.BindingOperations.SetBinding(this.warning, nameof(this.warning.IsRinging), () =>
{
if (!this.warning.IsRinging)
{
//把全部报警都复位, 当复位无效,该属性还是true,下次查寄存器时,还是能触发报警
errorConf.ResetError();
}
});
//--------------------------------------------------------------------------------
//step 3 历史数据记录
//--------------------------------------------------------------------------------
//last step PLC 更新计划服务初始化
plcos.Init();
}
void AddConfigFile()
{
plcos.AddConfigFile("feeder_plcgroup.json", (plcgroup) =>
{
this.plcgroup = plcgroup;
Version = plcgroup.Version;
//从plcgroup 分析出 有多少层,每层的仓数
//吸料
List<int> feederCntOfEachs = new List<int>();
Regex r = new Regex($@"{nameof(FeederDatas)}\[([0-9])\]");
Regex r2 = new Regex(@"IsFeederOn([1-9])");
foreach (PLCGroup.PLCVariable var in plcgroup.Variables)
{
Match m = r.Match(var.OwnerName);
if (m.Success)
{
int feederdata_idx = int.Parse(m.Groups[1].Value);
if (feederCntOfEachs.Count() <= feederdata_idx)
{
while (feederCntOfEachs.Count() <= feederdata_idx)
feederCntOfEachs.Add(0);
}
Match m2 = r2.Match(var.PropertyName);
if (m2.Success)
{
int feederCnt = int.Parse(m2.Groups[1].Value);
if (feederCntOfEachs[feederdata_idx] < feederCnt)
feederCntOfEachs[feederdata_idx] = feederCnt;
}
}
}
FeederCntOfEachs = feederCntOfEachs.ToArray();
for (int i = 0; i < FeederCntOfEachs.Count(); i++)
{
string number = FeederIndex2Number(i);
FeederData fd = new FeederData();
fd.Init(number, FeederCntOfEachs[i]);
FeederDatas.Add(fd);
}
//objname 转 obj
Dictionary<string, INotifyPropertyChanged> objnames = new Dictionary<string, INotifyPropertyChanged>();
objnames.Add(nameof(FeederAccy), FeederAccy);
if (FeederDatas != null)
{
for (int i = 0; i < FeederDatas.Count(); i++)
objnames.Add($"{nameof(FeederDatas)}[{i}]", FeederDatas[i]);
}
return objnames;
});
}
string FeederIndex2Number(int index)
{
string number = ((char)('A' + (index))).ToString();
return number;
}
public string[] GetSyncPropNames()
{
return new string[]{
nameof(FeederCntOfEachs),
nameof(Version)
};
}
public string[] GetNoSyncPropNames()
{
return null;
}
}
}
......@@ -25,6 +25,11 @@ namespace FLY.Weight.Server
/// </summary>
public bool BindingTotalFilmWidth { get; set; } = true;
/// <summary>
/// 有吸料系统
/// </summary>
public bool HasFeeder { get; set; } = false;
public SysParam()
{
}
......
......@@ -23,6 +23,7 @@ namespace FLY.Weight.Server
#region 本地数据----------------------------------------------------------------
public SysParam mSysParam;
public WeightSystem mData;
public FeederSystem mFeederSystem;
public HistoryDb mHistoryDb;
/// <summary>
/// 报警系统
......@@ -63,6 +64,9 @@ namespace FLY.Weight.Server
mHistoryDb = new HistoryDb();
mWarning = new WarningSystem2();
if (mSysParam.HasFeeder) {
mFeederSystem = new FeederSystem();
}
}
/// <summary>
/// 第1步, 加载本地数据
......@@ -92,6 +96,10 @@ namespace FLY.Weight.Server
mData.Init(mHistoryDb, mWarning);
if (mFeederSystem != null) {
mFeederSystem.Init(mWarning);
}
string connName = "blowing";
#region 与服务器同步的数据
FObjServiceClientManager.Instance.ConnAddrs.Add(new ConnAddr() { ConnName = connName, Addr = mSysParam.BlowingAddr });
......
......@@ -59,6 +59,7 @@ namespace FLY.Weight.Server
#endregion
/// <summary>
/// 报警系统
/// </summary>
......@@ -81,9 +82,6 @@ namespace FLY.Weight.Server
//--------------------------------------------------------------------------------
//step 1 加载PLC寄存器 文件
AddConfigFile();
}
public void Init(HistoryDb historyDb, WarningSystem2 warning)
......@@ -91,6 +89,8 @@ namespace FLY.Weight.Server
this.historyDb = historyDb;
this.warning = warning;
//--------------------------------------------------------------------------------
//step 2 报警配置
errorConf = new ErrorConf(plcos, this.warning, "称重");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment