Compare commits
No commits in common. "f85d51810e2b4adc5503e18c18812af02c392d1c" and "6a074de6f9bbeb6ba80bce29a7dd22c3ed1afbaa" have entirely different histories.
f85d51810e
...
6a074de6f9
|
|
@ -341,7 +341,7 @@ public class NormalQMController extends BaseController {
|
|||
String flag = code.getInspectionResult().equals("合格") ? "X" : "";
|
||||
ZWM3A17Item2DTO item2DTO = new ZWM3A17Item2DTO()
|
||||
.setEBELP(code.getPoLineNumber())
|
||||
.setSERNR(code.getSerialNum())
|
||||
.setFLAG(code.getSerialNum())
|
||||
.setFLAG(flag);
|
||||
zwm3A18DTO.getItem2().add(item2DTO);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,7 +10,9 @@ import com.nflg.wms.admin.pojo.dto.SAPMaterialInfoInOrderDTO;
|
|||
import com.nflg.wms.admin.pojo.dto.ZWM3A17DTO;
|
||||
import com.nflg.wms.admin.pojo.dto.ZWM3A18DTO;
|
||||
import com.nflg.wms.admin.util.JCoUtil;
|
||||
import com.nflg.wms.common.exception.SAPException;
|
||||
import com.nflg.wms.common.constant.Constant;
|
||||
import com.nflg.wms.common.constant.STATE;
|
||||
import com.nflg.wms.common.exception.NflgException;
|
||||
import com.nflg.wms.common.pojo.dto.*;
|
||||
import com.nflg.wms.common.pojo.qo.*;
|
||||
import com.nflg.wms.common.pojo.vo.*;
|
||||
|
|
@ -20,11 +22,11 @@ import com.nflg.wms.common.util.VUtil;
|
|||
import com.sap.conn.jco.*;
|
||||
import jakarta.annotation.Resource;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.slf4j.MDC;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Slf4j
|
||||
@Component
|
||||
|
|
@ -1027,24 +1029,8 @@ public class SapService {
|
|||
parameters.put("S_DATE", DateTimeUtil.format(query.getStartDate(), "yyyyMMdd"));
|
||||
parameters.put("E_DATE", DateTimeUtil.format(query.getEndDate(), "yyyyMMdd"));
|
||||
|
||||
Map<String, List<Map<String, Object>>> tables = new HashMap<>();
|
||||
if (CollectionUtil.isNotEmpty(query.getKostl())) {
|
||||
tables.put("S_KOSTL", query.getKostl().stream().map(kostl -> {
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("KOSTL", kostl);
|
||||
return map;
|
||||
}).collect(Collectors.toList()));
|
||||
}
|
||||
if (CollectionUtil.isNotEmpty(query.getRsnum())) {
|
||||
tables.put("S_RSNUM", query.getRsnum().stream().map(rsnum -> {
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("RSNUM", rsnum);
|
||||
return map;
|
||||
}).collect(Collectors.toList()));
|
||||
}
|
||||
|
||||
// 调用 SAP RFC 函数 ZWM00_MB112
|
||||
JCoFunction function = exec("ZWM3A13", parameters, tables);
|
||||
JCoFunction function = exec("ZWM3A13", parameters, null);
|
||||
|
||||
// 处理返回表 T_RETURN,判断执行是否成功
|
||||
JCoParameterList exportParam = function.getExportParameterList();
|
||||
|
|
@ -1077,25 +1063,8 @@ public class SapService {
|
|||
parameters.put("I_WERKS", query.getWerks());
|
||||
parameters.put("S_DATE", DateTimeUtil.format(query.getStartDate(), "yyyyMMdd"));
|
||||
parameters.put("E_DATE", DateTimeUtil.format(query.getEndDate(), "yyyyMMdd"));
|
||||
|
||||
Map<String, List<Map<String, Object>>> tables = new HashMap<>();
|
||||
if (CollectionUtil.isNotEmpty(query.getKostl())) {
|
||||
tables.put("S_KOSTL", query.getKostl().stream().map(kostl -> {
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("KOSTL", kostl);
|
||||
return map;
|
||||
}).collect(Collectors.toList()));
|
||||
}
|
||||
if (CollectionUtil.isNotEmpty(query.getRsnum())) {
|
||||
tables.put("S_RSNUM", query.getRsnum().stream().map(rsnum -> {
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("RSNUM", rsnum);
|
||||
return map;
|
||||
}).collect(Collectors.toList()));
|
||||
}
|
||||
|
||||
// 调用 SAP RFC 函数 ZWM00_MB112
|
||||
JCoFunction function = exec("ZWM3A14", parameters, tables);
|
||||
JCoFunction function = exec("ZWM3A14", parameters, null);
|
||||
// 处理返回表 T_RETURN,判断执行是否成功
|
||||
JCoParameterList exportParam = function.getExportParameterList();
|
||||
VUtil.trueThrowBusinessError(Objects.isNull(exportParam)).throwMessage("无法获取到有效的物料凭证信息");
|
||||
|
|
@ -1154,7 +1123,7 @@ public class SapService {
|
|||
JCoTable returnTable = function.getTableParameterList().getTable("T_RETURN");
|
||||
log.info("SAP返回: {}", returnTable);
|
||||
returnTable.setRow(0);
|
||||
throw new SAPException(returnTable.getString("MESSAGE"));
|
||||
throw new NflgException(STATE.BusinessError, "SAP错误:" + returnTable.getString("MESSAGE"));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1367,7 +1336,7 @@ public class SapService {
|
|||
return function;
|
||||
} catch (JCoException e) {
|
||||
log.error("SAP调用异常", e);
|
||||
throw new SAPException(e.getMessage());
|
||||
throw new NflgException(STATE.BusinessError, "SAP调用异常:" + MDC.get(Constant.TRACE_ID));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -25,8 +25,7 @@ public enum STATE {
|
|||
BusinessError(115, "业务异常"),
|
||||
RequestMethodError(116, "请求方式错误"),
|
||||
InconsistentDataError(117, "需要用户确认"),
|
||||
NoOrderData(118, "订单不存在"),
|
||||
SAPErr(119, "SAP错误");
|
||||
NoOrderData(118, "订单不存在");
|
||||
|
||||
@Getter
|
||||
private final Integer state;
|
||||
|
|
|
|||
|
|
@ -1,17 +0,0 @@
|
|||
package com.nflg.wms.common.exception;
|
||||
|
||||
import com.nflg.wms.common.constant.STATE;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class SAPException extends RuntimeException {
|
||||
|
||||
public final STATE state;
|
||||
private final String msg;
|
||||
|
||||
public SAPException(String msg) {
|
||||
super(msg);
|
||||
this.state = STATE.SAPErr;
|
||||
this.msg = msg;
|
||||
}
|
||||
}
|
||||
|
|
@ -6,7 +6,6 @@ import lombok.Data;
|
|||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
@Data
|
||||
|
|
@ -66,14 +65,4 @@ public class DepartmentMaterialRequisitionQO {
|
|||
}
|
||||
return endDate;
|
||||
}
|
||||
|
||||
/**
|
||||
* 预留/相关需求的编号
|
||||
*/
|
||||
private List<String> rsnum;
|
||||
|
||||
/**
|
||||
* 成本中心
|
||||
*/
|
||||
private List<String> kostl;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@ import lombok.Data;
|
|||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
@Data
|
||||
|
|
@ -33,14 +32,4 @@ public class DepartmentMaterialReturnSlipQO {
|
|||
}
|
||||
return endDate;
|
||||
}
|
||||
|
||||
/**
|
||||
* 预留/相关需求的编号
|
||||
*/
|
||||
private List<String> rsnum;
|
||||
|
||||
/**
|
||||
* 成本中心
|
||||
*/
|
||||
private List<String> kostl;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,7 +5,6 @@ import cn.hutool.core.util.StrUtil;
|
|||
import com.nflg.wms.common.constant.Constant;
|
||||
import com.nflg.wms.common.constant.STATE;
|
||||
import com.nflg.wms.common.exception.NflgException;
|
||||
import com.nflg.wms.common.exception.SAPException;
|
||||
import com.nflg.wms.common.pojo.ApiResult;
|
||||
import jakarta.validation.ConstraintViolation;
|
||||
import jakarta.validation.ConstraintViolationException;
|
||||
|
|
@ -75,10 +74,4 @@ public class GlobalRestControllerAdvice {
|
|||
log.error("请求的地址无效: ", ex);
|
||||
return ApiResult.error(STATE.BusinessError, "请求的地址无效:" + ex.getResourcePath());
|
||||
}
|
||||
|
||||
@ExceptionHandler(SAPException.class)
|
||||
public ApiResult<Void> handleSAPException(SAPException ex) {
|
||||
log.error("SAP错误: ", ex);
|
||||
return ApiResult.error(ex.getState(), "SAP错误:" + ex.getMessage());
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue