Browse Source

IFS jar 测试开发代码

master
DouDou 1 year ago
parent
commit
411de2f11c
  1. 328
      src/main/java/com/spring/ifs/api/BaseSearchApiTest.java
  2. 778
      src/main/java/com/spring/ifs/api/BomApiTest.java
  3. 1061
      src/main/java/com/spring/ifs/api/InventoryPartApiTest.java
  4. 200
      src/main/java/com/spring/ifs/api/MasterPartApiTest.java
  5. 1062
      src/main/java/com/spring/ifs/api/RoutingApiTest.java
  6. 292
      src/main/java/com/spring/ifs/api/TechnicalClassApiTest.java
  7. 504
      src/main/java/com/spring/ifs/api/ToolApiTest.java
  8. 164
      src/main/java/com/spring/ifs/bean/BaseSearchBeanTest.java
  9. 832
      src/main/java/com/spring/ifs/bean/InventoryServiceBeanTest.java
  10. 140
      src/main/java/com/spring/ifs/bean/MasterServiceBeanTest.java
  11. 210
      src/main/java/com/spring/ifs/bean/TechnicalClassBean.java
  12. 419
      src/main/java/com/spring/ifs/bean/ToolServiceBean.java

328
src/main/java/com/spring/ifs/api/BaseSearchApiTest.java

@ -0,0 +1,328 @@
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.APException;
import ifs.fnd.ap.RecordCollection;
import ifs.fnd.ap.Server;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @description: 基础查询的api
* @author LR
* @date 2024/12/12 10:44
* @version 1.0
*/
public class BaseSearchApiTest {
/**
* @description: 查询IFS的加工中心
* @author LR
* @date 2024/12/12 11:02
* @version 1.0
*/
public static List<WorkCenter> 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,");
searchSql.append(" TO_CHAR(NVL(wc.average_capacity, 0), 'FM99999999999999999999999999999999999999.999999') averageCapacity,");
searchSql.append(" NVL(wc.utilization, 0) utilization, wc.sched_capacity_db capacity_type_db,");
searchSql.append(" (CASE WHEN sched_capacity_db = 'I' THEN '无限产能' ELSE '有限产能' END) capacity_type, wc.uom um_id,");
searchSql.append(" (CASE WHEN wc.objstate = 'Active' THEN 'Y' ELSE 'N' END) active, wc.note_text remark, wc.create_date created_date,");
searchSql.append(" wc.PRODUCTION_LINE pro_line_no, 'N' can_create_new_roll_flag, 'N' need_setup_flag, wc.objid ifsRowId, wc.OBJVERSION ifsRowVersion");
searchSql.append(" FROM ifsapp.WORK_CENTER wc");
searchSql.append(" WHERE wc.work_center_code_db IN ('I','O')");
//添加判断的查询条件
if(!(null == siteCon || "".equals(siteCon))) {
searchSql.append(" AND wc.contract IN "+siteCon);
}
//设置查询的入参
Map<String, String> inParam = new HashMap<>();
if(!(null == ifsRowVersion || "".equals(ifsRowVersion))) {
searchSql.append(" AND wc.OBJVERSION >= :ifsRowVersion");
inParam.put("ifsRowVersion", ifsRowVersion);
}
//添加排序语句
searchSql.append(" ORDER BY wc.OBJVERSION, wc.contract, wc.work_center_no");
//调用查询的通用方法
RecordCollection recordCollection = IfsPlsqlUtils.execSqlSearchGetRecordCollection(srv, searchSql, inParam);
//判断能否返回
if (recordCollection == null) {
return null;
} else {
List<WorkCenter> resultItems = new ArrayList<>();
//调用通用的处理方法 返回Map
List<Map<String, String>> resultList = IfsConverterToMap.ConverterIfsToList(recordCollection);
//判断是否存在数据
if(resultList == null) {
return resultItems;
}
//获取数据转bean
for (int i = 0; i < resultList.size(); i++) {
Map<String, String> tempMap = resultList.get(i);
WorkCenter tempItem = new WorkCenter();
//设置参数
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.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.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.setProLineNo(tempMap.get("PRO_LINE_NO"));
tempItem.setCanCreateNewRollFlag(tempMap.get("CAN_CREATE_NEW_ROLL_FLAG"));
tempItem.setNeedSetupFlag(tempMap.get("NEED_SETUP_FLAG"));
//添加对象
resultItems.add(tempItem);
}
return resultItems;
}
}
/**
* @description: 查询机台的信息
* @author LR
* @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 {
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");
searchSql.append(" FROM ifsapp.WAREHOUSE_BAY_BIN wbb, ifsapp.INVENTORY_LOCATION_GROUP ilt");
searchSql.append(" WHERE wbb.location_group = ilt.LOCATION_GROUP");
//添加判断的查询条件
if(!(null == siteCon || "".equals(siteCon))) {
searchSql.append(" AND wbb.contract IN "+siteCon);
}
//设置查询的入参
Map<String, String> inParam = new HashMap<>();
if(!(null == ifsRowVersion || "".equals(ifsRowVersion))) {
searchSql.append(" AND wbb.OBJVERSION >= :ifsRowVersion");
inParam.put("ifsRowVersion", ifsRowVersion);
}
//添加排序语句
searchSql.append(" ORDER BY wbb.OBJVERSION, wbb.contract, wbb.location_no");
//添加分页的查询语句
searchSql.append(" OFFSET "+startIndex+" ROWS FETCH NEXT "+pageSize+" ROWS ONLY");
//调用查询的通用方法
RecordCollection recordCollection = IfsPlsqlUtils.execSqlSearchGetRecordCollection(srv, searchSql, inParam);
//判断能否返回
if (recordCollection == null) {
return null;
} else {
List<WarehouseLocation> resultItems = new ArrayList<>();
//调用通用的处理方法 返回Map
List<Map<String, String>> resultList = IfsConverterToMap.ConverterIfsToList(recordCollection);
//判断是否存在数据
if(resultList == null) {
return resultItems;
}
//获取数据转bean
for (int i = 0; i < resultList.size(); i++) {
Map<String, String> tempMap = resultList.get(i);
WarehouseLocation tempItem = new WarehouseLocation();
//设置参数
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.setLocationType(tempMap.get("LOCATION_TYPE"));
//添加对象
resultItems.add(tempItem);
}
return resultItems;
}
}
/**
* @description: 查询人员等级
* @author LR
* @date 2024/12/12 11:27
* @version 1.0
*/
public static List<LaborClass> 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,");
searchSql.append(" NULL update_date, NULL update_by, 100 level_cost, lc.objid ifsRowId, lc.OBJVERSION ifsRowVersion");
searchSql.append(" FROM ifsapp.labor_class lc");
//添加判断的查询条件
if(!(null == siteCon || "".equals(siteCon))) {
searchSql.append(" WHERE lc.contract IN "+siteCon);
}
//设置查询的入参
Map<String, String> inParam = new HashMap<>();
if(!(null == ifsRowVersion || "".equals(ifsRowVersion))) {
searchSql.append(" AND lc.OBJVERSION >= :ifsRowVersion");
inParam.put("ifsRowVersion", ifsRowVersion);
}
//添加排序语句
searchSql.append(" ORDER BY lc.OBJVERSION, lc.contract, lc.labor_class_no");
//调用查询的通用方法
RecordCollection recordCollection = IfsPlsqlUtils.execSqlSearchGetRecordCollection(srv, searchSql, inParam);
//判断能否返回
if (recordCollection == null) {
return null;
} else {
List<LaborClass> resultItems = new ArrayList<>();
//调用通用的处理方法 返回Map
List<Map<String, String>> resultList = IfsConverterToMap.ConverterIfsToList(recordCollection);
//判断是否存在数据
if(resultList == null) {
return resultItems;
}
//获取数据转bean
for (int i = 0; i < resultList.size(); i++) {
Map<String, String> tempMap = resultList.get(i);
LaborClass tempItem = new LaborClass();
//设置参数
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.setCreateBy(tempMap.get("CREATE_BY")); // 注意字段名也改为大写
tempItem.setUpdateDate(tempMap.get("UPDATE_DATE")); // 从tempMap获取值
tempItem.setUpdateBy(tempMap.get("UPDATE_BY")); // 从tempMap获取值
tempItem.setLevelCost(tempMap.get("LEVEL_COST")); // 获取成本值
//添加对象
resultItems.add(tempItem);
}
return resultItems;
}
}
/**
* @description: 获取物料件的数据
* @author LR
* @date 2024/12/12 11:34
* @version 1.0
*/
public static List<PartCatalog> getPartCatalogs(Server srv, String ifsRowVersion, int startIndex, int pageSize) throws APException {
StringBuilder searchSql = new StringBuilder();
searchSql.append("SELECT PART_NO, DESCRIPTION partDesc, INFO_TEXT, STD_NAME_ID, UNIT_CODE,");
searchSql.append(" LOT_TRACKING_CODE, WEIGHT_NET, UOM_FOR_WEIGHT_NET, VOLUME_NET, UOM_FOR_VOLUME_NET,");
searchSql.append(" OBJID ifsRowId, OBJVERSION ifsRowVersion");
searchSql.append(" FROM IFSAPP.PART_CATALOG pc");
//设置查询的入参
Map<String, String> inParam = new HashMap<>();
if(!(null == ifsRowVersion || "".equals(ifsRowVersion))) {
searchSql.append(" AND pc.OBJVERSION >= :ifsRowVersion");
inParam.put("ifsRowVersion", ifsRowVersion);
}
//添加排序语句
searchSql.append(" ORDER BY pc.OBJVERSION, pc.PART_NO, pc.DESCRIPTION");
//添加分页的查询语句
searchSql.append(" OFFSET "+startIndex+" ROWS FETCH NEXT "+pageSize+" ROWS ONLY");
//调用查询的通用方法
RecordCollection recordCollection = IfsPlsqlUtils.execSqlSearchGetRecordCollection(srv, searchSql, inParam);
//判断能否返回
if (recordCollection == null) {
return null;
} else {
List<PartCatalog> 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);
PartCatalog tempItem = new PartCatalog();
//设置参数
tempItem.setIfsRowId(tempMap.get("IFSROWID"));
tempItem.setIfsRowVersion(tempMap.get("IFSROWVERSION"));
tempItem.setPartNo(tempMap.get("PART_NO"));
tempItem.setPartDesc(tempMap.get("PARTDESC")); // 注意使用小写的partDesc以匹配属性名
tempItem.setInfoText(tempMap.get("INFO_TEXT"));
tempItem.setStdNameId(tempMap.get("STD_NAME_ID"));
tempItem.setUnitCode(tempMap.get("UNIT_CODE"));
tempItem.setLotTrackingCode(tempMap.get("LOT_TRACKING_CODE"));
tempItem.setWeightNet(tempMap.get("WEIGHT_NET"));
tempItem.setUomForWeightNet(tempMap.get("UOM_FOR_WEIGHT_NET"));
tempItem.setVolumeNet(tempMap.get("VOLUME_NET"));
tempItem.setUomForVolumeNet(tempMap.get("UOM_FOR_VOLUME_NET"));
//添加对象
resultItems.add(tempItem);
}
return resultItems;
}
}
/**
* @description: 查询库存件的属性值
* @author LR
* @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 {
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");
searchSql.append(" FROM ifsapp.INVENTORY_PART_UNIT_COST_SUM pcs");
searchSql.append(" WHERE pcs.CONFIGURATION_ID = '*'");
//添加判断的查询条件
if(!(null == siteCon || "".equals(siteCon))) {
searchSql.append(" AND pcs.contract IN "+siteCon);
}
//设置查询的入参
Map<String, String> inParam = new HashMap<>();
if(!(null == ifsRowVersion || "".equals(ifsRowVersion))) {
searchSql.append(" AND pcs.OBJVERSION >= :ifsRowVersion");
inParam.put("ifsRowVersion", ifsRowVersion);
}
//添加排序语句
searchSql.append(" ORDER BY pcs.OBJVERSION, pcs.contract, pcs.PART_NO");
//添加分页的查询语句
searchSql.append(" OFFSET "+startIndex+" ROWS FETCH NEXT "+pageSize+" ROWS ONLY");
//调用查询的通用方法
RecordCollection recordCollection = IfsPlsqlUtils.execSqlSearchGetRecordCollection(srv, searchSql, inParam);
//判断能否返回
if (recordCollection == null) {
return null;
} else {
List<InventoryValue> 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();
//设置参数
tempItem.setIfsRowId(tempMap.get("IFSROWID"));
tempItem.setIfsRowVersion(tempMap.get("IFSROWVERSION"));
tempItem.setSite(tempMap.get("SITE"));
tempItem.setPartNo(tempMap.get("PART_NO"));
tempItem.setConfigurationId(tempMap.get("CONFIGURATION_ID"));
tempItem.setLotBatchNo(tempMap.get("LOT_BATCH_NO"));
tempItem.setSerialNo(tempMap.get("SERIAL_NO"));
tempItem.setInventoryValue(tempMap.get("INVENTORYVALUE"));
//添加对象
resultItems.add(tempItem);
}
return resultItems;
}
}
}

778
src/main/java/com/spring/ifs/api/BomApiTest.java

@ -0,0 +1,778 @@
package com.spring.ifs.api;
import com.spring.ifs.data.BomAlternative;
import com.spring.ifs.data.BomDistribution;
import com.spring.ifs.data.BomHeader;
import com.spring.ifs.data.BomItem;
import com.spring.ifs.utils.IfsConverterToMap;
import com.spring.ifs.utils.IfsPlsqlUtils;
import com.spring.modules.base.utils.DateUtils;
import ifs.fnd.ap.*;
import java.util.*;
/**
* @description: Bom的api
* @author LR
* @date 2024/12/9 10:56
* @version 1.0
*/
public class BomApiTest {
/**
* @description: 查询Bom Header
* @author LR
* @date 2024/12/11 14:45
* @version 1.0
*/
public static Map<String, String> getBomHeader(Server srv, String contract, String partNo, String engChgLevel, String bomType) throws APException {
StringBuilder searchSql = new StringBuilder();
searchSql.append("SELECT OBJID ifsRowId, OBJVERSION ifsRowVersion,");
searchSql.append(" CONTRACT, PART_NO, BOM_TYPE, ENG_CHG_LEVEL, NOTE_TEXT");
searchSql.append(" FROM IFSAPP.PROD_STRUCTURE_HEAD");
searchSql.append(" WHERE CONTRACT = :contract AND PART_NO = :partNo AND ENG_CHG_LEVEL = :engChgLevel AND BOM_TYPE = :bomType");
//设置查询的入参
Map<String, String> inParam = new HashMap<>();
inParam.put("contract", contract);
inParam.put("partNo", partNo);
inParam.put("engChgLevel", engChgLevel);
inParam.put("bomType", bomType);
//调用查询的通用方法
RecordCollection recordCollection = IfsPlsqlUtils.execSqlSearchGetRecordCollection(srv, searchSql, inParam);
//判断能否返回
if (recordCollection == null) {
return null;
} else {
Record recordData = recordCollection.get(0);
Map<String, String> resultMap = IfsConverterToMap.ConverterIfsToMap(recordData);
return resultMap;
}
}
/**
* @description: 按照料号查询Bom Header的集合
* @author LR
* @date 2024/12/12 17:40
* @version 1.0
*/
public static List<BomHeader> getBomHeadersByPartNo(Server srv, String contract, String partNo) throws APException {
StringBuilder searchSql = new StringBuilder();
searchSql.append("SELECT OBJID ifsRowId, OBJVERSION ifsRowVersion,");
searchSql.append(" CONTRACT, PART_NO, BOM_TYPE, ENG_CHG_LEVEL, NOTE_TEXT");
searchSql.append(" FROM IFSAPP.PROD_STRUCTURE_HEAD");
searchSql.append(" WHERE CONTRACT = :contract AND PART_NO = :partNo");
//设置查询的入参
Map<String, String> 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<BomHeader> resultItems = new ArrayList<>();
//调用通用的处理方法 返回Map
List<Map<String, String>> resultList = IfsConverterToMap.ConverterIfsToList(recordCollection);
//判断是否存在数据
if(resultList == null) {
return resultItems;
}
//获取数据转bean
for (int i = 0; i < resultList.size(); i++) {
Map<String, String> tempMap = resultList.get(i);
BomHeader tempItem = new BomHeader();
//设置参数
tempItem.setIfsRowId(tempMap.get("IFSROWID"));
tempItem.setIfsRowVersion(tempMap.get("IFSROWVERSION"));
tempItem.setContract((String) tempMap.get("CONTRACT"));
tempItem.setPartNo((String) tempMap.get("PART_NO"));
tempItem.setBomType((String) tempMap.get("BOM_TYPE"));
tempItem.setEngChgLevel((String) tempMap.get("ENG_CHG_LEVEL"));
tempItem.setNoteText((String) tempMap.get("NOTE_TEXT"));
//添加对象
resultItems.add(tempItem);
}
return resultItems;
}
}
/**
* @description: 插入Bom Header的主表
* @author LR
* @date 2024/12/11 15:08
* @version 1.0
*/
public static Map<String, String> insertBomHeader(Server srv, BomHeader inData) throws APException {
//公共参数
String contract = inData.getContract();//
String partNo = inData.getPartNo();// 物料编码
String engChgLevel = inData.getEngChgLevel();// 版本
String bomType = inData.getBomType();// 分类
String effPhaseInDate = inData.getEffPhaseInDate().substring(0, 10)+"-00.00.00";// 启用时间-年月日
String effPhaseOutDate = inData.getEffPhaseOutDate();// 结束时间-年月日
if(effPhaseOutDate == null || effPhaseOutDate.equals("")) {
effPhaseOutDate = "";
}else {
effPhaseOutDate = effPhaseOutDate+"-00.00.00";
}
//判断是否存在问题
String noteText = inData.getNoteText();// 备注
String createDate = DateUtils.getStringDate(new Date(), "yyyy-MM-dd")+"-00.00.00";//创建的时间
//入参
Map<String, String> inParam = new HashMap<>();
//填充参数
inParam.put("OBJID", "");
inParam.put("OBJVERSION", "");
inParam.put("PART_NO", partNo); // 物料编码
inParam.put("CONTRACT", contract); //
inParam.put("ENG_CHG_LEVEL", engChgLevel); // 物料的版本
inParam.put("BOM_TYPE", bomType); // BOM类型
inParam.put("EFF_PHASE_IN_DATE", effPhaseInDate); // 启用日期
inParam.put("EFF_PHASE_OUT_DATE", effPhaseOutDate); // 到期时间
inParam.put("NOTE_TEXT", noteText); // 备注
inParam.put("CREATE_DATE", createDate); // 创建日期
//执行存储过程 获取结果集
//执行check的操作
Map<String, String> checkMap = IfsPlsqlUtils.execProcedureGetRecord(srv, "PROD_STRUCTURE_HEAD_API",
"NEW__", PlsqlBaseMethodType.NEW, PlsqlBaseMethodAction.CHECK, inParam);
//执行do的操作
Map<String, String> resultMap = IfsPlsqlUtils.execProcedureGetRecord(srv, "PROD_STRUCTURE_HEAD_API",
"NEW__", PlsqlBaseMethodType.NEW, PlsqlBaseMethodAction.DO, inParam);
//返回结果集
return resultMap;
}
/**
* @description: 修改Bom Header的主表信息
* @author LR
* @date 2024/12/11 15:32
* @version 1.0
*/
public static Map<String, String> modifyBomHeader(Server srv, BomHeader inData) throws APException {
//公共参数
String ifsRowId = inData.getIfsRowId();
String ifsRowVersion = inData.getIfsRowVersion();
String effPhaseInDate = inData.getEffPhaseInDate().substring(0, 10)+"-00.00.00";// 启用时间-年月日
String effPhaseOutDate = inData.getEffPhaseOutDate();// 结束时间-年月日
if(effPhaseOutDate == null || effPhaseOutDate.equals("")) {
effPhaseOutDate = "";
}else {
effPhaseOutDate = effPhaseOutDate+"-00.00.00";
}
//判断是否存在问题
String noteText = inData.getNoteText();// 备注
//入参
Map<String, String> inParam = new HashMap<>();
//填充参数
inParam.put("OBJID", ifsRowId);
inParam.put("OBJVERSION", ifsRowVersion);
inParam.put("EFF_PHASE_IN_DATE", effPhaseInDate); // 启用日期
inParam.put("EFF_PHASE_OUT_DATE", effPhaseOutDate); // 到期时间
inParam.put("NOTE_TEXT", noteText); // 备注
//执行check的操作
Map<String, String> checkMap = IfsPlsqlUtils.execProcedureGetRecord(srv, "PROD_STRUCTURE_HEAD_API",
"MODIFY__", PlsqlBaseMethodType.MODIFY, PlsqlBaseMethodAction.CHECK, inParam);
//执行do的操作
Map<String, String> resultMap = IfsPlsqlUtils.execProcedureGetRecord(srv, "PROD_STRUCTURE_HEAD_API",
"MODIFY__", PlsqlBaseMethodType.MODIFY, PlsqlBaseMethodAction.DO, inParam);
//返回结果集
return resultMap;
}
/**
* @description: 删除Bom的主表信息
* @author LR
* @date 2024/12/11 15:33
* @version 1.0
*/
public static Map<String, String> removeBomHeader(Server srv, BomHeader inData) throws APException {
//公共参数
String ifsRowId = inData.getIfsRowId();
String ifsRowVersion = inData.getIfsRowVersion();
//入参
Map<String, String> inParam = new HashMap<>();
//填充参数
inParam.put("OBJID", ifsRowId);
inParam.put("OBJVERSION", ifsRowVersion);
//执行check的操作
Map<String, String> checkMap = IfsPlsqlUtils.execProcedureGetRecord(srv, "PROD_STRUCTURE_HEAD_API",
"REMOVE__", PlsqlBaseMethodType.REMOVE, PlsqlBaseMethodAction.CHECK, inParam);
//执行do的操作
Map<String, String> resultMap = IfsPlsqlUtils.execProcedureGetRecord(srv, "PROD_STRUCTURE_HEAD_API",
"REMOVE__", PlsqlBaseMethodType.REMOVE, PlsqlBaseMethodAction.DO, inParam);
//返回结果集
return resultMap;
}
/**
* @description: 查询Bom的替代
* @author LR
* @date 2024/12/11 14:48
* @version 1.0
*/
public static Map<String, String> getBomAlternative(Server srv, String contract, String partNo, String engChgLevel, String bomType, String alternativeNo) throws APException {
StringBuilder searchSql = new StringBuilder();
searchSql.append("SELECT OBJID ifsRowId, OBJVERSION ifsRowVersion,");
searchSql.append(" CONTRACT, PART_NO, BOM_TYPE, ENG_CHG_LEVEL, ALTERNATIVE_NO, NOTE_TEXT");
searchSql.append(" FROM IFSAPP.PROD_STRUCT_ALTERNATE");
searchSql.append(" WHERE CONTRACT = :contract AND PART_NO = :partNo AND ENG_CHG_LEVEL = :engChgLevel AND BOM_TYPE = :bomType AND ALTERNATIVE_NO = :alternativeNo");
//设置查询的入参
Map<String, String> inParam = new HashMap<>();
inParam.put("contract", contract);
inParam.put("partNo", partNo);
inParam.put("engChgLevel", engChgLevel);
inParam.put("bomType", bomType);
inParam.put("alternativeNo", alternativeNo);
//调用查询的通用方法
RecordCollection recordCollection = IfsPlsqlUtils.execSqlSearchGetRecordCollection(srv, searchSql, inParam);
//判断能否返回
if (recordCollection == null) {
return null;
} else {
Record recordData = recordCollection.get(0);
Map<String, String> resultMap = IfsConverterToMap.ConverterIfsToMap(recordData);
return resultMap;
}
}
/**
* @description: 插入Bom Alternative
* @author LR
* @date 2024/12/11 15:45
* @version 1.0
*/
public static Map<String, String> insertBomAlternative(Server srv, BomAlternative inData) throws APException {
//公共参数
String contract = inData.getContract();//
String partNo = inData.getPartNo();// 物料编码
String engChgLevel = inData.getEngChgLevel();// 版本
String bomType = inData.getBomType();// 分类
String alternativeNo = inData.getAlternativeNo();
String alternativeDesc = inData.getAlternativeDesc();
//判断是否存在问题
String noteText = inData.getNoteText();// 备注
//入参
Map<String, String> inParam = new HashMap<>();
//填充参数
inParam.put("OBJID", "");
inParam.put("OBJVERSION", "");
inParam.put("PART_NO", partNo); // 物料编码
inParam.put("CONTRACT", contract); //
inParam.put("ENG_CHG_LEVEL", engChgLevel); // 物料的版本
inParam.put("BOM_TYPE", bomType); // BOM类型
inParam.put("ALTERNATIVE_NO", alternativeNo); // 替代编码
inParam.put("ALTERNATIVE_DESCRIPTION", alternativeDesc); // 替代编码描述
inParam.put("USE_COST_DISTRIBUTION_DB", "STANDARD"); // 固定值
inParam.put("NOTE_TEXT", noteText); // 备注
//执行存储过程 获取结果集
//执行check的操作
Map<String, String> checkMap = IfsPlsqlUtils.execProcedureGetRecord(srv, "PROD_STRUCT_ALTERNATE_API",
"NEW__", PlsqlBaseMethodType.NEW, PlsqlBaseMethodAction.CHECK, inParam);
//执行do的操作
Map<String, String> resultMap = IfsPlsqlUtils.execProcedureGetRecord(srv, "PROD_STRUCT_ALTERNATE_API",
"NEW__", PlsqlBaseMethodType.NEW, PlsqlBaseMethodAction.DO, inParam);
//返回结果集
return resultMap;
}
/**
* @description: 修改Bom 的替代信息
* @author LR
* @date 2024/12/11 15:47
* @version 1.0
*/
public static Map<String, String> modifyBomAlternative(Server srv, BomAlternative inData) throws APException {
//公共参数
String ifsRowId = inData.getIfsRowId();//
String ifsRowVersion = inData.getIfsRowVersion();// 物料编码
String alternativeDesc = inData.getAlternativeDesc();
String noteText = inData.getNoteText();// 备注
//入参
Map<String, String> inParam = new HashMap<>();
//填充参数
inParam.put("OBJID", ifsRowId);
inParam.put("OBJVERSION", ifsRowVersion);
inParam.put("ALTERNATIVE_DESCRIPTION", alternativeDesc); // 替代编码描述
inParam.put("NOTE_TEXT", noteText); // 备注
//执行check的操作
Map<String, String> checkMap = IfsPlsqlUtils.execProcedureGetRecord(srv, "PROD_STRUCT_ALTERNATE_API",
"MODIFY__", PlsqlBaseMethodType.MODIFY, PlsqlBaseMethodAction.CHECK, inParam);
//执行do的操作
Map<String, String> resultMap = IfsPlsqlUtils.execProcedureGetRecord(srv, "PROD_STRUCT_ALTERNATE_API",
"MODIFY__", PlsqlBaseMethodType.MODIFY, PlsqlBaseMethodAction.DO, inParam);
//返回结果集
return resultMap;
}
/**
* @description: 删除Bom Alternative
* @author LR
* @date 2024/12/11 15:51
* @version 1.0
*/
public static void removeBomAlternative(Server srv, BomAlternative inData) throws APException {
//公共参数
String ifsRowId = inData.getIfsRowId();//
String ifsRowVersion = inData.getIfsRowVersion();// 物料编码
//入参
Map<String, String> inParam = new HashMap<>();
//填充参数
inParam.put("OBJID", ifsRowId);
inParam.put("OBJVERSION", ifsRowVersion);
//执行check的操作
Map<String, String> checkMap = IfsPlsqlUtils.execProcedureGetRecord(srv, "PROD_STRUCT_ALTERNATE_API",
"REMOVE__", PlsqlBaseMethodType.REMOVE, PlsqlBaseMethodAction.CHECK, inParam);
//执行do的操作
Map<String, String> resultMap = IfsPlsqlUtils.execProcedureGetRecord(srv, "PROD_STRUCT_ALTERNATE_API",
"REMOVE__", PlsqlBaseMethodType.REMOVE, PlsqlBaseMethodAction.DO, inParam);
}
/**
* @description: Build Bom的信息
* @author LR
* @date 2024/12/11 15:53
* @version 1.0
*/
public static Map<String, String> buildBomAlternative(Server srv, BomAlternative inData) throws APException {
//公共参数
String ifsRowId = inData.getIfsRowId();//
String ifsRowVersion = inData.getIfsRowVersion();// 物料编码
//入参
Map<String, String> inParam = new HashMap<>();
//填充参数
inParam.put("OBJID", ifsRowId);
inParam.put("OBJVERSION", ifsRowVersion);
//执行check的操作
Map<String, String> checkMap = IfsPlsqlUtils.execProcedureGetRecord(srv, "PROD_STRUCT_ALTERNATE_API",
"PLAN__", PlsqlBaseMethodType.MODIFY, PlsqlBaseMethodAction.CHECK, inParam);
//执行do的操作
Map<String, String> resultMap = IfsPlsqlUtils.execProcedureGetRecord(srv, "PROD_STRUCT_ALTERNATE_API",
"PLAN__", PlsqlBaseMethodType.MODIFY, PlsqlBaseMethodAction.DO, inParam);
//返回结果集
return resultMap;
}
/**
* @description: retire Bom Alternative
* @author LR
* @date 2024/12/11 15:55
* @version 1.0
*/
public static Map<String, String> retireBomAlternative(Server srv, BomAlternative inData) throws APException {
//公共参数
String ifsRowId = inData.getIfsRowId();//
String ifsRowVersion = inData.getIfsRowVersion();// 物料编码
//入参
Map<String, String> inParam = new HashMap<>();
//填充参数
inParam.put("OBJID", ifsRowId);
inParam.put("OBJVERSION", ifsRowVersion);
//执行check的操作
Map<String, String> checkMap = IfsPlsqlUtils.execProcedureGetRecord(srv, "PROD_STRUCT_ALTERNATE_API",
"RETIRE__", PlsqlBaseMethodType.MODIFY, PlsqlBaseMethodAction.CHECK, inParam);
//执行do的操作
Map<String, String> resultMap = IfsPlsqlUtils.execProcedureGetRecord(srv, "PROD_STRUCT_ALTERNATE_API",
"RETIRE__", PlsqlBaseMethodType.MODIFY, PlsqlBaseMethodAction.DO, inParam);
//返回结果集
return resultMap;
}
/**
* @description: 获取Bom Item
* @author LR
* @date 2024/12/11 16:12
* @version 1.0
*/
public static Map<String, String> getBomItem(Server srv, String contract, String partNo, String engChgLevel, String bomType, String alternativeNo, String lineItemNo) throws APException {
StringBuilder searchSql = new StringBuilder();
searchSql.append("SELECT OBJID ifsRowId, OBJVERSION ifsRowVersion, PART_NO, CONTRACT, ENG_CHG_LEVEL, BOM_TYPE, ALTERNATIVE_NO,");
searchSql.append(" LINE_ITEM_NO, LINE_SEQUENCE, COMPONENT_PART, QTY_PER_ASSEMBLY, ISSUE_TYPE, OPERATION_NO,");
searchSql.append(" COMPONENT_SCRAP, SHRINKAGE_FACTOR");
searchSql.append(" FROM IFSAPP.PROD_STRUCTURE");
searchSql.append(" WHERE CONTRACT = :contract AND PART_NO = :partNo AND ENG_CHG_LEVEL = :engChgLevel AND BOM_TYPE = :bomType");
searchSql.append(" AND ALTERNATIVE_NO = :alternativeNo AND LINE_ITEM_NO = :lineItemNo");
//设置查询的入参
Map<String, String> inParam = new HashMap<>();
inParam.put("contract", contract);
inParam.put("partNo", partNo);
inParam.put("engChgLevel", engChgLevel);
inParam.put("bomType", bomType);
inParam.put("alternativeNo", alternativeNo);
inParam.put("lineItemNo", lineItemNo);
//调用查询的通用方法
RecordCollection recordCollection = IfsPlsqlUtils.execSqlSearchGetRecordCollection(srv, searchSql, inParam);
//判断能否返回
if (recordCollection == null) {
return null;
} else {
Record recordData = recordCollection.get(0);
Map<String, String> resultMap = IfsConverterToMap.ConverterIfsToMap(recordData);
return resultMap;
}
}
/**
* @description: 获取Bom Items
* @author LR
* @date 2024/12/11 16:16
* @version 1.0
*/
public static List<Map<String, String>> getBomItems(Server srv, String contract, String partNo, String engChgLevel, String bomType, String alternativeNo) throws APException {
StringBuilder searchSql = new StringBuilder();
searchSql.append("SELECT OBJID ifsRowId, OBJVERSION ifsRowVersion, PART_NO, CONTRACT, ENG_CHG_LEVEL, BOM_TYPE, ALTERNATIVE_NO,");
searchSql.append(" LINE_ITEM_NO, LINE_SEQUENCE, COMPONENT_PART, QTY_PER_ASSEMBLY, ISSUE_TYPE, OPERATION_NO,");
searchSql.append(" COMPONENT_SCRAP, SHRINKAGE_FACTOR");
searchSql.append(" FROM IFSAPP.PROD_STRUCTURE");
searchSql.append(" WHERE CONTRACT = :contract AND PART_NO = :partNo AND ENG_CHG_LEVEL = :engChgLevel AND BOM_TYPE = :bomType");
searchSql.append(" AND ALTERNATIVE_NO = :alternativeNo");
//设置查询的入参
Map<String, String> inParam = new HashMap<>();
inParam.put("contract", contract);
inParam.put("partNo", partNo);
inParam.put("engChgLevel", engChgLevel);
inParam.put("bomType", bomType);
inParam.put("alternativeNo", alternativeNo);
//调用查询的通用方法
RecordCollection recordCollection = IfsPlsqlUtils.execSqlSearchGetRecordCollection(srv, searchSql, inParam);
//判断能否返回
if (recordCollection == null) {
return null;
} else {
List<Map<String, String>> resultList = IfsConverterToMap.ConverterIfsToList(recordCollection);
return resultList;
}
}
/**
* @description: 查询 Bom Item集合
* @author LR
* @date 2024/12/13 9:48
* @version 1.0
*/
public static List<BomItem> getBomItems(Server srv, String contract, String partNo, String engChgLevel, String bomType,
String alternativeNo, String lineItemNo) throws APException {
StringBuilder searchSql = new StringBuilder();
searchSql.append("SELECT OBJID ifsRowId, OBJVERSION ifsRowVersion, PART_NO, CONTRACT, ENG_CHG_LEVEL, BOM_TYPE, ALTERNATIVE_NO,");
searchSql.append(" LINE_ITEM_NO, LINE_SEQUENCE, COMPONENT_PART, QTY_PER_ASSEMBLY, ISSUE_TYPE, OPERATION_NO,");
searchSql.append(" COMPONENT_SCRAP, SHRINKAGE_FACTOR");
searchSql.append(" FROM IFSAPP.PROD_STRUCTURE");
searchSql.append(" WHERE CONTRACT = :contract AND PART_NO = :partNo AND ENG_CHG_LEVEL = :engChgLevel AND BOM_TYPE = :bomType");
searchSql.append(" AND ALTERNATIVE_NO = :alternativeNo");
//设置查询的入参
Map<String, String> inParam = new HashMap<>();
inParam.put("contract", contract);
inParam.put("partNo", partNo);
inParam.put("engChgLevel", engChgLevel);
inParam.put("bomType", bomType);
inParam.put("alternativeNo", alternativeNo);
//判断是否需要添加查询的条件
if(!(lineItemNo == null || "".equals(lineItemNo))) {
inParam.put("lineItemNo", lineItemNo);
searchSql.append(" AND LINE_ITEM_NO = :lineItemNo");
}
//调用查询的通用方法
RecordCollection recordCollection = IfsPlsqlUtils.execSqlSearchGetRecordCollection(srv, searchSql, inParam);
//判断能否返回
if (recordCollection == null) {
return null;
} else {
List<BomItem> resultItems = new ArrayList<>();
//调用通用的处理方法 返回Map
List<Map<String, String>> resultList = IfsConverterToMap.ConverterIfsToList(recordCollection);
//判断是否存在数据
if(resultList == null) {
return resultItems;
}
//获取数据转bean
for (int i = 0; i < resultList.size(); i++) {
Map<String, String> tempMap = resultList.get(i);
BomItem tempItem = new BomItem();
//设置参数
tempItem.setIfsRowId(tempMap.get("IFSROWID"));
tempItem.setIfsRowVersion(tempMap.get("IFSROWVERSION"));
tempItem.setPartNo(tempMap.get("PART_NO"));
tempItem.setContract(tempMap.get("CONTRACT"));
tempItem.setEngChgLevel(tempMap.get("ENG_CHG_LEVEL"));
tempItem.setBomType(tempMap.get("BOM_TYPE"));
tempItem.setAlternativeNo(tempMap.get("ALTERNATIVE_NO"));
tempItem.setLineItemNo(tempMap.get("LINE_ITEM_NO"));
tempItem.setLineSequence(tempMap.get("LINE_SEQUENCE"));
tempItem.setComponentPart(tempMap.get("COMPONENT_PART"));
tempItem.setQtyPerAssembly(tempMap.get("QTY_PER_ASSEMBLY"));
tempItem.setIssueType(tempMap.get("ISSUE_TYPE"));
tempItem.setOperationNo(tempMap.get("OPERATION_NO"));
tempItem.setComponentScrap(tempMap.get("COMPONENT_SCRAP"));
tempItem.setShrinkageFactor(tempMap.get("SHRINKAGE_FACTOR"));
//添加对象
resultItems.add(tempItem);
}
return resultItems;
}
}
/**
* @description: 插入Bom Item
* @author LR
* @date 2024/12/11 16:17
* @version 1.0
*/
public static Map<String, String> insertBomItem(Server srv, BomItem inData) throws APException {
//公共参数
String contract = inData.getContract();
String partNo = inData.getPartNo();// 物料编码
String engChgLevel = inData.getEngChgLevel();// 版本
String bomType = inData.getBomType();// 分类
String alternativeNo = inData.getAlternativeNo();
String operationNo = inData.getOperationNo();
String lineItemNo = inData.getLineItemNo();
String sequenceNo = inData.getLineSequence();
//判断是否存在问题
String componentPart = inData.getComponentPart();//
String qtyPerAssembly = inData.getQtyPerAssembly();
String issueType = inData.getIssueType();
String componentScrap = inData.getComponentScrap();
String shrinkageFactor = inData.getShrinkageFactor();
String noteText = inData.getNoteText();
String consumptionItem = inData.getConsumptionItem();
String createDate = DateUtils.getStringDate(new Date(), "yyyy-MM-dd")+"-00.00.00";
String lastActivityDate = DateUtils.getStringDate(new Date(), "yyyy-MM-dd")+"-00.00.00";
//入参
Map<String, String> inParam = new HashMap<>();
//填充参数
inParam.put("OBJID", "");
inParam.put("OBJVERSION", "");
inParam.put("PART_NO", partNo); // 物料编码
inParam.put("CONTRACT", contract); //
inParam.put("ENG_CHG_LEVEL", engChgLevel); // 物料的版本
inParam.put("BOM_TYPE", bomType); // BOM类型
inParam.put("ALTERNATIVE_NO", alternativeNo); // 替代编码
inParam.put("LINE_ITEM_NO", lineItemNo); // 行号
inParam.put("LINE_SEQUENCE", sequenceNo); // 序号
inParam.put("COMPONENT_PART", componentPart); // 子零件
inParam.put("QTY_PER_ASSEMBLY", qtyPerAssembly); // 单位用量
inParam.put("ISSUE_TYPE", issueType); //
inParam.put("COMPONENT_SCRAP", componentScrap); // 报废
inParam.put("SHRINKAGE_FACTOR", shrinkageFactor); // 损耗率
inParam.put("NOTE_TEXT", noteText); // 备注
inParam.put("OPERATION_NO", operationNo); // 工序
inParam.put("ISSUE_PLANNED_SCRAP_DB", "TRUE"); // 固定值
inParam.put("ISSUE_OVERREPORTED_QTY_DB", "FALSE"); // 固定值
inParam.put("CONSUMPTION_ITEM", consumptionItem); // 消耗项目
inParam.put("LEADTIME_OFFSET", "0"); // 固定值
inParam.put("PROMISE_PLANNED", "Promised"); // 固定值
inParam.put("PHANTOM_CONSUME", "Not Phantom Consume"); // 固定值
inParam.put("CHARGED_ITEM", "Item not charged"); // 固定值
inParam.put("CREATE_DATE", createDate); // 创建时间
inParam.put("LAST_ACTIVITY_DATE", lastActivityDate); // 最近更新时间
inParam.put("PURCHASE_COMP_BACKFLUSH_DB", "FALSE"); // 固定值
inParam.put("STD_PLANNED_ITEM", "1"); // 固定值
inParam.put("OPER_COST_DISTRIBUTION", "0"); // 固定值
inParam.put("GEN_OH_COST_DISTRIBUTION", "0"); // 固定值
inParam.put("EXCLUDE_FROM_AS_BUILT_DB", "FALSE"); // 固定值
inParam.put("BY_PROD_AS_SUPPLY_IN_MRP_DB", "FALSE"); // 固定值
inParam.put("STOP_BOM_EXPLOSION_DB", "FALSE"); // 固定值
inParam.put("LOT_BATCH_ORIGIN_DB", "FALSE"); // 固定值
//执行check的操作
Map<String, String> checkMap = IfsPlsqlUtils.execProcedureGetRecord(srv, "PROD_STRUCTURE_API",
"NEW__", PlsqlBaseMethodType.NEW, PlsqlBaseMethodAction.CHECK, inParam);
//执行do的操作
Map<String, String> resultMap = IfsPlsqlUtils.execProcedureGetRecord(srv, "PROD_STRUCTURE_API",
"NEW__", PlsqlBaseMethodType.NEW, PlsqlBaseMethodAction.DO, inParam);
//返回结果集
return resultMap;
}
/**
* @description: 修改 Bom Item
* @author LR
* @date 2024/12/11 16:22
* @version 1.0
*/
public static Map<String, String> modifyBomItem(Server srv, BomItem inData) throws APException {
//公共参数
String ifsRowId = inData.getIfsRowId();//
String ifsRowVersion = inData.getIfsRowVersion();//
String sequenceNo = inData.getLineSequence();
String operationNo = inData.getOperationNo();
//判断是否存在问题
String componentPart = inData.getComponentPart();//
String qtyPerAssembly = inData.getQtyPerAssembly();
String issueType = inData.getIssueType();
String componentScrap = inData.getComponentScrap();
String shrinkageFactor = inData.getShrinkageFactor();
String noteText = inData.getNoteText();
String consumptionItem = inData.getConsumptionItem();
String createDate = DateUtils.getStringDate(new Date(), "yyyy-MM-dd")+"-00.00.00";
String lastActivityDate = DateUtils.getStringDate(new Date(), "yyyy-MM-dd")+"-00.00.00";
//入参
Map<String, String> inParam = new HashMap<>();
//填充参数
inParam.put("OBJID", ifsRowId);
inParam.put("OBJVERSION", ifsRowVersion);
inParam.put("LINE_SEQUENCE", sequenceNo); // 序号
inParam.put("COMPONENT_PART", componentPart); // 子零件
inParam.put("QTY_PER_ASSEMBLY", qtyPerAssembly); // 单位用量
inParam.put("ISSUE_TYPE", issueType); //
inParam.put("COMPONENT_SCRAP", componentScrap); // 报废
inParam.put("SHRINKAGE_FACTOR", shrinkageFactor); // 损耗率
inParam.put("NOTE_TEXT", noteText); // 备注
inParam.put("CONSUMPTION_ITEM", consumptionItem); // 消耗项目
inParam.put("CREATE_DATE", createDate); // 创建时间
inParam.put("OPERATION_NO", operationNo); // 工序
inParam.put("LAST_ACTIVITY_DATE", lastActivityDate); // 最近更新时间
//执行check的操作
Map<String, String> checkMap = IfsPlsqlUtils.execProcedureGetRecord(srv, "PROD_STRUCTURE_API",
"MODIFY__", PlsqlBaseMethodType.MODIFY, PlsqlBaseMethodAction.CHECK, inParam);
//执行do的操作
Map<String, String> resultMap = IfsPlsqlUtils.execProcedureGetRecord(srv, "PROD_STRUCTURE_API",
"MODIFY__", PlsqlBaseMethodType.MODIFY, PlsqlBaseMethodAction.DO, inParam);
//返回结果集
return resultMap;
}
/**
* @description: 删除 Bom Item
* @author LR
* @date 2024/12/11 16:24
* @version 1.0
*/
public static void removeBomItem(Server srv, BomItem inData) throws APException {
//公共参数
//公共参数
String ifsRowId = inData.getIfsRowId();//
String ifsRowVersion = inData.getIfsRowVersion();//
//入参
Map<String, String> inParam = new HashMap<>();
//填充参数
inParam.put("OBJID", ifsRowId);
inParam.put("OBJVERSION", ifsRowVersion);
//执行check的操作
Map<String, String> checkMap = IfsPlsqlUtils.execProcedureGetRecord(srv, "PROD_STRUCTURE_API",
"REMOVE__", PlsqlBaseMethodType.REMOVE, PlsqlBaseMethodAction.CHECK, inParam);
//执行do的操作
Map<String, String> resultMap = IfsPlsqlUtils.execProcedureGetRecord(srv, "PROD_STRUCTURE_API",
"REMOVE__", PlsqlBaseMethodType.REMOVE, PlsqlBaseMethodAction.DO, inParam);
}
/**
* @description: 查询副产品的信息
* @author LR
* @date 2024/12/11 16:27
* @version 1.0
*/
public static Map<String, String> getBomDistribution(Server srv, String contract, String partNo, String engChgLevel, String bomType, String alternativeNo,
String componentLineItemNo, String byProdLineItemNo) throws APException {
StringBuilder searchSql = new StringBuilder();
searchSql.append("SELECT OBJID ifsRowId, OBJVERSION ifsRowVersion, CONTRACT contract, PART_NO partNo, ENG_CHG_LEVEL engChgLevel,");
searchSql.append(" BOM_TYPE bomType, ALTERNATIVE_NO alternativeNo, BYPROD_LINE_ITEM_NO byProdLineItemNo,");
searchSql.append(" IFSAPP.MANUF_STRUCTURE_API.Get_Component_Part(contract,part_no,eng_chg_level,bom_type,alternative_no,BYPROD_LINE_ITEM_NO) byProductPartNo,");
searchSql.append(" COMPONENT_LINE_ITEM_NO componentLineItemNo,");
searchSql.append(" IFSAPP.MANUF_STRUCTURE_API.Get_Component_Part(contract,part_no,eng_chg_level,bom_type,alternative_no,COMPONENT_LINE_ITEM_NO) componentPart,");
searchSql.append(" ITEM_COST_DISTRIBUTION itemCostDistribution");
searchSql.append(" FROM IFSAPP.MANUF_STRUCT_COST_DISTRIB");
searchSql.append(" WHERE CONTRACT = :contract AND PART_NO = :partNo AND ENG_CHG_LEVEL = :engChgLevel AND BOM_TYPE = :bomType AND ALTERNATIVE_NO = :alternativeNo");
searchSql.append(" AND COMPONENT_LINE_ITEM_NO = :componentLineItemNo AND BYPROD_LINE_ITEM_NO = :byProdLineItemNo");
//设置查询的入参
Map<String, String> inParam = new HashMap<>();
inParam.put("contract", contract);
inParam.put("partNo", partNo);
inParam.put("engChgLevel", engChgLevel);
inParam.put("bomType", bomType);
inParam.put("alternativeNo", alternativeNo);
inParam.put("componentLineItemNo", componentLineItemNo);
inParam.put("byProdLineItemNo", byProdLineItemNo);
//调用查询的通用方法
RecordCollection recordCollection = IfsPlsqlUtils.execSqlSearchGetRecordCollection(srv, searchSql, inParam);
//判断能否返回
if (recordCollection == null) {
return null;
} else {
Record record = recordCollection.get(0);
Map<String, String> resultMap = IfsConverterToMap.ConverterIfsToMap(record);
return resultMap;
}
}
/**
* @description: 查询Bom 副产品的所有信息
* @author LR
* @date 2024/12/11 16:30
* @version 1.0
*/
public static List<Map<String, String>> getBomDistributions(Server srv, String contract, String partNo, String engChgLevel, String bomType, String alternativeNo) throws APException {
StringBuilder searchSql = new StringBuilder();
searchSql.append("SELECT OBJID ifsRowId, OBJVERSION ifsRowVersion, CONTRACT contract, PART_NO partNo, ENG_CHG_LEVEL engChgLevel,");
searchSql.append(" BOM_TYPE bomType, ALTERNATIVE_NO alternativeNo, BYPROD_LINE_ITEM_NO byProdLineItemNo,");
searchSql.append(" IFSAPP.MANUF_STRUCTURE_API.Get_Component_Part(contract,part_no,eng_chg_level,bom_type,alternative_no,BYPROD_LINE_ITEM_NO) byProductPartNo,");
searchSql.append(" COMPONENT_LINE_ITEM_NO componentLineItemNo,");
searchSql.append(" IFSAPP.MANUF_STRUCTURE_API.Get_Component_Part(contract,part_no,eng_chg_level,bom_type,alternative_no,COMPONENT_LINE_ITEM_NO) componentPart,");
searchSql.append(" ITEM_COST_DISTRIBUTION itemCostDistribution");
searchSql.append(" FROM IFSAPP.MANUF_STRUCT_COST_DISTRIB");
searchSql.append(" WHERE CONTRACT = :contract AND PART_NO = :partNo AND ENG_CHG_LEVEL = :engChgLevel AND BOM_TYPE = :bomType AND ALTERNATIVE_NO = :alternativeNo");
//设置查询的入参
Map<String, String> inParam = new HashMap<>();
inParam.put("contract", contract);
inParam.put("partNo", partNo);
inParam.put("engChgLevel", engChgLevel);
inParam.put("bomType", bomType);
inParam.put("alternativeNo", alternativeNo);
//调用查询的通用方法
RecordCollection recordCollection = IfsPlsqlUtils.execSqlSearchGetRecordCollection(srv, searchSql, inParam);
//判断能否返回
if (recordCollection == null) {
return null;
} else {
List<Map<String, String>> resultList = IfsConverterToMap.ConverterIfsToList(recordCollection);
return resultList;
}
}
/**
* @description: 修改 Bom的副产品信息
* @author LR
* @date 2024/12/11 16:47
* @version 1.0
*/
public static Map<String, String> modifyBomDistribution(Server srv, BomDistribution inData) throws APException {
//公共参数
String ifsRowId = inData.getIfsRowId();//
String ifsRowVersion = inData.getIfsRowVersion();//
String itemCostDistribution = inData.getItemCostDistribution();
//入参
Map<String, String> inParam = new HashMap<>();
//填充参数
inParam.put("OBJID", ifsRowId);
inParam.put("OBJVERSION", ifsRowVersion);
inParam.put("ITEM_COST_DISTRIBUTION", itemCostDistribution); // 序号
//执行check的操作
Map<String, String> checkMap = IfsPlsqlUtils.execProcedureGetRecord(srv, "MANUF_STRUCT_COST_DISTRIB_API",
"MODIFY__", PlsqlBaseMethodType.MODIFY, PlsqlBaseMethodAction.CHECK, inParam);
//执行do的操作
Map<String, String> resultMap = IfsPlsqlUtils.execProcedureGetRecord(srv, "MANUF_STRUCT_COST_DISTRIB_API",
"MODIFY__", PlsqlBaseMethodType.MODIFY, PlsqlBaseMethodAction.DO, inParam);
//返回结果集
return resultMap;
}
}

1061
src/main/java/com/spring/ifs/api/InventoryPartApiTest.java
File diff suppressed because it is too large
View File

200
src/main/java/com/spring/ifs/api/MasterPartApiTest.java

@ -0,0 +1,200 @@
package com.spring.ifs.api;
import com.spring.ifs.data.PartCatalog;
import com.spring.ifs.utils.IfsConverterToMap;
import com.spring.ifs.utils.IfsPlsqlUtils;
import ifs.fnd.ap.*;
import java.util.HashMap;
import java.util.Map;
/**
* @description: 处理Master业务的底层相关函数
* @author LR
* @date 2024/12/9 10:56
* @version 1.0
*/
public class MasterPartApiTest {
/**
* @description: 获取Master part的相关信息
* @author LR
* @date 2024/12/9 11:13
* @version 1.0
*/
public static Map<String, String> getMasterPart(Server srv, String partNo) throws APException {
StringBuilder searchSql = new StringBuilder();
searchSql.append("SELECT PART_NO, DESCRIPTION partDesc, objid ifsRowId, objversion ifsRowVersion");
searchSql.append(" FROM IFSAPP.PART_CATALOG");
searchSql.append(" WHERE PART_NO = :partNo");
//设置查询的入参
Map<String, String> inParam = new HashMap<>();
inParam.put("partNo", partNo);
//调用查询的通用方法
Record resultRecord = IfsPlsqlUtils.execSqlSearchGetRecord(srv, searchSql, inParam);
//判断能否返回
if (resultRecord == null) {
return null;
} else {
//调用通用的处理方法 返回Map
Map<String, String> resultMap = IfsConverterToMap.ConverterIfsToMap(resultRecord);
return resultMap;
}
}
/**
* @description: 执行库存件的新增操作
* @author LR
* @date 2024/12/10 17:59
* @version 1.0
*/
public static Map<String, String> insertMasterPart(Server srv, PartCatalog inData) throws APException {
//公共参数
String partNo = inData.getPartNo().toUpperCase();
String partDesc = inData.getPartDesc();
String unitCode = inData.getUnitCode();
String partMainGroup = inData.getPartMainGroup();
String weightNet = inData.getWeightNet();
String uomForWeightNet = inData.getUomForWeightNet();
String volumeNet = inData.getVolumeNet();
String uomForVolumeNet = inData.getUomForVolumeNet();
String conditionCodeUsageDb = inData.getConditionCodeUsageDb();
String multilevelTrackingDb = inData.getMultilevelTrackingDb();
String allowAsNotConsumedDb = inData.getAllowAsNotConsumedDb();
String lotTrackingCode = inData.getLotTrackingCode();
String lotQuantityRule = inData.getLotQuantityRule();
String subLotRule = inData.getSubLotRule();
String componentLotRule = inData.getComponentLotRule();
String infoText = inData.getInfoText();
//入参
Map<String, String> inParam = new HashMap<>();
//填充参数
inParam.put("PART_NO", partNo);
inParam.put("DESCRIPTION", partDesc);
inParam.put("UNIT_CODE", unitCode);
inParam.put("STD_NAME_ID", "0");
inParam.put("PART_MAIN_GROUP", partMainGroup);
inParam.put("WEIGHT_NET", weightNet);
inParam.put("UOM_FOR_WEIGHT_NET", uomForWeightNet);
inParam.put("VOLUME_NET", volumeNet);
inParam.put("UOM_FOR_VOLUME_NET", uomForVolumeNet);
inParam.put("FREIGHT_FACTOR", "1");
inParam.put("POSITION_PART_DB", "NOT POSITION PART");
inParam.put("CONDITION_CODE_USAGE_DB", conditionCodeUsageDb);
inParam.put("CONFIGURABLE_DB", "NOT CONFIGURED");
inParam.put("CATCH_UNIT_ENABLED_DB", "FALSE");
inParam.put("MULTILEVEL_TRACKING_DB", multilevelTrackingDb);
inParam.put("ALLOW_AS_NOT_CONSUMED_DB", allowAsNotConsumedDb);
inParam.put("RECEIPT_ISSUE_SERIAL_TRACK_DB", "FALSE");
inParam.put("SERIAL_TRACKING_CODE_DB", "NOT SERIAL TRACKING");
inParam.put("ENG_SERIAL_TRACKING_CODE_DB", "NOT SERIAL TRACKING");
inParam.put("STOP_ARRIVAL_ISSUED_SERIAL_DB", "FALSE");
inParam.put("STOP_NEW_SERIAL_IN_RMA_DB", "TRUE");
inParam.put("SERIAL_RULE", "Manual");
inParam.put("LOT_TRACKING_CODE", lotTrackingCode);
inParam.put("LOT_QUANTITY_RULE", lotQuantityRule);
inParam.put("SUB_LOT_RULE", subLotRule);
inParam.put("COMPONENT_LOT_RULE", componentLotRule);
inParam.put("INFO_TEXT", infoText);
inParam.put("OBJID", "");
inParam.put("OBJVERSION", "");
//执行存储过程 获取结果集
//执行check的操作
Map<String, String> checkMap = IfsPlsqlUtils.execProcedureGetRecord(srv, "PART_CATALOG_API",
"NEW__", PlsqlBaseMethodType.NEW, PlsqlBaseMethodAction.CHECK, inParam);
//执行do的操作
Map<String, String> resultMap = IfsPlsqlUtils.execProcedureGetRecord(srv, "PART_CATALOG_API",
"NEW__", PlsqlBaseMethodType.NEW, PlsqlBaseMethodAction.DO, inParam);
//返回结果集
return resultMap;
}
/**
* @description: 修改物料件的数据
* @author LR
* @date 2024/12/11 9:24
* @version 1.0
*/
public static Map<String, String> modifyMasterPart(Server srv, PartCatalog inData) throws APException {
//公共参数
String ifsRowId = inData.getIfsRowId();
String ifsRowVersion = inData.getIfsRowVersion();
String partDesc = inData.getPartDesc();
String unitCode = inData.getUnitCode();
String partMainGroup = inData.getPartMainGroup();
String weightNet = inData.getWeightNet();
String uomForWeightNet = inData.getUomForWeightNet();
String volumeNet = inData.getVolumeNet();
String uomForVolumeNet = inData.getUomForVolumeNet();
String conditionCodeUsageDb = inData.getConditionCodeUsageDb();
String multilevelTrackingDb = inData.getMultilevelTrackingDb();
String allowAsNotConsumedDb = inData.getAllowAsNotConsumedDb();
String lotTrackingCode = inData.getLotTrackingCode();
String lotQuantityRule = inData.getLotQuantityRule();
String subLotRule = inData.getSubLotRule();
String componentLotRule = inData.getComponentLotRule();
String infoText = inData.getInfoText();
//入参
Map<String, String> inParam = new HashMap<>();
//填充参数
inParam.put("OBJID", ifsRowId);
inParam.put("OBJVERSION", ifsRowVersion);
inParam.put("DESCRIPTION", partDesc); // 物料描述
inParam.put("UNIT_CODE", unitCode); // 单位
inParam.put("PART_MAIN_GROUP", partMainGroup); // PART_MAIN_GROUP
inParam.put("WEIGHT_NET", weightNet); // 净重
inParam.put("UOM_FOR_WEIGHT_NET", uomForWeightNet); // 净重单位
inParam.put("VOLUME_NET", volumeNet); // 体积
inParam.put("UOM_FOR_VOLUME_NET", uomForVolumeNet); // 体积单位
inParam.put("CONDITION_CODE_USAGE_DB", conditionCodeUsageDb); // CONDITION_CODE_USAGE_DB
inParam.put("MULTILEVEL_TRACKING_DB", multilevelTrackingDb); // MULTILEVEL_TRACKING_DB
inParam.put("ALLOW_AS_NOT_CONSUMED_DB", allowAsNotConsumedDb); // ALLOW_AS_NOT_CONSUMED_DB
inParam.put("LOT_TRACKING_CODE", lotTrackingCode); // 批次跟踪代码
inParam.put("LOT_QUANTITY_RULE", lotQuantityRule); // LOT_QUANTITY_RULE
inParam.put("SUB_LOT_RULE", subLotRule); // SUB_LOT_RULE
inParam.put("COMPONENT_LOT_RULE", componentLotRule); // COMPONENT_LOT_RULE
inParam.put("INFO_TEXT", infoText); // 备注
//执行存储过程 获取结果集
//执行check的操作
Map<String, String> checkMap = IfsPlsqlUtils.execProcedureGetRecord(srv, "PART_CATALOG_API",
"MODIFY__", PlsqlBaseMethodType.MODIFY, PlsqlBaseMethodAction.CHECK, inParam);
//执行do的操作
Map<String, String> resultMap = IfsPlsqlUtils.execProcedureGetRecord(srv, "PART_CATALOG_API",
"MODIFY__", PlsqlBaseMethodType.MODIFY, PlsqlBaseMethodAction.DO, inParam);
//返回结果集
return resultMap;
}
/**
* @description: 删除物料件
* @author LR
* @date 2024/12/11 10:01
* @version 1.0
*/
public static void removeMasterPart(Server srv, PartCatalog inData) throws APException {
//公共参数
String ifsRowId = inData.getIfsRowId();
String ifsRowVersion = inData.getIfsRowVersion();
//入参
Map<String, String> inParam = new HashMap<>();
//填充参数
inParam.put("OBJID", ifsRowId);
inParam.put("OBJVERSION", ifsRowVersion);
//执行存储过程 获取结果集
//执行check的操作
Map<String, String> checkMap = IfsPlsqlUtils.execProcedureGetRecord(srv, "PART_CATALOG_API",
"REMOVE__", PlsqlBaseMethodType.REMOVE, PlsqlBaseMethodAction.CHECK, inParam);
//执行do的操作
Map<String, String> resultMap = IfsPlsqlUtils.execProcedureGetRecord(srv, "PART_CATALOG_API",
"REMOVE__", PlsqlBaseMethodType.REMOVE, PlsqlBaseMethodAction.DO, inParam);
}
}

1062
src/main/java/com/spring/ifs/api/RoutingApiTest.java
File diff suppressed because it is too large
View File

292
src/main/java/com/spring/ifs/api/TechnicalClassApiTest.java

@ -0,0 +1,292 @@
package com.spring.ifs.api;
import com.spring.ifs.data.TechnicalAttribute;
import com.spring.ifs.data.TechnicalClass;
import com.spring.ifs.utils.IfsConverterToMap;
import com.spring.ifs.utils.IfsPlsqlUtils;
import ifs.fnd.ap.*;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @description: 处理技术等级的api
* @author LR
* @date 2024/12/9 10:56
* @version 1.0
*/
public class TechnicalClassApiTest {
/**
* @description: 查询技术等级的信息
* @author LR
* @date 2024/12/11 11:35
* @version 1.0
*/
public static Map<String, String> getTechnicalClass(Server srv, String luName, String keyRef) throws APException {
StringBuilder searchSql = new StringBuilder();
searchSql.append("SELECT OBJID ifsRowId, OBJVERSION ifsRowVersion, LU_NAME, KEY_REF, TECHNICAL_SPEC_NO, TECHNICAL_CLASS,");
searchSql.append(" OK_YES_NO, OK_SIGN, DT_OK");
searchSql.append(" FROM ifsapp.TECHNICAL_OBJECT_REFERENCE");
searchSql.append(" WHERE LU_NAME = :luName and KEY_REF = :keyRef");
//设置查询的入参
Map<String, String> inParam = new HashMap<>();
inParam.put("luName", luName);
inParam.put("keyRef", keyRef);
//调用查询的通用方法
RecordCollection recordCollection = IfsPlsqlUtils.execSqlSearchGetRecordCollection(srv, searchSql, inParam);
//判断能否返回
if (recordCollection == null) {
return null;
} else {
Record recordData = recordCollection.get(0);
Map<String, String> resultMap = IfsConverterToMap.ConverterIfsToMap(recordData);
return resultMap;
}
}
/**
* @description: 新增技术等级的数据
* @author LR
* @date 2024/12/11 11:38
* @version 1.0
*/
public static Map<String, String> insertTechnicalClass(Server srv, TechnicalClass inData) throws APException {
//公共参数
String keyRef = inData.getKeyRef();
String luName = inData.getLuName();
String technicalSpecNo = inData.getTechnicalSpecNo(); //
String technicalClass = inData.getTechnicalClass(); //
String okSign = inData.getOkSign(); //
String dtOk = inData.getDtOk();
//是否存在有效值
if(dtOk == null || dtOk.equals("")) {
dtOk = "";
}else {
dtOk = dtOk+"-00.00.00";
}
//入参
Map<String, String> inParam = new HashMap<>();
//填充参数
inParam.put("OBJID", "");
inParam.put("OBJVERSION", "");
inParam.put("LU_NAME", luName); // 属性值
inParam.put("KEY_REF", keyRef); // 物料
inParam.put("TECHNICAL_SPEC_NO", technicalSpecNo); // 固定值
inParam.put("TECHNICAL_CLASS", technicalClass); // 技术等级
inParam.put("OK_YES_NO", "Not Approved"); // 是否批准
inParam.put("OK_SIGN", okSign); // 人员
inParam.put("DT_OK", dtOk); // 时间
//执行存储过程 获取结果集
//执行check的操作
Map<String, String> checkMap = IfsPlsqlUtils.execProcedureGetRecord(srv, "TECHNICAL_OBJECT_REFERENCE_API",
"NEW__", PlsqlBaseMethodType.NEW, PlsqlBaseMethodAction.CHECK, inParam);
//执行do的操作
Map<String, String> resultMap = IfsPlsqlUtils.execProcedureGetRecord(srv, "TECHNICAL_OBJECT_REFERENCE_API",
"NEW__", PlsqlBaseMethodType.NEW, PlsqlBaseMethodAction.DO, inParam);
//返回结果集
return resultMap;
}
/**
* @description: 修改技术等级的信息
* @author LR
* @date 2024/12/11 11:42
* @version 1.0
*/
public static Map<String, String> modifyTechnicalClass(Server srv, TechnicalClass inData) throws APException {
//公共参数
String ifsRowId = inData.getIfsRowId();
String ifsRowVersion = inData.getIfsRowVersion();
//入参
Map<String, String> inParam = new HashMap<>();
//填充参数
inParam.put("OBJID", ifsRowId);
inParam.put("OBJVERSION", ifsRowVersion);
//执行存储过程 获取结果集
//执行check的操作
Map<String, String> checkMap = IfsPlsqlUtils.execProcedureGetRecord(srv, "INVENTORY_PART_API",
"REMOVE__", PlsqlBaseMethodType.REMOVE, PlsqlBaseMethodAction.CHECK, inParam);
//执行do的操作
Map<String, String> resultMap = IfsPlsqlUtils.execProcedureGetRecord(srv, "INVENTORY_PART_API",
"REMOVE__", PlsqlBaseMethodType.REMOVE, PlsqlBaseMethodAction.DO, inParam);
//返回结果集
return resultMap;
}
/**
* @description: 删除技术等级的信息
* @author LR
* @date 2024/12/11 11:45
* @version 1.0
*/
public static void removeTechnicalClass(Server srv, TechnicalClass inData) throws APException {
//公共参数
String ifsRowId = inData.getIfsRowId();
String ifsRowVersion = inData.getIfsRowVersion();
//入参
Map<String, String> inParam = new HashMap<>();
//填充参数
inParam.put("OBJID", ifsRowId);
inParam.put("OBJVERSION", ifsRowVersion);
//执行存储过程 获取结果集
//执行check的操作
Map<String, String> checkMap = IfsPlsqlUtils.execProcedureGetRecord(srv, "TECHNICAL_OBJECT_REFERENCE_API",
"REMOVE__", PlsqlBaseMethodType.REMOVE, PlsqlBaseMethodAction.CHECK, inParam);
//执行do的操作
Map<String, String> resultMap = IfsPlsqlUtils.execProcedureGetRecord(srv, "TECHNICAL_OBJECT_REFERENCE_API",
"REMOVE__", PlsqlBaseMethodType.REMOVE, PlsqlBaseMethodAction.DO, inParam);
}
/**
* @description: 查询技术等级的属性
* @author LR
* @date 2024/12/11 13:23
* @version 1.0
*/
public static Map<String, String> getTechnicalAttribute(Server srv, String technicalSpecNo, String technicalClass, String attribute) throws APException {
StringBuilder searchSql = new StringBuilder();
searchSql.append("SELECT OBJID ifsRowId, OBJVERSION ifsRowVersion, TECHNICAL_SPEC_NO, TECHNICAL_CLASS, ATTRIB_NUMBER, ATTRIBUTE,");
searchSql.append(" VALUE_NO, LOWER_LIMIT, UPPER_LIMIT, INFO, ALT_VALUE_NO, ALT_UNIT,");
searchSql.append(" CASE WHEN objtype = 'TechnicalSpecNumeric' THEN 'Numeric'");
searchSql.append(" WHEN objtype = 'TechnicalSpecAlphanum' THEN 'Alpha' ELSE '' END attributeType");
searchSql.append(" FROM ifsapp.TECHNICAL_SPECIFICATION_BOTH");
searchSql.append(" WHERE TECHNICAL_SPEC_NO = :technicalSpecNo AND TECHNICAL_CLASS = :technicalClass AND ATTRIBUTE = :attribute");
//设置查询的入参
Map<String, String> inParam = new HashMap<>();
inParam.put("technicalSpecNo", technicalSpecNo);
inParam.put("technicalClass", technicalClass);
inParam.put("attribute", attribute);
//调用查询的通用方法
RecordCollection recordCollection = IfsPlsqlUtils.execSqlSearchGetRecordCollection(srv, searchSql, inParam);
//判断能否返回
if (recordCollection == null) {
return null;
} else {
Record recordData = recordCollection.get(0);
Map<String, String> resultMap = IfsConverterToMap.ConverterIfsToMap(recordData);
return resultMap;
}
}
/**
* @description: 查询技术等级的属性集合
* @author LR
* @date 2024/12/11 13:26
* @version 1.0
*/
public static List<Map<String, String>> getTechnicalAttributes(Server srv, String technicalSpecNo, String technicalClass) throws APException {
StringBuilder searchSql = new StringBuilder();
searchSql.append("SELECT OBJID ifsRowId, OBJVERSION ifsRowVersion, TECHNICAL_SPEC_NO, TECHNICAL_CLASS, ATTRIB_NUMBER, ATTRIBUTE,");
searchSql.append(" VALUE_NO, LOWER_LIMIT, UPPER_LIMIT, INFO, ALT_VALUE_NO, ALT_UNIT,");
searchSql.append(" CASE WHEN objtype = 'TechnicalSpecNumeric' THEN 'Numeric'");
searchSql.append(" WHEN objtype = 'TechnicalSpecAlphanum' THEN 'Alpha' ELSE '' END attributeType");
searchSql.append(" FROM ifsapp.TECHNICAL_SPECIFICATION_BOTH");
searchSql.append(" WHERE TECHNICAL_SPEC_NO = :technicalSpecNo AND TECHNICAL_CLASS = :technicalClass");
//设置查询的入参
Map<String, String> inParam = new HashMap<>();
inParam.put("technicalSpecNo", technicalSpecNo);
inParam.put("technicalClass", technicalClass);
//调用查询的通用方法
RecordCollection recordCollection = IfsPlsqlUtils.execSqlSearchGetRecordCollection(srv, searchSql, inParam);
//判断能否返回
if (recordCollection == null) {
return null;
} else {
//处理结果集
List<Map<String, String>> resultList = IfsConverterToMap.ConverterIfsToList(recordCollection);
return resultList;
}
}
/**
* @description: 插入技术等级的属性
* @author LR
* @date 2024/12/11 13:55
* @version 1.0
*/
public static Map<String, String> modifyTechnicalAttribute(Server srv, TechnicalAttribute inData) throws APException {
//公共参数
String ifsRowId = inData.getIfsRowId();
String ifsRowVersion = inData.getIfsRowVersion();
String valueNo = inData.getValueNo();
String lowerLimit = inData.getLowerLimit();
String upperLimit = inData.getUpperLimit();
String valueText = inData.getValueText();
String attributeType = inData.getAttributeType();
String info = inData.getInfo();
String packageName = "";
//入参
Map<String, String> inParam = new HashMap<>();
//填充参数
inParam.put("OBJID", ifsRowId);
inParam.put("OBJVERSION", ifsRowVersion);
if(!(null == info || "".equals(info))) {
inParam.put("INFO", info);
}
//区分修改的是字符串 还是数字
if("Numeric".equalsIgnoreCase(attributeType)) {
packageName = "TECHNICAL_SPEC_NUMERIC_API";
inParam.put("VALUE_NO", valueNo); // 属性值
//判断上下限
if(!(null == lowerLimit || "".equals(lowerLimit))) {
inParam.put("LOWER_LIMIT", lowerLimit); // 下限
}
if(!(null == upperLimit || "".equals(upperLimit))) {
inParam.put("UPPER_LIMIT", upperLimit); // 上限
}
}else if("Alpha".equalsIgnoreCase(attributeType)) {
packageName = "TECHNICAL_SPEC_ALPHANUM_API";
inParam.put("VALUE_TEXT", valueText); // 属性值
}
//执行check的操作
Map<String, String> checkMap = IfsPlsqlUtils.execProcedureGetRecord(srv, packageName,
"MODIFY__", PlsqlBaseMethodType.MODIFY, PlsqlBaseMethodAction.CHECK, inParam);
//执行do的操作
Map<String, String> resultMap = IfsPlsqlUtils.execProcedureGetRecord(srv, packageName,
"MODIFY__", PlsqlBaseMethodType.MODIFY, PlsqlBaseMethodAction.DO, inParam);
//返回结果集
return resultMap;
}
/**
* @description: 删除属性的书
* @author LR
* @date 2024/12/11 14:04
* @version 1.0
*/
public static void removeTechnicalAttribute(Server srv, TechnicalAttribute inData) throws APException {
//公共参数
String ifsRowId = inData.getIfsRowId();
String ifsRowVersion = inData.getIfsRowVersion();
String attributeType = inData.getAttributeType();
String packageName = "";
//入参
Map<String, String> inParam = new HashMap<>();
//填充参数
inParam.put("OBJID", ifsRowId);
inParam.put("OBJVERSION", ifsRowVersion);
//区分修改的是字符串 还是数字
if("Numeric".equalsIgnoreCase(attributeType)) {
packageName = "TECHNICAL_SPEC_NUMERIC_API";
}else if("Alpha".equalsIgnoreCase(attributeType)) {
packageName = "TECHNICAL_SPEC_ALPHANUM_API";
}
//执行check的操作
Map<String, String> checkMap = IfsPlsqlUtils.execProcedureGetRecord(srv, packageName,
"REMOVE__", PlsqlBaseMethodType.REMOVE, PlsqlBaseMethodAction.CHECK, inParam);
//执行do的操作
Map<String, String> resultMap = IfsPlsqlUtils.execProcedureGetRecord(srv, packageName,
"REMOVE__", PlsqlBaseMethodType.REMOVE, PlsqlBaseMethodAction.DO, inParam);
}
}

504
src/main/java/com/spring/ifs/api/ToolApiTest.java

@ -0,0 +1,504 @@
package com.spring.ifs.api;
import com.spring.ifs.data.ToolHeader;
import com.spring.ifs.data.ToolInstance;
import com.spring.ifs.data.ToolInstanceDate;
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: Tool的api
* @author LR
* @date 2024/12/9 10:56
* @version 1.0
*/
public class ToolApiTest {
/**
* @description: 查询Tool Header
* @author LR
* @date 2024/12/11 14:45
* @version 1.0
*/
public static Map<String, String> getToolHeader(Server srv, String contract, String toolId) throws APException {
StringBuilder searchSql = new StringBuilder();
searchSql.append("SELECT OBJID ifsRowId, OBJVERSION ifsRowVersion,");
searchSql.append(" CONTRACT, TOOL_ID, TOOL_DESCRIPTION, NOTE_TEXT");
searchSql.append(" FROM IFSAPP.MANUF_TOOL");
searchSql.append(" WHERE CONTRACT = :contract AND TOOL_ID = :toolId");
//设置查询的入参
Map<String, String> inParam = new HashMap<>();
//查询条件
inParam.put("contract", contract);
inParam.put("toolId", toolId);
//调用查询的通用方法
RecordCollection recordCollection = IfsPlsqlUtils.execSqlSearchGetRecordCollection(srv, searchSql, inParam);
//判断能否返回
if (recordCollection == null) {
return null;
} else {
Record recordData = recordCollection.get(0);
Map<String, String> resultMap = IfsConverterToMap.ConverterIfsToMap(recordData);
return resultMap;
}
}
/**
* @description: 插入Tool Header的主表
* @author LR
* @date 2024/12/11 15:08
* @version 1.0
*/
public static Map<String, String> insertToolHeader(Server srv, ToolHeader inData) throws APException {
//公共参数
String contract = inData.getContract();//
String toolId = inData.getToolId();// 物料编码
String toolDesc = inData.getToolDesc();//
String toolType = inData.getToolType();// 分类
String calendarId = inData.getCalendarId();//
String schedCapacity = inData.getSchedCapacity();//
String alternateToolId = inData.getAlternateToolId();//
String calibrationControl = inData.getCalibrationControl();//
String calibrationTime = inData.getCalibrationTime();//
String enabledForControlPlanDb = inData.getEnabledForControlPlanDb();//
//入参
Map<String, String> inParam = new HashMap<>();
//填充参数
inParam.put("OBJID", "");
inParam.put("OBJVERSION", "");
inParam.put("CONTRACT", contract); // 基础合同或协议编号
inParam.put("TOOL_ID", toolId); // 工具编码
inParam.put("TOOL_DESCRIPTION", toolDesc); // 工具描述
inParam.put("TOOL_TYPE", toolType); // 工具的分类
inParam.put("CALENDAR_ID", calendarId); // 日历ID可能用于调度
inParam.put("SCHED_CAPACITY", schedCapacity); // 调度容量
inParam.put("ALTERNATE_TOOL_ID", alternateToolId); // 替代工具ID
inParam.put("CALIBRATION_CONTROL", calibrationControl); // 校准控制标志
inParam.put("CALIBRATION_TIME", calibrationTime); // 校准时间
inParam.put("ENABLED_FOR_CONTROL_PLAN_DB", enabledForControlPlanDb); // 是否启用控制计划数据库
//执行存储过程 获取结果集
//执行check的操作
Map<String, String> checkMap = IfsPlsqlUtils.execProcedureGetRecord(srv, "MANUF_TOOL_API",
"NEW__", PlsqlBaseMethodType.NEW, PlsqlBaseMethodAction.CHECK, inParam);
//执行do的操作
Map<String, String> resultMap = IfsPlsqlUtils.execProcedureGetRecord(srv, "MANUF_TOOL_API",
"NEW__", PlsqlBaseMethodType.NEW, PlsqlBaseMethodAction.DO, inParam);
//返回结果集
return resultMap;
}
/**
* @description: 修改Tool Header的主表信息
* @author LR
* @date 2024/12/11 15:32
* @version 1.0
*/
public static Map<String, String> modifyToolHeader(Server srv, ToolHeader inData) throws APException {
//公共参数
String ifsRowId = inData.getIfsRowId();//
String ifsRowVersion = inData.getIfsRowVersion();// 物料编码
String toolDesc = inData.getToolDesc();//
String toolType = inData.getToolType();// 分类
String calendarId = inData.getCalendarId();//
String schedCapacity = inData.getSchedCapacity();//
String alternateToolId = inData.getAlternateToolId();//
String calibrationControl = inData.getCalibrationControl();//
String calibrationTime = inData.getCalibrationTime();//
String enabledForControlPlanDb = inData.getEnabledForControlPlanDb();//
String noteText = inData.getNoteText();// 备注
//入参
Map<String, String> inParam = new HashMap<>();
//填充参数
inParam.put("OBJID", ifsRowId);
inParam.put("OBJVERSION", ifsRowVersion);
inParam.put("TOOL_DESCRIPTION", toolDesc); // 工具描述
inParam.put("TOOL_TYPE", toolType); // 工具的分类
inParam.put("CALENDAR_ID", calendarId); // 日历ID可能用于调度
inParam.put("SCHED_CAPACITY", schedCapacity); // 调度容量
inParam.put("ALTERNATE_TOOL_ID", alternateToolId); // 替代工具ID
inParam.put("CALIBRATION_CONTROL", calibrationControl); // 校准控制标志
inParam.put("CALIBRATION_TIME", calibrationTime); // 校准时间
inParam.put("ENABLED_FOR_CONTROL_PLAN_DB", enabledForControlPlanDb); // 是否启用控制计划数据库
inParam.put("NOTE_TEXT", noteText); // 备注文本
//执行check的操作
Map<String, String> checkMap = IfsPlsqlUtils.execProcedureGetRecord(srv, "MANUF_TOOL_API",
"MODIFY__", PlsqlBaseMethodType.MODIFY, PlsqlBaseMethodAction.CHECK, inParam);
//执行do的操作
Map<String, String> resultMap = IfsPlsqlUtils.execProcedureGetRecord(srv, "MANUF_TOOL_API",
"MODIFY__", PlsqlBaseMethodType.MODIFY, PlsqlBaseMethodAction.DO, inParam);
//返回结果集
return resultMap;
}
/**
* @description: 删除Tool Header
* @author LR
* @date 2024/12/11 15:33
* @version 1.0
*/
public static Map<String, String> removeToolHeader(Server srv, ToolHeader inData) throws APException {
//公共参数
String ifsRowId = inData.getIfsRowId();
String ifsRowVersion = inData.getIfsRowVersion();
//入参
Map<String, String> inParam = new HashMap<>();
//填充参数
inParam.put("OBJID", ifsRowId);
inParam.put("OBJVERSION", ifsRowVersion);
//执行check的操作
Map<String, String> checkMap = IfsPlsqlUtils.execProcedureGetRecord(srv, "MANUF_TOOL_API",
"REMOVE__", PlsqlBaseMethodType.REMOVE, PlsqlBaseMethodAction.CHECK, inParam);
//执行do的操作
Map<String, String> resultMap = IfsPlsqlUtils.execProcedureGetRecord(srv, "MANUF_TOOL_API",
"REMOVE__", PlsqlBaseMethodType.REMOVE, PlsqlBaseMethodAction.DO, inParam);
//返回结果集
return resultMap;
}
/**
* @description: 查询工具实例
* @author LR
* @date 2024/12/11 14:48
* @version 1.0
*/
public static Map<String, String> getToolInstance(Server srv, String contract, String toolId, String toolInstance) throws APException {
StringBuilder searchSql = new StringBuilder();
searchSql.append("SELECT OBJID ifsRowId, OBJVERSION ifsRowVersion,");
searchSql.append(" CONTRACT, TOOL_ID, TOOL_INSTANCE, NOTE_TEXT");
searchSql.append(" FROM IFSAPP.MANUF_TOOL_DETAIL");
searchSql.append(" WHERE CONTRACT = :contract AND TOOL_ID = :toolId AND TOOL_INSTANCE = :toolInstance");
//设置查询的入参
Map<String, String> inParam = new HashMap<>();
inParam.put("contract", contract);
inParam.put("toolId", toolId);
inParam.put("toolInstance", toolInstance);
//调用查询的通用方法
RecordCollection recordCollection = IfsPlsqlUtils.execSqlSearchGetRecordCollection(srv, searchSql, inParam);
//判断能否返回
if (recordCollection == null) {
return null;
} else {
Record recordData = recordCollection.get(0);
Map<String, String> resultMap = IfsConverterToMap.ConverterIfsToMap(recordData);
return resultMap;
}
}
/**
* @description: 插入Tool Instance
* @author LR
* @date 2024/12/11 15:45
* @version 1.0
*/
public static Map<String, String> insertToolInstance(Server srv, ToolInstance inData) throws APException {
//公共参数
String contract = inData.getContract();//
String toolId = inData.getToolId();// 物料编码
String toolInstance = inData.getToolInstance();//
String desc = inData.getDesc();// 分类
String lastCalibrationDate = inData.getLastCalibrationDate();//
//判断空值
if(lastCalibrationDate == null || lastCalibrationDate.equals("")) {
lastCalibrationDate = "";
}else {
lastCalibrationDate = lastCalibrationDate+"-00.00.00";
}
String normalWorkCenterNo = inData.getNormalWorkCenterNo();//
String normalProductionLine = inData.getNormalProductionLine();//
String noteText = inData.getNoteText();// 备注
String toolDiscrimination = inData.getToolDiscrimination();//
String toolLinearity = inData.getToolLinearity();//
String toolRepeatability = inData.getToolRepeatability();//
String toolBias = inData.getToolBias();//
String toolStability = inData.getToolStability();//
String toolReproducibility = inData.getToolReproducibility();//
//入参
Map<String, String> inParam = new HashMap<>();
//填充参数
inParam.put("OBJID", "");
inParam.put("OBJVERSION", "");
inParam.put("CONTRACT", contract); //
inParam.put("TOOL_ID", toolId); // 工具编码
inParam.put("TOOL_INSTANCE", toolInstance); // 工具实例
inParam.put("DESCRIPTION", desc); // 工具描述
inParam.put("NOTE_TEXT", noteText); // 备注文本
inParam.put("NORMAL_WORK_CENTER_NO", normalWorkCenterNo); // 标准工作中心编号
inParam.put("LAST_CALIBRATION_DATE", lastCalibrationDate); // 最后校准日期
inParam.put("NORMAL_PRODUCTION_LINE", normalProductionLine); // 标准生产线
inParam.put("TOOL_DISCRIMINATION", toolDiscrimination); // 工具区分度
inParam.put("TOOL_LINEARITY", toolLinearity); // 工具线性度
inParam.put("TOOL_REPEATABILITY", toolRepeatability); // 工具重复性
inParam.put("TOOL_BIAS", toolBias); // 工具偏差
inParam.put("TOOL_STABILITY", toolStability); // 工具稳定性
inParam.put("TOOL_REPRODUCIBILITY", toolReproducibility); // 工具再现性
//执行check的操作
Map<String, String> checkMap = IfsPlsqlUtils.execProcedureGetRecord(srv, "MANUF_TOOL_DETAIL_API",
"NEW__", PlsqlBaseMethodType.NEW, PlsqlBaseMethodAction.CHECK, inParam);
//执行do的操作
Map<String, String> resultMap = IfsPlsqlUtils.execProcedureGetRecord(srv, "MANUF_TOOL_DETAIL_API",
"NEW__", PlsqlBaseMethodType.NEW, PlsqlBaseMethodAction.DO, inParam);
//返回结果集
return resultMap;
}
/**
* @description: 修改Tool Instance
* @author LR
* @date 2024/12/11 15:47
* @version 1.0
*/
public static Map<String, String> modifyToolInstance(Server srv, ToolInstance inData) throws APException {
//公共参数
String ifsRowId = inData.getIfsRowId();//
String ifsRowVersion = inData.getIfsRowVersion();// 物料编码
String desc = inData.getDesc();// 分类
String lastCalibrationDate = inData.getLastCalibrationDate();//
//判断空值
if(lastCalibrationDate == null || lastCalibrationDate.equals("")) {
lastCalibrationDate = "";
}else {
lastCalibrationDate = lastCalibrationDate+"-00.00.00";
}
String normalWorkCenterNo = inData.getNormalWorkCenterNo();//
String normalProductionLine = inData.getNormalProductionLine();//
String noteText = inData.getNoteText();// 备注
String toolDiscrimination = inData.getToolDiscrimination();//
String toolLinearity = inData.getToolLinearity();//
String toolRepeatability = inData.getToolRepeatability();//
String toolBias = inData.getToolBias();//
String toolStability = inData.getToolStability();//
String toolReproducibility = inData.getToolReproducibility();//
//入参
Map<String, String> inParam = new HashMap<>();
//填充参数
inParam.put("OBJID", ifsRowId);
inParam.put("OBJVERSION", ifsRowVersion);
inParam.put("DESCRIPTION", desc); // 工具的描述
inParam.put("NOTE_TEXT", noteText); // 备注文本
inParam.put("NORMAL_WORK_CENTER_NO", normalWorkCenterNo); // 标准工作中心编号
inParam.put("LAST_CALIBRATION_DATE", lastCalibrationDate); // 最后校准日期
inParam.put("NORMAL_PRODUCTION_LINE", normalProductionLine); // 标准生产线
inParam.put("TOOL_DISCRIMINATION", toolDiscrimination); // 工具区分度
inParam.put("TOOL_LINEARITY", toolLinearity); // 工具线性度
inParam.put("TOOL_REPEATABILITY", toolRepeatability); // 工具重复性
inParam.put("TOOL_BIAS", toolBias); // 工具偏差
inParam.put("TOOL_STABILITY", toolStability); // 工具稳定性
inParam.put("TOOL_REPRODUCIBILITY", toolReproducibility); // 工具再现性
//执行check的操作
Map<String, String> checkMap = IfsPlsqlUtils.execProcedureGetRecord(srv, "MANUF_TOOL_DETAIL_API",
"MODIFY__", PlsqlBaseMethodType.MODIFY, PlsqlBaseMethodAction.CHECK, inParam);
//执行do的操作
Map<String, String> resultMap = IfsPlsqlUtils.execProcedureGetRecord(srv, "MANUF_TOOL_DETAIL_API",
"MODIFY__", PlsqlBaseMethodType.MODIFY, PlsqlBaseMethodAction.DO, inParam);
//返回结果集
return resultMap;
}
/**
* @description: 删除Tool Instance
* @author LR
* @date 2024/12/11 15:51
* @version 1.0
*/
public static void removeToolInstance(Server srv, ToolInstance inData) throws APException {
//公共参数
String ifsRowId = inData.getIfsRowId();//
String ifsRowVersion = inData.getIfsRowVersion();// 物料编码
//入参
Map<String, String> inParam = new HashMap<>();
//填充参数
inParam.put("OBJID", ifsRowId);
inParam.put("OBJVERSION", ifsRowVersion);
//执行check的操作
Map<String, String> checkMap = IfsPlsqlUtils.execProcedureGetRecord(srv, "MANUF_TOOL_DETAIL_API",
"REMOVE__", PlsqlBaseMethodType.REMOVE, PlsqlBaseMethodAction.CHECK, inParam);
//执行do的操作
Map<String, String> resultMap = IfsPlsqlUtils.execProcedureGetRecord(srv, "MANUF_TOOL_DETAIL_API",
"REMOVE__", PlsqlBaseMethodType.REMOVE, PlsqlBaseMethodAction.DO, inParam);
}
/**
* @description: 获取Tool Instance Date
* @author LR
* @date 2024/12/11 16:12
* @version 1.0
*/
public static List<Map<String, String>> getToolInstanceDates(Server srv, String contract, String toolId, String toolInstance) throws APException {
StringBuilder searchSql = new StringBuilder();
searchSql.append("SELECT OBJID ifsRowId, OBJVERSION ifsRowVersion, CONTRACT, TOOL_ID, TOOL_INSTANCE,");
searchSql.append(" BEGIN_DATE, END_DATE");
searchSql.append(" FROM IFSAPP.MANUF_TOOL_DETAIL_AVAIL");
searchSql.append(" WHERE CONTRACT = :contract AND TOOL_ID = :toolId AND TOOL_INSTANCE = :toolInstance");
//设置查询的入参
Map<String, String> inParam = new HashMap<>();
inParam.put("contract", contract);
inParam.put("toolId", toolId);
inParam.put("toolInstance", toolInstance);
//调用查询的通用方法
RecordCollection recordCollection = IfsPlsqlUtils.execSqlSearchGetRecordCollection(srv, searchSql, inParam);
//判断能否返回
if (recordCollection == null) {
return null;
} else {
List<Map<String, String>> resultList = IfsConverterToMap.ConverterIfsToList(recordCollection);
return resultList;
}
}
/**
* @description: 获取工具实例的时间数据
* @author LR
* @date 2024/12/16 16:44
* @version 1.0
*/
public static List<ToolInstanceDate> getToolInstanceDateList(Server srv, String contract, String toolId, String toolInstance) throws APException {
StringBuilder searchSql = new StringBuilder();
searchSql.append("SELECT OBJID ifsRowId, OBJVERSION ifsRowVersion, CONTRACT, TOOL_ID, TOOL_INSTANCE,");
searchSql.append(" BEGIN_DATE, END_DATE");
searchSql.append(" FROM IFSAPP.MANUF_TOOL_DETAIL_AVAIL");
searchSql.append(" WHERE CONTRACT = :contract AND TOOL_ID = :toolId AND TOOL_INSTANCE = :toolInstance");
//设置查询的入参
Map<String, String> inParam = new HashMap<>();
inParam.put("contract", contract);
inParam.put("toolId", toolId);
inParam.put("toolInstance", toolInstance);
//调用查询的通用方法
RecordCollection recordCollection = IfsPlsqlUtils.execSqlSearchGetRecordCollection(srv, searchSql, inParam);
//判断能否返回
if (recordCollection == null) {
return null;
} else {
List<ToolInstanceDate> 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);
ToolInstanceDate tempItem = new ToolInstanceDate();
//设置参数
tempItem.setIfsRowId(tempMap.get("IFSROWID"));
tempItem.setIfsRowVersion(tempMap.get("IFSROWVERSION"));
tempItem.setContract(tempMap.get("CONTRACT"));
tempItem.setToolId(tempMap.get("TOOL_ID"));
tempItem.setToolInstance(tempMap.get("TOOL_INSTANCE"));
tempItem.setBeginDate(tempMap.get("BEGIN_DATE"));
tempItem.setEndDate(tempMap.get("END_DATE"));
//添加对象
resultItems.add(tempItem);
}
return resultItems;
}
}
/**
* @description: 插入Tool Instance Date
* @author LR
* @date 2024/12/11 16:17
* @version 1.0
*/
public static Map<String, String> insertToolInstanceDate(Server srv, ToolInstanceDate inData) throws APException {
//公共参数
String contract = inData.getContract();//
String toolId = inData.getToolId();// 物料编码
String toolInstance = inData.getToolInstance();//
String beginDate = inData.getBeginDate()+"-00:00:00";//
//判断是否需要填充数据
String endDate = "";
if(!(null == inData.getEndDate() ||"".equals(inData.getEndDate()))) {
endDate = inData.getEndDate()+"-00:00:00";//
}
//入参
Map<String, String> inParam = new HashMap<>();
//填充参数
inParam.put("OBJID", "");
inParam.put("OBJVERSION", "");
inParam.put("CONTRACT", contract); //
inParam.put("TOOL_ID", toolId); // 工具编码
inParam.put("TOOL_INSTANCE", toolInstance); // 工具实例
inParam.put("BEGIN_DATE", beginDate); // 开始日期
inParam.put("END_DATE", endDate); // 结束日期
//执行check的操作
Map<String, String> checkMap = IfsPlsqlUtils.execProcedureGetRecord(srv, "MANUF_TOOL_DETAIL_AVAIL_API",
"NEW__", PlsqlBaseMethodType.NEW, PlsqlBaseMethodAction.CHECK, inParam);
//执行do的操作
Map<String, String> resultMap = IfsPlsqlUtils.execProcedureGetRecord(srv, "MANUF_TOOL_DETAIL_AVAIL_API",
"NEW__", PlsqlBaseMethodType.NEW, PlsqlBaseMethodAction.DO, inParam);
//返回结果集
return resultMap;
}
/**
* @description: 修改 Tool Instance Date
* @author LR
* @date 2024/12/11 16:22
* @version 1.0
*/
public static Map<String, String> modifyToolInstanceDate(Server srv, ToolInstanceDate inData) throws APException {
//公共参数
String ifsRowId = inData.getIfsRowId();//
String ifsRowVersion = inData.getIfsRowVersion();//
//判断是否需要填充数据
String endDate = "";
if(!(null == inData.getEndDate() ||"".equals(inData.getEndDate()))) {
endDate = inData.getEndDate()+"-00:00:00";//
}
//入参
Map<String, String> inParam = new HashMap<>();
//填充参数
inParam.put("OBJID", ifsRowId);
inParam.put("OBJVERSION", ifsRowVersion);
inParam.put("END_DATE", endDate); // 序号
//执行check的操作
Map<String, String> checkMap = IfsPlsqlUtils.execProcedureGetRecord(srv, "MANUF_TOOL_DETAIL_AVAIL_API",
"MODIFY__", PlsqlBaseMethodType.MODIFY, PlsqlBaseMethodAction.CHECK, inParam);
//执行do的操作
Map<String, String> resultMap = IfsPlsqlUtils.execProcedureGetRecord(srv, "MANUF_TOOL_DETAIL_AVAIL_API",
"MODIFY__", PlsqlBaseMethodType.MODIFY, PlsqlBaseMethodAction.DO, inParam);
//返回结果集
return resultMap;
}
/**
* @description: 删除 Tool Instance Date
* @author LR
* @date 2024/12/11 16:24
* @version 1.0
*/
public static Map<String, String> removeToolInstanceDate(Server srv, ToolInstanceDate inData) throws APException {
//公共参数
//公共参数
String ifsRowId = inData.getIfsRowId();//
String ifsRowVersion = inData.getIfsRowVersion();//
//入参
Map<String, String> inParam = new HashMap<>();
//填充参数
inParam.put("OBJID", ifsRowId);
inParam.put("OBJVERSION", ifsRowVersion);
//执行check的操作
Map<String, String> checkMap = IfsPlsqlUtils.execProcedureGetRecord(srv, "MANUF_TOOL_DETAIL_AVAIL_API",
"REMOVE__", PlsqlBaseMethodType.REMOVE, PlsqlBaseMethodAction.CHECK, inParam);
//执行do的操作
Map<String, String> resultMap = IfsPlsqlUtils.execProcedureGetRecord(srv, "MANUF_TOOL_DETAIL_AVAIL_API",
"REMOVE__", PlsqlBaseMethodType.REMOVE, PlsqlBaseMethodAction.DO, inParam);
//返回结果集
return resultMap;
}
}

164
src/main/java/com/spring/ifs/bean/BaseSearchBeanTest.java

@ -0,0 +1,164 @@
package com.spring.ifs.bean;
import com.spring.ifs.api.BaseSearchApiTest;
import com.spring.ifs.api.IfsServer;
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.ArrayList;
import java.util.List;
/**
* @description: 基础查询的实现类
* @author LR
* @date 2024/12/9 11:49
* @version 1.0
*/
@Component
public class BaseSearchBeanTest {
@Autowired
private IfsServer ifsServer;
private static final Logger logger = LoggerFactory.getLogger(BaseSearchBean.class);
/**
* @description: 查询加工中心
* @author LR
* @date 2024/12/12 13:23
* @version 1.0
*/
public List<WorkCenter> getWorkCenterNos(BaseSearchData inData) throws APException {
//查询的参数
String username = inData.getIfsUsername();
String password = inData.getIfsPassword();
String siteCon = inData.getSiteCon();
String ifsRowVersion = inData.getIfsRowVersion();
logger.info("请求参数:"+siteCon);
//获取连接
Server srv = ifsServer.getIfsServer(username, password);
List<WorkCenter> resultList = BaseSearchApiTest.getWorkCenterNos(srv, siteCon, ifsRowVersion);;
logger.info("返回集合大小:"+resultList.size());
return resultList;
}
/**
* @description: 查询
* @author LR
* @date 2024/12/12 13:24
* @version 1.0
*/
public List<WarehouseLocation> getWarehouseLocations(BaseSearchData inData) throws APException {
//查询的参数
String username = inData.getIfsUsername();
String password = inData.getIfsPassword();
String siteCon = inData.getSiteCon();
String ifsRowVersion = inData.getIfsRowVersion();
logger.info("请求参数:"+siteCon);
//获取连接
Server srv = ifsServer.getIfsServer(username, password);
List<WarehouseLocation> resultList = new ArrayList<>();
int pageSize = 200;
//迭代查询
for(int i = 0; i < 10; i++){
int startIndex = i * pageSize;
List<WarehouseLocation> tempList = BaseSearchApiTest.getWarehouseLocations(srv, siteCon, ifsRowVersion, startIndex, pageSize);
//判断查询是否结束
if(tempList.size() > 0) {
resultList.addAll(tempList);
}else {
break;
}
}
logger.info("返回集合大小:"+resultList.size());
return resultList;
}
/**
* @description: 获取人员等级的信息
* @author LR
* @date 2024/12/12 13:29
* @version 1.0
*/
public List<LaborClass> getIfsLaborClasss(BaseSearchData inData) throws APException {
//查询的参数
String username = inData.getIfsUsername();
String password = inData.getIfsPassword();
String siteCon = inData.getSiteCon();
String ifsRowVersion = inData.getIfsRowVersion();
//获取连接
Server srv = ifsServer.getIfsServer(username, password);
return BaseSearchApiTest.getIfsLaborClasss(srv, siteCon, ifsRowVersion);
}
/**
* @description: 查询物料件的信息
* @author LR
* @date 2024/12/9 13:28
* @version 1.0
*/
public List<PartCatalog> getMasterParts(BaseSearchData inData) throws APException {
//公共参数
String username = inData.getIfsUsername();
String password = inData.getIfsPassword();
String ifsRowVersion = inData.getIfsRowVersion();
//获取连接
Server srv = ifsServer.getIfsServer(username, password);
List<PartCatalog> resultList = new ArrayList<>();
int pageSize = 200;
//迭代查询
for(int i = 0; i < 10; i++){
int startIndex = i * pageSize;
List<PartCatalog> tempList = BaseSearchApiTest.getPartCatalogs(srv, ifsRowVersion, startIndex, pageSize);
//判断查询是否结束
if(tempList.size() > 0) {
resultList.addAll(tempList);
}else {
break;
}
}
logger.info("返回集合大小:"+resultList.size());
return resultList;
}
/**
* @description: 查询库存件的属性值
* @author LR
* @date 2024/12/12 13:33
* @version 1.0
*/
public List<InventoryValue> getInventoryValues(BaseSearchData inData) throws APException {
//查询的参数
String username = inData.getIfsUsername();
String password = inData.getIfsPassword();
String siteCon = inData.getSiteCon();
String ifsRowVersion = inData.getIfsRowVersion();
logger.info("库存件cost value请求参数:"+siteCon);
//获取连接
Server srv = ifsServer.getIfsServer(username, password);
List<InventoryValue> resultList = new ArrayList<>();
int pageSize = 200;
//迭代查询
for(int i = 0; i < 10; i++){
int startIndex = i * pageSize;
List<InventoryValue> tempList = BaseSearchApiTest.getInventoryValues(srv, siteCon, ifsRowVersion, startIndex, pageSize);
//判断查询是否结束
if(tempList.size() > 0) {
resultList.addAll(tempList);
}else {
break;
}
}
logger.info("返回集合大小:"+resultList.size());
return resultList;
}
}

832
src/main/java/com/spring/ifs/bean/InventoryServiceBeanTest.java

@ -0,0 +1,832 @@
package com.spring.ifs.bean;
import com.alibaba.fastjson.JSON;
import com.spring.ifs.api.BomApi;
import com.spring.ifs.api.IfsServer;
import com.spring.ifs.api.InventoryPartApi;
import com.spring.ifs.api.RoutingApi;
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 InventoryServiceBeanTest {
@Autowired
private IfsServer ifsServer;
private static final Logger logger = LoggerFactory.getLogger(InventoryServiceBeanTest.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<String, String> 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<String, String> 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<String, String> partMap = InventoryPartApi.getInventoryPartByPartNo(srv, contract, partNo);
//判断是否需要插入到ifs
if(partMap == null || partMap.size() == 0) {
//调用api
Map<String, String> 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<String, String> 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<String, String> 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<String, String> 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<String, String> 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<String, String> 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<String, String> partMap = InventoryPartApi.getInventoryPartByPartNo(srv, contract, partNo);
//判断是否需要插入到ifs
if(partMap == null || partMap.size() == 0) {
throw new RuntimeException("域:"+contract+"库存件:"+partNo+"不存在!");
}else {
//获取库存件Plan配置的信息
Map<String, String> planMap = InventoryPartApi.getInventoryPartPlan(srv, contract, partNo);
//设置ifs 信息
inData.setIfsRowId(planMap.get("IFSROWID"));
inData.setIfsRowVersion(planMap.get("IFSROWVERSION"));
Map<String, String> 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<InventoryPartLocation> syncInventoryPartLocations(List<InventoryPartLocation> 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<String, String> partMap = InventoryPartApi.getInventoryPartByPartNo(srv, contract, partNo);
//判断是否需要插入到ifs
if(partMap == null || partMap.size() == 0) {
throw new RuntimeException("域:" + contract + "库存件:" + partNo + "不存在!");
}
//编辑处理需要处理的数据
for(InventoryPartLocation inData : inDatas) {
Map<String, String> 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<String, String> 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<InventoryPartLocation> 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<String, String> 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<String, String> 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<String, String> 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<String, String> 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<String, String> revisionMap = InventoryPartApi.getInventoryPartRevision(srv, contract, partNo, engChgLevel);
//判断是否需要插入到ifs
if(revisionMap != null) {
throw new RuntimeException("当前版本信息已存在!");
}
//调用新增api
Map<String, String> resultMap = InventoryPartApi.insertInventoryPartRevision(srv, inData);
//设置ifs 信息
inData.setIfsRowId(resultMap.get("OBJID"));
inData.setIfsRowVersion(resultMap.get("OBJVERSION"));
//打印日志
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<String, String> 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<String, String> resultMap = InventoryPartApi.modifyInventoryPartRevision(srv, inData);
//设置ifs 信息
inData.setIfsRowVersion(resultMap.get("OBJVERSION"));
//打印日志
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<String, String> 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<CharacteristicCode> syncInventoryPartCharacteristics(List<CharacteristicCode> 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<String, String> characteristicMap = InventoryPartApi.getInventoryPartCharacteristicCode(srv, contract, partNo, characteristicCode);
if(characteristicMap != null && characteristicMap.size() > 0) {
throw new RuntimeException("属性编码已存在!");
}
//校验通过继续新增
Map<String, String> resultMap = InventoryPartApi.insertInventoryPartCharacteristicCode(srv, characteristic);
//设置ifs 信息
characteristic.setIfsRowId(resultMap.get("OBJID"));
characteristic.setIfsRowVersion(resultMap.get("OBJVERSION"));
}
//打印日志
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<CharacteristicCode> 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<BomHeader> bomHeaders = BomApi.getBomHeadersByPartNo(srv, contract, partNo);
//判断是否存在
if(bomHeaders != null && bomHeaders.size() > 0) {
for(BomHeader bomHeader : bomHeaders) {
//执行删除的操作
BomApi.removeBomHeader(srv, bomHeader);
}
}
//按照条件查询Routing的相关信息 按照海波的要求
List<RoutingHeader> 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<CharacteristicCode> 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<String, String> resultMap = InventoryPartApi.getCopyPartEventNo(srv);
String eventNo = resultMap.get("EVENT_NO");
//调整选择的接口数据
List<CopyPartItem> 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);
}
}

140
src/main/java/com/spring/ifs/bean/MasterServiceBeanTest.java

@ -0,0 +1,140 @@
package com.spring.ifs.bean;
import com.alibaba.fastjson.JSON;
import com.spring.ifs.api.IfsServer;
import com.spring.ifs.api.MasterPartApi;
import com.spring.ifs.data.PartCatalog;
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.Map;
/**
* @description: 物料件的实现类
* @author LR
* @date 2024/12/9 11:49
* @version 1.0
*/
@Component
public class MasterServiceBeanTest {
@Autowired
private IfsServer ifsServer;
private static final Logger logger = LoggerFactory.getLogger(MasterServiceBeanTest.class);
/**
* @description: 查询物料件的信息
* @author LR
* @date 2024/12/9 13:28
* @version 1.0
*/
public Map<String, String> getMasterPart(PartCatalog inData) throws APException {
//公共参数
String username = inData.getIfsUsername();
String password = inData.getIfsPassword();
String partNo = inData.getPartNo();
//获取连接
Server srv = ifsServer.getIfsServer(username, password);
//获取参数
Map<String, String> resultMap = MasterPartApi.getMasterPart(srv, partNo);
//判断是否存在
if(null == resultMap) {
throw new RuntimeException("当前物料件不存在!");
}
return resultMap;
}
/**
* @description: master part 新增
* @author LR
* @date 2024/12/12 15:33
* @version 1.0
*/
public PartCatalog syncPartCatalog(PartCatalog inData) throws APException {
logger.info("Part Catalog 新增开始:"+ JSON.toJSONString(inData));
//公共参数
String username = inData.getIfsUsername();
String password = inData.getIfsPassword();
String partNo = inData.getPartNo();
//获取连接
Server srv = ifsServer.getIfsServer(username, password);
Map<String, String> partMap = MasterPartApi.getMasterPart(srv, partNo);
//判断是否需要插入到ifs
if(partMap == null || partMap.size() == 0) {
Map<String, String> resultMap = MasterPartApi.insertMasterPart(srv, inData);
//设置ifs 信息
inData.setIfsRowId(resultMap.get("OBJID"));
inData.setIfsRowVersion(resultMap.get("OBJVERSION"));
}else {
throw new RuntimeException("物料件已存在!");
}
//打印日志
logger.info("Part Catalog 新增结束:"+JSON.toJSONString(inData));
//返回结果集
return inData;
}
/**
* @description: 调用修改的方法
* @author LR
* @date 2024/12/12 15:40
* @version 1.0
*/
public PartCatalog modifyPartCatalog(PartCatalog inData) throws APException {
logger.info("Part Catalog 修改开始:"+JSON.toJSONString(inData));
//公共参数
String username = inData.getIfsUsername();
String password = inData.getIfsPassword();
String partNo = inData.getPartNo();
//获取连接
Server srv = ifsServer.getIfsServer(username, password);
Map<String, String> partMap = MasterPartApi.getMasterPart(srv, partNo);
//判断是否需要插入到ifs
if(partMap == null && partMap.size() == 0) {
throw new RuntimeException("物料件不存在!");
}else {
//设置ifs 信息
inData.setIfsRowId(partMap.get("IFSROWID"));
inData.setIfsRowVersion(partMap.get("IFSROWVERSION"));
Map<String, String> resultMap = MasterPartApi.modifyMasterPart(srv, inData);
//设置ifs 信息
inData.setIfsRowVersion(resultMap.get("OBJVERSION"));
}
logger.info("Part Catalog 修改结束:"+JSON.toJSONString(inData));
//返回结果集
return inData;
}
/**
* @description: 调用删除的方法
* @author LR
* @date 2024/12/12 15:40
* @version 1.0
*/
public void removePartCatalog(PartCatalog inData) throws APException {
logger.info("Part Catalog 删除开始:"+JSON.toJSONString(inData));
//公共参数
String username = inData.getIfsUsername();
String password = inData.getIfsPassword();
String partNo = inData.getPartNo();
//获取连接
Server srv = ifsServer.getIfsServer(username, password);
Map<String, String> partMap = MasterPartApi.getMasterPart(srv, partNo);
//判断是否需要插入到ifs
if(partMap == null && partMap.size() == 0) {
throw new RuntimeException("物料件不存在!");
}else {
//设置ifs 信息
inData.setIfsRowId(partMap.get("IFSROWID"));
inData.setIfsRowVersion(partMap.get("IFSROWVERSION"));
MasterPartApi.removeMasterPart(srv, inData);
}
logger.info("Part Catalog 删除结束:"+JSON.toJSONString(inData));
}
}

210
src/main/java/com/spring/ifs/bean/TechnicalClassBean.java

@ -0,0 +1,210 @@
package com.spring.ifs.bean;
import com.alibaba.fastjson.JSON;
import com.spring.ifs.api.IfsServer;
import com.spring.ifs.api.TechnicalClassApi;
import com.spring.ifs.data.TechnicalAttribute;
import com.spring.ifs.data.TechnicalClass;
import com.spring.modules.Tooling.data.TechnicalClassAttribute;
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.ArrayList;
import java.util.List;
import java.util.Map;
/**
* @description: 技术等级实现类
* @author LR
* @date 2024/12/9 11:49
* @version 1.0
*/
@Component
public class TechnicalClassBean {
@Autowired
private IfsServer ifsServer;
private static final Logger logger = LoggerFactory.getLogger(TechnicalClassBean.class);
/**
* @description: 查询技术等级
* @author LR
* @date 2024/12/16 13:15
* @version 1.0
*/
public TechnicalClass getTechnicalClass(TechnicalClass inData) throws APException {
logger.info("Technical Class 查询开始:"+ JSON.toJSONString(inData));
//公共参数
String username = inData.getIfsUsername();
String password = inData.getIfsPassword();
String luName = inData.getLuName(); //
String keyRef = inData.getKeyRef(); //
//获取连接
Server srv = ifsServer.getIfsServer(username, password);
//查询对象
Map<String, String> resultMap = TechnicalClassApi.getTechnicalClass(srv, luName, keyRef);
//判断查询导数据
if(resultMap == null) {
throw new RuntimeException("查无此技术等级的信息!");
}
//设置ifs 信息
inData.setIfsRowId(resultMap.get("IFSROWID"));
inData.setIfsRowVersion(resultMap.get("IFSROWVERSION"));
logger.info("Technical Class 查询结束:"+JSON.toJSONString(inData));
//返回结果集
return inData;
}
/**
* @description: 新增
* @author LR
* @date 2024/12/16 13:37
* @version 1.0
*/
public TechnicalClass syncTechnicalClass(TechnicalClass inData) throws APException {
logger.info("Technical Class 新增开始:"+JSON.toJSONString(inData));
//公共参数
String username = inData.getIfsUsername();
String password = inData.getIfsPassword();
String luName = inData.getLuName(); //
String keyRef = inData.getKeyRef(); //
//获取连接
Server srv = ifsServer.getIfsServer(username, password);
//查询对象
Map<String, String> technicalMap = TechnicalClassApi.getTechnicalClass(srv, luName, keyRef);
//判断查询导数据
if(technicalMap != null && technicalMap.size() > 0) {
throw new RuntimeException("已存在此技术等级的信息!");
}
//设置IFS的信息
inData.setIfsRowId(technicalMap.get("IFSROWID"));
inData.setIfsRowVersion(technicalMap.get("IFSROWVERSION"));
//调用api同步信息
Map<String, String> resultMap = TechnicalClassApi.insertTechnicalClass(srv, inData);
//设置唯一键和版本
inData.setIfsRowVersion(resultMap.get("OBJVERSION"));
//插入查询的记录数据
logger.info("Technical Class 新增结束:"+JSON.toJSONString(inData));
return inData;
}
/**
* @description: 修改技术等级的数据
* @author LR
* @date 2024/12/16 13:45
* @version 1.0
*/
public TechnicalClass modifyTechnicalClass(TechnicalClass inData) throws APException {
logger.info("Technical Class 修改开始:"+JSON.toJSONString(inData));
//公共参数
String username = inData.getIfsUsername();
String password = inData.getIfsPassword();
String luName = inData.getLuName(); //
String keyRef = inData.getKeyRef(); //
//获取连接
Server srv = ifsServer.getIfsServer(username, password);
//查询对象
Map<String, String> technicalMap = TechnicalClassApi.getTechnicalClass(srv, luName, keyRef);
//判断查询导数据
if(technicalMap == null || technicalMap.size() == 0) {
throw new RuntimeException("不存在此技术等级的信息!");
}
//设置IFS的信息
inData.setIfsRowId(technicalMap.get("IFSROWID"));
inData.setIfsRowVersion(technicalMap.get("IFSROWVERSION"));
//调用api同步信息
Map<String, String> resultMap = TechnicalClassApi.modifyTechnicalClass(srv, inData);
//设置唯一键和版本
inData.setIfsRowVersion(resultMap.get("OBJVERSION"));
//插入查询的记录数据
logger.info("Technical Class 修改结束:"+JSON.toJSONString(inData));
return inData;
}
/**
* @description: 刪除技术等级的信息
* @author LR
* @date 2024/12/16 13:46
* @version 1.0
*/
public void removeTechnicalClass(TechnicalClass inData) throws APException {
logger.info("Technical Class 删除开始:"+JSON.toJSONString(inData));
//公共参数
String username = inData.getIfsUsername();
String password = inData.getIfsPassword();
String luName = inData.getLuName(); //
String keyRef = inData.getKeyRef(); //
//获取连接
Server srv = ifsServer.getIfsServer(username, password);
//查询对象
Map<String, String> technicalMap = TechnicalClassApi.getTechnicalClass(srv, luName, keyRef);
//判断查询导数据
if(technicalMap == null || technicalMap.size() == 0) {
throw new RuntimeException("不存在此技术等级的信息!");
}
//设置IFS的信息
inData.setIfsRowId(technicalMap.get("IFSROWID"));
inData.setIfsRowVersion(technicalMap.get("IFSROWVERSION"));
//调用api同步信息
TechnicalClassApi.removeTechnicalClass(srv, inData);
//插入查询的记录数据
logger.info("Technical Class 删除结束:"+JSON.toJSONString(inData));
}
public List<TechnicalAttribute> syncTechnicalClassAttributes(List<TechnicalAttribute> inDatas) throws APException {
logger.info("Technical Class Attributes 批量新增开始:"+JSON.toJSONString(inDatas));
TechnicalAttribute inData = inDatas.get(0);
// 公共参数
String username = inData.getIfsUsername();
String password = inData.getIfsPassword();
String luName = inData.getLuName(); //
String keyRef = inData.getKeyRef(); //
//获取连接
Server srv = ifsServer.getIfsServer(username, password);
//查询技术等级
Map<String, String> technicalMap = TechnicalClassApi.getTechnicalClass(srv, luName, keyRef);
//判断查询导数据
//判断查询导数据
if(technicalMap == null || technicalMap.size() == 0) {
throw new RuntimeException("不存在此技术等级的信息!");
}
//设置唯一键和版本
String technicalSpecNo = technicalMap.get("TECHNICAL_SPEC_NO");
String technicalClass = inData.getTechnicalClass();
//循环设置参数
for(TechnicalAttribute tempData : inDatas) {
String attribute = tempData.getAttribute();
//查询属性信息
Map<String, String> attributeMap = TechnicalClassApi.getTechnicalAttribute(srv, technicalSpecNo, technicalClass, attribute);
if(attributeMap != null && attributeMap.size() > 0) {
throw new RuntimeException("查已存在此技术等级的属性信息!");
}
//设置替代的ifs的key
inData.setIfsRowId(attributeMap.get("IFSROWID"));
inData.setIfsRowVersion(attributeMap.get("IFSROWVERSION"));
inData.setTechnicalSpecNo(technicalSpecNo);
//api修改参数
Map<String, String> resultMap = TechnicalClassApi.modifyTechnicalAttribute(srv, tempData);
//设置记录的版本
inData.setIfsRowVersion(resultMap.get("OBJVERSION"));
}
//插入查询的记录数据
logger.info("Technical Class Attributes 批量新增结束:"+JSON.toJSONString(inDatas));
return inDatas;
}
}

419
src/main/java/com/spring/ifs/bean/ToolServiceBean.java

@ -0,0 +1,419 @@
package com.spring.ifs.bean;
import com.alibaba.fastjson.JSON;
import com.spring.ifs.api.IfsServer;
import com.spring.ifs.api.ToolApi;
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;
import java.util.function.Function;
import java.util.stream.Collectors;
/**
* @description: Tool的实现类
* @author LR
* @date 2024/12/9 15:44
* @version 1.0
*/
@Component
public class ToolServiceBean {
@Autowired
private IfsServer ifsServer;
private static final Logger logger = LoggerFactory.getLogger(ToolServiceBean.class);
/**
* @description: 查询Tool Header
* @author LR
* @date 2024/12/12 15:49
* @version 1.0
*/
public ToolHeader getToolHeader(ToolHeader inData) throws APException {
logger.info("Tool Header查询参数:"+JSON.toJSONString(inData));
//查询的参数
String username = inData.getIfsUsername();
String password = inData.getIfsPassword();
String contract = inData.getContract();
String toolId = inData.getToolId();
//获取连接
Server srv = ifsServer.getIfsServer(username, password);
Map<String, String> headerMap = ToolApi.getToolHeader(srv, contract, toolId);
//判断是否需要插入到ifs
if(headerMap == null || headerMap.size() == 0) {
throw new RuntimeException("Tool Header不存在!");
}
//设置ifs 信息
inData.setIfsRowId(headerMap.get("IFSROWID"));
inData.setIfsRowVersion(headerMap.get("IFSROWVERSION"));
//打印日志
logger.info("Tool Header查询:"+JSON.toJSONString(inData));
return inData;
}
/**
* @description: Tool Header新增
* @author LR
* @date 2024/12/12 15:52
* @version 1.0
*/
public ToolHeader syncToolHeader(ToolHeader inData) throws APException {
logger.info("Tool Header新增开始:"+JSON.toJSONString(inData));
//查询的参数
String username = inData.getIfsUsername();
String password = inData.getIfsPassword();
String contract = inData.getContract();
String toolId = inData.getToolId();
//获取连接
Server srv = ifsServer.getIfsServer(username, password);
Map<String, String> headerMap = ToolApi.getToolHeader(srv, contract, toolId);
//判断是否需要插入到ifs
if(headerMap == null || headerMap.size() == 0) {
throw new RuntimeException("Tool Header不存在!");
}
//判断是否需要插入到ifs
if(headerMap != null && headerMap.size() > 0) {
throw new RuntimeException("Tool Header已存在!");
}
//设置IFS信息
inData.setIfsRowId(headerMap.get("IFSROWID"));
inData.setIfsRowVersion(headerMap.get("IFSROWVERSION"));
//调用api
Map<String, String> resultMap = ToolApi.insertToolHeader(srv, inData);
//设置ifs 信息
inData.setIfsRowVersion(resultMap.get("OBJVERSION"));
//打印日志
logger.info("Tool Header新增结束:"+JSON.toJSONString(inData));
//返回结果集
return inData;
}
/**
* @description: Tool Header修改
* @author LR
* @date 2024/12/12 15:55
* @version 1.0
*/
public ToolHeader modifyToolHeader(ToolHeader inData) throws APException {
logger.info("Tool Header修改开始:"+JSON.toJSONString(inData));
//查询的参数
String username = inData.getIfsUsername();
String password = inData.getIfsPassword();
String contract = inData.getContract();
String toolId = inData.getToolId();
//获取连接
Server srv = ifsServer.getIfsServer(username, password);
//查询
Map<String, String> headerMap = ToolApi.getToolHeader(srv, contract, toolId);
//判断是否需要插入到ifs
if(headerMap == null || headerMap.size() == 0) {
throw new RuntimeException("Tool Header不存在!");
}
//设置ifs 信息
inData.setIfsRowId(headerMap.get("IFSROWID"));
inData.setIfsRowVersion(headerMap.get("IFSROWVERSION"));
//调用修改api
Map<String, String> resultMap = ToolApi.modifyToolHeader(srv, inData);
//设置ifs 信息
inData.setIfsRowVersion(resultMap.get("OBJVERSION"));
//打印日志
logger.info("Tool Header修改结束:"+JSON.toJSONString(inData));
//返回结果
return inData;
}
/**
* @description: Tool Header删除
* @author LR
* @date 2024/12/12 15:58
* @version 1.0
*/
public void removeToolHeader(ToolHeader inData) throws APException {
logger.info("Tool Header删除开始:"+JSON.toJSONString(inData));
//查询的参数
String username = inData.getIfsUsername();
String password = inData.getIfsPassword();
String contract = inData.getContract();
String toolId = inData.getToolId();
//获取连接
Server srv = ifsServer.getIfsServer(username, password);
//查询
Map<String, String> headerMap = ToolApi.getToolHeader(srv, contract, toolId);
//判断是否需要插入到ifs
if(headerMap == null || headerMap.size() == 0) {
throw new RuntimeException("Tool Header不存在!");
}
//设置ifs 信息
inData.setIfsRowId(headerMap.get("IFSROWID"));
inData.setIfsRowVersion(headerMap.get("IFSROWVERSION"));
ToolApi.removeToolHeader(srv, inData);
//打印日志
logger.info("Tool Header 删除结束:"+JSON.toJSONString(inData));
}
/**
* @description: 查询Tool Instance
* @author LR
* @date 2024/12/12 16:59
* @version 1.0
*/
public ToolInstance getToolInstance(ToolInstance inData) throws APException {
logger.info("Tool Instance 查询开始:"+JSON.toJSONString(inData));
//公共参数
String username = inData.getIfsUsername();
String password = inData.getIfsPassword();
String contract = inData.getContract();
String toolId = inData.getToolId();
String toolInstance = inData.getToolInstance();
//获取连接
Server srv = ifsServer.getIfsServer(username, password);
//查询工具实例的信息
Map<String, String> instanceMap = ToolApi.getToolInstance(srv, contract, toolId, toolInstance);
//判断是否需要插入到ifs
if(instanceMap == null) {
throw new RuntimeException("Tool Instance 不存在!");
}
//设置ifs 信息
inData.setIfsRowId(instanceMap.get("IFSROWID"));
inData.setIfsRowVersion(instanceMap.get("IFSROWVERSION"));
//打印日志
logger.info("Tool Instance 查询结束:"+JSON.toJSONString(inData));
return inData;
}
/**
* @description: 插入Tool Instance
* @author LR
* @date 2024/12/12 17:03
* @version 1.0
*/
public ToolInstance syncToolInstance(ToolInstance inData) throws APException {
logger.info("Tool Instance 新增开始:"+JSON.toJSONString(inData));
//公共参数
String username = inData.getIfsUsername();
String password = inData.getIfsPassword();
String contract = inData.getContract();
String toolId = inData.getToolId();
String toolInstance = inData.getToolInstance();
//获取连接
Server srv = ifsServer.getIfsServer(username, password);
//查询工具实例的信息
Map<String, String> instanceMap = ToolApi.getToolInstance(srv, contract, toolId, toolInstance);
//判断是否需要插入到ifs
if(instanceMap != null && instanceMap.size() > 0) {
throw new RuntimeException("Tool Instance 已存在!");
}
//调用新增api
Map<String, String> resultMap = ToolApi.insertToolInstance(srv, inData);
//设置ifs 信息
inData.setIfsRowId(resultMap.get("OBJID"));
inData.setIfsRowVersion(resultMap.get("OBJVERSION"));
//打印日志
logger.info("Tool Instance 新增结束:"+JSON.toJSONString(inData));
//返回结果
return inData;
}
/**
* @description: 修改Tool Instance
* @author LR
* @date 2024/12/12 17:06
* @version 1.0
*/
public ToolInstance modifyToolInstance(ToolInstance inData) throws APException {
logger.info("Tool Instance 修改开始:"+JSON.toJSONString(inData));
//公共参数
String username = inData.getIfsUsername();
String password = inData.getIfsPassword();
String contract = inData.getContract();
String toolId = inData.getToolId();
String toolInstance = inData.getToolInstance();
//获取连接
Server srv = ifsServer.getIfsServer(username, password);
//查询工具实例的信息
Map<String, String> instanceMap = ToolApi.getToolInstance(srv, contract, toolId, toolInstance);
//判断是否需要插入到ifs
if(instanceMap == null || instanceMap.size() == 0) {
throw new RuntimeException("Tool Instance不存在!");
}
//设置ifs 信息
inData.setIfsRowId(instanceMap.get("IFSROWID"));
inData.setIfsRowVersion(instanceMap.get("IFSROWVERSION"));
//调用api
Map<String, String> resultMap = ToolApi.modifyToolInstance(srv, inData);
//设置ifs 信息
inData.setIfsRowVersion(resultMap.get("OBJVERSION"));
//打印日志
logger.info("Tool Instance 修改结束:"+JSON.toJSONString(inData));
//返回结果
return inData;
}
/**
* @description: 删除Tool Instance
* @author LR
* @date 2024/12/12 17:07
* @version 1.0
*/
public void removeToolInstance(ToolInstance inData) throws APException {
logger.info("Tool Instance 删除开始:"+JSON.toJSONString(inData));
//公共参数
//公共参数
String username = inData.getIfsUsername();
String password = inData.getIfsPassword();
String contract = inData.getContract();
String toolId = inData.getToolId();
String toolInstance = inData.getToolInstance();
//获取连接
Server srv = ifsServer.getIfsServer(username, password);
//查询工具实例的信息
Map<String, String> instanceMap = ToolApi.getToolInstance(srv, contract, toolId, toolInstance);
//判断是否需要插入到ifs
if(instanceMap == null || instanceMap.size() == 0) {
throw new RuntimeException("Tool Instance不存在!");
}
//设置ifs 信息
inData.setIfsRowId(instanceMap.get("IFSROWID"));
inData.setIfsRowVersion(instanceMap.get("IFSROWVERSION"));
//调用api
ToolApi.removeToolInstance(srv, inData);
//打印日志
logger.info("Tool Instance 删除结束:"+JSON.toJSONString(inData));
}
/**
* @description: 获取Tool Instance Date
* @author LR
* @date 2024/12/13 9:53
* @version 1.0
*/
public List<ToolInstanceDate> getToolInstanceDate(ToolInstanceDate inData) throws APException {
logger.info("Tool Instance Date查询开始:"+JSON.toJSONString(inData));
//公共参数
String username = inData.getIfsUsername();
String password = inData.getIfsPassword();
String contract = inData.getContract();
String toolId = inData.getToolId();
String toolInstance = inData.getToolInstance();
//获取连接
Server srv = ifsServer.getIfsServer(username, password);
//查询制造商信息
Map<String, String> instanceMap = ToolApi.getToolInstance(srv, contract, toolId, toolInstance);
//判断是否需要插入到ifs
if(instanceMap == null || instanceMap.size() == 0) {
throw new RuntimeException("Tool Instance不存在!");
}
//查询结果集
List<ToolInstanceDate> resultList = ToolApi.getToolInstanceDateList(srv, contract, toolId, toolInstance);
//判断是否查询数据
if(resultList.size() == 0 || resultList.isEmpty()) {
throw new RuntimeException("不存在时间信息!");
}
//打印日志
logger.info("Tool Instance Date查询结束:"+JSON.toJSONString(inData));
//返回结果集
return resultList;
}
/**
* @description: 新增Tool Instance Date
* @author LR
* @date 2024/12/12 17:23
* @version 1.0
*/
public ToolInstanceDate syncToolInstanceDate(ToolInstanceDate inData) throws APException {
logger.info("Bom替代明细集合新增开始:"+JSON.toJSONString(inData));
//公共参数
String username = inData.getIfsUsername();
String password = inData.getIfsPassword();
String contract = inData.getContract();
String toolId = inData.getToolId();
String toolInstance = inData.getToolInstance();
//获取连接
Server srv = ifsServer.getIfsServer(username, password);
//查询制造商信息
Map<String, String> instanceMap = ToolApi.getToolInstance(srv, contract, toolId, toolInstance);
//判断是否需要插入到ifs
if(instanceMap == null || instanceMap.size() == 0) {
throw new RuntimeException("Tool Instance不存在!");
}
//调用api
Map<String, String> resultMap = ToolApi.insertToolInstanceDate(srv, inData);
//设置ifs 信息
inData.setIfsRowId(resultMap.get("OBJID"));
inData.setIfsRowVersion(resultMap.get("OBJVERSION"));
//打印日志
logger.info("Bom替代明细集合新增开始:"+JSON.toJSONString(inData));
//返回结果集
return inData;
}
/**
* @description: 修改Tool Instance Date
* @author LR
* @date 2024/12/13 10:24
* @version 1.0
*/
public ToolInstanceDate modifyToolInstanceDate(ToolInstanceDate inData) throws APException {
logger.info("Tool Instance Date新增开始:"+JSON.toJSONString(inData));
String username = inData.getIfsUsername();
String password = inData.getIfsPassword();
String contract = inData.getContract();
String toolId = inData.getToolId();
String toolInstance = inData.getToolInstance();
//获取连接
Server srv = ifsServer.getIfsServer(username, password);
//查询制造商信息
Map<String, String> instanceMap = ToolApi.getToolInstance(srv, contract, toolId, toolInstance);
//判断是否需要插入到ifs
if(instanceMap == null || instanceMap.size() == 0) {
throw new RuntimeException("Tool Instance不存在!");
}
//调用api
Map<String, String> resultMap = ToolApi.modifyToolInstanceDate(srv, inData);
//设置ifs 信息
inData.setIfsRowVersion(resultMap.get("OBJVERSION"));
//打印日志
logger.info("Tool Instance Date新增结束:"+JSON.toJSONString(inData));
//返回结果集
return inData;
}
/**
* @description: 删除Tool Instance Date
* @author LR
* @date 2024/12/13 10:26
* @version 1.0
*/
public void removeToolInstanceDate(ToolInstanceDate inData) throws APException {
logger.info("Tool Instance Date删除开始:"+JSON.toJSONString(inData));
//公共参数
String username = inData.getIfsUsername();
String password = inData.getIfsPassword();
String contract = inData.getContract();
String toolId = inData.getToolId();
String toolInstance = inData.getToolInstance();
//获取连接
Server srv = ifsServer.getIfsServer(username, password);
//查询制造商信息
Map<String, String> instanceMap = ToolApi.getToolInstance(srv, contract, toolId, toolInstance);
//判断是否需要插入到ifs
if(instanceMap == null || instanceMap.size() == 0) {
throw new RuntimeException("Tool Instance不存在!");
}
//调用api删除数据
ToolApi.removeToolInstanceDate(srv, inData);
//打印日志
logger.info("Tool Instance Date删除结束:"+JSON.toJSONString(inData));
}
}
Loading…
Cancel
Save