Commit 0ce0c0e1 authored by 潘栩锋's avatar 潘栩锋 🚴

1. 添加 扫描图,大混合图,对比图,添加隐藏数据范围外曲线

2. 添加 产品界面 快速计算收缩率
parent 9bc7450d
......@@ -156,6 +156,9 @@
<Compile Include="UiModule\TrendGraph\TrendGraphVm.cs" />
<Compile Include="UiModule\TrendGraph\TrendGraphVmUt.cs" />
<Compile Include="UiModule\TrendGraph\UiModule2_TrendGraph.cs" />
<Compile Include="WdShrinkHelper.xaml.cs">
<DependentUpon>WdShrinkHelper.xaml</DependentUpon>
</Compile>
<Page Include="App.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
......@@ -260,6 +263,10 @@
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="WdShrinkHelper.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
</ItemGroup>
<ItemGroup>
<Compile Include="PgMenu.xaml.cs">
......
......@@ -4,7 +4,7 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:FLY.Thick.FilmCasting.UI"
xmlns:common="clr-namespace:FLY.Thick.FilmCasting.Common;assembly=FLY.Thick.FilmCasting"
xmlns:common="clr-namespace:FLY.Thick.FilmCasting.Common;assembly=FLY.Thick.FilmCasting" xmlns:iconPacks="http://metro.mahapps.com/winfx/xaml/iconpacks"
mc:Ignorable="d"
d:DesignHeight="1024" d:DesignWidth="1280" Background="WhiteSmoke"
d:DataContext="{d:DesignInstance local:PgProfileVm}"
......@@ -91,43 +91,53 @@
<Border Style="{StaticResource Styles.ParamSection.Border}">
<TextBlock Text="工艺" />
</Border>
<StackPanel Orientation="Horizontal" >
<StackPanel Margin="{StaticResource ControlMargin}">
<TextBlock Style="{StaticResource Styles.Text.FieldHeader.Editable}" Text="目标值" />
<StackPanel Orientation="Horizontal">
<TextBox Style="{StaticResource Styles.Text.FieldContent.Input.Card}" Text="{Binding Target, StringFormat={}{0:F1}}" />
<StackPanel>
<StackPanel Orientation="Horizontal" >
<StackPanel Margin="{StaticResource ControlMargin}">
<TextBlock Style="{StaticResource Styles.Text.FieldHeader.Editable}" Text="目标值" />
<StackPanel Orientation="Horizontal">
<TextBox Style="{StaticResource Styles.Text.FieldContent.Input.Card}" Text="{Binding Target, StringFormat={}{0:F1}}" />
</StackPanel>
</StackPanel>
</StackPanel>
<StackPanel Margin="{StaticResource ControlMargin}" >
<TextBlock Style="{StaticResource Styles.Text.FieldHeader.Editable}" Text="公差%" />
<StackPanel Orientation="Horizontal">
<TextBox Style="{StaticResource Styles.Text.FieldContent.Input.Card}" Text="{Binding TolerancePercent, Converter={StaticResource percentconv}}" />
<TextBlock Style="{StaticResource Styles.Text.FieldContent.Unit}" Text="%" />
<StackPanel Margin="{StaticResource ControlMargin}" >
<TextBlock Style="{StaticResource Styles.Text.FieldHeader.Editable}" Text="公差%" />
<StackPanel Orientation="Horizontal">
<TextBox Style="{StaticResource Styles.Text.FieldContent.Input.Card}" Text="{Binding TolerancePercent, Converter={StaticResource percentconv}}" />
<TextBlock Style="{StaticResource Styles.Text.FieldContent.Unit}" Text="%" />
</StackPanel>
</StackPanel>
<StackPanel Margin="{StaticResource ControlMargin}" DataContext="{Binding ElementName=grid_root,Path=DataContext}" >
<TextBlock Style="{StaticResource Styles.Text.FieldHeader.Editable}" Text="公差" />
<StackPanel Orientation="Horizontal">
<TextBox Style="{StaticResource Styles.Text.FieldContent.Input.Card}" Text="{Binding Tolerance,StringFormat={}{0:F1}}" />
</StackPanel>
</StackPanel>
</StackPanel>
<StackPanel Margin="{StaticResource ControlMargin}" DataContext="{Binding ElementName=grid_root,Path=DataContext}" >
<TextBlock Style="{StaticResource Styles.Text.FieldHeader.Editable}" Text="公差" />
<StackPanel Orientation="Horizontal">
<TextBox Style="{StaticResource Styles.Text.FieldContent.Input.Card}" Text="{Binding Tolerance,StringFormat={}{0:F1}}" />
<StackPanel Orientation="Horizontal" >
<StackPanel Margin="{StaticResource ControlMargin}">
<TextBlock Style="{StaticResource Styles.Text.FieldHeader.Editable}" Text="斜率K补偿" />
<TextBox Style="{StaticResource Styles.Text.FieldContent.Input.Card}" Text="{Binding K, StringFormat={}{0:F3}}" />
</StackPanel>
<StackPanel Margin="{StaticResource ControlMargin}" Visibility="{Binding ElementName=grid_dynarea,Path=DataContext.IsTest,Converter={StaticResource visbilityconv},ConverterParameter=Collapsed}">
<TextBlock Style="{StaticResource Styles.Text.FieldHeader}" Text="平移B补偿" />
<TextBlock Style="{StaticResource Styles.Text.FieldContent}" Text="{Binding B, StringFormat={}{0:F2}}" />
</StackPanel>
<Button Style="{StaticResource Styles.Button.Icon}" Command="{Binding DataContext.AhelperCmd,ElementName=page}" Foreground="{StaticResource Brushes.Highlight}">
<StackPanel>
<Grid Style="{StaticResource Styles.Shadow}">
<Rectangle Fill="White" Height="45" Width="45" RadiusX="5" HorizontalAlignment="Center" VerticalAlignment="Center"/>
<iconPacks:PackIconMaterial Kind="AutoFix" HorizontalAlignment="Center" VerticalAlignment="Center"/>
</Grid>
<TextBlock Text="计算补偿"/>
</StackPanel>
</Button>
</StackPanel>
</StackPanel>
</StackPanel>
<StackPanel Orientation="Horizontal" >
<Button Style="{StaticResource Styles.ParamSection.Button}" Command="{Binding DataContext.AhelperCmd,ElementName=page}">
<TextBlock Text="补偿" />
</Button>
<StackPanel Margin="{StaticResource ControlMargin}">
<TextBlock Style="{StaticResource Styles.Text.FieldHeader.Editable}" Text="斜率K" />
<TextBox Style="{StaticResource Styles.Text.FieldContent.Input.Card}" Text="{Binding K, StringFormat={}{0:F3}}" />
</StackPanel>
<StackPanel Margin="{StaticResource ControlMargin}" Visibility="{Binding ElementName=grid_dynarea,Path=DataContext.IsTest,Converter={StaticResource visbilityconv}}">
<TextBlock Style="{StaticResource Styles.Text.FieldHeader}" Text="平移B" />
<TextBlock Style="{StaticResource Styles.Text.FieldContent}" Text="{Binding B, StringFormat={}{0:F2}}" />
</StackPanel>
</StackPanel>
<StackPanel Orientation="Horizontal">
<Border Style="{StaticResource Styles.ParamSection.Border}" >
<TextBlock Text="范围" />
......@@ -136,7 +146,7 @@
<StackPanel Orientation="Horizontal">
<TextBlock Style="{StaticResource Styles.Text.FieldHeader.Editable}" Text="显示范围" />
<TextBlock Style="{StaticResource Styles.Text.FieldHeader.Comment}" DataContext="{Binding ElementName=grid_root,Path=DataContext}">
最大<Run Text="{Binding Boltmap.BoltCnt}"/>分区
最大<Run Text="{Binding Boltmap.BoltCnt}"/>分区
</TextBlock>
</StackPanel>
<StackPanel Orientation="Horizontal" DataContext="{Binding ElementName=grid_root,Path=DataContext.ScanRange}">
......@@ -176,29 +186,49 @@
</Border>
<StackPanel>
<StackPanel Orientation="Horizontal">
<StackPanel Margin="{StaticResource ControlMargin}" >
<TextBlock Style="{StaticResource Styles.Text.FieldHeader.Editable.Row2}" Text="开始无效螺丝数" />
<StackPanel Orientation="Horizontal">
<TextBox Style="{StaticResource Styles.Text.FieldContent.Input.Card}" Text="{Binding LeftEmptyBolts}"/>
<TextBlock Style="{StaticResource Styles.Text.FieldContent.Unit}" Text="个" />
<StackPanel Orientation="Horizontal">
<StackPanel Margin="{StaticResource ControlMargin}" >
<TextBlock Style="{StaticResource Styles.Text.FieldHeader.Editable.Row2}" Text="开始无效&#13;螺丝数" />
<StackPanel Orientation="Horizontal">
<TextBox Style="{StaticResource Styles.Text.FieldContent.Input.Card}" Text="{Binding LeftEmptyBolts}"/>
<TextBlock Style="{StaticResource Styles.Text.FieldContent.Unit}" Text="个" />
</StackPanel>
</StackPanel>
</StackPanel>
<StackPanel Margin="{StaticResource ControlMargin}" >
<TextBlock Style="{StaticResource Styles.Text.FieldHeader.Editable.Row2}" Text="结束无效螺丝数" />
<StackPanel Orientation="Horizontal">
<TextBox Style="{StaticResource Styles.Text.FieldContent.Input.Card}" Text="{Binding RightEmptyBolts}"/>
<TextBlock Style="{StaticResource Styles.Text.FieldContent.Unit}" Text="个" />
<StackPanel Margin="{StaticResource ControlMargin}" >
<StackPanel Orientation="Horizontal">
<TextBlock Style="{StaticResource Styles.Text.FieldHeader.Editable.Row2}" Text="结束无效&#13;螺丝数" />
<TextBlock Style="{StaticResource Styles.Text.FieldHeader.Comment}" DataContext="{Binding ElementName=grid_root,Path=DataContext}">
中心:<Run Text="{Binding MidBoltNo,StringFormat={}{0:0.#}}"/>
</TextBlock>
</StackPanel>
<StackPanel Orientation="Horizontal">
<TextBox Style="{StaticResource Styles.Text.FieldContent.Input.Card}" Text="{Binding RightEmptyBolts}"/>
<TextBlock Style="{StaticResource Styles.Text.FieldContent.Unit}" Text="个" />
</StackPanel>
</StackPanel>
</StackPanel>
<StackPanel Margin="{StaticResource ControlMargin}" >
<TextBlock Style="{StaticResource Styles.Text.FieldHeader.Editable}" Text="收缩率" />
<StackPanel Orientation="Horizontal">
<TextBox Style="{StaticResource Styles.Text.FieldContent.Input.Card}" Text="{Binding UniformShrinkPercent,Converter={StaticResource percentconv}}"/>
<TextBlock Style="{StaticResource Styles.Text.FieldContent.Unit}" Text="%" />
<StackPanel Orientation="Horizontal">
<StackPanel Margin="{StaticResource ControlMargin}" >
<TextBlock Style="{StaticResource Styles.Text.FieldHeader.Editable}" Text="收缩率" />
<StackPanel Orientation="Horizontal">
<TextBox Style="{StaticResource Styles.Text.FieldContent.Input.Card}" Text="{Binding UniformShrinkPercent,Converter={StaticResource percentconv}}"/>
<TextBlock Style="{StaticResource Styles.Text.FieldContent.Unit}" Text="%" />
</StackPanel>
</StackPanel>
<Button Style="{StaticResource Styles.Button.Icon}" Command="{Binding DataContext.SHelperCmd,ElementName=page}">
<StackPanel>
<Grid Style="{StaticResource Styles.Shadow}">
<Rectangle Fill="White" Height="45" Width="45" RadiusX="5" HorizontalAlignment="Center" VerticalAlignment="Center"/>
<iconPacks:PackIconMaterial Kind="AutoFix" HorizontalAlignment="Center" VerticalAlignment="Center"/>
</Grid>
<TextBlock Text="计算收缩率"/>
</StackPanel>
</Button>
</StackPanel>
<StackPanel Margin="{StaticResource ControlMargin}" >
<TextBlock Style="{StaticResource Styles.Text.FieldHeader.Editable.Row2}" Text="膜中心位置偏移" />
<TextBlock Style="{StaticResource Styles.Text.FieldHeader.Editable.Row2}" Text="膜中心&#13;位置偏移" />
<StackPanel Orientation="Horizontal">
<TextBox Style="{StaticResource Styles.Text.FieldContent.Input.Card}" Text="{Binding MidOffset}"/>
<TextBlock Style="{StaticResource Styles.Text.FieldContent.Unit}" Text="mm" />
......
......@@ -43,6 +43,7 @@ namespace FLY.Thick.FilmCasting.UI
viewModel.Init(profileService, gageService, boltMapFilmCastingService);
this.DataContext = viewModel;
}
}
public class PgProfileVm : INotifyPropertyChanged
......@@ -83,6 +84,10 @@ namespace FLY.Thick.FilmCasting.UI
public double Tolerance { get; set; }
#endregion
/// <summary>
/// 中心螺丝号
/// </summary>
public double MidBoltNo { get; set; }
#region Command
public RelayCommand ReadCmd { get; private set; }
public RelayCommand ApplyCmd { get; private set; }
......@@ -90,7 +95,7 @@ namespace FLY.Thick.FilmCasting.UI
public RelayCommand DelCmd { get; private set; }
public RelayCommand AhelperCmd { get; private set; }
public RelayCommand SHelperCmd { get; private set; }
#endregion
IFilmCastingProfileService profileService;
......@@ -108,6 +113,7 @@ namespace FLY.Thick.FilmCasting.UI
DelCmd = new RelayCommand(Del);
AhelperCmd = new RelayCommand(Ahelper);
ApplyParamCmd = new RelayCommand(ApplyParam);
SHelperCmd = new RelayCommand(SHelper);
}
......@@ -119,8 +125,7 @@ namespace FLY.Thick.FilmCasting.UI
this.boltMapFilmCastingService = boltMapFilmCastingService;
updateParam();
updateMidBoltNo();
Misc.BindingOperations.SetBinding(DynArea, nameof(DynArea.IsTest), () =>
{
......@@ -153,7 +158,32 @@ namespace FLY.Thick.FilmCasting.UI
Tolerance = Math.Round(Param.Target * Param.TolerancePercent, 1);
Param.PropertyChanged += Param_PropertyChanged_of_Tolerance;
this.PropertyChanged += PgProfileVm_PropertyChanged_of_Tolerance;
Param.PropertyChanged += Param_PropertyChanged;
boltMapFilmCastingService.PropertyChanged += BoltMapFilmCastingService_PropertyChanged;
}
private void BoltMapFilmCastingService_PropertyChanged(object sender, PropertyChangedEventArgs e)
{
if (e.PropertyName == nameof(boltMapFilmCastingService.BoltCnt)) {
updateMidBoltNo();
}
}
private void Param_PropertyChanged(object sender, PropertyChangedEventArgs e)
{
if ((e.PropertyName == nameof(Param.LeftEmptyBolts)) ||
(e.PropertyName == nameof(Param.RightEmptyBolts))) {
updateMidBoltNo();
}
}
void updateMidBoltNo()
{
MidBoltNo = (boltMapFilmCastingService.BoltCnt - (Param.LeftEmptyBolts + Param.RightEmptyBolts)) / 2.0 + Param.LeftEmptyBolts;
}
bool isShieldToleranceChanged = false;
private void PgProfileVm_PropertyChanged_of_Tolerance(object sender, PropertyChangedEventArgs e)
{
......@@ -354,5 +384,12 @@ namespace FLY.Thick.FilmCasting.UI
Param.B = 0;
}
}
private void SHelper()
{
WdShrinkHelper w = new WdShrinkHelper();
w.Init(boltMapFilmCastingService, Param);
w.Owner = App.Current.MainWindow;
w.ShowDialog();
}
}
}
......@@ -527,6 +527,11 @@ namespace FLY.Thick.FilmCasting.UI.UiModule
{
UpdateSeriesType();
}
else if (e.PropertyName == nameof(graphparam.IsSideCutHidden))
{
UpdateValues();
UpdateValues2();
}
}
......@@ -711,14 +716,35 @@ namespace FLY.Thick.FilmCasting.UI.UiModule
//必须先更新Y轴, X轴资料,最后再画线!!!!!!!
//不然 YAxisCrossing 会有机会无效
if (scanData != null && scanData.Thicks != null)
{
Values.AddRange(scanData.Thicks);
}
UpdateValues();
}, this);
}
protected void UpdateValues()
{
//清除全部数据
Values.Clear();
if (scanData != null && scanData.Thicks != null)
{
if (graphparam.IsSideCutHidden)
{
var thks = scanData.Thicks.ToArray();
for (int i = 0; i < DataBegin; i++)
{
thks[i] = double.NaN;
}
for (int i = DataEnd + 1; i < thks.Count(); i++)
{
thks[i] = double.NaN;
}
Values.AddRange(thks);
}
else
{
Values.AddRange(scanData.Thicks);
}
}
}
public void PreView()
{
......@@ -841,20 +867,46 @@ namespace FLY.Thick.FilmCasting.UI.UiModule
Values2.Clear();
UpdateAverage2();
if (scanData2 != null && scanData2.Thicks != null)
UpdateValues2();
}, this);
}
protected void UpdateAverage2()
{
if (scanData2 != null && scanData2.Thicks != null)
Id2 = this.scanData2.ID;
else
Id2 = -1;
}
protected void UpdateValues2()
{
//清除全部数据
Values2.Clear();
if (scanData2 != null && scanData2.Thicks != null)
{
if (graphparam.IsSideCutHidden)
{
var thks = scanData2.Thicks.ToArray();
for (int i = 0; i < scanData2.DataBegin; i++)
{
Id2 = this.scanData2.ID;
Values2.AddRange(scanData2.Thicks);
thks[i] = double.NaN;
}
else
for (int i = scanData2.DataEnd + 1; i < thks.Count(); i++)
{
Id2 = -1;
thks[i] = double.NaN;
}
}, this);
Values2.AddRange(thks);
}
else
{
Values2.AddRange(scanData2.Thicks);
}
}
}
void UpdateId2()
{
Update4Id2Changed();
......
......@@ -175,6 +175,12 @@
<ToggleButton Style="{StaticResource Styles.ToggleButton.YESNO}" IsChecked="{Binding IsLineMode}"/>
</StackPanel>
</StackPanel>
<StackPanel Margin="{StaticResource ControlMargin}">
<TextBlock Style="{StaticResource Styles.Text.FieldHeader.Editable.Row2}" Text="隐藏数据&#13;范围外数据" />
<StackPanel Orientation="Horizontal">
<ToggleButton Style="{StaticResource Styles.ToggleButton.YESNO}" IsChecked="{Binding IsSideCutHidden}"/>
</StackPanel>
</StackPanel>
</StackPanel>
<Button Style="{StaticResource Styles.Button.Apply}" Click="btnOkClick"/>
......
......@@ -70,5 +70,10 @@ namespace FLY.Thick.FilmCasting.UI.UiModule
/// 曲线模式
/// </summary>
public bool IsLineMode { get; set; }
/// <summary>
/// 数据范围外数据隐藏
/// </summary>
public bool IsSideCutHidden { get; set; }
}
}
......@@ -427,6 +427,10 @@ namespace FLY.Thick.FilmCasting.UI.UiModule
{
UpdateSeriesType();
}
else if (e.PropertyName == nameof(graphparam.IsSideCutHidden))
{
UpdateValues();
}
}
......@@ -720,6 +724,7 @@ namespace FLY.Thick.FilmCasting.UI.UiModule
//UpdateX();
UpdateValues();
UpdateCellValues();
}
protected void UpdateValues()
......@@ -727,14 +732,30 @@ namespace FLY.Thick.FilmCasting.UI.UiModule
Values.Clear();
if (Averages != null)
{
Values.AddRange(Averages);
updateCellValues();
if (graphparam.IsSideCutHidden)
{
var thks = Averages.ToArray();
for (int i = 0; i < DataBegin; i++)
{
thks[i] = double.NaN;
}
for (int i = DataEnd + 1; i < thks.Count(); i++)
{
thks[i] = double.NaN;
}
Values.AddRange(thks);
}
else
{
Values.AddRange(Averages);
}
}
}
/// <summary>
/// 画后面的10条线
/// </summary>
void updateCellValues()
protected void UpdateCellValues()
{
if (scanDatas.Count < graphparam.CellMix)
......
......@@ -111,7 +111,9 @@ namespace FLY.Thick.FilmCasting.UI.UiModule
UpdateAverage();
UpdateMaxMinText();
UpdateValues();
UpdateCellValues();
UpdateY();
#endregion
......
......@@ -86,6 +86,12 @@
<ToggleButton Style="{StaticResource Styles.ToggleButton.YESNO}" IsChecked="{Binding IsLineMode}"/>
</StackPanel>
</StackPanel>
<StackPanel Margin="{StaticResource ControlMargin}">
<TextBlock Style="{StaticResource Styles.Text.FieldHeader.Editable.Row2}" Text="隐藏数据&#13;范围外数据" />
<StackPanel Orientation="Horizontal">
<ToggleButton Style="{StaticResource Styles.ToggleButton.YESNO}" IsChecked="{Binding IsSideCutHidden}"/>
</StackPanel>
</StackPanel>
</StackPanel>
<Button Style="{StaticResource Styles.Button.Apply}" Click="btnOkClick"/>
</StackPanel>
......
......@@ -36,6 +36,11 @@ namespace FLY.Thick.FilmCasting.UI.UiModule
}
}
/// <summary>
/// 数据范围外数据隐藏
/// </summary>
public bool IsSideCutHidden { get; set; }
/// <summary>
/// 当小于等于0,为相对值,大于0为绝对值
/// </summary>
......
......@@ -433,6 +433,10 @@ namespace FLY.Thick.FilmCasting.UI.UiModule
{
UpdateSeriesType();
}
else if (e.PropertyName == nameof(graphparam.IsSideCutHidden))
{
UpdateValues();
}
}
......@@ -617,14 +621,35 @@ namespace FLY.Thick.FilmCasting.UI.UiModule
//必须先更新Y轴, X轴资料,最后再画线!!!!!!!
//不然 YAxisCrossing 会有机会无效
if (scanData != null && scanData.Thicks != null)
{
Values.AddRange(scanData.Thicks);
}
UpdateValues();
}, this);
}
protected void UpdateValues()
{
//清除全部数据
Values.Clear();
if (scanData != null && scanData.Thicks != null)
{
if (graphparam.IsSideCutHidden)
{
var thks = scanData.Thicks.ToArray();
for (int i = 0; i < DataBegin; i++)
{
thks[i] = double.NaN;
}
for (int i = DataEnd + 1; i < thks.Count(); i++)
{
thks[i] = double.NaN;
}
Values.AddRange(thks);
}
else
{
Values.AddRange(scanData.Thicks);
}
}
}
public void PreView()
{
......
......@@ -128,6 +128,12 @@
<ToggleButton Style="{StaticResource Styles.ToggleButton.YESNO}" IsChecked="{Binding IsLineMode}"/>
</StackPanel>
</StackPanel>
<StackPanel Margin="{StaticResource ControlMargin}">
<TextBlock Style="{StaticResource Styles.Text.FieldHeader.Editable.Row2}" Text="隐藏数据&#13;范围外数据" />
<StackPanel Orientation="Horizontal">
<ToggleButton Style="{StaticResource Styles.ToggleButton.YESNO}" IsChecked="{Binding IsSideCutHidden}"/>
</StackPanel>
</StackPanel>
</StackPanel>
<Button Style="{StaticResource Styles.Button.Apply}" Click="btnOkClick"/>
......
......@@ -46,6 +46,12 @@
<lvc:Separator Stroke="{StaticResource Brushes.ChartSeparator}" Step ="{Binding XStep}"/>
</lvc:Axis.Separator>
<lvc:Axis.Sections>
<lvc:AxisSection Style="{StaticResource AxisSectionStyle}" StrokeThickness="1" Stroke="{StaticResource Brushes.Activity}"
Value="{Binding DataBeginOfBoltNo}"
/>
<lvc:AxisSection Style="{StaticResource AxisSectionStyle}" StrokeThickness="1" Stroke="{StaticResource Brushes.Activity}"
Value="{Binding DataEndOfBoltNo}"
/>
<lvc:AxisSection Style="{StaticResource AxisSectionStyle}" Stroke="Orange"
Value="{Binding FilmBeginOfBoltNo}"
/>
......
......@@ -40,6 +40,8 @@ namespace FLY.Thick.FilmCasting.UI.UiModule
public double FilmEndOfBoltIndex { get; set; } = NULL_VALUE;
public double FilmEndOfBoltNo => FilmEndOfBoltIndex + 1;
/// <summary>
/// 选择的位置 单位:分区序号
/// </summary>
......
......@@ -51,16 +51,18 @@ namespace FLY.Thick.FilmCasting.UI.UiModule
Random random = new Random();
for (int i = 0; i < nbolts; i++)
{
datas[i] = (Math.Sin(i * Math.PI / nbolts) * 3) * tolerance + target + (random.NextDouble() - 0.5) * 1 - 6;
}
for (int i = 0; i < profileParam.DataRange.Begin; i++)
{
datas[i] = double.NaN;
}
for (int i = profileParam.DataRange.End; i < nbolts; i++)
{
datas[i] = double.NaN;
if (i < profileParam.DataRange.Begin - 3)
{
datas[i] = (random.NextDouble() - 0.5);
}
else if (i > profileParam.DataRange.End + 3)
{
datas[i] = (random.NextDouble() - 0.5);
}
else
{
datas[i] = (Math.Sin(i * Math.PI / nbolts) * 3) * tolerance + target + (random.NextDouble() - 0.5) * 1 - 6;
}
}
#endregion
......@@ -78,14 +80,15 @@ namespace FLY.Thick.FilmCasting.UI.UiModule
Velocity = 40.1;
Position = 800.4;
FilmBeginOfBoltIndex = profileParam.DataRange.Begin;
FilmEndOfBoltIndex = profileParam.DataRange.End;
FilmBeginOfBoltIndex = profileParam.DataRange.Begin - 3;
FilmEndOfBoltIndex = profileParam.DataRange.End + 3;
DataBegin = profileParam.DataRange.Begin;
DataEnd = profileParam.DataRange.End;
SelectedOfBoltIndex = FilmBeginOfBoltIndex + 6;
SelectedWidthOfBoltIndex = 30;
SelectedWidthMm = 312;
Values.Clear();
Values.AddRange(datas);
......
......@@ -141,6 +141,12 @@
<ToggleButton Style="{StaticResource Styles.ToggleButton.YESNO}" IsChecked="{Binding IsLineMode}"/>
</StackPanel>
</StackPanel>
<StackPanel Margin="{StaticResource ControlMargin}">
<TextBlock Style="{StaticResource Styles.Text.FieldHeader.Editable.Row2}" Text="隐藏数据&#13;范围外数据" />
<StackPanel Orientation="Horizontal">
<ToggleButton Style="{StaticResource Styles.ToggleButton.YESNO}" IsChecked="{Binding IsSideCutHidden}"/>
</StackPanel>
</StackPanel>
</StackPanel>
<Button Style="{StaticResource Styles.Button.Apply}" Click="btnOkClick"/>
</StackPanel>
......
......@@ -21,7 +21,7 @@
<local:TempScanGraphVmUt x:Key="viewmodel"/>
</ResourceDictionary>
</UserControl.Resources>
<Border Style="{StaticResource BorderStyle_module}" >
<Border Style="{StaticResource Styles.Module.Border}" >
<Grid d:DataContext="{StaticResource viewmodel}">
<Grid.RowDefinitions>
<RowDefinition Height="auto"/>
......
<flyctrllib:WindowBigClose x:Class="FLY.Thick.FilmCasting.UI.WdShrinkHelper"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:flyctrllib="clr-namespace:FLY.ControlLibrary;assembly=FLY.ControlLibrary"
xmlns:local="clr-namespace:FLY.Thick.FilmCasting.UI"
Background="White"
mc:Ignorable="d" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" SizeToContent="WidthAndHeight" >
<Window.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="pack://application:,,,/FLY.ControlLibrary;component/Themes/Dictionary_MyStyle.xaml"/>
<ResourceDictionary Source="pack://application:,,,/FLY.ControlLibrary;component/Converter/Dictionary_MyConv.xaml"/>
</ResourceDictionary.MergedDictionaries>
<local:WdShrinkHelperVm x:Key="viewmodel" />
</ResourceDictionary>
</Window.Resources>
<Grid TextBlock.FontSize="24" TextBlock.FontStyle="Normal" d:DataContext="{StaticResource viewmodel}">
<StackPanel Margin="{StaticResource ControlMargin}">
<Grid Height="20"/>
<StackPanel Orientation="Horizontal">
<StackPanel>
<StackPanel Orientation="Horizontal" >
<StackPanel Margin="{StaticResource ControlMargin}">
<TextBlock Style="{StaticResource Styles.Text.FieldHeader.Editable}" Text="真实螺丝号1" />
<TextBox Style="{StaticResource Styles.Text.FieldContent.Input.Card}" Text="{Binding RealBoltNo1,StringFormat={}{0:0.#}}" />
</StackPanel>
<StackPanel Margin="{StaticResource ControlMargin}">
<TextBlock Style="{StaticResource Styles.Text.FieldHeader.Editable}" Text="真实螺丝位2" />
<TextBox Style="{StaticResource Styles.Text.FieldContent.Input.Card}" Text="{Binding RealBoltNo2,StringFormat={}{0:0.#}}"/>
</StackPanel>
</StackPanel>
<StackPanel Orientation="Horizontal" >
<StackPanel Margin="{StaticResource ControlMargin}">
<TextBlock Style="{StaticResource Styles.Text.FieldHeader.Editable}" Text="显示螺丝位1" Foreground="{StaticResource Brushes.Highlight}"/>
<TextBox Style="{StaticResource Styles.Text.FieldContent.Input.Card}" Text="{Binding ShowBoltNo1,StringFormat={}{0:0.#}}" />
</StackPanel>
<StackPanel Margin="{StaticResource ControlMargin}">
<TextBlock Style="{StaticResource Styles.Text.FieldHeader.Editable}" Text="显示螺丝位2" Foreground="{StaticResource Brushes.Highlight}"/>
<TextBox Style="{StaticResource Styles.Text.FieldContent.Input.Card}" Text="{Binding ShowBoltNo2,StringFormat={}{0:0.#}}"/>
</StackPanel>
</StackPanel>
</StackPanel>
<StackPanel Orientation="Horizontal">
<Button Style="{StaticResource Styles.Button.Square.Accent2}" Command="{Binding CalCmd}" Content="计算"/>
</StackPanel>
</StackPanel>
<StackPanel Margin="{StaticResource ControlMargin}">
<TextBlock Style="{StaticResource Styles.Text.FieldHeader}" Text="结果"/>
<StackPanel >
<StackPanel Orientation="Horizontal">
<TextBlock Style="{StaticResource Styles.Text.FieldHeader}" Text="收缩率="/>
<StackPanel Orientation="Horizontal">
<TextBlock Style="{StaticResource Styles.Text.FieldContent}" Text="{Binding UniformShrinkPercent,Converter={StaticResource percentconv}}"/>
<TextBlock Style="{StaticResource Styles.Text.FieldContent.Unit}" Text="%" />
</StackPanel>
</StackPanel>
<StackPanel Orientation="Horizontal">
<TextBlock Style="{StaticResource Styles.Text.FieldHeader}" Text="膜中心位置偏移="/>
<StackPanel Orientation="Horizontal">
<TextBlock Style="{StaticResource Styles.Text.FieldContent}" Text="{Binding MidOffset}"/>
<TextBlock Style="{StaticResource Styles.Text.FieldContent.Unit}" Text="mm" />
</StackPanel>
</StackPanel>
</StackPanel>
</StackPanel>
<Button Style="{StaticResource Styles.Button.Apply}" Click="button_apply_Click" />
</StackPanel>
</Grid>
</flyctrllib:WindowBigClose>
using FLY.Thick.FilmCasting.Common;
using FLY.Thick.FilmCasting.IService;
using GalaSoft.MvvmLight.Command;
using Misc;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
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.Thick.FilmCasting.UI
{
/// <summary>
/// WdShrinkHelper.xaml 的交互逻辑
/// </summary>
public partial class WdShrinkHelper : FLY.ControlLibrary.WindowBigClose
{
WdShrinkHelperVm viewModel;
public WdShrinkHelper()
{
InitializeComponent();
}
public void Init(IBoltMapFilmCastingService boltMapFilmCastingService, FilmCastingProfileParam set_param)
{
viewModel = new WdShrinkHelperVm();
viewModel.Init(boltMapFilmCastingService, set_param);
this.DataContext = viewModel;
}
private void button_apply_Click(object sender, RoutedEventArgs e)
{
viewModel.Apply();
this.DialogResult = true;
this.Close();
}
}
public class WdShrinkHelperVm : INotifyPropertyChanged
{
/// <summary>
/// 真实螺丝位1
/// </summary>
public double RealBoltNo1 { get; set; }
/// <summary>
/// 真实螺丝位2
/// </summary>
public double RealBoltNo2 { get; set; }
/// <summary>
/// 测厚仪显示螺丝位1
/// </summary>
public double ShowBoltNo1 { get; set; }
/// <summary>
/// 测厚仪显示螺丝位2
/// </summary>
public double ShowBoltNo2 { get; set; }
/// <summary>
/// 计算出来的收缩率
/// </summary>
public double UniformShrinkPercent { get; set; }
public int MidOffset { get; set; }
public RelayCommand CalCmd { get; private set; }
double midBoltNo;
IBoltMapFilmCastingService boltMapFilmCastingService;
FilmCastingProfileParam set_param;
public WdShrinkHelperVm()
{
CalCmd = new RelayCommand(Cal);
}
public void Init(IBoltMapFilmCastingService boltMapFilmCastingService, FilmCastingProfileParam set_param)
{
this.boltMapFilmCastingService = boltMapFilmCastingService;
this.set_param = set_param;
midBoltNo = boltMapFilmCastingService.LeftEmptyBolts + (boltMapFilmCastingService.BoltCnt - (boltMapFilmCastingService.LeftEmptyBolts + boltMapFilmCastingService.RightEmptyBolts)) / 2.0;
RealBoltNo2 = (int)midBoltNo;
ShowBoltNo2 = (int)midBoltNo;
UniformShrinkPercent = this.boltMapFilmCastingService.UniformShrinkPercent;
MidOffset = this.boltMapFilmCastingService.MidOffset;
}
private void Cal()
{
//还原
double showBoltNo1 = ToShrink0ShowBoltNo(ShowBoltNo1);
double showBoltNo2 = ToShrink0ShowBoltNo(ShowBoltNo2);
double shrink = 1 - (showBoltNo2 - showBoltNo1) / (RealBoltNo2 - RealBoltNo1);
UniformShrinkPercent = shrink;
double showMidBoltNo = (1 - shrink) * (midBoltNo - RealBoltNo1) + showBoltNo1;
double midOffset = (showMidBoltNo - midBoltNo) * boltMapFilmCastingService.BoltWidth + boltMapFilmCastingService.MidOffset;
MidOffset = (int)midOffset;
}
/// <summary>
/// 转为收缩率为0时,显示的螺丝号
/// </summary>
/// <param name="currBoltNo"></param>
/// <returns></returns>
double ToShrink0ShowBoltNo(double currBoltNo)
{
double orgBoltNo = midBoltNo - (1 - boltMapFilmCastingService.UniformShrinkPercent) * (midBoltNo - currBoltNo);
return orgBoltNo;
}
public void Apply()
{
this.set_param.UniformShrinkPercent = Math.Round(UniformShrinkPercent, 3);
if (Math.Abs(MidOffset) < boltMapFilmCastingService.BoltWidth)
{
this.set_param.MidOffset = 0;
}
else
{
this.set_param.MidOffset = MidOffset;
}
}
public event PropertyChangedEventHandler PropertyChanged;
}
}
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