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.

490 lines
26 KiB

2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
  1. package com.spring.ifs.api;
  2. import com.spring.common.utils.DateUtils;
  3. import com.spring.ifs.data.*;
  4. import com.spring.ifs.utils.IfsConverterToMap;
  5. import com.spring.ifs.utils.IfsPlsqlUtils;
  6. import com.spring.modules.base.entity.WorkCenterCost;
  7. import com.spring.modules.base.vo.PersonnelLevelVo;
  8. import com.spring.modules.part.vo.InventoryPartUnitCostSumVo;
  9. import com.spring.modules.part.vo.LocationInformationVo;
  10. import com.spring.modules.part.vo.WorkCenterVo;
  11. import ifs.fnd.ap.APException;
  12. import ifs.fnd.ap.RecordCollection;
  13. import ifs.fnd.ap.Server;
  14. import java.math.BigDecimal;
  15. import java.util.ArrayList;
  16. import java.util.HashMap;
  17. import java.util.List;
  18. import java.util.Map;
  19. /**
  20. * @description: 基础查询的api
  21. * @author LR
  22. * @date 2024/12/12 10:44
  23. * @version 1.0
  24. */
  25. public class BaseSearchApi {
  26. /**
  27. * @description: 查询IFS的加工中心
  28. * @author LR
  29. * @date 2024/12/12 11:02
  30. * @version 1.0
  31. */
  32. public static List<WorkCenterVo> getWorkCenterNos(Server srv, String siteCon, String ifsRowVersion) throws APException {
  33. StringBuilder searchSql = new StringBuilder();
  34. searchSql.append("SELECT wc.contract site, wc.work_center_no, wc.description work_center_desc, wc.work_center_code_db,");
  35. searchSql.append(" (CASE WHEN work_center_code_db='I' THEN '内部' ELSE '外部' END) work_center_type, 100 efficiency,");
  36. searchSql.append(" TO_CHAR(NVL(wc.average_capacity, 0), 'FM99999999999999999999999999999999999999.999999') averageCapacity,");
  37. searchSql.append(" NVL(wc.utilization, 0) utilization, wc.sched_capacity_db capacity_type_db,");
  38. searchSql.append(" (CASE WHEN sched_capacity_db = 'I' THEN '无限产能' ELSE '有限产能' END) capacity_type, wc.uom um_id,");
  39. searchSql.append(" (CASE WHEN wc.objstate = 'Active' THEN 'Y' ELSE 'N' END) active, wc.note_text remark, wc.create_date created_date,");
  40. searchSql.append(" wc.PRODUCTION_LINE pro_line_no, 'N' can_create_new_roll_flag, 'N' need_setup_flag, wc.objid ifsRowId, wc.OBJVERSION ifsRowVersion");
  41. searchSql.append(" FROM ifsapp.WORK_CENTER wc");
  42. searchSql.append(" WHERE wc.work_center_code_db IN ('I','O')");
  43. //添加判断的查询条件
  44. if(!(null == siteCon || "".equals(siteCon))) {
  45. searchSql.append(" AND wc.contract IN "+siteCon);
  46. }
  47. //设置查询的入参
  48. Map<String, String> inParam = new HashMap<>();
  49. if(!(null == ifsRowVersion || "".equals(ifsRowVersion))) {
  50. searchSql.append(" AND wc.OBJVERSION >= :ifsRowVersion");
  51. inParam.put("ifsRowVersion", ifsRowVersion);
  52. }
  53. //添加排序语句
  54. searchSql.append(" ORDER BY wc.OBJVERSION, wc.contract, wc.work_center_no");
  55. //调用查询的通用方法
  56. RecordCollection recordCollection = IfsPlsqlUtils.execSqlSearchGetRecordCollection(srv, searchSql, inParam);
  57. //判断能否返回
  58. if (recordCollection == null) {
  59. return new ArrayList<>();
  60. } else {
  61. List<WorkCenterVo> resultItems = new ArrayList<>();
  62. //调用通用的处理方法 返回Map
  63. List<Map<String, String>> resultList = IfsConverterToMap.ConverterIfsToList(recordCollection);
  64. //判断是否存在数据
  65. if(resultList == null) {
  66. return resultItems;
  67. }
  68. //获取数据转bean
  69. for (int i = 0; i < resultList.size(); i++) {
  70. Map<String, String> tempMap = resultList.get(i);
  71. WorkCenterVo tempItem = new WorkCenterVo();
  72. //设置参数
  73. //tempItem.setIfsRowId(tempMap.get("IFSROWID"));
  74. tempItem.setIfsRowVersion(tempMap.get("IFSROWVERSION"));
  75. tempItem.setSite(tempMap.get("SITE"));
  76. tempItem.setWorkCenterNo(tempMap.get("WORK_CENTER_NO"));
  77. tempItem.setWorkCenterDesc(tempMap.get("WORK_CENTER_DESC"));
  78. tempItem.setWorkCenterTypeDB(tempMap.get("WORK_CENTER_CODE_DB"));
  79. tempItem.setWorkCenterType(tempMap.get("WORK_CENTER_TYPE"));
  80. tempItem.setAverageCapacity(new BigDecimal(tempMap.get("AVERAGECAPACITY")));
  81. tempItem.setEfficiency(new BigDecimal(tempMap.get("EFFICIENCY")));
  82. tempItem.setUtilization(new BigDecimal(tempMap.get("UTILIZATION")));
  83. tempItem.setCapacityTypeDB(tempMap.get("CAPACITY_TYPE_DB"));
  84. tempItem.setCapacityType(tempMap.get("CAPACITY_TYPE"));
  85. tempItem.setUmId(tempMap.get("UM_ID"));
  86. tempItem.setActive(tempMap.get("ACTIVE"));
  87. tempItem.setRemark(tempMap.get("REMARK"));
  88. tempItem.setCreatedDate(DateUtils.getStringToDate(tempMap.get("CREATED_DATE"), "yyyy-MM-dd HH:mm:ss"));
  89. tempItem.setProLineNo(tempMap.get("PRO_LINE_NO"));
  90. tempItem.setCanCreateNewRollFlag(tempMap.get("CAN_CREATE_NEW_ROLL_FLAG"));
  91. tempItem.setNeedSetupFlag(tempMap.get("NEED_SETUP_FLAG"));
  92. //添加对象
  93. resultItems.add(tempItem);
  94. }
  95. return resultItems;
  96. }
  97. }
  98. /**
  99. * @description: 查询机台的信息
  100. * @author LR
  101. * @date 2024/12/12 11:23
  102. * @version 1.0
  103. */
  104. public static List<LocationInformationVo> getWarehouseLocations(Server srv, String siteCon, String ifsRowVersion, int startIndex, int pageSize) throws APException {
  105. StringBuilder searchSql = new StringBuilder();
  106. searchSql.append("SELECT wbb.contract site, wbb.location_no location_id, wbb.description location_name, wbb.warehouse_id, 'Y' active, NULL create_date, 'admin' create_by,");
  107. searchSql.append(" NULL update_date, NULL update_by, ilt.inventory_location_type location_type, wbb.objid ifsRowId, wbb.OBJVERSION ifsRowVersion");
  108. searchSql.append(" FROM ifsapp.WAREHOUSE_BAY_BIN wbb, ifsapp.INVENTORY_LOCATION_GROUP ilt");
  109. searchSql.append(" WHERE wbb.location_group = ilt.LOCATION_GROUP");
  110. //添加判断的查询条件
  111. if(!(null == siteCon || "".equals(siteCon))) {
  112. searchSql.append(" AND wbb.contract IN "+siteCon);
  113. }
  114. //设置查询的入参
  115. Map<String, String> inParam = new HashMap<>();
  116. if(!(null == ifsRowVersion || "".equals(ifsRowVersion))) {
  117. searchSql.append(" AND wbb.OBJVERSION >= :ifsRowVersion");
  118. inParam.put("ifsRowVersion", ifsRowVersion);
  119. }
  120. //添加排序语句
  121. searchSql.append(" ORDER BY wbb.OBJVERSION, wbb.contract, wbb.location_no");
  122. //添加分页的查询语句
  123. searchSql.append(" OFFSET "+startIndex+" ROWS FETCH NEXT "+pageSize+" ROWS ONLY");
  124. //调用查询的通用方法
  125. RecordCollection recordCollection = IfsPlsqlUtils.execSqlSearchGetRecordCollection(srv, searchSql, inParam);
  126. //判断能否返回
  127. if (recordCollection == null) {
  128. return new ArrayList<>();
  129. } else {
  130. List<LocationInformationVo> resultItems = new ArrayList<>();
  131. //调用通用的处理方法 返回Map
  132. List<Map<String, String>> resultList = IfsConverterToMap.ConverterIfsToList(recordCollection);
  133. //判断是否存在数据
  134. if(resultList == null) {
  135. return resultItems;
  136. }
  137. //获取数据转bean
  138. for (int i = 0; i < resultList.size(); i++) {
  139. Map<String, String> tempMap = resultList.get(i);
  140. LocationInformationVo tempItem = new LocationInformationVo();
  141. //设置参数
  142. //tempItem.setIfsRowId(tempMap.get("IFSROWID"));
  143. tempItem.setIfsRowVersion(tempMap.get("IFSROWVERSION"));
  144. tempItem.setSite(tempMap.get("SITE"));
  145. tempItem.setLocationId(tempMap.get("LOCATION_ID"));
  146. tempItem.setLocationName(tempMap.get("LOCATION_NAME"));
  147. tempItem.setWarehouseId(tempMap.get("WAREHOUSE_ID"));
  148. tempItem.setActive(tempMap.get("ACTIVE"));
  149. tempItem.setCreateDate(null); // 从tempMap获取值,不再直接设为null
  150. tempItem.setCreateBy("admin"); // 注意:字段名也改为大写
  151. tempItem.setUpdateDate(null); // 从tempMap获取值,不再直接设为null
  152. tempItem.setUpdateBy(null);//直接设为null,因为SQL中对应字段是NULL
  153. tempItem.setLocationType(tempMap.get("LOCATION_TYPE"));
  154. //添加对象
  155. resultItems.add(tempItem);
  156. }
  157. return resultItems;
  158. }
  159. }
  160. /**
  161. * @description: 查询人员等级
  162. * @author LR
  163. * @date 2024/12/12 11:27
  164. * @version 1.0
  165. */
  166. public static List<PersonnelLevelVo> getIfsLaborClasss(Server srv, String siteCon, String ifsRowVersion) throws APException {
  167. StringBuilder searchSql = new StringBuilder();
  168. searchSql.append("SELECT lc.contract site, lc.labor_class_no level_id, lc.labor_class_description level_desc,");
  169. searchSql.append(" (CASE WHEN lc.objstate = 'Active' THEN 'Y' ELSE 'N' END) active, sysdate create_date, 'Admin' create_by,");
  170. searchSql.append(" NULL update_date, NULL update_by, 100 level_cost, lc.objid ifsRowId, lc.OBJVERSION ifsRowVersion");
  171. searchSql.append(" FROM ifsapp.labor_class lc");
  172. //添加判断的查询条件
  173. if(!(null == siteCon || "".equals(siteCon))) {
  174. searchSql.append(" WHERE lc.contract IN "+siteCon);
  175. }
  176. //设置查询的入参
  177. Map<String, String> inParam = new HashMap<>();
  178. if(!(null == ifsRowVersion || "".equals(ifsRowVersion))) {
  179. searchSql.append(" AND lc.OBJVERSION >= :ifsRowVersion");
  180. inParam.put("ifsRowVersion", ifsRowVersion);
  181. }
  182. //添加排序语句
  183. searchSql.append(" ORDER BY lc.OBJVERSION, lc.contract, lc.labor_class_no");
  184. //调用查询的通用方法
  185. RecordCollection recordCollection = IfsPlsqlUtils.execSqlSearchGetRecordCollection(srv, searchSql, inParam);
  186. //判断能否返回
  187. if (recordCollection == null) {
  188. return new ArrayList<>();
  189. } else {
  190. List<PersonnelLevelVo> resultItems = new ArrayList<>();
  191. //调用通用的处理方法 返回Map
  192. List<Map<String, String>> resultList = IfsConverterToMap.ConverterIfsToList(recordCollection);
  193. //判断是否存在数据
  194. if(resultList == null) {
  195. return resultItems;
  196. }
  197. //获取数据转bean
  198. for (int i = 0; i < resultList.size(); i++) {
  199. Map<String, String> tempMap = resultList.get(i);
  200. PersonnelLevelVo tempItem = new PersonnelLevelVo();
  201. //设置参数
  202. //tempItem.setIfsRowId(tempMap.get("IFSROWID"));
  203. tempItem.setIfsRowVersion(tempMap.get("IFSROWVERSION"));
  204. tempItem.setSite(tempMap.get("SITE"));
  205. tempItem.setLevelId(tempMap.get("LEVEL_ID"));
  206. tempItem.setLevelDesc(tempMap.get("LEVEL_DESC"));
  207. tempItem.setActive(tempMap.get("ACTIVE"));
  208. tempItem.setCreateDate(DateUtils.getStringToDate(tempMap.get("CREATE_DATE"), "yyyy-MM-dd HH:mm:ss")); // 从tempMap获取值
  209. tempItem.setCreateBy(tempMap.get("CREATE_BY")); // 注意:字段名也改为大写
  210. tempItem.setUpdateDate(null); // 从tempMap获取值
  211. tempItem.setUpdateBy(tempMap.get("UPDATE_BY")); // 从tempMap获取值
  212. tempItem.setLevelCost(new BigDecimal(tempMap.get("LEVEL_COST"))); // 获取成本值
  213. //添加对象
  214. resultItems.add(tempItem);
  215. }
  216. return resultItems;
  217. }
  218. }
  219. /**
  220. * @description: 获取物料件的数据
  221. * @author LR
  222. * @date 2024/12/12 11:34
  223. * @version 1.0
  224. */
  225. public static List<PartCatalog> getPartCatalogs(Server srv, String ifsRowVersion, int startIndex, int pageSize) throws APException {
  226. StringBuilder searchSql = new StringBuilder();
  227. searchSql.append("SELECT PART_NO, DESCRIPTION partDesc, INFO_TEXT, STD_NAME_ID, UNIT_CODE,");
  228. searchSql.append(" LOT_TRACKING_CODE, WEIGHT_NET, UOM_FOR_WEIGHT_NET, VOLUME_NET, UOM_FOR_VOLUME_NET,");
  229. searchSql.append(" OBJID ifsRowId, OBJVERSION ifsRowVersion");
  230. searchSql.append(" FROM IFSAPP.PART_CATALOG pc");
  231. //设置查询的入参
  232. Map<String, String> inParam = new HashMap<>();
  233. if(!(null == ifsRowVersion || "".equals(ifsRowVersion))) {
  234. searchSql.append(" WHERE pc.OBJVERSION >= :ifsRowVersion");
  235. inParam.put("ifsRowVersion", ifsRowVersion);
  236. }
  237. //添加排序语句
  238. searchSql.append(" ORDER BY pc.OBJVERSION, pc.PART_NO, pc.DESCRIPTION");
  239. //添加分页的查询语句
  240. searchSql.append(" OFFSET "+startIndex+" ROWS FETCH NEXT "+pageSize+" ROWS ONLY");
  241. //调用查询的通用方法
  242. RecordCollection recordCollection = IfsPlsqlUtils.execSqlSearchGetRecordCollection(srv, searchSql, inParam);
  243. //判断能否返回
  244. if (recordCollection == null) {
  245. return new ArrayList<>();
  246. } else {
  247. List<PartCatalog> resultItems = new ArrayList<>();
  248. //调用通用的处理方法 返回Map
  249. List<Map<String, String>> resultList = IfsConverterToMap.ConverterIfsToList(recordCollection);
  250. //获取数据转bean
  251. for (int i = 0; i < resultList.size(); i++) {
  252. Map<String, String> tempMap = resultList.get(i);
  253. PartCatalog tempItem = new PartCatalog();
  254. //设置参数
  255. tempItem.setIfsRowId(tempMap.get("IFSROWID"));
  256. tempItem.setIfsRowVersion(tempMap.get("IFSROWVERSION"));
  257. tempItem.setPartNo(tempMap.get("PART_NO"));
  258. tempItem.setPartDesc(tempMap.get("PARTDESC")); // 注意:使用小写的partDesc以匹配属性名
  259. tempItem.setInfoText(tempMap.get("INFO_TEXT"));
  260. tempItem.setStdNameId(tempMap.get("STD_NAME_ID"));
  261. tempItem.setUnitCode(tempMap.get("UNIT_CODE"));
  262. tempItem.setLotTrackingCode(tempMap.get("LOT_TRACKING_CODE"));
  263. tempItem.setWeightNet(tempMap.get("WEIGHT_NET"));
  264. tempItem.setUomForWeightNet(tempMap.get("UOM_FOR_WEIGHT_NET"));
  265. tempItem.setVolumeNet(tempMap.get("VOLUME_NET"));
  266. tempItem.setUomForVolumeNet(tempMap.get("UOM_FOR_VOLUME_NET"));
  267. //添加对象
  268. resultItems.add(tempItem);
  269. }
  270. return resultItems;
  271. }
  272. }
  273. /**
  274. * @description: 查询库存件的属性值
  275. * @author LR
  276. * @date 2024/12/12 11:38
  277. * @version 1.0
  278. */
  279. public static List<InventoryPartUnitCostSumVo> getInventoryValues(Server srv, String siteCon, String ifsRowVersion, int startIndex, int pageSize) throws APException {
  280. StringBuilder searchSql = new StringBuilder();
  281. searchSql.append("SELECT OBJID ifsRowId, OBJVERSION ifsRowVersion, CONTRACT site, PART_NO, CONFIGURATION_ID, LOT_BATCH_NO, SERIAL_NO,");
  282. searchSql.append(" ifsapp.Inventory_Part_Unit_Cost_API.Get_Inventory_Value_By_Method(CONTRACT,PART_NO,CONFIGURATION_ID,LOT_BATCH_NO,SERIAL_NO) inventoryValue");
  283. searchSql.append(" FROM ifsapp.INVENTORY_PART_UNIT_COST_SUM pcs");
  284. searchSql.append(" WHERE pcs.CONFIGURATION_ID = '*'");
  285. //添加判断的查询条件
  286. if(!(null == siteCon || "".equals(siteCon))) {
  287. searchSql.append(" AND pcs.contract IN "+siteCon);
  288. }
  289. //设置查询的入参
  290. Map<String, String> inParam = new HashMap<>();
  291. if(!(null == ifsRowVersion || "".equals(ifsRowVersion))) {
  292. searchSql.append(" AND pcs.OBJVERSION >= :ifsRowVersion");
  293. inParam.put("ifsRowVersion", ifsRowVersion);
  294. }
  295. //添加排序语句
  296. searchSql.append(" ORDER BY pcs.OBJVERSION, pcs.contract, pcs.PART_NO");
  297. //添加分页的查询语句
  298. searchSql.append(" OFFSET "+startIndex+" ROWS FETCH NEXT "+pageSize+" ROWS ONLY");
  299. //调用查询的通用方法
  300. RecordCollection recordCollection = IfsPlsqlUtils.execSqlSearchGetRecordCollection(srv, searchSql, inParam);
  301. //判断能否返回
  302. if (recordCollection == null) {
  303. return new ArrayList<>();
  304. } else {
  305. List<InventoryPartUnitCostSumVo> resultItems = new ArrayList<>();
  306. //调用通用的处理方法 返回Map
  307. List<Map<String, String>> resultList = IfsConverterToMap.ConverterIfsToList(recordCollection);
  308. //获取数据转bean
  309. for (int i = 0; i < resultList.size(); i++) {
  310. Map<String, String> tempMap = resultList.get(i);
  311. InventoryPartUnitCostSumVo tempItem = new InventoryPartUnitCostSumVo();
  312. //设置参数
  313. //tempItem.setIfsRowId(tempMap.get("IFSROWID"));
  314. tempItem.setIfsRowVersion(tempMap.get("IFSROWVERSION"));
  315. tempItem.setSite(tempMap.get("SITE"));
  316. tempItem.setPartNo(tempMap.get("PART_NO"));
  317. tempItem.setConfigurationId(tempMap.get("CONFIGURATION_ID"));
  318. tempItem.setLotBatchNo(tempMap.get("LOT_BATCH_NO"));
  319. tempItem.setSerialNo(tempMap.get("SERIAL_NO"));
  320. tempItem.setInventoryValue(tempMap.get("INVENTORYVALUE"));
  321. //添加对象
  322. resultItems.add(tempItem);
  323. }
  324. return resultItems;
  325. }
  326. }
  327. /**
  328. * @description: 根据条件查询库存件的成本价
  329. * @author LR
  330. * @date 2025/1/17 11:36
  331. * @version 1.0
  332. */
  333. public static InventoryPartUnitCostSumVo getInventoryValueByPartNo(Server srv, String contract, String partNo) throws APException {
  334. StringBuilder searchSql = new StringBuilder();
  335. searchSql.append("SELECT OBJID ifsRowId, OBJVERSION ifsRowVersion, CONTRACT site, PART_NO, CONFIGURATION_ID, LOT_BATCH_NO, SERIAL_NO,");
  336. searchSql.append(" ifsapp.Inventory_Part_Unit_Cost_API.Get_Inventory_Value_By_Method(CONTRACT,PART_NO,CONFIGURATION_ID,LOT_BATCH_NO,SERIAL_NO) inventoryValue");
  337. searchSql.append(" FROM ifsapp.INVENTORY_PART_UNIT_COST_SUM pcs");
  338. searchSql.append(" WHERE pcs.CONTRACT = : contract AND pcs.PART_NO = :partNo AND pcs.CONFIGURATION_ID = '*'");
  339. //设置查询的入参
  340. Map<String, String> inParam = new HashMap<>();
  341. inParam.put("contract", contract);
  342. inParam.put("partNo", partNo);
  343. //调用查询的通用方法
  344. RecordCollection recordCollection = IfsPlsqlUtils.execSqlSearchGetRecordCollection(srv, searchSql, inParam);
  345. //判断能否返回
  346. if (recordCollection == null) {
  347. return null;
  348. } else {
  349. //调用通用的处理方法 返回Map
  350. Map<String, String> resultMap = IfsConverterToMap.ConverterIfsToMap(recordCollection.get(0));
  351. InventoryPartUnitCostSumVo resultRow = new InventoryPartUnitCostSumVo();
  352. //设置参数
  353. resultRow.setIfsRowId(resultMap.get("IFSROWID"));
  354. resultRow.setIfsRowVersion(resultMap.get("IFSROWVERSION"));
  355. resultRow.setSite(resultMap.get("SITE"));
  356. resultRow.setPartNo(resultMap.get("PART_NO"));
  357. resultRow.setConfigurationId(resultMap.get("CONFIGURATION_ID"));
  358. resultRow.setLotBatchNo(resultMap.get("LOT_BATCH_NO"));
  359. resultRow.setSerialNo(resultMap.get("SERIAL_NO"));
  360. resultRow.setInventoryValue(resultMap.get("INVENTORYVALUE"));
  361. return resultRow;
  362. }
  363. }
  364. /**
  365. * @description: 查询技术等级的属性列表
  366. * @author LR
  367. * @date 2025/1/17 14:12
  368. * @version 1.0
  369. */
  370. public static List<TechnicalAttribute> getTechnicalAttributesByCon(Server srv, String technicalSpecNo) throws APException {
  371. StringBuilder searchSql = new StringBuilder();
  372. searchSql.append("SELECT OBJID ifsRowId, OBJVERSION ifsRowVersion, TECHNICAL_SPEC_NO, TECHNICAL_CLASS, ATTRIB_NUMBER, ATTRIBUTE,");
  373. searchSql.append(" VALUE_NO, LOWER_LIMIT, UPPER_LIMIT, INFO, ALT_VALUE_NO, ALT_UNIT,");
  374. searchSql.append(" CASE WHEN objtype = 'TechnicalSpecNumeric' THEN 'Numeric'");
  375. searchSql.append(" WHEN objtype = 'TechnicalSpecAlphanum' THEN 'Alpha' ELSE '' END attributeType");
  376. searchSql.append(" FROM ifsapp.TECHNICAL_SPECIFICATION_BOTH");
  377. searchSql.append(" WHERE TECHNICAL_SPEC_NO = :technicalSpecNo");
  378. //设置查询的入参
  379. Map<String, String> inParam = new HashMap<>();
  380. inParam.put("technicalSpecNo", technicalSpecNo);
  381. //调用查询的通用方法
  382. RecordCollection recordCollection = IfsPlsqlUtils.execSqlSearchGetRecordCollection(srv, searchSql, inParam);
  383. //判断能否返回
  384. if (recordCollection == null) {
  385. return new ArrayList<>();
  386. } else {
  387. List<TechnicalAttribute> technicalAttributes = new ArrayList<>();
  388. //处理结果集
  389. List<Map<String, String>> resultList = IfsConverterToMap.ConverterIfsToList(recordCollection);
  390. //获取数据转bean
  391. for (int i = 0; i < resultList.size(); i++) {
  392. Map<String, String> tempMap = resultList.get(i);
  393. TechnicalAttribute tempItem = new TechnicalAttribute();
  394. //设置参数
  395. tempItem.setIfsRowId(tempMap.get("IFSROWID"));
  396. tempItem.setIfsRowVersion(tempMap.get("IFSROWVERSION"));
  397. tempItem.setTechnicalSpecNo(tempMap.get("TECHNICAL_SPEC_NO"));
  398. tempItem.setTechnicalClass(tempMap.get("TECHNICAL_CLASS"));
  399. tempItem.setAttribute(tempMap.get("ATTRIBUTE"));
  400. tempItem.setValueNo(tempMap.get("VALUE_NO"));
  401. tempItem.setLowerLimit(tempMap.get("LOWER_LIMIT"));
  402. tempItem.setUpperLimit(tempMap.get("UPPER_LIMIT"));
  403. tempItem.setInfo(tempMap.get("INFO"));
  404. tempItem.setAttributeType(tempMap.get("ATTRIBUTETYPE"));
  405. //添加对象
  406. technicalAttributes.add(tempItem);
  407. }
  408. return technicalAttributes;
  409. }
  410. }
  411. /**
  412. * @description: 加工中心成本
  413. * @author LR
  414. * @date 2025/2/10 15:17
  415. * @version 1.0
  416. */
  417. public static List<WorkCenterCost> getWorkCenterCosts(Server srv, String siteCon, String ifsRowVersion, int startIndex, int pageSize) throws APException {
  418. StringBuilder searchSql = new StringBuilder();
  419. searchSql.append("SELECT OBJID ifsRowId, OBJVERSION ifsRowVersion, CONTRACT, WORK_CENTER_NO,");
  420. searchSql.append(" ifsapp.WORK_CENTER_API.Get_Description(CONTRACT, WORK_CENTER_NO) workCenterDesc,");
  421. searchSql.append(" COST_SET, ifsapp.COST_SET_API.Get_Description(CONTRACT,COST_SET) costSetDesc, WC_RATE, WC_COST_CODE,");
  422. searchSql.append(" OVERHEAD1_FAC, OVERHEAD1_APPL, OVERHEAD2_FAC, OVERHEAD2_APPL,");
  423. searchSql.append(" to_char(START_DATE, 'yyyy-MM-dd') START_DATE, to_char(END_DATE, 'yyyy-MM-dd') END_DATE");
  424. searchSql.append(" FROM ifsapp.WORK_CENTER_COST");
  425. searchSql.append(" WHERE ifsapp.Work_Center_API.Get_Work_Center_Code_Db(contract, work_center_no) = 'I'");
  426. //设置查询的入参
  427. Map<String, String> inParam = new HashMap<>();
  428. //判断是否存在入参
  429. if ((ifsRowVersion == null || "".equals(ifsRowVersion))){
  430. searchSql.append(" AND OBJVERSION >= :ifsRowVersion");
  431. inParam.put("ifsRowVersion", ifsRowVersion);
  432. }
  433. //添加排序语句
  434. searchSql.append(" ORDER BY OBJVERSION, CONTRACT, WORK_CENTER_NO");
  435. //添加分页的查询语句
  436. searchSql.append(" OFFSET "+startIndex+" ROWS FETCH NEXT "+pageSize+" ROWS ONLY");
  437. //调用查询的通用方法
  438. RecordCollection recordCollection = IfsPlsqlUtils.execSqlSearchGetRecordCollection(srv, searchSql, inParam);
  439. //判断能否返回
  440. if (recordCollection == null) {
  441. return new ArrayList<>();
  442. } else {
  443. List<WorkCenterCost> technicalAttributes = new ArrayList<>();
  444. //处理结果集
  445. List<Map<String, String>> resultList = IfsConverterToMap.ConverterIfsToList(recordCollection);
  446. //获取数据转bean
  447. for (int i = 0; i < resultList.size(); i++) {
  448. Map<String, String> tempMap = resultList.get(i);
  449. WorkCenterCost tempItem = new WorkCenterCost();
  450. //设置参数
  451. tempItem.setIfsRowId(tempMap.get("IFSROWID"));
  452. tempItem.setIfsRowVersion(tempMap.get("IFSROWVERSION"));
  453. tempItem.setSite(tempMap.get("CONTRACT"));
  454. tempItem.setWorkCenterNo(tempMap.get("WORK_CENTER_NO"));
  455. tempItem.setWorkCenterDesc(tempMap.get("WORKCENTERDESC"));
  456. tempItem.setCostSet(tempMap.get("COST_SET"));
  457. tempItem.setCostSetDesc(tempMap.get("COSTSETDESC"));
  458. tempItem.setWcCostCode(tempMap.get("WC_COST_CODE"));
  459. tempItem.setOverhead1Fac(tempMap.get("OVERHEAD1_FAC"));
  460. tempItem.setOverhead2Fac(tempMap.get("OVERHEAD2_FAC"));
  461. tempItem.setOverhead1Appl(tempMap.get("OVERHEAD1_APPL"));
  462. tempItem.setOverhead2Appl(tempMap.get("OVERHEAD2_APPL"));
  463. String startDate = tempMap.get("START_DATE");
  464. if (!(null == startDate || "".equals(startDate))){
  465. tempItem.setBeginDate(DateUtils.getStringToDate(startDate, "yyyy-MM-dd"));
  466. }
  467. String endDate = tempMap.get("END_DATE");
  468. if (!(null == endDate || "".equals(endDate))) {
  469. tempItem.setEndDate(DateUtils.getStringToDate(endDate, "yyyy-MM-dd"));
  470. }
  471. //添加对象
  472. technicalAttributes.add(tempItem);
  473. }
  474. return technicalAttributes;
  475. }
  476. }
  477. }