Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
李娜
/
SO827-AssemblyLine
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
图表
网络
创建新的问题
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit 15e8b795
由
LN
编写于
2021-02-19 15:32:26 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
bug修改
1 个父辈
c39c78d8
全部展开
隐藏空白字符变更
内嵌
并排
正在显示
9 个修改的文件
包含
237 行增加
和
38 行删除
source/AssemblyLineClient/FrmFeedingEquip.Designer.cs
source/AssemblyLineClient/FrmHYEquip.Designer.cs
source/AssemblyLineClient/FrmHYEquip.cs
source/DeviceLibrary/DeviceLibrary.csproj
source/DeviceLibrary/assemblyLine/EquipBase.cs
source/DeviceLibrary/assemblyLine/LineBean_Partial.cs
source/DeviceLibrary/assemblyLine/MoveEquip_Partial.cs
source/DeviceLibrary/assemblymanager/EDataManager.cs
source/DeviceLibrary/server/LineServer.cs
source/AssemblyLineClient/FrmFeedingEquip.Designer.cs
查看文件 @
15e8b79
...
@@ -218,7 +218,7 @@
...
@@ -218,7 +218,7 @@
this
.
lblAddr
.
AutoSize
=
true
;
this
.
lblAddr
.
AutoSize
=
true
;
this
.
lblAddr
.
Font
=
new
System
.
Drawing
.
Font
(
"微软雅黑"
,
9F
,
System
.
Drawing
.
FontStyle
.
Regular
,
System
.
Drawing
.
GraphicsUnit
.
Point
,
((
byte
)(
134
)));
this
.
lblAddr
.
Font
=
new
System
.
Drawing
.
Font
(
"微软雅黑"
,
9F
,
System
.
Drawing
.
FontStyle
.
Regular
,
System
.
Drawing
.
GraphicsUnit
.
Point
,
((
byte
)(
134
)));
this
.
lblAddr
.
ImageAlign
=
System
.
Drawing
.
ContentAlignment
.
MiddleRight
;
this
.
lblAddr
.
ImageAlign
=
System
.
Drawing
.
ContentAlignment
.
MiddleRight
;
this
.
lblAddr
.
Location
=
new
System
.
Drawing
.
Point
(
3
26
,
27
);
this
.
lblAddr
.
Location
=
new
System
.
Drawing
.
Point
(
3
64
,
27
);
this
.
lblAddr
.
Name
=
"lblAddr"
;
this
.
lblAddr
.
Name
=
"lblAddr"
;
this
.
lblAddr
.
Size
=
new
System
.
Drawing
.
Size
(
46
,
17
);
this
.
lblAddr
.
Size
=
new
System
.
Drawing
.
Size
(
46
,
17
);
this
.
lblAddr
.
TabIndex
=
258
;
this
.
lblAddr
.
TabIndex
=
258
;
...
@@ -257,9 +257,9 @@
...
@@ -257,9 +257,9 @@
this
.
cmbWriteIO
.
Font
=
new
System
.
Drawing
.
Font
(
"微软雅黑"
,
10.5F
,
System
.
Drawing
.
FontStyle
.
Regular
,
System
.
Drawing
.
GraphicsUnit
.
Point
,
((
byte
)(
134
)));
this
.
cmbWriteIO
.
Font
=
new
System
.
Drawing
.
Font
(
"微软雅黑"
,
10.5F
,
System
.
Drawing
.
FontStyle
.
Regular
,
System
.
Drawing
.
GraphicsUnit
.
Point
,
((
byte
)(
134
)));
this
.
cmbWriteIO
.
FormattingEnabled
=
true
;
this
.
cmbWriteIO
.
FormattingEnabled
=
true
;
this
.
cmbWriteIO
.
ItemHeight
=
22
;
this
.
cmbWriteIO
.
ItemHeight
=
22
;
this
.
cmbWriteIO
.
Location
=
new
System
.
Drawing
.
Point
(
29
,
21
);
this
.
cmbWriteIO
.
Location
=
new
System
.
Drawing
.
Point
(
17
,
21
);
this
.
cmbWriteIO
.
Name
=
"cmbWriteIO"
;
this
.
cmbWriteIO
.
Name
=
"cmbWriteIO"
;
this
.
cmbWriteIO
.
Size
=
new
System
.
Drawing
.
Size
(
284
,
28
);
this
.
cmbWriteIO
.
Size
=
new
System
.
Drawing
.
Size
(
341
,
28
);
this
.
cmbWriteIO
.
TabIndex
=
234
;
this
.
cmbWriteIO
.
TabIndex
=
234
;
this
.
cmbWriteIO
.
ValueMember
=
"ProName"
;
this
.
cmbWriteIO
.
ValueMember
=
"ProName"
;
this
.
cmbWriteIO
.
DrawItem
+=
new
System
.
Windows
.
Forms
.
DrawItemEventHandler
(
this
.
cmbWriteIO_DrawItem
);
this
.
cmbWriteIO
.
DrawItem
+=
new
System
.
Windows
.
Forms
.
DrawItemEventHandler
(
this
.
cmbWriteIO_DrawItem
);
...
...
source/AssemblyLineClient/FrmHYEquip.Designer.cs
查看文件 @
15e8b79
此文件的差异被折叠,
点击展开。
source/AssemblyLineClient/FrmHYEquip.cs
查看文件 @
15e8b79
...
@@ -99,7 +99,14 @@ namespace OnlineStore.AssemblyLine
...
@@ -99,7 +99,14 @@ namespace OnlineStore.AssemblyLine
}
}
private
void
Control_Click
(
object
sender
,
EventArgs
e
)
private
void
Control_Click
(
object
sender
,
EventArgs
e
)
{
{
IOTextControl
control
=
(
IOTextControl
)
sender
;
string
name
=
control
.
Name
.
Substring
(
3
,
control
.
Name
.
Length
-
3
);
List
<
string
>
keyList
=
new
List
<
string
>(
DOControlList
.
Keys
);
int
index
=
keyList
.
IndexOf
(
name
);
if
(
index
>=
0
)
{
cmbWriteIO
.
SelectedIndex
=
index
;
}
}
}
private
void
timer1_Tick
(
object
sender
,
EventArgs
e
)
private
void
timer1_Tick
(
object
sender
,
EventArgs
e
)
{
{
...
...
source/DeviceLibrary/DeviceLibrary.csproj
查看文件 @
15e8b79
...
@@ -83,6 +83,7 @@
...
@@ -83,6 +83,7 @@
<Compile Include="assemblyLine\FeedingEquip.cs" />
<Compile Include="assemblyLine\FeedingEquip.cs" />
<Compile Include="assemblymanager\RFIDManagercs.cs" />
<Compile Include="assemblymanager\RFIDManagercs.cs" />
<Compile Include="assemblymanager\SServerManager.cs" />
<Compile Include="assemblymanager\SServerManager.cs" />
<Compile Include="assemblymanager\EDataManager.cs" />
<Compile Include="assemblymanager\TrayManager.cs" />
<Compile Include="assemblymanager\TrayManager.cs" />
<Compile Include="baan\AxisBean.cs" />
<Compile Include="baan\AxisBean.cs" />
<Compile Include="baan\ClampJawBean.cs" />
<Compile Include="baan\ClampJawBean.cs" />
...
...
source/DeviceLibrary/assemblyLine/EquipBase.cs
查看文件 @
15e8b79
...
@@ -561,7 +561,7 @@ namespace OnlineStore.DeviceLibrary
...
@@ -561,7 +561,7 @@ namespace OnlineStore.DeviceLibrary
else
if
(
wait
.
WaitType
.
Equals
(
WaitEnum
.
W009_BoxCanInstore
))
else
if
(
wait
.
WaitType
.
Equals
(
WaitEnum
.
W009_BoxCanInstore
))
{
{
int
storeId
=
moveInfo
.
MoveParam
.
GetStoreId
();
int
storeId
=
moveInfo
.
MoveParam
.
GetStoreId
();
wait
.
IsEnd
=
LineServer
.
BoxCanReviceTray
(
storeId
);
wait
.
IsEnd
=
LineServer
.
BoxCanReviceTray
(
storeId
,
out
NotOkMsg
);
}
}
else
else
{
{
...
...
source/DeviceLibrary/assemblyLine/LineBean_Partial.cs
查看文件 @
15e8b79
...
@@ -144,7 +144,7 @@ namespace OnlineStore.DeviceLibrary
...
@@ -144,7 +144,7 @@ namespace OnlineStore.DeviceLibrary
else
if
(
wait
.
WaitType
.
Equals
(
WaitEnum
.
W009_BoxCanInstore
))
else
if
(
wait
.
WaitType
.
Equals
(
WaitEnum
.
W009_BoxCanInstore
))
{
{
int
storeId
=
checkWaitInfo
.
MoveParam
.
GetStoreId
();
int
storeId
=
checkWaitInfo
.
MoveParam
.
GetStoreId
();
wait
.
IsEnd
=
LineServer
.
BoxCanReviceTray
(
storeId
);
wait
.
IsEnd
=
LineServer
.
BoxCanReviceTray
(
storeId
,
out
NotOkMsg
);
}
}
//else if (wait.WaitType.Equals(WaitEnum.W010_SWCanTopUp))
//else if (wait.WaitType.Equals(WaitEnum.W010_SWCanTopUp))
//{
//{
...
...
source/DeviceLibrary/assemblyLine/MoveEquip_Partial.cs
查看文件 @
15e8b79
...
@@ -289,16 +289,18 @@ namespace OnlineStore.DeviceLibrary
...
@@ -289,16 +289,18 @@ namespace OnlineStore.DeviceLibrary
OutLog
(
"出库 "
+
MoveInfo
.
SLog
+
": 夹料气缸夹紧,更新料盘位置【"
+
MoveInfo
.
MoveParam
.
WareCode
+
"】【MOVING】【"
+
DeviceID
+
"】"
);
OutLog
(
"出库 "
+
MoveInfo
.
SLog
+
": 夹料气缸夹紧,更新料盘位置【"
+
MoveInfo
.
MoveParam
.
WareCode
+
"】【MOVING】【"
+
DeviceID
+
"】"
);
//CylinderMove(MoveInfo, IO_Type.ClampCylinder_Relax, IO_Type.ClampCylinder_Work);
//CylinderMove(MoveInfo, IO_Type.ClampCylinder_Relax, IO_Type.ClampCylinder_Work);
ClampJwa
.
Push
(
MoveInfo
);
ClampJwa
.
Push
(
MoveInfo
);
//更新料盘位置
//更新料盘位置
SServerManager
.
UpdateTrayLoc
(
Name
,
MoveInfo
.
MoveParam
.
WareCode
,
LocStatus
.
MOVING
,
DeviceID
.
ToString
());
SServerManager
.
UpdateTrayLoc
(
Name
,
MoveInfo
.
MoveParam
.
WareCode
,
LocStatus
.
MOVING
,
DeviceID
.
ToString
());
EDataManager
.
UpdateParam
(
DeviceID
,
2
,
MoveInfo
.
MoveParam
);
}
}
else
if
(
MoveInfo
.
IsStep
(
LineMoveStep
.
MO_54_CylinderOpen
))
else
if
(
MoveInfo
.
IsStep
(
LineMoveStep
.
MO_54_CylinderOpen
))
{
{
MoveInfo
.
NextMoveStep
(
LineMoveStep
.
MO_55_CylinderUp
);
MoveInfo
.
NextMoveStep
(
LineMoveStep
.
MO_55_CylinderUp
);
OutLog
(
"出库 "
+
MoveInfo
.
SLog
+
": 上下气缸上升"
);
OutLog
(
"出库 "
+
MoveInfo
.
SLog
+
": 上下气缸上升"
);
UpdownUpMove
();
UpdownUpMove
();
}
}
else
if
(
MoveInfo
.
IsStep
(
LineMoveStep
.
MO_56_ResetClamp
))
else
if
(
MoveInfo
.
IsStep
(
LineMoveStep
.
MO_56_ResetClamp
))
...
@@ -309,27 +311,27 @@ namespace OnlineStore.DeviceLibrary
...
@@ -309,27 +311,27 @@ namespace OnlineStore.DeviceLibrary
}
}
else
if
(
MoveInfo
.
IsStep
(
LineMoveStep
.
MO_55_CylinderUp
))
else
if
(
MoveInfo
.
IsStep
(
LineMoveStep
.
MO_55_CylinderUp
))
{
{
// MoveInfo.NextMoveStep(LineMoveStep.MO_57_ClampCheck);
// MoveInfo.NextMoveStep(LineMoveStep.MO_57_ClampCheck);
// if (ClampCount.Equals(0))
// if (ClampCount.Equals(0))
// {
// {
// OutLog("出库 " + MoveInfo.SLog + ": 检测夹爪料盘检测=HIGH,超时1000");
// OutLog("出库 " + MoveInfo.SLog + ": 检测夹爪料盘检测=HIGH,超时1000");
// MoveInfo.OneWaitCanEndStep = true;
// MoveInfo.OneWaitCanEndStep = true;
// MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(1000));
// MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(1000));
// MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.ClampCylinder_Check, IO_VALUE.HIGH));
// MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.ClampCylinder_Check, IO_VALUE.HIGH));
// }
// }
// else
// else
// {
// {
// MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(200));
// MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(200));
// OutLog("出库 " + MoveInfo.SLog + ": 检测夹爪料盘检测=HIGH");
// OutLog("出库 " + MoveInfo.SLog + ": 检测夹爪料盘检测=HIGH");
// MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.ClampCylinder_Check, IO_VALUE.HIGH));
// MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.ClampCylinder_Check, IO_VALUE.HIGH));
// }
// }
//}
//}
//else if (MoveInfo.IsStep(LineMoveStep.MO_57_ClampCheck))
//else if (MoveInfo.IsStep(LineMoveStep.MO_57_ClampCheck))
//{
//{
if
(
UpdownIsUp
())
if
(
UpdownIsUp
())
{
{
//if (IOValue(IO_Type.ClampCylinder_Check).Equals(IO_VALUE.HIGH))
//if (IOValue(IO_Type.ClampCylinder_Check).Equals(IO_VALUE.HIGH))
if
(
ClampJwa
.
HasReel
())
if
(
ClampJwa
.
HasReel
())
{
{
if
(
IsBigStore
())
if
(
IsBigStore
())
{
{
...
@@ -382,7 +384,7 @@ namespace OnlineStore.DeviceLibrary
...
@@ -382,7 +384,7 @@ namespace OnlineStore.DeviceLibrary
int
trayNum
=
SecondMoveInfo
.
MoveParam
.
TrayNumber
;
int
trayNum
=
SecondMoveInfo
.
MoveParam
.
TrayNumber
;
//去掉直接丢盘处理
//去掉直接丢盘处理
MoveInfo
.
NextMoveStep
(
LineMoveStep
.
MO_60_CylinderDown
);
MoveInfo
.
NextMoveStep
(
LineMoveStep
.
MO_60_CylinderDown
);
OutLog
(
"出库 "
+
MoveInfo
.
SLog
+
":
夹具检测编码完成, 上下气缸下降 ,更新料盘位置【"
+
MoveInfo
.
MoveParam
.
WareCode
+
"】【INLINE】【"
+
trayNum
+
"】
,顶升气缸上升"
);
OutLog
(
"出库 "
+
MoveInfo
.
SLog
+
":
拦截到空托盘【"
+
trayNum
+
"】, 上下气缸下降
,顶升气缸上升"
);
if
(
MoveInfo
.
MoveParam
!=
null
)
if
(
MoveInfo
.
MoveParam
!=
null
)
{
{
MoveInfo
.
MoveParam
.
TrayNumber
=
trayNum
;
MoveInfo
.
MoveParam
.
TrayNumber
=
trayNum
;
...
@@ -392,8 +394,7 @@ namespace OnlineStore.DeviceLibrary
...
@@ -392,8 +394,7 @@ namespace OnlineStore.DeviceLibrary
MoveInfo
.
MoveParam
=
SecondMoveInfo
.
MoveParam
;
MoveInfo
.
MoveParam
=
SecondMoveInfo
.
MoveParam
;
}
}
//更新料盘位置
SServerManager
.
UpdateTrayLoc
(
Name
,
MoveInfo
.
MoveParam
.
WareCode
,
LocStatus
.
INLINE
,
"E"
+
trayNum
.
ToString
().
PadLeft
(
2
,
'0'
));
UpdownDownP2Move
(
MoveInfo
.
MoveParam
.
PlateH
,
MoveInfo
.
MoveParam
.
PlateW
);
UpdownDownP2Move
(
MoveInfo
.
MoveParam
.
PlateH
,
MoveInfo
.
MoveParam
.
PlateW
);
CylinderMove
(
MoveInfo
,
IO_Type
.
TopCylinder_Down
,
IO_Type
.
TopCylinder_Up
);
CylinderMove
(
MoveInfo
,
IO_Type
.
TopCylinder_Down
,
IO_Type
.
TopCylinder_Up
);
}
}
...
@@ -402,14 +403,18 @@ namespace OnlineStore.DeviceLibrary
...
@@ -402,14 +403,18 @@ namespace OnlineStore.DeviceLibrary
else
if
(
MoveInfo
.
IsStep
(
LineMoveStep
.
MO_60_CylinderDown
))
else
if
(
MoveInfo
.
IsStep
(
LineMoveStep
.
MO_60_CylinderDown
))
{
{
OutLog
(
"出库 "
+
MoveInfo
.
SLog
+
": 夹料气缸放松,更新托盘【"
+
MoveInfo
.
MoveParam
.
TrayNumber
+
"】,有料盘,OutStore,【"
+
MoveInfo
.
MoveParam
.
ToStr
()
+
"】"
);
OutLog
(
"出库 "
+
MoveInfo
.
SLog
+
": 夹料气缸放松,更新托盘【"
+
MoveInfo
.
MoveParam
.
TrayNumber
+
"】,有料盘,OutStore,【"
+
MoveInfo
.
MoveParam
.
ToStr
()
+
"】"
);
//更新料盘位置
TrayManager
.
UpdateTrayInfo
(
MoveInfo
.
MoveParam
.
TrayNumber
,
true
,
ReelType
.
OutStore
,
MoveInfo
.
MoveParam
.
Clone
());
int
trayNum
=
MoveInfo
.
MoveParam
.
TrayNumber
;
TrayInfo
tray
=
TrayManager
.
GetTrayInfo
(
MoveInfo
.
MoveParam
.
TrayNumber
);
SServerManager
.
UpdateTrayLoc
(
Name
,
MoveInfo
.
MoveParam
.
WareCode
,
LocStatus
.
INLINE
,
"E"
+
trayNum
.
ToString
().
PadLeft
(
2
,
'0'
));
LogInfo
(
"出库 "
+
MoveInfo
.
SLog
+
": 夹料气缸放松,更新托盘信息 "
+
tray
.
ToStr
()
+
""
);
TrayManager
.
UpdateTrayInfo
(
trayNum
,
true
,
ReelType
.
OutStore
,
MoveInfo
.
MoveParam
.
Clone
());
TrayInfo
tray
=
TrayManager
.
GetTrayInfo
(
trayNum
);
LogInfo
(
"出库 "
+
MoveInfo
.
SLog
+
": ,更新料盘位置【"
+
MoveInfo
.
MoveParam
.
WareCode
+
"】【INLINE】更新托盘【"
+
trayNum
+
"】 "
+
tray
.
ToStr
()
+
""
);
//出库全部完成
//出库全部完成
MoveInfo
.
NextMoveStep
(
LineMoveStep
.
MO_61_CylinderRelax
);
MoveInfo
.
NextMoveStep
(
LineMoveStep
.
MO_61_CylinderRelax
);
//CylinderMove(MoveInfo, IO_Type.ClampCylinder_Work, IO_Type.ClampCylinder_Relax);
//CylinderMove(MoveInfo, IO_Type.ClampCylinder_Work, IO_Type.ClampCylinder_Relax);
ClampJwa
.
Relax
(
MoveInfo
);
ClampJwa
.
Relax
(
MoveInfo
);
EDataManager
.
UpdateParam
(
DeviceID
);
}
}
else
if
(
MoveInfo
.
IsStep
(
LineMoveStep
.
MO_61_CylinderRelax
))
else
if
(
MoveInfo
.
IsStep
(
LineMoveStep
.
MO_61_CylinderRelax
))
{
{
...
@@ -533,7 +538,8 @@ namespace OnlineStore.DeviceLibrary
...
@@ -533,7 +538,8 @@ namespace OnlineStore.DeviceLibrary
MoveInfo
.
NextMoveStep
(
LineMoveStep
.
MI_05_CylinderOpen
);
MoveInfo
.
NextMoveStep
(
LineMoveStep
.
MI_05_CylinderOpen
);
InLog
(
"入库 "
+
MoveInfo
.
SLog
+
": 夹料气缸夹紧"
);
InLog
(
"入库 "
+
MoveInfo
.
SLog
+
": 夹料气缸夹紧"
);
//CylinderMove(MoveInfo, IO_Type.ClampCylinder_Relax, IO_Type.ClampCylinder_Work);
//CylinderMove(MoveInfo, IO_Type.ClampCylinder_Relax, IO_Type.ClampCylinder_Work);
ClampJwa
.
Push
(
MoveInfo
);
ClampJwa
.
Push
(
MoveInfo
);
EDataManager
.
UpdateParam
(
DeviceID
,
1
,
MoveInfo
.
MoveParam
);
}
}
else
if
(
MoveInfo
.
IsStep
(
LineMoveStep
.
MI_05_CylinderOpen
))
else
if
(
MoveInfo
.
IsStep
(
LineMoveStep
.
MI_05_CylinderOpen
))
{
{
...
@@ -596,7 +602,8 @@ namespace OnlineStore.DeviceLibrary
...
@@ -596,7 +602,8 @@ namespace OnlineStore.DeviceLibrary
MoveInfo
.
NextMoveStep
(
LineMoveStep
.
MI_12_CylinderRelax
);
MoveInfo
.
NextMoveStep
(
LineMoveStep
.
MI_12_CylinderRelax
);
InLog
(
"入库 "
+
MoveInfo
.
SLog
+
",夹料气缸放松"
);
InLog
(
"入库 "
+
MoveInfo
.
SLog
+
",夹料气缸放松"
);
//CylinderMove(MoveInfo, IO_Type.ClampCylinder_Work, IO_Type.ClampCylinder_Relax);
//CylinderMove(MoveInfo, IO_Type.ClampCylinder_Work, IO_Type.ClampCylinder_Relax);
ClampJwa
.
Relax
(
MoveInfo
);
ClampJwa
.
Relax
(
MoveInfo
);
EDataManager
.
UpdateParam
(
DeviceID
);
}
}
else
if
(
MoveInfo
.
IsStep
(
LineMoveStep
.
MI_12_CylinderRelax
))
else
if
(
MoveInfo
.
IsStep
(
LineMoveStep
.
MI_12_CylinderRelax
))
{
{
...
...
source/DeviceLibrary/assemblymanager/EDataManager.cs
0 → 100644
查看文件 @
15e8b79
using
Asa
;
using
OnlineStore.Common
;
using
OnlineStore.LoadCSVLibrary
;
using
System
;
using
System.Collections.Concurrent
;
using
System.Collections.Generic
;
using
System.Diagnostics
;
using
System.IO
;
using
System.Linq
;
using
System.Text
;
using
System.Threading
;
using
System.Windows.Forms
;
namespace
OnlineStore.DeviceLibrary
{
public
class
EDataManager
{
/// <summary>
/// key=设备DeviceId,value=料盘信息
/// </summary>
private
static
ConcurrentDictionary
<
int
,
EquipDataInfo
>
dataMap
=
new
ConcurrentDictionary
<
int
,
EquipDataInfo
>();
static
EDataManager
()
{
}
public
static
List
<
EquipDataInfo
>
getDataList
()
{
return
new
List
<
EquipDataInfo
>(
dataMap
.
Values
);
}
public
static
EquipDataInfo
GetEuipParam
(
int
deviceId
)
{
if
(
dataMap
.
ContainsKey
(
deviceId
))
{
return
dataMap
[
deviceId
];
}
return
null
;
}
public
static
void
UpdateParam
(
int
deviceId
,
int
reelType
=
0
,
InOutParam
param
=
null
)
{
if
(
reelType
.
Equals
(
0
)
||
param
==
null
)
{
EquipDataInfo
data
=
null
;
dataMap
.
TryRemove
(
deviceId
,
out
data
);
}
else
{
EquipDataInfo
data
=
new
EquipDataInfo
(
deviceId
,
reelType
,
param
);
if
(
dataMap
.
ContainsKey
(
deviceId
))
{
dataMap
[
deviceId
]
=
data
;
}
else
{
dataMap
.
TryAdd
(
deviceId
,
data
);
}
}
SaveMapToFile
();
}
//public static void ClearInOutParam()
//{
// LogUtil.info("-------------------点击:清空托盘。清空前打印托盘信息:");
// List<EquipDataInfo> tray = new List<EquipDataInfo> (paramdataMap.Values);
// foreach (EquipDataInfo t in tray)
// {
// LogUtil.info(t.ToStr());
// }
// paramdataMap = new ConcurrentDictionary<int, EquipDataInfo>();
// SaveMapToFile();
// LogUtil.info("-------------------点击:清空托盘。托盘内容已清空");
//}
private
static
string
FilePath
=
""
;
public
static
void
InitFileData
()
{
dataMap
=
new
ConcurrentDictionary
<
int
,
EquipDataInfo
>();
FilePath
=
Application
.
StartupPath
+
ConfigAppSettings
.
GetValue
(
Setting_Init
.
ConfigPath_TrayList
);
if
(
File
.
Exists
(
FilePath
))
{
LogUtil
.
info
(
"开始加载文件设备料盘信息:"
+
FilePath
);
string
[]
lines
=
FileEncoding
.
GetFileLines
(
FilePath
);
foreach
(
string
line
in
lines
)
{
EquipDataInfo
data
=
JsonHelper
.
DeserializeJsonToObject
<
EquipDataInfo
>(
line
);
if
(
data
!=
null
&&
(
data
.
inouParam
!=
null
)
&&
(
data
.
inouParam
.
WareCode
!=
""
)
&&
data
.
ReelType
>
0
)
{
LogUtil
.
info
(
"加载到设备料盘信息:"
+
data
.
ToStr
());
dataMap
.
TryAdd
(
data
.
DeviceId
,
data
);
}
}
LogUtil
.
info
(
"设备料盘加载完成"
);
}
}
public
static
void
SaveMapToFile
()
{
try
{
List
<
EquipDataInfo
>
trayList
=
new
List
<
EquipDataInfo
>(
dataMap
.
Values
);
List
<
string
>
lineList
=
new
List
<
string
>();
foreach
(
EquipDataInfo
tray
in
trayList
)
{
string
line
=
JsonHelper
.
SerializeObject
(
tray
);
if
(!
string
.
IsNullOrEmpty
(
line
))
{
lineList
.
Add
(
line
);
}
}
FileEncoding
.
WritteFile
(
FilePath
,
lineList
.
ToArray
());
}
catch
(
Exception
ex
)
{
LogUtil
.
error
(
"SaveTrayToFile出错:"
+
ex
.
ToString
());
}
}
}
public
class
EquipDataInfo
{
public
EquipDataInfo
()
{
this
.
DeviceId
=
0
;
this
.
inouParam
=
null
;
this
.
ReelType
=
0
;
}
public
EquipDataInfo
(
int
id
,
int
reelType
,
InOutParam
param
)
{
this
.
ReelType
=
reelType
;
this
.
DeviceId
=
id
;
this
.
inouParam
=
param
;
}
public
int
DeviceId
{
get
;
set
;
}
public
InOutParam
inouParam
{
get
;
set
;
}
/// <summary>
/// 1=入库,2=出库
/// </summary>
public
int
ReelType
{
get
;
set
;
}
public
string
ToStr
()
{
if
(
inouParam
==
null
)
{
return
"设备["
+
DeviceId
+
"]=null"
;
}
return
"设备["
+
DeviceId
+
"]="
+
inouParam
.
ToStr
();
}
}
}
source/DeviceLibrary/server/LineServer.cs
查看文件 @
15e8b79
...
@@ -129,13 +129,30 @@ namespace OnlineStore.DeviceLibrary
...
@@ -129,13 +129,30 @@ namespace OnlineStore.DeviceLibrary
/// </summary>
/// </summary>
/// <param name="id"></param>
/// <param name="id"></param>
/// <returns></returns>
/// <returns></returns>
public
static
bool
BoxCanReviceTray
(
int
id
)
public
static
bool
BoxCanReviceTray
(
int
id
,
out
string
NotOkMsg
)
{
{
NotOkMsg
=
" [料仓"
+
id
+
"可以入库:离线] "
;
BoxInfo
box
=
GetBoxInfo
(
id
);
BoxInfo
box
=
GetBoxInfo
(
id
);
if
(
box
!=
null
)
if
(
box
!=
null
)
{
{
LineRunStatus
runs
=
(
LineRunStatus
)
box
.
SRunStatus
;
LineRunStatus
runs
=
(
LineRunStatus
)
box
.
SRunStatus
;
TimeSpan
span
=
DateTime
.
Now
-
box
.
LastMsgTime
;
TimeSpan
span
=
DateTime
.
Now
-
box
.
LastMsgTime
;
if
(
span
.
TotalSeconds
>
ClientKeepSecond
)
{
NotOkMsg
=
" [料仓"
+
id
+
"可以入库:离线] "
;
return
false
;
}
else
if
(!
box
.
HasTray
.
Equals
(
0
))
{
NotOkMsg
=
" [料仓"
+
id
+
"可以入库:仓门口有料] "
;
return
false
;
}
else
if
(!
box
.
SAlarmType
.
Equals
(
LineAlarmType
.
None
))
{
NotOkMsg
=
" [料仓"
+
id
+
"可以入库:报警中] "
;
return
false
;
}
if
(
span
.
TotalSeconds
<
ClientKeepSecond
&&
box
.
HasTray
.
Equals
(
0
)
&&
box
.
SAlarmType
.
Equals
(
LineAlarmType
.
None
))
if
(
span
.
TotalSeconds
<
ClientKeepSecond
&&
box
.
HasTray
.
Equals
(
0
)
&&
box
.
SAlarmType
.
Equals
(
LineAlarmType
.
None
))
{
{
if
(
id
.
Equals
(
7
))
if
(
id
.
Equals
(
7
))
...
@@ -144,14 +161,21 @@ namespace OnlineStore.DeviceLibrary
...
@@ -144,14 +161,21 @@ namespace OnlineStore.DeviceLibrary
{
{
return
true
;
return
true
;
}
}
else
{
NotOkMsg
=
" [料仓"
+
id
+
"可以入库:忙碌中] "
;
}
}
}
else
else
{
{
if
(
runs
.
Equals
(
LineRunStatus
.
Runing
))
if
(
runs
.
Equals
(
LineRunStatus
.
Runing
))
{
{
return
true
;
return
true
;
}
}
else
{
NotOkMsg
=
" [料仓"
+
id
+
"可以入库:忙碌中] "
;
}
}
}
}
}
}
}
...
...
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论