Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
刘韬
/
SO1007_XLC_Store
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
作业
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit 254093c8
由
刘韬
编写于
2021-12-30 16:56:36 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
1
1 个父辈
43513024
显示空白字符变更
内嵌
并排
正在显示
18 个修改的文件
包含
208 行增加
和
114 行删除
DeviceLibrary/DeviceLibrary/Camera.cs
DeviceLibrary/DeviceLibrary/CodeManager.cs
DeviceLibrary/DeviceLibrary/LiftMonitor.cs
DeviceLibrary/DeviceLibrary/LineRunMonitor.cs
DeviceLibrary/DeviceLibrary/OKLEController.cs
DeviceLibrary/DeviceLibrary/ServerCommunication.cs
DeviceLibrary/theMachine/BoxTransport.cs
DeviceLibrary/theMachine/Common.cs
DeviceLibrary/theMachine/JobList.cs
DeviceLibrary/theMachine/MainMachine _BtnProcess.cs
DeviceLibrary/theMachine/MainMachine _IN.cs
DeviceLibrary/theMachine/MainMachine _Store.cs
DeviceLibrary/theMachine/MainMachine.cs
DeviceLibrary/theMachine/RobotManage.cs
TheMachine/Form1.Designer.cs
TheMachine/Form1.cs
TheMachine/IOControls.Designer.cs
TheMachine/IOControls.cs
DeviceLibrary/DeviceLibrary/Camera.cs
查看文件 @
254093c
...
@@ -164,10 +164,12 @@ public class HIKCamera
...
@@ -164,10 +164,12 @@ public class HIKCamera
}
}
public
enum
FixtureState
public
enum
FixtureState
{
{
In
,
FromIn
,
Up
,
FromOut
,
Down
,
FromInSide
,
Out
,
FromOutSide
,
DoorIn
,
ToIn
,
DoorOut
,
ToOut
,
ToInSide
,
ToOutSide
,
}
}
DeviceLibrary/DeviceLibrary/CodeManager.cs
查看文件 @
254093c
...
@@ -79,6 +79,55 @@ namespace DeviceLibrary
...
@@ -79,6 +79,55 @@ namespace DeviceLibrary
LogUtil
.
error
(
"解析摄像机配置出错:"
+
ex
.
StackTrace
);
LogUtil
.
error
(
"解析摄像机配置出错:"
+
ex
.
StackTrace
);
}
}
}
}
/// <summary>
/// 初始化摄像机名称和二维码类型
/// </summary>
public
static
bool
LoadSingle
()
{
codeTypeList
=
new
List
<
string
>();
HDLogUtil
.
LogName
=
"RollingLogFileAppender"
;
try
{
codeTypeList
=
new
List
<
string
>();
string
[]
codeArray
=
CodeType
.
Split
(
spiltChar
);
foreach
(
string
str
in
codeArray
)
{
if
(
str
.
Trim
().
Equals
(
""
))
{
continue
;
}
string
file
=
GetCodeParamFilePath
(
str
.
Trim
());
LogUtil
.
info
(
"加载到配置二维码类型:"
+
str
.
Trim
()
+
",配置文件:"
+
file
);
codeTypeList
.
Add
(
str
.
Trim
());
}
CodeLibrary
.
HDCodeLearnHelper
.
LoadConfig
(
""
,
CodeType
);
LoadCamera
(
false
);
//如果未加载到配置相机,自动配置
if
(
hikNameList
.
Count
>
0
)
{
cameraNameList
=
new
List
<
string
>(
hikNameList
);
string
cameraStr
=
""
;
foreach
(
string
name
in
hikNameList
)
{
cameraStr
+=
name
+
spiltChar
;
}
cameraStr
=
cameraStr
.
Substring
(
0
,
cameraStr
.
Length
-
1
);
ConfigAppSettings
.
SaveValue
(
Setting_Init
.
CameraName
,
cameraStr
);
LogUtil
.
info
(
"未配置扫码相机,默认【"
+
Setting_Init
.
CameraName
+
"】=【"
+
cameraStr
+
"】"
);
return
true
;
}
return
false
;
}
catch
(
Exception
ex
)
{
LogUtil
.
error
(
"解析摄像机配置出错:"
+
ex
.
StackTrace
);
}
return
false
;
}
private
static
void
LoadCamera
(
bool
isReLoad
)
private
static
void
LoadCamera
(
bool
isReLoad
)
{
{
if
(
isReLoad
||
Camera
.
_cam
==
null
)
if
(
isReLoad
||
Camera
.
_cam
==
null
)
...
...
DeviceLibrary/DeviceLibrary/LiftMonitor.cs
查看文件 @
254093c
...
@@ -4,6 +4,7 @@ using System;
...
@@ -4,6 +4,7 @@ using System;
using
System.Collections.Generic
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Linq
;
using
System.Text
;
using
System.Text
;
using
System.Threading
;
using
System.Threading.Tasks
;
using
System.Threading.Tasks
;
namespace
DeviceLibrary
namespace
DeviceLibrary
...
@@ -44,6 +45,7 @@ namespace DeviceLibrary
...
@@ -44,6 +45,7 @@ namespace DeviceLibrary
return
;
return
;
}
}
IOManager
.
IOMove
(
axisbreak
,
IO_VALUE
.
HIGH
);
IOManager
.
IOMove
(
axisbreak
,
IO_VALUE
.
HIGH
);
Thread
.
Sleep
(
200
);
axisBean
.
RelMove
(
StrokeLength
,
(
double
)
speed
);
axisBean
.
RelMove
(
StrokeLength
,
(
double
)
speed
);
DateTime
d
=
DateTime
.
Now
;
DateTime
d
=
DateTime
.
Now
;
moveInfo
.
log
(
$
"{axisBean.AxisName},LiftUp"
);
moveInfo
.
log
(
$
"{axisBean.AxisName},LiftUp"
);
...
@@ -64,6 +66,7 @@ namespace DeviceLibrary
...
@@ -64,6 +66,7 @@ namespace DeviceLibrary
if
(
IOManager
.
IOValue
(
up
.
ToString
()).
Equals
(
IO_VALUE
.
HIGH
))
if
(
IOManager
.
IOValue
(
up
.
ToString
()).
Equals
(
IO_VALUE
.
HIGH
))
{
{
axisBean
.
SuddenStop
();
axisBean
.
SuddenStop
();
IOManager
.
IOMove
(
axisbreak
,
IO_VALUE
.
LOW
);
return
true
;
return
true
;
}
}
...
@@ -82,6 +85,7 @@ namespace DeviceLibrary
...
@@ -82,6 +85,7 @@ namespace DeviceLibrary
return
;
return
;
}
}
IOManager
.
IOMove
(
axisbreak
,
IO_VALUE
.
HIGH
);
IOManager
.
IOMove
(
axisbreak
,
IO_VALUE
.
HIGH
);
Thread
.
Sleep
(
200
);
axisBean
.
RelMove
(-
StrokeLength
,
(
double
)
speed
);
axisBean
.
RelMove
(-
StrokeLength
,
(
double
)
speed
);
DateTime
d
=
DateTime
.
Now
;
DateTime
d
=
DateTime
.
Now
;
moveInfo
.
log
(
$
"{axisBean.AxisName},LiftDown"
);
moveInfo
.
log
(
$
"{axisBean.AxisName},LiftDown"
);
...
@@ -104,6 +108,7 @@ namespace DeviceLibrary
...
@@ -104,6 +108,7 @@ namespace DeviceLibrary
if
(
IOManager
.
IOValue
(
down
.
ToString
()).
Equals
(
IO_VALUE
.
HIGH
))
if
(
IOManager
.
IOValue
(
down
.
ToString
()).
Equals
(
IO_VALUE
.
HIGH
))
{
{
axisBean
.
SuddenStop
();
axisBean
.
SuddenStop
();
IOManager
.
IOMove
(
axisbreak
,
IO_VALUE
.
LOW
);
return
true
;
return
true
;
}
}
...
...
DeviceLibrary/DeviceLibrary/LineRunMonitor.cs
查看文件 @
254093c
...
@@ -61,6 +61,7 @@ namespace DeviceLibrary
...
@@ -61,6 +61,7 @@ namespace DeviceLibrary
lineTimer
.
Enabled
=
false
;
lineTimer
.
Enabled
=
false
;
pauseTime
=
DateTime
.
Now
;
pauseTime
=
DateTime
.
Now
;
DOMove
(
LineIO
,
IO_VALUE
.
LOW
);
DOMove
(
LineIO
,
IO_VALUE
.
LOW
);
if
(
linrunlist
.
Count
>
0
)
LogUtil
.
info
(
Name
+
$
" 线体管理器 暂停线体."
);
LogUtil
.
info
(
Name
+
$
" 线体管理器 暂停线体."
);
}
}
}
}
...
@@ -82,6 +83,7 @@ namespace DeviceLibrary
...
@@ -82,6 +83,7 @@ namespace DeviceLibrary
}
}
pauseTime
=
DateTime
.
MinValue
;
pauseTime
=
DateTime
.
MinValue
;
lineTimer
.
Enabled
=
true
;
lineTimer
.
Enabled
=
true
;
if
(
linrunlist
.
Count
>
0
)
LogUtil
.
info
(
Name
+
$
" 线体管理器 恢复运行线体."
);
LogUtil
.
info
(
Name
+
$
" 线体管理器 恢复运行线体."
);
}
}
...
...
DeviceLibrary/DeviceLibrary/OKLEController.cs
查看文件 @
254093c
...
@@ -105,64 +105,18 @@ public class OKLEController
...
@@ -105,64 +105,18 @@ public class OKLEController
}
}
}
}
}
}
public
static
double
SetZero
(
string
port
)
{
return
0
;
double
weight
=
0d
;
AcSerialBean
sb
=
GetSerialBean
(
port
);
if
(
sb
==
null
)
{
return
weight
;
}
if
(!
Monitor
.
TryEnter
(
sb
))
public
static
bool
queryData
(
string
port
,
out
double
weight
)
return
ValueBuffer
[
port
];
try
{
{
LogName
=
"[OKLE_"
+
port
+
"]"
;
weight
=
0d
;
//12..1.2读取力值(毛重)指令,指令格式:01 03 00 50 00 02 C4 1A
//01 03 00 00 00 02 C4 0B
byte
[]
sendData
=
new
byte
[
8
];
sendData
[
0
]
=
0x01
;
sendData
[
1
]
=
0x06
;
sendData
[
2
]
=
0x00
;
sendData
[
3
]
=
0x07
;
sendData
[
4
]
=
0xA5
;
sendData
[
5
]
=
0x0D
;
//sendData[6] = 0xC4;
//sendData[7] = 0x0B;
sendData
=
buildCheckData
(
sendData
,
sendData
.
Length
-
2
);
string
str
=
AcSerialBean
.
byteToHexStr
(
sendData
,
" "
);
byte
[]
reviceData
=
new
byte
[
15
];
bool
isOk
=
false
;
sb
.
SendCommand
(
sendData
,
ref
reviceData
,
100
,
out
isOk
);
LogUtil
.
debug
(
LogName
+
"发送数据:"
+
str
+
",收到数据 :"
+
AcSerialBean
.
byteToHexStr
(
reviceData
,
" "
));
ValueBuffer
[
port
]
=
getReviceData
(
reviceData
);
return
ValueBuffer
[
port
];
}
catch
(
Exception
e
)
{
LogUtil
.
debug
(
LogName
+
e
.
ToString
());
return
ValueBuffer
[
port
];
}
finally
{
Monitor
.
Exit
(
sb
);
}
}
public
static
double
queryData
(
string
port
)
{
double
weight
=
0d
;
AcSerialBean
sb
=
GetSerialBean
(
port
);
AcSerialBean
sb
=
GetSerialBean
(
port
);
if
(
sb
==
null
)
if
(
sb
==
null
)
{
{
return
weight
;
return
false
;
}
}
if
(!
Monitor
.
TryEnter
(
sb
))
if
(!
Monitor
.
TryEnter
(
sb
))
return
ValueBuffer
[
port
]
;
return
false
;
try
try
{
{
...
@@ -184,20 +138,19 @@ public class OKLEController
...
@@ -184,20 +138,19 @@ public class OKLEController
bool
isOk
=
false
;
bool
isOk
=
false
;
sb
.
SendCommand
(
sendData
,
ref
reviceData
,
100
,
out
isOk
);
sb
.
SendCommand
(
sendData
,
ref
reviceData
,
100
,
out
isOk
);
//LogUtil.debug(LogName + "发送数据:" + str + ",收到数据 :" + AcSerialBean.byteToHexStr(reviceData, " "));
//LogUtil.debug(LogName + "发送数据:" + str + ",收到数据 :" + AcSerialBean.byteToHexStr(reviceData, " "));
ValueBuffer
[
port
]
=
getReviceData
(
reviceData
);
return
getReviceData
(
reviceData
,
out
weight
);
return
ValueBuffer
[
port
];
}
}
catch
(
Exception
e
)
{
catch
(
Exception
e
)
{
LogUtil
.
debug
(
LogName
+
e
.
ToString
());
LogUtil
.
debug
(
LogName
+
e
.
ToString
());
return
ValueBuffer
[
port
]
;
return
false
;
}
}
finally
{
finally
{
Monitor
.
Exit
(
sb
);
Monitor
.
Exit
(
sb
);
}
}
}
}
private
static
double
getReviceData
(
byte
[]
dataArray
)
private
static
bool
getReviceData
(
byte
[]
dataArray
,
out
double
value
)
{
{
double
value
=
0d
;
value
=
0d
;
try
try
{
{
//3D 53 47 2B 30 30 32 30 2E 30 31 6B BE 0D 0A
//3D 53 47 2B 30 30 32 30 2E 30 31 6B BE 0D 0A
...
@@ -208,18 +161,23 @@ public class OKLEController
...
@@ -208,18 +161,23 @@ public class OKLEController
{
{
var
numstr
=
tempstr
.
Substring
(
3
,
8
);
var
numstr
=
tempstr
.
Substring
(
3
,
8
);
if
(!
double
.
TryParse
(
numstr
,
out
value
))
if
(!
double
.
TryParse
(
numstr
,
out
value
))
{
LogUtil
.
info
(
LogName
+
"转换出错:"
+
numstr
.
ToString
());
LogUtil
.
info
(
LogName
+
"转换出错:"
+
numstr
.
ToString
());
return
false
;
}
return
true
;
}
}
else
else
{
{
LogUtil
.
info
(
LogName
+
"转换出错:"
+
tempstr
.
ToString
());
LogUtil
.
info
(
LogName
+
"转换出错:"
+
tempstr
.
ToString
());
return
false
;
}
}
}
}
catch
(
Exception
ex
)
catch
(
Exception
ex
)
{
{
LogUtil
.
info
(
LogName
+
"转换出错:"
+
ex
.
ToString
());
LogUtil
.
info
(
LogName
+
"转换出错:"
+
ex
.
ToString
());
}
}
return
valu
e
;
return
fals
e
;
}
}
...
...
DeviceLibrary/DeviceLibrary/ServerCommunication.cs
查看文件 @
254093c
...
@@ -241,7 +241,7 @@ namespace DeviceLibrary
...
@@ -241,7 +241,7 @@ namespace DeviceLibrary
}
}
if
(
resultOperation
.
op
.
Equals
(
1
))
if
(
resultOperation
.
op
.
Equals
(
1
))
{
{
ReviceInStoreProcess
(
""
,
resultOperation
);
ReviceInStoreProcess
(
resultOperation
.
data
[
"barcode"
]
,
resultOperation
);
}
}
else
if
(
resultOperation
.
op
.
Equals
(
2
))
else
if
(
resultOperation
.
op
.
Equals
(
2
))
{
{
...
...
DeviceLibrary/theMachine/BoxTransport.cs
查看文件 @
254093c
...
@@ -21,6 +21,8 @@ namespace DeviceLibrary
...
@@ -21,6 +21,8 @@ namespace DeviceLibrary
MoveInfo
MoveInfo
;
MoveInfo
MoveInfo
;
public
string
ErrMsgTxt
=
""
;
public
string
ErrMsgTxt
=
""
;
public
bool
IgnoreX09
=
false
;
public
event
Action
<
string
,
StoreMoveType
,
bool
>
InOutEndProcessEvent
;
public
event
Action
<
string
,
StoreMoveType
,
bool
>
InOutEndProcessEvent
;
public
bool
IsComplateOrFree
{
get
=>
MoveInfo
.
MoveStep
==
MoveStep
.
Wait
;
}
public
bool
IsComplateOrFree
{
get
=>
MoveInfo
.
MoveStep
==
MoveStep
.
Wait
;
}
public
bool
IsTakedBox
{
get
=>
MoveInfo
.
MoveStep
>=
MoveStep
.
StoreTS10
;
}
public
bool
IsTakedBox
{
get
=>
MoveInfo
.
MoveStep
>=
MoveStep
.
StoreTS10
;
}
...
@@ -137,7 +139,8 @@ namespace DeviceLibrary
...
@@ -137,7 +139,8 @@ namespace DeviceLibrary
MoveInfo
.
log
(
$
"{storeMoveType}:进出轴到达取料点"
);
MoveInfo
.
log
(
$
"{storeMoveType}:进出轴到达取料点"
);
break
;
break
;
case
MoveStep
.
StoreTS07
:
case
MoveStep
.
StoreTS07
:
GetCamera
(
From
.
Zaxis_P2
).
CameraGrabOne
(
RobotManage
.
CameraA
.
GetFixtureStateFilename
(
From
.
posid
,
WareCode
,
storeMoveType
,
FixtureState
.
In
));
GetCamera
(
From
.
Zaxis_P2
).
CameraGrabOne
(
RobotManage
.
CameraA
.
GetFixtureStateFilename
(
From
.
posid
,
WareCode
,
storeMoveType
,
FixtureState
.
FromIn
));
RobotManage
.
CameraB
.
CameraGrabOne
(
RobotManage
.
CameraA
.
GetFixtureStateFilename
(
From
.
posid
,
WareCode
,
storeMoveType
,
FixtureState
.
FromInSide
));
MoveInfo
.
NextMoveStep
(
MoveStep
.
StoreTS08
);
MoveInfo
.
NextMoveStep
(
MoveStep
.
StoreTS08
);
YAxis
.
AbsMove
(
MoveInfo
,
From
.
Yaxis_PH
,
Config
.
Yaxis_P4_speed
);
YAxis
.
AbsMove
(
MoveInfo
,
From
.
Yaxis_PH
,
Config
.
Yaxis_P4_speed
);
MoveInfo
.
log
(
$
"{storeMoveType}:上下轴到达取料高点"
);
MoveInfo
.
log
(
$
"{storeMoveType}:上下轴到达取料高点"
);
...
@@ -145,23 +148,26 @@ namespace DeviceLibrary
...
@@ -145,23 +148,26 @@ namespace DeviceLibrary
case
MoveStep
.
StoreTS08
:
case
MoveStep
.
StoreTS08
:
MoveInfo
.
NextMoveStep
(
MoveStep
.
StoreTS09
);
MoveInfo
.
NextMoveStep
(
MoveStep
.
StoreTS09
);
ZAxis
.
AbsMove
(
MoveInfo
,
Config
.
Zaxis_P1
,
Config
.
Zaxis_P1_speed
);
ZAxis
.
AbsMove
(
MoveInfo
,
Config
.
Zaxis_P1
,
Config
.
Zaxis_P1_speed
);
IgnoreX09
=
false
;
MoveInfo
.
log
(
$
"{storeMoveType}:进出轴到达待机点"
);
MoveInfo
.
log
(
$
"{storeMoveType}:进出轴到达待机点"
);
break
;
break
;
case
MoveStep
.
StoreTS09
:
case
MoveStep
.
StoreTS09
:
GetCamera
(
From
.
Zaxis_P2
).
CameraGrabOne
(
RobotManage
.
CameraA
.
GetFixtureStateFilename
(
From
.
posid
,
WareCode
,
storeMoveType
,
FixtureState
.
Out
));
GetCamera
(
From
.
Zaxis_P2
).
CameraGrabOne
(
RobotManage
.
CameraA
.
GetFixtureStateFilename
(
From
.
posid
,
WareCode
,
storeMoveType
,
FixtureState
.
FromOut
));
RobotManage
.
CameraB
.
CameraGrabOne
(
RobotManage
.
CameraA
.
GetFixtureStateFilename
(
From
.
posid
,
WareCode
,
storeMoveType
,
FixtureState
.
FromOutSide
));
if
(
IOManager
.
IOValue
(
IO_Type
.
SideA_ForkMaterial_Check
).
Equals
(
IO_VALUE
.
HIGH
)
||
if
(
IOManager
.
IOValue
(
IO_Type
.
SideA_ForkMaterial_Check
).
Equals
(
IO_VALUE
.
HIGH
)
||
IOManager
.
IOValue
(
IO_Type
.
SideB_ForkMaterial_Check
).
Equals
(
IO_VALUE
.
HIGH
))
IOManager
.
IOValue
(
IO_Type
.
SideB_ForkMaterial_Check
).
Equals
(
IO_VALUE
.
HIGH
))
{
{
Msg
.
add
(
"伸缩叉2侧X10/X11检测到有物料无法继续,请检查"
,
MsgLevel
.
alarm
);
Msg
.
add
(
"伸缩叉2侧X10/X11检测到有物料无法继续,请检查"
,
MsgLevel
.
alarm
);
RobotManage
.
UserPause
(
"伸缩叉2侧X10/X11检测到有物料无法继续,请检查"
);
RobotManage
.
UserPause
(
"伸缩叉2侧X10/X11检测到有物料无法继续,请检查"
);
}
}
else
if
(
IOManager
.
IOValue
(
IO_Type
.
ForkMaterial_Check
).
Equals
(
IO_VALUE
.
LOW
))
else
if
(
!
IgnoreX09
&&
IOManager
.
IOValue
(
IO_Type
.
ForkMaterial_Check
).
Equals
(
IO_VALUE
.
LOW
))
{
{
Msg
.
add
(
"出库时伸缩叉X09
检测到有物料无法继续,请检查"
,
MsgLevel
.
alarm
);
Msg
.
add
(
"出库时伸缩叉X09
没有检测到有物料无法继续,请检查"
,
MsgLevel
.
alarm
,
ErrInfo
.
X09_BoxNotDetect
);
RobotManage
.
UserPause
(
"出库时伸缩叉X09检测到有物料无法继续,请检查"
);
RobotManage
.
UserPause
(
"出库时伸缩叉X09
没有
检测到有物料无法继续,请检查"
);
}
}
else
else
{
{
IgnoreX09
=
false
;
MoveInfo
.
NextMoveStep
(
MoveStep
.
StoreTS10
);
MoveInfo
.
NextMoveStep
(
MoveStep
.
StoreTS10
);
if
(
isSameSide
(
To
.
Xaxis_P2
))
if
(
isSameSide
(
To
.
Xaxis_P2
))
{
{
...
@@ -188,7 +194,8 @@ namespace DeviceLibrary
...
@@ -188,7 +194,8 @@ namespace DeviceLibrary
MoveInfo
.
log
(
$
"{storeMoveType}:进出轴到达目的地"
);
MoveInfo
.
log
(
$
"{storeMoveType}:进出轴到达目的地"
);
break
;
break
;
case
MoveStep
.
StoreTS13
:
case
MoveStep
.
StoreTS13
:
GetCamera
(
To
.
Zaxis_P2
).
CameraGrabOne
(
RobotManage
.
CameraA
.
GetFixtureStateFilename
(
To
.
posid
,
WareCode
,
storeMoveType
,
FixtureState
.
In
));
GetCamera
(
To
.
Zaxis_P2
).
CameraGrabOne
(
RobotManage
.
CameraA
.
GetFixtureStateFilename
(
To
.
posid
,
WareCode
,
storeMoveType
,
FixtureState
.
ToIn
));
RobotManage
.
CameraB
.
CameraGrabOne
(
RobotManage
.
CameraA
.
GetFixtureStateFilename
(
From
.
posid
,
WareCode
,
storeMoveType
,
FixtureState
.
ToInSide
));
MoveInfo
.
NextMoveStep
(
MoveStep
.
StoreTS14
);
MoveInfo
.
NextMoveStep
(
MoveStep
.
StoreTS14
);
YAxis
.
AbsMove
(
MoveInfo
,
To
.
Yaxis_PL
,
Config
.
Yaxis_P4_speed
);
YAxis
.
AbsMove
(
MoveInfo
,
To
.
Yaxis_PL
,
Config
.
Yaxis_P4_speed
);
MoveInfo
.
log
(
$
"{storeMoveType}:上下轴到达目的地低点"
);
MoveInfo
.
log
(
$
"{storeMoveType}:上下轴到达目的地低点"
);
...
@@ -199,7 +206,8 @@ namespace DeviceLibrary
...
@@ -199,7 +206,8 @@ namespace DeviceLibrary
MoveInfo
.
log
(
$
"{storeMoveType}:进出轴到达待机点"
);
MoveInfo
.
log
(
$
"{storeMoveType}:进出轴到达待机点"
);
break
;
break
;
case
MoveStep
.
StoreTS15
:
case
MoveStep
.
StoreTS15
:
GetCamera
(
To
.
Zaxis_P2
).
CameraGrabOne
(
RobotManage
.
CameraA
.
GetFixtureStateFilename
(
To
.
posid
,
WareCode
,
storeMoveType
,
FixtureState
.
Out
));
GetCamera
(
To
.
Zaxis_P2
).
CameraGrabOne
(
RobotManage
.
CameraA
.
GetFixtureStateFilename
(
To
.
posid
,
WareCode
,
storeMoveType
,
FixtureState
.
ToOut
));
RobotManage
.
CameraB
.
CameraGrabOne
(
RobotManage
.
CameraA
.
GetFixtureStateFilename
(
From
.
posid
,
WareCode
,
storeMoveType
,
FixtureState
.
ToOutSide
));
if
(
IOManager
.
IOValue
(
IO_Type
.
SideA_ForkMaterial_Check
).
Equals
(
IO_VALUE
.
HIGH
)
||
if
(
IOManager
.
IOValue
(
IO_Type
.
SideA_ForkMaterial_Check
).
Equals
(
IO_VALUE
.
HIGH
)
||
IOManager
.
IOValue
(
IO_Type
.
SideB_ForkMaterial_Check
).
Equals
(
IO_VALUE
.
HIGH
))
IOManager
.
IOValue
(
IO_Type
.
SideB_ForkMaterial_Check
).
Equals
(
IO_VALUE
.
HIGH
))
{
{
...
@@ -245,7 +253,8 @@ namespace DeviceLibrary
...
@@ -245,7 +253,8 @@ namespace DeviceLibrary
}
}
HIKCamera
GetCamera
(
int
pos
)
{
HIKCamera
GetCamera
(
int
pos
)
{
return
pos
>
0
?
RobotManage
.
CameraA
:
RobotManage
.
CameraB
;
//return pos > 0 ? RobotManage.CameraA : RobotManage.CameraB;
return
RobotManage
.
CameraA
;
}
}
}
}
}
}
DeviceLibrary/theMachine/Common.cs
查看文件 @
254093c
...
@@ -311,6 +311,7 @@ namespace DeviceLibrary
...
@@ -311,6 +311,7 @@ namespace DeviceLibrary
public
static
List
<
Msg
>
msg
=
new
List
<
Msg
>();
public
static
List
<
Msg
>
msg
=
new
List
<
Msg
>();
public
string
msgtxt
;
public
string
msgtxt
;
public
MsgLevel
msgLevel
;
public
MsgLevel
msgLevel
;
public
ErrInfo
errInfo
;
public
DateTime
datetime
;
public
DateTime
datetime
;
public
static
List
<
Msg
>
get
()
{
public
static
List
<
Msg
>
get
()
{
...
@@ -322,13 +323,13 @@ namespace DeviceLibrary
...
@@ -322,13 +323,13 @@ namespace DeviceLibrary
List
<
Msg
>
mm
=
new
List
<
Msg
>(
msg
);
List
<
Msg
>
mm
=
new
List
<
Msg
>(
msg
);
return
mm
;
return
mm
;
}
}
public
static
void
add
(
string
m
,
MsgLevel
ml
)
public
static
void
add
(
string
m
,
MsgLevel
ml
,
ErrInfo
errInfo
=
ErrInfo
.
Empty
)
{
{
lock
(
msg
)
lock
(
msg
)
{
{
var
fm
=
msg
.
Find
((
x
)
=>
x
.
msgtxt
==
m
);
var
fm
=
msg
.
Find
((
x
)
=>
x
.
msgtxt
==
m
);
if
(
fm
==
null
)
if
(
fm
==
null
)
msg
.
Add
(
new
Msg
{
msgtxt
=
m
,
msgLevel
=
ml
,
datetime
=
DateTime
.
Now
});
msg
.
Add
(
new
Msg
{
msgtxt
=
m
,
msgLevel
=
ml
,
datetime
=
DateTime
.
Now
,
errInfo
=
errInfo
});
}
}
}
}
static
bool
_setlogones
=
false
;
static
bool
_setlogones
=
false
;
...
@@ -348,6 +349,11 @@ namespace DeviceLibrary
...
@@ -348,6 +349,11 @@ namespace DeviceLibrary
info
,
info
,
alarm
alarm
}
}
public
enum
ErrInfo
{
Empty
,
X09_BoxNotDetect
,
ResetBtn
,
}
public
class
IdWorker
public
class
IdWorker
{
{
private
long
workerId
;
private
long
workerId
;
...
...
DeviceLibrary/theMachine/JobList.cs
查看文件 @
254093c
...
@@ -17,7 +17,10 @@ namespace DeviceLibrary
...
@@ -17,7 +17,10 @@ namespace DeviceLibrary
lock
(
jobInfos
)
lock
(
jobInfos
)
{
{
if
(
lastoutpos
==
jobInfo
.
PosId
)
if
(
lastoutpos
==
jobInfo
.
PosId
)
{
LogUtil
.
info
(
"出库任务正在执行:"
+
jobInfo
.
ToStr
());
return
;
return
;
}
var
l
=
jobInfos
.
ToList
().
Find
((
x
)
=>
{
return
x
.
PosId
==
jobInfo
.
PosId
;
});
var
l
=
jobInfos
.
ToList
().
Find
((
x
)
=>
{
return
x
.
PosId
==
jobInfo
.
PosId
;
});
if
(
l
==
null
)
if
(
l
==
null
)
{
{
...
@@ -39,6 +42,10 @@ namespace DeviceLibrary
...
@@ -39,6 +42,10 @@ namespace DeviceLibrary
public
static
int
Count
{
public
static
int
Count
{
get
=>
jobInfos
.
Count
;
get
=>
jobInfos
.
Count
;
}
}
public
static
void
ClearLastPosid
(
string
posid
)
{
if
(
lastoutpos
==
posid
)
lastoutpos
=
""
;
}
}
}
class
InStoreJob
:
JobInfo
class
InStoreJob
:
JobInfo
{
{
...
...
DeviceLibrary/theMachine/MainMachine _BtnProcess.cs
查看文件 @
254093c
...
@@ -41,5 +41,10 @@ namespace DeviceLibrary
...
@@ -41,5 +41,10 @@ namespace DeviceLibrary
LogUtil
.
info
(
"踩下出口脚踏开关,出口没有对接小车结束"
);
LogUtil
.
info
(
"踩下出口脚踏开关,出口没有对接小车结束"
);
}
}
}
}
void
Reset_BTN
()
{
Msg
.
add
(
"按下复位按钮"
,
MsgLevel
.
info
,
ErrInfo
.
ResetBtn
);
LogUtil
.
info
(
"按下复位按钮"
);
ProcessMsgEvent
?.
Invoke
(
Msg
.
get
());
}
}
}
}
}
DeviceLibrary/theMachine/MainMachine _IN.cs
查看文件 @
254093c
...
@@ -6,6 +6,7 @@ using System.Collections.Generic;
...
@@ -6,6 +6,7 @@ using System.Collections.Generic;
using
System.Drawing
;
using
System.Drawing
;
using
System.Linq
;
using
System.Linq
;
using
System.Text
;
using
System.Text
;
using
System.Threading
;
using
System.Threading.Tasks
;
using
System.Threading.Tasks
;
namespace
DeviceLibrary
namespace
DeviceLibrary
...
@@ -38,9 +39,17 @@ namespace DeviceLibrary
...
@@ -38,9 +39,17 @@ namespace DeviceLibrary
get
get
{
if
(
RobotManage
.
StoreType
==
StoreType
.
TypeA
)
{
if
(
RobotManage
.
StoreType
==
StoreType
.
TypeA
)
{
{
var
weight
=
OKLEController
.
queryData
(
Config
.
WeightSensorPort
);
for
(
int
i
=
0
;
i
<
5
;
i
++)
{
if
(
OKLEController
.
queryData
(
Config
.
WeightSensorPort
,
out
double
weight
))
{
return
weight
-
Config
.
WeightSensorBase
;
return
weight
-
Config
.
WeightSensorBase
;
}
}
Thread
.
Sleep
(
1000
);
}
LogUtil
.
info
(
"读取重量超时"
);
return
double
.
MaxValue
;
}
else
else
return
0
;
return
0
;
}
}
...
@@ -85,6 +94,7 @@ namespace DeviceLibrary
...
@@ -85,6 +94,7 @@ namespace DeviceLibrary
InMoveInfo
.
log
(
$
"检测到周转箱到位信号,线体运转2秒"
);
InMoveInfo
.
log
(
$
"检测到周转箱到位信号,线体运转2秒"
);
LineIn
.
LineRun
(
"prework"
,
2
);
LineIn
.
LineRun
(
"prework"
,
2
);
InMoveInfo
.
NextMoveStep
(
MoveStep
.
In01
);
InMoveInfo
.
NextMoveStep
(
MoveStep
.
In01
);
InMoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitTime
(
2000
));
}
}
else
else
{
{
...
@@ -94,9 +104,10 @@ namespace DeviceLibrary
...
@@ -94,9 +104,10 @@ namespace DeviceLibrary
break
;
break
;
case
MoveStep
.
In01
:
case
MoveStep
.
In01
:
InMoveInfo
.
NextMoveStep
(
MoveStep
.
In02
);
InMoveInfo
.
NextMoveStep
(
MoveStep
.
In02
);
if
(
CurrentWeight
<=
Config
.
StoreWeightLimited
)
var
boxCurrentWeight
=
CurrentWeight
;
if
(
boxCurrentWeight
<=
Config
.
StoreWeightLimited
)
{
{
InMoveInfo
.
log
(
$
"开始拍照扫码"
);
InMoveInfo
.
log
(
$
"开始拍照扫码
,重量:{boxCurrentWeight}kg
"
);
if
(
RobotManage
.
InoutDebugMode
)
if
(
RobotManage
.
InoutDebugMode
)
{
{
InMoveInfo
.
NextMoveStep
(
MoveStep
.
InWaitServerCallback
);
InMoveInfo
.
NextMoveStep
(
MoveStep
.
InWaitServerCallback
);
...
@@ -106,7 +117,7 @@ namespace DeviceLibrary
...
@@ -106,7 +117,7 @@ namespace DeviceLibrary
else
else
{
{
Msg
.
add
(
"周转箱超重"
,
MsgLevel
.
warning
);
Msg
.
add
(
"周转箱超重"
,
MsgLevel
.
warning
);
InMoveInfo
.
log
(
$
"周转箱超重"
);
InMoveInfo
.
log
(
$
"周转箱超重
重量:{boxCurrentWeight}
"
);
InMoveInfo
.
NextMoveStep
(
MoveStep
.
Wait
);
InMoveInfo
.
NextMoveStep
(
MoveStep
.
Wait
);
}
}
break
;
break
;
...
@@ -272,17 +283,17 @@ namespace DeviceLibrary
...
@@ -272,17 +283,17 @@ namespace DeviceLibrary
{
{
IOMove
(
IO_Type
.
Camera_Led
,
IO_VALUE
.
HIGH
);
IOMove
(
IO_Type
.
Camera_Led
,
IO_VALUE
.
HIGH
);
Task
.
Delay
(
10
).
Wait
();
Task
.
Delay
(
10
).
Wait
();
List
<
CodeInfo
>
LastCodeList
,
LastCodeList2
;
List
<
CodeInfo
>
LastCodeList
;
LastCodeList
=
CodeManager
.
CameraScan
(
new
List
<
string
>
{
Config
.
CameraName
});
LastCodeList
=
CodeManager
.
CameraScan
(
new
List
<
string
>
{
Config
.
CameraName
});
BoxParam
labelParam
=
new
BoxParam
();
//
BoxParam labelParam = new BoxParam();
labelParam
.
codeInfos
=
new
List
<
CodeInfo
>(
LastCodeList
);
//
labelParam.codeInfos = new List<CodeInfo>(LastCodeList);
if
(!
Common
.
codeProcess
(
labelParam
,
out
_
))
//
if (!Common.codeProcess(labelParam, out _))
{
//
{
Task
.
Delay
(
500
).
Wait
();
//
Task.Delay(500).Wait();
LastCodeList2
=
CodeManager
.
CameraScan
(
new
List
<
string
>
{
Config
.
CameraName
});
//
LastCodeList2 = CodeManager.CameraScan(new List<string> { Config.CameraName });
LastCodeList
.
AddRange
(
LastCodeList2
);
//
LastCodeList.AddRange(LastCodeList2);
}
//
}
//IOMove(IO_Type.Camera_Led, IO_VALUE.LOW);
//IOMove(IO_Type.Camera_Led, IO_VALUE.LOW);
return
LastCodeList
;
return
LastCodeList
;
...
...
DeviceLibrary/theMachine/MainMachine _Store.cs
查看文件 @
254093c
...
@@ -102,7 +102,7 @@ namespace DeviceLibrary
...
@@ -102,7 +102,7 @@ namespace DeviceLibrary
OutMoveInfo
.
MoveParam
=
StoreMoveInfo
.
MoveParam
.
clone
();
OutMoveInfo
.
MoveParam
=
StoreMoveInfo
.
MoveParam
.
clone
();
StoreMoveInfo
.
log
(
$
"周转箱已到达目的地"
);
StoreMoveInfo
.
log
(
$
"周转箱已到达目的地"
);
ServerCM
.
SendStoreState
(
StoreMoveInfo
.
MoveParam
.
PosID
,
StoreStatus
.
OutStoreBoxEnd
);
ServerCM
.
SendStoreState
(
StoreMoveInfo
.
MoveParam
.
PosID
,
StoreStatus
.
OutStoreBoxEnd
);
OutStoreJobList
.
ClearLastPosid
(
StoreMoveInfo
.
MoveParam
.
PosID
);
StoreMoveInfo
.
EndMove
();
StoreMoveInfo
.
EndMove
();
}
}
break
;
break
;
...
...
DeviceLibrary/theMachine/MainMachine.cs
查看文件 @
254093c
...
@@ -122,6 +122,7 @@ namespace DeviceLibrary
...
@@ -122,6 +122,7 @@ namespace DeviceLibrary
AlarmBuzzer
.
SetOnOffAction
(()
=>{
IOMove
(
IO_Type
.
Alarm_Buzzer
,
IO_VALUE
.
HIGH
);
},
()
=>
{
IOMove
(
IO_Type
.
Alarm_Buzzer
,
IO_VALUE
.
LOW
);
});
AlarmBuzzer
.
SetOnOffAction
(()
=>{
IOMove
(
IO_Type
.
Alarm_Buzzer
,
IO_VALUE
.
HIGH
);
},
()
=>
{
IOMove
(
IO_Type
.
Alarm_Buzzer
,
IO_VALUE
.
LOW
);
});
IOMonitor
.
RegisterIO
(
IO_Type
.
OutLeave_BTN
,
Config
,
IO_VALUE
.
HIGH
,
OutLeave_BTN
,
2500
,
100
);
IOMonitor
.
RegisterIO
(
IO_Type
.
OutLeave_BTN
,
Config
,
IO_VALUE
.
HIGH
,
OutLeave_BTN
,
2500
,
100
);
IOMonitor
.
RegisterIO
(
IO_Type
.
Reset_BTN
,
Config
,
IO_VALUE
.
HIGH
,
Reset_BTN
,
2500
,
100
);
LedProcessInit
();
LedProcessInit
();
}
}
private
(
bool
,
string
)
ZAxis_interference
(
int
from
,
int
to
)
private
(
bool
,
string
)
ZAxis_interference
(
int
from
,
int
to
)
...
@@ -356,7 +357,6 @@ namespace DeviceLibrary
...
@@ -356,7 +357,6 @@ namespace DeviceLibrary
}
}
break
;
break
;
case
MoveStep
.
HEND_HomeReset
:
case
MoveStep
.
HEND_HomeReset
:
OKLEController
.
SetZero
(
Config
.
WeightSensorPort
);
forceHome
=
false
;
forceHome
=
false
;
InMoveInfo
.
NewMove
(
MoveStep
.
Wait
);
InMoveInfo
.
NewMove
(
MoveStep
.
Wait
);
OutMoveInfo
.
NewMove
(
MoveStep
.
Wait
);
OutMoveInfo
.
NewMove
(
MoveStep
.
Wait
);
...
@@ -515,5 +515,9 @@ namespace DeviceLibrary
...
@@ -515,5 +515,9 @@ namespace DeviceLibrary
return
0
;
return
0
;
}
}
public
void
IgnoreX09
()
{
boxTransport
.
IgnoreX09
=
true
;
LogUtil
.
info
(
"按下X09忽略"
);
}
}
}
}
}
DeviceLibrary/theMachine/RobotManage.cs
查看文件 @
254093c
...
@@ -69,7 +69,6 @@ namespace DeviceLibrary
...
@@ -69,7 +69,6 @@ namespace DeviceLibrary
msg
+=
$
"称重传感器初始化失败 Port:{Config.WeightSensorPort}\n"
;
msg
+=
$
"称重传感器初始化失败 Port:{Config.WeightSensorPort}\n"
;
}
}
}
}
OKLEController
.
SetZero
(
Config
.
WeightSensorPort
);
if
(!
CameraA
.
LoadCameraConfig
(
"CameraA"
,
out
string
errmsg
))
if
(!
CameraA
.
LoadCameraConfig
(
"CameraA"
,
out
string
errmsg
))
{
{
IsLoadOk
=
false
;
IsLoadOk
=
false
;
...
...
TheMachine/Form1.Designer.cs
查看文件 @
254093c
...
@@ -39,6 +39,8 @@ namespace TheMachine
...
@@ -39,6 +39,8 @@ namespace TheMachine
this
.
关于
ToolStripMenuItem
=
new
System
.
Windows
.
Forms
.
ToolStripMenuItem
();
this
.
关于
ToolStripMenuItem
=
new
System
.
Windows
.
Forms
.
ToolStripMenuItem
();
this
.
tabControl1
=
new
System
.
Windows
.
Forms
.
TabControl
();
this
.
tabControl1
=
new
System
.
Windows
.
Forms
.
TabControl
();
this
.
tabPage1
=
new
System
.
Windows
.
Forms
.
TabPage
();
this
.
tabPage1
=
new
System
.
Windows
.
Forms
.
TabPage
();
this
.
btn_inreset
=
new
System
.
Windows
.
Forms
.
Button
();
this
.
btn_outreset
=
new
System
.
Windows
.
Forms
.
Button
();
this
.
pictureBox2
=
new
System
.
Windows
.
Forms
.
PictureBox
();
this
.
pictureBox2
=
new
System
.
Windows
.
Forms
.
PictureBox
();
this
.
pictureBox1
=
new
System
.
Windows
.
Forms
.
PictureBox
();
this
.
pictureBox1
=
new
System
.
Windows
.
Forms
.
PictureBox
();
this
.
btn_PauseBuzzer
=
new
System
.
Windows
.
Forms
.
Button
();
this
.
btn_PauseBuzzer
=
new
System
.
Windows
.
Forms
.
Button
();
...
@@ -50,8 +52,7 @@ namespace TheMachine
...
@@ -50,8 +52,7 @@ namespace TheMachine
this
.
listView1
=
new
System
.
Windows
.
Forms
.
ListView
();
this
.
listView1
=
new
System
.
Windows
.
Forms
.
ListView
();
this
.
btn_stop
=
new
System
.
Windows
.
Forms
.
Button
();
this
.
btn_stop
=
new
System
.
Windows
.
Forms
.
Button
();
this
.
btn_run
=
new
System
.
Windows
.
Forms
.
Button
();
this
.
btn_run
=
new
System
.
Windows
.
Forms
.
Button
();
this
.
btn_outreset
=
new
System
.
Windows
.
Forms
.
Button
();
this
.
btn_IgnoreX09
=
new
System
.
Windows
.
Forms
.
Button
();
this
.
btn_inreset
=
new
System
.
Windows
.
Forms
.
Button
();
this
.
menuStrip1
.
SuspendLayout
();
this
.
menuStrip1
.
SuspendLayout
();
this
.
tabControl1
.
SuspendLayout
();
this
.
tabControl1
.
SuspendLayout
();
this
.
tabPage1
.
SuspendLayout
();
this
.
tabPage1
.
SuspendLayout
();
...
@@ -144,6 +145,7 @@ namespace TheMachine
...
@@ -144,6 +145,7 @@ namespace TheMachine
this
.
tabPage1
.
Controls
.
Add
(
this
.
btn_outreset
);
this
.
tabPage1
.
Controls
.
Add
(
this
.
btn_outreset
);
this
.
tabPage1
.
Controls
.
Add
(
this
.
pictureBox2
);
this
.
tabPage1
.
Controls
.
Add
(
this
.
pictureBox2
);
this
.
tabPage1
.
Controls
.
Add
(
this
.
pictureBox1
);
this
.
tabPage1
.
Controls
.
Add
(
this
.
pictureBox1
);
this
.
tabPage1
.
Controls
.
Add
(
this
.
btn_IgnoreX09
);
this
.
tabPage1
.
Controls
.
Add
(
this
.
btn_PauseBuzzer
);
this
.
tabPage1
.
Controls
.
Add
(
this
.
btn_PauseBuzzer
);
this
.
tabPage1
.
Controls
.
Add
(
this
.
cb_EnableBuzzer
);
this
.
tabPage1
.
Controls
.
Add
(
this
.
cb_EnableBuzzer
);
this
.
tabPage1
.
Controls
.
Add
(
this
.
cb_IgnoreGratingSignal
);
this
.
tabPage1
.
Controls
.
Add
(
this
.
cb_IgnoreGratingSignal
);
...
@@ -156,6 +158,26 @@ namespace TheMachine
...
@@ -156,6 +158,26 @@ namespace TheMachine
this
.
tabPage1
.
Text
=
"信息"
;
this
.
tabPage1
.
Text
=
"信息"
;
this
.
tabPage1
.
UseVisualStyleBackColor
=
true
;
this
.
tabPage1
.
UseVisualStyleBackColor
=
true
;
//
//
// btn_inreset
//
this
.
btn_inreset
.
Location
=
new
System
.
Drawing
.
Point
(
657
,
219
);
this
.
btn_inreset
.
Name
=
"btn_inreset"
;
this
.
btn_inreset
.
Size
=
new
System
.
Drawing
.
Size
(
191
,
40
);
this
.
btn_inreset
.
TabIndex
=
272
;
this
.
btn_inreset
.
Text
=
"入料线状态重置"
;
this
.
btn_inreset
.
UseVisualStyleBackColor
=
true
;
this
.
btn_inreset
.
Click
+=
new
System
.
EventHandler
(
this
.
btn_inreset_Click
);
//
// btn_outreset
//
this
.
btn_outreset
.
Location
=
new
System
.
Drawing
.
Point
(
657
,
265
);
this
.
btn_outreset
.
Name
=
"btn_outreset"
;
this
.
btn_outreset
.
Size
=
new
System
.
Drawing
.
Size
(
191
,
40
);
this
.
btn_outreset
.
TabIndex
=
272
;
this
.
btn_outreset
.
Text
=
"出料线状态重置"
;
this
.
btn_outreset
.
UseVisualStyleBackColor
=
true
;
this
.
btn_outreset
.
Click
+=
new
System
.
EventHandler
(
this
.
btn_outreset_Click
);
//
// pictureBox2
// pictureBox2
//
//
this
.
pictureBox2
.
BackColor
=
System
.
Drawing
.
Color
.
Gainsboro
;
this
.
pictureBox2
.
BackColor
=
System
.
Drawing
.
Color
.
Gainsboro
;
...
@@ -288,25 +310,17 @@ namespace TheMachine
...
@@ -288,25 +310,17 @@ namespace TheMachine
this
.
btn_run
.
UseVisualStyleBackColor
=
true
;
this
.
btn_run
.
UseVisualStyleBackColor
=
true
;
this
.
btn_run
.
Click
+=
new
System
.
EventHandler
(
this
.
btn_run_Click
);
this
.
btn_run
.
Click
+=
new
System
.
EventHandler
(
this
.
btn_run_Click
);
//
//
// btn_outreset
// btn_IgnoreX09
//
this
.
btn_outreset
.
Location
=
new
System
.
Drawing
.
Point
(
657
,
265
);
this
.
btn_outreset
.
Name
=
"btn_outreset"
;
this
.
btn_outreset
.
Size
=
new
System
.
Drawing
.
Size
(
191
,
40
);
this
.
btn_outreset
.
TabIndex
=
272
;
this
.
btn_outreset
.
Text
=
"出料线状态重置"
;
this
.
btn_outreset
.
UseVisualStyleBackColor
=
true
;
this
.
btn_outreset
.
Click
+=
new
System
.
EventHandler
(
this
.
btn_outreset_Click
);
//
// btn_inreset
//
//
this
.
btn_inreset
.
Location
=
new
System
.
Drawing
.
Point
(
657
,
208
);
this
.
btn_IgnoreX09
.
BackColor
=
System
.
Drawing
.
Color
.
OrangeRed
;
this
.
btn_inreset
.
Name
=
"btn_inreset"
;
this
.
btn_IgnoreX09
.
Location
=
new
System
.
Drawing
.
Point
(
657
,
155
);
this
.
btn_inreset
.
Size
=
new
System
.
Drawing
.
Size
(
191
,
40
);
this
.
btn_IgnoreX09
.
Name
=
"btn_IgnoreX09"
;
this
.
btn_inreset
.
TabIndex
=
272
;
this
.
btn_IgnoreX09
.
Size
=
new
System
.
Drawing
.
Size
(
201
,
40
);
this
.
btn_inreset
.
Text
=
"入料线状态重置"
;
this
.
btn_IgnoreX09
.
TabIndex
=
6
;
this
.
btn_inreset
.
UseVisualStyleBackColor
=
true
;
this
.
btn_IgnoreX09
.
Text
=
"忽略X09错误,并继续运行"
;
this
.
btn_inreset
.
Click
+=
new
System
.
EventHandler
(
this
.
btn_inreset_Click
);
this
.
btn_IgnoreX09
.
UseVisualStyleBackColor
=
false
;
this
.
btn_IgnoreX09
.
Visible
=
false
;
this
.
btn_IgnoreX09
.
Click
+=
new
System
.
EventHandler
(
this
.
btn_IgnoreX09_Click
);
//
//
// Form1
// Form1
//
//
...
@@ -363,6 +377,7 @@ namespace TheMachine
...
@@ -363,6 +377,7 @@ namespace TheMachine
private
System
.
Windows
.
Forms
.
PictureBox
pictureBox1
;
private
System
.
Windows
.
Forms
.
PictureBox
pictureBox1
;
private
System
.
Windows
.
Forms
.
Button
btn_inreset
;
private
System
.
Windows
.
Forms
.
Button
btn_inreset
;
private
System
.
Windows
.
Forms
.
Button
btn_outreset
;
private
System
.
Windows
.
Forms
.
Button
btn_outreset
;
private
System
.
Windows
.
Forms
.
Button
btn_IgnoreX09
;
}
}
}
}
TheMachine/Form1.cs
查看文件 @
254093c
...
@@ -247,12 +247,24 @@ namespace TheMachine
...
@@ -247,12 +247,24 @@ namespace TheMachine
listView1
.
Items
.
Clear
();
listView1
.
Items
.
Clear
();
foreach
(
Msg
msg
in
msgs
)
foreach
(
Msg
msg
in
msgs
)
{
{
ListViewItem
lvi
=
new
ListViewItem
(
new
string
[]
{
""
,
msg
.
datetime
.
ToString
(),
msg
.
msgtxt
});
ListViewItem
lvi
=
new
ListViewItem
(
new
string
[]
{
""
,
msg
.
datetime
.
ToString
(),
msg
.
msgtxt
});
if
(
msg
.
msgLevel
==
MsgLevel
.
info
)
if
(
msg
.
msgLevel
==
MsgLevel
.
info
)
lvi
.
ForeColor
=
Color
.
DarkGreen
;
lvi
.
ForeColor
=
Color
.
DarkGreen
;
else
else
lvi
.
ForeColor
=
Color
.
Red
;
lvi
.
ForeColor
=
Color
.
Red
;
listView1
.
Items
.
Add
(
lvi
);
listView1
.
Items
.
Add
(
lvi
);
if
(
msg
.
errInfo
==
ErrInfo
.
X09_BoxNotDetect
)
{
btn_IgnoreX09
.
Visible
=
true
;
}
else
if
(
msg
.
errInfo
==
ErrInfo
.
ResetBtn
)
{
Task
.
Run
(()=>
{
if
(!
RobotManage
.
isRunning
||
userpause
)
btn_run_Click
(
this
,
EventArgs
.
Empty
);
});
}
}
}
this
.
ResumeLayout
(
true
);
this
.
ResumeLayout
(
true
);
}
}
...
@@ -271,6 +283,7 @@ namespace TheMachine
...
@@ -271,6 +283,7 @@ namespace TheMachine
RobotManage_UserPauseSet
(
this
,
false
);
RobotManage_UserPauseSet
(
this
,
false
);
//(sender as Button).Text = "暂停运行";
//(sender as Button).Text = "暂停运行";
}
}
LogUtil
.
info
(
"用户按下启动"
);
}
}
else
if
(!
userpause
)
else
if
(!
userpause
)
{
{
...
@@ -309,11 +322,13 @@ namespace TheMachine
...
@@ -309,11 +322,13 @@ namespace TheMachine
}
}
private
void
btn_stop_Click
(
object
sender
,
EventArgs
e
)
private
void
btn_stop_Click
(
object
sender
,
EventArgs
e
)
{
{
btn_run
.
Text
=
"启动"
;
Task
.
Run
(()=>{
RobotManage
.
Stop
();
});
RobotManage
.
UserPause
(
false
);
RobotManage
.
UserPause
(
false
);
userpause
=
false
;
userpause
=
false
;
Task
.
Run
(()
=>
{
RobotManage
.
Stop
();
});
btn_stop
.
Enabled
=
false
;
btn_stop
.
Enabled
=
false
;
btn_run
.
Text
=
"启动"
;
btn_run
.
BackColor
=
Color
.
Transparent
;
}
}
private
void
退出
ToolStripMenuItem_Click
(
object
sender
,
EventArgs
e
)
private
void
退出
ToolStripMenuItem_Click
(
object
sender
,
EventArgs
e
)
...
@@ -427,5 +442,11 @@ namespace TheMachine
...
@@ -427,5 +442,11 @@ namespace TheMachine
RobotManage
.
mainMachine
.
OutMoveInfo
.
NewMove
(
MoveStep
.
OutReset
);
RobotManage
.
mainMachine
.
OutMoveInfo
.
NewMove
(
MoveStep
.
OutReset
);
}
}
private
void
btn_IgnoreX09_Click
(
object
sender
,
EventArgs
e
)
{
RobotManage
.
mainMachine
.
IgnoreX09
();
btn_IgnoreX09
.
Visible
=
false
;
}
}
}
}
}
TheMachine/IOControls.Designer.cs
查看文件 @
254093c
...
@@ -225,6 +225,7 @@ namespace TheMachine
...
@@ -225,6 +225,7 @@ namespace TheMachine
//
//
// timer1
// timer1
//
//
this
.
timer1
.
Interval
=
1500
;
this
.
timer1
.
Tick
+=
new
System
.
EventHandler
(
this
.
timer1_Tick
);
this
.
timer1
.
Tick
+=
new
System
.
EventHandler
(
this
.
timer1_Tick
);
//
//
// label_weight
// label_weight
...
...
TheMachine/IOControls.cs
查看文件 @
254093c
...
@@ -77,7 +77,7 @@ namespace TheMachine
...
@@ -77,7 +77,7 @@ namespace TheMachine
if
(
RobotManage
.
StoreType
==
StoreType
.
TypeA
)
if
(
RobotManage
.
StoreType
==
StoreType
.
TypeA
)
{
{
if
(!
this
.
Visible
)
return
;
if
(!
this
.
Visible
)
return
;
var
w
=
OKLEController
.
queryData
(
Config
.
WeightSensorPort
);
if
(
OKLEController
.
queryData
(
Config
.
WeightSensorPort
,
out
double
w
))
label_weight
.
Text
=
$
"称重读数: {w:0.00}kg"
;
label_weight
.
Text
=
$
"称重读数: {w:0.00}kg"
;
}
}
else
{
else
{
...
...
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论