diff --git a/src/main/java/com/gaotao/modules/inboundNotification/controller/InboundNotificationController.java b/src/main/java/com/gaotao/modules/inboundNotification/controller/InboundNotificationController.java index 13648e2..0631e6c 100644 --- a/src/main/java/com/gaotao/modules/inboundNotification/controller/InboundNotificationController.java +++ b/src/main/java/com/gaotao/modules/inboundNotification/controller/InboundNotificationController.java @@ -254,6 +254,46 @@ public class InboundNotificationController extends AbstractController { } } + /** + * 获取物料可用库存 + * 调用存储过程 GetInventoryStock + */ + @PostMapping("getInventoryStock") + public R getInventoryStock(@RequestBody Map params) { + try { + String site = (String) params.get("site"); + String notifyNo = (String) params.get("notifyNo"); + String notifyType = (String) params.get("notifyType"); + String orderNo = (String) params.get("orderNo"); + String orderLineNo = (String) params.get("orderLineNo"); + String partNo = (String) params.get("partNo"); + String warehouseId = (String) params.get("warehouseId"); + + if (site == null || site.trim().isEmpty()) { + return R.error("站点不能为空"); + } + + if (partNo == null || partNo.trim().isEmpty()) { + return R.error("物料编码不能为空"); + } + + List> stockList = inboundNotificationService.getInventoryStock( + site, + notifyNo != null ? notifyNo : "", + notifyType != null ? notifyType : "", + orderNo != null ? orderNo : "", + orderLineNo != null ? orderLineNo : "", + partNo, + warehouseId != null ? warehouseId : "" + ); + + return R.ok().put("data", stockList); + } catch (Exception e) { + logger.error("获取物料可用库存失败", e); + return R.error("获取物料可用库存失败: " + e.getMessage()); + } + } + // =========================== PC =========================== diff --git a/src/main/java/com/gaotao/modules/inboundNotification/dao/InboundNotificationHeadMapper.java b/src/main/java/com/gaotao/modules/inboundNotification/dao/InboundNotificationHeadMapper.java index 9ce1ae5..d50d877 100644 --- a/src/main/java/com/gaotao/modules/inboundNotification/dao/InboundNotificationHeadMapper.java +++ b/src/main/java/com/gaotao/modules/inboundNotification/dao/InboundNotificationHeadMapper.java @@ -90,6 +90,16 @@ public interface InboundNotificationHeadMapper extends BaseMapper> getInventoryStock(@Param("site") String site, + @Param("notifyNo") String notifyNo, + @Param("notifyType") String notifyType, + @Param("orderNo") String orderNo, + @Param("orderLineNo") String orderLineNo, + @Param("partNo") String partNo, + @Param("warehouseId") String warehouseId); IPage searchInboundNotification(Page inboundNotificationHeadVoPage, @Param("query") InboundNotificationHeadVo data); diff --git a/src/main/java/com/gaotao/modules/inboundNotification/service/InboundNotificationService.java b/src/main/java/com/gaotao/modules/inboundNotification/service/InboundNotificationService.java index 48b0f14..e2d90ff 100644 --- a/src/main/java/com/gaotao/modules/inboundNotification/service/InboundNotificationService.java +++ b/src/main/java/com/gaotao/modules/inboundNotification/service/InboundNotificationService.java @@ -69,6 +69,20 @@ public interface InboundNotificationService { */ List> getScannedLabelList(String site, String buNo, String inboundNo); + /** + * 获取物料可用库存 + * @param site 站点 + * @param notifyNo 入库单号 + * @param notifyType 类型 + * @param orderNo 单据号 + * @param orderLineNo 单据行号 + * @param partNo 物料编码 + * @param warehouseId 当前仓库 + * @return 可用库存列表 + */ + List> getInventoryStock(String site, String notifyNo, String notifyType, + String orderNo, String orderLineNo, String partNo, String warehouseId); + PageUtils searchInboundNotification(InboundNotificationHeadVo data); void saveInboundNotification(InboundNotificationHeadVo data); diff --git a/src/main/java/com/gaotao/modules/inboundNotification/service/impl/InboundNotificationServiceImpl.java b/src/main/java/com/gaotao/modules/inboundNotification/service/impl/InboundNotificationServiceImpl.java index ea52c67..697088c 100644 --- a/src/main/java/com/gaotao/modules/inboundNotification/service/impl/InboundNotificationServiceImpl.java +++ b/src/main/java/com/gaotao/modules/inboundNotification/service/impl/InboundNotificationServiceImpl.java @@ -359,6 +359,28 @@ public class InboundNotificationServiceImpl implements InboundNotificationServic } } + @Override + public List> getInventoryStock(String site, String notifyNo, String notifyType, + String orderNo, String orderLineNo, String partNo, String warehouseId) { + logger.info("获取物料可用库存,站点: {}, 物料编码: {}", site, partNo); + + try { + List> stockList = headMapper.getInventoryStock( + site, notifyNo, notifyType, orderNo, orderLineNo, partNo, warehouseId); + + if (stockList == null) { + stockList = new ArrayList<>(); + } + + logger.info("获取物料可用库存成功,站点: {}, 物料编码: {}, 记录数: {}", site, partNo, stockList.size()); + + return stockList; + } catch (Exception e) { + logger.error("获取物料可用库存失败,站点: {}, 物料编码: {}, 错误信息: {}", site, partNo, e.getMessage(), e); + throw new RuntimeException("获取物料可用库存失败: " + e.getMessage(), e); + } + } + /** * 生成事务明细记录 * @return 生成的明细记录列表,用于子明细关联 diff --git a/src/main/resources/mapper/inboundNotification/InboundNotificationHeadMapper.xml b/src/main/resources/mapper/inboundNotification/InboundNotificationHeadMapper.xml index 960dc80..7f87459 100644 --- a/src/main/resources/mapper/inboundNotification/InboundNotificationHeadMapper.xml +++ b/src/main/resources/mapper/inboundNotification/InboundNotificationHeadMapper.xml @@ -72,7 +72,10 @@ + + +