Browse Source

IFS jar 开发

master
DouDou 1 year ago
parent
commit
cc86ba18a0
  1. 64
      src/main/java/com/spring/ifs/api/BaseSearchApi.java
  2. 25
      src/main/java/com/spring/ifs/bean/BaseSearchBean.java
  3. 23
      src/main/java/com/spring/ifs/controller/TestIfsController.java

64
src/main/java/com/spring/ifs/api/BaseSearchApi.java

@ -1,12 +1,18 @@
package com.spring.ifs.api;
import com.spring.common.utils.DateUtils;
import com.spring.ifs.data.*;
import com.spring.ifs.utils.IfsConverterToMap;
import com.spring.ifs.utils.IfsPlsqlUtils;
import com.spring.modules.base.vo.PersonnelLevelVo;
import com.spring.modules.part.vo.InventoryPartUnitCostSumVo;
import com.spring.modules.part.vo.LocationInformationVo;
import com.spring.modules.part.vo.WorkCenterVo;
import ifs.fnd.ap.APException;
import ifs.fnd.ap.RecordCollection;
import ifs.fnd.ap.Server;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
@ -26,7 +32,7 @@ public class BaseSearchApi {
* @date 2024/12/12 11:02
* @version 1.0
*/
public static List<WorkCenter> getWorkCenterNos(Server srv, String siteCon, String ifsRowVersion) throws APException {
public static List<WorkCenterVo> getWorkCenterNos(Server srv, String siteCon, String ifsRowVersion) throws APException {
StringBuilder searchSql = new StringBuilder();
searchSql.append("SELECT wc.contract site, wc.work_center_no, wc.description work_center_desc, wc.work_center_code_db,");
searchSql.append(" (CASE WHEN work_center_code_db='I' THEN '内部' ELSE '外部' END) work_center_type, 100 efficiency,");
@ -55,7 +61,7 @@ public class BaseSearchApi {
if (recordCollection == null) {
return null;
} else {
List<WorkCenter> resultItems = new ArrayList<>();
List<WorkCenterVo> resultItems = new ArrayList<>();
//调用通用的处理方法 返回Map
List<Map<String, String>> resultList = IfsConverterToMap.ConverterIfsToList(recordCollection);
//判断是否存在数据
@ -65,24 +71,24 @@ public class BaseSearchApi {
//获取数据转bean
for (int i = 0; i < resultList.size(); i++) {
Map<String, String> tempMap = resultList.get(i);
WorkCenter tempItem = new WorkCenter();
WorkCenterVo tempItem = new WorkCenterVo();
//设置参数
tempItem.setIfsRowId(tempMap.get("IFSROWID"));
//tempItem.setIfsRowId(tempMap.get("IFSROWID"));
tempItem.setIfsRowVersion(tempMap.get("IFSROWVERSION"));
tempItem.setSite(tempMap.get("SITE"));
tempItem.setWorkCenterNo(tempMap.get("WORK_CENTER_NO"));
tempItem.setWorkCenterDesc(tempMap.get("WORK_CENTER_DESC"));
tempItem.setWorkCenterTypeDb(tempMap.get("WORK_CENTER_CODE_DB"));
tempItem.setWorkCenterTypeDB(tempMap.get("WORK_CENTER_CODE_DB"));
tempItem.setWorkCenterType(tempMap.get("WORK_CENTER_TYPE"));
tempItem.setAverageCapacity(tempMap.get("AVERAGECAPACITY"));
tempItem.setEfficiency(tempMap.get("EFFICIENCY"));
tempItem.setUtilization(tempMap.get("UTILIZATION"));
tempItem.setCapacityTypeDb(tempMap.get("CAPACITY_TYPE_DB"));
tempItem.setAverageCapacity(new BigDecimal(tempMap.get("AVERAGECAPACITY")));
tempItem.setEfficiency(new BigDecimal(tempMap.get("EFFICIENCY")));
tempItem.setUtilization(new BigDecimal(tempMap.get("UTILIZATION")));
tempItem.setCapacityTypeDB(tempMap.get("CAPACITY_TYPE_DB"));
tempItem.setCapacityType(tempMap.get("CAPACITY_TYPE"));
tempItem.setUmId(tempMap.get("UM_ID"));
tempItem.setActive(tempMap.get("ACTIVE"));
tempItem.setRemark(tempMap.get("REMARK"));
tempItem.setCreatedDate(tempMap.get("CREATED_DATE"));
tempItem.setCreatedDate(DateUtils.getStringToDate(tempMap.get("CREATED_DATE"), "yyyy-MM-dd HH:mm:ss"));
tempItem.setProLineNo(tempMap.get("PRO_LINE_NO"));
tempItem.setCanCreateNewRollFlag(tempMap.get("CAN_CREATE_NEW_ROLL_FLAG"));
tempItem.setNeedSetupFlag(tempMap.get("NEED_SETUP_FLAG"));
@ -99,7 +105,7 @@ public class BaseSearchApi {
* @date 2024/12/12 11:23
* @version 1.0
*/
public static List<WarehouseLocation> getWarehouseLocations(Server srv, String siteCon, String ifsRowVersion, int startIndex, int pageSize) throws APException {
public static List<LocationInformationVo> getWarehouseLocations(Server srv, String siteCon, String ifsRowVersion, int startIndex, int pageSize) throws APException {
StringBuilder searchSql = new StringBuilder();
searchSql.append("SELECT wbb.contract site, wbb.location_no location_id, wbb.description location_name, wbb.warehouse_id, 'Y' active, NULL create_date, 'admin' create_by,");
searchSql.append(" NULL update_date, NULL update_by, ilt.inventory_location_type location_type, wbb.objid ifsRowId, wbb.OBJVERSION ifsRowVersion");
@ -125,7 +131,7 @@ public class BaseSearchApi {
if (recordCollection == null) {
return null;
} else {
List<WarehouseLocation> resultItems = new ArrayList<>();
List<LocationInformationVo> resultItems = new ArrayList<>();
//调用通用的处理方法 返回Map
List<Map<String, String>> resultList = IfsConverterToMap.ConverterIfsToList(recordCollection);
//判断是否存在数据
@ -135,19 +141,19 @@ public class BaseSearchApi {
//获取数据转bean
for (int i = 0; i < resultList.size(); i++) {
Map<String, String> tempMap = resultList.get(i);
WarehouseLocation tempItem = new WarehouseLocation();
LocationInformationVo tempItem = new LocationInformationVo();
//设置参数
tempItem.setIfsRowId(tempMap.get("IFSROWID"));
//tempItem.setIfsRowId(tempMap.get("IFSROWID"));
tempItem.setIfsRowVersion(tempMap.get("IFSROWVERSION"));
tempItem.setSite(tempMap.get("SITE"));
tempItem.setLocationId(tempMap.get("LOCATION_ID"));
tempItem.setLocationName(tempMap.get("LOCATION_NAME"));
tempItem.setWarehouseId(tempMap.get("WAREHOUSE_ID"));
tempItem.setActive(tempMap.get("ACTIVE"));
tempItem.setCreateDate(tempMap.get("CREATE_DATE")); // 从tempMap获取值不再直接设为null
tempItem.setCreateBy(tempMap.get("CREATE_BY")); // 注意字段名也改为大写
tempItem.setUpdateDate(tempMap.get("UPDATE_DATE")); // 从tempMap获取值不再直接设为null
tempItem.setUpdateBy(tempMap.get("UPDATE_BY"));//直接设为null因为SQL中对应字段是NULL
tempItem.setCreateDate(null); // 从tempMap获取值不再直接设为null
tempItem.setCreateBy("admin"); // 注意字段名也改为大写
tempItem.setUpdateDate(null); // 从tempMap获取值不再直接设为null
tempItem.setUpdateBy(null);//直接设为null因为SQL中对应字段是NULL
tempItem.setLocationType(tempMap.get("LOCATION_TYPE"));
//添加对象
resultItems.add(tempItem);
@ -162,7 +168,7 @@ public class BaseSearchApi {
* @date 2024/12/12 11:27
* @version 1.0
*/
public static List<LaborClass> getIfsLaborClasss(Server srv, String siteCon, String ifsRowVersion) throws APException {
public static List<PersonnelLevelVo> getIfsLaborClasss(Server srv, String siteCon, String ifsRowVersion) throws APException {
StringBuilder searchSql = new StringBuilder();
searchSql.append("SELECT lc.contract site, lc.labor_class_no level_id, lc.labor_class_description level_desc,");
searchSql.append(" (CASE WHEN lc.objstate = 'Active' THEN 'Y' ELSE 'N' END) active, sysdate create_date, 'Admin' create_by,");
@ -186,7 +192,7 @@ public class BaseSearchApi {
if (recordCollection == null) {
return null;
} else {
List<LaborClass> resultItems = new ArrayList<>();
List<PersonnelLevelVo> resultItems = new ArrayList<>();
//调用通用的处理方法 返回Map
List<Map<String, String>> resultList = IfsConverterToMap.ConverterIfsToList(recordCollection);
//判断是否存在数据
@ -196,19 +202,19 @@ public class BaseSearchApi {
//获取数据转bean
for (int i = 0; i < resultList.size(); i++) {
Map<String, String> tempMap = resultList.get(i);
LaborClass tempItem = new LaborClass();
PersonnelLevelVo tempItem = new PersonnelLevelVo();
//设置参数
tempItem.setIfsRowId(tempMap.get("IFSROWID"));
//tempItem.setIfsRowId(tempMap.get("IFSROWID"));
tempItem.setIfsRowVersion(tempMap.get("IFSROWVERSION"));
tempItem.setSite(tempMap.get("SITE"));
tempItem.setLevelId(tempMap.get("LEVEL_ID"));
tempItem.setLevelDesc(tempMap.get("LEVEL_DESC"));
tempItem.setActive(tempMap.get("ACTIVE"));
tempItem.setCreateDate(tempMap.get("CREATE_DATE")); // 从tempMap获取值
tempItem.setCreateDate(DateUtils.getStringToDate(tempMap.get("CREATE_DATE"), "yyyy-MM-dd HH:mm:ss")); // 从tempMap获取值
tempItem.setCreateBy(tempMap.get("CREATE_BY")); // 注意字段名也改为大写
tempItem.setUpdateDate(tempMap.get("UPDATE_DATE")); // 从tempMap获取值
tempItem.setUpdateDate(null); // 从tempMap获取值
tempItem.setUpdateBy(tempMap.get("UPDATE_BY")); // 从tempMap获取值
tempItem.setLevelCost(tempMap.get("LEVEL_COST")); // 获取成本值
tempItem.setLevelCost(new BigDecimal(tempMap.get("LEVEL_COST"))); // 获取成本值
//添加对象
resultItems.add(tempItem);
}
@ -277,7 +283,7 @@ public class BaseSearchApi {
* @date 2024/12/12 11:38
* @version 1.0
*/
public static List<InventoryValue> getInventoryValues(Server srv, String siteCon, String ifsRowVersion, int startIndex, int pageSize) throws APException {
public static List<InventoryPartUnitCostSumVo> getInventoryValues(Server srv, String siteCon, String ifsRowVersion, int startIndex, int pageSize) throws APException {
StringBuilder searchSql = new StringBuilder();
searchSql.append("SELECT OBJID ifsRowId, OBJVERSION ifsRowVersion, CONTRACT site, PART_NO, CONFIGURATION_ID, LOT_BATCH_NO, SERIAL_NO,");
searchSql.append(" ifsapp.Inventory_Part_Unit_Cost_API.Get_Inventory_Value_By_Method(CONTRACT,PART_NO,CONFIGURATION_ID,LOT_BATCH_NO,SERIAL_NO) inventoryValue");
@ -303,15 +309,15 @@ public class BaseSearchApi {
if (recordCollection == null) {
return null;
} else {
List<InventoryValue> resultItems = new ArrayList<>();
List<InventoryPartUnitCostSumVo> resultItems = new ArrayList<>();
//调用通用的处理方法 返回Map
List<Map<String, String>> resultList = IfsConverterToMap.ConverterIfsToList(recordCollection);
//获取数据转bean
for (int i = 0; i < resultList.size(); i++) {
Map<String, String> tempMap = resultList.get(i);
InventoryValue tempItem = new InventoryValue();
InventoryPartUnitCostSumVo tempItem = new InventoryPartUnitCostSumVo();
//设置参数
tempItem.setIfsRowId(tempMap.get("IFSROWID"));
//tempItem.setIfsRowId(tempMap.get("IFSROWID"));
tempItem.setIfsRowVersion(tempMap.get("IFSROWVERSION"));
tempItem.setSite(tempMap.get("SITE"));
tempItem.setPartNo(tempMap.get("PART_NO"));

25
src/main/java/com/spring/ifs/bean/BaseSearchBean.java

@ -3,6 +3,11 @@ package com.spring.ifs.bean;
import com.spring.ifs.api.BaseSearchApi;
import com.spring.ifs.api.IfsServer;
import com.spring.ifs.data.*;
import com.spring.modules.base.vo.PersonnelLevelVo;
import com.spring.modules.part.entity.PartInformationEntity;
import com.spring.modules.part.vo.InventoryPartUnitCostSumVo;
import com.spring.modules.part.vo.LocationInformationVo;
import com.spring.modules.part.vo.WorkCenterVo;
import ifs.fnd.ap.APException;
import ifs.fnd.ap.Server;
import org.slf4j.Logger;
@ -33,12 +38,12 @@ public class BaseSearchBean {
* @date 2024/12/12 13:23
* @version 1.0
*/
public List<WorkCenter> getWorkCenterNos(Server srv, BaseSearchData inData) throws APException {
public List<WorkCenterVo> getWorkCenterNos(Server srv, PartInformationEntity inData) throws APException {
//查询的参数
String siteCon = inData.getSiteCon();
String ifsRowVersion = inData.getIfsRowVersion();
logger.info("请求参数:"+siteCon);
List<WorkCenter> resultList = BaseSearchApi.getWorkCenterNos(srv, siteCon, ifsRowVersion);;
List<WorkCenterVo> resultList = BaseSearchApi.getWorkCenterNos(srv, siteCon, ifsRowVersion);;
logger.info("返回集合大小:"+resultList.size());
return resultList;
}
@ -50,17 +55,17 @@ public class BaseSearchBean {
* @date 2024/12/12 13:24
* @version 1.0
*/
public List<WarehouseLocation> getWarehouseLocations(Server srv, BaseSearchData inData) throws APException {
public List<LocationInformationVo> getWarehouseLocations(Server srv, PartInformationEntity inData) throws APException {
//查询的参数
String siteCon = inData.getSiteCon();
String ifsRowVersion = inData.getIfsRowVersion();
logger.info("请求参数:"+siteCon);
List<WarehouseLocation> resultList = new ArrayList<>();
List<LocationInformationVo> resultList = new ArrayList<>();
int pageSize = 200;
//迭代查询
for(int i = 0; i < 10; i++){
int startIndex = i * pageSize;
List<WarehouseLocation> tempList = BaseSearchApi.getWarehouseLocations(srv, siteCon, ifsRowVersion, startIndex, pageSize);
List<LocationInformationVo> tempList = BaseSearchApi.getWarehouseLocations(srv, siteCon, ifsRowVersion, startIndex, pageSize);
//判断查询是否结束
if(tempList != null && tempList.size() > 0) {
resultList.addAll(tempList);
@ -78,7 +83,7 @@ public class BaseSearchBean {
* @date 2024/12/12 13:29
* @version 1.0
*/
public List<LaborClass> getIfsLaborClasss(Server srv, BaseSearchData inData) throws APException {
public List<PersonnelLevelVo> getIfsLaborClasss(Server srv, PartInformationEntity inData) throws APException {
//查询的参数
String siteCon = inData.getSiteCon();
String ifsRowVersion = inData.getIfsRowVersion();
@ -91,7 +96,7 @@ public class BaseSearchBean {
* @date 2024/12/9 13:28
* @version 1.0
*/
public List<PartCatalog> getMasterParts(Server srv, BaseSearchData inData) throws APException {
public List<PartCatalog> getMasterParts(Server srv, PartInformationEntity inData) throws APException {
//公共参数
String ifsRowVersion = inData.getIfsRowVersion();
//获取连接
@ -118,17 +123,17 @@ public class BaseSearchBean {
* @date 2024/12/12 13:33
* @version 1.0
*/
public List<InventoryValue> getInventoryValues(Server srv, BaseSearchData inData) throws APException {
public List<InventoryPartUnitCostSumVo> getInventoryValues(Server srv, PartInformationEntity inData) throws APException {
//查询的参数
String siteCon = inData.getSiteCon();
String ifsRowVersion = inData.getIfsRowVersion();
logger.info("库存件cost value请求参数:"+siteCon);
List<InventoryValue> resultList = new ArrayList<>();
List<InventoryPartUnitCostSumVo> resultList = new ArrayList<>();
int pageSize = 200;
//迭代查询
for(int i = 0; i < 10; i++){
int startIndex = i * pageSize;
List<InventoryValue> tempList = BaseSearchApi.getInventoryValues(srv, siteCon, ifsRowVersion, startIndex, pageSize);
List<InventoryPartUnitCostSumVo> tempList = BaseSearchApi.getInventoryValues(srv, siteCon, ifsRowVersion, startIndex, pageSize);
//判断查询是否结束
if(tempList.size() > 0) {
resultList.addAll(tempList);

23
src/main/java/com/spring/ifs/controller/TestIfsController.java

@ -4,6 +4,11 @@ import com.spring.ifs.bean.BaseSearchBean;
import com.spring.ifs.bean.InventoryServiceBean;
import com.spring.ifs.bean.MasterServiceBean;
import com.spring.ifs.data.*;
import com.spring.modules.base.vo.PersonnelLevelVo;
import com.spring.modules.part.entity.PartInformationEntity;
import com.spring.modules.part.vo.InventoryPartUnitCostSumVo;
import com.spring.modules.part.vo.LocationInformationVo;
import com.spring.modules.part.vo.WorkCenterVo;
import ifs.fnd.ap.APException;
import ifs.fnd.ap.Server;
import org.springframework.beans.factory.annotation.Autowired;
@ -36,10 +41,10 @@ public class TestIfsController {
* @version 1.0
*/
@PostMapping("/getWorkCenterNos")
public Object getWorkCenterNos(Server srv, @RequestBody BaseSearchData inData) throws APException {
public Object getWorkCenterNos(Server srv, @RequestBody PartInformationEntity inData) throws APException {
Map<String, Object> resultMap = new HashMap<String, Object>();
try {
List<WorkCenter> returnlist = baseSearchBean.getWorkCenterNos(srv, inData);
List<WorkCenterVo> returnlist = baseSearchBean.getWorkCenterNos(srv, inData);
resultMap.put("obj", returnlist);
resultMap.put("total", returnlist.size());
resultMap.put("code", 200);
@ -58,10 +63,10 @@ public class TestIfsController {
* @version 1.0
*/
@PostMapping("/getWarehouseLocations")
public Object getWarehouseLocations(Server srv, @RequestBody BaseSearchData inData) throws APException {
public Object getWarehouseLocations(Server srv, @RequestBody PartInformationEntity inData) throws APException {
Map<String, Object> resultMap = new HashMap<String, Object>();
try {
List<WarehouseLocation> returnlist = baseSearchBean.getWarehouseLocations(srv, inData);
List<LocationInformationVo> returnlist = baseSearchBean.getWarehouseLocations(srv, inData);
resultMap.put("obj", returnlist);
resultMap.put("total", returnlist.size());
resultMap.put("code", 200);
@ -80,10 +85,10 @@ public class TestIfsController {
* @version 1.0
*/
@PostMapping("/getIfsLaborClasss")
public Object getIfsLaborClasss(Server srv, @RequestBody BaseSearchData inData) throws APException {
public Object getIfsLaborClasss(Server srv, @RequestBody PartInformationEntity inData) throws APException {
Map<String, Object> resultMap = new HashMap<String, Object>();
try {
List<LaborClass> returnlist = baseSearchBean.getIfsLaborClasss(srv, inData);
List<PersonnelLevelVo> returnlist = baseSearchBean.getIfsLaborClasss(srv, inData);
resultMap.put("obj", returnlist);
resultMap.put("total", returnlist.size());
resultMap.put("code", 200);
@ -102,7 +107,7 @@ public class TestIfsController {
* @version 1.0
*/
@PostMapping("/getMasterParts")
public Object getMasterParts(Server srv, @RequestBody BaseSearchData inData) throws APException {
public Object getMasterParts(Server srv, @RequestBody PartInformationEntity inData) throws APException {
Map<String, Object> resultMap = new HashMap<String, Object>();
try {
List<PartCatalog> returnlist = baseSearchBean.getMasterParts(srv, inData);
@ -124,10 +129,10 @@ public class TestIfsController {
* @version 1.0
*/
@PostMapping("/getInventoryValues")
public Object getInventoryValues(Server srv, @RequestBody BaseSearchData inData) throws APException {
public Object getInventoryValues(Server srv, @RequestBody PartInformationEntity inData) throws APException {
Map<String, Object> resultMap = new HashMap<String, Object>();
try {
List<InventoryValue> returnlist = baseSearchBean.getInventoryValues(srv, inData);
List<InventoryPartUnitCostSumVo> returnlist = baseSearchBean.getInventoryValues(srv, inData);
resultMap.put("obj", returnlist);
resultMap.put("total", returnlist.size());
resultMap.put("code", 200);

Loading…
Cancel
Save