Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
李娜
/
AutoCountMachine
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
作业
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit 5ddaf0ae
由
LN
编写于
2020-05-26 16:15:56 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
增加入料照明
增加条码解析 增加接口代码 IO模块更新。
1 个父辈
ae2be12f
全部展开
隐藏空白字符变更
内嵌
并排
正在显示
13 个修改的文件
包含
250 行增加
和
143 行删除
RC1266-AutoCountMachine/source/AutoCountClient/FrmInputEquip.cs
RC1266-AutoCountMachine/source/AutoCountClient/记录.txt
RC1266-AutoCountMachine/source/Common/util/MyWebClient.cs
RC1266-AutoCountMachine/source/DeviceLibrary/bean/BatchMoveBean.cs
RC1266-AutoCountMachine/source/DeviceLibrary/bean/BatchMoveBean_Partial.cs
RC1266-AutoCountMachine/source/DeviceLibrary/bean/InputEquip.cs
RC1266-AutoCountMachine/source/DeviceLibrary/bean/InputEquip_InStore.cs
RC1266-AutoCountMachine/source/DeviceLibrary/bean/OutputEquip.cs
RC1266-AutoCountMachine/source/DeviceLibrary/bean/OutputEquip_Partial.cs
RC1266-AutoCountMachine/source/DeviceLibrary/bean/X_RAY_Equip_Partial.cs
RC1266-AutoCountMachine/source/DeviceLibrary/deviceLibrary/halcon/CodeManager.cs
RC1266-AutoCountMachine/source/DeviceLibrary/manager/SServerManager.cs
RC1266-AutoCountMachine/source/DeviceLibrary/model/WorkParam.cs
RC1266-AutoCountMachine/source/AutoCountClient/FrmInputEquip.cs
查看文件 @
5ddaf0a
...
@@ -508,8 +508,10 @@ namespace OnlineStore.AutoCountClient
...
@@ -508,8 +508,10 @@ namespace OnlineStore.AutoCountClient
private
void
btnScan_Click
(
object
sender
,
EventArgs
e
)
private
void
btnScan_Click
(
object
sender
,
EventArgs
e
)
{
{
List
<
string
>
LastCodeList
=
CodeManager
.
CameraScan
(
equipBean
.
Config
.
LeftCamera
,
equipBean
.
Name
);
equipBean
.
IOMove
(
IO_Type
.
Camera_Led
,
IO_VALUE
.
HIGH
);
string
msg
=
CodeManager
.
ProcessCode
(
LastCodeList
);
List
<
string
>
LastCodeList
=
CodeManager
.
CameraScan
(
equipBean
.
Name
,
equipBean
.
Config
.
LeftCamera
);
string
msg
=
CodeManager
.
GetValidCode
(
LastCodeList
);
equipBean
.
IOMove
(
IO_Type
.
Camera_Led
,
IO_VALUE
.
LOW
);
LogUtil
.
info
(
equipBean
.
Name
+
"["
+
equipBean
.
Config
.
LeftCamera
+
"]扫码测试结果:\r\n"
+
msg
);
LogUtil
.
info
(
equipBean
.
Name
+
"["
+
equipBean
.
Config
.
LeftCamera
+
"]扫码测试结果:\r\n"
+
msg
);
MessageBox
.
Show
(
equipBean
.
Name
+
"["
+
equipBean
.
Config
.
LeftCamera
+
"]扫码测试结果:"
+
msg
);
MessageBox
.
Show
(
equipBean
.
Name
+
"["
+
equipBean
.
Config
.
LeftCamera
+
"]扫码测试结果:"
+
msg
);
}
}
...
@@ -641,8 +643,10 @@ namespace OnlineStore.AutoCountClient
...
@@ -641,8 +643,10 @@ namespace OnlineStore.AutoCountClient
private
void
btnRScan_Click
(
object
sender
,
EventArgs
e
)
private
void
btnRScan_Click
(
object
sender
,
EventArgs
e
)
{
{
List
<
string
>
LastCodeList
=
CodeManager
.
CameraScan
(
equipBean
.
Config
.
RightCamera
,
equipBean
.
Name
);
equipBean
.
IOMove
(
IO_Type
.
Camera_Led
,
IO_VALUE
.
HIGH
);
string
msg
=
CodeManager
.
ProcessCode
(
LastCodeList
);
List
<
string
>
LastCodeList
=
CodeManager
.
CameraScan
(
equipBean
.
Name
,
equipBean
.
Config
.
RightCamera
);
string
msg
=
CodeManager
.
GetValidCode
(
LastCodeList
);
equipBean
.
IOMove
(
IO_Type
.
Camera_Led
,
IO_VALUE
.
LOW
);
LogUtil
.
info
(
equipBean
.
Name
+
"["
+
equipBean
.
Config
.
RightCamera
+
"]扫码测试结果:\r\n"
+
msg
);
LogUtil
.
info
(
equipBean
.
Name
+
"["
+
equipBean
.
Config
.
RightCamera
+
"]扫码测试结果:\r\n"
+
msg
);
MessageBox
.
Show
(
equipBean
.
Name
+
"["
+
equipBean
.
Config
.
RightCamera
+
"]扫码测试结果:"
+
msg
);
MessageBox
.
Show
(
equipBean
.
Name
+
"["
+
equipBean
.
Config
.
RightCamera
+
"]扫码测试结果:"
+
msg
);
}
}
...
...
RC1266-AutoCountMachine/source/AutoCountClient/记录.txt
查看文件 @
5ddaf0a
...
@@ -12,3 +12,10 @@
...
@@ -12,3 +12,10 @@
4.入料模块复位时,需要先下降顶升气缸,防止伺服报警。
4.入料模块复位时,需要先下降顶升气缸,防止伺服报警。
去掉X56
去掉X56
20200526
增加入料照明
增加条码解析
增加接口代码
IO模块更新。
\ No newline at end of file
\ No newline at end of file
RC1266-AutoCountMachine/source/Common/util/MyWebClient.cs
查看文件 @
5ddaf0a
...
@@ -71,19 +71,14 @@ namespace OnlineStore.Common
...
@@ -71,19 +71,14 @@ namespace OnlineStore.Common
}
}
}
}
return
true
;
return
true
;
}
}
//public static readonly ILog LOGGER = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
public
static
string
Post
(
string
url
,
string
paramData
,
int
timeOut
=
10000
)
public
static
string
Post
(
string
url
,
string
paramData
,
int
timeOut
=
2000
)
{
{
return
Post
(
url
,
paramData
,
Encoding
.
UTF8
,
timeOut
);
return
Post
(
url
,
paramData
,
Encoding
.
UTF8
,
timeOut
);
}
}
private
static
int
isLog
=
ConfigAppSettings
.
GetIntValue
(
Setting_Init
.
Server_Log_Open
);
private
static
int
isLog
=
ConfigAppSettings
.
GetIntValue
(
Setting_Init
.
Server_Log_Open
);
public
static
string
Post
(
string
url
,
string
paramData
,
Encoding
encoding
,
int
timeOut
=
2000
)
public
static
string
Post
(
string
url
,
string
paramData
,
Encoding
encoding
,
int
timeOut
=
10000
)
{
{
//if (PingURLIP(url, 100).Equals(false))
//{
// return "";
//}
if
(
isLog
==
1
)
if
(
isLog
==
1
)
{
{
LogUtil
.
info
(
"给服务器发送数据【"
+
paramData
+
"】 "
);
LogUtil
.
info
(
"给服务器发送数据【"
+
paramData
+
"】 "
);
...
...
RC1266-AutoCountMachine/source/DeviceLibrary/bean/BatchMoveBean.cs
查看文件 @
5ddaf0a
...
@@ -25,10 +25,10 @@ namespace OnlineStore.DeviceLibrary
...
@@ -25,10 +25,10 @@ namespace OnlineStore.DeviceLibrary
private
InputEquip
Robot
private
InputEquip
Robot
{
{
get
{
return
RobotManager
.
robot
.
inputEquip
;
}
get
{
return
RobotManager
.
robot
.
inputEquip
;
}
}
}
public
BatchMoveBean
(
InputEquip_Config
config
,
AxisBean
axis
,
int
inType
=
1
)
public
BatchMoveBean
(
InputEquip_Config
config
,
AxisBean
axis
,
int
inType
=
1
)
{
{
this
.
EquipType
=
inType
;
this
.
EquipType
=
inType
;
this
.
BatchAxis
=
axis
;
this
.
BatchAxis
=
axis
;
string
ioAdd
=
"L_"
;
string
ioAdd
=
"L_"
;
...
@@ -121,7 +121,7 @@ namespace OnlineStore.DeviceLibrary
...
@@ -121,7 +121,7 @@ namespace OnlineStore.DeviceLibrary
{
{
StopMove
();
StopMove
();
}
}
MoveInfo
.
NewMove
(
RobotMoveType
.
Reset
,
StepEnum
.
IBR01_LocationDown
);
MoveInfo
.
NewMove
(
RobotMoveType
.
Reset
,
StepEnum
.
IBR01_LocationDown
);
MoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitTime
(
100
));
MoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitTime
(
100
));
WorkLog
(
"开始复位,定位气缸下降"
);
WorkLog
(
"开始复位,定位气缸下降"
);
LocationDown
(
MoveInfo
);
LocationDown
(
MoveInfo
);
...
@@ -151,7 +151,7 @@ namespace OnlineStore.DeviceLibrary
...
@@ -151,7 +151,7 @@ namespace OnlineStore.DeviceLibrary
if
(
Robot
.
IOValue
(
IO_LineIn_Check
).
Equals
(
Robot
.
IOValue
(
IO_LineEnd_Check
)))
if
(
Robot
.
IOValue
(
IO_LineIn_Check
).
Equals
(
Robot
.
IOValue
(
IO_LineEnd_Check
)))
{
{
LineStop
();
LineStop
();
MoveInfo
.
NextMoveStep
(
StepEnum
.
IBR03_BatchHome
);
MoveInfo
.
NextMoveStep
(
StepEnum
.
IBR03_BatchHome
);
WorkLog
(
"复位:批量轴开始回原点"
);
WorkLog
(
"复位:批量轴开始回原点"
);
BatchAxis
.
HomeMove
(
MoveInfo
);
BatchAxis
.
HomeMove
(
MoveInfo
);
}
}
...
@@ -173,8 +173,8 @@ namespace OnlineStore.DeviceLibrary
...
@@ -173,8 +173,8 @@ namespace OnlineStore.DeviceLibrary
{
{
MoveInfo
.
NextMoveStep
(
StepEnum
.
IBR04_WaitTime
);
MoveInfo
.
NextMoveStep
(
StepEnum
.
IBR04_WaitTime
);
MoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitTime
(
100
));
MoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitTime
(
100
));
// WorkLog("复位:顶升气缸下降");
// WorkLog("复位:顶升气缸下降");
// LocationDown(MoveInfo);
// LocationDown(MoveInfo);
}
}
else
if
(
MoveInfo
.
IsStep
(
StepEnum
.
IBR04_WaitTime
))
else
if
(
MoveInfo
.
IsStep
(
StepEnum
.
IBR04_WaitTime
))
{
{
...
@@ -196,7 +196,7 @@ namespace OnlineStore.DeviceLibrary
...
@@ -196,7 +196,7 @@ namespace OnlineStore.DeviceLibrary
BatchAxis
.
SuddenStop
();
BatchAxis
.
SuddenStop
();
}
}
public
DateTime
LastAlarmTime
=
DateTime
.
Now
;
public
DateTime
LastAlarmTime
=
DateTime
.
Now
;
public
AlarmType
alarmType
=
AlarmType
.
None
;
public
AlarmType
alarmType
=
AlarmType
.
None
;
internal
void
Alarm
(
AlarmType
alarmType
)
internal
void
Alarm
(
AlarmType
alarmType
)
{
{
...
@@ -343,7 +343,7 @@ namespace OnlineStore.DeviceLibrary
...
@@ -343,7 +343,7 @@ namespace OnlineStore.DeviceLibrary
//当等待超过一分钟时,需要打印提示
//当等待超过一分钟时,需要打印提示
TimeSpan
span
=
DateTime
.
Now
-
moveInfo
.
LastSetpTime
;
TimeSpan
span
=
DateTime
.
Now
-
moveInfo
.
LastSetpTime
;
string
NotOkMsg
=
""
;
string
NotOkMsg
=
""
;
bool
isOk
=
!
moveInfo
.
OneWaitCanEndStep
;
bool
isOk
=
!
moveInfo
.
OneWaitCanEndStep
;
foreach
(
WaitResultInfo
wait
in
list
)
foreach
(
WaitResultInfo
wait
in
list
)
{
{
if
(
wait
.
IsEnd
)
if
(
wait
.
IsEnd
)
...
@@ -369,7 +369,7 @@ namespace OnlineStore.DeviceLibrary
...
@@ -369,7 +369,7 @@ namespace OnlineStore.DeviceLibrary
if
(!
msg
.
Equals
(
""
))
if
(!
msg
.
Equals
(
""
))
{
{
isOk
=
false
;
isOk
=
false
;
WarnMsg
=
Name
+
msg
;
WarnMsg
=
Name
+
msg
;
Alarm
(
AlarmType
.
AxisMoveError
);
Alarm
(
AlarmType
.
AxisMoveError
);
LogUtil
.
error
(
WarnMsg
,
DeviceID
*
1000
+
14
);
LogUtil
.
error
(
WarnMsg
,
DeviceID
*
1000
+
14
);
break
;
break
;
...
@@ -378,8 +378,8 @@ namespace OnlineStore.DeviceLibrary
...
@@ -378,8 +378,8 @@ namespace OnlineStore.DeviceLibrary
}
}
else
if
(
wait
.
WaitType
.
Equals
(
WaitEnum
.
W002_IOValue
))
else
if
(
wait
.
WaitType
.
Equals
(
WaitEnum
.
W002_IOValue
))
{
{
NotOkMsg
=
" ["
+
IOManager
.
Get
DI
(
wait
.
IoType
,
Robot
.
DeviceID
).
DisplayStr
+
"="
+
wait
.
IoValue
+
"]"
;
NotOkMsg
=
" ["
+
IOManager
.
Get
IO
(
wait
.
IoType
,
Robot
.
DeviceID
).
DisplayStr
+
"="
+
wait
.
IoValue
+
"]"
;
wait
.
IsEnd
=
Robot
.
IOValue
(
wait
.
IoType
).
Equals
(
wait
.
IoValue
);
wait
.
IsEnd
=
Robot
.
IOValue
(
wait
.
IoType
).
Equals
(
wait
.
IoValue
);
if
(!
wait
.
IsEnd
)
if
(!
wait
.
IsEnd
)
{
{
...
@@ -417,19 +417,20 @@ namespace OnlineStore.DeviceLibrary
...
@@ -417,19 +417,20 @@ namespace OnlineStore.DeviceLibrary
{
{
LogUtil
.
error
(
msg
);
LogUtil
.
error
(
msg
);
}
}
}
}
}
}
}
}
else
if
(
wait
.
WaitType
.
Equals
(
WaitEnum
.
W003_Time
))
else
if
(
wait
.
WaitType
.
Equals
(
WaitEnum
.
W003_Time
))
{
{
wait
.
IsEnd
=
(
span
.
TotalMilliseconds
>=
wait
.
TimeMSeconds
);
wait
.
IsEnd
=
(
span
.
TotalMilliseconds
>=
wait
.
TimeMSeconds
);
}
else
if
(
wait
.
WaitType
.
Equals
(
WaitEnum
.
W101_BatchAxisMove
))
}
else
if
(
wait
.
WaitType
.
Equals
(
WaitEnum
.
W101_BatchAxisMove
))
{
{
//等待信号亮或者走到绝对位置才停止
//等待信号亮或者走到绝对位置才停止
if
(
Robot
.
IOValue
(
BatchAxis
.
TargetIoType
).
Equals
(
BatchAxis
.
TargetIoValue
))
if
(
Robot
.
IOValue
(
BatchAxis
.
TargetIoType
).
Equals
(
BatchAxis
.
TargetIoValue
))
{
{
LogUtil
.
debug
(
Name
+
"CheckWaitResult 检测到"
+
BatchAxis
.
TargetIoType
+
"="
+
BatchAxis
.
TargetIoValue
+
",停止运行"
);
LogUtil
.
debug
(
Name
+
"CheckWaitResult 检测到"
+
BatchAxis
.
TargetIoType
+
"="
+
BatchAxis
.
TargetIoValue
+
",停止运行"
);
BatchAxis
.
AxisStopCheckMove
();
BatchAxis
.
AxisStopCheckMove
();
if
(
ACServerManager
.
GetBusyStatus
(
wait
.
AxisInfo
.
DeviceName
,
wait
.
AxisInfo
.
GetAxisValue
()).
Equals
(
1
))
if
(
ACServerManager
.
GetBusyStatus
(
wait
.
AxisInfo
.
DeviceName
,
wait
.
AxisInfo
.
GetAxisValue
()).
Equals
(
1
))
{
{
BatchAxis
.
SuddenStop
();
BatchAxis
.
SuddenStop
();
...
@@ -437,14 +438,15 @@ namespace OnlineStore.DeviceLibrary
...
@@ -437,14 +438,15 @@ namespace OnlineStore.DeviceLibrary
wait
.
IsEnd
=
true
;
wait
.
IsEnd
=
true
;
}
}
else
else
{
{
if
(
ACServerManager
.
GetBusyStatus
(
wait
.
AxisInfo
.
DeviceName
,
wait
.
AxisInfo
.
GetAxisValue
()).
Equals
(
0
))
if
(
ACServerManager
.
GetBusyStatus
(
wait
.
AxisInfo
.
DeviceName
,
wait
.
AxisInfo
.
GetAxisValue
()).
Equals
(
0
))
{
{
BatchAxis
.
AxisStopCheckMove
();
BatchAxis
.
AxisStopCheckMove
();
wait
.
IsEnd
=
true
;
wait
.
IsEnd
=
true
;
}
}
}
}
}
else
if
(
wait
.
WaitType
.
Equals
(
WaitEnum
.
W102_FeedScanCode
))
}
else
if
(
wait
.
WaitType
.
Equals
(
WaitEnum
.
W102_FeedScanCode
))
{
{
if
(
LastCodeList
.
Count
>
0
)
if
(
LastCodeList
.
Count
>
0
)
{
{
...
@@ -501,5 +503,11 @@ namespace OnlineStore.DeviceLibrary
...
@@ -501,5 +503,11 @@ namespace OnlineStore.DeviceLibrary
}
}
public
string
GetMoveStr
()
{
string
code
=
MoveInfo
.
MoveParam
!=
null
?
MoveInfo
.
MoveParam
.
WareCode
:
""
;
return
MoveInfo
.
MoveType
+
" "
+
MoveInfo
.
MoveStep
+
" "
+
code
+
"\n"
;
}
}
}
}
}
RC1266-AutoCountMachine/source/DeviceLibrary/bean/BatchMoveBean_Partial.cs
查看文件 @
5ddaf0a
...
@@ -178,7 +178,8 @@ namespace OnlineStore.DeviceLibrary
...
@@ -178,7 +178,8 @@ namespace OnlineStore.DeviceLibrary
else
if
(
MoveInfo
.
IsStep
(
StepEnum
.
IB09_ScanCode
))
else
if
(
MoveInfo
.
IsStep
(
StepEnum
.
IB09_ScanCode
))
{
{
MoveInfo
.
NextMoveStep
(
StepEnum
.
IB10_ScanOK
);
MoveInfo
.
NextMoveStep
(
StepEnum
.
IB10_ScanOK
);
WorkLog
(
"料串入料 :扫码结束,等待取料机构来取料"
);
MoveInfo
.
MoveParam
.
WareCode
=
CodeManager
.
GetValidCode
(
LastCodeList
);
WorkLog
(
"料串入料 :扫码结束【"
+
MoveInfo
.
MoveParam
.
WareCode
+
"】,等待取料机构来取料"
);
}
}
else
if
(
MoveInfo
.
IsStep
(
StepEnum
.
IB11_TrayLeave
))
else
if
(
MoveInfo
.
IsStep
(
StepEnum
.
IB11_TrayLeave
))
{
{
...
@@ -235,11 +236,11 @@ namespace OnlineStore.DeviceLibrary
...
@@ -235,11 +236,11 @@ namespace OnlineStore.DeviceLibrary
LogUtil
.
error
(
Name
+
"当前状态:"
+
MoveInfo
.
MoveType
+
",GetTrayOK暂不处理"
);
LogUtil
.
error
(
Name
+
"当前状态:"
+
MoveInfo
.
MoveType
+
",GetTrayOK暂不处理"
);
}
}
}
}
internal
string
GetCurrCode
()
//internal string LCodeStr = "";
{
//internal string GetCurrCode()
string
code
=
CodeManager
.
ProcessCode
(
LastCodeList
);
//{
return
code
;
// return LCodeStr = CodeManager.GetValidCode(LastCodeList);
}
//
}
private
void
FI_21_BatchAxisDown
()
private
void
FI_21_BatchAxisDown
()
{
{
...
@@ -273,13 +274,14 @@ namespace OnlineStore.DeviceLibrary
...
@@ -273,13 +274,14 @@ namespace OnlineStore.DeviceLibrary
try
try
{
{
Task
<
List
<
string
>>
scanTask
=
Task
.
Factory
.
StartNew
(
delegate
Task
<
List
<
string
>>
scanTask
=
Task
.
Factory
.
StartNew
(
delegate
{
{
Robot
.
IOMove
(
IO_Type
.
Camera_Led
,
IO_VALUE
.
HIGH
);
NextCodeList
=
CodeManager
.
CameraScan
(
CameraName
,
Name
);
NextCodeList
=
CodeManager
.
CameraScan
(
Name
,
CameraName
);
if
(
NextCodeList
.
Count
<=
0
)
if
(
NextCodeList
.
Count
<=
0
)
{
{
NextCodeList
=
CodeManager
.
CameraScan
(
CameraName
,
Name
);
NextCodeList
=
CodeManager
.
CameraScan
(
Name
,
Camera
Name
);
}
}
Robot
.
IOMove
(
IO_Type
.
Camera_Led
,
IO_VALUE
.
LOW
);
return
NextCodeList
;
return
NextCodeList
;
});
});
}
}
...
@@ -299,12 +301,13 @@ namespace OnlineStore.DeviceLibrary
...
@@ -299,12 +301,13 @@ namespace OnlineStore.DeviceLibrary
if
(
NextCodeList
.
Count
>
0
)
if
(
NextCodeList
.
Count
>
0
)
{
{
WorkLog
(
"料盘移栽 :开始扫码:使用预扫码"
);
MoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitTime
(
300
));
MoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitTime
(
300
));
LastCodeList
=
new
List
<
string
>(
NextCodeList
);
LastCodeList
=
new
List
<
string
>(
NextCodeList
);
NextCodeList
=
new
List
<
string
>();
NextCodeList
=
new
List
<
string
>();
MoveInfo
.
MoveParam
.
WareCode
=
CodeManager
.
GetValidCode
(
LastCodeList
);
MoveInfo
.
NextMoveStep
(
StepEnum
.
IB10_ScanOK
);
MoveInfo
.
NextMoveStep
(
StepEnum
.
IB10_ScanOK
);
WorkLog
(
"料盘移栽 :上料横移取料端"
);
WorkLog
(
"料盘移栽 :使用预扫码【"
+
MoveInfo
.
MoveParam
.
WareCode
+
"】,等待取料机构来取料"
);
//WorkLog("料盘移栽 :上料横移取料端");
// CylinderMove(MoveInfo, IO_Type.SL_MoveCylinder_Give, IO_Type.SL_MoveCylinder_Take);
// CylinderMove(MoveInfo, IO_Type.SL_MoveCylinder_Give, IO_Type.SL_MoveCylinder_Take);
}
}
else
if
(
isScan
)
else
if
(
isScan
)
...
@@ -317,12 +320,14 @@ namespace OnlineStore.DeviceLibrary
...
@@ -317,12 +320,14 @@ namespace OnlineStore.DeviceLibrary
{
{
Task
<
List
<
string
>>
scanTask
=
Task
.
Factory
.
StartNew
(
delegate
Task
<
List
<
string
>>
scanTask
=
Task
.
Factory
.
StartNew
(
delegate
{
{
Robot
.
IOMove
(
IO_Type
.
Camera_Led
,
IO_VALUE
.
HIGH
);
LastCodeList
=
CodeManager
.
CameraScan
(
CameraName
,
Name
);
LastCodeList
=
CodeManager
.
CameraScan
(
Name
,
Camera
Name
);
if
(
LastCodeList
.
Count
<=
0
)
if
(
LastCodeList
.
Count
<=
0
)
{
{
LastCodeList
=
CodeManager
.
CameraScan
(
CameraName
,
Name
);
LastCodeList
=
CodeManager
.
CameraScan
(
Name
,
Camera
Name
);
}
}
Robot
.
IOMove
(
IO_Type
.
Camera_Led
,
IO_VALUE
.
LOW
);
return
LastCodeList
;
return
LastCodeList
;
});
});
}
}
...
@@ -447,7 +452,7 @@ namespace OnlineStore.DeviceLibrary
...
@@ -447,7 +452,7 @@ namespace OnlineStore.DeviceLibrary
}
}
}
}
if
(
LastHeight
<=
8
)
{
LastHeight
=
8
;
}
if
(
LastHeight
<=
8
)
{
LastHeight
=
8
;
}
string
code
=
CodeManager
.
Process
Code
(
LastCodeList
);
string
code
=
CodeManager
.
GetValid
Code
(
LastCodeList
);
string
msg
=
Name
+
" 计算盘高:上升前 ["
+
StartMovePosition
+
"]实时[ "
+
EndMovePosition
+
"]差值["
+
(
EndMovePosition
-
StartMovePosition
)
+
"]系数["
+
AxisChangeValue
+
"] 计算后"
+
buchongStr
+
"["
+
height
+
"]"
+
",归类为【"
+
LastHeight
+
"mm】条码【"
+
code
+
"】"
;
string
msg
=
Name
+
" 计算盘高:上升前 ["
+
StartMovePosition
+
"]实时[ "
+
EndMovePosition
+
"]差值["
+
(
EndMovePosition
-
StartMovePosition
)
+
"]系数["
+
AxisChangeValue
+
"] 计算后"
+
buchongStr
+
"["
+
height
+
"]"
+
",归类为【"
+
LastHeight
+
"mm】条码【"
+
code
+
"】"
;
LogUtil
.
info
(
msg
);
LogUtil
.
info
(
msg
);
return
LastHeight
;
return
LastHeight
;
...
...
RC1266-AutoCountMachine/source/DeviceLibrary/bean/InputEquip.cs
查看文件 @
5ddaf0a
...
@@ -240,12 +240,14 @@ namespace OnlineStore.DeviceLibrary
...
@@ -240,12 +240,14 @@ namespace OnlineStore.DeviceLibrary
{
{
//若左侧或右侧在等待扫码结束的状态,需要开始去取料
//若左侧或右侧在等待扫码结束的状态,需要开始去取料
if
(
LeftBatchMove
.
MoveInfo
.
MoveType
.
Equals
(
RobotMoveType
.
Working
)
&&
LeftBatchMove
.
MoveInfo
.
IsStep
(
StepEnum
.
IB10_ScanOK
))
if
(
LeftBatchMove
.
MoveInfo
.
MoveType
.
Equals
(
RobotMoveType
.
Working
)
&&
LeftBatchMove
.
MoveInfo
.
IsStep
(
StepEnum
.
IB10_ScanOK
))
{
{
StartWorking
(
new
WorkParam
(
1
,
0
,
LeftBatchMove
.
GetCurrCode
()));
string
code
=
LeftBatchMove
.
MoveInfo
.
MoveParam
.
WareCode
;
StartWorking
(
new
WorkParam
(
1
,
0
,
code
));
}
}
else
if
(
RightBatchMove
.
MoveInfo
.
MoveType
.
Equals
(
RobotMoveType
.
Working
)
&&
RightBatchMove
.
MoveInfo
.
IsStep
(
StepEnum
.
IB10_ScanOK
))
else
if
(
RightBatchMove
.
MoveInfo
.
MoveType
.
Equals
(
RobotMoveType
.
Working
)
&&
RightBatchMove
.
MoveInfo
.
IsStep
(
StepEnum
.
IB10_ScanOK
))
{
{
StartWorking
(
new
WorkParam
(
2
,
0
,
RightBatchMove
.
GetCurrCode
()));
string
code
=
RightBatchMove
.
MoveInfo
.
MoveParam
.
WareCode
;
StartWorking
(
new
WorkParam
(
2
,
0
,
code
));
}
}
}
}
if
(
SecMoveInfo
.
MoveType
.
Equals
(
RobotMoveType
.
None
)
&&
NoErrorAlarm
())
if
(
SecMoveInfo
.
MoveType
.
Equals
(
RobotMoveType
.
None
)
&&
NoErrorAlarm
())
...
@@ -373,8 +375,8 @@ namespace OnlineStore.DeviceLibrary
...
@@ -373,8 +375,8 @@ namespace OnlineStore.DeviceLibrary
{
{
msg
+=
"\n"
;
msg
+=
"\n"
;
}
}
msg
+=
"左侧上料 :"
+
LeftBatchMove
.
MoveInfo
.
MoveType
+
" "
+
LeftBatchMove
.
MoveInfo
.
MoveStep
+
"\n"
;
msg
+=
"左侧上料 :"
+
LeftBatchMove
.
GetMoveStr
()+
"\n"
;
msg
+=
"右侧上料:"
+
RightBatchMove
.
MoveInfo
.
MoveType
+
" "
+
RightBatchMove
.
MoveInfo
.
MoveStep
+
"\n"
;
msg
+=
"右侧上料:"
+
RightBatchMove
.
GetMoveStr
()
+
"\n"
;
return
msg
;
return
msg
;
}
}
}
}
...
...
RC1266-AutoCountMachine/source/DeviceLibrary/bean/InputEquip_InStore.cs
查看文件 @
5ddaf0a
...
@@ -189,14 +189,40 @@ namespace OnlineStore.DeviceLibrary
...
@@ -189,14 +189,40 @@ namespace OnlineStore.DeviceLibrary
else
if
(
MoveInfo
.
IsStep
(
StepEnum
.
IW10_SaveSize
))
else
if
(
MoveInfo
.
IsStep
(
StepEnum
.
IW10_SaveSize
))
{
{
MoveInfo
.
NextMoveStep
(
StepEnum
.
IW11_GetTargetPosition
);
MoveInfo
.
NextMoveStep
(
StepEnum
.
IW11_GetTargetPosition
);
if
(
MoveInfo
.
MoveParam
.
TargetPosType
.
Equals
(
0
))
MoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitTime
(
1000
));
if
(
SServerManager
.
CanConnect
())
{
{
if
(
DefautTargetP
>
0
)
Task
task
=
Task
.
Factory
.
StartNew
(
delegate
{
{
bool
outNeed
=
false
;
MoveInfo
.
MoveParam
.
TargetPosType
=
DefautTargetP
;
string
msg
=
SServerManager
.
Get_VMICheckRLC
(
Name
,
MoveInfo
.
MoveParam
.
WareCode
,
out
outNeed
);
if
(!
msg
.
Equals
(
""
))
{
WorkLog
(
" 【"
+
MoveInfo
.
MoveParam
.
WareCode
+
"】获取是否测值失败:"
+
msg
);
MoveInfo
.
MoveParam
.
IsNgReel
=
true
;
MoveInfo
.
MoveParam
.
NgMsg
=
msg
;
}
else
if
(
outNeed
)
{
MoveInfo
.
MoveParam
.
TargetPosType
=
2
;
WorkLog
(
" 【"
+
MoveInfo
.
MoveParam
.
WareCode
+
"】需要测值"
);
}
else
{
MoveInfo
.
MoveParam
.
TargetPosType
=
1
;
WorkLog
(
" 【"
+
MoveInfo
.
MoveParam
.
WareCode
+
"】无需测值,开始点料"
);
}
});
}
else
{
if
(
MoveInfo
.
MoveParam
.
TargetPosType
.
Equals
(
0
))
{
if
(
DefautTargetP
>
0
)
{
MoveInfo
.
MoveParam
.
TargetPosType
=
DefautTargetP
;
}
}
}
WorkLog
(
" 根据条码获取目标位置:"
+
MoveInfo
.
MoveParam
.
ToStr
());
}
}
WorkLog
(
" 根据条码获取目标位置:"
+
MoveInfo
.
MoveParam
.
ToStr
());
}
}
#
endregion
#
endregion
...
@@ -204,11 +230,25 @@ namespace OnlineStore.DeviceLibrary
...
@@ -204,11 +230,25 @@ namespace OnlineStore.DeviceLibrary
{
{
if
(
MoveInfo
.
MoveParam
.
TargetPosType
.
Equals
(
0
))
if
(
MoveInfo
.
MoveParam
.
TargetPosType
.
Equals
(
0
))
{
{
//随机目标地址
if
(
SServerManager
.
CanConnect
())
Random
r
=
new
Random
();
{
int
targetP
=
r
.
Next
(
1
,
100
)
%
3
+
1
;
if
(
MoveInfo
.
IsTimeOut
(
120
))
MoveInfo
.
MoveParam
.
TargetPosType
=
targetP
;
{
WorkLog
(
" 随机放料目标:"
+
targetP
);
WarnMsg
=
Name
+
"等待"
+
MoveInfo
.
MoveParam
.
WareCode
+
"验证是否测值 超时["
+
MoveInfo
.
TimeOutSeconds
+
"]秒"
;
LogUtil
.
error
(
Name
+
WarnMsg
);
Alarm
(
AlarmType
.
IoSingleTimeOut
);
}
return
;
}
else
{
//随机目标地址
Random
r
=
new
Random
();
int
targetP
=
r
.
Next
(
1
,
100
)
%
3
+
1
;
MoveInfo
.
MoveParam
.
TargetPosType
=
targetP
;
WorkLog
(
" 随机放料目标:"
+
targetP
);
}
}
}
if
(
MoveInfo
.
MoveParam
.
TargetPosType
.
Equals
(
1
))
if
(
MoveInfo
.
MoveParam
.
TargetPosType
.
Equals
(
1
))
{
{
...
@@ -240,7 +280,7 @@ namespace OnlineStore.DeviceLibrary
...
@@ -240,7 +280,7 @@ namespace OnlineStore.DeviceLibrary
{
{
MoveInfo
.
NextMoveStep
(
StepEnum
.
IW24_WaitCanPut
);
MoveInfo
.
NextMoveStep
(
StepEnum
.
IW24_WaitCanPut
);
WorkLog
(
" 放料到XRay:等待XRay可放料"
);
WorkLog
(
" 放料到XRay:等待XRay可放料"
);
MoveInfo
.
TimeOutSeconds
=
120
;
//TODO
//TODO
MoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitTime
(
1000
));
MoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitTime
(
1000
));
MoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitIO
(
IO_Type
.
X_InLine_Check
,
IO_VALUE
.
LOW
));
MoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitIO
(
IO_Type
.
X_InLine_Check
,
IO_VALUE
.
LOW
));
...
@@ -249,7 +289,7 @@ namespace OnlineStore.DeviceLibrary
...
@@ -249,7 +289,7 @@ namespace OnlineStore.DeviceLibrary
else
if
(
MoveInfo
.
IsStep
(
StepEnum
.
IW24_WaitCanPut
))
else
if
(
MoveInfo
.
IsStep
(
StepEnum
.
IW24_WaitCanPut
))
{
{
MoveInfo
.
NextMoveStep
(
StepEnum
.
IW41_Clamping_Relax
);
MoveInfo
.
NextMoveStep
(
StepEnum
.
IW41_Clamping_Relax
);
RobotManager
.
robot
.
XrayBean
.
In_ReelInfo
=
new
ReelInfo
(
MoveInfo
.
MoveParam
.
WareCode
,
MoveInfo
.
MoveParam
.
PlateW
,
MoveInfo
.
MoveParam
.
PlateH
);
RobotManager
.
robot
.
XrayBean
.
In_ReelInfo
=
MoveInfo
.
MoveParam
.
GetReelInfo
(
);
WorkLog
(
" 放料到XRay:夹料气缸放松,更新XRay入口料盘信息:"
+
RobotManager
.
robot
.
XrayBean
.
In_ReelInfo
.
ToStr
());
WorkLog
(
" 放料到XRay:夹料气缸放松,更新XRay入口料盘信息:"
+
RobotManager
.
robot
.
XrayBean
.
In_ReelInfo
.
ToStr
());
CylinderMove
(
MoveInfo
,
IO_Type
.
Clamping_Work
,
IO_Type
.
Clamping_Relax
);
CylinderMove
(
MoveInfo
,
IO_Type
.
Clamping_Work
,
IO_Type
.
Clamping_Relax
);
}
}
...
...
RC1266-AutoCountMachine/source/DeviceLibrary/bean/OutputEquip.cs
查看文件 @
5ddaf0a
...
@@ -306,10 +306,10 @@ namespace OnlineStore.DeviceLibrary
...
@@ -306,10 +306,10 @@ namespace OnlineStore.DeviceLibrary
else
if
(
ShelfMoveInfo
.
IsStep
(
StepEnum
.
OBR02_CylinderBack
))
else
if
(
ShelfMoveInfo
.
IsStep
(
StepEnum
.
OBR02_CylinderBack
))
{
{
ShelfMoveInfo
.
NextMoveStep
(
StepEnum
.
OBR03_LineRun
);
;
ShelfMoveInfo
.
NextMoveStep
(
StepEnum
.
OBR03_LineRun
);
;
ShelfWorkLog
(
" :链条先转动
3
秒钟,横移电机停止"
);
ShelfWorkLog
(
" :链条先转动
8
秒钟,横移电机停止"
);
IOMove
(
IO_Type
.
O_WLine_Run
,
IO_VALUE
.
HIGH
);
IOMove
(
IO_Type
.
O_WLine_Run
,
IO_VALUE
.
HIGH
);
IOMove
(
IO_Type
.
O_ELine_Run
,
IO_VALUE
.
HIGH
);
IOMove
(
IO_Type
.
O_ELine_Run
,
IO_VALUE
.
HIGH
);
ShelfMoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitTime
(
3
000
));
ShelfMoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitTime
(
8
000
));
IOMove
(
IO_Type
.
O_SWLine_Run
,
IO_VALUE
.
LOW
);
IOMove
(
IO_Type
.
O_SWLine_Run
,
IO_VALUE
.
LOW
);
}
}
else
if
(
ShelfMoveInfo
.
IsStep
(
StepEnum
.
OBR03_LineRun
))
else
if
(
ShelfMoveInfo
.
IsStep
(
StepEnum
.
OBR03_LineRun
))
...
@@ -510,12 +510,14 @@ namespace OnlineStore.DeviceLibrary
...
@@ -510,12 +510,14 @@ namespace OnlineStore.DeviceLibrary
msg
+=
"贴标状态:"
+
SecMoveInfo
.
MoveType
+
" "
+
SecMoveInfo
.
MoveStep
+
"\n"
;
msg
+=
"贴标状态:"
+
SecMoveInfo
.
MoveType
+
" "
+
SecMoveInfo
.
MoveStep
+
"\n"
;
msg
+=
"料串状态:"
+
ShelfMoveInfo
.
MoveType
+
" "
+
ShelfMoveInfo
.
MoveStep
+
"\n"
;
msg
+=
"料串状态:"
+
ShelfMoveInfo
.
MoveType
+
" "
+
ShelfMoveInfo
.
MoveStep
+
"\n"
;
//msg += "料盘信息:" + MoveInfo.MoveParam.ToStr() + " \r\n";
// msg += "标签信息:" + Out_ReelInfo.ToStr() + " \r\n";
// msg += "标签信息:" + Out_ReelInfo.ToStr() + " \r\n";
msg
+=
"当前料串:"
+
WorkShelfId
+
",累积出料 "
+
OutReelCount
+
" 盘共 "
+
OutReelHeight
+
" mm \r\n"
;
msg
+=
"当前料串:"
+
WorkShelfId
+
",累积出料 "
+
OutReelCount
+
" 盘共 "
+
OutReelHeight
+
" mm \r\n"
;
msg
+=
"打印机["
+
RobotManager
.
PrintName
+
"]:"
+
RobotManager
.
LastPrintStatus
+
"\n"
;
msg
+=
"打印机["
+
RobotManager
.
PrintName
+
"]:"
+
RobotManager
.
LastPrintStatus
+
"\n"
;
if
(
MoveInfo
.
MoveType
.
Equals
(
RobotMoveType
.
Working
))
{
msg
+=
"当前料盘:"
+
MoveInfo
.
MoveParam
.
OutStr
()
+
" \r\n"
;
}
return
msg
;
return
msg
;
}
}
...
...
RC1266-AutoCountMachine/source/DeviceLibrary/bean/OutputEquip_Partial.cs
查看文件 @
5ddaf0a
...
@@ -370,7 +370,7 @@ namespace OnlineStore.DeviceLibrary
...
@@ -370,7 +370,7 @@ namespace OnlineStore.DeviceLibrary
else
if
(
SecMoveInfo
.
IsStep
(
StepEnum
.
OL04_PrintOk
))
else
if
(
SecMoveInfo
.
IsStep
(
StepEnum
.
OL04_PrintOk
))
{
{
bool
isPrintOk
=
RobotManager
.
LastPrintStatus
.
Equals
(
Asa
.
PrintLabel
.
PrinterStatus
.
Idle
);
bool
isPrintOk
=
RobotManager
.
LastPrintStatus
.
Equals
(
Asa
.
PrintLabel
.
PrinterStatus
.
Idle
);
bool
isTimeOut
=
SecMoveInfo
.
IsTimeOut
(
12
0
);
bool
isTimeOut
=
SecMoveInfo
.
IsTimeOut
(
3
0
);
if
(
isPrintOk
||
isTimeOut
)
if
(
isPrintOk
||
isTimeOut
)
{
{
SecMoveInfo
.
NextMoveStep
(
StepEnum
.
OL05_TakeBack
);
SecMoveInfo
.
NextMoveStep
(
StepEnum
.
OL05_TakeBack
);
...
...
RC1266-AutoCountMachine/source/DeviceLibrary/bean/X_RAY_Equip_Partial.cs
查看文件 @
5ddaf0a
...
@@ -157,16 +157,21 @@ namespace OnlineStore.DeviceLibrary
...
@@ -157,16 +157,21 @@ namespace OnlineStore.DeviceLibrary
MoveInfo
.
NextMoveStep
(
StepEnum
.
XW12_EndCount
);
MoveInfo
.
NextMoveStep
(
StepEnum
.
XW12_EndCount
);
if
(
Work_ReelInfo
.
WareCount
<=
0
)
if
(
Work_ReelInfo
.
WareCount
<=
0
)
{
{
MoveInfo
.
MoveParam
.
WareCount
=
99999
;
Work_ReelInfo
.
WareCount
=
99999
;
Work_ReelInfo
.
WareCount
=
99999
;
}
}
WorkLog
(
"料盘处理:点料结束,关闭X关机互锁信号"
);
WorkLog
(
"料盘处理:点料结束,关闭X关机互锁信号"
);
IOMove
(
IO_Type
.
X_Lock_On
,
IO_VALUE
.
LOW
);
IOMove
(
IO_Type
.
X_Lock_On
,
IO_VALUE
.
LOW
);
MoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitTime
(
1000
));
MoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitTime
(
1000
));
Task
.
Factory
.
StartNew
(
delegate
{
SServerManager
.
Return_Material
(
Name
,
MoveInfo
.
MoveParam
.
WareCode
,
Work_ReelInfo
.
WareCount
);
});
}
}
#
endregion
#
endregion
else
if
(
MoveInfo
.
IsStep
(
StepEnum
.
XW12_EndCount
))
else
if
(
MoveInfo
.
IsStep
(
StepEnum
.
XW12_EndCount
))
{
{
MoveInfo
.
NextMoveStep
(
StepEnum
.
XW21_WaitOutNoReel
);
MoveInfo
.
NextMoveStep
(
StepEnum
.
XW21_WaitOutNoReel
);
MoveInfo
.
TimeOutSeconds
=
120
;
WorkLog
(
"料盘处理:等待出口无料盘"
);
WorkLog
(
"料盘处理:等待出口无料盘"
);
MoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitIO
(
IO_Type
.
Out_TrayCheck
,
IO_VALUE
.
LOW
));
MoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitIO
(
IO_Type
.
Out_TrayCheck
,
IO_VALUE
.
LOW
));
}
}
...
@@ -196,7 +201,7 @@ namespace OnlineStore.DeviceLibrary
...
@@ -196,7 +201,7 @@ namespace OnlineStore.DeviceLibrary
{
{
MoveInfo
.
NextMoveStep
(
StepEnum
.
XW25_WaitTime
);
MoveInfo
.
NextMoveStep
(
StepEnum
.
XW25_WaitTime
);
WorkLog
(
"料盘处理:清空 Work_ReelInfo,更新 再转动3秒"
);
WorkLog
(
"料盘处理:清空 Work_ReelInfo,更新 再转动3秒"
);
Out_ReelInfo
=
new
ReelInfo
(
Work_ReelInfo
.
WareCode
,
Work_ReelInfo
.
PlateW
,
Work_ReelInfo
.
PlateH
,
Work_ReelInfo
.
WareCount
);
Out_ReelInfo
=
Work_ReelInfo
.
GetReelInfo
(
);
Work_ReelInfo
=
new
ReelInfo
();
Work_ReelInfo
=
new
ReelInfo
();
IOMove
(
IO_Type
.
X_MLine_Run
,
IO_VALUE
.
HIGH
);
IOMove
(
IO_Type
.
X_MLine_Run
,
IO_VALUE
.
HIGH
);
IOMove
(
IO_Type
.
X_OLine_Run
,
IO_VALUE
.
HIGH
);
IOMove
(
IO_Type
.
X_OLine_Run
,
IO_VALUE
.
HIGH
);
...
...
RC1266-AutoCountMachine/source/DeviceLibrary/deviceLibrary/halcon/CodeManager.cs
查看文件 @
5ddaf0a
...
@@ -51,7 +51,7 @@ namespace OnlineStore.DeviceLibrary
...
@@ -51,7 +51,7 @@ namespace OnlineStore.DeviceLibrary
}
}
private
static
void
LoadCamera
(
bool
isReLoad
)
private
static
void
LoadCamera
(
bool
isReLoad
)
{
{
if
(
isReLoad
||
Camera
.
_cam
==
null
)
if
(
isReLoad
||
Camera
.
_cam
==
null
)
{
{
try
try
{
{
...
@@ -59,13 +59,13 @@ namespace OnlineStore.DeviceLibrary
...
@@ -59,13 +59,13 @@ namespace OnlineStore.DeviceLibrary
{
{
Camera
.
_cam
.
CloseAll
();
Camera
.
_cam
.
CloseAll
();
}
}
Camera
.
Type
=
CameraType
.
HIK
;
Camera
.
Type
=
CameraType
.
HIK
;
Camera
.
_cam
.
Load
();
Camera
.
_cam
.
Load
();
}
}
catch
(
Exception
ex
)
catch
(
Exception
ex
)
{
{
LogUtil
.
error
(
"加载HIK相机出错:"
,
ex
);
LogUtil
.
error
(
"加载HIK相机出错:"
,
ex
);
}
}
}
}
string
[]
names
=
Camera
.
_cam
.
Name
;
string
[]
names
=
Camera
.
_cam
.
Name
;
...
@@ -84,7 +84,7 @@ namespace OnlineStore.DeviceLibrary
...
@@ -84,7 +84,7 @@ namespace OnlineStore.DeviceLibrary
{
{
LogUtil
.
info
(
"加载到HIK相机:"
+
name
);
LogUtil
.
info
(
"加载到HIK相机:"
+
name
);
}
}
}
}
}
}
public
static
void
CloseCamera
(
string
cameraName
)
public
static
void
CloseCamera
(
string
cameraName
)
...
@@ -92,22 +92,17 @@ namespace OnlineStore.DeviceLibrary
...
@@ -92,22 +92,17 @@ namespace OnlineStore.DeviceLibrary
Camera
.
_cam
.
Close
(
cameraName
);
Camera
.
_cam
.
Close
(
cameraName
);
}
}
public
static
void
CloseAllCamera
()
public
static
void
CloseAllCamera
()
{
Camera
.
_cam
.
CloseAll
();
}
public
static
List
<
string
>
CameraScan
(
string
camera
,
string
deviceName
,
bool
findRightCodeBreak
=
false
)
{
{
List
<
string
>
cameraList
=
new
List
<
string
>();
Camera
.
_cam
.
CloseAll
();
cameraList
.
Add
(
camera
);
return
CameraScan
(
cameraList
,
deviceName
,
findRightCodeBreak
);
}
}
private
static
int
ScanCount
=
0
;
private
static
int
ScanCount
=
0
;
private
static
int
codeCount
=
ConfigAppSettings
.
GetIntValue
(
Setting_Init
.
CodeCount
);
private
static
int
codeCount
=
ConfigAppSettings
.
GetIntValue
(
Setting_Init
.
CodeCount
);
[
HandleProcessCorruptedStateExceptions
]
[
HandleProcessCorruptedStateExceptions
]
public
static
List
<
string
>
CameraScan
(
List
<
string
>
cameraList
,
string
deviceName
,
bool
findRightCodeBreak
=
false
)
public
static
List
<
string
>
CameraScan
(
string
deviceName
,
params
string
[]
cameraList
)
{
{
List
<
string
>
codeList
=
new
List
<
string
>();
List
<
string
>
codeList
=
new
List
<
string
>();
if
(
cameraList
==
null
||
cameraList
.
Count
<=
0
)
if
(
cameraList
==
null
||
cameraList
.
Length
<=
0
)
{
{
return
codeList
;
return
codeList
;
}
}
...
@@ -120,23 +115,23 @@ namespace OnlineStore.DeviceLibrary
...
@@ -120,23 +115,23 @@ namespace OnlineStore.DeviceLibrary
continue
;
continue
;
}
}
ScanCount
++;
ScanCount
++;
DateTime
startTime
=
DateTime
.
Now
;
DateTime
startTime
=
DateTime
.
Now
;
if
(
deviceName
!=
""
)
if
(
deviceName
!=
""
)
{
{
LogUtil
.
info
(
deviceName
+
" 【"
+
cameraName
+
"】开始取图片"
);
LogUtil
.
debug
(
deviceName
+
" 【"
+
cameraName
+
"】开始取图片"
);
}
}
HalconDotNet
.
HObject
ho_Image
=
null
;
HalconDotNet
.
HObject
ho_Image
=
null
;
bool
findRightCode
=
false
;
try
try
{
{
ho_Image
=
Camera
.
_cam
.
CaptureOnImage
(
cameraName
);
ho_Image
=
Camera
.
_cam
.
CaptureOnImage
(
cameraName
);
if
(
ho_Image
==
null
)
if
(
ho_Image
==
null
)
{
{
LogUtil
.
error
(
deviceName
+
" 【"
+
cameraName
+
"】取图片失败["
+
Camera
.
_cam
.
ErrInfo
+
"],关闭相机"
);
LogUtil
.
error
(
deviceName
+
" 【"
+
cameraName
+
"】取图片失败["
+
Camera
.
_cam
.
ErrInfo
+
"],关闭相机"
);
CloseCamera
(
cameraName
);
CloseCamera
(
cameraName
);
continue
;
continue
;
}
}
LogUtil
.
debug
(
deviceName
+
" 【"
+
cameraName
+
"】取图片完成,开始扫码"
);
LogUtil
.
debug
(
deviceName
+
" 【"
+
cameraName
+
"】取图片完成,开始扫码"
);
List
<
CodeInfo
>
cc
=
new
List
<
CodeInfo
>();
List
<
CodeInfo
>
cc
=
new
List
<
CodeInfo
>();
string
r
=
""
;
string
r
=
""
;
...
@@ -157,18 +152,10 @@ namespace OnlineStore.DeviceLibrary
...
@@ -157,18 +152,10 @@ namespace OnlineStore.DeviceLibrary
if
(!
codeList
.
Contains
(
str
))
if
(!
codeList
.
Contains
(
str
))
{
{
codeList
.
Add
(
str
);
codeList
.
Add
(
str
);
r
=
r
+
"##"
+
str
;
r
=
r
+
"##"
+
str
;
if
(!
findRightCode
)
{
findRightCode
=
IsRightCode
(
str
);
}
}
}
}
}
if
(
findRightCodeBreak
&&
findRightCode
)
{
break
;
}
}
}
if
(
String
.
IsNullOrEmpty
(
r
))
if
(
String
.
IsNullOrEmpty
(
r
))
{
{
...
@@ -176,7 +163,7 @@ namespace OnlineStore.DeviceLibrary
...
@@ -176,7 +163,7 @@ namespace OnlineStore.DeviceLibrary
}
}
if
(
deviceName
!=
""
||
r
!=
""
)
if
(
deviceName
!=
""
||
r
!=
""
)
{
{
LogUtil
.
info
(
deviceName
+
" 【"
+
cameraName
+
"】扫码完成【"
+
FormUtil
.
GetSpanStr
(
DateTime
.
Now
-
startTime
)
+
"】
["
+
findRightCode
+
"]
"
+
ScanCount
+
" :"
+
r
);
LogUtil
.
info
(
deviceName
+
" 【"
+
cameraName
+
"】扫码完成【"
+
FormUtil
.
GetSpanStr
(
DateTime
.
Now
-
startTime
)
+
"】"
+
ScanCount
+
" :"
+
r
);
}
}
}
}
catch
(
AccessViolationException
e
)
catch
(
AccessViolationException
e
)
...
@@ -190,13 +177,13 @@ namespace OnlineStore.DeviceLibrary
...
@@ -190,13 +177,13 @@ namespace OnlineStore.DeviceLibrary
LogUtil
.
error
(
deviceName
+
" 扫码出错:"
+
ex
.
ToString
());
LogUtil
.
error
(
deviceName
+
" 扫码出错:"
+
ex
.
ToString
());
}
}
finally
finally
{
{
if
(
ho_Image
!=
null
)
if
(
ho_Image
!=
null
)
{
{
ho_Image
.
Dispose
();
ho_Image
.
Dispose
();
}
}
}
}
}
}
}
}
catch
(
AccessViolationException
e
)
catch
(
AccessViolationException
e
)
{
{
...
@@ -232,28 +219,7 @@ namespace OnlineStore.DeviceLibrary
...
@@ -232,28 +219,7 @@ namespace OnlineStore.DeviceLibrary
}
}
}
}
private
static
bool
IsRightCode
(
string
code
)
{
//分号分割后长度=4,L,E,B,R
try
{
string
[]
strarray
=
code
.
Split
(
';'
);
if
(
strarray
.
Length
==
4
)
{
if
(
strarray
[
0
].
StartsWith
(
"L"
)
&&
strarray
[
1
].
StartsWith
(
"E"
)
&&
strarray
[
2
].
StartsWith
(
"B"
)
&&
strarray
[
3
].
StartsWith
(
"R"
))
{
return
true
;
}
}
}
catch
(
Exception
ex
)
{
}
return
false
;
}
public
static
string
GetCodeParamFilePath
(
string
codePath
)
public
static
string
GetCodeParamFilePath
(
string
codePath
)
{
{
string
appPath
=
Application
.
StartupPath
;
string
appPath
=
Application
.
StartupPath
;
...
@@ -299,9 +265,32 @@ namespace OnlineStore.DeviceLibrary
...
@@ -299,9 +265,32 @@ namespace OnlineStore.DeviceLibrary
message
=
asciiEncoding
.
GetString
(
newBytes
.
ToArray
());
message
=
asciiEncoding
.
GetString
(
newBytes
.
ToArray
());
return
message
;
return
message
;
}
}
public
static
string
ProcessCode
(
List
<
string
>
codeList
)
private
static
bool
IsRightCode
(
string
code
)
{
//分号分割后长度=4,L,E,B,R
try
{
string
[]
strarray
=
code
.
Split
(
';'
);
if
(
strarray
.
Length
==
4
)
{
if
(
strarray
[
0
].
StartsWith
(
"L"
)
&&
strarray
[
1
].
StartsWith
(
"E"
)
&&
strarray
[
2
].
StartsWith
(
"B"
)
&&
strarray
[
3
].
StartsWith
(
"R"
))
{
return
true
;
}
}
}
catch
(
Exception
ex
)
{
}
return
false
;
}
public
static
string
GetValidCode
(
List
<
string
>
codeList
)
{
{
string
code
=
""
;
string
code
=
""
;
List
<
string
>
targetCode
=
new
List
<
string
>();
foreach
(
string
cc
in
codeList
)
foreach
(
string
cc
in
codeList
)
{
{
if
(
string
.
IsNullOrEmpty
(
cc
))
if
(
string
.
IsNullOrEmpty
(
cc
))
...
@@ -310,7 +299,49 @@ namespace OnlineStore.DeviceLibrary
...
@@ -310,7 +299,49 @@ namespace OnlineStore.DeviceLibrary
}
}
code
+=
cc
+
"##"
;
code
+=
cc
+
"##"
;
}
}
return
ReplaceCode
(
code
);
code
=
ReplaceCode
(
code
);
if
(
String
.
IsNullOrEmpty
(
code
))
{
return
""
;
}
foreach
(
string
cc
in
codeList
)
{
if
(
string
.
IsNullOrEmpty
(
cc
))
{
continue
;
}
string
rCode
=
ReplaceCode
(
cc
);
//L0000000000360K003732; E20200311 0365; B6D.49925.551014212020031105000; R014212020031103159##B29
string
[]
codearray
=
code
.
Split
(
';'
);
if
(
codearray
.
Length
>=
4
)
{
if
(
codearray
[
2
].
StartsWith
(
"B"
)
&&
codearray
[
2
].
Length
>=
13
&&
codearray
[
3
].
StartsWith
(
"R"
))
{
string
tc
=
codearray
[
2
].
Substring
(
1
,
12
)
+
";"
+
codearray
[
3
];
if
(!
targetCode
.
Contains
(
tc
))
{
targetCode
.
Add
(
tc
);
}
}
}
}
if
(
targetCode
.
Count
==
1
)
{
LogUtil
.
info
(
"解析条码【"
+
code
+
"】结果【"
+
targetCode
[
0
]
+
"】"
);
return
targetCode
[
0
];
}
else
if
(
targetCode
.
Count
<=
0
)
{
LogUtil
.
info
(
"解析条码【"
+
code
+
"】失败:未找到有效条码"
);
}
else
{
LogUtil
.
info
(
"解析条码【"
+
code
+
"】失败:有多个("
+
targetCode
.
Count
+
")有效条码"
);
}
return
""
;
}
}
}
}
}
}
RC1266-AutoCountMachine/source/DeviceLibrary/manager/SServerManager.cs
查看文件 @
5ddaf0a
此文件的差异被折叠,
点击展开。
RC1266-AutoCountMachine/source/DeviceLibrary/model/WorkParam.cs
查看文件 @
5ddaf0a
...
@@ -26,24 +26,16 @@ namespace OnlineStore.DeviceLibrary
...
@@ -26,24 +26,16 @@ namespace OnlineStore.DeviceLibrary
this
.
PlateH
=
plateH
;
this
.
PlateH
=
plateH
;
this
.
IsTest
=
test
;
this
.
IsTest
=
test
;
}
}
/// <summary>
/// 物品二维码信息
/// </summary>
public
string
WareCode
=
""
;
public
string
WareCode
=
""
;
/// <summary>
/// <summary>
/// 当前状态
/// 当前状态
/// </summary>
/// </summary>
public
int
TrayStatus
=
-
1
;
public
int
TrayStatus
=
-
1
;
/// <summary>
/// 料盘高度
/// </summary>
public
int
PlateH
=
0
;
public
int
PlateH
=
0
;
/// <summary>
/// 料盘宽度
/// </summary>
public
int
PlateW
=
0
;
public
int
PlateW
=
0
;
/// <summary>
/// <summary>
...
@@ -60,11 +52,9 @@ namespace OnlineStore.DeviceLibrary
...
@@ -60,11 +52,9 @@ namespace OnlineStore.DeviceLibrary
/// 目标位置:1=XRay入口,2=人工工位上层,3=人工工位下层
/// 目标位置:1=XRay入口,2=人工工位上层,3=人工工位下层
/// </summary>
/// </summary>
public
int
TargetPosType
=
0
;
public
int
TargetPosType
=
0
;
/// <summary>
/// 取料时判断是否是NG料
/// </summary>
public
bool
IsNgReel
=
false
;
public
bool
IsNgReel
=
false
;
public
string
NgMsg
=
""
;
/// <summary>
/// <summary>
/// 是否是测试步骤
/// 是否是测试步骤
/// </summary>
/// </summary>
...
@@ -89,7 +79,7 @@ namespace OnlineStore.DeviceLibrary
...
@@ -89,7 +79,7 @@ namespace OnlineStore.DeviceLibrary
}
}
public
string
OutStr
()
public
string
OutStr
()
{
{
return
"["
+
WareCode
+
"]
:["
+
PlateW
+
"]X["
+
PlateH
+
"]["
+
WareCount
+
"]
"
;
return
"["
+
WareCode
+
"]
[ "
+
PlateW
+
"X"
+
PlateH
+
" ] ["
+
WareCount
+
"]"
+
(
IsNgReel
?
"[NG料:"
+
NgMsg
+
"]"
:
""
)
+
"
"
;
}
}
public
int
Get_Inout_P2
(
InputEquip_Config
config
)
public
int
Get_Inout_P2
(
InputEquip_Config
config
)
{
{
...
@@ -146,6 +136,13 @@ namespace OnlineStore.DeviceLibrary
...
@@ -146,6 +136,13 @@ namespace OnlineStore.DeviceLibrary
this
.
PlateW
=
reel
.
PlateW
;
this
.
PlateW
=
reel
.
PlateW
;
this
.
WareCode
=
reel
.
WareCode
;
this
.
WareCode
=
reel
.
WareCode
;
this
.
WareCount
=
reel
.
WareCount
;
this
.
WareCount
=
reel
.
WareCount
;
this
.
IsNgReel
=
reel
.
IsNgReel
;
this
.
NgMsg
=
reel
.
NgMsg
;
}
public
ReelInfo
GetReelInfo
()
{
ReelInfo
reel
=
new
ReelInfo
(
WareCode
,
PlateW
,
PlateH
,
WareCount
,
IsNgReel
,
NgMsg
);
return
reel
;
}
}
}
}
...
@@ -153,12 +150,14 @@ namespace OnlineStore.DeviceLibrary
...
@@ -153,12 +150,14 @@ namespace OnlineStore.DeviceLibrary
public
class
ReelInfo
public
class
ReelInfo
{
{
public
ReelInfo
(
string
code
=
""
,
int
plateW
=
7
,
int
plateH
=
8
,
int
count
=
0
)
public
ReelInfo
(
string
code
=
""
,
int
plateW
=
7
,
int
plateH
=
8
,
int
count
=
0
,
bool
IsNg
=
false
,
string
msg
=
""
)
{
{
this
.
WareCode
=
code
;
this
.
WareCode
=
code
;
this
.
PlateH
=
plateH
;
this
.
PlateH
=
plateH
;
this
.
PlateW
=
plateW
;
this
.
PlateW
=
plateW
;
this
.
WareCount
=
count
;
this
.
WareCount
=
count
;
this
.
IsNgReel
=
IsNg
;
this
.
NgMsg
=
msg
;
}
}
/// <summary>
/// <summary>
/// 物品二维码信息
/// 物品二维码信息
...
@@ -178,10 +177,19 @@ namespace OnlineStore.DeviceLibrary
...
@@ -178,10 +177,19 @@ namespace OnlineStore.DeviceLibrary
public
int
WareCount
=
0
;
public
int
WareCount
=
0
;
public
bool
IsNgReel
=
false
;
public
string
NgMsg
=
""
;
public
string
ToStr
()
public
string
ToStr
()
{
{
return
"["
+
WareCode
+
"] [ "
+
PlateW
+
"X"
+
PlateH
+
" ] ["
+
WareCount
+
"]"
;
return
"["
+
WareCode
+
"] [ "
+
PlateW
+
"X"
+
PlateH
+
" ] ["
+
WareCount
+
"]"
+(
IsNgReel
?
"[NG料:"
+
NgMsg
+
"]"
:
""
)+
""
;
}
}
public
ReelInfo
GetReelInfo
()
{
ReelInfo
reel
=
new
ReelInfo
(
WareCode
,
PlateW
,
PlateH
,
WareCount
,
IsNgReel
,
NgMsg
);
return
reel
;
}
}
}
}
}
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论