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