Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
刘韬
/
SO20242OutBound
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
作业
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit 346d986b
由
LN
编写于
2023-07-02 21:50:12 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
1
1 个父辈
2c170ea6
隐藏空白字符变更
内嵌
并排
正在显示
8 个修改的文件
包含
66 行增加
和
43 行删除
Common/Setting_Init.cs
DeviceLibrary/DeviceLibrary/CodeManager.cs
DeviceLibrary/DeviceLibrary/HttpServer.cs
DeviceLibrary/DeviceLibrary/ReelParam.cs
DeviceLibrary/theMachine/MainMachine.cs
DeviceLibrary/theMachine/MainMachine_PutReel.cs
DeviceLibrary/theMachine/OutShelfBean.cs
TheMachine/Program.cs
Common/Setting_Init.cs
查看文件 @
346d986
...
...
@@ -77,7 +77,7 @@ namespace OnlineStore.Common
public
static
MyConfig
<
int
>
CameraScan_QRCodeCount
=
3
;
[
MyConfigComment
(
"二维码扫码超时毫秒"
)]
public
static
MyConfig
<
int
>
CameraScan_CodeTimeOut
=
3000
;
public
static
MyConfig
<
bool
>
R_IsPutReel
;
public
static
MyConfig
<
string
>
R_WareCode
;
...
...
DeviceLibrary/DeviceLibrary/CodeManager.cs
查看文件 @
346d986
...
...
@@ -185,16 +185,15 @@ namespace DeviceLibrary
}
}
[
HandleProcessCorruptedStateExceptions
]
public
static
List
<
CodeInfo
>
CameraScan
(
List
<
string
>
cameraNameList
)
{
{
HashSet
<
string
>
codestr
=
new
HashSet
<
string
>();
List
<
CodeInfo
>
codeList
=
new
List
<
CodeInfo
>();
string
bitmapfilename
=
""
;
if
(
cameraNameList
==
null
||
cameraNameList
.
Count
<=
0
)
{
return
codeList
;
throw
new
Exception
(
"CameraScan方法没有传入相机名称."
);
}
...
...
@@ -213,8 +212,8 @@ namespace DeviceLibrary
if
(
cameraName
.
Trim
().
Equals
(
""
))
{
return
;
}
DateTime
startTime
=
DateTime
.
Now
;
}
DateTime
startTime
=
DateTime
.
Now
;
HalconDotNet
.
HObject
ho_Image
=
null
;
Bitmap
bmp
=
null
;
try
...
...
@@ -228,7 +227,7 @@ namespace DeviceLibrary
retrytime
++;
CloseCamera
(
cameraName
);
LogUtil
.
info
(
$
"bitmap为空重试第{retrytime}次"
);
Task
.
Delay
(
1500
).
Wait
();
Task
.
Delay
(
1500
).
Wait
();
goto
retry
;
}
//HalconDotNet.HOperatorSet.RotateImage()
...
...
@@ -238,7 +237,7 @@ namespace DeviceLibrary
CloseCamera
(
cameraName
);
return
;
}
if
(
idx
==
0
)
if
(
idx
==
0
)
camera_event
?.
Invoke
(
null
,
bmp
);
LogUtil
.
info
(
" 【"
+
cameraName
+
"】取图片完成,开始扫码"
);
string
r
=
""
;
...
...
@@ -294,29 +293,37 @@ namespace DeviceLibrary
}
}));
Task
.
Delay
(
ii
*
7
00
).
Wait
();
Task
.
Delay
(
5
00
).
Wait
();
}
while
(!
cameraTask
[
0
].
IsCompleted
)
bool
isfinish
=
false
;
while
(!
isfinish
)
{
Application
.
DoEvents
();
Thread
.
Sleep
(
100
);
isfinish
=
true
;
for
(
int
i
=
0
;
i
<
cameraTask
.
Count
();
i
++)
{
if
(!
cameraTask
[
i
].
IsCompleted
)
{
isfinish
=
false
;
Application
.
DoEvents
();
Thread
.
Sleep
(
100
);
}
}
}
}
catch
(
AccessViolationException
e
)
{
LogUtil
.
error
(
" 扫码出现AccessViolationException异常:"
+
e
.
ToString
());
LogUtil
.
error
(
" 扫码出现AccessViolationException异常:"
+
e
.
ToString
());
//throw new Exception("扫码出现AccessViolationException异常");
// GC.Collect();
}
catch
(
Exception
ex
)
{
LogUtil
.
error
(
" 扫码出错:"
+
ex
.
ToString
());
LogUtil
.
error
(
" 扫码出错:"
+
ex
.
ToString
());
//throw new Exception("扫码出错");
}
return
codeList
;
}
/// <summary>
///
/// </summary>
...
...
DeviceLibrary/DeviceLibrary/HttpServer.cs
查看文件 @
346d986
...
...
@@ -244,8 +244,8 @@ namespace DeviceLibrary
return
tray
;
}
tray
=
JsonHelper
.
DeserializeJsonToObject
<
TrayInfo
>(
data
.
data
.
ToString
()
);
string
dataStr
=
JsonHelper
.
SerializeObject
(
data
.
data
);
tray
=
JsonHelper
.
DeserializeJsonToObject
<
TrayInfo
>(
data
Str
);
if
(
tray
==
null
||
tray
.
rfid
==
""
||
tray
.
rfidLoc
==
0
)
{
//msg = "获取位置失败";
...
...
DeviceLibrary/DeviceLibrary/ReelParam.cs
查看文件 @
346d986
...
...
@@ -26,7 +26,8 @@ public class ReelParam
TargetOutShelf
=
posArray
[
0
];
if
(
TargetOutShelf
!=
"NG"
)
{
TargetLoc
=
posArray
[
1
];
//取最后一位
TargetLoc
=
posArray
[
posArray
.
Length
-
1
];
}
}
}
...
...
DeviceLibrary/theMachine/MainMachine.cs
查看文件 @
346d986
...
...
@@ -738,11 +738,13 @@ namespace DeviceLibrary
ACStorePosition
position
=
CSVPositionReader
<
ACStorePosition
>.
GetPositon
(
pName
);
if
(
position
==
null
)
{
LogUtil
.
error
(
Name
+
" "
+
tray
.
ToStr
()
+
" 找到匹配料架,但未找到库位号:"
+
pName
+
",查找库位号:"
+
targetPosName
);
//判断库位号是否存在
position
=
CSVPositionReader
<
ACStorePosition
>.
GetPositon
(
targetPosName
);
if
(
position
==
null
)
{
LogUtil
.
error
(
Name
+
" "
+
tray
.
ToStr
()
+
" 找到匹配料架,但未找到库位号:"
+
position
);
LogUtil
.
error
(
Name
+
" "
+
tray
.
ToStr
()
+
" 找到匹配料架,但未找到库位号:"
+
targetPosName
);
WarnMsg
=
tray
.
barcode
+
"未找到库位号:"
+
position
;
targetPosName
=
""
;
break
;
...
...
@@ -750,8 +752,16 @@ namespace DeviceLibrary
}
targetPosName
=
position
.
PositionNum
;
LogUtil
.
info
(
Name
+
" "
+
tray
.
ToStr
()
+
" 使用料架:"
+
targetPosName
+
",更改料架为忙碌状态,开始放料"
);
obj
.
StartPutReel
();
bool
result
=
obj
.
StartPutReel
();
if
(
result
)
{
LogUtil
.
info
(
Name
+
" "
+
tray
.
ToStr
()
+
" 使用料架:"
+
targetPosName
+
",更改料架为忙碌状态,开始放料 成功"
);
return
targetPosName
;
}
else
{
LogUtil
.
info
(
Name
+
" "
+
tray
.
ToStr
()
+
" 使用料架:"
+
targetPosName
+
",更改料架为忙碌状态,开始放料 失败"
);
}
break
;
}
}
...
...
DeviceLibrary/theMachine/MainMachine_PutReel.cs
查看文件 @
346d986
...
...
@@ -161,7 +161,7 @@ namespace DeviceLibrary
else
{
OutShelfBean
bean
=
getOutShelf
(
StoreMoveInfo
.
MoveParam
.
TargetOutShelf
);
//通知服务器放料完成
ShelfTaskInfo
taskInfo
=
HttpServer
.
ShelfFinish
(
bean
.
CurrShelf
.
realRFID
,
StoreMoveInfo
.
MoveParam
.
WareCode
,
StoreMoveInfo
.
MoveParam
.
TargetLoc
);
bean
.
PutReelOk
(
taskInfo
);
...
...
DeviceLibrary/theMachine/OutShelfBean.cs
查看文件 @
346d986
...
...
@@ -170,7 +170,8 @@ namespace DeviceLibrary
if
(
ShelfReady
())
{
MoveInfo
.
NextMoveStep
(
MoveStep
.
S11_PutReel
);
MoveInfo
.
log
(
"开始放料"
);
MoveInfo
.
log
(
"开始放料 ,设置 CurrShelf.IsBusy = true"
);
CurrShelf
.
IsBusy
=
true
;
return
true
;
}
return
false
;
...
...
@@ -178,29 +179,31 @@ namespace DeviceLibrary
public
void
PutReelOk
(
ShelfTaskInfo
taskInfo
)
{
if
(
ShelfReady
())
//if (ShelfReady())
//{
if
(
MoveInfo
.
MoveStep
.
Equals
(
MoveStep
.
S11_PutReel
))
{
if
(
MoveInfo
.
MoveStep
.
Equals
(
MoveStep
.
S11_PutReel
))
{
if
(
taskInfo
.
IsValid
())
CurrShelf
.
IsBusy
=
false
;
//TODO 暂不判断是否返回成功
//if (taskInfo.IsValid())
{
if
(
taskInfo
.
smallEmpty
==
0
&&
taskInfo
.
bigEmpty
==
0
)
{
if
(
taskInfo
.
smallEmpty
==
0
&&
taskInfo
.
bigEmpty
==
0
)
{
//MoveInfo.NextMoveStep(MoveStep.S10_ShelfReady);
//CurrShelf.IsNeedLeave = true;
//当前工单任务已完成,直接送料架离开
MoveInfo
.
log
(
"放料完成,当前工单任务已完成,剩余空位=0,料架需要离开:"
+
taskInfo
.
ToStr
());
S21_ShelfNeedLeave
(
"剩余空位=0"
);
}
else
{
MoveInfo
.
NextMoveStep
(
MoveStep
.
S10_ShelfReady
);
MoveInfo
.
log
(
"放料完成,料架还有空位,准备放料完成"
);
}
//MoveInfo.NextMoveStep(MoveStep.S10_ShelfReady);
//CurrShelf.IsNeedLeave = true;
//当前工单任务已完成,直接送料架离开
MoveInfo
.
log
(
"放料完成 ,设置CurrShelf.IsBusy = false,当前工单任务已完成,剩余空位=0,料架需要离开:"
+
taskInfo
.
ToStr
());
S21_ShelfNeedLeave
(
"剩余空位=0"
);
}
else
{
MoveInfo
.
NextMoveStep
(
MoveStep
.
S10_ShelfReady
);
MoveInfo
.
log
(
"放料完成,设置CurrShelf.IsBusy = false,料架还有空位,准备放料完成"
);
}
}
//}
}
}
...
...
TheMachine/Program.cs
查看文件 @
346d986
using
ConfigHelper
;
using
DeviceLibrary
;
using
log4net.Config
;
//using Microsoft.Win32.TaskScheduler;
using
OnlineStore.Common
;
...
...
@@ -23,7 +24,8 @@ namespace TheMachine
[
STAThread
]
static
void
Main
()
{
//string resultStr = "{\"code\":0,\"data\":{\"w\":7,\"realRfid\":\"\",\"h\":12,\"rfid\":\"1-1F\",\"usedRfidList\":\"\",\"rfidLoc\":2,\"barcode\":\"34005600000807\"},\"msg\":\"ok\",\"msgKey\":\"smfcore.ok\",\"okResult\":true,\"params\":[]}";
// ResultData data = JsonHelper.DeserializeJsonToObject<ResultData>(resultStr);
_
=
new
Mutex
(
true
,
Application
.
ProductName
,
out
bool
ret
);
if
(!
ret
)
{
...
...
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论