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

添加 自动风环对位界面,支持 看上一幅稳定数据

parent 0547219d
......@@ -76,15 +76,19 @@
</lvc:CartesianChart.AxisY>
</lvc:CartesianChart>
<StackPanel Orientation="Horizontal" Margin="48,0,0,-20" Opacity="0.8">
<Button Style="{StaticResource ButtonStyle_RectangleIcon}" Command="{Binding PreStableCmd}" >
<iconPacks:PackIconMaterial Kind="ChevronDoubleLeft" />
</Button>
<Button Style="{StaticResource ButtonStyle_RectangleIcon}" Command="{Binding PreCmd}" >
<Grid>
<iconPacks:PackIconMaterial Kind="ArrowLeft" />
</Grid>
<iconPacks:PackIconMaterial Kind="ChevronLeft" Width="10"/>
</Button>
<Button Style="{StaticResource ButtonStyle_RectangleIcon}" Command="{Binding NextCmd}">
<Grid>
<iconPacks:PackIconMaterial Kind="ArrowRight" />
</Grid>
<!--<iconPacks:PackIconMaterial Kind="ArrowRight" />-->
<iconPacks:PackIconMaterial Kind="ChevronRight" Width="10"/>
</Button>
<Button Style="{StaticResource ButtonStyle_RectangleIcon}" Command="{Binding NextStableCmd}" >
<iconPacks:PackIconMaterial Kind="ChevronDoubleRight" />
</Button>
</StackPanel>
<Grid Grid.Column="1" Grid.RowSpan="2" Panel.ZIndex="2"
......
......@@ -116,6 +116,8 @@ namespace FLY.FeedbackRenZiJia.UI.Client
public RelayCommand PreCmd { get; }
public RelayCommand NextCmd { get; }
public RelayCommand PreStableCmd { get; }
public RelayCommand NextStableCmd { get; }
public Lc_ThickHeat frame;
IBulkDbService bulkDbService;
......@@ -150,6 +152,8 @@ namespace FLY.FeedbackRenZiJia.UI.Client
PreCmd = new RelayCommand(Pre);
NextCmd = new RelayCommand(Next);
PreStableCmd = new RelayCommand(PreStable);
NextStableCmd = new RelayCommand(NextStable);
}
......@@ -174,6 +178,8 @@ namespace FLY.FeedbackRenZiJia.UI.Client
private void UcThickHeatVm_PropertyChanged(object sender, PropertyChangedEventArgs e)
{
if (e.PropertyName == nameof(Number)) {
if (IsSkipNumberChanged)
return;
UpdateFrame();
}
}
......@@ -187,46 +193,95 @@ namespace FLY.FeedbackRenZiJia.UI.Client
void _updateFrame()
{
bulkDbService.GetFrame(Number, (asyncContext, retData) =>
if (IsGetStableFrame)
{
var reponce = retData as GetFrameReponse;
if (reponce.thickHeat != null)
IsGetStableFrame = false;
bulkDbService.GetStableFrame(Number, IsPre,(asyncContext, retData) =>
{
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
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);
}
else
{
bulkDbService.GetFrame(Number, (asyncContext, retData) =>
{
IsVaild = false;
}
FrameUpdated?.Invoke();
}, null);
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);
}
}
private void Next()
{
......@@ -237,8 +292,22 @@ namespace FLY.FeedbackRenZiJia.UI.Client
{
Number--;
}
bool IsGetStableFrame;
bool IsPre;
bool IsSkipNumberChanged;
private void NextStable()
{
IsGetStableFrame = true;
IsPre = false;
Number++;
}
private void PreStable()
{
IsGetStableFrame = true;
IsPre = true;
Number--;
}
/// <summary>
/// 以指定复位区号, 分区表 导出厚度%
/// </summary>
......
......@@ -20,6 +20,19 @@ namespace FLY.FeedbackRenZiJia.Client
{
Call(nameof(GetFrame), new { Id }, asyncDelegate, asyncContext);
}
/// <summary>
/// 获取一幅稳定的数据;
/// </summary>
/// <param name="Id">以Id为起始点, 向前或者向后或者最近稳定的一幅数据</param>
/// <param name="isPre"></param>
/// <param name="asyncDelegate"></param>
/// <param name="asyncContext"></param>
[Call(typeof(GetStableFrameReponse))]
public void GetStableFrame(long id, bool isPre, AsyncCBHandler asyncDelegate, object asyncContext)
{
Call(nameof(GetStableFrame), new { id, isPre }, asyncDelegate, asyncContext);
}
}
}
......@@ -17,17 +17,33 @@ namespace FLY.FeedbackRenZiJia.IService
/// </summary>
long LastId { get; }
/// <summary>
/// 获取一幅数据
/// 获取一幅数据;
/// </summary>
/// <param name="request"></param>
/// <param name="Id"></param>
/// <param name="asyncDelegate"></param>
/// <param name="asyncContext"></param>
[Call(typeof(GetFrameReponse))]
void GetFrame(long Id, AsyncCBHandler asyncDelegate, object asyncContext);
/// <summary>
/// 获取一幅稳定的数据;
/// </summary>
/// <param name="Id">以Id为起始点, 向前或者向后或者最近稳定的一幅数据</param>
/// <param name="isPre"></param>
/// <param name="asyncDelegate"></param>
/// <param name="asyncContext"></param>
[Call(typeof(GetStableFrameReponse))]
void GetStableFrame(long id, bool isPre, AsyncCBHandler asyncDelegate, object asyncContext);
}
public class GetFrameReponse
{
public long Id;
public Lc_ThickHeat thickHeat;
}
public class GetStableFrameReponse
{
public long id;
public bool isPre;
public Lc_ThickHeat thickHeat;
}
}
......@@ -177,7 +177,7 @@ namespace FLY.FeedbackRenZiJia.Server
/// <summary>
/// 最后一幅数据,单位 channelcnt, 可以有double.NaN
/// </summary>
public double[] ThickPercents;
public double[] ThickPercents=null;
/// <summary>
/// 最后一幅数据的复位区号
/// </summary>
......@@ -222,8 +222,9 @@ namespace FLY.FeedbackRenZiJia.Server
}
public void SetToBestThickPercents()
{
ThickPercents = Common.MyMath.Move(ThickPercents, (BestOrgBoltNo - OrgBoltNo)* ChannelCnt/BoltCnt);
OrgBoltNo = BestOrgBoltNo;
MoveThickPercents(BestOrgBoltNo);
//ThickPercents = Common.MyMath.Move(ThickPercents, (BestOrgBoltNo - OrgBoltNo)* ChannelCnt/BoltCnt);
//OrgBoltNo = BestOrgBoltNo;
Stability = STABILITY.OK_CORREL;
bool[] isStables = new bool[ChannelCnt];
for (int i = 0; i < isStables.Count(); i++)
......@@ -232,6 +233,17 @@ namespace FLY.FeedbackRenZiJia.Server
CurrR = MaxR;
BoltIsStable = isStables;
}
public bool MoveThickPercents(int orgBoltNo)
{
if (ThickPercents != null && OrgBoltNo!=orgBoltNo)
{
ThickPercents = Common.MyMath.Move(ThickPercents, (orgBoltNo - OrgBoltNo) * ChannelCnt / BoltCnt);
OrgBoltNo = orgBoltNo;
return true;
}
return false;
}
public void Init(int boltCnt, int channelCnt)
{
BoltCnt = boltCnt;
......
......@@ -173,7 +173,18 @@ namespace FLY.FeedbackRenZiJia.Server
public void Init3(IBlowingService blowingService)
{
this.blowingService = blowingService;
this.blowingService.PropertyChanged += BlowingService_PropertyChanged;
}
private void BlowingService_PropertyChanged(object sender, PropertyChangedEventArgs e)
{
//当复位区号改变了,同时也修改heatCell 的 thickPercents
if (e.PropertyName == nameof(this.blowingService.OrgBoltNo)) {
if (mHeatBuf.MoveThickPercents(this.blowingService.OrgBoltNo))
SetThickPercents(mHeatBuf.ThickPercents);
}
}
public void Init2(int boltCnt, int channelCnt)
{
ChannelCnt = channelCnt;
......@@ -281,13 +292,15 @@ namespace FLY.FeedbackRenZiJia.Server
string msg = "对位完成";
if (blowingService.OrgBoltNo != mHeatBuf.BestOrgBoltNo)
{
msg += $",[复位号]{blowingService.OrgBoltNo}->{mHeatBuf.BestOrgBoltNo}";
blowingService.OrgBoltNo = mHeatBuf.BestOrgBoltNo;
blowingService.Apply();
//调节 mHeatBuf.ThickPercents 移动到 mHeatBuf.BestOrgBoltNo
//使mHeatBuf状态为稳定
mHeatBuf.SetToBestThickPercents();
SetThickPercents(mHeatBuf.ThickPercents);
msg += $",[复位号]{blowingService.OrgBoltNo}->{mHeatBuf.BestOrgBoltNo}";
blowingService.OrgBoltNo = mHeatBuf.BestOrgBoltNo;
blowingService.Apply();
}
else
{
......@@ -314,7 +327,7 @@ namespace FLY.FeedbackRenZiJia.Server
{
if (AutoONoId0 < mHeatBuf.mData.First().thickHeat.ID)
{
//失败,对位过程有大波动
//失败,对位过程有大波动, 全部数据被清除?
AutoONoStatus = AutoONoStatusEnum.Fail;
AutoONoMsg = "失败,对位过程有大波动";
return;
......@@ -856,7 +869,7 @@ namespace FLY.FeedbackRenZiJia.Server
/// <summary>
/// 自动对位
/// </summary>
public bool IsAutoONo= false;
public bool IsAutoONo = true;
/// <summary>
/// 最大加热量
......
......@@ -111,5 +111,64 @@ namespace FLY.FeedbackRenZiJia.Server.Model
asyncDelegate(asyncContext, reponse);
}
/// <summary>
/// 获取一幅稳定的数据;
/// </summary>
/// <param name="Id">以Id为起始点, 向前或者向后或者最近稳定的一幅数据</param>
/// <param name="isPre"></param>
/// <param name="asyncDelegate"></param>
/// <param name="asyncContext"></param>
//[Call(typeof(GetStableFrameReponse))]
public async void GetStableFrame(long id, bool isPre, AsyncCBHandler asyncDelegate, object asyncContext)
{
var reponse = new GetStableFrameReponse();
reponse.id = id;
reponse.isPre = isPre;
await Task.Factory.StartNew(() =>
{
if (id <= 0)
{
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);
}
List<Db_ThickHeat> db_thickHeats = null;
if (isPre)
{
db_thickHeats = dbModel.TbThickHeat.Find(
$"WHERE {nameof(Db_ThickHeat.ID)} <= {id}" +
$" AND {nameof(Db_ThickHeat.IsStable)} = true" +
$" ORDER BY {nameof(Db_ThickHeat.ID)} DESC" +
$" LIMIT 1");
}
else {
db_thickHeats = dbModel.TbThickHeat.Find(
$"WHERE {nameof(Db_ThickHeat.ID)} >= {id}" +
$" AND {nameof(Db_ThickHeat.IsStable)} = true" +
$" ORDER BY {nameof(Db_ThickHeat.ID)}" +
$" LIMIT 1");
}
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);
}
}
}
......@@ -1350,6 +1350,12 @@ namespace FLY.Thick.Blowing.Server
frame = frameinfo.frame;
map = null;
}
//限制小数点
for (int j = 0; j < frame.Count(); j++)
{
if(!double.IsNaN(frame[j]))
frame[j] = Math.Round(frame[j], 2);
}
frameinfo.renZiJiaDataEventArgs = new RenZiJiaDataEventArgs()
{
......
......@@ -1065,7 +1065,7 @@ namespace FLY.Thick.BlowingScan.Server
return frame.Select(t =>
{
if (Misc.MyBase.ISVALIDATA(t))
return t / 100.0;
return Math.Round(t / 100.0, 2);
else
return double.NaN;
}).ToArray();
......
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