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.
301 lines
11 KiB
301 lines
11 KiB
package com.spring.ifs.bean;
|
|
|
|
import com.alibaba.fastjson.JSON;
|
|
import com.spring.ifs.api.BaseSearchApi;
|
|
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 com.spring.modules.part.entity.PartInformationEntity;
|
|
import com.spring.modules.part.vo.InventoryPartUnitCostSumVo;
|
|
import com.spring.modules.part.vo.LocationInformationVo;
|
|
import com.spring.modules.part.vo.WorkCenterVo;
|
|
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 BaseSearchBean {
|
|
|
|
@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<WorkCenterVo> getWorkCenterNos(Server srv, PartInformationEntity inData) throws APException {
|
|
//查询的参数
|
|
String siteCon = inData.getSiteCon();
|
|
String ifsRowVersion = inData.getIfsRowVersion();
|
|
logger.info("请求参数:"+siteCon);
|
|
List<WorkCenterVo> resultList = BaseSearchApi.getWorkCenterNos(srv, siteCon, ifsRowVersion);;
|
|
logger.info("返回集合大小:"+resultList.size());
|
|
return resultList;
|
|
}
|
|
|
|
|
|
/**
|
|
* @description: 查询
|
|
* @author LR
|
|
* @date 2024/12/12 13:24
|
|
* @version 1.0
|
|
*/
|
|
public List<LocationInformationVo> getWarehouseLocations(Server srv, PartInformationEntity inData) throws APException {
|
|
//查询的参数
|
|
String siteCon = inData.getSiteCon();
|
|
String ifsRowVersion = inData.getIfsRowVersion();
|
|
logger.info("请求参数:"+siteCon);
|
|
List<LocationInformationVo> resultList = new ArrayList<>();
|
|
int pageSize = 200;
|
|
//迭代查询
|
|
for(int i = 0; i < 150; i++){
|
|
int startIndex = i * pageSize;
|
|
List<LocationInformationVo> tempList = BaseSearchApi.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<PersonnelLevelVo> getIfsLaborClasss(Server srv, PartInformationEntity inData) throws APException {
|
|
//查询的参数
|
|
String siteCon = inData.getSiteCon();
|
|
String ifsRowVersion = inData.getIfsRowVersion();
|
|
return BaseSearchApi.getIfsLaborClasss(srv, siteCon, ifsRowVersion);
|
|
}
|
|
|
|
/**
|
|
* @description: 查询物料件的信息
|
|
* @author LR
|
|
* @date 2024/12/9 13:28
|
|
* @version 1.0
|
|
*/
|
|
public List<PartCatalog> getMasterParts(Server srv, PartInformationEntity inData) throws APException {
|
|
//公共参数
|
|
String ifsRowVersion = inData.getIfsRowVersion();
|
|
//获取连接
|
|
List<PartCatalog> resultList = new ArrayList<>();
|
|
int pageSize = 200;
|
|
//迭代查询
|
|
for(int i = 0; i < 10; i++){
|
|
int startIndex = i * pageSize;
|
|
List<PartCatalog> tempList = BaseSearchApi.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<InventoryPartUnitCostSumVo> getInventoryValues(Server srv, PartInformationEntity inData) throws APException {
|
|
//查询的参数
|
|
String siteCon = inData.getSiteCon();
|
|
String ifsRowVersion = inData.getIfsRowVersion();
|
|
logger.info("库存件cost value请求参数:"+siteCon);
|
|
List<InventoryPartUnitCostSumVo> resultList = new ArrayList<>();
|
|
int pageSize = 200;
|
|
//迭代查询
|
|
for(int i = 0; i < 10; i++){
|
|
int startIndex = i * pageSize;
|
|
List<InventoryPartUnitCostSumVo> tempList = BaseSearchApi.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 Map<String, String> getInventoryValueByPartNo(Server srv, PartInformationEntity inData) {
|
|
//查询的参数
|
|
Map<String, String> returnMap = new HashMap<>();
|
|
String site = inData.getSite();
|
|
String partNo = inData.getPartNo();
|
|
logger.info("库存件cost value请求参数 域:"+site+",物料编码:"+partNo);
|
|
try {
|
|
InventoryPartUnitCostSumVo resultRow = BaseSearchApi.getInventoryValueByPartNo(srv, site, partNo);
|
|
//判断null
|
|
if(resultRow == null) {
|
|
throw new APException("库存件按成本不存在!");
|
|
}
|
|
returnMap.put("resultCode", "200");
|
|
returnMap.put("obj", JSON.toJSONString(resultRow));
|
|
logger.info("返回集合大小:"+resultRow.toString());
|
|
} catch(APException e){
|
|
returnMap.put("resultCode", "400");
|
|
returnMap.put("resultMsg", e.getMessage());
|
|
logger.info("异常信息:"+e.getMessage());
|
|
}
|
|
return returnMap;
|
|
}
|
|
|
|
/**
|
|
* @description: 按照条件查询技术等级的数据
|
|
* @author LR
|
|
* @date 2025/1/17 13:20
|
|
* @version 1.0
|
|
*/
|
|
public Map<String, String> getTechnicalAttributesByCon(Server srv, BaseSearchData inData) {
|
|
logger.info("技术等级查询开始:"+JSON.toJSONString(inData));
|
|
//公共参数
|
|
Map<String, String> returnMap = new HashMap<>();
|
|
String keyRef = inData.getKeyRef();
|
|
String luName = inData.getLuName() ;
|
|
try {
|
|
//查询主表对应的信息
|
|
Map<String, String> resultMap = TechnicalClassApi.getTechnicalClass(srv, luName, keyRef);
|
|
//判断是否存在技术等级
|
|
if (resultMap == null || resultMap.isEmpty()){
|
|
throw new APException("不存在此技术等级的信息!");
|
|
}
|
|
//获取关联键
|
|
String technicalSpecNo = resultMap.get("TECHNICAL_SPEC_NO");
|
|
//查询技术等级属性的列表数据
|
|
List<TechnicalAttribute> resultList = BaseSearchApi.getTechnicalAttributesByCon(srv, technicalSpecNo);
|
|
returnMap.put("resultCode", "200");
|
|
returnMap.put("obj", JSON.toJSONString(resultList));
|
|
} catch(APException e){
|
|
returnMap.put("resultCode", "400");
|
|
returnMap.put("resultMsg", e.getMessage());
|
|
logger.info("异常信息:"+e.getMessage());
|
|
}
|
|
logger.info("技术等级查询结束:"+JSON.toJSONString(inData));
|
|
//返回参数
|
|
return returnMap;
|
|
}
|
|
|
|
/**
|
|
* @description: 查询加工中心成本
|
|
* @author LR
|
|
* @date 2025/1/17 13:20
|
|
* @version 1.0
|
|
*/
|
|
public List<WorkCenterCost> getWorkCenterCosts(Server srv, BaseSearchData inData) throws APException {
|
|
//查询的参数
|
|
String siteCon = inData.getSiteCon();
|
|
String ifsRowVersion = inData.getIfsRowVersion();
|
|
logger.info("加工中心成本的请求参数:"+ifsRowVersion);
|
|
List<WorkCenterCost> resultList = new ArrayList<>();
|
|
int pageSize = 200;
|
|
//迭代查询
|
|
for(int i = 0; i < 100; 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(Server srv, BaseSearchData inData) throws APException {
|
|
//查询的参数
|
|
String ifsRowVersion = inData.getIfsRowVersion();
|
|
logger.info("库存件查询的请求参数:"+ifsRowVersion);
|
|
List<PartIfsInventory> resultList = new ArrayList<>();
|
|
int pageSize = 200;
|
|
//迭代查询
|
|
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;
|
|
}
|
|
}
|
|
logger.info("返回集合大小:"+resultList.size());
|
|
return resultList;
|
|
}
|
|
|
|
/**
|
|
* @description: 查询人员等级成本
|
|
* @author LR
|
|
* @date 2025/5/6 11:55
|
|
* @version 1.0
|
|
*/
|
|
public List<PersonnelLevelVo> getLaborClassCosts(Server srv, PartInformationEntity inData) throws APException {
|
|
//查询的参数
|
|
logger.info("人员等级成本开始查询!");
|
|
String siteCon = inData.getSiteCon();
|
|
List<PersonnelLevelVo> resultList = new ArrayList<>();
|
|
int pageSize = 200;
|
|
//迭代查询
|
|
for(int i = 0; i < 100; i++){
|
|
int startIndex = i * pageSize;
|
|
List<PersonnelLevelVo> tempList = BaseSearchApi.getLaborClassCosts(srv, siteCon, startIndex, pageSize);
|
|
//判断查询是否结束
|
|
if(tempList.size() > 0) {
|
|
resultList.addAll(tempList);
|
|
}else {
|
|
break;
|
|
}
|
|
}
|
|
logger.info("人员等级成本结束查询,返回集合大小:"+resultList.size());
|
|
return resultList;
|
|
}
|
|
|
|
}
|