You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

200 lines
8.8 KiB

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