From 0bc2c552b180afa16e4aae3c8c12746b15ba6fc8 Mon Sep 17 00:00:00 2001
From: yuan <123@>
Date: 星期四, 02 四月 2026 17:35:42 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/dev_长治_健齿齿科器材' into dev_长治_健齿齿科器材
---
src/main/java/com/ruoyi/sales/service/impl/SalesLedgerServiceImpl.java | 59 +++++++++++++++++++++++++----------------------------------
1 files changed, 25 insertions(+), 34 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..78c7daa 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>()
@@ -426,6 +429,10 @@
for (SalesLedgerProductImportDto salesLedgerProductImportDto : salesLedgerProductImportDtos) {
SalesLedgerProduct salesLedgerProduct = new SalesLedgerProduct();
+ List<StockInventory> stockInventories = stockInventoryMapper.selectList(new LambdaQueryWrapper<StockInventory>().in(StockInventory::getBatchNo, salesLedgerProductImportDto.getBatchNo()));
+ if (CollectionUtils.isEmpty(stockInventories)) {
+ throw new RuntimeException("浜у搧鎵瑰彿:" + salesLedgerProductImportDto.getBatchNo() + ",搴撳瓨鏃犲搴斾骇鍝佹暟鎹紒");
+ }
BeanUtils.copyProperties(salesLedgerProductImportDto, salesLedgerProduct);
salesLedgerProduct.setSalesLedgerId(salesLedger.getId());
salesLedgerProduct.setType(1);
@@ -455,16 +462,13 @@
salesLedgerProduct.setApproveStatus(0);
salesLedgerProduct.setPendingInvoiceTotal(salesLedgerProductImportDto.getTaxInclusiveTotalPrice());
salesLedgerProductMapper.insert(salesLedgerProduct);
- // 娣诲姞鐢熶骇鏁版嵁
- salesLedgerProductServiceImpl.addProductionData(salesLedgerProduct);
}
}
return AjaxResult.success("瀵煎叆鎴愬姛");
} catch (Exception e) {
- e.printStackTrace();
+ throw new RuntimeException(e.getMessage());
}
- return AjaxResult.success("瀵煎叆澶辫触");
}
@Override
@@ -660,7 +664,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 +929,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 +982,5 @@
e.printStackTrace();
throw new RuntimeException("瀵煎嚭澶辫触");
}
-
}
}
--
Gitblit v1.9.3