Browse Source

按照ifsRowVersion查询所有域下的库存件方法

master
Rui_Li 11 months ago
parent
commit
717e73ca8e
  1. 85
      src/main/java/com/spring/ifs/api/BaseSearchApi.java
  2. 83
      src/main/java/com/spring/ifs/api/BaseSearchApiTest.java
  3. 28
      src/main/java/com/spring/ifs/bean/BaseSearchBean.java
  4. 32
      src/main/java/com/spring/ifs/bean/BaseSearchBeanTest.java
  5. 28
      src/main/java/com/spring/ifs/controller/TestIfsController.java

85
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<PartIfsInventory> 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<String, String> 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<PartIfsInventory> returnlList = new ArrayList<>();
//处理结果集
List<Map<String, String>> resultList = IfsConverterToMap.ConverterIfsToList(recordCollection);
//获取数据转bean
for (int i = 0; i < resultList.size(); i++) {
Map<String, String> 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;
}
}
}

83
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<PartIfsInventory> 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<String, String> 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<PartIfsInventory> returnlList = new ArrayList<>();
//处理结果集
List<Map<String, String>> resultList = IfsConverterToMap.ConverterIfsToList(recordCollection);
//获取数据转bean
for (int i = 0; i < resultList.size(); i++) {
Map<String, String> 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;
}
}
}

28
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<PartIfsInventory> getInventoryParts(Server srv, BaseSearchData inData) throws APException {
//查询的参数
String ifsRowVersion = inData.getIfsRowVersion();
logger.info("库存件查询的请求参数:"+ifsRowVersion);
List<PartIfsInventory> resultList = new ArrayList<>();
int pageSize = 200;
//迭代查询
for(int i = 0; i < 100; i++){
int startIndex = i * pageSize;
List<PartIfsInventory> tempList = BaseSearchApi.getInventoryParts(srv, ifsRowVersion, startIndex, pageSize);
//判断查询是否结束
if(tempList.size() > 0) {
resultList.addAll(tempList);
}else {
break;
}
}
logger.info("返回集合大小:"+resultList.size());
return resultList;
}
}

32
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<PartIfsInventory> getInventoryParts(BaseSearchData inData) throws APException {
//查询的参数
String ifsRowVersion = inData.getIfsRowVersion();
String username = inData.getIfsUsername();
String password = inData.getIfsPassword();
logger.info("库存件查询的请求参数:"+ifsRowVersion);
List<PartIfsInventory> resultList = new ArrayList<>();
int pageSize = 200;
//获取连接
Server srv = ifsServer.getIfsServer(username, password);
//迭代查询
for(int i = 0; i < 100; i++){
int startIndex = i * pageSize;
List<PartIfsInventory> tempList = BaseSearchApi.getInventoryParts(srv, ifsRowVersion, startIndex, pageSize);
//判断查询是否结束
if(tempList.size() > 0) {
resultList.addAll(tempList);
}else {
break;
}
}
logger.info("返回集合大小:"+resultList.size());
return resultList;
}
}

28
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<String, Object> resultMap = new HashMap<String, Object>();
@ -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<String, Object> resultMap = new HashMap<String, Object>();
try {
List<PartIfsInventory> 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;
}
}
Loading…
Cancel
Save