Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
H
hemei
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
潘栩锋
hemei
Commits
6d674742
Commit
6d674742
authored
Nov 07, 2022
by
潘栩锋
🚴
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加 称重组分的仓号记录
parent
bf5a25e5
Show whitespace changes
Inline
Side-by-side
Showing
18 changed files
with
211 additions
and
33 deletions
+211
-33
ExcelOuput.cs
....Blowing.DbViewer/FLY.Blowing.DbViewer/Core/ExcelOuput.cs
+4
-2
UcTAreaProfile.xaml
Project.FLY.Unions/FLY.Unions.UI/UcTAreaProfile.xaml
+3
-3
UcThkProfile.xaml
Project.FLY.Unions/FLY.Unions.UI/UcThkProfile.xaml
+3
-3
UcWeightProfile.xaml
Project.FLY.Unions/FLY.Unions.UI/UcWeightProfile.xaml
+15
-4
UcWeightProfile.xaml.cs
Project.FLY.Unions/FLY.Unions.UI/UcWeightProfile.xaml.cs
+21
-4
UcWeightProfileVmUt.cs
Project.FLY.Unions/FLY.Unions.UI/UcWeightProfileVmUt.cs
+3
-2
WdSetup.xaml
Project.FLY.Weight/FLY.Weight.UI.Server/WdSetup.xaml
+4
-0
WdSetup.xaml.cs
Project.FLY.Weight/FLY.Weight.UI.Server/WdSetup.xaml.cs
+3
-2
WeightProfileServiceClient.cs
...LY.Weight/FLY.Weight/Client/WeightProfileServiceClient.cs
+16
-0
WeightSystemServiceClient.cs
...FLY.Weight/FLY.Weight/Client/WeightSystemServiceClient.cs
+19
-2
WeightProfileParam.cs
Project.FLY.Weight/FLY.Weight/Common/WeightProfileParam.cs
+7
-0
IWeightProfileService.cs
...t.FLY.Weight/FLY.Weight/IService/IWeightProfileService.cs
+16
-0
IWeightSystemService.cs
...ct.FLY.Weight/FLY.Weight/IService/IWeightSystemService.cs
+5
-0
LcTable.cs
Project.FLY.Weight/FLY.Weight/Server/Model/LcTable.cs
+5
-0
TDGage.cs
Project.FLY.Weight/FLY.Weight/Server/TDGage.cs
+1
-1
WeightProfile.cs
Project.FLY.Weight/FLY.Weight/Server/WeightProfile.cs
+18
-1
WeightSystem.cs
Project.FLY.Weight/FLY.Weight/Server/WeightSystem.cs
+67
-8
thick_public
thick_public
+1
-1
No files found.
Project.FLY.Blowing.DbViewer/FLY.Blowing.DbViewer/Core/ExcelOuput.cs
View file @
6d674742
...
...
@@ -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
);
...
...
Project.FLY.Unions/FLY.Unions.UI/UcTAreaProfile.xaml
View file @
6d674742
...
...
@@ -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>
...
...
Project.FLY.Unions/FLY.Unions.UI/UcThkProfile.xaml
View file @
6d674742
...
...
@@ -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>
...
...
Project.FLY.Unions/FLY.Unions.UI/UcWeightProfile.xaml
View file @
6d674742
...
...
@@ -17,6 +17,8 @@
</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]}"/>
...
...
@@ -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>
...
...
@@ -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="Full"/>
</Border>
</StackPanel>
</DataTemplate>
</ItemsControl.ItemTemplate>
...
...
Project.FLY.Unions/FLY.Unions.UI/UcWeightProfile.xaml.cs
View file @
6d674742
...
...
@@ -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
:
...
...
@@ -333,12 +336,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 +361,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 +371,9 @@ namespace FLY.Unions.UI
return
param
;
}
/// <summary>
/// 从PLC获取当前数据
/// </summary>
public
void
SetValueFromPlc
()
{
for
(
int
i
=
0
;
i
<
Items
.
Count
();
i
++)
...
...
@@ -442,6 +455,10 @@ namespace FLY.Unions.UI
/// </summary>
public
float
Density
{
get
;
set
;
}
/// <summary>
/// 描述
/// </summary>
public
string
Description
{
get
;
set
;
}
/// <summary>
/// 比例 0~100
...
...
Project.FLY.Unions/FLY.Unions.UI/UcWeightProfileVmUt.cs
View file @
6d674742
...
...
@@ -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
};
...
...
Project.FLY.Weight/FLY.Weight.UI.Server/WdSetup.xaml
View file @
6d674742
...
...
@@ -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>
...
...
Project.FLY.Weight/FLY.Weight.UI.Server/WdSetup.xaml.cs
View file @
6d674742
...
...
@@ -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
();
...
...
Project.FLY.Weight/FLY.Weight/Client/WeightProfileServiceClient.cs
View file @
6d674742
...
...
@@ -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>
...
...
Project.FLY.Weight/FLY.Weight/Client/WeightSystemServiceClient.cs
View file @
6d674742
...
...
@@ -47,6 +47,12 @@ namespace FLY.Weight.Client
public
string
[]
NumberNames
{
get
;
set
;
}
public
string
Version
{
get
;
set
;
}
=
"v3"
;
/// <summary>
/// 有每层的组分描述
/// </summary>
public
bool
HasIngredientDescription
{
get
;
set
;
}
=
false
;
#
endregion
...
...
@@ -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
;
}
}
Project.FLY.Weight/FLY.Weight/Common/WeightProfileParam.cs
View file @
6d674742
...
...
@@ -47,6 +47,13 @@ namespace FLY.Weight.Common
/// 密度
/// </summary>
public
float
Density
;
/// <summary>
/// 描述
/// 这个功能是电脑端实现。 有功能关闭。
/// 易德提出的
/// </summary>
public
string
Description
;
}
...
...
Project.FLY.Weight/FLY.Weight/IService/IWeightProfileService.cs
View file @
6d674742
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
;
}
}
Project.FLY.Weight/FLY.Weight/IService/IWeightSystemService.cs
View file @
6d674742
...
...
@@ -47,6 +47,11 @@ namespace FLY.Weight.IService
/// 版本
/// </summary>
string
Version
{
get
;
}
/// <summary>
/// 有层描述功能
/// </summary>
bool
HasIngredientDescription
{
get
;
}
}
public
static
class
WeightSystemExt
...
...
Project.FLY.Weight/FLY.Weight/Server/Model/LcTable.cs
View file @
6d674742
...
...
@@ -91,5 +91,10 @@ namespace FLY.Weight.Server.Model
/// 1#比例显示
/// </summary>
public
double
PDisp
{
get
;
set
;
}
/// <summary>
/// 组分描述
/// </summary>
public
string
Description
{
get
;
set
;
}
}
}
Project.FLY.Weight/FLY.Weight/Server/TDGage.cs
View file @
6d674742
...
...
@@ -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
);
...
...
Project.FLY.Weight/FLY.Weight/Server/WeightProfile.cs
View file @
6d674742
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<string>
/// </summary>
...
...
Project.FLY.Weight/FLY.Weight/Server/WeightSystem.cs
View file @
6d674742
...
...
@@ -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
;
}
}
thick_public
@
1da75c4d
Subproject commit
bc6a413f1ab742c46233574738f501f9034fdf9a
Subproject commit
1da75c4d20745a469d67ce501782ff263d72d26b
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment