Commit 732549ef authored by 潘栩锋's avatar 潘栩锋 🚴

1. 添加 自动风环历史数据读取功能

parent d4aab41a
......@@ -14,58 +14,32 @@ namespace FLY.FeedbackRenZiJia.UI.Client
const int MARKNO_UPDATED = 1;
const int MARKNO_SHOWD = 2;
#region 参数
private double factor = 3;
/// <summary>
/// 比例因子
/// </summary>
public double Factor
{
get { return factor; }
set
{
if (factor != value)
{
factor = value;
NotifyPropertyChanged("Factor");
}
}
}
public double Factor { get; set; } = 3;
private int orgboltno = 1;
/// <summary>
/// 复位区号
/// </summary>
public int OrgBoltNo
{
get { return orgboltno; }
set
{
if (orgboltno != value)
{
orgboltno = value;
NotifyPropertyChanged("OrgBoltNo");
}
}
}
public int OrgBoltNo { get; set; } = 1;
private double rangle = 350;
/// <summary>
/// 旋转角度
/// </summary>
public double RAngle
{
get { return rangle; }
set
{
if (rangle != value)
{
rangle = value;
NotifyPropertyChanged("RAngle");
}
}
}
public double RAngle { get; set; } = 350;
/// <summary>
/// 反向
/// </summary>
public bool IsReversed { get; set; } = false;
#endregion
#region 状态
......@@ -183,7 +157,8 @@ namespace FLY.FeedbackRenZiJia.UI.Client
private void HeatListHelper_PropertyChanged(object sender, PropertyChangedEventArgs e)
{
if ((e.PropertyName == "RAngle") ||
(e.PropertyName == "OrgBoltNo"))
(e.PropertyName == "OrgBoltNo") ||
(e.PropertyName == "IsReversed"))
{
FObjBase.PollModule.Current.Poll_JustOnce(
() =>
......@@ -202,6 +177,13 @@ namespace FLY.FeedbackRenZiJia.UI.Client
int orgboltno = Org_OrgBoltNo;
if (org_diff == null)
return;
//反向
if (IsReversed)
{
org_diff = FLY.FeedbackRenZiJia.Common.MyMath.ReverseX(org_diff, orgboltno - 1);
}
//放大
int[] diff = FLY.FeedbackRenZiJia.Common.MyMath.ZoomX(org_diff, orgboltno - 1, RAngle / rangle);
//平移
......
......@@ -155,7 +155,12 @@
<Style TargetType="TextBlock" BasedOn="{StaticResource TextBlockStyle_FieldContent}" x:Key="TextBlockStyle_FieldContent2">
<Setter Property="FontSize" Value="25" />
</Style>
<Style TargetType="TextBlock" BasedOn="{StaticResource TextBlockStyle_FieldHeaderEditable}" x:Key="TextBlockStyle_FieldHeaderEditable2">
<Setter Property="FontSize" Value="15" />
</Style>
<Style TargetType="TextBox" BasedOn="{StaticResource TextBoxStyle_FieldContent}" x:Key="TextBoxStyle_FieldContent2">
<Setter Property="FontSize" Value="25" />
</Style>
<local:Bookmark2StringValueConverter x:Key="bm2str_conv"/>
<x:Array x:Key="snaps" Type="local:SnapShot">
......@@ -416,17 +421,21 @@
<ScrollViewer>
<StackPanel Orientation="Vertical">
<StackPanel Orientation="Vertical" Margin="5" x:Name="stackpanel_heateffectcurve">
<TextBlock Style="{StaticResource ResourceKey=TextBlockStyle_FieldHeaderEditable}" Text="加热效果" />
<TextBlock Style="{StaticResource TextBlockStyle_FieldHeaderEditable2}" Text="加热效果" />
<StackPanel Orientation="Horizontal">
<TextBox Style="{StaticResource ResourceKey=TextBoxStyle_FieldContent}" Text="{Binding HeatEffectCurve,Converter={StaticResource heconv}}"/>
<TextBox Style="{StaticResource TextBoxStyle_FieldContent2}" Text="{Binding HeatEffectCurve,Converter={StaticResource heconv}}"/>
</StackPanel>
</StackPanel>
<StackPanel Orientation="Vertical" Margin="5" >
<TextBlock Style="{StaticResource TextBlockStyle_FieldHeaderEditable2}" Text="图反向" />
<ToggleButton Style="{StaticResource ToggleButtonStyle1}" HorizontalAlignment="Left" IsChecked="{Binding IsReversed}"/>
</StackPanel>
<StackPanel Orientation="Horizontal">
<StackPanel Orientation="Vertical" Margin="5">
<TextBlock Style="{StaticResource ResourceKey=TextBlockStyle_FieldHeaderEditable}" Text="比例因子" />
<TextBlock Style="{StaticResource TextBlockStyle_FieldHeaderEditable2}" Text="比例因子" />
<StackPanel Orientation="Horizontal">
<TextBox Style="{StaticResource ResourceKey=TextBoxStyle_FieldContent}" Text="{Binding Factor, StringFormat={}{0:F1}}"/>
<TextBlock Style="{StaticResource ResourceKey=TextBlockStyle_FieldContent_mm}" Text="输出/厚度" FontSize="15" />
<TextBox Style="{StaticResource TextBoxStyle_FieldContent2}" Text="{Binding Factor, StringFormat={}{0:F1}}"/>
<TextBlock Style="{StaticResource TextBlockStyle_FieldContent_mm}" Text="输出/厚度" FontSize="15" />
</StackPanel>
</StackPanel>
<Button Click="button_factor_collapse_Click" >
......@@ -447,10 +456,10 @@
<StackPanel Orientation="Horizontal">
<StackPanel Orientation="Vertical" Margin="5">
<TextBlock Style="{StaticResource ResourceKey=TextBlockStyle_FieldHeaderEditable}" Text="复位区号" />
<TextBlock Style="{StaticResource TextBlockStyle_FieldHeaderEditable2}" Text="复位区号" />
<StackPanel Orientation="Horizontal">
<TextBox Style="{StaticResource ResourceKey=TextBoxStyle_FieldContent}" Text="{Binding OrgBoltNo}" />
<TextBox Style="{StaticResource TextBoxStyle_FieldContent2}" Text="{Binding OrgBoltNo}" />
</StackPanel>
</StackPanel>
<Button Click="button_left_Click" >
......@@ -462,11 +471,11 @@
</StackPanel>
<StackPanel Orientation="Horizontal">
<StackPanel Orientation="Vertical" Margin="5">
<TextBlock Style="{StaticResource ResourceKey=TextBlockStyle_FieldHeaderEditable}" Text="旋转角度" />
<TextBlock Style="{StaticResource TextBlockStyle_FieldHeaderEditable2}" Text="旋转角度" />
<StackPanel Orientation="Horizontal">
<TextBox Style="{StaticResource ResourceKey=TextBoxStyle_FieldContent}" Text="{Binding RAngle}" />
<TextBlock Style="{StaticResource ResourceKey=TextBlockStyle_FieldContent_mm}" Text="°" VerticalAlignment="Top" />
<TextBox Style="{StaticResource TextBoxStyle_FieldContent2}" Text="{Binding RAngle}" />
<TextBlock Style="{StaticResource TextBlockStyle_FieldContent_mm}" Text="°" VerticalAlignment="Top" />
</StackPanel>
</StackPanel>
<Button Click="button_collapse_Click" >
......@@ -505,7 +514,7 @@
<StackPanel Orientation="Vertical">
<StackPanel Orientation="Horizontal">
<StackPanel Orientation="Vertical" Margin="5" x:Name="stackpanel_isUsedBoltMap">
<TextBlock Style="{StaticResource ResourceKey=TextBlockStyle_FieldHeaderEditable}" Text="使用分区表" />
<TextBlock Style="{StaticResource TextBlockStyle_FieldHeaderEditable2}" Text="使用分区表" />
<ToggleButton Style="{StaticResource ToggleButtonStyle1}" HorizontalAlignment="Left" IsChecked="{Binding IsUsedMap}"/>
</StackPanel>
<Button Margin="10" Click="button_testmap_Click" >
......
......@@ -1031,6 +1031,11 @@ namespace FLY.FeedbackRenZiJia.UI.Client
}
private void button_applymap_Click(object sender, RoutedEventArgs e)
{
if (mHelper.IsReversed)
{
FLY.ControlLibrary.Window_WarningTip.Show("应用失败", "当前图是反向,需要先去调换旋转架的正反向信号线", TimeSpan.FromSeconds(2));
return;
}
if (Window_Password.Authorize(1))
{
mBlowing.IsUsedMap = IsUsedMap;
......
......@@ -6,5 +6,6 @@
<Grid>
<Button Content="立刻输出保存数据" Height="23" HorizontalAlignment="Left" Margin="80,110,0,0" Name="button1" VerticalAlignment="Top" Width="118" Click="button1_Click" />
<TextBlock Height="23" HorizontalAlignment="Left" Margin="80,81,0,0" Name="textBlock1" Text="{Binding CurrRows}" VerticalAlignment="Top" />
<Button Content="加载数据" Height="23" HorizontalAlignment="Left" Margin="80,35,0,0" x:Name="button2" VerticalAlignment="Top" Width="118" Click="button2_Click" />
</Grid>
</Window>
......@@ -45,5 +45,16 @@ namespace FLY.FeedbackRenZiJia.UI.Server
{
mGage.mfeedback.mHeatBuf.mHistory.Flush();
}
private void button2_Click(object sender, RoutedEventArgs e)
{
Microsoft.Win32.OpenFileDialog fileDialog = new Microsoft.Win32.OpenFileDialog();
var ret = fileDialog.ShowDialog();
if (ret == true)
{
string path = fileDialog.FileName;
mGage.mfeedback.mHeatBuf.LoadData(path);
}
}
}
}
......@@ -352,6 +352,27 @@ namespace FLY.FeedbackRenZiJia.Common
return 0;
}
/// <summary>
/// X轴反向
/// </summary>
/// <param name="data"></param>
/// <param name="mid">中心位置</param>
/// <returns></returns>
public static int[] ReverseX(int[] data, int mid)
{
//放大
int[] _diff = new int[data.Count()];
for (int i = 0; i < data.Count(); i++)
{
int idx = mid * 2 - i;
if (idx >= data.Count())
idx -= data.Count();
else if(idx<0)
idx+= data.Count();
_diff[i] = data[idx];
}
return _diff;
}
/// <summary>
/// X轴放大
/// </summary>
......
......@@ -494,12 +494,15 @@ namespace FLY.FeedbackRenZiJia.Server
}
}
}
void LoadData()
public void LoadData(string path)
{
if (string.IsNullOrEmpty(path))
path = data_path;
mData.Clear();
try
{
using (StreamReader sr = new StreamReader(data_path, Encoding.GetEncoding("GB2312")))
using (StreamReader sr = new StreamReader(path, Encoding.GetEncoding("GB2312")))
{
//第1行是标题
string header = sr.ReadLine();
......
......@@ -29,8 +29,6 @@ namespace FLY.FeedbackRenZiJia.Server
//M3 0x4 风环开关
//M4 0x5 检测电流
public FLY.Modbus.WithThread.ClientTCP mclient;
/// <summary>
/// 更新周期,单位ms,
......
......@@ -24,10 +24,10 @@ namespace WpfApplication1
{
InitializeComponent();
//FLY.FeedbackRenZiJia.UI.Client.UIModule.Page_DynArea dynArea = new FLY.FeedbackRenZiJia.UI.Client.UIModule.Page_DynArea();
FLY.FeedbackRenZiJia.UI.Client.UIModule.Page_DynArea dynArea = new FLY.FeedbackRenZiJia.UI.Client.UIModule.Page_DynArea();
//FLY.IBC.UI.Client.UIModule.Page_DynArea dynArea = new FLY.IBC.UI.Client.UIModule.Page_DynArea();
//FLY.Winder.UI.Client.UIModule.Page_DynArea dynArea = new FLY.Winder.UI.Client.UIModule.Page_DynArea();
FLY.Weight.UI.Client.UIModule.Page_DynArea dynArea = new FLY.Weight.UI.Client.UIModule.Page_DynArea();
//FLY.Weight.UI.Client.UIModule.Page_DynArea dynArea = new FLY.Weight.UI.Client.UIModule.Page_DynArea();
dynArea.Init(0);
Frame f = new Frame();
......@@ -35,15 +35,19 @@ namespace WpfApplication1
stackpanel_dynarea.Children.Add(f);
//FLY.Winder.UI.Client.UIModule.MenuSelect menu = new FLY.Winder.UI.Client.UIModule.MenuSelect();
FLY.Weight.UI.Client.UIModule.MenuSelect menu = new FLY.Weight.UI.Client.UIModule.MenuSelect();
//FLY.Weight.UI.Client.UIModule.MenuSelect menu = new FLY.Weight.UI.Client.UIModule.MenuSelect();
FLY.FeedbackRenZiJia.UI.Client.UIModule.MenuSelect_Main menu = new FLY.FeedbackRenZiJia.UI.Client.UIModule.MenuSelect_Main();
menu.Init(0);
stackpanel_toolbox.Children.Add(menu);
FLY.FeedbackRenZiJia.UI.Client.UIModule.Page_Graph p = new FLY.FeedbackRenZiJia.UI.Client.UIModule.Page_Graph();
//FLY.IBC.UI.Client.UIModule.Page_Main p = new FLY.IBC.UI.Client.UIModule.Page_Main();
//FLY.Winder.UI.Client.UIModule.Page_Main p = new FLY.Winder.UI.Client.UIModule.Page_Main();
FLY.Weight.UI.Client.UIModule.Page_Main p = new FLY.Weight.UI.Client.UIModule.Page_Main();
//FLY.Weight.UI.Client.UIModule.Page_Main p = new FLY.Weight.UI.Client.UIModule.Page_Main();
//FLY.Weight.UI.Client.UIModule.FlowGraph p = new FLY.Weight.UI.Client.UIModule.FlowGraph();
p.Init(0);
......
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