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 f4e8736..972fed0 100644 --- a/src/main/java/com/gaotao/modules/inboundNotification/controller/InboundNotificationController.java +++ b/src/main/java/com/gaotao/modules/inboundNotification/controller/InboundNotificationController.java @@ -41,7 +41,7 @@ public class InboundNotificationController extends AbstractController { } List> resultList = inboundNotificationService.getQualifiedInboundList( - site,warehouseId, searchCode, status); + site, warehouseId, searchCode, status); return R.ok().put("data", resultList); } catch (Exception e) { @@ -60,6 +60,7 @@ public class InboundNotificationController extends AbstractController { String partNo = (String) params.get("partNo"); String warehouseId = (String) params.get("warehouseId"); String site = (String) params.get("site"); + String buNo = (String) params.get("buNo"); if (inboundNo == null || inboundNo.trim().isEmpty()) { return R.error("入库单号不能为空"); } @@ -73,7 +74,7 @@ public class InboundNotificationController extends AbstractController { } Map result = inboundNotificationService.getInboundDetails( - inboundNo, partNo, warehouseId,site); + inboundNo, partNo, warehouseId,site,buNo); if (result == null || result.isEmpty()) { return R.error("未找到入库单详情"); @@ -201,4 +202,36 @@ public class InboundNotificationController extends AbstractController { return R.error("删除失败: " + e.getMessage()); } } + + /** + * 获取物料清单 + * 根据site、buNo、inboundNo从po_order_roll_no表获取物料信息 + */ + @PostMapping("getMaterialList") + public R getMaterialList(@RequestBody Map params) { + try { + String site = (String) params.get("site"); + String buNo = (String) params.get("buNo"); + String inboundNo = (String) params.get("inboundNo"); + + if (site == null || site.trim().isEmpty()) { + return R.error("站点不能为空"); + } + + if (buNo == null || buNo.trim().isEmpty()) { + return R.error("业务单元不能为空"); + } + + if (inboundNo == null || inboundNo.trim().isEmpty()) { + return R.error("入库单号不能为空"); + } + + List> materialList = inboundNotificationService.getMaterialList(site, buNo, inboundNo); + + return R.ok().put("data", materialList); + } catch (Exception e) { + logger.error("获取物料清单失败", e); + return R.error("获取物料清单失败: " + e.getMessage()); + } + } } 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 08b2b0a..04df47e 100644 --- a/src/main/java/com/gaotao/modules/inboundNotification/dao/InboundNotificationHeadMapper.java +++ b/src/main/java/com/gaotao/modules/inboundNotification/dao/InboundNotificationHeadMapper.java @@ -13,12 +13,14 @@ public interface InboundNotificationHeadMapper extends BaseMapper> getQualifiedInboundList(@Param("site")String site,@Param("warehouseId") String warehouseId, + List> getQualifiedInboundList(@Param("site") String site, + @Param("warehouseId") String warehouseId, @Param("searchCode") String searchCode, @Param("status") String status); @@ -32,7 +34,8 @@ public interface InboundNotificationHeadMapper extends BaseMapper getInboundDetails(@Param("orderNo") String orderNo, @Param("partNo") String partNo, @Param("warehouseId") String warehouseId, - @Param("site") String site); + @Param("site") String site, + @Param("buNo") String buNo); /** * 更新入库单状态 @@ -44,4 +47,15 @@ public interface InboundNotificationHeadMapper extends BaseMapper> getMaterialList(@Param("site") String site, + @Param("buNo") String buNo, + @Param("inboundNo") String inboundNo); } 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 f795bc2..20c0d77 100644 --- a/src/main/java/com/gaotao/modules/inboundNotification/service/InboundNotificationService.java +++ b/src/main/java/com/gaotao/modules/inboundNotification/service/InboundNotificationService.java @@ -7,12 +7,13 @@ public interface InboundNotificationService { /** * 获取检验合格待入库列表 + * @param site 站点 * @param warehouseId 仓库ID * @param searchCode 搜索条件 * @param status 状态 * @return 待入库列表 */ - List> getQualifiedInboundList(String site,String warehouseId, String searchCode, String status); + List> getQualifiedInboundList(String site, String warehouseId, String searchCode, String status); /** * 获取入库单详情 @@ -21,7 +22,7 @@ public interface InboundNotificationService { * @param warehouseId 仓库ID * @return 入库单详情 */ - Map getInboundDetails(String orderNo, String partNo, String warehouseId,String site); + Map getInboundDetails(String orderNo, String partNo, String warehouseId,String site, String buNo); /** * 验证标签与入库单是否匹配 @@ -43,4 +44,13 @@ public interface InboundNotificationService { * @return 处理结果 */ boolean confirmInboundStorage(String orderNo, String partNo, String warehouseId, String locationCode, List> labels, String site,String buNo); + + /** + * 获取物料清单 + * @param site 站点 + * @param buNo 业务单元 + * @param inboundNo 入库单号 + * @return 物料清单 + */ + List> getMaterialList(String site, String buNo, String inboundNo); } 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 3cfae0a..7d7c42b 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 @@ -44,13 +44,13 @@ public class InboundNotificationServiceImpl implements InboundNotificationServic private TransDetailService transDetailService; @Override - public List> getQualifiedInboundList(String site,String warehouseId, String searchCode, String status) { - return headMapper.getQualifiedInboundList(site,warehouseId, searchCode, status); + public List> getQualifiedInboundList(String site, String warehouseId, String searchCode, String status) { + return headMapper.getQualifiedInboundList(site, warehouseId, searchCode, status); } @Override - public Map getInboundDetails(String orderNo, String partNo, String warehouseId,String site) { - return headMapper.getInboundDetails(orderNo, partNo, warehouseId,site); + public Map getInboundDetails(String orderNo, String partNo, String warehouseId,String site, String buNo) { + return headMapper.getInboundDetails(orderNo, partNo, warehouseId,site,buNo); } @Override @@ -94,7 +94,7 @@ public class InboundNotificationServiceImpl implements InboundNotificationServic } // 4. 插入库存数据 - insertInventoryStock(orderNo, partNo, warehouseId, locationCode, labels, site); + insertInventoryStock(orderNo, partNo, warehouseId, locationCode, labels, site, buNo); // 5. 生成入库事务记录 generateInboundTransaction(orderNo, partNo, warehouseId, labels,site); @@ -113,12 +113,13 @@ public class InboundNotificationServiceImpl implements InboundNotificationServic /** * 插入或更新库存数据 */ - private void insertInventoryStock(String orderNo, String partNo, String warehouseId, String locationCode, List> labels, String site) { + private void insertInventoryStock(String orderNo, String partNo, String warehouseId, String locationCode, + List> labels, String site, String buNo) { logger.info("开始处理库存数据,入库单号: {}, 物料编码: {}, 仓库ID: {}, 标签数量: {}", orderNo, partNo, warehouseId, labels.size()); // 获取物料基本信息 - Map materialInfo = headMapper.getInboundDetails(orderNo, partNo, warehouseId, site); + Map materialInfo = headMapper.getInboundDetails(orderNo, partNo, warehouseId, site,buNo); if (materialInfo == null) { logger.error("获取物料信息失败,入库单号: {}, 物料编码: {}", orderNo, partNo); throw new RuntimeException("获取物料信息失败"); @@ -277,6 +278,28 @@ public class InboundNotificationServiceImpl implements InboundNotificationServic transHeader.getTransno(), orderNo, labels.size()); } + @Override + public List> getMaterialList(String site, String buNo, String inboundNo) { + logger.info("获取物料清单,站点: {}, 业务单元: {}, 入库单号: {}", site, buNo, inboundNo); + + try { + List> materialList = headMapper.getMaterialList(site, buNo, inboundNo); + + if (materialList == null) { + materialList = new ArrayList<>(); + } + + logger.info("获取物料清单成功,站点: {}, 业务单元: {}, 入库单号: {}, 记录数: {}", + site, buNo, inboundNo, materialList.size()); + + return materialList; + } catch (Exception e) { + logger.error("获取物料清单失败,站点: {}, 业务单元: {}, 入库单号: {}, 错误信息: {}", + site, buNo, inboundNo, e.getMessage(), e); + throw new RuntimeException("获取物料清单失败: " + e.getMessage(), e); + } + } + /** * 生成事务明细记录 */ diff --git a/src/main/resources/mapper/inboundNotification/InboundNotificationHeadMapper.xml b/src/main/resources/mapper/inboundNotification/InboundNotificationHeadMapper.xml index 48f419b..b34410e 100644 --- a/src/main/resources/mapper/inboundNotification/InboundNotificationHeadMapper.xml +++ b/src/main/resources/mapper/inboundNotification/InboundNotificationHeadMapper.xml @@ -6,29 +6,48 @@ + @@ -68,5 +90,16 @@ AND h.bu_no = #{buNo} + + +