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

1.修改 自动风环加热撤销使用数据库数据

2.修复 自动风环按测试时, 手动按钮没有隐藏
3.添加 自动风环对位添加查找上一个加热不动的数据
parent 391b4130
......@@ -122,10 +122,6 @@
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Themes\ABCTab.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="WdLoadHeatsFile.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
......
......@@ -47,7 +47,8 @@ namespace FLY.FeedbackRenZiJia.UI.Client
/// </summary>
public double Kp { get; set; } = 3;
public bool IsMoveByTakeEffect { get; set; } = true;
public bool IsMoveByDiffCTime { get; set; } = true;
/// <summary>
/// 复位区号
......@@ -233,6 +234,8 @@ namespace FLY.FeedbackRenZiJia.UI.Client
ucThickHeatVms[i] = new UcThickHeatVm();
ucThickHeatVms[i].Init($"记录{i+1}", bulkDbService, 0-i, Kp);
Misc.BindingOperations.SetBinding(this, nameof(Kp), ucThickHeatVms[i], nameof(UcThickHeatVm.Kp));
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;
}
......
......@@ -21,7 +21,7 @@
</ResourceDictionary>
</UserControl.Resources>
<Grid d:DataContext="{StaticResource viewModel}">
<Border Style="{StaticResource Card.Border}" >
<Border Style="{StaticResource Styles.Card.Border}" >
<StackPanel>
<Grid>
<Grid.RowDefinitions>
......@@ -77,20 +77,20 @@
</lvc:CartesianChart>
<StackPanel Orientation="Horizontal" Margin="48,0,0,-20" Opacity="0.8">
<Button Style="{StaticResource ButtonStyle_RectangleIcon}" Command="{Binding PreStableCmd}" >
<Button Style="{StaticResource Styles.Button.Icon.Rectangle}" Command="{Binding PreStableCmd}" >
<iconPacks:PackIconMaterial Kind="ChevronDoubleLeft" />
</Button>
<Button Style="{StaticResource ButtonStyle_RectangleIcon}" Command="{Binding PreCmd}" >
<Button Style="{StaticResource Styles.Button.Icon.Rectangle}" Command="{Binding PreCmd}" >
<iconPacks:PackIconMaterial Kind="ChevronLeft" Width="10"/>
</Button>
<Button Style="{StaticResource ButtonStyle_RectangleIcon}" Command="{Binding NextCmd}">
<Button Style="{StaticResource Styles.Button.Icon.Rectangle}" Command="{Binding NextCmd}">
<!--<iconPacks:PackIconMaterial Kind="ArrowRight" />-->
<iconPacks:PackIconMaterial Kind="ChevronRight" Width="10"/>
</Button>
<Button Style="{StaticResource ButtonStyle_RectangleIcon}" Command="{Binding NextStableCmd}" >
<Button Style="{StaticResource Styles.Button.Icon.Rectangle}" Command="{Binding NextStableCmd}" >
<iconPacks:PackIconMaterial Kind="ChevronDoubleRight" />
</Button>
<Button Style="{StaticResource ButtonStyle_RectangleIcon}" Command="{Binding NewestCmd}" Background="{StaticResource Badges.BlackBackground}">
<Button Style="{StaticResource Styles.Button.Icon.Rectangle}" Command="{Binding NewestCmd}" Background="{StaticResource Brushes.NoAct}">
<iconPacks:PackIconMaterial Kind="ArrowCollapseRight" />
</Button>
</StackPanel>
......@@ -169,7 +169,7 @@
</StackPanel>
</StackPanel>
<TextBlock Style="{StaticResource Card.Title}" Text="{Binding Title}"/>
<TextBlock Style="{StaticResource Styles.Card.Title}" Text="{Binding Title}"/>
</StackPanel>
<Grid
Margin="10,0"
......
......@@ -53,9 +53,17 @@ namespace FLY.FeedbackRenZiJia.UI.Client
public long LastId { get; set; }
public long Number { get; set; }
public long Number { get; set; }
/// <summary>
/// 急速移动,功能: 移动到下一个数据有效
/// </summary>
public bool IsMoveByTakeEffect { get; set; } = true;
/// <summary>
/// 急速移动,功能: 移动到下一个加热不同
/// </summary>
public bool IsMoveByDiffCTime { get; set; }
/// <summary>
/// 有效
/// </summary>
......@@ -122,7 +130,8 @@ namespace FLY.FeedbackRenZiJia.UI.Client
public Lc_ThickHeat frame;
IBulkDbService bulkDbService;
bool IsSkipNumberChanged;
public event Action FrameUpdated;
public UcThickHeatVm()
{
YFormatter = (y) =>
......@@ -185,106 +194,55 @@ namespace FLY.FeedbackRenZiJia.UI.Client
UpdateFrame();
}
}
public event Action FrameUpdated;
public void UpdateFrame() {
PollModule.Current.Poll_JustOnce(() => {
_updateFrame();
bulkDbService.GetFrame(Number, my_GetFrameReponse, null);
}, this, MARKNO_UPDATEFRAME);
}
void _updateFrame()
void my_GetFrameReponse(object asyncContext, object retData)
{
if (IsGetStableFrame)
{
IsGetStableFrame = false;
bulkDbService.GetStableFrame(Number, IsPre,(asyncContext, retData) =>
{
var reponce = retData as GetStableFrameReponse;
if (reponce.thickHeat != null)
{
frame = reponce.thickHeat;
Id = frame.ID;
Time = frame.Time;
EndTime = frame.EndTime;
IsBackw = frame.IsBackw;
RPeriod = frame.RPeriod;
OrgBoltNo = frame.OrgBoltNo;
RAngle = frame.RAngle;
FilmLength = frame.FilmLength;
Average = frame.Thicks.AverageNoNull();
Sigma2Percent = frame.Thicks.Sigma() / Average * 2;
Heats.Clear();
Heats.AddRange(frame.Heats);
XMax = frame.Heats.Count() + 1;
double[] thickPercents = GetThickPercents();
ThickPercents.Clear();
ThickPercents.AddRange(thickPercents);
IsStable = frame.IsStable;
HTime = frame.HTime;
IsVaild = true;
IsSkipNumberChanged = true;
Number = Id;
IsSkipNumberChanged = false;
}
else
{
IsVaild = false;
}
FrameUpdated?.Invoke();
}, null);
}
var reponse = retData as GetFrameReponse;
if (reponse.thickHeat != null)
SetFrame(reponse.thickHeat);
else
{
bulkDbService.GetFrame(Number, (asyncContext, retData) =>
{
var reponce = retData as GetFrameReponse;
if (reponce.thickHeat != null)
{
frame = reponce.thickHeat;
Id = frame.ID;
Time = frame.Time;
EndTime = frame.EndTime;
IsBackw = frame.IsBackw;
RPeriod = frame.RPeriod;
OrgBoltNo = frame.OrgBoltNo;
RAngle = frame.RAngle;
FilmLength = frame.FilmLength;
Average = frame.Thicks.AverageNoNull();
Sigma2Percent = frame.Thicks.Sigma() / Average * 2;
Heats.Clear();
Heats.AddRange(frame.Heats);
XMax = frame.Heats.Count() + 1;
double[] thickPercents = GetThickPercents();
ThickPercents.Clear();
ThickPercents.AddRange(thickPercents);
IsStable = frame.IsStable;
HTime = frame.HTime;
IsVaild = true;
}
else
{
IsVaild = false;
}
FrameUpdated?.Invoke();
}, null);
}
IsVaild = false;
FrameUpdated?.Invoke();
}
void SetFrame(Lc_ThickHeat frame)
{
Id = frame.ID;
Time = frame.Time;
EndTime = frame.EndTime;
IsBackw = frame.IsBackw;
RPeriod = frame.RPeriod;
OrgBoltNo = frame.OrgBoltNo;
RAngle = frame.RAngle;
FilmLength = frame.FilmLength;
Average = frame.Thicks.AverageNoNull();
Sigma2Percent = frame.Thicks.Sigma() / Average * 2;
Heats.Clear();
Heats.AddRange(frame.Heats);
XMax = frame.Heats.Count() + 1;
double[] thickPercents = GetThickPercents();
ThickPercents.Clear();
ThickPercents.AddRange(thickPercents);
IsStable = frame.IsStable;
HTime = frame.HTime;
IsVaild = true;
IsSkipNumberChanged = true;
Number = Id;
IsSkipNumberChanged = false;
}
private void Next()
{
if(Number < bulkDbService.LastId)
......@@ -294,14 +252,14 @@ namespace FLY.FeedbackRenZiJia.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()
{
......@@ -309,9 +267,10 @@ namespace FLY.FeedbackRenZiJia.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);
}
/// <summary>
/// 以指定复位区号, 分区表 导出厚度%
......
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="pack://application:,,,/FLY.ControlLibrary;component/Themes/Dictionary_MyStyle.xaml"/>
</ResourceDictionary.MergedDictionaries>
<Style x:Key="TabItemStyle_ABC" TargetType="{x:Type TabItem}">
<Setter Property="Foreground" Value="Black"/>
<Setter Property="Margin" Value="0"/>
<Setter Property="Padding" Value="6,2,6,2"/>
<Setter Property="HorizontalContentAlignment" Value="Stretch"/>
<Setter Property="VerticalContentAlignment" Value="Stretch"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type TabItem}" >
<Grid x:Name="templateRoot" SnapsToDevicePixels="true" >
<Border x:Name="mainBorder" MinWidth="113" Height="96" Background="{Binding Color}" Margin="0" />
<TextBlock Text="{Binding Number}" FontSize="100" FontWeight="Bold" Margin="-15,0,0,-30" VerticalAlignment="Bottom" HorizontalAlignment="Left"/>
</Grid>
<ControlTemplate.Triggers>
<MultiDataTrigger>
<MultiDataTrigger.Conditions>
<Condition Binding="{Binding IsSelected, RelativeSource={RelativeSource Self}}" Value="true"/>
</MultiDataTrigger.Conditions>
<Setter Property="Panel.ZIndex" Value="2"/>
<Setter Property="Margin" Value="-2,-2,-2,-2"/>
<Setter Property="Margin" TargetName="mainBorder" Value="-1"/>
</MultiDataTrigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style x:Key="TabControlStyle_ABC" TargetType="{x:Type TabControl}">
<Setter Property="Padding" Value="2"/>
<Setter Property="HorizontalContentAlignment" Value="Center"/>
<Setter Property="VerticalContentAlignment" Value="Center"/>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="Foreground" Value="{StaticResource {x:Static SystemColors.ControlTextBrushKey}}"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type TabControl}">
<Grid x:Name="templateRoot" ClipToBounds="true" SnapsToDevicePixels="true" KeyboardNavigation.TabNavigation="Local">
<Grid.ColumnDefinitions>
<ColumnDefinition x:Name="ColumnDefinition0"/>
<ColumnDefinition x:Name="ColumnDefinition1" Width="0"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition x:Name="RowDefinition0" Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition x:Name="RowDefinition1" Height="*"/>
</Grid.RowDefinitions>
<TabPanel x:Name="headerPanel" Background="Transparent" Grid.Column="0" IsItemsHost="true" Margin="2,2,2,0" Grid.Row="0" KeyboardNavigation.TabIndex="1" Panel.ZIndex="1"/>
<Grid Panel.ZIndex="1" Grid.Row="1" >
<Border Background="{Binding Path='SelectedItem.Color',RelativeSource={RelativeSource Mode=TemplatedParent}}" Height="10" />
<Border Background="Black" Height="2" VerticalAlignment="Bottom" />
</Grid>
<Border x:Name="contentPanel" Background="{TemplateBinding Background}" Grid.Column="0" KeyboardNavigation.DirectionalNavigation="Contained" Grid.Row="2" KeyboardNavigation.TabIndex="2" KeyboardNavigation.TabNavigation="Local">
<ContentPresenter x:Name="PART_SelectedContentHost" ContentSource="SelectedContent" Margin="{TemplateBinding Padding}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
</Border>
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="TabStripPlacement" Value="Bottom">
<Setter Property="Grid.Row" TargetName="headerPanel" Value="1"/>
<Setter Property="Grid.Row" TargetName="contentPanel" Value="0"/>
<Setter Property="Height" TargetName="RowDefinition0" Value="*"/>
<Setter Property="Height" TargetName="RowDefinition1" Value="Auto"/>
<Setter Property="Margin" TargetName="headerPanel" Value="2,0,2,2"/>
</Trigger>
<Trigger Property="TabStripPlacement" Value="Left">
<Setter Property="Grid.Row" TargetName="headerPanel" Value="0"/>
<Setter Property="Grid.Row" TargetName="contentPanel" Value="0"/>
<Setter Property="Grid.Column" TargetName="headerPanel" Value="0"/>
<Setter Property="Grid.Column" TargetName="contentPanel" Value="1"/>
<Setter Property="Width" TargetName="ColumnDefinition0" Value="Auto"/>
<Setter Property="Width" TargetName="ColumnDefinition1" Value="*"/>
<Setter Property="Height" TargetName="RowDefinition0" Value="*"/>
<Setter Property="Height" TargetName="RowDefinition1" Value="0"/>
<Setter Property="Margin" TargetName="headerPanel" Value="2,2,0,2"/>
</Trigger>
<Trigger Property="TabStripPlacement" Value="Right">
<Setter Property="Grid.Row" TargetName="headerPanel" Value="0"/>
<Setter Property="Grid.Row" TargetName="contentPanel" Value="0"/>
<Setter Property="Grid.Column" TargetName="headerPanel" Value="1"/>
<Setter Property="Grid.Column" TargetName="contentPanel" Value="0"/>
<Setter Property="Width" TargetName="ColumnDefinition0" Value="*"/>
<Setter Property="Width" TargetName="ColumnDefinition1" Value="Auto"/>
<Setter Property="Height" TargetName="RowDefinition0" Value="*"/>
<Setter Property="Height" TargetName="RowDefinition1" Value="0"/>
<Setter Property="Margin" TargetName="headerPanel" Value="0,2,2,2"/>
</Trigger>
<Trigger Property="IsEnabled" Value="false">
<Setter Property="TextElement.Foreground" TargetName="templateRoot" Value="{StaticResource {x:Static SystemColors.GrayTextBrushKey}}"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ResourceDictionary>
\ No newline at end of file
<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"/>
......@@ -29,27 +28,6 @@
<Setter Property="Margin" Value="5"/>
</Style>
<DropShadowEffect x:Key="Card.Shadow" Color="#303030" Opacity=".25" BlurRadius="5" ShadowDepth="3"/>
<Style x:Key="Card.Title" TargetType="TextBlock">
<Setter Property="Background" Value="#FFC107"/>
<Setter Property="FontSize" Value="18"/>
<Setter Property="HorizontalAlignment" Value="Right"/>
<Setter Property="Padding" Value="20 5"/>
<Setter Property="FontWeight" Value="Bold"/>
<Setter Property="VerticalAlignment" Value="Top"/>
</Style>
<Style x:Key="Card.Border" TargetType="Border">
<Setter Property="Margin" Value="5"/>
<Setter Property="Background" Value="White"/>
<Setter Property="CornerRadius" Value="3"/>
<Setter Property="Padding" Value="5"/>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="BorderBrush" Value="#EBEBEB"/>
<Setter Property="Effect" Value="{StaticResource Card.Shadow}"/>
</Style>
<Style TargetType="TextBlock" BasedOn="{StaticResource TextBlockStyle_FieldHeader}" x:Key="Text.FieldHeader2">
<Setter Property="FontSize" Value="15" />
......@@ -95,4 +73,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
......@@ -91,7 +91,7 @@
</StackPanel>
</Button>
<StackPanel Orientation="Horizontal" Grid.Column="1" Visibility="{Binding CheckEnable, Converter={StaticResource visbilityconv},ConverterParameter=HiddenWhenTrue}" >
<StackPanel Orientation="Horizontal" Grid.Column="1" Visibility="{Binding FeedbackHeat.CheckEnable, Converter={StaticResource visbilityconv},ConverterParameter=HiddenWhenTrue}" >
<Button Command="{Binding BaseUpCmd}" >
<StackPanel>
<Image Source="/FLY.FeedbackRenZiJia.UI.Client;component/Images/up.png"/>
......@@ -138,23 +138,14 @@
<StackPanel DataContext="{Binding FeedbackHeat}">
<Grid>
<Image Source="/FLY.FeedbackRenZiJia.UI.Client;component/Images/previous.png" />
<Grid HorizontalAlignment="Left" VerticalAlignment="Bottom" >
<Ellipse Fill="#FF2F5070" Width="25" Height="25" Opacity="0.8"/>
<TextBlock Text="{Binding UndoIdx}" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="White" FontFamily="Arial" FontSize="10"/>
</Grid>
</Grid>
<TextBlock >
<TextBlock.Style>
<Style TargetType="TextBlock" BasedOn="{StaticResource TitleStyle}">
<Setter Property="Text" Value="撤销"/>
<Style.Triggers>
<DataTrigger Binding="{Binding IsInUndo}" Value="True">
<Setter Property="Text" Value="{Binding UndoTime,StringFormat={}{0:HH:mm}}"/>
</DataTrigger>
</Style.Triggers>
</Style>
</TextBlock.Style>
</TextBlock>
<Grid>
<TextBlock Text="撤销" Visibility="{Binding IsInUndo,Converter={StaticResource visbilityconv},ConverterParameter=HiddenWhenTrue}"/>
<StackPanel Visibility="{Binding IsInUndo,Converter={StaticResource visbilityconv}}" Margin="0,0,0,-20">
<TextBlock Text="{Binding UndoTime,StringFormat={}{0:MM-dd}}"/>
<TextBlock Text="{Binding UndoTime,StringFormat={}{0:HH:mm:ss}}"/>
</StackPanel>
</Grid>
</StackPanel>
</Button>
<Button x:Name="btnClearH" Command="{Binding ClearCmd}" Template="{StaticResource picture_button}" >
......
......@@ -28,11 +28,26 @@ namespace FLY.FeedbackRenZiJia.Client
/// <param name="isPre"></param>
/// <param name="asyncDelegate"></param>
/// <param name="asyncContext"></param>
[Call(typeof(GetStableFrameReponse))]
[Call(typeof(GetFrameReponse))]
public void GetStableFrame(long id, bool isPre, AsyncCBHandler asyncDelegate, object asyncContext)
{
Call(nameof(GetStableFrame), new { id, isPre }, asyncDelegate, asyncContext);
}
/// <summary>
/// 以Id为起始点, 向前或者向后获取最近通道改变时间不相同的数据 或 起效数据
/// </summary>
/// <param name="id"></param>
/// <param name="isPre">向前</param>
/// <param name="isTakeEffect">数据起效</param>
/// <param name="isDiffHTime">加热不同</param>
/// <param name="asyncDelegate"></param>
/// <param name="asyncContext"></param>
[Call(typeof(GetFrameReponse))]
public void GetFrameAdv(long id, bool isPre, bool isTakeEffect, bool isDiffHTime, AsyncCBHandler asyncDelegate, object asyncContext)
{
Call(nameof(GetFrameAdv), new { id, isPre, isTakeEffect, isDiffHTime }, asyncDelegate, asyncContext);
}
}
}
......@@ -153,7 +153,7 @@ namespace FLY.FeedbackRenZiJia.Client
/// <summary>
/// undo 的序号
/// </summary>
public int UndoIdx { get; set; }
public long UndoId { get; set; }
/// <summary>
/// 在撤销中
/// </summary>
......
......@@ -12,13 +12,13 @@ namespace FLY.FeedbackRenZiJia.Common
{
ERRNO_PLC_DISCONNECTED = new ERRNO() { Code = 65535, Descrption = "风环 PLC连接断开" };
#region 收卷
ERRNO_NO_FAN = new ERRNO() { Code = 0, Descrption = "风机没开,不能加热" };
ERRNO_OPEN_CIRCUIT = new ERRNO() { Code = 1, Descrption = "加热棒断路" };
ERRNO_SHORT_CIRCUIT = new ERRNO() { Code = 2, Descrption = "加热控制板短路" };
ERRNO_POWER_OFF = new ERRNO() { Code = 3, Descrption = "电源没开启或电流计损坏" };
ERRNO_NO_VELOCITY = new ERRNO() { Code = 4, Descrption = "线速度=0,没生产" };
#endregion
ERRNO_PLC_ERROR = new ERRNO() { Code = 5, Descrption = "通讯异常" };
}
#region 报警类型
/// <summary>
......@@ -26,6 +26,10 @@ namespace FLY.FeedbackRenZiJia.Common
/// </summary>
public static ERRNO ERRNO_PLC_DISCONNECTED;
/// <summary>
/// 通讯异常
/// </summary>
public static ERRNO ERRNO_PLC_ERROR;
/// <summary>
/// 1.风机没开,不能加热
/// </summary>
public static ERRNO ERRNO_NO_FAN;
......
......@@ -19,11 +19,11 @@ namespace FLY.FeedbackRenZiJia.IService
/// <summary>
/// 获取一幅数据;
/// </summary>
/// <param name="Id"></param>
/// <param name="id"></param>
/// <param name="asyncDelegate"></param>
/// <param name="asyncContext"></param>
[Call(typeof(GetFrameReponse))]
void GetFrame(long Id, AsyncCBHandler asyncDelegate, object asyncContext);
void GetFrame(long id, AsyncCBHandler asyncDelegate, object asyncContext);
/// <summary>
/// 获取一幅稳定的数据;
......@@ -32,12 +32,24 @@ namespace FLY.FeedbackRenZiJia.IService
/// <param name="isPre"></param>
/// <param name="asyncDelegate"></param>
/// <param name="asyncContext"></param>
[Call(typeof(GetStableFrameReponse))]
[Call(typeof(GetFrameReponse))]
void GetStableFrame(long id, bool isPre, AsyncCBHandler asyncDelegate, object asyncContext);
/// <summary>
/// 以Id为起始点, 向前或者向后获取最近通道改变时间不相同的数据 或 起效数据
/// </summary>
/// <param name="id"></param>
/// <param name="isPre">向前</param>
/// <param name="isTakeEffect">数据起效</param>
/// <param name="isDiffHTime">加热不同</param>
/// <param name="asyncDelegate"></param>
/// <param name="asyncContext"></param>
[Call(typeof(GetFrameReponse))]
void GetFrameAdv(long id, bool isPre, bool isTakeEffect, bool isDiffHTime, AsyncCBHandler asyncDelegate, object asyncContext);
}
public class GetFrameReponse
{
public long Id;
public long id;
public Lc_ThickHeat thickHeat;
}
public class GetStableFrameReponse
......
......@@ -141,7 +141,7 @@ namespace FLY.FeedbackRenZiJia.IService
/// <summary>
/// 撤销的序号
/// </summary>
int UndoIdx { get; }
long UndoId { get; }
/// <summary>
/// 撤销中
/// </summary>
......
using FLY.FeedbackRenZiJia.IService;
using FLY.OBJComponents.Server;
using FObjBase;
using FObjBase.Reflect;
using SQLite;
using System;
using System.Collections.Generic;
......@@ -40,7 +41,7 @@ namespace FLY.FeedbackRenZiJia.Server.Model
}
/// <summary>
///
/// </summary>
......@@ -54,7 +55,7 @@ namespace FLY.FeedbackRenZiJia.Server.Model
public void GetFrame(long Id, AsyncCBHandler asyncDelegate, object asyncContext)
{
GetFrameReponse reponse = new GetFrameReponse();
reponse.Id = Id;
reponse.id = Id;
Task.Factory.StartNew(() =>
{
......@@ -89,11 +90,10 @@ namespace FLY.FeedbackRenZiJia.Server.Model
/// <param name="asyncDelegate"></param>
/// <param name="asyncContext"></param>
//[Call(typeof(GetStableFrameReponse))]
public async void GetStableFrame(long id, bool isPre, AsyncCBHandler asyncDelegate, object asyncContext)
public async void GetStableFrame(long id, bool isPre, AsyncCBHandler asyncDelegate, object asyncContext)
{
var reponse = new GetStableFrameReponse();
var reponse = new GetFrameReponse();
reponse.id = id;
reponse.isPre = isPre;
await Task.Factory.StartNew(() =>
{
......@@ -119,7 +119,8 @@ namespace FLY.FeedbackRenZiJia.Server.Model
$" ORDER BY {nameof(Db_ThickHeat.ID)} DESC" +
$" LIMIT 1");
}
else {
else
{
db_thickHeats = dbModel.TbThickHeat.Find(
$"WHERE {nameof(Db_ThickHeat.ID)} >= {id}" +
$" AND {nameof(Db_ThickHeat.IsStable)} = true" +
......@@ -139,5 +140,88 @@ namespace FLY.FeedbackRenZiJia.Server.Model
asyncDelegate(asyncContext, reponse);
}
/// <summary>
/// 以Id为起始点, 向前或者向后获取最近通道改变时间不相同的数据 或 起效数据
/// </summary>
/// <param name="id"></param>
/// <param name="isPre">向前</param>
/// <param name="isTakeEffect">数据起效</param>
/// <param name="isDiffHTime">加热不同</param>
/// <param name="asyncDelegate"></param>
/// <param name="asyncContext"></param>
[Call(typeof(GetFrameReponse))]
public async void GetFrameAdv(long id, bool isPre, bool isTakeEffect, bool isDiffHTime, AsyncCBHandler asyncDelegate, object asyncContext)
{
var reponse = new GetFrameReponse();
reponse.id = id;
//会慢,需要分个线程独立做这事
await Task.Factory.StartNew(() =>
{
if (id <= 0)
{
//先获取真实ID
string sql =
$"SELECT {nameof(Db_ThickHeat.ID)} FROM { dbModel.TbThickHeat.TableName}" +
$" ORDER BY {nameof(Db_ThickHeat.ID)} DESC" +
$" LIMIT 1 OFFSET {-id}";
var ret = dbModel.sqliteHelper.ExecuteScalar(sql);
if (ret == DBNull.Value)
return;
id = Convert.ToInt32(ret);
}
string ctime_str = "";
if (isDiffHTime)
{
DateTime ctime;
//获取对应ID 的 通道改变时间
{
string sql =
$"SELECT {nameof(Db_ThickHeat.HTime)} FROM { dbModel.TbThickHeat.TableName}" +
$" WHERE {nameof(Db_ThickHeat.ID)} = {id}";
var ret = dbModel.sqliteHelper.ExecuteScalar(sql);
if (ret == DBNull.Value)
return;
ctime = Convert.ToDateTime(ret);
}
ctime_str = ctime.ToStringOfSQLiteFieldType();
}
List<Db_ThickHeat> db_thickHeats = null;
{
string condition = "";
string symbol = isPre ? "<" : ">";
condition += $"WHERE {nameof(Db_ThickHeat.ID)}{symbol}{id}";
if (isDiffHTime)
condition += $" AND {nameof(Db_ThickHeat.HTime)}<>{ctime_str}";
if (isTakeEffect)
condition += $" AND {nameof(Db_ThickHeat.IsStable)}=TRUE";
condition += $" ORDER BY {nameof(Db_ThickHeat.ID)}";
if (isPre)
condition += " DESC";
condition += " LIMIT 1";
db_thickHeats = dbModel.TbThickHeat.Find(condition);
}
if (db_thickHeats.Count() == 0)
{
return;
}
var lc_thickHeat = Lc_AutoMapperProfile.Mapper.Map<Lc_ThickHeat>(db_thickHeats.First());
reponse.thickHeat = lc_thickHeat;
});
asyncDelegate(asyncContext, reponse);
}
}
}
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