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

添加 吹膜测厚 可以设置 正方向 是 顺时针方向

parent 72e637f3
......@@ -5,6 +5,9 @@
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Controls.xaml" />
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Fonts.xaml" />
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Themes/Light.Blue.xaml" />
<ResourceDictionary Source="pack://application:,,,/FLY.Thick.Base.UI;component/Themes/Styles.xaml"/>
</ResourceDictionary.MergedDictionaries>
<Style TargetType="GroupBox" />
......
......@@ -19,12 +19,10 @@
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="pack://application:,,,/FLY.ControlLibrary;component/Themes/Dictionary_MyStyle.xaml"/>
<ResourceDictionary Source="pack://application:,,,/FLY.Thick.Base.UI;component/Converter/Dictionary_MyConv.xaml"/>
</ResourceDictionary.MergedDictionaries>
<local:OnOffConverter x:Key="onOffConv"/>
<local:InNoConverter x:Key="inNoConv"/>
<local:PgBlowingVmUt x:Key="viewModel" IsRPosMode ="False"/>
<local:PgBlowingVmUt x:Key="viewModel" IsRPosMode ="False" IsForwCW="False" />
</ResourceDictionary>
</Page.Resources>
......@@ -70,13 +68,12 @@
<StackPanel Margin="{StaticResource ControlMargin}">
<TextBlock Style="{StaticResource Styles.Text.FieldHeader}" Text="旋转方向" />
<StackPanel Orientation="Horizontal">
<TextBlock>
<TextBlock DataContext="{Binding DataContext,ElementName=grid_viewModel}">
<TextBlock.Style>
<Style TargetType="TextBlock" BasedOn="{StaticResource Styles.Text.FieldContent}">
<Setter Property="Text" Value="逆时针"/>
<Style.Triggers>
<DataTrigger Binding="{Binding Direction}" Value="{x:Static misc:DIRECTION.BACKWARD}">
<DataTrigger Binding="{Binding IsCW,Mode=OneWay}" Value="True">
<Setter Property="Text" Value="顺时针"/>
</DataTrigger>
</Style.Triggers>
......@@ -190,7 +187,7 @@
<StackPanel Margin="{StaticResource ControlMargin}" >
<TextBlock Style="{StaticResource Styles.Text.FieldHeader.Editable}" Text="1号加热棒位置" />
<StackPanel Orientation="Horizontal">
<TextBox Style="{StaticResource Styles.Text.FieldContent.Input.Card}" Text="{Binding No1InClock}"/>
<TextBox Style="{StaticResource Styles.Text.FieldContent.Input.Card}" Text="{Binding No1InClock,StringFormat={}{0:#.#}}"/>
<TextBlock Style="{StaticResource Styles.Text.FieldContent.Unit}" Text="点钟方向" />
</StackPanel>
</StackPanel>
......@@ -225,10 +222,10 @@
<StackPanel >
<TextBlock Style="{StaticResource Styles.Card.Title}" Text="旋转"/>
<StackPanel Orientation="Horizontal">
</StackPanel>
<StackPanel Orientation="Horizontal">
<StackPanel Margin="{StaticResource ControlMargin}" >
<TextBlock Style="{StaticResource Styles.Text.FieldHeader.Editable}" Text="正方向是顺时针方向" />
<ToggleButton Style="{StaticResource Styles.ToggleButton.YESNO}" HorizontalAlignment="Left" IsChecked="{Binding IsForwCW}"/>
</StackPanel>
<StackPanel Margin="{StaticResource ControlMargin}" >
<TextBlock Style="{StaticResource Styles.Text.FieldHeader.Editable}" Text="立式旋转" />
<ToggleButton Style="{StaticResource Styles.ToggleButton.YESNO}" HorizontalAlignment="Left" IsChecked="{Binding Is3D}"/>
......
......@@ -144,10 +144,19 @@ namespace FLY.Thick.Blowing.UI
/// 当人字架复位时,探头在右边
/// </summary>
public bool IsProbeRight { get; set; } = true;
/// <summary>
/// 正方向是顺时钟;
/// 信号0->信号1 为正方向;
/// 风环加热棒排列方向为 正方向;
/// 默认情况 风环加热棒排列是逆时钟
/// </summary>
public bool IsForwCW { get; set; }
/// <summary>
/// 分区1号 对应时钟的位置 1 ~ 12
/// </summary>
public int No1InClock { get; set; } = 3;
public double No1InClock { get; set; } = 3;
/// <summary>
/// 使用分区表
/// </summary>
......@@ -178,6 +187,8 @@ namespace FLY.Thick.Blowing.UI
return false;
}
}
public bool IsCW { get; private set; }
#endregion
#region Command
......@@ -187,6 +198,7 @@ namespace FLY.Thick.Blowing.UI
public IBlowingFixService renZiJiaService { get; protected set; }
public IBlowingDetectService bDetect { get; protected set; }
bool isSkipUpdateOrgBoltNo = false;
public PgBlowingVm()
{
ApplyCmd = new RelayCommand(Apply);
......@@ -225,7 +237,7 @@ namespace FLY.Thick.Blowing.UI
Misc.BindingOperations.SetBinding(renZiJiaService, nameof(renZiJiaService.IsProbeRight), this, nameof(IsProbeRight));
Misc.BindingOperations.SetBinding(renZiJiaService, nameof(renZiJiaService.IsForwCW), this, nameof(IsForwCW));
Misc.BindingOperations.SetBinding(renZiJiaService, nameof(renZiJiaService.ChannelCnt), this, nameof(ChannelCnt));
Misc.BindingOperations.SetBinding(renZiJiaService, nameof(renZiJiaService.BPC), this, nameof(BPC));
Misc.BindingOperations.SetBinding(renZiJiaService, nameof(renZiJiaService.OrgBoltNo), this, nameof(OrgBoltNo));
......@@ -242,78 +254,136 @@ namespace FLY.Thick.Blowing.UI
});
updateNo1InClock();
updateIsCW();
this.PropertyChanged += PgBlowingVm_PropertyChanged;
bDetect.PropertyChanged += BDetect_PropertyChanged;
}
private void BDetect_PropertyChanged(object sender, PropertyChangedEventArgs e)
{
if(e.PropertyName == nameof(bDetect.Direction))
{
updateIsCW();
}
}
void updateIsCW()
{
if (IsForwCW)
{
IsCW = bDetect.Direction == Misc.DIRECTION.FORWARD;
}
else {
IsCW = bDetect.Direction != Misc.DIRECTION.FORWARD;
}
}
private void PgBlowingVm_PropertyChanged(object sender, PropertyChangedEventArgs e)
{
if ((e.PropertyName == nameof(No1InClock))|| (e.PropertyName == nameof(IsProbeRight)))
if ((e.PropertyName == nameof(No1InClock)) || (e.PropertyName == nameof(IsProbeRight)))
{
if (isSkipUpdate)
return;
isSkipUpdate = true;
updateOrgBoltNo();
isSkipUpdate = false;
}
else if (e.PropertyName == nameof(OrgBoltNo)) {
if (isSkipUpdate)
return;
isSkipUpdate = true;
else if ((e.PropertyName == nameof(OrgBoltNo)))
{
updateNo1InClock();
}
else if (e.PropertyName == nameof(IsForwCW))
{
updateIsCW();
updateNo1InClock();
isSkipUpdate = false;
}
}
bool isSkipUpdate = false;
void updateNo1InClock()
void updateNo1InClock()
{
if (isSkipUpdateOrgBoltNo)
return;
double orgBoltNo = OrgBoltNo;
if (orgBoltNo < 1 || orgBoltNo > NBolts)
orgBoltNo = 1;
int no1;
if (IsProbeRight)
double no1;
if (!IsForwCW)
{
no1 = (int)Math.Round(3 + 12 * (orgBoltNo - 1) / NBolts );
if (IsProbeRight)
{
no1 = Math.Round(3 + 12 * (orgBoltNo - 1) / NBolts, 1);
}
else
{
no1 = Math.Round(9 + 12 * (orgBoltNo - 1) / NBolts, 1);
}
}
else
{
no1 = (int)Math.Round(9 + 12 * (orgBoltNo - 1) / NBolts);
if (IsProbeRight)
{
no1 = Math.Round(3 - 12 * (orgBoltNo - 1) / NBolts, 1);
}
else
{
no1 = Math.Round(9 - 12 * (orgBoltNo - 1) / NBolts, 1);
}
}
if (no1 > 12)
no1 -= 12;
else if (no1 < 1)
else if (no1 < 0)
no1 += 12;
isSkipUpdateOrgBoltNo = true;
No1InClock = no1;
isSkipUpdateOrgBoltNo = false;
}
void updateOrgBoltNo()
void updateOrgBoltNo()
{
if (isSkipUpdateOrgBoltNo)
return;
double no1 = No1InClock;
if (no1 < 1 || no1 > 12)
if (no1 < 0 || no1 > 12)
no1 = 3;
//平移,以3为0点
no1 -= 3;
if (no1 < 0)
no1 += 12;
int orgBoltNo;
if (IsProbeRight)
if (!IsForwCW)
{
orgBoltNo = (int)Math.Round(NBolts * no1 / 12) + 1;
if (IsProbeRight)
{
orgBoltNo = (int)Math.Round((no1 - 3) * NBolts / 12) + 1;
}
else
{
orgBoltNo = (int)Math.Round((no1 - 9) * NBolts / 12) + 1;
}
}
else
else
{
orgBoltNo = (int)Math.Round(NBolts * (no1+6) / 12) + 1;
if (IsProbeRight)
{
orgBoltNo = (int)Math.Round((3 - no1) * NBolts / 12) + 1;
}
else
{
orgBoltNo = (int)Math.Round((9 - no1) * NBolts / 12) + 1;
}
}
if (orgBoltNo > NBolts)
orgBoltNo -= NBolts;
else if(orgBoltNo<1)
else if (orgBoltNo < 1)
orgBoltNo += NBolts;
isSkipUpdateOrgBoltNo = true;
OrgBoltNo = orgBoltNo;
isSkipUpdateOrgBoltNo = false;
}
void Download()
......@@ -411,6 +481,7 @@ namespace FLY.Thick.Blowing.UI
renZiJiaService.OrgBoltNo=this.OrgBoltNo;
renZiJiaService.IsUsedMap=this.IsUsedMap;
renZiJiaService.IsProbeRight = this.IsProbeRight;
renZiJiaService.IsForwCW = this.IsForwCW;
renZiJiaService.Apply();
FLY.ControlLibrary.Window_Tip.Show("应用成功",
......
......@@ -274,7 +274,13 @@ namespace FLY.Thick.Blowing.UI
public bool IsProbeRight { get; set; }
public BlowingType BType { get; set; }
/// <summary>
/// 正方向是顺时钟;
/// 信号0->信号1 为正方向;
/// 风环加热棒排列方向为 正方向;
/// 默认情况 风环加热棒排列是逆时钟
/// </summary>
public bool IsForwCW { get; set; }
public event EventHandler DataEvent;
public event PropertyChangedEventHandler PropertyChanged;
......
......@@ -15,8 +15,7 @@
<ResourceDictionary Source="pack://application:,,,/FLY.Thick.Base.UI;component/Converter/Dictionary_MyConv.xaml"/>
</ResourceDictionary.MergedDictionaries>
<local:DynAreaBlowingVmUt x:Key="viewModel" Direction="FORWARD" Angle="200"/>
<local:Angle2CWConverter x:Key="angle2cwConv"/>
<local:DynAreaBlowingVm x:Key="viewModel" IsCW="False"/>
</ResourceDictionary>
</UserControl.Resources>
......@@ -56,7 +55,7 @@
<TransformGroup>
<ScaleTransform/>
<SkewTransform/>
<RotateTransform Angle="{Binding Angle, Converter={StaticResource angle2cwConv}}"/>
<RotateTransform Angle="{Binding IconAngle}"/>
<TranslateTransform/>
</TransformGroup>
</iconPacks:PackIconMaterial.RenderTransform>
......@@ -64,7 +63,7 @@
<Style TargetType="iconPacks:PackIconMaterial">
<Setter Property="Kind" Value="RotateLeft"/>
<Style.Triggers>
<DataTrigger Binding="{Binding Direction}" Value="{x:Static misc:DIRECTION.BACKWARD}">
<DataTrigger Binding="{Binding IsCW}" Value="True">
<Setter Property="Kind" Value="RotateRight"/>
</DataTrigger>
</Style.Triggers>
......@@ -76,7 +75,7 @@
<Style TargetType="TextBlock" BasedOn="{StaticResource Styles.Module.Text.ItemHeader}">
<Setter Property="Text" Value="逆时针"/>
<Style.Triggers>
<DataTrigger Binding="{Binding Direction}" Value="{x:Static misc:DIRECTION.BACKWARD}">
<DataTrigger Binding="{Binding IsCW}" Value="True">
<Setter Property="Text" Value="顺时针"/>
</DataTrigger>
</Style.Triggers>
......
......@@ -20,6 +20,7 @@ namespace FLY.Thick.Blowing.UI.UiModule
public partial class DynAreaBlowing : UserControl
{
IUnityContainer container;
DynAreaBlowingVm viewModel;
public DynAreaBlowing()
{
InitializeComponent();
......@@ -28,11 +29,14 @@ namespace FLY.Thick.Blowing.UI.UiModule
[InjectionMethod]
public void Init(
IUnityContainer container,
IBlowingService blowingFixService,
IBlowingDetectService blowingDetectService)
{
this.container = container;
this.DataContext = blowingDetectService;
viewModel = new DynAreaBlowingVm();
viewModel.Init(blowingFixService, blowingDetectService);
this.DataContext = viewModel;
}
private void Border_Blowing_Click(object sender, RoutedEventArgs e)
......@@ -41,16 +45,74 @@ namespace FLY.Thick.Blowing.UI.UiModule
MultiLayout.FlyLayoutManager.NavigationService.Navigate(p);
}
}
public class DynAreaBlowingVmUt : INotifyPropertyChanged
public class DynAreaBlowingVm : INotifyPropertyChanged
{
public event PropertyChangedEventHandler PropertyChanged;
public double Angle { get; set; } = -170.2;
public Misc.DIRECTION Direction { get; set; } = Misc.DIRECTION.FORWARD;
public double IconAngle { get; set; } = 170.2;
//顺时针方向
public bool IsCW { get; set; } = true;
public TimeSpan RenZiJiaPeriod { get; set; } = TimeSpan.FromMinutes(12.3);
public TimeSpan PastTime { get; set; } = TimeSpan.FromMinutes(3.3);
public double FilmVelocity { get; set; } = 50.1;
IBlowingService blowingFixService;
IBlowingDetectService blowingDetectService;
public void Init(
IBlowingService blowingFixService,
IBlowingDetectService blowingDetectService)
{
this.blowingFixService = blowingFixService;
this.blowingDetectService = blowingDetectService;
Misc.BindingOperations.SetBinding(this.blowingDetectService, nameof(IBlowingDetectService.RenZiJiaPeriod), this, nameof(RenZiJiaPeriod));
Misc.BindingOperations.SetBinding(this.blowingDetectService, nameof(IBlowingDetectService.PastTime), this, nameof(PastTime));
Misc.BindingOperations.SetBinding(this.blowingDetectService, nameof(IBlowingDetectService.FilmVelocity), this, nameof(FilmVelocity));
Misc.BindingOperations.SetBinding(this.blowingDetectService, nameof(IBlowingDetectService.Angle), this, nameof(Angle));
Misc.BindingOperations.SetBinding(this.blowingDetectService, nameof(IBlowingDetectService.Angle), updateIconAngle);
Misc.BindingOperations.SetBinding(this.blowingDetectService, nameof(IBlowingDetectService.Direction), updateIsCW);
Misc.BindingOperations.SetBinding(this.blowingFixService, nameof(IBlowingService.IsForwCW), ()=> {
updateIconAngle();
updateIsCW();
});
}
void updateIconAngle()
{
if (blowingFixService.IsForwCW)
{
IconAngle = blowingDetectService.Angle;
}
else
{
IconAngle = -blowingDetectService.Angle;
}
}
void updateIsCW()
{
if (blowingFixService.IsForwCW)
{
IsCW = blowingDetectService.Direction == Misc.DIRECTION.FORWARD;
}
else
{
IsCW = blowingDetectService.Direction != Misc.DIRECTION.FORWARD;
}
}
}
public class UiModule2_DynAreaBlowing : MultiLayout.UiModule.IUiModule2
{
/// <summary>
......@@ -93,32 +155,4 @@ namespace FLY.Thick.Blowing.UI.UiModule
}
}
public class Angle2CWConverter : IValueConverter
{
#region IValueConverter 成员
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
if (!(value is double)
&& !(value is int)
)
{
return null;
}
int angle = System.Convert.ToInt32(value);
return -angle;
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
#endregion
}
}
......@@ -119,6 +119,7 @@ namespace FLY.Thick.Blowing.UI.UiModule
graph.SetBinding(PolarChart.BPCProperty, new Binding(nameof(blowingService.BPC)) { Source = blowingService });
graph.SetBinding(PolarChart.OrgBoltNoProperty, new Binding(nameof(blowingService.OrgBoltNo)) { Source = blowingService });
graph.SetBinding(PolarChart.MPIsRightProperty, new Binding(nameof(blowingService.IsProbeRight)) { Source = blowingService });
graph.SetBinding(PolarChart.IsForwCWProperty, new Binding(nameof(blowingService.IsForwCW)) { Source = blowingService });
paramDictionary.SetBinding(this, nameof(XStep), 5);
graph.SetBinding(PolarChart.XStepProperty, new Binding(nameof(XStep)) { Source = this });
......
......@@ -56,7 +56,14 @@ namespace FLY.Thick.Blowing.Client
/// 测厚仪类型, 追边 or 扫描
/// </summary>
public BlowingType BType { get; set; }
public bool IsProbeRight { get; set; }
public bool IsProbeRight { get; set; } = true;
/// <summary>
/// 正方向是顺时钟;
/// 信号0->信号1 为正方向;
/// 风环加热棒排列方向为 正方向;
/// 默认情况 风环加热棒排列是逆时钟
/// </summary>
public bool IsForwCW { get; set; }
#endregion
/// <summary>
......
......@@ -43,6 +43,13 @@ namespace FLY.Thick.Blowing.IService
BoltMapCell[] Map { get; set; }
#endregion
/// <summary>
/// 正方向是顺时钟;
/// 信号0->信号1 为正方向;
/// 风环加热棒排列方向为 正方向;
/// 默认情况 风环加热棒排列是逆时钟
/// </summary>
bool IsForwCW { get; set; }
/// <summary>
/// 测厚仪测量点位置方向:Left, Right (也就是三角形在左还是右)
/// </summary>
......
......@@ -121,6 +121,13 @@ namespace FLY.Thick.Blowing.Server
/// </summary>
public bool IsProbeRight { get; set; } = true;
/// <summary>
/// 正方向是顺时钟;
/// 信号0->信号1 为正方向;
/// 风环加热棒排列方向为 正方向;
/// 默认情况 风环加热棒排列是逆时钟
/// </summary>
public bool IsForwCW { get; set; }
/// <summary>
/// 应用
/// </summary>
......@@ -1596,6 +1603,7 @@ namespace FLY.Thick.Blowing.Server
public bool IsUsedMap;
public BoltMapCell[] Map;
public bool IsProbeRight = true;
public bool IsForwCW;
}
......
......@@ -5,6 +5,9 @@
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Controls.xaml" />
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Fonts.xaml" />
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Themes/Light.Blue.xaml" />
<ResourceDictionary Source="pack://application:,,,/FLY.Thick.Base.UI;component/Themes/Styles.xaml"/>
</ResourceDictionary.MergedDictionaries>
<Style TargetType="GroupBox" />
......
......@@ -69,13 +69,12 @@
<StackPanel Margin="{StaticResource ControlMargin}">
<TextBlock Style="{StaticResource Styles.Text.FieldHeader}" Text="旋转方向" />
<StackPanel Orientation="Horizontal">
<TextBlock>
<TextBlock DataContext="{Binding DataContext,ElementName=grid_viewModel}">
<TextBlock.Style>
<Style TargetType="TextBlock" BasedOn="{StaticResource Styles.Text.FieldContent}">
<Setter Property="Text" Value="逆时针"/>
<Style.Triggers>
<DataTrigger Binding="{Binding Direction}" Value="{x:Static misc:DIRECTION.BACKWARD}">
<DataTrigger Binding="{Binding IsCW,Mode=OneWay}" Value="True">
<Setter Property="Text" Value="顺时针"/>
</DataTrigger>
</Style.Triggers>
......@@ -189,7 +188,7 @@
<StackPanel Margin="{StaticResource ControlMargin}" >
<TextBlock Style="{StaticResource Styles.Text.FieldHeader.Editable}" Text="1号加热棒位置" />
<StackPanel Orientation="Horizontal">
<TextBox Style="{StaticResource Styles.Text.FieldContent.Input.Card}" Text="{Binding No1InClock}"/>
<TextBox Style="{StaticResource Styles.Text.FieldContent.Input.Card}" Text="{Binding No1InClock,StringFormat={}{0:#.#}}"/>
<TextBlock Style="{StaticResource Styles.Text.FieldContent.Unit}" Text="点钟方向" />
</StackPanel>
</StackPanel>
......@@ -265,6 +264,10 @@
</StackPanel>
<StackPanel Orientation="Horizontal">
<StackPanel Margin="{StaticResource ControlMargin}" >
<TextBlock Style="{StaticResource Styles.Text.FieldHeader.Editable}" Text="正方向是顺时针方向" />
<ToggleButton Style="{StaticResource Styles.ToggleButton.YESNO}" HorizontalAlignment="Left" IsChecked="{Binding IsForwCW}"/>
</StackPanel>
<StackPanel Margin="{StaticResource ControlMargin}" >
<TextBlock Style="{StaticResource Styles.Text.FieldHeader.Editable}" Text="立式旋转" />
<ToggleButton Style="{StaticResource Styles.ToggleButton.YESNO}" HorizontalAlignment="Left" IsChecked="{Binding Is3D}"/>
......
......@@ -143,10 +143,18 @@ namespace FLY.Thick.BlowingScan.UI.Client
/// </summary>
public bool IsProbeRight { get; set; } = true;
/// <summary>
/// 正方向是顺时钟;
/// 信号0->信号1 为正方向;
/// 风环加热棒排列方向为 正方向;
/// 默认情况 风环加热棒排列是逆时钟
/// </summary>
public bool IsForwCW { get; set; }
/// <summary>
/// 分区1号 对应时钟的位置 1 ~ 12
/// </summary>
public int No1InClock { get; set; } = 3;
public double No1InClock { get; set; } = 3;
/// <summary>
/// 使用分区表
/// </summary>
......@@ -197,6 +205,8 @@ namespace FLY.Thick.BlowingScan.UI.Client
return false;
}
}
public bool IsCW { get; private set; }
#endregion
......@@ -209,6 +219,8 @@ namespace FLY.Thick.BlowingScan.UI.Client
public IBlowingDetectService bDetect { get; protected set; }
public IInitParamService initParamService { get; protected set; }
bool isSkipUpdateOrgBoltNo = false;
public PgBlowingVm()
{
ApplyCmd = new RelayCommand(Apply);
......@@ -248,6 +260,7 @@ namespace FLY.Thick.BlowingScan.UI.Client
Misc.BindingOperations.SetBinding(bDetect, nameof(bDetect.InNo_Roll), this, nameof(InNo_Roll));
Misc.BindingOperations.SetBinding(renZiJiaService, nameof(renZiJiaService.IsProbeRight), this, nameof(IsProbeRight));
Misc.BindingOperations.SetBinding(renZiJiaService, nameof(renZiJiaService.IsForwCW), this, nameof(IsForwCW));
Misc.BindingOperations.SetBinding(renZiJiaService, nameof(renZiJiaService.ChannelCnt), this, nameof(ChannelCnt));
Misc.BindingOperations.SetBinding(renZiJiaService, nameof(renZiJiaService.BPC), this, nameof(BPC));
Misc.BindingOperations.SetBinding(renZiJiaService, nameof(renZiJiaService.OrgBoltNo), this, nameof(OrgBoltNo));
......@@ -270,80 +283,141 @@ namespace FLY.Thick.BlowingScan.UI.Client
updateNo1InClock();
updateIsCW();
this.PropertyChanged += PgBlowingVm_PropertyChanged;
bDetect.PropertyChanged += BDetect_PropertyChanged;
}
private void BDetect_PropertyChanged(object sender, PropertyChangedEventArgs e)
{
if (e.PropertyName == nameof(bDetect.Direction))
{
updateIsCW();
}
}
void updateIsCW()
{
if (IsForwCW)
{
IsCW = bDetect.Direction == Misc.DIRECTION.FORWARD;
}
else
{
IsCW = bDetect.Direction != Misc.DIRECTION.FORWARD;
}
}
private void PgBlowingVm_PropertyChanged(object sender, PropertyChangedEventArgs e)
{
if ((e.PropertyName == nameof(No1InClock)) || (e.PropertyName == nameof(IsProbeRight)))
{
if (isSkipUpdate)
return;
isSkipUpdate = true;
updateOrgBoltNo();
isSkipUpdate = false;
updateOrgBoltNo();
}
else if (e.PropertyName == nameof(OrgBoltNo))
else if ((e.PropertyName == nameof(OrgBoltNo)))
{
if (isSkipUpdate)
return;
isSkipUpdate = true;
updateNo1InClock();
isSkipUpdate = false;
}
else if (e.PropertyName == nameof(IsForwCW))
{
updateIsCW();
updateNo1InClock();
}
}
bool isSkipUpdate = false;
void updateNo1InClock()
{
if (isSkipUpdateOrgBoltNo)
return;
double orgBoltNo = OrgBoltNo;
if (orgBoltNo < 1 || orgBoltNo > NBolts)
orgBoltNo = 1;
int no1;
if (IsProbeRight)
double no1;
if (!IsForwCW)
{
no1 = (int)Math.Round(3 + 12 * (orgBoltNo - 1) / NBolts);
if (IsProbeRight)
{
no1 = Math.Round(3 + 12 * (orgBoltNo - 1) / NBolts, 1);
}
else
{
no1 = Math.Round(9 + 12 * (orgBoltNo - 1) / NBolts, 1);
}
}
else
{
no1 = (int)Math.Round(9 + 12 * (orgBoltNo - 1) / NBolts);
if (IsProbeRight)
{
no1 = Math.Round(3 - 12 * (orgBoltNo - 1) / NBolts,1);
}
else
{
no1 = Math.Round(9 - 12 * (orgBoltNo - 1) / NBolts,1);
}
}
if (no1 > 12)
no1 -= 12;
else if (no1 < 1)
else if (no1 < 0)
no1 += 12;
isSkipUpdateOrgBoltNo = true;
No1InClock = no1;
isSkipUpdateOrgBoltNo = false;
}
void updateOrgBoltNo()
{
if (isSkipUpdateOrgBoltNo)
return;
double no1 = No1InClock;
if (no1 < 1 || no1 > 12)
if (no1 < 0 || no1 > 12)
no1 = 3;
//平移,以3为0点
no1 -= 3;
if (no1 < 0)
no1 += 12;
int orgBoltNo;
if (IsProbeRight)
if (!IsForwCW)
{
orgBoltNo = (int)Math.Round(NBolts * no1 / 12) + 1;
if (IsProbeRight)
{
orgBoltNo = (int)Math.Round((no1 - 3) * NBolts / 12) + 1;
}
else
{
orgBoltNo = (int)Math.Round((no1 - 9) * NBolts / 12) + 1;
}
}
else
{
orgBoltNo = (int)Math.Round(NBolts * (no1 + 6) / 12) + 1;
if (IsProbeRight)
{
orgBoltNo = (int)Math.Round((3 - no1) * NBolts / 12) + 1;
}
else
{
orgBoltNo = (int)Math.Round((9 - no1) * NBolts / 12) + 1;
}
}
if (orgBoltNo > NBolts)
orgBoltNo -= NBolts;
else if (orgBoltNo < 1)
orgBoltNo += NBolts;
isSkipUpdateOrgBoltNo = true;
OrgBoltNo = orgBoltNo;
isSkipUpdateOrgBoltNo = false;
}
void Download()
{
IsBufListLoading = true;
......@@ -453,12 +527,11 @@ namespace FLY.Thick.BlowingScan.UI.Client
renZiJiaService.OrgBoltNo = this.OrgBoltNo;
renZiJiaService.IsUsedMap = this.IsUsedMap;
renZiJiaService.IsProbeRight = this.IsProbeRight;
renZiJiaService.IsForwCW = this.IsForwCW;
renZiJiaService.Smooth = this.Smooth;
renZiJiaService.SensorWidth = this.SensorWidth;
renZiJiaService.SolveCnt = this.SolveCnt;
renZiJiaService.Apply();
FLY.ControlLibrary.Window_Tip.Show("应用成功",
......
......@@ -273,6 +273,13 @@ namespace FLY.Thick.BlowingScan.UI.Client
public bool IsUsedMap { get; set; }
public BoltMapCell[] Map { get; set; }
public bool IsProbeRight { get; set; }
/// <summary>
/// 正方向是顺时钟;
/// 信号0->信号1 为正方向;
/// 风环加热棒排列方向为 正方向;
/// 默认情况 风环加热棒排列是逆时钟
/// </summary>
public bool IsForwCW { get; set; }
public BlowingType BType { get; set; }
......
......@@ -15,8 +15,7 @@
<ResourceDictionary Source="pack://application:,,,/FLY.Thick.Base.UI;component/Converter/Dictionary_MyConv.xaml"/>
</ResourceDictionary.MergedDictionaries>
<local:DynAreaBlowingVmUt x:Key="viewModel" Direction="BACKWARD" Angle="120"/>
<local:Angle2CWConverter x:Key="angle2cwConv"/>
<local:DynAreaBlowingVm x:Key="viewModel" IsCW="False"/>
</ResourceDictionary>
</UserControl.Resources>
......@@ -45,7 +44,7 @@
<TransformGroup>
<ScaleTransform/>
<SkewTransform/>
<RotateTransform Angle="{Binding Angle, Converter={StaticResource angle2cwConv}}"/>
<RotateTransform Angle="{Binding IconAngle}"/>
<TranslateTransform/>
</TransformGroup>
</iconPacks:PackIconMaterial.RenderTransform>
......@@ -53,7 +52,7 @@
<Style TargetType="iconPacks:PackIconMaterial">
<Setter Property="Kind" Value="RotateLeft"/>
<Style.Triggers>
<DataTrigger Binding="{Binding Direction}" Value="{x:Static misc:DIRECTION.BACKWARD}">
<DataTrigger Binding="{Binding IsCW}" Value="True">
<Setter Property="Kind" Value="RotateRight"/>
</DataTrigger>
</Style.Triggers>
......@@ -65,7 +64,7 @@
<Style TargetType="TextBlock" BasedOn="{StaticResource Styles.Module.Text.ItemHeader}">
<Setter Property="Text" Value="逆时针"/>
<Style.Triggers>
<DataTrigger Binding="{Binding Direction}" Value="{x:Static misc:DIRECTION.BACKWARD}">
<DataTrigger Binding="{Binding IsCW}" Value="True">
<Setter Property="Text" Value="顺时针"/>
</DataTrigger>
</Style.Triggers>
......
......@@ -12,9 +12,8 @@ namespace FLY.Thick.BlowingScan.UI.Client.UiModule
/// </summary>
public partial class DynAreaBlowing : UserControl
{
IBlowingScanService blowingScanService;
IBlowingDetectService blowingDetectService;
IUnityContainer container;
FLY.Thick.Blowing.UI.UiModule.DynAreaBlowingVm viewModel;
public DynAreaBlowing()
{
......@@ -24,12 +23,14 @@ namespace FLY.Thick.BlowingScan.UI.Client.UiModule
[InjectionMethod]
public void Init(
IUnityContainer container,
IBlowingService blowingFixService,
IBlowingDetectService blowingDetectService)
{
this.container = container;
this.blowingDetectService = blowingDetectService;
this.DataContext = blowingDetectService;
viewModel = new FLY.Thick.Blowing.UI.UiModule.DynAreaBlowingVm();
viewModel.Init(blowingFixService, blowingDetectService);
this.DataContext = viewModel;
}
......
......@@ -752,6 +752,14 @@ namespace FLY.Thick.BlowingScan.Server
/// </summary>
public bool IsProbeRight { get; set; } = true;
/// <summary>
/// 正方向是顺时钟;
/// 信号0->信号1 为正方向;
/// 风环加热棒排列方向为 正方向;
/// 默认情况 风环加热棒排列是逆时钟
/// </summary>
public bool IsForwCW { get; set; }
/// <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