From 5c891d8d2c206dfd2aa6daf59579eb2b6843dcc0 Mon Sep 17 00:00:00 2001
From: liding <756868258@qq.com>
Date: 星期三, 01 四月 2026 18:00:37 +0800
Subject: [PATCH] fix:1.采购/销售入库去掉审批 2.返工下载附件内容变更 3.生产/库存入库生产日期添加 4.仓库导入导出字段优化
---
src/main/java/com/ruoyi/sales/service/impl/SalesLedgerServiceImpl.java | 50 ++++++++++++++++++++------------------------------
1 files changed, 20 insertions(+), 30 deletions(-)
diff --git a/src/main/java/com/ruoyi/sales/service/impl/SalesLedgerServiceImpl.java b/src/main/java/com/ruoyi/sales/service/impl/SalesLedgerServiceImpl.java
index c32457c..12d8302 100644
--- a/src/main/java/com/ruoyi/sales/service/impl/SalesLedgerServiceImpl.java
+++ b/src/main/java/com/ruoyi/sales/service/impl/SalesLedgerServiceImpl.java
@@ -31,10 +31,6 @@
import com.ruoyi.other.mapper.TempFileMapper;
import com.ruoyi.other.pojo.TempFile;
import com.ruoyi.production.mapper.*;
-import com.ruoyi.production.pojo.ProductOrder;
-import com.ruoyi.production.pojo.ProductProcessRouteItem;
-import com.ruoyi.production.pojo.ProductWorkOrder;
-import com.ruoyi.production.pojo.ProductionProductMain;
import com.ruoyi.production.service.ProductionProductMainService;
import com.ruoyi.project.system.domain.SysDept;
import com.ruoyi.project.system.domain.SysUser;
@@ -45,6 +41,8 @@
import com.ruoyi.sales.mapper.*;
import com.ruoyi.sales.pojo.*;
import com.ruoyi.sales.service.ISalesLedgerService;
+import com.ruoyi.stock.mapper.StockInventoryMapper;
+import com.ruoyi.stock.pojo.StockInventory;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.io.FilenameUtils;
@@ -140,6 +138,8 @@
private final QualityInspectMapper qualityInspectMapper;
+ private final StockInventoryMapper stockInventoryMapper;
+
@Autowired
private SysDeptMapper sysDeptMapper;
@@ -168,7 +168,7 @@
}
- public List<SalesLedgerProduct> getSalesLedgerProductListByRelateId(Long relateId, SaleEnum type){
+ public List<SalesLedgerProduct> getSalesLedgerProductListByRelateId(Long relateId, SaleEnum type) {
LambdaQueryWrapper<SalesLedgerProduct> productWrapper = new LambdaQueryWrapper<>();
productWrapper.eq(SalesLedgerProduct::getSalesLedgerId, relateId);
productWrapper.eq(SalesLedgerProduct::getType, type.getCode());
@@ -194,6 +194,9 @@
product.setTempnoInvoiceAmount(product.getNoInvoiceAmount());
product.setTempNoInvoiceNum(product.getNoInvoiceNum());
product.setRegister(SecurityUtils.getLoginUser().getUser().getNickName());
+ product.setUidNo(product.getUidNo());
+ product.setUnit(product.getUnit());
+ product.setBatchNo(product.getBatchNo());
product.setRegisterDate(LocalDateTime.now());
// 鍙戣揣淇℃伅
ShippingInfo shippingInfo = shippingInfoMapper.selectOne(new LambdaQueryWrapper<ShippingInfo>()
@@ -660,7 +663,7 @@
// 4. 澶勭悊瀛愯〃鏁版嵁
List<SalesLedgerProduct> productList = salesLedgerDto.getProductData();
if (productList != null && !productList.isEmpty()) {
- handleSalesLedgerProducts(salesLedger.getId(), productList, EnumUtil.fromCode(SaleEnum.class,salesLedgerDto.getType()));
+ handleSalesLedgerProducts(salesLedger.getId(), productList, EnumUtil.fromCode(SaleEnum.class, salesLedgerDto.getType()));
updateMainContractAmount(
salesLedger.getId(),
productList,
@@ -925,32 +928,20 @@
map.put("filingCertificateNo", productModel.getFilingCertificateNo());
}
amount = amount.add(product.getTaxInclusiveTotalPrice());
- List<ProductOrder> productOrders = productOrderMapper.selectList(new LambdaQueryWrapper<ProductOrder>()
- .eq(ProductOrder::getBatchNo, product.getBatchNo()));
- if (CollectionUtils.isEmpty(productOrders)) {
+ List<StockInventory> stockInventoryList = stockInventoryMapper.selectList(new LambdaQueryWrapper<StockInventory>().eq(StockInventory::getProductModelId, product.getProductModelId())
+ .eq(StockInventory::getBatchNo, product.getBatchNo())
+ .eq(StockInventory::getCustomer, product.getCustomer()));
+ if (CollectionUtils.isEmpty(stockInventoryList)) {
throw new RuntimeException("鎵瑰彿涓嶅瓨鍦�");
}
- List<ProductWorkOrder> productWorkOrders = productWorkOrderMapper.selectList(new LambdaQueryWrapper<ProductWorkOrder>()
- .eq(ProductWorkOrder::getProductOrderId, productOrders.get(0).getId()));
- List<Long> ids = productWorkOrders.stream().map(ProductWorkOrder::getId).collect(Collectors.toList());
- List<ProductionProductMain> productionProductMains = productionProductMainMapper.selectList(new LambdaQueryWrapper<ProductionProductMain>()
- .in(ProductionProductMain::getWorkOrderId, ids)
- .orderByDesc(ProductionProductMain::getCreateTime));
- List<ProductProcessRouteItem> productProcessRouteItems = productProcessRouteItemMapper.selectList(new LambdaQueryWrapper<ProductProcessRouteItem>()
- .in(ProductProcessRouteItem::getId, productionProductMains.stream()
- .map(ProductionProductMain::getProductProcessRouteItemId).collect(Collectors.toList()))
- .eq(ProductProcessRouteItem::getProductModelId, product.getProductModelId())
- .orderByDesc(ProductProcessRouteItem::getCreateTime));
- if (CollectionUtils.isEmpty(productProcessRouteItems)) {
- throw new RuntimeException("鐢熶骇鏁版嵁涓嶅瓨鍦�");
- }
- String productionDate = productProcessRouteItems.get(0).getCreateTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
- if (productModel.getValidityPeriod() == null) {
- throw new RuntimeException("鏈夋晥鏈熶笉鑳戒负绌�");
- }
- String expiryDate = productProcessRouteItems.get(0).getCreateTime().plusYears(productModel.getValidityPeriod().longValue()).format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
+ String productionDate = stockInventoryList.get(0).getProductionDate().format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
map.put("productionDate", productionDate);
- map.put("expiryDate", expiryDate);
+ List<ProductModel> productModelList = productModelMapper.selectList(new LambdaQueryWrapper<ProductModel>().eq(ProductModel::getId, product.getProductModelId()));
+ BigDecimal validityPeriod = productModelList.get(0).getValidityPeriod();
+ LocalDate expiryDate = stockInventoryList.get(0).getProductionDate()
+ .plusYears(validityPeriod.longValue());
+ String expiryDateStr = expiryDate.format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
+ map.put("expiryDate", expiryDateStr);
products.add(map);
}
Map<String, Object> data = new HashMap<>();
@@ -990,6 +981,5 @@
e.printStackTrace();
throw new RuntimeException("瀵煎嚭澶辫触");
}
-
}
}
--
Gitblit v1.9.3