取消分配状态吧第一条全部取消第二条还有值状态应该为部分分配

This commit is contained in:
zhou-hongcheng
2026-03-18 22:12:08 +08:00
parent 4afbd44f67
commit 830f0c38ee
3 changed files with 17 additions and 3 deletions
@@ -835,6 +835,10 @@ public class StockOutOrderApplicationService {
* @return Boolean
*/
public Boolean cancelAssign(StockOutOrderDO stockOutOrderDO){
StockOutOrderPO infoChildren = getInfoChildren(stockOutOrderDO.getOutOrderId());
BigDecimal alreadyAllocationQuantityAll = infoChildren.getMaterialDetailList().stream().map(OutMaterialDetailPO::getAlreadyAllocationQuantity)
.filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add);
stockOutOrderDO.setAlreadyAllocationQuantityAll(alreadyAllocationQuantityAll);
return stockOutOrderDomainService.cancelAssign(stockOutOrderDO);
}
@@ -406,4 +406,7 @@ public class StockOutOrderDO extends BaseVOEntity {
@ApiModelProperty(name = "审核时间查询条件结束日期")
private String auditTimeEnd;
@ApiModelProperty(name = "已分配数量总数量")
private BigDecimal alreadyAllocationQuantityAll;
}
@@ -408,6 +408,8 @@ public class StockOutOrderDomainService {
//修改物料明细信息
StockOutOrderPO stockOutOrderPO = outMaterialDetailService.batchCancelAssignUpdate(stockOutOrderDb.getOutOrderNumber(), stockOutOrderDO.getMaterialDetailList());
//修改出库单
stockOutOrderPO.setAlreadyAllocationQuantity(stockOutOrderDO.getAlreadyAllocationQuantityAll());//全部的已分配数量
return updateStockOutOrderByAllocation(stockOutOrderDb, stockOutOrderPO, 2);
}
@@ -445,13 +447,18 @@ public class StockOutOrderDomainService {
// 如果出库单的已分配数量小于要取消的数量,说明数据不一致,使用要取消的数量作为基准
alreadyAllocationQuantity = cancelAlreadyAllocationQuantity;
}
alreadyAllocationQuantity = alreadyAllocationQuantity.subtract(cancelAlreadyAllocationQuantity);
alreadyAllocationQuantity = alreadyAllocationQuantity.subtract(cancelQuantity);
// 确保不会变成负数
if (alreadyAllocationQuantity.compareTo(BigDecimal.ZERO) < 0) {
alreadyAllocationQuantity = BigDecimal.ZERO;
}
status = judgeAllocationQuantityByManualAssign(stockOutOrderPO.getAllocationQuantity(), stockOutOrderPO.getAlreadyAllocationQuantity(),type);
BigDecimal subtract = stockOutOrderPO.getAlreadyAllocationQuantity().subtract(alreadyAllocationQuantity);
if (subtract.compareTo(BigDecimal.ZERO) == 0) {
status = 2;
} else {
status = 3;
}
// status = judgeAllocationQuantityByManualAssign(stockOutOrderPO.getAllocationQuantity(), stockOutOrderPO.getAlreadyAllocationQuantity(),type);
}else {
allocationQuantity = stockOutOrderPO.getAllocationQuantity();//直接使用返回的分配数量