Merge remote-tracking branch 'origin/dev' into dev

This commit is contained in:
tangyu 2025-09-25 10:09:29 +08:00
commit add3face01
6 changed files with 110 additions and 17 deletions

View File

@ -75,6 +75,13 @@ public class DocumentReportController {
return R.ok(documentReportService.pageDocumentDetailed(page, documentDetailReportDto));
}
//单据明细报表 汇总数量
@ResponseBody
@GetMapping("/totalAsyncFunction")
public R totalAsyncFunction(DocumentDetailReportDto documentDetailReportDto) {
return R.ok(documentReportService.totalAsyncFunction(documentDetailReportDto));
}
/**
* 单据明细表导出
*

View File

@ -6,11 +6,7 @@ import com.foreverwin.iep.common.base.FrontPage;
import com.foreverwin.mom.common.core.util.R;
import com.foreverwin.mom.common.data.tenant.TenantContextHolder;
import com.foreverwin.mom.common.excel.annotation.ResponseExcel;
import com.foreverwin.mom.wms.dto.InventoryQueryReportDto;
import com.foreverwin.mom.wms.dto.InventorySummaryReportDTO;
import com.foreverwin.mom.wms.dto.InventorySummaryReportNewThreeDTO;
import com.foreverwin.mom.wms.dto.InventorySummaryReportNewTwoDTO;
import com.foreverwin.mom.wms.dto.InventorySummaryReportNewOneDTO;
import com.foreverwin.mom.wms.dto.*;
import com.foreverwin.mom.wms.service.InventoryQueryReportService;
import com.foreverwin.mom.wms.util.ExcelCellWidthStyleStrategy;
import io.swagger.annotations.Api;
@ -20,6 +16,7 @@ import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import javax.servlet.http.HttpServletResponse;
import java.math.BigDecimal;
import java.util.List;
/**
@ -48,6 +45,17 @@ public class InventoryQueryReportController {
return R.ok(inventoryQueryReportService.doRetrieve(page, inventoryQueryReportDto));
}
/**
* 库存查询报表 - 总数量
*
* @return R
*/
@ResponseBody
@GetMapping("/getTotalQty")
public R<BigDecimal> getTotalQty(InventoryQueryReportDto inventoryQueryReportDto) {
return R.ok(inventoryQueryReportService.getTotalQty(inventoryQueryReportDto));
}
/**
* 库存查询报表 - 导出
*

View File

@ -7,6 +7,7 @@ import com.foreverwin.mom.wms.dto.DocumentSummaryReportDto;
import com.foreverwin.mom.wms.entity.DocumentDetailed;
import com.foreverwin.mom.wms.entity.WareHouse;
import java.math.BigDecimal;
import java.util.List;
/**
@ -35,4 +36,6 @@ public interface DocumentReportService extends IService<DocumentDetailed> {
//获取目标仓
IPage<WareHouse> getAllTargetWarehouse(IPage<WareHouse> iPage, String site, String searchText);
// 异步获取单据明细汇总数量
BigDecimal totalAsyncFunction(DocumentDetailReportDto documentDetailReportDto);
}

View File

@ -8,6 +8,7 @@ import com.foreverwin.mom.wms.dto.InventorySummaryReportNewOneDTO;
import com.foreverwin.mom.wms.dto.InventorySummaryReportNewThreeDTO;
import com.foreverwin.mom.wms.dto.InventorySummaryReportNewTwoDTO;
import java.math.BigDecimal;
import java.util.List;
/**
@ -22,6 +23,11 @@ public interface InventoryQueryReportService {
*/
IPage<InventoryQueryReportDto> doRetrieve(IPage<InventoryQueryReportDto> iPage, InventoryQueryReportDto inventoryQueryReportDto);
/**
* 库存查询报表 - 总数量
*/
BigDecimal getTotalQty(InventoryQueryReportDto inventoryQueryReportDto);
/**
* 库存查询报表(非9001)- 导出查询
*/

View File

@ -8,7 +8,6 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.foreverwin.mom.admin.api.entity.SysDictItem;
import com.foreverwin.mom.admin.api.feign.RemoteDictService;
import com.foreverwin.mom.common.core.constant.SecurityConstants;
import com.foreverwin.mom.common.core.exception.BusinessException;
import com.foreverwin.mom.common.data.tenant.TenantContextHolder;
import com.foreverwin.mom.wms.dto.DocumentDetailReportDto;
import com.foreverwin.mom.wms.dto.DocumentSummaryReportDto;
@ -16,7 +15,6 @@ import com.foreverwin.mom.wms.entity.DocumentDetailed;
import com.foreverwin.mom.wms.entity.WareHouse;
import com.foreverwin.mom.wms.mapper.DocumentReportMapper;
import com.foreverwin.mom.wms.service.DocumentReportService;
import lombok.AllArgsConstructor;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
@ -209,8 +207,44 @@ public class DocumentReportServiceImpl extends ServiceImpl<DocumentReportMapper,
modifyDateTime2,
iqcResultsList);
if (CollectionUtil.isNotEmpty(documentDetailReportDtoIPage.getRecords())) {
BigDecimal totalQty = baseMapper.retrieveTotalQty(site,
return documentDetailReportDtoIPage;
}
/**
* 单据明细表 汇总数量
* @param dto
* @return
*/
@Override
public BigDecimal totalAsyncFunction(DocumentDetailReportDto dto) {
String site = TenantContextHolder.getTenantId();
List<String> documentNoList = splitSearchField(dto.getDocumentNo());
List<String> externalDocumentNoList = splitSearchField(dto.getExternalDocumentNo());
List<String> documentTypeList = splitSearchField(dto.getDocumentType());
List<String> stateList = splitSearchField(dto.getState());
List<String> palletList = splitSearchField(dto.getPallet());
List<String> inventoryIdList = splitSearchField(dto.getInventoryId());
List<String> salesBatchList = splitSearchField(dto.getSalesBatch());
List<String> itemList = splitSearchField(dto.getItem());
List<String> inspectionOrderNoList = splitSearchField(dto.getInspectionOrderNo());
List<String> qualityInspectionStatusList = splitSearchField(dto.getQualityInspectionStatus());
List<String> batchNumberList = splitSearchField(dto.getBatchNumber());
List<String> vendorBatchList = splitSearchField(dto.getVendorBatch());
List<String> sourceWarehouseList = splitSearchField(dto.getSourceWarehouse());
List<String> sourceLocationList = splitSearchField(dto.getSourceLocation());
List<String> storageBinList = splitSearchField(dto.getStorageBin());
List<String> targetWarehouseList = splitSearchField(dto.getTargetWarehouse());
List<String> targetLocationList = splitSearchField(dto.getTargetLocation());
List<String> targetBinList = splitSearchField(dto.getTargetBin());
List<String> createUserList = splitSearchField(dto.getCreateUser());
LocalDateTime createDateTime1 = dto.getCreateDateTime1();
LocalDateTime createDateTime2 = dto.getCreateDateTime2();
LocalDateTime modifyDateTime1 = dto.getModifyDateTime1();
LocalDateTime modifyDateTime2 = dto.getModifyDateTime2();
List<String> updateUserList = splitSearchField(dto.getUpdateUser());
List<String> iqcResultsList = splitSearchField(dto.getIqcResults());
BigDecimal totalQty = baseMapper.retrieveTotalQty(site,
documentNoList,
externalDocumentNoList,
documentTypeList,
@ -236,10 +270,11 @@ public class DocumentReportServiceImpl extends ServiceImpl<DocumentReportMapper,
modifyDateTime1,
modifyDateTime2,
iqcResultsList);
documentDetailReportDtoIPage.getRecords().get(0).setTotalQty(totalQty);
// 如果获取到的数据为空,则返回0
if (totalQty == null) {
totalQty = BigDecimal.ZERO;
}
return documentDetailReportDtoIPage;
return totalQty;
}
@Override

View File

@ -1,6 +1,5 @@
package com.foreverwin.mom.wms.service.impl;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
@ -68,13 +67,48 @@ public class InventoryQueryReportServiceImpl implements InventoryQueryReportServ
String storageRemark = inventoryQueryReportDto.getStorageRemark();
IPage<InventoryQueryReportDto> inventoryQueryReportDtoIPage = inventoryQueryReportMapper.retrieve(iPage, site, erpStorageLocationList, inventoryIdList, carrierList, statusList, itemList, batchNoList, vendorBatchNoList, qualityInspectionStatusList, inventorySpecialMarking, dnOrder,qtyOnHand, dnOrderSeq, rollType, storageBinList, storageLocationList, allowZero, typeNo, shopOrderList, supplierBarcodeList, bigBatchNoList, isSecrecy, inventoryQueryReportDto.getStorageTime(), hasPmys, storageRemark);
if (CollectionUtil.isNotEmpty(inventoryQueryReportDtoIPage.getRecords())) {
BigDecimal totalQty = inventoryQueryReportMapper.retrieveTotalQty(site,qtyOnHand, erpStorageLocationList, inventoryIdList, carrierList, statusList, itemList, batchNoList, vendorBatchNoList, qualityInspectionStatusList, inventorySpecialMarking, dnOrder, dnOrderSeq, rollType, storageBinList, storageLocationList, allowZero, typeNo, shopOrderList, supplierBarcodeList, bigBatchNoList, isSecrecy, inventoryQueryReportDto.getStorageTime(), hasPmys, storageRemark);
inventoryQueryReportDtoIPage.getRecords().get(0).setTotalQty(totalQty);
}
// if (CollectionUtil.isNotEmpty(inventoryQueryReportDtoIPage.getRecords())) {
// BigDecimal totalQty = inventoryQueryReportMapper.retrieveTotalQty(site,qtyOnHand, erpStorageLocationList, inventoryIdList, carrierList, statusList, itemList, batchNoList, vendorBatchNoList, qualityInspectionStatusList, inventorySpecialMarking, dnOrder, dnOrderSeq, rollType, storageBinList, storageLocationList, allowZero, typeNo, shopOrderList, supplierBarcodeList, bigBatchNoList, isSecrecy, inventoryQueryReportDto.getStorageTime(), hasPmys, storageRemark);
// inventoryQueryReportDtoIPage.getRecords().get(0).setTotalQty(totalQty);
// }
return inventoryQueryReportDtoIPage;
}
@Override
public BigDecimal getTotalQty(InventoryQueryReportDto inventoryQueryReportDto) {
String site = TenantContextHolder.getTenantId();
List<String> erpStorageLocationList = splitSearchField(inventoryQueryReportDto.getErpStorageLocation());
List<String> inventoryIdList = splitSearchField(inventoryQueryReportDto.getInventoryId());
List<String> carrierList = splitSearchField(inventoryQueryReportDto.getCarrier());
List<String> statusList = splitSearchField(inventoryQueryReportDto.getStatus());
List<String> itemList = splitSearchField(inventoryQueryReportDto.getItem());
List<String> batchNoList = splitSearchField(inventoryQueryReportDto.getBatchNo());
List<String> vendorBatchNoList = splitSearchField(inventoryQueryReportDto.getVendorBatchNo());
List<String> qualityInspectionStatusList = splitSearchField(inventoryQueryReportDto.getQualityInspectionStatus());
String inventorySpecialMarking = inventoryQueryReportDto.getInventorySpecialMarking();
String dnOrder = inventoryQueryReportDto.getDnOrder();
Integer dnOrderSeq = inventoryQueryReportDto.getDnOrderSeq();
String rollType = inventoryQueryReportDto.getRollType();
String typeNo = inventoryQueryReportDto.getTypeNo();
List<String> storageBinList = splitSearchField(inventoryQueryReportDto.getStorageBin());
List<String> storageLocationList = splitSearchField(inventoryQueryReportDto.getStorageLocation());
boolean allowZero = inventoryQueryReportDto.isAllowZero();
List<String> supplierBarcodeList = splitSearchField(inventoryQueryReportDto.getSupplierBarcode());
List<String> bigBatchNoList = splitSearchField(inventoryQueryReportDto.getBigBatchNo());
List<String> shopOrderList = splitSearchField(inventoryQueryReportDto.getShopOrder());
BigDecimal qtyOnHand = inventoryQueryReportDto.getQtyOnHand();
// 作业规则 IS_SECRCY为Y代表保密用IN;IS_SECRCY不为Y,不配置此作业规则,用 not in
String isSecrecy = null;
// 如果 inventoryQueryReportDto.getIsSecrecy() 不为空,
if (StrUtil.isNotBlank(inventoryQueryReportDto.getIsSecrecy()) && "Y".equals(inventoryQueryReportDto.getIsSecrecy().toUpperCase())) {
isSecrecy = inventoryQueryReportDto.getIsSecrecy();
}
Boolean hasPmys = inventoryQueryReportDto.getHasPmys();
String storageRemark = inventoryQueryReportDto.getStorageRemark();
return inventoryQueryReportMapper.retrieveTotalQty(site,qtyOnHand, erpStorageLocationList, inventoryIdList, carrierList, statusList, itemList, batchNoList, vendorBatchNoList, qualityInspectionStatusList, inventorySpecialMarking, dnOrder, dnOrderSeq, rollType, storageBinList, storageLocationList, allowZero, typeNo, shopOrderList, supplierBarcodeList, bigBatchNoList, isSecrecy, inventoryQueryReportDto.getStorageTime(), hasPmys, storageRemark);
}
private List<String> splitSearchField(String field) {
return StrUtil.isNotBlank(field) ? Arrays.asList(field.split(" ")) : null;
}