Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
刘韬
/
1069_MIMO_PlUS
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
作业
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit debb7db7
由
刘韬
编写于
2022-05-13 09:24:27 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
添加通过颜色判断是否有料盘
1 个父辈
be24b727
全部展开
隐藏空白字符变更
内嵌
并排
正在显示
11 个修改的文件
包含
241 行增加
和
14 行删除
Common/ColorHelper.cs
Common/Common.csproj
DeviceLibrary/DeviceLibrary.csproj
DeviceLibrary/DeviceLibrary/CameraTest.cs
DeviceLibrary/DeviceLibrary/CodeManager.cs
DeviceLibrary/theMachine/MainMachine _LedProcess.cs
DeviceLibrary/theMachine/MainMachine.cs
DeviceLibrary/theMachine/MainMachine_Clamp.cs
TheMachine/Program.cs
TheMachine/SettingControl.Designer.cs
TheMachine/SettingControl.cs
Common/ColorHelper.cs
0 → 100644
查看文件 @
debb7db
此文件的差异被折叠,
点击展开。
Common/Common.csproj
查看文件 @
debb7db
...
@@ -56,6 +56,7 @@
...
@@ -56,6 +56,7 @@
<ItemGroup>
<ItemGroup>
<Compile Include="bean\Bean.cs" />
<Compile Include="bean\Bean.cs" />
<Compile Include="CodeResourceControl.cs" />
<Compile Include="CodeResourceControl.cs" />
<Compile Include="ColorHelper.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Setting_Init.cs" />
<Compile Include="Setting_Init.cs" />
<Compile Include="StringList.cs" />
<Compile Include="StringList.cs" />
...
...
DeviceLibrary/DeviceLibrary.csproj
查看文件 @
debb7db
...
@@ -74,6 +74,7 @@
...
@@ -74,6 +74,7 @@
<ItemGroup>
<ItemGroup>
<Compile Include="DeviceLibrary\AcSerialBean.cs" />
<Compile Include="DeviceLibrary\AcSerialBean.cs" />
<Compile Include="DeviceLibrary\Camera.cs" />
<Compile Include="DeviceLibrary\Camera.cs" />
<Compile Include="DeviceLibrary\CameraTest.cs" />
<Compile Include="DeviceLibrary\IOMonitor.cs" />
<Compile Include="DeviceLibrary\IOMonitor.cs" />
<Compile Include="DeviceLibrary\LiftMonitor.cs" />
<Compile Include="DeviceLibrary\LiftMonitor.cs" />
<Compile Include="DeviceLibrary\LineRunMonitor.cs" />
<Compile Include="DeviceLibrary\LineRunMonitor.cs" />
...
...
DeviceLibrary/DeviceLibrary/CameraTest.cs
0 → 100644
查看文件 @
debb7db
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Text
;
using
System.Threading.Tasks
;
namespace
DeviceLibrary
{
public
class
CameraTest
:
ConfigHelper
.
ICustEditor
{
public
object
ValueEdit
(
object
value
)
{
Task
.
Run
(()
=>
CodeManager
.
TestHasReel
(
CodeManager
.
hikNameList
[
0
]));
return
"Click To Test"
;
}
}
}
DeviceLibrary/DeviceLibrary/CodeManager.cs
查看文件 @
debb7db
...
@@ -13,6 +13,8 @@ using System.Drawing.Imaging;
...
@@ -13,6 +13,8 @@ using System.Drawing.Imaging;
using
System.Text.RegularExpressions
;
using
System.Text.RegularExpressions
;
using
System.Threading.Tasks
;
using
System.Threading.Tasks
;
using
System.Threading
;
using
System.Threading
;
using
System.Runtime.InteropServices
;
using
System.Drawing.Drawing2D
;
namespace
DeviceLibrary
namespace
DeviceLibrary
{
{
...
@@ -31,6 +33,9 @@ namespace DeviceLibrary
...
@@ -31,6 +33,9 @@ namespace DeviceLibrary
/// </summary>
/// </summary>
public
static
void
LoadConfig
()
public
static
void
LoadConfig
()
{
{
ConfigHelper
.
Config
.
Set
(
"CamTestReel_Test"
,
"Click To Test"
);
ConfigHelper
.
AdvanceConfigForm
.
AddCustomEditor
<
CameraTest
>(
"CamTestReel_Test"
);
string
nameStr
=
ConfigHelper
.
Config
.
Get
(
Setting_Init
.
CameraName
);
string
nameStr
=
ConfigHelper
.
Config
.
Get
(
Setting_Init
.
CameraName
);
codeTypeList
=
new
List
<
string
>();
codeTypeList
=
new
List
<
string
>();
HDLogUtil
.
LogName
=
"RollingLogFileAppender"
;
HDLogUtil
.
LogName
=
"RollingLogFileAppender"
;
...
@@ -306,6 +311,97 @@ namespace DeviceLibrary
...
@@ -306,6 +311,97 @@ namespace DeviceLibrary
}
}
return
codeList
;
return
codeList
;
}
}
[
HandleProcessCorruptedStateExceptions
]
public
static
bool
TestHasReel
(
string
cameraName
)
{
int
retrytime
=
0
;
retry
:
LogUtil
.
error
(
$
"【"
+
cameraName
+
"】开始取图片测试是否有料盘"
);
DateTime
startTime
=
DateTime
.
Now
;
Bitmap
bmp
=
null
;
try
{
bmp
=
Camera
.
_cam
.
GrabOneImage
(
cameraName
,
PixelType
.
RGB8
);
if
(
bmp
==
null
)
{
if
(
retrytime
>
2
)
return
false
;
retrytime
++;
LogUtil
.
info
(
$
"bitmap为空重试第{retrytime}次"
);
Task
.
Delay
(
1500
).
Wait
();
goto
retry
;
}
LogUtil
.
error
(
$
"【"
+
cameraName
+
"】获取到图像"
);
int
totalcover
=
ConfigHelper
.
Config
.
Get
(
"CamTestReel_totalcover"
,
69577
);
int
hl
=
ConfigHelper
.
Config
.
Get
(
"CamTestReel_HL"
,
18
);
int
hh
=
ConfigHelper
.
Config
.
Get
(
"CamTestReel_HH"
,
47
);
int
ll
=
ConfigHelper
.
Config
.
Get
(
"CamTestReel_LL"
,
15
);
int
lh
=
ConfigHelper
.
Config
.
Get
(
"CamTestReel_LH"
,
100
);
int
sl
=
ConfigHelper
.
Config
.
Get
(
"CamTestReel_SL"
,
95
);
int
sh
=
ConfigHelper
.
Config
.
Get
(
"CamTestReel_SH"
,
100
);
double
threshold
=
ConfigHelper
.
Config
.
Get
(
"CamTestReel_threshold"
,
0.6
);
if
(
ConfigHelper
.
Config
.
Get
(
"CamTestReel_debug"
,
false
))
SaveImageToFile
(
"test"
,
cameraName
,
bmp
);
double
maskcout
=
0
;
var
b
=
new
Bitmap
(
bmp
.
Width
/
2
,
bmp
.
Height
/
2
,
bmp
.
PixelFormat
);
using
(
var
g
=
Graphics
.
FromImage
(
b
))
{
g
.
InterpolationMode
=
InterpolationMode
.
Low
;
g
.
DrawImage
(
bmp
,
0
,
0
,
b
.
Width
,
b
.
Height
);
}
ImageLockMode
imageLockMode
=
ImageLockMode
.
ReadOnly
;
if
(
ConfigHelper
.
Config
.
Get
(
"CamTestReel_debug"
,
false
))
imageLockMode
=
ImageLockMode
.
ReadWrite
;
var
bd
=
b
.
LockBits
(
new
Rectangle
(
0
,
0
,
b
.
Width
,
b
.
Height
),
imageLockMode
,
b
.
PixelFormat
);
for
(
int
x
=
0
;
x
<
b
.
Width
*
b
.
Height
*
3
;
x
=
x
+
3
)
{
var
cr
=
(
int
)
Marshal
.
ReadByte
(
bd
.
Scan0
,
x
+
2
);
var
cg
=
(
int
)
Marshal
.
ReadByte
(
bd
.
Scan0
,
x
+
1
);
var
cb
=
(
int
)
Marshal
.
ReadByte
(
bd
.
Scan0
,
x
);
var
h
=
ColorHelper
.
RgbToHsv
(
new
ColorRGB
(
cr
,
cg
,
cb
));
if
(
h
.
H
>=
hl
&&
h
.
H
<=
hh
&&
h
.
V
>=
ll
&&
h
.
V
<=
lh
&&
h
.
S
>=
sl
&&
h
.
S
<=
sh
)
{
maskcout
++;
if
(
ConfigHelper
.
Config
.
Get
(
"CamTestReel_debug"
,
false
))
{
Marshal
.
WriteByte
(
bd
.
Scan0
,
x
,
0
);
Marshal
.
WriteByte
(
bd
.
Scan0
,
x
+
1
,
0
);
Marshal
.
WriteByte
(
bd
.
Scan0
,
x
+
2
,
255
);
}
}
}
b
.
UnlockBits
(
bd
);
if
(
ConfigHelper
.
Config
.
Get
(
"CamTestReel_debug"
,
false
))
SaveImageToFile
(
"test2"
,
cameraName
,
b
);
b
.
Dispose
();
double
calc
=
maskcout
/
(
double
)
totalcover
;
LogUtil
.
error
(
$
" 检测到覆盖面积计数:maskcout:{maskcout}/{totalcover}={calc}<{threshold},result:{calc <= threshold}"
);
return
calc
<=
threshold
;
}
catch
(
AccessViolationException
e
)
{
LogUtil
.
error
(
" 扫码出现AccessViolationException异常,关闭相机【"
+
cameraName
+
"】:"
+
e
.
ToString
());
Camera
.
_cam
.
Close
(
cameraName
);
// GC.Collect();
}
catch
(
Exception
ex
)
{
LogUtil
.
error
(
" 扫码出错:"
+
ex
.
ToString
());
}
finally
{
if
(
bmp
!=
null
)
bmp
.
Dispose
();
}
return
true
;
}
/// <summary>
/// <summary>
///
///
/// </summary>
/// </summary>
...
@@ -331,7 +427,7 @@ namespace DeviceLibrary
...
@@ -331,7 +427,7 @@ namespace DeviceLibrary
Directory
.
CreateDirectory
(
dire
);
Directory
.
CreateDirectory
(
dire
);
}
}
bitmap
.
Save
(
dire
+
iamgeName
,
ImageFormat
.
Bmp
);
bitmap
.
Save
(
dire
+
iamgeName
,
ImageFormat
.
Bmp
);
bitmap
.
Dispose
();
//
bitmap.Dispose();
LogUtil
.
info
(
deviceName
+
" 【"
+
cameraName
+
"】扫码完成,保存图片到【"
+
dire
+
iamgeName
+
"】成功"
);
LogUtil
.
info
(
deviceName
+
" 【"
+
cameraName
+
"】扫码完成,保存图片到【"
+
dire
+
iamgeName
+
"】成功"
);
}
}
...
...
DeviceLibrary/theMachine/MainMachine _LedProcess.cs
查看文件 @
debb7db
...
@@ -83,6 +83,20 @@ namespace DeviceLibrary
...
@@ -83,6 +83,20 @@ namespace DeviceLibrary
RunningLed
.
LedState
=
LedState
.
on
;
RunningLed
.
LedState
=
LedState
.
on
;
StandbyLed
.
LedState
=
LedState
.
off
;
StandbyLed
.
LedState
=
LedState
.
off
;
AlarmLed
.
LedState
=
LedState
.
blink
;
AlarmLed
.
LedState
=
LedState
.
blink
;
if
(
UserPause
)
{
RunningLed
.
LedState
=
LedState
.
blink
;
StandbyLed
.
LedState
=
LedState
.
blink
;
}
//if (ResetMoveInfo.MoveStep >= MoveStep.H13_HomeReset && ResetMoveInfo.MoveStep <= MoveStep.H14_HomeReset)
//{
// StandbyLed.LedState = LedState.blink;
//}
//if (ClampMoveInfo.MoveStep >= MoveStep.NGOUT_02 && ClampMoveInfo.MoveStep <= MoveStep.NGOUT_03)
//{
// StandbyLed.LedState = LedState.blink;
//}
}
}
Led
.
LedGroup
.
ForEach
((
x
)
=>
{
x
.
run
();
});
Led
.
LedGroup
.
ForEach
((
x
)
=>
{
x
.
run
();
});
}
}
...
...
DeviceLibrary/theMachine/MainMachine.cs
查看文件 @
debb7db
...
@@ -117,6 +117,7 @@ namespace DeviceLibrary
...
@@ -117,6 +117,7 @@ namespace DeviceLibrary
IOMonitor
.
RegisterIO
(
IO_Type
.
Reset_BTN
,
Config
,
IO_VALUE
.
HIGH
,
Reset_BTN
,
2500
,
100
);
IOMonitor
.
RegisterIO
(
IO_Type
.
Reset_BTN
,
Config
,
IO_VALUE
.
HIGH
,
Reset_BTN
,
2500
,
100
);
IOMonitor
.
RegisterIO
(
IO_Type
.
AutoRun_Single
,
Config
,
IO_VALUE
.
HIGH
,
Run_BTN
,
2500
,
100
);
IOMonitor
.
RegisterIO
(
IO_Type
.
AutoRun_Single
,
Config
,
IO_VALUE
.
HIGH
,
Run_BTN
,
2500
,
100
);
LedProcessInit
();
LedProcessInit
();
ConfigHelper
.
Config
.
Get
(
"CamTestReel_Ability"
,
false
);
}
}
private
void
Crc_LanguageChangeEvent
(
object
sender
,
EventArgs
e
)
private
void
Crc_LanguageChangeEvent
(
object
sender
,
EventArgs
e
)
...
@@ -318,7 +319,8 @@ namespace DeviceLibrary
...
@@ -318,7 +319,8 @@ namespace DeviceLibrary
InOut_Axis
.
AbsMove
(
ResetMoveInfo
,
Config
.
InOut_P1
,
Config
.
InOut_P1_speed
);
InOut_Axis
.
AbsMove
(
ResetMoveInfo
,
Config
.
InOut_P1
,
Config
.
InOut_P1_speed
);
Middle_Axis
.
HomeMove
(
ResetMoveInfo
,
forceHome
);
Middle_Axis
.
HomeMove
(
ResetMoveInfo
,
forceHome
);
UpDown_Axis
.
HomeMove
(
ResetMoveInfo
,
forceHome
);
UpDown_Axis
.
HomeMove
(
ResetMoveInfo
,
forceHome
);
OpenFlipDoor
(
ResetMoveInfo
);
//OpenFlipDoor(ResetMoveInfo);
break
;
break
;
case
MoveStep
.
H04_HomeReset
:
case
MoveStep
.
H04_HomeReset
:
ResetMoveInfo
.
NextMoveStep
(
MoveStep
.
H05_HomeReset
);
ResetMoveInfo
.
NextMoveStep
(
MoveStep
.
H05_HomeReset
);
...
@@ -346,7 +348,13 @@ namespace DeviceLibrary
...
@@ -346,7 +348,13 @@ namespace DeviceLibrary
ResetMoveInfo
.
log
(
"夹爪上有料盘,送到NG口"
);
ResetMoveInfo
.
log
(
"夹爪上有料盘,送到NG口"
);
}
}
else
{
else
if
(
IOValue
(
IO_Type
.
ReelFlipDoor_L_Home
).
Equals
(
IO_VALUE
.
LOW
)
&&
IOValue
(
IO_Type
.
ReelFlipDoor_R_Home
).
Equals
(
IO_VALUE
.
LOW
)
&&
NGDoor_Tray_Test_Reel
)
{
ResetMoveInfo
.
NextMoveStep
(
MoveStep
.
H12_HomeReset
);
ResetMoveInfo
.
log
(
"反转托盘上有料盘,送到NG口"
);
}
else
{
ResetMoveInfo
.
NextMoveStep
(
MoveStep
.
HEND_HomeReset
);
ResetMoveInfo
.
NextMoveStep
(
MoveStep
.
HEND_HomeReset
);
ResetMoveInfo
.
log
(
"夹爪上上没有料盘"
);
ResetMoveInfo
.
log
(
"夹爪上上没有料盘"
);
}
}
...
@@ -376,18 +384,26 @@ namespace DeviceLibrary
...
@@ -376,18 +384,26 @@ namespace DeviceLibrary
CylinderMove
(
ResetMoveInfo
,
IO_Type
.
NGDoor_Close
,
IO_Type
.
NGDoor_Open
,
IO_VALUE
.
HIGH
);
CylinderMove
(
ResetMoveInfo
,
IO_Type
.
NGDoor_Close
,
IO_Type
.
NGDoor_Open
,
IO_VALUE
.
HIGH
);
break
;
break
;
case
MoveStep
.
H13_HomeReset
:
case
MoveStep
.
H13_HomeReset
:
ResetMoveInfo
.
NextMoveStep
(
MoveStep
.
H1
2
_HomeReset
);
ResetMoveInfo
.
NextMoveStep
(
MoveStep
.
H1
4
_HomeReset
);
if
(
IOValue
(
IO_Type
.
NGDoor_Tray_Check
).
Equals
(
IO_VALUE
.
LOW
)
)
if
(
!
NGDoor_Tray_Test_Reel
)
{
{
Msg
.
add
(
crc
.
GetString
(
L
.
x29_low_no_reel
,
"传感器X29未检测到单料口料盘."
),
MsgLevel
.
alarm
);
Msg
.
add
(
crc
.
GetString
(
L
.
x29_low_no_reel
,
"传感器X29未检测到单料口料盘."
),
MsgLevel
.
alarm
);
RobotManage
.
UserPause
(
"传感器X29未检测到单料口料盘."
);
RobotManage
.
UserPause
(
"传感器X29未检测到单料口料盘."
);
}
}
break
;
break
;
case
MoveStep
.
H14_HomeReset
:
case
MoveStep
.
H14_HomeReset
:
if
(
IOValue
(
IO_Type
.
NGDoor_Tray_Check
).
Equals
(
IO_VALUE
.
HIGH
)
)
if
(
NGDoor_Tray_Test_Reel
)
{
{
Msg
.
add
(
crc
.
GetString
(
L
.
x29_higt_has_reel
,
"系统启动X29检测到有无信息料盘,等待取走单料口料盘"
),
MsgLevel
.
alarm
);
Msg
.
add
(
crc
.
GetString
(
L
.
x29_higt_has_reel
,
"系统启动X29检测到有无信息料盘,等待取走单料口料盘"
),
MsgLevel
.
alarm
);
RobotManage
.
UserPause
(
"系统启动X29检测到有无信息料盘,等待取走单料口料盘"
);
if
(
ConfigHelper
.
Config
.
Get
(
"CamTestReel_Ability"
,
false
))
{
ResetMoveInfo
.
NextMoveStep
(
MoveStep
.
H14_HomeReset
);
ResetMoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitTime
(
1000
));
}
else
{
RobotManage
.
UserPause
(
"系统启动X29检测到有无信息料盘,等待取走单料口料盘"
);
}
}
}
else
{
else
{
ResetMoveInfo
.
NextMoveStep
(
MoveStep
.
H15_HomeReset
);
ResetMoveInfo
.
NextMoveStep
(
MoveStep
.
H15_HomeReset
);
...
@@ -405,7 +421,7 @@ namespace DeviceLibrary
...
@@ -405,7 +421,7 @@ namespace DeviceLibrary
}
}
break
;
break
;
case
MoveStep
.
H16_HomeReset
:
case
MoveStep
.
H16_HomeReset
:
if
(
IOValue
(
IO_Type
.
SafetyLightCurtains
).
Equals
(
IO_VALUE
.
HIGH
)
&&
IOValue
(
IO_Type
.
NGDoor_Tray_Check
).
Equals
(
IO_VALUE
.
HIGH
)
)
if
(
IOValue
(
IO_Type
.
SafetyLightCurtains
).
Equals
(
IO_VALUE
.
HIGH
)
&&
NGDoor_Tray_Test_Reel
)
{
{
ResetMoveInfo
.
log
(
"NG口还是检测到料盘"
);
ResetMoveInfo
.
log
(
"NG口还是检测到料盘"
);
ResetMoveInfo
.
NextMoveStep
(
MoveStep
.
H14_HomeReset
);
ResetMoveInfo
.
NextMoveStep
(
MoveStep
.
H14_HomeReset
);
...
@@ -454,7 +470,7 @@ namespace DeviceLibrary
...
@@ -454,7 +470,7 @@ namespace DeviceLibrary
var
ignorestring
=
"["
+
crc
.
GetString
(
L
.
ignored
,
"已忽略"
)
+
"]"
;
var
ignorestring
=
"["
+
crc
.
GetString
(
L
.
ignored
,
"已忽略"
)
+
"]"
;
if
(
IOValue
(
IO_Type
.
SafetyLightCurtains
).
Equals
(
IO_VALUE
.
LOW
))
if
(
IOValue
(
IO_Type
.
SafetyLightCurtains
).
Equals
(
IO_VALUE
.
LOW
))
{
{
if
(!
IgnoreSafecheck
&&
IOValue
(
IO_Type
.
NGDoor_Open
).
Equals
(
IO_VALUE
.
HIGH
))
if
(!
IgnoreSafecheck
)
//
&& IOValue(IO_Type.NGDoor_Open).Equals(IO_VALUE.HIGH))
{
{
ok
=
false
;
ok
=
false
;
DeviceSuddenStop
();
DeviceSuddenStop
();
...
...
DeviceLibrary/theMachine/MainMachine_Clamp.cs
查看文件 @
debb7db
...
@@ -233,7 +233,7 @@ namespace DeviceLibrary
...
@@ -233,7 +233,7 @@ namespace DeviceLibrary
break
;
break
;
case
MoveStep
.
NGOUT_02
:
case
MoveStep
.
NGOUT_02
:
ClampMoveInfo
.
NextMoveStep
(
MoveStep
.
NGOUT_03
);
ClampMoveInfo
.
NextMoveStep
(
MoveStep
.
NGOUT_03
);
if
(
IOValue
(
IO_Type
.
NGDoor_Tray_Check
).
Equals
(
IO_VALUE
.
LOW
)
)
if
(
!
NGDoor_Tray_Test_Reel
)
{
{
Msg
.
add
(
crc
.
GetString
(
L
.
x29_low_no_reel
,
"传感器X29未检测到单料口料盘."
),
MsgLevel
.
alarm
);
Msg
.
add
(
crc
.
GetString
(
L
.
x29_low_no_reel
,
"传感器X29未检测到单料口料盘."
),
MsgLevel
.
alarm
);
Msg
.
add
(
ClampMoveInfo
.
MoveParam
.
NgMsg
,
MsgLevel
.
warning
);
Msg
.
add
(
ClampMoveInfo
.
MoveParam
.
NgMsg
,
MsgLevel
.
warning
);
...
@@ -242,10 +242,17 @@ namespace DeviceLibrary
...
@@ -242,10 +242,17 @@ namespace DeviceLibrary
break
;
break
;
case
MoveStep
.
NGOUT_03
:
case
MoveStep
.
NGOUT_03
:
Msg
.
add
(
ClampMoveInfo
.
MoveParam
.
NgMsg
,
MsgLevel
.
warning
);
Msg
.
add
(
ClampMoveInfo
.
MoveParam
.
NgMsg
,
MsgLevel
.
warning
);
if
(
IOValue
(
IO_Type
.
NGDoor_Tray_Check
).
Equals
(
IO_VALUE
.
HIGH
)
)
if
(
NGDoor_Tray_Test_Reel
)
{
{
Msg
.
add
(
crc
.
GetString
(
L
.
please_take_ngdoor_reel
,
"等待取走单口料盘"
),
MsgLevel
.
alarm
);
Msg
.
add
(
crc
.
GetString
(
L
.
please_take_ngdoor_reel
,
"等待取走单口料盘"
),
MsgLevel
.
alarm
);
RobotManage
.
UserPause
(
"等待取走单口料盘"
);
if
(
ConfigHelper
.
Config
.
Get
(
"CamTestReel_Ability"
,
false
))
{
ClampMoveInfo
.
NextMoveStep
(
MoveStep
.
NGOUT_03
);
ClampMoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitTime
(
1000
));
}
else
{
RobotManage
.
UserPause
(
"等待取走单口料盘"
);
}
}
}
else
else
{
{
...
@@ -264,7 +271,7 @@ namespace DeviceLibrary
...
@@ -264,7 +271,7 @@ namespace DeviceLibrary
}
}
break
;
break
;
case
MoveStep
.
NGOUT_05
:
case
MoveStep
.
NGOUT_05
:
if
(
IOValue
(
IO_Type
.
SafetyLightCurtains
).
Equals
(
IO_VALUE
.
HIGH
)
&&
IOValue
(
IO_Type
.
NGDoor_Tray_Check
).
Equals
(
IO_VALUE
.
HIGH
)
)
if
(
IOValue
(
IO_Type
.
SafetyLightCurtains
).
Equals
(
IO_VALUE
.
HIGH
)
&&
NGDoor_Tray_Test_Reel
)
{
{
ClampMoveInfo
.
log
(
"NG口还是检测到料盘"
);
ClampMoveInfo
.
log
(
"NG口还是检测到料盘"
);
ClampMoveInfo
.
NextMoveStep
(
MoveStep
.
NGOUT_03
);
ClampMoveInfo
.
NextMoveStep
(
MoveStep
.
NGOUT_03
);
...
@@ -305,7 +312,16 @@ namespace DeviceLibrary
...
@@ -305,7 +312,16 @@ namespace DeviceLibrary
break
;
break
;
}
}
}
}
bool
NGDoor_Tray_Test_Reel
{
get
{
if
(
ConfigHelper
.
Config
.
Get
(
"CamTestReel_Ability"
,
false
))
return
IOValue
(
IO_Type
.
NGDoor_Tray_Check
).
Equals
(
IO_VALUE
.
HIGH
)
||
CodeManager
.
TestHasReel
(
CodeManager
.
hikNameList
[
0
]);
else
return
IOValue
(
IO_Type
.
NGDoor_Tray_Check
).
Equals
(
IO_VALUE
.
HIGH
);
}
}
private
int
GetWidth
()
private
int
GetWidth
()
{
{
if
(
IOManager
.
IOValue
(
IO_Type
.
WidthCheck_15
).
Equals
(
IO_VALUE
.
HIGH
))
if
(
IOManager
.
IOValue
(
IO_Type
.
WidthCheck_15
).
Equals
(
IO_VALUE
.
HIGH
))
...
...
TheMachine/Program.cs
查看文件 @
debb7db
...
@@ -3,6 +3,9 @@ using log4net.Config;
...
@@ -3,6 +3,9 @@ using log4net.Config;
using
OnlineStore.Common
;
using
OnlineStore.Common
;
using
System
;
using
System
;
using
System.Collections.Generic
;
using
System.Collections.Generic
;
using
System.Diagnostics
;
using
System.Drawing
;
using
System.Drawing.Drawing2D
;
using
System.Linq
;
using
System.Linq
;
using
System.Runtime.InteropServices
;
using
System.Runtime.InteropServices
;
using
System.Threading
;
using
System.Threading
;
...
@@ -28,6 +31,50 @@ namespace TheMachine
...
@@ -28,6 +31,50 @@ namespace TheMachine
//datatxt = datatxt.Substring(3, 8);
//datatxt = datatxt.Substring(3, 8);
//double.TryParse(datatxt, out double value);
//double.TryParse(datatxt, out double value);
//Console.WriteLine(value);
//Console.WriteLine(value);
/*
int ff = 0;
var f = @"D:\rick\vs\SO1069MIMO_PLUS\Image_20220511153145272.bmp";
var bmp = new Bitmap(f);
Stopwatch stopwatch = new Stopwatch();
stopwatch.Start();
var b = new Bitmap(bmp.Width/2, bmp.Height/2,bmp.PixelFormat);
using (var g = Graphics.FromImage(b))
{
g.InterpolationMode = InterpolationMode.Low;
g.DrawImage(bmp, 0, 0, b.Width, b.Height);
}
var bd = b.LockBits(new Rectangle(0, 0, b.Width, b.Height), System.Drawing.Imaging.ImageLockMode.ReadWrite, b.PixelFormat);
var Pixels = new byte[b.Width * b.Height * 3];
// Copy data from pointer to array
Marshal.Copy(bd.Scan0, Pixels, 0, Pixels.Length);
for (int x = 0; x < b.Width * b.Height * 3; x += 3)
{
//var cr = (int)Marshal.ReadByte(bd.Scan0, x+2);
//var cg = (int)Marshal.ReadByte(bd.Scan0, x + 1);
//var cb = (int)Marshal.ReadByte(bd.Scan0, x);
var cr = (int)Pixels[x + 2];
var cg = (int)Pixels[x + 1];
var cb = (int)Pixels[x];
var h = ColorHelper.RgbToHsv(new ColorRGB(cr, cg, cb));
if (h.H >= 59 && h.H <= 61 && h.V >= 90 && h.S >= 90)
{
ff++;
//Marshal.WriteByte(bd.Scan0, x,0);
//Marshal.WriteByte(bd.Scan0, x+1, 0);
//Marshal.WriteByte(bd.Scan0, x+2, 255);
}
}
b.UnlockBits(bd);
stopwatch.Stop();
var t = stopwatch.ElapsedMilliseconds / 1000d;
b.Save(@"D:\rick\vs\SO1069MIMO_PLUS\11-57-09-156_11.bmp");
*/
_
=
new
Mutex
(
true
,
Application
.
ProductName
,
out
bool
ret
);
_
=
new
Mutex
(
true
,
Application
.
ProductName
,
out
bool
ret
);
if
(!
ret
)
if
(!
ret
)
...
...
TheMachine/SettingControl.Designer.cs
查看文件 @
debb7db
...
@@ -38,6 +38,7 @@ namespace TheMachine
...
@@ -38,6 +38,7 @@ namespace TheMachine
this
.
timer1
=
new
System
.
Windows
.
Forms
.
Timer
(
this
.
components
);
this
.
timer1
=
new
System
.
Windows
.
Forms
.
Timer
(
this
.
components
);
this
.
tp
=
new
System
.
Windows
.
Forms
.
TableLayoutPanel
();
this
.
tp
=
new
System
.
Windows
.
Forms
.
TableLayoutPanel
();
this
.
cb_usefixpos
=
new
System
.
Windows
.
Forms
.
CheckBox
();
this
.
cb_usefixpos
=
new
System
.
Windows
.
Forms
.
CheckBox
();
this
.
button1
=
new
System
.
Windows
.
Forms
.
Button
();
this
.
tp
.
SuspendLayout
();
this
.
tp
.
SuspendLayout
();
this
.
SuspendLayout
();
this
.
SuspendLayout
();
//
//
...
@@ -145,9 +146,21 @@ namespace TheMachine
...
@@ -145,9 +146,21 @@ namespace TheMachine
this
.
cb_usefixpos
.
Text
=
"启用校准库位"
;
this
.
cb_usefixpos
.
Text
=
"启用校准库位"
;
this
.
cb_usefixpos
.
UseVisualStyleBackColor
=
true
;
this
.
cb_usefixpos
.
UseVisualStyleBackColor
=
true
;
//
//
// button1
//
this
.
button1
.
Location
=
new
System
.
Drawing
.
Point
(
356
,
65
);
this
.
button1
.
Name
=
"button1"
;
this
.
button1
.
Size
=
new
System
.
Drawing
.
Size
(
102
,
48
);
this
.
button1
.
TabIndex
=
7
;
this
.
button1
.
Text
=
"button1"
;
this
.
button1
.
UseVisualStyleBackColor
=
true
;
this
.
button1
.
Visible
=
false
;
this
.
button1
.
Click
+=
new
System
.
EventHandler
(
this
.
button1_Click_1
);
//
// SettingControl
// SettingControl
//
//
this
.
AutoScaleMode
=
System
.
Windows
.
Forms
.
AutoScaleMode
.
None
;
this
.
AutoScaleMode
=
System
.
Windows
.
Forms
.
AutoScaleMode
.
None
;
this
.
Controls
.
Add
(
this
.
button1
);
this
.
Controls
.
Add
(
this
.
tp
);
this
.
Controls
.
Add
(
this
.
tp
);
this
.
Name
=
"SettingControl"
;
this
.
Name
=
"SettingControl"
;
this
.
Size
=
new
System
.
Drawing
.
Size
(
1024
,
740
);
this
.
Size
=
new
System
.
Drawing
.
Size
(
1024
,
740
);
...
@@ -168,5 +181,6 @@ namespace TheMachine
...
@@ -168,5 +181,6 @@ namespace TheMachine
private
System
.
Windows
.
Forms
.
Timer
timer1
;
private
System
.
Windows
.
Forms
.
Timer
timer1
;
private
System
.
Windows
.
Forms
.
TableLayoutPanel
tp
;
private
System
.
Windows
.
Forms
.
TableLayoutPanel
tp
;
private
System
.
Windows
.
Forms
.
CheckBox
cb_usefixpos
;
private
System
.
Windows
.
Forms
.
CheckBox
cb_usefixpos
;
private
System
.
Windows
.
Forms
.
Button
button1
;
}
}
}
}
TheMachine/SettingControl.cs
查看文件 @
debb7db
...
@@ -120,5 +120,10 @@ namespace TheMachine
...
@@ -120,5 +120,10 @@ namespace TheMachine
var
t
=
HumitureController
.
LastData
;
var
t
=
HumitureController
.
LastData
;
lbl_hmdstate
.
Text
+=
$
"{crc.GetString(L.humidity, "
温度
")}:{t.Temperate}℃, {crc.GetString(L.humidity, "
湿度
")}:{t.Humidity}%"
;
lbl_hmdstate
.
Text
+=
$
"{crc.GetString(L.humidity, "
温度
")}:{t.Temperate}℃, {crc.GetString(L.humidity, "
湿度
")}:{t.Humidity}%"
;
}
}
private
void
button1_Click_1
(
object
sender
,
EventArgs
e
)
{
Task
.
Run
(()=>
CodeManager
.
TestHasReel
(
CodeManager
.
hikNameList
[
0
]));
}
}
}
}
}
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论