Merge remote-tracking branch 'origin/dev' into dev
This commit is contained in:
+72
-9
@@ -32,6 +32,7 @@ import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
import java.util.function.Function;
|
||||
@@ -116,7 +117,17 @@ public class InvestigationManageApplicationService {
|
||||
investigationManageDO.setWarehouseId(associationWarehouseCacheDO.getWarehouseId());
|
||||
}
|
||||
}
|
||||
return investigationManageDomainService.queryList(investigationManageDO);
|
||||
List<InvestigationManagePO> list = investigationManageDomainService.queryList(investigationManageDO);
|
||||
// 计算盘点进度 = 已盘点状态的库存数量 / 盘点单库存总数量
|
||||
list.forEach(po -> {
|
||||
if (po.getTotalInventoryQuantity() != null && po.getTotalInventoryQuantity().compareTo(BigDecimal.ZERO) > 0
|
||||
&& po.getInvestigatedInventoryQuantity() != null) {
|
||||
po.setInvestigationProgress(po.getInvestigatedInventoryQuantity().divide(po.getTotalInventoryQuantity(), 4, RoundingMode.HALF_UP));
|
||||
} else {
|
||||
po.setInvestigationProgress(BigDecimal.ZERO);
|
||||
}
|
||||
});
|
||||
return list;
|
||||
}
|
||||
|
||||
|
||||
@@ -441,19 +452,71 @@ public class InvestigationManageApplicationService {
|
||||
|
||||
|
||||
/**
|
||||
* 按库位拣货 获取拣货作业单详细信息
|
||||
* 按库位盘点 获取盘点单详细信息(动态返回物料绑定的批次属性)
|
||||
*/
|
||||
public InvestigationManagePO getInfoByStorageLocation(Long investigationManageId)
|
||||
{
|
||||
return investigationManageDomainService.getInfoByStorageLocation(investigationManageId);
|
||||
public InvestigationManagePO getInfoByStorageLocation(Long investigationManageId) {
|
||||
InvestigationManagePO po = investigationManageDomainService.getInfoByStorageLocation(investigationManageId);
|
||||
enrichInvestigationWithBatchAttributes(po);
|
||||
return po;
|
||||
}
|
||||
|
||||
/**
|
||||
*按物料拣货 获取拣货作业单详细信息
|
||||
* 按物料盘点 获取盘点单详细信息(动态返回物料绑定的批次属性)
|
||||
*/
|
||||
public InvestigationManagePO getInfoByMaterial(Long investigationManageId)
|
||||
{
|
||||
return investigationManageDomainService.getInfoByMaterial(investigationManageId);
|
||||
public InvestigationManagePO getInfoByMaterial(Long investigationManageId) {
|
||||
InvestigationManagePO po = investigationManageDomainService.getInfoByMaterial(investigationManageId);
|
||||
enrichInvestigationWithBatchAttributes(po);
|
||||
return po;
|
||||
}
|
||||
|
||||
/**
|
||||
* 为盘点单的物料明细填充批次属性(与getInfo、StockOutTaskOrder等模块保持一致)
|
||||
*/
|
||||
private void enrichInvestigationWithBatchAttributes(InvestigationManagePO investigationManagePO) {
|
||||
if (investigationManagePO == null) {
|
||||
return;
|
||||
}
|
||||
List<InvestigetionManageDetailPO> detailList = new ArrayList<>();
|
||||
if (!CollectionUtils.isEmpty(investigationManagePO.getInvestigetionStorageList())) {
|
||||
investigationManagePO.getInvestigetionStorageList().forEach(storage -> {
|
||||
if (!CollectionUtils.isEmpty(storage.getInvestigetionManageDetailList())) {
|
||||
detailList.addAll(storage.getInvestigetionManageDetailList());
|
||||
}
|
||||
});
|
||||
}
|
||||
if (!CollectionUtils.isEmpty(investigationManagePO.getInvestigetionMaterialList())) {
|
||||
investigationManagePO.getInvestigetionMaterialList().forEach(material -> {
|
||||
if (!CollectionUtils.isEmpty(material.getInvestigetionManageDetailList())) {
|
||||
detailList.addAll(material.getInvestigetionManageDetailList());
|
||||
}
|
||||
});
|
||||
}
|
||||
if (CollectionUtils.isEmpty(detailList)) {
|
||||
return;
|
||||
}
|
||||
Set<Long> materialBaseInfoIdSet = detailList.stream()
|
||||
.map(InvestigetionManageDetailPO::getMaterialBaseInfoId)
|
||||
.filter(Objects::nonNull)
|
||||
.collect(Collectors.toSet());
|
||||
Map<Long, List<BatchDetailFeignPO>> batchDetailMap = new HashMap<>();
|
||||
for (Long materialBaseInfoId : materialBaseInfoIdSet) {
|
||||
try {
|
||||
AjaxResult ajaxResult = systemServiceFeign.getBatchDetailListByMaterialBaseInfoId(materialBaseInfoId);
|
||||
if (ajaxResult != null && "200".equals(String.valueOf(ajaxResult.get("code")))) {
|
||||
List<BatchDetailFeignPO> batchDetailFeignPOList = JSON.parseArray(
|
||||
JSONObject.toJSONString(ajaxResult.get("data")), BatchDetailFeignPO.class);
|
||||
if (!CollectionUtils.isEmpty(batchDetailFeignPOList)) {
|
||||
List<BatchDetailFeignPO> filteredList = batchDetailFeignPOList.stream()
|
||||
.filter(batchDetail -> batchDetail.getIsDisplay() != null && batchDetail.getIsDisplay() == 1)
|
||||
.collect(Collectors.toList());
|
||||
batchDetailMap.put(materialBaseInfoId, filteredList);
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.warn("获取物料批次属性失败,物料基础信息ID:{},错误:{}", materialBaseInfoId, e.getMessage());
|
||||
}
|
||||
}
|
||||
setMaterialMoreDetailListFromInventory(detailList, batchDetailMap);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+10
@@ -9,6 +9,7 @@ import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@@ -155,4 +156,13 @@ public class InvestigationManagePO extends BaseVOEntity {
|
||||
|
||||
@ApiModelProperty("按物料盘点详情")
|
||||
private List<InvestigetionMaterialPO> investigetionMaterialList;
|
||||
|
||||
@ApiModelProperty("盘点单库存总数量")
|
||||
private BigDecimal totalInventoryQuantity;
|
||||
|
||||
@ApiModelProperty("已盘点状态的库存数量")
|
||||
private BigDecimal investigatedInventoryQuantity;
|
||||
|
||||
@ApiModelProperty("盘点进度=已盘点状态的库存数量/盘点单库存总数量")
|
||||
private BigDecimal investigationProgress;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user