复核异常生成异常单

This commit is contained in:
秦鸿展
2026-04-11 15:35:07 +08:00
parent b2720fa655
commit 9bf7a9c0c8
2 changed files with 18 additions and 6 deletions
@@ -320,13 +320,9 @@ public class ReviewOrderApplicationService {
if (reviewOrderId == null) {
continue;
}
// 若完成复核请求携带明细,先按本次提交快照落库(数量与计量),再校验与同步出库/交接
// 若完成复核请求携带明细,先按本次提交快照落库(数量与计量),再同步出库/交接
applyReviewSnapshotForConfirm(reviewOrderId, cmd.getDetails(), loginUser);
List<ReviewMaterialDetailPO> rows = reviewOrderMapper.queryDetailByReviewOrderId(reviewOrderId);
boolean hasPending = rows.stream().anyMatch(r -> nz(r.getPendingReviewQty()).compareTo(BigDecimal.ZERO) > 0);
if (hasPending) {
throw new ServiceException("存在待复核数量,无法确认");
}
// 允许仍有待复核数量时确认(按当前已复核数量同步出库,不再强制全部复核完)
// 复核确认时将复核结果同步到出库明细/出库单,供出库交接读取数量
syncOutOrderCheckQtyByReviewConfirm(reviewOrderId, loginUser);
// 与出库单「复核确认」一致:复核数量与拣货数量不一致时生成复核异常单(FHYC)
@@ -256,7 +256,9 @@ public class OutOrderAbnormalImpl extends ServiceImpl<OutOrderAbnormalMapper, Ou
OutOrderAbnormal outOrderAbnormal = new OutOrderAbnormal();
BeanUtils.copyProperties(OutOrderAbnormalBaseDO, outOrderAbnormal);
BeanUtils.copyProperties(pickingMaterialDetail, outOrderAbnormal, IgnoreNullUtil.getNullPropertyNames(pickingMaterialDetail));
overlayAbnormalHeaderOrg(OutOrderAbnormalBaseDO, outOrderAbnormal);
outOrderAbnormal.setAbnormalNumber(OrderSequence.getOrderCode("JHYC"));
outOrderAbnormal.setType(1);
outOrderAbnormal.setAbnormalType(1);
outOrderAbnormal.setQuantity(alloc);
outOrderAbnormal.setActualQuantity(pick);
@@ -296,7 +298,9 @@ public class OutOrderAbnormalImpl extends ServiceImpl<OutOrderAbnormalMapper, Ou
OutOrderAbnormal outOrderAbnormal = new OutOrderAbnormal();
BeanUtils.copyProperties(OutOrderAbnormalBaseDO, outOrderAbnormal);
BeanUtils.copyProperties(outMaterialDetail, outOrderAbnormal, IgnoreNullUtil.getNullPropertyNames(outMaterialDetail));
overlayAbnormalHeaderOrg(OutOrderAbnormalBaseDO, outOrderAbnormal);
outOrderAbnormal.setAbnormalNumber(OrderSequence.getOrderCode("FHYC"));
outOrderAbnormal.setType(2);
outOrderAbnormal.setAbnormalType(2);//复核异常
outOrderAbnormal.setQuantity(pick);
outOrderAbnormal.setActualQuantity(check);
@@ -315,4 +319,16 @@ public class OutOrderAbnormalImpl extends ServiceImpl<OutOrderAbnormalMapper, Ou
return outOrderAbnormalList;
}
/**
* 明细行上的组织可能与出库单头不一致,复制明细后会覆盖异常单头组织;列表按一级组织过滤需与出库单头一致。
*/
private static void overlayAbnormalHeaderOrg(OutOrderAbnormalBaseDO base, OutOrderAbnormal target) {
if (base == null || target == null) {
return;
}
target.setOrganizationId(base.getOrganizationId());
target.setOrganizationName(base.getOrganizationName());
target.setTopOrganizationId(base.getTopOrganizationId());
}
}