From 717e73ca8ec1efe560c75a393d717cb1fe9d82f4 Mon Sep 17 00:00:00 2001 From: Rui_Li <877258667@qq.com> Date: Fri, 7 Mar 2025 11:50:09 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8C=89=E7=85=A7=1BifsRowVersion=E6=9F=A5?= =?UTF-8?q?=E8=AF=A2=E6=89=80=E6=9C=89=E5=9F=9F=E4=B8=8B=E7=9A=84=E5=BA=93?= =?UTF-8?q?=E5=AD=98=E4=BB=B6=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/spring/ifs/api/BaseSearchApi.java | 85 +++++++++++++++++++ .../com/spring/ifs/api/BaseSearchApiTest.java | 83 ++++++++++++++++++ .../com/spring/ifs/bean/BaseSearchBean.java | 28 ++++++ .../spring/ifs/bean/BaseSearchBeanTest.java | 32 +++++++ .../ifs/controller/TestIfsController.java | 28 ++++++ 5 files changed, 256 insertions(+) diff --git a/src/main/java/com/spring/ifs/api/BaseSearchApi.java b/src/main/java/com/spring/ifs/api/BaseSearchApi.java index 602a2120..7435115c 100644 --- a/src/main/java/com/spring/ifs/api/BaseSearchApi.java +++ b/src/main/java/com/spring/ifs/api/BaseSearchApi.java @@ -6,6 +6,7 @@ import com.spring.ifs.utils.IfsConverterToMap; import com.spring.ifs.utils.IfsPlsqlUtils; import com.spring.modules.base.entity.WorkCenterCost; import com.spring.modules.base.vo.PersonnelLevelVo; +import com.spring.modules.part.entity.APIEntity.PartIfsInventory; import com.spring.modules.part.vo.InventoryPartUnitCostSumVo; import com.spring.modules.part.vo.LocationInformationVo; import com.spring.modules.part.vo.WorkCenterVo; @@ -493,4 +494,88 @@ public class BaseSearchApi { return technicalAttributes; } } + + /** + * @description: 按照时间获取所有域下的库存件信息 + * @author LR + * @date 2025/3/7 10:58 + * @version 1.0 + */ + public static List getInventoryParts(Server srv, String ifsRowVersion, int startIndex, int pageSize) throws APException { + StringBuilder searchSql = new StringBuilder(); + searchSql.append("SELECT OBJID ifsRowId, OBJVERSION ifsRowVersion, PART_NO, DESCRIPTION, CONTRACT, TYPE_CODE, PLANNER_BUYER,"); + searchSql.append(" UNIT_MEAS, PRIME_COMMODITY, SECOND_COMMODITY, ASSET_CLASS, PART_STATUS, ABC_CLASS, FREQUENCY_CLASS, LIFECYCLE_STAGE,"); + searchSql.append(" HAZARD_CODE, ACCOUNTING_GROUP, PART_PRODUCT_CODE, PART_PRODUCT_FAMILY, TYPE_DESIGNATION, DIM_QUALITY, CREATE_DATE,"); + searchSql.append(" NOTE_TEXT, LEAD_TIME_CODE, PURCH_LEADTIME, MANUF_LEADTIME, EXPECTED_LEADTIME, DURABILITY_DAY, COUNTRY_OF_ORIGIN, REGION_OF_ORIGIN,"); + searchSql.append(" SUPPLY_CODE, INVENTORY_VALUATION_METHOD, INVENTORY_PART_COST_LEVEL, INVOICE_CONSIDERATION, ZERO_COST_FLAG, PART_COST_GROUP_ID,"); + searchSql.append(" STD_NAME_ID, ENG_ATTRIBUTE"); + searchSql.append(" FROM ifsapp.INVENTORY_PART"); + searchSql.append(" WHERE OBJVERSION >:ifsRowVersion"); + + //设置查询的入参 + Map inParam = new HashMap<>(); + inParam.put("ifsRowVersion", ifsRowVersion); + //添加排序语句 + searchSql.append(" ORDER BY OBJVERSION ASC"); + //添加分页的查询语句 + searchSql.append(" OFFSET "+startIndex+" ROWS FETCH NEXT "+pageSize+" ROWS ONLY"); + logger.info("库存件查询语句sql"+searchSql.toString()); + //调用查询的通用方法 + RecordCollection recordCollection = IfsPlsqlUtils.execSqlSearchGetRecordCollection(srv, searchSql, inParam); + //判断能否返回 + if (recordCollection == null) { + return new ArrayList<>(); + } else { + List returnlList = new ArrayList<>(); + //处理结果集 + List> resultList = IfsConverterToMap.ConverterIfsToList(recordCollection); + //获取数据转bean + for (int i = 0; i < resultList.size(); i++) { + Map tempMap = resultList.get(i); + PartIfsInventory tempItem = new PartIfsInventory(); + //设置参数 + tempItem.setIfsRowId(tempMap.get("IFSROWID")); + tempItem.setIfsRowVersion(tempMap.get("IFSROWVERSION")); + tempItem.setContract(tempMap.get("CONTRACT")); + tempItem.setPartNo(tempMap.get("PART_NO")); + tempItem.setPartDesc(tempMap.get("DESCRIPTION")); + tempItem.setTypeCode(tempMap.get("TYPE_CODE")); + tempItem.setPlannerBuyer(tempMap.get("PLANNER_BUYER")); + tempItem.setUnitMeas(tempMap.get("UNIT_MEAS")); + tempItem.setPrimeCommodity(tempMap.get("PRIME_COMMODITY")); + tempItem.setSecondCommodity(tempMap.get("SECOND_COMMODITY")); + tempItem.setAssetClass(tempMap.get("ASSET_CLASS")); + tempItem.setPartStatus(tempMap.get("PART_STATUS")); + tempItem.setAbcClass(tempMap.get("ABC_CLASS")); + tempItem.setFrequencyClass(tempMap.get("FREQUENCY_CLASS")); + tempItem.setLifecycleStage(tempMap.get("LIFECYCLE_STAGE")); + tempItem.setHazardCode(tempMap.get("HAZARD_CODE")); + tempItem.setAccountingGroup(tempMap.get("ACCOUNTING_GROUP")); + tempItem.setPartProductCode(tempMap.get("PART_PRODUCT_CODE")); + tempItem.setPartProductFamily(tempMap.get("PART_PRODUCT_FAMILY")); + tempItem.setTypeDesignation(tempMap.get("TYPE_DESIGNATION")); + tempItem.setDimQuality(tempMap.get("DIM_QUALITY")); + tempItem.setNoteText(tempMap.get("NOTE_TEXT")); + tempItem.setLeadTimeCode(tempMap.get("LEAD_TIME_CODE")); + tempItem.setManufLeadtime(tempMap.get("MANUF_LEADTIME")); + tempItem.setExpectedLeadtime(tempMap.get("EXPECTED_LEADTIME")); + tempItem.setDurabilityDay(tempMap.get("DURABILITY_DAY")); + tempItem.setCountryOfOrigin(tempMap.get("COUNTRY_OF_ORIGIN")); + tempItem.setRegionOfOrigin(tempMap.get("REGION_OF_ORIGIN")); + tempItem.setInventoryValuationMethod(tempMap.get("INVENTORY_VALUATION_METHOD")); + tempItem.setInventoryPartCostLevel(tempMap.get("INVENTORY_PART_COST_LEVEL")); + tempItem.setInvoiceConsideration(tempMap.get("INVOICE_CONSIDERATION")); + tempItem.setZeroCostFlag(tempMap.get("ZERO_COST_FLAG")); + tempItem.setPartCostGroupId(tempMap.get("PART_COST_GROUP_ID")); + tempItem.setEngAttribute(tempMap.get("ENG_ATTRIBUTE")); + String createdDate = tempMap.get("CREATE_DATE"); + if (!(null == createdDate || "".equals(createdDate))){ + tempItem.setCreatedDate(DateUtils.getStringToDate(createdDate, "yyyy-MM-dd HH:mm:ss")); + } + //添加对象 + returnlList.add(tempItem); + } + return returnlList; + } + } } diff --git a/src/main/java/com/spring/ifs/api/BaseSearchApiTest.java b/src/main/java/com/spring/ifs/api/BaseSearchApiTest.java index 6ea0c28c..3cbe7d7d 100644 --- a/src/main/java/com/spring/ifs/api/BaseSearchApiTest.java +++ b/src/main/java/com/spring/ifs/api/BaseSearchApiTest.java @@ -5,6 +5,7 @@ import com.spring.ifs.data.*; import com.spring.ifs.utils.IfsConverterToMap; import com.spring.ifs.utils.IfsPlsqlUtils; import com.spring.modules.base.entity.WorkCenterCost; +import com.spring.modules.part.entity.APIEntity.PartIfsInventory; import com.spring.modules.part.vo.InventoryPartUnitCostSumVo; import ifs.fnd.ap.APException; import ifs.fnd.ap.RecordCollection; @@ -491,4 +492,86 @@ public class BaseSearchApiTest { } } + /** + * @description: 按照时间获取所有域下的库存件信息 + * @author LR + * @date 2025/3/7 10:58 + * @version 1.0 + */ + public static List getInventoryParts(Server srv, String ifsRowVersion, int startIndex, int pageSize) throws APException { + StringBuilder searchSql = new StringBuilder(); + searchSql.append("SELECT OBJID ifsRowId, OBJVERSION ifsRowVersion, PART_NO, DESCRIPTION, CONTRACT, TYPE_CODE, PLANNER_BUYER,"); + searchSql.append(" UNIT_MEAS, PRIME_COMMODITY, SECOND_COMMODITY, ASSET_CLASS, PART_STATUS, ABC_CLASS, FREQUENCY_CLASS, LIFECYCLE_STAGE,"); + searchSql.append(" HAZARD_CODE, ACCOUNTING_GROUP, PART_PRODUCT_CODE, PART_PRODUCT_FAMILY, TYPE_DESIGNATION, DIM_QUALITY, CREATE_DATE,"); + searchSql.append(" NOTE_TEXT, LEAD_TIME_CODE, PURCH_LEADTIME, MANUF_LEADTIME, EXPECTED_LEADTIME, DURABILITY_DAY, COUNTRY_OF_ORIGIN, REGION_OF_ORIGIN,"); + searchSql.append(" SUPPLY_CODE, INVENTORY_VALUATION_METHOD, INVENTORY_PART_COST_LEVEL, INVOICE_CONSIDERATION, ZERO_COST_FLAG, PART_COST_GROUP_ID,"); + searchSql.append(" STD_NAME_ID"); + searchSql.append(" FROM ifsapp.INVENTORY_PART"); + searchSql.append(" WHERE OBJVERSION >:ifsRowVersion"); + + //设置查询的入参 + Map inParam = new HashMap<>(); + inParam.put("ifsRowVersion", ifsRowVersion); + //添加排序语句 + searchSql.append(" ORDER BY OBJVERSION ASC"); + //添加分页的查询语句 + searchSql.append(" OFFSET "+startIndex+" ROWS FETCH NEXT "+pageSize+" ROWS ONLY"); + //调用查询的通用方法 + RecordCollection recordCollection = IfsPlsqlUtils.execSqlSearchGetRecordCollection(srv, searchSql, inParam); + //判断能否返回 + if (recordCollection == null) { + return new ArrayList<>(); + } else { + List returnlList = new ArrayList<>(); + //处理结果集 + List> resultList = IfsConverterToMap.ConverterIfsToList(recordCollection); + //获取数据转bean + for (int i = 0; i < resultList.size(); i++) { + Map tempMap = resultList.get(i); + PartIfsInventory tempItem = new PartIfsInventory(); + //设置参数 + tempItem.setIfsRowId(tempMap.get("IFSROWID")); + tempItem.setIfsRowVersion(tempMap.get("IFSROWVERSION")); + tempItem.setContract(tempMap.get("CONTRACT")); + tempItem.setPartNo(tempMap.get("PART_NO")); + tempItem.setPartDesc(tempMap.get("DESCRIPTION")); + tempItem.setTypeCode(tempMap.get("TYPE_CODE")); + tempItem.setPlannerBuyer(tempMap.get("PLANNER_BUYER")); + tempItem.setUnitMeas(tempMap.get("UNIT_MEAS")); + tempItem.setPrimeCommodity(tempMap.get("PRIME_COMMODITY")); + tempItem.setSecondCommodity(tempMap.get("SECOND_COMMODITY")); + tempItem.setAssetClass(tempMap.get("ASSET_CLASS")); + tempItem.setPartStatus(tempMap.get("PART_STATUS")); + tempItem.setAbcClass(tempMap.get("ABC_CLASS")); + tempItem.setFrequencyClass(tempMap.get("FREQUENCY_CLASS")); + tempItem.setLifecycleStage(tempMap.get("LIFECYCLE_STAGE")); + tempItem.setHazardCode(tempMap.get("HAZARD_CODE")); + tempItem.setAccountingGroup(tempMap.get("ACCOUNTING_GROUP")); + tempItem.setPartProductCode(tempMap.get("PART_PRODUCT_CODE")); + tempItem.setPartProductFamily(tempMap.get("PART_PRODUCT_FAMILY")); + tempItem.setTypeDesignation(tempMap.get("TYPE_DESIGNATION")); + tempItem.setDimQuality(tempMap.get("DIM_QUALITY")); + tempItem.setNoteText(tempMap.get("NOTE_TEXT")); + tempItem.setLeadTimeCode(tempMap.get("LEAD_TIME_CODE")); + tempItem.setManufLeadtime(tempMap.get("MANUF_LEADTIME")); + tempItem.setExpectedLeadtime(tempMap.get("EXPECTED_LEADTIME")); + tempItem.setDurabilityDay(tempMap.get("DURABILITY_DAY")); + tempItem.setCountryOfOrigin(tempMap.get("COUNTRY_OF_ORIGIN")); + tempItem.setRegionOfOrigin(tempMap.get("REGION_OF_ORIGIN")); + tempItem.setInventoryValuationMethod(tempMap.get("INVENTORY_VALUATION_METHOD")); + tempItem.setInventoryPartCostLevel(tempMap.get("INVENTORY_PART_COST_LEVEL")); + tempItem.setInvoiceConsideration(tempMap.get("INVOICE_CONSIDERATION")); + tempItem.setZeroCostFlag(tempMap.get("ZERO_COST_FLAG")); + tempItem.setPartCostGroupId(tempMap.get("PART_COST_GROUP_ID")); + String createdDate = tempMap.get("CREATE_DATE"); + if (!(null == createdDate || "".equals(createdDate))){ + tempItem.setCreatedDate(DateUtils.getStringToDate(createdDate, "yyyy-MM-dd HH:mm:ss")); + } + //添加对象 + returnlList.add(tempItem); + } + return returnlList; + } + } + } \ No newline at end of file diff --git a/src/main/java/com/spring/ifs/bean/BaseSearchBean.java b/src/main/java/com/spring/ifs/bean/BaseSearchBean.java index b2d5a45c..c19ef6f3 100644 --- a/src/main/java/com/spring/ifs/bean/BaseSearchBean.java +++ b/src/main/java/com/spring/ifs/bean/BaseSearchBean.java @@ -7,6 +7,7 @@ import com.spring.ifs.api.TechnicalClassApi; import com.spring.ifs.data.*; import com.spring.modules.base.entity.WorkCenterCost; import com.spring.modules.base.vo.PersonnelLevelVo; +import com.spring.modules.part.entity.APIEntity.PartIfsInventory; import com.spring.modules.part.entity.PartInformationEntity; import com.spring.modules.part.vo.InventoryPartUnitCostSumVo; import com.spring.modules.part.vo.LocationInformationVo; @@ -243,4 +244,31 @@ public class BaseSearchBean { return resultList; } + /** + * @description: 按照时间获取所有域下的库存件信息 + * @author LR + * @date 2025/3/7 11:01 + * @version 1.0 + */ + public List getInventoryParts(Server srv, BaseSearchData inData) throws APException { + //查询的参数 + String ifsRowVersion = inData.getIfsRowVersion(); + logger.info("库存件查询的请求参数:"+ifsRowVersion); + List resultList = new ArrayList<>(); + int pageSize = 200; + //迭代查询 + for(int i = 0; i < 100; i++){ + int startIndex = i * pageSize; + List tempList = BaseSearchApi.getInventoryParts(srv, ifsRowVersion, startIndex, pageSize); + //判断查询是否结束 + if(tempList.size() > 0) { + resultList.addAll(tempList); + }else { + break; + } + } + logger.info("返回集合大小:"+resultList.size()); + return resultList; + } + } diff --git a/src/main/java/com/spring/ifs/bean/BaseSearchBeanTest.java b/src/main/java/com/spring/ifs/bean/BaseSearchBeanTest.java index 58feb263..b99955b6 100644 --- a/src/main/java/com/spring/ifs/bean/BaseSearchBeanTest.java +++ b/src/main/java/com/spring/ifs/bean/BaseSearchBeanTest.java @@ -9,6 +9,7 @@ import com.spring.ifs.data.*; import com.spring.ifs.utils.IfsConverterToMap; import com.spring.ifs.utils.IfsPlsqlUtils; import com.spring.modules.base.entity.WorkCenterCost; +import com.spring.modules.part.entity.APIEntity.PartIfsInventory; import com.spring.modules.part.entity.PartInformationEntity; import com.spring.modules.part.vo.InventoryPartUnitCostSumVo; import ifs.fnd.ap.APException; @@ -248,4 +249,35 @@ public class BaseSearchBeanTest { return resultList; } + /** + * @description: 按照时间获取所有域下的库存件信息 + * @author LR + * @date 2025/3/7 11:01 + * @version 1.0 + */ + public List getInventoryParts(BaseSearchData inData) throws APException { + //查询的参数 + String ifsRowVersion = inData.getIfsRowVersion(); + String username = inData.getIfsUsername(); + String password = inData.getIfsPassword(); + logger.info("库存件查询的请求参数:"+ifsRowVersion); + List resultList = new ArrayList<>(); + int pageSize = 200; + //获取连接 + Server srv = ifsServer.getIfsServer(username, password); + //迭代查询 + for(int i = 0; i < 100; i++){ + int startIndex = i * pageSize; + List tempList = BaseSearchApi.getInventoryParts(srv, ifsRowVersion, startIndex, pageSize); + //判断查询是否结束 + if(tempList.size() > 0) { + resultList.addAll(tempList); + }else { + break; + } + } + logger.info("返回集合大小:"+resultList.size()); + return resultList; + } + } \ No newline at end of file diff --git a/src/main/java/com/spring/ifs/controller/TestIfsController.java b/src/main/java/com/spring/ifs/controller/TestIfsController.java index 7b4f9433..6551dd81 100644 --- a/src/main/java/com/spring/ifs/controller/TestIfsController.java +++ b/src/main/java/com/spring/ifs/controller/TestIfsController.java @@ -3,6 +3,7 @@ package com.spring.ifs.controller; import com.spring.ifs.bean.*; import com.spring.ifs.data.*; import com.spring.modules.base.entity.WorkCenterCost; +import com.spring.modules.part.entity.APIEntity.PartIfsInventory; import com.spring.modules.part.entity.APIEntity.RecipeIfsAlternative; import com.spring.modules.part.entity.APIEntity.RecipeIfsHeader; import com.spring.modules.part.entity.APIEntity.RecipeIfsItem; @@ -2083,6 +2084,12 @@ public class TestIfsController { return resultMap; } + /** + * @description: 获取所有加工中心的数据 + * @author LR + * @date 2025/3/7 11:03 + * @version 1.0 + */ @PostMapping("/getWorkCenterCosts") public Object getWorkCenterCosts(@RequestBody BaseSearchData inData) throws APException { Map resultMap = new HashMap(); @@ -2098,4 +2105,25 @@ public class TestIfsController { return resultMap; } + /** + * @description: 按照时间获取所有域下的库存件信息 + * @author LR + * @date 2025/3/7 11:03 + * @version 1.0 + */ + @PostMapping("/getInventoryParts") + public Object getInventoryParts(@RequestBody BaseSearchData inData) throws APException { + Map resultMap = new HashMap(); + try { + List returnList = baseSearchBeanTest.getInventoryParts(inData); + resultMap.put("returnMap", returnList); + resultMap.put("code", 200); + resultMap.put("msg", "操作成功!"); + } catch (Exception e) { + resultMap.put("code", 400); + resultMap.put("msg", e.getMessage()); + } + return resultMap; + } + } \ No newline at end of file