Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
孙克
/
ACSingleStore
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
作业
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit 93747bd6
由
LN
编写于
2019-06-06 16:47:20 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
测高计算修改。 进入IO界面需要一直读取测高值。
1 个父辈
a9caaaa9
隐藏空白字符变更
内嵌
并排
正在显示
5 个修改的文件
包含
73 行增加
和
32 行删除
source/ACSingleStore/FrmIOStatus.cs
source/ACSingleStore/记录.txt
source/DeviceLibrary/DeviceLibrary.csproj
source/DeviceLibrary/KangNaiDe/KNDAIManager.cs
source/DeviceLibrary/acSingleStore/AC_SA_BoxBean.cs
source/ACSingleStore/FrmIOStatus.cs
查看文件 @
93747bd
...
@@ -95,6 +95,7 @@ namespace OnlineStore.ACSingleStore
...
@@ -95,6 +95,7 @@ namespace OnlineStore.ACSingleStore
private
void
FrmTest_FormClosing
(
object
sender
,
FormClosingEventArgs
e
)
private
void
FrmTest_FormClosing
(
object
sender
,
FormClosingEventArgs
e
)
{
{
KNDAIManager
.
NeedShow
=
false
;
try
try
{
{
if
(
this
.
timer1
.
Enabled
)
if
(
this
.
timer1
.
Enabled
)
...
@@ -155,6 +156,7 @@ namespace OnlineStore.ACSingleStore
...
@@ -155,6 +156,7 @@ namespace OnlineStore.ACSingleStore
private
void
FrmStoreIOStatus_Load
(
object
sender
,
EventArgs
e
)
private
void
FrmStoreIOStatus_Load
(
object
sender
,
EventArgs
e
)
{
{
KNDAIManager
.
NeedShow
=
true
;
}
}
private
void
cmbWriteIO_DrawItem
(
object
sender
,
DrawItemEventArgs
e
)
private
void
cmbWriteIO_DrawItem
(
object
sender
,
DrawItemEventArgs
e
)
...
...
source/ACSingleStore/记录.txt
查看文件 @
93747bd
...
@@ -76,7 +76,9 @@ statusBean.addServerData("needInAfterOut",needInAfterOut);
...
@@ -76,7 +76,9 @@ statusBean.addServerData("needInAfterOut",needInAfterOut);
20190606
进入IO界面需要一直读取测高值。
...
...
source/DeviceLibrary/DeviceLibrary.csproj
查看文件 @
93747bd
...
@@ -40,7 +40,7 @@
...
@@ -40,7 +40,7 @@
<HintPath>..\..\dll\CodeLibrary.dll</HintPath>
<HintPath>..\..\dll\CodeLibrary.dll</HintPath>
</Reference>
</Reference>
<Reference Include="halcondotnet">
<Reference Include="halcondotnet">
<HintPath>
C:\Program Files\MVTec\HALCON-12.0\bin\dotnet35
\halcondotnet.dll</HintPath>
<HintPath>
..\..\dll
\halcondotnet.dll</HintPath>
</Reference>
</Reference>
<Reference Include="log4net, Version=1.2.15.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
<Reference Include="log4net, Version=1.2.15.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<SpecificVersion>False</SpecificVersion>
...
...
source/DeviceLibrary/KangNaiDe/KNDAIManager.cs
查看文件 @
93747bd
...
@@ -116,6 +116,7 @@ namespace OnlineStore.DeviceLibrary
...
@@ -116,6 +116,7 @@ namespace OnlineStore.DeviceLibrary
}
}
private
static
DateTime
PreCheckTime
=
DateTime
.
Now
;
private
static
DateTime
PreCheckTime
=
DateTime
.
Now
;
private
static
bool
isProcess
=
false
;
private
static
bool
isProcess
=
false
;
public
static
bool
NeedShow
=
false
;
private
static
void
timer_Elapsed
(
object
sender
,
System
.
Timers
.
ElapsedEventArgs
e
)
private
static
void
timer_Elapsed
(
object
sender
,
System
.
Timers
.
ElapsedEventArgs
e
)
{
{
if
(
isProcess
)
if
(
isProcess
)
...
@@ -125,14 +126,14 @@ namespace OnlineStore.DeviceLibrary
...
@@ -125,14 +126,14 @@ namespace OnlineStore.DeviceLibrary
try
try
{
{
isProcess
=
true
;
isProcess
=
true
;
bool
IsNeedReadAI
=
StoreManager
.
Store
.
KNDIOValue
(
IO_Type
.
TrayCheck_Door
).
Equals
(
IO_VALUE
.
HIGH
);
bool
IsNeedReadAI
=
StoreManager
.
Store
.
KNDIOValue
(
IO_Type
.
TrayCheck_Door
).
Equals
(
IO_VALUE
.
HIGH
)
||
NeedShow
;
TimeSpan
span
=
DateTime
.
Now
-
PreCheckTime
;
TimeSpan
span
=
DateTime
.
Now
-
PreCheckTime
;
List
<
string
>
list
=
new
List
<
string
>(
mastMap
.
Keys
);
List
<
string
>
list
=
new
List
<
string
>(
mastMap
.
Keys
);
foreach
(
string
IP
in
list
)
foreach
(
string
IP
in
list
)
{
{
//判断是否连接,如果没有连接自动重连
//判断是否连接,如果没有连接自动重连
AITcpClient
clinet
=
mastMap
[
IP
];
AITcpClient
clinet
=
mastMap
[
IP
];
if
(!
IsNeedReadAI
)
if
(!
IsNeedReadAI
)
{
{
ClearAIData
(
IP
);
ClearAIData
(
IP
);
continue
;
continue
;
...
...
source/DeviceLibrary/acSingleStore/AC_SA_BoxBean.cs
查看文件 @
93747bd
using
HalconDotNet
;
using
OnlineStore.Common
;
using
OnlineStore.Common
;
using
OnlineStore.LoadCSVLibrary
;
using
OnlineStore.LoadCSVLibrary
;
using
System
;
using
System
;
...
@@ -1603,11 +1603,22 @@ namespace OnlineStore.DeviceLibrary
...
@@ -1603,11 +1603,22 @@ namespace OnlineStore.DeviceLibrary
{
{
return
result
;
return
result
;
}
}
double
ai1Value
=
KNDAIManager
.
ConvertAI
(
KNDAIManager
.
GetAIValue
(
Config
.
AIDevice_IP
,
Config
.
AIDI1_Addr
),
Config
.
AIDI1_DefaultPosition
);
double
ai1Value
=
KNDAIManager
.
ConvertAI
(
KNDAIManager
.
GetAIValue
(
Config
.
AIDevice_IP
,
Config
.
AIDI1_Addr
),
Config
.
AIDI1_DefaultPosition
);
double
ai2Value
=
KNDAIManager
.
ConvertAI
(
KNDAIManager
.
GetAIValue
(
Config
.
AIDevice_IP
,
Config
.
AIDI2_Addr
),
Config
.
AIDI2_DefaultPosition
);
double
ai2Value
=
KNDAIManager
.
ConvertAI
(
KNDAIManager
.
GetAIValue
(
Config
.
AIDevice_IP
,
Config
.
AIDI2_Addr
),
Config
.
AIDI2_DefaultPosition
);
double
Value
=
Math
.
Round
((
ai1Value
+
ai2Value
)
/
2
,
1
);
double
Value
=
Math
.
Round
((
ai1Value
+
ai2Value
)
/
2
,
1
);
if
(
Value
>
14
)
if
(
Value
>
18
)
{
if
((
Value
%
4
).
Equals
(
0
))
{
result
=
(
int
)
Value
;
}
else
{
result
=
((
int
)
Value
/
4
*
4
)
+
4
;
}
}
else
if
(
Value
>
14
)
{
{
result
=
16
;
result
=
16
;
}
}
...
@@ -1669,9 +1680,20 @@ namespace OnlineStore.DeviceLibrary
...
@@ -1669,9 +1680,20 @@ namespace OnlineStore.DeviceLibrary
return
result
;
return
result
;
}
}
double
ai1Value
=
KNDAIManager
.
ConvertAI
(
KNDAIManager
.
GetAIValue
(
Config
.
AIDevice_IP
,
Config
.
AIDI3_Addr
),
Config
.
AIDI3_DefaultPosition
);
double
ai1Value
=
KNDAIManager
.
ConvertAI
(
KNDAIManager
.
GetAIValue
(
Config
.
AIDevice_IP
,
Config
.
AIDI3_Addr
),
Config
.
AIDI3_DefaultPosition
);
double
ai2Value
=
KNDAIManager
.
ConvertAI
(
KNDAIManager
.
GetAIValue
(
Config
.
AIDevice_IP
,
Config
.
AIDI4_Addr
),
Config
.
AIDI4_DefaultPosition
);
double
ai2Value
=
KNDAIManager
.
ConvertAI
(
KNDAIManager
.
GetAIValue
(
Config
.
AIDevice_IP
,
Config
.
AIDI4_Addr
),
Config
.
AIDI4_DefaultPosition
);
double
Value
=
Math
.
Round
((
ai1Value
+
ai2Value
)
/
2
,
1
);
double
Value
=
Math
.
Round
((
ai1Value
+
ai2Value
)
/
2
,
1
);
if
(
Value
>
14
)
if
(
Value
>
18
)
{
if
((
Value
%
4
).
Equals
(
0
))
{
result
=
(
int
)
Value
;
}
else
{
result
=
((
int
)
Value
/
4
*
4
)
+
4
;
}
}
else
if
(
Value
>
14
)
{
{
result
=
16
;
result
=
16
;
}
}
...
@@ -1681,7 +1703,7 @@ namespace OnlineStore.DeviceLibrary
...
@@ -1681,7 +1703,7 @@ namespace OnlineStore.DeviceLibrary
}
}
else
if
(
Value
>=
4
)
else
if
(
Value
>=
4
)
{
{
if
(
ai1Value
>=
9
||
ai2Value
>=
9
)
if
(
ai1Value
>=
9
||
ai2Value
>=
9
)
{
{
result
=
12
;
result
=
12
;
}
}
...
@@ -1695,7 +1717,7 @@ namespace OnlineStore.DeviceLibrary
...
@@ -1695,7 +1717,7 @@ namespace OnlineStore.DeviceLibrary
result
=
0
;
result
=
0
;
}
}
return
result
;
return
result
;
}
}
#
endregion
#
endregion
...
@@ -1850,7 +1872,7 @@ namespace OnlineStore.DeviceLibrary
...
@@ -1850,7 +1872,7 @@ namespace OnlineStore.DeviceLibrary
}
}
catch
(
Exception
ex
)
catch
(
Exception
ex
)
{
{
LOGGER
.
Error
(
"定时给服务器发送消息出错:"
,
ex
);
LOGGER
.
Error
(
"定时给服务器发送消息出错:"
+
ex
.
ToString
()
);
}
}
}
}
HumitureController
.
QueryData
();
HumitureController
.
QueryData
();
...
@@ -1964,30 +1986,15 @@ namespace OnlineStore.DeviceLibrary
...
@@ -1964,30 +1986,15 @@ namespace OnlineStore.DeviceLibrary
}
}
string
server
=
ConfigAppSettings
.
GetValue
(
Setting_Init
.
http_server
);
string
server
=
ConfigAppSettings
.
GetValue
(
Setting_Init
.
http_server
);
Operation
resultOperation
=
HttpHelper
.
Post
(
StoreManager
.
GetPostApi
(
server
),
lineOperation
,
false
);
Operation
resultOperation
=
HttpHelper
.
Post
(
StoreManager
.
GetPostApi
(
server
),
lineOperation
,
false
);
//增加报警处理
if
(
resultOperation
.
data
!=
null
&&
resultOperation
.
data
.
ContainsKey
(
ParamDefine
.
inTimeout
)
&&
resultOperation
.
data
[
ParamDefine
.
inTimeout
].
ToLower
().
Equals
(
"alarm"
))
{
WarnMsg
=
"盘点入库超时报警"
;
LogUtil
.
error
(
LOGGER
,
"收到服务器端报警:盘点入库超时报警"
,
1000
);
Alarm
(
StoreAlarmType
.
CheckInStoreTimeOut
,
StoreAlarmType
.
CheckInStoreTimeOut
.
ToString
(),
WarnMsg
,
StoreMoveType
.
None
);
}
else
{
if
(
alarmType
.
Equals
(
StoreAlarmType
.
CheckInStoreTimeOut
))
{
LogUtil
.
error
(
"之前有报警:盘点入库超时报警,现在已经无报警,清理盘点入库报警"
);
WarnMsg
=
""
;
alarmType
=
StoreAlarmType
.
None
;
}
}
//发送状态信息到服务器
//发送状态信息到服务器
if
(
resultOperation
==
null
)
if
(
resultOperation
==
null
)
{
{
//判断服务端是否返回出库操作
return
;
return
;
}
}
if
(
resultOperation
.
data
!=
null
)
if
(
resultOperation
.
data
!=
null
)
{
{
ProcessInStoreTimeOut
(
resultOperation
);
ProcessHumidityCMD
(
resultOperation
);
ProcessHumidityCMD
(
resultOperation
);
}
}
...
@@ -2016,6 +2023,35 @@ namespace OnlineStore.DeviceLibrary
...
@@ -2016,6 +2023,35 @@ namespace OnlineStore.DeviceLibrary
LogUtil
.
info
(
StoreName
+
"执行TimerProcess 共处理了【"
+
span
.
TotalMilliseconds
+
"】毫秒"
);
LogUtil
.
info
(
StoreName
+
"执行TimerProcess 共处理了【"
+
span
.
TotalMilliseconds
+
"】毫秒"
);
}
}
}
}
private
void
ProcessInStoreTimeOut
(
Operation
resultOperation
)
{
try
{
Dictionary
<
string
,
string
>
data
=
resultOperation
.
data
;
//增加报警处理
if
(
data
!=
null
&&
data
.
ContainsKey
(
ParamDefine
.
inTimeout
)
&&(
data
[
ParamDefine
.
inTimeout
].
ToLower
().
Equals
(
"alarm"
)))
{
WarnMsg
=
"盘点入库超时报警"
;
LogUtil
.
error
(
LOGGER
,
"收到服务器端报警:盘点入库超时报警"
,
1000
);
Alarm
(
StoreAlarmType
.
CheckInStoreTimeOut
,
StoreAlarmType
.
CheckInStoreTimeOut
.
ToString
(),
WarnMsg
,
StoreMoveType
.
None
);
}
else
{
if
(
alarmType
.
Equals
(
StoreAlarmType
.
CheckInStoreTimeOut
))
{
LogUtil
.
error
(
"之前有报警:盘点入库超时报警,现在已经无报警,清理盘点入库报警"
);
WarnMsg
=
""
;
alarmType
=
StoreAlarmType
.
None
;
}
}
}
catch
(
Exception
ex
)
{
LogUtil
.
error
(
"ProcessInStoreTimeOut出错:"
+
ex
.
ToString
());
}
}
private
void
ProcessHumidityCMD
(
Operation
resultOperation
)
private
void
ProcessHumidityCMD
(
Operation
resultOperation
)
{
{
Dictionary
<
string
,
string
>
data
=
resultOperation
.
data
;
Dictionary
<
string
,
string
>
data
=
resultOperation
.
data
;
...
...
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论