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

1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
  1. package com.spring.ifs.bean;
  2. import com.alibaba.fastjson.JSON;
  3. import com.spring.ifs.api.BaseSearchApi;
  4. import com.spring.ifs.api.IfsServer;
  5. import com.spring.ifs.api.TechnicalClassApi;
  6. import com.spring.ifs.data.*;
  7. import com.spring.modules.base.entity.WorkCenterCost;
  8. import com.spring.modules.base.vo.PersonnelLevelVo;
  9. import com.spring.modules.part.entity.APIEntity.PartIfsInventory;
  10. import com.spring.modules.part.entity.PartInformationEntity;
  11. import com.spring.modules.part.vo.InventoryPartUnitCostSumVo;
  12. import com.spring.modules.part.vo.LocationInformationVo;
  13. import com.spring.modules.part.vo.WorkCenterVo;
  14. import ifs.fnd.ap.APException;
  15. import ifs.fnd.ap.Server;
  16. import org.slf4j.Logger;
  17. import org.slf4j.LoggerFactory;
  18. import org.springframework.beans.factory.annotation.Autowired;
  19. import org.springframework.stereotype.Component;
  20. import java.util.ArrayList;
  21. import java.util.HashMap;
  22. import java.util.List;
  23. import java.util.Map;
  24. /**
  25. * @description: 基础查询的实现类
  26. * @author LR
  27. * @date 2024/12/9 11:49
  28. * @version 1.0
  29. */
  30. @Component
  31. public class BaseSearchBean {
  32. @Autowired
  33. private IfsServer ifsServer;
  34. private static final Logger logger = LoggerFactory.getLogger(BaseSearchBean.class);
  35. /**
  36. * @description: 查询加工中心
  37. * @author LR
  38. * @date 2024/12/12 13:23
  39. * @version 1.0
  40. */
  41. public List<WorkCenterVo> getWorkCenterNos(Server srv, PartInformationEntity inData) throws APException {
  42. //查询的参数
  43. String siteCon = inData.getSiteCon();
  44. String ifsRowVersion = inData.getIfsRowVersion();
  45. logger.info("请求参数:"+siteCon);
  46. List<WorkCenterVo> resultList = BaseSearchApi.getWorkCenterNos(srv, siteCon, ifsRowVersion);;
  47. logger.info("返回集合大小:"+resultList.size());
  48. return resultList;
  49. }
  50. /**
  51. * @description: 查询
  52. * @author LR
  53. * @date 2024/12/12 13:24
  54. * @version 1.0
  55. */
  56. public List<LocationInformationVo> getWarehouseLocations(Server srv, PartInformationEntity inData) throws APException {
  57. //查询的参数
  58. String siteCon = inData.getSiteCon();
  59. String ifsRowVersion = inData.getIfsRowVersion();
  60. logger.info("请求参数:"+siteCon);
  61. List<LocationInformationVo> resultList = new ArrayList<>();
  62. int pageSize = 200;
  63. //迭代查询
  64. for(int i = 0; i < 150; i++){
  65. int startIndex = i * pageSize;
  66. List<LocationInformationVo> tempList = BaseSearchApi.getWarehouseLocations(srv, siteCon, startIndex, pageSize);
  67. //判断查询是否结束
  68. if(tempList.size() > 0) {
  69. resultList.addAll(tempList);
  70. }else {
  71. break;
  72. }
  73. }
  74. logger.info("返回集合大小:"+resultList.size());
  75. return resultList;
  76. }
  77. /**
  78. * @description: 获取人员等级的信息
  79. * @author LR
  80. * @date 2024/12/12 13:29
  81. * @version 1.0
  82. */
  83. public List<PersonnelLevelVo> getIfsLaborClasss(Server srv, PartInformationEntity inData) throws APException {
  84. //查询的参数
  85. String siteCon = inData.getSiteCon();
  86. String ifsRowVersion = inData.getIfsRowVersion();
  87. return BaseSearchApi.getIfsLaborClasss(srv, siteCon, ifsRowVersion);
  88. }
  89. /**
  90. * @description: 查询物料件的信息
  91. * @author LR
  92. * @date 2024/12/9 13:28
  93. * @version 1.0
  94. */
  95. public List<PartCatalog> getMasterParts(Server srv, PartInformationEntity inData) throws APException {
  96. //公共参数
  97. String ifsRowVersion = inData.getIfsRowVersion();
  98. //获取连接
  99. List<PartCatalog> resultList = new ArrayList<>();
  100. int pageSize = 200;
  101. //迭代查询
  102. for(int i = 0; i < 10; i++){
  103. int startIndex = i * pageSize;
  104. List<PartCatalog> tempList = BaseSearchApi.getPartCatalogs(srv, ifsRowVersion, startIndex, pageSize);
  105. //判断查询是否结束
  106. if(tempList.size() > 0) {
  107. resultList.addAll(tempList);
  108. }else {
  109. break;
  110. }
  111. }
  112. logger.info("返回集合大小:"+resultList.size());
  113. return resultList;
  114. }
  115. /**
  116. * @description: 查询库存件的属性值
  117. * @author LR
  118. * @date 2024/12/12 13:33
  119. * @version 1.0
  120. */
  121. public List<InventoryPartUnitCostSumVo> getInventoryValues(Server srv, PartInformationEntity inData) throws APException {
  122. //查询的参数
  123. String siteCon = inData.getSiteCon();
  124. String ifsRowVersion = inData.getIfsRowVersion();
  125. logger.info("库存件cost value请求参数:"+siteCon);
  126. List<InventoryPartUnitCostSumVo> resultList = new ArrayList<>();
  127. int pageSize = 200;
  128. //迭代查询
  129. for(int i = 0; i < 10; i++){
  130. int startIndex = i * pageSize;
  131. List<InventoryPartUnitCostSumVo> tempList = BaseSearchApi.getInventoryValues(srv, siteCon, ifsRowVersion, startIndex, pageSize);
  132. //判断查询是否结束
  133. if(tempList.size() > 0) {
  134. resultList.addAll(tempList);
  135. }else {
  136. break;
  137. }
  138. }
  139. logger.info("返回集合大小:"+resultList.size());
  140. return resultList;
  141. }
  142. /**
  143. * @description: 按照条件查询库存件的成本
  144. * @author LR
  145. * @date 2025/1/17 11:40
  146. * @version 1.0
  147. */
  148. public Map<String, String> getInventoryValueByPartNo(Server srv, PartInformationEntity inData) {
  149. //查询的参数
  150. Map<String, String> returnMap = new HashMap<>();
  151. String site = inData.getSite();
  152. String partNo = inData.getPartNo();
  153. logger.info("库存件cost value请求参数 域:"+site+",物料编码:"+partNo);
  154. try {
  155. InventoryPartUnitCostSumVo resultRow = BaseSearchApi.getInventoryValueByPartNo(srv, site, partNo);
  156. //判断null
  157. if(resultRow == null) {
  158. throw new APException("库存件按成本不存在!");
  159. }
  160. returnMap.put("resultCode", "200");
  161. returnMap.put("obj", JSON.toJSONString(resultRow));
  162. logger.info("返回集合大小:"+resultRow.toString());
  163. } catch(APException e){
  164. returnMap.put("resultCode", "400");
  165. returnMap.put("resultMsg", e.getMessage());
  166. logger.info("异常信息:"+e.getMessage());
  167. }
  168. return returnMap;
  169. }
  170. /**
  171. * @description: 按照条件查询技术等级的数据
  172. * @author LR
  173. * @date 2025/1/17 13:20
  174. * @version 1.0
  175. */
  176. public Map<String, String> getTechnicalAttributesByCon(Server srv, BaseSearchData inData) {
  177. logger.info("技术等级查询开始:"+JSON.toJSONString(inData));
  178. //公共参数
  179. Map<String, String> returnMap = new HashMap<>();
  180. String keyRef = inData.getKeyRef();
  181. String luName = inData.getLuName() ;
  182. try {
  183. //查询主表对应的信息
  184. Map<String, String> resultMap = TechnicalClassApi.getTechnicalClass(srv, luName, keyRef);
  185. //判断是否存在技术等级
  186. if (resultMap == null || resultMap.isEmpty()){
  187. throw new APException("不存在此技术等级的信息!");
  188. }
  189. //获取关联键
  190. String technicalSpecNo = resultMap.get("TECHNICAL_SPEC_NO");
  191. //查询技术等级属性的列表数据
  192. List<TechnicalAttribute> resultList = BaseSearchApi.getTechnicalAttributesByCon(srv, technicalSpecNo);
  193. returnMap.put("resultCode", "200");
  194. returnMap.put("obj", JSON.toJSONString(resultList));
  195. } catch(APException e){
  196. returnMap.put("resultCode", "400");
  197. returnMap.put("resultMsg", e.getMessage());
  198. logger.info("异常信息:"+e.getMessage());
  199. }
  200. logger.info("技术等级查询结束:"+JSON.toJSONString(inData));
  201. //返回参数
  202. return returnMap;
  203. }
  204. /**
  205. * @description: 查询加工中心成本
  206. * @author LR
  207. * @date 2025/1/17 13:20
  208. * @version 1.0
  209. */
  210. public List<WorkCenterCost> getWorkCenterCosts(Server srv, BaseSearchData inData) throws APException {
  211. //查询的参数
  212. String siteCon = inData.getSiteCon();
  213. String ifsRowVersion = inData.getIfsRowVersion();
  214. logger.info("加工中心成本的请求参数:"+ifsRowVersion);
  215. List<WorkCenterCost> resultList = new ArrayList<>();
  216. int pageSize = 200;
  217. //迭代查询
  218. for(int i = 0; i < 100; i++){
  219. int startIndex = i * pageSize;
  220. List<WorkCenterCost> tempList = BaseSearchApi.getWorkCenterCosts(srv, siteCon, ifsRowVersion, startIndex, pageSize);
  221. //判断查询是否结束
  222. if(tempList.size() > 0) {
  223. resultList.addAll(tempList);
  224. }else {
  225. break;
  226. }
  227. }
  228. logger.info("返回集合大小:"+resultList.size());
  229. return resultList;
  230. }
  231. /**
  232. * @description: 按照时间获取所有域下的库存件信息
  233. * @author LR
  234. * @date 2025/3/7 11:01
  235. * @version 1.0
  236. */
  237. public List<PartIfsInventory> getInventoryParts(Server srv, BaseSearchData inData) throws APException {
  238. //查询的参数
  239. String ifsRowVersion = inData.getIfsRowVersion();
  240. logger.info("库存件查询的请求参数:"+ifsRowVersion);
  241. List<PartIfsInventory> resultList = new ArrayList<>();
  242. int pageSize = 200;
  243. //迭代查询
  244. for(int i = 0; i < 100; i++){
  245. int startIndex = i * pageSize;
  246. List<PartIfsInventory> tempList = BaseSearchApi.getInventoryParts(srv, ifsRowVersion, startIndex, pageSize);
  247. //判断查询是否结束
  248. if(tempList.size() > 0) {
  249. resultList.addAll(tempList);
  250. }else {
  251. break;
  252. }
  253. }
  254. logger.info("返回集合大小:"+resultList.size());
  255. return resultList;
  256. }
  257. /**
  258. * @description: 查询人员等级成本
  259. * @author LR
  260. * @date 2025/5/6 11:55
  261. * @version 1.0
  262. */
  263. public List<PersonnelLevelVo> getLaborClassCosts(Server srv, PartInformationEntity inData) throws APException {
  264. //查询的参数
  265. logger.info("人员等级成本开始查询!");
  266. String siteCon = inData.getSiteCon();
  267. List<PersonnelLevelVo> resultList = new ArrayList<>();
  268. int pageSize = 200;
  269. //迭代查询
  270. for(int i = 0; i < 100; i++){
  271. int startIndex = i * pageSize;
  272. List<PersonnelLevelVo> tempList = BaseSearchApi.getLaborClassCosts(srv, siteCon, startIndex, pageSize);
  273. //判断查询是否结束
  274. if(tempList.size() > 0) {
  275. resultList.addAll(tempList);
  276. }else {
  277. break;
  278. }
  279. }
  280. logger.info("人员等级成本结束查询,返回集合大小:"+resultList.size());
  281. return resultList;
  282. }
  283. }