Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
顾剑亮
/
AGVControl-Qisda-ProductionLine
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
作业
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit 9ea1b3d5
由
张东亮
编写于
2020-12-01 13:40:20 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
1
1 个父辈
9194db74
全部展开
隐藏空白字符变更
内嵌
并排
正在显示
14 个修改的文件
包含
181 行增加
和
307 行删除
.vs/AGVControl-ProductionLine/v16/.suo
AGVControl-ProductionLine/AGVControl-ProductionLine.csproj
AGVControl-ProductionLine/BLL/Common.cs
AGVControl-ProductionLine/BLL/Control.cs
AGVControl-ProductionLine/BLL/LineWebService.cs
AGVControl-ProductionLine/BLL/UnlockMissionManager.cs
AGVControl-ProductionLine/FrmMain.Designer.cs
AGVControl-ProductionLine/FrmMain.cs
AGVControl-ProductionLine/FrmMain.resx
AGVControl-ProductionLine/bean/Node.cs
AGVControl-ProductionLine/bean/UnlockedShelf.cs
AGVControl-ProductionLine/bean/node/ClientNode.cs
AGVControl-ProductionLine/obj/Debug/DesignTimeResolveAssemblyReferences.cache
AGVControl-ProductionLine/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache
.vs/AGVControl-ProductionLine/v16/.suo
查看文件 @
9ea1b3d
此文件类型无法预览
AGVControl-ProductionLine/AGVControl-ProductionLine.csproj
查看文件 @
9ea1b3d
...
@@ -83,6 +83,7 @@
...
@@ -83,6 +83,7 @@
<Compile Include="bean\node\ClientNode.cs" />
<Compile Include="bean\node\ClientNode.cs" />
<Compile Include="bean\node\DoubleLineNodeFor4D.cs" />
<Compile Include="bean\node\DoubleLineNodeFor4D.cs" />
<Compile Include="bean\node\DoubleLineNodeFor4C.cs" />
<Compile Include="bean\node\DoubleLineNodeFor4C.cs" />
<Compile Include="bean\UnlockedShelf.cs" />
<Compile Include="BLL\AGVManager.cs" />
<Compile Include="BLL\AGVManager.cs" />
<Compile Include="BLL\AgvServer.cs" />
<Compile Include="BLL\AgvServer.cs" />
<Compile Include="BLL\Common.cs" />
<Compile Include="BLL\Common.cs" />
...
@@ -96,6 +97,7 @@
...
@@ -96,6 +97,7 @@
</Compile>
</Compile>
<Compile Include="BLL\LineWebService.cs" />
<Compile Include="BLL\LineWebService.cs" />
<Compile Include="BLL\StationRFIDManager.cs" />
<Compile Include="BLL\StationRFIDManager.cs" />
<Compile Include="BLL\UnlockMissionManager.cs" />
<Compile Include="FrmMain.cs">
<Compile Include="FrmMain.cs">
<SubType>Form</SubType>
<SubType>Form</SubType>
</Compile>
</Compile>
...
...
AGVControl-ProductionLine/BLL/Common.cs
查看文件 @
9ea1b3d
...
@@ -1073,102 +1073,6 @@ namespace AGVControl
...
@@ -1073,102 +1073,6 @@ namespace AGVControl
}
}
}
}
/// <summary>
/// 添加空料架解绑
/// </summary>
/// <param name="nodeName"></param>
/// <returns></returns>
public
static
bool
AddEmptyShelfTask
(
string
nodeName
,
string
rfid
)
{
int
idx
=
Common
.
nodeInfo
.
FindIndex
(
s
=>
s
.
Name
==
nodeName
);
if
(
idx
>
-
1
)
{
Common
.
missionManager
.
AddMission
(
new
MissionStru
(
DateTime
.
Now
.
ToString
(
"yyyy-MM-dd HH:mm:ss"
),
nodeName
,
rfid
));
Common
.
nodeInfo
[
idx
].
IncreEmptyShelfCnt
(
rfid
);
using
(
System
.
IO
.
StreamWriter
file
=
new
System
.
IO
.
StreamWriter
(
CONFIG_PATH
+
"LinePlace.txt"
))
{
foreach
(
var
item
in
Common
.
missionManager
.
missionList
)
{
file
.
WriteLine
(
string
.
Format
(
"{0},{1},{2}"
,
item
.
CreateTime
,
item
.
NodeName
,
rfid
));
}
}
return
true
;
}
else
{
log
.
Error
(
"AddLinePlace 失败 节点"
+
nodeName
+
"不存在"
);
return
false
;
}
}
/// <summary>
/// 删除空架任务
/// </summary>
/// <param name="nodeName"></param>
/// <returns></returns>
public
static
bool
DelEmptyShelfTask
(
string
nodeName
,
string
rfid
)
{
int
idx
=
Common
.
nodeInfo
.
FindIndex
(
s
=>
s
.
Name
==
nodeName
);
if
(
idx
>
-
1
)
{
idx
=
Common
.
missionManager
.
missionList
.
FindIndex
(
s
=>
s
.
NodeName
==
nodeName
);
if
(
idx
>
-
1
)
{
Common
.
nodeInfo
[
idx
].
DecreEmptyShelfCnt
(
rfid
);
LogInfo
(
"删除一个空料架任务:"
+
nodeName
+
"[RFID="
+
rfid
+
"]"
);
Common
.
missionManager
.
DelMission
(
idx
);
//Common.missionManager.missionList.RemoveAt(idx);
using
(
System
.
IO
.
StreamWriter
file
=
new
System
.
IO
.
StreamWriter
(
CONFIG_PATH
+
"LinePlace.txt"
))
{
foreach
(
var
item
in
Common
.
missionManager
.
missionList
)
{
file
.
WriteLine
(
string
.
Format
(
"{0},{1},{2}"
,
item
.
CreateTime
,
item
.
NodeName
,
rfid
));
}
}
return
true
;
}
log
.
Error
(
"DelLinePlace 失败 节点任务"
+
nodeName
+
"不存在"
);
return
false
;
}
else
{
log
.
Error
(
"DelLinePlace 失败 节点"
+
nodeName
+
"不存在"
);
return
false
;
}
}
//public static void CheckAGVMissionState()
//{
// foreach (Agv_Info agv in agvInfo)
// {
// Thread.Sleep(50);
// bool rtn = Common.mir.Get_Register(agv, 20, out int regValue);
// if (rtn)
// {
// agv.GetPlace(regValue);
// Common.log.Debug(string.Format("软件开启:{0} Get_Register PLC{1}={2} Place={3} PlaceState={4}", agv.Name, 20, regValue, agv.Place, agv.PlaceState));
// if (!agv.Place.Equals(""))
// {
// int idx = nodeInfo.FindIndex(s => s.Name == agv.Place);
// if (idx > -1)
// {
// nodeInfo[idx].AgvName = agv.Name;
// }
// agv.TaskSend = "Move" + agv.Place;
// }
// }
// else
// {
// Common.log.Debug("CheckAGVMissionState 获取PLC20失败");
// }
// }
//}
public
static
void
GetNodesPosition
()
public
static
void
GetNodesPosition
()
{
{
Agv_Info
agv
=
agvInfo
[
0
];
Agv_Info
agv
=
agvInfo
[
0
];
...
@@ -1452,65 +1356,5 @@ namespace AGVControl
...
@@ -1452,65 +1356,5 @@ namespace AGVControl
public
string
C4_Station1
;
public
string
C4_Station1
;
public
string
C4_Station2
;
public
string
C4_Station2
;
}
}
/// <summary>
/// 任务信息结构
/// </summary>
public
struct
MissionStru
{
public
string
NodeName
;
public
string
CreateTime
;
public
string
Rfid
;
/// <summary>
/// 任务结构
/// </summary>
/// <param name="dateTime">创建时间</param>
/// <param name="name">节点名称</param>
public
MissionStru
(
string
dateTime
,
string
name
,
string
rfid
)
{
NodeName
=
name
;
CreateTime
=
dateTime
;
Rfid
=
rfid
;
}
}
/// <summary>
/// 任务管理
/// </summary>
public
class
MissionManager
{
public
delegate
void
MissionChangedHandler
();
public
event
MissionChangedHandler
MissionChanged
;
/// <summary>
/// 任务列表
/// </summary>
public
List
<
MissionStru
>
missionList
;
/// <summary>
/// 空料架解绑总数
/// </summary>
public
Int32
EmptyMissionCount
{
get
{
return
missionList
.
Count
;
}
}
public
void
AddMission
(
MissionStru
missionStru
)
{
missionList
.
Add
(
missionStru
);
MissionChanged
?.
Invoke
();
}
public
void
DelMission
(
int
idx
)
{
if
(
idx
==
-
1
)
return
;
Common
.
missionManager
.
missionList
.
RemoveAt
(
idx
);
MissionChanged
?.
Invoke
();
}
public
MissionManager
()
{
missionList
=
new
List
<
MissionStru
>();
}
}
}
}
\ No newline at end of file
\ No newline at end of file
AGVControl-ProductionLine/BLL/Control.cs
查看文件 @
9ea1b3d
...
@@ -7,6 +7,7 @@ using System.Threading;
...
@@ -7,6 +7,7 @@ using System.Threading;
using
System.Threading.Tasks
;
using
System.Threading.Tasks
;
using
System.Web.Script.Serialization
;
using
System.Web.Script.Serialization
;
using
AGVControl
;
using
AGVControl
;
using
BLL
;
using
log4net.Util
;
using
log4net.Util
;
using
RestSharp
;
using
RestSharp
;
...
@@ -77,7 +78,7 @@ namespace AGVControl.BLL
...
@@ -77,7 +78,7 @@ namespace AGVControl.BLL
msglist
.
Add
(
new
AlarmMsg
(
Common
.
nodeInfo
[
j
].
AliceName
,
"lineAgv."
+
Common
.
nodeInfo
[
j
].
Name
+
".OffLine"
,
"离线"
));
msglist
.
Add
(
new
AlarmMsg
(
Common
.
nodeInfo
[
j
].
AliceName
,
"lineAgv."
+
Common
.
nodeInfo
[
j
].
Name
+
".OffLine"
,
"离线"
));
}
}
}
}
BLL
.
AGVManager
.
updateDeviceAlarmMsg
(
msglist
);
AGVManager
.
updateDeviceAlarmMsg
(
msglist
);
for
(
int
i
=
0
;
i
<
Common
.
agvInfo
.
Count
;
i
++)
for
(
int
i
=
0
;
i
<
Common
.
agvInfo
.
Count
;
i
++)
{
{
...
@@ -139,7 +140,7 @@ namespace AGVControl.BLL
...
@@ -139,7 +140,7 @@ namespace AGVControl.BLL
Common
.
log
.
Error
(
Common
.
agvInfo
[
i
].
Name
+
"上报小车运行步骤失败"
+
ex
.
Message
+
ex
.
StackTrace
);
Common
.
log
.
Error
(
Common
.
agvInfo
[
i
].
Name
+
"上报小车运行步骤失败"
+
ex
.
Message
+
ex
.
StackTrace
);
}
}
}
}
BLL
.
AGVManager
.
updateDeviceAlarmMsg
(
msglist
);
AGVManager
.
updateDeviceAlarmMsg
(
msglist
);
}
}
catch
(
Exception
ex
)
catch
(
Exception
ex
)
{
{
...
...
AGVControl-ProductionLine/BLL/LineWebService.cs
查看文件 @
9ea1b3d
...
@@ -73,12 +73,12 @@ namespace BLL
...
@@ -73,12 +73,12 @@ namespace BLL
if
(
rfid
==
null
)
if
(
rfid
==
null
)
{
{
res
=
new
Result
()
{
Succeed
=
false
,
ResultData
=
null
,
ErrorMessage
=
"rfid=null"
};
res
=
new
Result
()
{
Succeed
=
false
,
ResultData
=
null
,
ErrorMessage
=
"rfid=null"
};
Log
.
Error
(
string
.
Format
(
"
WebService Request(POST) Failed emptyStation={0},rfid=null
"
,
emptyStation
));
Log
.
Error
(
string
.
Format
(
"
Unlock Request(POST) Failed [emptyStation={0},rfid=null]
"
,
emptyStation
));
}
}
else
else
{
{
res
=
new
Result
()
{
Succeed
=
true
,
ResultData
=
rfid
,
ErrorMessage
=
""
};
res
=
new
Result
()
{
Succeed
=
true
,
ResultData
=
rfid
,
ErrorMessage
=
""
};
Log
.
Info
(
string
.
Format
(
"
WebService Request(POST) emptyStation={0},rfid={1}
"
,
emptyStation
,
rfid
.
ToUpper
()));
Log
.
Info
(
string
.
Format
(
"
Unlock Request(POST) [emptyStation={0},rfid={1}]
"
,
emptyStation
,
rfid
.
ToUpper
()));
if
(!
Common
.
AddEmptyShelfTask
(
value
,
rfid
.
ToUpper
()))
if
(!
Common
.
AddEmptyShelfTask
(
value
,
rfid
.
ToUpper
()))
{
{
Common
.
log
.
Error
(
"CreateEmptyRecycleTask(POST) 节点["
+
value
+
"]不存在"
);
Common
.
log
.
Error
(
"CreateEmptyRecycleTask(POST) 节点["
+
value
+
"]不存在"
);
...
@@ -92,7 +92,7 @@ namespace BLL
...
@@ -92,7 +92,7 @@ namespace BLL
else
else
{
{
res
=
new
Result
()
{
Succeed
=
false
,
ResultData
=
null
,
ErrorMessage
=
"Not find "
+
emptyStation
};
res
=
new
Result
()
{
Succeed
=
false
,
ResultData
=
null
,
ErrorMessage
=
"Not find "
+
emptyStation
};
AGVControl
.
Common
.
log
.
Error
(
"
WebService
POST Response false "
+
"Not find "
+
emptyStation
);
AGVControl
.
Common
.
log
.
Error
(
"
Unlock
POST Response false "
+
"Not find "
+
emptyStation
);
}
}
}
}
return
JsonHelper
.
SerializeObject
(
res
);
return
JsonHelper
.
SerializeObject
(
res
);
...
@@ -120,14 +120,14 @@ namespace BLL
...
@@ -120,14 +120,14 @@ namespace BLL
else
else
{
{
res
=
new
Result
()
{
Succeed
=
true
,
ResultData
=
RFID
,
ErrorMessage
=
""
};
res
=
new
Result
()
{
Succeed
=
true
,
ResultData
=
RFID
,
ErrorMessage
=
""
};
Log
.
Info
(
string
.
Format
(
"
WebService Request(GET) emptyStation={0},rfid={1}
"
,
line
,
RFID
));
Log
.
Info
(
string
.
Format
(
"
Unlock Request(GET) [emptyStation={0},rfid={1}]
"
,
line
,
RFID
));
Common
.
LogInfo
(
"任务[GET]:"
+
value
+
" 出空料架 [emptyStation="
+
line
+
",rfid="
+
RFID
.
ToUpper
()
+
"]"
);
Common
.
LogInfo
(
"任务[GET]:"
+
value
+
" 出空料架 [emptyStation="
+
line
+
",rfid="
+
RFID
.
ToUpper
()
+
"]"
);
}
}
}
}
else
else
{
{
res
=
new
Result
()
{
Succeed
=
false
,
ResultData
=
null
,
ErrorMessage
=
"Not find "
+
line
};
res
=
new
Result
()
{
Succeed
=
false
,
ResultData
=
null
,
ErrorMessage
=
"Not find "
+
line
};
AGVControl
.
Common
.
LogInfo
(
"
WebService
GET Response false "
+
"Not find "
+
line
);
AGVControl
.
Common
.
LogInfo
(
"
Unlock
GET Response false "
+
"Not find "
+
line
);
}
}
//Log.Info(string.Format("WebService GET Request emptyStation={0},rfid={1}", line, RFID));
//Log.Info(string.Format("WebService GET Request emptyStation={0},rfid={1}", line, RFID));
return
JsonHelper
.
SerializeObject
(
res
);
return
JsonHelper
.
SerializeObject
(
res
);
...
...
AGVControl-ProductionLine/BLL/UnlockMissionManager.cs
0 → 100644
查看文件 @
9ea1b3d
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Text
;
using
System.Threading.Tasks
;
namespace
AGVControl.BLL
{
/// <summary>
///解绑料架任务管理
/// </summary>
public
class
UnlockMissionManager
{
public
delegate
void
MissionChangedHandler
();
public
event
MissionChangedHandler
MissionChanged
;
/// <summary>
/// 任务列表
/// </summary>
public
Dictionary
<
string
,
UnlockedShelf
>
NodeUnlockMissions
{
get
;
private
set
;
}
public
UnlockMissionManager
()
{
NodeUnlockMissions
=
new
Dictionary
<
string
,
UnlockedShelf
>();
}
public
UnlockedShelf
GetUnlockInfo
(
string
nodeName
)
{
if
(
NodeUnlockMissions
.
ContainsKey
(
nodeName
))
{
return
NodeUnlockMissions
[
nodeName
];
}
return
null
;
}
public
void
AddMission
(
string
nodeName
,
string
rfid
)
{
NodeUnlockMissions
[
nodeName
].
Add
(
rfid
);
MissionChanged
?.
Invoke
();
}
public
void
DelMission
(
string
nodeName
,
string
rfid
)
{
NodeUnlockMissions
[
nodeName
].
Delete
(
rfid
);
MissionChanged
?.
Invoke
();
}
}
}
AGVControl-ProductionLine/FrmMain.Designer.cs
查看文件 @
9ea1b3d
此文件的差异被折叠,
点击展开。
AGVControl-ProductionLine/FrmMain.cs
查看文件 @
9ea1b3d
...
@@ -115,10 +115,6 @@ namespace AGVControl
...
@@ -115,10 +115,6 @@ namespace AGVControl
}));
}));
System
.
GC
.
Collect
();
System
.
GC
.
Collect
();
}
}
private
void
MissionManager_MissionChanged
()
{
ShowEmptyTask
();
}
private
void
Control_AgvOnline
(
int
agvIndex
)
private
void
Control_AgvOnline
(
int
agvIndex
)
{
{
Invoke
(
new
Action
(()
=>
{
DgvAgv
.
Rows
[
agvIndex
].
DefaultCellStyle
.
ForeColor
=
Common
.
agvInfo
[
agvIndex
].
IsCon
?
Color
.
Black
:
Color
.
Red
;
}));
Invoke
(
new
Action
(()
=>
{
DgvAgv
.
Rows
[
agvIndex
].
DefaultCellStyle
.
ForeColor
=
Common
.
agvInfo
[
agvIndex
].
IsCon
?
Color
.
Black
:
Color
.
Red
;
}));
...
@@ -177,7 +173,6 @@ namespace AGVControl
...
@@ -177,7 +173,6 @@ namespace AGVControl
Common
.
control
.
AgvOnline
+=
Control_AgvOnline
;
Common
.
control
.
AgvOnline
+=
Control_AgvOnline
;
Common
.
server
.
NodeChanged
+=
Server_NodeChanged
;
Common
.
server
.
NodeChanged
+=
Server_NodeChanged
;
Common
.
server
.
NodeOnline
+=
Server_NodeOnline
;
Common
.
server
.
NodeOnline
+=
Server_NodeOnline
;
Common
.
missionManager
.
MissionChanged
+=
MissionManager_MissionChanged
;
//foreach (var item in Common.agvInfo)
//foreach (var item in Common.agvInfo)
//{
//{
// cmbBoxAGVName.Items.Add(item.Name);
// cmbBoxAGVName.Items.Add(item.Name);
...
@@ -269,23 +264,11 @@ namespace AGVControl
...
@@ -269,23 +264,11 @@ namespace AGVControl
else
if
(
e
.
ColumnIndex
==
8
)
//清除缓存
else
if
(
e
.
ColumnIndex
==
8
)
//清除缓存
{
{
//清除节点缓存
//清除节点缓存
Common
.
LogInfo
(
string
.
Format
(
"手动清除缓存,{0} {1}"
,
Common
.
nodeInfo
[
e
.
RowIndex
].
AgvName
,
Common
.
nodeInfo
[
e
.
RowIndex
].
Name
));
Common
.
LogInfo
(
string
.
Format
(
"手动清除缓存,{0}"
,
Common
.
nodeInfo
[
e
.
RowIndex
].
Name
));
string
name
=
Common
.
nodeInfo
[
e
.
RowIndex
].
AgvName
;
Common
.
nodeInfo
[
e
.
RowIndex
].
AgvName
=
""
;
Common
.
nodeInfo
[
e
.
RowIndex
].
AgvName
=
""
;
DgvNode
.
Rows
[
e
.
RowIndex
].
Cells
[
5
].
Value
=
""
;
DgvNode
.
Rows
[
e
.
RowIndex
].
Cells
[
5
].
Value
=
""
;
Common
.
nodeInfo
[
e
.
RowIndex
].
RFID
=
""
;
Common
.
nodeInfo
[
e
.
RowIndex
].
RFID
=
""
;
DgvNode
.
Rows
[
e
.
RowIndex
].
Cells
[
4
].
Value
=
""
;
DgvNode
.
Rows
[
e
.
RowIndex
].
Cells
[
4
].
Value
=
""
;
//清除小车缓存
int
idx
=
Common
.
agvInfo
.
FindIndex
(
s
=>
s
.
Name
==
name
);
if
(
idx
>
-
1
)
{
Common
.
agvInfo
[
idx
].
Place
=
""
;
Common
.
agvInfo
[
idx
].
RFID
=
""
;
DgvAgv
.
Rows
[
idx
].
SetValues
(
Common
.
agvInfo
[
idx
].
ToRow
());
//添加Init任务
Common
.
mir
.
Add_Mission_Fleet
(
Common
.
agvInfo
[
idx
],
Common
.
agvMission
[
"Init"
]);
Common
.
mir
.
State_Ready
(
Common
.
agvInfo
[
idx
]);
}
DgvNode
.
Rows
[
e
.
RowIndex
].
SetValues
(
Common
.
nodeInfo
[
e
.
RowIndex
].
ToRow
());
DgvNode
.
Rows
[
e
.
RowIndex
].
SetValues
(
Common
.
nodeInfo
[
e
.
RowIndex
].
ToRow
());
}
}
}
}
...
@@ -394,32 +377,6 @@ namespace AGVControl
...
@@ -394,32 +377,6 @@ namespace AGVControl
InShhow
=
false
;
InShhow
=
false
;
}
}
private
void
ShowEmptyTask
()
{
if
(
dgvLineMission
.
InvokeRequired
)
{
dgvLineMission
.
Invoke
(
new
Action
(()
=>
ShowEmptyTask
()));
return
;
}
try
{
if
(
dgvLineMission
.
Rows
.
Count
!=
0
)
dgvLineMission
.
Rows
.
Clear
();
foreach
(
var
item
in
Common
.
missionManager
.
missionList
)
{
var
key
=
Common
.
nodeInfo
.
Where
(
q
=>
q
.
Name
==
item
.
NodeName
).
Select
(
q
=>
q
.
AliceName
);
if
(
key
.
ToList
().
Count
>
0
)
dgvLineMission
.
Rows
.
Add
(
item
.
CreateTime
,
key
.
ToList
()[
0
]);
}
groupBox4
.
Text
=
"产线解绑信息:共"
+
Common
.
missionManager
.
EmptyMissionCount
.
ToString
()
+
"个"
;
}
catch
(
Exception
ex
)
{
Common
.
log
.
Error
(
ex
);
}
}
private
void
ChkAutoCharge_CheckedChanged
(
object
sender
,
EventArgs
e
)
private
void
ChkAutoCharge_CheckedChanged
(
object
sender
,
EventArgs
e
)
{
{
...
@@ -438,21 +395,23 @@ namespace AGVControl
...
@@ -438,21 +395,23 @@ namespace AGVControl
}
}
if
(
MessageBox
.
Show
(
"确定删除产线任务["
+
cmbBoxLineName
.
SelectedItem
.
ToString
()
+
"]"
,
"手动删除解绑任务"
,
MessageBoxButtons
.
YesNo
)
==
DialogResult
.
No
)
if
(
MessageBox
.
Show
(
"确定删除产线任务["
+
cmbBoxLineName
.
SelectedItem
.
ToString
()
+
"]"
,
"手动删除解绑任务"
,
MessageBoxButtons
.
YesNo
)
==
DialogResult
.
No
)
return
;
return
;
//int idx=Common.missionList.FindIndex(s => s.NodeName == Common.agvProductionLine[txtBoxMission.Text]);
if
(
txtRfid
.
Text
.
ToUpper
().
StartsWith
(
"D"
)
||
txtRfid
.
Text
.
ToUpper
().
StartsWith
(
"C"
))
int
idx
=
Common
.
nodeInfo
.
FindIndex
(
s
=>
s
.
AliceName
.
Equals
(
cmbBoxLineName
.
SelectedItem
.
ToString
()));
if
(
idx
>
-
1
)
{
{
if
(
Common
.
DelEmptyShelfTask
(
Common
.
nodeInfo
[
idx
].
Name
))
int
idx
=
Common
.
nodeInfo
.
FindIndex
(
s
=>
s
.
AliceName
.
Equals
(
cmbBoxLineName
.
SelectedItem
.
ToString
()));
{
if
(
idx
>
-
1
)
Common
.
LogInfo
(
"手动删除任务成功:"
+
cmbBoxLineName
.
SelectedItem
.
ToString
());
}
else
{
{
Common
.
LogInfo
(
"手动删除任务失败"
);
if
(
Common
.
nodeInfo
[
idx
].
UnlockedShelf
.
Delete
(
txtRfid
.
Text
.
ToUpper
()))
{
Common
.
LogInfo
(
string
.
Format
(
"手动删除任务成功:{0} {1}"
,
cmbBoxLineName
.
SelectedItem
.
ToString
(),
txtRfid
.
Text
.
ToUpper
()));
}
else
{
Common
.
LogInfo
(
"手动删除任务失败"
);
}
}
}
}
}
}
}
catch
(
Exception
ex
)
catch
(
Exception
ex
)
{
{
...
@@ -465,32 +424,35 @@ namespace AGVControl
...
@@ -465,32 +424,35 @@ namespace AGVControl
{
{
try
try
{
{
if
(
cmbBoxLineName
.
SelectedItem
==
null
||
cmbBoxLineName
.
SelectedIndex
==
0
)
if
(
cmbBoxLineName
.
SelectedItem
==
null
||
cmbBoxLineName
.
SelectedIndex
==
0
||
txtRfid
.
Text
.
Equals
(
""
)
)
{
{
return
;
return
;
}
}
if
(
cmbBoxLineName
.
SelectedItem
.
ToString
().
StartsWith
(
"A"
))
if
(
cmbBoxLineName
.
SelectedItem
.
ToString
().
StartsWith
(
"A"
))
return
;
return
;
if
(
MessageBox
.
Show
(
"确定添加产线任务["
+
cmbBoxLineName
.
SelectedItem
.
ToString
()
+
"]"
,
"手动
1
添加解绑"
,
MessageBoxButtons
.
YesNo
)
==
DialogResult
.
No
)
if
(
MessageBox
.
Show
(
"确定添加产线任务["
+
cmbBoxLineName
.
SelectedItem
.
ToString
()
+
"]"
,
"手动添加解绑"
,
MessageBoxButtons
.
YesNo
)
==
DialogResult
.
No
)
return
;
return
;
int
idx
=
Common
.
nodeInfo
.
FindIndex
(
s
=>
s
.
AliceName
.
Equals
(
cmbBoxLineName
.
SelectedItem
.
ToString
()));
if
(
txtRfid
.
Text
.
ToUpper
().
StartsWith
(
"D"
)
||
txtRfid
.
Text
.
ToUpper
().
StartsWith
(
"C"
))
if
(
idx
>
-
1
)
{
{
if
(
Common
.
AddEmptyShelfTask
(
Common
.
nodeInfo
[
idx
].
Name
))
int
idx
=
Common
.
nodeInfo
.
FindIndex
(
s
=>
s
.
AliceName
.
Equals
(
cmbBoxLineName
.
SelectedItem
.
ToString
()));
{
if
(
idx
>
-
1
)
Common
.
LogInfo
(
"手动添加任务成功:"
+
cmbBoxLineName
.
SelectedItem
.
ToString
());
}
else
{
{
Common
.
LogInfo
(
"手动添加任务失败"
);
if
(
Common
.
nodeInfo
[
idx
].
UnlockedShelf
.
Add
(
txtRfid
.
Text
.
ToUpper
()))
}
{
Common
.
LogInfo
(
string
.
Format
(
"手动添加任务成功:{0} {1}"
,
cmbBoxLineName
.
SelectedItem
.
ToString
(),
txtRfid
.
Text
.
ToUpper
()));
}
else
{
Common
.
LogInfo
(
"手动添加任务失败"
);
}
}
}
}
}
}
catch
(
Exception
ex
)
catch
(
Exception
ex
)
{
{
ShowEmptyTask
();
Common
.
log
.
Error
(
"手动添加任务失败:"
+
ex
.
Message
);
Common
.
log
.
Error
(
"手动添加任务失败:"
+
ex
.
Message
);
}
}
}
}
...
@@ -617,11 +579,6 @@ namespace AGVControl
...
@@ -617,11 +579,6 @@ namespace AGVControl
}
}
}
}
private
void
dgvLineMission_Click
(
object
sender
,
EventArgs
e
)
{
ShowEmptyTask
();
}
private
void
btnClearC4StandyInfo_Click
(
object
sender
,
EventArgs
e
)
private
void
btnClearC4StandyInfo_Click
(
object
sender
,
EventArgs
e
)
{
{
Common
.
StandbyStation
.
C4_Station1
=
""
;
Common
.
StandbyStation
.
C4_Station1
=
""
;
...
...
AGVControl-ProductionLine/FrmMain.resx
查看文件 @
9ea1b3d
...
@@ -174,12 +174,6 @@
...
@@ -174,12 +174,6 @@
<metadata name="Column16.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<metadata name="Column16.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
<value>True</value>
</metadata>
</metadata>
<metadata name="Column24.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="Column8.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
<value>
...
...
AGVControl-ProductionLine/bean/Node.cs
查看文件 @
9ea1b3d
...
@@ -41,7 +41,11 @@ namespace AGVControl
...
@@ -41,7 +41,11 @@ namespace AGVControl
{
{
Name
=
name
;
Name
=
name
;
}
}
/// <summary>
/// 状态比较
/// </summary>
/// <param name="obj"></param>
/// <returns></returns>
public
bool
StateEquals
(
eNodeStatus
obj
)
public
bool
StateEquals
(
eNodeStatus
obj
)
{
{
return
nodeStatus
.
Equals
(
obj
);
return
nodeStatus
.
Equals
(
obj
);
...
...
AGVControl-ProductionLine/bean/UnlockedShelf.cs
0 → 100644
查看文件 @
9ea1b3d
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Text
;
using
System.Threading.Tasks
;
namespace
AGVControl
{
public
class
UnlockedShelf
{
/// <summary>
/// 已解绑料架信息
/// </summary>
/// <param name="nodeName"></param>
public
UnlockedShelf
(
string
nodeName
)
{
NodeName
=
nodeName
;
}
/// <summary>
/// 空料架数量
/// </summary>
public
int
EmptyCnt
{
get
{
return
emptyCnt
;
}
set
{
EmptyCnt
=
emptyCnt
;
}
}
/// <summary>
/// 节点名
/// </summary>
public
string
NodeName
{
get
;
private
set
;
}
private
int
emptyCnt
=
0
;
/// <summary>
/// 解绑的所有RFID
/// </summary>
private
Dictionary
<
string
,
string
>
Rfids
;
/// <summary>
///添加解绑的空料架,如果RFID相同,不增加数量
/// </summary>
public
bool
Add
(
string
rfid
)
{
if
(!
rfid
.
Equals
(
""
)
&&
!
Rfids
.
Keys
.
Contains
(
rfid
))
{
System
.
Threading
.
Interlocked
.
Increment
(
ref
emptyCnt
);
Rfids
.
Add
(
rfid
,
DateTime
.
Now
.
ToString
(
"yyyy/MM/dd/HH:mm:ss,fff"
));
Common
.
WriteIni
(
NodeName
,
SettingString
.
EmptyShelfRFIDs
,
string
.
Join
(
","
,
Rfids
.
Keys
.
ToArray
()));
Common
.
WriteIni
(
NodeName
,
SettingString
.
EmptyShelfCnt
,
emptyCnt
.
ToString
());
Common
.
LogInfo
(
string
.
Format
(
"{0}解绑任务添加成功:RFID={1}"
,
NodeName
,
rfid
));
return
true
;
}
Common
.
LogInfo
(
string
.
Format
(
"{0}解绑任务添加失败:RFID={1}"
,
NodeName
,
rfid
));
return
false
;
}
/// <summary>
/// 删除一个解绑任务
/// </summary>
public
bool
Delete
(
string
rfid
)
{
if
(
emptyCnt
>
0
)
{
if
(!
rfid
.
Equals
(
""
)
&&
Rfids
.
Keys
.
Contains
(
rfid
))
{
System
.
Threading
.
Interlocked
.
Decrement
(
ref
emptyCnt
);
Rfids
.
Remove
(
rfid
);
Common
.
WriteIni
(
NodeName
,
SettingString
.
EmptyShelfCnt
,
emptyCnt
.
ToString
());
Common
.
WriteIni
(
NodeName
,
SettingString
.
EmptyShelfRFIDs
,
string
.
Join
(
","
,
Rfids
.
Keys
.
ToArray
()));
using
()
{
}
Common
.
LogInfo
(
string
.
Format
(
"{0}解绑任务删除成功:RFID={1}"
,
NodeName
,
rfid
));
return
true
;
}
}
else
if
(
Rfids
.
Count
>
0
)
{
Rfids
.
Clear
();
return
true
;
}
Common
.
LogInfo
(
string
.
Format
(
"{0}解绑任务删除失败:RFID={1}"
,
NodeName
,
rfid
));
return
false
;
}
}
}
AGVControl-ProductionLine/bean/node/ClientNode.cs
查看文件 @
9ea1b3d
...
@@ -32,11 +32,6 @@ namespace AGVControl
...
@@ -32,11 +32,6 @@ namespace AGVControl
}
}
/// <summary>
/// <summary>
/// 小车名称
/// </summary>
public
string
AgvName
{
set
;
get
;
}
/// <summary>
/// 线体名(佳世达)
/// 线体名(佳世达)
/// </summary>
/// </summary>
public
string
LineName
{
set
;
get
;
}
public
string
LineName
{
set
;
get
;
}
...
@@ -54,24 +49,10 @@ namespace AGVControl
...
@@ -54,24 +49,10 @@ namespace AGVControl
/// 节点位置坐标
/// 节点位置坐标
/// </summary>
/// </summary>
public
PositionStru
position
;
public
PositionStru
position
;
/// <summary>
/// 空料架数量
/// </summary>
public
int
EmptyShelfCnt
{
get
{
return
_EmptyShelfCnt
;
}
set
{
EmptyShelfCnt
=
_EmptyShelfCnt
;
}
}
/// <summary>
/// <summary>
///
空架子的RFID
///
料架解绑信息
/// </summary>
/// </summary>
public
List
<
string
>
EmptyShelfRFIDs
;
public
UnlockedShelf
UnlockedShelf
{
get
;
set
;
}
private
int
_EmptyShelfCnt
=
0
;
public
string
AliceName
{
get
;
set
;
}
public
string
AliceName
{
get
;
set
;
}
/// <summary>
/// <summary>
/// 客户端节点
/// 客户端节点
...
@@ -84,14 +65,12 @@ namespace AGVControl
...
@@ -84,14 +65,12 @@ namespace AGVControl
AliceName
=
aliceName
;
AliceName
=
aliceName
;
RFID
=
rfid
;
RFID
=
rfid
;
AgvName
=
""
;
Online
=
false
;
Online
=
false
;
IsUse
=
isUse
;
IsUse
=
isUse
;
_EmptyShelfCnt
=
emptyCnt
;
this
.
Pos_name
=
pos_name
;
this
.
Pos_name
=
pos_name
;
this
.
Pos_guid
=
pos_guid
;
this
.
Pos_guid
=
pos_guid
;
LineName
=
lineName
;
LineName
=
lineName
;
EmptyShelfRFIDs
=
new
List
<
string
>(
);
UnlockedShelf
=
new
UnlockedShelf
(
name
);
}
}
/// <summary>
/// <summary>
...
@@ -106,48 +85,8 @@ namespace AGVControl
...
@@ -106,48 +85,8 @@ namespace AGVControl
RFID
=
rfid
;
RFID
=
rfid
;
nodeStatus
=
status
;
nodeStatus
=
status
;
AgvName
=
""
;
}
/// <summary>
///空料架数量增加,如果RFID相同,不增加数量
/// </summary>
public
void
IncreEmptyShelfCnt
(
string
rfid
)
{
if
(!
rfid
.
Equals
(
""
)
&&
!
EmptyShelfRFIDs
.
Contains
(
rfid
))
{
System
.
Threading
.
Interlocked
.
Increment
(
ref
_EmptyShelfCnt
);
EmptyShelfRFIDs
.
Add
(
rfid
);
Common
.
WriteIni
(
Name
,
SettingString
.
EmptyShelfRFIDs
,
string
.
Join
(
","
,
EmptyShelfRFIDs
.
ToArray
()));
Common
.
WriteIni
(
Name
,
SettingString
.
EmptyShelfCnt
,
_EmptyShelfCnt
.
ToString
());
Common
.
LogInfo
(
string
.
Format
(
"{0}解绑任务添加成功:RFID={1}"
,
Name
,
rfid
));
}
//else if(rfid.Equals(""))
//{
// System.Threading.Interlocked.Increment(ref _EmptyShelfCnt);
// Common.WriteIni(Name, SettingString.EmptyShelfCnt, _EmptyShelfCnt.ToString());
//}
}
/// <summary>
/// 空料架数量减少1
/// </summary>
public
void
DecreEmptyShelfCnt
(
string
rfid
)
{
if
(
_EmptyShelfCnt
>
0
)
{
if
(!
rfid
.
Equals
(
""
)
&&
EmptyShelfRFIDs
.
Contains
(
rfid
))
{
System
.
Threading
.
Interlocked
.
Decrement
(
ref
_EmptyShelfCnt
);
Common
.
WriteIni
(
Name
,
SettingString
.
EmptyShelfCnt
,
_EmptyShelfCnt
.
ToString
());
EmptyShelfRFIDs
.
Remove
(
rfid
);
Common
.
WriteIni
(
Name
,
SettingString
.
EmptyShelfRFIDs
,
string
.
Join
(
","
,
EmptyShelfRFIDs
.
ToArray
()));
Common
.
LogInfo
(
string
.
Format
(
"{0}解绑任务删除成功:RFID={1}"
,
Name
,
rfid
));
}
}
else
if
(
_EmptyShelfCnt
.
Equals
(
0
)
&&
EmptyShelfRFIDs
.
Count
>
0
)
{
EmptyShelfRFIDs
.
Clear
();
}
}
}
/// <summary>
/// <summary>
/// 节点状态的文本形式
/// 节点状态的文本形式
/// </summary>
/// </summary>
...
@@ -185,7 +124,6 @@ namespace AGVControl
...
@@ -185,7 +124,6 @@ namespace AGVControl
{
{
RFID
=
"00"
;
RFID
=
"00"
;
nodeStatus
=
eNodeStatus
.
None
;
nodeStatus
=
eNodeStatus
.
None
;
AgvName
=
""
;
Online
=
false
;
Online
=
false
;
}
}
...
...
AGVControl-ProductionLine/obj/Debug/DesignTimeResolveAssemblyReferences.cache
查看文件 @
9ea1b3d
此文件类型无法预览
AGVControl-ProductionLine/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache
查看文件 @
9ea1b3d
此文件类型无法预览
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论