From 47806d9e390ee00e1d29ad1da8c1aa908882a758 Mon Sep 17 00:00:00 2001
From: yuan <123@>
Date: 星期二, 11 八月 2026 14:43:59 +0800
Subject: [PATCH] 用河南鹤壁代码覆盖山西长治
---
src/main/java/com/ruoyi/sales/service/impl/SalesLedgerProductServiceImpl.java | 66 ++++++++++++++-------------------
1 files changed, 28 insertions(+), 38 deletions(-)
diff --git a/src/main/java/com/ruoyi/sales/service/impl/SalesLedgerProductServiceImpl.java b/src/main/java/com/ruoyi/sales/service/impl/SalesLedgerProductServiceImpl.java
index 171f5ae..28ce78a 100644
--- a/src/main/java/com/ruoyi/sales/service/impl/SalesLedgerProductServiceImpl.java
+++ b/src/main/java/com/ruoyi/sales/service/impl/SalesLedgerProductServiceImpl.java
@@ -4,6 +4,7 @@
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.ruoyi.common.utils.AmountUtils;
import com.ruoyi.framework.web.domain.R;
import com.ruoyi.procurementrecord.utils.StockUtils;
import com.ruoyi.production.mapper.*;
@@ -25,7 +26,6 @@
import com.ruoyi.technology.mapper.TechnologyBomStructureMapper;
import com.ruoyi.technology.mapper.TechnologyRoutingMapper;
import com.ruoyi.technology.pojo.TechnologyRouting;
-import org.apache.commons.lang3.BooleanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@@ -34,6 +34,7 @@
import java.lang.reflect.Field;
import java.math.BigDecimal;
import java.math.RoundingMode;
+import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.Arrays;
@@ -89,7 +90,9 @@
@Override
public SalesLedgerProduct selectSalesLedgerProductById(Long id) {
- return salesLedgerProductMapper.selectById(id);
+ SalesLedgerProduct product = salesLedgerProductMapper.selectById(id);
+ AmountUtils.normalizeSalesLedgerProduct(product);
+ return product;
}
@Override
@@ -97,29 +100,17 @@
List<SalesLedgerProduct> salesLedgerProducts = salesLedgerProductMapper.selectSalesLedgerProductList(salesLedgerProduct);
if(!CollectionUtils.isEmpty(salesLedgerProducts)){
salesLedgerProducts.forEach(item -> {
- // 鍙戣揣淇℃伅锛堝彇鏈�鏂颁竴鏉★紝鍙煡璇㈠鏍搁�氳繃鎴栧凡鍙戣揣鐨勮褰曪級
- ShippingInfo latestShippingInfo = shippingInfoMapper.selectOne(new LambdaQueryWrapper<ShippingInfo>()
+ AmountUtils.normalizeSalesLedgerProduct(item);
+ // 鍙戣揣淇℃伅
+ ShippingInfo shippingInfo = shippingInfoMapper.selectOne(new LambdaQueryWrapper<ShippingInfo>()
.eq(ShippingInfo::getSalesLedgerProductId, item.getId())
- .in(ShippingInfo::getStatus, "瀹℃牳閫氳繃", "宸插彂璐�")
.orderByDesc(ShippingInfo::getCreateTime)
.last("limit 1"));
- if(latestShippingInfo != null){
- item.setShippingDate(latestShippingInfo.getShippingDate());
- item.setExpressCompany(latestShippingInfo.getExpressCompany());
- item.setExpressNumber(latestShippingInfo.getExpressNumber());
- }
- // 杞︾墝鍙凤細鍙栨墍鏈夊鏍搁�氳繃鎴栧凡鍙戣揣璁板綍鐨勮溅鐗屽彿锛岄�楀彿鎷兼帴
- List<ShippingInfo> allShippingInfos = shippingInfoMapper.selectList(new LambdaQueryWrapper<ShippingInfo>()
- .eq(ShippingInfo::getSalesLedgerProductId, item.getId())
- .in(ShippingInfo::getStatus, "瀹℃牳閫氳繃", "宸插彂璐�")
- .orderByAsc(ShippingInfo::getCreateTime));
- if(!CollectionUtils.isEmpty(allShippingInfos)){
- String carNumbers = allShippingInfos.stream()
- .map(ShippingInfo::getShippingCarNumber)
- .filter(carNo -> carNo != null && !carNo.trim().isEmpty())
- .distinct()
- .collect(Collectors.joining(","));
- item.setShippingCarNumber(carNumbers);
+ if(shippingInfo != null){
+ item.setShippingDate(shippingInfo.getShippingDate());
+ item.setShippingCarNumber(shippingInfo.getShippingCarNumber());
+ item.setExpressCompany(shippingInfo.getExpressCompany());
+ item.setExpressNumber(shippingInfo.getExpressNumber());
}
});
}
@@ -177,6 +168,7 @@
@Override
@Transactional(rollbackFor = Exception.class)
public int addOrUpdateSalesLedgerProduct(SalesLedgerProduct salesLedgerProduct) {
+ AmountUtils.normalizeSalesLedgerProduct(salesLedgerProduct);
int result;
Long salesLedgerId = salesLedgerProduct.getSalesLedgerId();
@@ -228,22 +220,20 @@
*/
public void addProductionData(SalesLedgerProduct salesLedgerProduct) {
//鍏堝垽鏂浜у搧鏄惁闇�瑕佺敓浜�
- if (!BooleanUtils.isTrue(salesLedgerProduct.getIsProduction())) {
- return;
+ if (Boolean.TRUE.equals(salesLedgerProduct.getIsProduction())) {
+ SalesLedger salesLedger = salesLedgerMapper.selectById(salesLedgerProduct.getSalesLedgerId());
+ ProductionPlan productionPlan = new ProductionPlan();
+ productionPlan.setSalesLedgerId(salesLedgerProduct.getSalesLedgerId());
+ productionPlan.setSalesLedgerProductId(salesLedgerProduct.getId());
+ productionPlan.setMpsNo(generateNextPlanNo(LocalDate.now().format(DateTimeFormatter.ofPattern("yyyyMMdd"))));
+ productionPlan.setProductModelId(salesLedgerProduct.getProductModelId());
+ productionPlan.setQtyRequired(salesLedgerProduct.getQuantity());
+ productionPlan.setSource("閿�鍞�");
+ productionPlan.setStatus(0);
+ productionPlan.setRequiredDate(salesLedger.getDeliveryDate());//闇�姹傛棩鏈�=浜よ揣鏃ユ湡
+ productionPlan.setPromisedDeliveryDate(salesLedger.getDeliveryDate());//鎵胯鏃ユ湡=浜よ揣鏃ユ湡
+ productionPlanMapper.insert(productionPlan);
}
- SalesLedger salesLedger = salesLedgerMapper.selectById(salesLedgerProduct.getSalesLedgerId());
- ProductionPlan productionPlan = new ProductionPlan();
- productionPlan.setSalesLedgerId(salesLedgerProduct.getSalesLedgerId());
- productionPlan.setSalesLedgerProductId(salesLedgerProduct.getId());
- productionPlan.setMpsNo(generateNextPlanNo(com.ruoyi.common.utils.DateUtils.toLocalDate(salesLedger.getEntryDate())
- .format(DateTimeFormatter.ofPattern("yyyyMMdd"))));
- productionPlan.setProductModelId(salesLedgerProduct.getProductModelId());
- productionPlan.setQtyRequired(salesLedgerProduct.getQuantity());
- productionPlan.setSource("閿�鍞�");
- productionPlan.setStatus(0);
- productionPlan.setRequiredDate(salesLedger.getDeliveryDate());//闇�姹傛棩鏈�=浜よ揣鏃ユ湡
- productionPlan.setPromisedDeliveryDate(salesLedger.getDeliveryDate());//鎵胯鏃ユ湡=浜よ揣鏃ユ湡
- productionPlanMapper.insert(productionPlan);
}
@@ -295,7 +285,7 @@
Field amountField = mainEntityClass.getDeclaredField("contractAmount");
amountField.setAccessible(true);
- amountField.set(entity, totalAmount);
+ amountField.set(entity, AmountUtils.scaleAmount(totalAmount));
mainMapper.updateById(entity);
} catch (Exception e) {
--
Gitblit v1.9.3