|
@@ -81,6 +81,7 @@ public class YongyouServiceImpl implements YongyouService {
|
|
|
|
|
|
/**
|
|
|
* 强制重新获取token
|
|
|
+ *
|
|
|
* @return
|
|
|
*/
|
|
|
private String geTokenForce() {
|
|
@@ -95,7 +96,7 @@ public class YongyouServiceImpl implements YongyouService {
|
|
|
handler.setRequest(req);
|
|
|
String responseStr = handler.handler();
|
|
|
LoginResponse response = JSONObject.parseObject(responseStr, LoginResponse.class);
|
|
|
- if(!response.getResult()){
|
|
|
+ if (!response.getResult()) {
|
|
|
throw new BusinessException(response.getMsg() + "," + response.getData().getMsg());
|
|
|
}
|
|
|
Login login = response.getData();
|
|
@@ -109,6 +110,7 @@ public class YongyouServiceImpl implements YongyouService {
|
|
|
private String getConn() {
|
|
|
return RedisUtils.getString(Conn_key);
|
|
|
}
|
|
|
+
|
|
|
private String getCAccId() {
|
|
|
return RedisUtils.getString(cAcc_ID_key);
|
|
|
}
|
|
@@ -133,30 +135,30 @@ public class YongyouServiceImpl implements YongyouService {
|
|
|
req.setPageSize(pageSize);
|
|
|
StringBuffer whereStr = new StringBuffer(" 1=1 ");
|
|
|
// 仓库编码搜索
|
|
|
- if(StringUtils.isNotBlank(record.getStoreNo())){
|
|
|
+ if (StringUtils.isNotBlank(record.getStoreNo())) {
|
|
|
whereStr.append(" and cWhCode like '%" + record.getStoreNo() + "%' ");
|
|
|
}
|
|
|
// 仓库名称搜索
|
|
|
- if(StringUtils.isNotBlank(record.getStoreName())){
|
|
|
+ if (StringUtils.isNotBlank(record.getStoreName())) {
|
|
|
whereStr.append(" and cWhName like '%" + record.getStoreName() + "%' ");
|
|
|
}
|
|
|
// 存货编码搜索
|
|
|
- if(StringUtils.isNotBlank(record.getSpareNo())){
|
|
|
+ if (StringUtils.isNotBlank(record.getSpareNo())) {
|
|
|
whereStr.append(" and cInvCode like '%" + record.getSpareNo() + "%' ");
|
|
|
}
|
|
|
// 存货名称搜索
|
|
|
- if(StringUtils.isNotBlank(record.getSpareName())){
|
|
|
+ if (StringUtils.isNotBlank(record.getSpareName())) {
|
|
|
whereStr.append(" and cInvName like '%" + record.getSpareName() + "%' ");
|
|
|
}
|
|
|
// 规格型号搜索
|
|
|
- if(StringUtils.isNotBlank(record.getGgxh())){
|
|
|
+ if (StringUtils.isNotBlank(record.getGgxh())) {
|
|
|
whereStr.append(" and cInvStd like '%" + record.getGgxh() + "%' ");
|
|
|
}
|
|
|
req.setStrWhere(whereStr.toString());
|
|
|
handler.setRequest(req);
|
|
|
String responseStr = handler.handler();
|
|
|
GetCurrentStockResponse response = JSONObject.parseObject(responseStr, GetCurrentStockResponse.class);
|
|
|
- if(!response.getResult()){
|
|
|
+ if (!response.getResult()) {
|
|
|
throw new BusinessException(response.getMsg());
|
|
|
}
|
|
|
GetCurrentStockResponseData data = response.getData();
|
|
@@ -210,22 +212,22 @@ public class YongyouServiceImpl implements YongyouService {
|
|
|
req.setPageSize(pageSize);
|
|
|
StringBuffer ccode = new StringBuffer(" 1=1 ");
|
|
|
// 存货编码搜索
|
|
|
- if(StringUtils.isNotBlank(record.getNo())){
|
|
|
+ if (StringUtils.isNotBlank(record.getNo())) {
|
|
|
ccode.append(" and cInvCode like '%" + record.getNo() + "%' ");
|
|
|
}
|
|
|
// 存货名称搜索
|
|
|
- if(StringUtils.isNotBlank(record.getName())){
|
|
|
+ if (StringUtils.isNotBlank(record.getName())) {
|
|
|
ccode.append(" and cInvName like '%" + record.getName() + "%' ");
|
|
|
}
|
|
|
// 规格型号搜索
|
|
|
- if(StringUtils.isNotBlank(record.getGgxh())){
|
|
|
+ if (StringUtils.isNotBlank(record.getGgxh())) {
|
|
|
ccode.append(" and cInvStd like '%" + record.getGgxh() + "%' ");
|
|
|
}
|
|
|
req.setCcode(ccode.toString());
|
|
|
handler.setRequest(req);
|
|
|
String responseStr = handler.handler();
|
|
|
GetInventoryListResponse response = JSONObject.parseObject(responseStr, GetInventoryListResponse.class);
|
|
|
- if(!response.getResult()){
|
|
|
+ if (!response.getResult()) {
|
|
|
throw new BusinessException(response.getMsg());
|
|
|
}
|
|
|
GetInventoryListResponseData data = response.getData();
|
|
@@ -257,9 +259,10 @@ public class YongyouServiceImpl implements YongyouService {
|
|
|
* 提交出库单到用友
|
|
|
*
|
|
|
* @param id 领用单id
|
|
|
+ * @param id fromActivity是否从审批流过来的,审批过来,返回用友处理结果,否则直接更新结果
|
|
|
*/
|
|
|
@Override
|
|
|
- public void addOutForm(String id) {
|
|
|
+ public OtherOutAddResponse addOutForm(String id, boolean fromActivity) {
|
|
|
OutStoreFormVO outStoreFormVO = outStoreFormService.getDetail(id);
|
|
|
OtherOutVouch otherOutVouch = new OtherOutVouch();
|
|
|
OtherOutMain otherOutMain = new OtherOutMain();
|
|
@@ -283,9 +286,9 @@ public class YongyouServiceImpl implements YongyouService {
|
|
|
OtherOutDetail detail = new OtherOutDetail();
|
|
|
detail.setId(vo.getSpareId());
|
|
|
detail.setCinvcode(vo.getNo());
|
|
|
- if(vo.getIsOut()){
|
|
|
+ if (vo.getIsOut()) {
|
|
|
detail.setIquantity(vo.getNum());
|
|
|
- }else{// 负数为退库
|
|
|
+ } else {// 负数为退库
|
|
|
detail.setIquantity(vo.getNum().negate());
|
|
|
}
|
|
|
// detail.setIunitcost(vo.getPrice());
|
|
@@ -306,14 +309,18 @@ public class YongyouServiceImpl implements YongyouService {
|
|
|
handler.setRequest(req);
|
|
|
String responseStr = handler.handler();
|
|
|
OtherOutAddResponse response = JSONObject.parseObject(responseStr, OtherOutAddResponse.class);
|
|
|
- if(!response.getResult()){
|
|
|
- outStoreFormService.updateModelByIdYongyouError(outStoreFormVO.getId(), response.getMsg());
|
|
|
- throw new BusinessException(response.getMsg());
|
|
|
+ if (fromActivity) {//
|
|
|
+ return response;
|
|
|
+ } else {
|
|
|
+ if (!response.getResult()) {
|
|
|
+ outStoreFormService.updateModelByIdYongyouError(outStoreFormVO.getId(), response.getMsg());
|
|
|
+ throw new BusinessException(response.getMsg());
|
|
|
+ }
|
|
|
+ String data = response.getData();
|
|
|
+ // 保存用友出库单数据
|
|
|
+ outStoreFormService.updateModelByIdYongyou(outStoreFormVO.getId(), data);
|
|
|
+ return response;
|
|
|
}
|
|
|
- String data = response.getData();
|
|
|
-
|
|
|
- // 保存用友出库单数据
|
|
|
- outStoreFormService.updateModelByIdYongyou(outStoreFormVO.getId(), data);
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -327,8 +334,8 @@ public class YongyouServiceImpl implements YongyouService {
|
|
|
String id = (String) jsonObject.get("id");
|
|
|
Integer status = (Integer) jsonObject.get("status");
|
|
|
String time = (String) jsonObject.get("time");
|
|
|
- List<Map<String, String>> detailList = jsonObject.getObject("detailList", List.class);
|
|
|
- for (Map<String, String> next: detailList ) {
|
|
|
+ List<Map<String, String>> detailList = jsonObject.getObject("detailList", List.class);
|
|
|
+ for (Map<String, String> next : detailList) {
|
|
|
// spareId = next.getString("spareId");
|
|
|
String spareNum = next.get("spareNum");
|
|
|
String detailId = next.get("detailId");
|