Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
李娜
/
SO664-HCSingleStore
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
作业
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit 4042e400
由
LN
编写于
2021-03-05 11:33:02 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
1.温湿度bug修改。2.增加日志。3.增加温湿度功能勾选功能。
1 个父辈
4e8ef533
显示空白字符变更
内嵌
并排
正在显示
8 个修改的文件
包含
98 行增加
和
50 行删除
source/Common/util/AcSerialBean.cs
source/Common/util/HumitureController.cs
source/DeviceLibrary/acSingleStore/BoxBean.cs
source/DeviceLibrary/acSingleStore/HumitureBean.cs
source/DeviceLibrary/acSingleStore/StoreBean.cs
source/HCSingleStore/FrmBox.Designer.cs
source/HCSingleStore/FrmStore.Designer.cs
source/HCSingleStore/FrmStore.cs
source/Common/util/AcSerialBean.cs
查看文件 @
4042e40
...
...
@@ -287,7 +287,7 @@ namespace OnlineStore.Common
if
(
_serialPort
.
IsOpen
)
{
//lock (lockObj)
if
(
Monitor
.
TryEnter
(
lockObj
,
1
0
))
if
(
Monitor
.
TryEnter
(
lockObj
,
1
))
{
//Monitor.Enter(lockObj);
try
...
...
source/Common/util/HumitureController.cs
查看文件 @
4042e40
using
log4net
;
using
System
;
using
System.Collections.Concurrent
;
using
System.Collections.Generic
;
using
System.IO.Ports
;
using
System.Linq
;
...
...
@@ -21,6 +22,8 @@ namespace OnlineStore.Common
private
static
string
LogName
=
""
;
private
static
Dictionary
<
string
,
AcSerialBean
>
serialBeanMap
=
new
Dictionary
<
string
,
AcSerialBean
>();
private
static
ConcurrentDictionary
<
string
,
HumitureParam
>
lastDataMap
=
new
ConcurrentDictionary
<
string
,
HumitureParam
>();
public
static
int
HumitureControllerType
=
ConfigAppSettings
.
GetIntValue
(
Setting_Init
.
HumitureControllerType
);
public
static
bool
Init
(
string
port
)
{
...
...
@@ -93,15 +96,29 @@ namespace OnlineStore.Common
}
return
null
;
}
// public static ASTemperateParam LastData = new ASTemperateParam(0, 0);
public
static
HumitureParam
QueryData
(
string
port
)
{
if
(
lastDataMap
.
TryGetValue
(
port
,
out
HumitureParam
lastparam
))
{
//1秒以内不需要重新查询
TimeSpan
span
=
DateTime
.
Now
-
lastparam
.
UpdateTime
;
if
(
span
.
TotalSeconds
<=
5
)
{
return
lastparam
;
}
else
{
lastDataMap
.
TryRemove
(
port
,
out
lastparam
);
}
}
HumitureParam
param
=
new
HumitureParam
(
0
,
0
);
List
<
double
>
data
=
queryData
(
port
);
if
(
data
.
Count
.
Equals
(
2
))
{
param
=
new
HumitureParam
(
data
[
1
],
data
[
0
]);
}
lastDataMap
.
TryAdd
(
port
,
param
);
return
param
;
}
/// <summary>
...
...
source/DeviceLibrary/acSingleStore/BoxBean.cs
查看文件 @
4042e40
...
...
@@ -488,8 +488,19 @@ namespace OnlineStore.DeviceLibrary
LogUtil
.
error
(
Name
+
" 报警,报警类型:"
+
alarmType
);
this
.
alarmType
=
alarmType
;
if
(
alarmType
.
Equals
(
StoreAlarmType
.
AxisAlarm
)
|
alarmType
.
Equals
(
StoreAlarmType
.
AxisMoveError
))
if
(
alarmType
.
Equals
(
StoreAlarmType
.
AxisAlarm
)
||
alarmType
.
Equals
(
StoreAlarmType
.
AxisMoveError
))
{
if
(
MoveInfo
.
MoveType
.
Equals
(
StoreMoveType
.
InStore
)
||
MoveInfo
.
MoveType
.
Equals
(
StoreMoveType
.
OutStore
))
{
if
(
alarmDetial
.
Equals
(
LineAlarm
.
InOutAxisAlarm
.
ToString
())
&&
MoveInfo
.
MoveParam
!=
null
&&
MoveInfo
.
MoveParam
.
PosInfo
!=
null
)
{
string
posId
=
MoveInfo
.
MoveParam
.
PosInfo
.
PosId
;
LogUtil
.
info
(
Name
+
" ["
+
MoveInfo
.
MoveType
+
"]["
+
MoveInfo
.
MoveStep
+
"]"
+
MoveInfo
.
MoveParam
.
PosInfo
.
ToStr
()
+
" 过程中进出轴报警,记录库位号["
+
posId
+
"]"
);
//TODO
}
}
LogUtil
.
error
(
Name
+
"轴报警,关闭刹车,停止运动,关闭轴,打开报警灯"
);
//IOMove(IO_Type.Axis_Brake, IO_VALUE.LOW);
StopMove
();
...
...
@@ -1048,10 +1059,14 @@ namespace OnlineStore.DeviceLibrary
if
(
isInProcess
)
{
TimeSpan
span
=
DateTime
.
Now
-
lastConTime
;
if
(
span
.
TotalSeconds
<
60
)
if
(
span
.
TotalSeconds
<
3
)
{
return
;
}
else
{
LogUtil
.
error
(
$
"{Name}server_connect_timer_Tick 已耗时{span.TotalSeconds}秒,重新处理"
);
}
}
isInProcess
=
true
;
lastConTime
=
DateTime
.
Now
;
...
...
@@ -1082,8 +1097,11 @@ namespace OnlineStore.DeviceLibrary
}
}
}
if
(
StoreManager
.
Store
.
UseTemp
)
{
humBean
.
HumidityProcess
(
this
);
}
}
catch
(
Exception
ex
)
{
LogUtil
.
error
(
Name
+
"server_connect_timer_Tick出错:"
+
ex
.
ToString
());
...
...
source/DeviceLibrary/acSingleStore/HumitureBean.cs
查看文件 @
4042e40
...
...
@@ -72,12 +72,10 @@ namespace OnlineStore.DeviceLibrary
{
try
{
if
((
DateTime
.
Now
-
preLogTime
).
TotalSeconds
>
(
8
+
box
.
DeviceID
))
if
((
DateTime
.
Now
-
preLogTime
).
TotalSeconds
>
(
5
+
box
.
DeviceID
))
{
preLogTime
=
DateTime
.
Now
;
//用最大的湿度判断是否需要吹气,开始吹气的值=发过来的值-4
//温湿度
//ASTemperateParam param = HumitureServer.GetTemperateParam(Config.GetTempAddrList());
HumitureParam
param
=
QueryData
();
double
humidity
=
0
;
double
temp
=
0
;
...
...
@@ -87,48 +85,10 @@ namespace OnlineStore.DeviceLibrary
temp
=
param
.
Temperate
;
currTempStr
=
Name
+
(
"湿度:"
+
humidity
.
ToString
()
+
",温度:"
+
temp
);
}
//double currMaxHumidity = HumitureServer.GetMaxHumidity(Config.GetTempAddrList());
double
currMaxHumidity
=
param
.
Humidity
;
float
startBlowHumidity
=
Max_Humidity
-
StartBlowValue
;
float
stopBlowHumidity
=
Max_Humidity
-
StopBlowValue
;
////判断是否需要吹气
//if (startBlowHumidity > 0 && startBlowHumidity < currMaxHumidity && IsInBlowing.Equals(false))
//{
// //判断是否距离上次结束指定的时间
// TimeSpan span = DateTime.Now - LastEndBlowTime;
// if (span.TotalMinutes > box.Config.BlowAir_Interval)
// {
// LogUtil.info(Name + "当前最大湿度:" + currMaxHumidity.ToString() + ",开始吹气湿度:" + startBlowHumidity + ",当前不在吹气中,且间隔超过" + box.Config.BlowAir_Interval + "分钟,开始吹气!");
// IsInBlowing = true;
// //Thread.Sleep(100);
// box.IOMove(IO_Type.StartOrStopBlow, IO_VALUE.HIGH);
// LastBeginBlowTime = DateTime.Now;
// LastEndBlowTime = DateTime.Now;
// }
//}
//if (IsInBlowing && stopBlowHumidity > currMaxHumidity)
//{
// LogUtil.info(Name + "当前最大湿度:" + currMaxHumidity.ToString() + ",停止吹气湿度:" + stopBlowHumidity + ",停止吹气!");
// IsInBlowing = false;
// box.IOMove(IO_Type.StartOrStopBlow, IO_VALUE.LOW);
// LastEndBlowTime = DateTime.Now;
//}
//if (IsInBlowing)
//{
// //判断是否需要结束吹气
// TimeSpan span = DateTime.Now - LastBeginBlowTime;
// if (span.TotalMinutes > box.Config.BlowAir_Time)
// {
// LogUtil.info(Name + "已经吹气" + span.TotalMinutes + "分钟,超过配置的吹气时间" + box.Config.BlowAir_Time + "分钟,停止吹气!");
// IsInBlowing = false;
// //Thread.Sleep(100);
// box.IOMove(IO_Type.StartOrStopBlow, IO_VALUE.LOW);
// LastEndBlowTime = DateTime.Now;
// }
//}
bool
needAlarm
=
false
;
//如果开始吹气并且当前达到报警值
if
(
IsInBlowing
&&
humidity
>
Max_Humidity
)
...
...
source/DeviceLibrary/acSingleStore/StoreBean.cs
查看文件 @
4042e40
...
...
@@ -22,6 +22,7 @@ namespace OnlineStore.DeviceLibrary
public
Dictionary
<
int
,
BoxConfig
>
BoxConfigMap
{
get
;
set
;
}
public
Dictionary
<
int
,
BoxBean
>
BoxMap
=
new
Dictionary
<
int
,
BoxBean
>();
public
bool
UseBuzzer
=
true
;
public
bool
UseTemp
=
true
;
public
StoreConfig
Config
{
get
;
set
;
}
#
region
初始化
...
...
source/HCSingleStore/FrmBox.Designer.cs
查看文件 @
4042e40
...
...
@@ -315,12 +315,13 @@
this
.
groupBox1
.
Controls
.
Add
(
this
.
label43
);
this
.
groupBox1
.
Controls
.
Add
(
this
.
label42
);
this
.
groupBox1
.
Font
=
new
System
.
Drawing
.
Font
(
"微软雅黑"
,
9F
,
System
.
Drawing
.
FontStyle
.
Regular
,
System
.
Drawing
.
GraphicsUnit
.
Point
,
((
byte
)(
134
)));
this
.
groupBox1
.
Location
=
new
System
.
Drawing
.
Point
(
11
,
46
4
);
this
.
groupBox1
.
Location
=
new
System
.
Drawing
.
Point
(
11
,
46
2
);
this
.
groupBox1
.
Name
=
"groupBox1"
;
this
.
groupBox1
.
Size
=
new
System
.
Drawing
.
Size
(
476
,
136
);
this
.
groupBox1
.
TabIndex
=
217
;
this
.
groupBox1
.
TabStop
=
false
;
this
.
groupBox1
.
Text
=
"伺服状态"
;
this
.
groupBox1
.
Visible
=
false
;
//
// txt4Target
//
...
...
@@ -494,7 +495,7 @@
this
.
groupBox2
.
Controls
.
Add
(
this
.
button6
);
this
.
groupBox2
.
Controls
.
Add
(
this
.
button3
);
this
.
groupBox2
.
Controls
.
Add
(
this
.
button5
);
this
.
groupBox2
.
Location
=
new
System
.
Drawing
.
Point
(
11
,
3
80
);
this
.
groupBox2
.
Location
=
new
System
.
Drawing
.
Point
(
11
,
3
78
);
this
.
groupBox2
.
Name
=
"groupBox2"
;
this
.
groupBox2
.
Size
=
new
System
.
Drawing
.
Size
(
476
,
78
);
this
.
groupBox2
.
TabIndex
=
276
;
...
...
@@ -1444,10 +1445,10 @@
// tabPage1
//
this
.
tabPage1
.
Controls
.
Add
(
this
.
panel1
);
this
.
tabPage1
.
Location
=
new
System
.
Drawing
.
Point
(
4
,
2
2
);
this
.
tabPage1
.
Location
=
new
System
.
Drawing
.
Point
(
4
,
2
9
);
this
.
tabPage1
.
Name
=
"tabPage1"
;
this
.
tabPage1
.
Padding
=
new
System
.
Windows
.
Forms
.
Padding
(
3
);
this
.
tabPage1
.
Size
=
new
System
.
Drawing
.
Size
(
1
92
,
74
);
this
.
tabPage1
.
Size
=
new
System
.
Drawing
.
Size
(
1
091
,
607
);
this
.
tabPage1
.
TabIndex
=
0
;
this
.
tabPage1
.
Text
=
" IO调试 "
;
this
.
tabPage1
.
UseVisualStyleBackColor
=
true
;
...
...
source/HCSingleStore/FrmStore.Designer.cs
查看文件 @
4042e40
...
...
@@ -55,6 +55,8 @@
this
.
toolStripMenuItem4
=
new
System
.
Windows
.
Forms
.
ToolStripMenuItem
();
this
.
开机自动启动
ToolStripMenuItem
=
new
System
.
Windows
.
Forms
.
ToolStripMenuItem
();
this
.
toolStripSeparator10
=
new
System
.
Windows
.
Forms
.
ToolStripSeparator
();
this
.
toolStripMenuItem5
=
new
System
.
Windows
.
Forms
.
ToolStripMenuItem
();
this
.
toolStripSeparator15
=
new
System
.
Windows
.
Forms
.
ToolStripSeparator
();
this
.
启用蜂鸣器
ToolStripMenuItem
=
new
System
.
Windows
.
Forms
.
ToolStripMenuItem
();
this
.
toolStripSeparator11
=
new
System
.
Windows
.
Forms
.
ToolStripSeparator
();
this
.
开启
DEBUG
日志
ToolStripMenuItem
=
new
System
.
Windows
.
Forms
.
ToolStripMenuItem
();
...
...
@@ -321,6 +323,8 @@
this
.
开机自动启动
ToolStripMenuItem
,
this
.
toolStripSeparator10
,
this
.
启用蜂鸣器
ToolStripMenuItem
,
this
.
toolStripSeparator15
,
this
.
toolStripMenuItem5
,
this
.
toolStripSeparator11
,
this
.
开启
DEBUG
日志
ToolStripMenuItem
});
this
.
toolStripMenuItem4
.
Name
=
"toolStripMenuItem4"
;
...
...
@@ -339,6 +343,18 @@
this
.
toolStripSeparator10
.
Name
=
"toolStripSeparator10"
;
this
.
toolStripSeparator10
.
Size
=
new
System
.
Drawing
.
Size
(
196
,
6
);
//
// toolStripMenuItem5
//
this
.
toolStripMenuItem5
.
Name
=
"toolStripMenuItem5"
;
this
.
toolStripMenuItem5
.
Size
=
new
System
.
Drawing
.
Size
(
199
,
26
);
this
.
toolStripMenuItem5
.
Text
=
"启用温湿度"
;
this
.
toolStripMenuItem5
.
Click
+=
new
System
.
EventHandler
(
this
.
toolStripMenuItem5_Click
);
//
// toolStripSeparator15
//
this
.
toolStripSeparator15
.
Name
=
"toolStripSeparator15"
;
this
.
toolStripSeparator15
.
Size
=
new
System
.
Drawing
.
Size
(
196
,
6
);
//
// 启用蜂鸣器ToolStripMenuItem
//
this
.
启用蜂鸣器
ToolStripMenuItem
.
Name
=
"启用蜂鸣器ToolStripMenuItem"
;
...
...
@@ -599,6 +615,8 @@
private
System
.
Windows
.
Forms
.
ToolStripMenuItem
打开设备照明
ToolStripMenuItem
;
private
System
.
Windows
.
Forms
.
ToolStripSeparator
toolStripSeparator14
;
private
System
.
Windows
.
Forms
.
ToolStripMenuItem
关闭设备照明
ToolStripMenuItem
;
private
System
.
Windows
.
Forms
.
ToolStripMenuItem
toolStripMenuItem5
;
private
System
.
Windows
.
Forms
.
ToolStripSeparator
toolStripSeparator15
;
}
}
source/HCSingleStore/FrmStore.cs
查看文件 @
4042e40
...
...
@@ -64,6 +64,14 @@ namespace OnlineStore.ACSingleStore
{
启用蜂鸣器
ToolStripMenuItem
.
Text
=
"启用蜂鸣器"
;
}
if
(
store
.
UseTemp
)
{
toolStripMenuItem5
.
Text
=
gouStr
+
" 启用温湿度"
;
}
else
{
toolStripMenuItem5
.
Text
=
"启用温湿度"
;
}
foreach
(
BoxBean
box
in
store
.
BoxMap
.
Values
)
{
FrmBox
frm
=
new
FrmBox
();
...
...
@@ -661,5 +669,30 @@ namespace OnlineStore.ACSingleStore
{
btnCloseLed_Click
(
null
,
null
);
}
private
void
toolStripMenuItem5_Click
(
object
sender
,
EventArgs
e
)
{
if
(!
LoadOk
)
{
return
;
}
bool
result
=
!
toolStripMenuItem5
.
Text
.
Contains
(
gouStr
);
if
(
result
.
Equals
(
store
.
UseTemp
))
{
return
;
}
store
.
UseTemp
=
result
;
if
(
result
)
{
toolStripMenuItem5
.
Text
=
gouStr
+
" 启用温湿度"
;
}
else
{
toolStripMenuItem5
.
Text
=
"启用温湿度"
;
}
LogUtil
.
info
(
store
.
Name
+
"勾选:启用温湿度="
+
result
);
}
}
}
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论