PDA盘点修改
This commit is contained in:
+4
@@ -199,6 +199,10 @@ public class WarehouseDomainService {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
storageSectionLinkagePO.setChildren(storageLocationLinkagePOList);
|
storageSectionLinkagePO.setChildren(storageLocationLinkagePOList);
|
||||||
|
// 有 storageLocationType 过滤时,库位为空的库区不展示
|
||||||
|
if (storageLocationType != null && !storageLocationType.isEmpty() && storageLocationLinkagePOList.isEmpty()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
storageSectionLinkagePOList.add(storageSectionLinkagePO);
|
storageSectionLinkagePOList.add(storageSectionLinkagePO);
|
||||||
});
|
});
|
||||||
warehouseLinkagePO.setChildren(storageSectionLinkagePOList);
|
warehouseLinkagePO.setChildren(storageSectionLinkagePOList);
|
||||||
|
|||||||
+7
-3
@@ -57,9 +57,13 @@ public class InvestigetionMaterialPO extends BaseVOEntity {
|
|||||||
@Excel(name = "盘点数量")
|
@Excel(name = "盘点数量")
|
||||||
private BigDecimal investigationQuantity;
|
private BigDecimal investigationQuantity;
|
||||||
|
|
||||||
@ApiModelProperty("盈亏数量")
|
@ApiModelProperty("盘盈数量")
|
||||||
@Excel(name = "盈亏数量")
|
@Excel(name = "盘盈数量")
|
||||||
private BigDecimal profitLossQuantity;
|
private BigDecimal investigationProfitQuantity;
|
||||||
|
|
||||||
|
@ApiModelProperty("盘亏数量")
|
||||||
|
@Excel(name = "盘亏数量")
|
||||||
|
private BigDecimal investigationLossQuantity;
|
||||||
|
|
||||||
@ApiModelProperty("盘点状态: 1-待盘点 2-盘亏 3-正常 4-盘盈")
|
@ApiModelProperty("盘点状态: 1-待盘点 2-盘亏 3-正常 4-盘盈")
|
||||||
@Excel(name = "盘点状态: 1-待盘点 2-盘亏 3-正常 4-盘盈")
|
@Excel(name = "盘点状态: 1-待盘点 2-盘亏 3-正常 4-盘盈")
|
||||||
|
|||||||
+84
-29
@@ -147,26 +147,59 @@ public class InvestigationManageDomainService {
|
|||||||
BeanUtils.copyProperties(investigationManageDetailPOListByMaterial.get(0), investigetionStoragePO);
|
BeanUtils.copyProperties(investigationManageDetailPOListByMaterial.get(0), investigetionStoragePO);
|
||||||
BigDecimal inventoryQuantity = BigDecimal.ZERO;//库存数量
|
BigDecimal inventoryQuantity = BigDecimal.ZERO;//库存数量
|
||||||
BigDecimal investigationQuantity = BigDecimal.ZERO;//盘点数量
|
BigDecimal investigationQuantity = BigDecimal.ZERO;//盘点数量
|
||||||
BigDecimal investigationProfitQuantity = BigDecimal.ZERO;//盘盈数量
|
boolean hasInvestigated = false;//是否有已盘点的明细
|
||||||
BigDecimal investigationLossQuantity = BigDecimal.ZERO;//盘亏数量
|
|
||||||
for (InvestigetionManageDetailPO investigetionManageDetailPO : investigationManageDetailPOListByMaterial) {
|
for (InvestigetionManageDetailPO investigetionManageDetailPO : investigationManageDetailPOListByMaterial) {
|
||||||
inventoryQuantity = inventoryQuantity.add(investigetionManageDetailPO.getInventoryQuantity());
|
inventoryQuantity = inventoryQuantity.add(investigetionManageDetailPO.getInventoryQuantity());
|
||||||
investigationQuantity = investigationQuantity.add(investigetionManageDetailPO.getInvestigationQuantity());
|
investigationQuantity = investigationQuantity.add(investigetionManageDetailPO.getInvestigationQuantity());
|
||||||
if (1 == investigetionManageDetailPO.getInvestigationResult()) {
|
if (investigetionManageDetailPO.getInvestigationResult() != null && investigetionManageDetailPO.getInvestigationResult() > 0) {
|
||||||
//盘盈
|
hasInvestigated = true;
|
||||||
investigationProfitQuantity = investigationProfitQuantity.add(investigetionManageDetailPO.getDifferentQuantity());
|
|
||||||
} else if (2 == investigetionManageDetailPO.getInvestigationResult()) {
|
|
||||||
//盘亏
|
|
||||||
investigationLossQuantity = investigationLossQuantity.add(investigetionManageDetailPO.getDifferentQuantity());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
investigetionStoragePO.setInventoryQuantity(inventoryQuantity);
|
investigetionStoragePO.setInventoryQuantity(inventoryQuantity);
|
||||||
investigetionStoragePO.setInvestigationQuantity(investigationQuantity);
|
investigetionStoragePO.setInvestigationQuantity(investigationQuantity);
|
||||||
investigetionStoragePO.setInvestigationProfitQuantity(investigationProfitQuantity);
|
//判断盘点数量是否大于0(未盘点时强制返回1)
|
||||||
investigetionStoragePO.setInvestigationLossQuantity(investigationLossQuantity);
|
Integer investigationStatus = hasInvestigated
|
||||||
//判断盘点数量是否大于0
|
? judgeInvestigationQuantityByStorageLocation(investigationQuantity)
|
||||||
Integer investigationStatus = judgeInvestigationQuantityByStorageLocation(investigationQuantity);
|
: 1;
|
||||||
investigetionStoragePO.setInvestigationStatus(investigationStatus);
|
investigetionStoragePO.setInvestigationStatus(investigationStatus);
|
||||||
|
// 只有已盘点(status=2)才计算盈亏,未盘点(status=1)盈亏为0
|
||||||
|
if (investigationStatus == 2) {
|
||||||
|
if (investigationQuantity.compareTo(inventoryQuantity) > 0) {
|
||||||
|
investigetionStoragePO.setInvestigationProfitQuantity(investigationQuantity.subtract(inventoryQuantity));
|
||||||
|
investigetionStoragePO.setInvestigationLossQuantity(BigDecimal.ZERO);
|
||||||
|
} else if (investigationQuantity.compareTo(inventoryQuantity) < 0) {
|
||||||
|
investigetionStoragePO.setInvestigationProfitQuantity(BigDecimal.ZERO);
|
||||||
|
investigetionStoragePO.setInvestigationLossQuantity(inventoryQuantity.subtract(investigationQuantity));
|
||||||
|
} else {
|
||||||
|
investigetionStoragePO.setInvestigationProfitQuantity(BigDecimal.ZERO);
|
||||||
|
investigetionStoragePO.setInvestigationLossQuantity(BigDecimal.ZERO);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
investigetionStoragePO.setInvestigationProfitQuantity(BigDecimal.ZERO);
|
||||||
|
investigetionStoragePO.setInvestigationLossQuantity(BigDecimal.ZERO);
|
||||||
|
}
|
||||||
|
// 给每条明细填充盘盈/盘亏数量
|
||||||
|
// investigationResult=0 表示未盘点,不计算盈亏;否则按数量差值计算
|
||||||
|
investigationManageDetailPOListByMaterial.forEach(detail -> {
|
||||||
|
if (detail.getInvestigationResult() != null && detail.getInvestigationResult() > 0
|
||||||
|
&& detail.getInventoryQuantity() != null && detail.getInvestigationQuantity() != null) {
|
||||||
|
BigDecimal dInv = detail.getInventoryQuantity();
|
||||||
|
BigDecimal dCount = detail.getInvestigationQuantity();
|
||||||
|
if (dCount.compareTo(dInv) > 0) {
|
||||||
|
detail.setInvestigationProfitQuantity(dCount.subtract(dInv));
|
||||||
|
detail.setInvestigationLossQuantity(BigDecimal.ZERO);
|
||||||
|
} else if (dCount.compareTo(dInv) < 0) {
|
||||||
|
detail.setInvestigationProfitQuantity(BigDecimal.ZERO);
|
||||||
|
detail.setInvestigationLossQuantity(dInv.subtract(dCount));
|
||||||
|
} else {
|
||||||
|
detail.setInvestigationProfitQuantity(BigDecimal.ZERO);
|
||||||
|
detail.setInvestigationLossQuantity(BigDecimal.ZERO);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
detail.setInvestigationProfitQuantity(BigDecimal.ZERO);
|
||||||
|
detail.setInvestigationLossQuantity(BigDecimal.ZERO);
|
||||||
|
}
|
||||||
|
});
|
||||||
investigetionStoragePO.setInvestigetionManageDetailList(investigationManageDetailPOListByMaterial);
|
investigetionStoragePO.setInvestigetionManageDetailList(investigationManageDetailPOListByMaterial);
|
||||||
investigetionStorageList.add(investigetionStoragePO);
|
investigetionStorageList.add(investigetionStoragePO);
|
||||||
if (investigationStatus > 1) {
|
if (investigationStatus > 1) {
|
||||||
@@ -203,32 +236,53 @@ public class InvestigationManageDomainService {
|
|||||||
BeanUtils.copyProperties(investigationManageDetailPOListByMaterial.get(0), investigetionMaterialPO);
|
BeanUtils.copyProperties(investigationManageDetailPOListByMaterial.get(0), investigetionMaterialPO);
|
||||||
BigDecimal inventoryQuantity = BigDecimal.ZERO;//库存数量
|
BigDecimal inventoryQuantity = BigDecimal.ZERO;//库存数量
|
||||||
BigDecimal investigationQuantity = BigDecimal.ZERO;//盘点数量
|
BigDecimal investigationQuantity = BigDecimal.ZERO;//盘点数量
|
||||||
BigDecimal investigationProfitQuantity = BigDecimal.ZERO;//盘盈数量
|
boolean hasInvestigated = false;//是否有已盘点的明细
|
||||||
BigDecimal investigationLossQuantity = BigDecimal.ZERO;//盘亏数量
|
|
||||||
for (InvestigetionManageDetailPO investigetionManageDetailPO : investigationManageDetailPOListByMaterial) {
|
for (InvestigetionManageDetailPO investigetionManageDetailPO : investigationManageDetailPOListByMaterial) {
|
||||||
inventoryQuantity = inventoryQuantity.add(investigetionManageDetailPO.getInventoryQuantity());
|
inventoryQuantity = inventoryQuantity.add(investigetionManageDetailPO.getInventoryQuantity());
|
||||||
investigationQuantity = investigationQuantity.add(investigetionManageDetailPO.getInvestigationQuantity());
|
investigationQuantity = investigationQuantity.add(investigetionManageDetailPO.getInvestigationQuantity());
|
||||||
if (1 == investigetionManageDetailPO.getInvestigationResult()) {
|
if (investigetionManageDetailPO.getInvestigationResult() != null && investigetionManageDetailPO.getInvestigationResult() > 0) {
|
||||||
//盘盈
|
hasInvestigated = true;
|
||||||
investigationProfitQuantity = investigationProfitQuantity.add(investigetionManageDetailPO.getDifferentQuantity());
|
|
||||||
} else if (2 == investigetionManageDetailPO.getInvestigationResult()) {
|
|
||||||
//盘亏
|
|
||||||
investigationLossQuantity = investigationLossQuantity.add(investigetionManageDetailPO.getDifferentQuantity());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
investigetionMaterialPO.setInventoryQuantity(inventoryQuantity);
|
investigetionMaterialPO.setInventoryQuantity(inventoryQuantity);
|
||||||
investigetionMaterialPO.setInvestigationQuantity(investigationQuantity);
|
investigetionMaterialPO.setInvestigationQuantity(investigationQuantity);
|
||||||
//判断盘点数量和计划数量的差异 确定盘点状态 1-待盘点 2-盘亏 3-正常 4-盘盈
|
//判断盘点数量和计划数量的差异 确定盘点状态 1-待盘点 2-盘亏 3-正常 4-盘盈
|
||||||
int investigationStatus = judgeInvestigationQuantityByMaterial(investigationQuantity, inventoryQuantity);
|
int investigationStatus = hasInvestigated
|
||||||
|
? judgeInvestigationQuantityByMaterial(investigationQuantity, inventoryQuantity)
|
||||||
|
: 1;
|
||||||
investigetionMaterialPO.setInvestigationStatus(investigationStatus);
|
investigetionMaterialPO.setInvestigationStatus(investigationStatus);
|
||||||
if (investigationStatus == 2) {
|
if (investigationStatus == 2) {
|
||||||
investigetionMaterialPO.setProfitLossQuantity(investigationLossQuantity.subtract(investigationProfitQuantity));
|
// 盘亏:库存数量 - 盘点数量
|
||||||
|
investigetionMaterialPO.setInvestigationProfitQuantity(BigDecimal.ZERO);
|
||||||
|
investigetionMaterialPO.setInvestigationLossQuantity(inventoryQuantity.subtract(investigationQuantity));
|
||||||
} else if (investigationStatus == 4) {
|
} else if (investigationStatus == 4) {
|
||||||
investigetionMaterialPO.setProfitLossQuantity(investigationProfitQuantity.subtract(investigationProfitQuantity));
|
// 盘盈:盘点数量 - 库存数量
|
||||||
|
investigetionMaterialPO.setInvestigationProfitQuantity(investigationQuantity.subtract(inventoryQuantity));
|
||||||
|
investigetionMaterialPO.setInvestigationLossQuantity(BigDecimal.ZERO);
|
||||||
} else {
|
} else {
|
||||||
investigetionMaterialPO.setProfitLossQuantity(BigDecimal.ZERO);
|
investigetionMaterialPO.setInvestigationProfitQuantity(BigDecimal.ZERO);
|
||||||
|
investigetionMaterialPO.setInvestigationLossQuantity(BigDecimal.ZERO);
|
||||||
}
|
}
|
||||||
investigetionMaterialPO.setInvestigetionManageDetailList(investigationManageDetailPOListByMaterial);
|
investigetionMaterialPO.setInvestigetionManageDetailList(investigationManageDetailPOListByMaterial.stream().peek(detail -> {
|
||||||
|
if (detail.getInvestigationResult() != null && detail.getInvestigationResult() > 0
|
||||||
|
&& detail.getInventoryQuantity() != null && detail.getInvestigationQuantity() != null) {
|
||||||
|
BigDecimal dInv = detail.getInventoryQuantity();
|
||||||
|
BigDecimal dCount = detail.getInvestigationQuantity();
|
||||||
|
if (dCount.compareTo(dInv) > 0) {
|
||||||
|
detail.setInvestigationProfitQuantity(dCount.subtract(dInv));
|
||||||
|
detail.setInvestigationLossQuantity(BigDecimal.ZERO);
|
||||||
|
} else if (dCount.compareTo(dInv) < 0) {
|
||||||
|
detail.setInvestigationProfitQuantity(BigDecimal.ZERO);
|
||||||
|
detail.setInvestigationLossQuantity(dInv.subtract(dCount));
|
||||||
|
} else {
|
||||||
|
detail.setInvestigationProfitQuantity(BigDecimal.ZERO);
|
||||||
|
detail.setInvestigationLossQuantity(BigDecimal.ZERO);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
detail.setInvestigationProfitQuantity(BigDecimal.ZERO);
|
||||||
|
detail.setInvestigationLossQuantity(BigDecimal.ZERO);
|
||||||
|
}
|
||||||
|
}).collect(java.util.stream.Collectors.toList()));
|
||||||
investigetionMaterialList.add(investigetionMaterialPO);
|
investigetionMaterialList.add(investigetionMaterialPO);
|
||||||
if (investigationStatus > 1) {
|
if (investigationStatus > 1) {
|
||||||
totalInvestigetionMaterialQuantity += 1;
|
totalInvestigetionMaterialQuantity += 1;
|
||||||
@@ -317,11 +371,10 @@ public class InvestigationManageDomainService {
|
|||||||
* @date 2024/7/20 10:13
|
* @date 2024/7/20 10:13
|
||||||
*/
|
*/
|
||||||
private Integer judgeInvestigationQuantityByStorageLocation(BigDecimal investigationQuantity) {
|
private Integer judgeInvestigationQuantityByStorageLocation(BigDecimal investigationQuantity) {
|
||||||
if (investigationQuantity.compareTo(BigDecimal.ZERO) == 0) {
|
// investigationQuantity 为 null 表示未盘点;0 表示已盘点(全部盘亏)
|
||||||
//未盘点
|
if (investigationQuantity == null) {
|
||||||
return 1;
|
return 1;
|
||||||
} else {
|
} else {
|
||||||
//已盘点
|
|
||||||
return 2;
|
return 2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -336,9 +389,11 @@ public class InvestigationManageDomainService {
|
|||||||
*/
|
*/
|
||||||
private Integer judgeInvestigationQuantityByMaterial(BigDecimal investigationQuantity, BigDecimal quantity) {
|
private Integer judgeInvestigationQuantityByMaterial(BigDecimal investigationQuantity, BigDecimal quantity) {
|
||||||
//1-待盘点 2-盘亏 3-正常 4-盘盈
|
//1-待盘点 2-盘亏 3-正常 4-盘盈
|
||||||
if (investigationQuantity.compareTo(BigDecimal.ZERO) == 0) {
|
// investigationQuantity 为 null 表示未盘点
|
||||||
|
if (investigationQuantity == null) {
|
||||||
return 1;
|
return 1;
|
||||||
} else if (investigationQuantity.compareTo(quantity) < 0) {
|
} else if (investigationQuantity.compareTo(quantity) < 0) {
|
||||||
|
// 盘点数量 < 库存数量(含0),盘亏
|
||||||
return 2;
|
return 2;
|
||||||
} else if (investigationQuantity.compareTo(quantity) == 0) {
|
} else if (investigationQuantity.compareTo(quantity) == 0) {
|
||||||
return 3;
|
return 3;
|
||||||
|
|||||||
+8
@@ -75,6 +75,14 @@ public class InvestigetionManageDetailPO extends BaseVOEntity {
|
|||||||
@Excel(name = "差异数量")
|
@Excel(name = "差异数量")
|
||||||
private BigDecimal differentQuantity;
|
private BigDecimal differentQuantity;
|
||||||
|
|
||||||
|
@ApiModelProperty("盘盈数量")
|
||||||
|
@Excel(name = "盘盈数量")
|
||||||
|
private BigDecimal investigationProfitQuantity;
|
||||||
|
|
||||||
|
@ApiModelProperty("盘亏数量")
|
||||||
|
@Excel(name = "盘亏数量")
|
||||||
|
private BigDecimal investigationLossQuantity;
|
||||||
|
|
||||||
@ApiModelProperty("盘点结果:1.盘盈 2.盘亏 3.正常")
|
@ApiModelProperty("盘点结果:1.盘盈 2.盘亏 3.正常")
|
||||||
@Excel(name = "盘点结果:1.盘盈 2.盘亏 3.正常")
|
@Excel(name = "盘点结果:1.盘盈 2.盘亏 3.正常")
|
||||||
private Integer investigationResult;
|
private Integer investigationResult;
|
||||||
|
|||||||
Reference in New Issue
Block a user