Commit 01c9f470 authored by 潘栩锋's avatar 潘栩锋 🚴

Merge remote-tracking branch 'remotes/origin/feature-feng-yide-20221107' into dev-7.0-1

parents e46cffab 24395f94
......@@ -372,8 +372,9 @@ namespace FLY.Blowing.DbViewer.Core
dataTable.Columns.Add(new DataColumn() { ColumnName = "料斗重量(kg)", DataType = typeof(double), Caption = "0.0000" });
for (int i = 0; i < itemCnt; i++)
{
dataTable.Columns.Add(new DataColumn() { ColumnName = $"#{i+1}重量(kg)", DataType = typeof(double), Caption = "0.0000" });
dataTable.Columns.Add(new DataColumn() { ColumnName = $"#{i+1}比例(%)", DataType = typeof(double), Caption = "0.00" });
dataTable.Columns.Add(new DataColumn() { ColumnName = $"#{i + 1}重量(kg)", DataType = typeof(double), Caption = "0.0000" });
dataTable.Columns.Add(new DataColumn() { ColumnName = $"#{i + 1}比例(%)", DataType = typeof(double), Caption = "0.00" });
dataTable.Columns.Add(new DataColumn() { ColumnName = $"#{i + 1}仓号", DataType = typeof(string) });
}
CurrRowGrowUpReady();
for (int j = 0; j < mixs.Count(); j++)
......@@ -389,6 +390,7 @@ namespace FLY.Blowing.DbViewer.Core
var item = mix.Items[i];
dataRow[$"#{i + 1}重量(kg)"] = item.Disp;
dataRow[$"#{i + 1}比例(%)"] = item.PDisp;
dataRow[$"#{i + 1}仓号"] = item.Description;
}
dataTable.Rows.Add(dataRow);
......
......@@ -12,7 +12,7 @@ using System.Windows;
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("佛山市枫莱尔自动化技术有限公司")]
[assembly: AssemblyProduct("吹膜数据库浏览器")]
[assembly: AssemblyCopyright("Copyright © 2021 FlyAutomation")]
[assembly: AssemblyCopyright("Copyright © 2022 FlyAutomation")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
......@@ -51,6 +51,6 @@ using System.Windows;
// 可以指定所有值,也可以使用以下所示的 "*" 预置版本号和修订号
// 方法是按如下所示使用“*”: :
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("6.33.0.0")]
[assembly: AssemblyFileVersion("6.33.0.0")]
[assembly: AssemblyVersion("7.7.0.0")]
[assembly: AssemblyFileVersion("7.7.0.0")]
[assembly: Guid("5FE5D848-CD2B-42CC-8EBD-2029371CDFE2")]
......@@ -51,6 +51,6 @@ using System.Windows;
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
//通过使用 "*",如下所示:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("7.6.2.0")]
[assembly: AssemblyFileVersion("7.6.2.0")]
[assembly: AssemblyVersion("7.7.0")]
[assembly: AssemblyFileVersion("7.7.0")]
[assembly: Guid("D12087A7-EEC4-4D9F-9269-8F20324F4B04")]
......@@ -51,6 +51,6 @@ using System.Windows;
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
//通过使用 "*",如下所示:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("7.6.3.1")]
[assembly: AssemblyFileVersion("7.6.3.1")]
[assembly: AssemblyVersion("7.7.0.1")]
[assembly: AssemblyFileVersion("7.7.0.1")]
[assembly: Guid("38E0D8EC-4D1C-49FF-AB08-6289294C5BD4")]
......@@ -91,8 +91,8 @@
ItemsSource="{Binding ProfileList}" SelectedItem="{Binding SelectedItem}">
<ListBox.Resources>
<Style TargetType="{x:Type ListBoxItem}">
<Setter Property="FontFamily" Value="Microsoft YaHei UI Light"/>
<Setter Property="FontSize" Value="16"/>
<Setter Property="FontFamily" Value="{StaticResource FontFamily.Field}"/>
<Setter Property="FontSize" Value="{StaticResource FontSize.FieldContent.Middle}"/>
<!--<Setter Property="HorizontalContentAlignment" Value="Center"/>-->
<Setter Property="SnapsToDevicePixels" Value="True"/>
......@@ -109,7 +109,7 @@
Margin="0,0,0,5">
<!--<ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" />-->
<StackPanel Orientation="Horizontal">
<TextBlock x:Name="Tb" Text="{Binding .}" Foreground="{StaticResource Brushes.Static}" FontWeight="Bold" FontSize="26" FontFamily="Microsoft Sans Serif" />
<TextBlock x:Name="Tb" Text="{Binding .}" Foreground="{StaticResource Brushes.Static}" FontWeight="{TemplateBinding FontWeight}" FontSize="{TemplateBinding FontSize}" FontFamily="{TemplateBinding FontFamily}" />
</StackPanel>
</Border>
<ControlTemplate.Triggers>
......@@ -160,7 +160,7 @@
<StackPanel>
<StackPanel Margin="{StaticResource ControlMargin}">
<TextBlock Style="{StaticResource Styles.Text.FieldHeader.Editable}" Text="配方名称" />
<TextBox Style="{StaticResource Styles.Text.FieldContent.Input.Card}" Text="{Binding PName}" Tag="Full" />
<TextBox Style="{StaticResource Styles.Text.FieldContent.Input.Card}" Text="{Binding PName}" Tag="Name" />
</StackPanel>
</StackPanel>
</StackPanel>
......
......@@ -31,8 +31,8 @@
ItemsSource="{Binding ProfileList}" SelectedItem="{Binding SelectedItem}">
<ListBox.Resources>
<Style TargetType="{x:Type ListBoxItem}">
<Setter Property="FontFamily" Value="Microsoft YaHei UI Light"/>
<Setter Property="FontSize" Value="16"/>
<Setter Property="FontFamily" Value="{StaticResource FontFamily.Field}"/>
<Setter Property="FontSize" Value="{StaticResource FontSize.FieldContent.Middle}"/>
<!--<Setter Property="HorizontalContentAlignment" Value="Center"/>-->
<Setter Property="SnapsToDevicePixels" Value="True"/>
......@@ -49,7 +49,7 @@
Margin="0,0,0,5">
<!--<ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" />-->
<StackPanel Orientation="Horizontal">
<TextBlock x:Name="Tb" Text="{Binding .}" Foreground="{StaticResource Brushes.Static}" FontWeight="Bold" FontSize="26" FontFamily="Microsoft Sans Serif" />
<TextBlock x:Name="Tb" Text="{Binding .}" Foreground="{StaticResource Brushes.Static}" FontWeight="{TemplateBinding FontWeight}" FontSize="{TemplateBinding FontSize}" FontFamily="{TemplateBinding FontFamily}" />
</StackPanel>
</Border>
<ControlTemplate.Triggers>
......@@ -99,7 +99,7 @@
<StackPanel>
<StackPanel Margin="{StaticResource ControlMargin}">
<TextBlock Style="{StaticResource Styles.Text.FieldHeader.Editable}" Text="产品名称" />
<TextBox Style="{StaticResource Styles.Text.FieldContent.Input.Card}" Text="{Binding PName}" Tag="Full" />
<TextBox Style="{StaticResource Styles.Text.FieldContent.Input.Card}" Text="{Binding PName}" Tag="Name" />
</StackPanel>
<Grid>
<Grid.ColumnDefinitions>
......@@ -108,7 +108,7 @@
</Grid.ColumnDefinitions>
<StackPanel Margin="{StaticResource ControlMargin}">
<TextBlock Style="{StaticResource Styles.Text.FieldHeader.Editable}" Text="订单号" />
<TextBox Style="{StaticResource Styles.Text.FieldContent.Input.Card}" Text="{Binding OrderNo}" Tag="Full" />
<TextBox Style="{StaticResource Styles.Text.FieldContent.Input.Card}" Text="{Binding OrderNo}" Tag="Name" />
</StackPanel>
<StackPanel Margin="{StaticResource ControlMargin}" Grid.Column="1">
<TextBlock Style="{StaticResource Styles.Text.FieldHeader.Editable}" Text="卷号" />
......
......@@ -17,7 +17,9 @@
</ResourceDictionary.MergedDictionaries>
<sys:Double x:Key="Table.Column.Width[0]">50</sys:Double>
<sys:Double x:Key="Table.Column.Width">120</sys:Double>
<sys:Double x:Key="Table.Column.Width.Description">200</sys:Double>
<Style x:Key="Table.Column.Title[0]" TargetType="TextBlock" BasedOn="{StaticResource Styles.Text.FieldHeader}">
<Setter Property="Width" Value="{StaticResource Table.Column.Width[0]}"/>
<Setter Property="TextAlignment" Value="Center"/>
......@@ -62,8 +64,8 @@
ItemsSource="{Binding ProfileList}" SelectedItem="{Binding SelectedItem}">
<ListBox.Resources>
<Style TargetType="{x:Type ListBoxItem}">
<Setter Property="FontFamily" Value="Microsoft YaHei UI Light"/>
<Setter Property="FontSize" Value="16"/>
<Setter Property="FontFamily" Value="{StaticResource FontFamily.Field}"/>
<Setter Property="FontSize" Value="{StaticResource FontSize.FieldContent.Middle}"/>
<!--<Setter Property="HorizontalContentAlignment" Value="Center"/>-->
<Setter Property="SnapsToDevicePixels" Value="True"/>
......@@ -80,7 +82,7 @@
Margin="0,0,0,5">
<!--<ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" />-->
<StackPanel Orientation="Horizontal">
<TextBlock x:Name="Tb" Text="{Binding .}" Foreground="{StaticResource Brushes.Static}" FontWeight="Bold" FontSize="26" FontFamily="{StaticResource FontFamily.Field}" />
<TextBlock x:Name="Tb" Text="{Binding .}" Foreground="{StaticResource Brushes.Static}" FontWeight="{TemplateBinding FontWeight}" FontSize="{TemplateBinding FontSize}" FontFamily="{TemplateBinding FontFamily}" />
</StackPanel>
</Border>
<ControlTemplate.Triggers>
......@@ -131,7 +133,7 @@
<StackPanel>
<StackPanel Margin="{StaticResource ControlMargin}">
<TextBlock Style="{StaticResource Styles.Text.FieldHeader.Editable}" Text="配方名称" />
<TextBox Style="{StaticResource Styles.Text.FieldContent.Input.Card}" Text="{Binding PName}" Tag="Full" />
<TextBox Style="{StaticResource Styles.Text.FieldContent.Input.Card}" Text="{Binding PName}" Tag="Name" />
</StackPanel>
</StackPanel>
</StackPanel>
......@@ -232,6 +234,11 @@
Visibility="{Binding ElementName=grid_root,Path=DataContext.HasIngredientDensity,Converter={StaticResource visbilityconv},ConverterParameter=Collapsed}">
<TextBlock Style="{StaticResource Table.Column.Title}" Text="当前密度g/cm³" />
</Border>
<Border BorderThickness="0,1,1,1" BorderBrush="{StaticResource Color_table_border}"
Visibility="{Binding ElementName=grid_root,Path=DataContext.HasIngredientDescription,Converter={StaticResource visbilityconv},ConverterParameter=Collapsed}">
<TextBlock Style="{StaticResource Table.Column.Title}" Width="{StaticResource Table.Column.Width.Description}" Text="仓号" />
</Border>
</StackPanel>
<ItemsControl ItemsSource="{Binding Ingredients}" >
<ItemsControl.ItemsPanel>
......@@ -259,6 +266,10 @@
Visibility="{Binding ElementName=grid_root,Path=DataContext.HasIngredientDensity,Converter={StaticResource visbilityconv},ConverterParameter=Collapsed}">
<TextBlock Style="{StaticResource Table.Column.Content}" Text="{Binding PLC_Density,StringFormat={}{0:0.###}}" />
</Border>
<Border BorderThickness="0,0,1,1" BorderBrush="{StaticResource Color_table_border}"
Visibility="{Binding ElementName=grid_root,Path=DataContext.HasIngredientDescription,Converter={StaticResource visbilityconv},ConverterParameter=Collapsed}">
<TextBox Style="{StaticResource Table.Column.Content.Editable}" Width="{StaticResource Table.Column.Width.Description}" Text="{Binding Description}" Tag="Name"/>
</Border>
</StackPanel>
</DataTemplate>
</ItemsControl.ItemTemplate>
......
......@@ -62,7 +62,10 @@ namespace FLY.Unions.UI
/// </summary>
public bool HasIngredientDensity { get; set; }
/// <summary>
/// 有每层组份的描述功能
/// </summary>
public bool HasIngredientDescription { get; set; }
#region Command
......@@ -93,7 +96,7 @@ namespace FLY.Unions.UI
this.weightProfileService = _weightProfileService;
this.weightSystemService = _weightSystemService;
weightSystemService.VersionStringParse(out int version, out int itemStyle);
HasIngredientDescription = weightSystemService.HasIngredientDescription;
switch (version)
{
case 5:
......@@ -188,6 +191,21 @@ namespace FLY.Unions.UI
if (!WdPassword.Authorize("Profile"))
return;
//有效性检查
if (string.IsNullOrEmpty(Param.PName))
{
FLY.ControlLibrary.Window_WarningTip.Show("参数出错", "称重配方名称为空");
return;
}
weightProfileService.Apply(Param.GetValue());
if (!ProfileList.Contains(Param.PName))
{
ProfileList.Add(Param.PName);
}
SelectedItem = Param.PName;
//绑定weightSystemService数据
for (int i = 0; i < weightSystemService.Items.Count(); i++)
{
......@@ -209,6 +227,10 @@ namespace FLY.Unions.UI
ingredient.Density = ingredientView.Density;
}
}
FLY.ControlLibrary.Window_Tip.Show("成功",
"已经设置到PLC",
TimeSpan.FromSeconds(2));
}
private void ToProfile()
......@@ -333,12 +355,18 @@ namespace FLY.Unions.UI
ingredientView.Density = ingredient.Density;
ingredientView.MixPSet = ingredient.MixPSet;
ingredientView.Description = ingredient.Description;
}
}
}
/// <summary>
/// 从WeightProfileParamView转为WeightProfileParam
/// </summary>
/// <returns></returns>
public WeightProfileParam GetValue()
{
WeightProfileParam param = new WeightProfileParam
{
PName = PName,
......@@ -352,8 +380,9 @@ namespace FLY.Unions.UI
ingredientView => new IngredientParam
{
Density = ingredientView.Density,
MixPSet = ingredientView.MixPSet
}).ToArray()
MixPSet = ingredientView.MixPSet,
Description = ingredientView.Description
}).ToArray(),
};
}).ToArray()
};
......@@ -361,6 +390,9 @@ namespace FLY.Unions.UI
return param;
}
/// <summary>
/// 从PLC获取当前数据
/// </summary>
public void SetValueFromPlc()
{
for (int i = 0; i < Items.Count(); i++)
......@@ -442,6 +474,10 @@ namespace FLY.Unions.UI
/// </summary>
public float Density { get; set; }
/// <summary>
/// 描述
/// </summary>
public string Description { get; set; }
/// <summary>
/// 比例 0~100
......
......@@ -18,8 +18,9 @@ namespace FLY.Unions.UI
Param.PName = "qweqwee11231";
HasDensity = false;
HasIngredientDensity = false;
HasDensity = true;
HasIngredientDensity = true;
HasIngredientDescription = true;
int[] BinCnts = new int[] { 6, 2, 0, 2, 6 };
......
......@@ -51,6 +51,6 @@ using System.Windows;
// 可以指定所有这些值,也可以使用“内部版本号”和“修订号”的默认值,
// 方法是按如下所示使用“*”:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("7.6.1.0")]
[assembly: AssemblyFileVersion("7.6.1.0")]
[assembly: AssemblyVersion("7.7.0.0")]
[assembly: AssemblyFileVersion("7.7.0.0")]
[assembly: Guid("AC4FFE57-FF42-4B4D-9E23-FF583D78187D")]
......@@ -36,6 +36,10 @@
<TextBlock Text="层显示方式" Margin="2"/>
<ComboBox Margin="2" ItemsSource="{Binding WeightStyles}" DisplayMemberPath="Name" SelectedValuePath="ItemStyle" SelectedValue="{Binding ItemStyle,Mode=TwoWay}"/>
</StackPanel>
<StackPanel Margin="5">
<TextBlock Text="组分描述" Margin="2"/>
<CheckBox IsChecked="{Binding HasIngredientDescription}"/>
</StackPanel>
<Button Content="确定" Padding="20,5" Margin="5" Click="btnOkClick" VerticalAlignment="Bottom"/>
</StackPanel>
......
......@@ -55,12 +55,10 @@ namespace FLY.Weight.UI.Server
{
viewModel.GenV3();
}
private void ComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
viewModel.PlcGroupItem2Version();
}
private void btnVersionClick(object sender, RoutedEventArgs e)
{
string filePath = @"plcgroups\版本描述.txt";
......@@ -103,6 +101,7 @@ namespace FLY.Weight.UI.Server
public int DataVersion { get; set; }
public int ItemStyle { get; set; }
public bool HasIngredientDescription { get; set; }
public string[] NumberNames { get; set; }
TDGage gage;
......@@ -120,6 +119,7 @@ namespace FLY.Weight.UI.Server
DataVersion = version;
ItemStyle = itemStyle;
NumberNames = gage.mData.NumberNames;
HasIngredientDescription = gage.mData.HasIngredientDescription;
}
private void Init_PlcGroupItems()
......@@ -236,6 +236,7 @@ namespace FLY.Weight.UI.Server
gage.mData.NumberNames = NumberNames;
gage.mData.Version = gage.mData.CreateVersionString(DataVersion, ItemStyle);
gage.mData.HasIngredientDescription = HasIngredientDescription;
gage.mData.SaveNumberNames();
......
......@@ -11,10 +11,26 @@ namespace FLY.Weight.Client
{
protected override Type InterfaceType => typeof(IWeightProfileService);
/// <summary>
/// 每次有新数据时候推送。 修改参数,不会推送
/// </summary>
[Push(typeof(WeightProfileParamChangedEventArgs))]
public event EventHandler WeightProfileParamChanged;
public WeightProfileServiceClient(UInt32 id) : base(id) { }
public WeightProfileServiceClient(UInt32 serviceId, string connName) : base(serviceId, connName) { }
public void Trigger_WeightProfileParamChanged(EventArgs e)
{
//TODO, e 是 WeightProfileParamChangedEventArgs ,不知道是否能这样调用
WeightProfileParamChanged?.Invoke(this, e);
}
/// <summary>
/// 读取当前值, 没有推送功能
/// </summary>
......
......@@ -47,8 +47,14 @@ namespace FLY.Weight.Client
public string[] NumberNames { get; set; }
public string Version { get; set; } = "v3";
/// <summary>
/// 有每层的组分描述
/// </summary>
public bool HasIngredientDescription { get; set; } = false;
#endregion
SyncPropServiceClient syncPropServiceClient;
......@@ -133,7 +139,8 @@ namespace FLY.Weight.Client
{
BinCnts = BinCnts,
NumberNames = NumberNames,
Version = Version
Version = Version,
HasIngredientDescription = HasIngredientDescription
};
string json = Newtonsoft.Json.JsonConvert.SerializeObject(jsonDb);
File.WriteAllText(filePath, json);
......@@ -148,6 +155,7 @@ namespace FLY.Weight.Client
BinCnts = p.BinCnts;
NumberNames = p.NumberNames;
Version = p.Version;
HasIngredientDescription = p.HasIngredientDescription;
}
catch {
//失败就算了。。。
......@@ -168,6 +176,10 @@ namespace FLY.Weight.Client
{
Save();
}
else if (e.PropertyName == nameof(HasIngredientDescription))
{
Save();
}
else if (e.PropertyName == nameof(NumberNames)) {
if (IsNumberNamesChanged()) {
for (int i = 0; i < Items.Count(); i++)
......@@ -326,5 +338,10 @@ namespace FLY.Weight.Client
/// 版本号
/// </summary>
public string Version;
/// <summary>
/// 有层组分描述功能
/// </summary>
public bool HasIngredientDescription;
}
}
......@@ -47,6 +47,13 @@ namespace FLY.Weight.Common
/// 密度
/// </summary>
public float Density;
/// <summary>
/// 描述
/// 这个功能是电脑端实现。 有功能关闭。
/// 易德提出的
/// </summary>
public string Description;
}
......
using FLY.Weight.Common;
using FObjBase;
using FObjBase.Reflect;
using System;
using System.Collections.Generic;
using System.ComponentModel;
......@@ -9,8 +10,18 @@ namespace FLY.Weight.IService
public interface IWeightProfileService : INotifyPropertyChanged
{
/// <summary>
/// 每次有新数据时候推送。 修改参数,不会推送
/// </summary>
[Push(typeof(WeightProfileParamChangedEventArgs))]
event EventHandler WeightProfileParamChanged;
/// <summary>
/// 读取当前值, 没有推送功能
/// 不能把 WeightProfileParam Param 作为 属性,企图PropertyChangedNotify.
/// 它里面不是属性。有数组,不想变成属性这么麻烦
/// </summary>
/// <param name="asyncDelegate"></param>
/// <param name="asyncContext"></param>
......@@ -45,4 +56,9 @@ namespace FLY.Weight.IService
[Call(typeof(WeightProfileParam))]
void Read(string productname, AsyncCBHandler asyncDelegate, object asyncContext);
}
public class WeightProfileParamChangedEventArgs : EventArgs
{
public WeightProfileParam param;
}
}
......@@ -47,6 +47,11 @@ namespace FLY.Weight.IService
/// 版本
/// </summary>
string Version { get; }
/// <summary>
/// 有层描述功能
/// </summary>
bool HasIngredientDescription { get; }
}
public static class WeightSystemExt
......
......@@ -91,5 +91,10 @@ namespace FLY.Weight.Server.Model
/// 1#比例显示
/// </summary>
public double PDisp { get; set; }
/// <summary>
/// 组分描述
/// </summary>
public string Description { get; set; }
}
}
......@@ -96,7 +96,7 @@ namespace FLY.Weight.Server
mWarning.Init(mHistoryDb.ErrorBuffer);
mData.Init(mHistoryDb, mWarning);
mData.Init(mHistoryDb, mWarning, mProfile);
if (mFeederSystem != null) {
mFeederSystem.Init(mWarning, OBJComponents.Common.PlcErrNos.Instance.ERRNO_PLC_DISCONNECTED.Code+1);
......
using FLY.Weight.Common;
using FLY.Weight.IService;
using FObjBase;
using FObjBase.Reflect;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.IO;
......@@ -18,10 +20,16 @@ namespace FLY.Weight.Server
/// </summary>
WeightProfileJsonDb profileDb = new WeightProfileJsonDb();
WeightProfileParam weightProfileParam;
public WeightProfileParam weightProfileParam;
private string file_path = "weightprofile.json";
/// <summary>
/// 每次有新数据时候推送。 修改参数,不会推送
/// </summary>
[Push(typeof(WeightProfileParamChangedEventArgs))]
public event EventHandler WeightProfileParamChanged;
public WeightProfile()
{
......@@ -86,6 +94,13 @@ namespace FLY.Weight.Server
{
profileDb.ParamList[index] = weightProfileParam;
}
WeightProfileParamChanged?.Invoke(this, new WeightProfileParamChangedEventArgs()
{
param = weightProfileParam
});
Save();
}
......@@ -101,6 +116,8 @@ namespace FLY.Weight.Server
asyncDelegate?.Invoke(asyncContext, weightProfileParam);
}
/// <summary>
/// 获取产品列表, 返回类型为 List&lt;string&gt;
/// </summary>
......
......@@ -56,6 +56,11 @@ namespace FLY.Weight.Server
public string Version { get; set; } = "version=3;itemStyle=0";
public string[] NumberNames { get; set; }
/// <summary>
/// 有每层的组分描述
/// </summary>
public bool HasIngredientDescription { get; set; } = false;
#endregion
......@@ -76,6 +81,12 @@ namespace FLY.Weight.Server
/// 周期保存Ibc数据
/// </summary>
PeriodicallySaveData<Lc_Flow> psdFlow;
/// <summary>
/// 配方,只用于获取每层组分描述, 易德需要
/// </summary>
WeightProfile profile;
public WeightSystem()
{
LoadNumberNames();
......@@ -84,11 +95,11 @@ namespace FLY.Weight.Server
AddConfigFile();
}
public void Init(HistoryDb historyDb, WarningSystem2 warning)
public void Init(HistoryDb historyDb, WarningSystem2 warning, WeightProfile profile)
{
this.historyDb = historyDb;
this.warning = warning;
this.profile = profile;
//--------------------------------------------------------------------------------
......@@ -185,7 +196,7 @@ namespace FLY.Weight.Server
//提前记录配料数据到内存。 重新一次配料, 把之前保存的内存的数据,保存到数据库。
FObjBase.PollModule.Current.Poll_Config(PollModule.POLL_CONFIG.ADD, OnPoll_SaveMix, TimeSpan.FromSeconds(1));
FObjBase.PollModule.Current.Poll_Config(OnPoll_SaveMix, TimeSpan.FromSeconds(1));
//周期保存每层流量数据
psdFlow = new PeriodicallySaveData<Lc_Flow>();
......@@ -225,7 +236,8 @@ namespace FLY.Weight.Server
void OnPoll_SaveMix()
{
Dictionary<WeighterC, Lc_Mix> mix = new Dictionary<WeighterC, Lc_Mix>();
foreach (WeighterC w in Items)
foreach(WeighterC w in Items)
{
//记录
Lc_Mix f = new Lc_Mix
......@@ -238,9 +250,13 @@ namespace FLY.Weight.Server
{
FlyData_MixItem item = new FlyData_MixItem()
{
Disp = w.Ingredients[i].MixDisp,
PDisp = w.Ingredients[i].MixPDisp
Disp = Math.Round(w.Ingredients[i].MixDisp, 4),
PDisp = Math.Round(w.Ingredients[i].MixPDisp, 2) ,
};
//不需要记录描述,这里的10个只是缓存。最后还会复制到 Lc_Mix f
//if (HasIngredientDescription)
// item.Description = GetDescription(w, i);
f.Items[i] = item;
}
mix.Add(w, f);
......@@ -249,7 +265,35 @@ namespace FLY.Weight.Server
if (mix10.Count > 10)
mix10.RemoveAt(0);
}
string GetDescription(WeighterC w, int ingredient_idx)
{
int i = Items.IndexOf(w);
if (i < 0)
throw new Exception("GetDescription 获取组分描述 异常 不能找到 WeighterC");
int j = ingredient_idx;
WeightProfileParam profileParam = profile.weightProfileParam;
if (profileParam != null)
{
if (profileParam.Items != null)
{
if (i < profileParam.Items.Count())
{
if (profileParam.Items[i] != null)
{
if (profileParam.Items[i].Ingredients != null)
{
if (j < profileParam.Items[i].Ingredients.Count())
{
return profileParam.Items[i].Ingredients[j].Description;
}
}
}
}
}
}
return null;
}
//每隔1秒记录,w.MixDisp, Ingredients[i].(MixDisp,MixPDisp),保存10s
//当卸料时,提取2s前的数据保存!!!!
......@@ -287,11 +331,15 @@ namespace FLY.Weight.Server
Disp = Math.Round(f_last.Items[i].Disp, 4),
PDisp = Math.Round(f_last.Items[i].PDisp, 2)
};
if (HasIngredientDescription)
item.Description = GetDescription(w, i);
f.Items[i] = item;
}
}
else
{
//没有数据。。。。
f.Total = Math.Round(w.MixDisp, 4);
for (int i = 0; i < w.Ingredients.Count; i++)
{
......@@ -300,6 +348,9 @@ namespace FLY.Weight.Server
Disp = Math.Round(w.Ingredients[i].MixDisp, 4),
PDisp = Math.Round(w.Ingredients[i].MixPDisp, 2)
};
if (HasIngredientDescription)
item.Description = GetDescription(w, i);
f.Items[i] = item;
}
}
......@@ -327,6 +378,10 @@ namespace FLY.Weight.Server
Disp = Math.Round(w.Ingredients[i].MixCum, 4),
PDisp = Math.Round(w.Ingredients[i].MixCumPercent, 2)
};
if (HasIngredientDescription)
item.Description = GetDescription(w, i);
f.Items[i] = item;
}
int index = Items.IndexOf(w);
......@@ -520,6 +575,7 @@ namespace FLY.Weight.Server
var p = Newtonsoft.Json.JsonConvert.DeserializeObject<NumberNamesJsonDb>(json);
NumberNames = p.NumberNames;
Version = p.VersionString;
HasIngredientDescription = p.HasIngredientDescription;
return true;
}
public void SaveNumberNames()
......@@ -527,7 +583,8 @@ namespace FLY.Weight.Server
NumberNamesJsonDb jsonDb = new NumberNamesJsonDb
{
NumberNames = NumberNames,
VersionString = Version
VersionString = Version,
HasIngredientDescription = HasIngredientDescription
};
string json = Newtonsoft.Json.JsonConvert.SerializeObject(jsonDb);
File.WriteAllText(filePath_number, json);
......@@ -539,7 +596,8 @@ namespace FLY.Weight.Server
nameof(ItemsCnt),
nameof(BinCnts),
nameof(NumberNames),
nameof(Version)
nameof(Version),
nameof(HasIngredientDescription)
};
}
......@@ -552,5 +610,6 @@ namespace FLY.Weight.Server
{
public string[] NumberNames;
public string VersionString;
public bool HasIngredientDescription;
}
}
{
"InstallZipVersion":"7.6.3.1",
"InstallZipUrl":"http://server.flyautomation.net:8889/download/和美安装包_v7.6.3.1_20221106.7z"
"InstallZipVersion":"7.7.0.1",
"InstallZipUrl":"http://server.flyautomation.net:8889/download/和美安装包_v7.7.0.1_20221109.7z"
}
\ No newline at end of file
# 和美安装包_v7.7.0-20221108
## 测厚仪服务器 v7.6.2
## 测厚仪客户端 v7.7.0
1. 添加 称重的配方界面添加仓号输入
## 扫描测厚仪服务器 v7.6.1
## 扫描测厚仪客户端 v7.7.0
1. 添加 称重的配方界面添加仓号输入
## 自动风环 v7.6.1
## 称重 v7.7.0
1. 添加 仓号功能,历史数据会记录
## 称重单组 v7.6.0
## 收卷 v7.6.0
## IBC v7.6.0
## 下吹 v7.6.0
## 吹膜数据库浏览器 v7.0.0
<br/>
<br/>
<br/>
# 和美安装包_v7.6.3-20221105
## 测厚仪服务器 v7.6.2
......
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