增加SAP接口

highway
Yangwl 1 year ago
parent 4fd8301700
commit d59af9f9f6

@ -90,9 +90,9 @@
</dependency>
<!-- SAP JOC 3 -->
<dependency>
<groupId>com.sap</groupId>
<artifactId>sapjco3</artifactId>
<version>1.0.0</version>
<groupId>com.sap.conn</groupId>
<artifactId>sapjco</artifactId>
<version>3.0.8</version>
<!-- <scope>system</scope>-->
<!-- <systemPath>${project.basedir}/src/main/lib/sapjco3.jar</systemPath>-->
</dependency>

@ -175,6 +175,13 @@ public class SapController extends BaseController {
return sapMaterialPreparationService.MaterialPreparation(shopOrder);
}
@PostMapping("/sapMaterialPosting")
@Log(title = "订单物料领料过账、原材料补料、订单物料退料过账接口MB1A", businessType = BusinessType.SAP)
public R sapMaterialPosting(@RequestBody SapMaterialPosting sapMaterialPosting){
return sapItemSyncService.sapMaterialPosting(sapMaterialPosting);
}
/**
*
* @param sapCreateOrderList

@ -2,6 +2,7 @@ package com.op.sap.service;
import com.op.common.core.domain.R;
import com.op.sap.domain.vo.SapItemQuery;
import com.op.sap.domain.vo.SapMaterialPosting;
import com.op.system.api.domain.sap.SapBaseProduct;
import java.util.List;
@ -16,4 +17,12 @@ public interface SapItemSyncService {
* @return
*/
R itemSync(SapItemQuery sapItemQuery);
/**
* 退MB1A
* @param sapMaterialPosting
* @return
*/
R sapMaterialPosting(SapMaterialPosting sapMaterialPosting);
}

@ -9,6 +9,7 @@ import com.op.common.core.utils.StringUtils;
import com.op.common.core.utils.bean.BeanValidators;
import com.op.common.security.utils.SecurityUtils;
import com.op.sap.domain.vo.SapItemQuery;
import com.op.sap.domain.vo.SapMaterialPosting;
import com.op.sap.mapper.SapBaseProductMapper;
import com.op.sap.service.SapItemSyncService;
import com.op.sap.util.SAPConnUtils;
@ -191,6 +192,28 @@ public class SapItemSyncImpl implements SapItemSyncService {
}
}
@Override
public R sapMaterialPosting(SapMaterialPosting sapMaterialPosting) {
try {
// 获取调用 RFC 函数对象
//获取连接
JCoDestination dest = SAPConnUtils.connect();
JCoRepository repository = dest.getRepository();
JCoFunction func = repository.getFunction("ZPPR_MES_GOODSMVT_CREATE");
// 配置传入参数
JCoTable jCoTable = func.getTableParameterList().getTable("L_ITEM");
System.out.println(jCoTable);
if (func == null) {
throw new RuntimeException("Function does not exist in SAP");
}
return R.ok();
}catch (Exception e){
return R.fail(e.getMessage());
}
}
public String importProducts(List<SapBaseProduct> sapBaseProductList){
if (StringUtils.isNull(sapBaseProductList) || sapBaseProductList.size() == 0)
{

@ -47,7 +47,7 @@ public class SapOrderServiceImpl implements SapOrderService {
// S_WERKS(工厂) S_AUFNR订单号 S_MATNR物料号 S_ERDAT(创建日期) 例如20230923
if (!StringUtils.isNull(sapShopOrderQuery.getWerk())){
JCoTable S_WERKS = func.getTableParameterList().getTable("S_WERKS");
JCoTable S_WERKS = func.getTableParameterList().getTable("S_PWERK");
S_WERKS.appendRow();
S_WERKS.setValue(Constants.SIGN, "I");
S_WERKS.setValue(Constants.OPTION, "EQ");

Loading…
Cancel
Save