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