|
|
|
@ -75,12 +75,14 @@ public class SapRouterServiceImpl implements SapRouterService {
|
|
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
log.info("工艺路线同步入参-------" + sapRouterQuery.toString());
|
|
|
|
|
if (!StringUtils.isNull(sapRouterQuery.getMatnr())) {
|
|
|
|
|
if (sapRouterQuery.getMatnr()!=null&&sapRouterQuery.getMatnr().size()>0) {
|
|
|
|
|
JCoTable S_MATNR = func.getTableParameterList().getTable("S_MATNR");
|
|
|
|
|
S_MATNR.appendRow();
|
|
|
|
|
S_MATNR.setValue("SIGN", "I");
|
|
|
|
|
S_MATNR.setValue("OPTION", "EQ");
|
|
|
|
|
S_MATNR.setValue("LOW", sapRouterQuery.getMatnr());
|
|
|
|
|
for (String matnr:sapRouterQuery.getMatnr()){
|
|
|
|
|
S_MATNR.appendRow();
|
|
|
|
|
S_MATNR.setValue("SIGN", "I");
|
|
|
|
|
S_MATNR.setValue("OPTION", "EQ");
|
|
|
|
|
S_MATNR.setValue("LOW", matnr);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (!StringUtils.isNull(sapRouterQuery.getWerks())) {
|
|
|
|
|
JCoTable S_WERKS = func.getTableParameterList().getTable("S_WERKS");
|
|
|
|
@ -114,15 +116,14 @@ public class SapRouterServiceImpl implements SapRouterService {
|
|
|
|
|
S_AEDAT.setValue("LOW", sapRouterQuery.getAedat());
|
|
|
|
|
S_AEDAT.setValue("HIGH", END_DATE);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
System.out.println(func.getTableParameterList().getTable("S_MATNR"));
|
|
|
|
|
|
|
|
|
|
func.execute(dest);//执行调用函数
|
|
|
|
|
// 获取 内表 - ZMES_PRO
|
|
|
|
|
JCoTable maraTable = func.getTableParameterList().getTable("LT_ROUTING");
|
|
|
|
|
JCoRecordMetaData metaData = maraTable.getRecordMetaData();
|
|
|
|
|
// System.out.println("###" + metaData.toString());
|
|
|
|
|
List<SapProRoute> sapProRouteList = new ArrayList<>();
|
|
|
|
|
//DynamicDataSourceContextHolder.push("ds_1000");//controller已经完成切换
|
|
|
|
|
DynamicDataSourceContextHolder.push("ds_"+sapRouterQuery.getWerks());
|
|
|
|
|
for (int i = 0; i < maraTable.getNumRows(); i++) {
|
|
|
|
|
SapProProcess sapProProcess = new SapProProcess();
|
|
|
|
|
maraTable.setRow(i);
|
|
|
|
@ -200,7 +201,7 @@ public class SapRouterServiceImpl implements SapRouterService {
|
|
|
|
|
"计量单位03:" + VGE03 +
|
|
|
|
|
"标准值04(其它):" + VGW04 +
|
|
|
|
|
" 计量单位04:" + VGE04);
|
|
|
|
|
//工艺路线下的工序
|
|
|
|
|
// 工艺路线下的工序
|
|
|
|
|
if (StringUtil.isBlank(PLNNR)) {
|
|
|
|
|
throw new ServiceException("任务清单组码不能为空");
|
|
|
|
|
}
|
|
|
|
@ -229,6 +230,7 @@ public class SapRouterServiceImpl implements SapRouterService {
|
|
|
|
|
String routerid = IdUtils.fastSimpleUUID();
|
|
|
|
|
sapProRoute.setRouteId(routerid);
|
|
|
|
|
sapProRoute.setRouteCode(PLNNR);
|
|
|
|
|
sapProRoute.setProductCode(MATNR);
|
|
|
|
|
sapProRoute.setRouteName(KTEXT);
|
|
|
|
|
sapProRoute.setRouteDesc(KTEXT);
|
|
|
|
|
sapProRoute.setEnableFlag("Y");
|
|
|
|
@ -277,9 +279,9 @@ public class SapRouterServiceImpl implements SapRouterService {
|
|
|
|
|
//更新工艺路线
|
|
|
|
|
else {
|
|
|
|
|
sapProRoute.setRouteName(KTEXT);
|
|
|
|
|
sapProRoute.setProductCode(MATNR);
|
|
|
|
|
sapProRoute.setRouteDesc(KTEXT);
|
|
|
|
|
sapProRoute.setEnableFlag("Y");
|
|
|
|
|
|
|
|
|
|
//机器
|
|
|
|
|
sapProRoute.setTecMachine(VGW01);
|
|
|
|
|
sapProRoute.setTecMachineUnit(VGE01);
|
|
|
|
@ -296,59 +298,6 @@ public class SapRouterServiceImpl implements SapRouterService {
|
|
|
|
|
sapProRoute.setUpdateTime(DateUtils.getNowDate());
|
|
|
|
|
sapProRouteMapper.updateProRoute(sapProRoute);
|
|
|
|
|
}
|
|
|
|
|
// else{
|
|
|
|
|
// //验证是否存在工序
|
|
|
|
|
// sapProProcess.setProcessName(LTXA1);
|
|
|
|
|
// SapProProcess operation = sapProProcessMapper.selectProProcessByProcessName(sapProProcess);
|
|
|
|
|
// //验证产品是否存在
|
|
|
|
|
// SapBaseProduct sapBaseProduct=new SapBaseProduct();
|
|
|
|
|
// sapBaseProduct.setProductCode(MATNR);
|
|
|
|
|
// sapBaseProduct = sapBaseProductMapper.selectBaseProductByProductCode(sapBaseProduct);
|
|
|
|
|
// if (StringUtils.isNull(operation)){
|
|
|
|
|
// failureNum++;
|
|
|
|
|
// failureMsg.append(failureNum+"、工艺路线【" + PLNNR + "】下的工序【" + LTXA1 + "】不存在!");
|
|
|
|
|
// }
|
|
|
|
|
// else if (StringUtils.isNull(sapBaseProduct)){
|
|
|
|
|
// failureNum++;
|
|
|
|
|
// failureMsg.append(failureNum+"、工艺路线【" + PLNNR + "】下的物料【" + MATNR + "】不存在!");
|
|
|
|
|
// }
|
|
|
|
|
// else if(!StringUtils.isNull(operation) && !StringUtils.isNull(sapBaseProduct)) {
|
|
|
|
|
// //验证是否存在工艺路线和工序的关系
|
|
|
|
|
// SapProRouteProcess sapProRouteProcess = new SapProRouteProcess();
|
|
|
|
|
// sapProRouteProcess.setRouteId(sapProRoute.getRouteId());
|
|
|
|
|
// sapProRouteProcess.setProcessId(operation.getProcessId());
|
|
|
|
|
// List<SapProRouteProcess> sapProRouteProcessList = sapProRouteProcessMapper.selectProRouteProcessList(sapProRouteProcess);
|
|
|
|
|
// if (sapProRouteProcessList .size()==0) {
|
|
|
|
|
// //增加工艺路线和工序的关系
|
|
|
|
|
// sapProRouteProcess.setRecordId(IdUtils.fastSimpleUUID());
|
|
|
|
|
// sapProRouteProcess.setRouteId(sapProRoute.getRouteId());
|
|
|
|
|
// sapProRouteProcess.setProcessId(operation.getProcessId());
|
|
|
|
|
// sapProRouteProcess.setProcessCode(operation.getProcessCode());
|
|
|
|
|
// sapProRouteProcess.setProcessName(operation.getProcessName());
|
|
|
|
|
// sapProRouteProcess.setOrderNum(1);
|
|
|
|
|
// sapProRouteProcess.setCreateTime(DateUtils.dateTime("yyyy-MM-dd", ANDAT));
|
|
|
|
|
// sapProRouteProcess.setCreateBy(ANNAM);
|
|
|
|
|
// sapProRouteProcessMapper.insertProRouteProcess(sapProRouteProcess);
|
|
|
|
|
// }
|
|
|
|
|
// //验证是否存在工艺路线和物料的关系
|
|
|
|
|
// SapProRouteProduct sapProRouteProduct = new SapProRouteProduct();
|
|
|
|
|
// sapProRouteProduct.setRouteId(sapProRoute.getRouteId());
|
|
|
|
|
// sapProRouteProduct.setItemCode(MATNR);
|
|
|
|
|
// List<SapProRouteProduct> sapProRouteProductList = sapProRouteProductMapper.selectProRouteProductList(sapProRouteProduct);
|
|
|
|
|
// if (sapProRouteProductList .size()==0) {
|
|
|
|
|
// sapProRouteProduct.setRecordId(IdUtils.fastSimpleUUID());
|
|
|
|
|
// sapProRouteProduct.setRouteId(sapProRoute.getRouteId());
|
|
|
|
|
// sapProRouteProduct.setItemId(sapBaseProduct.getProductId());
|
|
|
|
|
// sapProRouteProduct.setItemCode(MATNR);
|
|
|
|
|
// sapProRouteProduct.setItemName(sapBaseProduct.getProductDescZh());
|
|
|
|
|
// sapProRouteProduct.setCreateBy(ANNAM);
|
|
|
|
|
// sapProRouteProduct.setCreateTime(DateUtils.dateTime("yyyy-MM-dd", ANDAT));
|
|
|
|
|
// sapProRouteProductMapper.insertProRouteProduct(sapProRouteProduct);
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (failureNum > 0) {
|
|
|
|
|