Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
孙克
/
ACSingleStore
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
作业
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit 5db702d1
由
几米阳光
编写于
2019-02-15 16:44:19 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
增加自动出库功能。扫码增加日志。
1 个父辈
7a963e86
全部展开
隐藏空白字符变更
内嵌
并排
正在显示
5 个修改的文件
包含
123 行增加
和
64 行删除
source/ACSingleStore/FrmStoreBox.Designer.cs
source/ACSingleStore/FrmStoreBox.cs
source/DeviceLibrary/acSingleStore/AC_SA_BoxBean.cs
source/DeviceLibrary/acSingleStore/AC_SA_BoxBean_Partial.cs
source/DeviceLibrary/halcon/CodeManager.cs
source/ACSingleStore/FrmStoreBox.Designer.cs
查看文件 @
5db702d
此文件的差异被折叠,
点击展开。
source/ACSingleStore/FrmStoreBox.cs
查看文件 @
5db702d
...
...
@@ -897,12 +897,21 @@ namespace OnlineStore.ACSingleStore
}
else
{
DialogResult
res
=
MessageBox
.
Show
(
"确定开始自动出入库?"
,
"提示"
,
MessageBoxButtons
.
YesNo
);
DialogResult
res
;
if
(
chbOnlyOut
.
Checked
)
{
res
=
MessageBox
.
Show
(
"确定开始自动出库?"
,
"提示"
,
MessageBoxButtons
.
YesNo
);
}
else
{
res
=
MessageBox
.
Show
(
"确定开始自动出入库?"
,
"提示"
,
MessageBoxButtons
.
YesNo
);
}
if
(
res
.
Equals
(
DialogResult
.
Yes
))
{
store
.
autoNext
=
true
;
int
jiange
=
FormUtil
.
GetIntValue
(
txtJiange
);
store
.
autoJiange
=
jiange
;
store
.
AutoOnlyOut
=
chbOnlyOut
.
Checked
;
if
(
cmbPosition
.
SelectedIndex
>=
0
)
{
int
currIndex
=
cmbPosition
.
SelectedIndex
;
...
...
@@ -910,9 +919,18 @@ namespace OnlineStore.ACSingleStore
store
.
AutoStartIndex
=
currIndex
;
string
poText
=
cmbPosition
.
Text
;
store
.
autoMsg
=
"自动出库:"
+
poText
;
LogUtil
.
info
(
LOGGER
,
store
.
StoreName
+
"开启自动出入库模式,开始位置【"
+
poText
+
"】(索引="
+
currIndex
+
"),间隔="
+
jiange
+
",入库开始!"
);
LogUtil
.
info
(
LOGGER
,
store
.
StoreName
+
"开启自动出入库模式,开始位置【"
+
poText
+
"】(索引="
+
currIndex
+
")(间隔="
+
jiange
+
")("
+
(
store
.
AutoOnlyOut
?
"出库"
:
"出入库"
)
+
"),开始!"
);
//store.StartOutStoreMove(new InOutStoreParam("", poText));
store
.
StartInStoreMove
(
new
InOutStoreParam
(
""
,
poText
));
if
(
store
.
AutoOnlyOut
)
{
store
.
StartOutStoreMove
(
new
InOutStoreParam
(
""
,
poText
));
}
else
{
store
.
StartInStoreMove
(
new
InOutStoreParam
(
""
,
poText
));
}
}
btnStartAuTo
.
Text
=
"停止自动出入库"
;
}
...
...
source/DeviceLibrary/acSingleStore/AC_SA_BoxBean.cs
查看文件 @
5db702d
...
...
@@ -1453,7 +1453,7 @@ namespace OnlineStore.DeviceLibrary
private
void
scanTimer_Elapsed
(
object
sender
,
System
.
Timers
.
ElapsedEventArgs
e
)
{
int
height
=
GetHeight
();
LogUtil
.
info
(
"高度【"
+
height
+
"】开始扫码"
);
//
LogUtil.info("高度【"+height+"】开始扫码");
DateTime
date
=
DateTime
.
Now
;
//scanTimer.Enabled = false;
KNDIOMove
(
IO_Type
.
CameraLight_Power
,
IO_VALUE
.
HIGH
);
...
...
source/DeviceLibrary/acSingleStore/AC_SA_BoxBean_Partial.cs
查看文件 @
5db702d
...
...
@@ -18,7 +18,11 @@ namespace OnlineStore.DeviceLibrary
/// <summary>
/// 入库完成后自动出库,出库完成后自动入库
/// </summary>
public
bool
autoNext
=
false
;
public
bool
autoNext
=
false
;
/// <summary>
/// 自动出入库只出库不入库
/// </summary>
public
bool
AutoOnlyOut
=
false
;
/// <summary>
/// 自动出入库间隔
/// </summary>
...
...
@@ -821,11 +825,7 @@ namespace OnlineStore.DeviceLibrary
}
if
(
storeMoveType
.
Equals
(
StoreMoveType
.
InStore
))
{
int
newIndex
=
autoPositionIndex
-
1
;
//if (autoJiange == 0)
//{
// newIndex = autoPositionIndex;
//}
int
newIndex
=
autoPositionIndex
;
if
(
newIndex
<
0
)
{
if
(
AutoStartIndex
>=
0
&&
AutoStartIndex
<
PositionNumList
.
Count
)
...
...
@@ -844,36 +844,16 @@ namespace OnlineStore.DeviceLibrary
{
autoPositionIndex
=
newIndex
;
string
posid
=
PositionNumList
[
autoPositionIndex
];
//判断是否需要重置
if
(
CurrInOutACount
>=
Config
.
Box_ResetACount
)
{
LogUtil
.
info
(
LOGGER
,
StoreName
+
"自动进入下一个出库:posid="
+
posid
+
",当时已经出入库"
+
CurrInOutACount
+
"次,需要重置BOX,先把出库信息存入排队列表中"
);
Reset
(
false
);
autoMsg
=
"自动出库:"
+
posid
;
AddWaitOutInfo
(
new
FixtureCodeInfo
(
0
,
""
,
posid
));
}
else
if
(
CurrInOutCount
>=
Config
.
Box_ResetMCount
)
{
LogUtil
.
info
(
LOGGER
,
StoreName
+
"自动进入下一个出库:posid="
+
posid
+
",当时已经出入库"
+
CurrInOutCount
+
"次,需要重置BOX旋转轴,先把出库信息存入排队列表中"
);
//ResetMiddleAxis(false);
autoMsg
=
"自动出库:"
+
posid
;
AddWaitOutInfo
(
new
FixtureCodeInfo
(
0
,
""
,
posid
));
}
else
{
LogUtil
.
info
(
LOGGER
,
StoreName
+
"自动进入下一个出库:posid="
+
posid
);
autoMsg
=
"自动出库:"
+
posid
;
StartOutStoreMove
(
new
InOutStoreParam
(
""
,
posid
));
}
StartNewOut
(
posid
);
}
}
else
if
(
storeMoveType
.
Equals
(
StoreMoveType
.
OutStore
))
{
int
newIndex
=
autoPositionIndex
-
autoJiange
;
if
(
newIndex
<
0
)
{
if
(
AutoStartIndex
>=
0
&&
AutoStartIndex
<
PositionNumList
.
Count
)
if
(
AutoStartIndex
>=
0
&&
AutoStartIndex
<
PositionNumList
.
Count
&&
AutoOnlyOut
.
Equals
(
false
)
)
{
newIndex
=
AutoStartIndex
;
LogUtil
.
info
(
LOGGER
,
StoreName
+
"下一个索引不存在,重新开始自动出入库,索引【"
+
AutoStartIndex
+
"】"
);
...
...
@@ -888,27 +868,16 @@ namespace OnlineStore.DeviceLibrary
else
{
string
posid
=
PositionNumList
[
newIndex
];
//判断是否需要重置
if
(
CurrInOutACount
>=
Config
.
Box_ResetACount
)
if
(
AutoOnlyOut
)
{
LogUtil
.
info
(
LOGGER
,
StoreName
+
"自动进入下一个入库:posid="
+
posid
+
",当时已经出入库"
+
CurrInOutACount
+
"次,需要重置BOX,先把入库信息存入排队列表中"
);
Reset
(
false
);
autoMsg
=
"自动入库:"
+
posid
;
AddWaitOutInfo
(
new
FixtureCodeInfo
(
0
,
"AAAA"
,
posid
));
}
else
if
(
CurrInOutCount
>=
Config
.
Box_ResetMCount
)
StartNewOut
(
posid
);
}
else
{
LogUtil
.
info
(
LOGGER
,
StoreName
+
"自动进入下一个出库:posid="
+
posid
+
",当时已经出入库"
+
CurrInOutCount
+
"次,需要重置BOX旋转轴,先把出库信息存入排队列表中"
);
//ResetMiddleAxis(false);
autoMsg
=
"自动入库:"
+
posid
;
AddWaitOutInfo
(
new
FixtureCodeInfo
(
0
,
"AAAA"
,
posid
));
}
else
{
LogUtil
.
info
(
LOGGER
,
StoreName
+
"自动进入下一个入库:posid="
+
posid
);
LogUtil
.
info
(
LOGGER
,
StoreName
+
"自动入库:posid="
+
posid
);
autoMsg
=
"自动入库:"
+
posid
;
StartInStoreMove
(
new
InOutStoreParam
(
"AAAA"
,
posid
));
}
}
}
}
...
...
@@ -918,6 +887,56 @@ namespace OnlineStore.DeviceLibrary
}
}
private
void
StartNewIn
(
string
posid
)
{
//判断是否需要重置
if
(
CurrInOutACount
>=
Config
.
Box_ResetACount
)
{
LogUtil
.
info
(
LOGGER
,
StoreName
+
"自动入库:【"
+
posid
+
"】已经出入库"
+
CurrInOutACount
+
"次,需要重置BOX,先把入库信息存放到列表中"
);
Reset
(
false
);
autoMsg
=
"自动入库:"
+
posid
;
AddWaitOutInfo
(
new
FixtureCodeInfo
(
0
,
"AAAA"
,
posid
));
}
else
if
(
CurrInOutCount
>=
Config
.
Box_ResetMCount
)
{
LogUtil
.
info
(
LOGGER
,
StoreName
+
"自动入库:【"
+
posid
+
"】已经出入库"
+
CurrInOutCount
+
"次,需要重置BOX旋转轴,先把入库信息存放到列表中"
);
//ResetMiddleAxis(false);
autoMsg
=
"自动入库:"
+
posid
;
AddWaitOutInfo
(
new
FixtureCodeInfo
(
0
,
"AAAA"
,
posid
));
}
else
{
LogUtil
.
info
(
LOGGER
,
StoreName
+
"自动入库:posid="
+
posid
);
autoMsg
=
"自动入库:"
+
posid
;
StartInStoreMove
(
new
InOutStoreParam
(
"AAAA"
,
posid
));
}
}
private
void
StartNewOut
(
string
posid
)
{
//判断是否需要重置
if
(
CurrInOutACount
>=
Config
.
Box_ResetACount
)
{
LogUtil
.
info
(
LOGGER
,
StoreName
+
"自动入库:【"
+
posid
+
"】已经出入库"
+
CurrInOutACount
+
"次,需要重置BOX,先把出库信息存入排队列表中"
);
Reset
(
false
);
autoMsg
=
"自动出库:"
+
posid
;
AddWaitOutInfo
(
new
FixtureCodeInfo
(
0
,
""
,
posid
));
}
else
if
(
CurrInOutCount
>=
Config
.
Box_ResetMCount
)
{
LogUtil
.
info
(
LOGGER
,
StoreName
+
"自动入库:【"
+
posid
+
"】已经出入库"
+
CurrInOutCount
+
"次,需要重置BOX旋转轴,先把出库信息存入排队列表中"
);
//ResetMiddleAxis(false);
autoMsg
=
"自动出库:"
+
posid
;
AddWaitOutInfo
(
new
FixtureCodeInfo
(
0
,
""
,
posid
));
}
else
{
LogUtil
.
info
(
LOGGER
,
StoreName
+
"自动出库:posid="
+
posid
);
autoMsg
=
"自动出库:"
+
posid
;
StartOutStoreMove
(
new
InOutStoreParam
(
""
,
posid
));
}
}
private
void
InStoreLog
(
string
msg
)
{
string
posId
=
StoreMove
.
MoveParam
!=
null
?
StoreMove
.
MoveParam
.
PositionNum
:
""
;
...
...
source/DeviceLibrary/halcon/CodeManager.cs
查看文件 @
5db702d
...
...
@@ -70,23 +70,44 @@ namespace OnlineStore.DeviceLibrary
public
static
Bitmap
GetCamerImage
(
string
cameraName
)
{
Bitmap
bitm
=
null
;
if
(
balserNameList
.
Contains
(
cameraName
))
{
BaslerCamera
.
Instance
.
Open
(
cameraName
);
BaslerCamera
.
Instance
.
GrabOne
();
bitm
=
BaslerCamera
.
Instance
.
Image
;
BaslerCamera
.
Instance
.
Close
();
}
else
if
(
hikNameList
.
Contains
(
cameraName
))
try
{
HIKCamera
.
Instance
.
Open
(
cameraName
);
HIKCamera
.
Instance
.
GrabOne
();
bitm
=
HIKCamera
.
Instance
.
Image
;
HIKCamera
.
Instance
.
Close
();
if
(
balserNameList
.
Contains
(
cameraName
))
{
bool
result
=
BaslerCamera
.
Instance
.
Open
(
cameraName
);
if
(
result
)
{
BaslerCamera
.
Instance
.
GrabOne
();
bitm
=
BaslerCamera
.
Instance
.
Image
;
BaslerCamera
.
Instance
.
Close
();
}
else
{
LogUtil
.
error
(
"相机【"
+
cameraName
+
"】打开失败:"
+
BaslerCamera
.
Instance
.
ErrInfo
);
}
}
else
if
(
hikNameList
.
Contains
(
cameraName
))
{
bool
result
=
HIKCamera
.
Instance
.
Open
(
cameraName
);
if
(
result
)
{
HIKCamera
.
Instance
.
GrabOne
();
bitm
=
HIKCamera
.
Instance
.
Image
;
HIKCamera
.
Instance
.
Close
();
}
else
{
LogUtil
.
error
(
"相机【"
+
cameraName
+
"】打开失败:"
+
HIKCamera
.
Instance
.
ErrInfo
);
}
}
else
{
LogUtil
.
info
(
"未找到相机【"
+
cameraName
+
"】无法获取图片"
);
}
}
else
catch
(
Exception
ex
)
{
LogUtil
.
info
(
"未找到摄像机【"
+
cameraName
+
"】无法获取图片"
);
LogUtil
.
error
(
"从相机【"
+
cameraName
+
"】获取图片出错:"
+
ex
.
ToString
()
);
}
return
bitm
;
}
...
...
@@ -107,6 +128,7 @@ namespace OnlineStore.DeviceLibrary
}
else
{
LogUtil
.
info
(
" 摄像机【"
+
cameraName
+
"】获取图片完成,开始扫码"
);
HObject
ho_Image
=
HDCodeHelper
.
Bitmap2HObjectBpp24
(
bitmap
);
List
<
CodeInfo
>
cc
=
new
List
<
CodeInfo
>();
foreach
(
string
codeType
in
codeTypeList
)
...
...
@@ -123,7 +145,7 @@ namespace OnlineStore.DeviceLibrary
}
allCodeList
.
AddRange
(
cc
);
}
}
}
}
catch
(
Exception
ex
)
{
...
...
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论