云
2 天以前 87733eb3623593da247c051593d64b8ff9e1d3a4
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/wm/productsales/MesWmProductSalesLineController.java
@@ -40,6 +40,7 @@
@RequestMapping("/mes/wm/product-sales-line")
@Validated
public class MesWmProductSalesLineController {
    @Resource private cn.iocoder.yudao.module.mes.dal.mysql.wm.transaction.MesWmTransactionMapper transactionMapper;
    @Resource
    private MesWmProductSalesLineService productSalesLineService;
@@ -108,6 +109,9 @@
                .stream().collect(Collectors.toMap(MdmUnitMeasureRespDTO::getId, e -> e));
        // 2. 构建结果
        return BeanUtils.toBean(list, MesWmProductSalesLineRespVO.class, vo -> {
            var shipped = transactionMapper.sumSalesOutboundByLineId(vo.getId());
            vo.setShippedQuantity(shipped == null ? java.math.BigDecimal.ZERO : shipped);
            vo.setRemainingQuantity((vo.getQuantity() == null ? java.math.BigDecimal.ZERO : vo.getQuantity()).subtract(vo.getShippedQuantity()).max(java.math.BigDecimal.ZERO));
            MapUtils.findAndThen(itemMap, vo.getItemId(), item -> {
                vo.setItemCode(item.getCode()).setItemName(item.getName()).setSpecification(item.getSpecification());
                MapUtils.findAndThen(unitMeasureMap, item.getUnitMeasureId(),