Commit 8424f769 authored by 潘栩锋's avatar 潘栩锋 🚴

修复 收卷,下吹测量旋转架位置,反向开关失效

parent 10bcf722
......@@ -71,6 +71,9 @@
<Compile Include="WdDRList.xaml.cs">
<DependentUpon>WdDRList.xaml</DependentUpon>
</Compile>
<Compile Include="WdRotary.xaml.cs">
<DependentUpon>WdRotary.xaml</DependentUpon>
</Compile>
<Compile Include="WdSetup.xaml.cs">
<DependentUpon>WdSetup.xaml</DependentUpon>
</Compile>
......@@ -98,6 +101,10 @@
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="WdRotary.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="WdSetup.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
......
......@@ -13,45 +13,119 @@
<local:PgMainVmUt x:Key="viewModel"/>
</Page.Resources>
<Grid d:DataContext="{StaticResource viewModel}">
<StackPanel>
<ItemsControl x:Name="itemcontrol" ItemsSource="{Binding PLCs}" Margin="5">
<ItemsControl.ItemTemplate>
<DataTemplate>
<StackPanel>
<StackPanel Orientation="Horizontal" >
<StackPanel Margin="4" >
<TextBlock Text="更新速度" />
<TextBlock FontSize="20">
<Run Text="{Binding ActUpdateInterval,Converter={StaticResource timespan2msConv}, Mode=OneWay}" />
<StackPanel Margin="5">
<GroupBox Header="PLC" Margin="5">
<StackPanel>
<ItemsControl x:Name="itemcontrol" ItemsSource="{Binding PLCs}">
<ItemsControl.ItemTemplate>
<DataTemplate>
<StackPanel>
<StackPanel Orientation="Horizontal" >
<StackPanel Margin="4" >
<TextBlock Text="更新速度" />
<TextBlock FontSize="20">
<Run Text="{Binding ActUpdateInterval,StringFormat=\{0:sfff\}, Mode=OneWay}" />
<Run Text="ms" FontSize="15"/>
</TextBlock>
</StackPanel>
<StackPanel Margin="4" >
<TextBlock Text="{Binding Client.RemoteAddr,Mode=OneWay}" />
<TextBlock >
</TextBlock>
</StackPanel>
<StackPanel Margin="4" >
<TextBlock Text="{Binding Client.RemoteAddr,Mode=OneWay}" />
<TextBlock >
连接状态[<Run Text="{Binding Client.IsConnected,Mode=OneWay}" FontSize="20"/>]
</TextBlock>
</StackPanel>
<StackPanel Margin="4" >
<TextBlock Text="异常次数" />
<TextBlock Text="{Binding ErrorCnt}" FontSize="20"/>
</StackPanel>
<StackPanel Margin="4" >
<TextBlock Text="寄存器更新数" />
<StackPanel Orientation="Horizontal">
<TextBlock FontSize="20">
</TextBlock>
</StackPanel>
<StackPanel Margin="4" >
<TextBlock Text="异常次数" />
<TextBlock Text="{Binding ErrorCnt}" FontSize="20"/>
</StackPanel>
<StackPanel Margin="4" >
<TextBlock Text="寄存器更新数" />
<StackPanel Orientation="Horizontal">
<TextBlock FontSize="20">
<Run Text="{Binding DRNeedUpdateCnt,Mode=OneWay}"/>/<Run Text="{Binding DRCnt,Mode=OneWay}"/>
</TextBlock>
</TextBlock>
</StackPanel>
</StackPanel>
<Button Margin="4" Padding="5,2" Content="..." Tag="{Binding .}" Click="btnMoreClick"/>
</StackPanel>
</StackPanel>
<Button Margin="4" Content="..." Height="40" Width="40" Tag="{Binding .}" Click="btnMoreClick"/>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
<Button Content="配置" Padding="20,5" Margin="5" HorizontalAlignment="Left" Click="btnSetupClick"></Button>
</StackPanel>
</GroupBox>
<GroupBox x:Name="gbRotary" Header="旋转架" Margin="5">
<StackPanel>
<StackPanel Orientation="Horizontal" >
<StackPanel Margin="4" >
<TextBlock Text="旋转启动" />
<TextBlock FontSize="20" Text="{Binding IsRotaryOn}"/>
</StackPanel>
<StackPanel Margin="4" >
<TextBlock Text="顺时针旋转(反)" />
<TextBlock FontSize="20" Text="{Binding IsBackw}"/>
</StackPanel>
<StackPanel Margin="4" >
<TextBlock Text="逆时针旋转(正)" />
<TextBlock FontSize="20" Text="{Binding IsForw}"/>
</StackPanel>
<StackPanel Margin="4" >
<TextBlock Text="电机频率" />
<StackPanel Orientation="Horizontal">
<TextBlock FontSize="20" Text="{Binding RotaryFreqSet,StringFormat={}{0:F0}}"/>
<TextBlock Text="Hz" VerticalAlignment="Bottom"/>
</StackPanel>
</StackPanel>
<StackPanel Margin="4" >
<TextBlock Text="速度" />
<StackPanel Orientation="Horizontal">
<TextBlock FontSize="20" Text="{Binding RSpeed,StringFormat={}{0:F0}}"/>
<TextBlock Text="pps" VerticalAlignment="Bottom"/>
</StackPanel>
</StackPanel>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
<Button Content="配置" Padding="20,5" Margin="5" HorizontalAlignment="Left" Click="btnSetupClick"></Button>
<StackPanel Margin="4" >
<TextBlock Text="全局脉冲" />
<StackPanel Orientation="Horizontal">
<TextBlock FontSize="20" Text="{Binding RPosGlobal,StringFormat={}{0:F0}}"/>
<TextBlock Text="p" VerticalAlignment="Bottom"/>
</StackPanel>
</StackPanel>
</StackPanel>
<StackPanel Orientation="Horizontal" >
<StackPanel Margin="4" >
<TextBlock Text="换向信号0" />
<TextBlock>
<Run Text="{Binding IsTurnSign0}"/>[<Run FontSize="20" Text="{Binding RPosAtTurnSign0,StringFormat={}{0:F0}}"/>p]
(<Run FontSize="20" Text="{Binding TurnSign0Cnt}"/>)
</TextBlock>
</StackPanel>
<StackPanel Margin="4" >
<TextBlock Text="复位原点信号" />
<TextBlock>
<Run Text="{Binding IsOrgSign}"/>[<Run FontSize="20" Text="{Binding RPosAtOrgSign,StringFormat={}{0:F0}}"/>p]
</TextBlock>
</StackPanel>
<StackPanel Margin="4" >
<TextBlock Text="换向信号1" />
<TextBlock>
<Run Text="{Binding IsTurnSign1}"/>[<Run FontSize="20" Text="{Binding RPosAtTurnSign1,StringFormat={}{0:F0}}"/>p]
</TextBlock>
</StackPanel>
<StackPanel Margin="4" >
<TextBlock Text="牵引速度" />
<TextBlock>
<Run FontSize="20" Text="{Binding TractionVelocity,StringFormat={}{0:F1}}"/>m/min
</TextBlock>
</StackPanel>
<Button Content="配置" Padding="20,5" Margin="5" HorizontalAlignment="Left" Click="btnRotaryClick"></Button>
</StackPanel>
</StackPanel>
</GroupBox>
</StackPanel>
</Grid>
</Page>
......@@ -21,16 +21,19 @@ namespace FLY.DownBlowing.UI.Server
/// </summary>
public partial class PgMain : Page
{
FLY.DownBlowing.Server.TDGage gage;
public PgMain()
{
InitializeComponent();
}
public void Init(FLY.DownBlowing.Server.TDGage gage)
{
this.gage = gage;
FLY.OBJComponents.Server.PLCProxySystem plsos =
gage.mData.PLCos as FLY.OBJComponents.Server.PLCProxySystem;
this.itemcontrol.ItemsSource = plsos.PLCs;
this.gbRotary.DataContext = gage.rotarySystem;
}
private void btnSetupClick(object sender, RoutedEventArgs e)
......@@ -49,6 +52,13 @@ namespace FLY.DownBlowing.UI.Server
w.Init(plc);
w.ShowDialog();
}
private void btnRotaryClick(object sender, RoutedEventArgs e)
{
WdRotary w = new WdRotary();
w.Init(gage.rotarySystem);
w.ShowDialog();
}
}
public class PgMainVmUt : INotifyPropertyChanged
......
......@@ -51,7 +51,7 @@ using System.Windows;
// 可以指定所有值,也可以使用以下所示的 "*" 预置版本号和修订号
// 方法是按如下所示使用“*”: :
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("7.0.0")]
[assembly: AssemblyFileVersion("7.0.0")]
[assembly: AssemblyVersion("7.0.2")]
[assembly: AssemblyFileVersion("7.0.2")]
[assembly: Guid("A4B71A37-7B77-47AA-9F59-ACC3EF84C4E0")]
<Window x:Class="FLY.DownBlowing.UI.Server.WdRotary"
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.DownBlowing.UI.Server"
mc:Ignorable="d"
Title="WdRotary" Height="101.4" Width="518.1">
<Grid>
<StackPanel>
<StackPanel Orientation="Horizontal">
<StackPanel Margin="5" x:Name="spRotary">
<CheckBox Content="反向" IsChecked="{Binding IsReversed}"/>
</StackPanel>
<Button Content="确定" Padding="20,5" Margin="5" Click="btnOkClick"/>
</StackPanel>
</StackPanel>
</Grid>
</Window>

using FLY.DownBlowing.Server;
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 FLY.DownBlowing.UI.Server
{
/// <summary>
/// WdRotary.xaml 的交互逻辑
/// </summary>
public partial class WdRotary : Window
{
RotarySystem rotarySystem;
public WdRotary()
{
InitializeComponent();
}
public void Init(RotarySystem rotarySystem)
{
this.rotarySystem = rotarySystem;
spRotary.DataContext = rotarySystem;
}
private void btnOkClick(object sender, RoutedEventArgs e)
{
rotarySystem.Save();
}
}
}
......@@ -62,10 +62,15 @@
<Compile Include="Server\Model\DbModel.cs" />
<Compile Include="Server\Model\DbTable.cs" />
<Compile Include="Server\Model\HistoryDb.cs" />
<Compile Include="Server\RotarySystem.cs" />
<Compile Include="Server\SysParam.cs" />
<Compile Include="Server\TDGage.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\Project.FLY.Thick.Blowing\FLY.Thick.Blowing.RotaryMachine\FLY.Thick.Blowing.RotaryMachine.csproj">
<Project>{a1e64379-0509-4b01-8cea-5bc3cb323403}</Project>
<Name>FLY.Thick.Blowing.RotaryMachine</Name>
</ProjectReference>
<ProjectReference Include="..\..\thick_public\Project.FLY.FObjSys\FObjBaseReflect\FObjBase.Reflect.csproj">
<Project>{15f40c32-d546-4b2a-8d80-b3ddbcdaa690}</Project>
<Name>FObjBase.Reflect</Name>
......
......@@ -17,6 +17,6 @@ namespace FLY.DownBlowing.OBJ_INTERFACE
public const UInt32 WARNING_OBJ_ID = 20000;
public const UInt32 RotarySerivce_OBJ_ID = FLY.Thick.Blowing.RotaryMachine.OBJ_INTERFACE.OBJ_INTERFACE_ID.RotarySerivce_OBJ_ID;
}
}
using FLY.DownBlowing.IService;
using FLY.DownBlowing.OBJ_INTERFACE;
using FLY.OBJComponents.Server.OBJProxy;
using FLY.Thick.Blowing.RotaryMachine.IService;
using System.Net;
namespace FLY.DownBlowing.Server.OBJProxy
......@@ -16,6 +17,11 @@ namespace FLY.DownBlowing.Server.OBJProxy
var warnSystemOBJProxy = new FObjBase.Reflect.Reflect_Proxy(objsys_idx, OBJ_INTERFACE_ID.WARNING_OBJ_ID,
typeof(OBJComponents.IService.IWarningSystem2Service), mGage.mWarning);
var mRotarySystemOBJProxy = new FObjBase.Reflect.Reflect_Proxy(
objsys_idx,
OBJ_INTERFACE_ID.RotarySerivce_OBJ_ID,
typeof(IRotarySerivce),
gage.rotarySystem);
downBlowingSystemOBJProxy.CurrObjSys.Start_Conn_Server(
new IPEndPoint(IPAddress.Any, gage.mSysParam.OBJ_Port));
......
This diff is collapsed.
using FLY.OBJComponents.Server;
using FLY.OBJComponents.IService;
using FLY.OBJComponents.Server;
using FLY.OBJComponents.Server.OBJProxy;
using FObjBase;
using System;
......@@ -21,7 +22,7 @@ namespace FLY.DownBlowing.Server
Model.DbModel mDbModel;
public Model.HistoryDb mHistoryDb;
public WarningSystem2 mWarning;
public RotarySystem rotarySystem;
public TDGage(string nam)
{
mName = nam;
......@@ -39,6 +40,7 @@ namespace FLY.DownBlowing.Server
mDbModel = new Model.DbModel();
mHistoryDb = new Model.HistoryDb();
mWarning = new WarningSystem2();
rotarySystem = new RotarySystem();
}
#region Init登陆服务器初始化----------------------------------------------------
/// <summary>
......@@ -69,7 +71,14 @@ namespace FLY.DownBlowing.Server
mWarning.Init(mHistoryDb.ErrorBuffer);
mData.Init(mHistoryDb, mWarning);
rotarySystem.Init(mData.WinderData);
Misc.BindingOperations.SetBinding(mData.PLCos, nameof(IPLCProxySystemService.IsConnectedWithPLC), () => {
if (mData.PLCos.IsConnectedWithPLC)
rotarySystem.StartMeasureRPos();
else
rotarySystem.StopMeasureRPos();
});
}
......
......@@ -70,6 +70,9 @@
<Compile Include="WdDRList.xaml.cs">
<DependentUpon>WdDRList.xaml</DependentUpon>
</Compile>
<Compile Include="WdRotary.xaml.cs">
<DependentUpon>WdRotary.xaml</DependentUpon>
</Compile>
<Compile Include="WdSetup.xaml.cs">
<DependentUpon>WdSetup.xaml</DependentUpon>
</Compile>
......@@ -97,6 +100,10 @@
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="WdRotary.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="WdSetup.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
......
......@@ -89,7 +89,6 @@
<TextBlock Text="p" VerticalAlignment="Bottom"/>
</StackPanel>
</StackPanel>
<Button Margin="4" Padding="5,2" Content="..." Tag="{Binding .}" />
</StackPanel>
<StackPanel Orientation="Horizontal" >
<StackPanel Margin="4" >
......@@ -117,6 +116,7 @@
<Run FontSize="20" Text="{Binding TractionVelocity,StringFormat={}{0:F1}}"/>m/min
</TextBlock>
</StackPanel>
<Button Content="配置" Padding="20,5" Margin="5" HorizontalAlignment="Left" Click="btnRotaryClick"></Button>
</StackPanel>
</StackPanel>
......
......@@ -23,12 +23,14 @@ namespace FLY.Winder.UI.Server
/// </summary>
public partial class PgMain : Page
{
TDGage gage;
public PgMain()
{
InitializeComponent();
}
public void Init(TDGage gage)
{
this.gage = gage;
var plsos = gage.mData.PLCos as FLY.OBJComponents.Server.PLCProxySystem;
this.itemcontrol.ItemsSource = plsos.PLCs;
......@@ -51,6 +53,13 @@ namespace FLY.Winder.UI.Server
w.Init(plc);
w.ShowDialog();
}
private void btnRotaryClick(object sender, RoutedEventArgs e)
{
WdRotary w = new WdRotary();
w.Init(gage.rotarySystem);
w.ShowDialog();
}
}
public class PgMainVmUt : INotifyPropertyChanged
{
......
......@@ -51,6 +51,6 @@ using System.Windows;
// 可以指定所有值,也可以使用以下所示的 "*" 预置版本号和修订号
// 方法是按如下所示使用“*”: :
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("7.0.0.0")]
[assembly: AssemblyFileVersion("7.0.0.0")]
[assembly: AssemblyVersion("7.0.2.0")]
[assembly: AssemblyFileVersion("7.0.2.0")]
[assembly: Guid("0CE35EA7-927A-41C0-9DC6-80511329760B")]
<Window x:Class="FLY.Winder.UI.Server.WdRotary"
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.Winder.UI.Server"
mc:Ignorable="d"
Title="WdRotary" Height="101.4" Width="518.1">
<Grid>
<StackPanel>
<StackPanel Orientation="Horizontal">
<StackPanel Margin="5" x:Name="spRotary">
<CheckBox Content="反向" IsChecked="{Binding IsReversed}"/>
</StackPanel>
<Button Content="确定" Padding="20,5" Margin="5" Click="btnOkClick"/>
</StackPanel>
</StackPanel>
</Grid>
</Window>
using FLY.Winder.Server;
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 FLY.Winder.UI.Server
{
/// <summary>
/// WdRotary.xaml 的交互逻辑
/// </summary>
public partial class WdRotary : Window
{
RotarySystem rotarySystem;
public WdRotary()
{
InitializeComponent();
}
public void Init(RotarySystem rotarySystem)
{
this.rotarySystem = rotarySystem;
spRotary.DataContext = rotarySystem;
}
private void btnOkClick(object sender, RoutedEventArgs e)
{
rotarySystem.Save();
}
}
}
......@@ -21,6 +21,6 @@ namespace FLY.Winder.OBJ_INTERFACE
public const UInt32 WINDER_OBJ_INFOLIST_ID = 33004;
public const UInt32 RotarySerivce_OBJ_ID = 33010;
public const UInt32 RotarySerivce_OBJ_ID = FLY.Thick.Blowing.RotaryMachine.OBJ_INTERFACE.OBJ_INTERFACE_ID.RotarySerivce_OBJ_ID;
}
}
......@@ -18,7 +18,7 @@ namespace FLY.Winder.Server
/// <summary>
/// 方向相反
/// </summary>
public bool IsReversed { get; set; } = false;
public bool IsReversed { get; set; } = true;
#region 状态
/// <summary>
/// 正方向运行 (逆时针旋转 counter-clockwise)
......@@ -139,18 +139,7 @@ namespace FLY.Winder.Server
Misc.BindingOperations.SetBinding(winderAccessory, nameof(winderAccessory.RotaryFreq), () =>
{
if (IsForw)
{
RSpeed = winderAccessory.RotaryFreq;
}
else if (IsBackw)
{
RSpeed = -winderAccessory.RotaryFreq;
}
else
{
RSpeed = 0;
}
updateRSpeed();
});
this.PropertyChanged += RotarySystem_PropertyChanged;
......@@ -160,7 +149,21 @@ namespace FLY.Winder.Server
dispatcherTimer.Tick += DispatcherTimer_Tick;
stopwatch_rpos = new Stopwatch();
}
void updateRSpeed()
{
if (IsForw)
{
RSpeed = winderAccessory.RotaryFreq;
}
else if (IsBackw)
{
RSpeed = -winderAccessory.RotaryFreq;
}
else
{
RSpeed = 0;
}
}
private void DispatcherTimer_Tick(object sender, EventArgs e)
{
double totalSeconds = stopwatch_rpos.Elapsed.TotalSeconds;
......@@ -199,7 +202,8 @@ namespace FLY.Winder.Server
IsTurnSign0 = (!IsReversed) ? winderAccessory.IsRotaryBackwTurn : winderAccessory.IsRotaryForwTurn;
IsTurnSign1 = (!IsReversed) ? winderAccessory.IsRotaryForwTurn : winderAccessory.IsRotaryBackwTurn;
}
else if (e.PropertyName == nameof(IsTurnSign0)) {
else if (e.PropertyName == nameof(IsTurnSign0))
{
if (IsTurnSign0)
{
RPosAtTurnSign0 = RPosGlobal;
......@@ -220,13 +224,21 @@ namespace FLY.Winder.Server
RPosAtOrgSign = RPosGlobal;
}
}
else {
else
{
if (IsBackw)
{
RPosAtOrgSign = RPosGlobal;
}
}
}
else if (e.PropertyName == nameof(IsForw))
{
updateRSpeed();
}
else if (e.PropertyName == nameof(IsBackw)) {
updateRSpeed();
}
}
string filePath = "rotary.json";
......
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