6 changed files with 1475 additions and 99 deletions
-
19src/main/java/com/spring/ifs/api/RecipeApi.java
-
688src/main/java/com/spring/ifs/api/RecipeApiTest.java
-
1src/main/java/com/spring/ifs/bean/BomServiceBean.java
-
1src/main/java/com/spring/ifs/bean/BomServiceBeanTest.java
-
171src/main/java/com/spring/ifs/bean/RecipeServiceBean.java
-
684src/main/java/com/spring/ifs/bean/RecipeServiceBeanTest.java
@ -0,0 +1,688 @@ |
|||||
|
package com.spring.ifs.api; |
||||
|
|
||||
|
import com.spring.ifs.utils.IfsConverterToMap; |
||||
|
import com.spring.ifs.utils.IfsPlsqlUtils; |
||||
|
import com.spring.modules.base.utils.DateUtils; |
||||
|
import com.spring.modules.part.entity.APIEntity.RecipeIfsAlternative; |
||||
|
import com.spring.modules.part.entity.APIEntity.RecipeIfsHeader; |
||||
|
import com.spring.modules.part.entity.APIEntity.RecipeIfsItem; |
||||
|
import ifs.fnd.ap.*; |
||||
|
|
||||
|
import java.util.*; |
||||
|
|
||||
|
/** |
||||
|
* @description: 配方的api |
||||
|
* @author LR |
||||
|
* @date 2024/12/9 10:56 |
||||
|
* @version 1.0 |
||||
|
*/ |
||||
|
public class RecipeApiTest { |
||||
|
|
||||
|
/** |
||||
|
* @description: 查询 Recipe Header |
||||
|
* @author LR |
||||
|
* @date 2024/12/11 14:45 |
||||
|
* @version 1.0 |
||||
|
*/ |
||||
|
public static Map<String, String> getRecipeHeader(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.RECIPE_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: 插入Recipe Header的主表 |
||||
|
* @author LR |
||||
|
* @date 2024/12/11 15:08 |
||||
|
* @version 1.0 |
||||
|
*/ |
||||
|
public static Map<String, String> insertRecipeHeader(Server srv, RecipeIfsHeader 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, "RECIPE_STRUCTURE_HEAD_API", |
||||
|
"NEW__", PlsqlBaseMethodType.NEW, PlsqlBaseMethodAction.CHECK, inParam); |
||||
|
//执行do的操作 |
||||
|
Map<String, String> resultMap = IfsPlsqlUtils.execProcedureGetRecord(srv, "RECIPE_STRUCTURE_HEAD_API", |
||||
|
"NEW__", PlsqlBaseMethodType.NEW, PlsqlBaseMethodAction.DO, inParam); |
||||
|
//返回结果集 |
||||
|
return resultMap; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* @description: 修改Recipe Header的主表信息 |
||||
|
* @author LR |
||||
|
* @date 2024/12/11 15:32 |
||||
|
* @version 1.0 |
||||
|
*/ |
||||
|
public static Map<String, String> modifyRecipeHeader(Server srv, RecipeIfsHeader 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, "RECIPE_STRUCTURE_HEAD_API", |
||||
|
"MODIFY__", PlsqlBaseMethodType.MODIFY, PlsqlBaseMethodAction.CHECK, inParam); |
||||
|
//执行do的操作 |
||||
|
Map<String, String> resultMap = IfsPlsqlUtils.execProcedureGetRecord(srv, "RECIPE_STRUCTURE_HEAD_API", |
||||
|
"MODIFY__", PlsqlBaseMethodType.MODIFY, PlsqlBaseMethodAction.DO, inParam); |
||||
|
//返回结果集 |
||||
|
return resultMap; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* @description: 删除Recipe的主表信息 |
||||
|
* @author LR |
||||
|
* @date 2024/12/11 15:33 |
||||
|
* @version 1.0 |
||||
|
*/ |
||||
|
public static Map<String, String> removeRecipeHeader(Server srv, RecipeIfsHeader 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, "RECIPE_STRUCTURE_HEAD_API", |
||||
|
"REMOVE__", PlsqlBaseMethodType.REMOVE, PlsqlBaseMethodAction.CHECK, inParam); |
||||
|
//执行do的操作 |
||||
|
Map<String, String> resultMap = IfsPlsqlUtils.execProcedureGetRecord(srv, "RECIPE_STRUCTURE_HEAD_API", |
||||
|
"REMOVE__", PlsqlBaseMethodType.REMOVE, PlsqlBaseMethodAction.DO, inParam); |
||||
|
//返回结果集 |
||||
|
return resultMap; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* @description: 查询Recipe Alternative |
||||
|
* @author LR |
||||
|
* @date 2024/12/11 14:48 |
||||
|
* @version 1.0 |
||||
|
*/ |
||||
|
public static Map<String, String> getRecipeAlternative(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, STD_SIZE_KG,"); |
||||
|
searchSql.append(" DISPLAY_WEIGHT_UOM, REG_UNIT, DISPLAY_VOLUME_UOM,"); |
||||
|
searchSql.append(" CONTRACT, PART_NO, BOM_TYPE, ENG_CHG_LEVEL, ALTERNATIVE_NO, STATE, NOTE_TEXT"); |
||||
|
searchSql.append(" FROM IFSAPP.RECIPE_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: 插入Recipe Alternative |
||||
|
* @author LR |
||||
|
* @date 2024/12/11 15:45 |
||||
|
* @version 1.0 |
||||
|
*/ |
||||
|
public static Map<String, String> insertRecipeAlternative(Server srv, RecipeIfsAlternative 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 displayWeightUom = inData.getDisplayWeightUom(); |
||||
|
String displayVolumeUom = inData.getDisplayVolumeUom(); |
||||
|
String regUnit = inData.getRegUnit(); |
||||
|
//判断是否存在问题 |
||||
|
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("DISPLAY_WEIGHT_UOM", displayWeightUom); // |
||||
|
inParam.put("DISPLAY_VOLUME_UOM", displayVolumeUom); // |
||||
|
|
||||
|
//执行PREPARE的操作 |
||||
|
Map<String, String> checkMap = IfsPlsqlUtils.execProcedureGetRecord(srv, "RECIPE_STRUCT_ALTERNATE_API", |
||||
|
"NEW__", PlsqlBaseMethodType.NEW, PlsqlBaseMethodAction.PREPARE, inParam); |
||||
|
|
||||
|
//填充PREPARE返回的参数 |
||||
|
inParam.put("STD_SIZE_KG", checkMap.get("STD_SIZE_KG")); // |
||||
|
inParam.put("YIELD", checkMap.get("YIELD")); // |
||||
|
inParam.put("USE_COST_DISTRIBUTION_DB", checkMap.get("USE_COST_DISTRIBUTION_DB")); // 替代编码 |
||||
|
inParam.put("REWORK_ALTERNATE_DB", checkMap.get("REWORK_ALTERNATE_DB")); // 替代编码 |
||||
|
//添加DO的参数 |
||||
|
inParam.put("ALTERNATIVE_NO", alternativeNo); // 替代编码 |
||||
|
inParam.put("ALTERNATIVE_DESCRIPTION", alternativeDesc); // 替代编码描述 |
||||
|
inParam.put("REG_UNIT", regUnit); // |
||||
|
inParam.put("NOTE_TEXT", noteText); // 备注 |
||||
|
//执行do的操作 |
||||
|
Map<String, String> resultMap = IfsPlsqlUtils.execProcedureGetRecord(srv, "RECIPE_STRUCT_ALTERNATE_API", |
||||
|
"NEW__", PlsqlBaseMethodType.NEW, PlsqlBaseMethodAction.DO, inParam); |
||||
|
//返回结果集 |
||||
|
return resultMap; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* @description: 修改Recipe Alternative |
||||
|
* @author LR |
||||
|
* @date 2024/12/11 15:47 |
||||
|
* @version 1.0 |
||||
|
*/ |
||||
|
public static Map<String, String> modifyRecipeAlternative(Server srv, RecipeIfsAlternative inData) throws APException { |
||||
|
//公共参数 |
||||
|
String ifsRowId = inData.getIfsRowId();// 域 |
||||
|
String ifsRowVersion = inData.getIfsRowVersion();// 物料编码 |
||||
|
String regUnit = inData.getRegUnit(); |
||||
|
String alternativeDesc = inData.getAlternativeDesc(); |
||||
|
String stdSizeKg = inData.getStdSizeKg(); |
||||
|
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("REG_UNIT", regUnit); //类型 |
||||
|
inParam.put("STD_SIZE_KG", stdSizeKg); // |
||||
|
inParam.put("NOTE_TEXT", noteText); // 备注 |
||||
|
|
||||
|
//执行check的操作 |
||||
|
Map<String, String> checkMap = IfsPlsqlUtils.execProcedureGetRecord(srv, "RECIPE_STRUCT_ALTERNATE_API", |
||||
|
"MODIFY__", PlsqlBaseMethodType.MODIFY, PlsqlBaseMethodAction.CHECK, inParam); |
||||
|
//执行do的操作 |
||||
|
Map<String, String> resultMap = IfsPlsqlUtils.execProcedureGetRecord(srv, "RECIPE_STRUCT_ALTERNATE_API", |
||||
|
"MODIFY__", PlsqlBaseMethodType.MODIFY, PlsqlBaseMethodAction.DO, inParam); |
||||
|
//返回结果集 |
||||
|
return resultMap; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* @description: 删除Recipe Alternative |
||||
|
* @author LR |
||||
|
* @date 2024/12/11 15:51 |
||||
|
* @version 1.0 |
||||
|
*/ |
||||
|
public static void removeRecipeAlternative(Server srv, RecipeIfsAlternative 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, "RECIPE_STRUCT_ALTERNATE_API", |
||||
|
"REMOVE__", PlsqlBaseMethodType.REMOVE, PlsqlBaseMethodAction.CHECK, inParam); |
||||
|
//执行do的操作 |
||||
|
Map<String, String> resultMap = IfsPlsqlUtils.execProcedureGetRecord(srv, "RECIPE_STRUCT_ALTERNATE_API", |
||||
|
"REMOVE__", PlsqlBaseMethodType.REMOVE, PlsqlBaseMethodAction.DO, inParam); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* @description: Build Recipe Alternative |
||||
|
* @author LR |
||||
|
* @date 2024/12/11 15:53 |
||||
|
* @version 1.0 |
||||
|
*/ |
||||
|
public static Map<String, String> buildRecipeAlternative(Server srv, RecipeIfsAlternative 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, "RECIPE_STRUCT_ALTERNATE_API", |
||||
|
"BUILD__", PlsqlBaseMethodType.MODIFY, PlsqlBaseMethodAction.CHECK, inParam); |
||||
|
//执行do的操作 |
||||
|
Map<String, String> resultMap = IfsPlsqlUtils.execProcedureGetRecord(srv, "RECIPE_STRUCT_ALTERNATE_API", |
||||
|
"BUILD__", PlsqlBaseMethodType.MODIFY, PlsqlBaseMethodAction.DO, inParam); |
||||
|
//返回结果集 |
||||
|
return resultMap; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* @description: retire Recipe Alternative |
||||
|
* @author LR |
||||
|
* @date 2024/12/11 15:55 |
||||
|
* @version 1.0 |
||||
|
*/ |
||||
|
public static Map<String, String> retireRecipeAlternative(Server srv, RecipeIfsAlternative 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, "RECIPE_STRUCT_ALTERNATE_API", |
||||
|
"RETIRE__", PlsqlBaseMethodType.MODIFY, PlsqlBaseMethodAction.CHECK, inParam); |
||||
|
//执行do的操作 |
||||
|
Map<String, String> resultMap = IfsPlsqlUtils.execProcedureGetRecord(srv, "RECIPE_STRUCT_ALTERNATE_API", |
||||
|
"RETIRE__", PlsqlBaseMethodType.MODIFY, PlsqlBaseMethodAction.DO, inParam); |
||||
|
//返回结果集 |
||||
|
return resultMap; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* @description: 获取Recipe Item |
||||
|
* @author LR |
||||
|
* @date 2024/12/11 16:12 |
||||
|
* @version 1.0 |
||||
|
*/ |
||||
|
public static Map<String, String> getRecipeItem(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, WEIGHT_SHARE,"); |
||||
|
searchSql.append(" COMPONENT_SCRAP, SHRINKAGE_FACTOR"); |
||||
|
searchSql.append(" FROM IFSAPP.RECIPE_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: 获取Recipe Items |
||||
|
* @author LR |
||||
|
* @date 2024/12/11 16:16 |
||||
|
* @version 1.0 |
||||
|
*/ |
||||
|
public static List<Map<String, String>> getRecipeItems(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, WEIGHT_SHARE,"); |
||||
|
searchSql.append(" COMPONENT_SCRAP, SHRINKAGE_FACTOR"); |
||||
|
searchSql.append(" FROM IFSAPP.RECIPE_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: 查询 Recipe Item集合 |
||||
|
* @author LR |
||||
|
* @date 2024/12/13 9:48 |
||||
|
* @version 1.0 |
||||
|
*/ |
||||
|
public static List<RecipeIfsItem> getRecipeItems(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, WEIGHT_SHARE,"); |
||||
|
searchSql.append(" COMPONENT_SCRAP, SHRINKAGE_FACTOR"); |
||||
|
searchSql.append(" FROM IFSAPP.RECIPE_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 new ArrayList<>(); |
||||
|
} else { |
||||
|
List<RecipeIfsItem> 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); |
||||
|
RecipeIfsItem tempItem = new RecipeIfsItem(); |
||||
|
//设置参数 |
||||
|
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.setComponentScrap(tempMap.get("COMPONENT_SCRAP")); |
||||
|
tempItem.setShrinkageFactor(tempMap.get("SHRINKAGE_FACTOR")); |
||||
|
//添加对象 |
||||
|
resultItems.add(tempItem); |
||||
|
} |
||||
|
return resultItems; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* @description: 插入Recipe Item |
||||
|
* @author LR |
||||
|
* @date 2024/12/11 16:17 |
||||
|
* @version 1.0 |
||||
|
*/ |
||||
|
public static Map<String, String> insertRecipeItem(Server srv, RecipeIfsItem inData) throws APException { |
||||
|
//公共参数 |
||||
|
String contract = inData.getContract(); |
||||
|
String partNo = inData.getPartNo();// 物料编码 |
||||
|
String engChgLevel = inData.getEngChgLevel();// 版本 |
||||
|
String bomType = inData.getBomType();// 分类 |
||||
|
String alternativeNo = inData.getAlternativeNo(); |
||||
|
String lineItemNo = inData.getLineItemNo(); |
||||
|
String lineSequence = inData.getLineSequence(); |
||||
|
String componentPart = inData.getComponentPart();// |
||||
|
String weightShare = inData.getWeightShare(); |
||||
|
String partsByWeight = inData.getPartsByWeight(); |
||||
|
String qtyUom = inData.getQtyUom(); |
||||
|
String qtyPerAssembly = inData.getQtyPerAssembly(); |
||||
|
String componentScrap = inData.getComponentScrap(); |
||||
|
String issueType = inData.getIssueType(); |
||||
|
String issuePlannedScrapDb = inData.getIssuePlannedScrapDb(); |
||||
|
String issueOverreportedQtyDb = inData.getIssueOverreportedQtyDb(); |
||||
|
String fixedQtyFlag = inData.getFixedQtyFlag(); |
||||
|
String promisePlanned = inData.getPromisePlanned(); |
||||
|
String phantomConsume = inData.getPhantomConsume(); |
||||
|
String consumptionItem = inData.getConsumptionItem(); |
||||
|
String operCostDistribution = inData.getOperCostDistribution(); |
||||
|
String genOhCostDistribution = inData.getGenOhCostDistribution(); |
||||
|
String qtyKg = inData.getQtyKg(); |
||||
|
String byProdAsSupplyInMrpDb = inData.getByProdAsSupplyInMrpDb(); |
||||
|
String leadtimeOffset = inData.getLeadtimeOffset(); |
||||
|
String stdPlannedItem = inData.getStdPlannedItem(); |
||||
|
String chargedItem = inData.getChargedItem(); |
||||
|
String createDate = DateUtils.getStringDate(new Date(), "yyyy-MM-dd")+"-00.00.00"; |
||||
|
String lastActivityDate = DateUtils.getStringDate(new Date(), "yyyy-MM-dd")+"-00.00.00"; |
||||
|
String excludeFromCalculationsDb = inData.getExcludeFromCalculationsDb(); |
||||
|
String excludeFromAsBuiltDb = inData.getExcludeFromAsBuiltDb(); |
||||
|
String shrinkageFactor = inData.getShrinkageFactor(); |
||||
|
String lotBatchOriginDb = inData.getLotBatchOriginDb(); |
||||
|
//入参 |
||||
|
Map<String, String> inParam = new HashMap<>(); |
||||
|
//填充参数 |
||||
|
inParam.put("OBJID", ""); |
||||
|
inParam.put("OBJVERSION", ""); |
||||
|
inParam.put("CONTRACT", contract); // 域 |
||||
|
inParam.put("PART_NO", partNo); // 物料编码 |
||||
|
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", lineSequence); // 序号 |
||||
|
inParam.put("COMPONENT_PART", componentPart); // 子零件 |
||||
|
inParam.put("QTY_PER_ASSEMBLY", qtyPerAssembly); // 单位用量 |
||||
|
inParam.put("ISSUE_TYPE", issueType); // 域 |
||||
|
inParam.put("COMPONENT_SCRAP", componentScrap); // 报废 |
||||
|
inParam.put("WEIGHT_SHARE", weightShare); // 损耗率 |
||||
|
inParam.put("PARTS_BY_WEIGHT", partsByWeight); // 备注 |
||||
|
inParam.put("QTY_UOM", qtyUom); // |
||||
|
inParam.put("ISSUE_PLANNED_SCRAP_DB", issuePlannedScrapDb); // |
||||
|
inParam.put("ISSUE_OVERREPORTED_QTY_DB", issueOverreportedQtyDb); // |
||||
|
inParam.put("FIXED_QTY_FLAG", fixedQtyFlag); // |
||||
|
inParam.put("PROMISE_PLANNED", promisePlanned); // |
||||
|
inParam.put("PHANTOM_CONSUME", phantomConsume); // |
||||
|
inParam.put("CONSUMPTION_ITEM", consumptionItem); // |
||||
|
inParam.put("OPER_COST_DISTRIBUTION", operCostDistribution); // |
||||
|
inParam.put("GEN_OH_COST_DISTRIBUTION", genOhCostDistribution); // |
||||
|
inParam.put("QTY_KG", qtyKg); // |
||||
|
inParam.put("BY_PROD_AS_SUPPLY_IN_MRP_DB", byProdAsSupplyInMrpDb); // |
||||
|
inParam.put("LEADTIME_OFFSET", leadtimeOffset); // |
||||
|
inParam.put("STD_PLANNED_ITEM", stdPlannedItem); // 固定值 |
||||
|
inParam.put("CHARGED_ITEM", chargedItem); // |
||||
|
inParam.put("EXCLUDE_FROM_CALCULATIONS_DB", excludeFromCalculationsDb); // |
||||
|
inParam.put("EXCLUDE_FROM_AS_BUILT_DB", excludeFromAsBuiltDb); // |
||||
|
inParam.put("SHRINKAGE_FACTOR", shrinkageFactor); // |
||||
|
inParam.put("LOT_BATCH_ORIGIN_DB", lotBatchOriginDb); // |
||||
|
inParam.put("CREATE_DATE", createDate); // 创建时间 |
||||
|
inParam.put("LAST_ACTIVITY_DATE", lastActivityDate); // 最近更新时间 |
||||
|
|
||||
|
//执行check的操作 |
||||
|
Map<String, String> checkMap = IfsPlsqlUtils.execProcedureGetRecord(srv, "RECIPE_STRUCTURE_API", |
||||
|
"NEW__", PlsqlBaseMethodType.NEW, PlsqlBaseMethodAction.CHECK, inParam); |
||||
|
//执行do的操作 |
||||
|
Map<String, String> resultMap = IfsPlsqlUtils.execProcedureGetRecord(srv, "RECIPE_STRUCTURE_API", |
||||
|
"NEW__", PlsqlBaseMethodType.NEW, PlsqlBaseMethodAction.DO, inParam); |
||||
|
//返回结果集 |
||||
|
return resultMap; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* @description: 修改 Recipe Item |
||||
|
* @author LR |
||||
|
* @date 2024/12/11 16:22 |
||||
|
* @version 1.0 |
||||
|
*/ |
||||
|
public static Map<String, String> modifyRecipeItem(Server srv, RecipeIfsItem inData) throws APException { |
||||
|
//公共参数 |
||||
|
String ifsRowId = inData.getIfsRowId();// |
||||
|
String ifsRowVersion = inData.getIfsRowVersion();// |
||||
|
String lineItemNo = inData.getLineItemNo(); |
||||
|
String lineSequence = inData.getLineSequence(); |
||||
|
String componentPart = inData.getComponentPart();// |
||||
|
String weightShare = inData.getWeightShare(); |
||||
|
String partsByWeight = inData.getPartsByWeight(); |
||||
|
String qtyUom = inData.getQtyUom(); |
||||
|
String qtyPerAssembly = inData.getQtyPerAssembly(); |
||||
|
String componentScrap = inData.getComponentScrap(); |
||||
|
String issueType = inData.getIssueType(); |
||||
|
String issuePlannedScrapDb = inData.getIssuePlannedScrapDb(); |
||||
|
String issueOverreportedQtyDb = inData.getIssueOverreportedQtyDb(); |
||||
|
String fixedQtyFlag = inData.getFixedQtyFlag(); |
||||
|
String promisePlanned = inData.getPromisePlanned(); |
||||
|
String phantomConsume = inData.getPhantomConsume(); |
||||
|
String consumptionItem = inData.getConsumptionItem(); |
||||
|
String operCostDistribution = inData.getOperCostDistribution(); |
||||
|
String genOhCostDistribution = inData.getGenOhCostDistribution(); |
||||
|
String qtyKg = inData.getQtyKg(); |
||||
|
String byProdAsSupplyInMrpDb = inData.getByProdAsSupplyInMrpDb(); |
||||
|
String leadtimeOffset = inData.getLeadtimeOffset(); |
||||
|
String stdPlannedItem = inData.getStdPlannedItem(); |
||||
|
String chargedItem = inData.getChargedItem(); |
||||
|
String lastActivityDate = DateUtils.getStringDate(new Date(), "yyyy-MM-dd")+"-00.00.00"; |
||||
|
String excludeFromCalculationsDb = inData.getExcludeFromCalculationsDb(); |
||||
|
String excludeFromAsBuiltDb = inData.getExcludeFromAsBuiltDb(); |
||||
|
String shrinkageFactor = inData.getShrinkageFactor(); |
||||
|
String lotBatchOriginDb = inData.getLotBatchOriginDb(); |
||||
|
//入参 |
||||
|
Map<String, String> inParam = new HashMap<>(); |
||||
|
//填充参数 |
||||
|
inParam.put("OBJID", ifsRowId); |
||||
|
inParam.put("OBJVERSION", ifsRowVersion); |
||||
|
inParam.put("LINE_ITEM_NO", lineItemNo); // 行号 |
||||
|
inParam.put("LINE_SEQUENCE", lineSequence); // 序号 |
||||
|
inParam.put("COMPONENT_PART", componentPart); // 子零件 |
||||
|
inParam.put("QTY_PER_ASSEMBLY", qtyPerAssembly); // 单位用量 |
||||
|
inParam.put("ISSUE_TYPE", issueType); // 域 |
||||
|
inParam.put("COMPONENT_SCRAP", componentScrap); // 报废 |
||||
|
inParam.put("WEIGHT_SHARE", weightShare); // 损耗率 |
||||
|
inParam.put("PARTS_BY_WEIGHT", partsByWeight); // 备注 |
||||
|
inParam.put("QTY_UOM", qtyUom); // |
||||
|
inParam.put("ISSUE_PLANNED_SCRAP_DB", issuePlannedScrapDb); // |
||||
|
inParam.put("ISSUE_OVERREPORTED_QTY_DB", issueOverreportedQtyDb); // |
||||
|
inParam.put("FIXED_QTY_FLAG", fixedQtyFlag); // |
||||
|
inParam.put("PROMISE_PLANNED", promisePlanned); // |
||||
|
inParam.put("PHANTOM_CONSUME", phantomConsume); // |
||||
|
inParam.put("CONSUMPTION_ITEM", consumptionItem); // |
||||
|
inParam.put("OPER_COST_DISTRIBUTION", operCostDistribution); // |
||||
|
inParam.put("GEN_OH_COST_DISTRIBUTION", genOhCostDistribution); // |
||||
|
inParam.put("QTY_KG", qtyKg); // |
||||
|
inParam.put("BY_PROD_AS_SUPPLY_IN_MRP_DB", byProdAsSupplyInMrpDb); // |
||||
|
inParam.put("LEADTIME_OFFSET", leadtimeOffset); // |
||||
|
inParam.put("STD_PLANNED_ITEM", stdPlannedItem); // 固定值 |
||||
|
inParam.put("CHARGED_ITEM", chargedItem); // |
||||
|
inParam.put("EXCLUDE_FROM_CALCULATIONS_DB", excludeFromCalculationsDb); // |
||||
|
inParam.put("EXCLUDE_FROM_AS_BUILT_DB", excludeFromAsBuiltDb); // |
||||
|
inParam.put("SHRINKAGE_FACTOR", shrinkageFactor); // |
||||
|
inParam.put("LOT_BATCH_ORIGIN_DB", lotBatchOriginDb); // |
||||
|
inParam.put("LAST_ACTIVITY_DATE", lastActivityDate); // 最近更新时间 |
||||
|
|
||||
|
//执行check的操作 |
||||
|
Map<String, String> checkMap = IfsPlsqlUtils.execProcedureGetRecord(srv, "RECIPE_STRUCTURE_API", |
||||
|
"MODIFY__", PlsqlBaseMethodType.MODIFY, PlsqlBaseMethodAction.CHECK, inParam); |
||||
|
//执行do的操作 |
||||
|
Map<String, String> resultMap = IfsPlsqlUtils.execProcedureGetRecord(srv, "RECIPE_STRUCTURE_API", |
||||
|
"MODIFY__", PlsqlBaseMethodType.MODIFY, PlsqlBaseMethodAction.DO, inParam); |
||||
|
//返回结果集 |
||||
|
return resultMap; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* @description: 删除 Recipe Item |
||||
|
* @author LR |
||||
|
* @date 2024/12/11 16:24 |
||||
|
* @version 1.0 |
||||
|
*/ |
||||
|
public static void removeRecipeItem(Server srv, RecipeIfsItem 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, "RECIPE_STRUCTURE_API", |
||||
|
"REMOVE__", PlsqlBaseMethodType.REMOVE, PlsqlBaseMethodAction.CHECK, inParam); |
||||
|
//执行do的操作 |
||||
|
Map<String, String> resultMap = IfsPlsqlUtils.execProcedureGetRecord(srv, "RECIPE_STRUCTURE_API", |
||||
|
"REMOVE__", PlsqlBaseMethodType.REMOVE, PlsqlBaseMethodAction.DO, inParam); |
||||
|
} |
||||
|
|
||||
|
} |
||||
@ -0,0 +1,684 @@ |
|||||
|
package com.spring.ifs.bean; |
||||
|
|
||||
|
import com.alibaba.fastjson.JSON; |
||||
|
import com.spring.ifs.api.IfsServer; |
||||
|
import com.spring.ifs.api.RecipeApi; |
||||
|
import com.spring.modules.part.entity.APIEntity.RecipeIfsAlternative; |
||||
|
import com.spring.modules.part.entity.APIEntity.RecipeIfsHeader; |
||||
|
import com.spring.modules.part.entity.APIEntity.RecipeIfsItem; |
||||
|
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.HashMap; |
||||
|
import java.util.List; |
||||
|
import java.util.Map; |
||||
|
import java.util.function.Function; |
||||
|
import java.util.stream.Collectors; |
||||
|
|
||||
|
/** |
||||
|
* @description: 处理配方的 |
||||
|
* @author LR |
||||
|
* @date 2024/12/9 15:44 |
||||
|
* @version 1.0 |
||||
|
*/ |
||||
|
@Component |
||||
|
public class RecipeServiceBeanTest { |
||||
|
|
||||
|
@Autowired |
||||
|
private IfsServer ifsServer; |
||||
|
|
||||
|
private static final Logger logger = LoggerFactory.getLogger(RecipeServiceBeanTest.class); |
||||
|
|
||||
|
/** |
||||
|
* @description: 查询Recipe Header |
||||
|
* @author LR |
||||
|
* @date 2024/12/12 15:49 |
||||
|
* @version 1.0 |
||||
|
*/ |
||||
|
public Map<String, String> getRecipeHeader(RecipeIfsHeader inData) { |
||||
|
logger.info("Recipe查询参数:"+JSON.toJSONString(inData)); |
||||
|
//查询的参数 |
||||
|
Map<String, String> returnMap = new HashMap<>(); |
||||
|
String username = inData.getIfsUsername(); |
||||
|
String password = inData.getIfsPassword(); |
||||
|
String contract = inData.getContract(); |
||||
|
String partNo = inData.getPartNo(); |
||||
|
String engChgLevel = inData.getEngChgLevel(); |
||||
|
String bomType = inData.getBomType(); |
||||
|
try{ |
||||
|
//获取连接 |
||||
|
Server srv = ifsServer.getIfsServer(username, password); |
||||
|
//查询数据 |
||||
|
Map<String, String> RecipeMap = RecipeApi.getRecipeHeader(srv, contract, partNo, engChgLevel, bomType); |
||||
|
//判断是否需要插入到ifs |
||||
|
if(RecipeMap == null || RecipeMap.size() == 0) { |
||||
|
throw new RuntimeException("Recipe不存在!"); |
||||
|
} |
||||
|
//设置ifs 信息 |
||||
|
inData.setIfsRowId(RecipeMap.get("IFSROWID")); |
||||
|
inData.setIfsRowVersion(RecipeMap.get("IFSROWVERSION")); |
||||
|
returnMap.put("resultCode", "200"); |
||||
|
returnMap.put("obj", JSON.toJSONString(inData)); |
||||
|
} catch(APException e){ |
||||
|
returnMap.put("resultCode", "400"); |
||||
|
returnMap.put("resultMsg", e.getMessage()); |
||||
|
} |
||||
|
//打印日志 |
||||
|
logger.info("Recipe查询:"+JSON.toJSONString(inData)); |
||||
|
//返回结果集 |
||||
|
return returnMap; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* @description: Recipe Header新增 |
||||
|
* @author LR |
||||
|
* @date 2024/12/12 15:52 |
||||
|
* @version 1.0 |
||||
|
*/ |
||||
|
public Map<String, String> syncRecipeHeader(RecipeIfsHeader inData) { |
||||
|
logger.info("Recipe新增开始:"+JSON.toJSONString(inData)); |
||||
|
//查询的参数 |
||||
|
Map<String, String> returnMap = new HashMap<>(); |
||||
|
String username = inData.getIfsUsername(); |
||||
|
String password = inData.getIfsPassword(); |
||||
|
String contract = inData.getContract(); |
||||
|
String partNo = inData.getPartNo(); |
||||
|
String engChgLevel = inData.getEngChgLevel(); |
||||
|
String bomType = inData.getBomType(); |
||||
|
try{ |
||||
|
//获取连接 |
||||
|
Server srv = ifsServer.getIfsServer(username, password); |
||||
|
//查询数据 |
||||
|
Map<String, String> RecipeMap = RecipeApi.getRecipeHeader(srv, contract, partNo, engChgLevel, bomType); |
||||
|
//判断是否需要插入到ifs |
||||
|
if(RecipeMap != null && RecipeMap.size() > 0) { |
||||
|
throw new APException("Recipe已存在!"); |
||||
|
} |
||||
|
|
||||
|
//调用api |
||||
|
Map<String, String> resultMap = RecipeApi.insertRecipeHeader(srv, inData); |
||||
|
//设置版本的信息 |
||||
|
inData.setIfsRowId(resultMap.get("OBJID")); |
||||
|
inData.setIfsRowVersion(resultMap.get("OBJVERSION")); |
||||
|
returnMap.put("resultCode", "200"); |
||||
|
returnMap.put("obj", JSON.toJSONString(inData)); |
||||
|
} catch(APException e){ |
||||
|
returnMap.put("resultCode", "400"); |
||||
|
returnMap.put("resultMsg", e.getMessage()); |
||||
|
} |
||||
|
//打印日志 |
||||
|
logger.info("Recipe新增结束:"+JSON.toJSONString(inData)); |
||||
|
//返回结果集 |
||||
|
return returnMap; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* @description: Recipe Header修改 |
||||
|
* @author LR |
||||
|
* @date 2024/12/12 15:55 |
||||
|
* @version 1.0 |
||||
|
*/ |
||||
|
public Map<String, String> modifyRecipeHeader(RecipeIfsHeader inData) { |
||||
|
logger.info("Recipe修改开始:"+JSON.toJSONString(inData)); |
||||
|
//查询的参数 |
||||
|
Map<String, String> returnMap = new HashMap<>(); |
||||
|
String username = inData.getIfsUsername(); |
||||
|
String password = inData.getIfsPassword(); |
||||
|
String contract = inData.getContract(); |
||||
|
String partNo = inData.getPartNo(); |
||||
|
String engChgLevel = inData.getEngChgLevel(); |
||||
|
String bomType = inData.getBomType(); |
||||
|
try{ |
||||
|
//获取连接 |
||||
|
Server srv = ifsServer.getIfsServer(username, password); |
||||
|
//查询数据 |
||||
|
Map<String, String> RecipeMap = RecipeApi.getRecipeHeader(srv, contract, partNo, engChgLevel, bomType); |
||||
|
//判断是否需要插入到ifs |
||||
|
if(RecipeMap == null || RecipeMap.size() == 0) { |
||||
|
throw new APException("Recipe不存在!"); |
||||
|
} |
||||
|
//设置ifs 信息 |
||||
|
inData.setIfsRowId(RecipeMap.get("IFSROWID")); |
||||
|
inData.setIfsRowVersion(RecipeMap.get("IFSROWVERSION")); |
||||
|
Map<String, String> resultMap = RecipeApi.modifyRecipeHeader(srv, inData); |
||||
|
//设置ifs 信息 |
||||
|
inData.setIfsRowVersion(resultMap.get("OBJVERSION")); |
||||
|
returnMap.put("resultCode", "200"); |
||||
|
returnMap.put("obj", JSON.toJSONString(inData)); |
||||
|
} catch(APException e){ |
||||
|
returnMap.put("resultCode", "400"); |
||||
|
returnMap.put("resultMsg", e.getMessage()); |
||||
|
} |
||||
|
//打印日志 |
||||
|
logger.info("Recipe修改结束:"+JSON.toJSONString(inData)); |
||||
|
//返回结果集 |
||||
|
return returnMap; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* @description: Recipe Header删除 |
||||
|
* @author LR |
||||
|
* @date 2024/12/12 15:58 |
||||
|
* @version 1.0 |
||||
|
*/ |
||||
|
public Map<String, String> removeRecipeHeader(RecipeIfsHeader inData) { |
||||
|
logger.info("Recipe Header删除开始:"+JSON.toJSONString(inData)); |
||||
|
//查询的参数 |
||||
|
Map<String, String> returnMap = new HashMap<>(); |
||||
|
String username = inData.getIfsUsername(); |
||||
|
String password = inData.getIfsPassword(); |
||||
|
String contract = inData.getContract(); |
||||
|
String partNo = inData.getPartNo(); |
||||
|
String engChgLevel = inData.getEngChgLevel(); |
||||
|
String bomType = inData.getBomType(); |
||||
|
try{ |
||||
|
//获取连接 |
||||
|
Server srv = ifsServer.getIfsServer(username, password); |
||||
|
//查询数据 |
||||
|
Map<String, String> RecipeMap = RecipeApi.getRecipeHeader(srv, contract, partNo, engChgLevel, bomType); |
||||
|
//判断是否需要插入到ifs |
||||
|
if(RecipeMap == null || RecipeMap.size() == 0) { |
||||
|
throw new APException("Recipe不存在!"); |
||||
|
} |
||||
|
//设置ifs 信息 |
||||
|
inData.setIfsRowId(RecipeMap.get("IFSROWID")); |
||||
|
inData.setIfsRowVersion(RecipeMap.get("IFSROWVERSION")); |
||||
|
RecipeApi.removeRecipeHeader(srv, inData); |
||||
|
returnMap.put("resultCode", "200"); |
||||
|
returnMap.put("obj", JSON.toJSONString(inData)); |
||||
|
} catch(APException e){ |
||||
|
returnMap.put("resultCode", "400"); |
||||
|
returnMap.put("resultMsg", e.getMessage()); |
||||
|
} |
||||
|
//打印日志 |
||||
|
logger.info("Recipe Header 删除结束:"+JSON.toJSONString(inData)); |
||||
|
//返回结果集 |
||||
|
return returnMap; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* @description: 查询Recipe Alternative |
||||
|
* @author LR |
||||
|
* @date 2024/12/12 16:59 |
||||
|
* @version 1.0 |
||||
|
*/ |
||||
|
public Map<String, String> getRecipeAlternative( RecipeIfsAlternative inData) { |
||||
|
logger.info("Recipe Alternative 查询开始:"+JSON.toJSONString(inData)); |
||||
|
//公共参数 |
||||
|
Map<String, String> returnMap = new HashMap<>(); |
||||
|
String username = inData.getIfsUsername(); |
||||
|
String password = inData.getIfsPassword(); |
||||
|
String contract = inData.getContract(); |
||||
|
String partNo = inData.getPartNo(); |
||||
|
String engChgLevel = inData.getEngChgLevel(); |
||||
|
String bomType = inData.getBomType(); |
||||
|
String alternativeNo = inData.getAlternativeNo(); |
||||
|
try{ |
||||
|
//获取连接 |
||||
|
Server srv = ifsServer.getIfsServer(username, password); |
||||
|
//查询数据 |
||||
|
Map<String, String> alternativeMap = RecipeApi.getRecipeAlternative(srv, contract, partNo, engChgLevel, bomType, alternativeNo); |
||||
|
//判断是否需要插入到ifs |
||||
|
if(alternativeMap == null) { |
||||
|
throw new APException("Recipe Alternative 不存在!"); |
||||
|
} |
||||
|
//设置ifs 信息 |
||||
|
inData.setIfsRowId(alternativeMap.get("IFSROWID")); |
||||
|
inData.setIfsRowVersion(alternativeMap.get("IFSROWVERSION")); |
||||
|
returnMap.put("resultCode", "200"); |
||||
|
returnMap.put("obj", JSON.toJSONString(inData)); |
||||
|
} catch(APException e){ |
||||
|
returnMap.put("resultCode", "400"); |
||||
|
returnMap.put("resultMsg", e.getMessage()); |
||||
|
} |
||||
|
//打印日志 |
||||
|
logger.info("Recipe Alternative 查询结束:"+JSON.toJSONString(inData)); |
||||
|
//返回结果集 |
||||
|
return returnMap; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* @description: 插入Recipe Alternative |
||||
|
* @author LR |
||||
|
* @date 2024/12/12 17:03 |
||||
|
* @version 1.0 |
||||
|
*/ |
||||
|
public Map<String, String> syncRecipeAlternative( RecipeIfsAlternative inData) { |
||||
|
logger.info("Recipe Alternative 新增开始:"+JSON.toJSONString(inData)); |
||||
|
//公共参数 |
||||
|
Map<String, String> returnMap = new HashMap<>(); |
||||
|
String username = inData.getIfsUsername(); |
||||
|
String password = inData.getIfsPassword(); |
||||
|
String contract = inData.getContract(); |
||||
|
String partNo = inData.getPartNo(); |
||||
|
String engChgLevel = inData.getEngChgLevel(); |
||||
|
String bomType = inData.getBomType(); |
||||
|
String alternativeNo = inData.getAlternativeNo(); |
||||
|
try{ |
||||
|
//获取连接 |
||||
|
Server srv = ifsServer.getIfsServer(username, password); |
||||
|
//查询数据 |
||||
|
Map<String, String> alternativeMap = RecipeApi.getRecipeAlternative(srv, contract, partNo, engChgLevel, bomType, alternativeNo); |
||||
|
//判断是否需要插入到ifs |
||||
|
if(alternativeMap != null && alternativeMap.size() > 0) { |
||||
|
throw new APException("Recipe Alternative 已存在!"); |
||||
|
} |
||||
|
|
||||
|
//调用新增api |
||||
|
Map<String, String> resultMap = RecipeApi.insertRecipeAlternative(srv, inData); |
||||
|
//设置ifs 信息 |
||||
|
inData.setIfsRowId(resultMap.get("OBJID")); |
||||
|
inData.setIfsRowVersion(resultMap.get("OBJVERSION")); |
||||
|
returnMap.put("resultCode", "200"); |
||||
|
returnMap.put("obj", JSON.toJSONString(resultMap)); |
||||
|
} catch(APException e){ |
||||
|
returnMap.put("resultCode", "400"); |
||||
|
returnMap.put("resultMsg", e.getMessage()); |
||||
|
} |
||||
|
//打印日志 |
||||
|
logger.info("Recipe Alternative 新增结束:"+JSON.toJSONString(inData)); |
||||
|
//返回结果集 |
||||
|
return returnMap; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* @description: 修改Recipe Alternative |
||||
|
* @author LR |
||||
|
* @date 2024/12/12 17:06 |
||||
|
* @version 1.0 |
||||
|
*/ |
||||
|
public Map<String, String> modifyRecipeAlternative( RecipeIfsAlternative inData) { |
||||
|
logger.info("Recipe Alternative 修改开始:"+JSON.toJSONString(inData)); |
||||
|
//公共参数 |
||||
|
Map<String, String> returnMap = new HashMap<>(); |
||||
|
String username = inData.getIfsUsername(); |
||||
|
String password = inData.getIfsPassword(); |
||||
|
String contract = inData.getContract(); |
||||
|
String partNo = inData.getPartNo(); |
||||
|
String engChgLevel = inData.getEngChgLevel(); |
||||
|
String bomType = inData.getBomType(); |
||||
|
String alternativeNo = inData.getAlternativeNo(); |
||||
|
try{ |
||||
|
//获取连接 |
||||
|
Server srv = ifsServer.getIfsServer(username, password); |
||||
|
//查询数据 |
||||
|
Map<String, String> alternativeMap = RecipeApi.getRecipeAlternative(srv, contract, partNo, engChgLevel, bomType, alternativeNo); |
||||
|
//判断是否需要插入到ifs |
||||
|
if(alternativeMap == null || alternativeMap.size() == 0) { |
||||
|
throw new APException("Recipe Alternative不存在!"); |
||||
|
} |
||||
|
//设置ifs 信息 |
||||
|
inData.setIfsRowId(alternativeMap.get("IFSROWID")); |
||||
|
inData.setIfsRowVersion(alternativeMap.get("IFSROWVERSION")); |
||||
|
inData.setStdSizeKg(inData.getStdSizeKg()); |
||||
|
//调用api |
||||
|
Map<String, String> resultMap = RecipeApi.modifyRecipeAlternative(srv, inData); |
||||
|
//设置ifs 信息 |
||||
|
inData.setIfsRowVersion(resultMap.get("OBJVERSION")); |
||||
|
returnMap.put("resultCode", "200"); |
||||
|
returnMap.put("obj", JSON.toJSONString(inData)); |
||||
|
} catch(APException e){ |
||||
|
returnMap.put("resultCode", "400"); |
||||
|
returnMap.put("resultMsg", e.getMessage()); |
||||
|
} |
||||
|
//打印日志 |
||||
|
logger.info("Recipe Alternative 修改结束:"+JSON.toJSONString(inData)); |
||||
|
//返回结果集 |
||||
|
return returnMap; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* @description: 删除Recipe Alternative |
||||
|
* @author LR |
||||
|
* @date 2024/12/12 17:07 |
||||
|
* @version 1.0 |
||||
|
*/ |
||||
|
public Map<String, String> removeRecipeAlternative( RecipeIfsAlternative inData) { |
||||
|
logger.info("Recipe Alternative 删除开始:"+JSON.toJSONString(inData)); |
||||
|
//公共参数 |
||||
|
Map<String, String> returnMap = new HashMap<>(); |
||||
|
String username = inData.getIfsUsername(); |
||||
|
String password = inData.getIfsPassword(); |
||||
|
String contract = inData.getContract(); |
||||
|
String partNo = inData.getPartNo(); |
||||
|
String engChgLevel = inData.getEngChgLevel(); |
||||
|
String bomType = inData.getBomType(); |
||||
|
String alternativeNo = inData.getAlternativeNo(); |
||||
|
try{ |
||||
|
//获取连接 |
||||
|
Server srv = ifsServer.getIfsServer(username, password); |
||||
|
//查询数据 |
||||
|
Map<String, String> alternativeMap = RecipeApi.getRecipeAlternative(srv, contract, partNo, engChgLevel, bomType, alternativeNo); |
||||
|
//判断是否需要插入到ifs |
||||
|
if(alternativeMap == null || alternativeMap.size() == 0) { |
||||
|
throw new APException("Recipe Alternative不存在!"); |
||||
|
} |
||||
|
//设置ifs 信息 |
||||
|
inData.setIfsRowId(alternativeMap.get("IFSROWID")); |
||||
|
inData.setIfsRowVersion(alternativeMap.get("IFSROWVERSION")); |
||||
|
//调用api |
||||
|
RecipeApi.removeRecipeAlternative(srv, inData); |
||||
|
returnMap.put("resultCode", "200"); |
||||
|
returnMap.put("obj", JSON.toJSONString(inData)); |
||||
|
} catch(APException e){ |
||||
|
returnMap.put("resultCode", "400"); |
||||
|
returnMap.put("resultMsg", e.getMessage()); |
||||
|
} |
||||
|
//打印日志 |
||||
|
logger.info("Recipe Alternative 删除结束:"+JSON.toJSONString(inData)); |
||||
|
//返回结果集 |
||||
|
return returnMap; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* @description: Build Recipe Alternative |
||||
|
* @author LR |
||||
|
* @date 2024/12/13 9:37 |
||||
|
* @version 1.0 |
||||
|
*/ |
||||
|
public Map<String, String> buildRecipeAlternative( RecipeIfsAlternative inData) { |
||||
|
logger.info("Recipe替代Build开始:"+JSON.toJSONString(inData)); |
||||
|
//公共参数 |
||||
|
Map<String, String> returnMap = new HashMap<>(); |
||||
|
String username = inData.getIfsUsername(); |
||||
|
String password = inData.getIfsPassword(); |
||||
|
String contract = inData.getContract(); |
||||
|
String partNo = inData.getPartNo(); |
||||
|
String engChgLevel = inData.getEngChgLevel(); |
||||
|
String bomType = inData.getBomType(); |
||||
|
String alternativeNo = inData.getAlternativeNo(); |
||||
|
try{ |
||||
|
//获取连接 |
||||
|
Server srv = ifsServer.getIfsServer(username, password); |
||||
|
//查询数据 |
||||
|
Map<String, String> alternativeMap = RecipeApi.getRecipeAlternative(srv, contract, partNo, engChgLevel, bomType, alternativeNo); |
||||
|
//判断是否需要插入到ifs |
||||
|
if(alternativeMap == null || alternativeMap.size() == 0) { |
||||
|
throw new APException("Recipe Alternative不存在!"); |
||||
|
} |
||||
|
//设置ifs 信息 |
||||
|
inData.setIfsRowId(alternativeMap.get("IFSROWID")); |
||||
|
inData.setIfsRowVersion(alternativeMap.get("IFSROWVERSION")); |
||||
|
//调用删除方法 |
||||
|
Map<String, String> resultMap = RecipeApi.buildRecipeAlternative(srv, inData); |
||||
|
//设置ifs 信息 |
||||
|
inData.setIfsRowVersion(resultMap.get("OBJVERSION")); |
||||
|
returnMap.put("resultCode", "200"); |
||||
|
returnMap.put("obj", JSON.toJSONString(inData)); |
||||
|
} catch(APException e){ |
||||
|
returnMap.put("resultCode", "400"); |
||||
|
returnMap.put("resultMsg", e.getMessage()); |
||||
|
} |
||||
|
//打印日志 |
||||
|
logger.info("Recipe替代Build结束:"+JSON.toJSONString(inData)); |
||||
|
//返回结果集 |
||||
|
return returnMap; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* @description: Retire Recipe Alternative |
||||
|
* @author LR |
||||
|
* @date 2024/12/13 9:40 |
||||
|
* @version 1.0 |
||||
|
*/ |
||||
|
public Map<String, String> retireRecipeAlternative( RecipeIfsAlternative inData) { |
||||
|
logger.info("Recipe替代retire开始:"+JSON.toJSONString(inData)); |
||||
|
//公共参数 |
||||
|
Map<String, String> returnMap = new HashMap<>(); |
||||
|
String username = inData.getIfsUsername(); |
||||
|
String password = inData.getIfsPassword(); |
||||
|
String contract = inData.getContract(); |
||||
|
String partNo = inData.getPartNo(); |
||||
|
String engChgLevel = inData.getEngChgLevel(); |
||||
|
String bomType = inData.getBomType(); |
||||
|
String alternativeNo = inData.getAlternativeNo(); |
||||
|
try{ |
||||
|
//获取连接 |
||||
|
Server srv = ifsServer.getIfsServer(username, password); |
||||
|
//查询数据 |
||||
|
Map<String, String> alternativeMap = RecipeApi.getRecipeAlternative(srv, contract, partNo, engChgLevel, bomType, alternativeNo); |
||||
|
//判断是否需要插入到ifs |
||||
|
if(alternativeMap == null || alternativeMap.size() == 0) { |
||||
|
throw new APException("Recipe Alternative不存在!"); |
||||
|
} |
||||
|
//设置ifs 信息 |
||||
|
inData.setIfsRowId(alternativeMap.get("IFSROWID")); |
||||
|
inData.setIfsRowVersion(alternativeMap.get("IFSROWVERSION")); |
||||
|
//调用删除方法 |
||||
|
Map<String, String> resultMap = RecipeApi.retireRecipeAlternative(srv, inData); |
||||
|
//设置ifs 信息 |
||||
|
inData.setIfsRowVersion(resultMap.get("IFSROWVERSION")); |
||||
|
returnMap.put("resultCode", "200"); |
||||
|
returnMap.put("obj", JSON.toJSONString(inData)); |
||||
|
} catch(APException e){ |
||||
|
returnMap.put("resultCode", "400"); |
||||
|
returnMap.put("resultMsg", e.getMessage()); |
||||
|
} |
||||
|
//打印日志 |
||||
|
logger.info("Recipe替代retire开始:"+JSON.toJSONString(inData)); |
||||
|
//返回结果集 |
||||
|
return returnMap; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* @description: 获取Recipe 的明细 |
||||
|
* @author LR |
||||
|
* @date 2024/12/13 9:53 |
||||
|
* @version 1.0 |
||||
|
*/ |
||||
|
public Map<String, String> getRecipeItems(RecipeIfsItem inData) { |
||||
|
//公共参数 |
||||
|
Map<String, String> returnMap = new HashMap<>(); |
||||
|
String username = inData.getIfsUsername(); |
||||
|
String password = inData.getIfsPassword(); |
||||
|
String contract = inData.getContract(); |
||||
|
String partNo = inData.getPartNo(); |
||||
|
String engChgLevel = inData.getEngChgLevel(); |
||||
|
String bomType = inData.getBomType(); |
||||
|
String alternativeNo = inData.getAlternativeNo(); |
||||
|
String lineItemNo = inData.getLineItemNo(); |
||||
|
try{ |
||||
|
//获取连接 |
||||
|
Server srv = ifsServer.getIfsServer(username, password); |
||||
|
//查询数据 |
||||
|
Map<String, String> alternativeMap = RecipeApi.getRecipeAlternative(srv, contract, partNo, engChgLevel, bomType, alternativeNo); |
||||
|
//判断是否需要插入到ifs |
||||
|
if(alternativeMap == null || alternativeMap.size() == 0) { |
||||
|
throw new APException("Recipe Alternative不存在!"); |
||||
|
} |
||||
|
//查询结果集 |
||||
|
List<RecipeIfsItem> resultList = RecipeApi.getRecipeItems(srv, contract, partNo, engChgLevel, bomType, alternativeNo, lineItemNo); |
||||
|
//判断是否查询数据 |
||||
|
if(resultList == null ||resultList.size() == 0 || resultList.isEmpty()) { |
||||
|
throw new APException("不存在此查Recipe组件信息!"); |
||||
|
} |
||||
|
returnMap.put("resultCode", "200"); |
||||
|
returnMap.put("obj", JSON.toJSONString(resultList)); |
||||
|
} catch(APException e){ |
||||
|
returnMap.put("resultCode", "400"); |
||||
|
returnMap.put("resultMsg", e.getMessage()); |
||||
|
} |
||||
|
//打印日志 |
||||
|
logger.info("Recipe替代明细集合结束:"+JSON.toJSONString(inData)); |
||||
|
//返回结果集 |
||||
|
return returnMap; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* @description: 批量新增查Recipe Item |
||||
|
* @author LR |
||||
|
* @date 2024/12/12 17:23 |
||||
|
* @version 1.0 |
||||
|
*/ |
||||
|
public Map<String, String> syncRecipeItems(List<RecipeIfsItem> inDatas) { |
||||
|
logger.info("Recipe替代明细集合新增开始:"+JSON.toJSONString(inDatas)); |
||||
|
//公共参数 |
||||
|
Map<String, String> returnMap = new HashMap<>(); |
||||
|
String username = inDatas.get(0).getIfsUsername(); |
||||
|
String password = inDatas.get(0).getIfsPassword(); |
||||
|
String contract = inDatas.get(0).getContract(); |
||||
|
String partNo = inDatas.get(0).getPartNo(); |
||||
|
String engChgLevel = inDatas.get(0).getEngChgLevel(); |
||||
|
String bomType = inDatas.get(0).getBomType(); |
||||
|
String alternativeNo = inDatas.get(0).getAlternativeNo(); |
||||
|
String lineItemNo = inDatas.get(0).getLineItemNo(); |
||||
|
try{ |
||||
|
//获取连接 |
||||
|
Server srv = ifsServer.getIfsServer(username, password); |
||||
|
//查询数据 |
||||
|
Map<String, String> alternativeMap = RecipeApi.getRecipeAlternative(srv, contract, partNo, engChgLevel, bomType, alternativeNo); |
||||
|
//判断是否需要插入到ifs |
||||
|
if(alternativeMap == null || alternativeMap.size() == 0) { |
||||
|
throw new APException("Recipe Alternative不存在!"); |
||||
|
} |
||||
|
//查询结果集 |
||||
|
List<RecipeIfsItem> itemList = RecipeApi.getRecipeItems(srv, contract, partNo, engChgLevel, bomType, alternativeNo, null); |
||||
|
//转Map |
||||
|
Map<String, String> itemMap = itemList.stream().collect(Collectors.toMap(RecipeIfsItem::getLineItemNo, RecipeIfsItem::getLineItemNo)); |
||||
|
//打印日志 |
||||
|
logger.info("Recipe替代明细集合 批量新增结束:"+JSON.toJSONString(inDatas)); |
||||
|
//循环判断的方法 |
||||
|
for(RecipeIfsItem recipeItem : inDatas) { |
||||
|
//判断是否已经存在 |
||||
|
String tempLineItemNo = recipeItem.getLineItemNo(); |
||||
|
if(itemMap.containsKey(tempLineItemNo)) { |
||||
|
throw new APException("已存在此bom组件信息!LineItemNo:"+tempLineItemNo); |
||||
|
} |
||||
|
} |
||||
|
// 校验通过 循环调用新增的方法 |
||||
|
for(RecipeIfsItem recipeItem : inDatas) { |
||||
|
//调用api |
||||
|
Map<String, String> tempMap = RecipeApi.insertRecipeItem(srv, recipeItem); |
||||
|
//设置ifs 信息 |
||||
|
recipeItem.setIfsRowId(tempMap.get("OBJID")); |
||||
|
recipeItem.setIfsRowVersion(tempMap.get("OBJVERSION")); |
||||
|
} |
||||
|
returnMap.put("resultCode", "200"); |
||||
|
returnMap.put("obj", JSON.toJSONString(inDatas)); |
||||
|
} catch(APException e){ |
||||
|
returnMap.put("resultCode", "400"); |
||||
|
returnMap.put("resultMsg", e.getMessage()); |
||||
|
} |
||||
|
//打印日志 |
||||
|
logger.info("Recipe替代明细集合新增开始:"+JSON.toJSONString(inDatas)); |
||||
|
//返回结果集 |
||||
|
return returnMap; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* @description: 修改查Recipe的明细 |
||||
|
* @author LR |
||||
|
* @date 2024/12/13 10:24 |
||||
|
* @version 1.0 |
||||
|
*/ |
||||
|
public Map<String, String> modifyRecipeItem(RecipeIfsItem inData) { |
||||
|
logger.info("Recipe替代明细新增开始:"+JSON.toJSONString(inData)); |
||||
|
// 公共参数 |
||||
|
Map<String, String> returnMap = new HashMap<>(); |
||||
|
String username = inData.getIfsUsername(); |
||||
|
String password = inData.getIfsPassword(); |
||||
|
String contract = inData.getContract(); |
||||
|
String partNo = inData.getPartNo(); |
||||
|
String engChgLevel = inData.getEngChgLevel(); |
||||
|
String bomType = inData.getBomType(); |
||||
|
String alternativeNo = inData.getAlternativeNo(); |
||||
|
String lineItemNo = inData.getLineItemNo(); |
||||
|
try{ |
||||
|
//获取连接 |
||||
|
Server srv = ifsServer.getIfsServer(username, password); |
||||
|
//查询数据 |
||||
|
Map<String, String> alternativeMap = RecipeApi.getRecipeAlternative(srv, contract, partNo, engChgLevel, bomType, alternativeNo); |
||||
|
//判断是否需要插入到ifs |
||||
|
if(alternativeMap == null || alternativeMap.size() == 0) { |
||||
|
throw new APException("Recipe Alternative不存在!"); |
||||
|
} |
||||
|
//查询结果集 |
||||
|
List<RecipeIfsItem> resultList = RecipeApi.getRecipeItems(srv, contract, partNo, engChgLevel, bomType, alternativeNo, lineItemNo); |
||||
|
//判断是否查询数据 |
||||
|
if(resultList.size() == 0 || resultList.isEmpty()) { |
||||
|
throw new APException("不存在此Recipe组件信息!"); |
||||
|
} |
||||
|
|
||||
|
RecipeIfsItem recipeItem = resultList.get(0); |
||||
|
//设置版本信息 |
||||
|
inData.setIfsRowId(recipeItem.getIfsRowId()); |
||||
|
inData.setIfsRowVersion(recipeItem.getIfsRowVersion()); |
||||
|
//调用修改的方法 |
||||
|
Map<String, String> resultMap = RecipeApi.modifyRecipeItem(srv, inData); |
||||
|
//设置ifs 信息 |
||||
|
recipeItem.setIfsRowId(resultMap.get("OBJID")); |
||||
|
recipeItem.setIfsRowVersion(resultMap.get("OBJVERSION")); |
||||
|
returnMap.put("resultCode", "200"); |
||||
|
returnMap.put("obj", JSON.toJSONString(inData)); |
||||
|
} catch(APException e){ |
||||
|
returnMap.put("resultCode", "400"); |
||||
|
returnMap.put("resultMsg", e.getMessage()); |
||||
|
} |
||||
|
//打印日志 |
||||
|
logger.info("Recipe替代明细新增结束:"+JSON.toJSONString(inData)); |
||||
|
//返回结果集 |
||||
|
return returnMap; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* @description: 批量删除 |
||||
|
* @author LR |
||||
|
* @date 2024/12/13 10:26 |
||||
|
* @version 1.0 |
||||
|
*/ |
||||
|
public Map<String, String> removeRecipeItems(List<RecipeIfsItem> inDatas) { |
||||
|
logger.info("Recipe 明细集合删除开始:"+JSON.toJSONString(inDatas)); |
||||
|
//公共参数 |
||||
|
Map<String, String> returnMap = new HashMap<>(); |
||||
|
String username = inDatas.get(0).getIfsUsername(); |
||||
|
String password = inDatas.get(0).getIfsPassword(); |
||||
|
String contract = inDatas.get(0).getContract(); |
||||
|
String partNo = inDatas.get(0).getPartNo(); |
||||
|
String engChgLevel = inDatas.get(0).getEngChgLevel(); |
||||
|
String bomType = inDatas.get(0).getBomType(); |
||||
|
String alternativeNo = inDatas.get(0).getAlternativeNo(); |
||||
|
try{ |
||||
|
//获取连接 |
||||
|
Server srv = ifsServer.getIfsServer(username, password); |
||||
|
//查询数据 |
||||
|
List<RecipeIfsItem> itemList = RecipeApi.getRecipeItems(srv, contract, partNo, engChgLevel, bomType, alternativeNo, null); |
||||
|
//转Map |
||||
|
Map<String, RecipeIfsItem> itemMap = itemList.stream().collect(Collectors.toMap(RecipeIfsItem::getLineItemNo, Function.identity())); |
||||
|
//打印日志 |
||||
|
logger.info("Recipe替代明细集合 批量新增结束:"+JSON.toJSONString(inDatas)); |
||||
|
//循环判断的方法 |
||||
|
for(RecipeIfsItem recipeItem : inDatas) { |
||||
|
//判断是否已经存在 |
||||
|
String tempLineItemNo = recipeItem.getLineItemNo(); |
||||
|
if(!itemMap.containsKey(tempLineItemNo)) { |
||||
|
throw new APException("不存在此Recipe组件信息!LineItemNo:"+tempLineItemNo); |
||||
|
} |
||||
|
} |
||||
|
// 校验通过 循环调用新增的方法 |
||||
|
for(RecipeIfsItem recipeItem : inDatas) { |
||||
|
//设置版本的信息 |
||||
|
String key = recipeItem.getLineItemNo(); |
||||
|
RecipeIfsItem oriItem = itemMap.get(key); |
||||
|
recipeItem.setIfsRowId(oriItem.getIfsRowId()); |
||||
|
recipeItem.setIfsRowVersion(oriItem.getIfsRowVersion()); |
||||
|
//调用api |
||||
|
RecipeApi.removeRecipeItem(srv, recipeItem); |
||||
|
} |
||||
|
returnMap.put("resultCode", "200"); |
||||
|
returnMap.put("obj", JSON.toJSONString(inDatas)); |
||||
|
} catch(APException e){ |
||||
|
returnMap.put("resultCode", "400"); |
||||
|
returnMap.put("resultMsg", e.getMessage()); |
||||
|
} |
||||
|
//打印日志 |
||||
|
logger.info("Recipe 明细集合删除开始:"+JSON.toJSONString(inDatas)); |
||||
|
//返回结果集 |
||||
|
return returnMap; |
||||
|
} |
||||
|
|
||||
|
} |
||||
Write
Preview
Loading…
Cancel
Save
Reference in new issue