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

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

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