Commit 944e758a authored by 潘栩锋's avatar 潘栩锋 🚴

添加 自动模头图表的Y轴可以设置。

添加 自动模头的对位分析 可以快速查找加热量不同的图
parent 3be7f334
......@@ -36,7 +36,16 @@
<Button Style="{StaticResource Styles.TitleBar.BackButton2}" Command="BrowseBack"/>
<StackPanel Orientation="Horizontal" VerticalAlignment="Center">
<TextBlock Style="{StaticResource Styles.TitleBar.Text}" Text="对位分析"/>
<TextBlock Style="{StaticResource Styles.TitleBar.Text.Sub}" Text="加热与厚度"/>
<StackPanel>
<StackPanel Orientation="Horizontal" >
<TextBlock Style="{StaticResource TextBlockStyle_FieldHeader}" Text="有效数据" Foreground="LightGray"/>
<ToggleButton Style="{StaticResource CheckStyle}" HorizontalAlignment="Left" IsChecked="{Binding IsMoveByTakeEffect}" Width="30" Height="auto" Foreground="White" Background="#02FFFFFF" />
</StackPanel>
<StackPanel Orientation="Horizontal" >
<TextBlock Style="{StaticResource TextBlockStyle_FieldHeader}" Text="模头改变" Foreground="LightGray"/>
<ToggleButton Style="{StaticResource CheckStyle}" HorizontalAlignment="Left" IsChecked="{Binding IsMoveByDiffCTime}" Width="30" Height="auto" Foreground="White" Background="#02FFFFFF" />
</StackPanel>
</StackPanel>
</StackPanel>
</StackPanel>
......@@ -88,29 +97,13 @@
<lvc:CartesianChart Height="300" Margin="5,2,2,2"
DisableAnimations="True" Hoverable="False" DataTooltip="{x:Null}" >
<lvc:CartesianChart.Series>
<!--<lvc1:Column2Series
PointGeometry="{x:Null}"
StrokeThickness ="1"
Stroke="Black"
Fill="{StaticResource Brushes.PreHeat}"
Values="{Binding HeatDiffs}"
Configuration="{Binding MapperHeats}"/>-->
<lvc1:Column2Series
<lvc1:Column2Series
PointGeometry="{x:Null}"
StrokeThickness ="1"
Stroke="Black"
Fill="{StaticResource Brushes.PreHeat}"
Values="{Binding HeatDiffEffects}"
Configuration="{Binding MapperHeats}"/>
<!--<lvc:LineSeries
PointGeometry="{x:Null}"
StrokeThickness ="3"
Stroke="{StaticResource Brushes.Heat}"
Fill="Transparent"
Values="{Binding HeatDiffEffects}"
Configuration="{Binding MapperHeats}"/>-->
<lvc:LineSeries
PointGeometry="{x:Null}"
StrokeThickness ="3"
......@@ -136,9 +129,9 @@
<lvc:CartesianChart.AxisY>
<lvc:Axis Foreground="{StaticResource Brushes.AxisLabel}"
LabelFormatter="{Binding YFormatter}" FontFamily="Courier New"
MinValue="-100" MaxValue="100">
MinValue="{Binding YMinOffset}" MaxValue="{Binding YMaxOffset}">
<lvc:Axis.Separator>
<lvc:Separator Stroke="{StaticResource Brushes.AxisSeparator}" Step="10"/>
<lvc:Separator Stroke="{StaticResource Brushes.AxisSeparator}" Step="{Binding YStepOffset}"/>
</lvc:Axis.Separator>
</lvc:Axis>
</lvc:CartesianChart.AxisY>
......@@ -153,6 +146,20 @@
Command="{Binding ApplyCmd}"/>
<WrapPanel 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 MaxHeat}"/>
<TextBlock Style="{StaticResource Styles.Text.FieldContent.Unit}" Text="%" />
</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 RangeOfOffset}"/>
<TextBlock Style="{StaticResource Styles.Text.FieldContent.Unit}" Text="%" />
</StackPanel>
</StackPanel>
<StackPanel Margin="{StaticResource ControlMargin}" >
<TextBlock Style="{StaticResource Styles.Text.FieldHeader.Editable}" Text="加热效果" />
<StackPanel Orientation="Horizontal">
......
......@@ -22,6 +22,13 @@ namespace FLY.FilmCasting.AutoDie.UI.Client
#region 图表控制
public Func<double, string> YFormatter { get; private set; }
public int XMax { get; protected set; }
public double YMax => MaxHeat;
public double YMin => 0;
public double YStep => MaxHeat / 10;
public double YStepOffset => RangeOfOffset / 10;
public double YMaxOffset => RangeOfOffset / 2;
public double YMinOffset => -RangeOfOffset / 2;
#endregion
......@@ -43,6 +50,11 @@ namespace FLY.FilmCasting.AutoDie.UI.Client
/// 比例因子
/// </summary>
public double Kp { get; set; } = 3;
public int MaxHeat { get; set; } = 100;
public int RangeOfOffset { get; set; } = 50;
public bool IsMoveByTakeEffect { get; set; } = true;
public bool IsMoveByDiffCTime { get; set; } = true;
/// <summary>
/// 复位区号
......@@ -163,6 +175,14 @@ namespace FLY.FilmCasting.AutoDie.UI.Client
this.heatCell, nameof(this.heatCell.Kp),
this, nameof(Kp));
Misc.BindingOperations.SetBinding(
this.heatCell, nameof(this.heatCell.MaxHeat),
this, nameof(MaxHeat));
Misc.BindingOperations.SetBinding(
this.heatCell, nameof(this.heatCell.RangeOfOffset),
this, nameof(RangeOfOffset));
Misc.BindingOperations.SetBinding(
this.heatBuf, nameof(this.heatBuf.HeatEffectCurve),
this, nameof(HeatEffectCurve));
......@@ -188,8 +208,11 @@ namespace FLY.FilmCasting.AutoDie.UI.Client
for (int i = 0; i < 2; i++)
{
ucThickHeatVms[i] = new UcThickHeatVm();
ucThickHeatVms[i].Init($"记录{i + 1}", bulkDbService, 0 - i, Kp);
ucThickHeatVms[i].Init($"记录{i + 1}", bulkDbService, 0 - i, Kp, MaxHeat);
Misc.BindingOperations.SetBinding(this, nameof(Kp), ucThickHeatVms[i], nameof(UcThickHeatVm.Kp));
Misc.BindingOperations.SetBinding(this, nameof(MaxHeat), ucThickHeatVms[i], nameof(UcThickHeatVm.MaxHeat));
Misc.BindingOperations.SetBinding(this, nameof(IsMoveByTakeEffect), ucThickHeatVms[i], nameof(UcThickHeatVm.IsMoveByTakeEffect));
Misc.BindingOperations.SetBinding(this, nameof(IsMoveByDiffCTime), ucThickHeatVms[i], nameof(UcThickHeatVm.IsMoveByDiffCTime));
ucThickHeatVms[i].FrameUpdated += PgHeatAnalyseVm_FrameUpdated;
}
......@@ -488,6 +511,8 @@ namespace FLY.FilmCasting.AutoDie.UI.Client
heatBuf.Apply();
heatCell.Kp = Kp;
heatCell.MaxHeat = MaxHeat;
heatCell.RangeOfOffset = RangeOfOffset;
heatCell.Apply();
FLY.ControlLibrary.Window_Tip.Show("通知", "应用成功", TimeSpan.FromSeconds(2));
......
......@@ -63,9 +63,9 @@
<lvc:CartesianChart.AxisY>
<lvc:Axis Foreground="{StaticResource Brushes.AxisLabel}"
LabelFormatter="{Binding YFormatter}" FontFamily="Courier New"
MinValue="0" MaxValue="100">
MinValue="{Binding YMin}" MaxValue="{Binding YMax}">
<lvc:Axis.Separator>
<lvc:Separator Stroke="{StaticResource Brushes.AxisSeparator}" Step="10"/>
<lvc:Separator Stroke="{StaticResource Brushes.AxisSeparator}" Step="{Binding YStep}"/>
</lvc:Axis.Separator>
</lvc:Axis>
</lvc:CartesianChart.AxisY>
......
......@@ -23,6 +23,11 @@ namespace FLY.FilmCasting.AutoDie.UI.Client
#region 图表控制
public Func<double, string> YFormatter { get; protected set; }
public int XMax { get; set; } = 88;
public double YMax => MaxHeat;
public double YMin => 0;
public double YStep => MaxHeat / 10;
#endregion
/// <summary>
......@@ -32,6 +37,16 @@ namespace FLY.FilmCasting.AutoDie.UI.Client
public ChartValues<int> Heats { get; } = new ChartValues<int>();
public double Kp { get; set; } = 3;
public int MaxHeat { get; set; } = 100;
/// <summary>
/// 急速移动,功能: 移动到下一个数据有效
/// </summary>
public bool IsMoveByTakeEffect { get; set; } = true;
/// <summary>
/// 急速移动,功能: 移动到下一个加热不同
/// </summary>
public bool IsMoveByDiffCTime { get; set; } = true;
public object MapperHeats { get; private set; }
......@@ -154,12 +169,15 @@ namespace FLY.FilmCasting.AutoDie.UI.Client
public void Init(string title,
IBulkDbService bulkDbService,
int number, double kp)
int number, double kp, int maxHeat)
{
this.bulkDbService = bulkDbService;
Title = title;
Kp = kp;
MaxHeat = maxHeat;
Misc.BindingOperations.SetBinding(bulkDbService, nameof(bulkDbService.LastId), this, nameof(LastId));
Number = number;
UpdateFrame();
......@@ -183,7 +201,7 @@ namespace FLY.FilmCasting.AutoDie.UI.Client
{
PollModule.Current.Poll_JustOnce(() =>
{
_updateFrame();
bulkDbService.GetFrame(Number, my_GetFrameReponse, null);
}, this, MARKNO_UPDATEFRAME);
}
......@@ -227,29 +245,7 @@ namespace FLY.FilmCasting.AutoDie.UI.Client
FrameUpdated?.Invoke();
}
void _updateFrame()
{
if (IsGetStableFrame)
{
IsGetStableFrame = false;
bulkDbService.GetStableFrame(Number, IsPre, (asyncContext, retData) =>
{
var reponce = retData as GetStableFrameReponse;
SetFrame(reponce.thickHeat);
}, null);
}
else
{
bulkDbService.GetFrame(Number, (asyncContext, retData) =>
{
var reponce = retData as GetFrameReponse;
SetFrame(reponce.thickHeat);
}, null);
}
}
private void Next()
{
if (Number < bulkDbService.LastId)
......@@ -259,14 +255,14 @@ namespace FLY.FilmCasting.AutoDie.UI.Client
{
Number--;
}
bool IsGetStableFrame;
bool IsPre;
bool IsSkipNumberChanged;
private void NextStable()
{
IsGetStableFrame = true;
IsPre = false;
Number++;
PollModule.Current.Poll_JustOnce(() =>
{
bulkDbService.GetFrameAdv(Number, false, IsMoveByTakeEffect, IsMoveByDiffCTime, my_GetFrameReponse, null);
}, this, MARKNO_UPDATEFRAME);
}
private void Newest()
{
......@@ -274,12 +270,22 @@ namespace FLY.FilmCasting.AutoDie.UI.Client
}
private void PreStable()
{
IsGetStableFrame = true;
IsPre = true;
Number--;
PollModule.Current.Poll_JustOnce(() =>
{
bulkDbService.GetFrameAdv(Number, true, IsMoveByTakeEffect, IsMoveByDiffCTime, my_GetFrameReponse, null);
}, this, MARKNO_UPDATEFRAME);
}
void my_GetFrameReponse(object asyncContext, object retData)
{
var reponse = retData as GetFrameReponse;
if (reponse.thickHeat != null)
SetFrame(reponse.thickHeat);
else
IsVaild = false;
FrameUpdated?.Invoke();
}
/// <summary>
/// 以指定分区表 导出厚度%
/// </summary>
......
......@@ -95,6 +95,13 @@
<TextBlock Style="{StaticResource Styles.Text.FieldContent.Unit}" Text="%" />
</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 RangeOfOffset}"/>
<TextBlock Style="{StaticResource Styles.Text.FieldContent.Unit}" Text="%" />
</StackPanel>
</StackPanel>
<StackPanel Margin="{StaticResource ControlMargin}">
<TextBlock Style="{StaticResource Styles.Text.FieldHeader.Editable}" Text="步进" />
......
......@@ -73,7 +73,12 @@ namespace FLY.FilmCasting.AutoDie.UI.Client
/// <summary>
/// 最大功率
/// </summary>
public int MaxHeat { get; set; }
public int MaxHeat { get; set; } = 100;
/// <summary>
/// 偏移量界面的显示范围
/// </summary>
public int RangeOfOffset { get; set; } = 50;
/// <summary>
/// 混合数
......@@ -126,6 +131,7 @@ namespace FLY.FilmCasting.AutoDie.UI.Client
Misc.BindingOperations.SetBinding(this.HeatCell, nameof(IHeatCellService.CtrlLine), this, nameof(CtrlLine));
Misc.BindingOperations.SetBinding(this.HeatCell, nameof(IHeatCellService.Kp), this, nameof(Kp));
Misc.BindingOperations.SetBinding(this.HeatCell, nameof(IHeatCellService.MaxHeat), this, nameof(MaxHeat));
Misc.BindingOperations.SetBinding(this.HeatCell, nameof(IHeatCellService.RangeOfOffset), this, nameof(RangeOfOffset));
Misc.BindingOperations.SetBinding(this.Feedback, nameof(IFeedbackHeatService.Step), this, nameof(Step));
Misc.BindingOperations.SetBinding(this.Feedback, nameof(IFeedbackHeatService.HasCheck), this, nameof(HasCheck));
......@@ -223,7 +229,7 @@ namespace FLY.FilmCasting.AutoDie.UI.Client
HeatCell.CtrlLine = this.CtrlLine;
HeatCell.Kp = this.Kp;
HeatCell.MaxHeat = this.MaxHeat;
HeatCell.RangeOfOffset = this.RangeOfOffset;
Feedback.Step=this.Step;
Feedback.HasCheckFilmVelocity=this.HasCheckFilmVelocity;
......
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:lvc="clr-namespace:LiveCharts.Wpf;assembly=LiveCharts.Wpf"
>
xmlns:lvc="clr-namespace:LiveCharts.Wpf;assembly=LiveCharts.Wpf" xmlns:iconPacks="http://metro.mahapps.com/winfx/xaml/iconpacks">
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="pack://application:,,,/FLY.ControlLibrary;component/Themes/Dictionary_MyStyle.xaml"/>
<ResourceDictionary Source="pack://application:,,,/FLY.ControlLibrary;component/Converter/Dictionary_MyConv.xaml"/>
......@@ -54,4 +53,24 @@
<SolidColorBrush x:Key="Badges.AccentBackground">#99008BE5</SolidColorBrush>
<SolidColorBrush x:Key="Badges.AccentForeground">White</SolidColorBrush>
<Style TargetType="{x:Type ToggleButton}" x:Key="CheckStyle" >
<Setter Property="HorizontalContentAlignment" Value="Center"/>
<Setter Property="VerticalContentAlignment" Value="Center"/>
<Setter Property="Padding" Value="1"/>
<Setter Property="Background" Value="Transparent"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ToggleButton}">
<Border Background="{TemplateBinding Background}" CornerRadius="2" >
<iconPacks:PackIconMaterial x:Name="icon" Kind="CheckboxBlankOutline" Height="{TemplateBinding Height}" Width="{TemplateBinding Width}" />
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsChecked" Value="True">
<Setter TargetName="icon" Property="Kind" Value="CheckboxMarkedOutline"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ResourceDictionary>
\ No newline at end of file
......@@ -50,11 +50,11 @@ xmlns:lvc="clr-namespace:LiveCharts.Wpf;assembly=LiveCharts.Wpf" xmlns:lvc1="clr
</ResourceDictionary>
</UserControl.Resources>
<Border Style="{StaticResource BorderStyle_module}" >
<Border Style="{StaticResource Styles.Module.Border}" >
<Grid Name="grid" d:DataContext="{StaticResource viewModel}">
<Grid.RowDefinitions>
<RowDefinition Height="auto" />
<RowDefinition Height="258*" />
<RowDefinition />
</Grid.RowDefinitions>
<Border Background="#F0579aab" Height="20" VerticalAlignment="Top" CornerRadius="3,3,0,0"/>
<Grid>
......@@ -279,13 +279,6 @@ xmlns:lvc="clr-namespace:LiveCharts.Wpf;assembly=LiveCharts.Wpf" xmlns:lvc1="clr
Fill="Transparent"
Values="{Binding ThickPercents}"
Configuration="{Binding MapperThickPercents}"/>
<!--<lvc:ScatterSeries
PointGeometry="{StaticResource Geometry.Close}"
StrokeThickness ="1"
Stroke="{StaticResource Brushes.Thick}"
Fill="{StaticResource WhiteBrush}"
Values="{Binding ThickPercents}"
Configuration="{Binding MapperThickPercentsWithIsStable}"/>-->
</lvc:CartesianChart.Series>
<lvc:CartesianChart.AxisX>
<lvc:Axis Foreground="{StaticResource Brushes.AxisLabel}"
......@@ -304,10 +297,10 @@ xmlns:lvc="clr-namespace:LiveCharts.Wpf;assembly=LiveCharts.Wpf" xmlns:lvc1="clr
</lvc:CartesianChart.AxisX>
<lvc:CartesianChart.AxisY>
<lvc:Axis Foreground="{StaticResource Brushes.AxisLabel}"
LabelFormatter="{Binding YFormatter}"
MinValue="-50" MaxValue="50" FontFamily="Courier New" >
LabelFormatter="{Binding YFormatter}" FontFamily="Courier New"
MinValue="{Binding YMinOffset}" MaxValue="{Binding YMaxOffset}" >
<lvc:Axis.Separator>
<lvc:Separator Stroke="{StaticResource Brushes.AxisSeparator}" Step="10"/>
<lvc:Separator Stroke="{StaticResource Brushes.AxisSeparator}" Step="{Binding YStepOffset}"/>
</lvc:Axis.Separator>
</lvc:Axis>
</lvc:CartesianChart.AxisY>
......@@ -349,9 +342,9 @@ xmlns:lvc="clr-namespace:LiveCharts.Wpf;assembly=LiveCharts.Wpf" xmlns:lvc1="clr
<lvc:CartesianChart.AxisY>
<lvc:Axis Foreground="{StaticResource Brushes.AxisLabel}"
LabelFormatter="{Binding YFormatter}"
MinValue="0" MaxValue="100" FontFamily="Courier New" >
MinValue="{Binding YMin}" MaxValue="{Binding YMax}" FontFamily="Courier New">
<lvc:Axis.Separator>
<lvc:Separator Stroke="{StaticResource Brushes.AxisSeparator}" Step="10"/>
<lvc:Separator Stroke="{StaticResource Brushes.AxisSeparator}" Step="{Binding YStep}"/>
</lvc:Axis.Separator>
</lvc:Axis>
</lvc:CartesianChart.AxisY>
......
......@@ -20,6 +20,14 @@ namespace FLY.FilmCasting.AutoDie.UI.Client.UiModule
public Func<double, string> YFormatter { get; private set; }
public double XMax { get; protected set; } = double.NaN;
public double XMin { get; protected set; } = double.NaN;
public double YMax => MaxHeat;
public double YMin => 0;
public double YStep => MaxHeat / 10;
public double YStepOffset => RangeOfOffset / 10;
public double YMaxOffset => RangeOfOffset / 2;
public double YMinOffset => -RangeOfOffset / 2;
#endregion
/// <summary>
......@@ -37,12 +45,13 @@ namespace FLY.FilmCasting.AutoDie.UI.Client.UiModule
[PropertyChanged.DependsOn(nameof(Kp))]
public object MapperThickPercents { get; private set; }
[PropertyChanged.DependsOn(nameof(Kp))]
public object MapperThickPercentsWithIsStable { get; private set; }
public object Mapper { get; private set; }
public int MaxHeat { get; set; } = 100;
public int RangeOfOffset { get; set; } = 50;
public double Kp { get; protected set; } = 3;
/// <summary>
/// 当前选择加热通道
/// </summary>
......@@ -75,7 +84,7 @@ namespace FLY.FilmCasting.AutoDie.UI.Client.UiModule
YFormatter = (y) =>
{
string text = y + "%";
string text = Math.Round(y) + "%";
return $"{text,6}";
};
......@@ -117,23 +126,6 @@ namespace FLY.FilmCasting.AutoDie.UI.Client.UiModule
return value * Kp;
});
MapperThickPercentsWithIsStable = Mappers.Xy<double>()
.X((value, index) =>
{
return index + 1;
})
.Y((value, index) =>
{
if (index < IsStables.Count() && index >= 0)
{
if (!IsStables[index])
{
return value * Kp;
}
}
return double.NaN;
});
Mapper = Mappers.Xy<int>()
.X((value, index) =>
......@@ -189,7 +181,8 @@ namespace FLY.FilmCasting.AutoDie.UI.Client.UiModule
Misc.BindingOperations.SetBinding(mHeatCell, nameof(mHeatCell.Kp), this, nameof(Kp));
Misc.BindingOperations.SetBinding(mHeatCell, nameof(mHeatCell.MaxHeat), this, nameof(MaxHeat));
Misc.BindingOperations.SetBinding(mHeatCell, nameof(mHeatCell.RangeOfOffset), this, nameof(RangeOfOffset));
this.btnClearH = button_clear_h;
LPress.Init(btnClearH);
......
......@@ -42,6 +42,12 @@ namespace FLY.FilmCasting.AutoDie.Client
/// 最大加热量 默认100%
/// </summary>
public int MaxHeat { get; set; }
/// <summary>
/// 偏移量界面的显示范围
/// </summary>
public int RangeOfOffset { get; set; }
#endregion
......
......@@ -31,10 +31,15 @@ namespace FLY.FilmCasting.AutoDie.IService
int CtrlLine { get; set; }
/// <summary>
/// 最大加热量 默认100%
/// 最大加热量 默认100%, 也是 当前量界面的显示范围
/// </summary>
int MaxHeat { get; set; }
/// <summary>
/// 偏移量界面的显示范围
/// </summary>
int RangeOfOffset { get; set; }
#endregion
#region 状态
......
......@@ -49,7 +49,10 @@ namespace FLY.FilmCasting.AutoDie.Server
/// 最大加热量 默认100%
/// </summary>
public int MaxHeat { get; set; } = 100;
/// <summary>
/// 偏移量界面的显示范围
/// </summary>
public int RangeOfOffset { get; set; } = 50;
#endregion
#region 状态
......@@ -136,6 +139,7 @@ namespace FLY.FilmCasting.AutoDie.Server
{
CtrlLine = 2;
}
}
public void Init(HeatBuf heatBuf)
{
......@@ -624,6 +628,11 @@ namespace FLY.FilmCasting.AutoDie.Server
/// </summary>
public int MaxHeat = 100;
/// <summary>
/// 偏移量界面的显示范围
/// </summary>
public int RangeOfOffset = 50;
/// <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