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

1.修复 追边测厚仪服务器删除图片历史会出错

2.修复 追边测厚仪服务器保存图片很慢
parent b6a9baa5
...@@ -68,6 +68,10 @@ namespace FLY.Thick.Blowing.UI.Fix.Server ...@@ -68,6 +68,10 @@ namespace FLY.Thick.Blowing.UI.Fix.Server
/// </summary> /// </summary>
public bool IsPercent { get; set; } = true; public bool IsPercent { get; set; } = true;
/// <summary>
/// 自动目标值
/// </summary>
public bool IsAutoTarget { get; set; }
#endregion #endregion
#region 状态 #region 状态
/// <summary> /// <summary>
...@@ -162,10 +166,14 @@ namespace FLY.Thick.Blowing.UI.Fix.Server ...@@ -162,10 +166,14 @@ namespace FLY.Thick.Blowing.UI.Fix.Server
Id = 0, Id = 0,
Mix = 1 Mix = 1
}, },
async (object asyncContext, object retData) => (object asyncContext, object retData) =>
{ {
Pack_GetFrameReponse reponse = retData as Pack_GetFrameReponse; //创建新线程跑下面的
await Add(reponse); Task.Factory.StartNew((obj) =>
{
Pack_GetFrameReponse reponse = obj as Pack_GetFrameReponse;
Add(reponse);
},retData);
}, this); }, this);
} }
...@@ -230,7 +238,7 @@ namespace FLY.Thick.Blowing.UI.Fix.Server ...@@ -230,7 +238,7 @@ namespace FLY.Thick.Blowing.UI.Fix.Server
ChartToImage.SaveToJpeg(scanGraph, path); ChartToImage.SaveToJpeg(scanGraph, path);
} }
public async Task Add(Pack_GetFrameReponse reponse) public void Add(Pack_GetFrameReponse reponse)
{ {
if (reponse.scanData == null) if (reponse.scanData == null)
return;//没有数据 return;//没有数据
...@@ -245,16 +253,13 @@ namespace FLY.Thick.Blowing.UI.Fix.Server ...@@ -245,16 +253,13 @@ namespace FLY.Thick.Blowing.UI.Fix.Server
//ALL //ALL
string path = CreateCurrPath(reponse.scanData.EndTime, false); string path = CreateCurrPath(reponse.scanData.EndTime, false);
timer.Dispatcher.Invoke(() =>
App.Current.MainWindow.Dispatcher.Invoke(() =>
{ {
scanGraphVm.UpdateValue(reponse, isWarning); scanGraphVm.UpdateValue(reponse, isWarning);
SavePic(path); SavePic(path);
}); });
await Task.Factory.StartNew(() =>
{
try try
{ {
if (isWarning) if (isWarning)
...@@ -269,7 +274,6 @@ namespace FLY.Thick.Blowing.UI.Fix.Server ...@@ -269,7 +274,6 @@ namespace FLY.Thick.Blowing.UI.Fix.Server
{ {
return; return;
} }
});
} }
...@@ -338,13 +342,48 @@ namespace FLY.Thick.Blowing.UI.Fix.Server ...@@ -338,13 +342,48 @@ namespace FLY.Thick.Blowing.UI.Fix.Server
private void Keep() private void Keep()
{ {
while (dateInRootPath.Count > KeepDay) while (dateInRootPath.Count > KeepDay)
{
try
{ {
string dirpath = RootPath + @"\all\" + dateInRootPath.First().ToString(@"yyyy\\MM\\dd"); string dirpath = RootPath + @"\all\" + dateInRootPath.First().ToString(@"yyyy\\MM\\dd");
if (Directory.Exists(dirpath))
{
Directory.Delete(dirpath, true); Directory.Delete(dirpath, true);
dirpath = RootPath + @"\iswarning\" + dateInRootPath.First().ToString(@"yyyy\\MM\\dd"); //检测上级文件夹,里面是空的,那就继续删除
dirpath = RootPath + @"\all\" + dateInRootPath.First().ToString(@"yyyy\\MM");
Directory.Delete(dirpath);
dirpath = RootPath + @"\all\" + dateInRootPath.First().ToString(@"yyyy");
Directory.Delete(dirpath);
}
}
catch
{
//删除不了。不管了。。。。
}
try
{
string dirpath = RootPath + @"\iswarning\" + dateInRootPath.First().ToString(@"yyyy\\MM\\dd");
if (Directory.Exists(dirpath))
{
Directory.Delete(dirpath, true); Directory.Delete(dirpath, true);
//检测上级文件夹,里面是空的,那就继续删除
dirpath = RootPath + @"\iswarning\" + dateInRootPath.First().ToString(@"yyyy\\MM");
Directory.Delete(dirpath);
dirpath = RootPath + @"\iswarning\" + dateInRootPath.First().ToString(@"yyyy");
Directory.Delete(dirpath);
}
}
catch
{
//删除不了。不管了。。。。
}
dateInRootPath.RemoveAt(0); dateInRootPath.RemoveAt(0);
} }
CurrDays = dateInRootPath.Count; CurrDays = dateInRootPath.Count;
...@@ -456,5 +495,10 @@ namespace FLY.Thick.Blowing.UI.Fix.Server ...@@ -456,5 +495,10 @@ namespace FLY.Thick.Blowing.UI.Fix.Server
/// Y轴%显示 /// Y轴%显示
/// </summary> /// </summary>
public bool IsPercent { get; set; } = true; public bool IsPercent { get; set; } = true;
/// <summary>
/// 自动目标值
/// </summary>
public bool IsAutoTarget { get; set; }
} }
} }
...@@ -256,6 +256,11 @@ namespace FLY.Thick.Blowing.UI.Fix.Server ...@@ -256,6 +256,11 @@ namespace FLY.Thick.Blowing.UI.Fix.Server
{ {
double target = this.profileParam.Target; double target = this.profileParam.Target;
if (picHistory.IsAutoTarget)
{
if (!double.IsNaN(Average))
target = Average;
}
double tolerance = this.profileParam.TolerancePercent * target; double tolerance = this.profileParam.TolerancePercent * target;
Target = target; Target = target;
......
...@@ -91,6 +91,10 @@ ...@@ -91,6 +91,10 @@
<TextBlock Style="{StaticResource Styles.Text.FieldHeader}" Text="Y轴%显示"/> <TextBlock Style="{StaticResource Styles.Text.FieldHeader}" Text="Y轴%显示"/>
<CheckBox IsChecked="{Binding IsPercent}"/> <CheckBox IsChecked="{Binding IsPercent}"/>
</StackPanel> </StackPanel>
<StackPanel Margin="{StaticResource ControlMargin}">
<TextBlock Style="{StaticResource Styles.Text.FieldHeader}" Text="Y轴自动目标值"/>
<CheckBox IsChecked="{Binding IsAutoTarget}"/>
</StackPanel>
</StackPanel> </StackPanel>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right" > <StackPanel Orientation="Horizontal" HorizontalAlignment="Right" >
<Button Style="{StaticResource Styles.Button.Square.Accent2}" Content="图片保存" Click="btnSavePicClick" Width="auto"/> <Button Style="{StaticResource Styles.Button.Square.Accent2}" Content="图片保存" Click="btnSavePicClick" Width="auto"/>
......
...@@ -100,6 +100,11 @@ namespace FLY.Thick.Blowing.UI.Fix.Server ...@@ -100,6 +100,11 @@ namespace FLY.Thick.Blowing.UI.Fix.Server
/// </summary> /// </summary>
public bool IsPercent { get; set; } = true; public bool IsPercent { get; set; } = true;
/// <summary>
/// Y轴自动目标值
/// </summary>
public bool IsAutoTarget { get; set; }
public RelayCommand OkCmd { get; private set; } public RelayCommand OkCmd { get; private set; }
private PicHistory picHistory; private PicHistory picHistory;
public PicHistory PicHistory => picHistory; public PicHistory PicHistory => picHistory;
...@@ -121,6 +126,7 @@ namespace FLY.Thick.Blowing.UI.Fix.Server ...@@ -121,6 +126,7 @@ namespace FLY.Thick.Blowing.UI.Fix.Server
YRangePercent = picHistory.YRangePercent; YRangePercent = picHistory.YRangePercent;
IntervalMin = picHistory.IntervalMin; IntervalMin = picHistory.IntervalMin;
IsPercent = picHistory.IsPercent; IsPercent = picHistory.IsPercent;
IsAutoTarget = picHistory.IsAutoTarget;
this.picHistory = picHistory; this.picHistory = picHistory;
} }
...@@ -184,7 +190,7 @@ namespace FLY.Thick.Blowing.UI.Fix.Server ...@@ -184,7 +190,7 @@ namespace FLY.Thick.Blowing.UI.Fix.Server
picHistory.YRangePercent = YRangePercent; picHistory.YRangePercent = YRangePercent;
picHistory.IntervalMin = IntervalMin; picHistory.IntervalMin = IntervalMin;
picHistory.IsPercent = IsPercent; picHistory.IsPercent = IsPercent;
picHistory.IsAutoTarget = IsAutoTarget;
picHistory.Save(); picHistory.Save();
MessageBox.Show($"设置完成"); MessageBox.Show($"设置完成");
......
...@@ -51,6 +51,6 @@ using System.Windows; ...@@ -51,6 +51,6 @@ using System.Windows;
// 可以指定所有这些值,也可以使用“内部版本号”和“修订号”的默认值, // 可以指定所有这些值,也可以使用“内部版本号”和“修订号”的默认值,
// 方法是按如下所示使用“*”: // 方法是按如下所示使用“*”:
// [assembly: AssemblyVersion("1.0.*")] // [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("6.34.2")] [assembly: AssemblyVersion("6.34.3")]
[assembly: AssemblyFileVersion("6.34.2")] [assembly: AssemblyFileVersion("6.34.3")]
[assembly: Guid("72FBA808-FA10-43BF-8504-C6E814E031E7")] [assembly: Guid("72FBA808-FA10-43BF-8504-C6E814E031E7")]
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