From 70ea74cfb981f812bfa4e3ef91843c5ad93f7b27 Mon Sep 17 00:00:00 2001
From: gaoluyang <2820782392@qq.com>
Date: 星期三, 04 十一月 2026 17:32:49 +0800
Subject: [PATCH] feat(erp): 采购台账改造与采购退货增强
---
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/service/wm/productsales/MesWmProductSalesLineServiceImpl.java | 13 +++++++++++++
1 files changed, 13 insertions(+), 0 deletions(-)
diff --git a/yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/service/wm/productsales/MesWmProductSalesLineServiceImpl.java b/yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/service/wm/productsales/MesWmProductSalesLineServiceImpl.java
index 92444cb..d1460c8 100644
--- a/yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/service/wm/productsales/MesWmProductSalesLineServiceImpl.java
+++ b/yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/service/wm/productsales/MesWmProductSalesLineServiceImpl.java
@@ -1,6 +1,7 @@
package cn.iocoder.yudao.module.mes.service.wm.productsales;
import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils;
+import cn.iocoder.yudao.module.erp.api.sale.ErpSaleOrderApi;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.core.util.ObjUtil;
@@ -60,6 +61,8 @@
@Resource
@Lazy
private MesQcOqcService oqcService;
+ @Resource
+ private ErpSaleOrderApi saleOrderApi;
@Override
public Long createProductSalesLine(MesWmProductSalesLineSaveReqVO createReqVO) {
@@ -196,6 +199,16 @@
mdmItemService.validateItemExistsAndEnable(reqVO.getItemId());
// 鏍¢獙鍏宠仈鍙戣揣閫氱煡鍗曡锛堝瓨鍦ㄦ�� + 褰掑睘 + 瀛楁涓�鑷存�э級
MesWmSalesNoticeLineDO noticeLine = validateSalesNoticeLine(sales, reqVO);
+ if (noticeLine == null && sales.getSaleOrderId() != null) {
+ if (reqVO.getSaleOrderItemId() == null) {
+ throw exception(WM_SALES_NOTICE_SALE_ORDER_ITEM_EMPTY);
+ }
+ var item = saleOrderApi.getSaleOrderItem(reqVO.getSaleOrderItemId()).getCheckedData();
+ if (item == null || !Objects.equals(item.getOrderId(), sales.getSaleOrderId())
+ || !Objects.equals(item.getProductId(), reqVO.getItemId())) {
+ throw exception(WM_SALES_NOTICE_LINE_SALE_ITEM_MISMATCH);
+ }
+ }
// 鏍规嵁 batchCode 瑙f瀽 batchId
fillBatchId(reqVO);
return noticeLine;
--
Gitblit v1.9.3