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.

200 lines
8.8 KiB

  1. package com.spring.ifs.api;
  2. import com.spring.ifs.data.PartCatalog;
  3. import com.spring.ifs.utils.IfsConverterToMap;
  4. import com.spring.ifs.utils.IfsPlsqlUtils;
  5. import ifs.fnd.ap.*;
  6. import java.util.HashMap;
  7. import java.util.Map;
  8. /**
  9. * @description: 处理Master业务的底层相关函数
  10. * @author LR
  11. * @date 2024/12/9 10:56
  12. * @version 1.0
  13. */
  14. public class MasterPartApiTest {
  15. /**
  16. * @description: 获取Master part的相关信息
  17. * @author LR
  18. * @date 2024/12/9 11:13
  19. * @version 1.0
  20. */
  21. public static Map<String, String> getMasterPart(Server srv, String partNo) throws APException {
  22. StringBuilder searchSql = new StringBuilder();
  23. searchSql.append("SELECT PART_NO, DESCRIPTION partDesc, objid ifsRowId, objversion ifsRowVersion");
  24. searchSql.append(" FROM IFSAPP.PART_CATALOG");
  25. searchSql.append(" WHERE PART_NO = :partNo");
  26. //设置查询的入参
  27. Map<String, String> inParam = new HashMap<>();
  28. inParam.put("partNo", partNo);
  29. //调用查询的通用方法
  30. Record resultRecord = IfsPlsqlUtils.execSqlSearchGetRecord(srv, searchSql, inParam);
  31. //判断能否返回
  32. if (resultRecord == null) {
  33. return null;
  34. } else {
  35. //调用通用的处理方法 返回Map
  36. Map<String, String> resultMap = IfsConverterToMap.ConverterIfsToMap(resultRecord);
  37. return resultMap;
  38. }
  39. }
  40. /**
  41. * @description: 执行库存件的新增操作
  42. * @author LR
  43. * @date 2024/12/10 17:59
  44. * @version 1.0
  45. */
  46. public static Map<String, String> insertMasterPart(Server srv, PartCatalog inData) throws APException {
  47. //公共参数
  48. String partNo = inData.getPartNo().toUpperCase();
  49. String partDesc = inData.getPartDesc();
  50. String unitCode = inData.getUnitCode();
  51. String partMainGroup = inData.getPartMainGroup();
  52. String weightNet = inData.getWeightNet();
  53. String uomForWeightNet = inData.getUomForWeightNet();
  54. String volumeNet = inData.getVolumeNet();
  55. String uomForVolumeNet = inData.getUomForVolumeNet();
  56. String conditionCodeUsageDb = inData.getConditionCodeUsageDb();
  57. String multilevelTrackingDb = inData.getMultilevelTrackingDb();
  58. String allowAsNotConsumedDb = inData.getAllowAsNotConsumedDb();
  59. String lotTrackingCode = inData.getLotTrackingCode();
  60. String lotQuantityRule = inData.getLotQuantityRule();
  61. String subLotRule = inData.getSubLotRule();
  62. String componentLotRule = inData.getComponentLotRule();
  63. String infoText = inData.getInfoText();
  64. //入参
  65. Map<String, String> inParam = new HashMap<>();
  66. //填充参数
  67. inParam.put("PART_NO", partNo);
  68. inParam.put("DESCRIPTION", partDesc);
  69. inParam.put("UNIT_CODE", unitCode);
  70. inParam.put("STD_NAME_ID", "0");
  71. inParam.put("PART_MAIN_GROUP", partMainGroup);
  72. inParam.put("WEIGHT_NET", weightNet);
  73. inParam.put("UOM_FOR_WEIGHT_NET", uomForWeightNet);
  74. inParam.put("VOLUME_NET", volumeNet);
  75. inParam.put("UOM_FOR_VOLUME_NET", uomForVolumeNet);
  76. inParam.put("FREIGHT_FACTOR", "1");
  77. inParam.put("POSITION_PART_DB", "NOT POSITION PART");
  78. inParam.put("CONDITION_CODE_USAGE_DB", conditionCodeUsageDb);
  79. inParam.put("CONFIGURABLE_DB", "NOT CONFIGURED");
  80. inParam.put("CATCH_UNIT_ENABLED_DB", "FALSE");
  81. inParam.put("MULTILEVEL_TRACKING_DB", multilevelTrackingDb);
  82. inParam.put("ALLOW_AS_NOT_CONSUMED_DB", allowAsNotConsumedDb);
  83. inParam.put("RECEIPT_ISSUE_SERIAL_TRACK_DB", "FALSE");
  84. inParam.put("SERIAL_TRACKING_CODE_DB", "NOT SERIAL TRACKING");
  85. inParam.put("ENG_SERIAL_TRACKING_CODE_DB", "NOT SERIAL TRACKING");
  86. inParam.put("STOP_ARRIVAL_ISSUED_SERIAL_DB", "FALSE");
  87. inParam.put("STOP_NEW_SERIAL_IN_RMA_DB", "TRUE");
  88. inParam.put("SERIAL_RULE", "Manual");
  89. inParam.put("LOT_TRACKING_CODE", lotTrackingCode);
  90. inParam.put("LOT_QUANTITY_RULE", lotQuantityRule);
  91. inParam.put("SUB_LOT_RULE", subLotRule);
  92. inParam.put("COMPONENT_LOT_RULE", componentLotRule);
  93. inParam.put("INFO_TEXT", infoText);
  94. inParam.put("OBJID", "");
  95. inParam.put("OBJVERSION", "");
  96. //执行存储过程 获取结果集
  97. //执行check的操作
  98. Map<String, String> checkMap = IfsPlsqlUtils.execProcedureGetRecord(srv, "PART_CATALOG_API",
  99. "NEW__", PlsqlBaseMethodType.NEW, PlsqlBaseMethodAction.CHECK, inParam);
  100. //执行do的操作
  101. Map<String, String> resultMap = IfsPlsqlUtils.execProcedureGetRecord(srv, "PART_CATALOG_API",
  102. "NEW__", PlsqlBaseMethodType.NEW, PlsqlBaseMethodAction.DO, inParam);
  103. //返回结果集
  104. return resultMap;
  105. }
  106. /**
  107. * @description: 修改物料件的数据
  108. * @author LR
  109. * @date 2024/12/11 9:24
  110. * @version 1.0
  111. */
  112. public static Map<String, String> modifyMasterPart(Server srv, PartCatalog inData) throws APException {
  113. //公共参数
  114. String ifsRowId = inData.getIfsRowId();
  115. String ifsRowVersion = inData.getIfsRowVersion();
  116. String partDesc = inData.getPartDesc();
  117. String unitCode = inData.getUnitCode();
  118. String partMainGroup = inData.getPartMainGroup();
  119. String weightNet = inData.getWeightNet();
  120. String uomForWeightNet = inData.getUomForWeightNet();
  121. String volumeNet = inData.getVolumeNet();
  122. String uomForVolumeNet = inData.getUomForVolumeNet();
  123. String conditionCodeUsageDb = inData.getConditionCodeUsageDb();
  124. String multilevelTrackingDb = inData.getMultilevelTrackingDb();
  125. String allowAsNotConsumedDb = inData.getAllowAsNotConsumedDb();
  126. String lotTrackingCode = inData.getLotTrackingCode();
  127. String lotQuantityRule = inData.getLotQuantityRule();
  128. String subLotRule = inData.getSubLotRule();
  129. String componentLotRule = inData.getComponentLotRule();
  130. String infoText = inData.getInfoText();
  131. //入参
  132. Map<String, String> inParam = new HashMap<>();
  133. //填充参数
  134. inParam.put("OBJID", ifsRowId);
  135. inParam.put("OBJVERSION", ifsRowVersion);
  136. inParam.put("DESCRIPTION", partDesc); // 物料描述
  137. inParam.put("UNIT_CODE", unitCode); // 单位
  138. inParam.put("PART_MAIN_GROUP", partMainGroup); // PART_MAIN_GROUP
  139. inParam.put("WEIGHT_NET", weightNet); // 净重
  140. inParam.put("UOM_FOR_WEIGHT_NET", uomForWeightNet); // 净重单位
  141. inParam.put("VOLUME_NET", volumeNet); // 体积
  142. inParam.put("UOM_FOR_VOLUME_NET", uomForVolumeNet); // 体积单位
  143. inParam.put("CONDITION_CODE_USAGE_DB", conditionCodeUsageDb); // CONDITION_CODE_USAGE_DB
  144. inParam.put("MULTILEVEL_TRACKING_DB", multilevelTrackingDb); // MULTILEVEL_TRACKING_DB
  145. inParam.put("ALLOW_AS_NOT_CONSUMED_DB", allowAsNotConsumedDb); // ALLOW_AS_NOT_CONSUMED_DB
  146. inParam.put("LOT_TRACKING_CODE", lotTrackingCode); // 批次跟踪代码
  147. inParam.put("LOT_QUANTITY_RULE", lotQuantityRule); // LOT_QUANTITY_RULE
  148. inParam.put("SUB_LOT_RULE", subLotRule); // SUB_LOT_RULE
  149. inParam.put("COMPONENT_LOT_RULE", componentLotRule); // COMPONENT_LOT_RULE
  150. inParam.put("INFO_TEXT", infoText); // 备注
  151. //执行存储过程 获取结果集
  152. //执行check的操作
  153. Map<String, String> checkMap = IfsPlsqlUtils.execProcedureGetRecord(srv, "PART_CATALOG_API",
  154. "MODIFY__", PlsqlBaseMethodType.MODIFY, PlsqlBaseMethodAction.CHECK, inParam);
  155. //执行do的操作
  156. Map<String, String> resultMap = IfsPlsqlUtils.execProcedureGetRecord(srv, "PART_CATALOG_API",
  157. "MODIFY__", PlsqlBaseMethodType.MODIFY, PlsqlBaseMethodAction.DO, inParam);
  158. //返回结果集
  159. return resultMap;
  160. }
  161. /**
  162. * @description: 删除物料件
  163. * @author LR
  164. * @date 2024/12/11 10:01
  165. * @version 1.0
  166. */
  167. public static void removeMasterPart(Server srv, PartCatalog inData) throws APException {
  168. //公共参数
  169. String ifsRowId = inData.getIfsRowId();
  170. String ifsRowVersion = inData.getIfsRowVersion();
  171. //入参
  172. Map<String, String> inParam = new HashMap<>();
  173. //填充参数
  174. inParam.put("OBJID", ifsRowId);
  175. inParam.put("OBJVERSION", ifsRowVersion);
  176. //执行存储过程 获取结果集
  177. //执行check的操作
  178. Map<String, String> checkMap = IfsPlsqlUtils.execProcedureGetRecord(srv, "PART_CATALOG_API",
  179. "REMOVE__", PlsqlBaseMethodType.REMOVE, PlsqlBaseMethodAction.CHECK, inParam);
  180. //执行do的操作
  181. Map<String, String> resultMap = IfsPlsqlUtils.execProcedureGetRecord(srv, "PART_CATALOG_API",
  182. "REMOVE__", PlsqlBaseMethodType.REMOVE, PlsqlBaseMethodAction.DO, inParam);
  183. }
  184. }