Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
张东亮
/
SO1131-XLRStore
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
作业
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit e8dc6ad0
由
张东亮
编写于
2023-02-13 16:48:34 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
警告消息、图片保存
1 个父辈
15347405
显示空白字符变更
内嵌
并排
正在显示
6 个修改的文件
包含
117 行增加
和
65 行删除
source/DeviceLibrary/deviceLibrary/halcon/CodeManager.cs
source/DeviceLibrary/manager/model/DeviceStep.cs
source/DeviceLibrary/storeBean/EquipBase.cs
source/DeviceLibrary/storeBean/boxBean/BoxEquip.cs
source/DeviceLibrary/storeBean/boxBean/BoxEquip_InExecute.cs
source/DeviceLibrary/storeBean/boxBean/BoxEquip_OutExecute.cs
source/DeviceLibrary/deviceLibrary/halcon/CodeManager.cs
查看文件 @
e8dc6ad
...
@@ -151,31 +151,6 @@ namespace OnlineStore.DeviceLibrary
...
@@ -151,31 +151,6 @@ namespace OnlineStore.DeviceLibrary
string
r
=
""
;
string
r
=
""
;
bool
eyemNoCode
=
false
;
bool
eyemNoCode
=
false
;
//Task eyemtask = Task.Factory.StartNew(delegate {
// List<CodeInfo> tlci = EyemDecode.ModelDecoder(ref bmp);
// foreach (CodeInfo code in tlci)
// {
// //LogUtil.info(deviceName + " 【" + cameraName + "】[eyemDecode]" + code.CodeType + "(X: " + code.X + ",Y: " + code.Y + ") " + code.CodeStr);
// string str = CodeManager.ReplaceCode(code.CodeStr);
// if (!codeList.Contains(str))
// {
// codeList.Add(str);
// r = r + "##eyem|" + code.CodeType + "|" + str;
// if (!findRightCode)
// {
// findRightCode = HasRightCode(str);
// }
// }
// }
//});
////最多等待60秒
//bool taskResult = eyemtask.Wait(60000);
//if (!taskResult)
//{
// LogUtil.error(deviceName + " 【" + cameraName + "】eyem扫码超时");
// eyemNoCode = true;
//}
if
(!
isPreScan
)
if
(!
isPreScan
)
{
{
if
(!
findRightCode
)
if
(!
findRightCode
)
...
@@ -214,38 +189,6 @@ namespace OnlineStore.DeviceLibrary
...
@@ -214,38 +189,6 @@ namespace OnlineStore.DeviceLibrary
{
{
LogUtil
.
error
(
deviceName
+
" RemoteDecodeHelper扫码出错:"
+
ex
.
ToString
());
LogUtil
.
error
(
deviceName
+
" RemoteDecodeHelper扫码出错:"
+
ex
.
ToString
());
}
}
//List<CodeInfo> cc = new List<CodeInfo>();
//eyemNoCode = true;
//foreach (string codeType in codeTypeList)
//{
// //判断是否是一维码
// if (codeType.ToLower().Equals("barcode"))
// {
// cc = HDCodeHelper.DecodeBarCode(ho_Image);
// }
// else
// {
// cc = HDCodeHelper.DecodeCode(ho_Image, codeType, GetCodeParamFilePath(codeType), codeCount, timeOut);
// }
// foreach (CodeInfo c in cc)
// {
// string str = CodeManager.ReplaceCode(c.CodeStr);
// if (!codeList.Contains(str))
// {
// codeList.Add(str);
// r = r + "##halcon|" + codeType + "|" + str;
// if (!findRightCode)
// {
// findRightCode = HasRightCode(str);
// }
// }
// }
// if (findRightCodeBreak && findRightCode)
// {
// break;
// }
//}
}
}
//if (!findRightCode && SaveErrorImageToFile.Equals(1))
//if (!findRightCode && SaveErrorImageToFile.Equals(1))
if
((!
findRightCode
)
||
eyemNoCode
)
if
((!
findRightCode
)
||
eyemNoCode
)
...
@@ -262,8 +205,9 @@ namespace OnlineStore.DeviceLibrary
...
@@ -262,8 +205,9 @@ namespace OnlineStore.DeviceLibrary
// nameStr = "eyemTimeOut";
// nameStr = "eyemTimeOut";
//}
//}
SaveImageToFile
(
deviceName
,
cameraName
+
nameStr
,
bmp
);
Save
NG
ImageToFile
(
deviceName
,
cameraName
+
nameStr
,
bmp
);
}
}
SaveOKImageToFile
(
deviceName
,
cameraName
,
bmp
);
}
}
if
(
deviceName
!=
""
||
r
!=
""
)
if
(
deviceName
!=
""
||
r
!=
""
)
{
{
...
@@ -424,7 +368,7 @@ namespace OnlineStore.DeviceLibrary
...
@@ -424,7 +368,7 @@ namespace OnlineStore.DeviceLibrary
//if (codeList.Count() == 0)
//if (codeList.Count() == 0)
//{
//{
bitmapfilename
=
SaveImageToFile
(
"XLRClient"
,
cameraName
,
bmp
);
bitmapfilename
=
Save
OK
ImageToFile
(
"XLRClient"
,
cameraName
,
bmp
);
// }
// }
LogUtil
.
info
(
" 【"
+
cameraName
+
"】"
+
" 扫码完成【"
+
FormUtil
.
GetSpanStr
(
DateTime
.
Now
-
startTime
)
+
"】 :"
+
r
);
LogUtil
.
info
(
" 【"
+
cameraName
+
"】"
+
" 扫码完成【"
+
FormUtil
.
GetSpanStr
(
DateTime
.
Now
-
startTime
)
+
"】 :"
+
r
);
}
}
...
@@ -463,11 +407,35 @@ namespace OnlineStore.DeviceLibrary
...
@@ -463,11 +407,35 @@ namespace OnlineStore.DeviceLibrary
}
}
return
(
codeList
,
bitmapfilename
);
return
(
codeList
,
bitmapfilename
);
}
}
static
int
CntImgs
=
ConfigAppSettings
.
GetIntValue
(
"SaveImgCnt"
,
100
);
private
static
string
SaveNGImageToFile
(
string
deviceName
,
string
cameraName
,
Bitmap
bitmap
)
{
string
date
=
DateTime
.
Now
.
ToString
(
"HH-mm-ss-"
)
+
DateTime
.
Now
.
Millisecond
;
string
dire
=
@"\image\" + deviceName.Trim().Replace('_', '-') + @"
\
" + cameraName.Trim().Replace('_', '-').Replace(':', '-') + @"
\
NG
\
";
string
iamgeName
=
date
+
".bmp"
;
try
{
Bitmap
bit
=
(
Bitmap
)
bitmap
.
Clone
();
if
(
Directory
.
Exists
(
dire
).
Equals
(
false
))
{
Directory
.
CreateDirectory
(
dire
);
}
//deleteFiles(dire);
bit
.
Save
(
dire
+
iamgeName
,
ImageFormat
.
Bmp
);
bit
.
Dispose
();
LogUtil
.
info
(
deviceName
+
" 【"
+
cameraName
+
"】保存NG图片到【"
+
dire
+
iamgeName
+
"】成功"
);
private
static
string
SaveImageToFile
(
string
deviceName
,
string
cameraName
,
Bitmap
bitmap
)
}
catch
(
Exception
ex
)
{
LogUtil
.
error
(
"保存"
+
deviceName
+
" 【"
+
cameraName
+
"】NG图片到【"
+
dire
+
iamgeName
+
"】出错"
+
ex
.
ToString
());
}
return
dire
+
iamgeName
;
}
private
static
string
SaveOKImageToFile
(
string
deviceName
,
string
cameraName
,
Bitmap
bitmap
)
{
{
string
date
=
DateTime
.
Now
.
ToString
(
"HH-mm-ss-"
)
+
DateTime
.
Now
.
Millisecond
;
string
date
=
DateTime
.
Now
.
ToString
(
"HH-mm-ss-"
)
+
DateTime
.
Now
.
Millisecond
;
string
dire
=
@"\image\" + deviceName.Trim().Replace('_', '-') + @"
\
" + cameraName.Trim().Replace('_', '-').Replace(':', '-') + @"
\
";
string
dire
=
@"\image\" + deviceName.Trim().Replace('_', '-') + @"
\
" + cameraName.Trim().Replace('_', '-').Replace(':', '-') + @"
\
OK
\
";
string
iamgeName
=
date
+
".bmp"
;
string
iamgeName
=
date
+
".bmp"
;
try
try
{
{
...
@@ -476,17 +444,65 @@ namespace OnlineStore.DeviceLibrary
...
@@ -476,17 +444,65 @@ namespace OnlineStore.DeviceLibrary
{
{
Directory
.
CreateDirectory
(
dire
);
Directory
.
CreateDirectory
(
dire
);
}
}
deleteFiles
(
dire
);
bit
.
Save
(
dire
+
iamgeName
,
ImageFormat
.
Bmp
);
bit
.
Save
(
dire
+
iamgeName
,
ImageFormat
.
Bmp
);
bit
.
Dispose
();
bit
.
Dispose
();
LogUtil
.
info
(
deviceName
+
" 【"
+
cameraName
+
"】
扫码完成,保存
图片到【"
+
dire
+
iamgeName
+
"】成功"
);
LogUtil
.
info
(
deviceName
+
" 【"
+
cameraName
+
"】
保存OK
图片到【"
+
dire
+
iamgeName
+
"】成功"
);
}
}
catch
(
Exception
ex
)
catch
(
Exception
ex
)
{
{
LogUtil
.
error
(
"保存"
+
deviceName
+
" 【"
+
cameraName
+
"】
的
图片到【"
+
dire
+
iamgeName
+
"】出错"
+
ex
.
ToString
());
LogUtil
.
error
(
"保存"
+
deviceName
+
" 【"
+
cameraName
+
"】
OK
图片到【"
+
dire
+
iamgeName
+
"】出错"
+
ex
.
ToString
());
}
}
return
dire
+
iamgeName
;
return
dire
+
iamgeName
;
}
}
static
Task
deleteTask
=
null
;
static
void
deleteFiles
(
string
dire
)
{
if
((
deleteTask
==
null
)||
(
deleteTask
!=
null
&&
deleteTask
.
IsCompleted
))
{
deleteTask
=
Task
.
Factory
.
StartNew
(()
=>
{
try
{
string
[]
imgFiles
=
Directory
.
GetFiles
(
dire
);
if
(
imgFiles
.
Length
>
CntImgs
)
{
FileInfo
fileInfo
;
List
<
FileInfo
>
files
=
new
List
<
FileInfo
>();
foreach
(
var
item
in
imgFiles
)
{
fileInfo
=
new
FileInfo
(
item
);
files
.
Add
(
fileInfo
);
}
do
{
FileInfo
oldFile
=
files
[
0
];
foreach
(
var
item
in
files
)
{
if
((
item
.
CreationTime
-
oldFile
.
CreationTime
).
Seconds
<
0
)
{
oldFile
=
item
;
}
}
oldFile
?.
Delete
();
}
while
(
files
.
Count
>
CntImgs
)
;
}
}
catch
(
Exception
ex
)
{
LogUtil
.
error
(
"删除文件失败"
,
ex
);
}
});
}
else
{
LogUtil
.
info
(
"延迟删除文件夹内的文件:"
+
dire
);
}
}
public
static
void
DelImg
(
string
deviceName
,
string
imgPath
)
public
static
void
DelImg
(
string
deviceName
,
string
imgPath
)
{
{
try
try
...
...
source/DeviceLibrary/manager/model/DeviceStep.cs
查看文件 @
e8dc6ad
...
@@ -1391,6 +1391,10 @@ namespace OnlineStore.DeviceLibrary
...
@@ -1391,6 +1391,10 @@ namespace OnlineStore.DeviceLibrary
/// <summary>
/// <summary>
/// 机器人报错
/// 机器人报错
/// </summary>
/// </summary>
RobotError
RobotError
,
/// <summary>
/// 警告消息
/// </summary>
AlarmMsg
,
}
}
}
}
source/DeviceLibrary/storeBean/EquipBase.cs
查看文件 @
e8dc6ad
...
@@ -543,7 +543,7 @@ namespace OnlineStore.DeviceLibrary
...
@@ -543,7 +543,7 @@ namespace OnlineStore.DeviceLibrary
CheckAndMove
(
IO_Type
.
Alarm_Buzzer
,
IO_VALUE
.
LOW
);
CheckAndMove
(
IO_Type
.
Alarm_Buzzer
,
IO_VALUE
.
LOW
);
}
}
protected
AlarmType
alarmRedLedType
=
AlarmType
.
AxisAlarm
;
protected
AlarmType
alarmRedLedType
=
AlarmType
.
IoSingleTimeOut
;
protected
void
LedProcess
(
object
sender
,
ElapsedEventArgs
e
)
protected
void
LedProcess
(
object
sender
,
ElapsedEventArgs
e
)
{
{
try
try
...
@@ -773,6 +773,12 @@ namespace OnlineStore.DeviceLibrary
...
@@ -773,6 +773,12 @@ namespace OnlineStore.DeviceLibrary
{
{
SetWarnMsg
(
""
);
SetWarnMsg
(
""
);
}
}
if
(
WarnMsg
.
Contains
(
msg
)
&&
alarmType
.
Equals
(
AlarmType
.
AlarmMsg
))
{
LogUtil
.
info
(
Name
+
"清理异常消息报警【"
+
WarnMsg
+
"】 "
);
alarmType
=
AlarmType
.
None
;
SetWarnMsg
(
""
);
}
}
}
protected
void
ClearTimeoutAlarm
(
string
msg
)
protected
void
ClearTimeoutAlarm
(
string
msg
)
{
{
...
@@ -786,6 +792,12 @@ namespace OnlineStore.DeviceLibrary
...
@@ -786,6 +792,12 @@ namespace OnlineStore.DeviceLibrary
alarmType
=
AlarmType
.
None
;
alarmType
=
AlarmType
.
None
;
SetWarnMsg
(
""
);
SetWarnMsg
(
""
);
}
}
if
(
WarnMsg
.
Contains
(
msg
)
&&
alarmType
.
Equals
(
AlarmType
.
AlarmMsg
))
{
LogUtil
.
info
(
Name
+
"清理异常消息报警【"
+
WarnMsg
+
"】 "
);
alarmType
=
AlarmType
.
None
;
SetWarnMsg
(
""
);
}
}
}
public
Color
GetShowColor
()
public
Color
GetShowColor
()
{
{
...
...
source/DeviceLibrary/storeBean/boxBean/BoxEquip.cs
查看文件 @
e8dc6ad
...
@@ -709,7 +709,11 @@ namespace OnlineStore.DeviceLibrary
...
@@ -709,7 +709,11 @@ namespace OnlineStore.DeviceLibrary
if
(
IOValue
(
IO_Type
.
FeedA_ReelCheck
).
Equals
(
IO_VALUE
.
LOW
)
&&
BufferDataManager
.
AInStoreInfo
!=
null
)
if
(
IOValue
(
IO_Type
.
FeedA_ReelCheck
).
Equals
(
IO_VALUE
.
LOW
)
&&
BufferDataManager
.
AInStoreInfo
!=
null
)
{
{
if
(
tsUppA
.
TotalSeconds
>
errSeconds
)
if
(
tsUppA
.
TotalSeconds
>
errSeconds
)
{
SetWarnMsg
(
"A上进料暂存区有料盘,但信号未亮"
);
SetWarnMsg
(
"A上进料暂存区有料盘,但信号未亮"
);
Alarm
(
AlarmType
.
AlarmMsg
);
}
}
}
else
else
{
{
...
@@ -719,8 +723,12 @@ namespace OnlineStore.DeviceLibrary
...
@@ -719,8 +723,12 @@ namespace OnlineStore.DeviceLibrary
if
(
IOValue
(
IO_Type
.
LineA_ReelInPlaceCheck
).
Equals
(
IO_VALUE
.
LOW
)
&&
BufferDataManager
.
AOutStoreInfo
!=
null
)
if
(
IOValue
(
IO_Type
.
LineA_ReelInPlaceCheck
).
Equals
(
IO_VALUE
.
LOW
)
&&
BufferDataManager
.
AOutStoreInfo
!=
null
)
{
{
if
(
tsUnA
.
TotalSeconds
>
errSeconds
)
if
(
tsUnA
.
TotalSeconds
>
errSeconds
)
{
Alarm
(
AlarmType
.
AlarmMsg
);
SetWarnMsg
(
"A下出料暂存区有料盘,但信号未亮"
);
SetWarnMsg
(
"A下出料暂存区有料盘,但信号未亮"
);
}
}
}
else
else
{
{
ClearSpecifiedAlarm
(
"A下出料暂存区有料盘,但信号未亮"
);
ClearSpecifiedAlarm
(
"A下出料暂存区有料盘,但信号未亮"
);
...
@@ -729,8 +737,12 @@ namespace OnlineStore.DeviceLibrary
...
@@ -729,8 +737,12 @@ namespace OnlineStore.DeviceLibrary
if
(
IOValue
(
IO_Type
.
FeedB_ReelCheck
).
Equals
(
IO_VALUE
.
LOW
)
&&
BufferDataManager
.
BInStoreInfo
!=
null
)
if
(
IOValue
(
IO_Type
.
FeedB_ReelCheck
).
Equals
(
IO_VALUE
.
LOW
)
&&
BufferDataManager
.
BInStoreInfo
!=
null
)
{
{
if
(
tsUppB
.
TotalSeconds
>
errSeconds
)
if
(
tsUppB
.
TotalSeconds
>
errSeconds
)
{
Alarm
(
AlarmType
.
AlarmMsg
);
SetWarnMsg
(
"B上进料暂存区有料盘,但信号未亮"
);
SetWarnMsg
(
"B上进料暂存区有料盘,但信号未亮"
);
}
}
}
else
else
{
{
ClearSpecifiedAlarm
(
"B上进料暂存区有料盘,但信号未亮"
);
ClearSpecifiedAlarm
(
"B上进料暂存区有料盘,但信号未亮"
);
...
@@ -739,8 +751,12 @@ namespace OnlineStore.DeviceLibrary
...
@@ -739,8 +751,12 @@ namespace OnlineStore.DeviceLibrary
if
(
IOValue
(
IO_Type
.
LineB_ReelInPlaceCheck
).
Equals
(
IO_VALUE
.
LOW
)
&&
BufferDataManager
.
BOutStoreInfo
!=
null
)
if
(
IOValue
(
IO_Type
.
LineB_ReelInPlaceCheck
).
Equals
(
IO_VALUE
.
LOW
)
&&
BufferDataManager
.
BOutStoreInfo
!=
null
)
{
{
if
(
tsUnB
.
TotalSeconds
>
errSeconds
)
if
(
tsUnB
.
TotalSeconds
>
errSeconds
)
{
Alarm
(
AlarmType
.
AlarmMsg
);
SetWarnMsg
(
"B下出料暂存区有料盘,但信号未亮"
);
SetWarnMsg
(
"B下出料暂存区有料盘,但信号未亮"
);
}
}
}
else
else
{
{
ClearSpecifiedAlarm
(
"B下出料暂存区有料盘,但信号未亮"
);
ClearSpecifiedAlarm
(
"B下出料暂存区有料盘,但信号未亮"
);
...
...
source/DeviceLibrary/storeBean/boxBean/BoxEquip_InExecute.cs
查看文件 @
e8dc6ad
...
@@ -63,6 +63,7 @@ namespace OnlineStore.DeviceLibrary
...
@@ -63,6 +63,7 @@ namespace OnlineStore.DeviceLibrary
if
(!
param
.
PosInfo
.
CheckPosition
())
if
(!
param
.
PosInfo
.
CheckPosition
())
{
{
Alarm
(
AlarmType
.
AlarmMsg
);
SetWarnMsg
(
Name
+
" 启动入库【"
+
param
.
PosInfo
.
ToStr
()
+
"】出错,找不到库位信息"
);
SetWarnMsg
(
Name
+
" 启动入库【"
+
param
.
PosInfo
.
ToStr
()
+
"】出错,找不到库位信息"
);
return
false
;
return
false
;
}
}
...
@@ -76,6 +77,7 @@ namespace OnlineStore.DeviceLibrary
...
@@ -76,6 +77,7 @@ namespace OnlineStore.DeviceLibrary
if
(!
ReviceInStoreCMD
(
param
.
PosInfo
.
PosId
,
param
.
PosInfo
.
PlateH
,
param
.
PosInfo
.
PlateW
,
param
.
PosInfo
.
barcode
))
if
(!
ReviceInStoreCMD
(
param
.
PosInfo
.
PosId
,
param
.
PosInfo
.
PlateH
,
param
.
PosInfo
.
PlateW
,
param
.
PosInfo
.
barcode
))
{
{
SetWarnMsg
(
$
" 入库验证失败:{param.PosInfo.ToStr()}"
);
SetWarnMsg
(
$
" 入库验证失败:{param.PosInfo.ToStr()}"
);
Alarm
(
AlarmType
.
AlarmMsg
);
return
false
;
return
false
;
}
}
else
else
...
@@ -86,6 +88,7 @@ namespace OnlineStore.DeviceLibrary
...
@@ -86,6 +88,7 @@ namespace OnlineStore.DeviceLibrary
{
{
if
(!
ReviceInStoreCMD
(
param
.
PosInfoBack
.
PosId
,
param
.
PosInfoBack
.
PlateH
,
param
.
PosInfoBack
.
PlateW
,
param
.
PosInfoBack
.
barcode
))
if
(!
ReviceInStoreCMD
(
param
.
PosInfoBack
.
PosId
,
param
.
PosInfoBack
.
PlateH
,
param
.
PosInfoBack
.
PlateW
,
param
.
PosInfoBack
.
barcode
))
{
{
Alarm
(
AlarmType
.
AlarmMsg
);
SetWarnMsg
(
$
" 入库验证失败:{param.PosInfoBack.ToStr()}"
);
SetWarnMsg
(
$
" 入库验证失败:{param.PosInfoBack.ToStr()}"
);
return
false
;
return
false
;
}
}
...
...
source/DeviceLibrary/storeBean/boxBean/BoxEquip_OutExecute.cs
查看文件 @
e8dc6ad
...
@@ -280,6 +280,7 @@ namespace OnlineStore.DeviceLibrary
...
@@ -280,6 +280,7 @@ namespace OnlineStore.DeviceLibrary
}
}
else
if
(
MoveInfo
.
IsTimeOut
(
30
))
else
if
(
MoveInfo
.
IsTimeOut
(
30
))
{
{
Alarm
(
AlarmType
.
AlarmMsg
);
SetWarnMsg
(
$
"等待皮带线无料盘超时"
);
SetWarnMsg
(
$
"等待皮带线无料盘超时"
);
}
}
break
;
break
;
...
...
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论