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

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

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