Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
孙克
/
RC30-AutoInOutStore
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
作业
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit 0fdd68d1
由
几米阳光
编写于
2018-12-07 17:25:33 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
部分逻辑修改
1 个父辈
ff5c8c23
全部展开
隐藏空白字符变更
内嵌
并排
正在显示
22 个修改的文件
包含
273 行增加
和
275 行删除
doc/设备IP地址分配.xlsx
source/ACSingleStore/App.config
source/ACSingleStore/FrmAxisDebug.Designer.cs
source/ACSingleStore/FrmStoreBox.Designer.cs
source/ACSingleStore/FrmStoreBox.cs
source/Common/Setting_Init.cs
source/DeviceLibrary/DeviceLibrary.csproj
source/DeviceLibrary/KangNaiDe/AITcpClient.cs
source/DeviceLibrary/KangNaiDe/KNDAIManager.cs
source/DeviceLibrary/PanasonicServo/ACServerManager.cs
source/DeviceLibrary/PanasonicServo/ACServerManager_Partial.cs
source/DeviceLibrary/StoreConfig/AC/StoreConfig.csv
source/DeviceLibrary/acSingleStore/AC_SA_BoxBean.cs
source/DeviceLibrary/acSingleStore/AC_SA_BoxBean_Partial.cs
source/DeviceLibrary/acSingleStore/AutomaticBaiting.cs
source/DeviceLibrary/acSingleStore/AutomaticBaiting_Partial.cs
source/DeviceLibrary/halcon/HDevelopCodeLearn.cs
source/DeviceLibrary/halcon/HDevelopExport.cs
source/DeviceLibrary/store/AC_Store.cs
source/DeviceLibrary/store/StoreMoveStep.cs
source/DeviceLibrary/store/model/StoreMoveInfo.cs
source/LoadCVSLibrary/position/CSVPositionReader.cs
doc/设备IP地址分配.xlsx
查看文件 @
0fdd68d
此文件类型无法预览
source/ACSingleStore/App.config
查看文件 @
0fdd68d
...
...
@@ -6,6 +6,7 @@
<
appSettings
>
<!--是否开机自动启动料仓-->
<
add
key
=
"App_AutoRun"
value
=
"1"
/>
<
add
key
=
"CodeRun"
value
=
"1"
/>
<
add
key
=
"App_Title"
value
=
"料仓_批量上下料"
/>
<
add
key
=
"scanner_start_command"
value
=
"S"
/>
<!-- 开始吹气的判断值(配置值=服务器发送的湿度值-开始吹气值)-->
...
...
source/ACSingleStore/FrmAxisDebug.Designer.cs
查看文件 @
0fdd68d
...
...
@@ -296,7 +296,7 @@
this
.
btnAutoMovej
.
Name
=
"btnAutoMovej"
;
this
.
btnAutoMovej
.
Size
=
new
System
.
Drawing
.
Size
(
131
,
36
);
this
.
btnAutoMovej
.
TabIndex
=
30
;
this
.
btnAutoMovej
.
Text
=
"
自动
轴-(向下)"
;
this
.
btnAutoMovej
.
Text
=
"
上下料
轴-(向下)"
;
this
.
btnAutoMovej
.
UseVisualStyleBackColor
=
false
;
this
.
btnAutoMovej
.
MouseDown
+=
new
System
.
Windows
.
Forms
.
MouseEventHandler
(
this
.
btnAutoMovej_MouseDown
);
this
.
btnAutoMovej
.
MouseUp
+=
new
System
.
Windows
.
Forms
.
MouseEventHandler
(
this
.
btnAutoMovej_MouseUp
);
...
...
@@ -308,7 +308,7 @@
this
.
btnAutoMove
.
Name
=
"btnAutoMove"
;
this
.
btnAutoMove
.
Size
=
new
System
.
Drawing
.
Size
(
131
,
36
);
this
.
btnAutoMove
.
TabIndex
=
29
;
this
.
btnAutoMove
.
Text
=
"
自动
轴+(向上)"
;
this
.
btnAutoMove
.
Text
=
"
上下料
轴+(向上)"
;
this
.
btnAutoMove
.
UseVisualStyleBackColor
=
false
;
this
.
btnAutoMove
.
MouseDown
+=
new
System
.
Windows
.
Forms
.
MouseEventHandler
(
this
.
btnAutoMove_MouseDown
);
this
.
btnAutoMove
.
MouseUp
+=
new
System
.
Windows
.
Forms
.
MouseEventHandler
(
this
.
btnAutoMove_MouseUp
);
...
...
@@ -325,9 +325,9 @@
this
.
label7
.
AutoSize
=
true
;
this
.
label7
.
Location
=
new
System
.
Drawing
.
Point
(
39
,
237
);
this
.
label7
.
Name
=
"label7"
;
this
.
label7
.
Size
=
new
System
.
Drawing
.
Size
(
92
,
17
);
this
.
label7
.
Size
=
new
System
.
Drawing
.
Size
(
80
,
17
);
this
.
label7
.
TabIndex
=
27
;
this
.
label7
.
Text
=
"
(轴五)自动
轴"
;
this
.
label7
.
Text
=
"
批量上下料
轴"
;
//
// FrmAxisDebug
//
...
...
source/ACSingleStore/FrmStoreBox.Designer.cs
查看文件 @
0fdd68d
此文件的差异被折叠,
点击展开。
source/ACSingleStore/FrmStoreBox.cs
查看文件 @
0fdd68d
...
...
@@ -148,18 +148,22 @@ namespace OnlineStore.AutoInOutStore
private
bool
LoadOk
=
false
;
private
void
FrmTest_Load
(
object
sender
,
EventArgs
e
)
{
timer1
.
Start
();
LogUtil
.
logBox
=
this
.
richTextBox1
;
initValue
();
this
.
ShowInTaskbar
=
true
;
this
.
Text
=
ConfigAppSettings
.
GetValue
(
Setting_Init
.
App_Title
);
HideForm
();
initValue
();
LoadOk
=
true
;
cmbHomeType
.
SelectedIndex
=
1
;
HideForm
();
timer1
.
Start
();
}
private
DateTime
preReadModblsTime
=
DateTime
.
Now
;
private
void
timer1_Tick
(
object
sender
,
EventArgs
e
)
{
if
(
this
.
Visible
.
Equals
(
false
))
{
return
;
}
//HumitureServer.RandomData(store.Config.GetTempAddrList());
lblTemp
.
Text
=
store
.
currTempStr
;
//验证运动是否完成
...
...
@@ -296,7 +300,7 @@ namespace OnlineStore.AutoInOutStore
btnBatchInStore
.
Enabled
=
!
dooIsOpen
;
btnGetOutTray
.
Enabled
=
!
dooIsOpen
;
btnStartBatchInStore
.
Enabled
=
dooIsOpen
;
btnBatch
OutEnd
.
Enabled
=
dooIsOpen
;
btnBatch
Reset
.
Enabled
=
dooIsOpen
;
}
private
void
ReadPosistion
()
...
...
@@ -336,7 +340,7 @@ namespace OnlineStore.AutoInOutStore
lblOutPulse2
.
Text
=
string
.
Format
(
"{0:d}"
,
lOutPulse2
);
int
lCountPulse2
=
ACServerManager
.
GetActualtPosition
(
store
.
Config
.
UpDown_Axis
.
DeviceName
,
store
.
Config
.
UpDown_Axis
.
GetAxisValue
());
lblCountPulse2
.
Text
=
string
.
Format
(
"{0:d}"
,
lCountPulse2
);
txt
InoutTarget
.
Text
=
store
.
Config
.
InOut
_Axis
.
TargetPosition
.
ToString
();
txt
UpdownTarget
.
Text
=
store
.
Config
.
UpDown
_Axis
.
TargetPosition
.
ToString
();
if
(
deviceName
.
Equals
(
store
.
Config
.
UpDown_Axis
.
DeviceName
))
{
lblOutPulse
.
Text
=
lblOutPulse2
.
Text
;
...
...
@@ -350,13 +354,28 @@ namespace OnlineStore.AutoInOutStore
lblOutPulse3
.
Text
=
string
.
Format
(
"{0:d}"
,
lOutPulse3
);
int
lCountPulse3
=
ACServerManager
.
GetActualtPosition
(
store
.
Config
.
InOut_Axis
.
DeviceName
,
store
.
Config
.
InOut_Axis
.
GetAxisValue
());
lblCountPulse3
.
Text
=
string
.
Format
(
"{0:d}"
,
lCountPulse3
);
txt
UpdownTarget
.
Text
=
store
.
Config
.
UpDown
_Axis
.
TargetPosition
.
ToString
();
txt
InoutTarget
.
Text
=
store
.
Config
.
InOut
_Axis
.
TargetPosition
.
ToString
();
if
(
deviceName
.
Equals
(
store
.
Config
.
InOut_Axis
.
DeviceName
))
{
lblOutPulse
.
Text
=
lblOutPulse3
.
Text
;
lblCountPulse
.
Text
=
lblCountPulse3
.
Text
;
}
}
if
(
ACServerManager
.
ServerOnStatus
(
store
.
Config
.
Batch_Axis
.
DeviceName
,
store
.
Config
.
Batch_Axis
.
GetAxisValue
()))
{
axis_5_Alarm
.
IOValue
=
ACServerManager
.
GetAlarmStatus
(
store
.
Config
.
Batch_Axis
.
DeviceName
,
store
.
Config
.
Batch_Axis
.
GetAxisValue
());
int
lOutPulse5
=
ACServerManager
.
GetTargetPosition
(
store
.
Config
.
Batch_Axis
.
DeviceName
,
store
.
Config
.
Batch_Axis
.
GetAxisValue
());
lblOutPulse5
.
Text
=
string
.
Format
(
"{0:d}"
,
lOutPulse5
);
int
lCountPulse5
=
ACServerManager
.
GetActualtPosition
(
store
.
Config
.
Batch_Axis
.
DeviceName
,
store
.
Config
.
Batch_Axis
.
GetAxisValue
());
lblCountPulse5
.
Text
=
string
.
Format
(
"{0:d}"
,
lCountPulse5
);
txtBatchTarget
.
Text
=
store
.
Config
.
Batch_Axis
.
TargetPosition
.
ToString
();
if
(
deviceName
.
Equals
(
store
.
Config
.
Batch_Axis
.
DeviceName
))
{
lblOutPulse
.
Text
=
lblOutPulse5
.
Text
;
lblCountPulse
.
Text
=
lblCountPulse5
.
Text
;
}
}
lblAxisStatus
.
Text
=
"最后一次更新时间:"
+
DateTime
.
Now
.
ToLongTimeString
();
}
private
void
Bt_ClearCounter_Click
(
object
sender
,
EventArgs
e
)
...
...
@@ -1470,7 +1489,8 @@ namespace OnlineStore.AutoInOutStore
if
(
AutomaticBaiting
.
DoorIsClose
())
{
AutomaticBaiting
.
BatchDoorClose
(
false
);
AutomaticBaiting
.
Reset
();
bool
result
=
AutomaticBaiting
.
Reset
();
}
else
{
...
...
@@ -1478,5 +1498,31 @@ namespace OnlineStore.AutoInOutStore
}
}
private
void
button3_Click
(
object
sender
,
EventArgs
e
)
{
ReadPosistion
();
}
private
void
btnReadLimit1_Click
(
object
sender
,
EventArgs
e
)
{
int
value
=
ACServerManager
.
GetLimitPositiveSingle
(
GetPortName
(),
GetSlaveAddr
());
this
.
txtLimit1
.
Text
=
value
.
ToString
();
}
private
void
btnReadLimit2_Click
(
object
sender
,
EventArgs
e
)
{
int
value
=
ACServerManager
.
GetLimitNegativeSingle
(
GetPortName
(),
GetSlaveAddr
());
this
.
txtLimit2
.
Text
=
value
.
ToString
();
}
private
void
btnUpdateStatus_Click
(
object
sender
,
EventArgs
e
)
{
btnGetAlarm_Click
(
null
,
null
);
button1_Click_1
(
null
,
null
);
button2_Click
(
null
,
null
);
btnReadHomeSingle_Click
(
null
,
null
);
btnReadLimit1_Click
(
null
,
null
);
btnReadLimit2_Click
(
null
,
null
);
}
}
}
source/Common/Setting_Init.cs
查看文件 @
0fdd68d
...
...
@@ -72,5 +72,9 @@ namespace OnlineStore.Common
/// 上料轴转换系数,plus/mm
/// </summary>
public
static
string
AxisChangeValue
=
"AxisChangeValue"
;
/// <summary>
/// 是否是代码运行,不需要连接设备
/// </summary>
public
static
string
CodeRun
=
"CodeRun"
;
}
}
source/DeviceLibrary/DeviceLibrary.csproj
查看文件 @
0fdd68d
...
...
@@ -78,7 +78,6 @@
<Compile Include="ShuoKe\ShuoKeControls.cs" />
<Compile Include="store\model\AxisAlarmInfo.cs" />
<Compile Include="store\model\FixtureCodeInfo.cs" />
<Compile Include="store\AC_DeviceBase.cs" />
<Compile Include="store\InOrOutStoreParam.cs">
<SubType>Code</SubType>
</Compile>
...
...
source/DeviceLibrary/KangNaiDe/AITcpClient.cs
deleted
100644 → 0
查看文件 @
ff5c8c2
此文件的差异被折叠,
点击展开。
source/DeviceLibrary/KangNaiDe/KNDAIManager.cs
deleted
100644 → 0
查看文件 @
ff5c8c2
此文件的差异被折叠,
点击展开。
source/DeviceLibrary/PanasonicServo/ACServerManager.cs
查看文件 @
0fdd68d
...
...
@@ -294,7 +294,7 @@ namespace OnlineStore.DeviceLibrary
public
static
void
HomeMove
(
string
portName
,
int
slvAddr
,
int
speed
)
{
//默认负方向原点返回
//byte[] data = ACCMDManager.GetWriteData(slvAddr, ACCMDManager.CMD_WriteRegisters, ACCMDManager.BlockNo, ACCMDManager.Block_HomeMove1, 2);
//SendData(portName, data);
//旋转轴回正方向,其他轴回负方向
...
...
@@ -310,8 +310,8 @@ namespace OnlineStore.DeviceLibrary
//}
//else
//{
UpdateBlock
(
portName
,
slvAddr
,
ACCMDManager
.
Block_HomeMove1
);
LogUtil
.
debug
(
"回原点:反方向"
);
//默认负方向原点返回
UpdateBlock
(
portName
,
slvAddr
,
ACCMDManager
.
Block_HomeMove1
);
//}
Thread
.
Sleep
(
SleepMSendons
);
OpenAndCloseSTB
(
portName
,
slvAddr
);
...
...
source/DeviceLibrary/PanasonicServo/ACServerManager_Partial.cs
查看文件 @
0fdd68d
...
...
@@ -495,7 +495,9 @@ namespace OnlineStore.DeviceLibrary
byte
[]
reviceData
=
SendCommand
(
portName
,
dataArray
,
100
,
6
);
return
GetCoilData
(
portName
,
reviceData
,
ACCMDManager
.
Home_Single
);
}
/// <summary>
/// 负极限
/// </summary>
public
static
int
GetLimitNegativeSingle
(
string
portName
,
int
slvAddr
)
{
PreReadCoilAddr
=
ACCMDManager
.
Home_Single
;
...
...
@@ -503,7 +505,9 @@ namespace OnlineStore.DeviceLibrary
byte
[]
reviceData
=
SendCommand
(
portName
,
dataArray
,
100
,
6
);
return
GetCoilData
(
portName
,
reviceData
,
ACCMDManager
.
Home_Single
);
}
/// <summary>
/// 正极限
/// </summary>
public
static
int
GetLimitPositiveSingle
(
string
portName
,
int
slvAddr
)
{
PreReadCoilAddr
=
ACCMDManager
.
Home_Single
;
...
...
source/DeviceLibrary/StoreConfig/AC/StoreConfig.csv
查看文件 @
0fdd68d
此文件的差异被折叠,
点击展开。
source/DeviceLibrary/acSingleStore/AC_SA_BoxBean.cs
查看文件 @
0fdd68d
此文件的差异被折叠,
点击展开。
source/DeviceLibrary/acSingleStore/AC_SA_BoxBean_Partial.cs
查看文件 @
0fdd68d
...
...
@@ -28,13 +28,10 @@ namespace OnlineStore.DeviceLibrary
public
string
autoMsg
=
""
;
#
endregion
#
region
出入库参数
/// <summary>
/// 当前出入库的次数,超过配置的数量时,需要自动重置一下,再进行出入库
/// </summary>
private
int
CurrInOutCount
=
0
;
private
int
CurrInOutACount
=
0
;
#
region
出入库参数
private
int
CurrInOutCount
=
0
;
private
int
CurrInOutACount
=
0
;
private
bool
LoadParamPosition
(
InOutStoreParam
param
,
bool
IsBatch
)
{
if
(
param
==
null
)
...
...
@@ -94,6 +91,7 @@ namespace OnlineStore.DeviceLibrary
#
endregion
#
region
出入库结果验证
private
void
InOutBackToP1
(
int
InOut_P1
)
{
//判断是否在P1,如果是,不需要运行
...
...
@@ -271,7 +269,7 @@ namespace OnlineStore.DeviceLibrary
LogUtil
.
error
(
LOGGER
,
StoreName
+
logMsg
+
" 出错,叉子料盘检测有料"
);
return
false
;
}
LogUtil
.
info
(
LOGGER
,
StoreName
+
logMsg
,
storeMoveColor
);
LogUtil
.
info
(
LOGGER
,
StoreName
+
logMsg
);
storeRunStatus
=
StoreRunStatus
.
Busy
;
storeStatus
=
StoreStatus
.
InStoreExecute
;
StoreMove
.
NewMove
(
StoreMoveType
.
InStore
,
param
);
...
...
@@ -462,7 +460,7 @@ namespace OnlineStore.DeviceLibrary
{
string
posId
=
StoreMove
.
MoveParam
!=
null
?
StoreMove
.
MoveParam
.
PositionNum
:
""
;
LogUtil
.
info
(
LOGGER
,
StoreName
+
" 【"
+
posId
+
"】 整个入库流程结束,耗时【"
+
FormUtil
.
GetSpanStr
(
InOutWatch
.
Elapsed
)
+
"】!"
,
storeMoveColor
);
LogUtil
.
info
(
LOGGER
,
StoreName
+
" 【"
+
posId
+
"】 整个入库流程结束,耗时【"
+
FormUtil
.
GetSpanStr
(
InOutWatch
.
Elapsed
)
+
"】!"
);
StoreMove
.
EndMove
();
storeRunStatus
=
StoreRunStatus
.
Runing
;
//设备连接,入库后,BOX恢复原始状态
...
...
@@ -521,7 +519,7 @@ namespace OnlineStore.DeviceLibrary
}
storeStatus
=
StoreStatus
.
OutStoreExecute
;
LogUtil
.
info
(
LOGGER
,
StoreName
+
logMsg
,
storeMoveColor
);
LogUtil
.
info
(
LOGGER
,
StoreName
+
logMsg
);
storeRunStatus
=
StoreRunStatus
.
Busy
;
StoreMove
.
NewMove
(
StoreMoveType
.
OutStore
,
param
);
StoreMove
.
IsBatchInOutStore
=
IsBatchWork
;
...
...
@@ -683,7 +681,7 @@ namespace OnlineStore.DeviceLibrary
{
string
posId
=
StoreMove
.
MoveParam
!=
null
?
StoreMove
.
MoveParam
.
PositionNum
:
""
;
storeStatus
=
StoreStatus
.
StoreOnline
;
LogUtil
.
info
(
LOGGER
,
StoreName
+
" 【"
+
posId
+
"】 整个出库流程结束,耗时【"
+
FormUtil
.
GetSpanStr
(
InOutWatch
.
Elapsed
)
+
"】!"
,
storeMoveColor
);
LogUtil
.
info
(
LOGGER
,
StoreName
+
" 【"
+
posId
+
"】 整个出库流程结束,耗时【"
+
FormUtil
.
GetSpanStr
(
InOutWatch
.
Elapsed
)
+
"】!"
);
StoreMove
.
EndMove
();
storeRunStatus
=
StoreRunStatus
.
Runing
;
InOutEndProcess
(
StoreMoveType
.
OutStore
);
...
...
@@ -701,7 +699,7 @@ namespace OnlineStore.DeviceLibrary
{
string
posId
=
StoreMove
.
MoveParam
!=
null
?
StoreMove
.
MoveParam
.
PositionNum
:
""
;
storeStatus
=
StoreStatus
.
StoreOnline
;
LogUtil
.
info
(
LOGGER
,
StoreName
+
" 【"
+
posId
+
"】 整个出库流程结束,耗时【"
+
FormUtil
.
GetSpanStr
(
InOutWatch
.
Elapsed
)
+
"】!"
,
storeMoveColor
);
LogUtil
.
info
(
LOGGER
,
StoreName
+
" 【"
+
posId
+
"】 整个出库流程结束,耗时【"
+
FormUtil
.
GetSpanStr
(
InOutWatch
.
Elapsed
)
+
"】!"
);
StoreMove
.
EndMove
();
storeRunStatus
=
StoreRunStatus
.
Runing
;
InOutEndProcess
(
StoreMoveType
.
OutStore
);
...
...
@@ -808,10 +806,10 @@ namespace OnlineStore.DeviceLibrary
}
}
#
endregion
public
List
<
FixtureCodeInfo
>
waitOutStoreList
=
new
List
<
FixtureCodeInfo
>();
public
object
waitOutListLock
=
""
;
public
void
AddWaitOutInfo
(
FixtureCodeInfo
code
)
{
lock
(
waitOutListLock
)
...
...
@@ -819,6 +817,8 @@ namespace OnlineStore.DeviceLibrary
waitOutStoreList
.
Add
(
code
);
}
}
#
region
自动出入库循环代码
private
void
InOutEndProcess
(
StoreMoveType
storeMoveType
)
{
try
...
...
@@ -867,7 +867,7 @@ namespace OnlineStore.DeviceLibrary
{
LogUtil
.
info
(
LOGGER
,
StoreName
+
"自动进入下一个出库:posid="
+
posid
);
autoMsg
=
"自动出库:"
+
posid
;
StartOutStoreMove
(
new
InOutStoreParam
(
""
,
posid
),
false
);
StartOutStoreMove
(
new
InOutStoreParam
(
""
,
posid
),
false
);
}
}
}
...
...
@@ -902,7 +902,7 @@ namespace OnlineStore.DeviceLibrary
{
LogUtil
.
info
(
LOGGER
,
StoreName
+
"自动进入下一个入库:posid="
+
posid
);
autoMsg
=
"自动入库:"
+
posid
;
StartInStoreMove
(
new
InOutStoreParam
(
"AAAA"
,
posid
),
false
);
StartInStoreMove
(
new
InOutStoreParam
(
"AAAA"
,
posid
),
false
);
}
}
}
...
...
@@ -911,19 +911,20 @@ namespace OnlineStore.DeviceLibrary
{
LogUtil
.
error
(
LOGGER
,
ex
.
ToString
());
}
}
}
#
endregion
private
void
InStoreLog
(
string
msg
)
{
string
posId
=
StoreMove
.
MoveParam
!=
null
?
StoreMove
.
MoveParam
.
PositionNum
:
""
;
string
isBatchMsg
=
StoreMove
.
IsBatchInOutStore
?
"批量"
:
""
;
LogUtil
.
info
(
LOGGER
,
isBatchMsg
+
"【"
+
posId
+
"】"
+
msg
,
storeMoveColor
);
LogUtil
.
info
(
LOGGER
,
isBatchMsg
+
"【"
+
posId
+
"】"
+
msg
);
}
private
void
OutStoreLog
(
string
msg
)
{
string
posId
=
StoreMove
.
MoveParam
!=
null
?
StoreMove
.
MoveParam
.
PositionNum
:
""
;
string
isBatchMsg
=
StoreMove
.
IsBatchInOutStore
?
"批量"
:
""
;
LogUtil
.
info
(
LOGGER
,
isBatchMsg
+
"【"
+
posId
+
"】"
+
msg
,
storeMoveColor
);
LogUtil
.
info
(
LOGGER
,
isBatchMsg
+
"【"
+
posId
+
"】"
+
msg
);
}
}
}
source/DeviceLibrary/acSingleStore/AutomaticBaiting.cs
查看文件 @
0fdd68d
此文件的差异被折叠,
点击展开。
source/DeviceLibrary/acSingleStore/AutomaticBaiting_Partial.cs
查看文件 @
0fdd68d
...
...
@@ -290,7 +290,8 @@ namespace OnlineStore.DeviceLibrary
}
foreach
(
string
str
in
codeList
)
{
message
=
message
+
"=1+0x0-"
+
LastSize
+
"x"
+
LastHeight
+
" ="
+
str
+
spiltStr
;
message
=
message
+
spiltStr
+
str
;
//message = message + "=1+0x0-" + LastSize + "x" + LastHeight + " =" + str + spiltStr;
}
LastCode
=
message
;
if
(
LastCode
.
Equals
(
""
))
...
...
@@ -299,7 +300,7 @@ namespace OnlineStore.DeviceLibrary
WarnMsg
=
"未扫到二维码,请拿走料盘"
;
}
KND
.
IOMove
(
IO_Type
.
CameraLight_Power
,
IO_VALUE
.
LOW
);
StoreManager
.
Store
.
onCodeReceived
(
message
);
//
StoreManager.Store.onCodeReceived(message);
});
}
#
endregion
...
...
source/DeviceLibrary/halcon/HDevelopCodeLearn.cs
deleted
100644 → 0
查看文件 @
ff5c8c2
using
HalconDotNet
;
using
OnlineStore.Common
;
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Text
;
using
System.Threading
;
namespace
OnlineStore.DeviceLibrary
{
public
class
HDevelopCodeLearn
{
public
static
HWindow
hv_ExpDefaultWinHandle
;
public
static
HTuple
hv_AcqHandle
=
null
;
public
static
void
HDevelopStop
()
{
//MessageBox.Show("Press button to continue", "Program stop");
}
public
static
void
InitHalcon
()
{
// Default settings used in HDevelop
HOperatorSet
.
SetSystem
(
"width"
,
512
);
HOperatorSet
.
SetSystem
(
"height"
,
512
);
}
public
static
void
RunHalcon
(
HWindow
Window
,
string
camerName
,
string
codeType
,
string
paramPath
,
int
codeCount
)
{
InitHalcon
();
hv_ExpDefaultWinHandle
=
Window
;
action
(
camerName
,
codeType
,
paramPath
,
codeCount
);
}
private
static
bool
OpenCamera
(
string
cameraName
)
{
try
{
//[1] HD USB Camera
HOperatorSet
.
OpenFramegrabber
(
"GigEVision"
,
0
,
0
,
0
,
0
,
0
,
0
,
"default"
,
-
1
,
"default"
,
-
1
,
"false"
,
"default"
,
cameraName
,
0
,
-
1
,
out
hv_AcqHandle
);
//HOperatorSet.OpenFramegrabber("DirectShow", 1, 1, 0, 0, 0, 0, "default", 8, "rgb",
// -1, "false", "default", "[1] HD USB Camera", 0, -1, out hv_AcqHandle);
return
true
;
}
catch
(
Exception
ex
)
{
LogUtil
.
error
(
"打开摄像机失败:"
+
ex
.
ToString
()
+
",调用关闭摄像头"
);
CloseCamera
(
cameraName
);
return
false
;
}
}
private
static
void
CloseCamera
(
string
cameraName
)
{
try
{
HOperatorSet
.
CloseFramegrabber
(
hv_AcqHandle
);
hv_AcqHandle
=
null
;
}
catch
(
Exception
ex
)
{
LogUtil
.
error
(
"关闭摄像机失败:"
+
ex
.
ToString
());
}
}
public
static
bool
IsRun
=
false
;
// Main procedure
private
static
bool
action
(
string
cameraName
,
string
codeType
,
string
paramPath
,
int
codeCount
)
{
IsRun
=
true
;
IsLearnEnd
=
false
;
IsTestEnd
=
false
;
try
{
HTuple
hv_code_type
=
codeType
;
HTuple
hv_model_path
=
paramPath
;
HObject
ho_Image
=
null
,
ho_SymbolXLDs
=
null
;
HTuple
hv_train_first
=
null
,
/*hv_AcqHandle = null,*/
hv_DataCodeHandle
=
null
;
HTuple
hv_ResultHandles
=
new
HTuple
(),
hv_DecodedDataStrings
=
new
HTuple
();
HTuple
hv_GenParamNames
=
new
HTuple
(),
hv_ModelBeforeTraining
=
new
HTuple
();
// Initialize local and output iconic variables
HOperatorSet
.
GenEmptyObj
(
out
ho_Image
);
HOperatorSet
.
GenEmptyObj
(
out
ho_SymbolXLDs
);
//Image Acquisition 04: Code generated by Image Acquisition 04
//Image Acquisition 01: Code generated by Image Acquisition 01
//hv_code_type = "Data Matrix ECC 200";
//hv_model_path = ("E:/BaiduNetdiskDownload/" + hv_code_type) + ".dcm";
hv_train_first
=
1
;
if
(!
OpenCamera
(
cameraName
))
{
return
false
;
}
//HOperatorSet.GrabImageStart(hv_AcqHandle, -1);
HOperatorSet
.
CreateDataCode2dModel
(
hv_code_type
,
new
HTuple
(),
new
HTuple
(),
out
hv_DataCodeHandle
);
//set_data_code_2d_param (DataCodeHandle, 'strict_model', 'yes')
//set_data_code_2d_param (DataCodeHandle, 'persistence', 0)
//set_data_code_2d_param (DataCodeHandle, 'polarity', 'light_on_dark')
List
<
string
>
findCode
=
new
List
<
string
>();
if
((
int
)(
hv_train_first
)
!=
0
)
{
while
(
findCode
.
Count
<
codeCount
&&
IsLearnEnd
.
Equals
(
false
))
{
ho_Image
.
Dispose
();
HOperatorSet
.
GrabImageAsync
(
out
ho_Image
,
hv_AcqHandle
,
-
1
);
//Image Acquisition 04: Do something
//write_image (Image, 'jpeg', 0, 'E:/BaiduNetdiskDownload/fuba2.jpg')
if
(
ho_Image
!=
null
)
{
ho_SymbolXLDs
.
Dispose
();
HOperatorSet
.
FindDataCode2d
(
ho_Image
,
out
ho_SymbolXLDs
,
hv_DataCodeHandle
,
"train"
,
"all"
,
out
hv_ResultHandles
,
out
hv_DecodedDataStrings
);
if
((
int
)(
new
HTuple
((
new
HTuple
(
hv_DecodedDataStrings
.
TupleLength
())).
TupleNotEqual
(
0
)))
!=
0
)
{
HOperatorSet
.
QueryDataCode2dParams
(
hv_DataCodeHandle
,
"get_model_params"
,
out
hv_GenParamNames
);
HOperatorSet
.
GetDataCode2dParam
(
hv_DataCodeHandle
,
hv_GenParamNames
,
out
hv_ModelBeforeTraining
);
HDevelopStop
();
string
[]
resultList
=
hv_DecodedDataStrings
.
SArr
;
foreach
(
string
str
in
resultList
)
{
if
(!
findCode
.
Contains
(
str
))
{
LogUtil
.
info
(
"["
+
cameraName
+
"]["
+
codeType
+
"]学习【"
+
str
+
"】"
);
findCode
.
Add
(
str
);
}
}
}
ShowImage
(
ho_Image
,
ho_SymbolXLDs
);
}
Thread
.
Sleep
(
500
);
}
//*参数写入文件
LogUtil
.
info
(
"["
+
cameraName
+
"]["
+
codeType
+
"]保存参数到文件【"
+
paramPath
+
"】"
);
HOperatorSet
.
WriteDataCode2dModel
(
hv_DataCodeHandle
,
hv_model_path
);
HOperatorSet
.
ClearDataCode2dModel
(
hv_DataCodeHandle
);
}
//Read the previously saved data code model
findCode
=
new
List
<
string
>();
HOperatorSet
.
ReadDataCode2dModel
(
hv_model_path
,
out
hv_DataCodeHandle
);
while
(
findCode
.
Count
<
codeCount
&&
IsTestEnd
.
Equals
(
false
))
{
ho_Image
.
Dispose
();
HOperatorSet
.
GrabImageAsync
(
out
ho_Image
,
hv_AcqHandle
,
-
1
);
//Image Acquisition 04: Do something
//write_image (Image, 'jpeg', 0, 'E:/BaiduNetdiskDownload/fuba2.jpg')
if
(
ho_Image
!=
null
)
{
ho_SymbolXLDs
.
Dispose
();
HOperatorSet
.
FindDataCode2d
(
ho_Image
,
out
ho_SymbolXLDs
,
hv_DataCodeHandle
,
"stop_after_result_num"
,
5
,
out
hv_ResultHandles
,
out
hv_DecodedDataStrings
);
ShowImage
(
ho_Image
,
ho_SymbolXLDs
);
if
((
int
)(
new
HTuple
((
new
HTuple
(
hv_DecodedDataStrings
.
TupleLength
())).
TupleNotEqual
(
0
)))
!=
0
)
{
string
[]
resultList
=
hv_DecodedDataStrings
.
SArr
;
foreach
(
string
str
in
resultList
)
{
if
(!
findCode
.
Contains
(
str
))
{
findCode
.
Add
(
str
);
LogUtil
.
info
(
"["
+
cameraName
+
"]["
+
codeType
+
"]检测到【"
+
str
+
"】"
);
}
}
}
}
Thread
.
Sleep
(
500
);
}
HOperatorSet
.
ClearDataCode2dModel
(
hv_DataCodeHandle
);
CloseCamera
(
cameraName
);
ho_Image
.
Dispose
();
ho_SymbolXLDs
.
Dispose
();
IsRun
=
false
;
return
true
;
}
catch
(
Exception
ex
)
{
LogUtil
.
error
(
"出错了:"
+
ex
.
ToString
());
CloseCamera
(
cameraName
);
IsRun
=
false
;
return
false
;
}
}
public
static
bool
IsTestEnd
=
false
;
public
static
bool
IsLearnEnd
=
false
;
public
static
void
StopLearn
()
{
IsTestEnd
=
true
;
IsLearnEnd
=
true
;
}
private
static
int
dWidth
=
0
;
private
static
int
dHeight
=
0
;
private
static
void
ShowImage
(
HObject
ho_Image
,
HObject
ho_SymbolXLDs
)
{
if
(
dWidth
<=
0
)
{
HTuple
width
,
height
;
//int dWidth = 0; int dHeight = 0;
HOperatorSet
.
GetImageSize
(
ho_Image
,
out
width
,
out
height
);
dWidth
=
(
int
)
width
.
D
;
dHeight
=
(
int
)
height
.
D
;
hv_ExpDefaultWinHandle
.
SetPart
(
0
,
0
,
dHeight
,
dWidth
);
}
HOperatorSet
.
DispObj
(
ho_Image
,
hv_ExpDefaultWinHandle
);
HOperatorSet
.
DispObj
(
ho_SymbolXLDs
,
hv_ExpDefaultWinHandle
);
}
}
}
source/DeviceLibrary/halcon/HDevelopExport.cs
deleted
100644 → 0
查看文件 @
ff5c8c2
此文件的差异被折叠,
点击展开。
source/DeviceLibrary/store/AC_Store.cs
查看文件 @
0fdd68d
...
...
@@ -15,12 +15,10 @@ namespace OnlineStore.DeviceLibrary
/// <summary>
/// 康泰克单台自动料仓
/// </summary>
public
abstract
class
AC_Store
:
AC_DeviceBase
public
abstract
class
AC_Store
{
public
AC_Store
()
{
}
protected
static
readonly
ILog
LOGGER
=
LogManager
.
GetLogger
(
System
.
Reflection
.
MethodBase
.
GetCurrentMethod
().
DeclaringType
);
public
Stopwatch
runTimeWatch
=
new
Stopwatch
();
/// <summary>
...
...
@@ -45,6 +43,170 @@ namespace OnlineStore.DeviceLibrary
public
AlarmInfo
alarmInfo
=
new
AlarmInfo
();
/// <summary>
/// 料仓单个调试状态(默认不是调试状态)
/// </summary>
public
bool
IsDebug
=
false
;
/// <summary>
///1=设备联机(正常就绪)(入库后,BOX恢复原始状态)(出库后,移载装置恢复原始状态),
///2=急停,3=故障,4=警告,5=调试
/// 6=入库执行中,7=入仓完成,8=入仓失败
/// 9=出库执行,10=出仓完成,11=出库失败
/// </summary>
public
StoreStatus
storeStatus
=
StoreStatus
.
StoreOnline
;
/// <summary>
/// 料仓状态
/// </summary>
public
StoreRunStatus
storeRunStatus
=
StoreRunStatus
.
Wait
;
/// <summary>
/// 移动信息
/// </summary>
public
StoreMoveInfo
StoreMove
=
null
;
/// <summary>
/// 提示消息,一般发给服务器后清空(LineBean表示报警提示消息,BoxBean表示出入库失败的原因记录)
/// </summary>
public
string
WarnMsg
=
""
;
public
string
StoreName
{
get
;
set
;
}
public
int
StoreID
{
get
;
set
;
}
protected
System
.
Timers
.
Timer
mainTimer
;
protected
System
.
Timers
.
Timer
serverConnectTimer
=
new
System
.
Timers
.
Timer
();
protected
System
.
Timers
.
Timer
IoCheckTimer
=
new
System
.
Timers
.
Timer
();
public
AC_Store
()
{
}
/// <summary>
/// 初始化
/// </summary>
protected
virtual
void
Init
()
{
StoreMove
=
new
StoreMoveInfo
(
StoreName
);
mainTimer
=
new
System
.
Timers
.
Timer
();
mainTimer
.
Enabled
=
false
;
mainTimer
.
Interval
=
300
;
mainTimer
.
Elapsed
+=
timersTimer_Elapsed
;
mainTimer
.
AutoReset
=
true
;
serverConnectTimer
=
new
System
.
Timers
.
Timer
();
serverConnectTimer
.
Interval
=
1000
;
serverConnectTimer
.
AutoReset
=
true
;
serverConnectTimer
.
Enabled
=
false
;
//serverConnectTimer.Elapsed += server_connect_timer_Tick;
IoCheckTimer
=
new
System
.
Timers
.
Timer
();
IoCheckTimer
.
Interval
=
200
;
IoCheckTimer
.
AutoReset
=
true
;
IoCheckTimer
.
Enabled
=
false
;
//IoCheckTimer.Elapsed += IoCheckTimer_Elapsed;
}
//public StoreRunStatus storeRunStatus
//{
// get
// {
// return storerunstatus;
// }
// set
// {
// StoreRunStatus oldStatus = storerunstatus;
// storerunstatus = value;
// }
//}
/// <summary>
/// 定时处理,监听信号,监听IO
/// </summary>
protected
abstract
void
timersTimer_Elapsed
(
object
sender
,
System
.
Timers
.
ElapsedEventArgs
e
);
#
region
出库
//public abstract bool StartOutStoreMove(InOutStoreParam param);
protected
abstract
void
OutStoreProcess
();
#
endregion
#
region
入库
//public abstract bool StartInStoreMove(InOutStoreParam param);
protected
abstract
void
InStoreProcess
();
#
endregion
public
string
GetRunStr
(
StoreRunStatus
runStatus
,
bool
IsStore
)
{
string
sta
=
"运行中"
;
string
aa
=
""
;
switch
(
runStatus
)
{
case
StoreRunStatus
.
Busy
:
sta
=
"忙碌"
;
break
;
case
StoreRunStatus
.
HomeMoving
:
sta
=
"原点返回"
;
break
;
case
StoreRunStatus
.
Reset
:
sta
=
"重置"
;
break
;
case
StoreRunStatus
.
Runing
:
sta
=
"运行中"
;
break
;
case
StoreRunStatus
.
Wait
:
sta
=
"等待启动"
;
break
;
}
if
(
runStatus
>
StoreRunStatus
.
Wait
)
{
//"0":"急停中", "1":"设备联机", "2":"故障中", "3":"入库执行中", "4":"出库执行中", 5":"料盘入仓位完成", "6":"料盘出仓位完成", 7":"设备调试中",
switch
(
storeStatus
)
{
case
StoreStatus
.
Debugging
:
aa
=
"设备调试中"
;
break
;
case
StoreStatus
.
InStoreEnd
:
aa
=
"料盘入仓位完成"
;
break
;
case
StoreStatus
.
InStoreExecute
:
aa
=
"入库执行中"
;
break
;
case
StoreStatus
.
InTrouble
:
aa
=
"故障中"
;
break
;
case
StoreStatus
.
OutStoreBoxEnd
:
aa
=
"料盘出仓位完成"
;
break
;
case
StoreStatus
.
OutStoreExecute
:
aa
=
"出库执行中"
;
break
;
case
StoreStatus
.
StoreOnline
:
aa
=
"设备联机"
;
break
;
case
StoreStatus
.
SuddenStop
:
aa
=
"急停中"
;
break
;
case
StoreStatus
.
OutMoveExecute
:
aa
=
"出库完成"
;
break
;
case
StoreStatus
.
InStoreFaild
:
aa
=
"入库失败("
+
WarnMsg
+
")"
;
break
;
case
StoreStatus
.
OutStoreFaild
:
aa
=
"出库失败("
+
WarnMsg
+
")"
;
break
;
}
if
(!
aa
.
Equals
(
""
))
{
return
sta
+
"_"
+
aa
;
}
else
{
return
sta
;
}
}
else
{
return
sta
;
}
}
/// <summary>
/// 记录上一次的部分IO状态,主要是急停,气压检测信号,复位信号,用来判断是否io发生改变
/// </summary>
public
Dictionary
<
string
,
IO_VALUE
>
DILastValueMap
=
new
Dictionary
<
string
,
IO_VALUE
>();
...
...
source/DeviceLibrary/store/StoreMoveStep.cs
查看文件 @
0fdd68d
...
...
@@ -366,7 +366,11 @@ namespace OnlineStore.DeviceLibrary
/// <summary>
/// 先上升到料盘检测1(上料机构)信号亮
/// </summary>
AUTO_I01_MoveToUp
,
AUTO_I00_MoveToUp
,
/// <summary>
/// 扫码
/// </summary>
AUTO_I01_ScanCode
,
/// <summary>
/// 吸盘下降
...
...
@@ -384,9 +388,9 @@ namespace OnlineStore.DeviceLibrary
AUTO_I04_SuckingDisc_Up
,
/// <summary>
///
扫码
///
从服务器获取PosID
/// </summary>
AUTO_I05_
ScanCode
,
AUTO_I05_
GetPosId
,
/// <summary>
/// 等待料盘被叉子拿走
...
...
source/DeviceLibrary/store/model/StoreMoveInfo.cs
查看文件 @
0fdd68d
...
...
@@ -293,8 +293,7 @@ namespace OnlineStore.DeviceLibrary
}
public
static
WaitResultInfo
WaitCodeOK
()
{
WaitResultInfo
wait
=
new
WaitResultInfo
();
WaitResultInfo
wait
=
new
WaitResultInfo
();
wait
.
WaitType
=
11
;
return
wait
;
}
...
...
source/LoadCVSLibrary/position/CSVPositionReader.cs
查看文件 @
0fdd68d
...
...
@@ -81,9 +81,12 @@ namespace OnlineStore.LoadCSVLibrary
{
if
(
array
.
Length
>=
titleIndex
.
Count
)
{
if
(
array
.
Length
>
0
&&
array
[
0
].
Equals
(
""
)
)
if
(
array
.
Length
>
0
)
{
continue
;
if
(
array
[
0
].
Equals
(
""
)
||
array
[
1
].
Equals
(
""
)
||
array
[
2
].
Equals
(
""
)
||
array
[
3
].
Equals
(
""
)
||
array
[
4
].
Equals
(
""
))
{
continue
;
}
}
var
bllIns
=
type
.
Assembly
.
CreateInstance
(
type
.
FullName
);
//取得属性集合
...
...
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论