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.
325 lines
12 KiB
325 lines
12 KiB
package com.spring.ifs.bean;
|
|
|
|
import com.spring.ifs.api.BaseSearchApi;
|
|
import com.spring.ifs.api.BaseSearchApiTest;
|
|
import com.spring.ifs.api.IfsServer;
|
|
import com.spring.ifs.api.TechnicalClassApi;
|
|
import com.spring.ifs.data.*;
|
|
import com.spring.modules.base.entity.WorkCenterCost;
|
|
import com.spring.modules.base.vo.PersonnelLevelVo;
|
|
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.ArrayList;
|
|
import java.util.HashMap;
|
|
import java.util.List;
|
|
import java.util.Map;
|
|
|
|
/**
|
|
* @description: 基础查询的实现类
|
|
* @author LR
|
|
* @date 2024/12/9 11:49
|
|
* @version 1.0
|
|
*/
|
|
@Component
|
|
public class BaseSearchBeanTest {
|
|
|
|
@Autowired
|
|
private IfsServer ifsServer;
|
|
|
|
private static final Logger logger = LoggerFactory.getLogger(BaseSearchBean.class);
|
|
|
|
/**
|
|
* @description: 查询加工中心
|
|
* @author LR
|
|
* @date 2024/12/12 13:23
|
|
* @version 1.0
|
|
*/
|
|
public List<WorkCenter> getWorkCenterNos(BaseSearchData inData) throws APException {
|
|
//查询的参数
|
|
String username = inData.getIfsUsername();
|
|
String password = inData.getIfsPassword();
|
|
String siteCon = inData.getSiteCon();
|
|
String ifsRowVersion = inData.getIfsRowVersion();
|
|
logger.info("请求参数:"+siteCon);
|
|
//获取连接
|
|
Server srv = ifsServer.getIfsServer(username, password);
|
|
List<WorkCenter> resultList = BaseSearchApiTest.getWorkCenterNos(srv, siteCon, ifsRowVersion);;
|
|
logger.info("返回集合大小:"+resultList.size());
|
|
return resultList;
|
|
}
|
|
|
|
|
|
/**
|
|
* @description: 查询
|
|
* @author LR
|
|
* @date 2024/12/12 13:24
|
|
* @version 1.0
|
|
*/
|
|
public List<WarehouseLocation> getWarehouseLocations(BaseSearchData inData) throws APException {
|
|
//查询的参数
|
|
String username = inData.getIfsUsername();
|
|
String password = inData.getIfsPassword();
|
|
String siteCon = inData.getSiteCon();
|
|
String ifsRowVersion = inData.getIfsRowVersion();
|
|
logger.info("请求参数:"+siteCon);
|
|
//获取连接
|
|
Server srv = ifsServer.getIfsServer(username, password);
|
|
List<WarehouseLocation> resultList = new ArrayList<>();
|
|
int pageSize = 200;
|
|
//迭代查询
|
|
for(int i = 0; i < 150; i++){
|
|
int startIndex = i * pageSize;
|
|
List<WarehouseLocation> tempList = BaseSearchApiTest.getWarehouseLocations(srv, siteCon, startIndex, pageSize);
|
|
//判断查询是否结束
|
|
if(tempList.size() > 0) {
|
|
resultList.addAll(tempList);
|
|
}else {
|
|
break;
|
|
}
|
|
}
|
|
logger.info("返回集合大小:"+resultList.size());
|
|
return resultList;
|
|
}
|
|
|
|
/**
|
|
* @description: 获取人员等级的信息
|
|
* @author LR
|
|
* @date 2024/12/12 13:29
|
|
* @version 1.0
|
|
*/
|
|
public List<LaborClass> getIfsLaborClasss(BaseSearchData inData) throws APException {
|
|
//查询的参数
|
|
String username = inData.getIfsUsername();
|
|
String password = inData.getIfsPassword();
|
|
String siteCon = inData.getSiteCon();
|
|
String ifsRowVersion = inData.getIfsRowVersion();
|
|
//获取连接
|
|
Server srv = ifsServer.getIfsServer(username, password);
|
|
return BaseSearchApiTest.getIfsLaborClasss(srv, siteCon, ifsRowVersion);
|
|
}
|
|
|
|
/**
|
|
* @description: 查询物料件的信息
|
|
* @author LR
|
|
* @date 2024/12/9 13:28
|
|
* @version 1.0
|
|
*/
|
|
public List<PartCatalog> getMasterParts(BaseSearchData inData) throws APException {
|
|
//公共参数
|
|
String username = inData.getIfsUsername();
|
|
String password = inData.getIfsPassword();
|
|
String ifsRowVersion = inData.getIfsRowVersion();
|
|
//获取连接
|
|
Server srv = ifsServer.getIfsServer(username, password);
|
|
List<PartCatalog> resultList = new ArrayList<>();
|
|
int pageSize = 200;
|
|
//迭代查询
|
|
for(int i = 0; i < 10; i++){
|
|
int startIndex = i * pageSize;
|
|
List<PartCatalog> tempList = BaseSearchApiTest.getPartCatalogs(srv, ifsRowVersion, startIndex, pageSize);
|
|
//判断查询是否结束
|
|
if(tempList.size() > 0) {
|
|
resultList.addAll(tempList);
|
|
}else {
|
|
break;
|
|
}
|
|
}
|
|
logger.info("返回集合大小:"+resultList.size());
|
|
return resultList;
|
|
}
|
|
|
|
/**
|
|
* @description: 查询库存件的属性值
|
|
* @author LR
|
|
* @date 2024/12/12 13:33
|
|
* @version 1.0
|
|
*/
|
|
public List<InventoryValue> getInventoryValues(BaseSearchData inData) throws APException {
|
|
//查询的参数
|
|
String username = inData.getIfsUsername();
|
|
String password = inData.getIfsPassword();
|
|
String siteCon = inData.getSiteCon();
|
|
String ifsRowVersion = inData.getIfsRowVersion();
|
|
logger.info("库存件cost value请求参数:"+siteCon);
|
|
//获取连接
|
|
Server srv = ifsServer.getIfsServer(username, password);
|
|
List<InventoryValue> resultList = new ArrayList<>();
|
|
int pageSize = 200;
|
|
//迭代查询
|
|
for(int i = 0; i < 10; i++){
|
|
int startIndex = i * pageSize;
|
|
List<InventoryValue> tempList = BaseSearchApiTest.getInventoryValues(srv, siteCon, ifsRowVersion, startIndex, pageSize);
|
|
//判断查询是否结束
|
|
if(tempList.size() > 0) {
|
|
resultList.addAll(tempList);
|
|
}else {
|
|
break;
|
|
}
|
|
}
|
|
logger.info("返回集合大小:"+resultList.size());
|
|
return resultList;
|
|
}
|
|
|
|
/**
|
|
* @description: 按照条件查询库存件的成本
|
|
* @author LR
|
|
* @date 2025/1/17 11:40
|
|
* @version 1.0
|
|
*/
|
|
public InventoryValue getInventoryValueByPartNo(BaseSearchData inData) throws APException {
|
|
//查询的参数
|
|
String site = inData.getSite();
|
|
String partNo = inData.getPartNo();
|
|
String username = inData.getIfsUsername();
|
|
String password = inData.getIfsPassword();
|
|
logger.info("库存件cost value请求参数 域:"+site+",物料编码:"+partNo);
|
|
//获取连接
|
|
Server srv = ifsServer.getIfsServer(username, password);
|
|
InventoryValue resultRow = BaseSearchApiTest.getInventoryValueByPartNo(srv, site, partNo);
|
|
//判断null
|
|
if(resultRow == null) {
|
|
throw new APException("库存件按成本不存在!");
|
|
}
|
|
logger.info("返回集合大小:"+resultRow.toString());
|
|
return resultRow;
|
|
}
|
|
|
|
/**
|
|
* @description: 按照条件查询技术等级的数据
|
|
* @author LR
|
|
* @date 2025/1/17 13:20
|
|
* @version 1.0
|
|
*/
|
|
public List<TechnicalAttribute> getTechnicalAttributesByCon(BaseSearchData inData) throws APException {
|
|
String username = inData.getIfsUsername();
|
|
String password = inData.getIfsPassword();
|
|
String keyRef = inData.getKeyRef();
|
|
String luName = inData.getLuName() ;
|
|
//获取连接
|
|
Server srv = ifsServer.getIfsServer(username, password);
|
|
//查询主表对应的信息
|
|
Map<String, String> resultMap = TechnicalClassApi.getTechnicalClass(srv, luName, keyRef);
|
|
//获取关联键
|
|
String technicalSpecNo = resultMap.get("TECHNICAL_SPEC_NO");
|
|
//查询技术等级属性的列表数据
|
|
List<TechnicalAttribute> resultList = BaseSearchApi.getTechnicalAttributesByCon(srv, technicalSpecNo);
|
|
return resultList;
|
|
}
|
|
|
|
/**
|
|
* @description: 查询加工中心成本
|
|
* @author LR
|
|
* @date 2025/1/17 13:20
|
|
* @version 1.0
|
|
*/
|
|
public List<WorkCenterCost> getWorkCenterCosts(BaseSearchData inData) throws APException {
|
|
//查询的参数
|
|
String username = inData.getIfsUsername();
|
|
String password = inData.getIfsPassword();
|
|
String siteCon = inData.getSiteCon();
|
|
String ifsRowVersion = inData.getIfsRowVersion();
|
|
logger.info("加工中心成本的请求参数:"+siteCon);
|
|
List<WorkCenterCost> resultList = new ArrayList<>();
|
|
int pageSize = 200;
|
|
//获取连接
|
|
Server srv = ifsServer.getIfsServer(username, password);
|
|
//迭代查询
|
|
for(int i = 0; i < 20; i++){
|
|
int startIndex = i * pageSize;
|
|
List<WorkCenterCost> tempList = BaseSearchApi.getWorkCenterCosts(srv, siteCon, ifsRowVersion, startIndex, pageSize);
|
|
//判断查询是否结束
|
|
if(tempList.size() > 0) {
|
|
resultList.addAll(tempList);
|
|
}else {
|
|
break;
|
|
}
|
|
}
|
|
logger.info("返回集合大小:"+resultList.size());
|
|
return resultList;
|
|
}
|
|
|
|
/**
|
|
* @description: 按照时间获取所有域下的库存件信息
|
|
* @author LR
|
|
* @date 2025/3/7 11:01
|
|
* @version 1.0
|
|
*/
|
|
public List<PartIfsInventory> getInventoryParts(BaseSearchData inData) throws APException {
|
|
//查询的参数
|
|
String ifsRowVersion = inData.getIfsRowVersion();
|
|
String username = inData.getIfsUsername();
|
|
String password = inData.getIfsPassword();
|
|
logger.info("库存件查询的请求参数:"+ifsRowVersion);
|
|
List<PartIfsInventory> resultList = new ArrayList<>();
|
|
int pageSize = 200;
|
|
//获取连接
|
|
Server srv = ifsServer.getIfsServer(username, password);
|
|
//迭代查询
|
|
for(int i = 0; i < 100; i++){
|
|
int startIndex = i * pageSize;
|
|
List<PartIfsInventory> tempList = BaseSearchApi.getInventoryParts(srv, ifsRowVersion, startIndex, pageSize);
|
|
//判断查询是否结束
|
|
if(tempList.size() > 0) {
|
|
resultList.addAll(tempList);
|
|
}else {
|
|
break;
|
|
}
|
|
}
|
|
//过滤重复的数据
|
|
List<PartIfsInventory> returnList = new ArrayList<>();
|
|
Map<String, Integer> checkMap = new HashMap<>();
|
|
for (PartIfsInventory partIfsInventory : resultList){
|
|
String key = partIfsInventory.getContract() +"-"+partIfsInventory.getPartNo();
|
|
if (checkMap.containsKey(key)){
|
|
int index = checkMap.get(key);
|
|
returnList.set(index, partIfsInventory);
|
|
}else {
|
|
returnList.add(partIfsInventory);
|
|
checkMap.put(key, returnList.size() - 1);
|
|
}
|
|
}
|
|
logger.info("返回集合大小:"+returnList.size());
|
|
return returnList;
|
|
}
|
|
|
|
/**
|
|
* @description: 查询人员等级成本
|
|
* @author LR
|
|
* @date 2025/5/6 11:55
|
|
* @version 1.0
|
|
*/
|
|
public List<PersonnelLevelVo> getLaborClassCosts(BaseSearchData inData) throws APException {
|
|
//查询的参数
|
|
logger.info("人员等级成本开始查询!");
|
|
String username = inData.getIfsUsername();
|
|
String password = inData.getIfsPassword();
|
|
String siteCon = inData.getSiteCon();
|
|
List<PersonnelLevelVo> resultList = new ArrayList<>();
|
|
int pageSize = 200;
|
|
try {
|
|
Server srv = ifsServer.getIfsServer(username, password);
|
|
//迭代查询
|
|
for(int i = 0; i < 150; i++){
|
|
int startIndex = i * pageSize;
|
|
List<PersonnelLevelVo> tempList = BaseSearchApi.getLaborClassCosts(srv, siteCon, startIndex, pageSize);
|
|
//判断查询是否结束
|
|
if(tempList.size() > 0) {
|
|
resultList.addAll(tempList);
|
|
}else {
|
|
break;
|
|
}
|
|
}
|
|
} catch (APException e){
|
|
throw new APException("异常信息:"+e.getMessage());
|
|
}
|
|
logger.info("人员等级成本结束查询,返回集合大小:"+resultList.size());
|
|
return resultList;
|
|
}
|
|
|
|
}
|