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
8d678190
Commit
8d678190
authored
Dec 19, 2019
by
tank.li@mushiny.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
盘点任务回复
parent
93400009
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
135 additions
and
5 deletions
+135
-5
HeliWMSController.java
...va/com/mushiny/heli/xnr/controller/HeliWMSController.java
+1
-1
MqListener.java
src/main/java/com/mushiny/heli/xnr/mq/MqListener.java
+1
-1
CustomException.java
src/main/java/com/mushiny/heli/xnr/wcs/CustomException.java
+30
-0
CustomResponseErrorHandler.java
.../com/mushiny/heli/xnr/wcs/CustomResponseErrorHandler.java
+93
-0
ExecutorHandler.java
src/main/java/com/mushiny/heli/xnr/wcs/ExecutorHandler.java
+8
-2
WmsToWcsService.java
src/main/java/com/mushiny/heli/xnr/wcs/WmsToWcsService.java
+2
-1
No files found.
src/main/java/com/mushiny/heli/xnr/controller/HeliWMSController.java
View file @
8d678190
...
...
@@ -44,7 +44,7 @@ public class HeliWMSController {
public
ResponseEntity
<
MessageDTO
>
callPod
(
@RequestBody
String
json
){
logger
.
debug
(
"inboundResp: "
+
json
);
this
.
wmsToWcsService
.
sendSingleTripToWcs
(
8
,
1
,
475
,
0
,
0
);
this
.
wmsToWcsService
.
sendSingleTripToWcs
(
8
,
1
,
475
,
3
,
0
);
MessageDTO
dto
=
MessageDTO
.
success
();
return
ResponseEntity
.
ok
(
dto
);
}
...
...
src/main/java/com/mushiny/heli/xnr/mq/MqListener.java
View file @
8d678190
...
...
@@ -109,7 +109,7 @@ public class MqListener {
newValue
.
put
(
"POD_ID"
,
podId
);
newValue
.
put
(
"POD_INDEX"
,
CommonUtils
.
parseInteger
(
"podId"
,
data
));
newValue
.
put
(
"TOWARD"
,
toward
);
newValue
.
put
(
"TRIP_TASK
"
,
CommonUtils
.
parseInteger
(
"taskId"
,
data
));
newValue
.
put
(
"TRIP_TASK
ID"
,
CommonUtils
.
parseString
(
"taskId"
,
data
));
CommonUtils
.
modifyUselessInfo
(
newValue
);
Map
con
=
new
HashMap
();
...
...
src/main/java/com/mushiny/heli/xnr/wcs/CustomException.java
0 → 100644
View file @
8d678190
package
com
.
mushiny
.
heli
.
xnr
.
wcs
;
import
org.springframework.web.client.RestClientException
;
/**
* Created by Lisi on 2019-12-19.
*/
public
class
CustomException
extends
RestClientException
{
private
RestClientException
restClientException
;
private
String
body
;
public
CustomException
(
String
message
,
RestClientException
scx
,
String
body
)
{
super
(
message
);
this
.
restClientException
=
restClientException
;
this
.
body
=
body
;
}
public
CustomException
(
String
msg
)
{
super
(
msg
);
}
public
CustomException
(
String
msg
,
Throwable
ex
)
{
super
(
msg
,
ex
);
}
}
src/main/java/com/mushiny/heli/xnr/wcs/CustomResponseErrorHandler.java
0 → 100644
View file @
8d678190
package
com
.
mushiny
.
heli
.
xnr
.
wcs
;
import
org.springframework.http.client.ClientHttpResponse
;
import
org.springframework.web.client.DefaultResponseErrorHandler
;
import
org.springframework.web.client.ResponseErrorHandler
;
import
org.springframework.web.client.RestClientException
;
import
java.io.BufferedReader
;
import
java.io.IOException
;
import
java.io.InputStream
;
import
java.io.InputStreamReader
;
import
java.util.List
;
public
class
CustomResponseErrorHandler
implements
ResponseErrorHandler
{
private
ResponseErrorHandler
errorHandler
=
new
DefaultResponseErrorHandler
();
@Override
public
void
handleError
(
ClientHttpResponse
response
)
throws
IOException
{
// 队请求头的处理
List
<
String
>
customHeader
=
response
.
getHeaders
().
get
(
"x-app-err-id"
);
String
svcErrorMessageID
=
""
;
if
(
customHeader
!=
null
)
{
svcErrorMessageID
=
customHeader
.
get
(
0
);
}
//对body 的处理 (inputStream)
String
body
=
convertStreamToString
(
response
.
getBody
());
try
{
errorHandler
.
handleError
(
response
);
}
catch
(
RestClientException
scx
)
{
throw
new
CustomException
(
scx
.
getMessage
(),
scx
,
body
);
}
}
@Override
public
boolean
hasError
(
ClientHttpResponse
response
)
throws
IOException
{
return
errorHandler
.
hasError
(
response
);
}
// inputStream 装换为 string
private
String
convertStreamToString
(
InputStream
is
)
{
BufferedReader
reader
=
new
BufferedReader
(
new
InputStreamReader
(
is
));
StringBuilder
sb
=
new
StringBuilder
();
String
line
=
null
;
try
{
while
((
line
=
reader
.
readLine
())
!=
null
)
{
sb
.
append
(
line
);
}
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
finally
{
try
{
is
.
close
();
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
}
return
sb
.
toString
();
}
}
src/main/java/com/mushiny/heli/xnr/wcs/ExecutorHandler.java
View file @
8d678190
...
...
@@ -5,9 +5,12 @@ import com.mushiny.heli.xnr.comm.JsonUtils;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.http.*
;
import
org.springframework.http.client.ClientHttpResponse
;
import
org.springframework.stereotype.Component
;
import
org.springframework.web.client.ResponseErrorHandler
;
import
org.springframework.web.client.RestTemplate
;
import
java.io.IOException
;
import
java.util.Map
;
@Component
...
...
@@ -45,6 +48,7 @@ public class ExecutorHandler {
headers
.
add
(
"Accept"
,
MediaType
.
APPLICATION_JSON
.
toString
());
headers
.
add
(
"authorization"
,
token
);
HttpEntity
<
String
>
formEntity
=
new
HttpEntity
<
String
>(
headers
);
this
.
restTemplate
.
setErrorHandler
(
new
CustomResponseErrorHandler
());
ResponseEntity
<
String
>
result
=
restTemplate
.
exchange
(
url
,
HttpMethod
.
GET
,
formEntity
,
String
.
class
,
params
);
...
...
@@ -59,11 +63,13 @@ public class ExecutorHandler {
headers
.
setContentType
(
type
);
headers
.
add
(
"Accept"
,
MediaType
.
APPLICATION_JSON
.
toString
());
headers
.
add
(
"authorization"
,
token
);
restTemplate
.
setErrorHandler
(
new
CustomResponseErrorHandler
());
ResponseEntity
<
String
>
response
=
restTemplate
.
exchange
(
url
+
"?taskId={taskId}"
,
url
+
"?taskId={taskId}
§ionId=1
"
,
HttpMethod
.
GET
,
new
HttpEntity
<
String
>(
headers
),
Map
.
class
,
params
);
String
.
class
,
params
);
logger
.
error
(
"respose.getBody:"
+
response
.
getBody
());
return
response
.
getBody
();
}
...
...
src/main/java/com/mushiny/heli/xnr/wcs/WmsToWcsService.java
View file @
8d678190
...
...
@@ -160,7 +160,8 @@ public class WmsToWcsService{
token
=
"Bearer "
+
token
;
Map
<
String
,
Object
>
taskMap
=
new
HashMap
<>();
taskMap
.
put
(
"taskId"
,
CommonUtils
.
parseString
(
"TRIP_TASKID"
,
podStation
));
this
.
executorHandler
.
getForObject
(
this
.
releasePod
,
taskMap
,
token
);
taskMap
.
put
(
"sectionId"
,
1
);
this
.
executorHandler
.
getMethod
(
this
.
releasePod
,
taskMap
,
token
);
logger
.
info
(
"工作站 = {} 释放pod = {} ,wcs返回taskId:{}"
,
workStationId
,
podIndex
);
//更显pod状态
...
...
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