Commit c6524d3e authored by 潘栩锋's avatar 潘栩锋 :bicyclist:

1.添加 膜宽记录到数据库,显示界面

2.添加 追边通过修正 平移补偿,以目标值,或者称重的厚度值 为平均值
3.添加 风环根据膜宽 动态修改Kp
4.优化 风环点【清除】 为删除全部加热, 再次点【清除】 为取消
parent 181ce960
......@@ -130,9 +130,11 @@ namespace FLY.Blowing.DbViewer.Core
dataTable.Columns.Add(new DataColumn() { ColumnName = "旋转角度", DataType = typeof(double), Caption = "0.0" });
dataTable.Columns.Add(new DataColumn() { ColumnName = "膜距离(m)", DataType = typeof(double), Caption = "0.0" });
dataTable.Columns.Add(new DataColumn() { ColumnName = "线速度(m/min)", DataType = typeof(double), Caption = "0.0" });
dataTable.Columns.Add(new DataColumn() { ColumnName = "斜率补偿", DataType = typeof(double), Caption = "0.000" });
dataTable.Columns.Add(new DataColumn() { ColumnName = "膜宽(mm)", DataType = typeof(int), Caption = "0" });
dataTable.Columns.Add(new DataColumn() { ColumnName = "斜率补偿", DataType = typeof(double), Caption = "0.00" });
dataTable.Columns.Add(new DataColumn() { ColumnName = "平移补偿", DataType = typeof(double), Caption = "0.0" });
dataTable.Columns.Add(new DataColumn() { ColumnName = "平均值(um)", DataType = typeof(double), Caption = "0.00" });
dataTable.Columns.Add(new DataColumn() { ColumnName = "平均值(um)", DataType = typeof(double), Caption = "0.0" });
dataTable.Columns.Add(new DataColumn() { ColumnName = "2σ(%)", DataType = typeof(double), Caption = "0.0" });
for (int i = 0; i < boltCnt; i++)
......@@ -142,7 +144,7 @@ namespace FLY.Blowing.DbViewer.Core
dataTable.Columns.Add(new DataColumn() { ColumnName = "加热时间", DataType = typeof(double), Caption = "yyyy-MM-dd HH:mm:ss" });
for (int i = 0; i < channelCnt; i++)
dataTable.Columns.Add(new DataColumn() { ColumnName = $"加热棒{i + 1}", DataType = typeof(double), Caption = "0" });
dataTable.Columns.Add(new DataColumn() { ColumnName = $"加热棒{i + 1}", DataType = typeof(int), Caption = "0" });
CurrRowGrowUpReady();
for (int i = 0; i < profilePack.ThickHeats.Count(); i++)
......@@ -160,8 +162,9 @@ namespace FLY.Blowing.DbViewer.Core
dataRow["旋转角度"] = thickHeat.RAngle;
dataRow["膜距离(m)"] = thickHeat.FilmLength;
dataRow["线速度(m/min)"] = thickHeat.FilmVelocity;
dataRow["膜宽(mm)"] = thickHeat.FilmWidth;
dataRow["斜率补偿"] = thickHeat.K;
dataRow["平移补偿"] = thickHeat.B;
var avg = thickHeat.Thicks.AverageNoNull();
var sigma = thickHeat.Thicks.Sigma();
......
......@@ -30,8 +30,8 @@
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="auto"/>
<ColumnDefinition Width="400*"/>
<ColumnDefinition Width="280*"/>
<ColumnDefinition Width="auto"/>
<ColumnDefinition />
</Grid.ColumnDefinitions>
<lvc:CartesianChart Grid.Row="1" Grid.ColumnSpan="3" Height="150" Margin="5,2,2,2"
......@@ -59,7 +59,7 @@
<lvc:Separator Stroke="{StaticResource Brushes.AxisSeparator}" Step="5"/>
</lvc:Axis.Separator>
<lvc:Axis.Sections>
<lvc:AxisSection Style="{StaticResource AxisSectionStyle}" StrokeThickness="0" Stroke="{StaticResource Color_theme_activity}"
<lvc:AxisSection Style="{StaticResource AxisSectionStyle}" StrokeThickness="0" Stroke="{StaticResource Brushes.Activity}"
Value="{Binding OrgBoltNo}"
/>
</lvc:Axis.Sections>
......@@ -94,6 +94,7 @@
<iconPacks:PackIconMaterial Kind="ArrowCollapseRight" />
</Button>
</StackPanel>
<Grid Grid.Column="1" Grid.RowSpan="2" Panel.ZIndex="2"
VerticalAlignment="Top" HorizontalAlignment="Left" >
......@@ -146,6 +147,14 @@
<TextBlock Style="{StaticResource Text.FieldContent2}" Text="{Binding FilmLength,StringFormat={}{0:F1}}" />
<TextBlock Style="{StaticResource Text.FieldContentMm2}" Text="m"/>
</StackPanel>
<StackPanel Orientation="Horizontal" Background="{StaticResource Badges.Background}" Margin="{StaticResource Badges.Margin}">
<TextBlock Style="{StaticResource Text.FieldContent2}" Text="{Binding FilmWidth,StringFormat={}{0:F0}}" />
<TextBlock Style="{StaticResource Text.FieldContentMm2}" Text="mm"/>
</StackPanel>
<StackPanel Orientation="Horizontal" Background="{StaticResource Badges.Background}" Margin="{StaticResource Badges.Margin}">
<TextBlock Style="{StaticResource Text.FieldContent2}" Text="{Binding FilmVelocity,StringFormat={}{0:F1}}" />
<TextBlock Style="{StaticResource Text.FieldContentMm2}" Text="m/min"/>
</StackPanel>
<StackPanel Orientation="Horizontal" Background="{StaticResource Badges.Background}" Margin="{StaticResource Badges.Margin}">
<TextBlock Style="{StaticResource Text.FieldHeader2}" Text="加热时间:" />
<StackPanel Orientation="Horizontal">
......
......@@ -107,6 +107,8 @@ namespace FLY.FeedbackRenZiJia.UI.Client
/// </summary>
public double FilmLength { get; set; }
public double FilmVelocity { get; set; }
public int FilmWidth { get; set; }
/// <summary>
/// 旋转时间
/// </summary>
......@@ -225,8 +227,12 @@ namespace FLY.FeedbackRenZiJia.UI.Client
OrgBoltNo = frame.OrgBoltNo;
RAngle = frame.RAngle;
FilmLength = frame.FilmLength;
FilmWidth = frame.FilmWidth;
FilmVelocity = frame.FilmVelocity;
Average = frame.Thicks.AverageNoNull();
Sigma2Percent = frame.Thicks.Sigma() / Average * 2;
Heats.Clear();
Heats.AddRange(frame.Heats);
......
......@@ -87,6 +87,19 @@
</StackPanel>
</StackPanel>
</StackPanel >
<StackPanel Margin="{StaticResource ControlMargin}" >
<TextBlock Style="{StaticResource Styles.Text.FieldHeader.Editable}" Text="分级Kp"/>
<DataGrid AutoGenerateColumns="False" ItemsSource="{Binding LvKps}"
AlternationCount ="2" AlternatingRowBackground="{StaticResource MahApps.Brushes.Gray8}"
MinHeight="100" TextBlock.FontSize="18" TextBlock.FontWeight="Normal"
>
<DataGrid.Columns>
<DataGridTextColumn Header="膜泡折径mm" Binding="{Binding FilmWidth}" />
<DataGridTextColumn Header="Kp" Binding="{Binding Kp,StringFormat={}{0:#.#}}" />
</DataGrid.Columns>
</DataGrid>
</StackPanel>
</StackPanel>
</Border>
......@@ -187,17 +200,7 @@
</StackPanel >
</Border>
<Border Style="{StaticResource Styles.Card.Border}" >
<StackPanel>
<TextBlock Grid.Column="1" Style="{StaticResource Styles.Card.Title}" Text="分级控制"/>
<StackPanel>
<DataGrid AutoGenerateColumns="False" ItemsSource="{Binding LvCtrlLines}" MinWidth="204" MinHeight="100" TextBlock.FontSize="18" TextBlock.FontWeight="Normal">
<DataGrid.Columns>
<DataGridTextColumn Header="控制线%" Binding="{Binding CtrlLine}" Width="150"/>
<DataGridTextColumn Header="厚度混合数" Binding="{Binding Mix}" Width="150"/>
</DataGrid.Columns>
</DataGrid>
</StackPanel>
</StackPanel>
</Border>
<Border Style="{StaticResource Styles.Card.Border}">
......@@ -342,7 +345,19 @@
</StackPanel>
</StackPanel>
</StackPanel>
<StackPanel Margin="{StaticResource ControlMargin}" >
<TextBlock Style="{StaticResource Styles.Text.FieldHeader.Editable}" Text="分级控制"/>
<StackPanel>
<DataGrid AutoGenerateColumns="False" ItemsSource="{Binding LvCtrlLines}"
AlternationCount ="2" AlternatingRowBackground="{StaticResource MahApps.Brushes.Gray8}"
MinHeight="100" TextBlock.FontSize="18" TextBlock.FontWeight="Normal">
<DataGrid.Columns>
<DataGridTextColumn Header="控制线%" Binding="{Binding CtrlLine}" Width="150"/>
<DataGridTextColumn Header="厚度混合数" Binding="{Binding Mix}" Width="150"/>
</DataGrid.Columns>
</DataGrid>
</StackPanel>
</StackPanel>
</StackPanel>
</Border>
......
......@@ -108,6 +108,11 @@ namespace FLY.FeedbackRenZiJia.UI.Client
/// </summary>
public ObservableCollection<LvCtrlLine> LvCtrlLines { get; } = new ObservableCollection<LvCtrlLine>();
/// <summary>
/// 分级Kp
/// </summary>
public ObservableCollection<LvKp> LvKps { get; } = new ObservableCollection<LvKp>();
/// <summary>
/// 对厚度数据横向平滑 单位加热棒数。 特别的当Smooth = ChannelCnt/2 就是膜泡的偏心度
/// </summary>
......@@ -176,6 +181,20 @@ namespace FLY.FeedbackRenZiJia.UI.Client
LvCtrlLines.Add(new LvCtrlLine() { CtrlLine = lvCtrlLine.CtrlLine, Mix = lvCtrlLine.Mix });
}
});
Misc.BindingOperations.SetBinding(this.HeatCell, nameof(IHeatCellService.LvKps), () =>
{
LvKps.Clear();
if (this.HeatCell.LvKps == null)
return;
if (this.HeatCell.LvKps.Count() == 0)
return;
foreach (var lvKp in this.HeatCell.LvKps)
{
LvKps.Add(new LvKp() { Kp = lvKp.Kp, FilmWidth = lvKp.FilmWidth });
}
});
Misc.BindingOperations.SetBinding(this.HeatCell, nameof(IHeatCellService.ThickSmoothRange), this, nameof(ThickSmoothRange));
Misc.BindingOperations.SetBinding(this.HeatCell, nameof(IHeatCellService.CanBreakIn), this, nameof(CanBreakIn));
......@@ -278,6 +297,26 @@ namespace FLY.FeedbackRenZiJia.UI.Client
{
HeatCell.LvCtrlLines = null;
}
if (LvKps.Count() > 0)
{
var lvKps = LvKps.ToList();
//LvKps 需要从小膜泡到大膜泡排列
lvKps.Sort((lvk1, lvk2) =>
{
if (lvk1.FilmWidth < lvk2.FilmWidth) return -1;
else if (lvk1.FilmWidth == lvk2.FilmWidth) return 0;
else
return 1;
});
HeatCell.LvKps = lvKps.Select(k => (LvKp)k.Clone()).ToArray();
}
else
{
HeatCell.LvKps = null;
}
HeatCell.ThickSmoothRange = ThickSmoothRange;
HeatCell.CanBreakIn = this.CanBreakIn;
......
......@@ -53,7 +53,7 @@ namespace FLY.FeedbackRenZiJia.UI.Client.UiModule
{
this.container = container;
viewModel = new AirRingGraphVm();
viewModel.Init(feedback, heatBuf, heatCell, btnClearH, profileService);
viewModel.Init(feedback, heatBuf, heatCell, profileService);
this.DataContext = viewModel;
}
......
......@@ -89,7 +89,6 @@ namespace FLY.FeedbackRenZiJia.UI.Client.UiModule
IFeedbackHeatService mFeedback;
IHeatBufService mHeatBuf;
IHeatCellService mHeatCell;
Button btnClearH;
protected Brush BadsBrush;
protected Brush PreHeatsBrush;
FLY.Thick.Blowing.Common.BlowingFixProfileParam profileParam;
......@@ -178,7 +177,6 @@ namespace FLY.FeedbackRenZiJia.UI.Client.UiModule
IFeedbackHeatService feedback,
IHeatBufService heatBuf,
IHeatCellService heatCell,
Button button_clear_h,
FLY.Thick.Blowing.IService.IBlowingFixProfileService profileService )
{
//把 FeedbackHeat 共享。 1个程序,只能有一个 FeedbackHeat
......@@ -204,15 +202,6 @@ namespace FLY.FeedbackRenZiJia.UI.Client.UiModule
Misc.BindingOperations.SetBinding(mHeatCell, nameof(mHeatCell.Kp), this, nameof(Kp));
Misc.BindingOperations.SetBinding(mHeatCell, nameof(mHeatCell.CurrMix), this, nameof(CurrMix));
this.btnClearH = button_clear_h;
LPress.Init(btnClearH);
LPress.LongClick += (s, e) =>
{
mHeatCell.ClearPreHeats();
};
updateOffsetGraphRange();
}
......@@ -410,7 +399,7 @@ namespace FLY.FeedbackRenZiJia.UI.Client.UiModule
}
mFeedback.SaveHeats(txt);
FLY.ControlLibrary.Window_Tip.Show("加载成功",
FLY.ControlLibrary.Window_Tip.Show("保存成功",
txt,
TimeSpan.FromSeconds(2));
......@@ -419,7 +408,7 @@ namespace FLY.FeedbackRenZiJia.UI.Client.UiModule
private void Load()
{
WdLoadHeatsFile w = new WdLoadHeatsFile();
w.Owner = FLY.ControlLibrary.COMMON.GetWindow(btnClearH);
w.Owner = Application.Current.MainWindow;// FLY.ControlLibrary.COMMON.GetWindow(btnClearH);
w.Init(mFeedback);
w.ShowDialog();
}
......@@ -437,8 +426,15 @@ namespace FLY.FeedbackRenZiJia.UI.Client.UiModule
{
SelectBoltNo = -1;
SelectBoltNoWidth = 0;
if (!LPress.IsOK)
if (mHeatCell.Offsets.All(offset => offset == 0))
{
mHeatCell.ClearPreHeats();
}
else {
mHeatCell.ClearOffsets();
}
//if (!LPress.IsOK)
// mHeatCell.ClearOffsets();
}
protected void NotifyPropertyChanged(string propertyName) {
......
......@@ -59,6 +59,11 @@ namespace FLY.FeedbackRenZiJia.Client
/// </summary>
public LvCtrlLine[] LvCtrlLines { get; set; }
/// <summary>
/// 分级Kp
/// </summary>
public LvKp[] LvKps { get; set; }
/// <summary>
/// 对厚度数据横向平滑 单位加热棒数。 特别的当Smooth = ChannelCnt/2 就是膜泡的偏心度
/// </summary>
......
......@@ -49,6 +49,11 @@ namespace FLY.FeedbackRenZiJia.IService
/// </summary>
LvCtrlLine[] LvCtrlLines { get; set; }
/// <summary>
/// 分级Kp
/// </summary>
LvKp[] LvKps { get; set; }
/// <summary>
/// 对厚度数据横向平滑 单位加热棒数。 特别的当Smooth = ChannelCnt/2 就是膜泡的偏心度
/// </summary>
......@@ -157,4 +162,27 @@ namespace FLY.FeedbackRenZiJia.IService
public double CtrlLine { get; set; }
public int Mix { get; set; }
}
/// <summary>
/// 分级Kp
/// </summary>
public class LvKp : INotifyPropertyChanged, ICloneable
{
public event PropertyChangedEventHandler PropertyChanged;
/// <summary>
/// 比例增益
/// </summary>
public double Kp { get; set; }
/// <summary>
/// 膜泡大小
/// </summary>
public int FilmWidth { get; set; }
public object Clone()
{
return new LvKp() { Kp = Kp, FilmWidth = FilmWidth };
}
}
}
......@@ -568,7 +568,9 @@ namespace FLY.FeedbackRenZiJia.Server
scanData.RAngle,
scanData.FilmLength,
scanData.FilmVelocity,
scanData.FilmWidth,
scanData.K,
scanData.B,
scanData.Thicks,
scanData.Boltmap
);
......@@ -689,7 +691,7 @@ namespace FLY.FeedbackRenZiJia.Server
Lc_ThickHeat lastLcThickHeat=null;
void Add(DateTime time, DateTime endtime, bool isBackw, TimeSpan period, int rotateCnt,
int orgboltno, double rAngle, double filmLength, double filmVelocity, double K,
int orgboltno, double rAngle, double filmLength, double filmVelocity, int filmWidth, double K, double B,
double[] frame, List<Thick.Blowing.IService.BoltMapCell> boltMaps)
{
//1.求平均值
......@@ -727,7 +729,9 @@ namespace FLY.FeedbackRenZiJia.Server
RAngle = rAngle,
FilmLength = filmLength,
FilmVelocity = filmVelocity,
FilmWidth = filmWidth,
K = K,
B = B,
Thicks = frame,
Boltmap = boltMaps,
HTime = heat.Time,
......@@ -745,6 +749,11 @@ namespace FLY.FeedbackRenZiJia.Server
return;
}
//从膜宽,计算出Kp
double kp = mHeatCell.GetKpFromFilmWidth(filmWidth);
if (!double.IsNaN(kp))
mHeatCell.Kp = kp;
mHeatCell.SetThickPercents(mHeatBuf.ThickPercents, mHeatBuf.MixCnt);
if (IsAuto)//如果自控中!!!
......
......@@ -70,6 +70,11 @@ namespace FLY.FeedbackRenZiJia.Server
/// </summary>
public LvCtrlLine[] LvCtrlLines { get; set; }
/// <summary>
/// 分级Kp
/// </summary>
public LvKp[] LvKps { get; set; }
private int thickSmoothRange = 5;
/// <summary>
/// 对厚度数据横向平滑 单位加热棒数。 特别的当Smooth = ChannelCnt/2 就是膜泡的偏心度
......@@ -831,7 +836,51 @@ namespace FLY.FeedbackRenZiJia.Server
Offsets = offsets;
UpdatePreHeats();
}
public double GetKpFromFilmWidth(int filmWidth)
{
if (LvKps == null)
return double.NaN;
if (LvKps.Count() == 0)
return double.NaN;
//LvKps 需要从小膜泡到大膜泡排列
if (LvKps.Count() == 1)
return LvKps.First().Kp;
var lvKps = LvKps.ToList();
lvKps.Sort((lvk1, lvk2) =>
{
if (lvk1.FilmWidth < lvk2.FilmWidth) return -1;
else if (lvk1.FilmWidth == lvk2.FilmWidth) return 0;
else
return 1;
});
if (filmWidth <= lvKps.First().FilmWidth) return lvKps.First().Kp;
if (filmWidth >= lvKps.Last().FilmWidth) return lvKps.Last().Kp;
//中间,需要插值
for (int i = 1; i < lvKps.Count(); i++)
{
if (filmWidth <= lvKps[i].FilmWidth)
{
int filmWidth0 = lvKps[i - 1].FilmWidth;
int filmWidth1 = lvKps[i].FilmWidth;
double kp0 = lvKps[i - 1].Kp;
double kp1 = lvKps[i].Kp;
if (filmWidth0 == filmWidth1)
return kp0;
double kp = kp0 + (kp1 - kp0) * (filmWidth - filmWidth0) / (filmWidth1 - filmWidth0);
return Math.Round(kp, 1);
}
}
//异常
return double.NaN;
}
#region PreHeats 平滑处理
double[] GetHeatSigmas(int[] heats)
{
......@@ -1088,6 +1137,11 @@ namespace FLY.FeedbackRenZiJia.Server
/// </summary>
public LvCtrlLine[] LvCtrlLines;
/// <summary>
/// 分级Kp
/// </summary>
public LvKp[] LvKps;
/// <summary>
/// 对厚度数据横向平滑 单位加热棒数。 特别的当Smooth = ChannelCnt/2 就是膜泡的偏心度
/// </summary>
......
......@@ -78,33 +78,45 @@ namespace FLY.FeedbackRenZiJia.Server.Model
public double FilmVelocity { get; set; }
/// <summary>
/// 斜率补偿
/// 膜宽 mm
/// </summary>
[PropertyIndex(10)]
public int FilmWidth { get; set; }
/// <summary>
/// 斜率补偿
/// </summary>
[PropertyIndex(11)]
public double K { get; set; }
/// <summary>
/// 平移补偿
/// </summary>
[PropertyIndex(12)]
public double B { get; set; }
/// <summary>
/// 1幅数据
/// </summary>
[PropertyIndex(11)]
[PropertyIndex(13)]
public string Thicks { get; set; }
/// <summary>
/// 分区表
/// </summary>
[PropertyIndex(12)]
[PropertyIndex(14)]
public string Boltmap { get; set; }
/// <summary>
/// 加热生效
/// </summary>
[PropertyIndex(13)]
[PropertyIndex(15)]
public bool IsStable { get; set; }
/// <summary>
/// 开始改变加热时间
/// </summary>
[PropertyIndex(14)]
[PropertyIndex(16)]
public DateTime HTime { get; set; }
......@@ -112,7 +124,7 @@ namespace FLY.FeedbackRenZiJia.Server.Model
/// <summary>
/// 1幅加热数据 % json
/// </summary>
[PropertyIndex(15)]
[PropertyIndex(17)]
public string Heats { get; set; }
}
......
......@@ -60,11 +60,21 @@ namespace FLY.FeedbackRenZiJia.Server.Model
/// </summary>
public double FilmVelocity { get; set; }
/// <summary>
/// 膜宽 mm
/// </summary>
public int FilmWidth { get; set; }
/// <summary>
/// 斜率补偿
/// </summary>
public double K { get; set; }
/// <summary>
/// 平移补偿
/// </summary>
public double B { get; set; }
/// <summary>
/// 1幅数据
/// </summary>
......
......@@ -223,6 +223,10 @@
<TextBlock Style="{StaticResource Styles.Card.Title}" Text="旋转"/>
<TextBlock Style="{StaticResource Styles.Text.FieldHeader}" Text="以下设置修改后,都必须重启测厚仪服务器!!!" Foreground="{StaticResource Brushes.Validation}"/>
<StackPanel Orientation="Horizontal">
<StackPanel Margin="{StaticResource ControlMargin}" >
<TextBlock Style="{StaticResource Styles.Text.FieldHeader.Editable}" Text="自动修正平移补偿" />
<ToggleButton Style="{StaticResource Styles.ToggleButton.YESNO}" HorizontalAlignment="Left" IsChecked="{Binding IsAutoB}"/>
</StackPanel>
<StackPanel Margin="{StaticResource ControlMargin}" >
<TextBlock Style="{StaticResource Styles.Text.FieldHeader.Editable}" Text="正方向是顺时针方向" />
<ToggleButton Style="{StaticResource Styles.ToggleButton.YESNO}" HorizontalAlignment="Left" IsChecked="{Binding IsForwCW}"/>
......@@ -281,6 +285,7 @@
</StackPanel>
</StackPanel>
</StackPanel>
</StackPanel>
</StackPanel>
</Border>
......
......@@ -153,6 +153,11 @@ namespace FLY.Thick.Blowing.UI
/// </summary>
public bool IsForwCW { get; set; }
/// <summary>
/// 根据 真实厚度 自动调整B
/// </summary>
public bool IsAutoB { get; set; }
/// <summary>
/// 分区1号 对应时钟的位置 1 ~ 12
/// </summary>
......@@ -241,7 +246,10 @@ namespace FLY.Thick.Blowing.UI
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));
Misc.BindingOperations.SetBinding(renZiJiaService, nameof(renZiJiaService.IsUsedMap), this, nameof(IsUsedMap));
Misc.BindingOperations.SetBinding(renZiJiaService, nameof(renZiJiaService.IsAutoB), this, nameof(IsAutoB));
Misc.BindingOperations.SetBinding(renZiJiaService, nameof(renZiJiaService.IsUsedMap), this, nameof(IsUsedMap));
Misc.BindingOperations.SetBinding(renZiJiaService, nameof(renZiJiaService.Map), ()=> {
BoltMap.Clear();
if (renZiJiaService.Map != null)
......@@ -482,6 +490,7 @@ namespace FLY.Thick.Blowing.UI
renZiJiaService.IsUsedMap=this.IsUsedMap;
renZiJiaService.IsProbeRight = this.IsProbeRight;
renZiJiaService.IsForwCW = this.IsForwCW;
renZiJiaService.IsAutoB = this.IsAutoB;
renZiJiaService.Apply();
FLY.ControlLibrary.Window_Tip.Show("应用成功",
......
......@@ -281,6 +281,10 @@ namespace FLY.Thick.Blowing.UI
/// 默认情况 风环加热棒排列是逆时钟
/// </summary>
public bool IsForwCW { get; set; }
public double ActThick { get; set; }
public bool IsAutoB { get; set; }
public double LastThick { get; set; }
public event EventHandler DataEvent;
public event PropertyChangedEventHandler PropertyChanged;
......
......@@ -28,10 +28,10 @@ namespace FLY.Thick.Blowing.UI
}
[InjectionMethod]
public void Init(IBlowingFixProfileService profileService)
public void Init(IBlowingFixProfileService profileService, IBlowingService blowingService)
{
viewModel = new PgProfileBlowingVm();
viewModel.Init(profileService, listview_profile);
viewModel.Init(profileService, blowingService);
this.DataContext = viewModel;
}
}
......@@ -40,22 +40,33 @@ namespace FLY.Thick.Blowing.UI
{
public event PropertyChangedEventHandler PropertyChanged;
#region 参数
public ObservableCollection<string> ProfileList { get; } = new ObservableCollection<string>();
public BlowingFixProfileParam Param { get; } = new BlowingFixProfileParam();
#endregion
public string SelectedItem { get; set; }
public bool IsShowB { get; set; }
public bool IsShowFilmWidth { get; set; }
public bool IsShowAHelper { get; set; }
public double ActValue { get; set; }
public double ShowValue { get; set; }
#region Command
public RelayCommand ReadCmd { get; }
public RelayCommand ApplyCmd { get; }
public RelayCommand DelCmd { get; }
public RelayCommand ReadCmd { get; private set; }
public RelayCommand AhelperCmd { get; }
public RelayCommand ApplyCmd { get; private set; }
public RelayCommand DelCmd { get; private set; }
public RelayCommand AhelperCmd { get; private set; }
public RelayCommand CalACmd { get; private set; }
#endregion
IBlowingFixProfileService profileService;
ListBox listview_profile;
IBlowingService blowingService;
public PgProfileBlowingVm()
{
......@@ -63,29 +74,44 @@ namespace FLY.Thick.Blowing.UI
ApplyCmd = new RelayCommand(Apply);
DelCmd = new RelayCommand(Del);
AhelperCmd = new RelayCommand(Ahelper);
CalACmd = new RelayCommand(CalA);
}
public void Init(IBlowingFixProfileService profileService, ListBox listview_profile)
public void Init(IBlowingFixProfileService _profileService, IBlowingService _blowingService)
{
this.profileService = profileService;
this.listview_profile = listview_profile;
profileService = _profileService;
blowingService = _blowingService;
if (blowingService is IBlowingFixService)
{
var blowingFixService = blowingService as IBlowingFixService;
Misc.BindingOperations.SetBinding(blowingFixService, nameof(blowingFixService.IsAutoB), this, nameof(IsShowB));
IsShowFilmWidth = true;
}
else
{
IsShowB = false;
IsShowFilmWidth = false;
}
Param.Copy(this.profileService.Param);
this.profileService.GetList(
new AsyncCBHandler(
delegate (object AsyncState, object retData)
(object asyncContext, object retData) =>
{
List<string> list = (List<string>)retData;
ProfileList.Clear();
for (int i = 0; i < list.Count(); i++)
ProfileList.Add(list[i]);
if (ProfileList.Contains(Param.PName))
{
List<string> list = (List<string>)retData;
ProfileList.Clear();
for (int i = 0; i < list.Count(); i++)
ProfileList.Add(list[i]);
if (ProfileList.Contains(Param.PName))
{
this.listview_profile.SelectedItem = ProfileList.First(s => s == Param.PName);
}
}), null);
SelectedItem = Param.PName;
}
}, null);
this.profileService.Param.PropertyChanged += Param_PropertyChanged;
}
......@@ -97,13 +123,13 @@ namespace FLY.Thick.Blowing.UI
private void Read()
{
if (listview_profile.SelectedItem != null)
if (SelectedItem != null)
{
string productname = listview_profile.SelectedItem as string;
string productname = SelectedItem;
profileService.Read(
productname,
new AsyncCBHandler(
delegate (object AsyncState, object retData)
delegate (object asyncContext, object retData)
{
var p = (BlowingFixProfileParam)retData;
Misc.PropertiesManager.CopyTo(p, Param);
......@@ -113,6 +139,13 @@ namespace FLY.Thick.Blowing.UI
private void Apply()
{
//有效性检查
if (string.IsNullOrEmpty(Param.PName))
{
FLY.ControlLibrary.Window_WarningTip.Show("参数出错", "产品名称为空");
return;
}
//有效性检查
......@@ -128,6 +161,22 @@ namespace FLY.Thick.Blowing.UI
return;
}
if (Param.K <= 0.1)
{
FLY.ControlLibrary.Window_WarningTip.Show("参数出错", "斜率补偿≤0.1 异常");
return;
}
if (IsShowFilmWidth)
{
if (Param.FilmWidth <= 100)
{
FLY.ControlLibrary.Window_WarningTip.Show("参数出错", "膜宽小于≤100mm 异常");
return;
}
}
//输入密码
if (!WdPassword.Authorize("Profile"))
return;
......@@ -136,6 +185,8 @@ namespace FLY.Thick.Blowing.UI
{
ProfileList.Add(Param.PName);
}
SelectedItem = Param.PName;
FLY.ControlLibrary.Window_Tip.Show("应用 & 保存成功",
Param.PName,
TimeSpan.FromSeconds(2));
......@@ -144,32 +195,87 @@ namespace FLY.Thick.Blowing.UI
private void Del()
{
if (listview_profile.SelectedItem == null)
if (SelectedItem == null)
return;
//输入密码
if (!WdPassword.Authorize("Profile"))
return;
string productname = listview_profile.SelectedItem as string;
profileService.Del(productname);
ProfileList.Remove(productname);
FLY.ControlLibrary.Window_Tip.Show("删除成功",
productname,
TimeSpan.FromSeconds(2));
string productname = SelectedItem;
profileService.Del(productname);
ProfileList.Remove(productname);
FLY.ControlLibrary.Window_Tip.Show("删除成功",
productname,
TimeSpan.FromSeconds(2));
}
private void Ahelper()
{
//显示 校正助手
IsShowAHelper = !IsShowAHelper;
WdAHelper w = new WdAHelper();
if (IsShowAHelper)
{
//设置 显示值,与当前值
if (!double.IsNaN(blowingService.ActThick) && blowingService.ActThick > 10)
{
ActValue = blowingService.ActThick;
}
else
{
ActValue = Param.Target;
}
w.Init(Param.K);
w.Owner = FLY.ControlLibrary.COMMON.GetWindow(listview_profile);
if (w.ShowDialog() == true)
ShowValue = blowingService.LastThick;
}
}
private void CalA()
{
if (ActValue <= 0 || ShowValue <= 0)
{
Param.K = w.A;
FLY.ControlLibrary.Window_WarningTip.Show("计算出错", "真实值 或 显示值 小于 0um");
return;
}
else if (profileService.Param.K <= 0)
{
FLY.ControlLibrary.Window_WarningTip.Show("计算出错", "当前斜率补偿 ≤ 0");
return;
}
double innerValue;
if (IsShowB)
{
innerValue = (ShowValue - profileService.Param.B) / profileService.Param.K;
}
else {
innerValue = ShowValue / profileService.Param.K;
}
double k = ActValue / innerValue;
Param.K = Math.Round(k, 3);
Param.B = 0;
FLY.ControlLibrary.Window_Tip.Show("计算成功","",TimeSpan.FromSeconds(2));
IsShowAHelper = false;
}
}
public class PgProfileBlowingVmUt : PgProfileBlowingVm
{
public PgProfileBlowingVmUt()
{
ProfileList.Add("adsasdaq-qeasa");
ProfileList.Add("adsasdaq-qeas1");
ProfileList.Add("adsasdaq-qeas2");
ProfileList.Add("adsasdaq-qeas3");
ProfileList.Add("adsasdaq-qeas4");
Param.PName = "qweqwee11231";
}
}
}
......@@ -22,16 +22,28 @@
<Button Click="Border_Blowing_Click" Style="{StaticResource Styles.Button.Empty}" d:DataContext="{StaticResource viewModel}">
<StackPanel>
<Border Style="{StaticResource Styles.Module.Border}" >
<StackPanel Margin="2">
<Grid Margin="2">
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<StackPanel Orientation="Horizontal" Margin="2">
<TextBlock Text="线速度" Style="{StaticResource Styles.Module.Text.ItemHeader}" />
<TextBlock Text="速度" Style="{StaticResource Styles.Module.Text.ItemHeader}" />
<StackPanel Orientation="Horizontal" Margin="3,1" >
<TextBlock Style="{StaticResource Styles.Module.Text.ItemValue}"
Text="{Binding FilmVelocity, StringFormat={}{0:F1}}" />
<TextBlock Style="{StaticResource Styles.Module.Text.ItemValue.Unit}" Text="m/min" />
</StackPanel>
</StackPanel>
</StackPanel>
<StackPanel Grid.Column="1" Orientation="Horizontal" Margin="2">
<TextBlock Text="宽度" Style="{StaticResource Styles.Module.Text.ItemHeader}" />
<StackPanel Orientation="Horizontal" Margin="3,1" >
<TextBlock Style="{StaticResource Styles.Module.Text.ItemValue}"
Text="{Binding FilmWidth, StringFormat={}{0:F0}}" />
<TextBlock Style="{StaticResource Styles.Module.Text.ItemValue.Unit}" Text="mm" />
</StackPanel>
</StackPanel>
</Grid>
</Border>
<Border Style="{StaticResource Styles.Module.Border}" >
<Grid Margin="2">
......
......@@ -28,14 +28,12 @@ namespace FLY.Thick.Blowing.UI.UiModule
[InjectionMethod]
public void Init(
IUnityContainer container,
IBlowingService blowingFixService,
IBlowingDetectService blowingDetectService)
IUnityContainer container)
{
this.container = container;
viewModel = new DynAreaBlowingVm();
viewModel.Init(blowingFixService, blowingDetectService);
container.BuildUp(viewModel);
this.DataContext = viewModel;
}
......@@ -62,23 +60,29 @@ namespace FLY.Thick.Blowing.UI.UiModule
public TimeSpan PastTime { get; set; } = TimeSpan.FromMinutes(3.3);
public double FilmVelocity { get; set; } = 50.1;
public double FilmWidth { get; set; } = 1234;
IBlowingService blowingFixService;
IBlowingDetectService blowingDetectService;
ITDGageService tDGageService;
[InjectionMethod]
public void Init(
IBlowingService blowingFixService,
IBlowingDetectService blowingDetectService)
IBlowingService _blowingFixService,
IBlowingDetectService _blowingDetectService,
ITDGageService _tDGageService)
{
this.blowingFixService = blowingFixService;
this.blowingDetectService = blowingDetectService;
this.blowingFixService = _blowingFixService;
this.blowingDetectService = _blowingDetectService;
this.tDGageService = _tDGageService;
Misc.BindingOperations.SetBinding(this.blowingDetectService, nameof(IBlowingDetectService.RenZiJiaPeriod), this, nameof(RenZiJiaPeriod));
Misc.BindingOperations.SetBinding(this.blowingDetectService, nameof(IBlowingDetectService.PastTime), this, nameof(PastTime));
Misc.BindingOperations.SetBinding(this.blowingDetectService, nameof(IBlowingDetectService.FilmVelocity), this, nameof(FilmVelocity));
//FilmWidth
Misc.BindingOperations.SetBinding(this.blowingDetectService, nameof(IBlowingDetectService.Angle), this, nameof(Angle));
Misc.BindingOperations.SetBinding(this.tDGageService.DynArea, nameof(Base.Common.DynArea.Width), this, nameof(FilmWidth));
Misc.BindingOperations.SetBinding(this.blowingDetectService, nameof(IBlowingDetectService.Angle), updateIconAngle);
Misc.BindingOperations.SetBinding(this.blowingDetectService, nameof(IBlowingDetectService.Direction), updateIsCW);
......
......@@ -4,7 +4,6 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:FLY.Thick.Blowing.UI.UiModule"
xmlns:blowing_common="clr-namespace:FLY.Thick.Blowing.Common;assembly=FLY.Thick.Blowing"
mc:Ignorable="d" d:DesignWidth="250">
<UserControl.Resources>
<ResourceDictionary>
......@@ -12,10 +11,10 @@
<ResourceDictionary Source="pack://application:,,,/FLY.ControlLibrary;component/Themes/Dictionary_MyStyle.xaml"/>
<ResourceDictionary Source="pack://application:,,,/FLY.Thick.Base.UI;component/Converter/Dictionary_MyConv.xaml"/>
</ResourceDictionary.MergedDictionaries>
<blowing_common:BlowingFixProfileParam x:Key="profile_param" />
<local:DynAreaProfileVmUt x:Key="viewModel"/>
</ResourceDictionary>
</UserControl.Resources>
<Button Click="button_profile_click" Style="{StaticResource Styles.Button.Empty}" d:DataContext="{StaticResource profile_param}">
<Button Click="button_profile_click" Style="{StaticResource Styles.Button.Empty}" d:DataContext="{StaticResource viewModel}">
<Border Style="{StaticResource Styles.Module.Border}" Name="Border_Profile">
<StackPanel Margin="2">
<Grid Margin="2">
......@@ -28,14 +27,18 @@
</Grid>
<Grid Margin="2">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="182*" />
<ColumnDefinition Width="auto" />
<ColumnDefinition />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<StackPanel Orientation="Horizontal">
<TextBlock Style="{StaticResource Styles.Module.Text.ItemHeader}" Text="A" />
<TextBlock Style="{StaticResource Styles.Module.Text.ItemHeader}" Text="斜率" />
<TextBlock Style="{StaticResource Styles.Module.Text.ItemValue}" Text="{Binding K, StringFormat={}{0:F3}}" />
</StackPanel>
<StackPanel Orientation="Horizontal" Grid.Column="1" Visibility="{Binding IsShowB,Converter={StaticResource visbilityconv}}">
<TextBlock Style="{StaticResource Styles.Module.Text.ItemHeader}" Text="平移" />
<TextBlock Style="{StaticResource Styles.Module.Text.ItemValue}" Text="{Binding B, StringFormat={}{0:F1}}" />
</StackPanel>
</Grid>
</StackPanel>
</Border>
......
using FLY.Thick.Base.Common;
using FLY.Thick.Blowing.IService;
using MultiLayout.UiModule;
using System.ComponentModel;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Navigation;
......@@ -13,7 +15,8 @@ namespace FLY.Thick.Blowing.UI.UiModule
public partial class DynAreaProfile : UserControl
{
IUnityContainer container;
FLY.Thick.Blowing.IService.IBlowingFixProfileService profileService;
DynAreaProfileVm viewModel;
public DynAreaProfile()
{
InitializeComponent();
......@@ -22,13 +25,17 @@ namespace FLY.Thick.Blowing.UI.UiModule
[InjectionMethod]
public void Init(
IUnityContainer container,
FLY.Thick.Blowing.IService.IBlowingFixProfileService profileService
IUnityContainer _container,
IBlowingFixProfileService _profileService,
IBlowingService _blowingService
)
{
this.container = container;
this.profileService = profileService;
Border_Profile.DataContext = this.profileService.Param;
container = _container;
viewModel = new DynAreaProfileVm();
viewModel.Init(_profileService, _blowingService);
this.DataContext = viewModel;
}
private void button_profile_click(object sender, RoutedEventArgs e)
......@@ -39,7 +46,50 @@ namespace FLY.Thick.Blowing.UI.UiModule
}
}
public class DynAreaProfileVm : INotifyPropertyChanged
{
public event PropertyChangedEventHandler PropertyChanged;
public string PName { get; set; }
public double K { get; set; }
public double B { get; set; }
public bool IsShowB { get; set; }
IBlowingFixProfileService profileService;
IBlowingService blowingService;
public void Init(
IBlowingFixProfileService _profileService,
IBlowingService _blowingService)
{
profileService = _profileService;
blowingService = _blowingService;
if (blowingService is IBlowingFixService)
{
var blowingFixService = blowingService as IBlowingFixService;
Misc.BindingOperations.SetBinding(blowingFixService, nameof(blowingFixService.IsAutoB), this, nameof(IsShowB));
}
else {
IsShowB = false;
}
Misc.BindingOperations.SetBinding(profileService.Param, nameof(profileService.Param.K), this, nameof(K));
Misc.BindingOperations.SetBinding(profileService.Param, nameof(profileService.Param.B), this, nameof(B));
Misc.BindingOperations.SetBinding(profileService.Param, nameof(profileService.Param.PName), this, nameof(PName));
}
}
public class DynAreaProfileVmUt : DynAreaProfileVm
{
public DynAreaProfileVmUt() {
PName = "abcdefg";
K = 0.64;
B = 3.4;
IsShowB = true;
}
}
public class UiModule2_DynAreaProfile : IUiModule2
{
/// <summary>
......
......@@ -22,13 +22,18 @@
<RowDefinition />
<RowDefinition Height="auto" />
</Grid.RowDefinitions>
<Border Background="{StaticResource Brushes.Activity}" CornerRadius="3" Height="130" >
<Border Background="{StaticResource Brushes.Activity}" CornerRadius="3" Height="130" >
<Grid>
<Viewbox Margin="10">
<TextBlock Style="{StaticResource Styles.Module.Text.ItemValue}"
<Viewbox Margin="{StaticResource ControlMargin}">
<StackPanel Orientation="Horizontal">
<TextBlock Style="{StaticResource Styles.Module.Text.ItemValue}"
Foreground="{StaticResource Brushes.TitleBar.Foreground}"
Text="{Binding Thk,StringFormat={}{0:F1}}" />
<TextBlock Style="{StaticResource Styles.Module.Text.ItemValue.Unit}"
Foreground="{StaticResource Brushes.TitleBar.Foreground}"
TextAlignment="Center" HorizontalAlignment="Center" VerticalAlignment="Center"
Text="{Binding Thk,StringFormat={}{0:F2}}" />
Text="um" />
</StackPanel>
</Viewbox>
<TextBlock Style="{StaticResource Styles.Module.Text.ItemValue.Unit}"
Foreground="{StaticResource Brushes.TitleBar.Foreground}"
......
......@@ -141,6 +141,24 @@
Text="min/R" />
</StackPanel>
</StackPanel>
<StackPanel Orientation="Horizontal" Background="#99FFFFFF">
<StackPanel Orientation="Horizontal" Margin="5,0">
<TextBlock Style="{StaticResource ValueStyle}"
Text="{Binding FilmVelocity,StringFormat={}{0:F1}}"
/>
<TextBlock Style="{StaticResource TitleStyle}" Width="auto" VerticalAlignment="Bottom"
Text="m/min" />
</StackPanel>
</StackPanel>
<StackPanel Orientation="Horizontal" Background="#99FFFFFF">
<StackPanel Orientation="Horizontal" Margin="5,0">
<TextBlock Style="{StaticResource ValueStyle}"
Text="{Binding FilmWidth}"
/>
<TextBlock Style="{StaticResource TitleStyle}" Width="auto" VerticalAlignment="Bottom"
Text="mm" />
</StackPanel>
</StackPanel>
</StackPanel>
</Viewbox>
</StackPanel>
......
......@@ -86,24 +86,31 @@ namespace FLY.Thick.Blowing.UI.UiModule
/// <summary>
/// 测量时间
/// </summary>
public DateTime Time { get; private set; }
public DateTime Time { get; protected set; }
/// <summary>
/// 测量结束时间
/// </summary>
public DateTime EndTime { get; private set; }
public DateTime EndTime { get; protected set; }
/// <summary>
/// 旋转方向 是反向
/// </summary>
public bool IsBackw { get; private set; }
public bool IsBackw { get; protected set; }
/// <summary>
/// 旋转1周的时间
/// </summary>
public TimeSpan RPeriod { get; private set; }
public TimeSpan RPeriod { get; protected set; }
/// <summary>
/// 膜宽 mm
/// </summary>
public int FilmWidth { get; protected set; }
/// <summary>
/// 生产速度 m/min
/// </summary>
public double FilmVelocity { get; protected set; }
/// <summary>
/// 数据库中的序号
/// </summary>
......@@ -532,7 +539,8 @@ namespace FLY.Thick.Blowing.UI.UiModule
}
}
protected void UpdateAverage() {
protected void UpdateAverage()
{
if (this.scanData == null)
{
Time = DateTime.MinValue;
......@@ -549,6 +557,8 @@ namespace FLY.Thick.Blowing.UI.UiModule
OrgBoltNo = this.scanData.OrgBoltNo;
IsBackw = this.scanData.IsBackw;
RPeriod = this.scanData.RPeriod;
FilmVelocity = this.scanData.FilmVelocity;
FilmWidth = this.scanData.FilmWidth;
}
double[] values = this.scanData.Thicks;
......
......@@ -60,7 +60,8 @@ namespace FLY.Thick.Blowing.UI.UiModule
OrgBoltNo = 41,
RAngle = 355,
RCnt = 6,
RPeriod = TimeSpan.FromMinutes(6.7)
RPeriod = TimeSpan.FromMinutes(6.7),
FilmWidth = 1302
};
#endregion
......
......@@ -145,7 +145,24 @@
Text="min/R" />
</StackPanel>
</StackPanel>
<StackPanel Orientation="Horizontal" Background="#99FFFFFF">
<StackPanel Orientation="Horizontal" Margin="5,0">
<TextBlock Style="{StaticResource ValueStyle}"
Text="{Binding FilmVelocity,StringFormat={}{0:F1}}"
/>
<TextBlock Style="{StaticResource TitleStyle}" Width="auto" VerticalAlignment="Bottom"
Text="m/min" />
</StackPanel>
</StackPanel>
<StackPanel Orientation="Horizontal" Background="#99FFFFFF">
<StackPanel Orientation="Horizontal" Margin="5,0">
<TextBlock Style="{StaticResource ValueStyle}"
Text="{Binding FilmWidth}"
/>
<TextBlock Style="{StaticResource TitleStyle}" Width="auto" VerticalAlignment="Bottom"
Text="mm" />
</StackPanel>
</StackPanel>
</StackPanel>
</Viewbox>
</StackPanel>
......
......@@ -115,6 +115,14 @@ namespace FLY.Thick.Blowing.UI.UiModule
/// </summary>
public TimeSpan RPeriod { get; private set; }
/// <summary>
/// 膜宽 mm
/// </summary>
public int FilmWidth { get; protected set; }
/// <summary>
/// 生产速度 m/min
/// </summary>
public double FilmVelocity { get; protected set; }
/// <summary>
/// 数据库中的序号
/// </summary>
public long Id { get; private set; } = 1231221;
......@@ -661,6 +669,8 @@ namespace FLY.Thick.Blowing.UI.UiModule
OrgBoltNo = this.scanData.OrgBoltNo;
IsBackw = this.scanData.IsBackw;
RPeriod = this.scanData.RPeriod;
FilmVelocity = this.scanData.FilmVelocity;
FilmWidth = this.scanData.FilmWidth;
}
double[] values = this.scanData.Thicks;
......
......@@ -57,9 +57,16 @@ namespace FLY.Thick.Blowing.UI.UiModule
{
Time = DateTime.Now.AddSeconds(-60),
EndTime = DateTime.Now.AddSeconds(-30),
ID = 1234567,
K = 2,
Thicks = datas
Thicks = datas,
IsBackw = false,
FilmLength = 23.3,
FilmVelocity = 53.1,
OrgBoltNo = 41,
RAngle = 355,
RCnt = 6,
RPeriod = TimeSpan.FromMinutes(6.7),
FilmWidth = 1302
};
BulkDbTempFrameChangedEventArgs e = new BulkDbTempFrameChangedEventArgs()
{
......
......@@ -113,9 +113,23 @@
</StackPanel>
</StackPanel>
<StackPanel Orientation="Horizontal" Margin="5,0" >
<TextBlock Style="{StaticResource TitleStyle}" Text="混合:" />
<TextBlock Style="{StaticResource ValueStyle}" Text="{Binding Mix}" Background="#99FFFFFF"/>
<StackPanel Orientation="Horizontal" Background="#99FFFFFF">
<StackPanel Orientation="Horizontal" Margin="5,0">
<TextBlock Style="{StaticResource ValueStyle}"
Text="{Binding FilmVelocity,StringFormat={}{0:F1}}"
/>
<TextBlock Style="{StaticResource TitleStyle}" Width="auto" VerticalAlignment="Bottom"
Text="m/min" />
</StackPanel>
</StackPanel>
<StackPanel Orientation="Horizontal" Background="#99FFFFFF">
<StackPanel Orientation="Horizontal" Margin="5,0">
<TextBlock Style="{StaticResource ValueStyle}"
Text="{Binding FilmWidth}"
/>
<TextBlock Style="{StaticResource TitleStyle}" Width="auto" VerticalAlignment="Bottom"
Text="mm" />
</StackPanel>
</StackPanel>
</StackPanel>
</StackPanel>
......
......@@ -72,6 +72,14 @@ namespace FLY.Thick.Blowing.UI.UiModule
/// </summary>
public TimeSpan RPeriod { get; private set; }
/// <summary>
/// 膜宽 mm
/// </summary>
public int FilmWidth { get; protected set; }
/// <summary>
/// 生产速度 m/min
/// </summary>
public double FilmVelocity { get; protected set; }
/// <summary>
/// 数据库中的序号
......@@ -361,6 +369,8 @@ namespace FLY.Thick.Blowing.UI.UiModule
OrgBoltNo = this.scanData.OrgBoltNo;
IsBackw = this.scanData.IsBackw;
RPeriod = this.scanData.RPeriod;
FilmVelocity = this.scanData.FilmVelocity;
FilmWidth = this.scanData.FilmWidth;
}
double[] values = this.scanData.Thicks;
......
......@@ -103,7 +103,7 @@
</lvc:Axis>
</lvc:CartesianChart.AxisX>
<lvc:CartesianChart.AxisY>
<lvc:Axis LabelFormatter="{Binding YFormatter2}" Foreground="{StaticResource Brushes.ChartAxisLabel}" MinRange="1"
<lvc:Axis LabelFormatter="{Binding YFormatter2}" Foreground="{StaticResource Brushes.ChartAxisLabel}" MinRange="10"
FontFamily="Courier New" >
<lvc:Axis.Separator>
<lvc:Separator Stroke="{StaticResource Brushes.ChartSeparator}" />
......
......@@ -114,7 +114,7 @@
</lvc:Axis>
</lvc:CartesianChart.AxisX>
<lvc:CartesianChart.AxisY>
<lvc:Axis LabelFormatter="{Binding YFormatter2}" Foreground="{StaticResource Brushes.ChartAxisLabel}" MinRange="1"
<lvc:Axis LabelFormatter="{Binding YFormatter2}" Foreground="{StaticResource Brushes.ChartAxisLabel}" MinRange="10"
FontFamily="Courier New" >
<lvc:Axis.Separator>
<lvc:Separator Stroke="{StaticResource Brushes.ChartSeparator}" />
......
......@@ -16,13 +16,17 @@ namespace FLY.Thick.Blowing.Client
protected override Type InterfaceType => typeof(IBlowingFixService);
/// <summary>
/// 根据 真实厚度 自动调整KB
/// </summary>
public bool IsAutoB { get; set; }
public BlowingFixServiceClient(UInt32 serverid) : base(serverid) { }
public BlowingFixServiceClient(UInt32 serviceId, string connName) : base(serviceId, connName) { }
#region 功能
/// <summary>
......
......@@ -64,6 +64,16 @@ namespace FLY.Thick.Blowing.Client
/// 默认情况 风环加热棒排列是逆时钟
/// </summary>
public bool IsForwCW { get; set; }
/// <summary>
/// 真实厚度 um 给第3方设置用
/// </summary>
public double ActThick { get; set; }
/// <summary>
/// 最后一次扫描均值 um
/// </summary>
public double LastThick { get; set; }
#endregion
/// <summary>
......
......@@ -19,14 +19,17 @@ namespace FLY.Thick.Blowing.Common
/// 产品名称
/// </summary>
public string PName { get; set; }= "pname";
/// <summary>
/// 订单号
/// </summary>
public string OrderNo { get; set; } = "00000001";
/// <summary>
/// 卷号
/// </summary>
public string Number { get; set; } = "1";
/// <summary>
/// 目标值
/// </summary>
......@@ -34,6 +37,7 @@ namespace FLY.Thick.Blowing.Common
/// <summary>
/// 公差%
/// TolerancePercent = 0.03 就是 3%
/// </summary>
public double TolerancePercent { get; set; } = 0.03;
......@@ -42,7 +46,16 @@ namespace FLY.Thick.Blowing.Common
/// </summary>
public double K { get; set; } = 1;
/// <summary>
/// 平移补偿
/// </summary>
public double B { get; set; } = 0;
/// <summary>
/// <para>膜宽 mm </para>
/// <para>用于风环 Kp</para>
/// </summary>
public int FilmWidth { get; set; }
#endregion
public event PropertyChangedEventHandler PropertyChanged;
......@@ -59,19 +72,4 @@ namespace FLY.Thick.Blowing.Common
Misc.PropertiesManager.CopyTo(src, this);
}
}
/// <summary>
/// 测量模式
/// </summary>
public enum MeasureMode
{
/// <summary>
/// 不解方程,探头距离膜边 0mm
/// </summary>
Edge,
/// <summary>
/// 一般模型,探头测双层
/// </summary>
Normal
}
}
......@@ -78,14 +78,9 @@
<Compile Include="Server\Model\DbModel.cs" />
<Compile Include="Server\Model\DbTable.cs" />
<Compile Include="Server\Model\Lc_AutoMapperProfile.cs" />
<Compile Include="Server\Model\OrgHistoryDb.cs" />
<Compile Include="Server\Model\OrgLc_AutoMapperProfile.cs" />
<Compile Include="Server\Model\OrgLcTable.cs" />
<Compile Include="Server\Model\OrgDbTable.cs" />
<Compile Include="Server\Model\HistoryDb.cs" />
<Compile Include="Server\Model\LcTable.cs" />
<Compile Include="Server\Model\LocalDb.cs" />
<Compile Include="Server\Model\OrgDbModel.cs" />
<Compile Include="Server\ScanWarning.cs" />
<Compile Include="Server\TDGage.cs" />
<Compile Include="Server\ThickPlcModbusTcpServer.cs" />
......
......@@ -13,6 +13,11 @@ namespace FLY.Thick.Blowing.IService
/// </summary>
public interface IBlowingFixService : IBlowingService
{
/// <summary>
/// 根据 真实厚度 自动调整B
/// </summary>
bool IsAutoB { get; set; }
#region 功能
/// <summary>
......
......@@ -60,6 +60,15 @@ namespace FLY.Thick.Blowing.IService
/// </summary>
BlowingType BType { get; }
/// <summary>
/// 真实厚度 um 给第3方设置用
/// </summary>
double ActThick { get; set; }
/// <summary>
/// 最后一圈数据均值 um
/// </summary>
double LastThick { get; }
/// <summary>
/// 参数应用
/// </summary>
......@@ -140,15 +149,25 @@ namespace FLY.Thick.Blowing.IService
public double FilmLength { get; set; }
/// <summary>
/// 线速度
/// 线速度 m/min
/// </summary>
public double FilmVelocity { get; set; }
/// <summary>
/// 膜宽度 mm
/// </summary>
public int FilmWidth { get; set; }
/// <summary>
/// 斜率补偿
/// </summary>
public double K { get; set; } = 1;
/// <summary>
/// 平移补偿
/// </summary>
public double B { get; set; } = 0;
/// <summary>
/// 1幅数据
/// </summary>
......@@ -184,6 +203,114 @@ namespace FLY.Thick.Blowing.IService
return new BoltMapCell() { NewNo = NewNo, OldNo = OldNo };
}
}
public static class BoltMapCellExt
{
/// <summary>
/// 检测通过,返回true
/// </summary>
/// <returns></returns>
public static bool IsValid(this BoltMapCell[] mapCells, int NBolts)
{
bool map_err = false;
bool g_o = false;
bool g_n = false;
if (mapCells == null)
return true;
//Map 检测
//OldNo,NewNo不能 <1 >NBolts
//Map OldNo 必须从小到大环形排列
//Map NewNo 必须从小到大环形排列
for (int i = 0; i < mapCells.Count(); i++)
{
var mapCell = mapCells[i];
if (mapCell.NewNo < 1 || mapCell.NewNo > NBolts)
{
map_err = true;
break;
}
if (mapCell.OldNo < 1 || mapCell.OldNo > NBolts)
{
map_err = true;
break;
}
int i_next = i + 1;
if (i_next >= mapCells.Count())
i_next = 0;
var mapCell_next = mapCells[i_next];
if (mapCell.OldNo >= mapCell_next.OldNo)
{
if (!g_o)
g_o = true;
else
{
map_err = true;
break;
}
}
if (mapCell.NewNo >= mapCell_next.NewNo)
{
if (!g_n)
g_n = true;
else
{
map_err = true;
break;
}
}
}
if (map_err)
{
return false;
}
else
{
return true;
}
}
public static bool IsEquals(this BoltMapCell c1, BoltMapCell c2)
{
if (c1 == c2)
{
return true;
}
if (c1 == null && c2 != null)
return false;
if (c1 != null && c2 == null)
return false;
if (c1.NewNo != c2.NewNo)
return false;
if (c1.OldNo != c2.OldNo)
return false;
return true;
}
public static bool IsEquals(this BoltMapCell[] mapCells1, BoltMapCell[] mapCells2)
{
if (mapCells1 == mapCells2)
return true;
if (mapCells1 == null && mapCells2 != null)
return false;
if (mapCells1 != null && mapCells2 == null)
return false;
if (mapCells1.Count() != mapCells2.Count())
return false;
//mapCells1 与 mapCells2 肯定都不是 null 且数量一样
for (int i = 0; i < mapCells1.Count(); i++)
{
var c1 = mapCells1[i];
var c2 = mapCells2[i];
if (!IsEquals(c1, c2))
return false;
}
return true;
}
}
}
......@@ -134,27 +134,39 @@ namespace FLY.Thick.Blowing.Server.Model
public double FilmLength { get; set; }
/// <summary>
/// 线速度
/// 线速度 m/min
/// </summary>
[PropertyIndex(9)]
public double FilmVelocity { get; set; }
/// <summary>
/// 膜宽 mm
/// </summary>
[PropertyIndex(11)]
public int FilmWidth { get; set; }
/// <summary>
/// 斜率补偿
/// </summary>
[PropertyIndex(10)]
[PropertyIndex(12)]
public double K { get; set; }
/// <summary>
/// 平移补偿
/// </summary>
[PropertyIndex(13)]
public double B { get; set; }
/// <summary>
/// 1幅数据
/// </summary>
[PropertyIndex(11)]
[PropertyIndex(14)]
public string Thicks { get; set; }
/// <summary>
/// 分区表
/// </summary>
[PropertyIndex(12)]
[PropertyIndex(15)]
public string Boltmap { get; set; }
}
......
......@@ -55,14 +55,25 @@ namespace FLY.Thick.Blowing.Server.Model
public double FilmLength { get; set; }
/// <summary>
/// 线速度
/// 线速度 m/min
/// </summary>
public double FilmVelocity { get; set; }
/// <summary>
/// 膜宽 mm
/// </summary>
public int FilmWidth { get; set; }
/// <summary>
/// 斜率补偿
/// </summary>
public double K { get; set; }
/// <summary>
/// 平移补偿
/// </summary>
public double B { get; set; }
/// <summary>
/// 1幅数据
/// </summary>
......
using SQLite;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace FLY.Thick.Blowing.Server.Model
{
/// <summary>
/// 原始数据.数据库 对象
/// </summary>
public class OrgDbModel : SQLiteDbContext
{
/// <summary>
/// Sign 表对象
/// </summary>
public DBTable<Db_Sign> TbSign { get; } = new DBTable<Db_Sign>();
/// <summary>
/// Roll 表对象
/// </summary>
public DBTable<Db_Roll> TbRoll { get; } = new DBTable<Db_Roll>();
/// <summary>
///
/// </summary>
/// <param name="dbpath"></param>
public OrgDbModel(string dbpath) : base(dbpath)
{
}
/// <summary>
///
/// </summary>
public OrgDbModel() : this(@"D:\blowingdata\thickness_fix_org.sqlite3")
{
}
}
}
using SQLite;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace FLY.Thick.Blowing.Server.Model
{
/// <summary>
/// 信号记录
/// </summary>
[Table("Sign")]
public class Db_Sign
{
/// <summary>
/// key
/// </summary>
[Key]
[PropertyIndex(0)]
public Int64 ID { get; set; }
/// <summary>
/// 信号时间
/// </summary>
[PropertyIndex(1)]
public DateTime Time { get; set; }
/// <summary>
/// 信号列表 SignData[]
/// </summary>
[PropertyIndex(2)]
public string Signs { get; set; }
}
/// <summary>
/// 辊信号记录
/// </summary>
[Table("Roll")]
public class Db_Roll
{
/// <summary>
/// key
/// </summary>
[Key]
[PropertyIndex(0)]
public Int64 ID { get; set; }
/// <summary>
/// 开始时间
/// </summary>
[PropertyIndex(1)]
public DateTime Time { get; set; }
/// <summary>
/// 信号列表 RollCell[]
/// </summary>
[PropertyIndex(2)]
public string Signs { get; set; }
}
}
using SQLite;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace FLY.Thick.Blowing.Server.Model
{
/// <summary>
/// 原始数据库 写操作
/// </summary>
public class OrgHistoryDb
{
OrgDbModel orgDbModel;
/// <summary>
///
/// </summary>
/// <param name="orgDBModel"></param>
public void Init(OrgDbModel orgDBModel)
{
this.orgDbModel = orgDBModel;
}
/// <summary>
/// 按时间删除原始数据库
/// </summary>
/// <param name="day"></param>
public void KeepDbSize(int day)
{
if (day <= 2)
day = 2;
DateTime del_time = DateTime.Now - TimeSpan.FromDays(day);
string det_time_str = del_time.ToStringOfSQLiteFieldType();
List<string> sqls = new List<string>();
sqls.Add(
$"DELETE FROM {orgDbModel.TbSign.TableName}" +
$" WHERE Time < {det_time_str}");
sqls.Add(
$"DELETE FROM {orgDbModel.TbRoll.TableName}" +
$" WHERE Time < {det_time_str}");
orgDbModel.sqliteHelper.QueryTran(sqls);
}
/// <summary>
/// 记录 原始数据.转向信号
/// </summary>
/// <param name="lc_Sign"></param>
public void AddSignData(
Lc_Sign lc_Sign
)
{
lc_Sign.ID = orgDbModel.TbSign.FreeID;
//SQLs
List<string> sqls = new List<string>();
var db_Sign = OrgLc_AutoMapperProfile.Mapper.Map<Db_Sign>(lc_Sign);
sqls.Add(SQLiteHelper.GetInsertCommandText(db_Sign));
orgDbModel.sqliteHelper.QueryTranAsync(sqls);
}
/// <summary>
/// 记录 原始数据.辊信号
/// </summary>
/// <param name="lc_Roll"></param>
public void AddRollData(
Lc_Roll lc_Roll
)
{
lc_Roll.ID = orgDbModel.TbRoll.FreeID;
//SQLs
List<string> sqls = new List<string>();
var db_Roll = OrgLc_AutoMapperProfile.Mapper.Map<Db_Roll>(lc_Roll);
sqls.Add(SQLiteHelper.GetInsertCommandText(db_Roll));
orgDbModel.sqliteHelper.QueryTranAsync(sqls);
}
}
}
using FLY.Thick.Blowing.IService;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace FLY.Thick.Blowing.Server.Model
{
/// <summary>
/// 信号记录
/// </summary>
public class Lc_Sign
{
/// <summary>
/// key
/// </summary>
public Int64 ID { get; set; }
/// <summary>
/// 信号时间
/// </summary>
public DateTime Time { get; set; }
/// <summary>
/// 信号列表 SignData[]
/// </summary>
public SignData[] Signs { get; set; }
}
/// <summary>
/// 辊信号记录
/// </summary>
public class Lc_Roll
{
/// <summary>
/// key
/// </summary>
public Int64 ID { get; set; }
/// <summary>
/// 开始时间
/// </summary>
public DateTime Time { get; set; }
/// <summary>
/// 信号列表 RollCell[]
/// </summary>
public RollCell[] Signs { get; set; }
}
}
using FLY.Thick.Blowing.IService;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace FLY.Thick.Blowing.Server.Model
{
/// <summary>
/// LC 与 DB 类的映射关系, 会在程序入口处, 手动使用
/// var assemblies = System.AppDomain.CurrentDomain.GetAssemblies();
/// var cfg = new MapperConfigurationExpression();
/// cfg.AddMaps(assemblies);
/// Mapper.Initialize(cfg);
///
/// 枚举全部程序集 中的AutoMapper.Profile 全部加载!!!
/// </summary>
public class OrgLc_AutoMapperProfile : AutoMapper.Profile
{
/// <summary>
///
/// </summary>
public static AutoMapper.IMapper Mapper;
static OrgLc_AutoMapperProfile()
{
var cfg = new AutoMapper.Configuration.MapperConfigurationExpression();
cfg.AddProfile<OrgLc_AutoMapperProfile>();
AutoMapper.MapperConfiguration config = new AutoMapper.MapperConfiguration(cfg);
Mapper = new AutoMapper.Mapper(config);
}
/// <summary>
///
/// </summary>
public OrgLc_AutoMapperProfile()
{
CreateMap<Lc_Roll, Db_Roll>()
.ForMember(s => s.Signs, opt =>
{
opt.MapFrom(s => Newtonsoft.Json.JsonConvert.SerializeObject(s.Signs));
})
.ReverseMap()
.ForMember(s => s.Signs, opt =>
{
opt.MapFrom(s => Newtonsoft.Json.JsonConvert.DeserializeObject<RollCell[]>(s.Signs));
});
CreateMap<Lc_Sign, Db_Sign>()
.ForMember(s => s.Signs, opt =>
{
opt.MapFrom(s => Newtonsoft.Json.JsonConvert.SerializeObject(s.Signs));
})
.ReverseMap()
.ForMember(s => s.Signs, opt =>
{
opt.MapFrom(s => Newtonsoft.Json.JsonConvert.DeserializeObject<SignData[]>(s.Signs));
});
}
}
}
......@@ -249,7 +249,8 @@ namespace FLY.Thick.Blowing.Server
//GM_RenZiJiaFix 配置----------------------------------------
gmRenZiJiaFix.Init(flyAd, Ad2Thk, dynArea, profile.Param, historyDb, bulkDb);
gmRenZiJiaFix.Init(flyAd, Ad2Thk, dynArea, profile, historyDb, bulkDb);
gmManager.AddGM(gmRenZiJiaFix);
......@@ -261,20 +262,7 @@ namespace FLY.Thick.Blowing.Server
#endregion
}
//void mGMRenZiJiaFix_EPCSampled(int ad)
//{
// CurveCollection pCurve = curve;
// dynArea.SampleAD[0] = ad;
// List<CurveCollection.ExChange> list = new List<CurveCollection.ExChange>();
// if (pCurve.Curves.Count == 0)
// return;
// list.Add(new CurveCollection.ExChange() { OrgAD = pCurve.Curves[0].AD, CurrAD = ad });
// pCurve.ModifyExChange(list);
// pCurve.ReviseCurve();
//}
#region 异常检测
class ErrNoForCheckItem
{
......@@ -419,6 +407,11 @@ namespace FLY.Thick.Blowing.Server
thk = curve.AD2Value(ad, AD2ValueFlag.Revised);
thk *= profile.Param.K;
if (gmRenZiJiaFix.IsAutoB)
{
thk += profile.Param.B;
}
}
return thk;
}
......
......@@ -281,6 +281,8 @@ namespace FLY.Thick.BlowingScan.UI.Client
/// </summary>
public bool IsForwCW { get; set; }
public double ActThick { get; set; }
public double LastThick { get; set; }
public BlowingType BType { get; set; }
public bool IsUsedEncoder { get; set; }
......
using FLY.Thick.Blowing.IService;
using FLY.Thick.Base.IService;
using FLY.Thick.Blowing.IService;
using FLY.Thick.BlowingScan.IService;
using MultiLayout.UiModule;
using System.Windows;
......@@ -22,14 +23,12 @@ namespace FLY.Thick.BlowingScan.UI.Client.UiModule
[InjectionMethod]
public void Init(
IUnityContainer container,
IBlowingService blowingFixService,
IBlowingDetectService blowingDetectService)
IUnityContainer container)
{
this.container = container;
viewModel = new FLY.Thick.Blowing.UI.UiModule.DynAreaBlowingVm();
viewModel.Init(blowingFixService, blowingDetectService);
container.BuildUp(viewModel);
this.DataContext = viewModel;
}
......
......@@ -58,11 +58,7 @@
<Compile Include="IService\IBlowingScanService.cs" />
<Compile Include="Server\GM_BlowingScan.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Server\Model\OrgLc_AutoMapperProfile.cs" />
<Compile Include="Server\Model\OrgDbModel.cs" />
<Compile Include="Server\Model\OrgDbTable.cs" />
<Compile Include="Server\Model\HistoryDb.cs" />
<Compile Include="Server\Model\OrgLcTable.cs" />
<Compile Include="Server\TDGage.cs" />
</ItemGroup>
<ItemGroup>
......
......@@ -760,6 +760,16 @@ namespace FLY.Thick.BlowingScan.Server
/// </summary>
public bool IsForwCW { get; set; }
/// <summary>
/// 真实厚度 um 给第3方设置用
/// </summary>
public double ActThick { get; set; }
/// <summary>
/// 最后一圈数据均值 um
/// </summary>
public double LastThick { get; protected set; }
/// <summary>
/// 应用
/// </summary>
......@@ -1692,11 +1702,15 @@ namespace FLY.Thick.BlowingScan.Server
RAngle = Math.Round(mPDetect.RAngle,1),
FilmLength = Math.Round(mPDetect.FilmLength,2),
FilmVelocity = Math.Round(mPDetect.FilmVelocity,2),
FilmWidth = (int)mDynArea.Width,
K = Math.Round(mProfileParam.K,3),
B = 0,
Thicks = realthicks,
Boltmap = map
};
LastThick = Math.Round(realthicks.AverageNoNull(), 2);
//TODO 只有最后一幅图推送
//if(scaninfo_idx == mScanInfoList.Count() - 1) //居然还有一幅更新的,但里面数据是空
{
......@@ -1858,13 +1872,13 @@ namespace FLY.Thick.BlowingScan.Server
}
#region sqlite3 历史数据保存
string[] profile_propertynames_add = new string[]{
"PName",
"OrderNo",
"Number"
nameof(BlowingFixProfileParam.PName),
nameof(BlowingFixProfileParam.OrderNo),
nameof(BlowingFixProfileParam.Number)
};
string[] profile_propertynames_update = new string[]{
"Target",
"TolerancePercent"
nameof(BlowingFixProfileParam.Target),
nameof(BlowingFixProfileParam.TolerancePercent)
};
/// <summary>
/// 检查产品信息更新情况,是否需要新加单,或者更新单信息
......
using FLY.Thick.Blowing.Server.Model;
using SQLite;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace FLY.Thick.BlowingScan.Server.Model
{
/// <summary>
/// 原始数据 数据库对象
/// </summary>
public class OrgDbModel : SQLiteDbContext
{
/// <summary>
/// 转向信号表对象
/// </summary>
public DBTable<Db_Sign> TbSign { get; } = new DBTable<Db_Sign>();
/// <summary>
/// 辊信号表对象
/// </summary>
public DBTable<Db_Roll> TbRoll { get; } = new DBTable<Db_Roll>();
/// <summary>
/// 扫描数据表对象
/// </summary>
public DBTable<Db_OrgScanData> TbOrgScanData { get; } = new DBTable<Db_OrgScanData>();
/// <summary>
///
/// </summary>
/// <param name="dbpath"></param>
public OrgDbModel(string dbpath) : base(dbpath)
{
}
/// <summary>
///
/// </summary>
public OrgDbModel() : this(@"D:\blowingdata\thickness_scan_org.sqlite3")
{
}
}
}
using SQLite;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace FLY.Thick.BlowingScan.Server.Model
{
/// <summary>
/// 原始厚度表
/// </summary>
[Table("OrgScanData")]
public class Db_OrgScanData
{
/// <summary>
/// key
/// </summary>
[Key]
[PropertyIndex(0)]
public Int64 ID { get; set; }
/// <summary>
/// 时间
/// </summary>
[PropertyIndex(1)]
public DateTime Time { get; set; }
/// <summary>
/// 边界开始
/// </summary>
[PropertyIndex(2)]
public int FilmBegin { get; set; }
/// <summary>
/// 边界结束
/// </summary>
[PropertyIndex(3)]
public int FilmEnd { get; set; }
/// <summary>
/// pos / grid
/// </summary>
[PropertyIndex(4)]
public int PosOfGrid { get; set; }
/// <summary>
/// 斜率补偿
/// </summary>
[PropertyIndex(5)]
public double K { get; set; }
/// <summary>
/// 厚度数据 double[] 总数量为grid总数
/// </summary>
[PropertyIndex(6)]
public string Thicks { get; set; }
/// <summary>
/// 测量时间 datetime[] 总数量为grid总数
/// </summary>
[PropertyIndex(7)]
public string ThicksDt { get; set; }
}
}
using FLY.Thick.Blowing.IService;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace FLY.Thick.BlowingScan.Server.Model
{
/// <summary>
/// 原始厚度表
/// </summary>
public class Lc_OrgScanData
{
/// <summary>
/// key
/// </summary>
public Int64 ID { get; set; }
/// <summary>
/// 时间
/// </summary>
public DateTime Time { get; set; }
/// <summary>
/// 边界开始
/// </summary>
public int FilmBegin { get; set; }
/// <summary>
/// 边界结束
/// </summary>
public int FilmEnd { get; set; }
/// <summary>
/// pos / grid
/// </summary>
public int PosOfGrid { get; set; }
/// <summary>
/// 斜率补偿
/// </summary>
public double K { get; set; }
/// <summary>
/// 厚度数据 double[] 总数量为grid总数
/// </summary>
public double[] Thicks { get; set; }
/// <summary>
/// 测量时间 datetime[] 总数量为grid总数
/// </summary>
public DateTime[] ThicksDt { get; set; }
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace FLY.Thick.BlowingScan.Server.Model
{
/// <summary>
/// LC 与 DB 类的映射关系, 会在程序入口处, 手动使用
/// var assemblies = System.AppDomain.CurrentDomain.GetAssemblies();
/// var cfg = new MapperConfigurationExpression();
/// cfg.AddMaps(assemblies);
/// Mapper.Initialize(cfg);
///
/// 枚举全部程序集 中的AutoMapper.Profile 全部加载!!!
/// </summary>
public class OrgLc_AutoMapperProfile : AutoMapper.Profile
{
/// <summary>
///
/// </summary>
public static AutoMapper.IMapper Mapper;
static OrgLc_AutoMapperProfile()
{
var cfg = new AutoMapper.Configuration.MapperConfigurationExpression();
cfg.AddProfile<OrgLc_AutoMapperProfile>();
AutoMapper.MapperConfiguration config = new AutoMapper.MapperConfiguration(cfg);
Mapper = new AutoMapper.Mapper(config);
}
/// <summary>
///
/// </summary>
public OrgLc_AutoMapperProfile()
{
CreateMap<Lc_OrgScanData, Db_OrgScanData>()
.ForMember(s => s.Thicks, opt =>
{
opt.MapFrom(s => Newtonsoft.Json.JsonConvert.SerializeObject(s.Thicks));
})
.ForMember(s => s.ThicksDt, opt =>
{
opt.MapFrom(s => Newtonsoft.Json.JsonConvert.SerializeObject(s.ThicksDt));
})
.ReverseMap()
.ForMember(s => s.Thicks, opt =>
{
opt.MapFrom(s => Newtonsoft.Json.JsonConvert.DeserializeObject<double[]>(s.Thicks));
})
.ForMember(s => s.ThicksDt, opt =>
{
opt.MapFrom(s => Newtonsoft.Json.JsonConvert.DeserializeObject<DateTime[]>(s.ThicksDt));
});
}
}
}
......@@ -16,7 +16,6 @@ using System.Threading.Tasks;
using System.Windows.Threading;
using FlyADIODefine = FLY.Thick.BlowingScan.Common.FlyADIODefine;
using HistoryDb = FLY.Thick.BlowingScan.Server.Model.HistoryDb;
using OrgDbModel = FLY.Thick.BlowingScan.Server.Model.OrgDbModel;
using ScanWarning = FLY.Thick.Blowing.Server.ScanWarning;
namespace FLY.Thick.BlowingScan.Server
......
......@@ -39,11 +39,14 @@ namespace FLY.Weight.Server
/// <summary>
/// 吹膜测厚仪, 旋转架模型
/// </summary>
FLY.Thick.Blowing.Client.BlowingDetectServiceClient mBDetect;
FLY.Thick.Blowing.Client.BlowingServiceClient blowingServiceClient;
FLY.Thick.Base.Client.TDGageServiceClient tDGageServiceClient;
#endregion
DispatcherTimer timer_saveSysParam;
DispatcherTimer timer_setActThick;
public TDGage(string nam)
{
mName = nam;
......@@ -107,6 +110,7 @@ namespace FLY.Weight.Server
FObjServiceClientManager.Instance.ConnAddrs.Add(new ConnAddr() { ConnName = connName, Addr = mSysParam.BlowingAddr });
tDGageServiceClient = new Thick.Base.Client.TDGageServiceClient(FLY.Thick.Blowing.OBJ_INTERFACE.OBJ_INTERFACE_ID.TDGAGE_ID, connName);
blowingServiceClient = new Thick.Blowing.Client.BlowingServiceClient(FLY.Thick.Blowing.OBJ_INTERFACE.OBJ_INTERFACE_ID.RENZIJIA_ID, connName);
#endregion
......@@ -117,6 +121,12 @@ namespace FLY.Weight.Server
timer_saveSysParam = new DispatcherTimer();
timer_saveSysParam.Interval = TimeSpan.FromSeconds(5);
timer_saveSysParam.Tick += Timer_saveSysParam_Tick;
//定期写入厚度数据
timer_setActThick = new DispatcherTimer();
timer_setActThick.Interval = TimeSpan.FromSeconds(5);
timer_setActThick.Tick += Timer_setActThick_Tick;
timer_setActThick.Start();
//这个是从测厚仪获取的,每几秒就写一次,不调试!!!!!
......@@ -124,13 +134,19 @@ namespace FLY.Weight.Server
mData.plcos.IgnoreLogProperties.Add(new SenderProperty() { sender = mData.Accessory, propertyName = nameof(mData.Accessory.TotalFilmWidth) });
}
private void Timer_setActThick_Tick(object sender, EventArgs e)
{
if (blowingServiceClient.IsConnected) {
blowingServiceClient.ActThick = Math.Round(mData.Accessory.Thickness, 1);
}
}
private void Timer_saveSysParam_Tick(object sender, EventArgs e)
{
timer_saveSysParam.Stop();
mSysParam.Save();
}
DispatcherTimer timer_saveSysParam;
private void MSysParam_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
{
......
Subproject commit 343e10fe1dcbae798535a595d29bd73e65f9ad66
Subproject commit 04e151cd6949ea9b940db8995574658a6726d760
{
"InstallZipVersion":"7.8.1.1",
"InstallZipUrl":"http://server.flyautomation.net:8889/download/和美安装包_v7.8.1.1_20230407.7z"
"InstallZipVersion":"7.9.0.1",
"InstallZipUrl":"http://server.flyautomation.net:8889/download/和美安装包_v7.9.0.1_20230429.7z"
}
\ No newline at end of file
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