Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
孙克
/
RC1250-AssemblyLine
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
作业
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit 39059f5b
由
LN
编写于
2019-11-28 11:50:03 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
1
1 个父辈
44252d09
隐藏空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
73 行增加
和
104 行删除
source/DeviceLibrary/assemblyLine/EquipBase.cs
source/DeviceLibrary/assemblyLine/LineBean.cs
source/DeviceLibrary/assemblyLine/MoveEquip.cs
source/DeviceLibrary/assemblymanager/TrayManager.cs
source/DeviceLibrary/assemblyLine/EquipBase.cs
查看文件 @
39059f5
using
OnlineStore.Common
;
using
OnlineStore.LoadCSVLibrary
;
using
System
;
using
System.Collections.Concurrent
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Text
;
...
...
@@ -14,10 +15,9 @@ namespace OnlineStore.DeviceLibrary
public
bool
IsDebug
=
false
;
public
bool
UseAxis
=
false
;
public
List
<
InOutParam
>
waitOutStoreList
=
new
List
<
InOutParam
>();
public
ConcurrentQueue
<
InOutParam
>
waitOutStoreList
=
new
ConcurrentQueue
<
InOutParam
>();
public
List
<
InOutParam
>
waitInStoreList
=
new
List
<
InOutParam
>();
internal
object
waitInListLock
=
""
;
internal
object
waitOutListLock
=
""
;
internal
object
waitInListLock
=
""
;
/// <summary>
///移栽装置后面分为两条移动线
/// </summary>
...
...
source/DeviceLibrary/assemblyLine/LineBean.cs
查看文件 @
39059f5
...
...
@@ -231,7 +231,7 @@ namespace OnlineStore.DeviceLibrary
}
private
void
RHomeOp
()
{
TrayManager
.
SidesWayStateMap
=
new
Dictionary
<
int
,
int
>()
;
TrayManager
.
SidesWayStateMap
=
new
System
.
Collections
.
Concurrent
.
ConcurrentDictionary
<
int
,
int
>()
;
alarmType
=
LineAlarmType
.
None
;
mainTimer
.
Enabled
=
false
;
IoCheckTimer
.
Enabled
=
false
;
...
...
source/DeviceLibrary/assemblyLine/MoveEquip.cs
查看文件 @
39059f5
...
...
@@ -235,15 +235,9 @@ namespace OnlineStore.DeviceLibrary
if
(
IsDebug
.
Equals
(
false
)
&&
MoveInfo
.
MoveType
.
Equals
(
LineMoveType
.
None
)
&&
runStatus
.
Equals
(
LineRunStatus
.
Runing
))
{
InOutParam
waitOutParma
=
null
;
lock
(
waitOutListLock
)
{
if
(
waitOutStoreList
.
Count
>
0
)
{
waitOutParma
=
waitOutStoreList
[
0
];
waitOutStoreList
.
RemoveAt
(
0
);
}
}
if
(
waitOutParma
!=
null
)
bool
ok
=
waitOutStoreList
.
TryDequeue
(
out
waitOutParma
);
if
(
ok
)
{
LogUtil
.
info
(
Name
+
"开始 执行排队中的出库【"
+
waitOutParma
.
ToStr
()
+
"】"
);
//出库
...
...
@@ -257,20 +251,17 @@ namespace OnlineStore.DeviceLibrary
}
}
public
void
AddWaitOutInfo
(
InOutParam
param
)
{
lock
(
waitOutListLock
)
{
//判断是否已经加入,不重复加
List
<
InOutParam
>
paramList
=
(
from
m
in
waitOutStoreList
where
m
.
PosId
.
Equals
(
param
.
PosId
)
select
m
).
ToList
<
InOutParam
>();
if
(
paramList
.
Count
>
0
)
{
//判断是否已经加入,不重复加
List
<
InOutParam
>
paramList
=
(
from
m
in
waitOutStoreList
where
m
.
PosId
.
Equals
(
param
.
PosId
)
select
m
).
ToList
<
InOutParam
>();
if
(
paramList
.
Count
>
0
)
{
LogUtil
.
error
(
Name
+
"出库【"
+
param
.
ToStr
()
+
"】加入等待出库队列失败,此库位已存在列表中"
);
}
else
{
waitOutStoreList
.
Add
(
param
);
}
LogUtil
.
error
(
Name
+
"出库【"
+
param
.
ToStr
()
+
"】加入等待出库队列失败,此库位已存在列表中"
);
}
else
{
waitOutStoreList
.
Enqueue
(
param
);
}
}
#
region
上下气缸伺服运动
...
...
source/DeviceLibrary/assemblymanager/TrayManager.cs
查看文件 @
39059f5
using
OnlineStore.Common
;
using
OnlineStore.LoadCSVLibrary
;
using
System
;
using
System.Collections.Concurrent
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Text
;
...
...
@@ -13,12 +14,12 @@ namespace OnlineStore.DeviceLibrary
/// <summary>
/// 出库时,可以不下降直接放料盘的宽度
/// </summary>
public
const
int
CanPushBagWidth
=
7
;
public
const
int
CanPushBagWidth
=
7
;
/// <summary>
/// 放在公共地方,方便存取,夹料编码盘列表,key=编码(1-6),value=是否有物品,true=有物品
/// </summary>
private
static
Dictionary
<
int
,
TrayInfo
>
fixtureCodeFullMap
=
new
Dictionary
<
int
,
TrayInfo
>();
private
static
object
fixtureMapLock
=
""
;
private
static
ConcurrentDictionary
<
int
,
TrayInfo
>
fixtureCodeFullMap
=
new
Concurrent
Dictionary
<
int
,
TrayInfo
>();
/// <summary>
/// 流水线需要的空盘数量
/// </summary>
...
...
@@ -39,8 +40,8 @@ namespace OnlineStore.DeviceLibrary
public
static
bool
LineRunTest
=
false
;
static
TrayManager
()
{
LineRunTest
=
ConfigAppSettings
.
GetIntValue
(
Setting_Init
.
LineRunTest
).
Equals
(
1
);
}
LineRunTest
=
ConfigAppSettings
.
GetIntValue
(
Setting_Init
.
LineRunTest
).
Equals
(
1
);
}
internal
static
void
AddNeedEmptyTrayNum
()
{
Interlocked
.
Increment
(
ref
LineNeedEmptyTrayNum
);
...
...
@@ -50,8 +51,6 @@ namespace OnlineStore.DeviceLibrary
{
Interlocked
.
Decrement
(
ref
LineNeedEmptyTrayNum
);
}
/// <summary>
/// 对应的盘号(1-6)是否有料盘
/// </summary>
...
...
@@ -59,85 +58,66 @@ namespace OnlineStore.DeviceLibrary
/// <returns>盘上是否有料盘</returns>
internal
static
bool
TrayIsFull
(
int
trayNum
)
{
lock
(
fixtureMapLock
)
if
(
fixtureCodeFullMap
.
ContainsKey
(
trayNum
)
)
{
if
(
fixtureCodeFullMap
.
ContainsKey
(
trayNum
))
{
return
fixtureCodeFullMap
[
trayNum
].
IsFull
;
}
return
fixtureCodeFullMap
[
trayNum
].
IsFull
;
}
return
false
;
}
internal
static
TrayInfo
GetTrayInfo
(
int
trayNum
)
{
lock
(
fixtureMapLock
)
if
(
fixtureCodeFullMap
.
ContainsKey
(
trayNum
)
)
{
if
(
fixtureCodeFullMap
.
ContainsKey
(
trayNum
))
{
return
fixtureCodeFullMap
[
trayNum
];
}
return
fixtureCodeFullMap
[
trayNum
];
}
return
null
;
}
internal
static
void
UpdateTrayInfo
(
int
trayNum
,
bool
isFull
=
false
,
int
inOrOut
=
0
,
string
wareCode
=
""
,
string
posId
=
""
,
int
plateH
=
0
,
int
plateW
=
0
)
internal
static
void
UpdateTrayInfo
(
int
trayNum
,
bool
isFull
=
false
,
int
inOrOut
=
0
,
string
wareCode
=
""
,
string
posId
=
""
,
int
plateH
=
0
,
int
plateW
=
0
)
{
lock
(
fixtureMapLock
)
if
(
fixtureCodeFullMap
.
ContainsKey
(
trayNum
)
)
{
if
(
fixtureCodeFullMap
.
ContainsKey
(
trayNum
))
{
fixtureCodeFullMap
[
trayNum
].
IsFull
=
isFull
;
fixtureCodeFullMap
[
trayNum
].
InOrOutStore
=
inOrOut
;
fixtureCodeFullMap
[
trayNum
].
WareCode
=
wareCode
;
fixtureCodeFullMap
[
trayNum
].
PosId
=
posId
;
fixtureCodeFullMap
[
trayNum
].
PlateH
=
plateH
;
fixtureCodeFullMap
[
trayNum
].
PlateW
=
plateW
;
fixtureCodeFullMap
[
trayNum
].
IsFull
=
isFull
;
fixtureCodeFullMap
[
trayNum
].
InOrOutStore
=
inOrOut
;
}
else
{
TrayInfo
fixture
=
new
TrayInfo
(
trayNum
,
isFull
,
inOrOut
,
wareCode
,
posId
,
plateH
,
plateW
);
fixtureCodeFullMap
.
Add
(
trayNum
,
fixture
);
}
fixtureCodeFullMap
[
trayNum
].
WareCode
=
wareCode
;
fixtureCodeFullMap
[
trayNum
].
PosId
=
posId
;
fixtureCodeFullMap
[
trayNum
].
PlateH
=
plateH
;
fixtureCodeFullMap
[
trayNum
].
PlateW
=
plateW
;
}
else
{
TrayInfo
fixture
=
new
TrayInfo
(
trayNum
,
isFull
,
inOrOut
,
wareCode
,
posId
,
plateH
,
plateW
);
fixtureCodeFullMap
.
TryAdd
(
trayNum
,
fixture
);
}
}
internal
static
void
UpdateTrayCode
(
int
trayNum
,
string
wareCode
=
""
)
internal
static
void
UpdateTrayCode
(
int
trayNum
,
string
wareCode
=
""
)
{
LogUtil
.
info
(
"更新托盘【"
+
trayNum
+
"】的条码为【"
+
wareCode
+
"】"
);
lock
(
fixtureMapLock
)
LogUtil
.
info
(
"更新托盘【"
+
trayNum
+
"】的条码为【"
+
wareCode
+
"】"
);
if
(
fixtureCodeFullMap
.
ContainsKey
(
trayNum
)
)
{
if
(
fixtureCodeFullMap
.
ContainsKey
(
trayNum
))
{
fixtureCodeFullMap
[
trayNum
].
WareCode
=
wareCode
;
}
fixtureCodeFullMap
[
trayNum
].
WareCode
=
wareCode
;
}
}
internal
static
void
UpdateInStoreNG
(
int
trayNum
,
bool
isNg
=
false
)
internal
static
void
UpdateInStoreNG
(
int
trayNum
,
bool
isNg
=
false
)
{
LogUtil
.
info
(
"更新托盘【"
+
trayNum
+
"】InStoreNG=【"
+
isNg
+
"】"
);
lock
(
fixtureMapLock
)
if
(
fixtureCodeFullMap
.
ContainsKey
(
trayNum
)
)
{
if
(
fixtureCodeFullMap
.
ContainsKey
(
trayNum
))
{
fixtureCodeFullMap
[
trayNum
].
InStoreNG
=
isNg
;
}
fixtureCodeFullMap
[
trayNum
].
InStoreNG
=
isNg
;
}
}
internal
static
void
UpdateTrayPosId
(
int
trayNum
,
string
PosId
=
""
)
{
lock
(
fixtureMapLock
)
if
(
fixtureCodeFullMap
.
ContainsKey
(
trayNum
))
{
if
(
fixtureCodeFullMap
.
ContainsKey
(
trayNum
))
{
fixtureCodeFullMap
[
trayNum
].
PosId
=
PosId
;
}
fixtureCodeFullMap
[
trayNum
].
PosId
=
PosId
;
}
}
/// <summary>
/// 是否还有有料仓的盘
...
...
@@ -183,7 +163,7 @@ namespace OnlineStore.DeviceLibrary
else
if
(
trayNum
.
Equals
(
1
)
&&
preTrayNum
>=
MaxTrayNum
)
{
return
true
;
}
}
return
false
;
}
...
...
@@ -203,10 +183,10 @@ namespace OnlineStore.DeviceLibrary
if
(
data
!=
null
)
{
if
(
data
.
RFType
.
Equals
(
"E"
))
{
{
return
data
.
Num
;
}
else
}
else
{
LogUtil
.
error
(
"读取托盘RFID["
+
subType
+
"]["
+
ip
+
"]的数据出错:"
+
data
.
ToStr
());
}
...
...
@@ -231,26 +211,26 @@ namespace OnlineStore.DeviceLibrary
}
return
data
;
}
public
static
string
GetRFIP
(
int
subType
,
int
rtType
=
0
)
public
static
string
GetRFIP
(
int
subType
,
int
rtType
=
0
)
{
string
ip
=
""
;
string
rtName
=
DeviceConfig
.
RFIP_Str
+
"_"
+
subType
.
ToString
().
PadLeft
(
3
,
'0'
);
string
rtName
=
DeviceConfig
.
RFIP_Str
+
"_"
+
subType
.
ToString
().
PadLeft
(
3
,
'0'
);
if
(
rtType
>
0
)
{
rtName
+=
"-"
+
rtType
.
ToString
();
}
}
if
(
DeviceConfig
.
ProRFIpMap
.
ContainsKey
(
rtName
))
{
ip
=
DeviceConfig
.
ProRFIpMap
[
rtName
];
ip
=
DeviceConfig
.
ProRFIpMap
[
rtName
];
}
return
ip
;
}
#
region
横移状态缓存
internal
static
Dictionary
<
int
,
int
>
SidesWayStateMap
=
new
Dictionary
<
int
,
int
>();
internal
static
object
swMapLock
=
""
;
internal
static
ConcurrentDictionary
<
int
,
int
>
SidesWayStateMap
=
new
Concurrent
Dictionary
<
int
,
int
>();
internal
static
bool
CanMoveSidesWay
(
int
swNum
)
{
if
(
SidesWayStateMap
.
ContainsKey
(
swNum
))
...
...
@@ -258,7 +238,7 @@ namespace OnlineStore.DeviceLibrary
if
(
SidesWayStateMap
[
swNum
].
Equals
(
1
))
{
return
true
;
}
}
else
if
(
swNum
.
Equals
(
1
)
||
swNum
.
Equals
(
3
))
{
if
(
SidesWayStateMap
[
swNum
].
Equals
(
0
))
...
...
@@ -274,26 +254,24 @@ namespace OnlineStore.DeviceLibrary
/// </summary>
/// <param name="swNum">横移编号</param>
/// <param name="value">0=未处理等待中,1=托盘处理完成,可处理横移,2=托盘检测处理中</param>
internal
static
void
UpdateSWState
(
int
swNum
,
int
value
)
internal
static
void
UpdateSWState
(
int
swNum
,
int
value
)
{
if
(
swNum
<=
0
)
{
return
;
}
lock
(
swMapLock
)
if
(
SidesWayStateMap
.
ContainsKey
(
swNum
))
{
if
(
SidesWayStateMap
.
ContainsKey
(
swNum
))
{
SidesWayStateMap
[
swNum
]
=
value
;
}
else
{
SidesWayStateMap
.
Add
(
swNum
,
value
);
}
SidesWayStateMap
[
swNum
]
=
value
;
}
else
{
SidesWayStateMap
.
TryAdd
(
swNum
,
value
);
}
}
#
endregion
}
}
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论