Browse Source

2025-11-03

pda采购退货优化
master
fengyuan_yang 4 months ago
parent
commit
4c70e0d605
  1. 41
      src/main/java/com/gaotao/modules/purchaseReturn/controller/PurchaseReturnController.java
  2. 17
      src/main/java/com/gaotao/modules/purchaseReturn/dao/PurchaseReturnMapper.java
  3. 14
      src/main/java/com/gaotao/modules/purchaseReturn/service/PurchaseReturnService.java
  4. 21
      src/main/java/com/gaotao/modules/purchaseReturn/service/impl/PurchaseReturnServiceImpl.java
  5. 34
      src/main/resources/mapper/purchaseReturn/PurchaseReturnMapper.xml

41
src/main/java/com/gaotao/modules/purchaseReturn/controller/PurchaseReturnController.java

@ -198,4 +198,45 @@ public class PurchaseReturnController extends AbstractController {
return R.error("获取物料清单失败: " + e.getMessage());
}
}
/**
* 获取采购退货单明细卡片列表
* 根据退货单号查询明细数据按物料分组
*/
@PostMapping("/getReturnDetailCards")
@ApiOperation("获取退货单明细卡片列表")
public R getReturnDetailCards(@RequestBody Map<String, Object> params) {
try {
String site = (String) params.get("site");
String buNo = (String) params.get("buNo");
String returnNo = (String) params.get("returnNo");
String warehouseId = (String) params.get("warehouseId");
String searchCode = (String) params.get("searchCode");
if (site == null || site.trim().isEmpty()) {
return R.error("站点不能为空");
}
if (buNo == null || buNo.trim().isEmpty()) {
return R.error("业务单元不能为空");
}
if (returnNo == null || returnNo.trim().isEmpty()) {
return R.error("退货单号不能为空");
}
if (warehouseId == null || warehouseId.trim().isEmpty()) {
return R.error("仓库ID不能为空");
}
String userName = getUser().getUsername();
List<Map<String, Object>> detailCards = purchaseReturnService.getReturnDetailCards(
site, buNo, returnNo, warehouseId, searchCode, userName);
return R.ok().put("data", detailCards);
} catch (Exception e) {
logger.error("获取采购退货单明细卡片列表失败", e);
return R.error("获取明细卡片列表失败: " + e.getMessage());
}
}
}

17
src/main/java/com/gaotao/modules/purchaseReturn/dao/PurchaseReturnMapper.java

@ -99,4 +99,21 @@ public interface PurchaseReturnMapper extends BaseMapper {
List<Map<String, Object>> getMaterialList(@Param("site") String site,
@Param("buNo") String buNo,
@Param("returnNo") String returnNo);
/**
* 获取采购退货单明细卡片列表
* @param site 站点
* @param buNo 业务单元
* @param returnNo 退货单号
* @param warehouseId 仓库ID
* @param searchCode 搜索条件
* @param userName 用户名
* @return 明细卡片列表
*/
List<Map<String, Object>> getReturnDetailCards(@Param("site") String site,
@Param("buNo") String buNo,
@Param("returnNo") String returnNo,
@Param("warehouseId") String warehouseId,
@Param("searchCode") String searchCode,
@Param("userName") String userName);
}

14
src/main/java/com/gaotao/modules/purchaseReturn/service/PurchaseReturnService.java

@ -68,4 +68,18 @@ public interface PurchaseReturnService {
* @return 物料清单
*/
List<Map<String, Object>> getMaterialList(String site, String buNo, String returnNo);
/**
* 获取采购退货单明细卡片列表
* 数据来源outbound_notification_head/detail表按物料分组
* @param site 站点
* @param buNo 业务单元
* @param returnNo 退货单号
* @param warehouseId 仓库ID
* @param searchCode 搜索条件
* @param userName 用户名
* @return 明细卡片列表
*/
List<Map<String, Object>> getReturnDetailCards(String site, String buNo, String returnNo,
String warehouseId, String searchCode, String userName);
}

21
src/main/java/com/gaotao/modules/purchaseReturn/service/impl/PurchaseReturnServiceImpl.java

@ -275,4 +275,25 @@ public class PurchaseReturnServiceImpl implements PurchaseReturnService {
}
}
@Override
public List<Map<String, Object>> getReturnDetailCards(String site, String buNo, String returnNo,
String warehouseId, String searchCode, String userName) {
logger.info("获取采购退货单明细卡片列表,site: {}, buNo: {}, returnNo: {}", site, buNo, returnNo);
try {
List<Map<String, Object>> detailCards = purchaseReturnMapper.getReturnDetailCards(
site, buNo, returnNo, warehouseId, searchCode, userName);
if (detailCards == null) {
detailCards = new ArrayList<>();
}
logger.info("获取采购退货单明细卡片列表成功,共 {} 条记录", detailCards.size());
return detailCards;
} catch (Exception e) {
logger.error("获取采购退货单明细卡片列表失败,错误: {}", e.getMessage(), e);
throw new RuntimeException("获取明细卡片列表失败: " + e.getMessage(), e);
}
}
}

34
src/main/resources/mapper/purchaseReturn/PurchaseReturnMapper.xml

@ -135,4 +135,38 @@
GROUP BY d.part_no, d.part_desc, d.required_qty
</select>
<!-- 获取采购退货单明细卡片列表 -->
<select id="getReturnDetailCards" resultType="java.util.Map">
SELECT
h.site,
h.order_no AS returnNo,
h.bu_no AS buNo,
h.customer_id as customerId,
C.CustomerName as customerName,
D.related_order_no AS relatedNo,
D.related_order_line_no AS relatedLineNo,
D.part_no AS partNo,
D.part_desc AS partDesc,
SUM(D.required_qty) AS totalQty,
SUM(D.actual_out_qty) AS availableQty
FROM outbound_notification_head h
INNER JOIN outbound_notification_detail d ON h.order_no = d.order_no AND h.site = d.site and h.bu_no = d.bu_no
INNER JOIN Customer C ON H.site = C.Site AND H.customer_id = C.CustomerID
WHERE h.site = #{site}
AND h.bu_no in (select bu_no from AccessBu where username = #{userName})
AND h.order_type = '采购退货'
AND h.close_flag = 'N'
AND h.order_status = '待出库'
AND d.out_warehouse = #{warehouseId}
AND h.order_no = #{returnNo}
<if test="searchCode != null and searchCode != ''">
AND (
h.order_no LIKE CONCAT('%', #{searchCode}, '%')
OR h.related_order_no LIKE CONCAT('%', #{searchCode}, '%')
)
</if>
GROUP BY h.site, h.order_no, h.bu_no, h.customer_id, C.CustomerName, h.required_outbound_date, D.related_order_no, D.related_order_line_no, D.part_no, D.part_desc
ORDER BY h.required_outbound_date DESC
</select>
</mapper>
Loading…
Cancel
Save