|
|
package com.spring.ifs.api;
import com.spring.ifs.data.*;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.BomIfsAlternative;import com.spring.modules.part.entity.APIEntity.BomIfsHeader;import com.spring.modules.part.entity.APIEntity.BomIfsItem;import com.spring.modules.part.entity.APIEntity.BomIfsManufStructCostDistrib;import ifs.fnd.ap.*;
import java.math.BigDecimal;import java.util.*;
/*** @description: Bom的api* @author LR* @date 2024/12/9 10:56* @version 1.0*/public class BomApi {
/** * @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<BomIfsHeader> 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 new ArrayList<>(); } else { List<BomIfsHeader> 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); BomIfsHeader tempItem = new BomIfsHeader(); //设置参数
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, BomIfsHeader 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, BomIfsHeader 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, BomIfsHeader 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, BomIfsAlternative 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, BomIfsAlternative 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, BomIfsAlternative 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, BomIfsAlternative 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", "BUILD__", PlsqlBaseMethodType.MODIFY, PlsqlBaseMethodAction.CHECK, inParam); //执行do的操作
Map<String, String> resultMap = IfsPlsqlUtils.execProcedureGetRecord(srv, "PROD_STRUCT_ALTERNATE_API", "BUILD__", 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, BomIfsAlternative 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 new ArrayList<>(); } 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<BomIfsItem> 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,"); //添加查询字段2025-07-03 新增字段
searchSql.append(" NOTE_TEXT, CONSUMPTION_ITEM, IFSAPP.INVENTORY_PART_API.Get_Unit_Meas(Contract, Component_Part) unitMeas,"); 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 new ArrayList<>(); } else { List<BomIfsItem> 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); BomIfsItem tempItem = new BomIfsItem(); //设置参数
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"));
BigDecimal itemValue = new BigDecimal(tempMap.get("LINE_ITEM_NO")); itemValue = itemValue.setScale(0, BigDecimal.ROUND_HALF_UP); itemValue = itemValue.stripTrailingZeros(); String formatterValue = itemValue.toPlainString(); tempItem.setLineItemNo(formatterValue); tempItem.setNoteText(tempMap.get("NOTE_TEXT")); tempItem.setConsumptionItem(tempMap.get("CONSUMPTION_ITEM")); tempItem.setPrintUnit(tempMap.get("UNITMEAS")); 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, BomIfsItem 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"; String productFlag = inData.getProductFlag(); //入参
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); // 单位用量
if ("byProduct".equalsIgnoreCase(productFlag)) { inParam.put("CONSUMPTION_ITEM", consumptionItem); // 消耗项目
}else { inParam.put("ISSUE_TYPE", issueType); // 生产属性
inParam.put("CONSUMPTION_ITEM", consumptionItem); // 消耗项目
}
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("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, BomIfsItem 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"; String productFlag = inData.getProductFlag(); //入参
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("COMPONENT_SCRAP", componentScrap); // 报废
if ("byProduct".equalsIgnoreCase(productFlag)) { inParam.put("CONSUMPTION_ITEM", consumptionItem); // 消耗项目
}else { inParam.put("ISSUE_TYPE", issueType); // 生产属性
inParam.put("CONSUMPTION_ITEM", consumptionItem); // 消耗项目
} inParam.put("SHRINKAGE_FACTOR", shrinkageFactor); // 损耗率
inParam.put("NOTE_TEXT", noteText); // 备注
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, BomIfsItem 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: 查询使用的方法 * @author LR * @date 2025/7/4 09:38 * @version 1.0 */ public static List<BomIfsManufStructCostDistrib> getBomDistributionsForSync(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,"); 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) componentPartNo,"); 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 new ArrayList<>(); } else { List<BomIfsManufStructCostDistrib> 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); BomIfsManufStructCostDistrib tempItem = new BomIfsManufStructCostDistrib(); //设置参数
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"));
BigDecimal itemValue = new BigDecimal(tempMap.get("BYPRODLINEITEMNO")); itemValue = itemValue.setScale(0, BigDecimal.ROUND_HALF_UP); itemValue = itemValue.stripTrailingZeros(); String formatterValue = itemValue.toPlainString(); tempItem.setByProdLineItemNo(formatterValue);
BigDecimal componentValue = new BigDecimal(tempMap.get("COMPONENTLINEITEMNO")); componentValue = componentValue.setScale(0, BigDecimal.ROUND_HALF_UP); componentValue = componentValue.stripTrailingZeros(); String formatterComponentValue = componentValue.toPlainString(); tempItem.setComponentLineItemNo(formatterComponentValue);
tempItem.setComponentPartNo(tempMap.get("COMPONENTPARTNO")); tempItem.setItemCostDistribution(tempMap.get("ITEMCOSTDISTRIBUTION")); //添加对象
resultItems.add(tempItem); } return resultItems; } }
/** * @description: 修改 Bom的副产品信息 * @author LR * @date 2024/12/11 16:47 * @version 1.0 */ public static Map<String, String> modifyBomDistribution(Server srv, BomIfsManufStructCostDistrib 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; }
}
|