From b93887bd221deb1d0a4f6379401ff3b992594d8c Mon Sep 17 00:00:00 2001
From: luxiaotao1123 <t1341870251@63.com>
Date: 星期六, 07 八月 2021 16:52:35 +0800
Subject: [PATCH] #
---
src/main/java/zy/cloud/wms/common/service/erp/ErpService.java | 33 +++++++++++++++++++--------------
1 files changed, 19 insertions(+), 14 deletions(-)
diff --git a/src/main/java/zy/cloud/wms/common/service/erp/ErpService.java b/src/main/java/zy/cloud/wms/common/service/erp/ErpService.java
index 6a1f4cf..6a537e9 100644
--- a/src/main/java/zy/cloud/wms/common/service/erp/ErpService.java
+++ b/src/main/java/zy/cloud/wms/common/service/erp/ErpService.java
@@ -37,14 +37,14 @@
/**
* 鍗曟嵁涓婃姤
*/
- public Boolean uploadBill(List<BillDto> dtos, Integer docId, String docNumber){
+ public ErpR uploadBill(List<BillDto> dtos, Integer docId, String docNumber){
try {
if (Cools.isEmpty(dtos)) {
- return false;
+ return new ErpR(false, null);
}
DocType docType = docTypeService.selectById(docId);
if (Cools.isEmpty(docType)) {
- return false;
+ return new ErpR(false, null);
}
UploadBill uploadBill = new UploadBill();
@@ -70,7 +70,7 @@
detl.setUnit(mat==null?"鏆傛棤":mat.getUnit());
detail.add(detl);
}
- System.out.println(JSON.toJSONString(uploadBill));
+ log.warn(JSON.toJSONString(uploadBill));
String response = new HttpHandler.Builder()
.setUri(ErpScheduler.URI)
.setPath(ErpScheduler.UPLOAD_BILL)
@@ -78,26 +78,31 @@
.build()
.doPost();
- // 鏃ュ織璁板綍
- RequestLog logInfo = new RequestLog();
- logInfo.setName("鍗曟嵁涓婁紶锛屽崟鎹被鍨�" + docId.toString());
- logInfo.setRequest(JSON.toJSONString(uploadBill)); // 鍏ュ弬
- logInfo.setResponse(response); // 鍑哄弬
- logInfo.setCreateTime(new Date());
- requestLogService.insert(logInfo);
+ try {
+ // 鏃ュ織璁板綍
+ RequestLog logInfo = new RequestLog();
+ logInfo.setName("鍗曟嵁涓婁紶锛屽崟鎹被鍨�" + docId);
+ logInfo.setRequest(JSON.toJSONString(uploadBill)); // 鍏ュ弬
+ logInfo.setResponse(response); // 鍑哄弬
+ logInfo.setCreateTime(new Date());
+ requestLogService.insert(logInfo);
+ } catch (Exception e) {
+ log.error(e.getMessage());
+ }
+
if (!Cools.isEmpty(response)) {
log.warn(response);
Result result = JSON.parseObject(response, Result.class);
if (result.getCode() != 1) {
- return false;
+ return new ErpR(false, result.getMsg());
}
}
} catch (Exception e) {
e.printStackTrace();
- return false;
+ return new ErpR(false, e.getMessage());
}
- return Boolean.TRUE;
+ return new ErpR(true, null);
}
--
Gitblit v1.9.1