SAP白坯需求数量接口
parent
6504f975a4
commit
df21d00b98
@ -0,0 +1,8 @@
|
||||
package com.op.sap.mapper;
|
||||
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface SapDeviceMapper {
|
||||
|
||||
}
|
@ -0,0 +1,10 @@
|
||||
package com.op.sap.service;
|
||||
|
||||
import com.op.common.core.domain.R;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public interface SapDeviceService {
|
||||
|
||||
R sapZmesAnlaGet(Map paramMap);
|
||||
}
|
@ -0,0 +1,72 @@
|
||||
package com.op.sap.service.impl;
|
||||
|
||||
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.op.common.core.constant.Constants;
|
||||
import com.op.common.core.domain.R;
|
||||
import com.op.common.core.utils.DateUtils;
|
||||
import com.op.common.core.utils.uuid.IdUtils;
|
||||
import com.op.sap.mapper.SapDeviceMapper;
|
||||
import com.op.sap.service.SapDeviceService;
|
||||
import com.op.system.api.domain.quality.QcCheckTaskIncomeDTO;
|
||||
import com.sap.conn.jco.*;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.validation.Validator;
|
||||
import java.math.BigDecimal;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Component
|
||||
@Service
|
||||
public class SapDeviceServiceImpl implements SapDeviceService {
|
||||
@Autowired
|
||||
private SapDeviceMapper sapDeviceMapper;
|
||||
@Autowired
|
||||
protected Validator validator;
|
||||
|
||||
@Autowired
|
||||
private JCoDestination dest;
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(SapItemSyncImpl.class);
|
||||
|
||||
|
||||
@Override
|
||||
public R sapZmesAnlaGet(Map paramMap) {
|
||||
try {
|
||||
JCoRepository repository = dest.getRepository();
|
||||
JCoFunction func = repository.getFunction("ZMES_ANLA_GET");
|
||||
if (func == null) {
|
||||
throw new RuntimeException("Function does not exist in SAP");
|
||||
}
|
||||
log.info("设备同步参数-------" + paramMap.toString());
|
||||
//参数
|
||||
JCoParameterList jCoParameterList = func.getImportParameterList();
|
||||
jCoParameterList.setValue("P_SERNR", paramMap.get("P_SERNR"));
|
||||
func.execute(dest);//执行调用函数
|
||||
JCoTable maraTable = func.getTableParameterList().getTable("L_ANLA");
|
||||
for (int i = 0; i < maraTable.getNumRows(); i++) {
|
||||
maraTable.setRow(i);
|
||||
String BUKRS = maraTable.getString("BUKRS");
|
||||
String ANLN1 = maraTable.getString("ANLN1");
|
||||
String ANLN2 = maraTable.getString("ANLN2");
|
||||
String TXT50 = maraTable.getString("TXT50");
|
||||
String SERNR = maraTable.getString("SERNR");
|
||||
String INVZU = maraTable.getString("INVZU");
|
||||
System.out.println("公司代码"+BUKRS+"主资产号"+ANLN1+"资产次级编号"+ANLN2+"资产描述"+TXT50+"序列号"+SERNR+"补充库存说明"+INVZU);
|
||||
}
|
||||
return R.ok();
|
||||
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage());
|
||||
return R.fail(e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue