Commit 0b584cd1 authored by 潘栩锋's avatar 潘栩锋 🚴

添加 按1号加热棒时针位置设置复位区号

parent e53208bf

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace FLY.FeedbackRenZiJia.Common
{
public class FlyData_BoltHeatRecord
{
/// <summary>
/// 稳定历史
/// </summary>
public BoltHeatRecord[] StableList;
/// <summary>
/// 不稳定列表
/// </summary>
public BoltHeatRecord[] UnstableList;
public byte[] ToBytes()
{
List<byte> buf = new List<byte>();
buf.AddRange(BitConverter.GetBytes(StableList.Count()));//4
for (int i = 0; i < StableList.Count(); i++)
buf.AddRange(StableList[i].ToBytes());//16
buf.AddRange(BitConverter.GetBytes(UnstableList.Count()));//4
for (int i = 0; i < UnstableList.Count(); i++)
buf.AddRange(UnstableList[i].ToBytes());//16
return buf.ToArray();
}
public bool TryParse(byte[] value)
{
int cnt;
return TryParse(value, 0, out cnt);
}
public bool TryParse(byte[] value, int index, out int cnt)
{
int idx = index;
cnt = 4;
if (value.Length < (index + cnt))
return false;
int len = BitConverter.ToInt32(value, idx);
idx += 4;
if (len > 0)
{
cnt += len * 20;
if (value.Length < (index + cnt))
return false;
StableList = new BoltHeatRecord[len];
for (int i = 0; i < len; i++)
{
BoltHeatRecord r = new BoltHeatRecord();
r.TryParse(value, idx);
StableList[i] = r;
idx += 20;
}
}
cnt += 4;
if (value.Length < (index + cnt))
return false;
len = BitConverter.ToInt32(value, idx);
idx += 4;
if (len > 0)
{
cnt += len * 20;
if (value.Length < (index + cnt))
return false;
UnstableList = new BoltHeatRecord[len];
for (int i = 0; i < len; i++)
{
BoltHeatRecord r = new BoltHeatRecord();
r.TryParse(value, idx);
UnstableList[i] = r;
idx += 20;
}
}
return true;
}
}
/// <summary>
/// [厚度%差,厚度%差中值,加热%滤波 差,加热%滤波 差中值]]
/// </summary>
public class BoltHeatRecord
{
public int ThickDiff { get; set; }
public int ThickMid { get; set; }
public int HeatDiff { get; set; }
public int HeatMid { get; set; }
/// <summary>
/// 次数
/// </summary>
public int Cnt { get; set; }
public BoltHeatRecord()
{
Cnt = 1;
}
public int Thick0
{
get
{
return ThickMid + ThickDiff / 2;
}
}
public int Thick1
{
get
{
return ThickMid - ThickDiff / 2;
}
}
public int Heat0
{
get
{
return HeatMid + HeatDiff / 2;
}
}
public int Heat1
{
get
{
return HeatMid - HeatDiff / 2;
}
}
public bool IsSameThick(int thick, int range)
{
if (Math.Abs(thick - Thick0) <= range)
return true;
if (Math.Abs(thick - Thick1) <= range)
return true;
return false;
}
public byte[] ToBytes()
{
List<byte> buf = new List<byte>();
buf.AddRange(BitConverter.GetBytes(Cnt));//4
buf.AddRange(BitConverter.GetBytes(ThickDiff));//4
buf.AddRange(BitConverter.GetBytes(ThickMid));//4
buf.AddRange(BitConverter.GetBytes(HeatDiff));//4
buf.AddRange(BitConverter.GetBytes(HeatMid));//4
return buf.ToArray();
}
/// <summary>
/// 20 byte
/// </summary>
/// <param name="value"></param>
/// <returns></returns>
public bool TryParse(byte[] value)
{
return TryParse(value, 0);
}
/// <summary>
/// 20 byte
/// </summary>
/// <param name="value"></param>
/// <param name="index"></param>
/// <param name="cnt"></param>
/// <returns></returns>
public bool TryParse(byte[] value, int index)
{
int cnt = 4 * 5;
if (value.Length < (index + cnt))
return false;
int idx = index;
Cnt = BitConverter.ToInt32(value, idx);
idx += 4;
ThickDiff = BitConverter.ToInt32(value, idx);
idx += 4;
ThickMid = BitConverter.ToInt32(value, idx);
idx += 4;
HeatDiff = BitConverter.ToInt32(value, idx);
idx += 4;
HeatMid = BitConverter.ToInt32(value, idx);
idx += 4;
return true;
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using System.Xml.Serialization;
namespace FLY.FeedbackRenZiJia.Common
{
/// <summary>
/// 加热记录
/// </summary>
public class HeatProfile
{
public int[] Heats;
public static HeatProfile Load(string path)
{
try
{
using (Stream fStream = new FileStream(path, FileMode.Open))
{
XmlSerializer xmlFormat = new XmlSerializer(typeof(HeatProfile));//创建XML序列化器,需要指定对象的类型
HeatProfile sp = (HeatProfile)xmlFormat.Deserialize(fStream);
fStream.Dispose();//关闭文件
return sp;
}
}
catch
{
return null;
}
}
public void Save(string path)
{
using (
Stream fStream = new FileStream(path, FileMode.Create))
{
XmlSerializer xmlFormat = new XmlSerializer(typeof(HeatProfile));//创建XML序列化器,需要指定对象的类型
xmlFormat.Serialize(fStream, this);
fStream.Dispose();//关闭文件
}
}
}
}
......@@ -52,9 +52,7 @@
<Compile Include="Client\HeatCellServiceClient.cs" />
<Compile Include="Common\ERRNOs.cs" />
<Compile Include="Common\FeedbackHeatsMark.cs" />
<Compile Include="Common\FlyData_BoltHeatRecord.cs" />
<Compile Include="Common\FlyData_FeedbackHeat.cs" />
<Compile Include="Common\HeatProfile.cs" />
<Compile Include="Common\MyMath.cs" />
<Compile Include="IService\IBulkDbService.cs" />
<Compile Include="IService\IHeatBufService.cs" />
......
......@@ -370,6 +370,30 @@
</StackPanel>
</StackPanel>
<GroupBox >
<GroupBox.Header>
<StackPanel Orientation="Horizontal">
<TextBlock Text="复位区号辅助设置" FontSize="15" Foreground="Gray"/>
<TextBlock Text="(站在收卷看风环)" FontSize="15" FontWeight="Bold"/>
</StackPanel>
</GroupBox.Header>
<StackPanel Orientation="Horizontal">
<StackPanel Margin="5" >
<TextBlock Style="{StaticResource TextBlockStyle_FieldHeaderEditable}" Text="探头在右边" />
<ToggleButton Style="{StaticResource ToggleButtonStyle1}" HorizontalAlignment="Left" IsChecked="{Binding IsProbeRight}"/>
</StackPanel>
<StackPanel Margin="5" >
<TextBlock Style="{StaticResource TextBlockStyle_FieldHeaderEditable}" Text="1号加热棒位置" />
<StackPanel Orientation="Horizontal">
<TextBox Style="{StaticResource TextBoxStyle_FieldContent}" Text="{Binding No1InClock}"/>
<TextBlock Style="{StaticResource TextBlockStyle_FieldContent_mm}" Text="点钟方向" />
</StackPanel>
</StackPanel>
</StackPanel>
</GroupBox>
</StackPanel>
<GroupBox Header="分区表" FontSize="20" Grid.Row="2" >
......
......@@ -10,6 +10,10 @@ using System.Text;
using System.Threading.Tasks;
using FLY.Thick.Base.UI;
using GalaSoft.MvvmLight.Command;
using System.Threading;
using OfficeOpenXml.FormulaParsing.Excel.Functions.Information;
using OfficeOpenXml.FormulaParsing.Excel.Functions.Logical;
using Unity.Injection;
namespace FLY.Thick.Blowing.UI.Fix.Client
{
......@@ -105,7 +109,15 @@ namespace FLY.Thick.Blowing.UI.Fix.Client
/// 人字架复位时, 探头对应的分区位, 也就是 0° 对应的分区位
/// </summary>
public int OrgBoltNo { get; set; }
/// <summary>
/// 当人字架复位时,探头在右边
/// </summary>
public bool IsProbeRight { get; set; } = true;
/// <summary>
/// 分区1号 对应时钟的位置 1 ~ 12
/// </summary>
public int No1InClock { get; set; } = 3;
/// <summary>
/// 使用分区表
/// </summary>
......@@ -161,6 +173,7 @@ namespace FLY.Thick.Blowing.UI.Fix.Client
Misc.BindingOperations.SetBinding(bDetect, nameof(bDetect.IsLackSignMode), this, nameof(IsLackSignMode));
Misc.BindingOperations.SetBinding(bDetect, nameof(bDetect.Is3D), this, nameof(Is3D));
Misc.BindingOperations.SetBinding(renZiJiaService, nameof(renZiJiaService.IsProbeRight), this, nameof(IsProbeRight));
Misc.BindingOperations.SetBinding(renZiJiaService, nameof(renZiJiaService.ChannelCnt), this, nameof(ChannelCnt));
Misc.BindingOperations.SetBinding(renZiJiaService, nameof(renZiJiaService.BPC), this, nameof(BPC));
Misc.BindingOperations.SetBinding(renZiJiaService, nameof(renZiJiaService.OrgBoltNo), this, nameof(OrgBoltNo));
......@@ -176,6 +189,79 @@ namespace FLY.Thick.Blowing.UI.Fix.Client
}
});
updateNo1InClock();
this.PropertyChanged += PgBlowingVm_PropertyChanged;
}
private void PgBlowingVm_PropertyChanged(object sender, PropertyChangedEventArgs e)
{
if ((e.PropertyName == nameof(No1InClock))|| (e.PropertyName == nameof(IsProbeRight)))
{
if (isSkipUpdate)
return;
isSkipUpdate = true;
updateOrgBoltNo();
isSkipUpdate = false;
}
else if (e.PropertyName == nameof(OrgBoltNo)) {
if (isSkipUpdate)
return;
isSkipUpdate = true;
updateNo1InClock();
isSkipUpdate = false;
}
}
bool isSkipUpdate = false;
void updateNo1InClock()
{
double orgBoltNo = OrgBoltNo;
if (orgBoltNo < 1 || orgBoltNo > NBolts)
orgBoltNo = 1;
int no1;
if (IsProbeRight)
{
no1 = (int)Math.Round(3 + 12 * (orgBoltNo - 1) / NBolts );
}
else
{
no1 = (int)Math.Round(9 + 12 * (orgBoltNo - 1) / NBolts);
}
if (no1 > 12)
no1 -= 12;
else if (no1 < 1)
no1 += 12;
No1InClock = no1;
}
void updateOrgBoltNo()
{
double no1 = No1InClock;
if (no1 < 1 || no1 > 12)
no1 = 3;
//平移,以3为0点
no1 -= 3;
if (no1 < 0)
no1 += 12;
int orgBoltNo;
if (IsProbeRight)
{
orgBoltNo = (int)Math.Round(NBolts * no1 / 12) + 1;
}
else
{
orgBoltNo = (int)Math.Round(NBolts * (no1+6) / 12) + 1;
}
if (orgBoltNo > NBolts)
orgBoltNo -= NBolts;
else if(orgBoltNo<1)
orgBoltNo += NBolts;
OrgBoltNo = orgBoltNo;
}
void Download()
......@@ -239,6 +325,7 @@ namespace FLY.Thick.Blowing.UI.Fix.Client
renZiJiaService.BPC=this.BPC;
renZiJiaService.OrgBoltNo=this.OrgBoltNo;
renZiJiaService.IsUsedMap=this.IsUsedMap;
renZiJiaService.IsProbeRight = this.IsProbeRight;
renZiJiaService.Apply();
FLY.ControlLibrary.Window_Tip.Show("应用成功",
......
......@@ -24,10 +24,5 @@ namespace FLY.Thick.Blowing.UI.Fix.Client.UiModule
/// Y轴显示范围是公差的N倍
/// </summary>
public double YRangePercent { get; set; } = 3;
/// <summary>
/// 探头在右边
/// </summary>
public bool MPIsRight { get; set; } = true;
}
}
......@@ -103,12 +103,12 @@ namespace FLY.Thick.Blowing.UI.Fix.Client.UiModule
graph.SetBinding(PolarChart.TolerancePercentProperty, new Binding(nameof(profileParam.TolerancePercent)) { Source = profileParam });
graph.SetBinding(PolarChart.MPIsRightProperty, new Binding(nameof(graphparam.MPIsRight)) { Source = graphparam });
graph.SetBinding(PolarChart.YRangePercentProperty, new Binding(nameof(graphparam.YRangePercent)) { Source = graphparam });
graph.SetBinding(PolarChart.BoltCntProperty, new Binding(nameof(blowingService.NBolts)) { Source = blowingService });
graph.SetBinding(PolarChart.OrgBoltNoProperty, new Binding(nameof(blowingService.OrgBoltNo)) { Source = blowingService });
graph.SetBinding(PolarChart.MPIsRightProperty, new Binding(nameof(blowingService.IsProbeRight)) { Source = blowingService });
graph.Values = Values;
Misc.BindingOperations.SetBinding(graphparam, nameof(graphparam.Mix), this, nameof(Mix));
......
......@@ -56,6 +56,7 @@ namespace FLY.Thick.Blowing.Client
/// 测厚仪类型, 追边 or 扫描
/// </summary>
public BlowingType BType { get; set; }
public bool IsProbeRight { get; set; }
#endregion
......
......@@ -79,8 +79,6 @@ namespace FLY.Thick.Blowing.IService
/// </summary>
bool Is3D { get; set; }
#endregion
#region 状态
......
......@@ -43,6 +43,11 @@ namespace FLY.Thick.Blowing.IService
BoltMapCell[] Map { get; set; }
#endregion
/// <summary>
/// 测厚仪测量点位置方向:Left, Right (也就是三角形在左还是右)
/// </summary>
bool IsProbeRight { get; set; }
/// <summary>
/// 测厚仪类型, 追边 or 扫描
/// </summary>
......
......@@ -33,7 +33,6 @@ namespace FLY.Thick.Blowing.Server
BulkDb bulkDb;
#region 延时操作,markno
const int MARKNO_SAVE = 1;
const int MARKNO_CALFRAME = 2;
#endregion
......@@ -117,6 +116,10 @@ namespace FLY.Thick.Blowing.Server
/// </summary>
public BlowingType BType { get; } = BlowingType.Fix;
/// <summary>
/// 测厚仪测量点位置方向:Left, Right (也就是三角形在左还是右)
/// </summary>
public bool IsProbeRight { get; set; } = true;
/// <summary>
/// 应用
/// </summary>
......@@ -1671,11 +1674,12 @@ namespace FLY.Thick.Blowing.Server
public static Mapper Mapper { get; } = new AutoMapper.Mapper(new MapperConfiguration(c => {
c.CreateMap<GM_BlowingFix, BlowingFixJsonDb>().ReverseMap();
}));
public int ChannelCnt;
public int BPC;
public int OrgBoltNo;
public int ChannelCnt=88;
public int BPC=1;
public int OrgBoltNo=1;
public bool IsUsedMap;
public BoltMapCell[] Map;
public bool IsProbeRight = true;
}
......
......@@ -378,6 +378,30 @@
</StackPanel>
</StackPanel>
<GroupBox >
<GroupBox.Header>
<StackPanel Orientation="Horizontal">
<TextBlock Text="复位区号辅助设置" FontSize="15" Foreground="Gray"/>
<TextBlock Text="(站在收卷看风环)" FontSize="15" FontWeight="Bold"/>
</StackPanel>
</GroupBox.Header>
<StackPanel Orientation="Horizontal">
<StackPanel Margin="{StaticResource ControlMargin}">
<TextBlock Style="{StaticResource TextBlockStyle_FieldHeaderEditable}" Text="探头在右边" />
<ToggleButton Style="{StaticResource ToggleButtonStyle1}" HorizontalAlignment="Left" IsChecked="{Binding IsProbeRight}"/>
</StackPanel>
<StackPanel Margin="{StaticResource ControlMargin}">
<TextBlock Style="{StaticResource TextBlockStyle_FieldHeaderEditable}" Text="1号加热棒位置" />
<StackPanel Orientation="Horizontal">
<TextBox Style="{StaticResource TextBoxStyle_FieldContent}" Text="{Binding No1InClock}"/>
<TextBlock Style="{StaticResource TextBlockStyle_FieldContent_mm}" Text="点钟方向" />
</StackPanel>
</StackPanel>
</StackPanel>
</GroupBox>
</StackPanel>
<GroupBox Header="分区表" FontSize="20" Grid.Row="2" >
......
......@@ -105,6 +105,15 @@ namespace FLY.Thick.BlowingScan.UI.Client
/// </summary>
public int OrgBoltNo { get; set; }
/// <summary>
/// 当人字架复位时,探头在右边
/// </summary>
public bool IsProbeRight { get; set; } = true;
/// <summary>
/// 分区1号 对应时钟的位置 1 ~ 12
/// </summary>
public int No1InClock { get; set; } = 3;
/// <summary>
/// 使用分区表
/// </summary>
......@@ -169,21 +178,19 @@ namespace FLY.Thick.BlowingScan.UI.Client
renZiJiaService = blowingScanService;
bDetect = blowingDetectService;
this.initParamService = initParamService;
Misc.BindingOperations.SetBinding(bDetect, "RAngle", this, "RAngle");
Misc.BindingOperations.SetBinding(bDetect, "DefaultRPeriod", this, "DefaultRPeriod");
Misc.BindingOperations.SetBinding(bDetect, "AccDecTime", this, "AccDecTime");
Misc.BindingOperations.SetBinding(bDetect, "IsSign0Double", this, "IsSign0Double");
Misc.BindingOperations.SetBinding(bDetect, "IsSign1Double", this, "IsSign1Double");
Misc.BindingOperations.SetBinding(bDetect, "SignType", this, "SignType");
Misc.BindingOperations.SetBinding(bDetect, "LimitSignTime", this, "LimitSignTime");
Misc.BindingOperations.SetBinding(bDetect, "FilmLength", this, "FilmLength");
Misc.BindingOperations.SetBinding(bDetect, "RollPerimeter", this, "RollPerimeter");
Misc.BindingOperations.SetBinding(bDetect, "IsSignFilter", this, "IsSignFilter");
Misc.BindingOperations.SetBinding(bDetect, "IsLackSignMode", this, "IsLackSignMode");
Misc.BindingOperations.SetBinding(bDetect, "Is3D", this, "Is3D");
Misc.BindingOperations.SetBinding(bDetect, nameof(bDetect.RAngle), this, nameof(RAngle));
Misc.BindingOperations.SetBinding(bDetect, nameof(bDetect.DefaultRPeriod), this, nameof(DefaultRPeriod));
Misc.BindingOperations.SetBinding(bDetect, nameof(bDetect.IsSign0Double), this, nameof(IsSign0Double));
Misc.BindingOperations.SetBinding(bDetect, nameof(bDetect.IsSign1Double), this, nameof(IsSign1Double));
Misc.BindingOperations.SetBinding(bDetect, nameof(bDetect.SignType), this, nameof(SignType));
Misc.BindingOperations.SetBinding(bDetect, nameof(bDetect.LimitSignTime), this, nameof(LimitSignTime));
Misc.BindingOperations.SetBinding(bDetect, nameof(bDetect.FilmLength), this, nameof(FilmLength));
Misc.BindingOperations.SetBinding(bDetect, nameof(bDetect.RollPerimeter), this, nameof(RollPerimeter));
Misc.BindingOperations.SetBinding(bDetect, nameof(bDetect.IsSignFilter), this, nameof(IsSignFilter));
Misc.BindingOperations.SetBinding(bDetect, nameof(bDetect.IsLackSignMode), this, nameof(IsLackSignMode));
Misc.BindingOperations.SetBinding(bDetect, nameof(bDetect.Is3D), this, nameof(Is3D));
Misc.BindingOperations.SetBinding(renZiJiaService, nameof(renZiJiaService.IsProbeRight), this, nameof(IsProbeRight));
Misc.BindingOperations.SetBinding(renZiJiaService, nameof(renZiJiaService.ChannelCnt), this, nameof(ChannelCnt));
Misc.BindingOperations.SetBinding(renZiJiaService, nameof(renZiJiaService.BPC), this, nameof(BPC));
Misc.BindingOperations.SetBinding(renZiJiaService, nameof(renZiJiaService.OrgBoltNo), this, nameof(OrgBoltNo));
......@@ -204,8 +211,82 @@ namespace FLY.Thick.BlowingScan.UI.Client
Misc.BindingOperations.SetBinding(renZiJiaService, nameof(renZiJiaService.SensorWidth), this, nameof(SensorWidth));
Misc.BindingOperations.SetBinding(renZiJiaService, nameof(renZiJiaService.SolveCnt), this, nameof(SolveCnt));
updateNo1InClock();
this.PropertyChanged += PgBlowingVm_PropertyChanged;
}
private void PgBlowingVm_PropertyChanged(object sender, PropertyChangedEventArgs e)
{
if ((e.PropertyName == nameof(No1InClock)) || (e.PropertyName == nameof(IsProbeRight)))
{
if (isSkipUpdate)
return;
isSkipUpdate = true;
updateOrgBoltNo();
isSkipUpdate = false;
}
else if (e.PropertyName == nameof(OrgBoltNo))
{
if (isSkipUpdate)
return;
isSkipUpdate = true;
updateNo1InClock();
isSkipUpdate = false;
}
}
bool isSkipUpdate = false;
void updateNo1InClock()
{
double orgBoltNo = OrgBoltNo;
if (orgBoltNo < 1 || orgBoltNo > NBolts)
orgBoltNo = 1;
int no1;
if (IsProbeRight)
{
no1 = (int)Math.Round(3 + 12 * (orgBoltNo - 1) / NBolts);
}
else
{
no1 = (int)Math.Round(9 + 12 * (orgBoltNo - 1) / NBolts);
}
if (no1 > 12)
no1 -= 12;
else if (no1 < 1)
no1 += 12;
No1InClock = no1;
}
void updateOrgBoltNo()
{
double no1 = No1InClock;
if (no1 < 1 || no1 > 12)
no1 = 3;
//平移,以3为0点
no1 -= 3;
if (no1 < 0)
no1 += 12;
int orgBoltNo;
if (IsProbeRight)
{
orgBoltNo = (int)Math.Round(NBolts * no1 / 12) + 1;
}
else
{
orgBoltNo = (int)Math.Round(NBolts * (no1 + 6) / 12) + 1;
}
if (orgBoltNo > NBolts)
orgBoltNo -= NBolts;
else if (orgBoltNo < 1)
orgBoltNo += NBolts;
OrgBoltNo = orgBoltNo;
}
void Download()
{
IsBufListLoading = true;
......@@ -268,6 +349,7 @@ namespace FLY.Thick.BlowingScan.UI.Client
renZiJiaService.BPC = this.BPC;
renZiJiaService.OrgBoltNo = this.OrgBoltNo;
renZiJiaService.IsUsedMap = this.IsUsedMap;
renZiJiaService.IsProbeRight = this.IsProbeRight;
renZiJiaService.Smooth = this.Smooth;
renZiJiaService.SensorWidth = this.SensorWidth;
......
......@@ -761,7 +761,10 @@ namespace FLY.Thick.BlowingScan.Server
/// 测厚仪类型, 追边 or 扫描
/// </summary>
public BlowingType BType { get; } = BlowingType.Scan;
/// <summary>
/// 测厚仪测量点位置方向:Left, Right (也就是三角形在左还是右)
/// </summary>
public bool IsProbeRight { get; set; } = true;
/// <summary>
/// 应用
/// </summary>
......@@ -2254,7 +2257,10 @@ namespace FLY.Thick.BlowingScan.Server
public BoltMapCell[] Map { get; set; }
/// <summary>
/// 测厚仪测量点位置方向:Left, Right (也就是三角形在左还是右)
/// </summary>
public bool IsProbeRight { get; set; } = true;
}
}
......
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