Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
刘韬
/
SO20031_TinStorage
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
作业
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit 79e944f8
由
刘韬
编写于
2023-01-09 20:10:06 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
1
1 个父辈
82303d25
隐藏空白字符变更
内嵌
并排
正在显示
21 个修改的文件
包含
832 行增加
和
308 行删除
CT时间.xlsx
Common/CodeResourceControl.cs
Common/Setting_Init.cs
DeviceLibrary/DeviceLibrary.csproj
DeviceLibrary/DeviceLibrary/CodeManager.cs
DeviceLibrary/DeviceLibrary/CylinderManger.cs
DeviceLibrary/DeviceLibrary/LimitedRotary.cs
DeviceLibrary/DeviceLibrary/ServerCommunication.cs
DeviceLibrary/theMachine/BoxTransport.cs
DeviceLibrary/theMachine/CameraPointTest.cs
DeviceLibrary/theMachine/MainMachine _IOMonitor.cs
DeviceLibrary/theMachine/MainMachine _LedProcess.cs
DeviceLibrary/theMachine/MainMachine.cs
DeviceLibrary/theMachine/MainMachine_Labeling.cs
DeviceLibrary/theMachine/MainMachine_RFIDSelftest.cs
DeviceLibrary/theMachine/MainMachine_StoreDemo.cs
DeviceLibrary/theMachine/MoveStep.cs
TheMachine/Form1.Designer.cs
TheMachine/Form1.cs
TheMachine/Program.cs
TheMachine/SettingControl.cs
CT时间.xlsx
0 → 100644
查看文件 @
79e944f
此文件类型无法预览
Common/CodeResourceControl.cs
查看文件 @
79e944f
...
...
@@ -283,14 +283,16 @@ namespace OnlineStore
}
private
static
void
PreControlLanaguage
(
Control
partentControl
,
string
class
Name
)
{
string
newStr
=
""
;
//Con_GetTxt(partentControl, out string title);
//string newStr = GetString(GetTextIdStr(className, partentControl.Name), title);
//if (!newStr.Equals(""))
//{
//Con_SetTxt(partentControl, newStr.Replace("\\n", "\n"));
//}
{
if
(
class
Name
.
IndexOf
(
'_'
)
<
0
)
{
Con_GetTxt
(
partentControl
,
out
string
title
);
string
newStr
=
GetString
(
GetTextIdStr
(
class
Name
,
partentControl
.
Name
),
title
);
if
(!
newStr
.
Equals
(
""
))
{
Con_SetTxt
(
partentControl
,
newStr
.
Replace
(
"\\n"
,
"\n"
));
}
}
foreach
(
Control
con
in
partentControl
.
Controls
)
{
string
txt
=
""
;
...
...
@@ -303,7 +305,7 @@ namespace OnlineStore
if
(
Con_GetTxt
(
con
,
out
txt
))
{
newStr
=
GetString
(
GetTextIdStr
(
class
Name
,
con
.
Name
),
txt
);
var
newStr
=
GetString
(
GetTextIdStr
(
class
Name
,
con
.
Name
),
txt
);
if
(!
newStr
.
Equals
(
""
))
{
Con_SetTxt
(
con
,
newStr
.
Replace
(
"\\n"
,
"\n"
));
...
...
Common/Setting_Init.cs
查看文件 @
79e944f
...
...
@@ -85,7 +85,7 @@ namespace OnlineStore.Common
public
static
MyConfig
<
string
>
Runtime_Posid
=
""
;
public
static
MyConfig
<
string
>
Runtime_RFID
=
""
;
public
static
MyConfig
<
string
>
Runtime_PN
=
""
;
public
static
MyConfig
<
string
>
Runtime_WareCode
=
""
;
...
...
DeviceLibrary/DeviceLibrary.csproj
查看文件 @
79e944f
...
...
@@ -106,6 +106,7 @@
<Compile Include="theMachine\MainMachine _Common.cs" />
<Compile Include="theMachine\MainMachine _AutoInOutTest.cs" />
<Compile Include="theMachine\MainMachine_Labeling.cs" />
<Compile Include="theMachine\MainMachine_RFIDSelftest.cs" />
<Compile Include="theMachine\MainMachine_StoreDemo.cs" />
<Compile Include="theMachine\MainMachine _IOMonitor.cs" />
<Compile Include="theMachine\MainMachine _LedProcess.cs" />
...
...
DeviceLibrary/DeviceLibrary/CodeManager.cs
查看文件 @
79e944f
...
...
@@ -189,7 +189,8 @@ namespace DeviceLibrary
string
bitmapfilename
=
""
;
if
(
cameraNameList
==
null
||
cameraNameList
.
Count
<=
0
)
{
throw
new
Exception
(
"CameraScan方法没有传入相机名称."
);
return
new
List
<
CodeInfo
>();
//throw new Exception("CameraScan方法没有传入相机名称.");
}
try
...
...
@@ -385,5 +386,122 @@ namespace DeviceLibrary
return
""
;
}
}
static
Bitmap
bufferBmp
=
null
;
[
HandleProcessCorruptedStateExceptions
]
public
static
bool
TakePicture
(
List
<
string
>
cameraNameList
)
{
if
(
cameraNameList
==
null
||
cameraNameList
.
Count
<=
0
)
{
return
false
;
}
try
{
var
cameraName
=
cameraNameList
[
0
];
int
retrytime
=
0
;
retry
:
LogUtil
.
info
(
$
"【"
+
cameraName
+
"】开始取图片"
);
if
(
cameraName
.
Trim
().
Equals
(
""
))
{
return
false
;
}
DateTime
startTime
=
DateTime
.
Now
;
try
{
_
=
Camera
.
_cam
.
CaptureOnImage
(
cameraName
,
out
bufferBmp
,
true
);
if
(
bufferBmp
==
null
)
{
if
(
retrytime
>
2
)
return
false
;
retrytime
++;
LoadCamera
(
true
);
LogUtil
.
info
(
$
"bitmap为空重试第{retrytime}次"
);
Task
.
Delay
(
1500
).
Wait
();
goto
retry
;
}
LogUtil
.
info
(
" 【"
+
cameraName
+
"】取图片完成:"
+(
DateTime
.
Now
-
startTime
).
TotalSeconds
.
ToString
());
return
true
;
}
catch
(
AccessViolationException
e
)
{
LogUtil
.
error
(
" 扫码出现AccessViolationException异常,关闭相机【"
+
cameraName
+
"】:"
+
e
.
ToString
());
Camera
.
_cam
.
Close
(
cameraName
);
}
catch
(
Exception
ex
)
{
LogUtil
.
error
(
" 扫码出错:"
+
ex
.
ToString
());
}
finally
{
}
}
catch
(
AccessViolationException
e
)
{
LogUtil
.
error
(
" 扫码出现AccessViolationException异常:"
+
e
.
ToString
());
//throw new Exception("扫码出现AccessViolationException异常");
// GC.Collect();
}
catch
(
Exception
ex
)
{
LogUtil
.
error
(
" 扫码出错:"
+
ex
.
ToString
());
//throw new Exception("扫码出错");
}
return
false
;
}
[
HandleProcessCorruptedStateExceptions
]
public
static
List
<
CodeInfo
>
ScanCode
()
{
HashSet
<
string
>
codestr
=
new
HashSet
<
string
>();
List
<
CodeInfo
>
codeList
=
new
List
<
CodeInfo
>();
string
bitmapfilename
=
""
;
DateTime
startTime
=
DateTime
.
Now
;
try
{
if
(
bufferBmp
==
null
)
{
LogUtil
.
error
(
"没有缓存的图像"
);
return
new
List
<
CodeInfo
>();
}
string
r
=
""
;
RemoteDecodeHelper
.
RemoteDecodeParam
remoteDecodeParam
=
new
RemoteDecodeHelper
.
RemoteDecodeParam
{
codeTypeList
=
codeTypeList
.
ToArray
(),
codeCount
=
QRCodeCount
,
timeout
=
CodeTimeOut
};
List
<
CodeInfo
>
cc
=
new
List
<
CodeInfo
>();
cc
=
RemoteDecodeHelper
.
DecodeRequest
(
bufferBmp
,
remoteDecodeParam
);
if
(
cc
!=
null
)
{
lock
(
codeList
)
{
cc
.
ForEach
((
c
)
=>
{
c
.
CodeStr
=
CodeManager
.
ReplaceCode
(
c
.
CodeStr
);
if
(!
codestr
.
Contains
(
c
.
CodeStr
))
{
codeList
.
Add
(
c
);
codestr
.
Add
(
c
.
CodeStr
);
r
+=
"##"
+
c
.
CodeStr
;
}
});
}
}
else
{
bitmapfilename
=
SaveImageToFile
(
"mimo"
,
""
,
bufferBmp
);
}
LogUtil
.
info
(
" 扫码完成【"
+
FormUtil
.
GetSpanStr
(
DateTime
.
Now
-
startTime
)
+
"】 :"
+
r
);
}
catch
(
Exception
ex
)
{
LogUtil
.
error
(
" 扫码出错:"
+
ex
.
ToString
());
}
return
codeList
;
}
}
}
DeviceLibrary/DeviceLibrary/CylinderManger.cs
查看文件 @
79e944f
...
...
@@ -41,7 +41,13 @@ namespace DeviceLibrary
Resume
();
LogUtil
.
info
(
$
"{Name},设置{High}=Low"
);
}
public
bool
IsHigh
{
get
=>
IOManager
.
IOValue
(
High
).
Equals
(
IO_VALUE
.
HIGH
);
}
public
bool
IsLow
{
get
=>
IOManager
.
IOValue
(
Low
).
Equals
(
IO_VALUE
.
HIGH
);
}
public
void
Pause
()
{
LogUtil
.
info
(
$
"{Name},停止运行"
);
...
...
DeviceLibrary/DeviceLibrary/LimitedRotary.cs
查看文件 @
79e944f
...
...
@@ -82,7 +82,7 @@ namespace DeviceLibrary
if
(!
axisBean
.
IsServeoOn
)
axisBean
.
Open
(
true
,
out
string
msg
);
axisBean
.
RelMove
(
len
,
(
double
)
upspeed
);
moveInfo
.
log
(
$
"{checkio}"
);
//
moveInfo.log($"{checkio}");
while
(!
IOManager
.
IOValue
(
checkio
).
Equals
(
IO_VALUE
.
HIGH
))
{
Task
.
Delay
(
30
).
Wait
();
...
...
@@ -101,6 +101,7 @@ namespace DeviceLibrary
Task
.
Delay
(
100
).
Wait
();
axisBean
.
SuddenStop
();
moveInfo
.
log
(
$
"{axisBean.AxisName},转到位"
);
degreeAdd
=
0
;
return
true
;
}
finally
...
...
@@ -114,8 +115,8 @@ namespace DeviceLibrary
});
}
public
Task
TurnWork
;
public
void
TurnDegree
(
int
degree
)
{
TurnWork
=
Task
.
Run
(()=>
public
Task
TurnDegree
(
int
degree
)
{
return
TurnWork
=
Task
.
Run
(()=>
{
if
(
IOManager
.
IOValue
(
IO_Type
.
SuddenStop_BTN
).
Equals
(
IO_VALUE
.
LOW
))
...
...
@@ -135,7 +136,7 @@ namespace DeviceLibrary
{
TurnToEnd
(
true
).
Wait
();
}
moveInfo
.
log
(
$
"len:{len}"
);
//
moveInfo.log($"len:{len}");
axisBean
.
RelMove
(
len
*-
1
,
(
double
)
upspeed
);
Task
.
Delay
(
50
).
Wait
();
while
(
axisBean
.
IsBusy
)
{
...
...
@@ -216,6 +217,8 @@ namespace DeviceLibrary
TurnToEnd
(
true
,
true
).
Wait
();
TurnToEnd
(
false
,
false
).
Wait
();
TurnToEnd
(
true
,
true
).
Wait
();
//TurnToEnd(false, false).Wait();
//TurnDegree(-20).Wait();
RobotManage
.
mainMachine
.
CylinderMove
(
null
,
IO_Type
.
Tin_Dock_Rotate_Release
,
IO_Type
.
Tin_Dock_Rotate_Clamp
,
IO_VALUE
.
LOW
);
while
(!
IOManager
.
IOValue
(
IO_Type
.
Tin_Dock_Rotate_Release
).
Equals
(
IO_VALUE
.
HIGH
))
{
...
...
@@ -225,9 +228,11 @@ namespace DeviceLibrary
TurnToEnd
(
false
).
Wait
();
});
}
public
void
TurnRound2
()
int
degreeAdd
=
0
;
public
Task
LockAndTurnDegree
(
int
degree
)
{
TurnWork
=
Task
.
Run
(()
=>
return
TurnWork
=
Task
.
Run
(()
=>
{
if
(
IOManager
.
IOValue
(
IO_Type
.
SuddenStop_BTN
).
Equals
(
IO_VALUE
.
LOW
))
...
...
@@ -238,53 +243,51 @@ namespace DeviceLibrary
if
(!
axisBean
.
IsServeoOn
)
axisBean
.
Open
(
true
,
out
string
msg
);
var
len
=
(
int
)(
StrokeLength
/
90
*
45
);
if
(
len
>
0
)
{
TurnToEnd
(
false
).
Wait
();
}
moveInfo
.
log
(
$
"len:{len}"
);
axisBean
.
RelMove
(
len
*
-
1
,
(
double
)
upspeed
);
Task
.
Delay
(
50
).
Wait
();
while
(
axisBean
.
IsBusy
)
var
len
=
(
int
)(
StrokeLength
/
90
*
degree
);
if
(
Math
.
Abs
(
degreeAdd
+
degree
)
>
90
)
{
Task
.
Delay
(
50
).
Wait
();
if
(
len
>
0
)
{
TurnToEnd
(
true
).
Wait
();
}
else
if
(
len
<
0
)
{
TurnToEnd
(
false
).
Wait
();
}
}
RobotManage
.
mainMachine
.
CylinderMove
(
null
,
IO_Type
.
Tin_Dock_Rotate_Release
,
IO_Type
.
Tin_Dock_Rotate_Clamp
,
IO_VALUE
.
HIGH
);
while
(!
IOManager
.
IOValue
(
IO_Type
.
Tin_Dock_Rotate_Clamp
).
Equals
(
IO_VALUE
.
HIGH
))
{
Task
.
Delay
(
100
).
Wait
();
}
axisBean
.
RelMove
(
len
*
-
1
,
(
double
)
upspeed
);
Task
.
Delay
(
50
).
Wait
();
while
(
axisBean
.
IsBusy
)
{
Task
.
Delay
(
50
).
Wait
();
}
axisBean
.
RelMove
(
len
*
2
,
(
double
)
upspeed
);
Task
.
Delay
(
50
).
Wait
();
while
(
axisBean
.
IsBusy
)
{
Task
.
Delay
(
50
).
Wait
();
Task
.
Delay
(
30
).
Wait
();
}
//moveInfo.log($"len:{len}");
axisBean
.
RelMove
(
len
*
-
1
,
(
double
)
upspeed
);
Task
.
Delay
(
50
).
Wait
();
while
(
axisBean
.
IsBusy
)
{
Task
.
Delay
(
50
).
Wait
();
}
RobotManage
.
mainMachine
.
CylinderMove
(
null
,
IO_Type
.
Tin_Dock_Rotate_Release
,
IO_Type
.
Tin_Dock_Rotate_Clamp
,
IO_VALUE
.
LOW
);
while
(!
IOManager
.
IOValue
(
IO_Type
.
Tin_Dock_Rotate_Release
).
Equals
(
IO_VALUE
.
HIGH
))
degreeAdd
+=
degree
;
});
}
public
Task
UnLock
()
{
return
TurnWork
=
Task
.
Run
(()
=>
{
if
(
IOManager
.
IOValue
(
IO_Type
.
SuddenStop_BTN
).
Equals
(
IO_VALUE
.
LOW
))
{
Task
.
Delay
(
100
).
Wait
();
moveInfo
.
log
(
$
"急停未解除"
);
return
;
}
if
(!
axisBean
.
IsServeoOn
)
axisBean
.
Open
(
true
,
out
string
msg
);
TurnToEnd
(
false
).
Wait
();
});
}
public
void
SetWaitResultInfo
(
MoveInfo
moveInfo
)
public
void
SetWaitResultInfo
(
MoveInfo
moveInfo
)
{
moveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitAction
(
new
Func
<
WaitResultInfo
,
bool
>(
WaitStatus
),
$
"等待[{axisBean.Config.Explain}]机构完成"
));
}
...
...
DeviceLibrary/DeviceLibrary/ServerCommunication.cs
查看文件 @
79e944f
...
...
@@ -351,26 +351,26 @@ namespace DeviceLibrary
if
(
dataMap
.
ContainsKey
(
ParamDefine
.
openInLock
)
&&
dataMap
[
ParamDefine
.
openInLock
].
Equals
(
ParamDefine
.
doit
))
{
LogUtil
.
info
(
StoreName
+
"收到服务器命令:openInLock=doit"
);
IOManager
.
IOMove
(
IO_Type
.
Entry_Drawer_Lock
,
IO_VALUE
.
HIGH
);
IOManager
.
IOMove
(
IO_Type
.
Entry_Drawer_Lock
,
IO_VALUE
.
LOW
);
result
=
""
;
}
else
if
(
dataMap
.
ContainsKey
(
ParamDefine
.
closeInLock
)
&&
dataMap
[
ParamDefine
.
closeInLock
].
Equals
(
ParamDefine
.
doit
))
{
LogUtil
.
info
(
StoreName
+
"收到服务器命令:closeInLock=doit"
);
IOManager
.
IOMove
(
IO_Type
.
Entry_Drawer_Lock
,
IO_VALUE
.
LOW
);
IOManager
.
IOMove
(
IO_Type
.
Entry_Drawer_Lock
,
IO_VALUE
.
HIGH
);
result
=
""
;
}
if
(
dataMap
.
ContainsKey
(
ParamDefine
.
openOutLock
)
&&
dataMap
[
ParamDefine
.
openOutLock
].
Equals
(
ParamDefine
.
doit
))
{
LogUtil
.
info
(
StoreName
+
"收到服务器命令:openOutLock=doit"
);
IOManager
.
IOMove
(
IO_Type
.
Out_Drawer_Lock
,
IO_VALUE
.
HIGH
);
IOManager
.
IOMove
(
IO_Type
.
Out_Drawer_Lock
,
IO_VALUE
.
LOW
);
result
=
""
;
}
else
if
(
dataMap
.
ContainsKey
(
ParamDefine
.
closeOutLock
)
&&
dataMap
[
ParamDefine
.
closeOutLock
].
Equals
(
ParamDefine
.
doit
))
{
LogUtil
.
info
(
StoreName
+
"收到服务器命令:closeOutLock=doit"
);
IOManager
.
IOMove
(
IO_Type
.
Out_Drawer_Lock
,
IO_VALUE
.
LOW
);
IOManager
.
IOMove
(
IO_Type
.
Out_Drawer_Lock
,
IO_VALUE
.
HIGH
);
result
=
""
;
}
if
(!
result
.
Equals
(
""
))
...
...
@@ -406,11 +406,11 @@ namespace DeviceLibrary
else
if
(
IOManager
.
IOValue
(
IO_Type
.
Entry_Drawer_Lock
).
Equals
(
IO_VALUE
.
HIGH
)
&&
RobotManage
.
mainMachine
.
StoreMoveInfo
.
MoveStep
==
MoveStep
.
Wait
)
{
map
[
ParamDefine
.
inDoorStatus
]
=
ParamDefine
.
open
;
map
[
ParamDefine
.
inDoorStatus
]
=
ParamDefine
.
close
;
}
else
if
(
IOManager
.
IOValue
(
IO_Type
.
Entry_Drawer_Lock
).
Equals
(
IO_VALUE
.
LOW
)
&&
RobotManage
.
mainMachine
.
StoreMoveInfo
.
MoveStep
==
MoveStep
.
Wait
)
{
map
[
ParamDefine
.
inDoorStatus
]
=
ParamDefine
.
close
;
map
[
ParamDefine
.
inDoorStatus
]
=
ParamDefine
.
open
;
}
if
(
IOManager
.
IOValue
(
IO_Type
.
Out_Drawer
).
Equals
(
IO_VALUE
.
LOW
))
{
...
...
@@ -419,12 +419,12 @@ namespace DeviceLibrary
else
if
(
IOManager
.
IOValue
(
IO_Type
.
Out_Drawer_Lock
).
Equals
(
IO_VALUE
.
HIGH
)
&&
RobotManage
.
mainMachine
.
StoreMoveInfo
.
MoveStep
==
MoveStep
.
Wait
)
{
map
[
ParamDefine
.
outDoorStatus
]
=
ParamDefine
.
open
;
map
[
ParamDefine
.
outDoorStatus
]
=
ParamDefine
.
close
;
}
else
if
(
IOManager
.
IOValue
(
IO_Type
.
Out_Drawer_Lock
).
Equals
(
IO_VALUE
.
LOW
)
&&
RobotManage
.
mainMachine
.
StoreMoveInfo
.
MoveStep
==
MoveStep
.
Wait
)
{
map
[
ParamDefine
.
outDoorStatus
]
=
ParamDefine
.
close
;
map
[
ParamDefine
.
outDoorStatus
]
=
ParamDefine
.
open
;
}
...
...
@@ -652,7 +652,7 @@ namespace DeviceLibrary
public
string
msg
{
get
;
set
;
}
public
Dictionary
<
string
,
string
>
data
{
get
;
set
;
}
public
Dictionary
<
string
,
object
>
data
{
get
;
set
;
}
}
/// <summary>
///1=设备联机(正常就绪)(入库后,BOX恢复原始状态)(出库后,移载装置恢复原始状态),
...
...
DeviceLibrary/theMachine/BoxTransport.cs
查看文件 @
79e944f
...
...
@@ -72,7 +72,7 @@ namespace DeviceLibrary
WareCode
=
"NG"
;
To
=
to
.
clone
();
MoveInfo
.
NewMove
(
MoveStep
.
StoreTS20
);
MoveInfo
.
log
(
$
"{storeMoveType}:开始运输
料盘
,直接到:{to.posid}"
);
MoveInfo
.
log
(
$
"{storeMoveType}:开始运输
物料
,直接到:{to.posid}"
);
MoveInfo
.
MoveParam
.
PosID
=
$
"NA=>{To.posid}"
;
}
else
...
...
@@ -82,7 +82,7 @@ namespace DeviceLibrary
To
=
to
.
clone
();
ignoreFixtureCheck
=
Common
.
IsNeedIgnoreFixtureCheck
(
WareCode
);
MoveInfo
.
NewMove
(
MoveStep
.
StoreTS01
);
MoveInfo
.
log
(
$
"{storeMoveType}:开始运输
料盘
,从:{from.posid},到:{to.posid},WareCode:{WareCode},ignoreFixtureCheck:{ignoreFixtureCheck}"
);
MoveInfo
.
log
(
$
"{storeMoveType}:开始运输
物料
,从:{from.posid},到:{to.posid},WareCode:{WareCode},ignoreFixtureCheck:{ignoreFixtureCheck}"
);
MoveInfo
.
MoveParam
.
PosID
=
$
"{From.posid}=>{To.posid}"
;
MoveInfo
.
MoveParam
.
ReelOnFixture
=
From
.
Reel
.
ReelOnFixture
;
...
...
@@ -91,7 +91,7 @@ namespace DeviceLibrary
FromCheckOffset
=
CalcOffset
(
From
.
posid
);
ToCheckOffset
=
CalcOffset
(
To
.
posid
);
MoveInfo
.
MoveParam
.
WareCode
=
WareCode
;
MoveInfo
.
log
(
$
"确认检查偏移: FromCheckOffset={FromCheckOffset},ToCheckOffset={ToCheckOffset}"
);
//
MoveInfo.log($"确认检查偏移: FromCheckOffset={FromCheckOffset},ToCheckOffset={ToCheckOffset}");
ErrMsgTxt
=
""
;
return
true
;
//thread = new Thread(new ThreadStart(Run));
...
...
@@ -112,27 +112,26 @@ namespace DeviceLibrary
Msg
.
add
(
""
,
MsgLevel
.
info
,
ErrInfo
.
X09_Clear
);
IgnoreX09
=
false
;
MoveInfo
.
NextMoveStep
(
MoveStep
.
StoreTS02
);
MoveInfo
.
log
(
$
"{storeMoveType}:
检查安全状态
"
);
MoveInfo
.
log
(
$
"{storeMoveType}:
开始
"
);
break
;
case
MoveStep
.
StoreTS02
:
if
(
MoveInfo
.
MoveParam
.
ReelOnFixture
)
{
MoveInfo
.
NextMoveStep
(
MoveStep
.
StoreTS08
);
MoveInfo
.
log
(
$
"{storeMoveType}:料盘已在料叉上"
);
}
else
{
case
MoveStep
.
StoreTS02
:
MoveInfo
.
NextMoveStep
(
MoveStep
.
StoreTS03
);
if
(
From
.
posid
!=
MainMachine
.
LabelP
)
Z_Axis
.
AbsMove
(
MoveInfo
,
Config
.
Z_Axis_P1
,
Config
.
Z_Axis_P1_speed
);
MoveInfo
.
log
(
$
"{storeMoveType}:Z轴返回待机点P1"
);
}
//
MoveInfo.log($"{storeMoveType}:Z轴返回待机点P1");
break
;
case
MoveStep
.
StoreTS03
:
MoveInfo
.
NextMoveStep
(
MoveStep
.
StoreTS04
);
if
(
MoveInfo
.
MoveParam
.
ReelOnFixture
)
{
MoveInfo
.
NextMoveStep
(
MoveStep
.
StoreTS08
);
MoveInfo
.
log
(
$
"{storeMoveType}:物料已在夹爪上"
);
}
else
MoveInfo
.
NextMoveStep
(
MoveStep
.
StoreTS04
);
Y_Axis
.
AbsMove
(
MoveInfo
,
From
.
Y_Axis_P2
+
FromCheckOffset
,
Config
.
Y_Axis_P1_speed
);
MoveInfo
.
log
(
$
"{storeMoveType}:Y轴到达取料点偏移点{From.Y_Axis_P2}+{FromCheckOffset}
"
);
//MoveInfo.log($"{storeMoveType}:Y轴到达取料点偏移点
");
X_Axis
.
AbsMove
(
MoveInfo
,
From
.
X_Axis_P2
,
Config
.
X_Axis_P1_speed
);
MoveInfo
.
log
(
$
"{storeMoveType}:X
轴到达取料检测{From.X_Axis_P2
}"
);
MoveInfo
.
log
(
$
"{storeMoveType}:X
Y轴到达取料检测,X:{From.X_Axis_P2},Y:{From.Y_Axis_P2}+{FromCheckOffset
}"
);
break
;
case
MoveStep
.
StoreTS04
:
if
(
CheckPosStatus
(
MoveInfo
,
From
.
posid
))
...
...
@@ -142,7 +141,7 @@ namespace DeviceLibrary
if
(
zp2
<
0
)
zp2
=
0
;
Z_Axis
.
AbsMove
(
MoveInfo
,
zp2
,
Config
.
Z_Axis_P1_speed
);
MoveInfo
.
log
(
$
"{storeMoveType}:Z轴到达取料前点{From.Z_Axis_P2}"
);
MoveInfo
.
log
(
$
"{storeMoveType}:Z轴到达取料前点
,
{From.Z_Axis_P2}"
);
RobotManage
.
mainMachine
.
CylinderMove
(
MoveInfo
,
IO_Type
.
Taking_Release
,
IO_Type
.
Taking_Clamp
,
IO_VALUE
.
LOW
);
MoveInfo
.
log
(
$
"{storeMoveType}:松开夹爪"
);
IgnoreX09
=
false
;
...
...
@@ -160,7 +159,7 @@ namespace DeviceLibrary
Msg
.
add
(
""
,
MsgLevel
.
info
,
ErrInfo
.
X09_Clear
);
IgnoreX09
=
false
;
MoveInfo
.
NextMoveStep
(
MoveStep
.
StoreTS06
);
MoveInfo
.
log
(
$
"{storeMoveType}:检测有料"
);
MoveInfo
.
log
(
$
"{storeMoveType}:检测有
物
料"
);
}
break
;
case
MoveStep
.
StoreTS06
:
...
...
@@ -177,7 +176,7 @@ namespace DeviceLibrary
case
MoveStep
.
StoreTS08
:
MoveInfo
.
NextMoveStep
(
MoveStep
.
StoreTS09
);
RobotManage
.
mainMachine
.
CylinderMove
(
MoveInfo
,
IO_Type
.
Taking_Release
,
IO_Type
.
Taking_Clamp
,
IO_VALUE
.
HIGH
);
Setting_Init
.
Runtime_Posid
=
To
.
posid
;
//
Setting_Init.Runtime_Posid = To.posid;
if
(
storeMoveType
==
StoreMoveType
.
InStore
&&
To
.
posid
==
MainMachine
.
LabelP
)
Setting_Init
.
Runtime_Step
=
Runtime_StepE
.
InToLabel
;
if
(
storeMoveType
==
StoreMoveType
.
InStore
&&
To
.
posid
!=
MainMachine
.
LabelP
)
...
...
@@ -189,7 +188,10 @@ namespace DeviceLibrary
break
;
case
MoveStep
.
StoreTS09
:
MoveInfo
.
NextMoveStep
(
MoveStep
.
StoreTS10
);
Z_Axis
.
AbsMove
(
MoveInfo
,
Config
.
Z_Axis_P1
,
Config
.
Z_Axis_P1_speed
);
if
(
From
.
posid
==
MainMachine
.
LabelP
&&
To
.
posid
==
MainMachine
.
RFIDP
)
Z_Axis
.
AbsMove
(
MoveInfo
,
To
.
Z_Axis_P3
,
Config
.
Z_Axis_P1_speed
);
else
Z_Axis
.
AbsMove
(
MoveInfo
,
Config
.
Z_Axis_P1
,
Config
.
Z_Axis_P1_speed
);
MoveInfo
.
log
(
$
"{storeMoveType}:Z轴到达待机点"
);
break
;
case
MoveStep
.
StoreTS10
:
...
...
@@ -201,9 +203,8 @@ namespace DeviceLibrary
case
MoveStep
.
StoreTS20
:
MoveInfo
.
NextMoveStep
(
MoveStep
.
StoreTS21
);
Y_Axis
.
AbsMove
(
MoveInfo
,
To
.
Y_Axis_P2
+
ToCheckOffset
,
Config
.
Y_Axis_P1_speed
);
MoveInfo
.
log
(
$
"{storeMoveType}:Y轴到达目的地偏移点:{To.Y_Axis_P2}+{ToCheckOffset}"
);
X_Axis
.
AbsMove
(
MoveInfo
,
To
.
X_Axis_P2
,
Config
.
X_Axis_P1_speed
);
MoveInfo
.
log
(
$
"{storeMoveType}:X
轴到达目的地检测:{To.X_Axis_P2
}"
);
MoveInfo
.
log
(
$
"{storeMoveType}:X
Y轴到达目的地检测,X:{To.X_Axis_P2},Y:{To.Y_Axis_P2}+{ToCheckOffset
}"
);
break
;
case
MoveStep
.
StoreTS21
:
if
(
CheckPosStatus
(
MoveInfo
,
To
.
posid
))
{
...
...
@@ -213,6 +214,12 @@ namespace DeviceLibrary
case
MoveStep
.
StoreTS22
:
MoveInfo
.
NextMoveStep
(
MoveStep
.
StoreTS23
);
MoveInfo
.
log
(
$
"{storeMoveType}:Z轴到达入库前点"
);
if
(
From
.
posid
==
MainMachine
.
LabelP
&&
To
.
posid
==
MainMachine
.
RFIDP
)
{
MoveInfo
.
NextMoveStep
(
MoveStep
.
StoreTS29
);
MoveInfo
.
log
(
"LabelP=>RFIDP 直接结束"
);
}
else
{
var
zp2
=
To
.
Z_Axis_P3
-
205000
;
if
(
zp2
<
0
)
...
...
@@ -288,7 +295,7 @@ namespace DeviceLibrary
break
;
case
MoveStep
.
StoreTS29
:
MoveInfo
.
log
(
$
"{storeMoveType}:转移
料盘
完成"
);
MoveInfo
.
log
(
$
"{storeMoveType}:转移
物料
完成"
);
MoveInfo
.
EndMove
();
ErrMsgTxt
=
""
;
To
.
posid
=
""
;
...
...
@@ -351,21 +358,36 @@ namespace DeviceLibrary
}
else
if
(
Regex
.
IsMatch
(
posid
,
"^S[A-G]"
))
{
RobotManage
.
mainMachine
.
TPMove
.
ToLow
(
moveInfo
);
moveInfo
.
log
(
$
"{posid},上层库位移至左侧"
);
return
true
;
if
(
RobotManage
.
mainMachine
.
TPMove
.
IsLow
)
return
true
;
else
{
RobotManage
.
mainMachine
.
TPMove
.
ToLow
(
moveInfo
);
moveInfo
.
log
(
$
"{posid},上层库位移至左侧"
);
return
false
;
}
}
else
if
(
Regex
.
IsMatch
(
posid
,
"^S[H-N][1-6]$"
))
{
RobotManage
.
mainMachine
.
TPMove
.
ToHigh
(
moveInfo
);
moveInfo
.
log
(
$
"{posid},上层库位移至右侧"
);
return
true
;
if
(
RobotManage
.
mainMachine
.
TPMove
.
IsHigh
)
return
true
;
else
{
RobotManage
.
mainMachine
.
TPMove
.
ToHigh
(
moveInfo
);
moveInfo
.
log
(
$
"{posid},上层库位移至右侧"
);
return
false
;
}
}
else
if
(
Regex
.
IsMatch
(
posid
,
"^S[H-N]([7-9]|\\d{2})$"
))
{
RobotManage
.
mainMachine
.
TPMove
.
ToLow
(
moveInfo
);
moveInfo
.
log
(
$
"{posid},上层库位移至左侧"
);
return
true
;
if
(
RobotManage
.
mainMachine
.
TPMove
.
IsLow
)
return
true
;
else
{
RobotManage
.
mainMachine
.
TPMove
.
ToLow
(
moveInfo
);
moveInfo
.
log
(
$
"{posid},上层库位移至左侧"
);
return
false
;
}
}
else
{
//moveInfo.log($"{posid},未知库位");
...
...
DeviceLibrary/theMachine/CameraPointTest.cs
查看文件 @
79e944f
...
...
@@ -123,10 +123,8 @@ namespace DeviceLibrary
}
}
static
List
<
int
>
TestStorePoint
(
Bitmap
bmp
,
TestStorePointPort
tp
)
public
static
List
<
int
>
TestStorePoint
(
Bitmap
bmp
,
TestStorePointPort
tp
)
{
if
(
bmp
==
null
)
return
new
List
<
int
>();
//TestStorePointEvent?.Invoke(tp, bmp);
...
...
@@ -137,7 +135,9 @@ namespace DeviceLibrary
}
List
<
Point
>
points
=
CameraData
[
Name
].
ObjectPoint
;
if
(
bmp
==
null
)
return
new
List
<
int
>(
points
.
Count
);
List
<
int
>
haslist
=
new
List
<
int
>();
var
bd
=
bmp
.
LockBits
(
new
Rectangle
(
0
,
0
,
bmp
.
Width
,
bmp
.
Height
),
ImageLockMode
.
ReadOnly
,
bmp
.
PixelFormat
);
try
...
...
@@ -148,9 +148,9 @@ namespace DeviceLibrary
p
.
X
=
p
.
X
-
8
;
p
.
Y
=
p
.
Y
-
8
;
var
cl
=
new
List
<
ColorHSV
>();
for
(
int
j
=
0
;
j
<
16
;
j
++)
for
(
int
j
=
0
;
j
<
32
;
j
++)
{
for
(
int
k
=
0
;
k
<
16
;
k
++)
for
(
int
k
=
0
;
k
<
32
;
k
++)
{
var
x
=
p
.
X
+
j
;
var
y
=
p
.
Y
+
k
;
...
...
@@ -257,11 +257,11 @@ namespace DeviceLibrary
int
errlinecount
=
0
;
try
{
for
(
int
i
=
0
;
i
<
height
;
i
++
)
for
(
int
i
=
0
;
i
<
height
;
i
=
i
+
2
)
{
int
linecount
=
0
;
for
(
int
j
=
0
;
j
<
width
;
j
++
)
for
(
int
j
=
0
;
j
<
width
;
j
=
j
+
3
)
{
var
x
=
Start
.
X
+
j
;
var
y
=
Start
.
Y
+
height
-
i
;
...
...
@@ -281,7 +281,7 @@ namespace DeviceLibrary
Marshal
.
WriteByte
(
bd
.
Scan0
,
addr
,
0
);
}
}
if
(
linecount
<
width
*
0.6
)
if
(
linecount
*
3
<
width
*
0.6
)
{
errlinecount
++;
HeightCount
=
0
;
...
...
@@ -293,7 +293,7 @@ namespace DeviceLibrary
}
else
{
HeightCount
++;
if
(
HeightCount
>
50
)
{
if
(
HeightCount
*
2
>
50
)
{
return
true
;
}
}
...
...
DeviceLibrary/theMachine/MainMachine _IOMonitor.cs
查看文件 @
79e944f
...
...
@@ -14,9 +14,34 @@ namespace DeviceLibrary
{
partial
class
MainMachine
{
bool
MaterialDoorOpen
=
false
;
public
bool
LeftDoorOpen
=
false
;
public
bool
RightDoorOpen
=
false
;
public
bool
PrintDoorOpen
=
false
;
void
ioMonitor
()
{
//if (!PrintDoorOpen && IOValue(IO_Type.PrinterDoor_Check).Equals(IO_VALUE.HIGH))
//{
// IOMove(IO_Type.PrinterDoor_Lock, IO_VALUE.HIGH);
//}
//else
//{
// PrintDoorOpen = false;
//}
//if (!LeftDoorOpen && IOValue(IO_Type.LeftDoor_Check).Equals(IO_VALUE.LOW))
//{
// IOMove(IO_Type.LeftDoor_Lock, IO_VALUE.HIGH);
//}
//else {
// LeftDoorOpen = false;
//}
//if (!RightDoorOpen && IOValue(IO_Type.RightDoor_Check).Equals(IO_VALUE.LOW))
//{
// IOMove(IO_Type.RightDoor_Lock, IO_VALUE.HIGH);
//}
//else
//{
// RightDoorOpen = false;
//}
if
(
IOValue
(
IO_Type
.
Airpressure_Check
).
Equals
(
IO_VALUE
.
LOW
))
{
Msg
.
add
(
crc
.
GetString
(
"Res0079"
,
"未检测到气压信号."
),
MsgLevel
.
warning
);
}
...
...
DeviceLibrary/theMachine/MainMachine _LedProcess.cs
查看文件 @
79e944f
...
...
@@ -18,6 +18,7 @@ namespace DeviceLibrary
{
Led
AlarmLed
;
Led
StandbyLed
;
Led
RunningLed
;
public
Dictionary
<
MachineLedStateE
,
Dictionary
<
LedColor
,
LedState
>>
MachineLedState
=
new
Dictionary
<
MachineLedStateE
,
Dictionary
<
LedColor
,
LedState
>>();
public
Dictionary
<
MachineLedStateE
,
string
>
MachineLedStateName
=
new
Dictionary
<
MachineLedStateE
,
string
>();
...
...
@@ -82,11 +83,11 @@ namespace DeviceLibrary
MachineLedStateName
[
MachineLedStateE
.
SystemPause
]
=
crc
.
GetString
(
"Res0084"
,
"暂停"
);
MachineLedState
.
Add
(
MachineLedStateE
.
SystemPause
,
nls
(
LedState
.
blink
,
LedState
.
off
,
LedState
.
blink
));
//温湿度超限30分钟. 红闪,黄闪
MachineLedStateName
[
MachineLedStateE
.
THoutRangeOver30m
]
=
crc
.
GetString
(
"Res0085"
,
"温湿度超限30分钟"
);
MachineLedState
.
Add
(
MachineLedStateE
.
THoutRangeOver30m
,
nls
(
LedState
.
blink
,
LedState
.
blink
,
LedState
.
none
));
//
MachineLedStateName[MachineLedStateE.THoutRangeOver30m] = crc.GetString("Res0085","温湿度超限30分钟");
//
MachineLedState.Add(MachineLedStateE.THoutRangeOver30m, nls(LedState.blink, LedState.blink, LedState.none));
//温湿度超限 绿闪黄闪
MachineLedStateName
[
MachineLedStateE
.
THoutRange
]
=
crc
.
GetString
(
"Res0086"
,
"温湿度超限"
);
MachineLedState
.
Add
(
MachineLedStateE
.
THoutRange
,
nls
(
LedState
.
none
,
LedState
.
blink
,
LedState
.
blink
));
//
MachineLedStateName[MachineLedStateE.THoutRange] = crc.GetString("Res0086","温湿度超限");
//
MachineLedState.Add(MachineLedStateE.THoutRange, nls(LedState.none, LedState.blink, LedState.blink));
//进出库, 绿亮,黄闪
MachineLedStateName
[
MachineLedStateE
.
InOut
]
=
crc
.
GetString
(
"Res0087"
,
"出入库中"
);
MachineLedState
.
Add
(
MachineLedStateE
.
InOut
,
nls
(
LedState
.
none
,
LedState
.
blink
,
LedState
.
on
));
...
...
@@ -111,7 +112,7 @@ namespace DeviceLibrary
foreach
(
var
ledcolor
in
ledcfg
.
Keys
)
{
if
(!
Led
.
LedColors
.
ContainsKey
(
ledcolor
)
||
ledcfg
[
ledcolor
]
==
LedState
.
none
)
return
;
continue
;
Led
.
LedColors
[
ledcolor
].
LedState
=
ledcfg
[
ledcolor
];
}
}
...
...
@@ -137,22 +138,6 @@ namespace DeviceLibrary
//StandbyLed.LedState = LedState.blink;
ProcessLefCfg
(
MachineLedStateE
.
InOut
);
}
//温度超限 绿亮 黄闪
if
(
IsTHoutRange
())
{
//RunningLed.LedState = LedState.on;
//StandbyLed.LedState = LedState.blink;
ProcessLefCfg
(
MachineLedStateE
.
THoutRange
);
}
//温度超限30分钟 绿亮 黄闪 红闪
if
(
IsTHoutRangeOver30m
())
{
//RunningLed.LedState = LedState.on;
//StandbyLed.LedState = LedState.blink;
//AlarmLed.LedState = LedState.blink;
ProcessLefCfg
(
MachineLedStateE
.
THoutRangeOver30m
);
}
//系统暂停,说明书未定义, 绿闪, 红闪
if
(!
canRunning
||
UserPause
)
{
...
...
DeviceLibrary/theMachine/MainMachine.cs
查看文件 @
79e944f
...
...
@@ -85,6 +85,7 @@ namespace DeviceLibrary
AIOTMoveInfo
=
new
MoveInfo
(
crc
.
GetString
(
"Res0091"
,
"出入库测试"
));
#
region
初始化
led
灯
RunningLed
=
new
Led
(
Config
.
DOList
[
IO_Type
.
AuroRun_Led
].
GetIOAddr
(),
LedColor
.
green
);
StandbyLed
=
new
Led
(
Config
.
DOList
[
IO_Type
.
Standby_Led
].
GetIOAddr
(),
LedColor
.
yellow
);
AlarmLed
=
new
Led
(
Config
.
DOList
[
IO_Type
.
Alarm_Led
].
GetIOAddr
(),
LedColor
.
red
);
#
endregion
...
...
@@ -118,13 +119,35 @@ namespace DeviceLibrary
AlarmBuzzer
.
SetOnOffAction
(()
=>{
IOMove
(
IO_Type
.
Alarm_Buzzer
,
IO_VALUE
.
HIGH
);
},
()
=>
{
IOMove
(
IO_Type
.
Alarm_Buzzer
,
IO_VALUE
.
LOW
);
});
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
.
Entry_Drawer
,
Config
,
IO_VALUE
.
LOW
,
Entry_Drawer_Open
,
2500
,
100
);
IOMonitor
.
RegisterIO
(
IO_Type
.
Entry_Drawer
,
Config
,
IO_VALUE
.
LOW
,
Entry_Drawer_Open
,
1500
,
100
);
IOMonitor
.
RegisterIO
(
IO_Type
.
Entry_Drawer
,
Config
,
IO_VALUE
.
HIGH
,
Entry_Drawer_Close
,
1500
,
100
);
IOMonitor
.
RegisterIO
(
IO_Type
.
Out_Drawer
,
Config
,
IO_VALUE
.
HIGH
,
Out_Drawer_Close
,
1500
,
100
);
IOMonitor
.
RegisterIO
(
IO_Type
.
RightDoor_Check
,
Config
,
IO_VALUE
.
LOW
,
RightDoor_Close
,
1500
,
100
);
IOMonitor
.
RegisterIO
(
IO_Type
.
LeftDoor_Check
,
Config
,
IO_VALUE
.
LOW
,
LeftDoor_Close
,
1500
,
100
);
IOMonitor
.
RegisterIO
(
IO_Type
.
PrinterDoor_Check
,
Config
,
IO_VALUE
.
HIGH
,
PrinterDoor_Close
,
1500
,
100
);
LedProcessInit
();
}
private
void
Entry_Drawer_Open
()
{
nglist
=
new
List
<
string
>();
}
private
void
RightDoor_Close
()
{
IOMove
(
IO_Type
.
RightDoor_Lock
,
IO_VALUE
.
HIGH
);
}
private
void
LeftDoor_Close
()
{
IOMove
(
IO_Type
.
LeftDoor_Lock
,
IO_VALUE
.
HIGH
);
}
private
void
PrinterDoor_Close
()
{
IOMove
(
IO_Type
.
PrinterDoor_Lock
,
IO_VALUE
.
HIGH
);
}
private
void
Entry_Drawer_Close
()
{
CameraPointTest
.
GetThingStoreName
(
TestStorePointPort
.
入口
);
}
private
void
Out_Drawer_Close
()
{
CameraPointTest
.
GetThingStoreName
(
TestStorePointPort
.
出口
);
}
private
(
bool
,
string
)
Y_Axis_interference
(
int
from
,
int
to
)
...
...
@@ -164,6 +187,8 @@ namespace DeviceLibrary
while
(
mstart
)
{
try
{
Thread
.
Sleep
(
200
);
ioMonitor
();
canRunning
=
DeviceCheck
();
if
(
canRunning
)
{
...
...
@@ -172,12 +197,12 @@ namespace DeviceLibrary
//if (canRunning && !lastSafeCheckStatus){}
//lastSafeCheckStatus = canRunning;
}
Thread
.
Sleep
(
200
);
if
(!
canRunning
||
!
mstart
)
continue
;
if
(
runStatus
==
RunStatus
.
Running
)
{
ioMonitor
();
boxTransport
.
Process
();
if
(
RobotManage
.
InoutDebugMode
)
AutoInOutTestProcess
();
...
...
@@ -233,6 +258,21 @@ namespace DeviceLibrary
public
void
Start
()
{
ServerCM
.
StartConnectServer
();
Msg
.
add
(
""
,
MsgLevel
.
info
,
ErrInfo
.
X09_Clear
);
LeftDoorOpen
=
false
;
RightDoorOpen
=
false
;
PrintDoorOpen
=
false
;
if
(
IOValue
(
IO_Type
.
PrinterDoor_Check
).
Equals
(
IO_VALUE
.
HIGH
))
{
IOMove
(
IO_Type
.
PrinterDoor_Lock
,
IO_VALUE
.
HIGH
);
}
if
(
IOValue
(
IO_Type
.
LeftDoor_Check
).
Equals
(
IO_VALUE
.
LOW
))
{
IOMove
(
IO_Type
.
LeftDoor_Lock
,
IO_VALUE
.
HIGH
);
}
if
(
IOValue
(
IO_Type
.
RightDoor_Check
).
Equals
(
IO_VALUE
.
LOW
))
{
IOMove
(
IO_Type
.
RightDoor_Lock
,
IO_VALUE
.
HIGH
);
}
Run
();
}
public
void
Stop
()
{
...
...
@@ -271,6 +311,7 @@ namespace DeviceLibrary
{
case
MoveStep
.
H01_HomeReset
:
ServerCM
.
storeStatus
=
StoreStatus
.
ResetMove
;
OutStoreJobList
.
ClearLastPosid
();
if
(
IOValue
(
IO_Type
.
Entry_Drawer
).
Equals
(
IO_VALUE
.
LOW
))
{
Msg
.
add
(
crc
.
GetString
(
"Res0094"
,
"入料抽屉没有关闭"
),
MsgLevel
.
alarm
);
return
;
...
...
@@ -280,17 +321,7 @@ namespace DeviceLibrary
Msg
.
add
(
crc
.
GetString
(
"Res0095"
,
"出料抽屉没有关闭"
),
MsgLevel
.
alarm
);
return
;
}
if
(
IOValue
(
IO_Type
.
Taking_Clamp
).
Equals
(
IO_VALUE
.
LOW
))
{
if
(
Setting_Init
.
Runtime_Step
>=
Runtime_StepE
.
Printed
&&
Setting_Init
.
Runtime_Step
<
Runtime_StepE
.
LabelPasteFinish
)
{
StoreMoveInfo
.
log
(
"检测到上次正在贴标:"
+
Setting_Init
.
Runtime_Step
+
","
+
Setting_Init
.
Runtime_Posid
);
//LabelingMoveInfo.NextMoveStep(MoveStep.Labeling01);
//StoreMoveInfo.NextMoveStep(MoveStep.StoreIn03);
Msg
.
add
(
"重置前物料正在贴标,无法继续,请手动处理"
,
MsgLevel
.
warning
,
ErrInfo
.
LabelInPaste
);
RobotManage
.
UserPause
(
"重置前物料正在贴标,无法继续,请手动处理"
);
}
}
ResetMoveInfo
.
NextMoveStep
(
MoveStep
.
H02_HomeReset_01
);
ResetMoveInfo
.
log
(
"锁定抽屉"
);
IOMove
(
IO_Type
.
Entry_Drawer_Lock
,
IO_VALUE
.
HIGH
);
...
...
@@ -320,9 +351,26 @@ namespace DeviceLibrary
case
MoveStep
.
H03_HomeReset
:
ResetMoveInfo
.
NextMoveStep
(
MoveStep
.
H04_HomeReset
);
FlipEquip
.
LiftUp
(
ResetMoveInfo
);
Z_Axis
.
AbsMove
(
ResetMoveInfo
,
Config
.
Z_Axis_P1
,
Config
.
Z_Axis_P1_speed
);
break
;
case
MoveStep
.
H04_HomeReset
:
ResetMoveInfo
.
NextMoveStep
(
MoveStep
.
H05_HomeReset
);
X_Axis
.
AbsMove
(
ResetMoveInfo
,
Config
.
X_Axis_P1
,
Config
.
X_Axis_P1_speed
);
Y_Axis
.
AbsMove
(
ResetMoveInfo
,
Config
.
Y_Axis_P1
,
Config
.
Y_Axis_P1_speed
);
break
;
case
MoveStep
.
H05_HomeReset
:
ResetMoveInfo
.
NextMoveStep
(
MoveStep
.
HEND_HomeReset
);
if
(
IOValue
(
IO_Type
.
Taking_Clamp
).
Equals
(
IO_VALUE
.
LOW
))
{
if
(
Setting_Init
.
Runtime_Step
>=
Runtime_StepE
.
Printed
&&
Setting_Init
.
Runtime_Step
<
Runtime_StepE
.
LabelPasteFinish
)
{
StoreMoveInfo
.
log
(
"检测到上次正在贴标:"
+
Setting_Init
.
Runtime_Step
+
","
+
Setting_Init
.
Runtime_Posid
);
//LabelingMoveInfo.NextMoveStep(MoveStep.Labeling01);
//StoreMoveInfo.NextMoveStep(MoveStep.StoreIn03);
Msg
.
add
(
"重置前物料正在贴标,无法继续,请手动处理"
,
MsgLevel
.
warning
,
ErrInfo
.
LabelInPaste
);
RobotManage
.
UserPause
(
"重置前物料正在贴标,无法继续,请手动处理"
);
}
}
break
;
case
MoveStep
.
HEND_HomeReset
:
forceHome
=
false
;
...
...
@@ -353,26 +401,44 @@ namespace DeviceLibrary
bool
SafeCheck
()
{
bool
ok
=
true
;
var
ignorestring
=
"["
+
crc
.
GetString
(
"Res0096"
,
"已忽略"
)
+
"]"
;
if
(
IOValue
(
IO_Type
.
Left
Door_Check
).
Equals
(
IO_VALUE
.
LOW
))
if
(
IOValue
(
IO_Type
.
Printer
Door_Check
).
Equals
(
IO_VALUE
.
LOW
))
{
if
(!
IgnoreSafecheck
)
{
ok
=
false
;
DeviceSuddenStop
();
}
Msg
.
add
(
crc
.
GetString
(
"Res0097"
,
"左侧防护门没有关闭"
)
+
(
ok
?
ignorestring
:
""
),
MsgLevel
.
warning
);
Msg
.
add
(
"打印机维护门未关闭"
+
(
ok
?
ignorestring
:
""
),
MsgLevel
.
alarm
);
}
if
(
IOValue
(
IO_Type
.
RightDoor_Check
).
Equals
(
IO_VALUE
.
LOW
))
if
(
IOValue
(
IO_Type
.
LeftDoor_Check
).
Equals
(
IO_VALUE
.
HIGH
))
{
if
(!
IgnoreSafecheck
)
{
ok
=
false
;
DeviceSuddenStop
();
}
Msg
.
add
(
crc
.
GetString
(
"Res0098"
,
"右侧防护门没有关闭"
)
+
(
ok
?
ignorestring
:
""
),
MsgLevel
.
warning
);
Msg
.
add
(
crc
.
GetString
(
"Res0097"
,
"左侧防护门没有关闭"
)
+
(
ok
?
ignorestring
:
""
),
MsgLevel
.
alarm
);
}
if
(
IOValue
(
IO_Type
.
RightDoor_Check
).
Equals
(
IO_VALUE
.
HIGH
))
{
if
(!
IgnoreSafecheck
)
{
ok
=
false
;
DeviceSuddenStop
();
}
Msg
.
add
(
crc
.
GetString
(
"Res0098"
,
"右侧防护门没有关闭"
)
+
(
ok
?
ignorestring
:
""
),
MsgLevel
.
alarm
);
}
if
(
IOValue
(
IO_Type
.
SafeDoor_Disable
).
Equals
(
IO_VALUE
.
LOW
)
&&
IOValue
(
IO_Type
.
DoorLock_Check
).
Equals
(
IO_VALUE
.
LOW
))
{
Msg
.
add
(
"防护门没有锁定"
,
MsgLevel
.
warning
);
DeviceSuddenStop
();
ok
=
false
;
}
if
(!
lastSafeCheckStatus
&&
ok
)
{
SafetyDevice
.
ResumeAll
();
}
lastSafeCheckStatus
=
ok
;
...
...
@@ -403,7 +469,7 @@ namespace DeviceLibrary
isInSuddenDown
=
IOValue
(
IO_Type
.
SuddenStop_BTN
).
Equals
(
IO_VALUE
.
LOW
);
if
(
UserPause
)
{
Msg
.
add
(
crc
.
GetString
(
"Res0099"
,
"系统暂停"
),
MsgLevel
.
warning
);
Msg
.
add
(
crc
.
GetString
(
"Res0099"
,
"系统暂停"
),
MsgLevel
.
warning
);
DeviceSuddenStop
();
lastSafeCheckStatus
=
false
;
ok
=
false
;
...
...
@@ -412,17 +478,19 @@ namespace DeviceLibrary
else
if
(
isInSuddenDown
)
{
Alarm
(
AlarmType
.
SuddenStop
);
Msg
.
add
(
crc
.
GetString
(
"Res0100"
,
"急停中"
),
MsgLevel
.
alarm
);
Msg
.
add
(
crc
.
GetString
(
"Res0100"
,
"急停中"
),
MsgLevel
.
alarm
);
ok
=
false
;
}
else
if
(
alarmType
!=
AlarmType
.
None
)
{
else
if
(
alarmType
!=
AlarmType
.
None
)
{
//if (IOValue(IO_Type.Right_BTN).Equals(IO_VALUE.HIGH) || IOValue(IO_Type.Left_BTN).Equals(IO_VALUE.HIGH))
//{
// Alarm(AlarmType.None);
//}
//else
{
Msg
.
add
(
crc
.
GetString
(
"Res0101"
,
"系统需要重置"
),
MsgLevel
.
alarm
,
ErrInfo
.
SuddenStop
);
Msg
.
add
(
crc
.
GetString
(
"Res0101"
,
"系统需要重置"
),
MsgLevel
.
alarm
,
ErrInfo
.
SuddenStop
);
ButtenEvent
?.
Invoke
(
null
,
ErrInfo
.
SuddenStop
);
ok
=
false
;
}
...
...
DeviceLibrary/theMachine/MainMachine_Labeling.cs
查看文件 @
79e944f
...
...
@@ -7,6 +7,7 @@ using System.Collections.Generic;
using
System.Drawing
;
using
System.Linq
;
using
System.Text
;
using
System.Text.RegularExpressions
;
using
System.Threading.Tasks
;
namespace
DeviceLibrary
...
...
@@ -28,29 +29,42 @@ namespace DeviceLibrary
case
MoveStep
.
Labeling01
:
LabelingMoveInfo
.
NextMoveStep
(
MoveStep
.
Labeling02
);
FlipEquip
.
LiftDown
(
LabelingMoveInfo
);
LabelingMoveInfo
.
log
(
"
翻转机构下降
"
);
LabelingMoveInfo
.
log
(
"
进入扫码贴标机构
"
);
CylinderMove
(
LabelingMoveInfo
,
IO_Type
.
Label_Dock_Down
,
IO_Type
.
Label_Dock_Up
,
IO_VALUE
.
LOW
);
break
;
case
MoveStep
.
Labeling02
:
LabelingMoveInfo
.
NextMoveStep
(
MoveStep
.
Labeling03
);
CylinderMove
(
LabelingMoveInfo
,
IO_Type
.
Tin_Dock_Left
,
IO_Type
.
Tin_Dock_Right
,
IO_VALUE
.
HIGH
);
CylinderMove
(
LabelingMoveInfo
,
IO_Type
.
Label_Dock_Back
,
IO_Type
.
Label_Dock_Front
,
IO_VALUE
.
HIGH
);
LabelingMoveInfo
.
log
(
"锡膏横移到右侧"
);
//
LabelingMoveInfo.log("锡膏横移到右侧");
ScanTimes
=
0
;
CodeList
=
new
List
<
CodeInfo
>();
LabelingMoveInfo
.
MoveParam
=
new
ReelParam
();
break
;
case
MoveStep
.
Labeling03
:
LabelingMoveInfo
.
NextMoveStep
(
MoveStep
.
Labeling04
);
RotateEquip
.
TurnDegree
(
30
);
//LabelingMoveInfo.WaitList.Add(WaitResultInfo.WaitTime(2000));
LabelingMoveInfo
.
log
(
"滚动锡膏"
);
RotateEquip
.
LockAndTurnDegree
(-
20
);
break
;
case
MoveStep
.
Labeling04
:
if
(
RotateEquip
.
TurnWork
.
IsCompleted
)
{
LabelingMoveInfo
.
NextMoveStep
(
MoveStep
.
Labeling05
);
//LabelingMoveInfo.WaitList.Add(WaitResultInfo.WaitTime(1000));
ScanCode
();
LabelingMoveInfo
.
NextMoveStep
(
MoveStep
.
Labeling04a
);
TakePicture
();
}
break
;
case
MoveStep
.
Labeling04a
:
if
(
IsTackPictureFinish
)
{
if
(
TakePictureTask
.
Result
)
{
LabelingMoveInfo
.
NextMoveStep
(
MoveStep
.
Labeling05
);
RotateEquip
.
LockAndTurnDegree
(-
20
);
ScanCode
();
}
else
{
LabelingMoveInfo
.
NextMoveStep
(
MoveStep
.
Labeling04
);
LabelingMoveInfo
.
log
(
"拍照失败,重试"
);
}
}
break
;
case
MoveStep
.
Labeling05
:
...
...
@@ -61,32 +75,23 @@ namespace DeviceLibrary
LabelingMoveInfo
.
log
(
$
"扫到部分条码:"
+
string
.
Join
(
","
,
xx
.
Select
(
x
=>
x
.
CodeType
+
":"
+
x
.
CodeStr
).
ToArray
()));
CodeList
.
AddRange
(
xx
);
if
(
HasRightCode
(
xx
.
ToArray
(),
LabelingMoveInfo
.
MoveParam
))
if
(
HasRightCode
(
CodeList
.
ToArray
(),
LabelingMoveInfo
.
MoveParam
))
{
Setting_Init
.
Runtime_RFID
=
LabelingMoveInfo
.
MoveParam
.
RFID
;
LabelingMoveInfo
.
MoveParam
.
IsNg
=
false
;
LabelingMoveInfo
.
NextMoveStep
(
MoveStep
.
Labeling06
);
LabelingMoveInfo
.
MoveParam
.
PlateH
=
50
;
LabelingMoveInfo
.
MoveParam
.
PlateW
=
7
;
LabelingMoveInfo
.
log
(
"code: "
+
LabelingMoveInfo
.
MoveParam
.
WareCode
);
ScanTimes
=
0
;
ServerCM
.
SendInStoreRequest
(
new
string
[]
{
LabelingMoveInfo
.
MoveParam
.
WareCode
},
LabelingMoveInfo
.
MoveParam
,
true
);
Setting_Init
.
Runtime_Posid
=
LabelingMoveInfo
.
MoveParam
.
PosID
;
if
(
false
&&
LabelingMoveInfo
.
MoveParam
.
usedCount
>
0
)
{
LabelingMoveInfo
.
NextMoveStep
(
MoveStep
.
Labeling55
);
}
Setting_Init
.
Runtime_RFID
=
LabelingMoveInfo
.
MoveParam
.
RFID
;
return
;
}
}
if
(
demomode
&&
false
)
{
LabelingMoveInfo
.
MoveParam
.
IsNg
=
false
;
LabelingMoveInfo
.
MoveParam
.
WareCode
=
"Demo"
;
LabelingMoveInfo
.
NextMoveStep
(
MoveStep
.
Labeling06
);
ScanTimes
=
0
;
return
;
}
ScanTimes
++;
if
(
ScanTimes
>=
12
)
if
(
ScanTimes
>=
1
8
*
2
)
{
LabelingMoveInfo
.
NextMoveStep
(
MoveStep
.
Labeling06
);
LabelingMoveInfo
.
log
(
$
"未识别到有效二维码,送到NG口"
);
...
...
@@ -94,37 +99,35 @@ namespace DeviceLibrary
LabelingMoveInfo
.
MoveParam
.
NgMsg
=
crc
.
GetString
(
L
.
not_detect_reel_code
,
"未识别到有效二维码"
);
}
else
{
LabelingMoveInfo
.
NextMoveStep
(
MoveStep
.
Labeling0
3
);
LabelingMoveInfo
.
NextMoveStep
(
MoveStep
.
Labeling0
4
);
LabelingMoveInfo
.
log
(
"继续扫码"
);
}
}
break
;
case
MoveStep
.
Labeling06
:
LabelingMoveInfo
.
NextMoveStep
(
MoveStep
.
Labeling07
);
RotateEquip
.
TurnDegree
(-
36
);
LabelingMoveInfo
.
log
(
"滚动锡膏"
);
RotateEquip
.
TurnDegree
(-
45
);
//
LabelingMoveInfo.log("滚动锡膏");
break
;
case
MoveStep
.
Labeling07
:
if
(
RotateEquip
.
TurnWork
.
IsCompleted
)
{
LabelingMoveInfo
.
NextMoveStep
(
MoveStep
.
Labeling06
);
var
hc
=
CameraPointTest
.
ScanRectangle
();
LabelingMoveInfo
.
log
(
"检测到绿色宽度:"
+
hc
);
var
hc
=
CameraPointTest
.
ScanRectangle
();
ScanTimes
++;
if
(
demomode
&&
false
)
{
LabelingMoveInfo
.
NextMoveStep
(
MoveStep
.
Labeling08
);
return
;
}
if
(
hc
)
{
LabelingMoveInfo
.
log
(
"检测到绿色区域"
);
LabelingMoveInfo
.
NextMoveStep
(
MoveStep
.
Labeling08
);
}
else
if
(
ScanTimes
>
10
)
{
LabelingMoveInfo
.
log
(
"未找到绿色区域"
);
LabelingMoveInfo
.
NextMoveStep
(
MoveStep
.
Labeling08
);
LabelingMoveInfo
.
MoveParam
.
IsNg
=
true
;
LabelingMoveInfo
.
MoveParam
.
NgMsg
=
"未找到绿色区域"
;
}
ServerCM
.
cancelPutInTask
(
""
,
LabelingMoveInfo
.
MoveParam
.
WareCode
);
}
//else
//LabelingMoveInfo.log("本次未找到绿色区域,转动后再次查找,"+ ScanTimes);
}
break
;
case
MoveStep
.
Labeling08
:
...
...
@@ -142,6 +145,7 @@ namespace DeviceLibrary
}
else
{
LabelingMoveInfo
.
NextMoveStep
(
MoveStep
.
Labeling10
);
LabelingMoveInfo
.
log
(
"开始贴标"
);
}
}
break
;
...
...
@@ -149,7 +153,7 @@ namespace DeviceLibrary
LabelingMoveInfo
.
NextMoveStep
(
MoveStep
.
Labeling11
);
PrintTask
=
RobotManage
.
printerHelper
.
PrintLabel
(
LabelingMoveInfo
.
MoveParam
);
Setting_Init
.
Runtime_Step
=
Runtime_StepE
.
Printed
;
LabelingMoveInfo
.
log
(
"
检测到打印任务开始打印
:"
+
LabelingMoveInfo
.
MoveParam
.
ToDetailStr
());
LabelingMoveInfo
.
log
(
"
开始打印标签
:"
+
LabelingMoveInfo
.
MoveParam
.
ToDetailStr
());
break
;
case
MoveStep
.
Labeling11
:
if
(
PrintTask
.
IsCompleted
)
...
...
@@ -173,30 +177,30 @@ namespace DeviceLibrary
case
MoveStep
.
Labeling12
:
LabelingMoveInfo
.
NextMoveStep
(
MoveStep
.
Labeling13
);
CylinderMove
(
LabelingMoveInfo
,
IO_Type
.
Label_Dock_Back
,
IO_Type
.
Label_Dock_Front
,
IO_VALUE
.
LOW
);
LabelingMoveInfo
.
log
(
"
接标台左移动
"
);
LabelingMoveInfo
.
log
(
"
开始贴标
"
);
break
;
case
MoveStep
.
Labeling13
:
LabelingMoveInfo
.
NextMoveStep
(
MoveStep
.
Labeling14
);
CylinderMove
(
LabelingMoveInfo
,
IO_Type
.
Label_Dock_Down
,
IO_Type
.
Label_Dock_Up
,
IO_VALUE
.
HIGH
);
LabelingMoveInfo
.
log
(
"接标台上升"
);
//
LabelingMoveInfo.log("接标台上升");
break
;
case
MoveStep
.
Labeling14
:
LabelingMoveInfo
.
NextMoveStep
(
MoveStep
.
Labeling15
);
IOMove
(
IO_Type
.
Label_Vacuum
,
IO_VALUE
.
HIGH
);
CylinderMove
(
null
,
IO_Type
.
Labeling_Down
,
IO_Type
.
Labeling_Up
,
IO_VALUE
.
LOW
);
Setting_Init
.
Runtime_Step
=
Runtime_StepE
.
LabelGot
;
LabelingMoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitTime
(
1000
));
LabelingMoveInfo
.
log
(
"吸标下降"
);
//
LabelingMoveInfo.WaitList.Add(WaitResultInfo.WaitTime(1000));
//
LabelingMoveInfo.log("吸标下降");
break
;
case
MoveStep
.
Labeling15
:
LabelingMoveInfo
.
NextMoveStep
(
MoveStep
.
Labeling16
);
LabelingMoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitTime
(
10
00
));
LabelingMoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitTime
(
5
00
));
break
;
case
MoveStep
.
Labeling16
:
LabelingMoveInfo
.
NextMoveStep
(
MoveStep
.
Labeling50
);
CylinderMove
(
null
,
IO_Type
.
Labeling_Down
,
IO_Type
.
Labeling_Up
,
IO_VALUE
.
HIGH
);
LabelingMoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitTime
(
1000
));
LabelingMoveInfo
.
log
(
"吸标上升"
);
//
LabelingMoveInfo.WaitList.Add(WaitResultInfo.WaitTime(1000));
//
LabelingMoveInfo.log("吸标上升");
break
;
case
MoveStep
.
Labeling50
:
LabelingMoveInfo
.
NextMoveStep
(
MoveStep
.
Labeling51
);
...
...
@@ -206,9 +210,9 @@ namespace DeviceLibrary
case
MoveStep
.
Labeling51
:
LabelingMoveInfo
.
NextMoveStep
(
MoveStep
.
Labeling52
);
CylinderMove
(
null
,
IO_Type
.
Labeling_Down
,
IO_Type
.
Labeling_Up
,
IO_VALUE
.
LOW
);
LabelingMoveInfo
.
log
(
"贴标下降"
);
//
LabelingMoveInfo.log("贴标下降");
Setting_Init
.
Runtime_Step
=
Runtime_StepE
.
LabelPaste
;
LabelingMoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitTime
(
1000
));
//
LabelingMoveInfo.WaitList.Add(WaitResultInfo.WaitTime(1000));
break
;
case
MoveStep
.
Labeling52
:
LabelingMoveInfo
.
NextMoveStep
(
MoveStep
.
Labeling53
);
...
...
@@ -219,27 +223,44 @@ namespace DeviceLibrary
if
(
RotateEquip
.
TurnWork
.
IsCompleted
)
{
LabelingMoveInfo
.
NextMoveStep
(
MoveStep
.
Labeling54
);
Setting_Init
.
Runtime_Step
=
Runtime_StepE
.
LabelPasteFinish
;
LabelingMoveInfo
.
log
(
"滚动回位"
);
}
break
;
case
MoveStep
.
Labeling54
:
LabelingMoveInfo
.
NextMoveStep
(
MoveStep
.
Labeling55
);
CylinderMove
(
null
,
IO_Type
.
Labeling_Down
,
IO_Type
.
Labeling_Up
,
IO_VALUE
.
HIGH
);
LabelingMoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitTime
(
1000
));
//
LabelingMoveInfo.WaitList.Add(WaitResultInfo.WaitTime(1000));
break
;
case
MoveStep
.
Labeling55
:
LabelingMoveInfo
.
NextMoveStep
(
MoveStep
.
Labeling56
);
RotateEquip
.
TurnDegree
(
90
);
break
;
case
MoveStep
.
Labeling56
:
if
(
RotateEquip
.
TurnWork
.
IsCompleted
)
{
LabelingMoveInfo
.
NextMoveStep
(
MoveStep
.
Labeling57
);
Setting_Init
.
Runtime_Step
=
Runtime_StepE
.
LabelPasteFinish
;
LabelingMoveInfo
.
log
(
"贴标完成"
);
RotateEquip
.
TurnToEnd
(
false
);
}
break
;
case
MoveStep
.
Labeling57
:
if
(
RotateEquip
.
WaitStatus
(
null
))
{
LabelingMoveInfo
.
NextMoveStep
(
MoveStep
.
Labeling58
);
}
break
;
case
MoveStep
.
Labeling58
:
LabelingMoveInfo
.
NextMoveStep
(
MoveStep
.
Labeling59
);
CylinderMove
(
LabelingMoveInfo
,
IO_Type
.
Labeling_Left
,
IO_Type
.
Labeling_Right
,
IO_VALUE
.
HIGH
);
CylinderMove
(
null
,
IO_Type
.
Labeling_Left
,
IO_Type
.
Labeling_Right
,
IO_VALUE
.
HIGH
);
CylinderMove
(
LabelingMoveInfo
,
IO_Type
.
Tin_Dock_Left
,
IO_Type
.
Tin_Dock_Right
,
IO_VALUE
.
LOW
);
//CylinderMove(LabelingMoveInfo, IO_Type.Label_Dock_Back, IO_Type.Label_Dock_Front, IO_VALUE.LOW);
LabelingMoveInfo
.
log
(
"锡膏横移到左侧"
);
//
LabelingMoveInfo.log("锡膏横移到左侧");
break
;
case
MoveStep
.
Labeling5
6
:
case
MoveStep
.
Labeling5
9
:
LabelingMoveInfo
.
NextMoveStep
(
MoveStep
.
Wait
);
FlipEquip
.
LiftUp
(
LabelingMoveInfo
);
LabelingMoveInfo
.
log
(
"
翻转机构上升
"
);
LabelingMoveInfo
.
log
(
"
完成扫码贴标
"
);
break
;
default
:
LabelingMoveInfo
.
log
(
$
"未找到对应步骤:{StoreMoveInfo.MoveStep}"
);
...
...
@@ -259,7 +280,16 @@ namespace DeviceLibrary
return
state
;
}
public
bool
IsTackPictureFinish
{
get
{
if
(
TakePictureTask
==
null
)
return
true
;
return
TakePictureTask
.
IsCompleted
;
}
}
public
bool
IsScanFinish
{
get
...
...
@@ -272,49 +302,101 @@ namespace DeviceLibrary
}
int
scantrytimes
=
0
;
/// <summary>
/// 拍照线程
/// </summary>
Task
<
bool
>
TakePictureTask
;
public
void
TakePicture
()
{
LabelingMoveInfo
.
log
(
"开始拍照"
);
TakePictureTask
=
Task
.
Run
(
new
Func
<
bool
>(()
=>
{
IOMove
(
IO_Type
.
Camera_Led
,
IO_VALUE
.
HIGH
);
//Task.Delay(10).Wait();
return
CodeManager
.
TakePicture
(
CodeManager
.
hikNameList
);
}));
}
/// <summary>
/// 扫码线程
/// </summary>
Task
<
List
<
CodeInfo
>>
ScanTask
;
public
void
ScanCode
()
{
LabelingMoveInfo
.
log
(
"开始扫码"
);
try
ScanTask
=
Task
.
Run
(
new
Func
<
List
<
CodeInfo
>>(()
=>
{
ScanTask
=
Task
.
Run
(
new
Func
<
List
<
CodeInfo
>>(()
=>
{
IOMove
(
IO_Type
.
Camera_Led
,
IO_VALUE
.
HIGH
);
//Task.Delay(10).Wait();
var
l
=
CodeManager
.
CameraScan
(
CodeManager
.
hikNameList
);
//LastCodeList.AddRange(l);
IOMove
(
IO_Type
.
Camera_Led
,
IO_VALUE
.
HIGH
);
return
CodeManager
.
ScanCode
();
})
);
}
public
bool
HasRightCode
(
CodeInfo
[]
codeInfos
,
ReelParam
reelParam
)
{
return
l
;
}));
string
rightcode
=
""
;
string
[]
code
=
new
string
[
7
];
foreach
(
var
cc
in
codeInfos
)
{
if
(
cc
.
CodeStr
.
IndexOf
(
'|'
)
>
0
)
{
var
cs
=
cc
.
CodeStr
.
Split
(
'|'
);
if
(
cs
.
Length
>=
7
)
{
rightcode
=
cc
.
CodeStr
;
break
;
}
}
//PN[5:0:-1]|BATCH[2:0:-1]|LOT|QTY[2:0:3]|RI|SP[3:0:-1]|EXPDATEdd-MM-yyyy[2:0:-1]|xxx|xxx|xxx|MSL[1:0:-1]
if
(
cc
.
CodeStr
.
StartsWith
(
"P"
))
//pn
code
[
0
]
=
cc
.
CodeStr
;
else
if
(
cc
.
CodeStr
.
StartsWith
(
"21P"
))
//batch
code
[
1
]
=
cc
.
CodeStr
;
else
if
(
cc
.
CodeStr
.
StartsWith
(
"1P"
))
//lot
code
[
2
]
=
cc
.
CodeStr
;
else
if
(
cc
.
CodeStr
.
StartsWith
(
"1T"
))
//lot
code
[
3
]
=
cc
.
CodeStr
;
else
if
(
cc
.
CodeStr
.
StartsWith
(
"2D"
))
//qty
code
[
4
]
=
cc
.
CodeStr
;
else
if
(
cc
.
CodeStr
.
StartsWith
(
"S"
))
// if (Regex.IsMatch(cc.CodeStr, @"S[A-Za-z\-]*\d+")) //ri
code
[
5
]
=
cc
.
CodeStr
;
}
catch
(
Exception
ex
)
if
(
string
.
IsNullOrEmpty
(
rightcode
)
)
{
LogUtil
.
error
(
"FI_13_ScanCode扫码出错:"
,
ex
);
if
(
string
.
IsNullOrEmpty
(
code
[
0
]))
return
false
;
if
(
string
.
IsNullOrEmpty
(
code
[
3
]))
return
false
;
if
(
string
.
IsNullOrEmpty
(
code
[
4
]))
return
false
;
if
(
string
.
IsNullOrEmpty
(
code
[
5
]))
return
false
;
for
(
int
i
=
0
;
i
<
code
.
Length
;
i
++)
{
if
(
string
.
IsNullOrEmpty
(
code
[
i
]))
code
[
i
]
=
"XXX"
;
}
rightcode
=
string
.
Join
(
"|"
,
code
);
}
}
public
bool
HasRightCode
(
CodeInfo
[]
codeInfos
,
ReelParam
reelParam
)
{
foreach
(
var
c
in
codeInfos
)
{
if
(
c
.
CodeStr
.
IndexOf
(
"|"
)
>
0
)
{
var
cs
=
c
.
CodeStr
.
Split
(
'|'
);
if
(
cs
.
Length
==
7
)
{
reelParam
.
PN
=
cs
[
0
].
Substring
(
1
);
reelParam
.
LOT
=
cs
[
3
].
Substring
(
1
);
reelParam
.
EXP
=
cs
[
4
].
Substring
(
1
);
reelParam
.
SN
=
cs
[
5
].
Substring
(
1
);
reelParam
.
WareCode
=
c
.
CodeStr
;
reelParam
.
ReeID
=
reelParam
.
SN
;
reelParam
.
RFID
=
reelParam
.
SN
;
return
true
;
}
if
(!
string
.
IsNullOrEmpty
(
rightcode
))
{
var
cs
=
rightcode
.
Split
(
'|'
);
if
(
cs
.
Length
>=
7
)
{
reelParam
.
PN
=
cs
[
0
].
Substring
(
1
);
reelParam
.
LOT
=
cs
[
3
].
Substring
(
1
);
reelParam
.
EXP
=
cs
[
4
].
Substring
(
1
);
reelParam
.
SN
=
cs
[
5
].
Substring
(
1
);
reelParam
.
WareCode
=
rightcode
;
reelParam
.
ReeID
=
reelParam
.
SN
;
reelParam
.
RFID
=
reelParam
.
SN
.
Substring
(
1
);
return
true
;
}
}
return
false
;
}
}
...
...
DeviceLibrary/theMachine/MainMachine_RFIDSelftest.cs
0 → 100644
查看文件 @
79e944f
using
CodeLibrary
;
using
OnlineStore
;
using
OnlineStore.Common
;
using
OnlineStore.LoadCSVLibrary
;
using
System
;
using
System.Collections.Generic
;
using
System.Drawing
;
using
System.Linq
;
using
System.Text
;
using
System.Text.RegularExpressions
;
using
System.Threading
;
using
System.Threading.Tasks
;
namespace
DeviceLibrary
{
partial
class
MainMachine
{
List
<
string
>
DemoTestList
;
int
DemoTestIndex
=
0
;
int
DemoTestCount
=
0
;
void
TFIDSelfTestProcess
()
{
if
(
CheckWait
(
StoreMoveInfo
))
return
;
//常规上料扫码流程
switch
(
StoreMoveInfo
.
MoveStep
)
{
case
MoveStep
.
Wait
:
break
;
case
MoveStep
.
StoreIn01
:
DemoTestList
=
CameraPointTest
.
GetThingStoreName
(
TestStorePointPort
.
上层左侧
);
if
(
DemoTestList
.
Count
==
0
)
return
;
DemoTestIndex
=
0
;
break
;
case
MoveStep
.
StoreOut10
:
if
(
IOValue
(
IO_Type
.
Out_Drawer
).
Equals
(
IO_VALUE
.
HIGH
)
&&
IOValue
(
IO_Type
.
Out_Drawer_Lock
).
Equals
(
IO_VALUE
.
HIGH
))
{
StoreMoveInfo
.
NextMoveStep
(
MoveStep
.
StoreOut11
);
}
else
if
(
IOValue
(
IO_Type
.
Out_Drawer
).
Equals
(
IO_VALUE
.
LOW
)
&&
IOValue
(
IO_Type
.
Out_Drawer_Lock
).
Equals
(
IO_VALUE
.
HIGH
))
{
IOMove
(
IO_Type
.
Out_Drawer_Lock
,
IO_VALUE
.
LOW
);
}
else
if
(
IOValue
(
IO_Type
.
Out_Drawer
).
Equals
(
IO_VALUE
.
LOW
))
{
Msg
.
add
(
"出库任务正在执行,请关好抽屉"
,
MsgLevel
.
warning
);
}
else
{
IOMove
(
IO_Type
.
Out_Drawer_Lock
,
IO_VALUE
.
HIGH
);
}
break
;
case
MoveStep
.
StoreOut11
:
StoreMoveInfo
.
NextMoveStep
(
MoveStep
.
StoreOut12
);
var
from
=
CSVPositionReader
<
ACStorePosition
>.
GetPositon
(
DemoTestList
[
DemoTestIndex
]);
var
to
=
CSVPositionReader
<
ACStorePosition
>.
GetPositon
(
RFIDP
);
boxTransport
.
Start
(
new
BoxStorePosition
(
Config
,
from
,
StoreMoveInfo
.
MoveParam
),
new
BoxStorePosition
(
Config
,
to
,
StoreMoveInfo
.
MoveParam
),
StoreMoveType
.
OutStore
,
true
);
StoreMoveInfo
.
log
(
$
"开始转运出库"
);
break
;
case
MoveStep
.
StoreOut12
:
if
(
boxTransport
.
IsComplateOrFree
)
{
bool
issame
=
false
;
string
ds
=
""
;
for
(
int
i
=
0
;
i
<
15
;
i
++)
{
if
(
RobotManage
.
RFID
.
ReadEPC
(
12
,
out
byte
[]
data
))
{
if
(
data
[
0
]
!=
0xFF
)
{
ds
=
Encoding
.
ASCII
.
GetString
(
data
).
Trim
();
if
(
StoreMoveInfo
.
MoveParam
.
WareCode
.
IndexOf
(
ds
)>-
1
)
{
StoreMoveInfo
.
MoveParam
.
RFID
=
ds
;
StoreMoveInfo
.
log
(
"读取到 RFID:"
+
ds
+
" , "
+
RobotManage
.
RFID
.
HexBuff
(
data
));
issame
=
true
;
break
;
}
}
}
Thread
.
Sleep
(
200
);
}
if
(!
issame
)
{
//StoreMoveInfo.log("读取到 RFID:" + ds);
//Msg.add("读取到的RFID与物料信息不符:" + ds, MsgLevel.alarm);
//RobotManage.UserPause("读取到的RFID与物料信息不符");
}
StoreMoveInfo
.
NextMoveStep
(
MoveStep
.
StoreOut13
);
from
=
CSVPositionReader
<
ACStorePosition
>.
GetPositon
(
RFIDP
);
to
=
CSVPositionReader
<
ACStorePosition
>.
GetPositon
(
DemoTestList
[
DemoTestIndex
]);
StoreMoveInfo
.
MoveParam
.
ReelOnFixture
=
true
;
boxTransport
.
Start
(
new
BoxStorePosition
(
Config
,
from
,
StoreMoveInfo
.
MoveParam
),
new
BoxStorePosition
(
Config
,
to
,
StoreMoveInfo
.
MoveParam
),
StoreMoveType
.
OutStore
,
true
);
StoreMoveInfo
.
log
(
$
"开始转运出库"
);
}
break
;
case
MoveStep
.
StoreOut13
:
if
(
boxTransport
.
IsComplateOrFree
)
{
StoreMoveInfo
.
NextMoveStep
(
MoveStep
.
StoreOut11
);
DemoTestIndex
++;
if
(
DemoTestIndex
>=
DemoTestList
.
Count
)
DemoTestIndex
=
0
;
DemoTestCount
++;
}
break
;
default
:
StoreMoveInfo
.
log
(
$
"未找到对应步骤:{StoreMoveInfo.MoveStep}"
);
break
;
}
}
}
}
\ No newline at end of file
DeviceLibrary/theMachine/MainMachine_StoreDemo.cs
查看文件 @
79e944f
...
...
@@ -61,30 +61,30 @@ namespace DeviceLibrary
return
;
if
(
IOValue
(
IO_Type
.
Taking_Clamp
).
Equals
(
IO_VALUE
.
LOW
))
{
if
(
Setting_Init
.
Runtime_Step
==
Runtime_StepE
.
LabelProcess
)
{
if
(
Setting_Init
.
Runtime_Step
==
Runtime_StepE
.
LabelProcess
)
{
StoreMoveInfo
.
log
(
"检测到上次正在贴标:"
+
Setting_Init
.
Runtime_Step
+
","
+
Setting_Init
.
Runtime_Posid
);
LabelingMoveInfo
.
Ne
xtMoveStep
(
MoveStep
.
Labeling01
);
LabelingMoveInfo
.
Ne
wMove
(
MoveStep
.
Labeling01
);
StoreMoveInfo
.
NextMoveStep
(
MoveStep
.
StoreIn03
);
}
else
if
(
Setting_Init
.
Runtime_Step
==
Runtime_StepE
.
LabelPasteFinish
)
}
else
if
(
Setting_Init
.
Runtime_Step
==
Runtime_StepE
.
LabelPasteFinish
)
{
StoreMoveInfo
.
log
(
"检测到上次已完成贴标:"
+
Setting_Init
.
Runtime_Step
+
","
+
Setting_Init
.
Runtime_Posid
+
","
+
Setting_Init
.
Runtime_RFID
);
StoreMoveInfo
.
Ne
xtMoveStep
(
MoveStep
.
StoreIn03
);
StoreMoveInfo
.
Ne
wMove
(
MoveStep
.
StoreIn03
);
StoreMoveInfo
.
MoveParam
.
PosID
=
Setting_Init
.
Runtime_Posid
;
StoreMoveInfo
.
MoveParam
.
RFID
=
Setting_Init
.
Runtime_RFID
;
}
else
if
(
Setting_Init
.
Runtime_Step
>=
Runtime_StepE
.
Printed
&&
Setting_Init
.
Runtime_Step
<
Runtime_StepE
.
LabelPasteFinish
)
else
if
(
Setting_Init
.
Runtime_Step
>=
Runtime_StepE
.
Printed
&&
Setting_Init
.
Runtime_Step
<
Runtime_StepE
.
LabelPasteFinish
)
{
StoreMoveInfo
.
log
(
"检测到上次正在贴标:"
+
Setting_Init
.
Runtime_Step
+
","
+
Setting_Init
.
Runtime_Posid
);
//LabelingMoveInfo.NextMoveStep(MoveStep.Labeling01);
//StoreMoveInfo.NextMoveStep(MoveStep.StoreIn03);
Msg
.
add
(
"重置前物料正在贴标,无法继续,请手动处理"
,
MsgLevel
.
warning
,
ErrInfo
.
LabelInPaste
);
RobotManage
.
UserPause
(
"重置前物料正在贴标,无法继续,请手动处理"
);
}
else
if
(
OutStoreJobList
.
Dequeue
(
out
JobInfo
jobInfo
))
{
IOMove
(
IO_Type
.
Out_Drawer_Lock
,
IO_VALUE
.
HIGH
);
StoreMoveInfo
.
NewMove
(
MoveStep
.
StoreOut10
);
StoreMoveInfo
.
MoveParam
.
PosID
=
jobInfo
.
PosId
;
StoreMoveInfo
.
MoveParam
.
WareCode
=
jobInfo
.
WareNum
;
...
...
@@ -93,9 +93,9 @@ namespace DeviceLibrary
StoreMoveInfo
.
log
(
$
"开始出库任务:"
+
jobInfo
.
ToStr
());
ServerCM
.
storeStatus
=
StoreStatus
.
OutStoreExecute
;
}
if
(
IOValue
(
IO_Type
.
Entry_Drawer_Lock
).
Equals
(
IO_VALUE
.
HIGH
)
&&
IOValue
(
IO_Type
.
Entry_Drawer
).
Equals
(
IO_VALUE
.
HIGH
))
else
if
(
IOValue
(
IO_Type
.
Entry_Drawer_Lock
).
Equals
(
IO_VALUE
.
HIGH
)
&&
IOValue
(
IO_Type
.
Entry_Drawer
).
Equals
(
IO_VALUE
.
HIGH
))
{
StoreMoveInfo
.
Ne
xtMoveStep
(
MoveStep
.
StoreIn01
);
StoreMoveInfo
.
Ne
wMove
(
MoveStep
.
StoreIn01
);
StoreMoveInfo
.
log
(
$
"检测到入库抽屉已锁定"
);
}
Setting_Init
.
Runtime_Step
=
Runtime_StepE
.
None
;
...
...
@@ -116,28 +116,32 @@ namespace DeviceLibrary
StoreMoveInfo
.
log
(
"检测到上次正在准备去库位:"
+
Setting_Init
.
Runtime_Posid
);
StoreMoveInfo
.
NextMoveStep
(
MoveStep
.
StoreIn04
);
StoreMoveInfo
.
MoveParam
.
PosID
=
Setting_Init
.
Runtime_Posid
;
StoreMoveInfo
.
MoveParam
.
RFID
=
Setting_Init
.
Runtime_RFID
;
StoreMoveInfo
.
MoveParam
.
ReelOnFixture
=
true
;
}
else
if
(
Setting_Init
.
Runtime_Step
==
Runtime_StepE
.
Out
)
{
StoreMoveInfo
.
log
(
"检测到上次正在出库:"
+
Setting_Init
.
Runtime_Posid
);
StoreMoveInfo
.
NextMoveStep
(
MoveStep
.
StoreOut11
);
{
var
olist
=
CameraPointTest
.
GetThingStoreName
(
TestStorePointPort
.
出口
);
StoreMoveInfo
.
log
(
$
"检测到出库口有料库位:{string.Join("
,
", olist)}"
);
olist
=
RobotManage
.
AllPositionMapNumList
.
ToList
().
Where
(
p
=>
{
return
p
.
StartsWith
(
"U"
)
&&
!
olist
.
Contains
(
p
);
}).
ToList
();
if
(
olist
.
Count
==
0
)
{
StoreMoveInfo
.
NextMoveStep
(
MoveStep
.
Wait
);
StoreMoveInfo
.
log
(
$
"没有检测到出库未有空位"
);
return
;
}
else
{
StoreMoveInfo
.
MoveParam
.
PosID
=
olist
[
0
];
StoreMoveInfo
.
log
(
$
"检测到出库位有料:{StoreMoveInfo.MoveParam.PosID}, 其他有料出库位:{string.Join("
,
", olist)}"
);
}
}
StoreMoveInfo
.
log
(
"检测到上次正在出库:"
+
Setting_Init
.
Runtime_Posid
+
","
+
Setting_Init
.
Runtime_WareCode
);
StoreMoveInfo
.
NextMoveStep
(
MoveStep
.
StoreOut10_1
);
StoreMoveInfo
.
MoveParam
.
ReelOnFixture
=
true
;
StoreMoveInfo
.
MoveParam
.
PosID
=
Setting_Init
.
Runtime_Posid
;
StoreMoveInfo
.
MoveParam
.
WareCode
=
Setting_Init
.
Runtime_WareCode
;
//{
// var olist = CameraPointTest.GetThingStoreName(TestStorePointPort.出口);
// StoreMoveInfo.log($"检测到出库口有料库位:{string.Join(",", olist)}");
// olist = RobotManage.AllPositionMapNumList.ToList().Where(p => { return p.StartsWith("U") && !olist.Contains(p); }).ToList();
// if (olist.Count == 0)
// {
// StoreMoveInfo.NextMoveStep(MoveStep.Wait);
// StoreMoveInfo.log($"没有检测到出库未有空位");
// return;
// }
// else
// {
// StoreMoveInfo.MoveParam.OutPosID = olist[0];
// StoreMoveInfo.log($"检测到出库位有料:{StoreMoveInfo.MoveParam.OutPosID}, 其他有料出库位:{string.Join(",", olist)}");
// }
//}
}
...
...
@@ -177,7 +181,7 @@ namespace DeviceLibrary
if
(
LabelingMoveInfo
.
MoveStep
==
MoveStep
.
Wait
)
{
StoreMoveInfo
.
NextMoveStep
(
MoveStep
.
StoreIn03
);
LabelingMoveInfo
.
Ne
xtMoveStep
(
MoveStep
.
Labeling01
);
LabelingMoveInfo
.
Ne
wMove
(
MoveStep
.
Labeling01
);
StoreMoveInfo
.
log
(
$
"等待贴标完成"
);
}
else
...
...
@@ -219,7 +223,7 @@ namespace DeviceLibrary
if
(
StoreMoveInfo
.
MoveParam
.
IsNg
)
{
StoreMoveInfo
.
NextMoveStep
(
MoveStep
.
StoreIn0
8
);
StoreMoveInfo
.
NextMoveStep
(
MoveStep
.
StoreIn0
6
);
StoreMoveInfo
.
log
(
$
"收到完成贴标NG"
);
}
else
...
...
@@ -254,8 +258,8 @@ namespace DeviceLibrary
{
if
(
StoreMoveInfo
.
MoveParam
.
RFID
.
Length
>
12
)
StoreMoveInfo
.
MoveParam
.
RFID
=
StoreMoveInfo
.
MoveParam
.
RFID
.
Substring
(
0
,
12
);
for
(
int
i
=
0
;
i
<
5
;
i
++)
bool
writeok
=
false
;
for
(
int
i
=
0
;
i
<
1
5
;
i
++)
{
RobotManage
.
RFID
.
WriteEPC
(
Encoding
.
ASCII
.
GetBytes
(
StoreMoveInfo
.
MoveParam
.
RFID
));
Thread
.
Sleep
(
500
);
...
...
@@ -267,14 +271,25 @@ namespace DeviceLibrary
if
(
ds
==
StoreMoveInfo
.
MoveParam
.
RFID
)
{
StoreMoveInfo
.
log
(
"RFID 写入成功:"
+
ds
);
writeok
=
true
;
break
;
}
else
{
StoreMoveInfo
.
log
(
"
读取到
RFID:"
+
ds
);
StoreMoveInfo
.
log
(
"
失败的
RFID:"
+
ds
);
}
}
}
Thread
.
Sleep
(
200
);
}
if
(!
writeok
)
{
StoreMoveInfo
.
NextMoveStep
(
MoveStep
.
StoreIn06
);
StoreMoveInfo
.
MoveParam
.
ReelOnFixture
=
true
;
StoreMoveInfo
.
log
(
$
"RFID 写入失败 NG"
);
ServerCM
.
cancelPutInTask
(
""
,
StoreMoveInfo
.
MoveParam
.
WareCode
);
Msg
.
add
(
"RFID 写入失败"
,
MsgLevel
.
alarm
);
RobotManage
.
UserPause
(
"RFID 写入失败"
);
return
;
}
StoreMoveInfo
.
NextMoveStep
(
MoveStep
.
StoreIn09
);
...
...
@@ -286,6 +301,15 @@ namespace DeviceLibrary
StoreMoveInfo
.
log
(
$
"开始转运到入库位置"
);
}
break
;
case
MoveStep
.
StoreIn06
:
StoreMoveInfo
.
NextMoveStep
(
MoveStep
.
StoreIn07
);
Z_Axis
.
AbsMove
(
StoreMoveInfo
,
Config
.
Z_Axis_P1
,
Config
.
Z_Axis_P1_speed
);
break
;
case
MoveStep
.
StoreIn07
:
StoreMoveInfo
.
NextMoveStep
(
MoveStep
.
StoreIn08
);
//X_Axis.AbsMove(ResetMoveInfo, Config.X_Axis_P1, Config.X_Axis_P1_speed);
Y_Axis
.
AbsMove
(
ResetMoveInfo
,
Config
.
Y_Axis_P1
,
Config
.
Y_Axis_P1_speed
);
break
;
case
MoveStep
.
StoreIn08
:
if
(
boxTransport
.
IsComplateOrFree
)
{
...
...
@@ -324,23 +348,27 @@ namespace DeviceLibrary
}
break
;
case
MoveStep
.
StoreOut10
:
if
(
string
.
IsNullOrEmpty
(
StoreMoveInfo
.
MoveParam
.
PosID
))
if
(
IOValue
(
IO_Type
.
Out_Drawer
).
Equals
(
IO_VALUE
.
HIGH
)
&&
IOValue
(
IO_Type
.
Out_Drawer_Lock
).
Equals
(
IO_VALUE
.
HIGH
))
{
OutStoreJobList
.
ClearLastPosid
();
slist
=
CameraPointTest
.
GetThingStoreName
(
TestStorePointPort
.
下层右侧
);
if
(
slist
.
Count
==
0
)
{
StoreMoveInfo
.
NextMoveStep
(
MoveStep
.
Wait
);
StoreMoveInfo
.
log
(
$
"没有检测到库内有料"
);
return
;
}
else
{
inposid
=
slist
[
0
];
StoreMoveInfo
.
log
(
$
"检测到库位有料:{inposid}, 其他有料库位:{string.Join("
,
", slist)}"
);
}
StoreMoveInfo
.
NextMoveStep
(
MoveStep
.
StoreOut10_1
);
}
else
if
(
IOValue
(
IO_Type
.
Out_Drawer
).
Equals
(
IO_VALUE
.
LOW
)
&&
IOValue
(
IO_Type
.
Out_Drawer_Lock
).
Equals
(
IO_VALUE
.
HIGH
))
{
IOMove
(
IO_Type
.
Out_Drawer_Lock
,
IO_VALUE
.
LOW
);
}
else
if
(
IOValue
(
IO_Type
.
Out_Drawer
).
Equals
(
IO_VALUE
.
LOW
))
{
Msg
.
add
(
"出库任务正在执行,请关好抽屉"
,
MsgLevel
.
warning
);
}
else
{
IOMove
(
IO_Type
.
Out_Drawer_Lock
,
IO_VALUE
.
HIGH
);
}
break
;
case
MoveStep
.
StoreOut10_1
:
inposid
=
StoreMoveInfo
.
MoveParam
.
PosID
;
Setting_Init
.
Runtime_Posid
=
inposid
;
Setting_Init
.
Runtime_WareCode
=
StoreMoveInfo
.
MoveParam
.
WareCode
;
{
var
outposid
=
""
;
var
olist
=
CameraPointTest
.
GetThingStoreName
(
TestStorePointPort
.
出口
);
...
...
@@ -348,7 +376,8 @@ namespace DeviceLibrary
olist
=
RobotManage
.
AllPositionMapNumList
.
ToList
().
Where
(
p
=>
{
return
p
.
StartsWith
(
"U"
)
&&
!
olist
.
Contains
(
p
);
}).
ToList
();
if
(
olist
.
Count
==
0
)
{
StoreMoveInfo
.
NextMoveStep
(
MoveStep
.
Wait
);
OutStoreJobList
.
ClearLastPosid
();
StoreMoveInfo
.
NextMoveStep
(
MoveStep
.
StoreOut13
);
StoreMoveInfo
.
log
(
$
"没有检测到出库未有空位"
);
return
;
}
...
...
@@ -363,7 +392,7 @@ namespace DeviceLibrary
to
=
CSVPositionReader
<
ACStorePosition
>.
GetPositon
(
RFIDP
);
StoreMoveInfo
.
MoveParam
.
OutPosID
=
outposid
;
//StoreMoveInfo.MoveParam.ReelOnFixture = false;
boxTransport
.
Start
(
new
BoxStorePosition
(
Config
,
from
,
StoreMoveInfo
.
MoveParam
),
new
BoxStorePosition
(
Config
,
to
,
StoreMoveInfo
.
MoveParam
),
StoreMoveType
.
In
Store
,
true
);
boxTransport
.
Start
(
new
BoxStorePosition
(
Config
,
from
,
StoreMoveInfo
.
MoveParam
),
new
BoxStorePosition
(
Config
,
to
,
StoreMoveInfo
.
MoveParam
),
StoreMoveType
.
Out
Store
,
true
);
StoreMoveInfo
.
log
(
$
"开始转运出库"
);
ServerCM
.
SendStoreState
(
StoreMoveInfo
.
MoveParam
.
PosID
,
StoreStatus
.
OutStoreExecute
);
}
...
...
@@ -372,35 +401,40 @@ namespace DeviceLibrary
if
(
boxTransport
.
IsComplateOrFree
)
{
ServerCM
.
SendStoreState
(
StoreMoveInfo
.
MoveParam
.
PosID
,
StoreStatus
.
OutStoreBoxEnd
);
for
(
int
i
=
0
;
i
<
5
;
i
++)
bool
issame
=
false
;
string
ds
=
""
;
for
(
int
i
=
0
;
i
<
15
;
i
++)
{
if
(
RobotManage
.
RFID
.
ReadEPC
(
12
,
out
byte
[]
data
))
{
if
(
data
[
0
]
!=
0xFF
)
{
var
ds
=
Encoding
.
ASCII
.
GetString
(
data
).
Trim
();
ds
=
Encoding
.
ASCII
.
GetString
(
data
).
Trim
();
if
(
StoreMoveInfo
.
MoveParam
.
WareCode
.
IndexOf
(
ds
)>-
1
)
{
StoreMoveInfo
.
MoveParam
.
RFID
=
ds
;
StoreMoveInfo
.
log
(
"读取到 RFID:"
+
ds
);
StoreMoveInfo
.
log
(
"读取到 RFID:"
+
ds
+
" , "
+
RobotManage
.
RFID
.
HexBuff
(
data
));
issame
=
true
;
break
;
}
else
{
StoreMoveInfo
.
log
(
"读取到 RFID:"
+
ds
);
Msg
.
add
(
"读取到的RFID与物料信息不符:"
+
ds
,
MsgLevel
.
alarm
);
RobotManage
.
UserPause
(
"读取到的RFID与物料信息不符"
);
}
}
}
Thread
.
Sleep
(
200
);
}
if
(!
issame
)
{
StoreMoveInfo
.
log
(
"读取到 RFID:"
+
ds
);
Msg
.
add
(
"读取到的RFID与物料信息不符:"
+
ds
,
MsgLevel
.
alarm
);
RobotManage
.
UserPause
(
"读取到的RFID与物料信息不符"
);
}
StoreMoveInfo
.
NextMoveStep
(
MoveStep
.
StoreOut12
);
from
=
CSVPositionReader
<
ACStorePosition
>.
GetPositon
(
RFIDP
);
to
=
CSVPositionReader
<
ACStorePosition
>.
GetPositon
(
StoreMoveInfo
.
MoveParam
.
OutPosID
);
StoreMoveInfo
.
MoveParam
.
ReelOnFixture
=
true
;
boxTransport
.
Start
(
new
BoxStorePosition
(
Config
,
from
,
StoreMoveInfo
.
MoveParam
),
new
BoxStorePosition
(
Config
,
to
,
StoreMoveInfo
.
MoveParam
),
StoreMoveType
.
In
Store
,
true
);
boxTransport
.
Start
(
new
BoxStorePosition
(
Config
,
from
,
StoreMoveInfo
.
MoveParam
),
new
BoxStorePosition
(
Config
,
to
,
StoreMoveInfo
.
MoveParam
),
StoreMoveType
.
Out
Store
,
true
);
StoreMoveInfo
.
log
(
$
"开始转运出库"
);
}
break
;
...
...
@@ -411,9 +445,15 @@ namespace DeviceLibrary
StoreMoveInfo
.
log
(
"出库完成"
);
StoreMoveInfo
.
NextMoveStep
(
MoveStep
.
Wait
);
OutStoreJobList
.
ClearLastPosid
();
var
olist
=
CameraPointTest
.
GetThingStoreName
(
TestStorePointPort
.
出口
);
StoreMoveInfo
.
log
(
$
"检测到出库口有料库位:{string.Join("
,
", olist)}"
);
olist
=
RobotManage
.
AllPositionMapNumList
.
ToList
().
Where
(
p
=>
{
return
p
.
StartsWith
(
"U"
)
&&
!
olist
.
Contains
(
p
);
}).
ToList
();
if
(
olist
.
Count
==
0
)
{
StoreMoveInfo
.
NextMoveStep
(
MoveStep
.
StoreOut13
);
StoreMoveInfo
.
log
(
$
"出库库位已用完"
);
}
if
(
OutStoreJobList
.
Count
==
0
)
//slist = CameraPointTest.GetThingStoreName(TestStorePointPort.下层右侧);
//if (slist.Count == 0)
{
StoreMoveInfo
.
NextMoveStep
(
MoveStep
.
StoreOut13
);
StoreMoveInfo
.
log
(
$
"没有出库任务了"
);
...
...
@@ -457,8 +497,9 @@ namespace DeviceLibrary
StoreMoveInfo
.
EndMove
();
}
else
{
StoreMoveInfo
.
NextMoveStep
(
MoveStep
.
StoreIn05
);
{
StoreMoveInfo
.
NextMoveStep
(
MoveStep
.
StoreOut15
);
IOMove
(
IO_Type
.
Out_Drawer_Lock
,
IO_VALUE
.
LOW
);
}
break
;
default
:
...
...
DeviceLibrary/theMachine/MoveStep.cs
查看文件 @
79e944f
...
...
@@ -61,6 +61,7 @@ namespace DeviceLibrary
StoreIn08
,
StoreIn09
,
StoreOut10
,
//出库
StoreOut10_1
,
StoreOut_NGPre
,
StoreOut11
,
StoreOut12
,
...
...
@@ -114,6 +115,7 @@ namespace DeviceLibrary
Labeling02
,
Labeling03
,
Labeling04
,
Labeling04a
,
Labeling05
,
Labeling06
,
Labeling07
,
...
...
TheMachine/Form1.Designer.cs
查看文件 @
79e944f
...
...
@@ -44,6 +44,8 @@ namespace TheMachine
this
.
tabc
=
new
System
.
Windows
.
Forms
.
TabControl
();
this
.
tabP1
=
new
System
.
Windows
.
Forms
.
TabPage
();
this
.
pnl
=
new
System
.
Windows
.
Forms
.
Panel
();
this
.
btn_rightsafedoorunlock
=
new
System
.
Windows
.
Forms
.
Button
();
this
.
btn_leftsafedoorunlock
=
new
System
.
Windows
.
Forms
.
Button
();
this
.
button3
=
new
System
.
Windows
.
Forms
.
Button
();
this
.
button4
=
new
System
.
Windows
.
Forms
.
Button
();
this
.
button1
=
new
System
.
Windows
.
Forms
.
Button
();
...
...
@@ -52,7 +54,6 @@ namespace TheMachine
this
.
stateView
=
new
System
.
Windows
.
Forms
.
ListView
();
this
.
cb_IgnoreSafecheck
=
new
System
.
Windows
.
Forms
.
CheckBox
();
this
.
pictureBox2
=
new
System
.
Windows
.
Forms
.
PictureBox
();
this
.
cb_IgnoreGratingSignal
=
new
System
.
Windows
.
Forms
.
CheckBox
();
this
.
pictureBox1
=
new
System
.
Windows
.
Forms
.
PictureBox
();
this
.
cb_EnableBuzzer
=
new
System
.
Windows
.
Forms
.
CheckBox
();
this
.
btn_IgnoreX09
=
new
System
.
Windows
.
Forms
.
Button
();
...
...
@@ -60,6 +61,7 @@ namespace TheMachine
this
.
listView1
=
new
System
.
Windows
.
Forms
.
ListView
();
this
.
btn_stop
=
new
System
.
Windows
.
Forms
.
Button
();
this
.
btn_run
=
new
System
.
Windows
.
Forms
.
Button
();
this
.
btn_printsafedoorunlock
=
new
System
.
Windows
.
Forms
.
Button
();
this
.
menuStrip1
.
SuspendLayout
();
this
.
tabc
.
SuspendLayout
();
this
.
tabP1
.
SuspendLayout
();
...
...
@@ -197,6 +199,9 @@ namespace TheMachine
//
// pnl
//
this
.
pnl
.
Controls
.
Add
(
this
.
btn_printsafedoorunlock
);
this
.
pnl
.
Controls
.
Add
(
this
.
btn_rightsafedoorunlock
);
this
.
pnl
.
Controls
.
Add
(
this
.
btn_leftsafedoorunlock
);
this
.
pnl
.
Controls
.
Add
(
this
.
button3
);
this
.
pnl
.
Controls
.
Add
(
this
.
button4
);
this
.
pnl
.
Controls
.
Add
(
this
.
button1
);
...
...
@@ -204,7 +209,6 @@ namespace TheMachine
this
.
pnl
.
Controls
.
Add
(
this
.
groupBox1
);
this
.
pnl
.
Controls
.
Add
(
this
.
cb_IgnoreSafecheck
);
this
.
pnl
.
Controls
.
Add
(
this
.
pictureBox2
);
this
.
pnl
.
Controls
.
Add
(
this
.
cb_IgnoreGratingSignal
);
this
.
pnl
.
Controls
.
Add
(
this
.
pictureBox1
);
this
.
pnl
.
Controls
.
Add
(
this
.
cb_EnableBuzzer
);
this
.
pnl
.
Controls
.
Add
(
this
.
btn_IgnoreX09
);
...
...
@@ -215,6 +219,30 @@ namespace TheMachine
this
.
pnl
.
Size
=
new
System
.
Drawing
.
Size
(
1000
,
576
);
this
.
pnl
.
TabIndex
=
273
;
//
// btn_rightsafedoorunlock
//
this
.
btn_rightsafedoorunlock
.
BackColor
=
System
.
Drawing
.
Color
.
White
;
this
.
btn_rightsafedoorunlock
.
FlatStyle
=
System
.
Windows
.
Forms
.
FlatStyle
.
Flat
;
this
.
btn_rightsafedoorunlock
.
Location
=
new
System
.
Drawing
.
Point
(
808
,
332
);
this
.
btn_rightsafedoorunlock
.
Name
=
"btn_rightsafedoorunlock"
;
this
.
btn_rightsafedoorunlock
.
Size
=
new
System
.
Drawing
.
Size
(
139
,
56
);
this
.
btn_rightsafedoorunlock
.
TabIndex
=
275
;
this
.
btn_rightsafedoorunlock
.
Text
=
"右侧防护门解锁"
;
this
.
btn_rightsafedoorunlock
.
UseVisualStyleBackColor
=
false
;
this
.
btn_rightsafedoorunlock
.
Click
+=
new
System
.
EventHandler
(
this
.
button2_Click_1
);
//
// btn_leftsafedoorunlock
//
this
.
btn_leftsafedoorunlock
.
BackColor
=
System
.
Drawing
.
Color
.
White
;
this
.
btn_leftsafedoorunlock
.
FlatStyle
=
System
.
Windows
.
Forms
.
FlatStyle
.
Flat
;
this
.
btn_leftsafedoorunlock
.
Location
=
new
System
.
Drawing
.
Point
(
808
,
271
);
this
.
btn_leftsafedoorunlock
.
Name
=
"btn_leftsafedoorunlock"
;
this
.
btn_leftsafedoorunlock
.
Size
=
new
System
.
Drawing
.
Size
(
139
,
55
);
this
.
btn_leftsafedoorunlock
.
TabIndex
=
276
;
this
.
btn_leftsafedoorunlock
.
Text
=
"左侧防护门解锁"
;
this
.
btn_leftsafedoorunlock
.
UseVisualStyleBackColor
=
false
;
this
.
btn_leftsafedoorunlock
.
Click
+=
new
System
.
EventHandler
(
this
.
button5_Click_1
);
//
// button3
//
this
.
button3
.
BackColor
=
System
.
Drawing
.
Color
.
White
;
...
...
@@ -312,18 +340,6 @@ namespace TheMachine
this
.
pictureBox2
.
DoubleClick
+=
new
System
.
EventHandler
(
this
.
pictureBox1_DoubleClick
);
this
.
pictureBox2
.
MouseDown
+=
new
System
.
Windows
.
Forms
.
MouseEventHandler
(
this
.
pictureBox1_MouseDown
);
//
// cb_IgnoreGratingSignal
//
this
.
cb_IgnoreGratingSignal
.
AutoSize
=
true
;
this
.
cb_IgnoreGratingSignal
.
Location
=
new
System
.
Drawing
.
Point
(
607
,
78
);
this
.
cb_IgnoreGratingSignal
.
Name
=
"cb_IgnoreGratingSignal"
;
this
.
cb_IgnoreGratingSignal
.
Size
=
new
System
.
Drawing
.
Size
(
125
,
25
);
this
.
cb_IgnoreGratingSignal
.
TabIndex
=
2
;
this
.
cb_IgnoreGratingSignal
.
Text
=
"忽略安全光栅"
;
this
.
cb_IgnoreGratingSignal
.
UseVisualStyleBackColor
=
true
;
this
.
cb_IgnoreGratingSignal
.
Visible
=
false
;
this
.
cb_IgnoreGratingSignal
.
CheckedChanged
+=
new
System
.
EventHandler
(
this
.
cb_IgnoreGratingSignal_CheckedChanged
);
//
// pictureBox1
//
this
.
pictureBox1
.
BackColor
=
System
.
Drawing
.
Color
.
Gainsboro
;
...
...
@@ -411,6 +427,18 @@ namespace TheMachine
this
.
btn_run
.
UseVisualStyleBackColor
=
true
;
this
.
btn_run
.
Click
+=
new
System
.
EventHandler
(
this
.
btn_run_Click
);
//
// btn_printsafedoorunlock
//
this
.
btn_printsafedoorunlock
.
BackColor
=
System
.
Drawing
.
Color
.
White
;
this
.
btn_printsafedoorunlock
.
FlatStyle
=
System
.
Windows
.
Forms
.
FlatStyle
.
Flat
;
this
.
btn_printsafedoorunlock
.
Location
=
new
System
.
Drawing
.
Point
(
808
,
394
);
this
.
btn_printsafedoorunlock
.
Name
=
"btn_printsafedoorunlock"
;
this
.
btn_printsafedoorunlock
.
Size
=
new
System
.
Drawing
.
Size
(
139
,
56
);
this
.
btn_printsafedoorunlock
.
TabIndex
=
277
;
this
.
btn_printsafedoorunlock
.
Text
=
"打印维护门解锁"
;
this
.
btn_printsafedoorunlock
.
UseVisualStyleBackColor
=
false
;
this
.
btn_printsafedoorunlock
.
Click
+=
new
System
.
EventHandler
(
this
.
button2_Click_2
);
//
// Form1
//
this
.
AutoScaleMode
=
System
.
Windows
.
Forms
.
AutoScaleMode
.
None
;
...
...
@@ -457,7 +485,6 @@ namespace TheMachine
private
System
.
Windows
.
Forms
.
ListView
stateView
;
private
System
.
Windows
.
Forms
.
GroupBox
groupBox1
;
private
System
.
Windows
.
Forms
.
CheckBox
cb_IgnoreSafecheck
;
private
System
.
Windows
.
Forms
.
CheckBox
cb_IgnoreGratingSignal
;
private
System
.
Windows
.
Forms
.
ToolStripMenuItem
二维码识别调试
ToolStripMenuItem
;
private
System
.
Windows
.
Forms
.
ToolStripSeparator
toolStripSeparator1
;
private
System
.
Windows
.
Forms
.
ToolStripMenuItem
关于
ToolStripMenuItem
;
...
...
@@ -475,6 +502,9 @@ namespace TheMachine
private
System
.
Windows
.
Forms
.
Button
btn_entrylock
;
private
System
.
Windows
.
Forms
.
Button
button3
;
private
System
.
Windows
.
Forms
.
Button
button4
;
private
System
.
Windows
.
Forms
.
Button
btn_rightsafedoorunlock
;
private
System
.
Windows
.
Forms
.
Button
btn_leftsafedoorunlock
;
private
System
.
Windows
.
Forms
.
Button
btn_printsafedoorunlock
;
}
}
TheMachine/Form1.cs
查看文件 @
79e944f
...
...
@@ -265,13 +265,13 @@ namespace TheMachine
//RobotManage.Config = (Robot_Config)CSVConfigReader.LoadConfig(RobotManage.Config);
addTablePage
();
RobotManage
.
LoadDebug
();
cb_IgnoreGratingSignal
.
Visible
=
true
;
//
cb_IgnoreGratingSignal.Visible = true;
cb_IgnoreSafecheck
.
Visible
=
true
;
}
else
{
cb_IgnoreGratingSignal
.
Checked
=
false
;
cb_IgnoreGratingSignal
.
Visible
=
false
;
//
cb_IgnoreGratingSignal.Checked = false;
//
cb_IgnoreGratingSignal.Visible = false;
cb_IgnoreSafecheck
.
Checked
=
false
;
cb_IgnoreSafecheck
.
Visible
=
false
;
var
tc
=
tabc
.
TabPages
.
Count
;
...
...
@@ -701,5 +701,23 @@ namespace TheMachine
{
IOManager
.
IOMove
(
IO_Type
.
Out_Drawer_Lock
,
IO_VALUE
.
LOW
);
}
private
void
button5_Click_1
(
object
sender
,
EventArgs
e
)
{
IOManager
.
IOMove
(
IO_Type
.
LeftDoor_Lock
,
IO_VALUE
.
LOW
);
RobotManage
.
mainMachine
.
LeftDoorOpen
=
true
;
}
private
void
button2_Click_1
(
object
sender
,
EventArgs
e
)
{
IOManager
.
IOMove
(
IO_Type
.
RightDoor_Lock
,
IO_VALUE
.
LOW
);
RobotManage
.
mainMachine
.
RightDoorOpen
=
true
;
}
private
void
button2_Click_2
(
object
sender
,
EventArgs
e
)
{
IOManager
.
IOMove
(
IO_Type
.
PrinterDoor_Lock
,
IO_VALUE
.
LOW
);
RobotManage
.
mainMachine
.
PrintDoorOpen
=
true
;
}
}
}
\ No newline at end of file
TheMachine/Program.cs
查看文件 @
79e944f
...
...
@@ -25,11 +25,12 @@ namespace TheMachine
static
void
Main
()
{
CameraPointTest
.
Init
();
//CameraPointTest.ScanRectangle();
//var bmpfile = @"D:\rick\vs\SO20031_TinStorage\
料架照片\106_监控点1_106_20221125194616_31932401
.bmp";
//var bmpfile = @"D:\rick\vs\SO20031_TinStorage\
TheMachine\bin\Debug\test
.bmp";
//var bmp = new Bitmap(bmpfile);
//var r = C
ommon.CalcStoreBMP(bmp,4, 5
);
//var l= Common.TestStorePoint(bmp, r);
//var r = C
ameraPointTest.TestStorePoint(bmp, TestStorePointPort.入口
);
_
=
new
Mutex
(
true
,
Application
.
ProductName
,
out
bool
ret
);
if
(!
ret
)
{
...
...
TheMachine/SettingControl.cs
查看文件 @
79e944f
...
...
@@ -137,7 +137,9 @@ namespace TheMachine
private
void
btn_labeledit_Click
(
object
sender
,
EventArgs
e
)
{
RobotManage
.
printerHelper
.
EditLabel
();
PrintLabel
.
FrmLabel
frmLabel
=
new
PrintLabel
.
FrmLabel
();
crc
.
LanguageProcess
(
frmLabel
,
"FrmLabel"
);
frmLabel
.
ShowDialog
();
loadlabellist
();
}
void
loadlabellist
()
...
...
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论