diff --git a/src/main/java/com/spring/ifs/api/BaseSearchApi.java b/src/main/java/com/spring/ifs/api/BaseSearchApi.java index 2a8354fb..8254ca80 100644 --- a/src/main/java/com/spring/ifs/api/BaseSearchApi.java +++ b/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 getWorkCenterNos(Server srv, String siteCon, String ifsRowVersion) throws APException { + public static List 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 resultItems = new ArrayList<>(); + List resultItems = new ArrayList<>(); //调用通用的处理方法 返回Map List> resultList = IfsConverterToMap.ConverterIfsToList(recordCollection); //判断是否存在数据 @@ -65,24 +71,24 @@ public class BaseSearchApi { //获取数据转bean for (int i = 0; i < resultList.size(); i++) { Map 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 getWarehouseLocations(Server srv, String siteCon, String ifsRowVersion, int startIndex, int pageSize) throws APException { + public static List 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 resultItems = new ArrayList<>(); + List resultItems = new ArrayList<>(); //调用通用的处理方法 返回Map List> resultList = IfsConverterToMap.ConverterIfsToList(recordCollection); //判断是否存在数据 @@ -135,19 +141,19 @@ public class BaseSearchApi { //获取数据转bean for (int i = 0; i < resultList.size(); i++) { Map 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 getIfsLaborClasss(Server srv, String siteCon, String ifsRowVersion) throws APException { + public static List 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 resultItems = new ArrayList<>(); + List resultItems = new ArrayList<>(); //调用通用的处理方法 返回Map List> resultList = IfsConverterToMap.ConverterIfsToList(recordCollection); //判断是否存在数据 @@ -196,19 +202,19 @@ public class BaseSearchApi { //获取数据转bean for (int i = 0; i < resultList.size(); i++) { Map 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 getInventoryValues(Server srv, String siteCon, String ifsRowVersion, int startIndex, int pageSize) throws APException { + public static List 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 resultItems = new ArrayList<>(); + List resultItems = new ArrayList<>(); //调用通用的处理方法 返回Map List> resultList = IfsConverterToMap.ConverterIfsToList(recordCollection); //获取数据转bean for (int i = 0; i < resultList.size(); i++) { Map 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")); diff --git a/src/main/java/com/spring/ifs/bean/BaseSearchBean.java b/src/main/java/com/spring/ifs/bean/BaseSearchBean.java index cf95ed45..d79ca6f8 100644 --- a/src/main/java/com/spring/ifs/bean/BaseSearchBean.java +++ b/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 getWorkCenterNos(Server srv, BaseSearchData inData) throws APException { + public List getWorkCenterNos(Server srv, PartInformationEntity inData) throws APException { //查询的参数 String siteCon = inData.getSiteCon(); String ifsRowVersion = inData.getIfsRowVersion(); logger.info("请求参数:"+siteCon); - List resultList = BaseSearchApi.getWorkCenterNos(srv, siteCon, ifsRowVersion);; + List 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 getWarehouseLocations(Server srv, BaseSearchData inData) throws APException { + public List getWarehouseLocations(Server srv, PartInformationEntity inData) throws APException { //查询的参数 String siteCon = inData.getSiteCon(); String ifsRowVersion = inData.getIfsRowVersion(); logger.info("请求参数:"+siteCon); - List resultList = new ArrayList<>(); + List resultList = new ArrayList<>(); int pageSize = 200; //迭代查询 for(int i = 0; i < 10; i++){ int startIndex = i * pageSize; - List tempList = BaseSearchApi.getWarehouseLocations(srv, siteCon, ifsRowVersion, startIndex, pageSize); + List 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 getIfsLaborClasss(Server srv, BaseSearchData inData) throws APException { + public List 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 getMasterParts(Server srv, BaseSearchData inData) throws APException { + public List 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 getInventoryValues(Server srv, BaseSearchData inData) throws APException { + public List getInventoryValues(Server srv, PartInformationEntity inData) throws APException { //查询的参数 String siteCon = inData.getSiteCon(); String ifsRowVersion = inData.getIfsRowVersion(); logger.info("库存件cost value请求参数:"+siteCon); - List resultList = new ArrayList<>(); + List resultList = new ArrayList<>(); int pageSize = 200; //迭代查询 for(int i = 0; i < 10; i++){ int startIndex = i * pageSize; - List tempList = BaseSearchApi.getInventoryValues(srv, siteCon, ifsRowVersion, startIndex, pageSize); + List tempList = BaseSearchApi.getInventoryValues(srv, siteCon, ifsRowVersion, startIndex, pageSize); //判断查询是否结束 if(tempList.size() > 0) { resultList.addAll(tempList); diff --git a/src/main/java/com/spring/ifs/controller/TestIfsController.java b/src/main/java/com/spring/ifs/controller/TestIfsController.java index 818f308e..5ba7c4bc 100644 --- a/src/main/java/com/spring/ifs/controller/TestIfsController.java +++ b/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 resultMap = new HashMap(); try { - List returnlist = baseSearchBean.getWorkCenterNos(srv, inData); + List 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 resultMap = new HashMap(); try { - List returnlist = baseSearchBean.getWarehouseLocations(srv, inData); + List 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 resultMap = new HashMap(); try { - List returnlist = baseSearchBean.getIfsLaborClasss(srv, inData); + List 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 resultMap = new HashMap(); try { List 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 resultMap = new HashMap(); try { - List returnlist = baseSearchBean.getInventoryValues(srv, inData); + List returnlist = baseSearchBean.getInventoryValues(srv, inData); resultMap.put("obj", returnlist); resultMap.put("total", returnlist.size()); resultMap.put("code", 200);