From 274dd8b724dd4485658e1d2a3f825a007f625bd7 Mon Sep 17 00:00:00 2001
From: liyong <18434998025@163.com>
Date: 星期五, 17 七月 2026 09:10:07 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/dev_business' into dev_business
---
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/service/wm/productsales/MesWmProductSalesServiceImpl.java | 31 ++++++++++++++++++++++++++++---
1 files changed, 28 insertions(+), 3 deletions(-)
diff --git a/yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/service/wm/productsales/MesWmProductSalesServiceImpl.java b/yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/service/wm/productsales/MesWmProductSalesServiceImpl.java
index baec481..352debd 100644
--- a/yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/service/wm/productsales/MesWmProductSalesServiceImpl.java
+++ b/yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/service/wm/productsales/MesWmProductSalesServiceImpl.java
@@ -27,6 +27,7 @@
import cn.iocoder.yudao.module.mes.service.wm.transaction.MesWmTransactionService;
import cn.iocoder.yudao.module.mes.service.wm.transaction.dto.MesWmTransactionSaveReqDTO;
import cn.iocoder.yudao.module.erp.api.sale.ErpSaleOrderApi;
+import cn.iocoder.yudao.module.erp.api.sale.enums.ErpSaleOrderOutStatusEnum;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@@ -213,6 +214,12 @@
// 鎵ц鎷h揣锛堝緟鎷h揣 鈫� 寰呭~鍐欒繍鍗曪級
productSalesMapper.updateById(new MesWmProductSalesDO()
.setId(id).setStatus(MesWmProductSalesStatusEnum.SHIPPING.getStatus()));
+
+ // 鍥炲啓 ERP 閿�鍞鍗曞嚭搴撶姸鎬佷负"閮ㄥ垎鍑哄簱"锛堣〃绀哄凡鎷h揣/鍗犵敤锛�
+ if (sales.getSaleOrderId() != null) {
+ saleOrderApi.updateOrderOutStatusTo(sales.getSaleOrderId(),
+ ErpSaleOrderOutStatusEnum.PART_OUT.getStatus());
+ }
}
@Override
@@ -251,13 +258,30 @@
productSalesMapper.updateById(new MesWmProductSalesDO()
.setId(id).setStatus(MesWmProductSalesStatusEnum.FINISHED.getStatus()));
- // 5. 鏇存柊鍏宠仈鐨勫彂璐ч�氱煡鍗曠姸鎬�
+ // 5. 鏇存柊鍏宠仈鐨勫彂璐ч�氱煡鍗曞嚭搴撴暟閲忓拰鐘舵��
if (sales.getNoticeId() != null) {
- salesNoticeService.finishSalesNotice(sales.getNoticeId());
+ updateSalesNoticeOutCount(sales);
}
// 6. 鍥炲啓 ERP 閿�鍞鍗曠殑鍑哄簱鏁伴噺鍜岀姸鎬�
updateErpSaleOrderOutCount(sales);
+ }
+
+ /**
+ * 鏇存柊鍙戣揣閫氱煡鍗曠殑鍑哄簱鏁伴噺鍜岀姸鎬�
+ */
+ private void updateSalesNoticeOutCount(MesWmProductSalesDO sales) {
+ // 鑾峰彇鍑哄簱鍗曡
+ List<MesWmProductSalesLineDO> lines = productSalesLineService.getProductSalesLineListBySalesId(sales.getId());
+ if (CollUtil.isEmpty(lines)) {
+ return;
+ }
+ // 閬嶅巻琛岋紝鎸� noticeLineId 鏇存柊鍑哄簱鏁伴噺
+ for (MesWmProductSalesLineDO line : lines) {
+ if (line.getNoticeLineId() != null && line.getQuantity() != null) {
+ salesNoticeService.updateSalesNoticeLineOutCount(line.getNoticeLineId(), line.getQuantity());
+ }
+ }
}
/**
@@ -299,7 +323,8 @@
.setBatchId(detail.getBatchId()).setBatchCode(detail.getBatchCode())
.setWarehouseId(detail.getWarehouseId()).setLocationId(detail.getLocationId()).setAreaId(detail.getAreaId())
.setBizType(MesBizTypeConstants.WM_PRODUCT_SALES).setBizId(sales.getId())
- .setBizCode(sales.getCode()).setBizLineId(detail.getLineId())));
+ .setBizCode(sales.getCode()).setBizLineId(detail.getLineId())
+ .setMaterialStockId(detail.getMaterialStockId()))); // 鎸囧畾搴撳瓨璁板綍ID锛岄伩鍏嶉噸鏂板尮閰�
}
@Override
--
Gitblit v1.9.3