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
cf066b8e
Commit
cf066b8e
authored
Aug 07, 2020
by
潘栩锋
🚴
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加 称重单组分/设备连接变量表_5
parent
4ea25e8b
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
156 additions
and
0 deletions
+156
-0
FLY.Weight2.UI.Server.csproj
...eight2/FLY.Weight2.UI.Server/FLY.Weight2.UI.Server.csproj
+7
-0
MainWindow.xaml
Project.FLY.Weight2/FLY.Weight2.UI.Server/MainWindow.xaml
+1
-0
MainWindow.xaml.cs
Project.FLY.Weight2/FLY.Weight2.UI.Server/MainWindow.xaml.cs
+7
-0
WdSetup.xaml
Project.FLY.Weight2/FLY.Weight2.UI.Server/WdSetup.xaml
+24
-0
WdSetup.xaml.cs
Project.FLY.Weight2/FLY.Weight2.UI.Server/WdSetup.xaml.cs
+117
-0
HMI-31.MCE
Resource/称重/设备连接变量表_444_v1/HMI-31.MCE
+0
-0
446.MCE
Resource/称重/设备连接变量表_446_v1/446.MCE
+0
-0
446地址表.xlsx
Resource/称重/设备连接变量表_446_v1/446地址表.xlsx
+0
-0
plcgroup.json
Resource/称重/设备连接变量表_446_v1/Generated/plcgroup.json
+0
-0
plcgroup.json
Resource/称重单组分/设备连接变量表_5/Generated/plcgroup.json
+0
-0
HMI-51.xlsx
Resource/称重单组分/设备连接变量表_5/HMI-51.xlsx
+0
-0
No files found.
Project.FLY.Weight2/FLY.Weight2.UI.Server/FLY.Weight2.UI.Server.csproj
View file @
cf066b8e
...
...
@@ -62,6 +62,9 @@
<DependentUpon>
App.xaml
</DependentUpon>
<SubType>
Code
</SubType>
</Compile>
<Compile
Include=
"WdSetup.xaml.cs"
>
<DependentUpon>
WdSetup.xaml
</DependentUpon>
</Compile>
</ItemGroup>
<ItemGroup>
<Compile
Include=
"MainWindow.xaml.cs"
>
...
...
@@ -141,6 +144,10 @@
<Generator>
MSBuild:Compile
</Generator>
<SubType>
Designer
</SubType>
</Page>
<Page
Include=
"WdSetup.xaml"
>
<Generator>
MSBuild:Compile
</Generator>
<SubType>
Designer
</SubType>
</Page>
</ItemGroup>
<ItemGroup>
<Resource
Include=
"hourglass.ico"
/>
...
...
Project.FLY.Weight2/FLY.Weight2.UI.Server/MainWindow.xaml
View file @
cf066b8e
...
...
@@ -53,6 +53,7 @@
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
<Button Content="配置" Padding="20,5" Margin="5" HorizontalAlignment="Left" Click="btnSetupClick"></Button>
<!--<StackPanel Orientation="Horizontal" >
<StackPanel Margin="4" DataContext="{Binding DataContext,ElementName=grid_plc}">
<TextBlock Text="更新速度" />
...
...
Project.FLY.Weight2/FLY.Weight2.UI.Server/MainWindow.xaml.cs
View file @
cf066b8e
...
...
@@ -34,5 +34,12 @@ namespace FLY.Weight2.UI.Server
this
.
itemcontrol
.
ItemsSource
=
plsos
.
PLCs
;
spBDetect
.
DataContext
=
gage
.
mBDetect
;
}
private
void
btnSetupClick
(
object
sender
,
RoutedEventArgs
e
)
{
WdSetup
w
=
new
WdSetup
();
w
.
Owner
=
this
;
w
.
ShowDialog
();
}
}
}
Project.FLY.Weight2/FLY.Weight2.UI.Server/WdSetup.xaml
0 → 100644
View file @
cf066b8e
<Window x:Class="FLY.Weight2.UI.Server.WdSetup"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:FLY.Weight2.UI.Server"
mc:Ignorable="d"
Title="WdSetup" SizeToContent="WidthAndHeight" >
<Grid>
<StackPanel Orientation="Horizontal">
<StackPanel Margin="5">
<TextBlock Text="plcgroup配置文件" Margin="2"/>
<ComboBox MinWidth="200" Margin="2" x:Name="comboBox" >
<ComboBox.ItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding Name}"/>
</DataTemplate>
</ComboBox.ItemTemplate>
</ComboBox>
</StackPanel>
<Button Content="确定" Padding="20,5" Margin="5" Click="btnOkClick"/>
</StackPanel>
</Grid>
</Window>
Project.FLY.Weight2/FLY.Weight2.UI.Server/WdSetup.xaml.cs
0 → 100644
View file @
cf066b8e
using
FLY.OBJComponents.Common
;
using
System
;
using
System.Collections.Generic
;
using
System.ComponentModel
;
using
System.IO
;
using
System.Linq
;
using
System.Security.Cryptography
;
using
System.Text
;
using
System.Threading.Tasks
;
using
System.Windows
;
using
System.Windows.Controls
;
using
System.Windows.Data
;
using
System.Windows.Documents
;
using
System.Windows.Input
;
using
System.Windows.Media
;
using
System.Windows.Media.Imaging
;
using
System.Windows.Shapes
;
namespace
FLY.Weight2.UI.Server
{
/// <summary>
/// WdSetup.xaml 的交互逻辑
/// </summary>
public
partial
class
WdSetup
:
Window
{
public
event
PropertyChangedEventHandler
PropertyChanged
;
public
WdSetup
()
{
InitializeComponent
();
Init
();
}
private
void
Init
()
{
var
items
=
new
List
<
PlcGroupItem
>();
//查找 脚本/称重 下的全部 设备连接变量表_xxx 的文件夹
DirectoryInfo
directoryInfo
=
new
DirectoryInfo
(
@"plcgroups"
);
if
(!
directoryInfo
.
Exists
)
{
//异常
return
;
}
var
dirs
=
directoryInfo
.
GetDirectories
();
foreach
(
var
dir
in
dirs
)
{
if
(
dir
.
Name
.
StartsWith
(
"设备连接变量表_"
))
{
PlcGroupItem
item
=
new
PlcGroupItem
();
item
.
Name
=
dir
.
Name
.
Substring
(
"设备连接变量表_"
.
Length
);
item
.
Path
=
System
.
IO
.
Path
.
Combine
(
dir
.
FullName
,
"Generated"
,
"plcgroup.json"
);
items
.
Add
(
item
);
}
}
comboBox
.
ItemsSource
=
items
;
foreach
(
var
item
in
items
)
{
if
(
IsSameContent
(
item
.
Path
,
"plcgroup.json"
))
{
//找到了
comboBox
.
SelectedItem
=
item
;
break
;
}
}
}
public
static
bool
IsSameContent
(
string
filePath1
,
string
filePath2
)
{
//创建一个哈希算法对象
using
(
HashAlgorithm
hash
=
HashAlgorithm
.
Create
())
{
using
(
FileStream
file1
=
new
FileStream
(
filePath1
,
FileMode
.
Open
),
file2
=
new
FileStream
(
filePath2
,
FileMode
.
Open
))
{
byte
[]
hashByte1
=
hash
.
ComputeHash
(
file1
);
//哈希算法根据文本得到哈希码的字节数组
byte
[]
hashByte2
=
hash
.
ComputeHash
(
file2
);
return
Enumerable
.
SequenceEqual
(
hashByte1
,
hashByte2
);
//string str1 = BitConverter.ToString(hashByte1);//将字节数组装换为字符串
//string str2 = BitConverter.ToString(hashByte2);
//return (str1 == str2);//比较哈希码
}
}
}
private
void
btnOkClick
(
object
sender
,
RoutedEventArgs
e
)
{
var
item
=
comboBox
.
SelectedItem
as
PlcGroupItem
;
if
(
item
==
null
)
{
MessageBox
.
Show
(
"请选择型号!!!"
);
return
;
}
if
(
MessageBox
.
Show
(
"需要重启,才能生效"
,
"提示"
,
MessageBoxButton
.
OKCancel
)
==
MessageBoxResult
.
OK
)
{
File
.
Copy
(
item
.
Path
,
"plcgroup.json"
,
true
);
//System.Windows.Forms.Application.Restart();
Application
.
Current
.
Shutdown
();
}
}
}
public
class
PlcGroupItem
{
/// <summary>
/// 名称
/// </summary>
public
string
Name
{
get
;
set
;
}
/// <summary>
/// 路径
/// </summary>
public
string
Path
{
get
;
set
;
}
}
}
Resource/称重/设备连接变量表_444_v1/HMI-31.MCE
View file @
cf066b8e
No preview for this file type
Resource/称重/设备连接变量表_446/446.MCE
→
Resource/称重/设备连接变量表_446
_v1
/446.MCE
View file @
cf066b8e
File moved
Resource/称重/设备连接变量表_446/446地址表.xlsx
→
Resource/称重/设备连接变量表_446
_v1
/446地址表.xlsx
View file @
cf066b8e
File moved
Resource/称重/设备连接变量表_446/Generated/plcgroup.json
→
Resource/称重/设备连接变量表_446
_v1
/Generated/plcgroup.json
View file @
cf066b8e
File moved
Resource/称重单组分/设备连接变量表_5/Generated/plcgroup.json
0 → 100644
View file @
cf066b8e
This diff is collapsed.
Click to expand it.
Resource/称重单组分/设备连接变量表_5/HMI-51.xlsx
0 → 100644
View file @
cf066b8e
File added
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