Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
张东亮
/
SO1131-ConveyorLine
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
作业
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit 6848577d
由
张东亮
编写于
2023-01-03 15:04:42 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
20230103
1 个父辈
a1f4eb60
显示空白字符变更
内嵌
并排
正在显示
15 个修改的文件
包含
193 行增加
和
120 行删除
source/AssemblyLineClient/App.config
source/AssemblyLineClient/FrmLine.cs
source/AssemblyLineClient/FrmRFIPEdit.cs
source/Common/Setting_Init.cs
source/Common/util/MyWebClient.cs
source/DeviceLibrary/ESS/WebService.cs
source/DeviceLibrary/clientLine/HY/HY_SLStation.cs
source/DeviceLibrary/clientLine/LineBean.cs
source/DeviceLibrary/clientLine/StationEquip_InStore.cs
source/DeviceLibrary/clientLine/StationEquip_OutStore.cs
source/DeviceLibrary/lineManager/ALineManager.cs
source/DeviceLibrary/lineManager/ContainerManager.cs
source/DeviceLibrary/lineManager/RFIDManagercs.cs
source/DeviceLibrary/lineManager/SServerManager.cs
source/RFID_PuYue/PuYueRFID_C2S.cs
source/AssemblyLineClient/App.config
查看文件 @
6848577
...
...
@@ -31,6 +31,10 @@
<!--是否打开托盘编码界面-->
<
add
key
=
"DefaultPWD"
value
=
"123456"
/>
<
add
key
=
"Server_Log_Open"
value
=
"0"
/>
<!--任务限制数量-->
<
add
key
=
"TaskCnt"
value
=
"30"
/>
<!--横移
3
出库箱子等待超时时间-->
<
add
key
=
"HY3_WaitTimeOut"
value
=
"30"
/>
</
appSettings
>
<
log4net
>
<
appender
name
=
"RollingLogFileAppender"
type
=
"log4net.Appender.RollingFileAppender"
>
...
...
source/AssemblyLineClient/FrmLine.cs
查看文件 @
6848577
...
...
@@ -554,7 +554,8 @@ namespace OnlineStore.AssemblyLine
msg
+=
t
.
ToStr
()
+
"\r\n"
;
}
msg
+=
"---------结束打印容器信息----------"
;
MessageBox
.
Show
(
msg
,
"容器信息列表"
);
var
outTask
=
ContainerManager
.
getTrayList
().
FindAll
(
s
=>
s
.
InOrOutStore
.
Equals
(
ContainerType
.
OutStore
));
MessageBox
.
Show
(
msg
,
$
"容器信息列表[{outTask?.Count??0}]/[{tray?.Count ?? 0}]"
);
}
...
...
source/AssemblyLineClient/FrmRFIPEdit.cs
查看文件 @
6848577
...
...
@@ -29,7 +29,7 @@ namespace OnlineStore.AssemblyLine
comboxType
.
Items
.
Clear
();
foreach
(
EquipBase
b
in
LineManager
.
Line
.
AllEquipMap
.
Values
)
{
b
.
OpenRfid
();
//
b.OpenRfid();
List
<
string
>
value
=
RFIDManager
.
GetRFIP
(
b
.
DeviceID
);
if
(
value
!=
null
&&
value
.
Count
>
0
)
{
...
...
@@ -73,13 +73,13 @@ namespace OnlineStore.AssemblyLine
private
void
FrmRFIPEdit_FormClosed
(
object
sender
,
FormClosedEventArgs
e
)
{
if
(
LineManager
.
Line
.
runStatus
<=
LineRunStatus
.
Wait
)
{
foreach
(
EquipBase
b
in
LineManager
.
Line
.
AllEquipMap
.
Values
)
{
b
.
CloseRfid
();
}
}
//
if (LineManager.Line.runStatus <= LineRunStatus.Wait)
//
{
//
foreach (EquipBase b in LineManager.Line.AllEquipMap.Values)
//
{
//
b.CloseRfid();
//
}
//
}
}
}
}
source/Common/Setting_Init.cs
查看文件 @
6848577
...
...
@@ -49,5 +49,6 @@ namespace OnlineStore.Common
public
static
string
DisTraySave
=
"DisTraySave"
;
public
static
string
ESS_Server
=
"ESS_Server"
;
public
static
string
Webservice
=
"Webservice"
;
public
static
string
HY3_WaitTimeOut
=
"HY3_WaitTimeOut"
;
}
}
source/Common/util/MyWebClient.cs
查看文件 @
6848577
...
...
@@ -169,7 +169,7 @@ namespace OnlineStore.Common
{
LogUtil
.
error
(
"POST ["
+
url
+
"] ERROR:"
+
e
.
ToString
(),
101
);
}
if
(
!
resultMsg
.
Contains
(
"null"
)
&&
resultMsg
.
Length
!=
0
)
if
(
resultMsg
.
Length
!=
0
)
//!resultMsg.Contains("null") &&
{
return
true
;
}
...
...
source/DeviceLibrary/ESS/WebService.cs
查看文件 @
6848577
...
...
@@ -81,8 +81,8 @@ namespace OnlineStore.DeviceLibrary.ESS
{
ContainerManager
.
UpdateTaskStatus
(
essModel
.
containerCode
,
TaskStatus
.
IN_ON_AGV
);
}
else
if
(
essModel
.
status
.
Equals
(
"cancel"
))
ContainerManager
.
UpdateTaskStatus
(
essModel
.
containerCode
,
TaskStatus
.
ERROR
);
//
else if (essModel.status.Equals("cancel"))
//
ContainerManager.UpdateTaskStatus(essModel.containerCode, TaskStatus.ERROR);
}
else
if
(
essModel
.
eventType
?.
Equals
(
"task"
)??
false
)
{
...
...
@@ -90,8 +90,8 @@ namespace OnlineStore.DeviceLibrary.ESS
{
ContainerManager
.
UpdateTaskStatus
(
essModel
.
containerCode
,
TaskStatus
.
FINISHED
);
}
else
if
(
essModel
.
status
.
Equals
(
"cancel"
))
ContainerManager
.
UpdateTaskStatus
(
essModel
.
containerCode
,
TaskStatus
.
ERROR
);
//
else if (essModel.status.Equals("cancel"))
// ContainerManager.UpdateTaskStatus(essModel.containerCode, TaskStatus.WAIT
);
}
}
else
if
(
essModel
.
taskCode
?.
ToLower
().
StartsWith
(
"out"
)
??
false
)
...
...
@@ -102,8 +102,8 @@ namespace OnlineStore.DeviceLibrary.ESS
{
ContainerManager
.
UpdateTaskStatus
(
essModel
.
containerCode
,
TaskStatus
.
OUT_ON_AGV
);
}
else
if
(
essModel
.
status
.
Equals
(
"cancel"
))
ContainerManager
.
UpdateTaskStatus
(
essModel
.
containerCode
,
TaskStatus
.
ERROR
);
//
else if (essModel.status.Equals("cancel"))
//
ContainerManager.UpdateTaskStatus(essModel.containerCode, TaskStatus.ERROR);
}
else
if
(
essModel
.
eventType
?.
Equals
(
"task"
)
??
false
)
{
...
...
@@ -117,8 +117,8 @@ namespace OnlineStore.DeviceLibrary.ESS
// LineManager.StartStationInStore(info.InoutParam);
//}
}
else
if
(
essModel
.
status
.
Equals
(
"cancel"
))
ContainerManager
.
UpdateTaskStatus
(
essModel
.
containerCode
,
TaskStatus
.
ERROR
);
//
else if (essModel.status.Equals("cancel"))
//
ContainerManager.UpdateTaskStatus(essModel.containerCode, TaskStatus.ERROR);
}
}
...
...
source/DeviceLibrary/clientLine/HY/HY_SLStation.cs
查看文件 @
6848577
...
...
@@ -57,7 +57,7 @@ namespace OnlineStore.DeviceLibrary
MoveInfo
.
NextMoveStep
(
LineMoveStep
.
HY_R_01StopMove
);
LogInfo
(
"开始复位,横移线体停止 "
);
LineStop
(
MoveInfo
);
if
(
IsHY2
()
&&
IOValue
(
IO_Type
.
HY_BoxCheck
).
Equals
(
IO_VALUE
.
HIGH
))
if
(
IsHY2
()
&&
IOValue
(
IO_Type
.
HY_BoxCheck
).
Equals
(
IO_VALUE
.
HIGH
))
{
JackingDown
(
MoveInfo
);
MoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitTime
(
10000
));
...
...
@@ -275,6 +275,8 @@ namespace OnlineStore.DeviceLibrary
{
UpdateContainerCode
();
}
bool
hy3ToDischarge
=
false
;
int
hy3WaitTime
=
ConfigAppSettings
.
GetIntValue
(
Setting_Init
.
HY3_WaitTimeOut
);
protected
override
void
BoxProcess
()
{
if
(
MoveInfo
.
IsInWait
)
...
...
@@ -327,34 +329,52 @@ namespace OnlineStore.DeviceLibrary
ContainerInfo
trayInfo
=
ContainerManager
.
GetTrayInfo
(
CurContainerId
);
if
(
trayInfo
?.
InOrOutStore
==
ContainerType
.
InStore
)
//入库
{
if
(
IsDischargeIdle
())
{
JackingDown
(
MoveInfo
);
}
else
{
JackingUp
(
MoveInfo
);
}
}
else
{
JackingUp
(
MoveInfo
);
}
}
else
if
(
MoveInfo
.
IsStep
(
LineMoveStep
.
HY34_GetBoxInfo
))
{
MoveInfo
.
NextMoveStep
(
LineMoveStep
.
HY35_CheckDownriver
);
LogInfo
(
" 检查下游状态"
);
ContainerInfo
trayInfo
=
ContainerManager
.
GetTrayInfo
(
CurContainerId
);
if
(
trayInfo
?.
InOrOutStore
==
ContainerType
.
InStore
)
//入库
{
if
(
IsDischargeIdle
())
{
MoveInfo
.
NextMoveStep
(
LineMoveStep
.
HY35_CheckDownriver
);
LogInfo
(
"入库容器,出料工位空闲,流到出料工位"
);
JackingDown
(
MoveInfo
);
hy3ToDischarge
=
true
;
}
else
if
(
MoveInfo
.
IsTimeOut
(
hy3WaitTime
))
{
MoveInfo
.
NextMoveStep
(
LineMoveStep
.
HY35_CheckDownriver
);
LogInfo
(
$
"入库容器,等待{hy3WaitTime}秒超时,直接流转"
);
JackingUp
(
MoveInfo
);
hy3ToDischarge
=
false
;
}
}
else
{
MoveInfo
.
NextMoveStep
(
LineMoveStep
.
HY35_CheckDownriver
);
LogInfo
(
"出库容器,直接流转"
);
JackingUp
(
MoveInfo
);
hy3ToDischarge
=
false
;
}
}
else
if
(
MoveInfo
.
IsStep
(
LineMoveStep
.
HY35_CheckDownriver
))
{
ContainerInfo
trayInfo
=
ContainerManager
.
GetTrayInfo
(
CurContainerId
);
if
(
trayInfo
?.
InOrOutStore
==
ContainerType
.
InStore
)
//入库
{
if
(
IsDischargeIdle
())
if
(
hy3ToDischarge
)
//入库
{
MoveInfo
.
NextMoveStep
(
LineMoveStep
.
HY36_ReleaseBox
);
ClearSpecifiedWarnMsg
(
"等待出料工位空闲超时"
);
...
...
@@ -363,11 +383,7 @@ namespace OnlineStore.DeviceLibrary
StopDown
(
MoveInfo
);
LineManager
.
StartDisChargeMove
();
MoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitTime
(
1000
));
}
else
if
(
MoveInfo
.
IsTimeOut
(
30
))
{
SetWarnMsg
(
"等待出料工位空闲超时"
);
}
}
else
{
...
...
@@ -386,12 +402,11 @@ namespace OnlineStore.DeviceLibrary
SetWarnMsg
(
"等待横移4空闲超时"
);
}
}
}
else
if
(
MoveInfo
.
IsStep
(
LineMoveStep
.
HY36_ReleaseBox
))
{
ContainerInfo
trayInfo
=
ContainerManager
.
GetTrayInfo
(
CurContainerId
);
if
(
trayInfo
?.
InOrOutStore
==
ContainerType
.
InStor
e
)
//入库
if
(
hy3ToDischarg
e
)
//入库
{
if
(
BoxReachDischarge
())
{
...
...
@@ -435,7 +450,7 @@ namespace OnlineStore.DeviceLibrary
MoveInfo
.
NextMoveStep
(
LineMoveStep
.
HY21_WaitBoxCheck
);
LogInfo
(
$
"等待容器到位"
);
MoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitIO
(
IO_Type
.
HY_BoxCheck
,
IO_VALUE
.
HIGH
));
MoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitTime
(
3
00
));
MoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitTime
(
15
00
));
}
else
if
(
MoveInfo
.
IsStep
(
LineMoveStep
.
HY21_WaitBoxCheck
))
{
...
...
@@ -454,11 +469,11 @@ namespace OnlineStore.DeviceLibrary
else
if
(
MoveInfo
.
IsStep
(
LineMoveStep
.
HY23_WaitBoxLeave
))
{
MoveInfo
.
NextMoveStep
(
LineMoveStep
.
HY24_JackingUp
);
if
(
LineManager
.
IsFeedingHasBox
())
{
LogInfo
(
$
"入料工位有容器,顶升不动作"
);
}
else
//
if (LineManager.IsFeedingHasBox())
//
{
//
LogInfo($"入料工位有容器,顶升不动作");
//
}
//
else
{
LogInfo
(
$
"入料工位无容器,顶升上升"
);
JackingUp
(
MoveInfo
);
...
...
source/DeviceLibrary/clientLine/LineBean.cs
查看文件 @
6848577
...
...
@@ -800,21 +800,16 @@ namespace OnlineStore.DeviceLibrary
return
msg
;
}
private
bool
conIsPro
=
false
;
private
object
conIsPro
=
new
object
()
;
private
DateTime
conLastTime
=
DateTime
.
Now
;
private
DateTime
callOutLastTime
=
DateTime
.
Now
;
private
void
ServerConTimer_Elapsed
(
object
sender
,
ElapsedEventArgs
e
)
{
TimeSpan
span
=
DateTime
.
Now
-
conLastTime
;
if
(
conIsPro
&&
span
.
TotalSeconds
<
30
)
if
(
Monitor
.
TryEnter
(
conIsPro
))
{
return
;
}
try
{
conIsPro
=
true
;
conLastTime
=
DateTime
.
Now
;
#
region
异常上报
#
region
异常上报
未使用
//List<AlarmMsg> alarmList = new List<AlarmMsg>();
//foreach (EquipBase equip in AllEquipMap.Values)
//{
...
...
@@ -874,6 +869,10 @@ namespace OnlineStore.DeviceLibrary
RobotStates
states
=
SServerManager
.
GetRobotState
();
if
(
LineManager
.
RobotIsIdle
(
states
)
||
LineManager
.
CheckRobotTrayIsInstore
(
states
))
{
TimeSpan
span1
=
DateTime
.
Now
-
callOutLastTime
;
if
(
span1
.
TotalSeconds
>
15
)
{
callOutLastTime
=
DateTime
.
Now
;
foreach
(
var
item
in
outTask
)
{
ContainerManager
.
AddOrUpdateContainerInfo
(
item
.
barcode
);
...
...
@@ -881,6 +880,8 @@ namespace OnlineStore.DeviceLibrary
}
}
}
//发送呼叫任务
ContainerManager
.
HandlePendingTask
();
//上报容器状态
...
...
@@ -892,7 +893,8 @@ namespace OnlineStore.DeviceLibrary
}
finally
{
conIsPro
=
false
;
Monitor
.
Exit
(
conIsPro
);
}
}
}
...
...
source/DeviceLibrary/clientLine/StationEquip_InStore.cs
查看文件 @
6848577
...
...
@@ -166,12 +166,23 @@ namespace OnlineStore.DeviceLibrary
MoveInfo
.
NextMoveStep
(
LineMoveStep
.
SI_05_WaitBoxLeave
);
LogInfo
(
$
"等待出库容器被拿走"
);
AddWaitBoxCheck
(
false
);
MoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitTime
(
15000
));
MoveInfo
.
OneWaitCanEndStep
=
true
;
}
else
if
(
MoveInfo
.
IsStep
(
LineMoveStep
.
SI_05_WaitBoxLeave
))
{
if
(
IOValue
(
IO_Type
.
Stop_BoxCheck
).
Equals
(
IO_VALUE
.
HIGH
))
{
MoveInfo
.
NextMoveStep
(
LineMoveStep
.
SI_08_StopDown
);
LogInfo
(
$
"出库容器被拿走超时,放行"
);
StopDown
(
MoveInfo
);
}
else
{
MoveInfo
.
NextMoveStep
(
LineMoveStep
.
SI_06_WaitBoxAtStation
);
LogInfo
(
$
"出库容器被拿走,等待容器到达工作台"
);
}
}
else
if
(
MoveInfo
.
IsStep
(
LineMoveStep
.
SI_06_WaitBoxAtStation
))
{
EquipBase
equipBase
=
GetOutEquip
();
...
...
@@ -187,28 +198,30 @@ namespace OnlineStore.DeviceLibrary
}
}
ClearSpecifiedWarnMsg
(
$
"等待容器到达下游"
);
if
(
MoveInfo
.
IsTimeOut
(
30
))
if
(
MoveInfo
.
IsTimeOut
(
15
))
{
MoveInfo
.
NextMoveStep
(
LineMoveStep
.
SI_07_AllStopDown
);
if
(
ContainerManager
.
GetInTaskCnt
(
DeviceID
)
>
0
)
{
LogInfo
(
$
"容器到达工作台30秒超时,该工位将有出库容器到达,前阻挡下降"
);
FrontStopDown
(
MoveInfo
);
//
if (ContainerManager.GetInTaskCnt(DeviceID) > 0)
//
{
//
LogInfo($"容器到达工作台30秒超时,该工位将有出库容器到达,前阻挡下降");
//
FrontStopDown(MoveInfo);
}
else
if
(
ContainerManager
.
GetOutTaskCnt
(
DeviceID
)
>
0
)
{
LogInfo
(
$
"容器到达工作台30秒超时,该工位将有入库容器离开,阻挡下降"
);
StopDown
(
MoveInfo
);
}
else
if
(
DeviceID
==
5
)
//}
//else if (ContainerManager.GetOutTaskCnt(DeviceID) > 0)
//{
// LogInfo($"容器到达工作台30秒超时,该工位将有入库容器离开,阻挡下降");
// StopDown(MoveInfo);
//}
//else
if
(
DeviceID
==
5
)
{
LogInfo
(
$
"容器到达工作台
30
秒超时,前阻挡下降"
);
LogInfo
(
$
"容器到达工作台
15
秒超时,前阻挡下降"
);
FrontStopDown
(
MoveInfo
);
}
else
{
LogInfo
(
$
"容器到达工作台
30
秒超时,所有阻挡下降"
);
LogInfo
(
$
"容器到达工作台
15
秒超时,所有阻挡下降"
);
StopDown
(
MoveInfo
);
FrontStopDown
(
MoveInfo
);
}
...
...
@@ -220,17 +233,19 @@ namespace OnlineStore.DeviceLibrary
if
(
CurShelfId_Station
.
Equals
(
CurContainerId
))
{
MoveInfo
.
NextMoveStep
(
LineMoveStep
.
SI_07_AllStopDown
);
if
(
ContainerManager
.
GetInTaskCnt
(
DeviceID
)
>
0
)
{
LogInfo
(
$
" 容器到达工作台,该工位将有出库容器到达,前阻挡下降"
);
FrontStopDown
(
MoveInfo
);
}
else
if
(
ContainerManager
.
GetOutTaskCnt
(
DeviceID
)
>
0
)
{
LogInfo
(
$
"容器到达工作台,该工位将有入库容器离开,阻挡下降"
);
StopDown
(
MoveInfo
);
}
else
if
(
DeviceID
==
5
)
//if (ContainerManager.GetInTaskCnt(DeviceID) > 0)
//{
// LogInfo($" 容器到达工作台,该工位将有出库容器到达,前阻挡下降");
// FrontStopDown(MoveInfo);
//}
//else if (ContainerManager.GetOutTaskCnt(DeviceID) > 0)
//{
// LogInfo($"容器到达工作台,该工位将有入库容器离开,阻挡下降");
// StopDown(MoveInfo);
//}
//else
if
(
DeviceID
==
5
)
{
LogInfo
(
$
"箱子到达工作台,前阻挡下降"
);
FrontStopDown
(
MoveInfo
);
...
...
@@ -272,17 +287,19 @@ namespace OnlineStore.DeviceLibrary
}
ClearSpecifiedWarnMsg
(
$
"等待容器到达下游"
);
MoveInfo
.
NextMoveStep
(
LineMoveStep
.
SI_10_FrontStopDown
);
if
(
ContainerManager
.
GetInTaskCnt
(
DeviceID
)
>
1
)
{
LogInfo
(
$
"该工位将有出库容器到达,阻挡上升,前阻挡下降"
);
StopUp
(
MoveInfo
);
FrontStopDown
(
MoveInfo
);
}
else
if
(
ContainerManager
.
GetOutTaskCnt
(
DeviceID
)
>
0
)
{
LogInfo
(
$
"该工位将有入库容器离开,前阻挡保持上升"
);
}
else
if
(
DeviceID
==
5
)
//工位5放行一个容器后前阻挡上升
//if (ContainerManager.GetInTaskCnt(DeviceID) > 1)
//{
// LogInfo($"该工位将有出库容器到达,阻挡上升,前阻挡下降");
// StopUp(MoveInfo);
// FrontStopDown(MoveInfo);
//}
//else if (ContainerManager.GetOutTaskCnt(DeviceID) > 0)
//{
// LogInfo($"该工位将有入库容器离开,前阻挡保持上升");
//}
//else
if
(
DeviceID
==
5
)
//工位5放行一个容器后前阻挡上升
{
LogInfo
(
$
"阻挡上升"
);
StopUp
(
MoveInfo
);
...
...
source/DeviceLibrary/clientLine/StationEquip_OutStore.cs
查看文件 @
6848577
...
...
@@ -39,8 +39,8 @@ namespace OnlineStore.DeviceLibrary
{
MoveInfo
.
NextMoveStep
(
LineMoveStep
.
SO_02_WaitBoxInToLine
);
AddWaitBoxCheck
(
true
);
WaitTime
(
3
000
);
//
MoveInfo.OneWaitCanEndStep = true;
WaitTime
(
15
000
);
MoveInfo
.
OneWaitCanEndStep
=
true
;
LogInfo
(
$
"等待箱子离开工作站"
);
}
else
if
(
MoveInfo
.
IsStep
(
LineMoveStep
.
SO_02_WaitBoxInToLine
))
...
...
source/DeviceLibrary/lineManager/ALineManager.cs
查看文件 @
6848577
...
...
@@ -172,7 +172,7 @@ namespace OnlineStore.DeviceLibrary
}
public
static
void
StartStationInStore
(
InOutParam
inOutParam
)
{
if
(
Line
?.
AllEquipMap
.
ContainsKey
(
inOutParam
.
DeviceId
)??
false
)
if
(
Line
?.
AllEquipMap
.
ContainsKey
(
inOutParam
.
DeviceId
)
??
false
)
{
Line
?.
AllEquipMap
[
inOutParam
.
DeviceId
].
StartInStoreMove
(
inOutParam
);
}
...
...
@@ -196,18 +196,22 @@ namespace OnlineStore.DeviceLibrary
{
try
{
if
(
robotStates
!=
null
&&
robotStates
.
robots
!=
null
)
if
(
robotStates
!=
null
&&
robotStates
.
robots
!=
null
)
{
foreach
(
var
item
in
robotStates
.
robots
)
{
if
(!
item
.
state
.
Equals
(
"IDLE"
))
continue
;
var
fullTray
=
item
.
trays
.
FindAll
(
s
=>
s
.
containerCode
!=
null
);
if
(
fullTray
==
null
)
return
true
;
if
(
fullTray
==
null
||
fullTray
.
Count
==
0
)
{
LogUtil
.
info
(
$
"机器人空闲且背篓为空,允许发送出库任务:【{JsonHelper.SerializeObject(item)}】"
);
return
true
;
}
}
}
}
catch
(
Exception
ex
)
catch
(
Exception
ex
)
{
LogUtil
.
error
(
"RobotTrayIsEmpty"
,
ex
);
}
...
...
@@ -233,10 +237,13 @@ namespace OnlineStore.DeviceLibrary
{
var
instore
=
ContainerManager
.
GetTrayInfo
(
tray
.
containerCode
);
if
(
instore
!=
null
&&
instore
.
InOrOutStore
.
Equals
(
ContainerType
.
InStore
))
{
LogUtil
.
info
(
$
"机器人背篓有入库容器,允许发送出库任务:【{JsonHelper.SerializeObject(item)}】【{JsonHelper.SerializeObject(instore)}】"
);
return
true
;
}
}
}
}
}
}
...
...
@@ -246,13 +253,18 @@ namespace OnlineStore.DeviceLibrary
}
return
false
;
}
static
int
taskCnt
=
ConfigAppSettings
.
GetIntValue
(
"TaskCnt"
);
/// <summary>
/// 检查容器任务数是否超限
/// 检查容器
出库
任务数是否超限
/// </summary>
/// <returns></returns>
public
static
bool
CheckTaskCntIsInLimit
()
{
return
ContainerManager
.
getTrayList
().
Count
<=
30
;
var
outTask
=
ContainerManager
.
getTrayList
().
FindAll
(
s
=>
s
.
InOrOutStore
.
Equals
(
ContainerType
.
OutStore
));
if
(
taskCnt
>
0
)
return
outTask
?.
Count
<=
taskCnt
;
//30
else
return
outTask
?.
Count
<=
8
;
//30
}
#
endregion
}
...
...
source/DeviceLibrary/lineManager/ContainerManager.cs
查看文件 @
6848577
...
...
@@ -48,18 +48,18 @@ namespace OnlineStore.DeviceLibrary
/// <returns></returns>
public
static
int
CntofContainerOnLine
()
{
try
{
List
<
ContainerInfo
>
containers
=
getTrayList
().
FindAll
(
s
=>(
s
.
Status
.
Equals
(
TaskStatus
.
IN_ON_LINE
)
||
s
.
Status
.
Equals
(
TaskStatus
.
OUT_ON_LINE
)));
if
(
containers
!=
null
)
{
return
containers
.
Count
;
}
}
catch
(
Exception
ex
)
{
LogUtil
.
error
(
$
"CntofContainerOnLine"
,
ex
);
}
//
try
//
{
//
List<ContainerInfo> containers= getTrayList().FindAll(s=>(s.Status.Equals(TaskStatus.IN_ON_LINE) || s.Status.Equals(TaskStatus.OUT_ON_LINE)));
//
if(containers!=null)
//
{
//
return containers.Count;
//
}
//
}
//
catch (Exception ex)
//
{
//
LogUtil.error($"CntofContainerOnLine", ex);
//
}
return
0
;
}
/// <summary>
...
...
@@ -84,7 +84,7 @@ namespace OnlineStore.DeviceLibrary
{
foreach
(
var
item
in
getTrayList
())
{
bool
rtn
=
SServerManager
.
UpdateLocInfo
(
"ContainerManager"
,
item
.
ContainerValidCode
,
item
.
Status
,
item
.
CurLoc
);
bool
rtn
=
SServerManager
.
UpdateLocInfo
(
"ContainerManager"
,
item
.
ContainerValidCode
,
item
.
Status
,
item
.
CurLoc
,
out
bool
canRemove
);
if
(
rtn
)
{
if
(
item
.
Status
.
Equals
(
TaskStatus
.
ERROR
))
...
...
@@ -95,7 +95,12 @@ namespace OnlineStore.DeviceLibrary
else
if
(
item
.
Status
.
Equals
(
TaskStatus
.
FINISHED
))
{
bool
res
=
containerInfoMap
.
TryRemove
(
item
.
ContainerValidCode
,
out
ContainerInfo
containerInfo
);
LogUtil
.
info
(
$
"任务完成【{res}】:【{JsonHelper.SerializeObject(containerInfo)}】"
);
LogUtil
.
info
(
$
"任务完成,自动删除该任务【{res}】:【{JsonHelper.SerializeObject(containerInfo)}】"
);
}
else
if
(
canRemove
)
{
bool
res
=
containerInfoMap
.
TryRemove
(
item
.
ContainerValidCode
,
out
ContainerInfo
containerInfo
);
LogUtil
.
info
(
$
"任务不存在,自动删除该任务【{res}】:【{JsonHelper.SerializeObject(containerInfo)}】"
);
}
}
}
...
...
@@ -454,7 +459,6 @@ namespace OnlineStore.DeviceLibrary
static
object
saveObj
=
new
object
();
static
void
SaveMapToFile
()
{
LogUtil
.
info
(
"SaveMapToFile"
);
if
(
Monitor
.
TryEnter
(
saveObj
,
500
))
{
try
...
...
source/DeviceLibrary/lineManager/RFIDManagercs.cs
查看文件 @
6848577
...
...
@@ -22,12 +22,12 @@ namespace OnlineStore.DeviceLibrary
{
if
(
RfidMap
.
ContainsKey
(
ip
))
{
return
;
if
(
RfidMap
[
ip
].
IsConn
)
RfidMap
[
ip
].
Close
();
RfidMap
.
TryRemove
(
ip
,
out
PuYueRFID_C2S
puYueRFID_C2S
);
}
PuYueRFID_C2S
rfid
=
new
PuYueRFID_C2S
(
ip
,
true
);
//rfid.StartAddr = 0x20;
//rfid.Length = 16;
rfid
.
ID_Changed_Event
+=
Rfid_ID_Changed_Event
;
//rfid.ID_Changed_Event += Rfid_ID_Changed_Event;
if
(
rfid
.
IsConn
)
rfid
.
Close
();
else
...
...
source/DeviceLibrary/lineManager/SServerManager.cs
查看文件 @
6848577
...
...
@@ -12,6 +12,7 @@ using System.Text;
using
System.Threading
;
using
System.Threading.Tasks
;
using
static
System
.
Windows
.
Forms
.
VisualStyles
.
VisualStyleElement
;
using
static
System
.
Windows
.
Forms
.
VisualStyles
.
VisualStyleElement
.
Tab
;
namespace
OnlineStore.DeviceLibrary
{
...
...
@@ -314,7 +315,6 @@ namespace OnlineStore.DeviceLibrary
}
return
list
;
}
/// <summary>
/// B 获取出库任务列表
/// </summary>
...
...
@@ -420,9 +420,10 @@ namespace OnlineStore.DeviceLibrary
/// <param name="status">状态</param>
/// <param name="locInfo">位置</param>
/// <returns></returns>
public
static
bool
UpdateLocInfo
(
string
deviceName
,
string
barcode
,
string
status
,
string
locInfo
=
""
)
public
static
bool
UpdateLocInfo
(
string
deviceName
,
string
barcode
,
string
status
,
string
locInfo
,
out
bool
canRemove
)
{
string
msg
=
""
;
canRemove
=
false
;
try
{
if
(
String
.
IsNullOrEmpty
(
barcode
))
...
...
@@ -452,22 +453,25 @@ namespace OnlineStore.DeviceLibrary
}
else
if
(
serverResult
.
code
.
Equals
(
303
).
Equals
(
true
))
{
canRemove
=
true
;
// code: 0为正常,其他为异常, msg: 消息, data: 为空
msg
=
deviceName
+
" UpdateTrayLoc 任务已完成【"
+
barcode
+
"】【"
+
status
+
"】【"
+
locInfo
+
"】 :"
+
"【"
+
serverResult
.
code
+
"】"
+
serverResult
.
msg
;
LogUtil
.
info
(
msg
);
//
LogUtil.info(msg);
return
true
;
}
else
if
(
serverResult
.
code
.
Equals
(
0
).
Equals
(
fals
e
))
else
if
(
serverResult
.
code
.
Equals
(
0
).
Equals
(
tru
e
))
{
// code: 0为正常,其他为异常, msg: 消息, data: 为空
msg
=
deviceName
+
" UpdateTrayLoc【"
+
barcode
+
"】【"
+
status
+
"】【"
+
locInfo
+
"】 :"
+
"【"
+
serverResult
.
code
+
"】"
+
serverResult
.
msg
;
// LogUtil.info(msg);
return
true
;
}
if
(!
msg
.
Equals
(
""
))
{
LogUtil
.
error
(
msg
);
return
false
;
}
return
true
;
}
catch
(
Exception
ex
)
{
...
...
@@ -489,7 +493,9 @@ namespace OnlineStore.DeviceLibrary
try
{
string
path
=
ess_server
+
Addr_GetRobotState
;
if
(
HttpHelper
.
Post
(
path
,
""
,
out
bool
isTimueOut
,
out
string
outMsg
))
Dictionary
<
string
,
object
>
tmp
=
new
Dictionary
<
string
,
object
>();
string
param
=
JsonHelper
.
SerializeObject
(
tmp
);
if
(
HttpHelper
.
Post
(
path
,
param
,
out
bool
isTimueOut
,
out
string
outMsg
))
{
ResultData
resultData
=
JsonHelper
.
DeserializeJsonToObject
<
ResultData
>(
outMsg
);
if
(
resultData
!=
null
)
...
...
source/RFID_PuYue/PuYueRFID_C2S.cs
查看文件 @
6848577
...
...
@@ -354,10 +354,14 @@ public class PuYueRFID_C2S
}
}
object
locRead
=
new
object
();
public
bool
ReadByte
(
short
address
,
short
length
,
out
byte
[]
data
)
{
data
=
null
;
if
(
Monitor
.
TryEnter
(
locRead
))
{
try
{
if
(
length
>
64
)
throw
new
Exception
(
"最大读取64个字节"
);
data
=
null
;
...
...
@@ -399,7 +403,7 @@ public class PuYueRFID_C2S
seqadd
();
tcpClient
.
Client
.
Send
(
by
);
Thread
.
Sleep
(
5
);
ulength
=
tcpClient
?.
Client
?.
Receive
(
result
)??
0
;
ulength
=
tcpClient
?.
Client
?.
Receive
(
result
)
??
0
;
}
catch
(
SocketException
se
)
...
...
@@ -434,6 +438,13 @@ public class PuYueRFID_C2S
if
(
tcpClient
.
Client
.
Available
>
0
)
_
=
tcpClient
.
Client
.
Receive
(
result
);
}
}
finally
{
Monitor
.
Exit
(
locRead
);
}
}
return
false
;
}
/// <summary>
...
...
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论