From 8f903210610b4dc084a72d4ca9f3d8086e5972eb Mon Sep 17 00:00:00 2001
From: liding <756868258@qq.com>
Date: 星期二, 24 三月 2026 15:35:54 +0800
Subject: [PATCH] feat:1.生产报工(销售订单不创建生产订单) 2.报工增加投入总量 3.报工不扣投入库存数量
---
src/main/java/com/ruoyi/production/service/impl/ProductionProductMainServiceImpl.java | 17 ++++++++++-------
1 files changed, 10 insertions(+), 7 deletions(-)
diff --git a/src/main/java/com/ruoyi/production/service/impl/ProductionProductMainServiceImpl.java b/src/main/java/com/ruoyi/production/service/impl/ProductionProductMainServiceImpl.java
index 13d7ccb..272ea6b 100644
--- a/src/main/java/com/ruoyi/production/service/impl/ProductionProductMainServiceImpl.java
+++ b/src/main/java/com/ruoyi/production/service/impl/ProductionProductMainServiceImpl.java
@@ -141,7 +141,7 @@
productionProductMainMapper.insert(productionProductMain);
/*鏂板鎶ュ伐鎶曞叆琛�*/
List<ProductStructureDto> productStructureDtos = productStructureMapper.listBybomAndProcess(productProcessRoute.getBomId(), productProcess.getId());
- if (productStructureDtos.size() == 0) {
+ if (productStructureDtos.isEmpty()) {
//濡傛灉璇ュ伐搴忔病鏈変骇鍝佺粨鏋勭殑鎶曞叆鍝�,閭h繖涓姇鍏ュ搧鍜屼骇鍑哄搧鏄悓涓�涓�
ProductStructureDto productStructureDto = new ProductStructureDto();
productStructureDto.setProductModelId(productProcessRouteItem.getProductModelId());
@@ -155,8 +155,6 @@
productionProductInput.setQuantity(productStructureDto.getUnitQuantity().multiply(dto.getQuantity()));
productionProductInput.setProductMainId(productionProductMain.getId());
productionProductInputMapper.insert(productionProductInput);
- stockUtils.substractStock(productStructureDto.getProductModelId(), productionProductInput.getQuantity(), StockOutQualifiedRecordTypeEnum.PRODUCTION_REPORT_STOCK_OUT.getCode(), productionProductMain.getId());
-
}
/*鏂板鎶ュ伐浜у嚭琛�*/
ProductionProductOutput productionProductOutput = new ProductionProductOutput();
@@ -165,8 +163,8 @@
productionProductOutput.setQuantity(dto.getQuantity() != null ? dto.getQuantity() : BigDecimal.ZERO);
productionProductOutput.setScrapQty(dto.getScrapQty() != null ? dto.getScrapQty() : BigDecimal.ZERO);
productionProductOutputMapper.insert(productionProductOutput);
- //鍚堟牸鏁伴噺=鎶ュ伐鏁伴噺-鎶ュ簾鏁伴噺
- BigDecimal productQty = productionProductOutput.getQuantity().subtract(productionProductOutput.getScrapQty());
+ //鍚堟牸鏁伴噺=鎶ュ伐鏁伴噺
+ BigDecimal productQty = productionProductOutput.getQuantity();
//鍙湁鍚堟牸鏁伴噺>0鎵嶈兘澧炲姞鐩稿簲鏁版嵁
if (productQty.compareTo(BigDecimal.ZERO) > 0) {
/*鏂板璐ㄦ*/
@@ -220,6 +218,7 @@
if (productWorkOrder.getCompleteQuantity().compareTo(productWorkOrder.getPlanQuantity()) == 0) {
productWorkOrder.setActualEndTime(LocalDate.now());//瀹為檯缁撴潫鏃堕棿
}
+ productWorkOrder.setTotalInvestment(dto.getTotalInvestment());
productWorkOrderMapper.updateById(productWorkOrder);
//鐢熶骇璁㈠崟
ProductOrder productOrder = productOrderMapper.selectById(productWorkOrder.getProductOrderId());
@@ -234,13 +233,17 @@
}
}
productOrderMapper.updateById(productOrder);
- /*娣诲姞鐢熶骇鏍哥畻*/
+ /*娣诲姞鐢熶骇鏍哥畻 鍖哄垎宸ュ簭鏄浠惰繕鏄鏃�*/
+ BigDecimal workHours = (productProcess.getType() == 1)
+ ? productProcess.getSalaryQuota().multiply(productQty)
+ : productProcess.getSalaryQuota();
+
SalesLedgerProductionAccounting salesLedgerProductionAccounting = SalesLedgerProductionAccounting.builder()
.productMainId(productionProductMain.getId())
.schedulingUserId(user.getUserId())
.schedulingUserName(user.getNickName())
.finishedNum(productQty)
- .workHours(productProcess.getSalaryQuota())
+ .workHours(workHours)
.process(productProcess.getName())
.schedulingDate(LocalDate.now())
.tenantId(dto.getTenantId())
--
Gitblit v1.9.3