From 86a939a713a5e693659b949fcff8b0a8939dd537 Mon Sep 17 00:00:00 2001 From: DouDou <877258667@qq.com> Date: Mon, 16 Dec 2024 09:35:41 +0800 Subject: [PATCH] =?UTF-8?q?IFS=20jar=20=E5=BC=80=E5=8F=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/spring/ifs/api/IfsServer.java | 32 + .../com/spring/ifs/api/InventoryPartApi.java | 1061 +++++++++++++++++ .../spring/ifs/bean/InventoryServiceBean.java | 830 +++++++++++++ .../spring/ifs/data/CharacteristicCode.java | 71 ++ .../ifs/data/CharacteristicTemplate.java | 15 + .../java/com/spring/ifs/data/CopyPart.java | 152 +++ .../com/spring/ifs/data/CopyPartItem.java | 90 ++ .../com/spring/ifs/data/IfsParamBean.java | 52 + .../com/spring/ifs/data/InventoryPart.java | 294 +++++ .../spring/ifs/data/InventoryPartConfig.java | 27 + .../ifs/data/InventoryPartLocation.java | 26 + .../ifs/data/InventoryPartManufacture.java | 134 +++ .../spring/ifs/data/InventoryPartPlan.java | 81 ++ .../ifs/data/InventoryPartRevision.java | 75 ++ .../com/spring/ifs/data/InventoryValue.java | 90 ++ .../spring/ifs/utils/IfsConverterToMap.java | 176 +++ .../com/spring/ifs/utils/IfsPlsqlUtils.java | 180 +++ 17 files changed, 3386 insertions(+) create mode 100644 src/main/java/com/spring/ifs/api/IfsServer.java create mode 100644 src/main/java/com/spring/ifs/api/InventoryPartApi.java create mode 100644 src/main/java/com/spring/ifs/bean/InventoryServiceBean.java create mode 100644 src/main/java/com/spring/ifs/data/CharacteristicCode.java create mode 100644 src/main/java/com/spring/ifs/data/CharacteristicTemplate.java create mode 100644 src/main/java/com/spring/ifs/data/CopyPart.java create mode 100644 src/main/java/com/spring/ifs/data/CopyPartItem.java create mode 100644 src/main/java/com/spring/ifs/data/IfsParamBean.java create mode 100644 src/main/java/com/spring/ifs/data/InventoryPart.java create mode 100644 src/main/java/com/spring/ifs/data/InventoryPartConfig.java create mode 100644 src/main/java/com/spring/ifs/data/InventoryPartLocation.java create mode 100644 src/main/java/com/spring/ifs/data/InventoryPartManufacture.java create mode 100644 src/main/java/com/spring/ifs/data/InventoryPartPlan.java create mode 100644 src/main/java/com/spring/ifs/data/InventoryPartRevision.java create mode 100644 src/main/java/com/spring/ifs/data/InventoryValue.java create mode 100644 src/main/java/com/spring/ifs/utils/IfsConverterToMap.java create mode 100644 src/main/java/com/spring/ifs/utils/IfsPlsqlUtils.java diff --git a/src/main/java/com/spring/ifs/api/IfsServer.java b/src/main/java/com/spring/ifs/api/IfsServer.java new file mode 100644 index 00000000..0220b37a --- /dev/null +++ b/src/main/java/com/spring/ifs/api/IfsServer.java @@ -0,0 +1,32 @@ +package com.spring.ifs.api; + +import ifs.fnd.ap.Server; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Component; + +/** +* @description: 获取IFS Server +* @author LR +* @date 2024/12/9 10:57 +* @version 1.0 +*/ +@Component +public class IfsServer { + + @Value("${ifs.target.url}") + private String ifsTargetUrl; + + /** + * @description: 获取IFS所需的链接 + * @author LR + * @date 2024/12/9 11:08 + * @version 1.0 + */ + public Server getIfsServer(String username, String passWord){ + Server srv = new Server(); + srv.setConnectionString(ifsTargetUrl);// 测试期间使用固定配置文件 + srv.setCredentials(username, passWord);//配置文件 + return srv; + } + +} diff --git a/src/main/java/com/spring/ifs/api/InventoryPartApi.java b/src/main/java/com/spring/ifs/api/InventoryPartApi.java new file mode 100644 index 00000000..58b83bc4 --- /dev/null +++ b/src/main/java/com/spring/ifs/api/InventoryPartApi.java @@ -0,0 +1,1061 @@ +package com.spring.ifs.api; + +import com.spring.ifs.data.*; +import com.spring.ifs.utils.IfsConverterToMap; +import com.spring.ifs.utils.IfsPlsqlUtils; +import ifs.fnd.ap.*; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** +* @description: 处理Master业务的底层相关函数 +* @author LR +* @date 2024/12/9 10:56 +* @version 1.0 +*/ +public class InventoryPartApi{ + + /** + * @description: 查询库存件的信息 + * @author LR + * @date 2024/12/11 9:35 + * @version 1.0 + */ + public static Map getInventoryPartByPartNo(Server srv, String contract, String partNo) throws APException { + StringBuilder searchSql = new StringBuilder(); + searchSql.append("SELECT CONTRACT, PART_NO partNo, OBJID ifsRowId, OBJVERSION ifsRowVersion"); + searchSql.append(" FROM IFSAPP.INVENTORY_PART"); + 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 null; + } else { + Record recordData = recordCollection.get(0); + Map resultMap = IfsConverterToMap.ConverterIfsToMap(recordData); + return resultMap; + } + } + + + public static InventoryPart getInventoryPart(Server srv, String contract, String partNo) throws APException { + StringBuilder searchSql = new StringBuilder(); + searchSql.append("SELECT CONTRACT, PART_NO, OBJID ifsRowId, OBJVERSION ifsRowVersion"); + searchSql.append(" FROM IFSAPP.INVENTORY_PART"); + 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 null; + } else { + Record recordData = recordCollection.get(0); + Map resultMap = IfsConverterToMap.ConverterIfsToMap(recordData); + //判断是否存在 + if(null == resultMap || resultMap.size() == 0){ + return null; + }else { + //解析数据 + InventoryPart tempPart = new InventoryPart(); + tempPart.setContract(resultMap.get("CONTRACT")); + tempPart.setPartNo(resultMap.get("PART_NO")); // + tempPart.setIfsRowId(resultMap.get("IFSROWID")); + tempPart.setIfsRowVersion(resultMap.get("IFSROWVERSION")); + return tempPart; + } + } + } + + /** + * @description: 新增库存件 + * @author LR + * @date 2024/12/11 9:51 + * @version 1.0 + */ + public static Map insertInventoryPart(Server srv, InventoryPart inData) throws APException { + //公共参数 + String contract = inData.getContract(); + String partNo = inData.getPartNo().toUpperCase(); + String partDesc = inData.getPartDesc(); + String typeCode = inData.getTypeCode(); + String plannerBuyer = inData.getPlannerBuyer(); + String unitMeas = inData.getUnitMeas(); + String primeCommodity = inData.getPrimeCommodity();//主分组 + String secondCommodity = inData.getSecondCommodity();//第二分组 + String assetClass = inData.getAssetClass(); + String partStatus = inData.getPartStatus(); + String hazardCode = inData.getHazardCode(); + String accountingGroup = inData.getAccountingGroup(); + String partProductCode = inData.getPartProductCode(); + String partProductFamily = inData.getPartProductFamily(); + String typeDesignation = inData.getTypeDesignation(); + String dimQuality = inData.getDimQuality(); + String noteText = inData.getNoteText(); + String leadTimeCode = inData.getLeadTimeCode(); + String manufLeadtime = inData.getManufLeadtime(); + String expectedLeadtime = inData.getExpectedLeadtime(); + String durabilityDay = inData.getDurabilityDay(); + String countryOfOrigin = inData.getCountryOfOrigin(); + String regionOfOrigin = inData.getRegionOfOrigin(); + String customsStatNo = inData.getCustomsStatNo(); + String intrastatConvFactor = inData.getIntrastatConvFactor(); + String inventoryValuationMethod = inData.getInventoryValuationMethod();// + String inventoryPartCostLevel = inData.getInventoryPartCostLevel();// + String invoiceConsideration = inData.getInvoiceConsideration();// + String zeroCostFlag = inData.getZeroCostFlag();// + String partCostGroupId = inData.getPartCostGroupId();// + String engAttribute = inData.getEngAttribute(); + //入参 + Map inParam = new HashMap<>(); + //填充参数 + inParam.put("OBJID", ""); + inParam.put("OBJVERSION", ""); + inParam.put("CONTRACT", contract); // ifs域 + inParam.put("PART_NO", partNo); // 物料编码 + inParam.put("DESCRIPTION", partDesc); // 物料描述 + inParam.put("TYPE_CODE", typeCode); // 物料大类 + inParam.put("PLANNER_BUYER", plannerBuyer); // 计划购买者 + inParam.put("UNIT_MEAS", unitMeas); // 单位 + inParam.put("PRIME_COMMODITY", primeCommodity); // 主分组 + inParam.put("SECOND_COMMODITY", secondCommodity); // 副分组 + inParam.put("ASSET_CLASS", assetClass); // ASSET_CLASS + inParam.put("PART_STATUS", partStatus); // ASSET_CLASS + inParam.put("HAZARD_CODE", hazardCode); // HAZARD_CODE + inParam.put("ACCOUNTING_GROUP", accountingGroup); // 商品属性 半成品 成品 原材料 + inParam.put("PART_PRODUCT_CODE", partProductCode); // 产品代码 + inParam.put("PART_PRODUCT_FAMILY", partProductFamily); // 零部件标识 + inParam.put("TYPE_DESIGNATION", typeDesignation); // 类型标识 + inParam.put("DIM_QUALITY", dimQuality); // DIM_QUALITY + inParam.put("NOTE_TEXT", noteText); // 备注 + inParam.put("LEAD_TIME_CODE", leadTimeCode); // LEAD_TIME_CODE + inParam.put("MANUF_LEADTIME", manufLeadtime); // MANUF_LEADTIME + inParam.put("EXPECTED_LEADTIME", expectedLeadtime); // + inParam.put("DURABILITY_DAY", durabilityDay); // DURABILITY_DAY + inParam.put("COUNTRY_OF_ORIGIN", countryOfOrigin); // 国家 + inParam.put("REGION_OF_ORIGIN", regionOfOrigin); // 区域 + inParam.put("CUSTOMS_STAT_NO", customsStatNo); // CUSTOMS_STAT_NO + inParam.put("INTRASTAT_CONV_FACTOR", intrastatConvFactor); // INTRASTAT_CONV_FACTOR + inParam.put("INVENTORY_VALUATION_METHOD", inventoryValuationMethod); // INVENTORY_VALUATION_METHOD + inParam.put("INVENTORY_PART_COST_LEVEL", inventoryPartCostLevel); // INVENTORY_PART_COST_LEVEL + inParam.put("INVOICE_CONSIDERATION", invoiceConsideration); // INVOICE_CONSIDERATION + inParam.put("ZERO_COST_FLAG", zeroCostFlag); // ZERO_COST_FLAG + inParam.put("PART_COST_GROUP_ID", partCostGroupId); // PART_COST_GROUP_ID + inParam.put("ENG_ATTRIBUTE", engAttribute); // 库存件模版 + // 固定参数 + inParam.put("CATCH_UNIT_MEAS", ""); // 拼接固定值CATCH_UNIT_MEAS + inParam.put("PURCH_LEADTIME", "0"); // 拼接固定值PURCH_LEADTIME + inParam.put("MIN_DURAB_DAYS_CO_DELIV", "0"); // 拼接固定参数 + inParam.put("MIN_DURAB_DAYS_PLANNING", "0"); // 拼接固定参数 + inParam.put("MANDATORY_EXPIRATION_DATE_DB", "FALSE"); // 拼接固定参数 + inParam.put("SUPPLY_CODE", "Inventory Order"); // 拼接固定参数 + inParam.put("DOP_CONNECTION", "Automatic DOP"); // 拼接固定参数 + inParam.put("DOP_NETTING", "No Netting"); // 拼接固定参数 + inParam.put("QTY_CALC_ROUNDING", "16"); // 拼接固定参数 + inParam.put("CYCLE_PERIOD", "0"); // 拼接固定参数 + inParam.put("CYCLE_CODE_DB", "N"); // 拼接固定参数 + inParam.put("STOCK_MANAGEMENT_DB", "SYSTEM MANAGED INVENTORY"); // 固定参数 + inParam.put("SPECIAL_CONSUMPTION_TAX_DB", "FALSE"); // SPECIAL_CONSUMPTION_TAX_DB + inParam.put("CUSTOMS_DECL_NO_LEVEL", "Not Used"); // CUSTOMS_DECL_NO_LEVEL + //执行存储过程 获取结果集 + //执行check的操作 + Map checkMap = IfsPlsqlUtils.execProcedureGetRecord(srv, "INVENTORY_PART_API", + "NEW__", PlsqlBaseMethodType.NEW, PlsqlBaseMethodAction.CHECK, inParam); + //执行do的操作 + Map resultMap = IfsPlsqlUtils.execProcedureGetRecord(srv, "INVENTORY_PART_API", + "NEW__", PlsqlBaseMethodType.NEW, PlsqlBaseMethodAction.DO, inParam); + //返回结果集 + return resultMap; + } + + /** + * @description: 修改库存件的信息 + * @author LR + * @date 2024/12/11 9:59 + * @version 1.0 + */ + public static Map modifyInventoryPart(Server srv, InventoryPart inData) throws APException { + //公共参数 + String ifsRowId = inData.getIfsRowId(); + String ifsRowVersion = inData.getIfsRowVersion(); + String partDesc = inData.getPartDesc(); + String typeCode = inData.getTypeCode(); + String plannerBuyer = inData.getPlannerBuyer(); + String primeCommodity = inData.getPrimeCommodity();//主分组 + String secondCommodity = inData.getSecondCommodity();//第二分组 + String assetClass = inData.getAssetClass(); + String partStatus = inData.getPartStatus(); + String abcClass = inData.getAbcClass(); + String hazardCode = inData.getHazardCode(); + String accountingGroup = inData.getAccountingGroup(); + String partProductCode = inData.getPartProductCode(); + String partProductFamily = inData.getPartProductFamily(); + String typeDesignation = inData.getTypeDesignation(); + String dimQuality = inData.getDimQuality(); + String noteText = inData.getNoteText(); + String manufLeadtime = inData.getManufLeadtime(); + String expectedLeadtime = inData.getExpectedLeadtime(); + String durabilityDay = inData.getDurabilityDay(); + String countryOfOrigin = inData.getCountryOfOrigin(); + String regionOfOrigin = inData.getRegionOfOrigin(); + String customsStatNo = inData.getCustomsStatNo(); + String intrastatConvFactor = inData.getIntrastatConvFactor(); + String inventoryValuationMethod = inData.getInventoryValuationMethod();// + String inventoryPartCostLevel = inData.getInventoryPartCostLevel();// + String invoiceConsideration = inData.getInvoiceConsideration();// + String zeroCostFlag = inData.getZeroCostFlag();// + String partCostGroupId = inData.getPartCostGroupId();// + String engAttribute = inData.getEngAttribute(); + //入参 + Map inParam = new HashMap<>(); + //填充参数 + inParam.put("OBJID", ifsRowId); + inParam.put("OBJVERSION", ifsRowVersion); + inParam.put("DESCRIPTION", partDesc); // 物料描述 + inParam.put("TYPE_CODE", typeCode); // 物料大类 + inParam.put("PLANNER_BUYER", plannerBuyer); // 计划购买者 + inParam.put("PRIME_COMMODITY", primeCommodity); // 主分组 + inParam.put("SECOND_COMMODITY", secondCommodity); // 副分组 + inParam.put("ASSET_CLASS", assetClass); // ASSET_CLASS + inParam.put("PART_STATUS", partStatus); // ASSET_CLASS + inParam.put("ABC_CLASS", abcClass); // ASSET_CLASS + inParam.put("HAZARD_CODE", hazardCode); // HAZARD_CODE + inParam.put("ACCOUNTING_GROUP", accountingGroup); // 商品属性 半成品 成品 原材料 + inParam.put("PART_PRODUCT_CODE", partProductCode); // 产品代码 + inParam.put("PART_PRODUCT_FAMILY", partProductFamily); // 零部件标识 + inParam.put("TYPE_DESIGNATION", typeDesignation); // 类型标识 + inParam.put("DIM_QUALITY", dimQuality); // DIM_QUALITY + inParam.put("NOTE_TEXT", noteText); // 备注 + inParam.put("MANUF_LEADTIME", manufLeadtime); // MANUF_LEADTIME + inParam.put("EXPECTED_LEADTIME", expectedLeadtime); // + inParam.put("DURABILITY_DAY", durabilityDay); // DURABILITY_DAY + inParam.put("COUNTRY_OF_ORIGIN", countryOfOrigin); // 国家 + inParam.put("REGION_OF_ORIGIN", regionOfOrigin); // 区域 + inParam.put("CUSTOMS_STAT_NO", customsStatNo); // CUSTOMS_STAT_NO + inParam.put("INTRASTAT_CONV_FACTOR", intrastatConvFactor); // 备注 + inParam.put("INVENTORY_VALUATION_METHOD", inventoryValuationMethod); // INVENTORY_VALUATION_METHOD + inParam.put("INVENTORY_PART_COST_LEVEL", inventoryPartCostLevel); // INVENTORY_PART_COST_LEVEL + inParam.put("INVOICE_CONSIDERATION", invoiceConsideration); // INVOICE_CONSIDERATION + inParam.put("ZERO_COST_FLAG", zeroCostFlag); // ZERO_COST_FLAG + inParam.put("PART_COST_GROUP_ID", partCostGroupId); // PART_COST_GROUP_ID + inParam.put("ENG_ATTRIBUTE", engAttribute); // 库存件模版 + + //执行存储过程 获取结果集 + //执行check的操作 + Map checkMap = IfsPlsqlUtils.execProcedureGetRecord(srv, "INVENTORY_PART_API", + "MODIFY__", PlsqlBaseMethodType.MODIFY, PlsqlBaseMethodAction.CHECK, inParam); + //执行do的操作 + Map resultMap = IfsPlsqlUtils.execProcedureGetRecord(srv, "INVENTORY_PART_API", + "MODIFY__", PlsqlBaseMethodType.MODIFY, PlsqlBaseMethodAction.DO, inParam); + //返回结果集 + return resultMap; + } + + /** + * @description: 删除库存件 + * @author LR + * @date 2024/12/11 10:04 + * @version 1.0 + */ + public static void removeInventoryPart(Server srv, PartCatalog inData) throws APException { + //公共参数 + String ifsRowId = inData.getIfsRowId(); + String ifsRowVersion = inData.getIfsRowVersion(); + //入参 + Map inParam = new HashMap<>(); + //填充参数 + inParam.put("OBJID", ifsRowId); + inParam.put("OBJVERSION", ifsRowVersion); + //执行存储过程 获取结果集 + //执行check的操作 + Map checkMap = IfsPlsqlUtils.execProcedureGetRecord(srv, "INVENTORY_PART_API", + "REMOVE__", PlsqlBaseMethodType.REMOVE, PlsqlBaseMethodAction.CHECK, inParam); + //执行do的操作 + Map resultMap = IfsPlsqlUtils.execProcedureGetRecord(srv, "INVENTORY_PART_API", + "REMOVE__", PlsqlBaseMethodType.REMOVE, PlsqlBaseMethodAction.DO, inParam); + } + + /** + * @description: 查询库存件的cost配置信息 + * @author LR + * @date 2024/12/11 10:13 + * @version 1.0 + */ + public static Map getInventoryPartConfig(Server srv, String contract, String partNo) throws APException { + StringBuilder searchSql = new StringBuilder(); + searchSql.append("SELECT CONTRACT, PART_NO partNo, configuration_id, estimated_material_cost, OBJID ifsRowId, OBJVERSION ifsRowVersion"); + searchSql.append(" FROM IFSAPP.INVENTORY_PART_CONFIG"); + 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 null; + } else { + Record recordData = recordCollection.get(0); + Map resultMap = IfsConverterToMap.ConverterIfsToMap(recordData); + return resultMap; + } + } + + /** + * @description: 修改库存件的cost的信息 + * @author LR + * @date 2024/12/11 10:23 + * @version 1.0 + */ + public static Map modifyInventoryPartCost(Server srv, InventoryPartConfig inData) throws APException { + //公共参数 + String ifsRowId = inData.getIfsRowId(); + String ifsRowVersion = inData.getIfsRowVersion(); + String estimatedMaterialCost = inData.getEstimatedMaterialCost(); + //入参 + Map inParam = new HashMap<>(); + inParam.put("OBJID", ifsRowId); + inParam.put("OBJVERSION", ifsRowVersion); + inParam.put("ESTIMATED_MATERIAL_COST", estimatedMaterialCost); // ESTIMATED_MATERIAL_COST + + //执行check的操作 + Map checkMap = IfsPlsqlUtils.execProcedureGetRecord(srv, "INVENTORY_PART_CONFIG_API", + "MODIFY__", PlsqlBaseMethodType.MODIFY, PlsqlBaseMethodAction.CHECK, inParam); + //执行do的操作 + Map resultMap = IfsPlsqlUtils.execProcedureGetRecord(srv, "INVENTORY_PART_CONFIG_API", + "MODIFY__", PlsqlBaseMethodType.MODIFY, PlsqlBaseMethodAction.DO, inParam); + //返回结果集 + return resultMap; + } + + /** + * @description: 获取库存件的计划 + * @author LR + * @date 2024/12/11 10:31 + * @version 1.0 + */ + public static Map getInventoryPartPlan(Server srv, String contract, String partNo) throws APException { + StringBuilder searchSql = new StringBuilder(); + searchSql.append("SELECT CONTRACT, PART_NO partNo, planning_method, safety_stock, OBJID ifsRowId, OBJVERSION ifsRowVersion"); + searchSql.append(" FROM IFSAPP.INVENTORY_PART_PLANNING"); + 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 null; + } else { + Record recordData = recordCollection.get(0); + Map resultMap = IfsConverterToMap.ConverterIfsToMap(recordData); + return resultMap; + } + } + + /** + * @description: 修改库存件的计划 + * @author LR + * @date 2024/12/11 10:44 + * @version 1.0 + */ + public static Map modifyInventoryPartPlan(Server srv, InventoryPartPlan inData) throws APException { + //公共参数 + String ifsRowId = inData.getIfsRowId(); + String ifsRowVersion = inData.getIfsRowVersion(); + String planningMethod = inData.getPlanningMethod(); // + String safetyStock = inData.getSafetyStock(); + String safetyLeadTime = inData.getSafetyLeadTime(); + String minOrderQty = inData.getMinOrderQty(); + String maxOrderQty = inData.getMaxOrderQty(); + String mulOrderQty = inData.getMulOrderQty(); + String shrinkageFac = inData.getShrinkageFac(); + String stdOrderSize = inData.getStdOrderSize(); + //入参 + Map inParam = new HashMap<>(); + inParam.put("OBJID", ifsRowId); + inParam.put("OBJVERSION", ifsRowVersion); + inParam.put("PLANNING_METHOD", planningMethod); // PLANNING_METHOD + inParam.put("SAFETY_STOCK", safetyStock); // SAFETY_STOCK + inParam.put("SAFETY_LEAD_TIME", safetyLeadTime); // SAFETY_LEAD_TIME + inParam.put("MIN_ORDER_QTY", minOrderQty); // MIN_ORDER_QTY + inParam.put("MAX_ORDER_QTY", maxOrderQty); // MAX_ORDER_QTY + inParam.put("MUL_ORDER_QTY", mulOrderQty); // MUL_ORDER_QTY + inParam.put("SHRINKAGE_FAC", shrinkageFac); // SHRINKAGE_FAC + inParam.put("STD_ORDER_SIZE", stdOrderSize); // STD_ORDER_SIZE + + //执行check的操作 + Map checkMap = IfsPlsqlUtils.execProcedureGetRecord(srv, "INVENTORY_PART_PLANNING_API", + "MODIFY__", PlsqlBaseMethodType.MODIFY, PlsqlBaseMethodAction.CHECK, inParam); + //执行do的操作 + Map resultMap = IfsPlsqlUtils.execProcedureGetRecord(srv, "INVENTORY_PART_PLANNING_API", + "MODIFY__", PlsqlBaseMethodType.MODIFY, PlsqlBaseMethodAction.DO, inParam); + //返回结果集 + return resultMap; + } + + /** + * @description: 查询库存件的库位信息 + * @author LR + * @date 2024/12/11 10:51 + * @version 1.0 + */ + public static Map getInventoryPartLocation(Server srv, String contract, String partNo, String locationNo) throws APException { + StringBuilder searchSql = new StringBuilder(); + searchSql.append("SELECT CONTRACT, PART_NO partNo, location_no, location_type, OBJID ifsRowId, OBJVERSION ifsRowVersion"); + searchSql.append(" FROM IFSAPP.INVENTORY_PART_DEF_LOC"); + searchSql.append(" WHERE CONTRACT = :contract AND PART_NO = :partNo AND LOCATION_NO = :locationNo"); + //设置查询的入参 + Map inParam = new HashMap<>(); + inParam.put("contract", contract); + inParam.put("partNo", partNo); + inParam.put("locationNo", locationNo); + //调用查询的通用方法 + RecordCollection recordCollection = IfsPlsqlUtils.execSqlSearchGetRecordCollection(srv, searchSql, inParam); + //判断能否返回 + if (recordCollection == null) { + return null; + } else { + Record recordData = recordCollection.get(0); + Map resultMap = IfsConverterToMap.ConverterIfsToMap(recordData); + return resultMap; + } + } + + /** + * @description: 插入库存件的库位信息 + * @author LR + * @date 2024/12/11 10:52 + * @version 1.0 + */ + public static Map insertInventoryPartLocation(Server srv, InventoryPartLocation inData) throws APException { + //公共参数 + String contract = inData.getContract(); + String partNo = inData.getPartNo().toUpperCase(); + String locationNo = inData.getLocationNo(); + String locationType = inData.getLocationType(); + //入参 + Map inParam = new HashMap<>(); + inParam.put("OBJID", ""); + inParam.put("OBJVERSION", ""); + inParam.put("CONTRACT", contract); // CONTRACT + inParam.put("PART_NO", partNo); // PART_NO + inParam.put("LOCATION_NO", locationNo); // LOCATION_NO + inParam.put("LOCATION_TYPE", locationType); // LOCATION_TYPE + + //执行check的操作 + Map checkMap = IfsPlsqlUtils.execProcedureGetRecord(srv, "INVENTORY_PART_DEF_LOC_API", + "NEW__", PlsqlBaseMethodType.NEW, PlsqlBaseMethodAction.CHECK, inParam); + //执行do的操作 + Map resultMap = IfsPlsqlUtils.execProcedureGetRecord(srv, "INVENTORY_PART_DEF_LOC_API", + "NEW__", PlsqlBaseMethodType.NEW, PlsqlBaseMethodAction.DO, inParam); + //返回结果集 + return resultMap; + } + + /** + * @description: 删除库存件的库位信息 + * @author LR + * @date 2024/12/11 10:59 + * @version 1.0 + */ + public static void removeInventoryPartLocation(Server srv, InventoryPartLocation inData) throws APException { + //公共参数 + String ifsRowId = inData.getIfsRowId(); + String ifsRowVersion = inData.getIfsRowVersion(); + //入参 + Map inParam = new HashMap<>(); + inParam.put("OBJID", ifsRowId); + inParam.put("OBJVERSION", ifsRowVersion); + + //执行check的操作 + Map checkMap = IfsPlsqlUtils.execProcedureGetRecord(srv, "INVENTORY_PART_DEF_LOC_API", + "REMOVE__", PlsqlBaseMethodType.REMOVE, PlsqlBaseMethodAction.CHECK, inParam); + //执行do的操作 + Map resultMap = IfsPlsqlUtils.execProcedureGetRecord(srv, "INVENTORY_PART_DEF_LOC_API", + "REMOVE__", PlsqlBaseMethodType.REMOVE, PlsqlBaseMethodAction.DO, inParam); + } + + /** + * @description: 查询库存件的制造商信息 + * @author LR + * @date 2024/12/11 11:02 + * @version 1.0 + */ + public static Map getInventoryManufacture(Server srv, String contract, String partNo) throws APException { + StringBuilder searchSql = new StringBuilder(); + searchSql.append("SELECT CONTRACT, PART_NO partNo, cum_leadtime, density, OBJID ifsRowId, OBJVERSION ifsRowVersion"); + searchSql.append(" FROM IFSAPP.MANUF_PART_ATTRIBUTE"); + 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 null; + } else { + Record recordData = recordCollection.get(0); + Map resultMap = IfsConverterToMap.ConverterIfsToMap(recordData); + return resultMap; + } + } + + /** + * @description: 修改库存件的制造商信息 + * @author LR + * @date 2024/12/11 11:11 + * @version 1.0 + */ + public static Map modifyInventoryPartManufacture(Server srv, InventoryPartManufacture inData) throws APException { + //公共参数 + String ifsRowId = inData.getIfsRowId(); + String ifsRowVersion = inData.getIfsRowVersion(); + String cumLeadtime = inData.getCumLeadtime(); + String unprotectedLeadTime = inData.getUnprotectedLeadTime(); + String fixedLeadtimeDay = inData.getFixedLeadtimeDay(); + String variableLeadtimeDay = inData.getVariableLeadtimeDay(); + String fixedLeadtimeHour = inData.getFixedLeadtimeHour(); + String variableLeadtimeHour = inData.getVariableLeadtimeHour(); + String backflushPart = inData.getBackflushPart(); + String issueType = inData.getIssueType(); + String overReporting = inData.getOverReporting(); + String overReportTolerance = inData.getOverReportTolerance(); + String byProdAsSupplyInMrpDb = inData.getByProdAsSupplyInMrpDb(); + String mrpControlFlagDb = inData.getMrpControlFlagDb(); + String useTheoriticalDensityDb = inData.getUseTheoriticalDensityDb(); + String density = inData.getDensity(); + //入参 + Map inParam = new HashMap<>(); + inParam.put("OBJID", ifsRowId); + inParam.put("OBJVERSION", ifsRowVersion); + inParam.put("CUM_LEADTIME", cumLeadtime); // CUM_LEADTIME + inParam.put("UNPROTECTED_LEAD_TIME", unprotectedLeadTime); // UNPROTECTED_LEAD_TIME + inParam.put("FIXED_LEADTIME_DAY", fixedLeadtimeDay); // FIXED_LEADTIME_DAY + inParam.put("VARIABLE_LEADTIME_DAY", variableLeadtimeDay); // VARIABLE_LEADTIME_DAY + inParam.put("FIXED_LEADTIME_HOUR", fixedLeadtimeHour); // FIXED_LEADTIME_HOUR + inParam.put("VARIABLE_LEADTIME_HOUR", variableLeadtimeHour); // VARIABLE_LEADTIME_HOUR + inParam.put("BACKFLUSH_PART", backflushPart); // BACKFLUSH_PART + inParam.put("ISSUE_TYPE", issueType); // ISSUE_TYPE + inParam.put("OVER_REPORTING", overReporting); // OVER_REPORTING + inParam.put("OVER_REPORT_TOLERANCE", overReportTolerance); // OVER_REPORT_TOLERANCE + inParam.put("BY_PROD_AS_SUPPLY_IN_MRP_DB", byProdAsSupplyInMrpDb); // BY_PROD_AS_SUPPLY_IN_MRP_DB + inParam.put("MRP_CONTROL_FLAG_DB", mrpControlFlagDb); // MRP_CONTROL_FLAG_DB + inParam.put("USE_THEORITICAL_DENSITY_DB", useTheoriticalDensityDb); // USE_THEORITICAL_DENSITY_DB + if(!density.equals("")) { + inParam.put("DENSITY", density); + } + + //执行check的操作 + Map checkMap = IfsPlsqlUtils.execProcedureGetRecord(srv, "MANUF_PART_ATTRIBUTE_API", + "MODIFY__", PlsqlBaseMethodType.MODIFY, PlsqlBaseMethodAction.CHECK, inParam); + //执行do的操作 + Map resultMap = IfsPlsqlUtils.execProcedureGetRecord(srv, "MANUF_PART_ATTRIBUTE_API", + "MODIFY__", PlsqlBaseMethodType.MODIFY, PlsqlBaseMethodAction.DO, inParam); + //返回结果集 + return resultMap; + } + + /** + * @description: 查询库存件的版本信息 + * @author LR + * @date 2024/12/11 11:19 + * @version 1.0 + */ + public static Map getInventoryPartRevision(Server srv, String contract, String partNo, String engChgLevel) throws APException { + StringBuilder searchSql = new StringBuilder(); + searchSql.append("SELECT CONTRACT, PART_NO partNo, eng_chg_level, revision_text, OBJID ifsRowId, OBJVERSION ifsRowVersion"); + searchSql.append(" FROM IFSAPP.PART_REVISION"); + searchSql.append(" WHERE CONTRACT = :contract AND PART_NO = :partNo AND ENG_CHG_LEVEL = :engChgLevel"); + //设置查询的入参 + Map inParam = new HashMap<>(); + inParam.put("contract", contract); + inParam.put("partNo", partNo); + inParam.put("engChgLevel", engChgLevel); + //调用查询的通用方法 + RecordCollection recordCollection = IfsPlsqlUtils.execSqlSearchGetRecordCollection(srv, searchSql, inParam); + //判断能否返回 + if (recordCollection == null) { + return null; + } else { + Record recordData = recordCollection.get(0); + Map resultMap = IfsConverterToMap.ConverterIfsToMap(recordData); + return resultMap; + } + } + + /** + * @description: 插入库存件的版本 + * @author LR + * @date 2024/12/11 11:21 + * @version 1.0 + */ + public static Map insertInventoryPartRevision(Server srv, InventoryPartRevision inData) throws APException { + //公共参数 + String contract = inData.getContract(); + String partNo = inData.getPartNo().toUpperCase(); + String engChgLevel = inData.getEngChgLevel(); + String revisionText = inData.getRevisionText(); + String effPhaseInDate = inData.getEffPhaseInDate().substring(0, 10)+"-00.00.00"; + String effPhaseOutDate = inData.getEffPhaseOutDate(); + //是否存在有效值 + if(effPhaseOutDate == null || effPhaseOutDate.equals("")) { + effPhaseOutDate = ""; + }else { + effPhaseOutDate = effPhaseOutDate.substring(0, 10)+"-00.00.00"; + } + String engRevision = inData.getEngRevision(); + String engRevisionDesc = inData.getEngRevisionDesc(); + //入参 + Map inParam = new HashMap<>(); + inParam.put("OBJID", ""); + inParam.put("OBJVERSION", ""); + inParam.put("CONTRACT", contract); // ifs域 + inParam.put("PART_NO", partNo); // 物料编码 + inParam.put("ENG_CHG_LEVEL", engChgLevel); // 版本信息 + inParam.put("REVISION_TEXT", revisionText); // 版本备注 + inParam.put("EFF_PHASE_IN_DATE", effPhaseInDate); // 启用日期 + inParam.put("EFF_PHASE_OUT_DATE", effPhaseOutDate); // 过期日期 + inParam.put("ENG_REVISION", engRevision); // ENG_REVISION + inParam.put("ENG_REVISION_DESC", engRevisionDesc); // 版本描述 + inParam.put("EFFECTIVE_STATUS", "Not In Effect"); // 有效状态 + inParam.put("EFFECTIVE_REPAIR_STATUS", "Not In Effect"); // 有效维修状态 + inParam.put("PART_REVISION_LOCK", "Not locked"); // 版本锁 + inParam.put("PART_REVISION_REPORT", "No Report"); // 版本报告 + inParam.put("PART_REVISION_STATUS", "Not decided"); // 版本状态 + inParam.put("PART_REVISION_USAGE", "Unlimited"); // 版本使用 + + //执行check的操作 + Map checkMap = IfsPlsqlUtils.execProcedureGetRecord(srv, "PART_REVISION_API", + "NEW__", PlsqlBaseMethodType.NEW, PlsqlBaseMethodAction.CHECK, inParam); + //执行do的操作 + Map resultMap = IfsPlsqlUtils.execProcedureGetRecord(srv, "PART_REVISION_API", + "NEW__", PlsqlBaseMethodType.NEW, PlsqlBaseMethodAction.DO, inParam); + //返回结果集 + return resultMap; + } + + /** + * @description: 修改库存件的版本 + * @author LR + * @date 2024/12/11 11:23 + * @version 1.0 + */ + public static Map modifyInventoryPartRevision(Server srv, InventoryPartRevision inData) throws APException { + //公共参数 + String ifsRowId = inData.getIfsRowId(); + String ifsRowVersion = inData.getIfsRowVersion(); + String revisionText = inData.getRevisionText(); + String effPhaseInDate = inData.getEffPhaseInDate().substring(0, 10)+"-00.00.00"; + String effPhaseOutDate = inData.getEffPhaseOutDate(); + //是否存在有效值 + if(effPhaseOutDate == null || effPhaseOutDate.equals("")) { + effPhaseOutDate = ""; + }else { + effPhaseOutDate = effPhaseOutDate.substring(0, 10)+"-00.00.00"; + } + String engRevision = inData.getEngRevision(); + String engRevisionDesc = inData.getEngRevisionDesc(); + //入参 + Map inParam = new HashMap<>(); + //填充参数 + inParam.put("OBJID", ifsRowId); + inParam.put("OBJVERSION", ifsRowVersion); + inParam.put("REVISION_TEXT", revisionText); // 版本备注 + inParam.put("EFF_PHASE_IN_DATE", effPhaseInDate); // 启用日期 + inParam.put("EFF_PHASE_OUT_DATE", effPhaseOutDate); // 过期日期 + inParam.put("ENG_REVISION", engRevision); // ENG_REVISION + inParam.put("ENG_REVISION_DESC", engRevisionDesc); // 版本描述 + + //执行check的操作 + Map checkMap = IfsPlsqlUtils.execProcedureGetRecord(srv, "PART_REVISION_API", + "MODIFY__", PlsqlBaseMethodType.MODIFY, PlsqlBaseMethodAction.CHECK, inParam); + //执行do的操作 + Map resultMap = IfsPlsqlUtils.execProcedureGetRecord(srv, "PART_REVISION_API", + "MODIFY__", PlsqlBaseMethodType.MODIFY, PlsqlBaseMethodAction.DO, inParam); + //返回结果集 + return resultMap; + } + + /** + * @description: 删除库存件的版本信息 + * @author LR + * @date 2024/12/11 11:25 + * @version 1.0 + */ + public static void removeInventoryPartRevision(Server srv, InventoryPartRevision inData) throws APException { + //公共参数 + String ifsRowId = inData.getIfsRowId(); + String ifsRowVersion = inData.getIfsRowVersion(); + //入参 + Map inParam = new HashMap<>(); + //填充参数 + inParam.put("OBJID", ifsRowId); + inParam.put("OBJVERSION", ifsRowVersion); + //执行存储过程 获取结果集 + //执行check的操作 + Map checkMap = IfsPlsqlUtils.execProcedureGetRecord(srv, "PART_REVISION_API", + "REMOVE__", PlsqlBaseMethodType.REMOVE, PlsqlBaseMethodAction.CHECK, inParam); + //执行do的操作 + Map resultMap = IfsPlsqlUtils.execProcedureGetRecord(srv, "PART_REVISION_API", + "REMOVE__", PlsqlBaseMethodType.REMOVE, PlsqlBaseMethodAction.DO, inParam); + } + + /** + * @description: 查询库存件属性模版 + * @author LR + * @date 2024/12/11 11:35 + * @version 1.0 + */ + public static Map getInventoryPartCharacteristicTemplate(Server srv, String contract, String partNo) throws APException { + StringBuilder searchSql = new StringBuilder(); + searchSql.append("SELECT CONTRACT, PART_NO partNo, eng_attribute, OBJID ifsRowId, OBJVERSION ifsRowVersion"); + searchSql.append(" FROM IFSAPP.INVENTORY_PART"); + 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 null; + } else { + Record recordData = recordCollection.get(0); + Map resultMap = IfsConverterToMap.ConverterIfsToMap(recordData); + return resultMap; + } + } + + /** + * @description: 修改库存件的属性模版 + * @author LR + * @date 2024/12/11 11:42 + * @version 1.0 + */ + public static Map modifyInventoryPartCharacteristicTemplate(Server srv, CharacteristicTemplate inData) throws APException { + //公共参数 + String ifsRowId = inData.getIfsRowId(); + String ifsRowVersion = inData.getIfsRowVersion(); + String engAttribute = inData.getEngAttribute(); + //入参 + Map inParam = new HashMap<>(); + //填充参数 + inParam.put("OBJID", ifsRowId); + inParam.put("OBJVERSION", ifsRowVersion); + inParam.put("ENG_ATTRIBUTE", engAttribute); + //执行存储过程 获取结果集 + //执行check的操作 + Map checkMap = IfsPlsqlUtils.execProcedureGetRecord(srv, "INVENTORY_PART_API", + "MODIFY__", PlsqlBaseMethodType.MODIFY, PlsqlBaseMethodAction.CHECK, inParam); + //执行do的操作 + Map resultMap = IfsPlsqlUtils.execProcedureGetRecord(srv, "INVENTORY_PART_API", + "MODIFY__", PlsqlBaseMethodType.MODIFY, PlsqlBaseMethodAction.DO, inParam); + //返回结果集 + return resultMap; + } + + /** + * @description: 获取库存件的属性 + * @author LR + * @date 2024/12/11 14:24 + * @version 1.0 + */ + public static Map getInventoryPartCharacteristicCode(Server srv, String contract, String partNo, String characteristicCode) throws APException { + StringBuilder searchSql = new StringBuilder(); + searchSql.append("SELECT OBJID ifsRowId, OBJVERSION ifsRowVersion, CONTRACT, PART_NO, CHARACTERISTIC_CODE,"); + searchSql.append(" ifsapp.CHARACTERISTIC_API.Get_Description(CHARACTERISTIC_CODE) characteristicDesc,"); + searchSql.append(" ATTR_VALUE_NUMERIC, ATTR_VALUE_ALPHA, UNIT_MEAS"); + searchSql.append(" FROM ifsapp.INVENTORY_PART_CHAR_ALL"); + searchSql.append(" WHERE CONTRACT = :contract and PART_NO = :partNo AND CHARACTERISTIC_CODE = :characteristicCode"); + //设置查询的入参 + Map inParam = new HashMap<>(); + inParam.put("contract", contract); + inParam.put("partNo", partNo); + inParam.put("characteristicCode", characteristicCode); + //调用查询的通用方法 + RecordCollection recordCollection = IfsPlsqlUtils.execSqlSearchGetRecordCollection(srv, searchSql, inParam); + //判断能否返回 + if (recordCollection == null) { + return null; + } else { + Record recordData = recordCollection.get(0); + Map resultMap = IfsConverterToMap.ConverterIfsToMap(recordData); + return resultMap; + } + } + + /** + * @description: 查询库存件的属性集合 + * @author LR + * @date 2024/12/11 14:27 + * @version 1.0 + */ + public static List getInventoryPartCharacteristicCodes(Server srv, String contract, String partNo) throws APException { + StringBuilder searchSql = new StringBuilder(); + searchSql.append("SELECT OBJID ifsRowId, OBJVERSION ifsRowVersion, CONTRACT, PART_NO, CHARACTERISTIC_CODE,"); + searchSql.append(" ifsapp.CHARACTERISTIC_API.Get_Description(CHARACTERISTIC_CODE) characteristicDesc,"); + searchSql.append(" ATTR_VALUE_NUMERIC, ATTR_VALUE_ALPHA, UNIT_MEAS"); + searchSql.append(" FROM ifsapp.INVENTORY_PART_CHAR_ALL"); + 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 null; + } else { + List resultItems = new ArrayList<>(); + List> resultList = IfsConverterToMap.ConverterIfsToList(recordCollection); + //判断是否存在数据 + if(resultList == null) { + return resultItems; + } + //获取数据转bean + for (int i = 0; i < resultList.size(); i++) { + Map tempMap = resultList.get(i); + CharacteristicCode tempItem = new CharacteristicCode(); + //设置参数 + tempItem.setIfsRowId(tempMap.get("IFSROWID")); + tempItem.setIfsRowVersion(tempMap.get("IFSROWVERSION")); + tempItem.setContract(tempMap.get("CONTRACT")); + tempItem.setPartNo(tempMap.get("PART_NO")); + tempItem.setCharacteristicCode(tempMap.get("CHARACTERISTIC_CODE")); + tempItem.setCharacteristicDesc(tempMap.get("CHARACTERISTICDESC")); // 这个是通过函数获取的描述 + tempItem.setAttrValueNumeric(tempMap.get("ATTR_VALUE_NUMERIC")); + tempItem.setAttrValueAlpha(tempMap.get("ATTR_VALUE_ALPHA")); + tempItem.setUnitMeas(tempMap.get("UNIT_MEAS")); + //添加对象 + resultItems.add(tempItem); + } + return resultItems; + } + } + + /** + * @description: 插入库存件的属性 + * @author LR + * @date 2024/12/11 14:31 + * @version 1.0 + */ + public static Map insertInventoryPartCharacteristicCode(Server srv, CharacteristicCode inData) throws APException { + //公共参数 + String contract = inData.getContract(); + String partNo = inData.getPartNo().toUpperCase(); + String characteristicCode = inData.getCharacteristicCode(); + String unitMeas = inData.getUnitMeas(); + String attrValueNumeric = inData.getAttrValueNumeric(); + String attrValueAlpha = inData.getAttrValueAlpha(); + String characteristicType = inData.getCharacteristicType(); + //入参 + Map inParam = new HashMap<>(); + inParam.put("OBJID", ""); + inParam.put("OBJVERSION", ""); + inParam.put("CONTRACT", contract); + inParam.put("PART_NO", partNo); + inParam.put("CHARACTERISTIC_CODE", characteristicCode); + inParam.put("UNIT_MEAS", unitMeas); + + //区分类型 + if ("Alpha".equals(characteristicType)) { + inParam.put("ATTR_VALUE_ALPHA", attrValueAlpha); + } else if ("Numeric".equals(characteristicType)) { + inParam.put("ATTR_VALUE_NUMERIC", attrValueNumeric); + } + + //执行check的操作 + Map checkMap = IfsPlsqlUtils.execProcedureGetRecord(srv, "INVENTORY_PART_CHAR_API", + "NEW__", PlsqlBaseMethodType.NEW, PlsqlBaseMethodAction.CHECK, inParam); + //执行do的操作 + Map resultMap = IfsPlsqlUtils.execProcedureGetRecord(srv, "INVENTORY_PART_CHAR_API", + "NEW__", PlsqlBaseMethodType.NEW, PlsqlBaseMethodAction.DO, inParam); + //返回结果集 + return resultMap; + } + + /** + * @description: 修改库存件的属性 + * @author LR + * @date 2024/12/11 14:37 + * @version 1.0 + */ + public static Map modifyInventoryPartCharacteristicCode(Server srv, CharacteristicCode inData) throws APException { + //公共参数 + String ifsRowId = inData.getIfsRowId(); + String ifsRowVersion = inData.getIfsRowVersion(); + String attrValueNumeric = inData.getAttrValueNumeric(); + String attrValueAlpha = inData.getAttrValueAlpha(); + String characteristicType = inData.getCharacteristicType(); + //入参 + Map inParam = new HashMap<>(); + inParam.put("OBJID", ifsRowId); + inParam.put("OBJVERSION", ifsRowVersion); + + //区分类型 + if ("Alpha".equals(characteristicType)) { + inParam.put("ATTR_VALUE_ALPHA", attrValueAlpha); + } else if ("Numeric".equals(characteristicType)) { + inParam.put("ATTR_VALUE_NUMERIC", attrValueNumeric); + } + + //执行check的操作 + Map checkMap = IfsPlsqlUtils.execProcedureGetRecord(srv, "INVENTORY_PART_CHAR_API", + "MODIFY__", PlsqlBaseMethodType.MODIFY, PlsqlBaseMethodAction.CHECK, inParam); + //执行do的操作 + Map resultMap = IfsPlsqlUtils.execProcedureGetRecord(srv, "INVENTORY_PART_CHAR_API", + "MODIFY__", PlsqlBaseMethodType.MODIFY, PlsqlBaseMethodAction.DO, inParam); + //返回结果集 + return resultMap; + } + + /** + * @description: 删除库存件的属性 + * @author LR + * @date 2024/12/11 14:38 + * @version 1.0 + */ + public static Map removeInventoryPartCharacteristic(Server srv, CharacteristicCode inData) throws APException { + //公共参数 + String ifsRowId = inData.getIfsRowId(); + String ifsRowVersion = inData.getIfsRowVersion(); + //入参 + Map inParam = new HashMap<>(); + inParam.put("OBJID", ifsRowId); + inParam.put("OBJVERSION", ifsRowVersion); + + //执行check的操作 + Map checkMap = IfsPlsqlUtils.execProcedureGetRecord(srv, "INVENTORY_PART_CHAR_API", + "REMOVE__", PlsqlBaseMethodType.REMOVE, PlsqlBaseMethodAction.CHECK, inParam); + //执行do的操作 + Map resultMap = IfsPlsqlUtils.execProcedureGetRecord(srv, "INVENTORY_PART_CHAR_API", + "REMOVE__", PlsqlBaseMethodType.REMOVE, PlsqlBaseMethodAction.DO, inParam); + //返回结果集 + return resultMap; + } + + /** + * @description: 获取copy part的事件编码 + * @author LR + * @date 2024/12/9 15:56 + * @version 1.0 + */ + public static Map getCopyPartEventNo(Server srv) throws APException { + //填充参数 + List inParams = new ArrayList<>(); + List outParams = new ArrayList<>(); + //设置入参和出参 + inParams.add(new IfsParamBean("DEFAULT", "TEXT", "FALSE")); + outParams.add(new IfsParamBean("EVENT_NO", "NUMBER", "")); + //调用特殊的存储过程 + Map resultMap = IfsPlsqlUtils.execProcedureGetRecord(srv, + "Part_Copy_Manager_Partca_API", + "Generate_Copy_Event_Parameters", inParams, outParams); + //返回结果集 + return resultMap; + } + + /** + * @description: 执行查询的sql语句 获取明细的数据 + * @author LR + * @date 2024/12/9 16:35 + * @version 1.0 + */ + public static List getCopyPartItemsByEventNo(Server srv, String eventNo) throws APException { + StringBuilder searchSql = new StringBuilder(); + searchSql.append("SELECT OBJID ifsRowId, OBJVERSION ifsRowVersion, ENABLED_DB, CANCEL_WHEN_NO_SOURCE_DB, CANCEL_WHEN_EXISTING_COPY_DB,"); + searchSql.append(" ifsapp.Part_Copy_Module_Dataset_API.Get_Dataset_Description(MODULE, DATASET_ID) copyDesc, DATASET_ID, MODULE"); + searchSql.append(" FROM ifsapp.PART_COPY_EVENT_PARAMETER_EXT"); + searchSql.append(" WHERE EVENT_NO = :eventNo"); + searchSql.append(" ORDER BY EXECUTION_ORDER, PRESENTATION_ORDER"); + //设置查询的入参 + Map inParam = new HashMap<>(); + inParam.put("eventNo", eventNo); + //调用查询的通用方法 + RecordCollection recordCollection = IfsPlsqlUtils.execSqlSearchGetRecordCollection(srv, searchSql, inParam); + //判断能否返回 + if (recordCollection == null) { + return null; + } 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); + CopyPartItem tempItem = new CopyPartItem(); + //设置参数 + tempItem.setIfsRowId(tempMap.get("IFSROWID")); + tempItem.setIfsRowVersion(tempMap.get("IFSROWVERSION")); + tempItem.setCopyDesc(tempMap.get("COPYDESC")); + //添加对象 + resultItems.add(tempItem); + } + return resultItems; + } + } + + /** + * @description: 修改Copy Part的选项 + * @author LR + * @date 2024/12/9 17:13 + * @version 1.0 + */ + public static void modifyIfsCopyPartItem(Server srv, String ifsRowId, String ifsRowVersion, String enabledDb, String cancelWhenExistingCopyDb) throws APException { + Map inParam = new HashMap<>(); + //填充参数 + inParam.put("OBJID", ifsRowId); + inParam.put("OBJVERSION", ifsRowVersion); + inParam.put("ENABLED_DB", enabledDb); + inParam.put("CANCEL_WHEN_NO_SOURCE_DB", "FALSE"); + inParam.put("CANCEL_WHEN_EXISTING_COPY_DB", cancelWhenExistingCopyDb); + //执行存储过程 获取结果集 + Map resultMap = IfsPlsqlUtils.execProcedureGetRecord(srv, "PART_COPY_EVENT_PARAMETER_API", + "MODIFY__", PlsqlBaseMethodType.MODIFY, PlsqlBaseMethodAction.DO, inParam); + } + + /** + * @description: 处理库存件的 Copy Part功能 + * @author LR + * @date 2024/12/10 17:53 + * @version 1.0 + */ + public static void processIfsCopyPart(Server srv, String oriContract, String oriPartNo, String contract, + String partNo, String partDesc, String jobFalse, String eventNo) throws APException { + //填充参数 + List inParams = new ArrayList<>(); + List outParams = new ArrayList<>(); + //设置入参和出参 + inParams.add(new IfsParamBean("FROM_CONTRACT", "TEXT", oriContract)); + inParams.add(new IfsParamBean("FROM_PART_NO", "TEXT", oriPartNo)); + inParams.add(new IfsParamBean("TO_CONTRACT", "TEXT", contract)); + inParams.add(new IfsParamBean("TO_PART_NO", "TEXT", partNo)); + inParams.add(new IfsParamBean("TO_PART_DESC", "TEXT", partDesc)); + inParams.add(new IfsParamBean("IS_BACKGROUND_JOB", "TEXT", jobFalse)); + inParams.add(new IfsParamBean("EVENT_NO", "TEXT", eventNo)); + //调用特殊的存储过程 + Map resultMap = IfsPlsqlUtils.execProcedureGetRecord(srv, + "Part_Copy_Manager_Partca_API", "Copy", inParams, outParams); + + } + +} diff --git a/src/main/java/com/spring/ifs/bean/InventoryServiceBean.java b/src/main/java/com/spring/ifs/bean/InventoryServiceBean.java new file mode 100644 index 00000000..34fb80ee --- /dev/null +++ b/src/main/java/com/spring/ifs/bean/InventoryServiceBean.java @@ -0,0 +1,830 @@ +package com.spring.ifs.bean; + +import com.alibaba.fastjson.JSON; +import com.spring.ifs.api.*; +import com.spring.ifs.data.*; +import ifs.fnd.ap.APException; +import ifs.fnd.ap.Server; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +import java.util.List; +import java.util.Map; + +/** +* @description: 处理库存件的 +* @author LR +* @date 2024/12/9 15:44 +* @version 1.0 +*/ +@Component +public class InventoryServiceBean { + + @Autowired + private IfsServer ifsServer; + + private static final Logger logger = LoggerFactory.getLogger(InventoryServiceBean.class); + + /** + * @description: 查询库存件的信息 + * @author LR + * @date 2024/12/12 15:49 + * @version 1.0 + */ + public InventoryPart getInventoryPart(InventoryPart inData) throws APException { + logger.info("Inventory Part 查询开始:"+ JSON.toJSONString(inData)); + //查询的参数 + String username = inData.getIfsUsername(); + String password = inData.getIfsPassword(); + String contract = inData.getContract(); + String partNo = inData.getPartNo(); + //获取连接 + Server srv = ifsServer.getIfsServer(username, password); + Map partMap = InventoryPartApi.getInventoryPartByPartNo(srv, contract, partNo); + //判断是否需要插入到ifs + if(partMap == null || partMap.size() == 0) { + throw new RuntimeException("库存件不存在!"); + } + //设置ifs 信息 + inData.setIfsRowId(partMap.get("IFSROWID")); + inData.setIfsRowVersion(partMap.get("IFSROWVERSION")); + //查询库存件的属性模版 + Map templateMap = InventoryPartApi.getInventoryPartCharacteristicTemplate(srv, contract, partNo); + //设置模版 + inData.setEngAttribute(templateMap.get("ENG_ATTRIBUTE")); + logger.info("Inventory Part 查询结束:"+JSON.toJSONString(inData)); + return inData; + } + + /** + * @description: 库存件新增 + * @author LR + * @date 2024/12/12 15:52 + * @version 1.0 + */ + public InventoryPart syncInventoryPart(InventoryPart inData) throws APException { + logger.info("Inventory Part 新增开始:"+JSON.toJSONString(inData)); + //查询的参数 + String username = inData.getIfsUsername(); + String password = inData.getIfsPassword(); + String contract = inData.getContract(); + String partNo = inData.getPartNo(); + //获取连接 + Server srv = ifsServer.getIfsServer(username, password); + Map partMap = InventoryPartApi.getInventoryPartByPartNo(srv, contract, partNo); + //判断是否需要插入到ifs + if(partMap == null || partMap.size() == 0) { + //调用api + Map resultMap = InventoryPartApi.insertInventoryPart(srv, inData); + //设置ifs 信息 + inData.setIfsRowId(resultMap.get("OBJID")); + inData.setIfsRowVersion(resultMap.get("OBJVERSION")); + }else { + throw new RuntimeException("库存件已存在!"); + } + //打印日志 + logger.info("Inventory Part 新增结束:"+JSON.toJSONString(inData)); + //返回结果集 + return inData; + } + + /** + * @description: 库存件修改 + * @author LR + * @date 2024/12/12 15:55 + * @version 1.0 + */ + public InventoryPart modifyInventoryPart(InventoryPart inData) throws APException { + logger.info("Inventory Part 修改开始:"+JSON.toJSONString(inData)); + //查询的参数 + String username = inData.getIfsUsername(); + String password = inData.getIfsPassword(); + String contract = inData.getContract(); + String partNo = inData.getPartNo(); + //获取连接 + Server srv = ifsServer.getIfsServer(username, password); + Map partMap = InventoryPartApi.getInventoryPartByPartNo(srv, contract, partNo); + //判断是否需要插入到ifs + if(partMap == null || partMap.size() == 0) { + throw new RuntimeException("域:"+contract+"库存件:"+partNo+"不存在!"); + }else { + //设置ifs 信息 + inData.setIfsRowId(partMap.get("IFSROWID")); + inData.setIfsRowVersion(partMap.get("IFSROWVERSION")); + Map resultMap = InventoryPartApi.modifyInventoryPart(srv, inData); + //设置ifs 信息 + inData.setIfsRowVersion(resultMap.get("OBJVERSION")); + } + //打印日志 + logger.info("Inventory Part 修改结束:"+JSON.toJSONString(inData)); + //返回结果集 + return inData; + } + + /** + * @description: 库存件删除 + * @author LR + * @date 2024/12/12 15:58 + * @version 1.0 + */ + public void removeInventoryPart(InventoryPart inData) throws APException { + logger.info("Inventory Part 删除开始:"+JSON.toJSONString(inData)); + //查询的参数 + String username = inData.getIfsUsername(); + String password = inData.getIfsPassword(); + String contract = inData.getContract(); + String partNo = inData.getPartNo(); + //获取连接 + Server srv = ifsServer.getIfsServer(username, password); + Map partMap = InventoryPartApi.getInventoryPartByPartNo(srv, contract, partNo); + //判断是否需要插入到ifs + if(partMap == null || partMap.size() == 0) { + throw new RuntimeException("域:"+contract+"库存件:"+partNo+"不存在!"); + }else { + //设置ifs 信息 + inData.setIfsRowId(partMap.get("IFSROWID")); + inData.setIfsRowVersion(partMap.get("IFSROWVERSION")); + InventoryPartApi.removeInventoryPart(srv, inData); + } + //打印日志 + logger.info("Inventory Part 删除结束:"+JSON.toJSONString(inData)); + } + + /** + * @description: 修改库存件的配置信息 + * @author LR + * @date 2024/12/12 16:11 + * @version 1.0 + */ + public InventoryPartConfig modifyInventoryPartCost(InventoryPartConfig inData) throws APException { + logger.info("Inventory Part Cost 修改开始:"+JSON.toJSONString(inData)); + //查询的参数 + String username = inData.getIfsUsername(); + String password = inData.getIfsPassword(); + String contract = inData.getContract(); + String partNo = inData.getPartNo(); + //获取连接 + Server srv = ifsServer.getIfsServer(username, password); + Map partMap = InventoryPartApi.getInventoryPartConfig(srv, contract, partNo); + //判断是否需要插入到ifs + if(partMap == null || partMap.size() == 0) { + throw new RuntimeException("域:"+contract+"库存件:"+partNo+"不存在!"); + }else { + //设置ifs 信息 + inData.setIfsRowId(partMap.get("IFSROWID")); + inData.setIfsRowVersion(partMap.get("IFSROWVERSION")); + Map resultMap = InventoryPartApi.modifyInventoryPartCost(srv, inData); + //设置ifs 信息 + inData.setIfsRowVersion(resultMap.get("OBJVERSION")); + } + //打印日志 + logger.info("Inventory Part Cost 修改结束:"+JSON.toJSONString(inData)); + //返回结果集 + return inData; + } + + /** + * @description: 修改库存件的Plan + * @author LR + * @date 2024/12/12 16:31 + * @version 1.0 + */ + public InventoryPartPlan modifyInventoryPartPlan(InventoryPartPlan inData) throws APException { + logger.info("Inventory Part Plan 修改开始:"+JSON.toJSONString(inData)); + //查询的参数 + String username = inData.getIfsUsername(); + String password = inData.getIfsPassword(); + String contract = inData.getContract(); + String partNo = inData.getPartNo(); + //获取连接 + Server srv = ifsServer.getIfsServer(username, password); + Map partMap = InventoryPartApi.getInventoryPartByPartNo(srv, contract, partNo); + //判断是否需要插入到ifs + if(partMap == null || partMap.size() == 0) { + throw new RuntimeException("域:"+contract+"库存件:"+partNo+"不存在!"); + }else { + //获取库存件Plan配置的信息 + Map planMap = InventoryPartApi.getInventoryPartPlan(srv, contract, partNo); + //设置ifs 信息 + inData.setIfsRowId(planMap.get("IFSROWID")); + inData.setIfsRowVersion(planMap.get("IFSROWVERSION")); + Map resultMap = InventoryPartApi.modifyInventoryPartPlan(srv, inData); + //设置ifs 信息 + inData.setIfsRowVersion(resultMap.get("OBJVERSION")); + } + //打印日志 + logger.info("Inventory Part Plan 修改结束:"+JSON.toJSONString(inData)); + //返回结果集 + return inData; + } + + /** + * @description: 批量新增库位 + * @author LR + * @date 2024/12/12 16:36 + * @version 1.0 + */ + public List syncInventoryPartLocations(List inDatas) throws APException { + logger.info("Inventory Part Location 批量新增开始:"+JSON.toJSONString(inDatas)); + String username = inDatas.get(0).getIfsUsername(); + String password = inDatas.get(0).getIfsPassword(); + String contract = inDatas.get(0).getContract(); + String partNo = inDatas.get(0).getPartNo(); + //获取连接 + Server srv = ifsServer.getIfsServer(username, password); + Map partMap = InventoryPartApi.getInventoryPartByPartNo(srv, contract, partNo); + //判断是否需要插入到ifs + if(partMap == null || partMap.size() == 0) { + throw new RuntimeException("域:" + contract + "库存件:" + partNo + "不存在!"); + } + //编辑处理需要处理的数据 + for(InventoryPartLocation inData : inDatas) { + Map resultMap = InventoryPartApi.insertInventoryPartLocation(srv, inData); + //设置ifs 信息 + inData.setIfsRowId(resultMap.get("OBJID")); + inData.setIfsRowVersion(resultMap.get("OBJVERSION")); + } + logger.info("Inventory Part Location 批量新增结束:"+JSON.toJSONString(inDatas)); + //返回结果集 + return inDatas; + } + + /** + * @description: 删除单个库存件的 Location + * @author LR + * @date 2024/12/12 16:37 + * @version 1.0 + */ + public void removeInventoryPartLocation(InventoryPartLocation inData) throws APException { + logger.info("Inventory Part Location 删除开始:"+JSON.toJSONString(inData)); + String username = inData.getIfsUsername(); + String password = inData.getIfsPassword(); + String contract = inData.getContract(); + String partNo = inData.getPartNo(); + String locationNo = inData.getLocationNo(); + //获取连接 + Server srv = ifsServer.getIfsServer(username, password); + //获取库存件Plan配置的信息 + Map locationMap = InventoryPartApi.getInventoryPartLocation(srv, contract, partNo, locationNo); + //判断是否需要插入到ifs + if(locationMap == null || locationMap.size() == 0) { + throw new RuntimeException("域:" + contract + "库存件:" + partNo + "库位编码:" + locationNo +"不存在!"); + } + //设置ifs 信息 + inData.setIfsRowId(locationMap.get("IFSROWID")); + inData.setIfsRowVersion(locationMap.get("IFSROWVERSION")); + InventoryPartApi.removeInventoryPartLocation(srv, inData); + //打印日志 + logger.info("Inventory Part Location 删除结束:"+JSON.toJSONString(inData)); + } + + /** + * @description: 批量删除库位的信息 + * @author LR + * @date 2024/12/12 16:42 + * @version 1.0 + */ + public void removeInventoryPartLocations(List inDatas) throws APException { + logger.info("Inventory Part Location 批量删除开始:"+JSON.toJSONString(inDatas)); + String username = inDatas.get(0).getIfsUsername(); + String password = inDatas.get(0).getIfsPassword(); + String contract = inDatas.get(0).getContract(); + String partNo = inDatas.get(0).getPartNo(); + //获取连接 + Server srv = ifsServer.getIfsServer(username, password); + //循环处理数据 + for(InventoryPartLocation inData : inDatas) { + String locationNo = inData.getLocationNo(); + //获取库存件Plan配置的信息 + Map locationMap = InventoryPartApi.getInventoryPartLocation(srv, contract, partNo, locationNo); + //判断是否需要插入到ifs + if(locationMap == null || locationMap.size() == 0) { + throw new RuntimeException("域:" + contract + "库存件:" + partNo + "库位编码:" + locationNo +"不存在!"); + } + //设置ifs 信息 + inData.setIfsRowId(locationMap.get("IFSROWID")); + inData.setIfsRowVersion(locationMap.get("IFSROWVERSION")); + InventoryPartApi.removeInventoryPartLocation(srv, inData); + } + //打印日志 + logger.info("Inventory Part Location 批量删除结束:"+JSON.toJSONString(inDatas)); + } + + /** + * @description: 修改库存件的Manufacture + * @author LR + * @date 2024/12/12 16:44 + * @version 1.0 + */ + public InventoryPartManufacture modifyInventoryPartManufacture(InventoryPartManufacture inData) throws APException { + logger.info("Inventory Part Manufacture 修改开始:"+JSON.toJSONString(inData)); + //公共参数 + String username = inData.getIfsUsername(); + String password = inData.getIfsPassword(); + String contract = inData.getContract(); + String partNo = inData.getPartNo(); + //获取连接 + Server srv = ifsServer.getIfsServer(username, password); + //查询制造商信息 + Map manufMap = InventoryPartApi.getInventoryManufacture(srv, contract, partNo); + //判断是否需要插入到ifs + if(manufMap == null || manufMap.size() == 0) { + throw new RuntimeException("域:"+contract+"库存件:"+partNo+"不存在制造商信息!"); + }else { + //设置ifs 信息 + inData.setIfsRowId(manufMap.get("IFSROWID")); + inData.setIfsRowVersion(manufMap.get("IFSROWVERSION")); + Map resultMap = InventoryPartApi.modifyInventoryPartManufacture(srv, inData); + //设置ifs 信息 + inData.setIfsRowVersion(resultMap.get("IFSROWVERSION")); + } + //打印日志 + logger.info("Inventory Part Manufacture 修改结束:"+JSON.toJSONString(inData)); + //返回信息 + return inData; + } + + /** + * @description: 查询库存件 Revision + * @author LR + * @date 2024/12/12 16:59 + * @version 1.0 + */ + public InventoryPartRevision getInventoryPartRevision(InventoryPartRevision inData) throws APException { + logger.info("Inventory Part Revision 查询开始:"+JSON.toJSONString(inData)); + //公共参数 + String username = inData.getIfsUsername(); + String password = inData.getIfsPassword(); + String contract = inData.getContract(); + String partNo = inData.getPartNo(); + String engChgLevel = inData.getEngChgLevel(); + //获取连接 + Server srv = ifsServer.getIfsServer(username, password); + //查询制造商信息 + Map revisionMap = InventoryPartApi.getInventoryPartRevision(srv, contract, partNo, engChgLevel); + //判断是否需要插入到ifs + if(revisionMap == null) { + throw new RuntimeException("当前版本信息不存在!"); + } + //设置ifs 信息 + inData.setIfsRowId(revisionMap.get("IFSROWID")); + inData.setIfsRowVersion(revisionMap.get("IFSROWVERSION")); + //打印日志 + logger.info("Inventory Part Revision 查询结束:"+JSON.toJSONString(inData)); + return inData; + } + + /** + * @description: 插入库存件的版本 + * @author LR + * @date 2024/12/12 17:03 + * @version 1.0 + */ + public InventoryPartRevision syncInventoryPartRevision(InventoryPartRevision inData) throws APException { + logger.info("Inventory Part Revision 新增开始:"+JSON.toJSONString(inData)); + //公共参数 + String username = inData.getIfsUsername(); + String password = inData.getIfsPassword(); + String contract = inData.getContract(); + String partNo = inData.getPartNo(); + String engChgLevel = inData.getEngChgLevel(); + //获取连接 + Server srv = ifsServer.getIfsServer(username, password); + //查询制造商信息 + Map revisionMap = InventoryPartApi.getInventoryPartRevision(srv, contract, partNo, engChgLevel); + //判断是否需要插入到ifs + if(revisionMap != null) { + throw new RuntimeException("当前版本信息已存在!"); + } + //调用新增api + Map resultMap = InventoryPartApi.insertInventoryPartRevision(srv, inData); + //设置ifs 信息 + inData.setIfsRowId(resultMap.get("IFSROWID")); + inData.setIfsRowVersion(resultMap.get("IFSROWVERSION")); + //打印日志 + logger.info("Inventory Part Revision 新增结束:"+JSON.toJSONString(inData)); + //返回结果 + return inData; + } + + /** + * @description: 修改库存件的版本 + * @author LR + * @date 2024/12/12 17:06 + * @version 1.0 + */ + public InventoryPartRevision modifyInventoryPartRevision(InventoryPartRevision inData) throws APException { + logger.info("Inventory Part Revision 修改开始:"+JSON.toJSONString(inData)); + //公共参数 + String username = inData.getIfsUsername(); + String password = inData.getIfsPassword(); + String contract = inData.getContract(); + String partNo = inData.getPartNo(); + String engChgLevel = inData.getEngChgLevel(); + //获取连接 + Server srv = ifsServer.getIfsServer(username, password); + //查询制造商信息 + Map revisionMap = InventoryPartApi.getInventoryPartRevision(srv, contract, partNo, engChgLevel); + //判断是否需要插入到ifs + if(revisionMap == null || revisionMap.size() == 0) { + throw new RuntimeException("当前版本信息不存在!"); + } + //设置ifs 信息 + inData.setIfsRowId(revisionMap.get("IFSROWID")); + inData.setIfsRowVersion(revisionMap.get("IFSROWVERSION")); + //调用api + Map resultMap = InventoryPartApi.modifyInventoryPartRevision(srv, inData); + //设置ifs 信息 + inData.setIfsRowId(resultMap.get("IFSROWID")); + inData.setIfsRowVersion(resultMap.get("IFSROWVERSION")); + //打印日志 + logger.info("Inventory Part Revision 修改结束:"+JSON.toJSONString(inData)); + //返回结果 + return inData; + } + + /** + * @description: 删除库存件 Revision + * @author LR + * @date 2024/12/12 17:07 + * @version 1.0 + */ + public void removeInventoryPartRevision(InventoryPartRevision inData) throws APException { + logger.info("Inventory Part Revision 删除开始:"+JSON.toJSONString(inData)); + //公共参数 + String username = inData.getIfsUsername(); + String password = inData.getIfsPassword(); + String contract = inData.getContract(); + String partNo = inData.getPartNo(); + String engChgLevel = inData.getEngChgLevel(); + //获取连接 + Server srv = ifsServer.getIfsServer(username, password); + //查询制造商信息 + Map revisionMap = InventoryPartApi.getInventoryPartRevision(srv, contract, partNo, engChgLevel); + //判断是否需要插入到ifs + if(revisionMap == null || revisionMap.size() == 0) { + throw new RuntimeException("当前版本信息不存在!"); + } + //设置ifs 信息 + inData.setIfsRowId(revisionMap.get("IFSROWID")); + inData.setIfsRowVersion(revisionMap.get("IFSROWVERSION")); + //调用api + InventoryPartApi.removeInventoryPartRevision(srv, inData); + //打印日志 + logger.info("Inventory Part Revision 删除结束:"+JSON.toJSONString(inData)); + } + + /** + * @description: 批量新增属性 + * @author LR + * @date 2024/12/12 17:23 + * @version 1.0 + */ + public List syncInventoryPartCharacteristics(List inDatas) throws APException { + logger.info("Inventory Part Characteristic Code 批量新增开始:"+JSON.toJSONString(inDatas)); + //公共参数 + String username = inDatas.get(0).getIfsUsername(); + String password = inDatas.get(0).getIfsPassword(); + String contract = inDatas.get(0).getContract(); + String partNo = inDatas.get(0).getPartNo(); + //获取连接 + Server srv = ifsServer.getIfsServer(username, password); + //递归判断 + for(CharacteristicCode characteristic : inDatas) { + String characteristicCode = characteristic.getCharacteristicCode(); + Map characteristicMap = InventoryPartApi.getInventoryPartCharacteristicCode(srv, contract, partNo, characteristicCode); + if(characteristicMap != null || characteristicMap.size() > 0) { + throw new RuntimeException("属性编码已存在!"); + } + //校验通过继续新增 + Map resultMap = InventoryPartApi.insertInventoryPartCharacteristicCode(srv, characteristic); + //设置ifs 信息 + characteristic.setIfsRowId(resultMap.get("IFSROWID")); + characteristic.setIfsRowVersion(resultMap.get("IFSROWVERSION")); + } + //打印日志 + logger.info("Inventory Part Characteristic Code 批量新增结束:"+JSON.toJSONString(inDatas)); + return inDatas; + } + + /** + * @description: 按照料号删除库存件的属性 + * @author LR + * @date 2024/12/12 17:28 + * @version 1.0 + */ + public void removeInventoryPartCharacteristicsByPartNo(InventoryPart inData) throws APException { + logger.info("删除库存件的所有属性开始:"+JSON.toJSONString(inData)); + //公共参数 + String username = inData.getIfsUsername(); + String password = inData.getIfsPassword(); + String contract = inData.getContract(); + String partNo = inData.getPartNo(); + //获取连接 + Server srv = ifsServer.getIfsServer(username, password); + //查询当前物料的属性 先删除物料属性 再删除库存件 + List characteristicList = InventoryPartApi.getInventoryPartCharacteristicCodes(srv, contract, partNo); + //如果存在就批量删掉数据 + if(characteristicList != null && characteristicList.size() > 0) { + for(CharacteristicCode characteristic : characteristicList) { + //一个一个删掉库存件的属性 + InventoryPartApi.removeInventoryPartCharacteristic(srv, characteristic); + } + } + logger.info("删除库存件的所有属性结束:"+JSON.toJSONString(inData)); + } + + + /** + * @description: 删除库存件关联的数据 + * @author LR + * @date 2024/12/12 17:38 + * @version 1.0 + */ + public void removeInventoryPartRelationInfo(InventoryPart inData) throws APException { + logger.info("删除库存件的关联信息开始:"+JSON.toJSONString(inData)); + //公共参数 + String username = inData.getIfsUsername(); + String password = inData.getIfsPassword(); + String contract = inData.getContract(); + String partNo = inData.getPartNo(); + //获取连接 + Server srv = ifsServer.getIfsServer(username, password); + //按照条件查询Bom的相关信息 按照海波的要求 删除Bom Header + List bomHeaders = BomApi.getBomHeadersByPartNo(srv, contract, partNo); + //判断是否存在 + if(bomHeaders != null && bomHeaders.size() > 0) { + for(BomHeader bomHeader : bomHeaders) { + //执行删除的操作 + BomApi.removeBomHeader(srv, bomHeader); + } + } + + //按照条件查询Routing的相关信息 按照海波的要求 + List routingHeaders = RoutingApi.getRoutingHeadersByPartNo(srv, contract, partNo); + //判断是否存在 + if(routingHeaders != null && routingHeaders.size() > 0) { + for(RoutingHeader routingHeader : routingHeaders) { + //执行删除的操作 + RoutingApi.removeRoutingHeader(srv, routingHeader); + } + } + + //判断库存件是否存在 + InventoryPart inventoryPart = InventoryPartApi.getInventoryPart(srv, contract, partNo); + //如果存在需要删掉 + if(inventoryPart != null) { + //查询当前物料的属性 先删除物料属性 再删除库存件 + List characteristicCodes = InventoryPartApi.getInventoryPartCharacteristicCodes(srv, contract, partNo); + //如果存在就批量删掉数据 + if(characteristicCodes.size() > 0) { + for(CharacteristicCode characteristic : characteristicCodes) { + //一个一个删掉库存件的属性 + InventoryPartApi.removeInventoryPartCharacteristic(srv, characteristic); + } + } + InventoryPartApi.removeInventoryPart(srv, inventoryPart); + } + logger.info("删除库存件的关联信息结束:"+JSON.toJSONString(inData)); + } + + /** + * @description: 执行copy part的操作 + * @author LR + * @date 2024/12/9 15:51 + * @version 1.0 + */ + public void syncCopyPartForInventoryPart(CopyPart inData) throws APException { + //公共参数 + String username = inData.getIfsUsername(); + String password = inData.getIfsPassword(); + String oriContract = inData.getOriContract(); + String oriPartNo = inData.getOriPartNo(); + String contract = inData.getContract(); + String partNo = inData.getPartNo(); + String partDesc = inData.getPartDesc(); + String copyGeneral = inData.getCopyGeneral();//对应Inventory Part, General + String copyDefaultLocation = inData.getCopyDefaultLocation(); //Inventory Part, Default Locations + String copyCharacteristic = inData.getCopyCharacteristic(); //Inventory Part, Characteristics + String copyManufacturing = inData.getCopyManufacturing(); //Inventory Part, Manufacturing + String copyPPGeneral = inData.getCopyPPGeneral();//对应Purchase Part, General + String copyPPDocumentTexts = inData.getCopyPPDocumentTexts();//对应Purchase Part, Document Texts + String copyPPConnectedObjects = inData.getCopyPPConnectedObjects();//对应Purchase Part, Connected Objects + String copySPPGeneral = inData.getCopySPPGeneral();//对应Supplier for Purchase Part, General + String copySPPDocumentTexts = inData.getCopySPPDocumentTexts();//对应Supplier for Purchase Part, Document Texts + String copySPGeneral = inData.getCopySPGeneral();//对应Sales Part, General + String copySPCharacteristics = inData.getCopySPCharacteristics();//对应Sales Part, Characteristics + String copySPDocumentTexts = inData.getCopySPDocumentTexts();//对应Sales Part, Document Texts + String copySPLanguageDescription = inData.getCopySPLanguageDescription();//对应Sales Part, Language Description + //获取连接 + Server srv = ifsServer.getIfsServer(username, password); + //调用api方法获取事件的编码 + Map resultMap = InventoryPartApi.getCopyPartEventNo(srv); + String eventNo = resultMap.get("EVENT_NO"); + //调整选择的接口数据 + List copyPartItems = InventoryPartApi.getCopyPartItemsByEventNo(srv, eventNo); + //循环遍历 + for(CopyPartItem copyPartItem : copyPartItems) { + String copyDesc = copyPartItem.getCopyDesc(); + String ifsRowId = copyPartItem.getIfsRowId(); + String ifsRowVersion = copyPartItem.getIfsRowVersion(); + //处理Bom的数据都要传 + if(copyDesc.indexOf("Manufacturing Structure,") == 0) { + //调用api设置成 必传 重复不添加 + InventoryPartApi.modifyIfsCopyPartItem(srv, ifsRowId, ifsRowVersion, "TRUE", "TRUE"); + } + //处理Routing的数据都要传 + if(copyDesc.indexOf("Manufacturing Routings,") == 0) { + //调用api设置成 必传 重复不添加 + InventoryPartApi.modifyIfsCopyPartItem(srv, ifsRowId, ifsRowVersion, "TRUE", "TRUE"); + } + //处理master Part数据都要传 + if(copyDesc.indexOf("Part Catalog,") == 0 || copyDesc.indexOf("Part,") == 0) { + //调用api设置成 必传 重复不添加 + InventoryPartApi.modifyIfsCopyPartItem(srv, ifsRowId, ifsRowVersion, "TRUE", "TRUE"); + } + //针对Connected Objects 特殊设置 不确定页面和页签 + //库存件 + if(copyDesc.equalsIgnoreCase("Inventory Part, Connected Objects")) { + //调用api设置成 必传 重复不添加 + InventoryPartApi.modifyIfsCopyPartItem(srv, ifsRowId, ifsRowVersion, "TRUE", "TRUE"); + } + //库存件 + if(copyDesc.equalsIgnoreCase("Inventory Part, Document Texts")) { + //调用api设置成 必传 重复不添加 + InventoryPartApi.modifyIfsCopyPartItem(srv, ifsRowId, ifsRowVersion, "FALSE", "TRUE"); + } + + //销售件 + if(copyDesc.equalsIgnoreCase("Sales Part, Connected Objects")) { + //调用api设置成 必传 重复不添加 + InventoryPartApi.modifyIfsCopyPartItem(srv, ifsRowId, ifsRowVersion, "TRUE", "TRUE"); + } + + //针对特殊PLM控制的的数据 设置对应的参数 + //1.Inventory Part, General + if(copyDesc.equalsIgnoreCase("Inventory Part, General")) { + //根据plm的设置填充数据 + if("Y".equals(copyGeneral)) { + //调用api设置成 必传 重复不添加 + InventoryPartApi.modifyIfsCopyPartItem(srv, ifsRowId, ifsRowVersion, "TRUE", "TRUE"); + }else { + //调用api设置成 必传 重复不添加 + InventoryPartApi.modifyIfsCopyPartItem(srv, ifsRowId, ifsRowVersion, "FALSE", "TRUE"); + } + } + + //2.Inventory Part, Default Locations + if(copyDesc.equalsIgnoreCase("Inventory Part, Default Locations")) { + //根据plm的设置填充数据 + if("Y".equals(copyDefaultLocation)) { + //调用api设置成 必传 重复不添加 + InventoryPartApi.modifyIfsCopyPartItem(srv, ifsRowId, ifsRowVersion, "TRUE", "TRUE"); + }else { + //调用api设置成 必传 重复不添加 + InventoryPartApi.modifyIfsCopyPartItem(srv, ifsRowId, ifsRowVersion, "FALSE", "TRUE"); + } + } + + //3.Inventory Part, Characteristics + if(copyDesc.equalsIgnoreCase("Inventory Part, Characteristics")) { + //根据plm的设置填充数据 + if("Y".equals(copyCharacteristic)) { + //调用api设置成 必传 重复不添加 + InventoryPartApi.modifyIfsCopyPartItem(srv, ifsRowId, ifsRowVersion, "TRUE", "TRUE"); + }else { + //调用api设置成 必传 重复不添加 + InventoryPartApi.modifyIfsCopyPartItem(srv, ifsRowId, ifsRowVersion, "FALSE", "TRUE"); + } + } + + //4.Inventory Part, Manufacturing + if(copyDesc.equalsIgnoreCase("Inventory Part, Manufacturing")) { + //根据plm的设置填充数据 + if("Y".equals(copyManufacturing)) { + //调用api设置成 必传 重复不添加 + InventoryPartApi.modifyIfsCopyPartItem(srv, ifsRowId, ifsRowVersion, "TRUE", "TRUE"); + }else { + //调用api设置成 必传 重复不添加 + InventoryPartApi.modifyIfsCopyPartItem(srv, ifsRowId, ifsRowVersion, "FALSE", "TRUE"); + } + } + + //5.Purchase Part, General + if(copyDesc.equalsIgnoreCase("Purchase Part, General")) { + //根据plm的设置填充数据 + if("Y".equals(copyPPGeneral)) { + //调用api设置成 必传 重复不添加 + InventoryPartApi.modifyIfsCopyPartItem(srv, ifsRowId, ifsRowVersion, "TRUE", "TRUE"); + }else { + //调用api设置成 必传 重复不添加 + InventoryPartApi.modifyIfsCopyPartItem(srv, ifsRowId, ifsRowVersion, "FALSE", "TRUE"); + } + } + + //6.Purchase Part, Document Texts + if(copyDesc.equalsIgnoreCase("Purchase Part, Document Texts")) { + //根据plm的设置填充数据 + if("Y".equals(copyPPDocumentTexts)) { + //调用api设置成 必传 重复不添加 + InventoryPartApi.modifyIfsCopyPartItem(srv, ifsRowId, ifsRowVersion, "TRUE", "TRUE"); + }else { + //调用api设置成 必传 重复不添加 + InventoryPartApi.modifyIfsCopyPartItem(srv, ifsRowId, ifsRowVersion, "FALSE", "TRUE"); + } + } + + //7.Purchase Part, Connected Objects + if(copyDesc.equalsIgnoreCase("Purchase Part, Connected Objects")) { + //根据plm的设置填充数据 + if("Y".equals(copyPPConnectedObjects)) { + //调用api设置成 必传 重复不添加 + InventoryPartApi.modifyIfsCopyPartItem(srv, ifsRowId, ifsRowVersion, "TRUE", "TRUE"); + }else { + //调用api设置成 必传 重复不添加 + InventoryPartApi.modifyIfsCopyPartItem(srv, ifsRowId, ifsRowVersion, "FALSE", "TRUE"); + } + } + + //8.Supplier for Purchase Part, General + if(copyDesc.equalsIgnoreCase("Supplier for Purchase Part, General")) { + //根据plm的设置填充数据 + if("Y".equals(copySPPGeneral)) { + //调用api设置成 必传 重复不添加 + InventoryPartApi.modifyIfsCopyPartItem(srv, ifsRowId, ifsRowVersion, "TRUE", "TRUE"); + }else { + //调用api设置成 必传 重复不添加 + InventoryPartApi.modifyIfsCopyPartItem(srv, ifsRowId, ifsRowVersion, "FALSE", "TRUE"); + } + } + + //9.Supplier for Purchase Part, Document Texts + if(copyDesc.equalsIgnoreCase("Supplier for Purchase Part, Document Texts")) { + //根据plm的设置填充数据 + if("Y".equals(copySPPDocumentTexts)) { + //调用api设置成 必传 重复不添加 + InventoryPartApi.modifyIfsCopyPartItem(srv, ifsRowId, ifsRowVersion, "TRUE", "TRUE"); + }else { + //调用api设置成 必传 重复不添加 + InventoryPartApi.modifyIfsCopyPartItem(srv, ifsRowId, ifsRowVersion, "FALSE", "TRUE"); + } + } + + //10.Sales Part, General + if(copyDesc.equalsIgnoreCase("Sales Part, General")) { + //根据plm的设置填充数据 + if("Y".equals(copySPGeneral)) { + //调用api设置成 必传 重复不添加 + InventoryPartApi.modifyIfsCopyPartItem(srv, ifsRowId, ifsRowVersion, "TRUE", "TRUE"); + }else { + //调用api设置成 必传 重复不添加 + InventoryPartApi.modifyIfsCopyPartItem(srv, ifsRowId, ifsRowVersion, "FALSE", "TRUE"); + } + } + + //11.Sales Part, Characteristics + if(copyDesc.equalsIgnoreCase("Sales Part, Characteristics")) { + //根据plm的设置填充数据 + if("Y".equals(copySPCharacteristics)) { + //调用api设置成 必传 重复不添加 + InventoryPartApi.modifyIfsCopyPartItem(srv, ifsRowId, ifsRowVersion, "TRUE", "TRUE"); + }else { + //调用api设置成 必传 重复不添加 + InventoryPartApi.modifyIfsCopyPartItem(srv, ifsRowId, ifsRowVersion, "FALSE", "TRUE"); + } + } + + //12.Sales Part, Document Texts + if(copyDesc.equalsIgnoreCase("Sales Part, Document Texts")) { + //根据plm的设置填充数据 + if("Y".equals(copySPDocumentTexts)) { + //调用api设置成 必传 重复不添加 + InventoryPartApi.modifyIfsCopyPartItem(srv, ifsRowId, ifsRowVersion, "TRUE", "TRUE"); + }else { + //调用api设置成 必传 重复不添加 + InventoryPartApi.modifyIfsCopyPartItem(srv, ifsRowId, ifsRowVersion, "FALSE", "TRUE"); + } + } + + //13.Sales Part, Language Description + if(copyDesc.equalsIgnoreCase("Sales Part, Language Description")) { + //根据plm的设置填充数据 + if("Y".equals(copySPLanguageDescription)) { + //调用api设置成 必传 重复不添加 + InventoryPartApi.modifyIfsCopyPartItem(srv, ifsRowId, ifsRowVersion, "TRUE", "TRUE"); + }else { + //调用api设置成 必传 重复不添加 + InventoryPartApi.modifyIfsCopyPartItem(srv, ifsRowId, ifsRowVersion, "FALSE", "TRUE"); + } + } + } + //执行拷贝的操作 + InventoryPartApi.processIfsCopyPart(srv, oriContract, oriPartNo, contract, partNo, partDesc, "FALSE", eventNo); + } + + + + +} diff --git a/src/main/java/com/spring/ifs/data/CharacteristicCode.java b/src/main/java/com/spring/ifs/data/CharacteristicCode.java new file mode 100644 index 00000000..119946cc --- /dev/null +++ b/src/main/java/com/spring/ifs/data/CharacteristicCode.java @@ -0,0 +1,71 @@ +package com.spring.ifs.data; + +/** + * + * @ClassName: CharacteristicCodeData + * @Description:属性类 + * @author: LR + * @date: 2024年10月20日 下午5:35:05 + * @Copyright: + */ +public class CharacteristicCode extends PartCatalog { + private String characteristicCode; + private String characteristicDesc; + private String attrValueNumeric; + private String attrValueAlpha; + private String unitMeas; + private String characteristicType; + + public CharacteristicCode() { + super(); + } + + public String getCharacteristicCode() { + return characteristicCode; + } + + public void setCharacteristicCode(String characteristicCode) { + this.characteristicCode = characteristicCode; + } + + public String getCharacteristicDesc() { + return characteristicDesc; + } + + public void setCharacteristicDesc(String characteristicDesc) { + this.characteristicDesc = characteristicDesc; + } + + public String getAttrValueNumeric() { + return attrValueNumeric; + } + + public void setAttrValueNumeric(String attrValueNumeric) { + this.attrValueNumeric = attrValueNumeric; + } + + public String getAttrValueAlpha() { + return attrValueAlpha; + } + + public void setAttrValueAlpha(String attrValueAlpha) { + this.attrValueAlpha = attrValueAlpha; + } + + public String getUnitMeas() { + return unitMeas; + } + + public void setUnitMeas(String unitMeas) { + this.unitMeas = unitMeas; + } + + public String getCharacteristicType() { + return characteristicType; + } + + public void setCharacteristicType(String characteristicType) { + this.characteristicType = characteristicType; + } + +} diff --git a/src/main/java/com/spring/ifs/data/CharacteristicTemplate.java b/src/main/java/com/spring/ifs/data/CharacteristicTemplate.java new file mode 100644 index 00000000..644b430e --- /dev/null +++ b/src/main/java/com/spring/ifs/data/CharacteristicTemplate.java @@ -0,0 +1,15 @@ +package com.spring.ifs.data; + +/** +* @description: 库存件 +* @author LR +* @date 2024/12/11 9:53 +* @version 1.0 +*/ +public class CharacteristicTemplate extends InventoryPart { + + public CharacteristicTemplate() { + } + + +} diff --git a/src/main/java/com/spring/ifs/data/CopyPart.java b/src/main/java/com/spring/ifs/data/CopyPart.java new file mode 100644 index 00000000..b998d19c --- /dev/null +++ b/src/main/java/com/spring/ifs/data/CopyPart.java @@ -0,0 +1,152 @@ +package com.spring.ifs.data; + +/** + * + * @ClassName: CopyPart + * @Description: CopyPart功能使用 + * @author: LR + * @date: 2024年11月25日 上午9:25:50 + * @Copyright: + */ +public class CopyPart extends PartCatalog { + private String oriContract;// + private String oriPartNo;// + private String copyGeneral;//对应Inventory Part, General + private String copyDefaultLocation; //Inventory Part, Default Locations + private String copyCharacteristic; //Inventory Part, Characteristics + private String copyManufacturing; //Inventory Part, Manufacturing + private String copyPPGeneral;//对应Purchase Part, General + private String copyPPDocumentTexts;//对应Purchase Part, Document Texts + private String copyPPConnectedObjects;//对应Purchase Part, Connected Objects + private String copySPPGeneral;//对应Supplier for Purchase Part, General + private String copySPPDocumentTexts;//对应Supplier for Purchase Part, Document Texts + private String copySPGeneral;//对应Sales Part, General + private String copySPCharacteristics;//对应Sales Part, Characteristics + private String copySPDocumentTexts;//对应Sales Part, Document Texts + private String copySPLanguageDescription;//对应Sales Part, Language Description + + public CopyPart() { + super(); + } + + public String getOriContract() { + return oriContract; + } + + public void setOriContract(String oriContract) { + this.oriContract = oriContract; + } + + public String getOriPartNo() { + return oriPartNo; + } + + public void setOriPartNo(String oriPartNo) { + this.oriPartNo = oriPartNo; + } + + public String getCopyGeneral() { + return copyGeneral; + } + + public void setCopyGeneral(String copyGeneral) { + this.copyGeneral = copyGeneral; + } + + public String getCopyDefaultLocation() { + return copyDefaultLocation; + } + + public void setCopyDefaultLocation(String copyDefaultLocation) { + this.copyDefaultLocation = copyDefaultLocation; + } + + public String getCopyCharacteristic() { + return copyCharacteristic; + } + + public void setCopyCharacteristic(String copyCharacteristic) { + this.copyCharacteristic = copyCharacteristic; + } + + public String getCopyManufacturing() { + return copyManufacturing; + } + + public void setCopyManufacturing(String copyManufacturing) { + this.copyManufacturing = copyManufacturing; + } + + public String getCopyPPGeneral() { + return copyPPGeneral; + } + + public void setCopyPPGeneral(String copyPPGeneral) { + this.copyPPGeneral = copyPPGeneral; + } + + public String getCopyPPDocumentTexts() { + return copyPPDocumentTexts; + } + + public void setCopyPPDocumentTexts(String copyPPDocumentTexts) { + this.copyPPDocumentTexts = copyPPDocumentTexts; + } + + public String getCopyPPConnectedObjects() { + return copyPPConnectedObjects; + } + + public void setCopyPPConnectedObjects(String copyPPConnectedObjects) { + this.copyPPConnectedObjects = copyPPConnectedObjects; + } + + public String getCopySPPGeneral() { + return copySPPGeneral; + } + + public void setCopySPPGeneral(String copySPPGeneral) { + this.copySPPGeneral = copySPPGeneral; + } + + public String getCopySPPDocumentTexts() { + return copySPPDocumentTexts; + } + + public void setCopySPPDocumentTexts(String copySPPDocumentTexts) { + this.copySPPDocumentTexts = copySPPDocumentTexts; + } + + public String getCopySPGeneral() { + return copySPGeneral; + } + + public void setCopySPGeneral(String copySPGeneral) { + this.copySPGeneral = copySPGeneral; + } + + public String getCopySPCharacteristics() { + return copySPCharacteristics; + } + + public void setCopySPCharacteristics(String copySPCharacteristics) { + this.copySPCharacteristics = copySPCharacteristics; + } + + public String getCopySPDocumentTexts() { + return copySPDocumentTexts; + } + + public void setCopySPDocumentTexts(String copySPDocumentTexts) { + this.copySPDocumentTexts = copySPDocumentTexts; + } + + public String getCopySPLanguageDescription() { + return copySPLanguageDescription; + } + + public void setCopySPLanguageDescription(String copySPLanguageDescription) { + this.copySPLanguageDescription = copySPLanguageDescription; + } + +} diff --git a/src/main/java/com/spring/ifs/data/CopyPartItem.java b/src/main/java/com/spring/ifs/data/CopyPartItem.java new file mode 100644 index 00000000..a23b3621 --- /dev/null +++ b/src/main/java/com/spring/ifs/data/CopyPartItem.java @@ -0,0 +1,90 @@ +package com.spring.ifs.data; + +/** + * + * @ClassName: CopyPartItemData + * @Description:查询复制物料的明细控制明细 + * @author: LR + * @date: 2024年11月26日 上午11:26:18 + * @Copyright: + */ +public class CopyPartItem { + private String ifsRowId; + private String ifsRowVersion; + private String enabledDb; + private String copyDesc; + private String cancelWhenNoSourceDb; + private String cancelWhenExistingCopyDb; + private String datasetId; + private String module; + + public CopyPartItem() { + super(); + // TODO Auto-generated constructor stub + } + + public String getIfsRowId() { + return ifsRowId; + } + + public void setIfsRowId(String ifsRowId) { + this.ifsRowId = ifsRowId; + } + + public String getIfsRowVersion() { + return ifsRowVersion; + } + + public void setIfsRowVersion(String ifsRowVersion) { + this.ifsRowVersion = ifsRowVersion; + } + + public String getEnabledDb() { + return enabledDb; + } + + public void setEnabledDb(String enabledDb) { + this.enabledDb = enabledDb; + } + + public String getCopyDesc() { + return copyDesc; + } + + public void setCopyDesc(String copyDesc) { + this.copyDesc = copyDesc; + } + + public String getCancelWhenNoSourceDb() { + return cancelWhenNoSourceDb; + } + + public void setCancelWhenNoSourceDb(String cancelWhenNoSourceDb) { + this.cancelWhenNoSourceDb = cancelWhenNoSourceDb; + } + + public String getCancelWhenExistingCopyDb() { + return cancelWhenExistingCopyDb; + } + + public void setCancelWhenExistingCopyDb(String cancelWhenExistingCopyDb) { + this.cancelWhenExistingCopyDb = cancelWhenExistingCopyDb; + } + + public String getDatasetId() { + return datasetId; + } + + public void setDatasetId(String datasetId) { + this.datasetId = datasetId; + } + + public String getModule() { + return module; + } + + public void setModule(String module) { + this.module = module; + } + +} diff --git a/src/main/java/com/spring/ifs/data/IfsParamBean.java b/src/main/java/com/spring/ifs/data/IfsParamBean.java new file mode 100644 index 00000000..dec427b6 --- /dev/null +++ b/src/main/java/com/spring/ifs/data/IfsParamBean.java @@ -0,0 +1,52 @@ +package com.spring.ifs.data; + +/** + * + * @ClassName: InParamBean + * @Description:入参控制类 + * @author: LR + * @date: 2024年12月10日 下午4:05:11 + * @Copyright: + */ +public class IfsParamBean { + private String columnName; + private String columnType; + private String columnValue; + + public IfsParamBean() { + super(); + // TODO Auto-generated constructor stub + } + + public IfsParamBean(String columnName, String columnType, String columnValue) { + super(); + this.columnName = columnName; + this.columnType = columnType; + this.columnValue = columnValue; + } + + public String getColumnName() { + return columnName; + } + + public void setColumnName(String columnName) { + this.columnName = columnName; + } + + public String getColumnType() { + return columnType; + } + + public void setColumnType(String columnType) { + this.columnType = columnType; + } + + public String getColumnValue() { + return columnValue; + } + + public void setColumnValue(String columnValue) { + this.columnValue = columnValue; + } + +} diff --git a/src/main/java/com/spring/ifs/data/InventoryPart.java b/src/main/java/com/spring/ifs/data/InventoryPart.java new file mode 100644 index 00000000..735d25d8 --- /dev/null +++ b/src/main/java/com/spring/ifs/data/InventoryPart.java @@ -0,0 +1,294 @@ +package com.spring.ifs.data; + +/** +* @description: 库存件 +* @author LR +* @date 2024/12/11 9:53 +* @version 1.0 +*/ +public class InventoryPart extends PartCatalog { + private String typeCode;// 大分类 + private String plannerBuyer;// 计划购买人员 + private String unitMeas;// 单位 + private String primeCommodity;// + private String secondCommodity;// + private String assetClass;// + private String partStatus;// 状态 + private String abcClass;// 状态 + private String hazardCode;// + private String accountingGroup;// 商品属性编码 + private String partProductCode;// 产品代码 + private String partProductFamily;// 分类 + private String typeDesignation;// 类型标识 + private String dimQuality;// 功能 + private String noteText;// 备注 + private String leadTimeCode;// + private String manufLeadtime;// + private String expectedLeadtime;// + private String countryOfOrigin;// 国家 + private String regionOfOrigin;// 产地区域 + private String customsStatNo;// + private String intrastatConvFactor;// + private String durabilityDay;// + private String inventoryValuationMethod;// + private String inventoryPartCostLevel;// + private String invoiceConsideration;// + private String zeroCostFlag;// + private String partCostGroupId;// + private String engAttribute;// 库存件的属性模版 + private String engChgLevel;// + private String bomType; + + public InventoryPart() { + super(); + } + + public String getTypeCode() { + return typeCode; + } + + public void setTypeCode(String typeCode) { + this.typeCode = typeCode; + } + + public String getPlannerBuyer() { + return plannerBuyer; + } + + public void setPlannerBuyer(String plannerBuyer) { + this.plannerBuyer = plannerBuyer; + } + + public String getUnitMeas() { + return unitMeas; + } + + public void setUnitMeas(String unitMeas) { + this.unitMeas = unitMeas; + } + + public String getPrimeCommodity() { + return primeCommodity; + } + + public void setPrimeCommodity(String primeCommodity) { + this.primeCommodity = primeCommodity; + } + + public String getSecondCommodity() { + return secondCommodity; + } + + public void setSecondCommodity(String secondCommodity) { + this.secondCommodity = secondCommodity; + } + + public String getAssetClass() { + return assetClass; + } + + public void setAssetClass(String assetClass) { + this.assetClass = assetClass; + } + + public String getPartStatus() { + return partStatus; + } + + public void setPartStatus(String partStatus) { + this.partStatus = partStatus; + } + + public String getAbcClass() { + return abcClass; + } + + public void setAbcClass(String abcClass) { + this.abcClass = abcClass; + } + + public String getHazardCode() { + return hazardCode; + } + + public void setHazardCode(String hazardCode) { + this.hazardCode = hazardCode; + } + + public String getAccountingGroup() { + return accountingGroup; + } + + public void setAccountingGroup(String accountingGroup) { + this.accountingGroup = accountingGroup; + } + + public String getPartProductCode() { + return partProductCode; + } + + public void setPartProductCode(String partProductCode) { + this.partProductCode = partProductCode; + } + + public String getPartProductFamily() { + return partProductFamily; + } + + public void setPartProductFamily(String partProductFamily) { + this.partProductFamily = partProductFamily; + } + + public String getTypeDesignation() { + return typeDesignation; + } + + public void setTypeDesignation(String typeDesignation) { + this.typeDesignation = typeDesignation; + } + + public String getDimQuality() { + return dimQuality; + } + + public void setDimQuality(String dimQuality) { + this.dimQuality = dimQuality; + } + + public String getNoteText() { + return noteText; + } + + public void setNoteText(String noteText) { + this.noteText = noteText; + } + + public String getLeadTimeCode() { + return leadTimeCode; + } + + public void setLeadTimeCode(String leadTimeCode) { + this.leadTimeCode = leadTimeCode; + } + + public String getManufLeadtime() { + return manufLeadtime; + } + + public void setManufLeadtime(String manufLeadtime) { + this.manufLeadtime = manufLeadtime; + } + + public String getExpectedLeadtime() { + return expectedLeadtime; + } + + public void setExpectedLeadtime(String expectedLeadtime) { + this.expectedLeadtime = expectedLeadtime; + } + + public String getCountryOfOrigin() { + return countryOfOrigin; + } + + public void setCountryOfOrigin(String countryOfOrigin) { + this.countryOfOrigin = countryOfOrigin; + } + + public String getRegionOfOrigin() { + return regionOfOrigin; + } + + public void setRegionOfOrigin(String regionOfOrigin) { + this.regionOfOrigin = regionOfOrigin; + } + + public String getCustomsStatNo() { + return customsStatNo; + } + + public void setCustomsStatNo(String customsStatNo) { + this.customsStatNo = customsStatNo; + } + + public String getIntrastatConvFactor() { + return intrastatConvFactor; + } + + public void setIntrastatConvFactor(String intrastatConvFactor) { + this.intrastatConvFactor = intrastatConvFactor; + } + + public String getDurabilityDay() { + return durabilityDay; + } + + public void setDurabilityDay(String durabilityDay) { + this.durabilityDay = durabilityDay; + } + + public String getInventoryValuationMethod() { + return inventoryValuationMethod; + } + + public void setInventoryValuationMethod(String inventoryValuationMethod) { + this.inventoryValuationMethod = inventoryValuationMethod; + } + + public String getInventoryPartCostLevel() { + return inventoryPartCostLevel; + } + + public void setInventoryPartCostLevel(String inventoryPartCostLevel) { + this.inventoryPartCostLevel = inventoryPartCostLevel; + } + + public String getInvoiceConsideration() { + return invoiceConsideration; + } + + public void setInvoiceConsideration(String invoiceConsideration) { + this.invoiceConsideration = invoiceConsideration; + } + + public String getZeroCostFlag() { + return zeroCostFlag; + } + + public void setZeroCostFlag(String zeroCostFlag) { + this.zeroCostFlag = zeroCostFlag; + } + + public String getPartCostGroupId() { + return partCostGroupId; + } + + public void setPartCostGroupId(String partCostGroupId) { + this.partCostGroupId = partCostGroupId; + } + + public String getEngAttribute() { + return engAttribute; + } + + public void setEngAttribute(String engAttribute) { + this.engAttribute = engAttribute; + } + + public String getEngChgLevel() { + return engChgLevel; + } + + public void setEngChgLevel(String engChgLevel) { + this.engChgLevel = engChgLevel; + } + + public String getBomType() { + return bomType; + } + + public void setBomType(String bomType) { + this.bomType = bomType; + } + +} diff --git a/src/main/java/com/spring/ifs/data/InventoryPartConfig.java b/src/main/java/com/spring/ifs/data/InventoryPartConfig.java new file mode 100644 index 00000000..05fe2710 --- /dev/null +++ b/src/main/java/com/spring/ifs/data/InventoryPartConfig.java @@ -0,0 +1,27 @@ +package com.spring.ifs.data; + +public class InventoryPartConfig extends PartCatalog { + private String configurationId;// + private String estimatedMaterialCost;// + + public InventoryPartConfig() { + super(); + } + + public String getConfigurationId() { + return configurationId; + } + + public void setConfigurationId(String configurationId) { + this.configurationId = configurationId; + } + + public String getEstimatedMaterialCost() { + return estimatedMaterialCost; + } + + public void setEstimatedMaterialCost(String estimatedMaterialCost) { + this.estimatedMaterialCost = estimatedMaterialCost; + } + +} diff --git a/src/main/java/com/spring/ifs/data/InventoryPartLocation.java b/src/main/java/com/spring/ifs/data/InventoryPartLocation.java new file mode 100644 index 00000000..f272a285 --- /dev/null +++ b/src/main/java/com/spring/ifs/data/InventoryPartLocation.java @@ -0,0 +1,26 @@ +package com.spring.ifs.data; + +public class InventoryPartLocation extends PartCatalog { + private String locationNo; // + private String locationType; // + + public InventoryPartLocation() { + } + + public String getLocationNo() { + return locationNo; + } + + public void setLocationNo(String locationNo) { + this.locationNo = locationNo; + } + + public String getLocationType() { + return locationType; + } + + public void setLocationType(String locationType) { + this.locationType = locationType; + } + +} diff --git a/src/main/java/com/spring/ifs/data/InventoryPartManufacture.java b/src/main/java/com/spring/ifs/data/InventoryPartManufacture.java new file mode 100644 index 00000000..bdba1353 --- /dev/null +++ b/src/main/java/com/spring/ifs/data/InventoryPartManufacture.java @@ -0,0 +1,134 @@ +package com.spring.ifs.data; + +public class InventoryPartManufacture extends PartCatalog { + private String cumLeadtime; // + private String unprotectedLeadTime; // + private String fixedLeadtimeDay; // + private String variableLeadtimeDay; // + private String fixedLeadtimeHour; // + private String variableLeadtimeHour; // + private String backflushPart; // + private String issueType; // + private String overReporting; // + private String overReportTolerance; // + private String byProdAsSupplyInMrpDb; // + private String mrpControlFlagDb; // + private String useTheoriticalDensityDb; // + private String density; // + + public InventoryPartManufacture() { + } + + public String getCumLeadtime() { + return cumLeadtime; + } + + public void setCumLeadtime(String cumLeadtime) { + this.cumLeadtime = cumLeadtime; + } + + public String getUnprotectedLeadTime() { + return unprotectedLeadTime; + } + + public void setUnprotectedLeadTime(String unprotectedLeadTime) { + this.unprotectedLeadTime = unprotectedLeadTime; + } + + public String getFixedLeadtimeDay() { + return fixedLeadtimeDay; + } + + public void setFixedLeadtimeDay(String fixedLeadtimeDay) { + this.fixedLeadtimeDay = fixedLeadtimeDay; + } + + public String getVariableLeadtimeDay() { + return variableLeadtimeDay; + } + + public void setVariableLeadtimeDay(String variableLeadtimeDay) { + this.variableLeadtimeDay = variableLeadtimeDay; + } + + public String getFixedLeadtimeHour() { + return fixedLeadtimeHour; + } + + public void setFixedLeadtimeHour(String fixedLeadtimeHour) { + this.fixedLeadtimeHour = fixedLeadtimeHour; + } + + public String getVariableLeadtimeHour() { + return variableLeadtimeHour; + } + + public void setVariableLeadtimeHour(String variableLeadtimeHour) { + this.variableLeadtimeHour = variableLeadtimeHour; + } + + public String getBackflushPart() { + return backflushPart; + } + + public void setBackflushPart(String backflushPart) { + this.backflushPart = backflushPart; + } + + public String getIssueType() { + return issueType; + } + + public void setIssueType(String issueType) { + this.issueType = issueType; + } + + public String getOverReporting() { + return overReporting; + } + + public void setOverReporting(String overReporting) { + this.overReporting = overReporting; + } + + public String getOverReportTolerance() { + return overReportTolerance; + } + + public void setOverReportTolerance(String overReportTolerance) { + this.overReportTolerance = overReportTolerance; + } + + public String getByProdAsSupplyInMrpDb() { + return byProdAsSupplyInMrpDb; + } + + public void setByProdAsSupplyInMrpDb(String byProdAsSupplyInMrpDb) { + this.byProdAsSupplyInMrpDb = byProdAsSupplyInMrpDb; + } + + public String getMrpControlFlagDb() { + return mrpControlFlagDb; + } + + public void setMrpControlFlagDb(String mrpControlFlagDb) { + this.mrpControlFlagDb = mrpControlFlagDb; + } + + public String getUseTheoriticalDensityDb() { + return useTheoriticalDensityDb; + } + + public void setUseTheoriticalDensityDb(String useTheoriticalDensityDb) { + this.useTheoriticalDensityDb = useTheoriticalDensityDb; + } + + public String getDensity() { + return density; + } + + public void setDensity(String density) { + this.density = density; + } + +} diff --git a/src/main/java/com/spring/ifs/data/InventoryPartPlan.java b/src/main/java/com/spring/ifs/data/InventoryPartPlan.java new file mode 100644 index 00000000..dc9d1e1f --- /dev/null +++ b/src/main/java/com/spring/ifs/data/InventoryPartPlan.java @@ -0,0 +1,81 @@ +package com.spring.ifs.data; + +public class InventoryPartPlan extends PartCatalog { + private String planningMethod; // + private String safetyStock; // + private String safetyLeadTime; // + private String minOrderQty; // + private String maxOrderQty; // + private String mulOrderQty; // + private String shrinkageFac; // + private String stdOrderSize; // + + public InventoryPartPlan() { + super(); + } + + public String getPlanningMethod() { + return planningMethod; + } + + public void setPlanningMethod(String planningMethod) { + this.planningMethod = planningMethod; + } + + public String getSafetyStock() { + return safetyStock; + } + + public void setSafetyStock(String safetyStock) { + this.safetyStock = safetyStock; + } + + public String getSafetyLeadTime() { + return safetyLeadTime; + } + + public void setSafetyLeadTime(String safetyLeadTime) { + this.safetyLeadTime = safetyLeadTime; + } + + public String getMinOrderQty() { + return minOrderQty; + } + + public void setMinOrderQty(String minOrderQty) { + this.minOrderQty = minOrderQty; + } + + public String getMaxOrderQty() { + return maxOrderQty; + } + + public void setMaxOrderQty(String maxOrderQty) { + this.maxOrderQty = maxOrderQty; + } + + public String getMulOrderQty() { + return mulOrderQty; + } + + public void setMulOrderQty(String mulOrderQty) { + this.mulOrderQty = mulOrderQty; + } + + public String getShrinkageFac() { + return shrinkageFac; + } + + public void setShrinkageFac(String shrinkageFac) { + this.shrinkageFac = shrinkageFac; + } + + public String getStdOrderSize() { + return stdOrderSize; + } + + public void setStdOrderSize(String stdOrderSize) { + this.stdOrderSize = stdOrderSize; + } + +} diff --git a/src/main/java/com/spring/ifs/data/InventoryPartRevision.java b/src/main/java/com/spring/ifs/data/InventoryPartRevision.java new file mode 100644 index 00000000..5e6bd130 --- /dev/null +++ b/src/main/java/com/spring/ifs/data/InventoryPartRevision.java @@ -0,0 +1,75 @@ +package com.spring.ifs.data; + +public class InventoryPartRevision extends PartCatalog { + private String engChgLevel; // + private String revisionText;// + private String effPhaseInDate; // 启用时间 + private String effPhaseOutDate; // 失效时间 + private String engRevision; // + private String engRevisionDesc; // + + public InventoryPartRevision() { + super(); + } + + + public String getEngChgLevel() { + return engChgLevel; + } + + + public void setEngChgLevel(String engChgLevel) { + this.engChgLevel = engChgLevel; + } + + + public String getRevisionText() { + return revisionText; + } + + + public void setRevisionText(String revisionText) { + this.revisionText = revisionText; + } + + + public String getEffPhaseInDate() { + return effPhaseInDate; + } + + + public void setEffPhaseInDate(String effPhaseInDate) { + this.effPhaseInDate = effPhaseInDate; + } + + + public String getEffPhaseOutDate() { + return effPhaseOutDate; + } + + + public void setEffPhaseOutDate(String effPhaseOutDate) { + this.effPhaseOutDate = effPhaseOutDate; + } + + + public String getEngRevision() { + return engRevision; + } + + + public void setEngRevision(String engRevision) { + this.engRevision = engRevision; + } + + + public String getEngRevisionDesc() { + return engRevisionDesc; + } + + + public void setEngRevisionDesc(String engRevisionDesc) { + this.engRevisionDesc = engRevisionDesc; + } + +} diff --git a/src/main/java/com/spring/ifs/data/InventoryValue.java b/src/main/java/com/spring/ifs/data/InventoryValue.java new file mode 100644 index 00000000..7632cd3d --- /dev/null +++ b/src/main/java/com/spring/ifs/data/InventoryValue.java @@ -0,0 +1,90 @@ +package com.spring.ifs.data; + +/** + * @ClassName: IfsInventoryValue + * @Description: 库存件的数据 + * @author: LR + * @date: 2024年11月13日 上午10:41:55 + * @Copyright: + */ +public class InventoryValue { + private String site;// + private String partNo;// + private String configurationId;// + private String lotBatchNo;// + private String serialNo;// + private String inventoryValue; + private String ifsRowId; + private String ifsRowVersion; + + public InventoryValue() { + super(); + } + + + public String getSite() { + return site; + } + + + public void setSite(String site) { + this.site = site; + } + + + public String getPartNo() { + return partNo; + } + + public void setPartNo(String partNo) { + this.partNo = partNo; + } + + public String getConfigurationId() { + return configurationId; + } + + public void setConfigurationId(String configurationId) { + this.configurationId = configurationId; + } + + public String getLotBatchNo() { + return lotBatchNo; + } + + public void setLotBatchNo(String lotBatchNo) { + this.lotBatchNo = lotBatchNo; + } + + public String getSerialNo() { + return serialNo; + } + + public void setSerialNo(String serialNo) { + this.serialNo = serialNo; + } + + public String getInventoryValue() { + return inventoryValue; + } + + public void setInventoryValue(String inventoryValue) { + this.inventoryValue = inventoryValue; + } + + public String getIfsRowId() { + return ifsRowId; + } + + public void setIfsRowId(String ifsRowId) { + this.ifsRowId = ifsRowId; + } + + public String getIfsRowVersion() { + return ifsRowVersion; + } + + public void setIfsRowVersion(String ifsRowVersion) { + this.ifsRowVersion = ifsRowVersion; + } +} diff --git a/src/main/java/com/spring/ifs/utils/IfsConverterToMap.java b/src/main/java/com/spring/ifs/utils/IfsConverterToMap.java new file mode 100644 index 00000000..8a031c95 --- /dev/null +++ b/src/main/java/com/spring/ifs/utils/IfsConverterToMap.java @@ -0,0 +1,176 @@ +package com.spring.ifs.utils; + +import ifs.fnd.ap.*; + +import java.math.BigDecimal; +import java.text.SimpleDateFormat; +import java.util.*; + +/** +* @description: 转换类型 +* @author LR +* @date 2024/12/9 9:17 +* @version 1.0 +*/ +public class IfsConverterToMap { + + /** + * @description: 把IFS的集合数据转换成List> + * @author LR + * @date 2024/12/9 9:29 + * @version 1.0 + */ + public static List> ConverterIfsToList(RecordCollection recordCollection) { + List> resultList = new ArrayList<>(); + //外层遍历单个集合的数据 + RecordIterator recordIterator = recordCollection.recordIterator(); + while (recordIterator.hasNext()) { + Record tempRecord = recordIterator.nextRecord(); + //内层遍历单个map + if (tempRecord != null && tempRecord.getAttributes() != null) { + Map tempMap = new HashMap<>(); + RecordAttributeIterator attributeIterator = tempRecord.getAttributes().attributeIterator(); + //遍历单个Bean的数据 + while (attributeIterator.hasNext()) { + RecordAttribute attribute = (RecordAttribute) attributeIterator.next(); + String key = attribute.getNameOf(); + Object objValue = attribute.getValue(); + DataType dataType = attribute.getDataType(); + //处理NULL + if (objValue == null) { + tempMap.put(key, ""); + continue; + } else if (dataType == DataType.TEXT || dataType == DataType.LONG_TEXT) { + tempMap.put(key, String.valueOf(objValue)); + } else if (dataType == DataType.FLOAT) { + //区分数据的类型 + if (objValue instanceof Float) { + BigDecimal bigDecimal = new BigDecimal((Double) objValue); + // 设置小数位数,最多保留 16 位有效数字 + bigDecimal = bigDecimal.setScale(16, BigDecimal.ROUND_HALF_UP); + // 去除尾部的零 + bigDecimal = bigDecimal.stripTrailingZeros(); + String formatterValue = bigDecimal.toPlainString(); + tempMap.put(key, formatterValue); + } else if (objValue instanceof Double) { + BigDecimal bigDecimal = new BigDecimal((Double) objValue); + // 设置小数位数,最多保留 16 位有效数字 + bigDecimal = bigDecimal.setScale(16, BigDecimal.ROUND_HALF_UP); + // 去除尾部的零 + bigDecimal = bigDecimal.stripTrailingZeros(); + String formatterValue = bigDecimal.toPlainString(); + tempMap.put(key, formatterValue); + } else if (objValue instanceof Integer) { + BigDecimal bigDecimal = new BigDecimal((Integer) objValue); + // 设置小数位数,最多保留 16 位有效数字 + String formatterValue = bigDecimal.toPlainString(); + tempMap.put(key, formatterValue); + } else { + System.err.println("特殊的数字:" + String.valueOf(objValue)); + } + } else if (dataType == DataType.TIMESTAMP) { + if (objValue instanceof Date) { + // 使用 SimpleDateFormat 格式化 Date + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + String formattedDate = sdf.format(objValue); + tempMap.put(key, formattedDate); + } + } else if (dataType == DataType.DATE) { + if (objValue instanceof Date) { + // 使用 SimpleDateFormat 格式化 Date + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); + String formattedDate = sdf.format(objValue); + tempMap.put(key, formattedDate); + } + } else if (dataType == DataType.BOOLEAN) { + if (objValue instanceof Boolean) { + // 使用 SimpleDateFormat 格式化 Date + String formattedFlag = String.valueOf(objValue).toUpperCase(Locale.ROOT); + tempMap.put(key, formattedFlag); + } + } else { + System.err.println("字段类型:" + dataType + "字段:" + key + "数值:" + String.valueOf(objValue)); + } + } + //数据保存到结果的list + resultList.add(tempMap); + } + } + return resultList; + } + + /** + * @description: 解析IFS的数据成Map数据 + * @author LR + * @date 2024/12/9 10:50 + * @version 1.0 + */ + public static Map ConverterIfsToMap(Record record){ + Map resultMap = new HashMap<>(); + RecordAttributeIterator attributeIterator = record.getAttributes().attributeIterator(); + //遍历单个Bean的数据 + while (attributeIterator.hasNext()) { + RecordAttribute attribute = (RecordAttribute) attributeIterator.next(); + String key = attribute.getNameOf(); + Object objValue = attribute.getValue(); + DataType dataType = attribute.getDataType(); + //处理NULL + if (objValue == null) { + resultMap.put(key, ""); + continue; + } else if (dataType == DataType.TEXT || dataType == DataType.LONG_TEXT) { + resultMap.put(key, String.valueOf(objValue)); + } else if (dataType == DataType.FLOAT) { + //区分数据的类型 + if (objValue instanceof Float) { + BigDecimal bigDecimal = new BigDecimal((Double) objValue); + // 设置小数位数,最多保留 16 位有效数字 + bigDecimal = bigDecimal.setScale(16, BigDecimal.ROUND_HALF_UP); + // 去除尾部的零 + bigDecimal = bigDecimal.stripTrailingZeros(); + String formatterValue = bigDecimal.toPlainString(); + resultMap.put(key, formatterValue); + } else if (objValue instanceof Double) { + BigDecimal bigDecimal = new BigDecimal((Double) objValue); + // 设置小数位数,最多保留 16 位有效数字 + bigDecimal = bigDecimal.setScale(16, BigDecimal.ROUND_HALF_UP); + // 去除尾部的零 + bigDecimal = bigDecimal.stripTrailingZeros(); + String formatterValue = bigDecimal.toPlainString(); + resultMap.put(key, formatterValue); + } else if (objValue instanceof Integer) { + BigDecimal bigDecimal = new BigDecimal((Integer) objValue); + // 设置小数位数,最多保留 16 位有效数字 + String formatterValue = bigDecimal.toPlainString(); + resultMap.put(key, formatterValue); + } else { + System.err.println("特殊的数字:" + String.valueOf(objValue)); + } + } else if (dataType == DataType.TIMESTAMP) { + if (objValue instanceof Date) { + // 使用 SimpleDateFormat 格式化 Date + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + String formattedDate = sdf.format(objValue); + resultMap.put(key, formattedDate); + } + } else if (dataType == DataType.DATE) { + if (objValue instanceof Date) { + // 使用 SimpleDateFormat 格式化 Date + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); + String formattedDate = sdf.format(objValue); + resultMap.put(key, formattedDate); + } + } else if (dataType == DataType.BOOLEAN) { + if (objValue instanceof Boolean) { + // 使用 SimpleDateFormat 格式化 Date + String formattedFlag = String.valueOf(objValue).toUpperCase(Locale.ROOT); + resultMap.put(key, formattedFlag); + } + } else { + System.err.println("字段类型:" + dataType + "字段:" + key + "数值:" + String.valueOf(objValue)); + } + } + return resultMap; + } + +} diff --git a/src/main/java/com/spring/ifs/utils/IfsPlsqlUtils.java b/src/main/java/com/spring/ifs/utils/IfsPlsqlUtils.java new file mode 100644 index 00000000..a0f18d8d --- /dev/null +++ b/src/main/java/com/spring/ifs/utils/IfsPlsqlUtils.java @@ -0,0 +1,180 @@ +package com.spring.ifs.utils; + +import com.spring.ifs.data.IfsParamBean; +import ifs.fnd.ap.*; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** +* @description: IFS的通用方法 +* @author LR +* @date 2024/12/9 11:18 +* @version 1.0 +*/ +public class IfsPlsqlUtils { + + /** + * @description: 调用查询的通用方法-- 返回单个Bean + * @author LR + * @date 2024/12/9 11:21 + * @version 1.0 + */ + public static Record execSqlSearchGetRecord(Server srv, StringBuilder searchSql, Map inParam) throws APException { + //创建查询体 + PlsqlSelectCommand selCmd = new PlsqlSelectCommand(srv, searchSql.toString()); + //获取绑定参数 + Record bindVars = selCmd.getBindVariables(); + //循环设置入参 + for(Map.Entry entry : inParam.entrySet()) { + String key = entry.getKey(); + String value = entry.getValue(); + //设置入参 + bindVars.add(key, value).setBindVariableDirection(BindVariableDirection.IN); + } + //执行查询 + RecordCollection result = selCmd.executeQuery(); + //判断是否查询到数据 + if (null == result || result.size() == 0){ + return null; + }else { + return result.get(0); + } + } + + + /** + * @description: 执行参数返回 集合参数 + * @author LR + * @date 2024/12/9 11:36 + * @version 1.0 + */ + public static RecordCollection execSqlSearchGetRecordCollection(Server srv, StringBuilder searchSql, Map inParam) throws APException { + //创建查询体 + PlsqlSelectCommand selCmd = new PlsqlSelectCommand(srv, searchSql.toString()); + //获取绑定参数 + Record bindVars = selCmd.getBindVariables(); + //循环设置入参 + for(Map.Entry entry : inParam.entrySet()) { + String key = entry.getKey(); + String value = entry.getValue(); + //设置入参 + bindVars.add(key, value).setBindVariableDirection(BindVariableDirection.IN); + } + //执行查询 + RecordCollection result = selCmd.executeQuery(); + //判断是否查询到数据 + if (null == result || result.size() == 0){ + return null; + }else { + return result; + } + } + + /** + * @description: 执行存储过程 返回需要的数据 + * @author LR + * @date 2024/12/9 16:17 + * @version 1.0 + */ + public static Map execProcedureGetRecord(Server srv, String packageName, String methodName, + PlsqlBaseMethodType methodType, PlsqlBaseMethodAction methodAction, Map inParam) throws APException { + //创建查询体 + Record profile = new Record("PROFILE"); + //填充参数 + //循环设置入参 + for(Map.Entry entry : inParam.entrySet()) { + String key = entry.getKey(); + String value = entry.getValue(); + //设置入参 + profile.add(key, value); + } + //创建执行的框体 + PlsqlBaseMethodCommand methodCommand = new PlsqlBaseMethodCommand( + srv, + methodType, + packageName, + methodName, + profile, + methodAction); + //执行 + methodCommand.execute(); + //转换类型 + Map resultMap = IfsConverterToMap.ConverterIfsToMap(profile); + //返回结果集 + return resultMap; + } + + /** + * + * @Title: execProcedureGetRecord + * @Description: 调用特殊的存储过程 出参和入参严格规范后的数据 入参和出参 不重复的数据 + * @author: LR + * @date 2024年12月10日 下午3:54:22 + * @return: Map + * @throws + */ + public static Map execProcedureGetRecord(Server srv, String packageName, String methodName, + List inParams, List outParams) throws APException { + Map resultMap = new HashMap<>(); + //创建查询体 + StringBuilder searchSql = new StringBuilder(); + searchSql.append("BEGIN ifsapp.").append(packageName).append(".").append(methodName).append("("); + //首先循环写入出参 + for(int i = 0; i < outParams.size(); i++) { + IfsParamBean param = outParams.get(i); + //判断一下是否有入参 + if(inParams != null) { + searchSql.append(":").append(param.getColumnName()).append(", "); + }else { + searchSql.append(":").append(param.getColumnName()); + //判断是否是最后一个参数 + if(i < outParams.size() - 1) { + searchSql.append(", "); + } + } + + } + //然后填充入参 + for(int i = 0; i < inParams.size(); i++) { + IfsParamBean param = inParams.get(i); + searchSql.append(":").append(param.getColumnName()); + //判断是否是最后一个参数 + if(i < inParams.size() - 1) { + searchSql.append(", "); + } + + } + //拼接最终的sql + searchSql.append("); END;"); + //打印最终调用的sql语句 + System.err.println(searchSql.toString()); + PlsqlSelectCommand selCmd = new PlsqlSelectCommand(srv, searchSql.toString()); + Record bindVars = selCmd.getBindVariables(); + //循环设置入参 + for(IfsParamBean param : inParams) { + bindVars.add(param.getColumnName(), param.getColumnValue()).setBindVariableDirection(BindVariableDirection.IN); + } + //循环设置出参 + for(IfsParamBean param : outParams) { + bindVars.add(param.getColumnName()).setBindVariableDirection(BindVariableDirection.OUT); + } + //执行查询 + selCmd.executeQuery(); + //遍历返回结果集 + for(IfsParamBean param : outParams) { + String columnName = param.getColumnName(); + String columnValue = bindVars.find(param.getColumnName()).getString(); + resultMap.put(columnName, columnValue); + } + + //返回结果集 + return resultMap; + } + + + + + +}