Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
孙克
/
RC1250-ACPackingStore
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
作业
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit c29089ae
由
LN
编写于
2020-08-06 14:20:44 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
扫码NG图片保存到文件夹。
1 个父辈
85c6a587
隐藏空白字符变更
内嵌
并排
正在显示
6 个修改的文件
包含
110 行增加
和
43 行删除
source/ACPackingStore/Program.cs
source/DeviceLibrary/ACPackingStore/AC_BOX_Bean_Partial.cs
source/DeviceLibrary/ACPackingStore/AC_BOX_Bean_Shelf.cs
source/DeviceLibrary/device/halcon/CodeManager.cs
source/DeviceLibrary/store/KTK_Store.cs
source/DeviceLibrary/store/model/StoreMoveInfo.cs
source/ACPackingStore/Program.cs
查看文件 @
c29089a
...
...
@@ -93,6 +93,7 @@ namespace OnlineStore.ACPackingStore
}
if
(!
isShow
)
{
System
.
Net
.
ServicePointManager
.
DefaultConnectionLimit
=
512
;
XmlConfigurator
.
Configure
();
Application
.
EnableVisualStyles
();
Application
.
SetCompatibleTextRenderingDefault
(
false
);
...
...
source/DeviceLibrary/ACPackingStore/AC_BOX_Bean_Partial.cs
查看文件 @
c29089a
...
...
@@ -378,7 +378,7 @@ namespace OnlineStore.DeviceLibrary
private
void
StartSendTray
(
string
str
=
"扫码失败"
)
{
MoveInfo
.
NextMoveStep
(
StoreMoveStep
.
BI_71_ToNGDoor
);
InOutStoreLog
(
"
送出料盘
"
+
MoveInfo
.
SLog
+
":"
+
str
+
",升降轴到NG门口高点P12,旋转轴到NG门口P11"
);
InOutStoreLog
(
"
NG料
"
+
MoveInfo
.
SLog
+
":"
+
str
+
",升降轴到NG门口高点P12,旋转轴到NG门口P11"
);
if
(
MoveInfo
.
IsShelfLocked
)
//锁定料架,扫码失败则清除当前位置
{
StoreManager
.
ClearLockLoc
(
Name
,
CurrShelfID
,
MoveInfo
.
currShelfIndex
);
...
...
@@ -458,13 +458,13 @@ namespace OnlineStore.DeviceLibrary
else
if
(
MoveInfo
.
MoveStep
.
Equals
(
StoreMoveStep
.
BI_12_MoveToShelf
))
{
MoveInfo
.
NextMoveStep
(
StoreMoveStep
.
BI_13_InoutToP101
);
InOutStoreLog
(
"料架取料 "
+
MoveInfo
.
SLog
+
":叉子前进到P101点"
);
InOutStoreLog
(
"料架取料 "
+
MoveInfo
.
SLog
+
":叉子前进到P101点"
,
true
);
ACAxisMove
(
Config
.
InOut_Axis
,
moveP
.
InOut_P101
,
Config
.
InOutAxis_P101_Speed
);
}
else
if
(
MoveInfo
.
MoveStep
.
Equals
(
StoreMoveStep
.
BI_13_InoutToP101
))
{
MoveInfo
.
NextMoveStep
(
StoreMoveStep
.
BI_14_UpdownToP102
);
InOutStoreLog
(
"料架取料 "
+
MoveInfo
.
SLog
+
":升降轴上升到P102点"
);
InOutStoreLog
(
"料架取料 "
+
MoveInfo
.
SLog
+
":升降轴上升到P102点"
,
true
);
ACAxisMove
(
Config
.
UpDown_Axis
,
moveP
.
UpDown_HP102
,
Config
.
UpDownAxis_P101_Speed
);
}
else
if
(
MoveInfo
.
MoveStep
.
Equals
(
StoreMoveStep
.
BI_14_UpdownToP102
))
...
...
@@ -521,7 +521,7 @@ namespace OnlineStore.DeviceLibrary
else
{
MoveInfo
.
NextMoveStep
(
StoreMoveStep
.
BI_21_ToScanPosition
);
InOutStoreLog
(
"扫码 "
+
MoveInfo
.
SLog
+
":升降轴到P2,旋转轴到P1"
);
InOutStoreLog
(
"扫码 "
+
MoveInfo
.
SLog
+
":升降轴到P2,旋转轴到P1"
,
true
);
ACAxisMove
(
Config
.
UpDown_Axis
,
moveP
.
UpDown_P2
,
Config
.
UpDownAxis_P1_Speed
);
ACAxisMove
(
Config
.
Middle_Axis
,
moveP
.
Middle_P1
,
Config
.
MiddleAxis_P1_Speed
);
}
...
...
@@ -529,21 +529,21 @@ namespace OnlineStore.DeviceLibrary
else
if
(
MoveInfo
.
MoveStep
.
Equals
(
StoreMoveStep
.
BI_21_ToScanPosition
))
{
MoveInfo
.
NextMoveStep
(
StoreMoveStep
.
BI_22_InOutToP2
);
InOutStoreLog
(
"扫码 "
+
MoveInfo
.
SLog
+
":进出轴到P2"
);
InOutStoreLog
(
"扫码 "
+
MoveInfo
.
SLog
+
":进出轴到P2"
,
true
);
ACAxisMove
(
Config
.
InOut_Axis
,
moveP
.
InOut_P2
,
Config
.
InOutAxis_P2_Speed
);
}
else
if
(
MoveInfo
.
MoveStep
.
Equals
(
StoreMoveStep
.
BI_22_InOutToP2
))
{
MoveInfo
.
NextMoveStep
(
StoreMoveStep
.
BI_23_PutTrayDown
);
InOutStoreLog
(
"扫码 "
+
MoveInfo
.
SLog
+
":升降轴到扫码低点P1,压紧轴到压紧前点P3"
);
InOutStoreLog
(
"扫码 "
+
MoveInfo
.
SLog
+
":升降轴到扫码低点P1,压紧轴到压紧前点P3"
,
true
);
ACAxisMove
(
Config
.
UpDown_Axis
,
moveP
.
UpDown_P1
,
Config
.
UpDownAxis_P2_Speed
);
ACAxisMove
(
Config
.
Comp_Axis
,
moveP
.
ComPress_P3
,
Config
.
CompAxis_P3_Speed
);
}
else
if
(
MoveInfo
.
MoveStep
.
Equals
(
StoreMoveStep
.
BI_23_PutTrayDown
))
{
MoveInfo
.
NextMoveStep
(
StoreMoveStep
.
BI_24_InOutToP1
);
InOutStoreLog
(
"扫码 "
+
MoveInfo
.
SLog
+
":进出轴返回待机点P1"
);
InOutStoreLog
(
"扫码 "
+
MoveInfo
.
SLog
+
":进出轴返回待机点P1"
,
true
);
ACAxisMove
(
Config
.
InOut_Axis
,
moveP
.
InOut_P1
,
Config
.
CompAxis_P1_Speed
);
}
else
if
(
MoveInfo
.
MoveStep
.
Equals
(
StoreMoveStep
.
BI_24_InOutToP1
))
...
...
@@ -595,21 +595,21 @@ namespace OnlineStore.DeviceLibrary
else
{
MoveInfo
.
NextMoveStep
(
StoreMoveStep
.
BI_27_InoutToP2
);
InOutStoreLog
(
"扫码 "
+
MoveInfo
.
SLog
+
":进出轴到P2"
);
InOutStoreLog
(
"扫码 "
+
MoveInfo
.
SLog
+
":进出轴到P2"
,
true
);
ACAxisMove
(
Config
.
InOut_Axis
,
moveP
.
InOut_P2
,
Config
.
InOutAxis_P2_Speed
);
}
}
else
if
(
MoveInfo
.
MoveStep
.
Equals
(
StoreMoveStep
.
BI_27_InoutToP2
))
{
MoveInfo
.
NextMoveStep
(
StoreMoveStep
.
BI_28_GetScanPTray
);
InOutStoreLog
(
"扫码 "
+
MoveInfo
.
SLog
+
":升降轴到扫码高P2,压紧轴到压紧点P2"
);
InOutStoreLog
(
"扫码 "
+
MoveInfo
.
SLog
+
":升降轴到扫码高P2,压紧轴到压紧点P2"
,
true
);
ACAxisMove
(
Config
.
UpDown_Axis
,
moveP
.
UpDown_P2
,
Config
.
UpDownAxis_P2_Speed
);
ACAxisMove
(
Config
.
Comp_Axis
,
moveP
.
ComPress_P2
,
Config
.
CompAxis_P2_Speed
);
}
else
if
(
MoveInfo
.
MoveStep
.
Equals
(
StoreMoveStep
.
BI_28_GetScanPTray
))
{
MoveInfo
.
NextMoveStep
(
StoreMoveStep
.
BI_29_InoutBackP1
);
InOutStoreLog
(
"扫码 "
+
MoveInfo
.
SLog
+
":进出轴返回"
);
InOutStoreLog
(
"扫码 "
+
MoveInfo
.
SLog
+
":进出轴返回"
,
true
);
ACAxisMove
(
Config
.
InOut_Axis
,
moveP
.
InOut_P1
,
Config
.
InOutAxis_P1_Speed
);
}
else
if
(
MoveInfo
.
MoveStep
.
Equals
(
StoreMoveStep
.
BI_29_InoutBackP1
))
...
...
@@ -723,38 +723,38 @@ namespace OnlineStore.DeviceLibrary
else
if
(
MoveInfo
.
MoveStep
.
Equals
(
StoreMoveStep
.
BI_71_ToNGDoor
))
{
MoveInfo
.
NextMoveStep
(
StoreMoveStep
.
BI_72_NGDoorUp
);
InOutStoreLog
(
"
送出料盘 "
+
MoveInfo
.
SLog
+
":NG升降门上升"
);
InOutStoreLog
(
"
NG料 "
+
MoveInfo
.
SLog
+
":NG升降门上升"
,
true
);
CylinderMove
(
MoveInfo
,
IO_Type
.
NGDoorCylinder_Down
,
IO_Type
.
NGDoowCylinder_Up
);
}
else
if
(
MoveInfo
.
MoveStep
.
Equals
(
StoreMoveStep
.
BI_72_NGDoorUp
))
{
MoveInfo
.
NextMoveStep
(
StoreMoveStep
.
BI_73_InoutToNGDoor
);
InOutStoreLog
(
"
送出料盘 "
+
MoveInfo
.
SLog
+
":进出轴到NG料门口位置P11"
);
InOutStoreLog
(
"
NG料 "
+
MoveInfo
.
SLog
+
":进出轴到NG料门口位置P11"
,
true
);
ACAxisMove
(
Config
.
InOut_Axis
,
moveP
.
InOut_P11
,
Config
.
InOutAxis_P2_Speed
);
}
else
if
(
MoveInfo
.
MoveStep
.
Equals
(
StoreMoveStep
.
BI_73_InoutToNGDoor
))
{
MoveInfo
.
NextMoveStep
(
StoreMoveStep
.
BI_74_UpdownDown
);
InOutStoreLog
(
"
送出料盘 "
+
MoveInfo
.
SLog
+
":升降轴到P11,压紧轴到P3,放下料盘"
);
InOutStoreLog
(
"
NG料 "
+
MoveInfo
.
SLog
+
":升降轴到P11,压紧轴到P3,放下料盘"
,
true
);
ACAxisMove
(
Config
.
UpDown_Axis
,
moveP
.
UpDown_P11
,
Config
.
UpDownAxis_P2_Speed
);
ACAxisMove
(
Config
.
Comp_Axis
,
moveP
.
ComPress_P3
,
Config
.
CompAxis_P3_Speed
);
}
else
if
(
MoveInfo
.
MoveStep
.
Equals
(
StoreMoveStep
.
BI_74_UpdownDown
))
{
MoveInfo
.
NextMoveStep
(
StoreMoveStep
.
BI_75_InoutToP1
);
InOutStoreLog
(
"
送出料盘 "
+
MoveInfo
.
SLog
+
":叉子后退到P1"
);
InOutStoreLog
(
"
NG料 "
+
MoveInfo
.
SLog
+
":叉子后退到P1"
,
true
);
ACAxisMove
(
Config
.
InOut_Axis
,
moveP
.
InOut_P1
,
Config
.
InOutAxis_P1_Speed
);
}
else
if
(
MoveInfo
.
MoveStep
.
Equals
(
StoreMoveStep
.
BI_75_InoutToP1
))
{
MoveInfo
.
NextMoveStep
(
StoreMoveStep
.
BI_76_NGDoorDown
);
InOutStoreLog
(
"
送出料盘 "
+
MoveInfo
.
SLog
+
":关门NG料门,送出料盘结束"
);
InOutStoreLog
(
"
NG料 "
+
MoveInfo
.
SLog
+
":关门NG料门,送出料盘结束"
,
true
);
CylinderMove
(
MoveInfo
,
IO_Type
.
NGDoowCylinder_Up
,
IO_Type
.
NGDoorCylinder_Down
);
}
else
if
(
MoveInfo
.
MoveStep
.
Equals
(
StoreMoveStep
.
BI_76_NGDoorDown
))
{
MoveInfo
.
NextMoveStep
(
StoreMoveStep
.
BI_77_NGLineRun
);
InOutStoreLog
(
"料架入库 "
+
MoveInfo
.
SLog
+
":NG流水线转动5000"
);
InOutStoreLog
(
"料架入库 "
+
MoveInfo
.
SLog
+
":NG流水线转动5000"
,
true
);
IOMove
(
IO_Type
.
NGLine_Run
,
IO_VALUE
.
HIGH
);
MoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitTime
(
5000
));
...
...
@@ -771,7 +771,7 @@ namespace OnlineStore.DeviceLibrary
else
if
(
MoveInfo
.
MoveStep
==
StoreMoveStep
.
SO_10_ToShelfPosition
)
{
MoveInfo
.
NextMoveStep
(
StoreMoveStep
.
SO_11_ToShelf
);
InOutStoreLog
(
"送出料盘 "
+
MoveInfo
.
SLog
+
":叉子进出料口,进出轴至P101"
);
InOutStoreLog
(
"送出料盘 "
+
MoveInfo
.
SLog
+
":叉子进出料口,进出轴至P101"
,
true
);
ACAxisMove
(
Config
.
InOut_Axis
,
moveP
.
InOut_P101
,
Config
.
InOutAxis_P101_Speed
);
}
...
...
@@ -786,14 +786,14 @@ namespace OnlineStore.DeviceLibrary
else
if
(
MoveInfo
.
MoveStep
==
StoreMoveStep
.
SO_12_PutReel
)
{
MoveInfo
.
NextMoveStep
(
StoreMoveStep
.
SO_13_InoutBack
);
InOutStoreLog
(
"送出料盘 "
+
MoveInfo
.
SLog
+
":叉子从出料口返回, 进出轴到P1 "
);
InOutStoreLog
(
"送出料盘 "
+
MoveInfo
.
SLog
+
":叉子从出料口返回, 进出轴到P1 "
,
true
);
InOutBackToP1
(
moveP
.
InOut_P1
);
}
else
if
(
MoveInfo
.
MoveStep
==
StoreMoveStep
.
SO_13_InoutBack
)
{
MoveInfo
.
NextMoveStep
(
StoreMoveStep
.
BI_10_StartGetTray
);
InOutStoreLog
(
"送出料盘结束 "
+
MoveInfo
.
SLog
+
": 升降轴返回,升降轴到P1,顶升下降,继续循环料架取料盘"
);
// ACAxisMove(Config.UpDown_Axis, moveP.UpDown_P1, Config.UpDownAxis_P1_Speed);
// ACAxisMove(Config.UpDown_Axis, moveP.UpDown_P1, Config.UpDownAxis_P1_Speed);
}
#
endregion
...
...
source/DeviceLibrary/ACPackingStore/AC_BOX_Bean_Shelf.cs
查看文件 @
c29089a
...
...
@@ -850,7 +850,7 @@ namespace OnlineStore.DeviceLibrary
return
false
;
}
// CodeMsg = "收到二维码【 " + message + "】,发送给服务器获取入库PosID";
LogUtil
.
info
(
Name
+
"二维码【 "
+
message
+
"】,发送给服务器获取入库PosID"
);
LogUtil
.
debug
(
Name
+
"二维码【 "
+
message
+
"】,发送给服务器获取入库PosID"
);
//查询该料盘所在料仓以及仓位
StoreManager
.
ResultType
resultType
=
StoreManager
.
GetPosForPutIn
(
Name
,
Config
,
message
,
CurrShelfID
,
rfidLoc
,
out
bool
isLockInfoMatch
);
...
...
source/DeviceLibrary/device/halcon/CodeManager.cs
查看文件 @
c29089a
using
CodeLibrary
;
using
CodeLibrary
;
using
OnlineStore.Common
;
using
System
;
using
System.Collections.Generic
;
...
...
@@ -8,6 +8,7 @@ using System.IO;
using
System.Linq
;
using
System.Runtime.ExceptionServices
;
using
System.Text
;
using
System.Threading
;
using
System.Windows.Forms
;
namespace
OnlineStore.DeviceLibrary
...
...
@@ -15,7 +16,7 @@ namespace OnlineStore.DeviceLibrary
public
class
CodeManager
{
public
static
List
<
string
>
codeTypeList
=
new
List
<
string
>();
//
public static List<string> balserNameList = new List<string>();
public
static
List
<
string
>
balserNameList
=
new
List
<
string
>();
public
static
List
<
string
>
hikNameList
=
new
List
<
string
>();
private
static
char
spiltChar
=
'#'
;
...
...
@@ -37,7 +38,7 @@ namespace OnlineStore.DeviceLibrary
continue
;
}
string
file
=
GetCodeParamFilePath
(
str
.
Trim
());
LogUtil
.
info
(
"加载到配置二维码类型:"
+
str
.
Trim
()
+
",配置文件:"
+
file
);
LogUtil
.
info
(
"加载到配置二维码类型:"
+
str
.
Trim
()
+
",配置文件:"
+
file
);
codeTypeList
.
Add
(
str
.
Trim
());
}
...
...
@@ -46,7 +47,7 @@ namespace OnlineStore.DeviceLibrary
}
catch
(
Exception
ex
)
{
LogUtil
.
error
(
"解析摄像机配置出错:"
+
ex
.
ToString
());
LogUtil
.
error
(
"解析摄像机配置出错:"
+
ex
.
ToString
());
}
}
private
static
void
LoadCamera
(
bool
isReLoad
)
...
...
@@ -64,7 +65,7 @@ namespace OnlineStore.DeviceLibrary
}
catch
(
Exception
ex
)
{
LogUtil
.
error
(
"加载HIK相机出错:"
+
ex
.
ToString
());
LogUtil
.
error
(
"加载HIK相机出错:"
+
ex
.
ToString
());
}
}
string
[]
names
=
Camera
.
_cam
.
Name
;
...
...
@@ -92,14 +93,14 @@ namespace OnlineStore.DeviceLibrary
Camera
.
_cam
.
Close
(
cameraName
);
}
public
static
void
CloseAllCamera
()
{
{
Camera
.
_cam
.
CloseAll
();
}
private
static
int
ScanCount
=
0
;
private
static
int
codeCount
=
ConfigAppSettings
.
GetIntValue
(
Setting_Init
.
CodeCount
);
[
HandleProcessCorruptedStateExceptions
]
public
static
List
<
string
>
CameraScan
(
List
<
string
>
cameraList
,
string
deviceName
,
bool
isSaveImg
=
false
)
public
static
List
<
string
>
CameraScan
(
List
<
string
>
cameraList
,
string
deviceName
,
int
timeOut
=
1500
)
{
if
(
codeCount
<
1
)
{
...
...
@@ -118,9 +119,14 @@ namespace OnlineStore.DeviceLibrary
{
continue
;
}
ScanCount
++;
DateTime
startTime
=
DateTime
.
Now
;
LogUtil
.
info
(
deviceName
+
" 【"
+
cameraName
+
"】开始取图片"
);
if
(
deviceName
!=
""
)
{
LogUtil
.
debug
(
deviceName
+
" 【"
+
cameraName
+
"】开始取图片"
);
}
HalconDotNet
.
HObject
ho_Image
=
null
;
bool
findRightCode
=
false
;
try
{
ho_Image
=
Camera
.
_cam
.
CaptureOnImage
(
cameraName
);
...
...
@@ -129,8 +135,8 @@ namespace OnlineStore.DeviceLibrary
LogUtil
.
error
(
deviceName
+
" 【"
+
cameraName
+
"】取图片失败["
+
Camera
.
_cam
.
ErrInfo
+
"],关闭相机"
);
CloseCamera
(
cameraName
);
continue
;
}
LogUtil
.
info
(
deviceName
+
" 【"
+
cameraName
+
"】取图片完成,开始扫码"
);
}
LogUtil
.
debug
(
deviceName
+
" 【"
+
cameraName
+
"】取图片完成,开始扫码"
);
List
<
CodeInfo
>
cc
=
new
List
<
CodeInfo
>();
string
r
=
""
;
foreach
(
string
codeType
in
codeTypeList
)
...
...
@@ -142,7 +148,7 @@ namespace OnlineStore.DeviceLibrary
}
else
{
cc
=
HDCodeHelper
.
DecodeCode
(
ho_Image
,
code
Count
,
GetCodeParamFilePath
(
codeType
),
codeType
);
cc
=
HDCodeHelper
.
DecodeCode
(
ho_Image
,
code
Type
,
GetCodeParamFilePath
(
codeType
),
codeCount
,
timeOut
);
}
foreach
(
CodeInfo
c
in
cc
)
{
...
...
@@ -151,14 +157,21 @@ namespace OnlineStore.DeviceLibrary
{
codeList
.
Add
(
str
);
r
=
r
+
"##"
+
str
;
if
(!
findRightCode
)
{
findRightCode
=
HasRightCode
(
str
);
}
}
}
}
}
if
(
String
.
IsNullOrEmpty
(
r
)
)
if
(
!
findRightCode
)
{
// SaveImageToFile(deviceName, cameraName, bit);
SaveImageToFile
(
deviceName
,
cameraName
,
ho_Image
);
}
if
(
deviceName
!=
""
||
r
!=
""
)
{
LogUtil
.
info
(
deviceName
+
" 【"
+
cameraName
+
"】扫码完成【"
+
FormUtil
.
GetSpanStr
(
DateTime
.
Now
-
startTime
)
+
"】["
+
findRightCode
+
"]"
+
ScanCount
+
" :"
+
r
);
}
LogUtil
.
info
(
deviceName
+
" 【"
+
cameraName
+
"】扫码完成【"
+
FormUtil
.
GetSpanStr
(
DateTime
.
Now
-
startTime
)
+
"】 :"
+
r
);
}
catch
(
AccessViolationException
e
)
{
...
...
@@ -171,7 +184,7 @@ namespace OnlineStore.DeviceLibrary
LogUtil
.
error
(
deviceName
+
" 扫码出错:"
+
ex
.
ToString
());
}
finally
{
{
if
(
ho_Image
!=
null
)
{
ho_Image
.
Dispose
();
...
...
@@ -181,8 +194,9 @@ namespace OnlineStore.DeviceLibrary
}
catch
(
AccessViolationException
e
)
{
LogUtil
.
error
(
deviceName
+
" 扫码出现AccessViolationException异常:"
+
e
.
ToString
());
// GC.Collect();
LogUtil
.
error
(
deviceName
+
" 扫码出现AccessViolationException异常,关闭所有相机:"
+
e
.
ToString
());
Camera
.
_cam
.
CloseAll
();
//GC.Collect();
}
catch
(
Exception
ex
)
{
...
...
@@ -190,9 +204,29 @@ namespace OnlineStore.DeviceLibrary
}
return
codeList
;
}
private
static
void
SaveImageToFile
(
string
deviceName
,
string
cameraName
,
HalconDotNet
.
HObject
bitmap
)
{
string
date
=
deviceName
.
Trim
().
Replace
(
'_'
,
'-'
)
+
"-"
+
DateTime
.
Now
.
ToString
(
"yyyyMMdd-HHmmss"
)
+
"-"
+
DateTime
.
Now
.
Millisecond
.
ToString
().
PadLeft
(
4
,
'0'
);
string
dire
=
@"D:\image\" + deviceName.Trim().Replace('_', '-') + @"
\
" + cameraName.Trim().Replace('_', '-').Replace(':', '-') + @"
\
";
string
iamgeName
=
date
+
".bmp"
;
try
{
if
(!
Directory
.
Exists
(
dire
))
{
Directory
.
CreateDirectory
(
dire
);
}
bitmap
.
WriteObject
(
dire
+
iamgeName
);
LogUtil
.
info
(
deviceName
+
" 【"
+
cameraName
+
"】扫码失败,保存图片到【"
+
dire
+
iamgeName
+
"】成功"
);
}
catch
(
Exception
ex
)
{
LogUtil
.
error
(
"保存"
+
deviceName
+
" 【"
+
cameraName
+
"】的图片到【"
+
dire
+
iamgeName
+
"】出错"
+
ex
.
ToString
());
}
}
private
static
void
SaveImageToFile
(
string
deviceName
,
string
cameraName
,
Bitmap
bitmap
)
{
string
date
=
DateTime
.
Now
.
ToString
(
"HH-mm-ss-"
)
+
DateTime
.
Now
.
Millisecond
;
string
date
=
deviceName
.
Trim
().
Replace
(
'_'
,
'-'
)
+
"-"
+
DateTime
.
Now
.
ToString
(
"HH-mm-ss-"
)
+
DateTime
.
Now
.
Millisecond
;
string
dire
=
@"D:\image\" + deviceName.Trim().Replace('_', '-') + @"
\
" + cameraName.Trim().Replace('_', '-').Replace(':', '-') + @"
\
";
string
iamgeName
=
date
+
".bmp"
;
try
...
...
@@ -207,10 +241,34 @@ namespace OnlineStore.DeviceLibrary
}
catch
(
Exception
ex
)
{
LogUtil
.
error
(
"保存"
+
deviceName
+
" 【"
+
cameraName
+
"】的图片到【"
+
dire
+
iamgeName
+
"】出错"
+
ex
.
ToString
());
LogUtil
.
error
(
"保存"
+
deviceName
+
" 【"
+
cameraName
+
"】的图片到【"
+
dire
+
iamgeName
+
"】出错"
+
ex
.
ToString
());
}
}
public
static
bool
HasRightCode
(
params
string
[]
codes
)
{
//分号分割后长度=4,L,E,B,R
try
{
foreach
(
string
code
in
codes
)
{
string
[]
strarray
=
code
.
Split
(
';'
);
if
(
strarray
.
Length
==
4
)
{
if
(
strarray
[
0
].
StartsWith
(
"L"
)
&&
strarray
[
1
].
StartsWith
(
"E"
)
&&
strarray
[
2
].
StartsWith
(
"B"
))
{
return
true
;
}
}
}
}
catch
(
Exception
ex
)
{
}
return
false
;
}
public
static
string
GetCodeParamFilePath
(
string
codePath
)
{
string
appPath
=
Application
.
StartupPath
;
...
...
source/DeviceLibrary/store/KTK_Store.cs
查看文件 @
c29089a
...
...
@@ -480,11 +480,18 @@ namespace OnlineStore.DeviceLibrary
{
LogUtil
.
info
(
Name
+
logInfo
);
}
protected
void
InOutStoreLog
(
string
msg
)
protected
void
InOutStoreLog
(
string
msg
,
bool
isDebug
=
false
)
{
string
posId
=
MoveInfo
.
MoveParam
!=
null
?
"["
+
MoveInfo
.
MoveParam
.
PosID
+
"]"
:
""
;
string
shelfId
=
MoveInfo
.
MoveParam
!=
null
?
"["
+
MoveInfo
.
MoveParam
.
ShelfPosID
+
"]"
:
""
;
LogInfo
(
" "
+
posId
+
""
+
shelfId
+
" :"
+
msg
);
if
(
isDebug
)
{
LogUtil
.
debug
(
Name
+
" "
+
posId
+
""
+
shelfId
+
" :"
+
msg
);
}
else
{
LogInfo
(
" "
+
posId
+
""
+
shelfId
+
" :"
+
msg
);
}
}
protected
int
GetAlarmCodeByAxis
(
ConfigMoveAxis
axis
)
{
...
...
source/DeviceLibrary/store/model/StoreMoveInfo.cs
查看文件 @
c29089a
...
...
@@ -163,6 +163,7 @@ namespace OnlineStore.DeviceLibrary
//设置取料位置
MoveParam
.
UpdateShelfPosId
(
currShelfPosId
);
MoveParam
.
PosID
=
""
;
return
true
;
}
/// <summary>
...
...
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论