From f355fc52750f7d3cd70ccedeb6f0e48aa5047b2a Mon Sep 17 00:00:00 2001 From: fengyuan_yang <1976974459@qq.com> Date: Fri, 20 Dec 2024 13:55:20 +0800 Subject: [PATCH] =?UTF-8?q?2024-12-20=20=E6=8E=A5=E5=8F=A3=E6=9B=B4?= =?UTF-8?q?=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../part/mapper/RoutingManagementMapper.java | 2 +- .../impl/BomManagementServiceImpl.java | 8 +- .../impl/PartInformationServiceImpl.java | 8 +- .../impl/RoutingManagementServiceImpl.java | 251 ++++++++---------- .../mapper/part/RoutingManagementMapper.xml | 30 ++- 5 files changed, 130 insertions(+), 169 deletions(-) diff --git a/src/main/java/com/spring/modules/part/mapper/RoutingManagementMapper.java b/src/main/java/com/spring/modules/part/mapper/RoutingManagementMapper.java index 8f3d5f42..c698fa6a 100644 --- a/src/main/java/com/spring/modules/part/mapper/RoutingManagementMapper.java +++ b/src/main/java/com/spring/modules/part/mapper/RoutingManagementMapper.java @@ -137,7 +137,7 @@ public interface RoutingManagementMapper extends BaseMapper void saveRoutingComponents(List ifsRoutingComponentList); - List getRoutingToolByAlternative(RoutingDetailVo routingDetailVo); + List getRoutingToolByAlternative(RoutingDetailVo routingDetailVo); List getGuideLineByAlternative(RoutingDetailVo routingDetailVo); diff --git a/src/main/java/com/spring/modules/part/service/impl/BomManagementServiceImpl.java b/src/main/java/com/spring/modules/part/service/impl/BomManagementServiceImpl.java index bbb3b6a2..60edf2b2 100644 --- a/src/main/java/com/spring/modules/part/service/impl/BomManagementServiceImpl.java +++ b/src/main/java/com/spring/modules/part/service/impl/BomManagementServiceImpl.java @@ -1161,6 +1161,7 @@ public class BomManagementServiceImpl extends ServiceImpl updateBomManufStructCostDistribResponse = bomServiceBean.modifyBomDistribution(srv, bomIfsManufStructCostDistrib); + if (!"200".equals(updateBomManufStructCostDistribResponse.get("resultCode"))) { + throw new RuntimeException("IFS Bom副产品成本分配修改异常:" + updateBomManufStructCostDistribResponse.get("resultMsg")); } } } diff --git a/src/main/java/com/spring/modules/part/service/impl/PartInformationServiceImpl.java b/src/main/java/com/spring/modules/part/service/impl/PartInformationServiceImpl.java index 12c368b1..b8fa6f02 100644 --- a/src/main/java/com/spring/modules/part/service/impl/PartInformationServiceImpl.java +++ b/src/main/java/com/spring/modules/part/service/impl/PartInformationServiceImpl.java @@ -2991,7 +2991,6 @@ public class PartInformationServiceImpl extends ServiceImpl bomIfsManufStructCostDistribs = new ArrayList<>(); for (BomManufStructCostDistribVo bomManufStructCostDistribVo : collect1) { @@ -3008,10 +3007,9 @@ public class PartInformationServiceImpl extends ServiceImpl updateBomManufStructCostDistribResponse = bomServiceBean.modifyBomDistributions(srv, bomIfsManufStructCostDistribs); + if (!"200".equals(updateBomManufStructCostDistribResponse.get("resultCode"))) { + throw new RuntimeException("IFS Bom副产品成本分配修改异常:" + updateBomManufStructCostDistribResponse.get("resultMsg")); } } } diff --git a/src/main/java/com/spring/modules/part/service/impl/RoutingManagementServiceImpl.java b/src/main/java/com/spring/modules/part/service/impl/RoutingManagementServiceImpl.java index a41303d0..4b3c83c8 100644 --- a/src/main/java/com/spring/modules/part/service/impl/RoutingManagementServiceImpl.java +++ b/src/main/java/com/spring/modules/part/service/impl/RoutingManagementServiceImpl.java @@ -10,6 +10,7 @@ import com.spring.common.utils.DateUtils; import com.spring.common.utils.PageUtils; import com.spring.ifs.api.IfsServer; import com.spring.ifs.bean.BaseSearchBean; +import com.spring.ifs.bean.RoutingServiceBean; import com.spring.ifs.data.PartCatalog; import com.spring.modules.base.entity.PersonnelLevel; import com.spring.modules.base.utils.DataUtils; @@ -69,6 +70,9 @@ public class RoutingManagementServiceImpl extends ServiceImpl().eq("username", username)); + if (ifsUser == null || !org.apache.commons.lang3.StringUtils.isNotBlank(ifsUser.getIfsUsername()) || !org.apache.commons.lang3.StringUtils.isNotBlank(ifsUser.getIfsPassword())) { + throw new RuntimeException("获取用户的IFS账号密码为空值!"); + } + Server srv = ifsServer.getIfsServer(ifsUser.getUsername(), ifsUser.getPassword()); + return srv; + } + /** * routing列表查询 * @param data @@ -139,17 +155,15 @@ public class RoutingManagementServiceImpl extends ServiceImpl().eq("site", data.getSite()).eq("part_no", data.getPartNo()).eq("routing_revision", data.getRoutingRevision()).eq("routing_type", data.getRoutingType())); // 判断是否为正式的routingHeader if ("Y".equals(RoutingHeader.getOfficialFlag())) { - // 同步ifs + Server srv = getIfsServer(data.getUpdateBy()); RoutingIfsHeader routingIfsHeader = new RoutingIfsHeader(data); - String updateRoutingHeaderURL = apiUrl + "/routing/ifs/modifyRoutingHeaderToIfs"; - ResponseData updateRoutingHeaderResponse = HttpClientUtil.doPostByRawWithPLM(updateRoutingHeaderURL, routingIfsHeader); - if (!"200".equals(updateRoutingHeaderResponse.getCode())) { - throw new RuntimeException("IFS RoutingHeader修改异常:" + updateRoutingHeaderResponse.getMsg()); + Map updateRoutingHeaderResponse = routingServiceBean.modifyRoutingHeader(srv, routingIfsHeader); + if (!"200".equals(updateRoutingHeaderResponse.get("resultCode"))) { + throw new RuntimeException("IFS RoutingHeader修改异常:" + updateRoutingHeaderResponse.get("resultMsg")); } } } @@ -164,17 +178,15 @@ public class RoutingManagementServiceImpl extends ServiceImpl().eq("site", data.getSite()).eq("part_no", data.getPartNo()).eq("routing_revision", data.getRoutingRevision()).eq("routing_type", data.getRoutingType())); // 判断是否为正式的routingHeader if ("Y".equals(RoutingHeader.getOfficialFlag())) { - // 同步ifs + Server srv = getIfsServer(data.getUpdateBy()); RoutingIfsHeader routingIfsHeader = new RoutingIfsHeader(data); - String updateRoutingHeaderURL = apiUrl + "/routing/ifs/modifyRoutingHeaderToIfs"; - ResponseData updateRoutingHeaderResponse = HttpClientUtil.doPostByRawWithPLM(updateRoutingHeaderURL, routingIfsHeader); - if (!"200".equals(updateRoutingHeaderResponse.getCode())) { - throw new RuntimeException("IFS RoutingHeader修改异常:" + updateRoutingHeaderResponse.getMsg()); + Map updateRoutingHeaderResponse = routingServiceBean.modifyRoutingHeader(srv, routingIfsHeader); + if (!"200".equals(updateRoutingHeaderResponse.get("resultCode"))) { + throw new RuntimeException("IFS RoutingHeader修改异常:" + updateRoutingHeaderResponse.get("resultMsg")); } } } @@ -233,11 +245,9 @@ public class RoutingManagementServiceImpl extends ServiceImpl map = new HashMap<>(); // 查询明细 List detailList = routingManagementMapper.queryRoutingDetail(data); - // 查询子明细 RoutingDetailEntity detailEntity = new RoutingDetailEntity(); BeanUtils.copyProperties(data, detailEntity); - // 如果传值有替代编码,则查指定的替代 if ((StringUtils.isNotBlank(data.getAlternativeNo()))) { detailEntity.setAlternativeNo(data.getAlternativeNo()); @@ -258,9 +268,7 @@ public class RoutingManagementServiceImpl extends ServiceImpl componentList = routingManagementMapper.queryRoutingComponent(detailEntity); - // 返回值 map.put("detailList",detailList); map.put("componentList",componentList); @@ -324,16 +332,14 @@ public class RoutingManagementServiceImpl extends ServiceImpl updateRoutingDetailResponse = routingServiceBean.modifyRoutingAlternative(srv, routingIfsDetail); + if (!"200".equals(updateRoutingDetailResponse.get("resultCode"))) { + throw new RuntimeException("IFS RoutingAlternative修改异常:" + updateRoutingDetailResponse.get("resultMsg")); } } } @@ -364,21 +370,18 @@ public class RoutingManagementServiceImpl extends ServiceImpl routingDetailDelete(RoutingDetailEntity data) { HashMap map = new HashMap<>(); - if (dataUrl) { // 判断该替代是否为正式替代 List routingDetailList = routingManagementMapper.checkRoutingDetailOnlyOne(data); if ("Y".equals(routingDetailList.get(0).getOfficialFlag())) { - // ifs删除bomDetail + Server srv = getIfsServer(data.getUpdateBy()); RoutingIfsAlternative routingIfsDetail = getIfsRoutingDetail(routingDetailList.get(0)); - String deleteRoutingDetailURL = apiUrl + "/routing/ifs/removeRoutingAlternativeToIfs"; - ResponseData deleteRoutingDetailResponse = HttpClientUtil.doPostByRawWithPLM(deleteRoutingDetailURL, routingIfsDetail); - if (!"200".equals(deleteRoutingDetailResponse.getCode())) { - throw new RuntimeException("IFS RoutingAlternative删除异常:" + deleteRoutingDetailResponse.getMsg()); + Map deleteRoutingDetailResponse = routingServiceBean.removeRoutingAlternative(srv, routingIfsDetail); + if (!"200".equals(deleteRoutingDetailResponse.get("resultCode"))) { + throw new RuntimeException("IFS RoutingAlternative删除异常:" + deleteRoutingDetailResponse.get("resultMsg")); } } } - // 删除替代 routingManagementMapper.routingDetailDelete(data); // 删除该替代的子明细 @@ -448,28 +451,24 @@ public class RoutingManagementServiceImpl extends ServiceImpl buildRoutingDetailResponse = routingServiceBean.buildRoutingAlternative(srv, routingIfsDetail); + if (!"200".equals(buildRoutingDetailResponse.get("resultCode"))) { + throw new RuntimeException("IFS RoutingAlternative Build异常:" + buildRoutingDetailResponse.get("resultMsg")); } } else if ("Obsolete".equals(data.getStatus())) { // 状态修改为Obsolete - String retireRoutingDetailURL = apiUrl + "/routing/ifs/retireRoutingAlternativeToIfs"; - ResponseData retireRoutingDetailResponse = HttpClientUtil.doPostByRawWithPLM(retireRoutingDetailURL, routingIfsDetail); - if (!"200".equals(retireRoutingDetailResponse.getCode())) { - throw new RuntimeException("IFS RoutingAlternative Retire异常:" + retireRoutingDetailResponse.getMsg()); + Map retireRoutingDetailResponse = routingServiceBean.retireRoutingAlternative(srv, routingIfsDetail); + if (!"200".equals(retireRoutingDetailResponse.get("resultCode"))) { + throw new RuntimeException("IFS RoutingAlternative Retire异常:" + retireRoutingDetailResponse.get("resultMsg")); } } } } - // 修改替代状态 routingManagementMapper.updateAlternativeStatus(data); // 查询替代列表 @@ -561,7 +560,6 @@ public class RoutingManagementServiceImpl extends ServiceImpl checkList = routingManagementMapper.checkRoutingDetailOnlyOne(routingDetailEntity); if ("Y".equals(checkList.get(0).getOfficialFlag())) { // 查工序的rowKey rowVersion + Server srv = getIfsServer(data.getCreateBy()); RoutingComponentEntity componentEntity = routingManagementMapper.getRoutingComponentRowKeyAndVersion(data.getOperationId()); LinkedList routingIfsTools = new LinkedList<>(); RoutingIfsTool routingIfsTool = new RoutingIfsTool(data); @@ -576,12 +575,11 @@ public class RoutingManagementServiceImpl extends ServiceImpl saveRoutingToolResponse = routingServiceBean.syncRoutingTools(srv, routingIfsTools); + if (!"200".equals(saveRoutingToolResponse.get("resultCode"))) { + throw new RuntimeException("IFS RoutingTool 新增异常:" + saveRoutingToolResponse.get("resultMsg")); } - String s = String.valueOf(saveRoutingToolResponse.getObj()); + String s = String.valueOf(saveRoutingToolResponse.get("obj")); List routingTool = JSON.parseArray(s, RoutingIfsTool.class); if (!routingTool.isEmpty()) { for (RoutingIfsTool ifsTool : routingTool) { // 修改ifs关键字 @@ -658,14 +656,14 @@ public class RoutingManagementServiceImpl extends ServiceImpl checkList = routingManagementMapper.checkRoutingDetailOnlyOne(routingDetailEntity); if ("Y".equals(checkList.get(0).getOfficialFlag())) { + Server srv = getIfsServer(data.getUpdateBy()); RoutingIfsTool routingIfsTool = routingManagementMapper.getRoutingToolToIfs(data); - String updateRoutingToolURL = apiUrl + "/routing/ifs/modifyRoutingIfsToolToIfs"; - ResponseData updateRoutingToolResponse = HttpClientUtil.doPostByRawWithPLM(updateRoutingToolURL, routingIfsTool); - if (!"200".equals(updateRoutingToolResponse.getCode())) { - throw new RuntimeException("IFS RoutingTool修改异常:" + updateRoutingToolResponse.getMsg()); + Map updateRoutingToolResponse = routingServiceBean.modifyRoutingTool(srv, routingIfsTool); + if (!"200".equals(updateRoutingToolResponse.get("resultCode"))) { + throw new RuntimeException("IFS RoutingTool修改异常:" + updateRoutingToolResponse.get("resultMsg")); } // 更新 ifs_row_id ifs_row_version - String s = String.valueOf(updateRoutingToolResponse.getObj()); + String s = String.valueOf(updateRoutingToolResponse.get("obj")); RoutingIfsTool routingTool = JSON.parseObject(s, RoutingIfsTool.class); if (routingTool != null) { data.setIfsRowId(routingTool.getIfsRowId()); @@ -719,13 +717,12 @@ public class RoutingManagementServiceImpl extends ServiceImpl deleteRoutingToolResponse = routingServiceBean.removeRoutingTools(srv, routingIfsTools); + if (!"200".equals(deleteRoutingToolResponse.get("resultCode"))) { + throw new RuntimeException("IFS RoutingTool删除异常:" + deleteRoutingToolResponse.get("resultMsg")); } } } @@ -768,11 +765,11 @@ public class RoutingManagementServiceImpl extends ServiceImpl updateRoutingHeaderResponse = routingServiceBean.modifyRoutingHeader(srv, routingIfsHeader); + if (!"200".equals(updateRoutingHeaderResponse.get("resultCode"))) { + throw new RuntimeException("IFS RoutingHeader修改异常:" + updateRoutingHeaderResponse.get("resultMsg")); } } } @@ -839,16 +836,15 @@ public class RoutingManagementServiceImpl extends ServiceImpl routingDetailList = routingManagementMapper.queryRoutingDetailOfficialFlag(data); if ("Y".equals(routingDetailList.get(0).getOfficialFlag())) { - // 同步ifs + Server srv = getIfsServer(data.getCreateBy()); LinkedList routingIfsItems = new LinkedList<>(); RoutingIfsItem routingIfsItem = getIfsRoutingComponent(data); routingIfsItems.add(routingIfsItem); - String addRoutingComponentURL = apiUrl + "/routing/ifs/syncRoutingIfsItemsToIfs"; - ResponseData addRoutingComponentResponse = HttpClientUtil.doPostByRawWithPLM(addRoutingComponentURL, routingIfsItems); - if (!"200".equals(addRoutingComponentResponse.getCode())) { - throw new RuntimeException("IFS RoutingItem新增异常:" + addRoutingComponentResponse.getMsg()); + Map addRoutingComponentResponse = routingServiceBean.syncRoutingItems(srv, routingIfsItems); + if (!"200".equals(addRoutingComponentResponse.get("resultCode"))) { + throw new RuntimeException("IFS RoutingItem新增异常:" + addRoutingComponentResponse.get("resultMsg")); } - String s = String.valueOf(addRoutingComponentResponse.getObj()); + String s = String.valueOf(addRoutingComponentResponse.get("obj")); List ifsItems = JSON.parseArray(s, RoutingIfsItem.class); if (!ifsItems.isEmpty()) { data.setIfsRowId(ifsItems.get(0).getIfsRowId()); @@ -885,15 +881,14 @@ public class RoutingManagementServiceImpl extends ServiceImpl routingDetailList = routingManagementMapper.queryRoutingDetailOfficialFlag(data); if (!routingDetailList.isEmpty() && "Y".equals(routingDetailList.get(0).getOfficialFlag())) { - // 同步ifs + Server srv = getIfsServer(data.getUpdateBy()); RoutingIfsItem routingIfsItem = routingManagementMapper.getRoutingComponentToIfs(data); - String updateRoutingComponentURL = apiUrl + "/routing/ifs/modifyRoutingIfsItemToIfs"; - ResponseData updateRoutingComponentResponse = HttpClientUtil.doPostByRawWithPLM(updateRoutingComponentURL, routingIfsItem); - if (!"200".equals(updateRoutingComponentResponse.getCode())) { - throw new RuntimeException("ifs RoutingItem修改异常:" + updateRoutingComponentResponse.getMsg()); + Map updateRoutingComponentResponse = routingServiceBean.modifyRoutingItem(srv, routingIfsItem); + if (!"200".equals(updateRoutingComponentResponse.get("resultCode"))) { + throw new RuntimeException("ifs RoutingItem修改异常:" + updateRoutingComponentResponse.get("resultMsg")); } // 更新 ifs_row_id ifs_row_version - String s = String.valueOf(updateRoutingComponentResponse.getObj()); + String s = String.valueOf(updateRoutingComponentResponse.get("obj")); RoutingIfsItem ifsItems = JSON.parseObject(s, RoutingIfsItem.class); if (ifsItems != null) { data.setIfsRowId(ifsItems.getIfsRowId()); @@ -940,10 +935,10 @@ public class RoutingManagementServiceImpl extends ServiceImpl deleteRoutingComponentResponse = routingServiceBean.removeRoutingItems(srv, routingIfsItems); + if (!"200".equals(deleteRoutingComponentResponse.get("resultCode"))) { + throw new RuntimeException("IFS RoutingItem删除异常:" + deleteRoutingComponentResponse.get("resultMsg")); } } } @@ -1226,12 +1221,11 @@ public class RoutingManagementServiceImpl extends ServiceImpl().eq("site", data.getSite()).eq("part_no", data.getPartNo()).eq("routing_revision", data.getRoutingRevision()).eq("routing_type", data.getRoutingType())); RoutingIfsHeader routingIfsHeader = new RoutingIfsHeader(); routingIfsHeader.setContract(data.getSite()); @@ -1241,48 +1235,42 @@ public class RoutingManagementServiceImpl extends ServiceImpl getRoutingHeaderResponse = routingServiceBean.getRoutingHeader(srv, routingIfsHeader); + if (!"200".equals(getRoutingHeaderResponse.get("resultCode"))) { // 未同步 + Map addRoutingHeaderResponse = routingServiceBean.syncRoutingHeader(srv, routingIfsHeader); + if (!"200".equals(addRoutingHeaderResponse.get("resultCode"))) { + throw new RuntimeException("IFS RoutingHeader新增异常:" + addRoutingHeaderResponse.get("resultMsg")); } } else { // 修改 - String updateRoutingHeaderURL = apiUrl + "/routing/ifs/modifyRoutingHeaderToIfs"; - ResponseData updateRoutingHeaderResponse = HttpClientUtil.doPostByRawWithPLM(updateRoutingHeaderURL, routingIfsHeader); - if (!"200".equals(updateRoutingHeaderResponse.getCode())) { - throw new RuntimeException("IFS RoutingHeader修改异常:" + updateRoutingHeaderResponse.getMsg()); + Map updateRoutingHeaderResponse = routingServiceBean.modifyRoutingHeader(srv, routingIfsHeader); + if (!"200".equals(updateRoutingHeaderResponse.get("resultCode"))) { + throw new RuntimeException("IFS RoutingHeader修改异常:" + updateRoutingHeaderResponse.get("resultMsg")); } } + // 判断是否已同步RoutingDetail RoutingIfsAlternative routingIfsAlternative = getIfsRoutingDetail(data); - String getRoutingDetailURL = apiUrl + "/routing/ifs/getRoutingAlternative"; - ResponseData getRoutingDetailResponse = HttpClientUtil.doPostByRawWithPLM(getRoutingDetailURL, routingIfsAlternative); - if (!"200".equals(getRoutingDetailResponse.getCode())) { // 未同步 - String addRoutingDetailURL = apiUrl + "/routing/ifs/syncRoutingAlternativeToIfs"; - ResponseData addRoutingDetailResponse = HttpClientUtil.doPostByRawWithPLM(addRoutingDetailURL, routingIfsAlternative); - if (!"200".equals(addRoutingDetailResponse.getCode())) { - throw new RuntimeException("IFS RoutingAlternative新增异常:" + addRoutingDetailResponse.getMsg()); + Map getRoutingDetailResponse = routingServiceBean.getRoutingAlternative(srv, routingIfsAlternative); + if (!"200".equals(getRoutingDetailResponse.get("resultCode"))) { // 未同步 + Map addRoutingDetailResponse = routingServiceBean.syncRoutingAlternative(srv, routingIfsAlternative); + if (!"200".equals(addRoutingDetailResponse.get("resultCode"))) { + throw new RuntimeException("IFS RoutingAlternative新增异常:" + addRoutingDetailResponse.get("resultMsg")); } } else { // 修改 - String updateRoutingDetailURL = apiUrl + "/routing/ifs/modifyRoutingAlternativeToIfs"; - ResponseData updateRoutingDetailResponse = HttpClientUtil.doPostByRawWithPLM(updateRoutingDetailURL, routingIfsAlternative); - if (!"200".equals(updateRoutingDetailResponse.getCode())) { - throw new RuntimeException("IFS RoutingAlternative修改异常:" + updateRoutingDetailResponse.getMsg()); + Map updateRoutingDetailResponse = routingServiceBean.modifyRoutingAlternative(srv, routingIfsAlternative); + if (!"200".equals(updateRoutingDetailResponse.get("resultCode"))) { + throw new RuntimeException("IFS RoutingAlternative修改异常:" + updateRoutingDetailResponse.get("resultMsg")); } } // 同步RoutingComponent List componentList = routingManagementMapper.getRoutingComponent(data); if (!componentList.isEmpty()) { - String addRoutingComponentURL = apiUrl + "/routing/ifs/syncRoutingIfsItemsToIfs"; - ResponseData addRoutingComponentResponse = HttpClientUtil.doPostByRawWithPLM(addRoutingComponentURL, componentList); - if (!"200".equals(addRoutingComponentResponse.getCode())) { - throw new RuntimeException("IFS RoutingItem新增异常:" + addRoutingComponentResponse.getMsg()); + Map addRoutingComponentResponse = routingServiceBean.syncRoutingItems(srv, componentList); + if (!"200".equals(addRoutingComponentResponse.get("resultCode"))) { + throw new RuntimeException("IFS RoutingItem新增异常:" + addRoutingComponentResponse.get("resultMsg")); } - String s = String.valueOf(addRoutingComponentResponse.getObj()); + String s = String.valueOf(addRoutingComponentResponse.get("obj")); List ifsItems = JSON.parseArray(s, RoutingIfsItem.class); if (!ifsItems.isEmpty()) { for (RoutingIfsItem ifsItem : ifsItems) { // 修改ifs关键字 @@ -1294,14 +1282,13 @@ public class RoutingManagementServiceImpl extends ServiceImpl routingTools = routingManagementMapper.getRoutingToolByAlternative(data); + List routingTools = routingManagementMapper.getRoutingToolByAlternative(data); if (!routingTools.isEmpty()) { - String addRoutingToolURL = apiUrl + "/routing/ifs/syncRoutingIfsToolsToIfs"; - ResponseData addRoutingToolResponse = HttpClientUtil.doPostByRawWithPLM(addRoutingToolURL, routingTools); - if (!"200".equals(addRoutingToolResponse.getCode())) { - throw new RuntimeException("IFS RoutingTool新增异常:" + addRoutingToolResponse.getMsg()); + Map addRoutingToolResponse = routingServiceBean.syncRoutingTools(srv, routingTools); + if (!"200".equals(addRoutingToolResponse.get("resultCode"))) { + throw new RuntimeException("IFS RoutingTool新增异常:" + addRoutingToolResponse.get("resultMsg")); } - String RoutingToolObj = String.valueOf(addRoutingToolResponse.getObj()); + String RoutingToolObj = String.valueOf(addRoutingToolResponse.get("obj")); List ifsTools = JSON.parseArray(RoutingToolObj, RoutingIfsTool.class); if (!ifsTools.isEmpty()) { for (RoutingIfsTool ifsTool : ifsTools) { // 修改ifs关键字 @@ -1315,12 +1302,11 @@ public class RoutingManagementServiceImpl extends ServiceImpl routingGuidelines = routingManagementMapper.getGuideLineByAlternative(data); if (!routingGuidelines.isEmpty()) { - String addRoutingGuidelineURL = apiUrl + "/routing/ifs/syncRoutingIfsGuideLinesToIfs"; - ResponseData addRoutingGuidelineResponse = HttpClientUtil.doPostByRawWithPLM(addRoutingGuidelineURL, routingGuidelines); - if (!"200".equals(addRoutingGuidelineResponse.getCode())) { - throw new RuntimeException("IFS RoutingGuideline新增异常:" + addRoutingGuidelineResponse.getMsg()); + Map addRoutingGuidelineResponse = routingServiceBean.syncRoutingGuideLines(srv, routingGuidelines); + if (!"200".equals(addRoutingGuidelineResponse.get("resultCode"))) { + throw new RuntimeException("IFS RoutingGuideline新增异常:" + addRoutingGuidelineResponse.get("resultMsg")); } - String RoutingGuidelineObj = String.valueOf(addRoutingGuidelineResponse.getObj()); + String RoutingGuidelineObj = String.valueOf(addRoutingGuidelineResponse.get("obj")); List ifsGuidelines = JSON.parseArray(RoutingGuidelineObj, RoutingIfsGuideLine.class); if (!ifsGuidelines.isEmpty()) { for (RoutingIfsGuideLine ifsGuideline : ifsGuidelines) { // 修改ifs关键字 @@ -1358,16 +1344,7 @@ public class RoutingManagementServiceImpl extends ServiceImpl ifsLocations = JSON.parseArray(LocationsObj, LocationInformationEntity.class); - - //获取连接 + // 获取连接 Server srv = ifsServer.getIfsServer(ifsUsername, ifsPassword); PartInformationEntity baseSearchData = new PartInformationEntity(); baseSearchData.setSiteCon(data.getSiteCon()); @@ -1379,7 +1356,6 @@ public class RoutingManagementServiceImpl extends ServiceImpl plmLocations = routingManagementMapper.getPLMLocations(arr); @@ -1448,15 +1424,7 @@ public class RoutingManagementServiceImpl extends ServiceImpl ifsLaborClass = JSON.parseArray(LaborClasssObj, PersonnelLevel.class); - - //获取连接 + // 获取连接 Server srv = ifsServer.getIfsServer(ifsUsername, ifsPassword); PartInformationEntity baseSearchData = new PartInformationEntity(); baseSearchData.setSiteCon(data.getSiteCon()); @@ -1468,7 +1436,6 @@ public class RoutingManagementServiceImpl extends ServiceImpl plmLaborClasss = routingManagementMapper.getPLMLaborClasss(arr); @@ -1537,15 +1504,7 @@ public class RoutingManagementServiceImpl extends ServiceImpl ifsWorkCenters = JSON.parseArray(workCentersObj, WorkCenter.class); - - //获取连接 + // 获取连接 Server srv = ifsServer.getIfsServer(ifsUsername, ifsPassword); PartInformationEntity baseSearchData = new PartInformationEntity(); baseSearchData.setSiteCon(data.getSiteCon()); diff --git a/src/main/resources/mapper/part/RoutingManagementMapper.xml b/src/main/resources/mapper/part/RoutingManagementMapper.xml index 28d2a5dc..33aa3ab5 100644 --- a/src/main/resources/mapper/part/RoutingManagementMapper.xml +++ b/src/main/resources/mapper/part/RoutingManagementMapper.xml @@ -1041,20 +1041,24 @@ - SELECT - id, - site, - part_no, - routing_type, - routing_revision, - alternative_no, - operation_id, - tool_id, - tool_qty, - remark - FROM routing_tool - where site = #{site} and part_no = #{partNo} and routing_type = #{routingType} and routing_revision = #{routingRevision} and alternative_no = #{alternativeNo} + a.id, + a.site as contract, + a.part_no, + a.routing_type, + a.routing_revision, + a.alternative_no, + a.operation_id, + b.operation_no, + a.tool_id, + a.tool_qty as toolQuantity, + a.remark as noteText, + b.ifs_row_id, + b.ifs_row_version + FROM routing_tool as a + left join plm_routing_component as b on a.site = b.site and a.part_no = b.part_no and a.routing_type = b.routing_type and a.routing_revision = b.routing_revision and a.alternative_no = b.alternative_no and a.operation_id = b.operation_id + where a.site = #{site} and a.part_no = #{partNo} and a.routing_type = #{routingType} and a.routing_revision = #{routingRevision} and a.alternative_no = #{alternativeNo}