PDA复核页面查询修改

This commit is contained in:
秦鸿展
2026-03-14 21:06:06 +08:00
parent 86700813ae
commit 8b09d1b2e0
2 changed files with 27 additions and 8 deletions
@@ -742,7 +742,11 @@ public class ShiftManageApplicationService {
continue;
}
shiftMoveMaterialQuantityList.forEach(shiftMoveMaterialQuantityPO -> {
AjaxResult storageLocationResult = systemServiceFeign.getStorageLocationInfoByStorageLocationId(shiftMoveMaterialQuantityPO.getNewStorageLocationId());
Long newStorageLocationId = shiftMoveMaterialQuantityPO.getNewStorageLocationId();
if (newStorageLocationId == null || newStorageLocationId <= 0) {
throw new ServiceException("目标库位不能为空,请选择目标库位");
}
AjaxResult storageLocationResult = systemServiceFeign.getStorageLocationInfoByStorageLocationId(newStorageLocationId);
if(!"200".equals(String.valueOf(storageLocationResult.get("code")))){
throw new ServiceException("获取上架库位信息失败");
}
@@ -150,20 +150,35 @@ public class StockOutOrderApplicationService {
List<StockOutOrderPO> stockOutOrderPOS = stockOutOrderDomainService.queryList(stockOutOrderDO);
for (StockOutOrderPO stockOutOrderPO : stockOutOrderPOS) {
StockOutOrderPO stockOutOrderPO1 = stockOutOrderDomainService.getInfoChildren(stockOutOrderPO.getOutOrderId());
List<OutMaterialDetailPO> materialDetailList = stockOutOrderPO1.getMaterialDetailList();
BigDecimal reduce = materialDetailList.stream().map(OutMaterialDetailPO::getOutboundQuantity).reduce(BigDecimal.ZERO, BigDecimal::add);
List<OutMaterialDetailPO> materialDetailList = stockOutOrderPO1 != null ? stockOutOrderPO1.getMaterialDetailList() : null;
if (materialDetailList == null) {
materialDetailList = Collections.emptyList();
}
BigDecimal reduce = materialDetailList.stream().map(OutMaterialDetailPO::getOutboundQuantity).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add);
stockOutOrderPO.setTotalOutboundQuantity(reduce);
stockOutOrderPO.setAllocationQuantity(stockOutOrderPO1.getAllocationQuantity());
// PDA复核物料总数量:使用实际下发时的拣货完成数量(picking_material_detail),而非计划数量
stockOutOrderPO.setAllocationQuantity(stockOutOrderPO1 != null ? stockOutOrderPO1.getAllocationQuantity() : null);
String outOrderNumber = stockOutOrderPO.getOutOrderNumber();
// PDA复核物料总数量:使用实际下发时的拣货完成数量(picking_material_detail),拣货多少显示多少
// PDA端物料总数量取quantity字段、复核总数量取checkQuantity字段,需同时设置quantity和pickingQuantity
BigDecimal actualPickingQty = pickingMaterialDetailService.sumPickingQuantityByOutOrderNumber(outOrderNumber);
stockOutOrderPO.setPickingQuantity(actualPickingQty.compareTo(BigDecimal.ZERO) > 0 ? actualPickingQty : stockOutOrderPO1.getPickingQuantity());
// 物料种类:按有拣货数量的明细统计
BigDecimal displayPickingQty = actualPickingQty.compareTo(BigDecimal.ZERO) > 0 ? actualPickingQty : (stockOutOrderPO1 != null ? stockOutOrderPO1.getPickingQuantity() : BigDecimal.ZERO);
stockOutOrderPO.setPickingQuantity(displayPickingQty);
stockOutOrderPO.setQuantity(displayPickingQty);
// 物料种类:优先从picking_material_detail统计,为0时从out_material_detail按料号去重
Integer materialTypeCount = pickingMaterialDetailService.countMaterialTypesByOutOrderNumber(outOrderNumber);
if (materialTypeCount != null && materialTypeCount > 0) {
stockOutOrderPO.setMaterialQuantity(materialTypeCount);
} else {
long count = materialDetailList.stream()
.map(d -> d.getMaterialBaseInfoId() != null ? String.valueOf(d.getMaterialBaseInfoId()) : d.getMaterialCode())
.filter(Objects::nonNull)
.distinct()
.count();
stockOutOrderPO.setMaterialQuantity((int) count);
}
stockOutOrderPO.setCheckQuantity(stockOutOrderPO1.getCheckQuantity());
// 复核总数量:从out_material_detail汇总check_quantity
BigDecimal checkSum = materialDetailList.stream().map(OutMaterialDetailPO::getCheckQuantity).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add);
stockOutOrderPO.setCheckQuantity(checkSum);
}
return stockOutOrderPOS;
}