From 04624b351188348a21cdd6d962b2dad865d87ab7 Mon Sep 17 00:00:00 2001 From: Rui_Li <877258667@qq.com> Date: Wed, 21 May 2025 16:18:08 +0800 Subject: [PATCH] =?UTF-8?q?IFS=20copy=20part=20=E6=9F=A5=E8=AF=A2=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/spring/ifs/api/RoutingApi.java | 170 +++++++++++++++++- .../spring/ifs/bean/RoutingServiceBean.java | 92 ++++++++++ 2 files changed, 261 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/spring/ifs/api/RoutingApi.java b/src/main/java/com/spring/ifs/api/RoutingApi.java index 281aa0e0..7c629242 100644 --- a/src/main/java/com/spring/ifs/api/RoutingApi.java +++ b/src/main/java/com/spring/ifs/api/RoutingApi.java @@ -529,6 +529,70 @@ public class RoutingApi { } } + /** + * @description: 仅仅copy part 赋值使用 + * @author LR + * @date 2025/5/21 15:56 + * @version 1.0 + */ + public static List getRoutingItemsWithCopyPart(Server srv, String contract, String partNo) throws APException { + StringBuilder searchSql = new StringBuilder(); + searchSql.append("SELECT CONTRACT, PART_NO, ROUTING_REVISION, BOM_TYPE, ALTERNATIVE_NO,"); + searchSql.append(" OPERATION_NO, OPERATION_DESCRIPTION operationDesc, WORK_CENTER_NO, EFFICIENCY_FACTOR, MACH_SETUP_TIME,"); + searchSql.append(" MACH_RUN_FACTOR, RUN_TIME_CODE, LABOR_RUN_FACTOR, LABOR_SETUP_TIME, CREW_SIZE, SETUP_CREW_SIZE,"); + searchSql.append(" OPERATION_ID, MACHINE_NO, OUTSIDE_OP_ITEM, LABOR_CLASS_NO, SETUP_LABOR_CLASS_NO,"); + searchSql.append(" OVERLAP, NOTE_TEXT, objid ifsRowId, objversion ifsRowVersion"); + searchSql.append(" FROM ifsapp.ROUTING_OPERATION"); + searchSql.append(" WHERE CONTRACT = :contract AND PART_NO = :partNo"); + + //设置查询的入参 + Map inParam = new HashMap<>(); + inParam.put("contract", contract); + inParam.put("partNo", partNo); + //调用查询的通用方法 + RecordCollection recordCollection = IfsPlsqlUtils.execSqlSearchGetRecordCollection(srv, searchSql, inParam); + //判断能否返回 + if (recordCollection == null) { + return new ArrayList<>(); + } else { + List resultItems = new ArrayList<>(); + //调用通用的处理方法 返回Map + List> resultList = IfsConverterToMap.ConverterIfsToList(recordCollection); + //获取数据转bean + for (int i = 0; i < resultList.size(); i++) { + Map tempMap = resultList.get(i); + RoutingIfsItem tempItem = new RoutingIfsItem(); + //设置参数 + tempItem.setIfsRowId(tempMap.get("IFSROWID")); + tempItem.setIfsRowVersion(tempMap.get("IFSROWVERSION")); + tempItem.setRoutingRevision(tempMap.get("ROUTING_REVISION")); + tempItem.setRoutingType(tempMap.get("BOM_TYPE")); + tempItem.setAlternativeNo(tempMap.get("ALTERNATIVE_NO")); + tempItem.setOperationNo(tempMap.get("OPERATION_NO")); + tempItem.setOperationDesc(tempMap.get("OPERATION_DESCRIPTION")); + tempItem.setWorkCenterNo(tempMap.get("WORK_CENTER_NO")); + tempItem.setEfficiencyFactor(tempMap.get("EFFICIENCY_FACTOR")); + tempItem.setMachSetupTime(tempMap.get("MACH_SETUP_TIME")); + tempItem.setMachRunFactor(tempMap.get("MACH_RUN_FACTOR")); + tempItem.setRunTimeCode(tempMap.get("RUN_TIME_CODE")); + tempItem.setLaborRunFactor(tempMap.get("LABOR_RUN_FACTOR")); + tempItem.setLaborSetupTime(tempMap.get("LABOR_SETUP_TIME")); + tempItem.setCrewSize(tempMap.get("CREW_SIZE")); + tempItem.setSetupCrewSize(tempMap.get("SETUP_CREW_SIZE")); + tempItem.setOperationId(tempMap.get("OPERATION_ID")); + tempItem.setMachineNo(tempMap.get("MACHINE_NO")); + tempItem.setOutsideOpItem(tempMap.get("OUTSIDE_OP_ITEM")); + tempItem.setLaborClassNo(tempMap.get("LABOR_CLASS_NO")); + tempItem.setSetupLaborClassNo(tempMap.get("SETUP_LABOR_CLASS_NO")); + tempItem.setOverlap(tempMap.get("OVERLAP")); + tempItem.setNoteText(tempMap.get("NOTE_TEXT")); + //添加对象 + resultItems.add(tempItem); + } + return resultItems; + } + } + /** * @description: 插入Routing Item * @author LR @@ -724,7 +788,7 @@ public class RoutingApi { inParam.put("alternativeNo", alternativeNo); //添加判断的查询条件 if(!(null == toolId || "".equals(toolId))) { - searchSql.append(" AND OPERATION_NO = :toolId"); + searchSql.append(" AND TOOL_ID = :toolId"); inParam.put("toolId", toolId); } //调用查询的通用方法 @@ -739,6 +803,57 @@ public class RoutingApi { } } + /** + * @description: copy part 使用的查询方法 + * @author LR + * @date 2025/5/21 16:02 + * @version 1.0 + */ + public static List getRoutingToolsWithCopyPart(Server srv, String contract, String partNo) throws APException { + StringBuilder searchSql = new StringBuilder(); + searchSql.append("SELECT CONTRACT, PART_NO, ROUTING_REVISION, BOM_TYPE, ALTERNATIVE_NO, OPERATION_NO,"); + searchSql.append(" TOOL_ID, TOOL_QUANTITY, OBJID ifsRowId, OBJVERSION ifsRowVersion, NOTE_TEXT"); + searchSql.append(" FROM IFSAPP.ROUTING_OPERATION_TOOL"); + searchSql.append(" WHERE CONTRACT = :contract AND PART_NO = :partNo AND ROUTING_REVISION = :routingRevision AND BOM_TYPE = :routingType AND ALTERNATIVE_NO = :alternativeNo"); + + //设置查询的入参 + Map inParam = new HashMap<>(); + inParam.put("contract", contract); + inParam.put("partNo", partNo); + //调用查询的通用方法 + RecordCollection recordCollection = IfsPlsqlUtils.execSqlSearchGetRecordCollection(srv, searchSql, inParam); + //判断能否返回 + if (recordCollection == null) { + return new ArrayList<>(); + } else { + List resultItems = new ArrayList<>(); + //调用通用的处理方法 返回Map + List> resultList = IfsConverterToMap.ConverterIfsToList(recordCollection); + //判断是否存在数据 + if(resultList == null) { + return resultItems; + } + //获取数据转bean + for (int i = 0; i < resultList.size(); i++) { + Map tempMap = resultList.get(i); + RoutingIfsTool tempItem = new RoutingIfsTool(); + //设置参数 + tempItem.setIfsRowId(tempMap.get("IFSROWID")); + tempItem.setIfsRowVersion(tempMap.get("IFSROWVERSION")); + tempItem.setContract(tempMap.get("CONTRACT")); + tempItem.setPartNo(tempMap.get("PART_NO")); + tempItem.setRoutingType(tempMap.get("BOM_TYPE")); + tempItem.setRoutingRevision(tempMap.get("ROUTING_REVISION")); + tempItem.setAlternativeNo(tempMap.get("ALTERNATIVE_NO")); + tempItem.setOperationNo(tempMap.get("OPERATION_NO")); // + tempItem.setNoteText(tempMap.get("NOTE_TEXT")); + //添加对象 + resultItems.add(tempItem); + } + return resultItems; + } + } + /** * @description: 查询Routing Tool的所有信息 * @author LR @@ -942,6 +1057,59 @@ public class RoutingApi { } } + /** + * @description: 查询RoutingIfsGuideLine 集合 + * @author LR + * @date 2025/5/21 15:42 + * @version 1.0 + */ + public static List getRoutingGuideLinesWithCopyPart(Server srv, String contract, String partNo) throws APException { + StringBuilder searchSql = new StringBuilder(); + searchSql.append("SELECT rog.CONTRACT, rog.PART_NO, rog.ROUTING_REVISION, rog.BOM_TYPE, rog.ALTERNATIVE_NO, rot.OPERATION_NO, rog.GUIDELINE_NO,"); + searchSql.append(" rog.GUIDELINE_SEQ, rog.OBJID ifsRowId, rog.OBJVERSION ifsRowVersion"); + searchSql.append(" FROM IFSAPP.ROUTING_OPER_WORK_GUIDE rog"); + searchSql.append(" LEFT JOIN IFSAPP.ROUTING_OPERATION_TOOL rot"); + searchSql.append(" ON rot.CONTRACT = rog.CONTRACT AND rot.PART_NO = rog.PART_NO AND rot.ROUTING_REVISION = rog.ROUTING_REVISION "); + searchSql.append(" AND rot.BOM_TYPE = rog.BOM_TYPE AND rot.ALTERNATIVE_NO = rog.ALTERNATIVE_NO AND rot.OPERATION_ID = rog.OPERATION_ID"); + searchSql.append(" WHERE rog.CONTRACT = :contract AND rog.PART_NO = :partNo"); + //设置查询的入参 + Map inParam = new HashMap<>(); + inParam.put("contract", contract); + inParam.put("partNo", partNo); + //调用查询的通用方法 + RecordCollection recordCollection = IfsPlsqlUtils.execSqlSearchGetRecordCollection(srv, searchSql, inParam); + //判断能否返回 + if (recordCollection == null) { + return new ArrayList<>(); + } else { + List resultItems = new ArrayList<>(); + //调用通用的处理方法 返回Map + List> resultList = IfsConverterToMap.ConverterIfsToList(recordCollection); + //判断是否存在数据 + if(resultList == null) { + return resultItems; + } + //获取数据转bean + for (int i = 0; i < resultList.size(); i++) { + Map tempMap = resultList.get(i); + RoutingIfsGuideLine tempItem = new RoutingIfsGuideLine(); + //设置参数 + tempItem.setIfsRowId(tempMap.get("IFSROWID")); + tempItem.setIfsRowVersion(tempMap.get("IFSROWVERSION")); + tempItem.setContract(tempMap.get("CONTRACT")); + tempItem.setPartNo(tempMap.get("PART_NO")); + tempItem.setRoutingType(tempMap.get("BOM_TYPE")); + tempItem.setRoutingRevision(tempMap.get("ROUTING_REVISION")); + tempItem.setAlternativeNo(tempMap.get("ALTERNATIVE_NO")); + tempItem.setOperationNo(tempMap.get("OPERATION_NO")); // + tempItem.setNoteText(tempMap.get("NOTE_TEXT")); + //添加对象 + resultItems.add(tempItem); + } + return resultItems; + } + } + /** * @description: 新增 Routing Guide Line * @author LR diff --git a/src/main/java/com/spring/ifs/bean/RoutingServiceBean.java b/src/main/java/com/spring/ifs/bean/RoutingServiceBean.java index 740f3b81..ad43ec5f 100644 --- a/src/main/java/com/spring/ifs/bean/RoutingServiceBean.java +++ b/src/main/java/com/spring/ifs/bean/RoutingServiceBean.java @@ -472,6 +472,39 @@ public class RoutingServiceBean { return returnMap; } + /** + * @description: 查询工艺路线的组件信息 + * @author LR + * @date 2025/5/21 15:59 + * @version 1.0 + */ + public Map getRoutingItemsWithCopyPart(Server srv, RoutingIfsItem inData) { + //公共参数 + Map returnMap = new HashMap<>(); + String contract = inData.getContract(); + String partNo = inData.getPartNo(); + try{ + //查询结果集 + List resultList = RoutingApi.getRoutingItemsWithCopyPart(srv, contract, partNo); + //判断是否查询数据 + if(resultList.isEmpty()) { + throw new APException("不存在此Routing组件信息!"); + } + returnMap.put("resultCode", "200"); + //打印日志 + logger.info("Routing 明细查询数据:"+JSON.toJSONString(inData)); + returnMap.put("obj", JSON.toJSONString(resultList)); + } catch(APException e){ + returnMap.put("resultCode", "400"); + returnMap.put("resultMsg", e.getMessage()); + logger.info("异常信息:"+e.getMessage()); + } + //打印日志 + logger.info("Routing替代明细集合结束:"+JSON.toJSONString(inData)); + //返回结果集 + return returnMap; + } + /** * @description: 批量新增Routing Item * @author LR @@ -636,6 +669,65 @@ public class RoutingServiceBean { return returnMap; } + /** + * @description: copy part 使用的方法 + * @author LR + * @date 2025/5/21 16:01 + * @version 1.0 + */ + public Map getRoutingToolsWithCopyPart(Server srv, RoutingIfsTool inData) { + logger.info("Routing Tools查询开始:"+JSON.toJSONString(inData)); + //公共参数 + Map returnMap = new HashMap<>(); + String contract = inData.getContract(); + String partNo = inData.getPartNo(); + try{ + //循环处理 + List resultList = RoutingApi.getRoutingToolsWithCopyPart(srv, contract, partNo); + returnMap.put("resultCode", "200"); + logger.info("Routing Tools查询到数据:"+JSON.toJSONString(inData)); + returnMap.put("obj", JSON.toJSONString(resultList)); + } catch(APException e){ + returnMap.put("resultCode", "400"); + returnMap.put("resultMsg", e.getMessage()); + logger.info("异常信息:"+e.getMessage()); + } + //打印日志 + logger.info("Routing Tools查询结束:"+JSON.toJSONString(inData)); + //返回结果集 + return returnMap; + } + + + /** + * @description: copy part 使用的方法 + * @author LR + * @date 2025/5/21 16:05 + * @version 1.0 + */ + public Map getRoutingGuideLinesWithCopyPart(Server srv, RoutingIfsGuideLine inData) { + logger.info("Routing GuideLines查询开始:"+JSON.toJSONString(inData)); + //公共参数 + Map returnMap = new HashMap<>(); + String contract = inData.getContract(); + String partNo = inData.getPartNo(); + try{ + //循环处理 + List resultList = RoutingApi.getRoutingGuideLinesWithCopyPart(srv, contract, partNo); + returnMap.put("resultCode", "200"); + logger.info("Routing GuideLines查询到数据:"+JSON.toJSONString(inData)); + returnMap.put("obj", JSON.toJSONString(resultList)); + } catch(APException e){ + returnMap.put("resultCode", "400"); + returnMap.put("resultMsg", e.getMessage()); + logger.info("异常信息:"+e.getMessage()); + } + //打印日志 + logger.info("Routing GuideLines查询结束:"+JSON.toJSONString(inData)); + //返回结果集 + return returnMap; + } + /** * @description: 批量新增 Routing Tool * @author LR