优化测试
This commit is contained in:
parent
96dce21051
commit
ee3557370f
|
|
@ -3,7 +3,6 @@ package com.nflg.wms.admin.service;
|
|||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.nflg.wms.admin.pojo.dto.SAPMaterialInfoInOrderDTO;
|
||||
import com.nflg.wms.admin.pojo.dto.ZIM003105DTO;
|
||||
import com.nflg.wms.admin.pojo.dto.ZIM003DTO;
|
||||
|
|
@ -12,13 +11,11 @@ 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.qo.Zwm3a07QO;
|
||||
import com.nflg.wms.common.pojo.vo.*;
|
||||
import com.nflg.wms.common.util.UserUtil;
|
||||
import com.nflg.wms.common.util.VUtil;
|
||||
import com.sap.conn.jco.*;
|
||||
import jakarta.annotation.Resource;
|
||||
import jdk.jshell.execution.Util;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.slf4j.MDC;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
|
@ -789,21 +786,21 @@ public class SapService {
|
|||
|
||||
// 构造并填充明细项
|
||||
Zwm3a07ItemVO item = new Zwm3a07ItemVO();
|
||||
item.setQlsl(tOut.getString("QLSL"))
|
||||
.setSqsl(tOut.getString("SQSL"))
|
||||
item.setQlsl(tOut.getBigDecimal("QLSL"))
|
||||
.setSqsl(tOut.getBigDecimal("SQSL"))
|
||||
.setMatnr(tOut.getString("MATNR"))
|
||||
.setBdter(tOut.getString("BDTER"))
|
||||
.setRspos(tOut.getString("RSPOS"))
|
||||
.setSqsl2(tOut.getString("SQSL2"))
|
||||
.setSqsl3(tOut.getString("SQSL3"))
|
||||
.setEnmng(tOut.getString("ENMNG"))
|
||||
.setBdmng(tOut.getString("BDMNG"))
|
||||
.setLabst(tOut.getString("LABST"))
|
||||
.setKcqls(tOut.getString("KCQLS"))
|
||||
.setSqsl2(tOut.getBigDecimal("SQSL2"))
|
||||
.setSqsl3(tOut.getBigDecimal("SQSL3"))
|
||||
.setEnmng(tOut.getBigDecimal("ENMNG"))
|
||||
.setBdmng(tOut.getBigDecimal("BDMNG"))
|
||||
.setLabst(tOut.getBigDecimal("LABST"))
|
||||
.setKcqls(tOut.getBigDecimal("KCQLS"))
|
||||
.setLgort2(tOut.getString("LGORT2"))
|
||||
.setMeins(tOut.getString("MEINS"))
|
||||
.setLgpbe(tOut.getString("LGPBE"))
|
||||
.setInsme(tOut.getString("INSME"))
|
||||
.setInsme(tOut.getBigDecimal("INSME"))
|
||||
.setRsnum2(tOut.getString("RSNUM2"))
|
||||
.setMaktx2(tOut.getString("MAKTX2"))
|
||||
.setEkgrp(tOut.getString("EKGRP"))
|
||||
|
|
@ -1217,80 +1214,4 @@ public class SapService {
|
|||
throw new NflgException(STATE.BusinessError, "SAP调用异常:" + MDC.get(Constant.TRACE_ID));
|
||||
}
|
||||
}
|
||||
|
||||
public void printMeta(String functionName) {
|
||||
try {
|
||||
functionName = functionName.toUpperCase();
|
||||
JCoFunction function = repository.getFunction(functionName);
|
||||
VUtil.trueThrowBusinessError(Objects.isNull(function)).throwMessage("方法" + functionName + "不存在");
|
||||
printMeta(function);
|
||||
} catch (Exception e) {
|
||||
log.error("打印方法参数信息异常", e);
|
||||
}
|
||||
}
|
||||
|
||||
public void printMetaJson(String functionName) {
|
||||
try {
|
||||
functionName = functionName.toUpperCase();
|
||||
JCoFunction function = repository.getFunction(functionName);
|
||||
VUtil.trueThrowBusinessError(Objects.isNull(function)).throwMessage("方法" + functionName + "不存在");
|
||||
printMeta(function);
|
||||
} catch (Exception e) {
|
||||
log.error("打印方法参数信息异常", e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void printMeta(JCoFunction function) {
|
||||
log.trace("-------------------------------------------------------");
|
||||
log.trace("SAP {} 方法参数信息", function.getName());
|
||||
log.trace("-- Import结构");
|
||||
printParameterField(function.getImportParameterList());
|
||||
log.trace("-- Changing结构");
|
||||
printParameterField(function.getChangingParameterList());
|
||||
log.trace("-- Export结构");
|
||||
printParameterField(function.getExportParameterList());
|
||||
log.trace("-- Table结构");
|
||||
printParameterField(function.getTableParameterList());
|
||||
log.trace("-------------------------------------------------------");
|
||||
}
|
||||
|
||||
private void printParameterField(JCoParameterList parameterList) {
|
||||
if (Objects.nonNull(parameterList)) {
|
||||
JCoParameterFieldIterator iterator = parameterList.getParameterFieldIterator();
|
||||
if (Objects.nonNull(iterator)) {
|
||||
while (iterator.hasNextField()) {
|
||||
JCoParameterField field = iterator.nextParameterField();
|
||||
log.trace("名称:{},类型:{},描述:{}", field.getName(), field.getTypeAsString(), field.getDescription());
|
||||
if (field.isTable()) {
|
||||
printJCoTable(field.getTable());
|
||||
} else if (field.isStructure()) {
|
||||
printStructure(field.getStructure());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void printJCoTable(JCoTable table) {
|
||||
log.trace("Table结构");
|
||||
JCoRecordFieldIterator iterator = table.getRecordFieldIterator();
|
||||
Map<String, String> map = new HashMap<>();
|
||||
while (iterator.hasNextField()) {
|
||||
JCoRecordField field = iterator.nextRecordField();
|
||||
log.trace("名称:{},类型:{},描述:{}", field.getName(), field.getTypeAsString(), field.getDescription());
|
||||
map.put(field.getName(), field.getDescription());
|
||||
}
|
||||
String json = JSON.toJSONString(map);
|
||||
log.trace("{}", json);
|
||||
}
|
||||
|
||||
private void printStructure(JCoStructure structure) {
|
||||
log.trace("Structure结构");
|
||||
JCoRecordFieldIterator iterator = structure.getRecordFieldIterator();
|
||||
while (iterator.hasNextField()) {
|
||||
JCoRecordField field = iterator.nextRecordField();
|
||||
log.trace("名称:{},类型:{},描述:{}", field.getName(), field.getTypeAsString(), field.getDescription());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,8 @@
|
|||
package com.nflg.wms.admin;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.json.JSONObject;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.sap.conn.jco.*;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
|
@ -47,6 +49,61 @@ public class SapMetaPrintTest {
|
|||
printMeta("ZWM3A06");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void ZWM00_MB017() throws JCoException {
|
||||
printMeta("ZWM00_MB017");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void ZWM00_MB112() throws JCoException {
|
||||
printMeta("ZWM00_MB112");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void ZWM00_MB026() throws JCoException {
|
||||
printMeta("ZWM00_MB026");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void ZWM00_MB115() throws JCoException {
|
||||
printMeta("ZWM00_MB115");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void ZWM3A03() throws JCoException {
|
||||
printMeta("ZWM3A03");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void ZWM3A04() throws JCoException {
|
||||
printMeta("ZWM3A04");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void ZWM3A07() throws JCoException {
|
||||
printMeta("ZWM3A07");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void ZWM3A10() throws JCoException {
|
||||
printMeta("ZWM3A10");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void ZWM3A08() throws JCoException {
|
||||
printMeta("ZWM3A08");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void ZWM3A09() throws JCoException {
|
||||
printMeta("ZWM3A09");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void ZWM3A11() throws JCoException {
|
||||
printMeta("ZWM3A11");
|
||||
}
|
||||
|
||||
public void printMeta(String functionName) throws JCoException {
|
||||
functionName = functionName.toUpperCase();
|
||||
JCoFunction function = repository.getFunction(functionName);
|
||||
|
|
@ -72,14 +129,17 @@ public class SapMetaPrintTest {
|
|||
if (Objects.nonNull(iterator)) {
|
||||
List<JCoParameterField> fields = new ArrayList<>();
|
||||
List<String[]> data = new ArrayList<>();
|
||||
JSONObject jo = new JSONObject();
|
||||
while (iterator.hasNextField()) {
|
||||
JCoParameterField field = iterator.nextParameterField();
|
||||
data.add(new String[]{field.getName(), field.getTypeAsString(), field.getDescription()});
|
||||
if (field.isTable() || field.isStructure()) {
|
||||
fields.add(field);
|
||||
}
|
||||
jo.putOnce(field.getName(), field.getDescription());
|
||||
}
|
||||
printTable(data);
|
||||
printJson(jo);
|
||||
fields.forEach(this::print);
|
||||
}
|
||||
}
|
||||
|
|
@ -96,14 +156,23 @@ public class SapMetaPrintTest {
|
|||
|
||||
private void print(JCoRecordFieldIterator iterator) {
|
||||
List<String[]> data = new ArrayList<>();
|
||||
JSONObject jo = new JSONObject();
|
||||
while (iterator.hasNextField()) {
|
||||
JCoRecordField field = iterator.nextRecordField();
|
||||
data.add(new String[]{field.getName(), field.getTypeAsString(), field.getDescription()});
|
||||
jo.putOnce(field.getName(), field.getDescription());
|
||||
}
|
||||
printTable(data);
|
||||
printJson(jo);
|
||||
}
|
||||
|
||||
private void printJson(JSONObject jo) {
|
||||
print("JSON形式:");
|
||||
print(JSONUtil.toJsonPrettyStr(jo).toLowerCase());
|
||||
}
|
||||
|
||||
private void printTable(List<String[]> datas) {
|
||||
print("表格形式:");
|
||||
SimpleTable table = new SimpleTable();
|
||||
table.addHeader("序号", "名称", "类型", "描述");
|
||||
for (int i = 0; i < datas.size(); i++) {
|
||||
|
|
@ -198,84 +267,6 @@ public class SapMetaPrintTest {
|
|||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void ZWM00_MB017()
|
||||
{
|
||||
sapService.printMeta("ZWM00_MB017");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void execZwm00_MB017()
|
||||
{
|
||||
sapService.zwm00_MB017("1309976");
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void ZWM00_MB112()
|
||||
{
|
||||
sapService.printMeta("ZWM00_MB112");
|
||||
}
|
||||
@Test
|
||||
public void ZWM00_MB026()
|
||||
{
|
||||
sapService.printMeta("ZWM00_MB026");
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void ZWM00_MB115()
|
||||
{
|
||||
sapService.printMeta("ZWM00_MB115");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void ZWM3A03()
|
||||
{
|
||||
sapService.printMeta("ZWM3A03");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void ZWM3A04()
|
||||
{
|
||||
sapService.printMeta("ZWM3A04");
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void ZWM3A07()
|
||||
{
|
||||
sapService.printMeta("ZWM3A07");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void ZWM3A10()
|
||||
{
|
||||
sapService.printMeta("ZWM3A10");
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Test
|
||||
public void ZWM3A08()
|
||||
{
|
||||
sapService.printMeta("ZWM3A08");
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Test
|
||||
public void ZWM3A09()
|
||||
{
|
||||
sapService.printMeta("ZWM3A09");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void ZWM3A11()
|
||||
{
|
||||
sapService.printMeta("ZWM3A11");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue