上传文件至 'op-modules/op-sap/src/main/java/com/op/sap/service/impl'

highway
zhaoxl 1 year ago
parent 3c45df589c
commit 03efbd1db7

@ -0,0 +1,110 @@
package com.op.sap.service.impl;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.op.common.core.domain.BaseFileData;
import com.op.common.core.utils.DateUtils;
import com.op.sap.domain.SapBaseFile;
import com.op.sap.mapper.SapBaseFileMapper;
import com.op.sap.service.SapBaseFileService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* Service
*
* @author Open Platform
* @date 2023-07-10
*/
@Service
public class SapBaseFileServiceImpl implements SapBaseFileService {
@Autowired
private SapBaseFileMapper baseFileMapper;
/**
*
*
* @param fileId
* @return
*/
@Override
@DS("#header.poolName")
public SapBaseFile selectBaseFileByFileId(String fileId) {
return baseFileMapper.selectBaseFileByFileId(fileId);
}
/**
*
*
* @param baseFile
* @return
*/
@Override
@DS("#header.poolName")
public List<SapBaseFile> selectBaseFileList(SapBaseFile baseFile) {
return baseFileMapper.selectBaseFileList(baseFile);
}
/**
*
*
* @param baseFile
* @return
*/
@Override
@DS("#header.poolName")
public int insertBaseFile(SapBaseFile baseFile) {
baseFile.setCreateTime(DateUtils.getNowDate());
return baseFileMapper.insertBaseFile(baseFile);
}
/**
*
*
* @param baseFile
* @return
*/
@Override
@DS("#header.poolName")
public int updateBaseFile(SapBaseFile baseFile) {
baseFile.setUpdateTime(DateUtils.getNowDate());
return baseFileMapper.updateBaseFile(baseFile);
}
/**
*
*
* @param fileIds
* @return
*/
@Override
@DS("#header.poolName")
public int deleteBaseFileByFileIds(String[] fileIds) {
return baseFileMapper.deleteBaseFileByFileIds(fileIds);
}
/**
*
*
* @param fileId
* @return
*/
@Override
@DS("#header.poolName")
public int deleteBaseFileByFileId(String fileId) {
return baseFileMapper.deleteBaseFileByFileId(fileId);
}
/**
*
*
* @param baseFiles
* @return
*/
@Override
@DS("#header.poolName")
public Boolean insertBaseFileBatch(List<BaseFileData> baseFiles) {
return baseFileMapper.insertBaseFileBatch(baseFiles);
}
}

@ -0,0 +1,110 @@
package com.op.sap.service.impl;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.op.common.core.utils.DateUtils;
import com.op.common.security.utils.SecurityUtils;
import com.op.sap.domain.SapBaseProduct;
import com.op.sap.mapper.SapBaseProductMapper;
import com.op.sap.service.ISapBaseProductService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* Service
*
* @author Open Platform
* @date 2023-07-18
*/
@Service
public class SapBaseProductServiceImpl implements ISapBaseProductService {
@Autowired
private SapBaseProductMapper baseProductMapper;
/**
*
*
* @param productId
* @return
*/
@Override
@DS("#header.poolName")
public SapBaseProduct selectBaseProductByProductId(String productId) {
return baseProductMapper.selectBaseProductByProductId(productId);
}
/**
*
*
* @param baseProduct
* @return
*/
@Override
@DS("#header.poolName")
public List<SapBaseProduct> selectBaseProductList(SapBaseProduct baseProduct) {
return baseProductMapper.selectBaseProductList(baseProduct);
}
/**
*
*
* @param baseProduct
* @return
*/
@Override
@DS("#header.poolName")
public int insertBaseProduct(SapBaseProduct baseProduct) {
baseProduct.setCreateTime(DateUtils.getNowDate());
baseProduct.setCreateBy(SecurityUtils.getUsername());
return baseProductMapper.insertBaseProduct(baseProduct);
}
/**
*
*
* @param baseProduct
* @return
*/
@Override
@DS("#header.poolName")
public int updateBaseProduct(SapBaseProduct baseProduct) {
baseProduct.setUpdateTime(DateUtils.getNowDate());
baseProduct.setUpdateBy(SecurityUtils.getUsername());
return baseProductMapper.updateBaseProduct(baseProduct);
}
/**
*
*
* @param productIds
* @return
*/
@Override
@DS("#header.poolName")
public int deleteBaseProductByProductIds(String[] productIds) {
return baseProductMapper.deleteBaseProductByProductIds(productIds);
}
/**
*
*
* @param productId
* @return
*/
@Override
@DS("#header.poolName")
public int deleteBaseProductByProductId(String productId) {
return baseProductMapper.deleteBaseProductByProductId(productId);
}
@Override
public String selectBaseProductIDByProductCode(String productCode) {
return baseProductMapper.selectBaseProductIDByProductCode(productCode);
}
}

@ -0,0 +1,132 @@
package com.op.sap.service.impl;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.op.common.core.utils.DateUtils;
import com.op.common.core.utils.uuid.IdUtils;
import com.op.common.security.utils.SecurityUtils;
import com.op.sap.domain.SapProRouteProduct;
import com.op.sap.mapper.SapProRouteProductMapper;
import com.op.sap.service.SapProRouteProductService;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.List;
/**
* 线Service
*
* @author Open Platform
* @date 2023-07-13
*/
@Service
public class SapProRouteProductServiceImpl implements SapProRouteProductService {
@Autowired
private SapProRouteProductMapper proRouteProductMapper;
/**
* 线
*
* @param recordId 线
* @return 线
*/
@Override
@DS("#header.poolName")
public SapProRouteProduct selectProRouteProductByRecordId(String recordId) {
return proRouteProductMapper.selectProRouteProductByRecordId(recordId);
}
/**
* 线
*
* @param proRouteProduct 线
* @return 线
*/
@Override
@DS("#header.poolName")
public List<SapProRouteProduct> selectProRouteProductList(SapProRouteProduct proRouteProduct) {
return proRouteProductMapper.selectProRouteProductList(proRouteProduct);
}
/**
* 线
*
* @param proRouteProduct 线
* @return
*/
@Override
@DS("#header.poolName")
public int insertProRouteProduct(SapProRouteProduct proRouteProduct) {
Date now = DateUtils.getNowDate();
if(StringUtils.isNotBlank(proRouteProduct.getRouteId())){
//删除之前的关联关系
proRouteProductMapper.deleteByRouteId(proRouteProduct);
}
if(proRouteProduct.getSelectedValues()!=null){
SapProRouteProduct proRouteProductDto =null;
for(String ProductCode:proRouteProduct.getSelectedValues()){
//查询物料编码对应的各种信息
proRouteProductDto = new SapProRouteProduct();
proRouteProductDto.setRecordId(IdUtils.fastSimpleUUID());
proRouteProductDto.setCreateTime(now);
proRouteProductDto.setCreateBy(SecurityUtils.getUsername());
proRouteProductDto.setRouteId(proRouteProduct.getRouteId());
proRouteProductDto.setItemId(proRouteProduct.getItemId());
proRouteProductDto.setItemCode(ProductCode);
proRouteProductDto.setItemName(proRouteProduct.getItemName());
proRouteProductMapper.insertProRouteProduct(proRouteProductDto);
}
}
//新增关联关系
return 1;
}
/**
* 线
*
* @param proRouteProduct 线
* @return
*/
@Override
@DS("#header.poolName")
public int updateProRouteProduct(SapProRouteProduct proRouteProduct) {
proRouteProduct.setUpdateTime(DateUtils.getNowDate());
return proRouteProductMapper.updateProRouteProduct(proRouteProduct);
}
/**
* 线
*
* @param recordIds 线
* @return
*/
@Override
@DS("#header.poolName")
public int deleteProRouteProductByRecordIds(String[] recordIds) {
return proRouteProductMapper.deleteProRouteProductByRecordIds(recordIds);
}
/**
* 线
*
* @param recordId 线
* @return
*/
@Override
@DS("#header.poolName")
public int deleteProRouteProductByRecordId(String recordId) {
return proRouteProductMapper.deleteProRouteProductByRecordId(recordId);
}
@Override
@DS("#header.poolName")
public SapProRouteProduct getList(SapProRouteProduct proRouteProduct) {
SapProRouteProduct dto = new SapProRouteProduct();
List<SapProRouteProduct> unSelected = proRouteProductMapper.getRouteProdProductListUndo(proRouteProduct);
dto.setUnSelect(unSelected);
List<SapProRouteProduct> selected= proRouteProductMapper.getRouteProdProductListDo(proRouteProduct);
dto.setSelected(selected);
return dto;
}
}

@ -0,0 +1,209 @@
package com.op.sap.service.impl;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.op.common.core.constant.UserConstants;
import com.op.common.core.domain.BaseFileData;
import com.op.common.core.utils.DateUtils;
import com.op.common.core.utils.StringUtils;
import com.op.common.core.utils.uuid.IdUtils;
import com.op.common.security.utils.SecurityUtils;
import com.op.sap.domain.SapBaseFile;
import com.op.sap.domain.SapProRoute;
import com.op.sap.mapper.SapBaseFileMapper;
import com.op.sap.mapper.SapProRouteMapper;
import com.op.sap.service.SapProRouteService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
/**
* 线Service
*
* @author yinjinlu
* @date 2022-05-12
*/
@Service
public class SapProRouteServiceImpl implements SapProRouteService {
@Autowired
private SapProRouteMapper proRouteMapper;
@Autowired
private SapBaseFileMapper baseFileMapper;
/**
* 线
*
* @param routeId 线
* @return 线
*/
@Override
@DS("#header.poolName")
public SapProRoute selectProRouteByRouteId(String routeId) {
SapProRoute p = proRouteMapper.selectProRouteByRouteId(routeId);
List<SapBaseFile> files = baseFileMapper.getBaseFileBatch(routeId);
if (!CollectionUtils.isEmpty(files)) {
p.setFiles(files);
}
return p;
}
/**
* 线
*
* @param proRoute 线
* @return 线
*/
@Override
@DS("#header.poolName")
public List<SapProRoute> selectProRouteList(SapProRoute proRoute) {
return proRouteMapper.selectProRouteList(proRoute);
}
@Override
public SapProRoute getRouteByProductId(String itemId) {
return proRouteMapper.getRouteByProductId(itemId);
}
@Override
@DS("#header.poolName")
public Boolean checkRouteCodeUnique(SapProRoute proRoute) {
SapProRoute route = proRouteMapper.checkRouteCodeUnique(proRoute);
String routeId = proRoute.getRouteId();
if (StringUtils.isNotNull(route) && !route.getRouteId().equals(routeId)) {
return UserConstants.NOT_UNIQUE;
}
return UserConstants.UNIQUE;
}
/**
* 线
*
* @param proRoute 线
* @return
*/
@Override
@DS("#header.poolName")
public int insertProRoute(SapProRoute proRoute) {
proRoute.setCreateTime(DateUtils.getNowDate());
proRoute.setRouteVersion("V.1");
//上传附件
if (StringUtils.isNotEmpty(proRoute.getFileList())) {
String[] ids = proRoute.getFileList().split(",");
List<BaseFileData> files = new ArrayList<>();
BaseFileData file = null;
for (String id : ids) {
file = new BaseFileData();
file.setFileId(IdUtils.fastSimpleUUID());
file.setFileName(id.split("&fileName=")[1]);
file.setFileAddress(id);
file.setSourceId(proRoute.getRouteId());
file.setCreateBy(SecurityUtils.getUsername());
file.setCreateTime(new Date());
files.add(file);
}
baseFileMapper.insertBaseFileBatch(files);
}
return proRouteMapper.insertProRoute(proRoute);
}
/**
* 线
*
* @param proRoute 线
* @return
*/
@Override
@DS("#header.poolName")
public int updateProRoute(SapProRoute proRoute) {
proRoute.setUpdateTime(DateUtils.getNowDate());
//上传附件
if (StringUtils.isNotEmpty(proRoute.getFileList())) {
baseFileMapper.deleteBaseFileBySourceId(proRoute.getRouteId());
String[] ids = proRoute.getFileList().split(",");
List<BaseFileData> files = new ArrayList<>();
BaseFileData file = null;
for (String id : ids) {
file = new BaseFileData();
file.setFileId(IdUtils.fastSimpleUUID());
file.setFileAddress(id);
file.setFileName(id.split("&fileName=")[1]);
file.setSourceId(proRoute.getRouteId());
file.setCreateBy(SecurityUtils.getUsername());
file.setCreateTime(new Date());
files.add(file);
}
baseFileMapper.insertBaseFileBatch(files);
}
//更新版本V.1->递增
String nowRouteVersion = proRoute.getRouteVersion().replace("V", "")
.replace(".", "");
int nowRouteVersionNum = Integer.parseInt(nowRouteVersion);
String newRouteVersionNum = "V." + (++nowRouteVersionNum);
proRoute.setRouteVersion(newRouteVersionNum);
return proRouteMapper.updateProRoute(proRoute);
}
/**
* 线
*
* @param routeIds 线
* @return
*/
@Override
@DS("#header.poolName")
public int deleteProRouteByRouteIds(String[] routeIds) {
return proRouteMapper.deleteProRouteByRouteIds(routeIds);
}
/**
* 线
*
* @param routeId 线
* @return
*/
@Override
@DS("#header.poolName")
public int deleteProRouteByRouteId(String routeId) {
return proRouteMapper.deleteProRouteByRouteId(routeId);
}
@Override
@DS("#header.poolName")
public int batchInsertProRoute(SapProRoute proRoute) {
proRoute.setCreateTime(DateUtils.getNowDate());
if (StringUtils.isNotEmpty(proRoute.getFileList())) {
List<String> ids = proRoute.getIdList();
// for (int j = ids.size(); j < 1; j--) {
for (String id :ids) {
String[] f = proRoute.getFileList().split(",");
List<BaseFileData> files = new ArrayList<>();
BaseFileData file = null;
for (String file1 : f) {
file = new BaseFileData();
file.setFileId(IdUtils.fastSimpleUUID());
file.setFileName(file1.split("&fileName=")[1]);
file.setFileAddress(file1);
file.setSourceId(id);
file.setCreateBy(SecurityUtils.getUsername());
file.setCreateTime(new Date());
files.add(file);
}
baseFileMapper.insertBaseFileBatch(files);
}
}
return 1;
}
@Override
public int selectProRrouteByRouteCode(String routeCode) {
return proRouteMapper.selectProRouteByRouteCode(routeCode);
}
}

@ -0,0 +1,862 @@
package com.op.sap.service.impl;
import com.baomidou.dynamic.datasource.toolkit.DynamicDataSourceContextHolder;
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.common.core.utils.uuid.UUID;
import com.op.sap.domain.*;
import com.op.sap.mapper.*;
import com.op.sap.service.ISapBaseProductService;
import com.op.sap.service.SapService;
import com.op.sap.util.SAPConnUtils;
import com.op.system.api.model.SapProOrder;
import com.sap.conn.jco.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
import java.util.TreeSet;
import java.util.stream.Collectors;
@Service
public class SapServiceImpl implements SapService {
// @Autowired
// private RemotePlanService remotePlanService;
@Autowired
private ISapBaseProductService sapBaseProductService;
@Autowired
private SapSysDeptMapper sapSysDeptMapper;
@Autowired
private SapSysUserMapper sapSysUserMapper;
@Autowired
private SapBaseProductMapper sapBaseProductMapper;
@Autowired
private SapProRouteMapper sapProRouteMapper;
@Autowired
private SapProRouteProductMapper sapProRouteProductMapper;
@Autowired
private SapProProcessMapper sapProProcessMapper;
@Autowired
private SapProProcessContentMapper sapProProcessContentMapper;
@Autowired
private SapProRouteProcessMapper sapProRouteProcessMapper;
// @Override
// public List<SapProOrder> shopOrderSync(SapProOrder sapProOrder) {
//
//
// // 连接
// SapConn con = new SapConn(
// ashost,
// sysnr,
// client,
// user,
// passwd,
// lang,
// pool_capacity,
// peak_limit,
// saprouter
// );
// JCoDestination jCoDestination = SAPConnUtils.connect(con);
// try {
// // 获取调用 RFC 函数对象
// JCoFunction func = jCoDestination.getRepository().getFunction("ZPPR_MES_PRO_TO");
// // 配置传入参数
// JCoParameterList importParameterList = func.getImportParameterList();
//// importParameterList.setValue("S_AUFNR",001002125255 );
// // 调用并获取返回值
// func.execute(jCoDestination);
// // 获取 内表 - ZMES_PRO
// JCoTable maraTable = func.getTableParameterList().getTable("ZMES_PRO");
// JCoRecordMetaData metaData = maraTable.getRecordMetaData();
// System.out.println("###" + metaData.toString());
// SapProOrder proOrder = new SapProOrder();
// List<SapProOrder> proOrderList = new ArrayList<>();
// // 循环输出 Table 数据
// for (int i = 0; i < maraTable.getNumRows(); i++) {
// maraTable.setRow(i);
// String AUFNR = maraTable.getString("AUFNR");
// String AUART = maraTable.getString("AUART");
// String MAUFNR = maraTable.getString("MAUFNR");
// String PLNBEZ = maraTable.getString("PLNBEZ");
// String MAKTX = maraTable.getString("MAKTX");
// String PWERK = maraTable.getString("PWERK");
// String GAMNG = maraTable.getString("GAMNG");
// String GMEIN = maraTable.getString("GMEIN");
// String PLNNR = maraTable.getString("PLNNR");
// String GSTRP = maraTable.getString("GSTRP");
// String GLTRP = maraTable.getString("GLTRP");
// String ERNAM = maraTable.getString("ERNAM");
// String ERDAT = maraTable.getString("ERDAT");
// String STTXT = maraTable.getString("STTXT");
// System.out.println("订单号:" + AUFNR + " - 订单类型:" + AUART + " - 上级订单编号:" + MAUFNR + " - 物料号:" + PLNBEZ + " - 物料描述(短文本):" + MAKTX
// + " - 订单的计划工厂:" + PWERK + " - 订单数量总计:" + GAMNG + " - 基本计量单位:" + GMEIN + " - 任务清单组码:" + PLNNR + " - 基本开始日期:" + GSTRP
// + " - 基本完成日期:" + GLTRP + " - 输入者:" + ERNAM + " - 创建日期:" + ERDAT + " - 系统状态:" + STTXT);
// proOrder.setId(IdUtils.fastSimpleUUID());
// proOrder.setPlanFactoryCode(PWERK);
// proOrder.setOrderCode(AUFNR);
// proOrder.setOrderType(AUART);
// proOrder.setProdCode(PLNBEZ);
// proOrder.setProdDesc(MAKTX);
// proOrder.setQuantity(Long.parseLong(GAMNG.substring(0, GAMNG.indexOf("."))));
// proOrder.setUnit(GMEIN);
// proOrder.setWorkerOrder(PLNNR);
// proOrder.setPlanProDate(DateUtils.dateTime("yyyy-MM-dd", GSTRP));
// proOrder.setPlanComplete(DateUtils.dateTime("yyyy-MM-dd", GLTRP));
// proOrder.setParentOrder(MAUFNR);
// proOrder.setCreateBy(ERNAM);
// proOrder.setCreateTime(DateUtils.dateTime("yyyy-MM-dd", ERDAT));
// proOrder.setUpdateBy(ERNAM);
// proOrder.setUpdateTime(DateUtils.dateTime("yyyy-MM-dd", ERDAT));
// proOrder.setStatus("0");
// proOrderList.add(proOrder);
// // remotePlanService.sapAddOrder(proOrder);
// // remoteMesService.sapAddOrder(proOrder);
// }
// return proOrderList;
// } catch (Exception e) {
// return null;
// }
// }
//
//
// @Override
// public R<Boolean> sapItem() {
// DynamicDataSourceContextHolder.push("lanju_op_xiaolan_ds");
// // 连接
// SapConn con = new SapConn(
// ashost,
// sysnr,
// client,
// user,
// passwd,
// lang,
// pool_capacity,
// peak_limit,
// saprouter
// );
// JCoDestination jCoDestination = SAPConnUtils.connect(con);
// try {
//// // 获取调用 RFC 函数对象
//// JCoFunction func = jCoDestination.getRepository().getFunction("ZMMR_MES_MAT_GET");
//// // 配置传入参数
//// JCoParameterList importParameterList = func.getImportParameterList();
//// //importParameterList.setValue("S_AUFNR",001002125255 );
//// // 调用并获取返回值
//// func.execute(jCoDestination);
//// // 获取 内表 - ZMES_PRO
//// JCoTable maraTable = func.getTableParameterList().getTable("LT_MARA");
//// JCoRecordMetaData metaData = maraTable.getRecordMetaData();
//// System.out.println("###"+metaData.toString());
//// SapProOrder proOrder=new SapProOrder();
//// List<SapProOrder> proOrderList=new ArrayList<>();
//// // 循环输出 Table 数据
//// for (int i = 0; i < maraTable.getNumRows(); i++) {
//// maraTable.setRow(i);
//// String AUFNR = maraTable.getString("AUFNR");
//// String AUART = maraTable.getString("AUART");
//// String MAUFNR = maraTable.getString("MAUFNR");
//// String PLNBEZ = maraTable.getString("PLNBEZ");
// //获取调用 RFC 函数对象
// JCoFunction func = jCoDestination.getRepository().getFunction("ZMMR_MES_MAT_GET");
// // 配置传入参数
// JCoParameterList importParameterList = func.getImportParameterList();
// //importParameterList.setValue("S_AUFNR",001002125255 );
// // 调用并获取返回值
// func.execute(jCoDestination);
// // 获取 内表 - LT_BOM
// JCoTable maraTable = func.getTableParameterList().getTable("LT_MARA");
// JCoRecordMetaData metaData = maraTable.getRecordMetaData();
// System.out.println("###" + metaData.toString());
//// SapProOrder proOrder=new SapProOrder();
// SapBaseProduct baseProduct = new SapBaseProduct();
// String[] str = new String[maraTable.getNumRows()];
// List<SapBaseProduct> baseProductList = new ArrayList<>();
// // 循环输出 Table 数据
// for (int i = 0; i < maraTable.getNumRows(); i++) {
//
// maraTable.setRow(i);
// String MATNR = maraTable.getString("MATNR");
// String MAKTX = maraTable.getString("MAKTX");
// String EAN11 = maraTable.getString("EAN11");
// String MTART = maraTable.getString("MTART");
// String MTBEZ = maraTable.getString("MTBEZ");
// String MATKL = maraTable.getString("MATKL");
// String WGBEZ = maraTable.getString("WGBEZ");
// BigDecimal BRGEW = maraTable.getBigDecimal("BRGEW");
// BigDecimal NTGEW = maraTable.getBigDecimal("NTGEW");
// BigDecimal VOLUM = maraTable.getBigDecimal("VOLUM");
// String VOLEH = maraTable.getString("VOLEH");
// String MEINS = maraTable.getString("MEINS");
// String MEINH = maraTable.getString("MEINH");
// String UMREZ = maraTable.getString("UMREZ");
// String UMREN = maraTable.getString("UMREN");
// String LVORM = maraTable.getString("LVORM");
// String MENGE = maraTable.getString("MENGE");
// String MHDHB = maraTable.getString("MHDHB");
// String SPART = maraTable.getString("SPART");
// String SPART_NM = maraTable.getString("SPART_NM");
// String MVGR1 = maraTable.getString("MVGR1");
// String MVGR1_NM = maraTable.getString("MVGR1_NM");
// String MVGR2 = maraTable.getString("MVGR2");
// String MVGR2_NM = maraTable.getString("MVGR2_NM");
// String MVGR3 = maraTable.getString("MVGR3");
// String MVGR3_NM = maraTable.getString("MVGR3_NM");
// String MVGR4 = maraTable.getString("MVGR4");
// String MVGR4_NM = maraTable.getString("MVGR4_NM");
// String MVGR5 = maraTable.getString("MVGR5");
// String MVGR5_NM = maraTable.getString("MVGR5_NM");
//// String SANKA = maraTable.getString("SANKA");
//// System.out.println("MATNR" + MATNR + "MAKTX" + MAKTX);
// baseProduct.setProductCode(MATNR);
// baseProduct.setProductDescZh(MAKTX);
//// baseProduct.setProductean11(EAN11);
// baseProduct.setProductGroup(MATKL);
// baseProduct.setProductGroupName(WGBEZ);
// baseProduct.setGrossWeight(BRGEW);
// baseProduct.setNetWeight(NTGEW);
// baseProduct.setVolume(VOLUM);
// baseProduct.setDelFlag("0");
// str[i] = baseProduct.getProductCode();
// if (i!=0){
// if (str[i].equals(str[i-1])) {
// System.out.println("chongfu");
//
// }else {
// sapBaseProductMapper.insertBaseProduct(baseProduct);
// }
// }
//
//
//// baseProductList.add(i, baseProduct);
//// sapBaseProductMapper.insertBaseProduct(baseProduct);
//
//
// }
// } catch (Exception e) {
// return R.fail(e.getMessage());
// }
// return R.ok();
// }
//
// @Override
// public R<Boolean> sapBom() {
// // 连接
// SapConn con = new SapConn(
// ashost,
// sysnr,
// client,
// user,
// passwd,
// lang,
// pool_capacity,
// peak_limit,
// saprouter
// );
// JCoDestination jCoDestination = SAPConnUtils.connect(con);
// try {
// // 获取调用 RFC 函数对象
// JCoFunction func = jCoDestination.getRepository().getFunction("ZMMR_MES_MAT_GET");
// // 配置传入参数
// JCoParameterList importParameterList = func.getImportParameterList();
// //importParameterList.setValue("S_AUFNR",001002125255 );
// // 调用并获取返回值
// func.execute(jCoDestination);
// // 获取 内表 - ZMES_PRO
// JCoTable maraTable = func.getTableParameterList().getTable("LT_MARA");
// JCoRecordMetaData metaData = maraTable.getRecordMetaData();
// System.out.println("###" + metaData.toString());
// SapProOrder proOrder = new SapProOrder();
// List<SapProOrder> proOrderList = new ArrayList<>();
// // 循环输出 Table 数据
// for (int i = 0; i < maraTable.getNumRows(); i++) {
// maraTable.setRow(i);
// String AUFNR = maraTable.getString("AUFNR");
// String AUART = maraTable.getString("AUART");
// String MAUFNR = maraTable.getString("MAUFNR");
// String PLNBEZ = maraTable.getString("PLNBEZ");
// System.out.println("工厂:" + AUFNR + " - 物料号:" + AUART + " - 物料组:"
// + MAUFNR + " - 生产版本:" + PLNBEZ);
// }
//
//// sapBaseProductService.insertBaseProduct(baseProduct);
// }
// catch(
// Exception e)
//
// {
// return R.fail(e.getMessage());
// }
// return R.ok();
//}
//
// @Override
// public R<Boolean> sapProRoute() {
// DynamicDataSourceContextHolder.push("lanju_op_xiaolan_ds");
// // 连接
// SapConn con = new SapConn(
// ashost,
// sysnr,
// client,
// user,
// passwd,
// lang,
// pool_capacity,
// peak_limit,
// saprouter
// );
// JCoDestination jCoDestination = SAPConnUtils.connect(con);
// try {
// // 获取调用 RFC 函数对象
// JCoFunction func = jCoDestination.getRepository().getFunction("ZPPR_MES_ROUTING");
// // 配置传入参数
// JCoParameterList importParameterList = func.getImportParameterList();
//// System.out.println(importParameterList.getListMetaData());
// // importParameterList.setValue("S_ERDAT","2019-11-07" );
// // 调用并获取返回值
// func.execute(jCoDestination);
// // 获取 内表 - ZMES_PRO
// JCoTable maraTable = func.getTableParameterList().getTable("LT_ROUTING");
// JCoRecordMetaData metaData = maraTable.getRecordMetaData();
// String[] str = new String[maraTable.getNumRows()];
//// System.out.println("###" + metaData.toString());
//
// List<SapProRoute> proRouteList = new ArrayList<>();
// for (int i = 0; i <maraTable.getNumRows(); i++) {
// SapProRoute proRoute = new SapProRoute();
// maraTable.setRow(i);
// String WERKS = maraTable.getString("WERKS");
// String PLNTY = maraTable.getString("PLNTY");
// String PLNNR = maraTable.getString("PLNNR");
// String PLNAL = maraTable.getString("PLNAL");
// String LOEKZ = maraTable.getString("LOEKZ");
// String MATNR = maraTable.getString("MATNR");
// String MAKTX = maraTable.getString("MAKTX");
// String VERWE = maraTable.getString("VERWE");
// String STATU = maraTable.getString("STATU");
// String LOSVN = maraTable.getString("LOSVN");
// String LOSBS = maraTable.getString("LOSBS");
// String KTEXT = maraTable.getString("KTEXT");
// String VORNR = maraTable.getString("VORNR");
// String STEUS = maraTable.getString("STEUS");
// String KTSCH = maraTable.getString("KTSCH");
// String LTXA1 = maraTable.getString("LTXA1");
// String ANDAT = maraTable.getString("ANDAT");
// String ANNAM = maraTable.getString("ANNAM");
// String AEDAT = maraTable.getString("AEDAT");
// String AENAM = maraTable.getString("AENAM");
// String ARBPL = maraTable.getString("ARBPL");
// String UMREN = maraTable.getString("UMREN");
// String UMREZ = maraTable.getString("UMREZ");
// String BMSCH = maraTable.getString("BMSCH");
// String MEINH = maraTable.getString("MEINH");
// String LAR01 = maraTable.getString("LAR01");
// String VGW01 = maraTable.getString("VGW01");
// String VGE01 = maraTable.getString("VGE01");
// String VGW02 = maraTable.getString("VGW02");
// String VGE02 = maraTable.getString("VGE02");
// String VGW03 = maraTable.getString("VGW03");
// String VGE03 = maraTable.getString("VGE03");
// String VGW04 = maraTable.getString("VGW04");
// String VGE04 = maraTable.getString("VGE04");
// String VGW05 = maraTable.getString("VGW05");
// String VGE05 = maraTable.getString("VGE05");
// String VGW06 = maraTable.getString("VGW06");
// String VGE06 = maraTable.getString("VGE06");
// String UEMUS = maraTable.getString("UEMUS");
// String UEKAN = maraTable.getString("UEKAN");
// String FLIES = maraTable.getString("FLIES");
// String SPMUS = maraTable.getString("SPMUS");
// String SPLIM = maraTable.getString("SPLIM");
// String CKSELKZ = maraTable.getString("CKSELKZ");
// proRoute.setRouteId(UUID.randomUUID().toString().replaceAll("-",""));
// proRoute.setRouteCode(PLNNR);
// proRoute.setRouteName(KTEXT);
// proRoute.setCreateBy(ANNAM);
// proRoute.setRouteDesc(KTEXT);
// proRoute.setEnableFlag("Y");
// proRoute.setCreateTime(DateUtils.dateTime("yyyy-MM-dd", ANDAT));
// if (proRoute.getRouteName().isEmpty()){
// proRoute.setRouteName("无");
// }
// proRouteList.add(i,proRoute);
//
// }
// proRouteList = proRouteList.stream().collect(Collectors.collectingAndThen
// (Collectors.toCollection(() ->new TreeSet<>(Comparator.comparing(SapProRoute::getRouteCode))),
// ArrayList::new));
// for (int i = 0; i < proRouteList.size(); i++) {
// sapProRouteMapper.insertProRoute(proRouteList.get(i));
// }
//
//
// }
// catch (Exception e){
// return R.fail(e.getMessage());
// }
// return R.ok();
// }
// @Override
// public R<Boolean> sapProRouteProduct() {
// DynamicDataSourceContextHolder.push("lanju_op_xiaolan_ds");
//
// try {
// // 获取调用 RFC 函数对象
// //获取连接
// JCoDestination dest = SAPConnUtils.connect();
// JCoRepository repository = dest.getRepository();
// JCoFunction func = repository.getFunction("ZPPR_MES_ROUTING");
// if (func == null) {
// throw new RuntimeException("Function does not exist in SAP");
// }
// // 配置传入参数
//// JCoTable jCoTable = func.getTableParameterList().getTable("S_STLNR");
//// jCoTable.appendRow();
//// jCoTable.setValue(Constants.SIGN, "I");
//// jCoTable.setValue(Constants.OPTION, "EQ");
//// jCoTable.setValue(Constants.LOW, "00012222");
//
//// JCoTable jCoTables = func.getTableParameterList().getTable("LT_ROUTING");
//// jCoTables.appendRow();
//// jCoTables.setValue(Constants.SIGN, "I");
//// jCoTables.setValue(Constants.OPTION, "EQ");
//// jCoTables.setValue(Constants.LOW, "00012222");
// // 获取调用 RFC 函数对象
// func.execute(dest);
// // 获取 内表 - ZMES_PRO
// JCoTable maraTable = func.getTableParameterList().getTable("LT_ROUTING");
// JCoRecordMetaData metaData = maraTable.getRecordMetaData();
// System.out.println("###" + metaData.toString());
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
// // 获取调用 RFC 函数对象
// JCoFunction func = jCoDestination.getRepository().getFunction("ZPPR_MES_ROUTING");
// // 配置传入参数
// JCoParameterList importParameterList = func.getImportParameterList();
//// System.out.println(importParameterList.getListMetaData());
// // importParameterList.setValue("S_ERDAT","2019-11-07" );
// // 调用并获取返回值
// func.execute(jCoDestination);
// // 获取 内表 - ZMES_PRO
// JCoTable maraTable = func.getTableParameterList().getTable("LT_ROUTING");
// JCoRecordMetaData metaData = maraTable.getRecordMetaData();
// String[] str = new String[maraTable.getNumRows()];
//// System.out.println("###" + metaData.toString());
// List<SapProRoute> proRouteList = new ArrayList<>();
// List<SapProRouteProduct> proRouteProductList = new ArrayList<>();
// for (int i = 0; i <maraTable.getNumRows(); i++) {
// SapProRouteProduct proRouteProduct = new SapProRouteProduct();
// SapProRoute proRoute = new SapProRoute();
// maraTable.setRow(i);
// String WERKS = maraTable.getString("WERKS");
// String PLNTY = maraTable.getString("PLNTY");
// String PLNNR = maraTable.getString("PLNNR");
// String PLNAL = maraTable.getString("PLNAL");
// String LOEKZ = maraTable.getString("LOEKZ");
// String MATNR = maraTable.getString("MATNR");
// String MAKTX = maraTable.getString("MAKTX");
// String VERWE = maraTable.getString("VERWE");
// String STATU = maraTable.getString("STATU");
// String LOSVN = maraTable.getString("LOSVN");
// String LOSBS = maraTable.getString("LOSBS");
// String KTEXT = maraTable.getString("KTEXT");
// String VORNR = maraTable.getString("VORNR");
// String STEUS = maraTable.getString("STEUS");
// String KTSCH = maraTable.getString("KTSCH");
// String LTXA1 = maraTable.getString("LTXA1");
// String ANDAT = maraTable.getString("ANDAT");
// String ANNAM = maraTable.getString("ANNAM");
// String AEDAT = maraTable.getString("AEDAT");
// String AENAM = maraTable.getString("AENAM");
// String ARBPL = maraTable.getString("ARBPL");
// String UMREN = maraTable.getString("UMREN");
// String UMREZ = maraTable.getString("UMREZ");
// String BMSCH = maraTable.getString("BMSCH");
// String MEINH = maraTable.getString("MEINH");
// String LAR01 = maraTable.getString("LAR01");
// String VGW01 = maraTable.getString("VGW01");
// String VGE01 = maraTable.getString("VGE01");
// String VGW02 = maraTable.getString("VGW02");
// String VGE02 = maraTable.getString("VGE02");
// String VGW03 = maraTable.getString("VGW03");
// String VGE03 = maraTable.getString("VGE03");
// String VGW04 = maraTable.getString("VGW04");
// String VGE04 = maraTable.getString("VGE04");
// String VGW05 = maraTable.getString("VGW05");
// String VGE05 = maraTable.getString("VGE05");
// String VGW06 = maraTable.getString("VGW06");
// String VGE06 = maraTable.getString("VGE06");
// String UEMUS = maraTable.getString("UEMUS");
// String UEKAN = maraTable.getString("UEKAN");
// String FLIES = maraTable.getString("FLIES");
// String SPMUS = maraTable.getString("SPMUS");
// String SPLIM = maraTable.getString("SPLIM");
// String CKSELKZ = maraTable.getString("CKSELKZ");
// proRoute.setRouteCode(PLNNR);
// proRoute.setRouteName(KTEXT);
// proRoute.setCreateBy(ANNAM);
// proRoute.setRouteDesc(KTEXT);
// proRoute.setRouteId(UUID.randomUUID().toString().replaceAll("-",""));
// proRoute.setEnableFlag("Y");
// if (proRoute.getRouteName().isEmpty()){
// proRoute.setRouteName("无");
// }
// proRouteList.add(i,proRoute);
// proRouteProduct.setRecordId(UUID.randomUUID().toString().replace("-",""));
// proRouteProduct.setItemCode(MATNR);
// proRouteProduct.setItemName(MAKTX);
// proRouteProduct.setRouteId(proRouteList.get(i).getRouteId());
// proRouteProductList.add(i,proRouteProduct);
// }
// //根据routecode去重
// proRouteList = proRouteList.stream().collect(Collectors.collectingAndThen
// (Collectors.toCollection(() ->new TreeSet<>(Comparator.comparing(SapProRoute::getRouteCode))),
// ArrayList::new));
// for (int i = 0; i < proRouteList.size(); i++) {
// sapProRouteMapper.insertProRoute(proRouteList.get(i));
// }
//// for (int i = 0; i <proRouteList.size(); i++) {sapProRouteMapper.insertProRoute(proRouteList.get(i));}
// for (int j=0; j<proRouteProductList.size(); j++) {
// //item_id为空时不插入
// if (!sapBaseProductMapper.selectBaseProductIDByProductCode(proRouteProductList.get(j).getItemCode()).isEmpty()){
// proRouteProductList.get(j).setItemId
// (sapBaseProductMapper.selectBaseProductIDByProductCode(proRouteProductList.get(j).getItemCode()));
// sapProRouteProductMapper.insertProRouteProduct(proRouteProductList.get(j));
// }}
//
// }
// catch (Exception e){
// return R.fail(e.getMessage());
// }
// return R.ok();
// }
@Override
public R<Boolean> sapProRouteProcess() {
// DynamicDataSourceContextHolder.push("lanju_op_xiaolan_ds");
// DynamicDataSourceContextHolder.push("lanju_op_cloud");
try {
// 获取调用 RFC 函数对象
//获取连接
JCoDestination dest = SAPConnUtils.connect();
JCoRepository repository = dest.getRepository();
JCoFunction func = repository.getFunction("ZPPR_MES_ROUTING");
if (func == null) {
throw new RuntimeException("Function does not exist in SAP");
}
// 获取调用 RFC 函数对象
func.execute(dest);
// 获取 内表 - ZMES_PRO
JCoTable maraTable = func.getTableParameterList().getTable("LT_ROUTING");
JCoRecordMetaData metaData = maraTable.getRecordMetaData();
System.out.println("###" + metaData.toString());
// System.out.println("###" + metaData.toString());
List<SapProProcess> proProcessList = new ArrayList<>();
List<SapProRouteProcess> proRouteProcessList = new ArrayList<>();
List<SapProProcessContent> proProcessContentList = new ArrayList<>();
List<SapProRoute> proRouteList = new ArrayList();
for (int i = 0,arr1=0,arr2=0; i <maraTable.getNumRows(); i++) {
SapProProcess proProcess = new SapProProcess();
SapProRouteProcess proRouteProcess = new SapProRouteProcess();
SapProProcessContent proProcessContent = new SapProProcessContent();
SapProRoute proRoute = new SapProRoute();
maraTable.setRow(i);
String WERKS = maraTable.getString("WERKS");
String PLNTY = maraTable.getString("PLNTY");
String PLNNR = maraTable.getString("PLNNR");
String PLNAL = maraTable.getString("PLNAL");
String LOEKZ = maraTable.getString("LOEKZ");
String MATNR = maraTable.getString("MATNR");
String MAKTX = maraTable.getString("MAKTX");
String VERWE = maraTable.getString("VERWE");
String STATU = maraTable.getString("STATU");
String LOSVN = maraTable.getString("LOSVN");
String LOSBS = maraTable.getString("LOSBS");
String KTEXT = maraTable.getString("KTEXT");
String VORNR = maraTable.getString("VORNR");
String STEUS = maraTable.getString("STEUS");
String KTSCH = maraTable.getString("KTSCH");
String LTXA1 = maraTable.getString("LTXA1");
String ANDAT = maraTable.getString("ANDAT");
String ANNAM = maraTable.getString("ANNAM");
String AEDAT = maraTable.getString("AEDAT");
String AENAM = maraTable.getString("AENAM");
String ARBPL = maraTable.getString("ARBPL");
String UMREN = maraTable.getString("UMREN");
String UMREZ = maraTable.getString("UMREZ");
String BMSCH = maraTable.getString("BMSCH");
String MEINH = maraTable.getString("MEINH");
String LAR01 = maraTable.getString("LAR01");
String VGW01 = maraTable.getString("VGW01");
String VGE01 = maraTable.getString("VGE01");
String VGW02 = maraTable.getString("VGW02");
String VGE02 = maraTable.getString("VGE02");
String VGW03 = maraTable.getString("VGW03");
String VGE03 = maraTable.getString("VGE03");
String VGW04 = maraTable.getString("VGW04");
String VGE04 = maraTable.getString("VGE04");
String VGW05 = maraTable.getString("VGW05");
String VGE05 = maraTable.getString("VGE05");
String VGW06 = maraTable.getString("VGW06");
String VGE06 = maraTable.getString("VGE06");
String UEMUS = maraTable.getString("UEMUS");
String UEKAN = maraTable.getString("UEKAN");
String FLIES = maraTable.getString("FLIES");
String SPMUS = maraTable.getString("SPMUS");
String SPLIM = maraTable.getString("SPLIM");
String CKSELKZ = maraTable.getString("CKSELKZ");
//根据工厂切换数据源
String poolName = sapSysUserMapper.getPoolName(WERKS);
String[] split = poolName.split("=");
System.out.println(split[1]);
DynamicDataSourceContextHolder.push(split[1]);
proRoute.setRouteCode(PLNNR);
proRoute.setRouteName(KTEXT);
proRoute.setCreateBy(ANNAM);
proRoute.setRouteDesc(KTEXT);
proRoute.setTecMan(VGW01);
proRoute.setTecManUnit(VGE01);
proRoute.setTecMachine(VGW02);
proRoute.setTecMachineUnit(VGE02);
proRoute.setTecDepreciation(VGW03);
proRoute.setTecDepreciationUnit(VGE03);
proRoute.setTecOther(VGW04);
proRoute.setTecOtherUnit(VGE04);
proRoute.setTecConfAcivity5(VGW05);
proRoute.setTecConfAcivity5Unit(VGE05);
proRoute.setTecConfAcivity6(VGW06);
proRoute.setTecConfAcivity6Unit(VGE06);
proRoute.setAttr1(Integer.valueOf(i).toString());
proRoute.setRouteId(UUID.randomUUID().toString().replaceAll("-",""));
proRoute.setEnableFlag("Y");
if (proRoute.getRouteName().isEmpty()){
proRoute.setRouteName("无");
}
// proRouteList.add(i,proRoute);
if (proRoute.getRouteName()!="无"){
{
System.out.println(sapProRouteMapper.selectProRouteByRouteCode(proRoute.getRouteCode()));
if (sapProRouteMapper.selectProRouteByRouteCode(proRoute.getRouteCode())==0){
proRoute.setRouteId(UUID.randomUUID().toString().replaceAll("-",""));
sapProRouteMapper.insertProRoute(proRoute);
arr1 = 1;
}
else{
sapProRouteMapper.updateProRoute(proRoute);
arr1=0;
System.out.println(i);
}
}}
proProcess.setProcessId(UUID.randomUUID().toString().replaceAll("-",""));
proProcess.setProcessName(LTXA1);
proProcess.setProcessCode(LTXA1);
proProcess.setAttention(LTXA1);
proProcess.setEnableFlag("Y");
proProcess.setWorkCenter(ARBPL);
proProcess.setAttr1(Integer.valueOf(i).toString());
proProcess.setCreateTime(DateUtils.dateTime("yyyy-MM-dd", ANDAT));
proProcess.setCreateBy(ANNAM);
proProcess.setUpdateBy(AENAM);
if (proProcess.getProcessCode()!=null){
if (sapProProcessMapper.selectProProcessByProcessName(proProcess.getProcessName())==0){
proProcess.setProcessId(UUID.randomUUID().toString().replaceAll("-",""));
sapProProcessMapper.insertProProcess(proProcess);
arr2 = 1;
}
else{
sapProProcessMapper.updateProProcess(proProcess);
arr2 = 0;
}
}
//
if (arr1==1&&arr2==1){
proRouteProcess.setRecordId(UUID.randomUUID().toString().replace("-",""));
proRouteProcess.setRouteId(proRoute.getRouteId());
proRouteProcess.setProcessId(proProcess.getProcessId());
proRouteProcess.setAttr1(Integer.valueOf(i).toString());
proRouteProcess.setProcessCode(proProcess.getProcessCode());
proRouteProcess.setProcessName(proProcess.getProcessName());
proRouteProcess.setOrderNum(1);
proRouteProcess.setCreateTime(DateUtils.dateTime(("yyyy-MM-dd"),ANDAT));
proRouteProcess.setCreateBy(ANNAM);
proRouteProcess.setUpdateBy(AENAM);
sapProRouteProcessMapper.insertProRouteProcess(proRouteProcess);
}
else {
proRouteProcess.setRouteId(proRoute.getRouteId());
proRouteProcess.setProcessId(proProcess.getProcessId());
proRouteProcess.setAttr1(Integer.valueOf(i).toString());
proRouteProcess.setProcessCode(proProcess.getProcessCode());
proRouteProcess.setProcessName(proProcess.getProcessName());
proRouteProcess.setOrderNum(1);
proRouteProcess.setCreateTime(DateUtils.dateTime(("yyyy-MM-dd"),ANDAT));
proRouteProcess.setCreateBy(ANNAM);
proRouteProcess.setUpdateBy(AENAM);
sapProRouteProcessMapper.updateProRouteProcess(proRouteProcess);
}
// //根据routecode去重
//
// for (int i = 0; i < proRouteList.size(); i++) {
//
//
// }
// //quchong
//
// for (int i = 0; i < proProcessList.size(); i++) {
// if (!proProcessList.get(i).getProcessCode().isEmpty()){
// proProcessList.get(i).setProcessId(UUID.randomUUID().toString().replaceAll("-",""));
// sapProProcessMapper.insertProProcess(proProcessList.get(i));
//// System.out.println(proProcessList.get(i));
// }
// }
// proProcessContentList = proProcessContentList.stream().collect(Collectors.collectingAndThen
// (Collectors.toCollection(() ->new TreeSet<>(Comparator.comparing(SapProProcessContent::getContentText))),
// ArrayList::new));
// for (int j=0; j<proProcessContentList.size(); j++) {
// if (!proProcessContentList.get(j).getContentText().isEmpty()){
// sapProProcessContentMapper.insertProProcessContent(proProcessContentList.get(j));
// }}
// proRouteProcessList = proRouteProcessList.stream().collect(Collectors.collectingAndThen
// (Collectors.toCollection(() ->new TreeSet<>(Comparator.comparing(SapProRouteProcess::getProcessCode))),
// ArrayList::new));
// for (int k = 0;k<proRouteProcessList.size();k++){
// if (!proRouteProcessList.get(k).getProcessCode().isEmpty()){
// sapProRouteProcessMapper.insertProRouteProcess(proRouteProcessList.get(k));
// }}
// proRouteProcessList = proRouteProcessList.stream().collect(Collectors.collectingAndThen
// (Collectors.toCollection(() ->new TreeSet<>(Comparator.comparing(SapProRouteProcess::getProcessCode))),
// ArrayList::new));
// for (int k = 0;k<proRouteProcessList.size();k++){
// if (!proRouteProcessList.get(k).getProcessCode().isEmpty()){ sapProRouteProcessMapper.insertProRouteProcess(proRouteProcessList.get(k));}
// if (proRouteList.get(k).getRouteName()!="无"){ sapProRouteMapper.insertProRoute(proRouteList.get(k)); }
// if (!proProcessList.get(k).getProcessCode().isEmpty()){ sapProProcessMapper.insertProProcess(proProcessList.get(k)); }
// if (!proProcessContentList.get(k).getContentText().isEmpty()){ sapProProcessContentMapper.insertProProcessContent(proProcessContentList.get(k)); }
// }
}}
catch (Exception e){
return R.fail(e.getMessage());
}
return R.ok();
}
// public static void main(String[] args) throws JCoException {
// // 连接
// SapConn con = new SapConn(
// "192.168.0.53",
// "00",
// "800",
// "MES",
// "123456",
// "zh",
// "true",
// "20",
// ""
// );
// JCoDestination jCoDestination = SAPConnUtils.connect(con);
// // 获取调用 RFC 函数对象
// JCoFunction func = jCoDestination.getRepository().getFunction("ZPPR_MES_PRO_TO");
// // 配置传入参数
// JCoParameterList importParameterList = func.getImportParameterList();
// System.out.println(importParameterList.getListMetaData());
// // importParameterList.setValue("S_ERDAT","2019-11-07" );
// // 调用并获取返回值
// func.execute(jCoDestination);
// // 获取 内表 - ZMES_PRO
// JCoTable maraTable = func.getTableParameterList().getTable("ZMES_PRO");
// JCoRecordMetaData metaData = maraTable.getRecordMetaData();
// System.out.println("###" + metaData.toString());
// SapProOrder proOrder = new SapProOrder();
// List<SapProOrder> proOrderList = new ArrayList<>();
// for (int i = 0; i < maraTable.getNumRows(); i++) {
// maraTable.setRow(i);
// String AUFNR = maraTable.getString("AUFNR");
// String AUART = maraTable.getString("AUART");
// String MAUFNR = maraTable.getString("MAUFNR");
// String PLNBEZ = maraTable.getString("PLNBEZ");
// String MAKTX = maraTable.getString("MAKTX");
// String PWERK = maraTable.getString("PWERK");
// String GAMNG = maraTable.getString("GAMNG");
// String GMEIN = maraTable.getString("GMEIN");
// String PLNNR = maraTable.getString("PLNNR");
// String GSTRP = maraTable.getString("GSTRP");
// String GLTRP = maraTable.getString("GLTRP");
// String ERNAM = maraTable.getString("ERNAM");
// String ERDAT = maraTable.getString("ERDAT");
// String STTXT = maraTable.getString("STTXT");
// System.out.println("订单号:" +AUFNR+" - 订单类型:" + AUART+ " - 上级订单编号:" + MAUFNR+ " - 物料号:" + PLNBEZ+ " - 物料描述(短文本):" + MAKTX
// + " - 订单的计划工厂:" + PWERK+ " - 订单数量总计:" + GAMNG+ " - 基本计量单位:" + GMEIN+ " - 任务清单组码:" + PLNNR+ " - 基本开始日期:" + GSTRP
// + " - 基本完成日期:" + GLTRP+ " - 输入者:" + ERNAM+ " - 创建日期:" + ERDAT+ " - 系统状态:" + STTXT);
// }
// // 循环输出 Table 数据
//// for (int i = 0; i < maraTable.getNumRows(); i++) {
//// maraTable.setRow(i);
//// String MATNR = maraTable.getString("MATNR");
//// String MAKTX = maraTable.getString("MAKTX");
//// String EAN11 = maraTable.getString("EAN11");
//// String MTART = maraTable.getString("MTART");
//// String MTBEZ = maraTable.getString("MTBEZ");
//// String MATKL = maraTable.getString("MATKL");
//// String WGBEZ = maraTable.getString("WGBEZ");
//// String BRGEW = maraTable.getString("BRGEW");
//// String NTGEW = maraTable.getString("NTGEW");
//// String VOLUM = maraTable.getString("VOLUM");
//// String VOLEH = maraTable.getString("VOLEH");
//// String MEINS = maraTable.getString("MEINS");
//// String MEINH = maraTable.getString("MEINH");
//// String UMREZ = maraTable.getString("UMREZ");
//// String UMREN = maraTable.getString("UMREN");
//// String LVORM = maraTable.getString("LVORM");
//// String MENGE = maraTable.getString("MENGE");
//// String MHDHB = maraTable.getString("MHDHB");
//// String SPART = maraTable.getString("SPART");
//// String SPART_NM = maraTable.getString("SPART_NM");
//// String MVGR1 = maraTable.getString("MVGR1");
//// String MVGR1_NM = maraTable.getString("MVGR1_NM");
//// String MVGR2 = maraTable.getString("MVGR2");
//// String MVGR2_NM = maraTable.getString("MVGR2_NM");
//// String MVGR3 = maraTable.getString("MVGR3");
//// String MVGR3_NM = maraTable.getString("MVGR3_NM");
//// String MVGR4 = maraTable.getString("MVGR4");
//// String MVGR4_NM = maraTable.getString("MVGR4_NM");
//// String MVGR5 = maraTable.getString("MVGR5");
//// String MVGR5_NM = maraTable.getString("MVGR5_NM");
//// System.out.println("物料号:" + MATNR + " - 物料描述:" + MAKTX + " - 国际文件号(EAN/UPC)" + EAN11 + " - 物料类型:" + MTART );
//// }
// }
}
Loading…
Cancel
Save