Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
srm
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
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
Jobs
Commits
Open sidebar
aship
srm
Commits
3763b9eb
Commit
3763b9eb
authored
Aug 12, 2019
by
顾俭
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
aship/aship#1 防伪码功能:申请防伪码接口
parent
8f17e245
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
18 deletions
+17
-18
BarcodeGenClient.java
src/main/java/com/i1/erp/barcode/soap/BarcodeGenClient.java
+17
-18
No files found.
src/main/java/com/i1/erp/barcode/soap/BarcodeGenClient.java
View file @
3763b9eb
...
...
@@ -14,6 +14,8 @@ import org.slf4j.LoggerFactory;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.stereotype.Component
;
import
tw.com.dsc.tiptop.tiptopservicegateway.SRMGenbarcodeRequestSRMGenbarcodeRequest
;
import
tw.com.dsc.tiptop.tiptopservicegateway.SRMGenbarcodeResponseSRMGenbarcodeResponse
;
import
static
com
.
i1
.
erp
.
base
.
web
.
dto
.
SyncResponseCode
.
FAIL_CODE
;
import
static
com
.
i1
.
erp
.
base
.
web
.
dto
.
SyncResponseCode
.
SUCCESS_CODE
;
...
...
@@ -37,36 +39,32 @@ public class BarcodeGenClient extends WebServiceClient {
public
SyncResponse
genBarcode
(
PoBarcodeDto
input
)
{
try
{
// xml
logger
.
info
(
"prepare gen barcode {}"
,
input
.
getFactoryUid
()
+
"-"
+
input
.
getPurchaseOrderUid
());
Request
requestXml
=
null
;
try
{
requestXml
=
barCodeGenServicel
.
genXml
(
input
);
}
catch
(
Exception
e
)
{
logger
.
error
(
"error:"
,
e
);
return
SyncResponse
.
of
(
FAIL_CODE
,
e
.
getMessage
());
}
Request
requestXml
=
barCodeGenServicel
.
genXml
(
input
);
if
(
requestXml
==
null
)
{
logger
.
error
(
"error:防伪码申请无法生成XML结构"
);
return
SyncResponse
.
of
(
FAIL_CODE
,
"防伪码申请无法生成XML结构"
);
}
logger
.
info
(
covertObjectToXML
(
requestXml
,
Request
.
class
));
// request
SRMGenbarcodeRequestSRMGenbarcodeRequest
genbarcodeRequest
=
new
SRMGenbarcodeRequestSRMGenbarcodeRequest
();
genbarcodeRequest
.
setRequest
(
covertObjectToXML
(
requestXml
,
Request
.
class
));
logger
.
info
(
genbarcodeRequest
.
getRequest
());
if
(
StringUtils
.
isBlank
(
WSDL_URL
)
||
StringUtils
.
isBlank
(
ERP_GEN_BARCODE_OP
))
{
throw
new
IOneServiceException
(
"WSDL不可为空."
);
}
Client
client
=
getClient
(
WSDL_URL
);
Object
[]
objects
=
client
.
invoke
(
ERP_GEN_BARCODE_OP
,
new
Object
[]{
requestXml
});
Object
[]
objects
=
client
.
invoke
(
ERP_GEN_BARCODE_OP
,
new
Object
[]{
genbarcodeRequest
});
client
.
destroy
();
logger
.
info
(
objects
[
0
].
toString
());
// handle response
try
{
Response
response
=
convertXMLToObject
(
objects
[
0
].
toString
(),
Response
.
class
);
// response
if
(
objects
!=
null
&&
objects
.
length
>
0
)
{
SRMGenbarcodeResponseSRMGenbarcodeResponse
originalResponse
=
(
SRMGenbarcodeResponseSRMGenbarcodeResponse
)
objects
[
0
];
logger
.
info
(
originalResponse
.
getResponse
());
Response
response
=
convertXMLToObject
(
originalResponse
.
getResponse
(),
Response
.
class
);
if
(
response
.
getExecution
().
getStatus
().
getCode
().
equalsIgnoreCase
(
"0"
))
{
return
SyncResponse
.
of
(
SUCCESS_CODE
,
"申请防伪码成功"
);
...
...
@@ -77,8 +75,9 @@ public class BarcodeGenClient extends WebServiceClient {
safeString
(
response
.
getExecution
().
getStatus
().
getSqlcode
()));
return
SyncResponse
.
of
(
FAIL_CODE
,
errorDetails
);
}
}
catch
(
IOneServiceException
e
)
{
return
SyncResponse
.
of
(
FAIL_CODE
,
e
.
getMessage
());
}
else
{
logger
.
error
(
"ERP无响应."
);
return
SyncResponse
.
of
(
FAIL_CODE
,
"ERP无响应"
);
}
}
catch
(
Exception
e
)
{
...
...
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