Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
刘韬
/
1069_MIMO_PlUS
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
作业
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit d6d176be
由
刘韬
编写于
2022-06-02 16:58:51 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
1
1 个父辈
93afe3d7
显示空白字符变更
内嵌
并排
正在显示
8 个修改的文件
包含
44 行增加
和
56 行删除
Common/util/MyWebClient.cs
DeviceLibrary/DeviceLibrary/ServerCommunication.cs
DeviceLibrary/theMachine/BoxTransport.cs
DeviceLibrary/theMachine/LabelParam.cs
DeviceLibrary/theMachine/MainMachine _BtnProcess.cs
DeviceLibrary/theMachine/MainMachine _IOMonitor.cs
DeviceLibrary/theMachine/MainMachine.cs
DeviceLibrary/theMachine/MainMachine_Store.cs
Common/util/MyWebClient.cs
查看文件 @
d6d176b
...
@@ -89,7 +89,7 @@ namespace OnlineStore.Common
...
@@ -89,7 +89,7 @@ namespace OnlineStore.Common
try
try
{
{
using
(
var
wc
=
new
MyWebClient
(
10000
))
using
(
var
wc
=
new
MyWebClient
(
timeOut
))
{
{
if
(
string
.
IsNullOrEmpty
(
wc
.
Headers
[
"Content-Type"
]))
if
(
string
.
IsNullOrEmpty
(
wc
.
Headers
[
"Content-Type"
]))
{
{
...
@@ -110,31 +110,12 @@ namespace OnlineStore.Common
...
@@ -110,31 +110,12 @@ namespace OnlineStore.Common
return
result
;
return
result
;
}
}
static
object
lockpost
=
new
object
();
static
object
lockpost
=
new
object
();
public
static
Operation
Post
(
string
url
,
Operation
operation
,
bool
simulate
,
bool
printlog
=
false
)
public
static
Operation
Post
(
string
url
,
Operation
operation
,
int
timeout
=
5000
,
bool
printlog
=
false
)
{
{
try
try
{
{
if
(
simulate
)
{
//模拟服务器返回
operation
.
status
=
200
;
operation
.
data
.
Clear
();
operation
.
data
.
Add
(
"posId"
,
"A001"
);
string
pos
=
"D100-111#D102-222#D104-333"
;
operation
.
data
.
Add
(
"pos"
,
pos
);
if
(
operation
.
op
==
1
||
operation
.
op
==
2
)
{
//入库或出库
string
json
=
JsonHelper
.
SerializeObject
(
operation
);
string
json
=
JsonHelper
.
SerializeObject
(
operation
);
LogUtil
.
error
(
"模拟HTTP服务器返回出库入库信息:"
+
json
);
string
result
=
Post
(
url
,
json
,
timeout
);
return
operation
;
}
}
else
{
//lock (lockpost)
{
string
json
=
JsonHelper
.
SerializeObject
(
operation
);
string
result
=
Post
(
url
,
json
,
2000
);
Operation
op
=
JsonHelper
.
DeserializeJsonToObject
<
Operation
>(
result
);
Operation
op
=
JsonHelper
.
DeserializeJsonToObject
<
Operation
>(
result
);
if
(
printlog
)
if
(
printlog
)
...
@@ -143,8 +124,6 @@ namespace OnlineStore.Common
...
@@ -143,8 +124,6 @@ namespace OnlineStore.Common
}
}
return
op
;
return
op
;
}
}
}
}
catch
(
Exception
ex
)
catch
(
Exception
ex
)
{
{
LogUtil
.
error
(
"Post 出错【operation.op="
+
operation
.
op
+
"】:"
+
ex
);
LogUtil
.
error
(
"Post 出错【operation.op="
+
operation
.
op
+
"】:"
+
ex
);
...
...
DeviceLibrary/DeviceLibrary/ServerCommunication.cs
查看文件 @
d6d176b
...
@@ -36,12 +36,22 @@ namespace DeviceLibrary
...
@@ -36,12 +36,22 @@ namespace DeviceLibrary
serverConnectTimer
.
AutoReset
=
true
;
serverConnectTimer
.
AutoReset
=
true
;
serverConnectTimer
.
Enabled
=
true
;
serverConnectTimer
.
Enabled
=
true
;
serverConnectTimer
.
Elapsed
+=
ServerConnectTimer_Elapsed
;
serverConnectTimer
.
Elapsed
+=
ServerConnectTimer_Elapsed
;
GC
.
KeepAlive
(
serverConnectTimer
);
}
}
int
lockerrtime
=
0
;
private
void
ServerConnectTimer_Elapsed
(
object
sender
,
System
.
Timers
.
ElapsedEventArgs
e
)
private
void
ServerConnectTimer_Elapsed
(
object
sender
,
System
.
Timers
.
ElapsedEventArgs
e
)
{
{
if
(!
Monitor
.
TryEnter
(
serverConnectTimer
))
//if (!Monitor.TryEnter(serverConnectTimer))
return
;
//{
// LogUtil.error("ServerConnectTimer_Elapsed locked");
// lockerrtime++;
// if (lockerrtime > 3)
// {
// lockerrtime = 0;
// Monitor.Exit(serverConnectTimer);
// }
// return;
//}
try
try
{
{
if
(!
RobotManage
.
isRunning
)
if
(!
RobotManage
.
isRunning
)
...
@@ -53,7 +63,7 @@ namespace DeviceLibrary
...
@@ -53,7 +63,7 @@ namespace DeviceLibrary
}
}
finally
{
finally
{
Monitor
.
Exit
(
serverConnectTimer
);
//
Monitor.Exit(serverConnectTimer);
}
}
}
}
public
void
StartConnectServer
()
{
public
void
StartConnectServer
()
{
...
@@ -93,7 +103,7 @@ namespace DeviceLibrary
...
@@ -93,7 +103,7 @@ namespace DeviceLibrary
{
{
operation
.
data
.
Add
(
"singleIn"
,
"false"
);
operation
.
data
.
Add
(
"singleIn"
,
"false"
);
}
}
Operation
resultOperation
=
HttpHelper
.
Post
(
GetPostApi
(),
operation
,
false
,
printlog
);
Operation
resultOperation
=
HttpHelper
.
Post
(
GetPostApi
(),
operation
,
5000
,
printlog
);
if
(
operation
.
seq
!=
resultOperation
.
seq
)
if
(
operation
.
seq
!=
resultOperation
.
seq
)
{
{
Thread
.
Sleep
(
1000
);
Thread
.
Sleep
(
1000
);
...
@@ -107,7 +117,6 @@ namespace DeviceLibrary
...
@@ -107,7 +117,6 @@ namespace DeviceLibrary
{
{
lock
(
serverclock
)
lock
(
serverclock
)
{
{
retry
:
Operation
operation
=
getLineBoxStatus
();
Operation
operation
=
getLineBoxStatus
();
if
(!
string
.
IsNullOrEmpty
(
posid
))
if
(!
string
.
IsNullOrEmpty
(
posid
))
operation
.
boxStatus
[
StoreID
].
data
.
Add
(
ParamDefine
.
posId
,
posid
);
operation
.
boxStatus
[
StoreID
].
data
.
Add
(
ParamDefine
.
posId
,
posid
);
...
@@ -117,14 +126,18 @@ namespace DeviceLibrary
...
@@ -117,14 +126,18 @@ namespace DeviceLibrary
LogUtil
.
info
(
JsonHelper
.
SerializeObject
(
operation
));
LogUtil
.
info
(
JsonHelper
.
SerializeObject
(
operation
));
if
(
RobotManage
.
InoutDebugMode
)
if
(
RobotManage
.
InoutDebugMode
)
return
true
;
return
true
;
Operation
resultOperation
=
HttpHelper
.
Post
(
GetPostApi
(),
operation
,
false
);
Operation
resultOperation
=
HttpHelper
.
Post
(
GetPostApi
(),
operation
,
5000
);
if
(
resultOperation
==
null
)
if
(
resultOperation
==
null
)
{
{
LogUtil
.
info
(
$
"SendStoreState error,posid:{posid}, storeStatus:{storeStatus}"
);
LogUtil
.
info
(
$
"SendStoreState error,posid:{posid}, storeStatus:{storeStatus}"
);
//goto retry;
return
false
;
return
false
;
}
}
if
(
operation
.
seq
!=
resultOperation
.
seq
)
{
LogUtil
.
info
(
$
"SendStoreState seq error,posid:{posid}, storeStatus:{storeStatus}"
);
return
false
;
}
LogUtil
.
info
(
$
"SendStoreState success,posid:{posid}, storeStatus:{storeStatus}"
);
LogUtil
.
info
(
$
"SendStoreState success,posid:{posid}, storeStatus:{storeStatus}"
);
ResultProcess
(
resultOperation
);
ResultProcess
(
resultOperation
);
...
@@ -267,7 +280,7 @@ namespace DeviceLibrary
...
@@ -267,7 +280,7 @@ namespace DeviceLibrary
printlog
=
true
;
printlog
=
true
;
}
}
Operation
resultOperation
=
HttpHelper
.
Post
(
GetPostApi
(),
lineOperation
,
printlog
);
Operation
resultOperation
=
HttpHelper
.
Post
(
GetPostApi
(),
lineOperation
,
700
,
printlog
);
if
(
resultOperation
!=
null
)
if
(
resultOperation
!=
null
)
getthtime
=
0
;
getthtime
=
0
;
//LogUtil.info(JsonHelper.SerializeObject(resultOperation.data));
//LogUtil.info(JsonHelper.SerializeObject(resultOperation.data));
...
@@ -376,17 +389,17 @@ namespace DeviceLibrary
...
@@ -376,17 +389,17 @@ namespace DeviceLibrary
return
map
;
return
map
;
if
(
RobotManage
.
mainMachine
.
IOValue
(
IO_Type
.
StringDoor_Close
).
Equals
(
IO_VALUE
.
HIGH
)
if
(
//RobotManage.mainMachine.IOValue(IO_Type.StringDoor_Close).Equals(IO_VALUE.HIGH) &&
&&
(
RobotManage
.
mainMachine
.
StringMoveInfo
.
MoveStep
==
MoveStep
.
StringOut_Released
(
RobotManage
.
mainMachine
.
StringMoveInfo
.
MoveStep
==
MoveStep
.
StringOut_Released
||
RobotManage
.
mainMachine
.
StringMoveInfo
.
MoveStep
==
MoveStep
.
Wait
))
||
RobotManage
.
mainMachine
.
StringMoveInfo
.
MoveStep
==
MoveStep
.
Wait
))
{
{
map
.
Add
(
ParamDefine
.
doorStatus
,
"料串门关闭"
);
//
map.Add(ParamDefine.doorStatus, "料串门关闭");
map
[
ParamDefine
.
openLock
]
=
ParamDefine
.
enable
;
map
[
ParamDefine
.
openLock
]
=
ParamDefine
.
enable
;
}
}
else
if
(
RobotManage
.
mainMachine
.
IOValue
(
IO_Type
.
StringDoor_Open
).
Equals
(
IO_VALUE
.
HIGH
))
//else//
if (RobotManage.mainMachine.IOValue(IO_Type.StringDoor_Open).Equals(IO_VALUE.HIGH))
{
{
map
[
ParamDefine
.
closeLock
]
=
ParamDefine
.
enable
;
map
[
ParamDefine
.
closeLock
]
=
ParamDefine
.
enable
;
map
.
Add
(
ParamDefine
.
doorStatus
,
"料串门打开"
);
//
map.Add(ParamDefine.doorStatus, "料串门打开");
}
}
if
(
RobotManage
.
mainMachine
.
StringMoveInfo
.
MoveStep
>=
MoveStep
.
StringLoad_04
if
(
RobotManage
.
mainMachine
.
StringMoveInfo
.
MoveStep
>=
MoveStep
.
StringLoad_04
&&
RobotManage
.
mainMachine
.
StringMoveInfo
.
MoveStep
<
MoveStep
.
StringOut_01
)
&&
RobotManage
.
mainMachine
.
StringMoveInfo
.
MoveStep
<
MoveStep
.
StringOut_01
)
...
...
DeviceLibrary/theMachine/BoxTransport.cs
查看文件 @
d6d176b
...
@@ -113,13 +113,12 @@ namespace DeviceLibrary
...
@@ -113,13 +113,12 @@ namespace DeviceLibrary
case
MoveStep
.
StoreTS01
:
case
MoveStep
.
StoreTS01
:
if
(
IOManager
.
IOValue
(
IO_Type
.
TrayCheck_Fixture
).
Equals
(
IO_VALUE
.
HIGH
))
if
(
IOManager
.
IOValue
(
IO_Type
.
TrayCheck_Fixture
).
Equals
(
IO_VALUE
.
HIGH
))
{
{
if
(!
IgnoreX09
&&
IOMonitor
.
IODebound
(
IO_Type
.
TrayCheck_Fixture
,
Config
,
IO_VALUE
.
HIGH
,
5000
))
if
(!
IgnoreX09
&&
IOMonitor
.
IODebound
(
IO_Type
.
TrayCheck_Fixture
,
Config
,
IO_VALUE
.
HIGH
,
5000
))
Msg
.
add
(
crc
.
GetString
(
L
.
out_store_detect_material
,
"出库时料叉X30检测到有物料无法继续,请检查."
),
MsgLevel
.
alarm
,
ErrInfo
.
X09_BoxNotDetect
);
Msg
.
add
(
crc
.
GetString
(
L
.
out_store_detect_material
,
"出库时料叉X30检测到有物料无法继续,请检查."
),
MsgLevel
.
alarm
,
ErrInfo
.
X09_BoxNotDetect
);
//RobotManage.UserPause("出库时料叉X30检测到有物料无法继续,请检查");
//RobotManage.UserPause("出库时料叉X30检测到有物料无法继续,请检查");
}
}
else
else
{
{
Msg
.
add
(
""
,
MsgLevel
.
info
,
ErrInfo
.
X09_Clear
);
Msg
.
add
(
""
,
MsgLevel
.
info
,
ErrInfo
.
X09_Clear
);
IgnoreX09
=
false
;
IgnoreX09
=
false
;
MoveInfo
.
NextMoveStep
(
MoveStep
.
StoreTS02
);
MoveInfo
.
NextMoveStep
(
MoveStep
.
StoreTS02
);
...
...
DeviceLibrary/theMachine/LabelParam.cs
查看文件 @
d6d176b
...
@@ -154,7 +154,7 @@ namespace DeviceLibrary
...
@@ -154,7 +154,7 @@ namespace DeviceLibrary
Comp_PL
=
Comp_PL
<
0
?
0
:
Comp_PL
;
Comp_PL
=
Comp_PL
<
0
?
0
:
Comp_PL
;
posid
=
aCStorePosition
.
PositionNum
;
posid
=
aCStorePosition
.
PositionNum
;
Reel
=
reel
.
clone
();
Reel
=
reel
.
clone
();
LogUtil
.
info
(
$
"BSP:{posid},Comp_PH:{Comp_PH}={
aCStorePosition.BagHigh
},Comp_PL:{Comp_PL}={reel.PlateH},Comp_PL_MM:{Config.Comp_PL_MM},{JsonHelper.SerializeObject(this)}"
);
LogUtil
.
info
(
$
"BSP:{posid},Comp_PH:{Comp_PH}={
Config.Comp_P2}-({aCStorePosition.BagHigh}-{8}+{Config.Comp_PH_MM})*{Config.Clamp_PoToMM
},Comp_PL:{Comp_PL}={reel.PlateH},Comp_PL_MM:{Config.Comp_PL_MM},{JsonHelper.SerializeObject(this)}"
);
}
}
public
const
string
ngdoor
=
"单料口"
;
public
const
string
ngdoor
=
"单料口"
;
public
const
string
strings
=
"料串口"
;
public
const
string
strings
=
"料串口"
;
...
...
DeviceLibrary/theMachine/MainMachine _BtnProcess.cs
查看文件 @
d6d176b
...
@@ -51,12 +51,6 @@ namespace DeviceLibrary
...
@@ -51,12 +51,6 @@ namespace DeviceLibrary
}
}
LogUtil
.
info
(
"按下启动按钮"
);
LogUtil
.
info
(
"按下启动按钮"
);
ProcessMsgEvent
?.
Invoke
(
Msg
.
get
());
ProcessMsgEvent
?.
Invoke
(
Msg
.
get
());
//未启动时按钮
//if (!RobotManage.isRunning)
//{
//
//}
}
}
}
}
}
}
DeviceLibrary/theMachine/MainMachine _IOMonitor.cs
查看文件 @
d6d176b
...
@@ -37,16 +37,16 @@ namespace DeviceLibrary
...
@@ -37,16 +37,16 @@ namespace DeviceLibrary
Current_Temperate
=
temp
.
Temperate
;
Current_Temperate
=
temp
.
Temperate
;
//var tempIsOK = Current_Temperate < ServerCM.Max_Temperature;
//var tempIsOK = Current_Temperate < ServerCM.Max_Temperature;
var
humi
IsOK
=
Current_Humidity
<
ServerCM
.
Max_Humidity
-
ConfigHelper
.
Config
.
Get
(
"Device_HumidityStartOffser"
,
1
)
var
humi
NeedStart
=
Current_Humidity
>
ServerCM
.
Max_Humidity
-
ConfigHelper
.
Config
.
Get
(
"Device_HumidityStartOffser"
,
1
);
&&
Current_Humidity
>
ServerCM
.
Max_Humidity
-
ConfigHelper
.
Config
.
Get
(
"Device_HumidityEndOffser"
,
10
);
var
humiNeedStop
=
Current_Humidity
<
ServerCM
.
Max_Humidity
-
ConfigHelper
.
Config
.
Get
(
"Device_HumidityEndOffser"
,
10
);
if
(
!
humiIsOK
&&
!
airisopen
)
if
(
humiNeedStart
&&
!
airisopen
)
{
{
IOMove
(
IO_Type
.
NitrogenValve
,
IO_VALUE
.
HIGH
);
IOMove
(
IO_Type
.
NitrogenValve
,
IO_VALUE
.
HIGH
);
airisopen
=
true
;
airisopen
=
true
;
LogUtil
.
info
(
$
"开始吹气,当前最大湿度:{Current_Humidity} > {ServerCM.Max_Humidity}-{ConfigHelper.Config.Get("
Device_HumidityStartOffser
", 1)}."
);
LogUtil
.
info
(
$
"开始吹气,当前最大湿度:{Current_Humidity} > {ServerCM.Max_Humidity}-{ConfigHelper.Config.Get("
Device_HumidityStartOffser
", 1)}."
);
}
}
else
if
(
humi
IsOK
&&
airisopen
)
else
if
(
humi
NeedStop
&&
airisopen
)
{
{
IOMove
(
IO_Type
.
NitrogenValve
,
IO_VALUE
.
LOW
);
IOMove
(
IO_Type
.
NitrogenValve
,
IO_VALUE
.
LOW
);
airisopen
=
false
;
airisopen
=
false
;
...
@@ -57,7 +57,7 @@ namespace DeviceLibrary
...
@@ -57,7 +57,7 @@ namespace DeviceLibrary
DateTime
lastTHoutRangeTime
=
DateTime
.
MaxValue
;
DateTime
lastTHoutRangeTime
=
DateTime
.
MaxValue
;
bool
IsTHoutRange
()
bool
IsTHoutRange
()
{
{
if
(
HumitureController
.
LastData
.
Humidity
>
ServerCM
.
Max_Humidity
if
(
HumitureController
.
LastData
.
Humidity
>
ServerCM
.
Max_Humidity
// || HumitureController.LastData.Humidity < ServerCM.Min_Humidity
||
HumitureController
.
LastData
.
Temperate
>
ServerCM
.
Max_Temperature
)
||
HumitureController
.
LastData
.
Temperate
>
ServerCM
.
Max_Temperature
)
{
{
if
(!
lastTHoutRangeStatus
)
if
(!
lastTHoutRangeStatus
)
...
...
DeviceLibrary/theMachine/MainMachine.cs
查看文件 @
d6d176b
...
@@ -305,7 +305,7 @@ namespace DeviceLibrary
...
@@ -305,7 +305,7 @@ namespace DeviceLibrary
return
;
return
;
}
}
if
(!
ConfigHelper
.
Config
.
Get
(
"Device_Disable_StringDoor"
,
false
))
if
(!
ConfigHelper
.
Config
.
Get
(
"Device_Disable_StringDoor"
,
false
))
CylinderMove
(
String
MoveInfo
,
IO_Type
.
StringDoor_Close
,
IO_Type
.
StringDoor_Open
,
IO_VALUE
.
LOW
);
CylinderMove
(
Reset
MoveInfo
,
IO_Type
.
StringDoor_Close
,
IO_Type
.
StringDoor_Open
,
IO_VALUE
.
LOW
);
break
;
break
;
case
MoveStep
.
H02_HomeReset_01
:
case
MoveStep
.
H02_HomeReset_01
:
ResetMoveInfo
.
NextMoveStep
(
MoveStep
.
H02_HomeReset
);
ResetMoveInfo
.
NextMoveStep
(
MoveStep
.
H02_HomeReset
);
...
...
DeviceLibrary/theMachine/MainMachine_Store.cs
查看文件 @
d6d176b
...
@@ -162,9 +162,12 @@ namespace DeviceLibrary
...
@@ -162,9 +162,12 @@ namespace DeviceLibrary
case
MoveStep
.
StoreOut12
:
case
MoveStep
.
StoreOut12
:
if
(
boxTransport
.
IsPutOnOut
)
if
(
boxTransport
.
IsPutOnOut
)
{
{
if
(!
ServerCM
.
SendStoreState
(
StoreMoveInfo
.
MoveParam
.
PosID
,
StoreStatus
.
OutStoreEnd
))
{
Msg
.
add
(
"服务器连接异常"
,
MsgLevel
.
warning
);
return
;
}
StoreMoveInfo
.
log
(
$
"料盘已到达目的地"
);
StoreMoveInfo
.
log
(
$
"料盘已到达目的地"
);
ServerCM
.
SendStoreState
(
StoreMoveInfo
.
MoveParam
.
PosID
,
StoreStatus
.
OutStoreEnd
);
if
(
StoreMoveInfo
.
MoveParam
.
IsNg
)
if
(
StoreMoveInfo
.
MoveParam
.
IsNg
)
{
{
...
...
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论