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

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

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