一些优化
This commit is contained in:
parent
4a0b165b91
commit
85c653e9dc
|
|
@ -1,5 +1,6 @@
|
|||
package com.nflg.wms.admin;
|
||||
|
||||
import cn.dev33.satoken.sso.SaSsoManager;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
|
|
@ -19,15 +20,8 @@ public class AdminApplication {
|
|||
public static void main(String[] args) {
|
||||
SpringApplication.run(AdminApplication.class, args);
|
||||
log.info("服务已启动");
|
||||
// log.info("---------------------- Sa-Token SSO 模式二 Client 端启动成功 ----------------------");
|
||||
// log.info("配置信息:" + SaSsoManager.getClientConfig());
|
||||
|
||||
// SapService sapService= SpringUtil.getBean(SapService.class);
|
||||
// sapService.printMeta("ZIM_001");
|
||||
// sapService.zim001query("cdsfds");
|
||||
// sapService.zwm00_MB017("1309976");
|
||||
// log.info(JSONUtil.toJsonStr(sapService.searchOrder("0000101808")));
|
||||
// log.info(JSONUtil.toJsonStr(sapService.getMaterialInfoInOrder("7500188009","0000101808","2100053760")));
|
||||
log.info("---------------------- Sa-Token SSO 模式二 Client 端启动成功 ----------------------");
|
||||
log.info("配置信息:" + SaSsoManager.getClientConfig());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -10,10 +10,7 @@ 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.C_MaterialOutboundQO;
|
||||
import com.nflg.wms.common.pojo.qo.C_MaterialReturnItemQO;
|
||||
import com.nflg.wms.common.pojo.qo.C_MaterialReturnQO;
|
||||
import com.nflg.wms.common.pojo.qo.ScanCodeQO;
|
||||
import com.nflg.wms.common.pojo.qo.*;
|
||||
import com.nflg.wms.common.util.UserUtil;
|
||||
import com.nflg.wms.common.util.VUtil;
|
||||
import com.sap.conn.jco.*;
|
||||
|
|
@ -36,6 +33,75 @@ public class SapService {
|
|||
@Resource
|
||||
private JCoRepository repository;
|
||||
|
||||
/**
|
||||
* 生产订单查询
|
||||
* @param no 生产订单号
|
||||
*/
|
||||
public ZWM00MB007DTO zwm00Mb007(String no){
|
||||
Map<String, Object> parameters = new HashMap<>();
|
||||
parameters.put("I_AUFNR", no);
|
||||
|
||||
JCoFunction function = exec("ZWM00_MB007", parameters);
|
||||
|
||||
JCoStructure sreturn = function.getExportParameterList().getStructure("E_RETURN");
|
||||
VUtil.trueThrowBusinessError(!StrUtil.equals(sreturn.getString("TYPE"), "S"))
|
||||
.throwMessage("SAP错误:" + sreturn.getString("MSG"));
|
||||
|
||||
JCoStructure data = function.getExportParameterList().getStructure("E_OUTPUT");
|
||||
return new ZWM00MB007DTO()
|
||||
.setAUFNR(data.getString("AUFNR"))
|
||||
.setPSMNG(data.getBigDecimal("PSMNG"))
|
||||
.setPWERK(data.getString("PWERK"))
|
||||
.setWEMNG(data.getBigDecimal("WEMNG"))
|
||||
.setMATNR(data.getString("MATNR"))
|
||||
.setWSHSL(data.getBigDecimal("WSHSL"))
|
||||
.setLGORT(data.getString("LGORT"))
|
||||
.setMEINS(data.getString("MEINS"))
|
||||
.setMAKTX(data.getString("MAKTX"));
|
||||
}
|
||||
|
||||
/**
|
||||
* 生产订单收货
|
||||
* @param no 生产订单号
|
||||
* @param userName 用户名
|
||||
* @param materials 入库物料列表
|
||||
* @param sernrs 序列号列表
|
||||
*/
|
||||
public Zwm00Mb107DTO zwm00_mb107(String no, String userName, List<Zwm00Mb107QO> materials, List<String> sernrs){
|
||||
Map<String, Object> parameters = new HashMap<>();
|
||||
parameters.put("I_AUFNR", no);
|
||||
parameters.put("I_USNAM", userName);
|
||||
|
||||
Map<String, List<Map<String, Object>>> tables = new HashMap<>();
|
||||
List<Map<String, Object>> list1 = new ArrayList<>();
|
||||
materials.forEach(item -> {
|
||||
Map<String, Object> map=new HashMap<>();
|
||||
map.put("PWERK", item.getPWERK());
|
||||
map.put("LGORT", item.getLGORT());
|
||||
map.put("PSMNG", item.getPSMNG());
|
||||
map.put("AMEIN", item.getAMEIN());
|
||||
map.put("CHARG", item.getCHARG());
|
||||
list1.add(map);
|
||||
});
|
||||
tables.put("T_LIST1", list1);
|
||||
|
||||
List<Map<String, Object>> list2 = new ArrayList<>();
|
||||
sernrs.forEach(item -> {
|
||||
list2.add(Map.of("SERNR", item));
|
||||
});
|
||||
tables.put("T_LIST2", list2);
|
||||
|
||||
JCoFunction function = exec("ZWM00_MB107", parameters, tables);
|
||||
|
||||
JCoStructure sreturn = function.getExportParameterList().getStructure("E_RETURN");
|
||||
VUtil.trueThrowBusinessError(!StrUtil.equals(sreturn.getString("TYPE"), "S"))
|
||||
.throwMessage("SAP错误:" + sreturn.getString("MSG"));
|
||||
|
||||
return new Zwm00Mb107DTO()
|
||||
.setE_MBLNR(function.getExportParameterList().getString("E_MBLNR"))
|
||||
.setE_MJAHR(function.getExportParameterList().getString("E_MJAHR"));
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询采购单退库信息
|
||||
* @param orderNo 采购单号
|
||||
|
|
@ -478,6 +544,10 @@ public class SapService {
|
|||
return out;
|
||||
}
|
||||
|
||||
private JCoFunction exec(String functionName, Map<String, Object> parameters) {
|
||||
return exec(functionName, parameters, null);
|
||||
}
|
||||
|
||||
private JCoFunction exec(String functionName, Map<String, Object> parameters, Map<String, List<Map<String, Object>>> tables) {
|
||||
try {
|
||||
functionName=functionName.toUpperCase();
|
||||
|
|
@ -509,11 +579,15 @@ public class SapService {
|
|||
}
|
||||
}
|
||||
|
||||
public void printMeta(String functionName) throws JCoException {
|
||||
functionName=functionName.toUpperCase();
|
||||
JCoFunction function = repository.getFunction(functionName);
|
||||
VUtil.trueThrowBusinessError(Objects.isNull(function)).throwMessage("方法"+functionName+"不存在");
|
||||
printMeta(function);
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
private void printMeta(JCoFunction function){
|
||||
|
|
|
|||
|
|
@ -0,0 +1,23 @@
|
|||
package com.nflg.wms.admin;
|
||||
|
||||
import com.nflg.wms.admin.service.SapService;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
|
||||
@SpringBootTest
|
||||
public class SapMetaPrintTest {
|
||||
|
||||
@Resource
|
||||
private SapService sapService;
|
||||
|
||||
@Test
|
||||
public void ZWM00_MB007(){
|
||||
sapService.printMeta("ZWM00_MB007");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void ZWM00_MB107(){
|
||||
sapService.printMeta("ZWM00_MB107");
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,56 @@
|
|||
package com.nflg.wms.common.pojo.dto;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class ZWM00MB007DTO {
|
||||
|
||||
/**
|
||||
* 订单号
|
||||
*/
|
||||
private String AUFNR;
|
||||
|
||||
/**
|
||||
* 物料号
|
||||
*/
|
||||
private String MATNR;
|
||||
|
||||
/**
|
||||
* 物料描述
|
||||
*/
|
||||
private String MAKTX;
|
||||
|
||||
/**
|
||||
* 工厂
|
||||
*/
|
||||
private String PWERK;
|
||||
|
||||
/**
|
||||
* 仓库
|
||||
*/
|
||||
private String LGORT;
|
||||
|
||||
/**
|
||||
* 订单数量
|
||||
*/
|
||||
private BigDecimal PSMNG;
|
||||
|
||||
/**
|
||||
* 已收货数量
|
||||
*/
|
||||
private BigDecimal WEMNG;
|
||||
|
||||
/**
|
||||
* 未收货数量
|
||||
*/
|
||||
private BigDecimal WSHSL;
|
||||
|
||||
/**
|
||||
* 单位
|
||||
*/
|
||||
private String MEINS;
|
||||
}
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
package com.nflg.wms.common.pojo.dto;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class Zwm00Mb107DTO {
|
||||
|
||||
/**
|
||||
* 物料凭证编号
|
||||
*/
|
||||
private String E_MBLNR;
|
||||
|
||||
/**
|
||||
* 物料凭证年度
|
||||
*/
|
||||
private String E_MJAHR;
|
||||
}
|
||||
|
|
@ -0,0 +1,36 @@
|
|||
package com.nflg.wms.common.pojo.qo;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class Zwm00Mb107QO {
|
||||
|
||||
/**
|
||||
* 工厂
|
||||
*/
|
||||
private String PWERK;
|
||||
|
||||
/**
|
||||
* 仓库
|
||||
*/
|
||||
private String LGORT;
|
||||
|
||||
/**
|
||||
* 数量
|
||||
*/
|
||||
private BigDecimal PSMNG;
|
||||
|
||||
/**
|
||||
* 单位
|
||||
*/
|
||||
private String AMEIN;
|
||||
|
||||
/**
|
||||
* 批次
|
||||
*/
|
||||
private String CHARG;
|
||||
}
|
||||
Loading…
Reference in New Issue