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.
848 lines
39 KiB
848 lines
39 KiB
package com.spring.ifs.bean;
|
|
|
|
import com.alibaba.fastjson.JSON;
|
|
import com.spring.ifs.api.*;
|
|
import com.spring.ifs.data.*;
|
|
import com.spring.modules.part.entity.APIEntity.PartIfsInventory;
|
|
import ifs.fnd.ap.APException;
|
|
import ifs.fnd.ap.Server;
|
|
import org.slf4j.Logger;
|
|
import org.slf4j.LoggerFactory;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.stereotype.Component;
|
|
|
|
import java.util.List;
|
|
import java.util.Map;
|
|
|
|
/**
|
|
* @description: 处理库存件的
|
|
* @author LR
|
|
* @date 2024/12/9 15:44
|
|
* @version 1.0
|
|
*/
|
|
@Component
|
|
public class InventoryServiceBeanTest {
|
|
|
|
@Autowired
|
|
private IfsServer ifsServer;
|
|
|
|
private static final Logger logger = LoggerFactory.getLogger(InventoryServiceBeanTest.class);
|
|
|
|
/**
|
|
* @description: 查询库存件的信息
|
|
* @author LR
|
|
* @date 2024/12/12 15:49
|
|
* @version 1.0
|
|
*/
|
|
public InventoryPart getInventoryPart(InventoryPart inData) throws APException {
|
|
logger.info("Inventory Part 查询开始:"+ JSON.toJSONString(inData));
|
|
//查询的参数
|
|
String username = inData.getIfsUsername();
|
|
String password = inData.getIfsPassword();
|
|
String contract = inData.getContract();
|
|
String partNo = inData.getPartNo();
|
|
//获取连接
|
|
Server srv = ifsServer.getIfsServer(username, password);
|
|
Map<String, String> partMap = InventoryPartApiTest.getInventoryPartByPartNo(srv, contract, partNo);
|
|
//判断是否需要插入到ifs
|
|
if(partMap == null || partMap.size() == 0) {
|
|
throw new APException("库存件不存在!");
|
|
}
|
|
//设置ifs 信息
|
|
inData.setIfsRowId(partMap.get("IFSROWID"));
|
|
inData.setIfsRowVersion(partMap.get("IFSROWVERSION"));
|
|
//查询库存件的属性模版
|
|
Map<String, String> templateMap = InventoryPartApiTest.getInventoryPartCharacteristicTemplate(srv, contract, partNo);
|
|
//设置模版
|
|
inData.setEngAttribute(templateMap.get("ENG_ATTRIBUTE"));
|
|
logger.info("Inventory Part 查询结束:"+JSON.toJSONString(inData));
|
|
return inData;
|
|
}
|
|
|
|
/**
|
|
* @description: 库存件新增
|
|
* @author LR
|
|
* @date 2024/12/12 15:52
|
|
* @version 1.0
|
|
*/
|
|
public InventoryPart syncInventoryPart(InventoryPart inData) throws APException {
|
|
logger.info("Inventory Part 新增开始:"+JSON.toJSONString(inData));
|
|
//查询的参数
|
|
String username = inData.getIfsUsername();
|
|
String password = inData.getIfsPassword();
|
|
String contract = inData.getContract();
|
|
String partNo = inData.getPartNo();
|
|
//获取连接
|
|
Server srv = ifsServer.getIfsServer(username, password);
|
|
Map<String, String> partMap = InventoryPartApiTest.getInventoryPartByPartNo(srv, contract, partNo);
|
|
//判断是否需要插入到ifs
|
|
if(partMap == null || partMap.size() == 0) {
|
|
//调用api
|
|
Map<String, String> resultMap = InventoryPartApiTest.insertInventoryPart(srv, inData);
|
|
//设置ifs 信息
|
|
inData.setIfsRowId(resultMap.get("OBJID"));
|
|
inData.setIfsRowVersion(resultMap.get("OBJVERSION"));
|
|
}else {
|
|
throw new APException("库存件已存在!");
|
|
}
|
|
//打印日志
|
|
logger.info("Inventory Part 新增结束:"+JSON.toJSONString(inData));
|
|
//返回结果集
|
|
return inData;
|
|
}
|
|
|
|
/**
|
|
* @description: 库存件修改
|
|
* @author LR
|
|
* @date 2024/12/12 15:55
|
|
* @version 1.0
|
|
*/
|
|
public InventoryPart modifyInventoryPart(InventoryPart inData) throws APException {
|
|
logger.info("Inventory Part 修改开始:"+JSON.toJSONString(inData));
|
|
//查询的参数
|
|
String username = inData.getIfsUsername();
|
|
String password = inData.getIfsPassword();
|
|
String contract = inData.getContract();
|
|
String partNo = inData.getPartNo();
|
|
//获取连接
|
|
Server srv = ifsServer.getIfsServer(username, password);
|
|
Map<String, String> partMap = InventoryPartApiTest.getInventoryPartByPartNo(srv, contract, partNo);
|
|
//判断是否需要插入到ifs
|
|
if(partMap == null || partMap.size() == 0) {
|
|
throw new APException("域:"+contract+"库存件:"+partNo+"不存在!");
|
|
}else {
|
|
//设置ifs 信息
|
|
inData.setIfsRowId(partMap.get("IFSROWID"));
|
|
inData.setIfsRowVersion(partMap.get("IFSROWVERSION"));
|
|
Map<String, String> resultMap = InventoryPartApiTest.modifyInventoryPart(srv, inData);
|
|
//设置ifs 信息
|
|
inData.setIfsRowVersion(resultMap.get("OBJVERSION"));
|
|
}
|
|
//打印日志
|
|
logger.info("Inventory Part 修改结束:"+JSON.toJSONString(inData));
|
|
//返回结果集
|
|
return inData;
|
|
}
|
|
|
|
/**
|
|
* @description: 库存件删除
|
|
* @author LR
|
|
* @date 2024/12/12 15:58
|
|
* @version 1.0
|
|
*/
|
|
public void removeInventoryPart(InventoryPart inData) throws APException {
|
|
logger.info("Inventory Part 删除开始:"+JSON.toJSONString(inData));
|
|
//查询的参数
|
|
String username = inData.getIfsUsername();
|
|
String password = inData.getIfsPassword();
|
|
String contract = inData.getContract();
|
|
String partNo = inData.getPartNo();
|
|
//获取连接
|
|
Server srv = ifsServer.getIfsServer(username, password);
|
|
Map<String, String> partMap = InventoryPartApiTest.getInventoryPartByPartNo(srv, contract, partNo);
|
|
//判断是否需要插入到ifs
|
|
if(partMap == null || partMap.size() == 0) {
|
|
throw new APException("域:"+contract+"库存件:"+partNo+"不存在!");
|
|
}else {
|
|
//设置ifs 信息
|
|
inData.setIfsRowId(partMap.get("IFSROWID"));
|
|
inData.setIfsRowVersion(partMap.get("IFSROWVERSION"));
|
|
InventoryPartApiTest.removeInventoryPart(srv, inData);
|
|
}
|
|
//打印日志
|
|
logger.info("Inventory Part 删除结束:"+JSON.toJSONString(inData));
|
|
}
|
|
|
|
/**
|
|
* @description: 修改库存件的配置信息
|
|
* @author LR
|
|
* @date 2024/12/12 16:11
|
|
* @version 1.0
|
|
*/
|
|
public InventoryPartConfig modifyInventoryPartCost(InventoryPartConfig inData) throws APException {
|
|
logger.info("Inventory Part Cost 修改开始:"+JSON.toJSONString(inData));
|
|
//查询的参数
|
|
String username = inData.getIfsUsername();
|
|
String password = inData.getIfsPassword();
|
|
String contract = inData.getContract();
|
|
String partNo = inData.getPartNo();
|
|
//获取连接
|
|
Server srv = ifsServer.getIfsServer(username, password);
|
|
Map<String, String> partMap = InventoryPartApiTest.getInventoryPartConfig(srv, contract, partNo);
|
|
//判断是否需要插入到ifs
|
|
if(partMap == null || partMap.size() == 0) {
|
|
throw new APException("域:"+contract+"库存件:"+partNo+"不存在!");
|
|
}else {
|
|
//设置ifs 信息
|
|
inData.setIfsRowId(partMap.get("IFSROWID"));
|
|
inData.setIfsRowVersion(partMap.get("IFSROWVERSION"));
|
|
Map<String, String> resultMap = InventoryPartApiTest.modifyInventoryPartCost(srv, inData);
|
|
//设置ifs 信息
|
|
inData.setIfsRowVersion(resultMap.get("OBJVERSION"));
|
|
}
|
|
//打印日志
|
|
logger.info("Inventory Part Cost 修改结束:"+JSON.toJSONString(inData));
|
|
//返回结果集
|
|
return inData;
|
|
}
|
|
|
|
/**
|
|
* @description: 修改库存件的Plan
|
|
* @author LR
|
|
* @date 2024/12/12 16:31
|
|
* @version 1.0
|
|
*/
|
|
public InventoryPartPlan modifyInventoryPartPlan(InventoryPartPlan inData) throws APException {
|
|
logger.info("Inventory Part Plan 修改开始:"+JSON.toJSONString(inData));
|
|
//查询的参数
|
|
String username = inData.getIfsUsername();
|
|
String password = inData.getIfsPassword();
|
|
String contract = inData.getContract();
|
|
String partNo = inData.getPartNo();
|
|
//获取连接
|
|
Server srv = ifsServer.getIfsServer(username, password);
|
|
Map<String, String> partMap = InventoryPartApiTest.getInventoryPartByPartNo(srv, contract, partNo);
|
|
//判断是否需要插入到ifs
|
|
if(partMap == null || partMap.size() == 0) {
|
|
throw new APException("域:"+contract+"库存件:"+partNo+"不存在!");
|
|
}else {
|
|
//获取库存件Plan配置的信息
|
|
Map<String, String> planMap = InventoryPartApiTest.getInventoryPartPlan(srv, contract, partNo);
|
|
//设置ifs 信息
|
|
inData.setIfsRowId(planMap.get("IFSROWID"));
|
|
inData.setIfsRowVersion(planMap.get("IFSROWVERSION"));
|
|
Map<String, String> resultMap = InventoryPartApiTest.modifyInventoryPartPlan(srv, inData);
|
|
//设置ifs 信息
|
|
inData.setIfsRowVersion(resultMap.get("OBJVERSION"));
|
|
}
|
|
//打印日志
|
|
logger.info("Inventory Part Plan 修改结束:"+JSON.toJSONString(inData));
|
|
//返回结果集
|
|
return inData;
|
|
}
|
|
|
|
/**
|
|
* @description: 批量新增库位
|
|
* @author LR
|
|
* @date 2024/12/12 16:36
|
|
* @version 1.0
|
|
*/
|
|
public List<InventoryPartLocation> syncInventoryPartLocations(List<InventoryPartLocation> inDatas) throws APException {
|
|
logger.info("Inventory Part Location 批量新增开始:"+JSON.toJSONString(inDatas));
|
|
String username = inDatas.get(0).getIfsUsername();
|
|
String password = inDatas.get(0).getIfsPassword();
|
|
String contract = inDatas.get(0).getContract();
|
|
String partNo = inDatas.get(0).getPartNo();
|
|
//获取连接
|
|
Server srv = ifsServer.getIfsServer(username, password);
|
|
Map<String, String> partMap = InventoryPartApiTest.getInventoryPartByPartNo(srv, contract, partNo);
|
|
//判断是否需要插入到ifs
|
|
if(partMap == null || partMap.size() == 0) {
|
|
throw new APException("域:" + contract + "库存件:" + partNo + "不存在!");
|
|
}
|
|
//编辑处理需要处理的数据
|
|
for(InventoryPartLocation inData : inDatas) {
|
|
Map<String, String> resultMap = InventoryPartApiTest.insertInventoryPartLocation(srv, inData);
|
|
//设置ifs 信息
|
|
inData.setIfsRowId(resultMap.get("OBJID"));
|
|
inData.setIfsRowVersion(resultMap.get("OBJVERSION"));
|
|
}
|
|
logger.info("Inventory Part Location 批量新增结束:"+JSON.toJSONString(inDatas));
|
|
//返回结果集
|
|
return inDatas;
|
|
}
|
|
|
|
/**
|
|
* @description: 删除单个库存件的 Location
|
|
* @author LR
|
|
* @date 2024/12/12 16:37
|
|
* @version 1.0
|
|
*/
|
|
public void removeInventoryPartLocation(InventoryPartLocation inData) throws APException {
|
|
logger.info("Inventory Part Location 删除开始:"+JSON.toJSONString(inData));
|
|
String username = inData.getIfsUsername();
|
|
String password = inData.getIfsPassword();
|
|
String contract = inData.getContract();
|
|
String partNo = inData.getPartNo();
|
|
String locationNo = inData.getLocationNo();
|
|
//获取连接
|
|
Server srv = ifsServer.getIfsServer(username, password);
|
|
//获取库存件Plan配置的信息
|
|
Map<String, String> locationMap = InventoryPartApiTest.getInventoryPartLocation(srv, contract, partNo, locationNo);
|
|
//判断是否需要插入到ifs
|
|
if(locationMap == null || locationMap.size() == 0) {
|
|
throw new APException("域:" + contract + "库存件:" + partNo + "库位编码:" + locationNo +"不存在!");
|
|
}
|
|
//设置ifs 信息
|
|
inData.setIfsRowId(locationMap.get("IFSROWID"));
|
|
inData.setIfsRowVersion(locationMap.get("IFSROWVERSION"));
|
|
InventoryPartApiTest.removeInventoryPartLocation(srv, inData);
|
|
//打印日志
|
|
logger.info("Inventory Part Location 删除结束:"+JSON.toJSONString(inData));
|
|
}
|
|
|
|
/**
|
|
* @description: 批量删除库位的信息
|
|
* @author LR
|
|
* @date 2024/12/12 16:42
|
|
* @version 1.0
|
|
*/
|
|
public void removeInventoryPartLocations(List<InventoryPartLocation> inDatas) throws APException {
|
|
logger.info("Inventory Part Location 批量删除开始:"+JSON.toJSONString(inDatas));
|
|
String username = inDatas.get(0).getIfsUsername();
|
|
String password = inDatas.get(0).getIfsPassword();
|
|
String contract = inDatas.get(0).getContract();
|
|
String partNo = inDatas.get(0).getPartNo();
|
|
//获取连接
|
|
Server srv = ifsServer.getIfsServer(username, password);
|
|
//循环处理数据
|
|
for(InventoryPartLocation inData : inDatas) {
|
|
String locationNo = inData.getLocationNo();
|
|
//获取库存件Plan配置的信息
|
|
Map<String, String> locationMap = InventoryPartApiTest.getInventoryPartLocation(srv, contract, partNo, locationNo);
|
|
//判断是否需要插入到ifs
|
|
if(locationMap == null || locationMap.size() == 0) {
|
|
throw new APException("域:" + contract + "库存件:" + partNo + "库位编码:" + locationNo +"不存在!");
|
|
}
|
|
//设置ifs 信息
|
|
inData.setIfsRowId(locationMap.get("IFSROWID"));
|
|
inData.setIfsRowVersion(locationMap.get("IFSROWVERSION"));
|
|
InventoryPartApiTest.removeInventoryPartLocation(srv, inData);
|
|
}
|
|
//打印日志
|
|
logger.info("Inventory Part Location 批量删除结束:"+JSON.toJSONString(inDatas));
|
|
}
|
|
|
|
/**
|
|
* @description: 修改库存件的Manufacture
|
|
* @author LR
|
|
* @date 2024/12/12 16:44
|
|
* @version 1.0
|
|
*/
|
|
public InventoryPartManufacture modifyInventoryPartManufacture(InventoryPartManufacture inData) throws APException {
|
|
logger.info("Inventory Part Manufacture 修改开始:"+JSON.toJSONString(inData));
|
|
//公共参数
|
|
String username = inData.getIfsUsername();
|
|
String password = inData.getIfsPassword();
|
|
String contract = inData.getContract();
|
|
String partNo = inData.getPartNo();
|
|
//获取连接
|
|
Server srv = ifsServer.getIfsServer(username, password);
|
|
//查询制造商信息
|
|
Map<String, String> manufMap = InventoryPartApiTest.getInventoryManufacture(srv, contract, partNo);
|
|
//判断是否需要插入到ifs
|
|
if(manufMap == null || manufMap.size() == 0) {
|
|
throw new APException("域:"+contract+"库存件:"+partNo+"不存在制造商信息!");
|
|
}else {
|
|
//设置ifs 信息
|
|
inData.setIfsRowId(manufMap.get("IFSROWID"));
|
|
inData.setIfsRowVersion(manufMap.get("IFSROWVERSION"));
|
|
Map<String, String> resultMap = InventoryPartApiTest.modifyInventoryPartManufacture(srv, inData);
|
|
//设置ifs 信息
|
|
inData.setIfsRowVersion(resultMap.get("IFSROWVERSION"));
|
|
}
|
|
//打印日志
|
|
logger.info("Inventory Part Manufacture 修改结束:"+JSON.toJSONString(inData));
|
|
//返回信息
|
|
return inData;
|
|
}
|
|
|
|
/**
|
|
* @description: 查询库存件 Revision
|
|
* @author LR
|
|
* @date 2024/12/12 16:59
|
|
* @version 1.0
|
|
*/
|
|
public InventoryPartRevision getInventoryPartRevision(InventoryPartRevision inData) throws APException {
|
|
logger.info("Inventory Part Revision 查询开始:"+JSON.toJSONString(inData));
|
|
//公共参数
|
|
String username = inData.getIfsUsername();
|
|
String password = inData.getIfsPassword();
|
|
String contract = inData.getContract();
|
|
String partNo = inData.getPartNo();
|
|
String engChgLevel = inData.getEngChgLevel();
|
|
//获取连接
|
|
Server srv = ifsServer.getIfsServer(username, password);
|
|
//查询制造商信息
|
|
Map<String, String> revisionMap = InventoryPartApiTest.getInventoryPartRevision(srv, contract, partNo, engChgLevel);
|
|
//判断是否需要插入到ifs
|
|
if(revisionMap == null) {
|
|
throw new APException("当前版本信息不存在!");
|
|
}
|
|
//设置ifs 信息
|
|
inData.setIfsRowId(revisionMap.get("IFSROWID"));
|
|
inData.setIfsRowVersion(revisionMap.get("IFSROWVERSION"));
|
|
//打印日志
|
|
logger.info("Inventory Part Revision 查询结束:"+JSON.toJSONString(inData));
|
|
return inData;
|
|
}
|
|
|
|
/**
|
|
* @description: 插入库存件的版本
|
|
* @author LR
|
|
* @date 2024/12/12 17:03
|
|
* @version 1.0
|
|
*/
|
|
public InventoryPartRevision syncInventoryPartRevision(InventoryPartRevision inData) throws APException {
|
|
logger.info("Inventory Part Revision 新增开始:"+JSON.toJSONString(inData));
|
|
//公共参数
|
|
String username = inData.getIfsUsername();
|
|
String password = inData.getIfsPassword();
|
|
String contract = inData.getContract();
|
|
String partNo = inData.getPartNo();
|
|
String engChgLevel = inData.getEngChgLevel();
|
|
//获取连接
|
|
Server srv = ifsServer.getIfsServer(username, password);
|
|
//查询制造商信息
|
|
Map<String, String> revisionMap = InventoryPartApiTest.getInventoryPartRevision(srv, contract, partNo, engChgLevel);
|
|
//判断是否需要插入到ifs
|
|
if(revisionMap != null) {
|
|
throw new APException("当前版本信息已存在!");
|
|
}
|
|
//调用新增api
|
|
Map<String, String> resultMap = InventoryPartApiTest.insertInventoryPartRevision(srv, inData);
|
|
//设置ifs 信息
|
|
inData.setIfsRowId(resultMap.get("OBJID"));
|
|
inData.setIfsRowVersion(resultMap.get("OBJVERSION"));
|
|
//打印日志
|
|
logger.info("Inventory Part Revision 新增结束:"+JSON.toJSONString(inData));
|
|
//返回结果
|
|
return inData;
|
|
}
|
|
|
|
/**
|
|
* @description: 修改库存件的版本
|
|
* @author LR
|
|
* @date 2024/12/12 17:06
|
|
* @version 1.0
|
|
*/
|
|
public InventoryPartRevision modifyInventoryPartRevision(InventoryPartRevision inData) throws APException {
|
|
logger.info("Inventory Part Revision 修改开始:"+JSON.toJSONString(inData));
|
|
//公共参数
|
|
String username = inData.getIfsUsername();
|
|
String password = inData.getIfsPassword();
|
|
String contract = inData.getContract();
|
|
String partNo = inData.getPartNo();
|
|
String engChgLevel = inData.getEngChgLevel();
|
|
//获取连接
|
|
Server srv = ifsServer.getIfsServer(username, password);
|
|
//查询制造商信息
|
|
Map<String, String> revisionMap = InventoryPartApiTest.getInventoryPartRevision(srv, contract, partNo, engChgLevel);
|
|
//判断是否需要插入到ifs
|
|
if(revisionMap == null || revisionMap.size() == 0) {
|
|
throw new APException("当前版本信息不存在!");
|
|
}
|
|
//设置ifs 信息
|
|
inData.setIfsRowId(revisionMap.get("IFSROWID"));
|
|
inData.setIfsRowVersion(revisionMap.get("IFSROWVERSION"));
|
|
//调用api
|
|
Map<String, String> resultMap = InventoryPartApiTest.modifyInventoryPartRevision(srv, inData);
|
|
//设置ifs 信息
|
|
inData.setIfsRowVersion(resultMap.get("OBJVERSION"));
|
|
//打印日志
|
|
logger.info("Inventory Part Revision 修改结束:"+JSON.toJSONString(inData));
|
|
//返回结果
|
|
return inData;
|
|
}
|
|
|
|
/**
|
|
* @description: 删除库存件 Revision
|
|
* @author LR
|
|
* @date 2024/12/12 17:07
|
|
* @version 1.0
|
|
*/
|
|
public void removeInventoryPartRevision(InventoryPartRevision inData) throws APException {
|
|
logger.info("Inventory Part Revision 删除开始:"+JSON.toJSONString(inData));
|
|
//公共参数
|
|
String username = inData.getIfsUsername();
|
|
String password = inData.getIfsPassword();
|
|
String contract = inData.getContract();
|
|
String partNo = inData.getPartNo();
|
|
String engChgLevel = inData.getEngChgLevel();
|
|
//获取连接
|
|
Server srv = ifsServer.getIfsServer(username, password);
|
|
//查询制造商信息
|
|
Map<String, String> revisionMap = InventoryPartApiTest.getInventoryPartRevision(srv, contract, partNo, engChgLevel);
|
|
//判断是否需要插入到ifs
|
|
if(revisionMap == null || revisionMap.size() == 0) {
|
|
throw new APException("当前版本信息不存在!");
|
|
}
|
|
//设置ifs 信息
|
|
inData.setIfsRowId(revisionMap.get("IFSROWID"));
|
|
inData.setIfsRowVersion(revisionMap.get("IFSROWVERSION"));
|
|
//调用api
|
|
InventoryPartApiTest.removeInventoryPartRevision(srv, inData);
|
|
//打印日志
|
|
logger.info("Inventory Part Revision 删除结束:"+JSON.toJSONString(inData));
|
|
}
|
|
|
|
/**
|
|
* @description: 批量新增属性
|
|
* @author LR
|
|
* @date 2024/12/12 17:23
|
|
* @version 1.0
|
|
*/
|
|
public List<CharacteristicCode> syncInventoryPartCharacteristics(List<CharacteristicCode> inDatas) throws APException {
|
|
logger.info("Inventory Part Characteristic Code 批量新增开始:"+JSON.toJSONString(inDatas));
|
|
//公共参数
|
|
String username = inDatas.get(0).getIfsUsername();
|
|
String password = inDatas.get(0).getIfsPassword();
|
|
String contract = inDatas.get(0).getContract();
|
|
String partNo = inDatas.get(0).getPartNo();
|
|
//获取连接
|
|
Server srv = ifsServer.getIfsServer(username, password);
|
|
//递归判断
|
|
for(CharacteristicCode characteristic : inDatas) {
|
|
String characteristicCode = characteristic.getCharacteristicCode();
|
|
Map<String, String> characteristicMap = InventoryPartApiTest.getInventoryPartCharacteristicCode(srv, contract, partNo, characteristicCode);
|
|
if(characteristicMap != null && characteristicMap.size() > 0) {
|
|
throw new APException("属性编码已存在!");
|
|
}
|
|
//校验通过继续新增
|
|
Map<String, String> resultMap = InventoryPartApiTest.insertInventoryPartCharacteristicCode(srv, characteristic);
|
|
//设置ifs 信息
|
|
characteristic.setIfsRowId(resultMap.get("OBJID"));
|
|
characteristic.setIfsRowVersion(resultMap.get("OBJVERSION"));
|
|
}
|
|
//打印日志
|
|
logger.info("Inventory Part Characteristic Code 批量新增结束:"+JSON.toJSONString(inDatas));
|
|
return inDatas;
|
|
}
|
|
|
|
/**
|
|
* @description: 按照料号删除库存件的属性
|
|
* @author LR
|
|
* @date 2024/12/12 17:28
|
|
* @version 1.0
|
|
*/
|
|
public void removeInventoryPartCharacteristicsByPartNo(InventoryPart inData) throws APException {
|
|
logger.info("删除库存件的所有属性开始:"+JSON.toJSONString(inData));
|
|
//公共参数
|
|
String username = inData.getIfsUsername();
|
|
String password = inData.getIfsPassword();
|
|
String contract = inData.getContract();
|
|
String partNo = inData.getPartNo();
|
|
//获取连接
|
|
Server srv = ifsServer.getIfsServer(username, password);
|
|
//查询当前物料的属性 先删除物料属性 再删除库存件
|
|
List<CharacteristicCode> characteristicList = InventoryPartApiTest.getInventoryPartCharacteristicCodes(srv, contract, partNo);
|
|
//如果存在就批量删掉数据
|
|
if(characteristicList != null && characteristicList.size() > 0) {
|
|
for(CharacteristicCode characteristic : characteristicList) {
|
|
//一个一个删掉库存件的属性
|
|
InventoryPartApiTest.removeInventoryPartCharacteristic(srv, characteristic);
|
|
}
|
|
}
|
|
logger.info("删除库存件的所有属性结束:"+JSON.toJSONString(inData));
|
|
}
|
|
|
|
|
|
/**
|
|
* @description: 删除库存件关联的数据
|
|
* @author LR
|
|
* @date 2024/12/12 17:38
|
|
* @version 1.0
|
|
*/
|
|
public void removeInventoryPartRelationInfo(InventoryPart inData) throws APException {
|
|
logger.info("删除库存件的关联信息开始:"+JSON.toJSONString(inData));
|
|
//公共参数
|
|
String username = inData.getIfsUsername();
|
|
String password = inData.getIfsPassword();
|
|
String contract = inData.getContract();
|
|
String partNo = inData.getPartNo();
|
|
//获取连接
|
|
Server srv = ifsServer.getIfsServer(username, password);
|
|
//按照条件查询Bom的相关信息 按照海波的要求 删除Bom Header
|
|
List<BomHeader> bomHeaders = BomApiTest.getBomHeadersByPartNo(srv, contract, partNo);
|
|
//判断是否存在
|
|
if(bomHeaders != null && bomHeaders.size() > 0) {
|
|
for(BomHeader bomHeader : bomHeaders) {
|
|
//执行删除的操作
|
|
BomApiTest.removeBomHeader(srv, bomHeader);
|
|
}
|
|
}
|
|
|
|
//按照条件查询Routing的相关信息 按照海波的要求
|
|
List<RoutingHeader> routingHeaders = RoutingApiTest.getRoutingHeadersByPartNo(srv, contract, partNo);
|
|
//判断是否存在
|
|
if(routingHeaders != null && routingHeaders.size() > 0) {
|
|
for(RoutingHeader routingHeader : routingHeaders) {
|
|
//执行删除的操作
|
|
RoutingApiTest.removeRoutingHeader(srv, routingHeader);
|
|
}
|
|
}
|
|
|
|
//判断库存件是否存在
|
|
InventoryPart inventoryPart = InventoryPartApiTest.getInventoryPart(srv, contract, partNo);
|
|
//如果存在需要删掉
|
|
if(inventoryPart != null) {
|
|
//查询当前物料的属性 先删除物料属性 再删除库存件
|
|
List<CharacteristicCode> characteristicCodes = InventoryPartApiTest.getInventoryPartCharacteristicCodes(srv, contract, partNo);
|
|
//如果存在就批量删掉数据
|
|
if(characteristicCodes.size() > 0) {
|
|
for(CharacteristicCode characteristic : characteristicCodes) {
|
|
//一个一个删掉库存件的属性
|
|
InventoryPartApiTest.removeInventoryPartCharacteristic(srv, characteristic);
|
|
}
|
|
}
|
|
InventoryPartApiTest.removeInventoryPart(srv, inventoryPart);
|
|
}
|
|
logger.info("删除库存件的关联信息结束:"+JSON.toJSONString(inData));
|
|
}
|
|
|
|
/**
|
|
* @description: 执行copy part的操作
|
|
* @author LR
|
|
* @date 2024/12/9 15:51
|
|
* @version 1.0
|
|
*/
|
|
public void syncCopyPartForInventoryPart(CopyPart inData) throws APException {
|
|
//公共参数
|
|
String username = inData.getIfsUsername();
|
|
String password = inData.getIfsPassword();
|
|
String oriContract = inData.getOriContract();
|
|
String oriPartNo = inData.getOriPartNo();
|
|
String contract = inData.getContract();
|
|
String partNo = inData.getPartNo();
|
|
String partDesc = inData.getPartDesc();
|
|
String copyGeneral = inData.getCopyGeneral();//对应Inventory Part, General
|
|
String copyDefaultLocation = inData.getCopyDefaultLocation(); //Inventory Part, Default Locations
|
|
String copyCharacteristic = inData.getCopyCharacteristic(); //Inventory Part, Characteristics
|
|
String copyManufacturing = inData.getCopyManufacturing(); //Inventory Part, Manufacturing
|
|
String copyPPGeneral = inData.getCopyPPGeneral();//对应Purchase Part, General
|
|
String copyPPDocumentTexts = inData.getCopyPPDocumentTexts();//对应Purchase Part, Document Texts
|
|
String copyPPConnectedObjects = inData.getCopyPPConnectedObjects();//对应Purchase Part, Connected Objects
|
|
String copySPPGeneral = inData.getCopySPPGeneral();//对应Supplier for Purchase Part, General
|
|
String copySPPDocumentTexts = inData.getCopySPPDocumentTexts();//对应Supplier for Purchase Part, Document Texts
|
|
String copySPGeneral = inData.getCopySPGeneral();//对应Sales Part, General
|
|
String copySPCharacteristics = inData.getCopySPCharacteristics();//对应Sales Part, Characteristics
|
|
String copySPDocumentTexts = inData.getCopySPDocumentTexts();//对应Sales Part, Document Texts
|
|
String copySPLanguageDescription = inData.getCopySPLanguageDescription();//对应Sales Part, Language Description
|
|
//获取连接
|
|
Server srv = ifsServer.getIfsServer(username, password);
|
|
//调用api方法获取事件的编码
|
|
Map<String, String> resultMap = InventoryPartApiTest.getCopyPartEventNo(srv);
|
|
String eventNo = resultMap.get("EVENT_NO");
|
|
//调整选择的接口数据
|
|
List<CopyPartItem> copyPartItems = InventoryPartApiTest.getCopyPartItemsByEventNo(srv, eventNo);
|
|
//循环遍历
|
|
for(CopyPartItem copyPartItem : copyPartItems) {
|
|
String copyDesc = copyPartItem.getCopyDesc();
|
|
String ifsRowId = copyPartItem.getIfsRowId();
|
|
String ifsRowVersion = copyPartItem.getIfsRowVersion();
|
|
//处理Bom的数据都要传
|
|
if(copyDesc.indexOf("Manufacturing Structure,") == 0) {
|
|
//调用api设置成 必传 重复不添加
|
|
InventoryPartApiTest.modifyIfsCopyPartItem(srv, ifsRowId, ifsRowVersion, "TRUE", "TRUE");
|
|
}
|
|
//处理Routing的数据都要传
|
|
if(copyDesc.indexOf("Manufacturing Routings,") == 0) {
|
|
//调用api设置成 必传 重复不添加
|
|
InventoryPartApiTest.modifyIfsCopyPartItem(srv, ifsRowId, ifsRowVersion, "TRUE", "TRUE");
|
|
}
|
|
//处理master Part数据都要传
|
|
if(copyDesc.indexOf("Part Catalog,") == 0 || copyDesc.indexOf("Part,") == 0) {
|
|
//调用api设置成 必传 重复不添加
|
|
InventoryPartApiTest.modifyIfsCopyPartItem(srv, ifsRowId, ifsRowVersion, "TRUE", "TRUE");
|
|
}
|
|
//针对Connected Objects 特殊设置 不确定页面和页签
|
|
//库存件
|
|
if(copyDesc.equalsIgnoreCase("Inventory Part, Connected Objects")) {
|
|
//调用api设置成 必传 重复不添加
|
|
InventoryPartApiTest.modifyIfsCopyPartItem(srv, ifsRowId, ifsRowVersion, "TRUE", "TRUE");
|
|
}
|
|
//库存件
|
|
if(copyDesc.equalsIgnoreCase("Inventory Part, Document Texts")) {
|
|
//调用api设置成 必传 重复不添加
|
|
InventoryPartApiTest.modifyIfsCopyPartItem(srv, ifsRowId, ifsRowVersion, "FALSE", "TRUE");
|
|
}
|
|
|
|
//销售件
|
|
if(copyDesc.equalsIgnoreCase("Sales Part, Connected Objects")) {
|
|
//调用api设置成 必传 重复不添加
|
|
InventoryPartApiTest.modifyIfsCopyPartItem(srv, ifsRowId, ifsRowVersion, "TRUE", "TRUE");
|
|
}
|
|
|
|
//针对特殊PLM控制的的数据 设置对应的参数
|
|
//1.Inventory Part, General
|
|
if(copyDesc.equalsIgnoreCase("Inventory Part, General")) {
|
|
//根据plm的设置填充数据
|
|
if("Y".equals(copyGeneral)) {
|
|
//调用api设置成 必传 重复不添加
|
|
InventoryPartApiTest.modifyIfsCopyPartItem(srv, ifsRowId, ifsRowVersion, "TRUE", "TRUE");
|
|
}else {
|
|
//调用api设置成 必传 重复不添加
|
|
InventoryPartApiTest.modifyIfsCopyPartItem(srv, ifsRowId, ifsRowVersion, "FALSE", "TRUE");
|
|
}
|
|
}
|
|
|
|
//2.Inventory Part, Default Locations
|
|
if(copyDesc.equalsIgnoreCase("Inventory Part, Default Locations")) {
|
|
//根据plm的设置填充数据
|
|
if("Y".equals(copyDefaultLocation)) {
|
|
//调用api设置成 必传 重复不添加
|
|
InventoryPartApiTest.modifyIfsCopyPartItem(srv, ifsRowId, ifsRowVersion, "TRUE", "TRUE");
|
|
}else {
|
|
//调用api设置成 必传 重复不添加
|
|
InventoryPartApiTest.modifyIfsCopyPartItem(srv, ifsRowId, ifsRowVersion, "FALSE", "TRUE");
|
|
}
|
|
}
|
|
|
|
//3.Inventory Part, Characteristics
|
|
if(copyDesc.equalsIgnoreCase("Inventory Part, Characteristics")) {
|
|
//根据plm的设置填充数据
|
|
if("Y".equals(copyCharacteristic)) {
|
|
//调用api设置成 必传 重复不添加
|
|
InventoryPartApiTest.modifyIfsCopyPartItem(srv, ifsRowId, ifsRowVersion, "TRUE", "TRUE");
|
|
}else {
|
|
//调用api设置成 必传 重复不添加
|
|
InventoryPartApiTest.modifyIfsCopyPartItem(srv, ifsRowId, ifsRowVersion, "FALSE", "TRUE");
|
|
}
|
|
}
|
|
|
|
//4.Inventory Part, Manufacturing
|
|
if(copyDesc.equalsIgnoreCase("Inventory Part, Manufacturing")) {
|
|
//根据plm的设置填充数据
|
|
if("Y".equals(copyManufacturing)) {
|
|
//调用api设置成 必传 重复不添加
|
|
InventoryPartApiTest.modifyIfsCopyPartItem(srv, ifsRowId, ifsRowVersion, "TRUE", "TRUE");
|
|
}else {
|
|
//调用api设置成 必传 重复不添加
|
|
InventoryPartApiTest.modifyIfsCopyPartItem(srv, ifsRowId, ifsRowVersion, "FALSE", "TRUE");
|
|
}
|
|
}
|
|
|
|
//5.Purchase Part, General
|
|
if(copyDesc.equalsIgnoreCase("Purchase Part, General")) {
|
|
//根据plm的设置填充数据
|
|
if("Y".equals(copyPPGeneral)) {
|
|
//调用api设置成 必传 重复不添加
|
|
InventoryPartApiTest.modifyIfsCopyPartItem(srv, ifsRowId, ifsRowVersion, "TRUE", "TRUE");
|
|
}else {
|
|
//调用api设置成 必传 重复不添加
|
|
InventoryPartApiTest.modifyIfsCopyPartItem(srv, ifsRowId, ifsRowVersion, "FALSE", "TRUE");
|
|
}
|
|
}
|
|
|
|
//6.Purchase Part, Document Texts
|
|
if(copyDesc.equalsIgnoreCase("Purchase Part, Document Texts")) {
|
|
//根据plm的设置填充数据
|
|
if("Y".equals(copyPPDocumentTexts)) {
|
|
//调用api设置成 必传 重复不添加
|
|
InventoryPartApiTest.modifyIfsCopyPartItem(srv, ifsRowId, ifsRowVersion, "TRUE", "TRUE");
|
|
}else {
|
|
//调用api设置成 必传 重复不添加
|
|
InventoryPartApiTest.modifyIfsCopyPartItem(srv, ifsRowId, ifsRowVersion, "FALSE", "TRUE");
|
|
}
|
|
}
|
|
|
|
//7.Purchase Part, Connected Objects
|
|
if(copyDesc.equalsIgnoreCase("Purchase Part, Connected Objects")) {
|
|
//根据plm的设置填充数据
|
|
if("Y".equals(copyPPConnectedObjects)) {
|
|
//调用api设置成 必传 重复不添加
|
|
InventoryPartApiTest.modifyIfsCopyPartItem(srv, ifsRowId, ifsRowVersion, "TRUE", "TRUE");
|
|
}else {
|
|
//调用api设置成 必传 重复不添加
|
|
InventoryPartApiTest.modifyIfsCopyPartItem(srv, ifsRowId, ifsRowVersion, "FALSE", "TRUE");
|
|
}
|
|
}
|
|
|
|
//8.Supplier for Purchase Part, General
|
|
if(copyDesc.equalsIgnoreCase("Supplier for Purchase Part, General")) {
|
|
//根据plm的设置填充数据
|
|
if("Y".equals(copySPPGeneral)) {
|
|
//调用api设置成 必传 重复不添加
|
|
InventoryPartApiTest.modifyIfsCopyPartItem(srv, ifsRowId, ifsRowVersion, "TRUE", "TRUE");
|
|
}else {
|
|
//调用api设置成 必传 重复不添加
|
|
InventoryPartApiTest.modifyIfsCopyPartItem(srv, ifsRowId, ifsRowVersion, "FALSE", "TRUE");
|
|
}
|
|
}
|
|
|
|
//9.Supplier for Purchase Part, Document Texts
|
|
if(copyDesc.equalsIgnoreCase("Supplier for Purchase Part, Document Texts")) {
|
|
//根据plm的设置填充数据
|
|
if("Y".equals(copySPPDocumentTexts)) {
|
|
//调用api设置成 必传 重复不添加
|
|
InventoryPartApiTest.modifyIfsCopyPartItem(srv, ifsRowId, ifsRowVersion, "TRUE", "TRUE");
|
|
}else {
|
|
//调用api设置成 必传 重复不添加
|
|
InventoryPartApiTest.modifyIfsCopyPartItem(srv, ifsRowId, ifsRowVersion, "FALSE", "TRUE");
|
|
}
|
|
}
|
|
|
|
//10.Sales Part, General
|
|
if(copyDesc.equalsIgnoreCase("Sales Part, General")) {
|
|
//根据plm的设置填充数据
|
|
if("Y".equals(copySPGeneral)) {
|
|
//调用api设置成 必传 重复不添加
|
|
InventoryPartApiTest.modifyIfsCopyPartItem(srv, ifsRowId, ifsRowVersion, "TRUE", "TRUE");
|
|
}else {
|
|
//调用api设置成 必传 重复不添加
|
|
InventoryPartApiTest.modifyIfsCopyPartItem(srv, ifsRowId, ifsRowVersion, "FALSE", "TRUE");
|
|
}
|
|
}
|
|
|
|
//11.Sales Part, Characteristics
|
|
if(copyDesc.equalsIgnoreCase("Sales Part, Characteristics")) {
|
|
//根据plm的设置填充数据
|
|
if("Y".equals(copySPCharacteristics)) {
|
|
//调用api设置成 必传 重复不添加
|
|
InventoryPartApiTest.modifyIfsCopyPartItem(srv, ifsRowId, ifsRowVersion, "TRUE", "TRUE");
|
|
}else {
|
|
//调用api设置成 必传 重复不添加
|
|
InventoryPartApiTest.modifyIfsCopyPartItem(srv, ifsRowId, ifsRowVersion, "FALSE", "TRUE");
|
|
}
|
|
}
|
|
|
|
//12.Sales Part, Document Texts
|
|
if(copyDesc.equalsIgnoreCase("Sales Part, Document Texts")) {
|
|
//根据plm的设置填充数据
|
|
if("Y".equals(copySPDocumentTexts)) {
|
|
//调用api设置成 必传 重复不添加
|
|
InventoryPartApiTest.modifyIfsCopyPartItem(srv, ifsRowId, ifsRowVersion, "TRUE", "TRUE");
|
|
}else {
|
|
//调用api设置成 必传 重复不添加
|
|
InventoryPartApiTest.modifyIfsCopyPartItem(srv, ifsRowId, ifsRowVersion, "FALSE", "TRUE");
|
|
}
|
|
}
|
|
|
|
//13.Sales Part, Language Description
|
|
if(copyDesc.equalsIgnoreCase("Sales Part, Language Description")) {
|
|
//根据plm的设置填充数据
|
|
if("Y".equals(copySPLanguageDescription)) {
|
|
//调用api设置成 必传 重复不添加
|
|
InventoryPartApiTest.modifyIfsCopyPartItem(srv, ifsRowId, ifsRowVersion, "TRUE", "TRUE");
|
|
}else {
|
|
//调用api设置成 必传 重复不添加
|
|
InventoryPartApiTest.modifyIfsCopyPartItem(srv, ifsRowId, ifsRowVersion, "FALSE", "TRUE");
|
|
}
|
|
}
|
|
}
|
|
//执行拷贝的操作
|
|
InventoryPartApiTest.processIfsCopyPart(srv, oriContract, oriPartNo, contract, partNo, partDesc, "FALSE", eventNo);
|
|
}
|
|
|
|
|
|
/**
|
|
* @description: 测试修改Inventory Part 的CommGroup3参数
|
|
* @author LR
|
|
* @date 2026/4/22 09:16
|
|
* @version 1.0
|
|
*/
|
|
public Map<String, String> modifyInventoryPartCommGroup3(Map<String, String> inParam) throws APException {
|
|
logger.info("Inventory PartCommGroup3 修改开始:"+JSON.toJSONString(inParam));
|
|
//查询的参数
|
|
String username = inParam.get("ifsUsername");
|
|
String password = inParam.get("ifsPassword");
|
|
//获取连接
|
|
Server srv = ifsServer.getIfsServer(username, password);
|
|
//设置ifsobjVersion 信息
|
|
Map<String, String> resultMap = InventoryPartApi.modifyInventoryPartCommGroup3(srv, inParam);
|
|
//打印日志
|
|
logger.info("Inventory Part 修改结束:"+JSON.toJSONString(resultMap));
|
|
//返回结果集
|
|
return resultMap;
|
|
}
|
|
}
|