From 7a4a00136ff933197318de096b0d318b6331484f Mon Sep 17 00:00:00 2001
From: maven <2163098428@qq.com>
Date: 星期三, 17 十二月 2025 16:11:00 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/hckx' into hckx
---
src/main/java/com/ruoyi/procurementrecord/service/impl/ProcurementRecordServiceImpl.java | 108 ++++++++++++++++++++++++++++++++++++++++++------------
1 files changed, 84 insertions(+), 24 deletions(-)
diff --git a/src/main/java/com/ruoyi/procurementrecord/service/impl/ProcurementRecordServiceImpl.java b/src/main/java/com/ruoyi/procurementrecord/service/impl/ProcurementRecordServiceImpl.java
index c9d5fee..ab73804 100644
--- a/src/main/java/com/ruoyi/procurementrecord/service/impl/ProcurementRecordServiceImpl.java
+++ b/src/main/java/com/ruoyi/procurementrecord/service/impl/ProcurementRecordServiceImpl.java
@@ -110,6 +110,8 @@
procurementRecordStorageById.setWarnNum(procurementDto.getWarnNum());
procurementRecordStorageById.setUpdateUser(SecurityUtils.getLoginUser().getUserId());
procurementRecordStorageById.setUpdateTime(LocalDateTime.now());
+ procurementRecordStorageById.setUnitPrice(procurementDto.getUnitPrice());
+ procurementRecordStorageById.setTotalPrice(procurementDto.getTotalPrice());
return procurementRecordMapper.updateById(procurementRecordStorageById);
}
@@ -119,7 +121,8 @@
procurementRecordMapper.deleteBatchIds(procurementRecordStorageById.stream().map(ProcurementRecordStorage::getId).collect(Collectors.toList()));
// 鍒犻櫎鎵�鏈夊搴旂殑鍑哄簱璁板綍
LambdaQueryWrapper<ProcurementRecordOut> procurementRecordOutLambdaQueryWrapper = new LambdaQueryWrapper<>();
- procurementRecordOutLambdaQueryWrapper.in(ProcurementRecordOut::getProcurementRecordStorageId, procurementDto.getIds());
+ procurementRecordOutLambdaQueryWrapper.in(ProcurementRecordOut::getProcurementRecordStorageId, procurementDto.getIds())
+ .eq(ProcurementRecordOut::getType,procurementDto.getType());
List<ProcurementRecordOut> procurementRecordOuts = procurementRecordOutMapper.selectList(procurementRecordOutLambdaQueryWrapper);
if(!CollectionUtils.isEmpty(procurementRecordOuts)){
procurementRecordOutMapper.deleteBatchIds(procurementRecordOuts.stream().map(ProcurementRecordOut::getId).collect(Collectors.toList()));
@@ -192,15 +195,28 @@
if(salesLedgerProduct == null){
throw new RuntimeException("閿�鍞彴璐︿骇鍝佷笉瀛樺湪");
}
+ // 鏍规嵁澶х被锛岃鏍兼煡璇㈡墍鏈変骇鍝乮d
+ LambdaQueryWrapper<SalesLedgerProduct> salesLedgerProductLambdaQueryWrapper = new LambdaQueryWrapper<>();
+ salesLedgerProductLambdaQueryWrapper.eq(SalesLedgerProduct::getProductCategory, salesLedgerProduct.getProductCategory())
+ .eq(SalesLedgerProduct::getSpecificationModel, salesLedgerProduct.getSpecificationModel())
+ .eq(SalesLedgerProduct::getType, 1);
+ List<SalesLedgerProduct> salesLedgerProducts = salesLedgerProductMapper.selectList(salesLedgerProductLambdaQueryWrapper);
+ if(CollectionUtils.isEmpty(salesLedgerProducts)){
+ throw new RuntimeException("娌℃湁鎵惧埌瀵瑰簲鐨勪骇鍝�");
+ }
salesLedgerProduct.setMinStock(procurementDto.getMinStock());
salesLedgerProductMapper.updateById(salesLedgerProduct);
- ProcurementRecordStorage procurementRecordStorageById = getProcurementRecordById(procurementDto.getId());
- procurementRecordStorageById.setCreateBy(sysUser.getNickName());
- procurementRecordStorageById.setCreateUser(sysUser.getUserId());
- procurementRecordStorageById.setUpdateTime(LocalDateTime.parse(entryDateStr,df));
- procurementRecordStorageById.setUpdateUser(loginUser.getUserId());
- procurementRecordStorageById.setCreateTime(LocalDateTime.parse(createTimeStr,df));
- procurementRecordMapper.updateById(procurementRecordStorageById);
+ LambdaQueryWrapper<ProcurementRecordStorage> procurementRecordStorageLambdaQueryWrapper = new LambdaQueryWrapper<>();
+ procurementRecordStorageLambdaQueryWrapper.in(ProcurementRecordStorage::getSalesLedgerProductId, salesLedgerProducts.stream().map(SalesLedgerProduct::getId).collect(Collectors.toList()));
+ ProcurementRecordStorage procurementRecordStorage = ProcurementRecordStorage.builder().build();
+ procurementRecordStorage.setUnitPrice(procurementDto.getUnitPrice());
+ procurementRecordStorage.setTotalPrice(procurementDto.getTotalPrice());
+ procurementRecordStorage.setCreateBy(sysUser.getNickName());
+ procurementRecordStorage.setCreateUser(sysUser.getUserId());
+ procurementRecordStorage.setUpdateTime(LocalDateTime.parse(entryDateStr,df));
+ procurementRecordStorage.setUpdateUser(loginUser.getUserId());
+ procurementRecordStorage.setCreateTime(LocalDateTime.parse(createTimeStr,df));
+ procurementRecordMapper.update(procurementRecordStorage,procurementRecordStorageLambdaQueryWrapper);
return 0;
}
@@ -255,7 +271,9 @@
@Override
public void exportCopyTwo(HttpServletResponse response,Integer type) {
- List<CustomStorage> list = customStorageMapper.selectList(null);
+ LambdaQueryWrapper<CustomStorage> customStorageLambdaQueryWrapper = new LambdaQueryWrapper<>();
+ customStorageLambdaQueryWrapper.groupBy(CustomStorage::getSupplierName, CustomStorage::getProductCategory, CustomStorage::getSpecificationModel);
+ List<CustomStorage> list = customStorageMapper.selectList(customStorageLambdaQueryWrapper);
// 璁$畻寰呭叆搴撴暟閲�
// 鏌ヨ閲囪喘璁板綍宸插叆搴撴暟閲�
List<Integer> collect = list.stream().map(CustomStorage::getId).collect(Collectors.toList());
@@ -462,11 +480,16 @@
customStorageLambdaQueryWrapper.like(CustomStorage::getSupplierName, customStorage.getSupplierName());
}
// 绛涢�夊叆搴撴椂闂�
- if(customStorage.getInboundDate() != null){
- customStorageLambdaQueryWrapper.eq(CustomStorage::getInboundDate, customStorage.getInboundDate());
+ if(customStorage.getTimeStr() != null){
+ customStorageLambdaQueryWrapper.eq(CustomStorage::getInboundDate, customStorage.getTimeStr());
+ }
+ if(!StringUtils.isEmpty(customStorage.getProductCategory())){
+ customStorageLambdaQueryWrapper.like(CustomStorage::getProductCategory, customStorage.getProductCategory());
}
}
+ customStorageLambdaQueryWrapper.orderByDesc(CustomStorage::getInboundDate);
IPage<CustomStorage> procurementPageDtoIPage = customStorageMapper.selectPage(page, customStorageLambdaQueryWrapper);
+ procurementPageDtoIPage.getRecords().forEach(item -> item.setInboundNum0(item.getInboundNum()));
List<CustomStorage> procurementPageDtos = procurementPageDtoIPage.getRecords();
// 璁$畻寰呭叆搴撴暟閲�
// 鏌ヨ閲囪喘璁板綍宸插叆搴撴暟閲�
@@ -530,6 +553,7 @@
// 濡傛灉娌℃湁鐩稿叧鐨勫嚭搴撹褰曪紝璺宠繃璇ユ潯鏁版嵁
if(CollectionUtils.isEmpty(collect1)){
dto.setInboundNum0(dto.getInboundNum());
+ dto.setTotalInboundNum(BigDecimal.ZERO);
continue;
}
@@ -541,24 +565,33 @@
dto.setTotalInboundNum(totalInboundNum);
// 寰呭嚭搴撴暟閲� = 鎬绘暟閲� - 宸插嚭搴撴暟閲�
dto.setInboundNum0(dto.getInboundNum().subtract(totalInboundNum));
+ // 搴撳瓨浠峰��
+ if(dto.getUnitPrice() != null){
+ dto.setTotalPrice(dto.getTotalInboundNum().multiply(dto.getUnitPrice()));
+ }
}
return procurementPageDtoCopyIPage;
}
@Override
public IPage<CustomStorage> listPageCopyByCustom(Page page, CustomStorage customStorage) {
- LambdaQueryWrapper<CustomStorage> customStorageLambdaQueryWrapper = new LambdaQueryWrapper<>();
- customStorageLambdaQueryWrapper.groupBy(CustomStorage::getSupplierName, CustomStorage::getProductCategory, CustomStorage::getSpecificationModel);
- if(customStorage != null){
- if(!StringUtils.isEmpty(customStorage.getSupplierName())){
- customStorageLambdaQueryWrapper.like(CustomStorage::getSupplierName, customStorage.getSupplierName());
- }
- // 绛涢�夊叆搴撴椂闂�
- if(customStorage.getInboundDate() != null){
- customStorageLambdaQueryWrapper.eq(CustomStorage::getInboundDate, customStorage.getInboundDate());
- }
- }
- IPage<CustomStorage> pageList = customStorageMapper.selectPage(page, customStorageLambdaQueryWrapper);
+// LambdaQueryWrapper<CustomStorage> customStorageLambdaQueryWrapper = new LambdaQueryWrapper<>();
+// customStorageLambdaQueryWrapper.groupBy(CustomStorage::getProductCategory, CustomStorage::getSpecificationModel,CustomStorage::getTaxInclusiveUnitPrice);
+// if(customStorage != null){
+// if(!StringUtils.isEmpty(customStorage.getSupplierName())){
+// customStorageLambdaQueryWrapper.like(CustomStorage::getSupplierName, customStorage.getSupplierName());
+// }
+// // 绛涢�夊叆搴撴椂闂�
+// if(customStorage.getInboundDate() != null){
+// customStorageLambdaQueryWrapper.eq(CustomStorage::getInboundDate, customStorage.getInboundDate());
+// }
+// if(!StringUtils.isEmpty(customStorage.getProductCategory())){
+// customStorageLambdaQueryWrapper.like(CustomStorage::getProductCategory, customStorage.getProductCategory());
+// }
+// }
+// customStorageLambdaQueryWrapper.orderByDesc(CustomStorage::getInboundDate);
+ IPage<CustomStorage> pageList = customStorageMapper.listPageCopyByCustom(page, customStorage);
+
List<CustomStorage> procurementPageDtoCopyList = pageList.getRecords();
// 璁$畻寰呭叆搴撴暟閲�
// 鏌ヨ閲囪喘璁板綍宸插叆搴撴暟閲�
@@ -582,6 +615,7 @@
// 濡傛灉娌℃湁鐩稿叧鐨勫嚭搴撹褰曪紝璺宠繃璇ユ潯鏁版嵁
if(CollectionUtils.isEmpty(collect1)){
dto.setInboundNum0(dto.getInboundNum());
+ dto.setTotalInboundNum(BigDecimal.ZERO);
continue;
}
@@ -593,6 +627,10 @@
dto.setTotalInboundNum(totalInboundNum);
// 寰呭嚭搴撴暟閲� = 鎬绘暟閲� - 宸插嚭搴撴暟閲�
dto.setInboundNum0(dto.getInboundNum().subtract(totalInboundNum));
+ // 搴撳瓨浠峰��
+ if(dto.getTaxInclusiveUnitPrice() != null){
+ dto.setTaxInclusiveTotalPrice(dto.getInboundNum0().multiply(dto.getTaxInclusiveUnitPrice()));
+ }
}
pageList.setRecords(procurementPageDtoCopyList);
return pageList;
@@ -606,6 +644,21 @@
@Override
public AjaxResult deleteCustom(List<Long> ids) {
return AjaxResult.success(customStorageMapper.deleteBatchIds(ids));
+ }
+
+ @Override
+ public int updateManagementByCustom(ProcurementManagementUpdateDto procurementDto) {
+ CustomStorage customStorage = customStorageMapper.selectById(procurementDto.getId());
+ if(customStorage == null){
+ throw new RuntimeException("鏉愭枡搴撳瓨涓嶅瓨鍦�");
+ }
+ LambdaQueryWrapper<CustomStorage> customStorageLambdaQueryWrapper = new LambdaQueryWrapper<>();
+ customStorageLambdaQueryWrapper.eq(CustomStorage::getProductCategory, customStorage.getProductCategory())
+ .eq(CustomStorage::getSpecificationModel, customStorage.getSpecificationModel());
+ CustomStorage one = new CustomStorage();
+ one.setTaxInclusiveUnitPrice(procurementDto.getTaxInclusiveUnitPrice());
+ one.setTaxInclusiveTotalPrice(procurementDto.getTaxInclusiveTotalPrice());
+ return customStorageMapper.update(one,customStorageLambdaQueryWrapper);
}
@Override
@@ -625,6 +678,8 @@
.inboundNum(detail.getInboundQuantity())
.type(procurementDto.getType())
.warnNum(detail.getWarnNum())
+ .unitPrice(detail.getUnitPrice())
+ .totalPrice(detail.getInboundQuantity().multiply(detail.getUnitPrice()))
.createTime(LocalDateTime.now())
.createUser(loginUser.getUserId())
.updateTime(LocalDateTime.now())
@@ -704,12 +759,13 @@
for (ProcurementPageDtoCopy dto : procurementPageDtoCopyList) {
// 鏍规嵁閲囪喘鍙拌处ID绛涢�夊搴旂殑鍑哄簱璁板綍
List<ProcurementRecordOut> collect1 = procurementRecords.stream()
- .filter(ProcurementRecordOut -> ProcurementRecordOut.getProcurementRecordStorageId().equals(dto.getId()))
+ .filter(ProcurementRecordOut -> ProcurementRecordOut.getProcurementRecordStorageId().equals(dto.getId()) && ProcurementRecordOut.getType().equals(1))
.collect(Collectors.toList());
// 濡傛灉娌℃湁鐩稿叧鐨勫嚭搴撹褰曪紝璺宠繃璇ユ潯鏁版嵁
if(CollectionUtils.isEmpty(collect1)){
dto.setInboundNum0(dto.getInboundNum());
+ dto.setTotalInboundNum(BigDecimal.ZERO);
continue;
}
@@ -721,6 +777,10 @@
dto.setTotalInboundNum(totalInboundNum);
// 寰呭嚭搴撴暟閲� = 鎬绘暟閲� - 宸插嚭搴撴暟閲�
dto.setInboundNum0(dto.getInboundNum().subtract(totalInboundNum));
+ // 搴撳瓨浠峰��
+ if(dto.getUnitPrice() != null){
+ dto.setTotalPrice(dto.getInboundNum0().multiply(dto.getUnitPrice()));
+ }
}
return procurementPageDtoCopyIPage;
}
--
Gitblit v1.9.3