Commit 4d8f0717 authored by 潘栩锋's avatar 潘栩锋 🚴

优化 全部扫描图 与 自动模头的Graph图, X轴都为 分区号。且主轴线 整数对齐

parent 2998bd6a
...@@ -42,7 +42,7 @@ xmlns:lvc="clr-namespace:LiveCharts.Wpf;assembly=LiveCharts.Wpf" xmlns:lvc1="clr ...@@ -42,7 +42,7 @@ xmlns:lvc="clr-namespace:LiveCharts.Wpf;assembly=LiveCharts.Wpf" xmlns:lvc1="clr
<Setter Property="Stroke" Value="{StaticResource Brushes.SelectBoltNo2}"/> <Setter Property="Stroke" Value="{StaticResource Brushes.SelectBoltNo2}"/>
<Setter Property="DataLabel" Value="False"/> <Setter Property="DataLabel" Value="False"/>
</Style> </Style>
<local:AirRingGraphVmUt x:Key="viewModel"/> <local:AutoDieGraphVmUt x:Key="viewModel"/>
<Geometry x:Key="Geometry.Close"> <Geometry x:Key="Geometry.Close">
M15.59,7L12,10.59L8.41,7L7,8.41L10.59,12L7,15.59L8.41,17L12,13.41L15.59,17L17,15.59L13.41,12L17,8.41L15.59,7Z M15.59,7L12,10.59L8.41,7L7,8.41L10.59,12L7,15.59L8.41,17L12,13.41L15.59,17L17,15.59L13.41,12L17,8.41L15.59,7Z
...@@ -289,7 +289,7 @@ xmlns:lvc="clr-namespace:LiveCharts.Wpf;assembly=LiveCharts.Wpf" xmlns:lvc1="clr ...@@ -289,7 +289,7 @@ xmlns:lvc="clr-namespace:LiveCharts.Wpf;assembly=LiveCharts.Wpf" xmlns:lvc1="clr
</lvc:CartesianChart.Series> </lvc:CartesianChart.Series>
<lvc:CartesianChart.AxisX> <lvc:CartesianChart.AxisX>
<lvc:Axis Foreground="{StaticResource Brushes.AxisLabel}" <lvc:Axis Foreground="{StaticResource Brushes.AxisLabel}"
MinValue="0" MaxValue="{Binding XMax}" MinValue="{Binding XMin}" MaxValue="{Binding XMax}"
> >
<lvc:Axis.Separator> <lvc:Axis.Separator>
<lvc:Separator Stroke="{StaticResource Brushes.AxisSeparator}" Step ="5"/> <lvc:Separator Stroke="{StaticResource Brushes.AxisSeparator}" Step ="5"/>
...@@ -332,7 +332,7 @@ xmlns:lvc="clr-namespace:LiveCharts.Wpf;assembly=LiveCharts.Wpf" xmlns:lvc1="clr ...@@ -332,7 +332,7 @@ xmlns:lvc="clr-namespace:LiveCharts.Wpf;assembly=LiveCharts.Wpf" xmlns:lvc1="clr
</lvc:CartesianChart.Series> </lvc:CartesianChart.Series>
<lvc:CartesianChart.AxisX> <lvc:CartesianChart.AxisX>
<lvc:Axis Foreground="{StaticResource Brushes.AxisLabel}" <lvc:Axis Foreground="{StaticResource Brushes.AxisLabel}"
MinValue="0" MaxValue="{Binding XMax}" MinValue="{Binding XMin}" MaxValue="{Binding XMax}"
> >
<lvc:Axis.Separator> <lvc:Axis.Separator>
<lvc:Separator Stroke="{StaticResource Brushes.AxisSeparator}" Step ="5"/> <lvc:Separator Stroke="{StaticResource Brushes.AxisSeparator}" Step ="5"/>
......
...@@ -47,11 +47,14 @@ namespace FLY.FilmCasting.AutoDie.UI.Client.UiModule ...@@ -47,11 +47,14 @@ namespace FLY.FilmCasting.AutoDie.UI.Client.UiModule
IUnityContainer container, IUnityContainer container,
IFeedbackHeatService feedback, IFeedbackHeatService feedback,
IHeatBufService heatBuf, IHeatBufService heatBuf,
IHeatCellService heatCell) IHeatCellService heatCell,
FLY.Thick.FilmCasting.IService.IFilmCastingProfileService filmCastingProfileService)
{ {
this.container = container; this.container = container;
viewModel = new AutoDieGraphVm(); viewModel = new AutoDieGraphVm();
viewModel.Init(feedback, heatBuf, heatCell, btnClearH);
viewModel.Init(feedback, heatBuf, heatCell, btnClearH, filmCastingProfileService.Param);
this.DataContext = viewModel; this.DataContext = viewModel;
} }
...@@ -88,9 +91,8 @@ namespace FLY.FilmCasting.AutoDie.UI.Client.UiModule ...@@ -88,9 +91,8 @@ namespace FLY.FilmCasting.AutoDie.UI.Client.UiModule
xEnd = closetsPoint.X; xEnd = closetsPoint.X;
vm.SelectBoltNo = (int)Math.Min(xBegin, xEnd); vm.SetSelected(xBegin, xEnd);
vm.SelectBoltNoWidth = (int)Math.Abs(xEnd - xBegin) + 1;
} }
private double xBegin; private double xBegin;
...@@ -116,9 +118,7 @@ namespace FLY.FilmCasting.AutoDie.UI.Client.UiModule ...@@ -116,9 +118,7 @@ namespace FLY.FilmCasting.AutoDie.UI.Client.UiModule
return; return;
} }
xBegin = closetsPoint.X; xBegin = closetsPoint.X;
vm.SetSelected(xBegin, xBegin);
vm.SelectBoltNo = (int)Math.Min(xBegin, xEnd);
vm.SelectBoltNoWidth = 1;
} }
private void UIElement_MouseUp(object sender, MouseButtonEventArgs e) private void UIElement_MouseUp(object sender, MouseButtonEventArgs e)
...@@ -145,9 +145,7 @@ namespace FLY.FilmCasting.AutoDie.UI.Client.UiModule ...@@ -145,9 +145,7 @@ namespace FLY.FilmCasting.AutoDie.UI.Client.UiModule
return; return;
xEnd = closetsPoint.X; xEnd = closetsPoint.X;
vm.SelectBoltNo = (int)Math.Min(xBegin, xEnd); vm.SetSelected(xBegin, xEnd);
vm.SelectBoltNoWidth = (int)Math.Abs(xEnd - xBegin) + 1;
} }
} }
......
...@@ -18,7 +18,8 @@ namespace FLY.FilmCasting.AutoDie.UI.Client.UiModule ...@@ -18,7 +18,8 @@ namespace FLY.FilmCasting.AutoDie.UI.Client.UiModule
#region 图表控制 #region 图表控制
public Func<double, string> YFormatter { get; private set; } public Func<double, string> YFormatter { get; private set; }
public int XMax { get; protected set; } public double XMax { get; protected set; } = double.NaN;
public double XMin { get; protected set; } = double.NaN;
#endregion #endregion
/// <summary> /// <summary>
...@@ -54,8 +55,9 @@ namespace FLY.FilmCasting.AutoDie.UI.Client.UiModule ...@@ -54,8 +55,9 @@ namespace FLY.FilmCasting.AutoDie.UI.Client.UiModule
/// 长按驱动器 /// 长按驱动器
/// </summary> /// </summary>
public LongPress LPress { get; } = new LongPress(); public LongPress LPress { get; } = new LongPress();
public IFeedbackHeatService FeedbackHeat { get; private set; } public IFeedbackHeatService FeedbackHeat => mFeedback;
FLY.Thick.FilmCasting.Common.FilmCastingProfileParam profileParam;
IFeedbackHeatService mFeedback; IFeedbackHeatService mFeedback;
IHeatBufService mHeatBuf; IHeatBufService mHeatBuf;
IHeatCellService mHeatCell; IHeatCellService mHeatCell;
...@@ -160,58 +162,31 @@ namespace FLY.FilmCasting.AutoDie.UI.Client.UiModule ...@@ -160,58 +162,31 @@ namespace FLY.FilmCasting.AutoDie.UI.Client.UiModule
ClearCmd = new RelayCommand(Clear); ClearCmd = new RelayCommand(Clear);
} }
private void Apply()
{
SelectBoltNo = -1;
SelectBoltNoWidth = 0;
mHeatCell.HeatApply();
}
private void Sub()
{
for (int i = 0; i < SelectBoltNoWidth; i++)
{
int index = SelectBoltNo - 1 + i;
if (index >= 0 && index < mFeedback.ChannelCnt)
{
mHeatCell.ModifyOffset(index, -mFeedback.Step);
}
}
}
private void Add()
{
for (int i = 0; i < SelectBoltNoWidth; i++)
{
int index = SelectBoltNo - 1 + i;
if (index >= 0 && index < mFeedback.ChannelCnt)
{
mHeatCell.ModifyOffset(index, mFeedback.Step);
}
}
}
public void Init( public void Init(
IFeedbackHeatService feedback, IFeedbackHeatService feedback,
IHeatBufService heatBuf, IHeatBufService heatBuf,
IHeatCellService heatCell, IHeatCellService heatCell,
Button button_clear_h) Button button_clear_h,
FLY.Thick.FilmCasting.Common.FilmCastingProfileParam _profileParam)
{ {
//把 FeedbackHeat 共享。 1个程序,只能有一个 FeedbackHeat //把 FeedbackHeat 共享。 1个程序,只能有一个 FeedbackHeat
mFeedback = feedback; mFeedback = feedback;
mHeatBuf = heatBuf; mHeatBuf = heatBuf;
mHeatCell = heatCell; mHeatCell = heatCell;
profileParam = _profileParam;
FeedbackHeat = mFeedback;
mFeedback.PropertyChanged += mFeedbackHeatService_PropertyChanged; mFeedback.PropertyChanged += mFeedbackHeatService_PropertyChanged;
mHeatCell.PropertyChanged += MHeatCell_PropertyChanged; mHeatCell.PropertyChanged += MHeatCell_PropertyChanged;
UpdateAxisX(); UpdateX();
DataBindAll_Thicks(); DataBindAll_Thicks();
DataBindAll_HeatOffsets(); DataBindAll_HeatOffsets();
DataBindAll_Heats(); DataBindAll_Heats();
DataBindAll_PreHeats(); DataBindAll_PreHeats();
profileParam.PropertyChanged += ProfileParam_PropertyChanged;
Misc.BindingOperations.SetBinding(mHeatCell, nameof(mHeatCell.Kp), this, nameof(Kp)); Misc.BindingOperations.SetBinding(mHeatCell, nameof(mHeatCell.Kp), this, nameof(Kp));
...@@ -224,7 +199,13 @@ namespace FLY.FilmCasting.AutoDie.UI.Client.UiModule ...@@ -224,7 +199,13 @@ namespace FLY.FilmCasting.AutoDie.UI.Client.UiModule
}; };
} }
private void ProfileParam_PropertyChanged(object sender, PropertyChangedEventArgs e)
{
if (e.PropertyName == nameof(profileParam.ScanRange))
{
UpdateX();
}
}
private void MHeatCell_PropertyChanged(object sender, PropertyChangedEventArgs e) private void MHeatCell_PropertyChanged(object sender, PropertyChangedEventArgs e)
{ {
if (e.PropertyName == nameof(mHeatCell.ThickPercents)) if (e.PropertyName == nameof(mHeatCell.ThickPercents))
...@@ -252,7 +233,7 @@ namespace FLY.FilmCasting.AutoDie.UI.Client.UiModule ...@@ -252,7 +233,7 @@ namespace FLY.FilmCasting.AutoDie.UI.Client.UiModule
{ {
if (e.PropertyName == nameof(mFeedback.ChannelCnt)) if (e.PropertyName == nameof(mFeedback.ChannelCnt))
{ {
UpdateAxisX(); UpdateX();
} }
if (e.PropertyName == nameof(mFeedback.Bads)) if (e.PropertyName == nameof(mFeedback.Bads))
{ {
...@@ -294,9 +275,21 @@ namespace FLY.FilmCasting.AutoDie.UI.Client.UiModule ...@@ -294,9 +275,21 @@ namespace FLY.FilmCasting.AutoDie.UI.Client.UiModule
NotifyPropertyChanged(nameof(MapperPreHeats)); NotifyPropertyChanged(nameof(MapperPreHeats));
} }
void UpdateAxisX() void UpdateX()
{ {
XMax = mFeedback.ChannelCnt + 1; if (profileParam.ScanRange.IsValid)
{
//数据的X轴,是螺丝号,从1开始
//profileParam.ScanRange 扫描范围 是序号,从0开始
//当显示全部螺丝时, 扫描范围 = 0~119 (120个螺丝)
//XMin = 0, XMax = 121
XMin = profileParam.ScanRange.Begin;
XMax = profileParam.ScanRange.End + 2;
}
else {
XMax = mFeedback.ChannelCnt + 1;
}
} }
public RelayCommand AddCmd { get; } public RelayCommand AddCmd { get; }
...@@ -379,6 +372,49 @@ namespace FLY.FilmCasting.AutoDie.UI.Client.UiModule ...@@ -379,6 +372,49 @@ namespace FLY.FilmCasting.AutoDie.UI.Client.UiModule
mHeatCell.ClearOffsets(); mHeatCell.ClearOffsets();
} }
private void Apply()
{
SelectBoltNo = -1;
SelectBoltNoWidth = 0;
mHeatCell.HeatApply();
}
private void Sub()
{
for (int i = 0; i < SelectBoltNoWidth; i++)
{
int index = SelectBoltNo - 1 + i;
if (index >= 0 && index < mFeedback.ChannelCnt)
{
mHeatCell.ModifyOffset(index, -mFeedback.Step);
}
}
}
private void Add()
{
for (int i = 0; i < SelectBoltNoWidth; i++)
{
int index = SelectBoltNo - 1 + i;
if (index >= 0 && index < mFeedback.ChannelCnt)
{
mHeatCell.ModifyOffset(index, mFeedback.Step);
}
}
}
/// <summary>
/// 设置选择范围。 在ScanMmGraph 中调用
/// </summary>
/// <param name="boltNoBegin"></param>
/// <param name="boltNoEnd"></param>
public void SetSelected(double boltNoBegin, double boltNoEnd)
{
SelectBoltNo = (int)Math.Min(boltNoBegin,boltNoEnd);
SelectBoltNoWidth = (int)Math.Abs(boltNoEnd - boltNoBegin) + 1;
}
protected void NotifyPropertyChanged(string propertyName) protected void NotifyPropertyChanged(string propertyName)
{ {
this.PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); this.PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
......
...@@ -9,10 +9,10 @@ using System.Windows.Media; ...@@ -9,10 +9,10 @@ using System.Windows.Media;
namespace FLY.FilmCasting.AutoDie.UI.Client.UiModule namespace FLY.FilmCasting.AutoDie.UI.Client.UiModule
{ {
public class AirRingGraphVmUt : AutoDieGraphVm public class AutoDieGraphVmUt : AutoDieGraphVm
{ {
public AirRingGraphVmUt() public AutoDieGraphVmUt()
{ {
......
...@@ -21,7 +21,7 @@ namespace FLY.Thick.FilmCasting.UI.UiModule ...@@ -21,7 +21,7 @@ namespace FLY.Thick.FilmCasting.UI.UiModule
public class GiantMixScanGraph2Vm : INotifyPropertyChanged public class GiantMixScanGraph2Vm : INotifyPropertyChanged
{ {
const int MARKNO_TEXTUP = 1; const int MARKNO_TEXTUP = 1;
/// <summary> /// <summary>
/// Y轴%显示,最小的中值 /// Y轴%显示,最小的中值
/// </summary> /// </summary>
...@@ -76,12 +76,12 @@ namespace FLY.Thick.FilmCasting.UI.UiModule ...@@ -76,12 +76,12 @@ namespace FLY.Thick.FilmCasting.UI.UiModule
/// 混合数,从服务器返回的 /// 混合数,从服务器返回的
/// </summary> /// </summary>
public int Mix { get; protected set; } = 100; public int Mix { get; protected set; } = 100;
/// <summary> /// <summary>
/// 曲线显示模式 /// 曲线显示模式
/// </summary> /// </summary>
public bool IsLineMode { get; protected set; } public bool IsLineMode { get; protected set; }
/// <summary> /// <summary>
/// 测量 开始时间 /// 测量 开始时间
/// </summary> /// </summary>
...@@ -191,13 +191,13 @@ namespace FLY.Thick.FilmCasting.UI.UiModule ...@@ -191,13 +191,13 @@ namespace FLY.Thick.FilmCasting.UI.UiModule
XFormatter = (x) => XFormatter = (x) =>
{ {
return $"{x + 1}"; return $"{x}";
}; };
Mapper = Mappers.Xy<double>() Mapper = Mappers.Xy<double>()
.X((value, index) => .X((value, index) =>
{ {
return index; return index + 1;
}) })
.Y(value => value) .Y(value => value)
.Fill((value) => .Fill((value) =>
...@@ -248,7 +248,7 @@ namespace FLY.Thick.FilmCasting.UI.UiModule ...@@ -248,7 +248,7 @@ namespace FLY.Thick.FilmCasting.UI.UiModule
Init2(); Init2();
} }
protected void ClearValues() protected void ClearValues()
{ {
Values.Clear(); Values.Clear();
UpperValues.Clear(); UpperValues.Clear();
...@@ -258,7 +258,7 @@ namespace FLY.Thick.FilmCasting.UI.UiModule ...@@ -258,7 +258,7 @@ namespace FLY.Thick.FilmCasting.UI.UiModule
{ {
// 绑定全局的 X轴 间隔 // 绑定全局的 X轴 间隔
paramDictionary.SetBinding(this, nameof(XStep), Base.UI.ParamDistItemKeys.XStep, XStep); paramDictionary.SetBinding(this, nameof(XStep), Base.UI.ParamDistItemKeys.XStep, XStep);
} }
...@@ -291,7 +291,9 @@ namespace FLY.Thick.FilmCasting.UI.UiModule ...@@ -291,7 +291,9 @@ namespace FLY.Thick.FilmCasting.UI.UiModule
{ {
UpdateY(); UpdateY();
} }
else if (e.PropertyName == nameof(profileParam.ScanRange)) {
UpdateX();
}
} }
private void BulkDb_PropertyChanged(object sender, PropertyChangedEventArgs e) private void BulkDb_PropertyChanged(object sender, PropertyChangedEventArgs e)
...@@ -311,9 +313,10 @@ namespace FLY.Thick.FilmCasting.UI.UiModule ...@@ -311,9 +313,10 @@ namespace FLY.Thick.FilmCasting.UI.UiModule
} }
} }
} }
void mixChanged() void mixChanged()
{ {
if (scanDatas.Count == graphparam.Mix) { if (scanDatas.Count == graphparam.Mix)
{
return; return;
} }
...@@ -323,7 +326,8 @@ namespace FLY.Thick.FilmCasting.UI.UiModule ...@@ -323,7 +326,8 @@ namespace FLY.Thick.FilmCasting.UI.UiModule
scanDatas.RemoveRange(0, scanDatas.Count - graphparam.Mix); scanDatas.RemoveRange(0, scanDatas.Count - graphparam.Mix);
scanDatasChanged(); scanDatasChanged();
} }
else { else
{
isDownloadPrev = true; isDownloadPrev = true;
//添加更多 //添加更多
Download(); Download();
...@@ -338,7 +342,7 @@ namespace FLY.Thick.FilmCasting.UI.UiModule ...@@ -338,7 +342,7 @@ namespace FLY.Thick.FilmCasting.UI.UiModule
clearScanDatas(); clearScanDatas();
} }
void clearScanDatas() void clearScanDatas()
{ {
//清空数据 //清空数据
scanDatas.Clear(); scanDatas.Clear();
...@@ -355,7 +359,7 @@ namespace FLY.Thick.FilmCasting.UI.UiModule ...@@ -355,7 +359,7 @@ namespace FLY.Thick.FilmCasting.UI.UiModule
//更新Target //更新Target
UpdateY(); UpdateY();
UpdateX(); //UpdateX();
} }
public void ClearFromTime() public void ClearFromTime()
...@@ -388,7 +392,7 @@ namespace FLY.Thick.FilmCasting.UI.UiModule ...@@ -388,7 +392,7 @@ namespace FLY.Thick.FilmCasting.UI.UiModule
{ {
UpdateY(); UpdateY();
} }
else if (e.PropertyName == nameof(graphparam.IsLineMode)) else if (e.PropertyName == nameof(graphparam.IsLineMode))
{ {
UpdateSeriesType(); UpdateSeriesType();
} }
...@@ -438,16 +442,16 @@ namespace FLY.Thick.FilmCasting.UI.UiModule ...@@ -438,16 +442,16 @@ namespace FLY.Thick.FilmCasting.UI.UiModule
else else
{ {
Series = new SeriesCollection Series = new SeriesCollection
{
new Column2Series
{ {
Values = Values, new Column2Series
Stroke = new SolidColorBrush(Colors.Black), {
StrokeThickness = 1, Values = Values,
PointGeometry = null, Stroke = new SolidColorBrush(Colors.Black),
Configuration = Mapper StrokeThickness = 1,
} PointGeometry = null,
}; Configuration = Mapper
}
};
((Series)Series[0]).SetBinding(Column2Series.YAxisCrossingProperty, new Binding(nameof(Target)) { Source = this }); ((Series)Series[0]).SetBinding(Column2Series.YAxisCrossingProperty, new Binding(nameof(Target)) { Source = this });
} }
...@@ -485,9 +489,14 @@ namespace FLY.Thick.FilmCasting.UI.UiModule ...@@ -485,9 +489,14 @@ namespace FLY.Thick.FilmCasting.UI.UiModule
protected void UpdateX() protected void UpdateX()
{ {
if (profileParam.ScanRange.IsValid) { if (profileParam.ScanRange.IsValid)
XMin = profileParam.ScanRange.Begin - 1; {
XMax = profileParam.ScanRange.End + 1; //数据的X轴,是螺丝号,从1开始
//profileParam.ScanRange 扫描范围 是序号,从0开始
//当显示全部螺丝时, 扫描范围 = 0~119 (120个螺丝)
//XMin = 0, XMax = 121
XMin = profileParam.ScanRange.Begin;
XMax = profileParam.ScanRange.End + 2;
} }
} }
...@@ -510,16 +519,16 @@ namespace FLY.Thick.FilmCasting.UI.UiModule ...@@ -510,16 +519,16 @@ namespace FLY.Thick.FilmCasting.UI.UiModule
}, this, MARKNO_TEXTUP); }, this, MARKNO_TEXTUP);
} }
void updateThicks() void updateThicks()
{ {
if (this.scanDatas.Count() != 0) if (this.scanDatas.Count() != 0)
{ {
int dataCnt = this.scanDatas.Last().Thicks.Count(); int dataCnt = this.scanDatas.Last().Thicks.Count();
double[] averages = new double[dataCnt]; double[] averages = new double[dataCnt];
double[] sigmas = new double[dataCnt]; double[] sigmas = new double[dataCnt];
for (int j = 0; j < dataCnt; j++) for (int j = 0; j < dataCnt; j++)
{ {
List<double> list = new List<double>(); List<double> list = new List<double>();
for (int i = 0; i < this.scanDatas.Count(); i++) for (int i = 0; i < this.scanDatas.Count(); i++)
...@@ -534,12 +543,13 @@ namespace FLY.Thick.FilmCasting.UI.UiModule ...@@ -534,12 +543,13 @@ namespace FLY.Thick.FilmCasting.UI.UiModule
averages[j] = list.AverageNoNull(); averages[j] = list.AverageNoNull();
sigmas[j] = list.Sigma(); sigmas[j] = list.Sigma();
} }
Averages = averages; Averages = averages;
Sigmas = sigmas; Sigmas = sigmas;
} }
else { else
{
Averages = null; Averages = null;
Sigmas = null; Sigmas = null;
} }
...@@ -569,12 +579,13 @@ namespace FLY.Thick.FilmCasting.UI.UiModule ...@@ -569,12 +579,13 @@ namespace FLY.Thick.FilmCasting.UI.UiModule
Position = scanData.FilmPosition; Position = scanData.FilmPosition;
Velocity = scanData.FilmVelocity; Velocity = scanData.FilmVelocity;
FilmWidth = scanData.FilmWidth; FilmWidth = scanData.FilmWidth;
List<double> list = new List<double>(); List<double> list = new List<double>();
double[] values = Averages; double[] values = Averages;
if (this.profileParam.DataRange.IsValid) { if (this.profileParam.DataRange.IsValid)
{
int beginIndex = this.profileParam.DataRange.Begin; int beginIndex = this.profileParam.DataRange.Begin;
int endIndex = this.profileParam.DataRange.End; int endIndex = this.profileParam.DataRange.End;
...@@ -631,7 +642,8 @@ namespace FLY.Thick.FilmCasting.UI.UiModule ...@@ -631,7 +642,8 @@ namespace FLY.Thick.FilmCasting.UI.UiModule
isDownloadNext = false; isDownloadNext = false;
isDownloadPrev = false; isDownloadPrev = false;
} }
else { else
{
//1. graphparam.Mix 变化了,需要下载 //1. graphparam.Mix 变化了,需要下载
//2. bulkDb.LastScanDataId 更新了,需要下载更多 //2. bulkDb.LastScanDataId 更新了,需要下载更多
...@@ -675,7 +687,8 @@ namespace FLY.Thick.FilmCasting.UI.UiModule ...@@ -675,7 +687,8 @@ namespace FLY.Thick.FilmCasting.UI.UiModule
isDownloading = true; isDownloading = true;
bulkDb.GetRecentFrames( bulkDb.GetRecentFrames(
new Pack_GetRecentFramesRequest() { new Pack_GetRecentFramesRequest()
{
Id = id, Id = id,
Count = count Count = count
}, },
...@@ -709,7 +722,7 @@ namespace FLY.Thick.FilmCasting.UI.UiModule ...@@ -709,7 +722,7 @@ namespace FLY.Thick.FilmCasting.UI.UiModule
}, this); }, this);
} }
void scanDatasChanged() void scanDatasChanged()
{ {
updateThicks(); updateThicks();
...@@ -725,13 +738,13 @@ namespace FLY.Thick.FilmCasting.UI.UiModule ...@@ -725,13 +738,13 @@ namespace FLY.Thick.FilmCasting.UI.UiModule
//更新Target //更新Target
UpdateY(); UpdateY();
UpdateX(); //UpdateX();
UpdateValues(); UpdateValues();
} }
protected void UpdateValues() protected void UpdateValues()
{ {
if (Averages != null) if (Averages != null)
{ {
......
...@@ -183,13 +183,13 @@ namespace FLY.Thick.FilmCasting.UI.UiModule ...@@ -183,13 +183,13 @@ namespace FLY.Thick.FilmCasting.UI.UiModule
XFormatter = (x) => XFormatter = (x) =>
{ {
return $"{x + 1}"; return $"{x}";
}; };
Mapper = Mappers.Xy<double>() Mapper = Mappers.Xy<double>()
.X((value, index) => .X((value, index) =>
{ {
return index; return index + 1;
}) })
.Y(value => value) .Y(value => value)
.Fill((value) => .Fill((value) =>
...@@ -373,7 +373,9 @@ namespace FLY.Thick.FilmCasting.UI.UiModule ...@@ -373,7 +373,9 @@ namespace FLY.Thick.FilmCasting.UI.UiModule
{ {
UpdateY(); UpdateY();
} }
else if (e.PropertyName == nameof(profileParam.ScanRange)) {
UpdateX();
}
} }
private void BulkDb_PropertyChanged(object sender, PropertyChangedEventArgs e) private void BulkDb_PropertyChanged(object sender, PropertyChangedEventArgs e)
...@@ -454,8 +456,12 @@ namespace FLY.Thick.FilmCasting.UI.UiModule ...@@ -454,8 +456,12 @@ namespace FLY.Thick.FilmCasting.UI.UiModule
protected void UpdateX() protected void UpdateX()
{ {
if (profileParam.ScanRange.IsValid) { if (profileParam.ScanRange.IsValid) {
XMin = profileParam.ScanRange.Begin - 1; //数据的X轴,是螺丝号,从1开始
XMax = profileParam.ScanRange.End + 1; //profileParam.ScanRange 扫描范围 是序号,从0开始
//当显示全部螺丝时, 扫描范围 = 0~119 (120个螺丝)
//XMin = 0, XMax = 121
XMin = profileParam.ScanRange.Begin;
XMax = profileParam.ScanRange.End + 2;
} }
} }
...@@ -593,7 +599,7 @@ namespace FLY.Thick.FilmCasting.UI.UiModule ...@@ -593,7 +599,7 @@ namespace FLY.Thick.FilmCasting.UI.UiModule
//更新Target //更新Target
UpdateY(); UpdateY();
UpdateX(); //UpdateX();
//必须先更新Y轴, X轴资料,最后再画线!!!!!!! //必须先更新Y轴, X轴资料,最后再画线!!!!!!!
//不然 YAxisCrossing 会有机会无效 //不然 YAxisCrossing 会有机会无效
......
...@@ -47,13 +47,13 @@ ...@@ -47,13 +47,13 @@
</lvc:Axis.Separator> </lvc:Axis.Separator>
<lvc:Axis.Sections> <lvc:Axis.Sections>
<lvc:AxisSection Style="{StaticResource AxisSectionStyle}" Stroke="Orange" <lvc:AxisSection Style="{StaticResource AxisSectionStyle}" Stroke="Orange"
Value="{Binding FilmBeginOfBoltIndex}" Value="{Binding FilmBeginOfBoltNo}"
/> />
<lvc:AxisSection Style="{StaticResource AxisSectionStyle}" Stroke="Orange" <lvc:AxisSection Style="{StaticResource AxisSectionStyle}" Stroke="Orange"
Value="{Binding FilmEndOfBoltIndex}" Value="{Binding FilmEndOfBoltNo}"
/> />
<lvc:AxisSection Style="{StaticResource Styles.Axis.Section.Selected}" <lvc:AxisSection Style="{StaticResource Styles.Axis.Section.Selected}"
Value="{Binding SelectedOfBoltIndex}" SectionWidth="{Binding SelectedWidthOfBoltIndex}" Value="{Binding SelectedOfBoltNo}" SectionWidth="{Binding SelectedWidthOfBoltIndex}"
/> />
</lvc:Axis.Sections> </lvc:Axis.Sections>
</lvc:Axis> </lvc:Axis>
......
...@@ -33,17 +33,18 @@ namespace FLY.Thick.FilmCasting.UI.UiModule ...@@ -33,17 +33,18 @@ namespace FLY.Thick.FilmCasting.UI.UiModule
/// 膜开始位置 单位:分区序号 /// 膜开始位置 单位:分区序号
/// </summary> /// </summary>
public double FilmBeginOfBoltIndex { get; set; } = NULL_VALUE; public double FilmBeginOfBoltIndex { get; set; } = NULL_VALUE;
public double FilmBeginOfBoltNo => FilmBeginOfBoltIndex + 1;
/// <summary> /// <summary>
/// 膜结束位置 单位:分区序号 /// 膜结束位置 单位:分区序号
/// </summary> /// </summary>
public double FilmEndOfBoltIndex { get; set; } = NULL_VALUE; public double FilmEndOfBoltIndex { get; set; } = NULL_VALUE;
public double FilmEndOfBoltNo => FilmEndOfBoltIndex + 1;
/// <summary> /// <summary>
/// 选择的位置 单位:分区序号 /// 选择的位置 单位:分区序号
/// </summary> /// </summary>
public double SelectedOfBoltIndex { get; set; } = NULL_VALUE; public double SelectedOfBoltIndex { get; set; } = NULL_VALUE;
public double SelectedOfBoltNo => SelectedOfBoltIndex + 1;
/// <summary> /// <summary>
/// 选择的位置宽度 单位:分区序号 /// 选择的位置宽度 单位:分区序号
/// </summary> /// </summary>
...@@ -66,18 +67,18 @@ namespace FLY.Thick.FilmCasting.UI.UiModule ...@@ -66,18 +67,18 @@ namespace FLY.Thick.FilmCasting.UI.UiModule
XFormatter = (x) => XFormatter = (x) =>
{ {
if(graphParamMm==null) if(graphParamMm==null)
return $"{x + 1}"; return $"{x}";
if (graphParamMm.IsXShowBoltNo) if (graphParamMm.IsXShowBoltNo)
return $"{x + 1}"; return $"{x}";
if (!IsMmValid) if (!IsMmValid)
{ {
//还没有膜 //还没有膜
return $"{x + 1}"; return $"{x}";
} }
int posMm = (int)BoltIndex2Mm(x); int posMm = (int)BoltIndex2Mm(x-1);
return $"{posMm}mm"; return $"{posMm}mm";
}; };
} }
...@@ -213,13 +214,19 @@ namespace FLY.Thick.FilmCasting.UI.UiModule ...@@ -213,13 +214,19 @@ namespace FLY.Thick.FilmCasting.UI.UiModule
} }
} }
public void SetSelected(double boltIndexBegin, double boltIndexEnd) /// <summary>
/// 设置选择范围。 在ScanMmGraph 中调用
/// </summary>
/// <param name="boltNoBegin"></param>
/// <param name="boltNoEnd"></param>
public void SetSelected(double boltNoBegin, double boltNoEnd)
{ {
//当没有数据时,不能选择 //当没有数据时,不能选择
if (!IsMmValid) if (!IsMmValid)
return; return;
double boltIndexBegin = boltNoBegin - 1;
double boltIndexEnd = boltNoEnd - 1;
if ((boltIndexBegin < FilmBeginOfBoltIndex && boltIndexEnd < FilmBeginOfBoltIndex) if ((boltIndexBegin < FilmBeginOfBoltIndex && boltIndexEnd < FilmBeginOfBoltIndex)
|| (boltIndexBegin > FilmEndOfBoltIndex && boltIndexEnd > FilmEndOfBoltIndex)) || (boltIndexBegin > FilmEndOfBoltIndex && boltIndexEnd > FilmEndOfBoltIndex))
{ {
......
...@@ -44,10 +44,10 @@ ...@@ -44,10 +44,10 @@
</lvc:Axis.Separator> </lvc:Axis.Separator>
<lvc:Axis.Sections> <lvc:Axis.Sections>
<lvc:AxisSection Style="{StaticResource AxisSectionStyle}" StrokeThickness="1" Stroke="{StaticResource Brushes.Activity}" <lvc:AxisSection Style="{StaticResource AxisSectionStyle}" StrokeThickness="1" Stroke="{StaticResource Brushes.Activity}"
Value="{Binding DataBegin}" Value="{Binding DataBeginOfBoltNo}"
/> />
<lvc:AxisSection Style="{StaticResource AxisSectionStyle}" StrokeThickness="1" Stroke="{StaticResource Brushes.Activity}" <lvc:AxisSection Style="{StaticResource AxisSectionStyle}" StrokeThickness="1" Stroke="{StaticResource Brushes.Activity}"
Value="{Binding DataEnd}" Value="{Binding DataEndOfBoltNo}"
/> />
</lvc:Axis.Sections> </lvc:Axis.Sections>
</lvc:Axis> </lvc:Axis>
......
...@@ -88,7 +88,9 @@ namespace FLY.Thick.FilmCasting.UI.UiModule ...@@ -88,7 +88,9 @@ namespace FLY.Thick.FilmCasting.UI.UiModule
public int BoltCnt { get; set; } = 100; public int BoltCnt { get; set; } = 100;
public int DataBegin { get; set; } = NULL_VALUE; public int DataBegin { get; set; } = NULL_VALUE;
public int DataBeginOfBoltNo => DataBegin + 1;
public int DataEnd { get; set; } = NULL_VALUE; public int DataEnd { get; set; } = NULL_VALUE;
public int DataEndOfBoltNo => DataEnd + 1;
#endregion #endregion
protected List<Brush> AreaColors; protected List<Brush> AreaColors;
...@@ -142,14 +144,15 @@ namespace FLY.Thick.FilmCasting.UI.UiModule ...@@ -142,14 +144,15 @@ namespace FLY.Thick.FilmCasting.UI.UiModule
XFormatter = (x) => XFormatter = (x) =>
{ {
//全部+1 //已经是分区号
return $"{x + 1}"; return $"{x}";
}; };
Mapper = Mappers.Xy<double>() Mapper = Mappers.Xy<double>()
.X((value, index) => .X((value, index) =>
{ {
return index; //变为分区号
return index+1;
}) })
.Y(value => value); .Y(value => value);
#endregion #endregion
...@@ -422,8 +425,12 @@ namespace FLY.Thick.FilmCasting.UI.UiModule ...@@ -422,8 +425,12 @@ namespace FLY.Thick.FilmCasting.UI.UiModule
{ {
if (profileParam.ScanRange.IsValid) if (profileParam.ScanRange.IsValid)
{ {
XMin = profileParam.ScanRange.Begin - 1; //数据的X轴,是螺丝号,从1开始
XMax = profileParam.ScanRange.End + 1; //profileParam.ScanRange 扫描范围 是序号,从0开始
//当显示全部螺丝时, 扫描范围 = 0~119 (120个螺丝)
//XMin = 0, XMax = 121
XMin = profileParam.ScanRange.Begin;
XMax = profileParam.ScanRange.End + 2;
} }
} }
......
Subproject commit 572c2c5edd7be3603d1aec068b2c04c37f064bb0 Subproject commit f445c84c07690898037a1034fd1f1320c7907920
...@@ -7,20 +7,20 @@ ...@@ -7,20 +7,20 @@
<assembly name="FLY.Thick.Base.UI" /> <assembly name="FLY.Thick.Base.UI" />
<namespace name="FLY.Thick.Base.UI" /> <namespace name="FLY.Thick.Base.UI" />
<container> <container>
<register type="WarningSystem2ServiceClientWithName" name="w00"> <register type="WarningSystem2ServiceClientWithName" name="自动模头">
<lifetime type="singleton" /> <lifetime type="singleton" />
<constructor> <constructor>
<param name="serviceId" value="20000" /> <param name="serviceId" value="20000" />
<param name="connName" value="thick" /> <param name="connName" value="autoDie" />
<param name="devName" value="测厚仪" /> <param name="devName" value="自动模头" />
</constructor> </constructor>
</register> </register>
<register type="WarningSystem2ServiceClientWithName" name="w01"> <register type="WarningSystem2ServiceClientWithName" name="测厚仪">
<lifetime type="singleton" /> <lifetime type="singleton" />
<constructor> <constructor>
<param name="serviceId" value="20000" /> <param name="serviceId" value="20000" />
<param name="connName" value="autoDie" /> <param name="connName" value="thick" />
<param name="devName" value="自动模头" /> <param name="devName" value="测厚仪" />
</constructor> </constructor>
</register> </register>
</container> </container>
......
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