PDA盘点修改进度不显示问题,状态显示问题

This commit is contained in:
秦鸿展
2026-03-17 13:17:47 +08:00
parent cf869030f0
commit 7899379c22
3 changed files with 36 additions and 17 deletions
@@ -559,20 +559,28 @@ public class InvestigationManageApplicationService {
po.setInvestigationProgress(BigDecimal.ZERO);
return;
}
int totalCount = detailList.size();
int investigatedCount = 0;
BigDecimal totalQuantity = BigDecimal.ZERO;
BigDecimal investigatedQuantity = BigDecimal.ZERO;
for (InvestigetionManageDetailPO detail : detailList) {
if (detail.getInventoryQuantity() != null) {
totalQuantity = totalQuantity.add(detail.getInventoryQuantity());
if (Integer.valueOf(4).equals(detail.getInvestigationStatus())) {
}
Integer status = detail.getInvestigationStatus();
// 状态>=3表示已盘完(3=盘亏/盘盈,4=正常),盘点数量可以为0
if (status != null && status >= 3) {
investigatedCount++;
if (detail.getInventoryQuantity() != null) {
investigatedQuantity = investigatedQuantity.add(detail.getInventoryQuantity());
}
}
}
po.setTotalInventoryQuantity(totalQuantity);
po.setInvestigatedInventoryQuantity(investigatedQuantity);
if (totalQuantity.compareTo(BigDecimal.ZERO) > 0) {
po.setInvestigationProgress(investigatedQuantity.divide(totalQuantity, 4, RoundingMode.HALF_UP));
// 进度按条数计算,避免盘点数量为0时进度不准
if (totalCount > 0) {
po.setInvestigationProgress(new BigDecimal(investigatedCount).divide(new BigDecimal(totalCount), 4, RoundingMode.HALF_UP));
} else {
po.setInvestigationProgress(BigDecimal.ZERO);
}
@@ -623,8 +631,8 @@ public class InvestigationManageApplicationService {
if (investigetionManageDetailPO == null){
throw new ServiceException("物料明细不存在");
}
if (ObjectUtil.isNull(investigetionManageDetailDO.getInvestigationQuantity()) || investigetionManageDetailDO.getInvestigationQuantity().compareTo(BigDecimal.ZERO) == 0){
//未进盘点直接跳过
if (ObjectUtil.isNull(investigetionManageDetailDO.getInvestigationQuantity())){
//盘点数量为null时跳过
continue;
}
InvestigetionManageDetailDO returnInvestigetionManageDetailDO = new InvestigetionManageDetailDO();
@@ -25,6 +25,7 @@ import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
@@ -175,19 +176,23 @@ public class InvestigationManageDomainService {
investigationManagePO.setInvestigationMaterialQuantity(totalInvestigetionMaterialQuantity);
investigationManagePO.setMaterialQuantity(investigetionStorageList.size());
investigationManagePO.setInvestigetionStorageList(investigetionStorageList);
// 计算盘点进度 = 已盘组数 / 总组数
if (investigetionStorageList.size() > 0) {
investigationManagePO.setInvestigationProgress(
new BigDecimal(totalInvestigetionMaterialQuantity).divide(new BigDecimal(investigetionStorageList.size()), 4, RoundingMode.HALF_UP)
);
} else {
investigationManagePO.setInvestigationProgress(BigDecimal.ZERO);
}
return investigationManagePO;
}
/**
* 按物料盘点 获取盘点单详细信息
*/
public InvestigationManagePO getInfoByMaterial(Long investigationManageId) {
InvestigationManagePO investigationManagePO = investigationManageService.getInfoByInvestigationManageId(investigationManageId);
InvestigetionManageDetailDO investigetionManageDetailDO = new InvestigetionManageDetailDO();
investigetionManageDetailDO.setInvestigationNumber(investigationManagePO.getInvestigationNumber());
List<InvestigetionManageDetailPO> investigetionManageDetailPOList = iInvestigetionManageDetailService.queryList(investigetionManageDetailDO);
Map<Long, List<InvestigetionManageDetailPO>> investigetionManageDetailPOMap = investigetionManageDetailPOList.stream().collect(Collectors.groupingBy(InvestigetionManageDetailPO::getStorageLocationId));
int totalInvestigetionMaterialQuantity = 0;//盘点单按物料分组 统计已拣货进度
Map<Long, List<InvestigetionManageDetailPO>> investigetionManageDetailPOMap = investigetionManageDetailPOList.stream().collect(Collectors.groupingBy(InvestigetionManageDetailPO::getMaterialBaseInfoId));
int totalInvestigetionMaterialQuantity = 0;//盘点单按物料分组 统计已盘点进度
List<InvestigetionMaterialPO> investigetionMaterialList = new ArrayList<>();
for (Map.Entry<Long, List<InvestigetionManageDetailPO>> map : investigetionManageDetailPOMap.entrySet()) {
List<InvestigetionManageDetailPO> investigationManageDetailPOListByMaterial = map.getValue();
@@ -232,6 +237,14 @@ public class InvestigationManageDomainService {
investigationManagePO.setInvestigationMaterialQuantity(totalInvestigetionMaterialQuantity);
investigationManagePO.setMaterialQuantity(investigetionMaterialList.size());
investigationManagePO.setInvestigetionMaterialList(investigetionMaterialList);
// 计算盘点进度 = 已盘组数 / 总组数
if (investigetionMaterialList.size() > 0) {
investigationManagePO.setInvestigationProgress(
new BigDecimal(totalInvestigetionMaterialQuantity).divide(new BigDecimal(investigetionMaterialList.size()), 4, RoundingMode.HALF_UP)
);
} else {
investigationManagePO.setInvestigationProgress(BigDecimal.ZERO);
}
return investigationManagePO;
}
@@ -324,16 +337,12 @@ public class InvestigationManageDomainService {
private Integer judgeInvestigationQuantityByMaterial(BigDecimal investigationQuantity, BigDecimal quantity) {
//1-待盘点 2-盘亏 3-正常 4-盘盈
if (investigationQuantity.compareTo(BigDecimal.ZERO) == 0) {
//待盘点
return 1;
} else if (investigationQuantity.compareTo(quantity) < 0) {
//盘亏
return 2;
} else if (investigationQuantity.compareTo(quantity) == 0) {
//正常
return 3;
} else {
//盘盈
return 4;
}
}
@@ -29,6 +29,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="taskDistributionTime" column="task_distribution_time" />
<result property="operatorsBy" column="operators_by" />
<result property="operatorsName" column="operators_name" />
<result property="investigationManBy" column="investigation_man_by" />
<result property="investigationManName" column="investigation_man_name" />
<result property="nullify" column="nullify" />
<result property="remark" column="remark" />
<result property="createTime" column="create_time" />
@@ -44,9 +46,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<sql id="selectInvestigationManagePo">
select m.investigation_manage_id, m.organization_id, m.organization_name, m.top_organization_id, m.investigation_number, m.old_investigation_number, m.investigation_status, m.investigation_range, m.investigation_type, m.investigation_method, m.investigation_frequency, m.different_number, m.warehouse_id, m.warehouse_code, m.warehouse_name, m.audit_status, m.audit_remark, m.audit_by, m.audit_by_name, m.audit_time, m.task_distribution, m.task_distribution_time, m.operators_by, m.operators_name, m.nullify, m.remark, m.create_time, m.create_by, m.create_by_name, m.update_time, m.update_by, m.update_by_name, m.del_flag,
select m.investigation_manage_id, m.organization_id, m.organization_name, m.top_organization_id, m.investigation_number, m.old_investigation_number, m.investigation_status, m.investigation_range, m.investigation_type, m.investigation_method, m.investigation_frequency, m.different_number, m.warehouse_id, m.warehouse_code, m.warehouse_name, m.audit_status, m.audit_remark, m.audit_by, m.audit_by_name, m.audit_time, m.task_distribution, m.task_distribution_time, m.operators_by, m.operators_name, m.investigation_man_by, m.investigation_man_name, m.nullify, m.remark, m.create_time, m.create_by, m.create_by_name, m.update_time, m.update_by, m.update_by_name, m.del_flag,
(SELECT IFNULL(SUM(d.inventory_quantity), 0) FROM investigetion_manage_detail d WHERE d.investigation_number = m.investigation_number AND d.del_flag = 1) as total_inventory_quantity,
(SELECT IFNULL(SUM(d.inventory_quantity), 0) FROM investigetion_manage_detail d WHERE d.investigation_number = m.investigation_number AND d.del_flag = 1 AND d.investigation_status = 4) as investigated_inventory_quantity
(SELECT IFNULL(SUM(d.inventory_quantity), 0) FROM investigetion_manage_detail d WHERE d.investigation_number = m.investigation_number AND d.del_flag = 1 AND d.investigation_status IN (3, 4)) as investigated_inventory_quantity
from investigation_manage m
</sql>