Commit 7df48248 authored by 潘栩锋's avatar 潘栩锋 🚴

添加 根据AD盒V3,V2 版本号, 显示IO口的编号, V3是从X0~X15, V2是i1~i12

parent 42531211
......@@ -14,13 +14,14 @@
<ResourceDictionary Source="CtMicroGageStyle.xaml"/>
</ResourceDictionary.MergedDictionaries>
<local:IO2BitColorConverter x:Key="io2bitcolorconv"/>
<local:IONumberConverter x:Key="ioNumberConv"/>
<local:CtMircoGageVmUt x:Key="viewModel"
Thick="300.3" AD="12000" ADMax="65535" Position="5001" PosLength="8900" PosMm="500.1" Velocity="5.1" ControllerState="定点"
OStatus="0x0005"
IStatus="0xff7f"
IsError="False"
ErrMsg="枫莱尔控制器连接断开"
IsIOShowNo ="False"
/>
</ResourceDictionary>
</UserControl.Resources>
......@@ -130,7 +131,7 @@
<Rectangle Fill="{Binding IStatus,Converter={StaticResource io2bitcolorconv},ConverterParameter=13}" Style="{StaticResource IOStyle}"/>
<Grid>
<Rectangle Fill="{Binding IStatus,Converter={StaticResource io2bitcolorconv},ConverterParameter=12}" Style="{StaticResource IOStyle}"/>
<TextBlock Text="13" Style="{StaticResource IOTextStyle}"/>
<TextBlock Text="{Binding IsIOShowNo,Converter={StaticResource ioNumberConv},ConverterParameter=12}" Style="{StaticResource IOTextStyle}"/>
</Grid>
</StackPanel>
<StackPanel Orientation="Horizontal" Margin="4,0">
......@@ -139,7 +140,7 @@
<Rectangle Fill="{Binding IStatus,Converter={StaticResource io2bitcolorconv},ConverterParameter=9}" Style="{StaticResource IOStyle}"/>
<Grid>
<Rectangle Fill="{Binding IStatus,Converter={StaticResource io2bitcolorconv},ConverterParameter=8}" Style="{StaticResource IOStyle}"/>
<TextBlock Text="9" Style="{StaticResource IOTextStyle}"/>
<TextBlock Text="{Binding IsIOShowNo,Converter={StaticResource ioNumberConv},ConverterParameter=8}" Style="{StaticResource IOTextStyle}"/>
</Grid>
</StackPanel>
<StackPanel Orientation="Horizontal" Margin="4,0">
......@@ -148,7 +149,7 @@
<Rectangle Fill="{Binding IStatus,Converter={StaticResource io2bitcolorconv},ConverterParameter=5}" Style="{StaticResource IOStyle}"/>
<Grid>
<Rectangle Fill="{Binding IStatus,Converter={StaticResource io2bitcolorconv},ConverterParameter=4}" Style="{StaticResource IOStyle}"/>
<TextBlock Text="5" Style="{StaticResource IOTextStyle}"/>
<TextBlock Text="{Binding IsIOShowNo,Converter={StaticResource ioNumberConv},ConverterParameter=4}" Style="{StaticResource IOTextStyle}"/>
</Grid>
</StackPanel>
<StackPanel Orientation="Horizontal" Margin="4,0">
......@@ -157,7 +158,7 @@
<Rectangle Fill="{Binding IStatus,Converter={StaticResource io2bitcolorconv},ConverterParameter=1}" Style="{StaticResource IOStyle}"/>
<Grid>
<Rectangle Fill="{Binding IStatus,Converter={StaticResource io2bitcolorconv},ConverterParameter=0}" Style="{StaticResource IOStyle}"/>
<TextBlock Text="1" Style="{StaticResource IOTextStyle}"/>
<TextBlock Text="{Binding IsIOShowNo,Converter={StaticResource ioNumberConv},ConverterParameter=0}" Style="{StaticResource IOTextStyle}"/>
</Grid>
......@@ -176,7 +177,7 @@
<Rectangle Fill="{Binding OStatus,Converter={StaticResource io2bitcolorconv},ConverterParameter=5}" Style="{StaticResource IOStyle}"/>
<Grid>
<Rectangle Fill="{Binding OStatus,Converter={StaticResource io2bitcolorconv},ConverterParameter=4}" Style="{StaticResource IOStyle}"/>
<TextBlock Text="5" Style="{StaticResource IOTextStyle}"/>
<TextBlock Text="{Binding IsIOShowNo,Converter={StaticResource ioNumberConv},ConverterParameter=4}" Style="{StaticResource IOTextStyle}"/>
</Grid>
</StackPanel>
<StackPanel Orientation="Horizontal" Margin="4,0">
......@@ -185,7 +186,7 @@
<Rectangle Fill="{Binding OStatus,Converter={StaticResource io2bitcolorconv},ConverterParameter=1}" Style="{StaticResource IOStyle}"/>
<Grid>
<Rectangle Fill="{Binding OStatus,Converter={StaticResource io2bitcolorconv},ConverterParameter=0}" Style="{StaticResource IOStyle}"/>
<TextBlock Text="1" Style="{StaticResource IOTextStyle}"/>
<TextBlock Text="{Binding IsIOShowNo,Converter={StaticResource ioNumberConv},ConverterParameter=0}" Style="{StaticResource IOTextStyle}"/>
</Grid>
</StackPanel>
......
......@@ -4,6 +4,7 @@ using FLY.Thick.Base.Common;
using FLY.Thick.Base.IService;
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
......@@ -88,4 +89,36 @@ namespace FLY.Thick.Base.UI
throw new NotImplementedException();
}
}
public class IONumberConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
bool isIOShowNo = true;
int idx = 0;
if (value is bool)
{
isIOShowNo = (bool)value;
}
if (!(parameter is string))
{
return null;
}
if (!int.TryParse((string)parameter, out idx))
{
return null;
}
if (isIOShowNo)
{
return (idx + 1).ToString();
}
else {
return (idx).ToString();
}
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}
}
......@@ -50,7 +50,7 @@
<Setter Property="Foreground" Value="{StaticResource MahApps.Brushes.Accent}" />
<Setter Property="HorizontalAlignment" Value="Center" />
<Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="FontSize" Value="10"/>
<Setter Property="FontSize" Value="8"/>
</Style>
<Style x:Key="IconStyle" TargetType="{x:Type Control}" >
<Setter Property="Margin" Value="6"/>
......
......@@ -28,6 +28,7 @@ namespace FLY.Thick.Base.UI
public double Thick { get; set; }
public int AD { get; set; }
public int ADMax { get; set; }
public bool IsIOShowNo { get; set; } = true;
public int Position { get; set; }
public int PosLength { get; set; }
......@@ -113,6 +114,7 @@ namespace FLY.Thick.Base.UI
});
Misc.BindingOperations.SetBinding(this.initParam, nameof(CtMicroGageVm.initParam.PosLength), this, nameof(PosLength));
Misc.BindingOperations.SetBinding(dynArea, nameof(dynArea.IsIOShowNo), this, nameof(IsIOShowNo));
Misc.BindingOperations.SetBinding(dynArea, nameof(dynArea.OStatus), this, nameof(OStatus));
Misc.BindingOperations.SetBinding(dynArea, nameof(dynArea.IStatus), this, nameof(IStatus));
......
......@@ -26,7 +26,7 @@
</Style>
<Style x:Key="IOTextStyle" TargetType="TextBlock" BasedOn="{StaticResource Styles.Text.FieldContent}">
<Setter Property="FontSize" Value="20"/>
<Setter Property="Width" Value="30" />
<Setter Property="Width" Value="40" />
<Setter Property="Margin" Value="3" />
</Style>
<local:WdIoTipVmUt x:Key="viewModel"/>
......
......@@ -59,37 +59,16 @@ namespace FLY.Thick.Base.UI
this.dynArea = dynArea;
this.iODefineService = iODefineService;
for (int i = 0; i < 12; i++) {
IStatus.Add(new FlyAdIoStatus()
{
Number = $"i{i+1}"
});
};
for (int i = 0; i < 4; i++)
{
OStatus.Add(new FlyAdIoStatus()
{
Number = $"o{i+1}"
});
};
if (this.iODefineService is FObjBase.FObjServiceClient)
{
var client = this.iODefineService as FObjBase.FObjServiceClient;
if (client.IsConnected)
{
update();
}
client.PropertyChanged += Client_PropertyChanged;
}
else
{
update();
}
Misc.BindingOperations.SetBinding(dynArea, nameof(dynArea.IsIOShowNo), update);
Misc.BindingOperations.SetBinding(dynArea, nameof(dynArea.IStatus), updateIsOn_In);
Misc.BindingOperations.SetBinding(dynArea, nameof(dynArea.OStatus), updateIsOn_Out);
}
void updateIsOn_In()
......@@ -122,16 +101,16 @@ namespace FLY.Thick.Base.UI
{
iODefineService.GetIODefine((asyncContext, retData) => {
var reponse = retData as IODefineCollection;
if (reponse == null) {
var response = retData as IODefineCollection;
if (response == null) {
return;
}
var list = reponse.List;
var list = response.List;
if (list == null || list.Count() == 0)
return;
update(IODefine.IOTYPE.Input, IStatus, reponse.InCount, list);
update(IODefine.IOTYPE.Output, OStatus, reponse.OutCount, list);
update(IODefine.IOTYPE.Input, IStatus, dynArea.IsIOShowNo, response.InCount, list);
update(IODefine.IOTYPE.Output, OStatus, dynArea.IsIOShowNo, response.OutCount, list);
updateIsOn_In();
updateIsOn_Out();
......@@ -141,24 +120,38 @@ namespace FLY.Thick.Base.UI
void update(
IODefine.IOTYPE ioType,
ObservableCollection<FlyAdIoStatus> ioStatus,
bool isShowNo,
int ioCnt,
List<IODefine> list)
{
//补够数量
if (ioStatus.Count() != ioCnt && ioCnt > 0)
{
while (ioStatus.Count() > ioCnt)
ioStatus.Clear();
for (int i = 0; i < ioCnt; i++) {
string number;
if (isShowNo)
{
ioStatus.RemoveAt(ioStatus.Count() - 1);
if (ioType == IODefine.IOTYPE.Input)
{
number = $"i{i + 1}";
}
else
{
number = $"o{i + 1}";
}
}
while (ioStatus.Count() < ioCnt)
{
int i = ioStatus.Count();
ioStatus.Add(new FlyAdIoStatus()
else {
if (ioType == IODefine.IOTYPE.Input)
{
number = $"X{i}";
}
else
{
Number = $"i{i + 1}"
});
number = $"Y{i}";
}
}
ioStatus.Add(new FlyAdIoStatus()
{
Number = number
});
}
//获取中文
......@@ -216,18 +209,18 @@ namespace FLY.Thick.Base.UI
public WdIoTipVmUt()
{
for (int i = 0; i < 12; i++)
for (int i = 0; i < 16; i++)
{
IStatus.Add(new FlyAdIoStatus()
{
Number = $"i{i + 1}"
Number = $"X{i}"
});
};
for (int i = 0; i < 4; i++)
for (int i = 0; i < 8; i++)
{
OStatus.Add(new FlyAdIoStatus()
{
Number = $"o{i + 1}"
Number = $"Y{i}"
});
};
......
......@@ -27,8 +27,8 @@
</Style>
<local:DynAreaIOVmUt x:Key="ioVm" />
<local:DynAreaErrorVm x:Key="errorVm" IsError="True" ErrMsg="枫莱尔控制器连接断开 枫莱尔控制器连接断开"/>
<local:DynAreaErrorVm x:Key="errorVm" IsError="False" ErrMsg="枫莱尔控制器连接断开 枫莱尔控制器连接断开"/>
<local:IONumberConverter x:Key="ioNumberConv"/>
</ResourceDictionary>
</UserControl.Resources>
<Grid Height="100" >
......@@ -44,7 +44,7 @@
<Rectangle Fill="{Binding IStatus,Converter={StaticResource io2bitcolorconv},ConverterParameter=13}" Style="{StaticResource IOStyle}"/>
<Grid>
<Rectangle Fill="{Binding IStatus,Converter={StaticResource io2bitcolorconv},ConverterParameter=12}" Style="{StaticResource IOStyle}"/>
<TextBlock Text="13" Style="{StaticResource IOTextStyle}"/>
<TextBlock Text="{Binding IsIOShowNo,Converter={StaticResource ioNumberConv},ConverterParameter=12}" Style="{StaticResource IOTextStyle}"/>
</Grid>
</StackPanel>
<StackPanel Orientation="Horizontal" Margin="4,0">
......@@ -53,7 +53,7 @@
<Rectangle Fill="{Binding IStatus,Converter={StaticResource io2bitcolorconv},ConverterParameter=9}" Style="{StaticResource IOStyle}"/>
<Grid>
<Rectangle Fill="{Binding IStatus,Converter={StaticResource io2bitcolorconv},ConverterParameter=8}" Style="{StaticResource IOStyle}"/>
<TextBlock Text="9" Style="{StaticResource IOTextStyle}"/>
<TextBlock Text="{Binding IsIOShowNo,Converter={StaticResource ioNumberConv},ConverterParameter=8}" Style="{StaticResource IOTextStyle}"/>
</Grid>
</StackPanel>
<StackPanel Orientation="Horizontal" Margin="4,0">
......@@ -62,7 +62,7 @@
<Rectangle Fill="{Binding IStatus,Converter={StaticResource io2bitcolorconv},ConverterParameter=5}" Style="{StaticResource IOStyle}"/>
<Grid>
<Rectangle Fill="{Binding IStatus,Converter={StaticResource io2bitcolorconv},ConverterParameter=4}" Style="{StaticResource IOStyle}"/>
<TextBlock Text="5" Style="{StaticResource IOTextStyle}"/>
<TextBlock Text="{Binding IsIOShowNo,Converter={StaticResource ioNumberConv},ConverterParameter=4}" Style="{StaticResource IOTextStyle}"/>
</Grid>
</StackPanel>
<StackPanel Orientation="Horizontal" Margin="4,0">
......@@ -71,7 +71,7 @@
<Rectangle Fill="{Binding IStatus,Converter={StaticResource io2bitcolorconv},ConverterParameter=1}" Style="{StaticResource IOStyle}"/>
<Grid>
<Rectangle Fill="{Binding IStatus,Converter={StaticResource io2bitcolorconv},ConverterParameter=0}" Style="{StaticResource IOStyle}"/>
<TextBlock Text="1" Style="{StaticResource IOTextStyle}"/>
<TextBlock Text="{Binding IsIOShowNo,Converter={StaticResource ioNumberConv},ConverterParameter=0}" Style="{StaticResource IOTextStyle}"/>
</Grid>
</StackPanel>
</StackPanel>
......@@ -88,7 +88,7 @@
<Rectangle Fill="{Binding OStatus,Converter={StaticResource io2bitcolorconv},ConverterParameter=5}" Style="{StaticResource IOStyle}"/>
<Grid>
<Rectangle Fill="{Binding OStatus,Converter={StaticResource io2bitcolorconv},ConverterParameter=4}" Style="{StaticResource IOStyle}"/>
<TextBlock Text="5" Style="{StaticResource IOTextStyle}"/>
<TextBlock Text="{Binding IsIOShowNo,Converter={StaticResource ioNumberConv},ConverterParameter=4}" Style="{StaticResource IOTextStyle}"/>
</Grid>
</StackPanel>
<StackPanel Orientation="Horizontal" Margin="4,0">
......@@ -97,7 +97,7 @@
<Rectangle Fill="{Binding OStatus,Converter={StaticResource io2bitcolorconv},ConverterParameter=1}" Style="{StaticResource IOStyle}"/>
<Grid>
<Rectangle Fill="{Binding OStatus,Converter={StaticResource io2bitcolorconv},ConverterParameter=0}" Style="{StaticResource IOStyle}"/>
<TextBlock Text="1" Style="{StaticResource IOTextStyle}"/>
<TextBlock Text="{Binding IsIOShowNo,Converter={StaticResource ioNumberConv},ConverterParameter=0}" Style="{StaticResource IOTextStyle}"/>
</Grid>
</StackPanel>
</StackPanel>
......
......@@ -24,6 +24,7 @@ using MultiLayout;
using FLY.OBJComponents.IService;
using GalaSoft.MvvmLight.Command;
using FObjBase.Reflect;
using System.Globalization;
namespace FLY.Thick.Base.UI.UiModule
{
......@@ -65,6 +66,7 @@ namespace FLY.Thick.Base.UI.UiModule
public UInt16 IStatus { get; set; } = 0xffff;
public UInt16 OStatus { get; set; } = 0x000f;
public bool IsIOShowNo { get; set; } = true;
public int Hrs { get; set; } = 3;
/// <summary>
......@@ -94,7 +96,9 @@ namespace FLY.Thick.Base.UI.UiModule
Misc.BindingOperations.SetBinding(this.dynArea, nameof(this.dynArea.IStatus), this, nameof(IStatus));
Misc.BindingOperations.SetBinding(this.dynArea, nameof(this.dynArea.OStatus), this, nameof(OStatus));
Misc.BindingOperations.SetBinding(this.dynArea, nameof(this.dynArea.IsIOShowNo), this, nameof(IsIOShowNo));
Misc.BindingOperations.SetBinding(this.dynArea, nameof(this.dynArea.Hrs), this, nameof(Hrs));
UpdateIsForever();
this.dynArea.PropertyChanged += (s, e) =>
......@@ -400,4 +404,38 @@ namespace FLY.Thick.Base.UI.UiModule
}
}
public class IONumberConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
bool isIOShowNo = true;
int idx = 0;
if (value is bool)
{
isIOShowNo = (bool)value;
}
if (!(parameter is string))
{
return null;
}
if (!int.TryParse((string)parameter, out idx))
{
return null;
}
if (isIOShowNo)
{
return (idx + 1).ToString();
}
else
{
return (idx).ToString();
}
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}
}
......@@ -26,6 +26,7 @@
</Style>
<local:DynAreaIOVm x:Key="ioVm" IStatus = "0xff7f" OStatus = "0x0005" Hrs = "2000" IsForever="False"/>
<local:IONumberConverter x:Key="ioNumberConv"/>
</ResourceDictionary>
</UserControl.Resources>
<Button Style="{StaticResource Styles.Button.Empty}" d:DataContext="{StaticResource ioVm}" Command="{Binding OpenIoTipCmd}">
......@@ -40,7 +41,7 @@
<Rectangle Fill="{Binding IStatus,Converter={StaticResource io2bitcolorconv},ConverterParameter=13}" Style="{StaticResource IOStyle}"/>
<Grid>
<Rectangle Fill="{Binding IStatus,Converter={StaticResource io2bitcolorconv},ConverterParameter=12}" Style="{StaticResource IOStyle}"/>
<TextBlock Text="13" Style="{StaticResource IOTextStyle}"/>
<TextBlock Text="{Binding IsIOShowNo,Converter={StaticResource ioNumberConv},ConverterParameter=12}" Style="{StaticResource IOTextStyle}"/>
</Grid>
</StackPanel>
<StackPanel Orientation="Horizontal" Margin="4,0">
......@@ -49,7 +50,7 @@
<Rectangle Fill="{Binding IStatus,Converter={StaticResource io2bitcolorconv},ConverterParameter=9}" Style="{StaticResource IOStyle}"/>
<Grid>
<Rectangle Fill="{Binding IStatus,Converter={StaticResource io2bitcolorconv},ConverterParameter=8}" Style="{StaticResource IOStyle}"/>
<TextBlock Text="9" Style="{StaticResource IOTextStyle}"/>
<TextBlock Text="{Binding IsIOShowNo,Converter={StaticResource ioNumberConv},ConverterParameter=8}" Style="{StaticResource IOTextStyle}"/>
</Grid>
</StackPanel>
<StackPanel Orientation="Horizontal" Margin="4,0">
......@@ -58,7 +59,7 @@
<Rectangle Fill="{Binding IStatus,Converter={StaticResource io2bitcolorconv},ConverterParameter=5}" Style="{StaticResource IOStyle}"/>
<Grid>
<Rectangle Fill="{Binding IStatus,Converter={StaticResource io2bitcolorconv},ConverterParameter=4}" Style="{StaticResource IOStyle}"/>
<TextBlock Text="5" Style="{StaticResource IOTextStyle}"/>
<TextBlock Text="{Binding IsIOShowNo,Converter={StaticResource ioNumberConv},ConverterParameter=4}" Style="{StaticResource IOTextStyle}"/>
</Grid>
</StackPanel>
<StackPanel Orientation="Horizontal" Margin="4,0">
......@@ -67,7 +68,7 @@
<Rectangle Fill="{Binding IStatus,Converter={StaticResource io2bitcolorconv},ConverterParameter=1}" Style="{StaticResource IOStyle}"/>
<Grid>
<Rectangle Fill="{Binding IStatus,Converter={StaticResource io2bitcolorconv},ConverterParameter=0}" Style="{StaticResource IOStyle}"/>
<TextBlock Text="1" Style="{StaticResource IOTextStyle}"/>
<TextBlock Text="{Binding IsIOShowNo,Converter={StaticResource ioNumberConv},ConverterParameter=0}" Style="{StaticResource IOTextStyle}"/>
</Grid>
</StackPanel>
</StackPanel>
......@@ -84,7 +85,7 @@
<Rectangle Fill="{Binding OStatus,Converter={StaticResource io2bitcolorconv},ConverterParameter=5}" Style="{StaticResource IOStyle}"/>
<Grid>
<Rectangle Fill="{Binding OStatus,Converter={StaticResource io2bitcolorconv},ConverterParameter=4}" Style="{StaticResource IOStyle}"/>
<TextBlock Text="5" Style="{StaticResource IOTextStyle}"/>
<TextBlock Text="{Binding IsIOShowNo,Converter={StaticResource ioNumberConv},ConverterParameter=4}" Style="{StaticResource IOTextStyle}"/>
</Grid>
</StackPanel>
<StackPanel Orientation="Horizontal" Margin="4,0">
......@@ -93,7 +94,7 @@
<Rectangle Fill="{Binding OStatus,Converter={StaticResource io2bitcolorconv},ConverterParameter=1}" Style="{StaticResource IOStyle}"/>
<Grid>
<Rectangle Fill="{Binding OStatus,Converter={StaticResource io2bitcolorconv},ConverterParameter=0}" Style="{StaticResource IOStyle}"/>
<TextBlock Text="1" Style="{StaticResource IOTextStyle}"/>
<TextBlock Text="{Binding IsIOShowNo,Converter={StaticResource ioNumberConv},ConverterParameter=0}" Style="{StaticResource IOTextStyle}"/>
</Grid>
</StackPanel>
</StackPanel>
......
......@@ -107,6 +107,10 @@ namespace FLY.Thick.Base.Common
public UInt16 OStatus { get; set; } = 0xffff;
/// <summary>
/// I/O 显示编号1~16
/// </summary>
public bool IsIOShowNo { get; set; } = true;
#endregion
#region 系统
......
using FLY.Thick.Base.IService;
using FlyADBase;
using FObjBase;
using System;
using System.Collections.Generic;
......@@ -31,8 +32,15 @@ namespace FLY.Thick.Base.Common
/// 子类 需要 重新 把子类对象 赋值给 Instance, 确保整个环境只用一个版本的 单例
/// </summary>
public static FlyADIODefine Instance => instance;
#region 输入口
/// <summary>
/// 扫描按钮信号
/// </summary>
[Description("扫描按钮信号")]
public int InNo_Scan { get; protected set; } = 1 - 1;
/// <summary>
/// 归零信号
/// </summary>
......@@ -95,6 +103,13 @@ namespace FLY.Thick.Base.Common
#endregion
#region 输出口
/// <summary>
/// 扫描动作中
/// </summary>
[Description("扫描动作中")]
public int OutNo_Scan { get; protected set; } = 1 - 1;
/// <summary>
/// 变频器反转 VF0 是松下的变频器牌子
/// </summary>
......@@ -132,30 +147,29 @@ namespace FLY.Thick.Base.Common
#endregion
private int version = 2;
/// <summary>
/// 根据AD盒的版本,设置
/// </summary>
/// <param name="version"></param>
public virtual void SerVersion(int version)
IFlyAD flyAD;
public virtual void SetFlyAD(IFlyAD _flyAD)
{
this.version = version;
if (this.version == 3)
this.flyAD = _flyAD;
Misc.BindingOperations.SetBinding(flyAD, nameof(flyAD.HardwareVersion), () =>
{
InNo_Org = 13 - 1;
InNo_Limit_Forw = 14 - 1;
InNo_Limit_Backw = 16 - 1;
if (this.flyAD.HardwareVersion < 3)
{
InNo_Org = 2 - 1;
InNo_Limit_Forw = 3 - 1;
InNo_Limit_Backw = 4 - 1;
InNo_Roll = 15 - 1;
}
else
{
InNo_Org = 2 - 1;
InNo_Limit_Forw = 3 - 1;
InNo_Limit_Backw = 4 - 1;
InNo_Roll = 11 - 1;
}
else
{
InNo_Org = 13 - 1;
InNo_Limit_Forw = 14 - 1;
InNo_Limit_Backw = 16 - 1;
InNo_Roll = 11 - 1;
}
InNo_Roll = 15 - 1;
}
});
}
/// <summary>
......@@ -201,23 +215,37 @@ namespace FLY.Thick.Base.Common
public void GetIODefine(AsyncCBHandler asyncDelegate, object asyncContext)
{
//获取全部带 Description 的属性,且名字 InNo_XXX 或 OutNo_XXX
IODefineCollection reponse = new IODefineCollection();
IODefineCollection response = new IODefineCollection();
List<IODefine> list = new List<IODefine>();
reponse.List = list;
if (version == 3)
response.List = list;
if (flyAD.HardwareVersion < 3)
{
reponse.InCount = 16;
reponse.OutCount = 8;
response.InCount = 12;
response.OutCount = 4;
}
else {
reponse.InCount = 12;
reponse.OutCount = 4;
response.InCount = 16;
response.OutCount = 8;
}
var inputPropertyNames = GetInputPropertyNames();
var outputPropertyNames = GetOutputPropertyNames();
if (flyAD.MotorType != FlyADBase.MOTORTYPE.VF0)
{
//把 变频器 接口删除
outputPropertyNames.Remove(nameof(OutNo_VF0_Forw));
outputPropertyNames.Remove(nameof(OutNo_VF0_Backw));
outputPropertyNames.Remove(nameof(OutNo_VF0_Slow));
}
if (flyAD.MotorType == FlyADBase.MOTORTYPE.VF0)
{
//变频器 模式 没有扫描状态灯
outputPropertyNames.Remove(nameof(OutNo_Scan));
}
Type t = this.GetType();
foreach (var propertyName in inputPropertyNames)
......@@ -240,6 +268,7 @@ namespace FLY.Thick.Base.Common
Index = index,
Description = desp
};
list.Add(iodefine);
}
......@@ -266,7 +295,7 @@ namespace FLY.Thick.Base.Common
list.Add(iodefine);
}
asyncDelegate?.Invoke(asyncContext, reponse);
asyncDelegate?.Invoke(asyncContext, response);
}
}
}
......@@ -32,7 +32,6 @@ namespace FLY.Thick.Base.IService
/// 输出口数量
/// </summary>
public int OutCount;
/// <summary>
/// 列表
/// </summary>
......
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