Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
刘韬
/
SO1007_XLC_Store
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
作业
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit a1958cc1
由
刘韬
编写于
2021-12-14 16:48:10 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
1
1 个父辈
e617e614
全部展开
隐藏空白字符变更
内嵌
并排
正在显示
20 个修改的文件
包含
499 行增加
和
427 行删除
DeviceLibrary/DeviceLibrary.csproj
DeviceLibrary/DeviceLibrary/CodeManager.cs
DeviceLibrary/DeviceLibrary/LineRunMonitor.cs
DeviceLibrary/DeviceLibrary/OKLEController.cs
DeviceLibrary/DeviceLibrary/ServerCommunication.cs
DeviceLibrary/theMachine/BoxTransport.cs
DeviceLibrary/theMachine/LabelParam.cs
DeviceLibrary/theMachine/MainMachine _AutoInOutTest.cs
DeviceLibrary/theMachine/MainMachine _IN.cs
DeviceLibrary/theMachine/MainMachine _IOMonitor.cs
DeviceLibrary/theMachine/MainMachine _LabelProcess.cs
DeviceLibrary/theMachine/MainMachine _LeftProcess.cs
DeviceLibrary/theMachine/MainMachine _MiddleProcess.cs
DeviceLibrary/theMachine/MainMachine _Out.cs
DeviceLibrary/theMachine/MainMachine _Printer.cs
DeviceLibrary/theMachine/MainMachine _Store.cs
DeviceLibrary/theMachine/MainMachine.cs
DeviceLibrary/theMachine/MoveStep.cs
TheMachine/UC/uc_boxdebug.Designer.cs
TheMachine/UC/uc_boxdebug.cs
DeviceLibrary/DeviceLibrary.csproj
查看文件 @
a1958cc
...
...
@@ -62,6 +62,7 @@
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Drawing" />
<Reference Include="System.Web" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
...
...
@@ -86,6 +87,7 @@
<Compile Include="theMachine\MainMachine _BtnProcess.cs" />
<Compile Include="theMachine\MainMachine _Common.cs" />
<Compile Include="theMachine\MainMachine _Out.cs" />
<Compile Include="theMachine\MainMachine _AutoInOutTest.cs" />
<Compile Include="theMachine\MainMachine _Store.cs" />
<Compile Include="theMachine\MainMachine _IN.cs" />
<Compile Include="theMachine\MainMachine _IOMonitor.cs" />
...
...
DeviceLibrary/DeviceLibrary/CodeManager.cs
查看文件 @
a1958cc
...
...
@@ -128,7 +128,7 @@ namespace DeviceLibrary
[
HandleProcessCorruptedStateExceptions
]
public
static
(
List
<
CodeInfo
>,
string
)
CameraScan
(
List
<
string
>
cameraNameList
)
public
static
List
<
CodeInfo
>
CameraScan
(
List
<
string
>
cameraNameList
)
{
List
<
CodeInfo
>
codeList
=
new
List
<
CodeInfo
>();
string
bitmapfilename
=
""
;
...
...
@@ -163,58 +163,26 @@ namespace DeviceLibrary
}
LogUtil
.
info
(
" 【"
+
cameraName
+
"】取图片完成,开始扫码"
);
string
r
=
""
;
//bmp.RotateFlip(RotateFlipType.Rotate270FlipNone);
//List<CodeInfo> tlci = EyemDecode2.Decoder(ref bmp);
//foreach (CodeInfo code in tlci)
//{
// LogUtil.info(" 【" + cameraName + "】[eyemDecode]" + code.CodeType + "(X: " + code.X + ",Y: " + code.Y + ") " + code.CodeStr);
// //string str = CodeManager.ReplaceCode(code.CodeStr);
// lock (codeList)
// {
// if (!codeList.Contains(code))
// {
// codeList.Add(code);
// r = r + "##" + code.CodeStr;
// }
// }
//}
RemoteDecodeHelper
.
RemoteDecodeParam
remoteDecodeParam
=
new
RemoteDecodeHelper
.
RemoteDecodeParam
{
codeTypeList
=
codeTypeList
.
ToArray
(),
codeCount
=
3
,
timeout
=
3000
};
List
<
CodeInfo
>
cc
=
new
List
<
CodeInfo
>();
foreach
(
string
codeType
in
codeTypeList
)
cc
=
RemoteDecodeHelper
.
DecodeRequest
(
ho_Image
,
remoteDecodeParam
);
if
(
cc
!=
null
)
{
//判断是否是一维码
if
(
codeType
.
ToLower
().
Equals
(
"barcode"
))
{
cc
=
HDCodeHelper
.
DecodeBarCode
(
ho_Image
);
}
else
{
cc
=
HDCodeHelper
.
DecodeCode
(
ho_Image
,
codeType
,
GetCodeParamFilePath
(
codeType
),
QRCodeCount
,
3000
);
cc
.
ForEach
((
x
)
=>
{
x
.
CodeType
=
codeType
;
});
}
LogUtil
.
info
(
" 【"
+
cameraName
+
"】[Halcon]"
+
codeType
+
","
+
QRCodeCount
+
","
+
cc
.
Count
);
foreach
(
CodeInfo
c
in
cc
)
{
LogUtil
.
info
(
" 【"
+
cameraName
+
"】[Halcon]"
+
c
.
CodeType
+
"(X: "
+
c
.
X
+
",Y: "
+
c
.
Y
+
") "
+
c
.
CodeStr
);
c
.
CodeStr
=
CodeManager
.
ReplaceCode
(
c
.
CodeStr
);
lock
(
codeList
)
{
if
(!
codeList
.
Contains
(
c
))
{
codeList
.
Add
(
c
);
r
=
r
+
"##"
+
c
.
CodeStr
;
}
}
}
}
codeList
.
AddRange
(
cc
);
//if (codeList.Count() == 0)
//{
bitmapfilename
=
SaveImageToFile
(
"mimo"
,
cameraName
,
bmp
);
// }
codeList
.
ForEach
((
c
)
=>
{
string
str
=
CodeManager
.
ReplaceCode
(
c
.
CodeStr
);
r
+=
"##"
+
str
;
});
}
else
{
bitmapfilename
=
SaveImageToFile
(
"mimo"
,
cameraName
,
bmp
);
}
LogUtil
.
info
(
" 【"
+
cameraName
+
"】"
+
" 扫码完成【"
+
FormUtil
.
GetSpanStr
(
DateTime
.
Now
-
startTime
)
+
"】 :"
+
r
);
}
catch
(
AccessViolationException
e
)
...
...
@@ -249,7 +217,7 @@ namespace DeviceLibrary
LogUtil
.
error
(
" 扫码出错:"
+
ex
.
ToString
());
//throw new Exception("扫码出错");
}
return
(
codeList
,
bitmapfilename
)
;
return
codeList
;
}
/// <summary>
///
...
...
DeviceLibrary/DeviceLibrary/LineRunMonitor.cs
查看文件 @
a1958cc
...
...
@@ -54,6 +54,33 @@ namespace DeviceLibrary
return
IOManager
.
GetDOValue
(
""
,
0x00
,
LineIO
);
}
DateTime
pauseTime
=
DateTime
.
MinValue
;
public
void
Pause
()
{
lineTimer
.
Enabled
=
false
;
pauseTime
=
DateTime
.
Now
;
DOMove
(
LineIO
,
IO_VALUE
.
LOW
);
LogUtil
.
info
(
Name
+
$
" 线体管理器 暂停线体."
);
}
public
void
Resume
()
{
if
(
pauseTime
!=
DateTime
.
MinValue
)
{
lock
(
linrunlist
)
{
if
(
linrunlist
.
Count
>
0
)
{
foreach
(
var
k
in
linrunlist
.
Keys
)
{
linrunlist
[
k
]
+=
DateTime
.
Now
-
pauseTime
;
}
DOMove
(
LineIO
,
IO_VALUE
.
HIGH
);
}
}
}
pauseTime
=
DateTime
.
MinValue
;
lineTimer
.
Enabled
=
true
;
LogUtil
.
info
(
Name
+
$
" 线体管理器 恢复运行线体."
);
}
/// <summary>
/// 控制线体运转
...
...
DeviceLibrary/DeviceLibrary/OKLEController.cs
查看文件 @
a1958cc
...
...
@@ -147,7 +147,6 @@ public class OKLEController
//01 03 00 00 00 02 C4 0B
byte
[]
sendData
=
new
byte
[
8
];
sendData
[
0
]
=
0x01
;
sendData
[
1
]
=
0x03
;
sendData
[
2
]
=
0x00
;
sendData
[
3
]
=
0x00
;
...
...
DeviceLibrary/DeviceLibrary/ServerCommunication.cs
查看文件 @
a1958cc
...
...
@@ -11,8 +11,8 @@ namespace DeviceLibrary
class
ServerCommunication
{
public
StoreStatus
storeStatus
=
StoreStatus
.
Debugging
;
static
string
server
=
Config
AppSettings
.
GetValue
(
ConfigHelper
.
Config
.
Get
(
"http_server"
)
);
static
string
CID
=
Config
AppSettings
.
GetValue
(
ConfigHelper
.
Config
.
Get
(
"CID"
)
);
static
string
server
=
Config
Helper
.
Config
.
Get
(
"http_server"
);
static
string
CID
=
Config
Helper
.
Config
.
Get
(
"CID"
);
int
StoreID
=
1
;
string
StoreName
;
...
...
@@ -257,7 +257,7 @@ namespace DeviceLibrary
return
;
}
//TODO:判断BOX是否处于可以入库状态,如果调试或急停中,需要返回给服务器;
if
(
RobotManage
.
mainMachine
.
IsInStoreReady
()
)
if
(
RobotManage
.
mainMachine
.
IsInStoreReady
)
{
WarnMsg
=
""
;
JobInfo
inStoreJob
=
new
JobInfo
(
message
,
posId
);
...
...
@@ -348,6 +348,65 @@ namespace DeviceLibrary
}
}
}
private
static
string
Addr_cancelPutInTask
=
"/service/store/cancelPutInTask"
;
public
string
cancelPutInTask
(
string
deviceName
,
string
barcode
)
{
string
msg
=
""
;
try
{
Dictionary
<
string
,
string
>
paramMap
=
new
Dictionary
<
string
,
string
>();
paramMap
.
Add
(
"barcode"
,
barcode
);
string
server
=
GetAddr
(
Addr_cancelPutInTask
,
paramMap
);
DateTime
startTime
=
DateTime
.
Now
;
string
resultStr
=
HttpHelper
.
Post
(
server
,
""
);
LogUtil
.
info
(
deviceName
+
"cancelPutInTask "
+
FormUtil
.
GetSpanStr
(
DateTime
.
Now
-
startTime
)
+
" 【"
+
server
+
"】【"
+
resultStr
+
"】"
);
ResultData
data
=
JsonHelper
.
DeserializeJsonToObject
<
ResultData
>(
resultStr
);
if
(
data
==
null
)
{
return
msg
=
deviceName
+
" cancelPutInTask【 "
+
barcode
+
"】 没有收到服务器反馈"
;
}
else
if
(
data
.
code
.
Equals
(
0
).
Equals
(
false
))
{
return
msg
=
deviceName
+
" cancelPutInTask【 "
+
barcode
+
"】 :"
+
data
.
msg
;
}
return
""
;
}
catch
(
Exception
ex
)
{
LogUtil
.
error
(
deviceName
+
" "
+
ex
.
ToString
());
}
return
msg
;
}
private
static
string
GetAddr
(
string
addr
,
Dictionary
<
string
,
string
>
paramsMap
)
{
if
(
server
.
EndsWith
(
"/"
))
{
server
=
server
.
Substring
(
0
,
server
.
Length
-
1
);
}
string
path
=
server
+
addr
.
Trim
()
+
"?"
;
foreach
(
string
paramName
in
paramsMap
.
Keys
)
{
string
par
=
System
.
Web
.
HttpUtility
.
UrlEncode
(
paramsMap
[
paramName
],
System
.
Text
.
Encoding
.
UTF8
);
path
+=
paramName
+
"="
+
par
+
"&"
;
}
path
=
path
.
Substring
(
0
,
path
.
Length
-
1
);
return
path
;
}
}
public
class
ResultData
{
//{"code":0,"msg":"ok","data":"7"}
public
int
code
{
get
;
set
;
}
public
string
msg
{
get
;
set
;
}
public
Dictionary
<
string
,
string
>
data
{
get
;
set
;
}
}
/// <summary>
///1=设备联机(正常就绪)(入库后,BOX恢复原始状态)(出库后,移载装置恢复原始状态),
...
...
DeviceLibrary/theMachine/BoxTransport.cs
查看文件 @
a1958cc
...
...
@@ -61,7 +61,18 @@ namespace DeviceLibrary
//thread = new Thread(new ThreadStart(Run));
//thread.Start();
}
bool
isSameSide
(
int
from
)
{
var
p
=
XAxis
.
GetAclPosition
();
var
rtx
=
p
+
Config
.
XAxis
.
CanErrorCountMax
;
var
ltx
=
p
-
Config
.
XAxis
.
CanErrorCountMax
;
if
(
rtx
>=
Config
.
Xaxis_P1
&&
rtx
>=
from
)
return
true
;
if
(
ltx
<=
Config
.
Xaxis_P1
&&
ltx
<=
from
)
return
true
;
return
false
;
}
public
bool
Process
()
{
if
(
mainMachine
.
CheckWait
(
MoveInfo
))
...
...
@@ -75,13 +86,13 @@ namespace DeviceLibrary
if
(
IOManager
.
IOValue
(
IO_Type
.
SideA_ForkMaterial_Check
).
Equals
(
IO_VALUE
.
LOW
)
&&
IOManager
.
IOValue
(
IO_Type
.
SideB_ForkMaterial_Check
).
Equals
(
IO_VALUE
.
LOW
))
{
Msg
.
add
(
"伸缩叉检测到有物料无法继续,请检查"
,
MsgLevel
.
warning
);
RobotManage
.
UserPause
(
true
);
Msg
.
add
(
"伸缩叉
2侧
检测到有物料无法继续,请检查"
,
MsgLevel
.
warning
);
RobotManage
.
UserPause
(
"伸缩2侧叉检测到有物料无法继续,请检查"
);
}
else
if
(
IOManager
.
IOValue
(
IO_Type
.
ForkMaterial_Check
).
Equals
(
IO_VALUE
.
HIGH
))
{
Msg
.
add
(
"伸缩叉检测到有物料无法继续,请检查"
,
MsgLevel
.
warning
);
RobotManage
.
UserPause
(
true
);
Msg
.
add
(
"
出库时
伸缩叉检测到有物料无法继续,请检查"
,
MsgLevel
.
warning
);
RobotManage
.
UserPause
(
"出库时伸缩叉检测到有物料无法继续,请检查"
);
}
else
{
...
...
@@ -96,10 +107,12 @@ namespace DeviceLibrary
break
;
case
MoveStep
.
StoreTS03
:
MoveInfo
.
NextMoveStep
(
MoveStep
.
StoreTS04
);
//if (From.Xaxis_P2<=Config.Xaxis_P1+Config.XAxis.CanErrorCountMax)
YAxis
.
AbsMove
(
MoveInfo
,
Config
.
Yaxis_P1
,
Config
.
Yaxis_P1_speed
);
XAxis
.
AbsMove
(
MoveInfo
,
Config
.
Xaxis_P1
,
Config
.
Xaxis_P1_speed
);
MoveInfo
.
log
(
$
"{storeMoveType}:上下轴,行走机构返回待机点P1"
);
if
(
isSameSide
(
From
.
Xaxis_P2
))
{
YAxis
.
AbsMove
(
MoveInfo
,
Config
.
Yaxis_P1
,
Config
.
Yaxis_P1_speed
);
XAxis
.
AbsMove
(
MoveInfo
,
Config
.
Xaxis_P1
,
Config
.
Xaxis_P1_speed
);
MoveInfo
.
log
(
$
"{storeMoveType}:上下轴,行走机构返回待机点P1"
);
}
break
;
case
MoveStep
.
StoreTS04
:
MoveInfo
.
NextMoveStep
(
MoveStep
.
StoreTS05
);
...
...
@@ -130,20 +143,23 @@ namespace DeviceLibrary
if
(
IOManager
.
IOValue
(
IO_Type
.
SideA_ForkMaterial_Check
).
Equals
(
IO_VALUE
.
LOW
)
&&
IOManager
.
IOValue
(
IO_Type
.
SideB_ForkMaterial_Check
).
Equals
(
IO_VALUE
.
LOW
))
{
Msg
.
add
(
"伸缩叉检测到有物料无法继续,请检查"
,
MsgLevel
.
warning
);
RobotManage
.
UserPause
(
true
);
Msg
.
add
(
"伸缩叉
2侧
检测到有物料无法继续,请检查"
,
MsgLevel
.
warning
);
RobotManage
.
UserPause
(
"伸缩叉2侧检测到有物料无法继续,请检查"
);
}
else
if
(
IOManager
.
IOValue
(
IO_Type
.
ForkMaterial_Check
).
Equals
(
IO_VALUE
.
LOW
))
{
Msg
.
add
(
"伸缩叉没有取到物料,请检查"
,
MsgLevel
.
warning
);
RobotManage
.
UserPause
(
true
);
Msg
.
add
(
"
出库时
伸缩叉没有取到物料,请检查"
,
MsgLevel
.
warning
);
RobotManage
.
UserPause
(
"出库时伸缩叉没有取到物料,请检查"
);
}
else
{
MoveInfo
.
NextMoveStep
(
MoveStep
.
StoreTS10
);
YAxis
.
AbsMove
(
MoveInfo
,
Config
.
Yaxis_P1
,
Config
.
Yaxis_P1_speed
);
XAxis
.
AbsMove
(
MoveInfo
,
Config
.
Xaxis_P1
,
Config
.
Xaxis_P1_speed
);
MoveInfo
.
log
(
$
"{storeMoveType}:上下轴,行走机构返回待机点P1"
);
if
(
isSameSide
(
To
.
Xaxis_P2
))
{
YAxis
.
AbsMove
(
MoveInfo
,
Config
.
Yaxis_P1
,
Config
.
Yaxis_P1_speed
);
XAxis
.
AbsMove
(
MoveInfo
,
Config
.
Xaxis_P1
,
Config
.
Xaxis_P1_speed
);
MoveInfo
.
log
(
$
"{storeMoveType}:上下轴,行走机构返回待机点P1"
);
}
InOutEndProcess
(
StoreMoveType
.
OutStore
,
From
.
posid
);
}
break
;
...
...
@@ -177,12 +193,12 @@ namespace DeviceLibrary
IOManager
.
IOValue
(
IO_Type
.
SideB_ForkMaterial_Check
).
Equals
(
IO_VALUE
.
LOW
))
{
Msg
.
add
(
"伸缩叉检测到有物料无法继续,请检查"
,
MsgLevel
.
warning
);
RobotManage
.
UserPause
(
true
);
RobotManage
.
UserPause
(
"伸缩叉检测到有物料无法继续,请检查"
);
}
else
if
(
IOManager
.
IOValue
(
IO_Type
.
ForkMaterial_Check
).
Equals
(
IO_VALUE
.
HIGH
))
{
Msg
.
add
(
"伸缩叉上任然检测到物料,请检查"
,
MsgLevel
.
warning
);
RobotManage
.
UserPause
(
true
);
Msg
.
add
(
"
入库后
伸缩叉上任然检测到物料,请检查"
,
MsgLevel
.
warning
);
RobotManage
.
UserPause
(
"入库后伸缩叉上任然检测到物料,请检查"
);
}
else
{
...
...
@@ -192,9 +208,9 @@ namespace DeviceLibrary
break
;
case
MoveStep
.
StoreTS16
:
MoveInfo
.
NextMoveStep
(
MoveStep
.
StoreTS17
);
YAxis
.
AbsMove
(
MoveInfo
,
Config
.
Yaxis_P1
,
Config
.
Yaxis_P1_speed
);
XAxis
.
AbsMove
(
MoveInfo
,
Config
.
Xaxis_P1
,
Config
.
Xaxis_P1_speed
);
MoveInfo
.
log
(
$
"{storeMoveType}:上下轴,行走机构返回待机点P1"
);
//
YAxis.AbsMove(MoveInfo, Config.Yaxis_P1, Config.Yaxis_P1_speed);
//
XAxis.AbsMove(MoveInfo, Config.Xaxis_P1, Config.Xaxis_P1_speed);
//
MoveInfo.log($"{storeMoveType}:上下轴,行走机构返回待机点P1");
ErrMsgTxt
=
""
;
break
;
case
MoveStep
.
StoreTS17
:
...
...
DeviceLibrary/theMachine/LabelParam.cs
查看文件 @
a1958cc
...
...
@@ -95,12 +95,12 @@ namespace DeviceLibrary
{
if
(
IsNg
)
{
return
"["
+
WareCode
+
"], ["
+
PlateW
+
"x"
+
PlateH
+
"
]"
;
return
$
"入库NG:{NgMsg}[{WareCode}
]"
;
}
else
{
return
"["
+
WareCode
+
"], ["
+
PlateW
+
"x"
+
PlateH
+
"]
"
;
return
$
"库位号:[{PosID}][{WareCode}]
"
;
}
}
...
...
DeviceLibrary/theMachine/MainMachine _AutoInOutTest.cs
0 → 100644
查看文件 @
a1958cc
using
CodeLibrary
;
using
OnlineStore.Common
;
using
OnlineStore.LoadCSVLibrary
;
using
System
;
using
System.Collections.Generic
;
using
System.Drawing
;
using
System.Linq
;
using
System.Text
;
using
System.Threading.Tasks
;
namespace
DeviceLibrary
{
partial
class
MainMachine
{
public
bool
StartAutoInOutTest
(
int
posindex
,
out
string
errmsg
)
{
errmsg
=
""
;
if
(!
boxTransport
.
IsComplateOrFree
)
{
errmsg
=
"料仓忙碌中,无法启动"
;
return
false
;
}
if
(!
IsInStoreReady
)
{
errmsg
=
"入库周转箱没有准备好,无法启动"
;
return
false
;
}
if
(!
IsOutLiftEmpty
)
{
errmsg
=
"出库口有周转箱,无法启动"
;
return
false
;
}
poslist
=
CSVPositionReader
<
ACStorePosition
>.
getPositionList
();
AutoInOutTest
=
true
;
StopAutoInOut
=
false
;
CurrentPosIndex
=
posindex
;
//AIOTMoveInfo.NewMove(MoveStep.Wait);
return
true
;
}
public
void
StopAutoInOutTest
()
{
StopAutoInOut
=
true
;
}
List
<
ACStorePosition
>
poslist
;
int
CurrentPosIndex
=
0
;
public
bool
AutoInOutTest
=
false
;
bool
StopAutoInOut
=
false
;
void
AutoInOutTestProcess
()
{
if
(
CheckWait
(
AIOTMoveInfo
))
return
;
//常规上料扫码流程
switch
(
AIOTMoveInfo
.
MoveStep
)
{
case
MoveStep
.
Wait
:
if
(
InMoveInfo
.
MoveStep
==
MoveStep
.
InWaitBoxLeave
)
{
AIOTMoveInfo
.
NextMoveStep
(
MoveStep
.
StoreIn01
);
AIOTMoveInfo
.
log
(
$
"入库周转箱已准备好"
);
}
break
;
case
MoveStep
.
StoreIn01
:
AIOTMoveInfo
.
NextMoveStep
(
MoveStep
.
StoreIn02
);
var
ac
=
poslist
[
CurrentPosIndex
];
if
(!
boxTransport
.
Start
(
new
BoxStorePosition
(
Config
,
StoreSide
.
A
),
new
BoxStorePosition
(
ac
),
StoreMoveType
.
InStore
))
{
AIOTMoveInfo
.
log
(
$
"料仓周转启动失败"
);
AutoInOutTest
=
false
;
StopAutoInOut
=
true
;
return
;
}
AIOTMoveInfo
.
log
(
$
"开始转运周转箱"
);
break
;
case
MoveStep
.
StoreIn02
:
if
(
boxTransport
.
IsTakedBox
)
{
AIOTMoveInfo
.
NextMoveStep
(
MoveStep
.
StoreIn03
);
InMoveInfo
.
NextMoveStep
(
MoveStep
.
InBoxLeaved
);
AIOTMoveInfo
.
log
(
$
"周转箱已取走"
);
}
else
{
Msg
.
add
(
"入料线等待周转箱离开"
,
MsgLevel
.
info
);
}
break
;
case
MoveStep
.
StoreIn03
:
if
(
boxTransport
.
IsComplateOrFree
)
{
AIOTMoveInfo
.
log
(
$
"周转箱已到达目的地"
);
ac
=
poslist
[
CurrentPosIndex
];
CurrentPosIndex
--;
if
(
CurrentPosIndex
<
0
||
StopAutoInOut
)
{
AIOTMoveInfo
.
log
(
$
"已达到最后一个库位{CurrentPosIndex},或手动停止{StopAutoInOut},自动出入库停止,将周转箱送至出口"
);
AIOTMoveInfo
.
NextMoveStep
(
MoveStep
.
StoreOut10
);
return
;
}
var
bc
=
poslist
[
CurrentPosIndex
];
if
(!
boxTransport
.
Start
(
new
BoxStorePosition
(
ac
),
new
BoxStorePosition
(
bc
),
StoreMoveType
.
InStore
))
{
AIOTMoveInfo
.
log
(
$
"料仓周转启动失败"
);
AutoInOutTest
=
false
;
StopAutoInOut
=
true
;
return
;
}
}
break
;
case
MoveStep
.
StoreOut10
:
if
(!
IsOutLiftEmpty
)
{
Msg
.
add
(
"出口位置被占用无法送出料箱"
,
MsgLevel
.
warning
);
return
;
}
AIOTMoveInfo
.
NextMoveStep
(
MoveStep
.
StoreOut11
);
ac
=
poslist
[
CurrentPosIndex
];
if
(!
boxTransport
.
Start
(
new
BoxStorePosition
(
ac
),
new
BoxStorePosition
(
Config
,
StoreSide
.
B
),
StoreMoveType
.
OutStore
))
{
AIOTMoveInfo
.
log
(
$
"料仓周转启动失败"
);
AutoInOutTest
=
false
;
StopAutoInOut
=
true
;
return
;
}
AIOTMoveInfo
.
log
(
$
"开始转运周转箱"
);
break
;
case
MoveStep
.
StoreOut11
:
if
(
boxTransport
.
IsTakedBox
)
{
AIOTMoveInfo
.
NextMoveStep
(
MoveStep
.
StoreOut12
);
AIOTMoveInfo
.
log
(
$
"周转箱已取走"
);
}
else
{
Msg
.
add
(
"出料线等待周转箱到达"
,
MsgLevel
.
info
);
}
break
;
case
MoveStep
.
StoreOut12
:
if
(
boxTransport
.
IsComplateOrFree
)
{
OutMoveInfo
.
NextMoveStep
(
MoveStep
.
OutBoxPutOn
);
AIOTMoveInfo
.
log
(
$
"周转箱已到达目的地"
);
AIOTMoveInfo
.
EndMove
();
AutoInOutTest
=
false
;
}
break
;
default
:
AIOTMoveInfo
.
log
(
$
"未找到对应步骤:{AIOTMoveInfo.MoveStep}"
);
break
;
}
}
}
}
DeviceLibrary/theMachine/MainMachine _IN.cs
查看文件 @
a1958cc
...
...
@@ -12,30 +12,47 @@ namespace DeviceLibrary
{
partial
class
MainMachine
{
public
bool
IsInStoreReady
()
{
return
InMoveInfo
.
MoveStep
==
MoveStep
.
InWaitServerCallback
;
/// <summary>
/// InMoveInfo.MoveStep == MoveStep.InWaitServerCallback
/// </summary>
public
bool
IsInStoreReady
{
get
=>
InMoveInfo
.
MoveStep
==
MoveStep
.
InWaitServerCallback
;
}
/// <summary>
/// if (InMoveInfo.MoveStep == MoveStep.InWaitServerCallback)
/// </summary>
/// <param name="jobInfo"></param>
/// <returns></returns>
public
bool
StartInStore
(
JobInfo
jobInfo
)
{
if
(
I
nMoveInfo
.
MoveStep
==
MoveStep
.
InWaitServerCallback
)
if
(
I
sInStoreReady
)
{
InMoveInfo
.
MoveParam
.
WareCode
=
jobInfo
.
WareNum
;
InMoveInfo
.
MoveParam
.
PosID
=
jobInfo
.
PosId
;
InMoveInfo
.
NextMoveStep
(
MoveStep
.
StartInStore
);
return
true
;
}
return
false
;
}
double
CurrentWeight
{
get
{
var
weight
=
OKLEController
.
queryData
(
Config
.
WeightSensorPort
);
return
weight
-
Config
.
WeightSensorBase
;
}
}
void
InProcess
()
{
if
(
CheckWait
(
InMoveInfo
))
return
;
//常规上料扫码流程
switch
(
InMoveInfo
.
MoveStep
)
{
case
MoveStep
.
Wait
:
if
(
IOValue
(
IO_Type
.
InStart_BTN
).
Equals
(
IO_VALUE
.
HIGH
))
if
(
CurrentWeight
>
Config
.
StoreWeightLimited
)
{
Msg
.
add
(
$
"周转箱超重,当前重量:{CurrentWeight}kg,最大限重{Config.StoreWeightLimited}kg"
,
MsgLevel
.
warning
);
}
else
if
(
IOValue
(
IO_Type
.
InStart_BTN
).
Equals
(
IO_VALUE
.
HIGH
))
{
InMoveInfo
.
log
(
$
"踩下启动脚踏"
);
InMoveInfo
.
NextMoveStep
(
MoveStep
.
InPre01
);
...
...
@@ -72,15 +89,10 @@ namespace DeviceLibrary
break
;
case
MoveStep
.
In01
:
InMoveInfo
.
NextMoveStep
(
MoveStep
.
In02
);
var
weight
=
OKLEController
.
queryData
(
Config
.
WeightSensorPort
);
weight
=
weight
-
Config
.
WeightSensorBase
;
if
(
weight
<=
Config
.
StoreWeightLimited
)
if
(
CurrentWeight
<=
Config
.
StoreWeightLimited
)
{
InMoveInfo
.
log
(
$
"开始拍照扫码"
);
if
(
RobotManage
.
InoutDebugMode
)
InMoveInfo
.
NextMoveStep
(
MoveStep
.
InWaitServerCallback
);
else
ScanCode
();
ScanCode
();
}
else
{
...
...
@@ -92,7 +104,7 @@ namespace DeviceLibrary
case
MoveStep
.
In02
:
if
(
InScanTask
.
IsCompleted
)
{
var
(
x
,
s
)
=
InScanTask
.
Result
;
var
x
=
InScanTask
.
Result
;
if
(
x
.
Count
==
0
)
{
InMoveInfo
.
NextMoveStep
(
MoveStep
.
In01
);
...
...
@@ -105,11 +117,9 @@ namespace DeviceLibrary
InMoveInfo
.
log
(
$
"已完成扫码,等待服务器反馈库位 Count={x.Count}"
);
InMoveInfo
.
MoveParam
.
IsNg
=
false
;
InMoveInfo
.
MoveParam
.
codeInfos
=
x
;
InMoveInfo
.
MoveParam
.
bitmapfilename
=
s
;
var
cc
=
x
.
Select
((
a
)
=>
a
.
CodeStr
);
ServerCM
.
SendInStoreRequest
(
cc
.
ToArray
());
}
}
}
else
if
(
InMoveInfo
.
IsTimeOut
(
10
))
{
...
...
@@ -118,7 +128,9 @@ namespace DeviceLibrary
}
break
;
case
MoveStep
.
InWaitServerCallback
:
if
(
InMoveInfo
.
IsTimeOut
(
15
))
if
(
InMoveInfo
.
IsTimeOut
(
5
))
Msg
.
add
(
"等待服务器返回库位"
,
MsgLevel
.
info
);
else
if
(
InMoveInfo
.
IsTimeOut
(
15
))
{
InMoveInfo
.
NextMoveStep
(
MoveStep
.
Wait
);
InMoveInfo
.
log
(
$
"等待服务器返回库位超时"
);
...
...
@@ -129,18 +141,19 @@ namespace DeviceLibrary
CylinderMove
(
InMoveInfo
,
IO_Type
.
InStop_Down
,
IO_Type
.
InStop_Up
,
IO_VALUE
.
LOW
);
InSideLift
.
LiftUp
(
InMoveInfo
);
InMoveInfo
.
log
(
$
"放下入料阻挡"
);
break
;
case
MoveStep
.
In06
:
InMoveInfo
.
NextMoveStep
(
MoveStep
.
In07
);
LineIn
.
LineRun
(
"work"
,
999
);
InMoveInfo
.
log
(
$
"启动滚筒"
);
CylinderMove
(
InMoveInfo
,
IO_Type
.
InMaterialLocation_Bck
,
IO_Type
.
InMaterialLocation_Fwd
,
IO_VALUE
.
HIGH
);
InMoveInfo
.
log
(
$
"料箱定位前进"
);
break
;
case
MoveStep
.
In07
:
if
(
IOValue
(
IO_Type
.
InOverHead_Check
).
Equals
(
IO_VALUE
.
HIGH
))
{
LineIn
.
LineStop
(
"work"
);
InMoveInfo
.
log
(
$
"检测到物料超高,停止滚筒"
);
InMoveInfo
.
NextMoveStep
(
MoveStep
.
InOverHead
);
ServerCM
.
cancelPutInTask
(
""
,
InMoveInfo
.
MoveParam
.
WareCode
);
return
;
}
//IOValue(IO_Type.InEndMaterialTop_Check).Equals(IO_VALUE.HIGH) &&
...
...
@@ -158,6 +171,11 @@ namespace DeviceLibrary
}
break
;
case
MoveStep
.
In08
:
InMoveInfo
.
NextMoveStep
(
MoveStep
.
In09
);
CylinderMove
(
InMoveInfo
,
IO_Type
.
InMaterialLocation_Bck
,
IO_Type
.
InMaterialLocation_Fwd
,
IO_VALUE
.
LOW
);
InMoveInfo
.
log
(
"料箱定位后退"
);
break
;
case
MoveStep
.
In09
:
InMoveInfo
.
NextMoveStep
(
MoveStep
.
InWaitBoxLeave
);
InSideLift
.
LiftUp
(
InMoveInfo
);
InMoveInfo
.
log
(
"顶升上升,等待周转箱到位"
);
...
...
@@ -185,13 +203,22 @@ namespace DeviceLibrary
break
;
}
}
string
Right
State
()
{
string
In
State
()
{
string
state
=
""
;
if
(
InMoveInfo
.
MoveStep
>=
MoveStep
.
In02
)
{
return
InMoveInfo
.
MoveParam
.
ToStr
();
}
else
if
(
InMoveInfo
.
MoveStep
>=
MoveStep
.
Wait
)
{
state
=
"空闲中"
;
}
else
if
(
InMoveInfo
.
MoveStep
<
MoveStep
.
In02
)
{
return
"无料串
"
;
state
=
"入库扫描
"
;
}
return
state
;
return
state
;
}
public
bool
IsScanRunning
()
{
if
(
InScanTask
==
null
)
...
...
@@ -202,7 +229,7 @@ namespace DeviceLibrary
/// <summary>
/// 扫码线程
/// </summary>
Task
<
(
List
<
CodeInfo
>,
string
)
>
InScanTask
;
Task
<
List
<
CodeInfo
>
>
InScanTask
;
void
ScanCode
()
{
InMoveInfo
.
log
(
"开始扫码"
);
//RightMoveInfo.OneWaitCanEndStep = true;
...
...
@@ -210,25 +237,24 @@ namespace DeviceLibrary
//RightMoveInfo.WaitList.Add(WaitResultInfo.WaitTime(1000));
try
{
InScanTask
=
Task
.
Run
(
new
Func
<
(
List
<
CodeInfo
>,
string
)
>(()=>
InScanTask
=
Task
.
Run
(
new
Func
<
List
<
CodeInfo
>
>(()=>
{
IOMove
(
IO_Type
.
Camera_Led
,
IO_VALUE
.
HIGH
);
string
filename
;
Task
.
Delay
(
10
).
Wait
();
List
<
CodeInfo
>
LastCodeList
,
LastCodeList2
;
(
LastCodeList
,
filename
)
=
CodeManager
.
CameraScan
(
new
List
<
string
>
{
Config
.
CameraName
});
LastCodeList
=
CodeManager
.
CameraScan
(
new
List
<
string
>
{
Config
.
CameraName
});
BoxParam
labelParam
=
new
BoxParam
();
labelParam
.
codeInfos
=
new
List
<
CodeInfo
>(
LastCodeList
);
if
(!
Common
.
codeProcess
(
labelParam
,
out
_
))
{
Task
.
Delay
(
500
).
Wait
();
(
LastCodeList2
,
filename
)
=
CodeManager
.
CameraScan
(
new
List
<
string
>
{
Config
.
CameraName
});
LastCodeList2
=
CodeManager
.
CameraScan
(
new
List
<
string
>
{
Config
.
CameraName
});
LastCodeList
.
AddRange
(
LastCodeList2
);
}
//IOMove(IO_Type.Camera_Led, IO_VALUE.LOW);
return
(
LastCodeList
,
filename
)
;
return
LastCodeList
;
}));
}
catch
(
Exception
ex
)
...
...
DeviceLibrary/theMachine/MainMachine _IOMonitor.cs
查看文件 @
a1958cc
...
...
@@ -14,8 +14,7 @@ namespace DeviceLibrary
partial
class
MainMachine
{
void
ioMonitor
()
{
{
//右侧料串已空
//if (RightMoveInfo.IsStep(MoveStep.Wait) && IOValue(IO_Type.RightEnd_Check).Equals(IO_VALUE.HIGH) && RightShelfNoTray)
...
...
DeviceLibrary/theMachine/MainMachine _LabelProcess.cs
deleted
100644 → 0
查看文件 @
e617e61
using
CodeLibrary
;
using
OnlineStore.Common
;
using
OnlineStore.LoadCSVLibrary
;
using
System
;
using
System.Collections.Generic
;
using
System.Drawing
;
using
System.Linq
;
using
System.Text
;
using
System.Threading.Tasks
;
namespace
DeviceLibrary
{
partial
class
MainMachine
{
void
LabelProcess
()
{
if
(
CheckWait
(
LabelMoveInfo
))
return
;
switch
(
LabelMoveInfo
.
MoveStep
)
{
case
MoveStep
.
Lbl01
:
LabelMoveInfo
.
NextMoveStep
(
MoveStep
.
Lbl_WaitPrint
);
Label_X_Axis
.
AbsMove
(
LabelMoveInfo
,
Config
.
Label_X_P2
,
Config
.
Label_X_P2_speed
);
Label_Y_Axis
.
AbsMove
(
LabelMoveInfo
,
Config
.
Label_Y_P2
,
Config
.
Label_Y_P2_speed
);
Label_Z_Axis
.
AbsMove
(
LabelMoveInfo
,
Config
.
Label_Z_P2
,
Config
.
Label_Z_P2_speed
);
Label_R_Axis
.
AbsMove
(
LabelMoveInfo
,
Config
.
Label_R_P2
,
Config
.
Label_Z_P2_speed
);
LabelMoveInfo
.
log
(
"Label_XYZ转到取标点,等待标签打印完毕"
);
break
;
case
MoveStep
.
Lbl_WaitPrint
:
if
(
LastPrintStatus
==
Asa
.
PrintLabel
.
PrinterStatus
.
Idle
)
{
LabelMoveInfo
.
NextMoveStep
(
MoveStep
.
Lbl_Printted
);
}
break
;
case
MoveStep
.
Lbl_Printted
:
LabelMoveInfo
.
NextMoveStep
(
MoveStep
.
Lbl03
);
LastPrintStatus
=
Asa
.
PrintLabel
.
PrinterStatus
.
Unknown
;
IOMove
(
IO_Type
.
LabelCylinder_Work
,
IO_VALUE
.
HIGH
);
Label_Z_Axis
.
AbsMove
(
LabelMoveInfo
,
Config
.
Label_Z_P3
,
Config
.
Label_Z_P3_speed
);
//CylinderMove(LabelMoveInfo, IO_Type.LabelCylinder_Bck, IO_Type.LabelCylinder_Fwd);
LabelMoveInfo
.
log
(
"标签打印完毕,取标气缸下降,开始吸气."
);
break
;
case
MoveStep
.
Lbl03
:
LabelMoveInfo
.
NextMoveStep
(
MoveStep
.
Lbl04
);
LabelMoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitTime
(
500
));
break
;
case
MoveStep
.
Lbl04
:
LabelMoveInfo
.
NextMoveStep
(
MoveStep
.
Lbl05
);
Label_Z_Axis
.
AbsMove
(
LabelMoveInfo
,
Config
.
Label_Z_P2
,
Config
.
Label_Z_P2_speed
);
//CylinderMove(LabelMoveInfo, IO_Type.LabelCylinder_Fwd, IO_Type.LabelCylinder_Bck);
LabelMoveInfo
.
log
(
"标签打印完毕,取标气缸上升,取起标签."
);
break
;
case
MoveStep
.
Lbl05
:
if
(
LeftMoveInfo
.
MoveStep
==
MoveStep
.
L20_WaitLabel
)
{
LabelMoveInfo
.
NextMoveStep
(
MoveStep
.
Lbl10
);
}
else
if
(
LabelMoveInfo
.
IsTimeOut
(
60
))
{
LabelMoveInfo
.
log
(
"等待左侧料串可贴标."
);
}
break
;
case
MoveStep
.
Lbl10
:
if
(!
Label_Y_Axis
.
IsSafe
(
Config
.
Label_Y_P3
,
out
string
msg
))
{
Msg
.
add
(
msg
,
MsgLevel
.
warning
);
return
;
}
//照片中料盘中心点像素位置
Point
Right_Batch_Point
=
new
Point
(
RobotManage
.
Config
.
Right_Batch_X
,
RobotManage
.
Config
.
Right_Batch_Y
);
//不同尺寸料盘需要在照片上便宜的贴标像素
int
widthOffset
=
Config
.
Label_Offset_Pixel_7
;
switch
(
LabelMoveInfo
.
MoveParam
.
PlateW
)
{
case
13
:
widthOffset
=
Config
.
Label_Offset_Pixel_13
;
break
;
case
15
:
widthOffset
=
Config
.
Label_Offset_Pixel_15
;
break
;
}
//计算照片中贴标的像素位置
Point
p
=
Common
.
CalcLabelPoint
(
LabelMoveInfo
.
MoveParam
,
Right_Batch_Point
,
Config
.
Label_R_Offset
,
Config
.
Label_R_Angle_Diff
,
out
int
labelAngle
);
if
(
labelAngle
>
350
)
labelAngle
=
350
;
//计算贴标角度的脉冲值
int
labelAxisPos
=
Config
.
Label_R_360
/
350
*
labelAngle
;
//计算像素点位与中心点的差
Point
Label_p3
=
new
Point
(
p
.
X
-
Right_Batch_Point
.
X
,
p
.
Y
-
Right_Batch_Point
.
Y
);
//计算像素*脉冲像素比得到脉冲值+中心点基准脉冲
Label_p3
.
X
=
(
int
)(
Label_p3
.
X
*
Config
.
Cam_Pixel_X_Ratio
)
+
Config
.
Label_X_P3
;
Label_p3
.
Y
=
(
int
)(
Label_p3
.
Y
*
Config
.
Cam_Pixel_Y_Ratio
)
+
Config
.
Label_Y_P3
;
LabelMoveInfo
.
log
(
$
"计算贴标像素点位为{p},轴点位为{Label_p3},角度{labelAngle},R轴{labelAxisPos},盘宽{LabelMoveInfo.MoveParam.PlateW}"
);
LabelMoveInfo
.
NextMoveStep
(
MoveStep
.
Lbl11
);
Label_X_Axis
.
AbsMove
(
LabelMoveInfo
,
Label_p3
.
X
,
Config
.
Label_X_P3_speed
);
Label_Y_Axis
.
AbsMove
(
LabelMoveInfo
,
Label_p3
.
Y
,
Config
.
Label_Y_P3_speed
);
Label_R_Axis
.
AbsMove
(
LabelMoveInfo
,
labelAxisPos
,
Config
.
Label_R_P2_speed
);
Label_Z_Axis
.
AbsMove
(
LabelMoveInfo
,
Config
.
Label_Z_P4
,
Config
.
Label_Z_P4_speed
);
LabelMoveInfo
.
log
(
"Label_XYZ转到贴标点."
);
break
;
case
MoveStep
.
Lbl11
:
LabelMoveInfo
.
NextMoveStep
(
MoveStep
.
Lbl12
);
Label_Z_Axis
.
AbsMove
(
LabelMoveInfo
,
Config
.
Label_Z_P5
,
Config
.
Label_Z_P5_speed
);
LabelMoveInfo
.
log
(
"下降."
);
break
;
case
MoveStep
.
Lbl12
:
LabelMoveInfo
.
NextMoveStep
(
MoveStep
.
Lbl13
);
IOMove
(
IO_Type
.
LabelCylinder_Work
,
IO_VALUE
.
LOW
);
LabelMoveInfo
.
log
(
"关闭吸气."
);
break
;
case
MoveStep
.
Lbl13
:
LabelMoveInfo
.
NextMoveStep
(
MoveStep
.
Lbl14
);
Label_Z_Axis
.
AbsMove
(
LabelMoveInfo
,
Config
.
Label_Z_P4
,
Config
.
Label_Z_P4_speed
);
LabelMoveInfo
.
log
(
"上升."
);
break
;
case
MoveStep
.
Lbl14
:
LeftMoveInfo
.
NextMoveStep
(
MoveStep
.
L30_LabelFinish
);
LabelMoveInfo
.
NextMoveStep
(
MoveStep
.
Lbl01
);
LabelMoveInfo
.
log
(
"完成贴标."
);
break
;
default
:
LabelMoveInfo
.
log
(
$
"未找到对应步骤:{LabelMoveInfo.MoveStep}"
);
break
;
}
}
string
LabelState
()
{
string
state
=
""
;
if
(
LabelMoveInfo
.
MoveStep
>=
MoveStep
.
Lbl_Printted
)
{
state
+=
"标签已打印,当前ReelID:"
+
LabelMoveInfo
.
MoveParam
.
WareCode
;
}
if
(
LabelMoveInfo
.
MoveStep
==
MoveStep
.
Lbl01
)
{
state
+=
"等待标签打印"
;
}
if
(
LabelMoveInfo
.
MoveStep
==
MoveStep
.
Wait
)
{
state
+=
"等待中"
;
}
return
state
;
}
}
}
DeviceLibrary/theMachine/MainMachine _LeftProcess.cs
deleted
100644 → 0
查看文件 @
e617e61
此文件的差异被折叠,
点击展开。
DeviceLibrary/theMachine/MainMachine _MiddleProcess.cs
deleted
100644 → 0
查看文件 @
e617e61
此文件的差异被折叠,
点击展开。
DeviceLibrary/theMachine/MainMachine _Out.cs
查看文件 @
a1958cc
...
...
@@ -32,11 +32,12 @@ namespace DeviceLibrary
OutMoveInfo
.
NextMoveStep
(
MoveStep
.
WaitErr
);
}
else
if
(
IOValue
(
IO_Type
.
OutEntryMaterialTop_Check
).
Equals
(
IO_VALUE
.
HIGH
))
{
{
Msg
.
add
(
"检测到出料口有周转箱"
,
MsgLevel
.
warning
);
//OutMoveInfo.log($"检测到出料口有周转箱");
}
OutMoveInfo
.
log
(
$
"检测到出料口有周转箱,送出"
);
OutMoveInfo
.
NextMoveStep
(
MoveStep
.
OutBoxPutOn
);
}
break
;
case
MoveStep
.
WaitErr
:
OutMoveInfo
.
NextMoveStep
(
MoveStep
.
Wait
);
...
...
@@ -44,7 +45,7 @@ namespace DeviceLibrary
OutMoveInfo
.
log
(
$
"出料口周转箱顶升上升"
);
break
;
case
MoveStep
.
OutBoxPutOn
:
if
(
IOValue
(
IO_Type
.
OutEntryMaterialTop_Check
).
Equals
(
IO_VALUE
.
HIGH
))
if
(
IOValue
(
IO_Type
.
OutEntryMaterialTop_Check
).
Equals
(
IO_VALUE
.
LOW
))
{
Msg
.
add
(
"出口没有检测到周转箱"
,
MsgLevel
.
warning
);
}
...
...
@@ -57,14 +58,15 @@ namespace DeviceLibrary
break
;
case
MoveStep
.
Out01
:
OutMoveInfo
.
NextMoveStep
(
MoveStep
.
Out02
);
if
(
IOMonitor
.
IODebound
(
IO_Type
.
OutStopMaterial_Check
,
Config
,
IO_VALUE
.
LOW
,
2000
)
&&
IOMonitor
.
IODebound
(
IO_Type
.
OutExitMaterial_Check
,
Config
,
IO_VALUE
.
LOW
,
2000
))
if
(
IOMonitor
.
IODebound
(
IO_Type
.
OutStopMaterial_Check
,
Config
,
IO_VALUE
.
LOW
,
2000
)
&&
IOMonitor
.
IODebound
(
IO_Type
.
OutExitMaterial_Check
,
Config
,
IO_VALUE
.
LOW
,
2000
))
{
LineOut
.
LineRun
(
"out"
,
999
);
CylinderMove
(
OutMoveInfo
,
IO_Type
.
OutStop_Down
,
IO_Type
.
OutStop_Up
,
IO_VALUE
.
LOW
);
OutMoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitIO
(
IO_Type
.
OutExitMaterial_Check
,
IO_VALUE
.
HIGH
));
OutMoveInfo
.
log
(
$
"线体转动"
);
}
else
{
else
{
Msg
.
add
(
"等待出口清空周转箱"
,
MsgLevel
.
warning
);
}
break
;
...
...
@@ -75,11 +77,14 @@ namespace DeviceLibrary
OutMoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitTime
(
2000
));
break
;
case
MoveStep
.
Out03
:
OutMoveInfo
.
NextMoveStep
(
MoveStep
.
Out04
);
CylinderMove
(
OutMoveInfo
,
IO_Type
.
OutStop_Down
,
IO_Type
.
OutStop_Up
,
IO_VALUE
.
HIGH
);
OutSideLift
.
LiftDown
(
OutMoveInfo
);
OutMoveInfo
.
log
(
$
"出料中间阻挡升起"
);
ServerCM
.
SendStoreState
(
StoreMoveInfo
.
MoveParam
.
PosID
,
StoreStatus
.
OutStoreEnd
);
OutMoveInfo
.
EndMove
();
break
;
case
MoveStep
.
Out04
:
OutMoveInfo
.
NextMoveStep
(
MoveStep
.
Wait
);
break
;
default
:
OutMoveInfo
.
log
(
$
"未找到对应步骤:{OutMoveInfo.MoveStep}"
);
...
...
@@ -88,8 +93,13 @@ namespace DeviceLibrary
}
string
OutState
()
{
string
state
=
""
;
if
(
OutMoveInfo
.
MoveStep
>=
MoveStep
.
OutBoxPutOn
)
{
return
"送出周转箱:"
+
OutMoveInfo
.
MoveParam
.
ToStr
();
}
else
{
return
"
无料串"
;
return
"
最后的周转箱:"
+
OutMoveInfo
.
MoveParam
.
ToStr
()
;
}
return
state
;
...
...
DeviceLibrary/theMachine/MainMachine _Printer.cs
deleted
100644 → 0
查看文件 @
e617e61
using
CodeLibrary
;
using
OnlineStore.Common
;
using
OnlineStore.LoadCSVLibrary
;
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Text
;
using
System.Threading.Tasks
;
using
System.Windows.Forms
;
namespace
DeviceLibrary
{
partial
class
MainMachine
{
//Asa.PrintLabel PrintBean = null;
public
void
InitPrint
()
{
//RobotManage.PrintBean = new Asa.PrintLabel(Application.StartupPath + "\\Label");
RobotManage
.
PrintBean
.
PrintStatusChanged
+=
Print_PrintStatusChanged
;
/*
System.Drawing.Printing.PrintDocument print = new System.Drawing.Printing.PrintDocument();
string sDefault = print.PrinterSettings.PrinterName;//默认打印机名
LogUtil.info("PrintLabel 本机默认打印机:" + sDefault);
int index = 1;
foreach (string sPrint in System.Drawing.Printing.PrinterSettings.InstalledPrinters)//获取所有打印机名称
{
LogUtil.info("PrintLabel 打印机_" + index + "_名称:" + sPrint);
index++;
}*/
}
public
Asa
.
PrintLabel
.
PrinterStatus
LastPrintStatus
=
Asa
.
PrintLabel
.
PrinterStatus
.
Unknown
;
void
Print_PrintStatusChanged
(
Asa
.
PrintLabel
.
PrinterStatus
sta
,
string
msg
)
{
if
(
sta
.
Equals
(
LastPrintStatus
).
Equals
(
false
))
{
LogUtil
.
info
(
"PrintLabel 收到打印机新状态:【"
+
sta
+
"】【"
+
msg
+
"】,替换原来的状态【"
+
LastPrintStatus
+
"】 "
);
}
else
{
if
(
sta
==
Asa
.
PrintLabel
.
PrinterStatus
.
Idle
)
{
//Task.Run(()=> {
// while (true)
// {
// if (LabelMoveInfo.IsStep(MoveStep.Lbl_WaitPrint))
// {
// LabelMoveInfo.NextMoveStep(MoveStep.Lbl_Printted);
// break;
// }
// Task.Delay(500).Wait();
// }
//});
}
LogUtil
.
info
(
" PrintLabel 收到打印机新状态:【"
+
sta
+
"】【"
+
msg
+
"】,与之前状态一样 "
);
}
LastPrintStatus
=
sta
;
}
public
string
LastPrintLabel
=
""
;
void
StartPrintLabel
(
LabelParam
labelParam
)
{
try
{
LastPrintStatus
=
Asa
.
PrintLabel
.
PrinterStatus
.
Unknown
;
LogUtil
.
info
(
"调用 PrintLabel 打印标签 StartPrintLabel ,["
+
labelParam
.
WareCode
+
"] ["
+
labelParam
.
QTY
+
"] 开始"
);
Dictionary
<
string
,
string
>
text
=
new
Dictionary
<
string
,
string
>
{
{
"code"
,
labelParam
.
WareCode
},
{
"ri"
,
labelParam
.
RI
},
{
"pn"
,
labelParam
.
PN
},
{
"batch"
,
labelParam
.
Batch
},
{
"qty"
,
labelParam
.
QTY
.
ToString
()
}
};
LastPrintLabel
=
labelParam
.
PN
;
RobotManage
.
PrintBean
.
Print
(
text
);
LogUtil
.
info
(
"PrintLabel 打印标签 StartPrintLabel 结束 "
);
}
catch
(
Exception
ex
)
{
LogUtil
.
error
(
"PrintLabel 打印标签 StartPrintLabel 错误:"
+
ex
.
ToString
());
}
}
public
Task
DoPrint
(
LabelParam
labelParam
)
{
return
Task
.
Run
(()
=>
{
StartPrintLabel
(
labelParam
);
});
}
}
}
DeviceLibrary/theMachine/MainMachine _Store.cs
查看文件 @
a1958cc
...
...
@@ -98,8 +98,8 @@ namespace DeviceLibrary
case
MoveStep
.
StoreOut12
:
if
(
boxTransport
.
IsComplateOrFree
)
{
OutMoveInfo
.
NextMoveStep
(
MoveStep
.
OutBoxPutOn
);
OutMoveInfo
.
MoveParam
=
StoreMoveInfo
.
MoveParam
.
clone
();
StoreMoveInfo
.
log
(
$
"周转箱已到达目的地"
);
ServerCM
.
SendStoreState
(
StoreMoveInfo
.
MoveParam
.
PosID
,
StoreStatus
.
OutStoreBoxEnd
);
...
...
@@ -111,5 +111,19 @@ namespace DeviceLibrary
break
;
}
}
string
StoreState
()
{
string
state
=
"空闲中"
;
if
(
StoreMoveInfo
.
MoveStep
>=
MoveStep
.
StoreOut10
)
{
state
=
$
"出库中,库位号:{StoreMoveInfo.MoveParam.PosID}"
;
}
else
if
(
StoreMoveInfo
.
MoveStep
>=
MoveStep
.
StoreIn01
)
{
state
=
$
"入库中,库位号:{StoreMoveInfo.MoveParam.PosID}"
;
}
return
state
;
}
}
}
DeviceLibrary/theMachine/MainMachine.cs
查看文件 @
a1958cc
...
...
@@ -39,6 +39,7 @@ namespace DeviceLibrary
public
MoveInfo
InMoveInfo
;
public
MoveInfo
OutMoveInfo
;
MoveInfo
StoreMoveInfo
;
MoveInfo
AIOTMoveInfo
;
public
delegate
void
ProcessMsg
(
List
<
Msg
>
msg
);
public
event
ProcessMsg
ProcessMsgEvent
;
...
...
@@ -79,13 +80,14 @@ namespace DeviceLibrary
Config
=
_config
;
InMoveInfo
=
new
MoveInfo
(
"A侧取料"
);
//InMoveInfo.SetStateDelegate(Right
State);
InMoveInfo
.
SetStateDelegate
(
In
State
);
StoreMoveInfo
=
new
MoveInfo
(
"出入库"
);
//StoreMoveInfo.SetStateDelegate(Middl
eState);
StoreMoveInfo
.
SetStateDelegate
(
Stor
eState
);
OutMoveInfo
=
new
MoveInfo
(
"B侧出料"
);
//OutMoveInfo.SetStateDelegate(Lef
tState);
OutMoveInfo
.
SetStateDelegate
(
Ou
tState
);
ResetMoveInfo
=
new
MoveInfo
(
"重置"
);
AIOTMoveInfo
=
new
MoveInfo
(
"出入库测试"
);
//MoveInfo.List.Remove(AIOTMoveInfo);
#
region
初始化
led
灯
AlarmLed
=
new
Led
(
Config
.
DOList
[
IO_Type
.
Alarm_Led
].
GetIOAddr
());
...
...
@@ -118,7 +120,6 @@ namespace DeviceLibrary
//BoxTransport_InOutEndProcessEvent;
//ProcessMsgEvent += MainMachine_ProcessMsgEvent;
AlarmBuzzer
.
SetOnOffAction
(()
=>{
IOMove
(
IO_Type
.
Alarm_Buzzer
,
IO_VALUE
.
HIGH
);
},
()
=>
{
IOMove
(
IO_Type
.
Alarm_Buzzer
,
IO_VALUE
.
LOW
);
});
LedProcessInit
();
...
...
@@ -188,6 +189,11 @@ namespace DeviceLibrary
{
BtnProcess
();
canRunning
=
SafeCheck
();
if
(
canRunning
&&
!
lastSafeCheckStatus
)
{
}
lastSafeCheckStatus
=
canRunning
;
}
Thread
.
Sleep
(
200
);
if
(!
canRunning
||
!
mstart
)
...
...
@@ -197,7 +203,10 @@ namespace DeviceLibrary
ioMonitor
();
InProcess
();
boxTransport
.
Process
();
StoreProcess
();
if
(
RobotManage
.
mainMachine
.
AutoInOutTest
)
AutoInOutTestProcess
();
else
StoreProcess
();
OutProcess
();
}
else
if
(
runStatus
==
RunStatus
.
HomeReset
)
...
...
@@ -339,7 +348,27 @@ namespace DeviceLibrary
bool
lastSafeCheckStatus
=
true
;
bool
SafeCheck
()
{
bool
ok
=
true
;
if
(
IOValue
(
IO_Type
.
InSide_SafetyGrating
).
Equals
(
IO_VALUE
.
LOW
))
if
(
IOValue
(
IO_Type
.
InEntry_SafetyGrating
).
Equals
(
IO_VALUE
.
LOW
))
{
if
(!
IgnoreSafecheck
&&
!
IgnoreGratingSignal
&&
IOValue
(
IO_Type
.
InFrontCar_Check
).
Equals
(
IO_VALUE
.
LOW
))
{
ok
=
false
;
DeviceSuddenStop
();
}
Msg
.
add
(
"安全光栅被遮挡"
+
(
ok
?
"[已忽略]"
:
""
),
MsgLevel
.
warning
);
}
else
if
(
IOValue
(
IO_Type
.
OutExit_SafetyGrating
).
Equals
(
IO_VALUE
.
LOW
))
{
if
(!
IgnoreSafecheck
&&
!
IgnoreGratingSignal
&&
IOValue
(
IO_Type
.
InFrontCar_Check
).
Equals
(
IO_VALUE
.
LOW
))
{
ok
=
false
;
DeviceSuddenStop
();
}
Msg
.
add
(
"安全光栅被遮挡"
+
(
ok
?
"[已忽略]"
:
""
),
MsgLevel
.
warning
);
}
if
(
IOValue
(
IO_Type
.
InSide_SafetyGrating
).
Equals
(
IO_VALUE
.
LOW
))
{
if
(!
IgnoreSafecheck
&&
!
IgnoreGratingSignal
&&
IOValue
(
IO_Type
.
InFrontCar_Check
).
Equals
(
IO_VALUE
.
LOW
))
...
...
@@ -378,7 +407,7 @@ namespace DeviceLibrary
}
Msg
.
add
(
"后门没有关闭"
+
(
ok
?
"[已忽略]"
:
""
),
MsgLevel
.
warning
);
}
lastSafeCheckStatus
=
ok
;
return
ok
;
}
...
...
@@ -389,13 +418,18 @@ namespace DeviceLibrary
//AxisBean.StopMultiAxis(new List<AxisBean>() { Take_Middle_Axis, Take_UpDown_Axis, Label_X_Axis,Label_Y_Axis, Label_Z_Axis, Label_R_Axis });
AxisBean
.
StopMultiAxis
(
AxisBean
.
List
);
MoveInfo
.
List
.
ForEach
((
m
)
=>
{
m
.
CanWhileCount
=
5
;
});
LineIn
.
Pause
();
LineOut
.
Pause
();
if
(
runStatus
==
RunStatus
.
HomeReset
)
{
ResetMoveInfo
.
NewMove
(
MoveStep
.
H01_HomeReset
);
}
}
}
void
DeviceResume
()
{
LineIn
.
Resume
();
LineOut
.
Resume
();
}
/// <summary>
/// 最后一次气压检测变为0的时间
...
...
DeviceLibrary/theMachine/MoveStep.cs
查看文件 @
a1958cc
...
...
@@ -34,6 +34,8 @@ namespace DeviceLibrary
In06
,
In07
,
In08
,
In09
,
In10
,
InWaitBoxLeave
,
//等待料箱入库
InBoxLeaved
,
//料箱已取走
InOverHead
,
...
...
TheMachine/UC/uc_boxdebug.Designer.cs
查看文件 @
a1958cc
...
...
@@ -39,6 +39,7 @@ namespace TheMachine
this
.
timer1
=
new
System
.
Windows
.
Forms
.
Timer
(
this
.
components
);
this
.
dataGridView1
=
new
System
.
Windows
.
Forms
.
DataGridView
();
this
.
storePosControl1
=
new
TheMachine
.
StorePosControl
();
this
.
btn_autoinout
=
new
System
.
Windows
.
Forms
.
Button
();
this
.
groupInout
.
SuspendLayout
();
((
System
.
ComponentModel
.
ISupportInitialize
)(
this
.
dataGridView1
)).
BeginInit
();
this
.
SuspendLayout
();
...
...
@@ -46,6 +47,7 @@ namespace TheMachine
// groupInout
//
this
.
groupInout
.
Controls
.
Add
(
this
.
cb_inoutdebugmode
);
this
.
groupInout
.
Controls
.
Add
(
this
.
btn_autoinout
);
this
.
groupInout
.
Controls
.
Add
(
this
.
btnInStore
);
this
.
groupInout
.
Controls
.
Add
(
this
.
btnOutStore
);
this
.
groupInout
.
Location
=
new
System
.
Drawing
.
Point
(
2
,
315
);
...
...
@@ -152,6 +154,20 @@ namespace TheMachine
this
.
storePosControl1
.
TabIndex
=
225
;
this
.
storePosControl1
.
Tag
=
"not"
;
//
// btn_autoinout
//
this
.
btn_autoinout
.
BackColor
=
System
.
Drawing
.
SystemColors
.
Control
;
this
.
btn_autoinout
.
Enabled
=
false
;
this
.
btn_autoinout
.
FlatStyle
=
System
.
Windows
.
Forms
.
FlatStyle
.
Flat
;
this
.
btn_autoinout
.
Font
=
new
System
.
Drawing
.
Font
(
"微软雅黑"
,
9F
,
System
.
Drawing
.
FontStyle
.
Regular
,
System
.
Drawing
.
GraphicsUnit
.
Point
,
((
byte
)(
134
)));
this
.
btn_autoinout
.
Location
=
new
System
.
Drawing
.
Point
(
6
,
162
);
this
.
btn_autoinout
.
Name
=
"btn_autoinout"
;
this
.
btn_autoinout
.
Size
=
new
System
.
Drawing
.
Size
(
173
,
32
);
this
.
btn_autoinout
.
TabIndex
=
102
;
this
.
btn_autoinout
.
Text
=
"自动库位测试"
;
this
.
btn_autoinout
.
UseVisualStyleBackColor
=
false
;
this
.
btn_autoinout
.
Click
+=
new
System
.
EventHandler
(
this
.
btn_autoinout_Click
);
//
// uc_boxdebug
//
this
.
AutoScaleDimensions
=
new
System
.
Drawing
.
SizeF
(
6F
,
12F
);
...
...
@@ -182,5 +198,6 @@ namespace TheMachine
private
System
.
Windows
.
Forms
.
Label
label_size
;
private
StorePosControl
storePosControl1
;
private
System
.
Windows
.
Forms
.
CheckBox
cb_inoutdebugmode
;
private
System
.
Windows
.
Forms
.
Button
btn_autoinout
;
}
}
TheMachine/UC/uc_boxdebug.cs
查看文件 @
a1958cc
...
...
@@ -34,11 +34,6 @@ namespace TheMachine
Init
();
}
}
private
string
StartAuto
{
get
=>
"开始自动出入库"
;
}
private
string
StopAuto
{
get
=>
"停止自动出入库"
;
}
private
string
AutoOut
{
get
=>
"自动出库:"
;
}
private
string
AutoIn
{
get
=>
"自动入库:"
;
}
public
static
readonly
ILog
LOGGER
=
LogManager
.
GetLogger
(
MethodBase
.
GetCurrentMethod
().
DeclaringType
);
Dictionary
<
string
,
PosState
>
posState
=
new
Dictionary
<
string
,
PosState
>();
//如果总配置文件存在,保存到总的配置文件
static
string
appPath
=
Application
.
StartupPath
;
...
...
@@ -51,7 +46,6 @@ namespace TheMachine
public
uc_boxdebug
()
{
InitializeComponent
();
}
public
void
Init
()
...
...
@@ -263,7 +257,8 @@ namespace TheMachine
string
selectPositionNum
=
cmbPosition
.
Text
;
JobInfo
jobInfo
=
new
JobInfo
(
"IN_TEST"
,
selectPositionNum
);
if
(!
RobotManage
.
mainMachine
.
StartInStore
(
jobInfo
))
{
MessageBox
.
Show
(
"周转箱没有到位"
);
MessageBox
.
Show
(
"周转箱没有到位,无法手动入库"
);
return
;
}
LogUtil
.
info
(
$
"手动入库:{selectPositionNum}"
);
}
...
...
@@ -278,7 +273,6 @@ namespace TheMachine
if
(
RobotManage
.
mainMachine
.
runStatus
==
RunStatus
.
Running
)
{
string
selectPositionNum
=
cmbPosition
.
Text
;
JobInfo
jobInfo
=
new
JobInfo
(
"IN_TEST"
,
selectPositionNum
);
if
(
RobotManage
.
mainMachine
.
boxTransportIsFree
)
{
LogUtil
.
info
(
$
"手动出库:{selectPositionNum}"
);
RobotManage
.
mainMachine
.
AddOutStoreTask
(
selectPositionNum
);
...
...
@@ -286,56 +280,13 @@ namespace TheMachine
else
{
MessageBox
.
Show
(
"料仓正在出入库中,无法手动出库"
);
}
}
}
else
{
MessageBox
.
Show
(
"请先启动料仓!"
);
}
}
private
void
btnStartAuTo_Click
(
object
sender
,
EventArgs
e
)
{
/*
if (RobotManage.storeRunStatus >= StoreRunStatus.HomeMoving)
{
if (store.autoNext)
{
store.autoNext = false;
btnStartAuTo.Text = StartAuto;
}
else
{
DialogResult res = MyMessage.Show("确定开始自动出入库?", "提示", MessageBoxButtons.YesNo);
if (res.Equals(DialogResult.Yes))
{
store.autoNext = true;
int jiange = FormUtil.GetIntValue(txtJiange);
store.autoJiange = jiange;
if (!string.IsNullOrEmpty(cmbPosition.Text))
{
int currIndex = store.PositionNumList.IndexOf(cmbPosition.Text); ;
store.autoPositionIndex = currIndex;
store.AutoStartIndex = currIndex;
store.Double_Alternate = checkBox_Double_Alternate.Checked;
store.Alternate = false;
store.hasDoublePlate = false;
string poText = cmbPosition.Text;
store.autoMsg = AutoIn + ":" + poText;
LogUtil.info(LOGGER, store.StoreName + "开启自动出入库模式,开始位置【" + poText + "】(索引=" + currIndex + "),间隔=" + jiange + ",入库开始!");
//store.StartOutStoreMove(new InOutStoreParam("", poText));
store.StartInStoreMove(new InOutStoreParam("", poText));
}
btnStartAuTo.Text = StopAuto;
}
}
}
else
{
MyMessage.Show("请先启动料仓!");
}*/
}
bool
preOpen
=
false
;
public
void
StoreOpenStatus
(
bool
isOpen
)
...
...
@@ -355,6 +306,21 @@ namespace TheMachine
if
(!
Visible
)
return
;
if
(!
cb_inoutdebugmode
.
Checked
)
return
;
if
(
RobotManage
.
mainMachine
.
AutoInOutTest
)
{
btnOutStore
.
Enabled
=
false
;
btnInStore
.
Enabled
=
false
;
btn_autoinout
.
Text
=
"停止自动库位测试"
;
}
else
{
btnOutStore
.
Enabled
=
true
;
btnInStore
.
Enabled
=
true
;
btn_autoinout
.
Text
=
"自动库位测试"
;
}
}
private
void
dataGridView1_CellContentClick
(
object
sender
,
DataGridViewCellEventArgs
e
)
{
...
...
@@ -376,6 +342,35 @@ namespace TheMachine
RobotManage
.
InoutDebugMode
=
cb_inoutdebugmode
.
Checked
;
btnInStore
.
Enabled
=
cb_inoutdebugmode
.
Checked
;
btnOutStore
.
Enabled
=
cb_inoutdebugmode
.
Checked
;
btn_autoinout
.
Enabled
=
cb_inoutdebugmode
.
Checked
;
}
private
void
btn_autoinout_Click
(
object
sender
,
EventArgs
e
)
{
if
(
RobotManage
.
mainMachine
.
AutoInOutTest
)
{
RobotManage
.
mainMachine
.
StopAutoInOutTest
();
MessageBox
.
Show
(
"自动出入库过程会再周转箱送至出口后自动停止"
);
return
;
}
if
(
RobotManage
.
mainMachine
.
runStatus
==
RunStatus
.
Running
)
{
DialogResult
res
=
MessageBox
.
Show
(
"确定开始自动库位测试?\n请确保料仓库位全部为空,请先在入口放入一个周转箱."
,
"提示"
,
MessageBoxButtons
.
YesNo
);
if
(
res
==
DialogResult
.
No
)
return
;
int
posindex
=
RobotManage
.
PositionNumList
.
IndexOf
(
cmbPosition
.
Text
);
if
(!
RobotManage
.
mainMachine
.
StartAutoInOutTest
(
posindex
,
out
string
errmsg
))
{
MessageBox
.
Show
(
errmsg
);
return
;
}
(
sender
as
Button
).
Text
=
"停止自动库位测试"
;
}
else
{
MessageBox
.
Show
(
"请先启动料仓!"
);
}
}
}
}
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论