Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
X
xnr-interface
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
heli_wms
xnr-interface
Commits
07915eeb
Commit
07915eeb
authored
Dec 17, 2019
by
tank.li@mushiny.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
拣货任务完善,出库单与系统绑定 完成后反馈
parent
3f00a623
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
164 additions
and
34 deletions
+164
-34
CommonUtils.java
src/main/java/com/mushiny/heli/xnr/comm/CommonUtils.java
+10
-0
ICQAService.java
src/main/java/com/mushiny/heli/xnr/service/ICQAService.java
+2
-3
InboundService.java
...ain/java/com/mushiny/heli/xnr/service/InboundService.java
+117
-3
Sql_Table.java
src/main/java/com/mushiny/heli/xnr/service/Sql_Table.java
+11
-0
WmsToWcsService.java
src/main/java/com/mushiny/heli/xnr/wcs/WmsToWcsService.java
+24
-28
No files found.
src/main/java/com/mushiny/heli/xnr/comm/CommonUtils.java
View file @
07915eeb
...
...
@@ -365,4 +365,14 @@ public class CommonUtils {
return
face
;
}
public
static
int
wsFace2Direct
(
Integer
orientation
)
{
int
direct
=
0
;
switch
(
orientation
){
case
0
:
direct
=
0
;
break
;
case
90
:
direct
=
1
;
break
;
case
180
:
direct
=
2
;
break
;
case
270
:
direct
=
3
;
break
;
}
return
direct
;
}
}
src/main/java/com/mushiny/heli/xnr/service/ICQAService.java
View file @
07915eeb
...
...
@@ -119,7 +119,7 @@ public class ICQAService {
}
/**
* 定时启动任务
* 定时启动任务
生成调度单数据
*/
@Scheduled
(
fixedDelay
=
10
*
1000L
)
public
void
startICQATrip
(){
...
...
@@ -153,7 +153,7 @@ public class ICQAService {
baseBpo
.
addKV
(
"POD_ID"
,
podId
);
baseBpo
.
addKV
(
"TRIP_TYPE"
,
"ICQAPod"
);
baseBpo
.
addKV
(
"WORKSTATION_ID"
,
workStation
);
baseBpo
.
addKV
(
"TRIP_STATE"
,
"New"
);
baseBpo
.
addKV
(
"TRIP_STATE"
,
Sql_Table
.
NEW
);
baseBpo
.
addKV
(
"WAREHOUSE_ID"
,
CommonUtils
.
parseString
(
"WAREHOUSE_ID"
,
map
));
baseBpo
.
addKV
(
"SECTION_ID"
,
CommonUtils
.
parseString
(
"SECTION_ID"
,
map
));
this
.
jdbcRepository
.
insertBusinessObject
(
baseBpo
);
...
...
@@ -186,7 +186,6 @@ public class ICQAService {
Map
newValue
=
new
HashMap
();
newValue
.
put
(
"STATE"
,
Sql_Table
.
AVAILABLE
);
//生成就结束了 是不是执行完看TRIPPOSITION_ID
newValue
.
put
(
"TRIPPOSITION_ID"
,
tripPositionID
);
newValue
.
put
(
"TRIPPOSITION_ID"
,
tripPositionID
);
CommonUtils
.
modifyUselessInfo
(
newValue
);
Map
con
=
new
HashMap
();
...
...
src/main/java/com/mushiny/heli/xnr/service/InboundService.java
View file @
07915eeb
...
...
@@ -2,6 +2,7 @@ package com.mushiny.heli.xnr.service;
import
com.mushiny.heli.xnr.beans.BaseBpo
;
import
com.mushiny.heli.xnr.comm.CommonUtils
;
import
com.mushiny.heli.xnr.comm.JsonUtils
;
import
com.mushiny.heli.xnr.dto.MessageDTO
;
import
com.mushiny.heli.xnr.dto.StorageLocation
;
import
com.mushiny.heli.xnr.jdbc.repositories.JdbcRepository
;
...
...
@@ -316,7 +317,7 @@ public class InboundService {
private String stationId = "6db9c7c0-4f93-4fa1-82c0-fb6435af7aae";*/
/**
* 定时启动任务
* 定时启动任务
生成RCS_TRIP表数据
*/
@Scheduled
(
fixedDelay
=
10
*
1000L
)
public
void
startInboundTrip
(){
...
...
@@ -352,7 +353,7 @@ public class InboundService {
baseBpo
.
addKV
(
"POD_ID"
,
podId
);
baseBpo
.
addKV
(
"TRIP_TYPE"
,
"StowPod"
);
baseBpo
.
addKV
(
"WORKSTATION_ID"
,
workStation
);
baseBpo
.
addKV
(
"TRIP_STATE"
,
"New"
);
baseBpo
.
addKV
(
"TRIP_STATE"
,
Sql_Table
.
NEW
);
baseBpo
.
addKV
(
"WAREHOUSE_ID"
,
CommonUtils
.
parseString
(
"WAREHOUSE_ID"
,
map
));
baseBpo
.
addKV
(
"SECTION_ID"
,
CommonUtils
.
parseString
(
"SECTION_ID"
,
map
));
this
.
jdbcRepository
.
insertBusinessObject
(
baseBpo
);
...
...
@@ -388,7 +389,7 @@ public class InboundService {
Map
newValue
=
new
HashMap
();
newValue
.
put
(
"STATE"
,
Sql_Table
.
AVAILABLE
);
//生成就结束了 是不是执行完看TRIPPOSITION_ID
newValue
.
put
(
"TRIPPOSITION_ID"
,
tripPositionID
);
newValue
.
put
(
"TRIPPOSITION_ID"
,
tripPositionID
);
//
newValue.put("TRIPPOSITION_ID", tripPositionID);
CommonUtils
.
modifyUselessInfo
(
newValue
);
Map
con
=
new
HashMap
();
...
...
@@ -398,6 +399,119 @@ public class InboundService {
}
}
}
@Autowired
private
WmsToWcsService
wmsToWcsService
;
/**
* 发送任务到WCS 将状态变成Process 两种类型都处理
*/
@Scheduled
(
fixedDelay
=
10
*
1000L
)
@Transactional
public
void
wcsTrip
(){
//1、检查有没有执行完的
this
.
checkTasks
();
//2、检查有没有未执行的
this
.
sendTasks
();
}
private
void
checkTasks
()
{
List
<
Map
>
rcsTrips
=
this
.
jdbcRepository
.
queryBySql
(
Sql_Table
.
QUERY_RCSTRIP
,
//寻找RCSTRIP里新建的或执行中的任务,并且子表记录
Sql_Table
.
PROCESS
,
Sql_Table
.
PROCESS
);
/*SELECT RCS_TRIPPOSITION.ID TRIPPOSITION_ID,RCS_TRIP.ID TRIP_ID,
WD_SECTION.RCS_SECTIONID,MD_POD.POD_INDEX,
MD_WORKSTATION.STOPPOINT,MD_WORKSTATION.WORKING_FACE_ORIENTATION,
RCS_TRIPPOSITION.POD_USING_FACE */
String
tripId
=
""
;
for
(
int
i
=
0
;
i
<
rcsTrips
.
size
();
i
++)
{
Map
row
=
rcsTrips
.
get
(
i
);
String
currentTripId
=
CommonUtils
.
parseString
(
"TRIP_ID"
,
row
);
String
tripPositionId
=
CommonUtils
.
parseString
(
"TRIPPOSITION_ID"
,
row
);
String
taskId
=
CommonUtils
.
parseString
(
"TASKID"
,
row
);
String
result
=
this
.
wmsToWcsService
.
agvTaskDetail
(
taskId
);
Map
data
=
JsonUtils
.
json2Map
(
result
);
String
state
=
CommonUtils
.
parseString
(
"taskStatus"
,
data
);
if
(
Objects
.
equals
(
"Finished"
,
state
)){
state
=
Sql_Table
.
FINISH
;
this
.
updateTripPositionStatus
(
state
,
tripPositionId
);
}
}
//找所有子表标记为Finish但主表还存在Process的记录 更新调
//TODO
}
private
void
sendTasks
()
{
List
<
Map
>
rcsTrips
=
this
.
jdbcRepository
.
queryBySql
(
Sql_Table
.
QUERY_RCSTRIP
,
//寻找RCSTRIP里新建的或执行中的任务,并且子表记录
Sql_Table
.
NEW
,
Sql_Table
.
AVAILABLE
);
/*SELECT RCS_TRIPPOSITION.ID TRIPPOSITION_ID,RCS_TRIP.ID TRIP_ID,
WD_SECTION.RCS_SECTIONID,MD_POD.POD_INDEX,
MD_WORKSTATION.STOPPOINT,MD_WORKSTATION.WORKING_FACE_ORIENTATION,
RCS_TRIPPOSITION.POD_USING_FACE */
String
tripId
=
""
;
for
(
int
i
=
0
;
i
<
rcsTrips
.
size
();
i
++)
{
Map
row
=
rcsTrips
.
get
(
i
);
String
currentTripId
=
CommonUtils
.
parseString
(
"TRIP_ID"
,
row
);
String
tripPositionId
=
CommonUtils
.
parseString
(
"TRIPPOSITION_ID"
,
row
);
Integer
face
=
CommonUtils
.
faceToInteger
(
CommonUtils
.
parseString
(
"POD_USING_FACE"
,
row
));
if
((
i
==
rcsTrips
.
size
()-
1
)
||
(!
CommonUtils
.
isEmpty
(
tripId
)
&&
!
Objects
.
equals
(
currentTripId
,
tripId
))){
//原先的RCSTRIP状态更新
this
.
updateTripStatus
(
Sql_Table
.
PROCESS
,
tripId
);
}
Integer
podIndex
=
CommonUtils
.
parseInteger
(
"POD_INDEX"
,
row
);
Integer
stopCellId
=
CommonUtils
.
parseInteger
(
"STOPPOINT"
,
row
);
Integer
sectId
=
CommonUtils
.
parseInteger
(
"RCS_SECTIONID"
,
row
);
Integer
wsDirect
=
CommonUtils
.
wsFace2Direct
(
CommonUtils
.
parseInteger
(
"WORKING_FACE_ORIENTATION"
,
row
));
String
taskId
=
this
.
wmsToWcsService
.
sendSingleTripToWcs
(
podIndex
,
sectId
,
stopCellId
,
wsDirect
,
face
);
this
.
updateTripPositionStatus
(
Sql_Table
.
PROCESS
,
tripPositionId
,
taskId
);
}
}
private
void
updateTripPositionStatus
(
String
state
,
String
tripPositionId
,
String
taskId
)
{
Map
newValue
=
new
HashMap
();
newValue
.
put
(
"TRIPPOSITION_STATE"
,
state
);
newValue
.
put
(
"TASKID"
,
taskId
);
//增加一个字段
CommonUtils
.
modifyUselessInfo
(
newValue
);
Map
con
=
new
HashMap
();
con
.
put
(
"ID"
,
tripPositionId
);
this
.
jdbcRepository
.
updateRecords
(
"RCS_TRIPPOSITION"
,
newValue
,
con
);
}
private
void
updateTripPositionStatus
(
String
state
,
String
tripPositionId
)
{
Map
newValue
=
new
HashMap
();
newValue
.
put
(
"TRIPPOSITION_STATE"
,
state
);
CommonUtils
.
modifyUselessInfo
(
newValue
);
Map
con
=
new
HashMap
();
con
.
put
(
"ID"
,
tripPositionId
);
this
.
jdbcRepository
.
updateRecords
(
"RCS_TRIPPOSITION"
,
newValue
,
con
);
}
private
void
updateTripStatus
(
String
state
,
String
tripId
)
{
Map
newValue
=
new
HashMap
();
newValue
.
put
(
"TRIP_STATE"
,
state
);
CommonUtils
.
modifyUselessInfo
(
newValue
);
Map
con
=
new
HashMap
();
con
.
put
(
"ID"
,
tripId
);
this
.
jdbcRepository
.
updateRecords
(
"RCS_TRIP"
,
newValue
,
con
);
}
/**
* 检查任务状态 如果完成将状态变成Finish 两种类型都处理
*/
@Scheduled
(
fixedDelay
=
10
*
1000L
)
public
void
checkWcsTrip
(){
}
private
Map
<
String
,
Integer
>
genIndexMap
()
{
Map
<
String
,
Integer
>
map
=
new
HashMap
<>();
...
...
src/main/java/com/mushiny/heli/xnr/service/Sql_Table.java
View file @
07915eeb
...
...
@@ -196,4 +196,15 @@ public interface Sql_Table {
String
SQL_QUERYSECTIONBYSID
=
"SELECT * FROM WD_SECTION WHERE RCS_SECTIONID=?"
;
String
SQL_QUERYWDBYSTOP
=
"SELECT * FROM MD_WORKSTATION WHERE STOPPOINT = ? AND SECTION_ID=?"
;
String
SQL_QUERYPODBYINDEX
=
"SELECT * FROM MD_POD WHERE SECTION_ID=? AND POD_INDEX=?"
;
String
QUERY_RCSTRIP
=
"SELECT RCS_TRIPPOSITION.ID,WD_SECTION.RCS_SECTIONID,MD_POD.POD_INDEX, \n"
+
"MD_WORKSTATION.STOPPOINT, RCS_TRIPPOSITION.TASKID,MD_WORKSTATION.WORKING_FACE_ORIENTATION,RCS_TRIPPOSITION.POD_USING_FACE \n"
+
"FROM RCS_TRIP,RCS_TRIPPOSITION, MD_POD, MD_WORKSTATION,WD_SECTION\n"
+
"WHERE RCS_TRIP.ID=RCS_TRIPPOSITION.TRIP_ID\n"
+
"AND MD_POD.ID=RCS_TRIP.POD_ID\n"
+
"AND WD_SECTION.ID=MD_POD.SECTION_ID\n"
+
"AND MD_WORKSTATION.ID=RCS_TRIP.WORKSTATION_ID\n"
+
"AND RCS_TRIP.TRIP_STATE= ?\n"
+
"AND RCS_TRIPPOSITION.TRIPPOSITION_STATE=? \n"
+
"ORDER BY POD_INDEX"
;
}
src/main/java/com/mushiny/heli/xnr/wcs/WmsToWcsService.java
View file @
07915eeb
...
...
@@ -33,6 +33,9 @@ public class WmsToWcsService{
@Value
(
"${wcs.releasePod}"
)
private
String
releasePod
;
@Value
(
"${wcs.agvTaskDetail}"
)
private
String
agvTaskDetail
;
@Autowired
private
WmsToWcsBusiness
wmsToWcsBusiness
;
...
...
@@ -75,17 +78,24 @@ public class WmsToWcsService{
return
amount
;
}
/**
* 向wcs发送调度任务
public
String
agvTaskDetail
(
String
taskId
){
String
token
=
wmsToWcsBusiness
.
getTokenFromWcs
();
if
(
""
.
equals
(
token
))
{
logger
.
info
(
"获取wcs token失败"
);
return
null
;
}
Map
<
String
,
Object
>
taskMap
=
new
HashMap
<>();
taskMap
.
put
(
"taskId"
,
taskId
);
return
executorHandler
.
getForObject
(
this
.
agvTaskDetail
,
taskMap
,
token
);
}
*/
public
List
<
Map
>
sendTripToWcs
(
String
podIndex
,
public
String
sendSingleTripToWcs
(
Integer
podIndex
,
Integer
sectionId
,
Integer
stopCellId
,
Integer
direction
,
List
<
String
>
availableFaces
)
{
Integer
face
)
{
String
token
=
wmsToWcsBusiness
.
getTokenFromWcs
();
if
(
""
.
equals
(
token
))
{
if
(
""
.
equals
(
token
))
{
logger
.
info
(
"获取wcs token失败"
);
return
null
;
}
...
...
@@ -95,19 +105,14 @@ public class WmsToWcsService{
taskMap
.
put
(
"podId"
,
podIndex
);
taskMap
.
put
(
"stopCellId"
,
stopCellId
);
taskMap
.
put
(
"direction"
,
direction
);
List
<
Map
>
ret
=
new
ArrayList
<>();
for
(
String
podFace:
availableFaces
){
taskMap
.
put
(
"targetDirection"
,
CommonUtils
.
faceToInteger
(
podFace
));
taskMap
.
put
(
"targetDirection"
,
face
);
String
taskIdFromWcs
=
executorHandler
.
postForObject
(
this
.
callPodUrl
,
JsonUtils
.
map2Json
(
taskMap
),
token
);
logger
.
info
(
"发送调度任务,wcs返回taskId:{}"
,
taskIdFromWcs
);
JsonUtils
.
map2Json
(
taskMap
),
token
);
Map
<
String
,
String
>
resultMap
=
JsonUtils
.
json2Map
(
taskIdFromWcs
);
logger
.
info
(
"发送调度任务,wcs返回taskId:{}"
,
taskIdFromWcs
);
Map
<
String
,
String
>
resultMap
=
JsonUtils
.
json2Map
(
taskIdFromWcs
);
String
taskId
=
""
;
if
(
resultMap
!=
null
...
...
@@ -115,20 +120,11 @@ public class WmsToWcsService{
taskId
=
resultMap
.
get
(
"taskId"
);
}
if
(
CommonUtils
.
isEmpty
(
taskId
)){
logger
.
info
(
"发送{}的face{}调度任务时,获取taskId失败。。。"
,
podIndex
,
podFace
);
continue
;
}
Map
data
=
new
HashMap
();
data
.
put
(
"taskId"
,
taskId
);
data
.
put
(
"targetDirection"
,
CommonUtils
.
faceToInteger
(
podFace
));
data
.
put
(
"sectionId"
,
sectionId
);
data
.
put
(
"podId"
,
podIndex
);
data
.
put
(
"stopCellId"
,
stopCellId
);
data
.
put
(
"direction"
,
direction
);
ret
.
add
(
data
);
if
(
CommonUtils
.
isEmpty
(
taskId
))
{
logger
.
info
(
"发送{}的face{}调度任务时,获取taskId失败。。。"
,
podIndex
,
face
);
throw
new
RuntimeException
(
"任务失败 pod:"
+
podIndex
+
" face:"
+
face
);
}
return
ret
;
return
taskId
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment