自动化立体仓库 - WMS系统
chen.llin
2 天以前 0406c675e143bbb08284fd55381261afcc587afc
src/main/java/com/zy/asrs/service/impl/MonthlySettleServiceImpl.java
@@ -395,12 +395,35 @@
            throw new CoolException("月结记录不存在");
        }
        // 关联物料表查询明细
        // 关联物料表查询明细(汇总)
        List<MonthlySettleDetail> details = monthlySettleDetailMapper.selectDetailWithMat(settleId);
        // 查询明细流水(订单明细)
        List<com.zy.asrs.entity.result.MonthlySettleDetailFlowVO> pakinFlows = this.baseMapper.selectDetailFlowFromPakin(settleId);
        List<com.zy.asrs.entity.result.MonthlySettleDetailFlowVO> pakoutFlows = this.baseMapper.selectDetailFlowFromPakout(settleId);
        // 合并入库和出库的明细流水
        List<com.zy.asrs.entity.result.MonthlySettleDetailFlowVO> detailFlows = new java.util.ArrayList<>();
        if (pakinFlows != null && !pakinFlows.isEmpty()) {
            detailFlows.addAll(pakinFlows);
        }
        if (pakoutFlows != null && !pakoutFlows.isEmpty()) {
            detailFlows.addAll(pakoutFlows);
        }
        // 按业务时间和订单编号排序
        detailFlows.sort((a, b) -> {
            int timeCompare = (a.getOrderTime() != null ? a.getOrderTime() : "").compareTo(b.getOrderTime() != null ? b.getOrderTime() : "");
            if (timeCompare != 0) {
                return timeCompare;
            }
            return (a.getOrderNo() != null ? a.getOrderNo() : "").compareTo(b.getOrderNo() != null ? b.getOrderNo() : "");
        });
        MonthlySettleStatisticsVO result = new MonthlySettleStatisticsVO();
        result.setSettle(settle);
        result.setDetails(details);
        result.setDetailFlows(detailFlows);
        return result;
    }
@@ -424,25 +447,9 @@
        }
        
        wrapper.orderBy("create_time", false);
        List<MonthlySettle> list = this.selectList(wrapper);
        EntityWrapper<MonthlySettle> countWrapper = new EntityWrapper<>();
        countWrapper.eq("is_deleted", 0);
        if (condition != null) {
            if (condition.get("settleNo") != null) {
                countWrapper.like("settle_no", condition.get("settleNo").toString());
            }
            if (condition.get("status") != null) {
                countWrapper.eq("status", condition.get("status"));
            }
            if (condition.get("startDate") != null && condition.get("endDate") != null) {
                countWrapper.ge("start_date", condition.get("startDate"));
                countWrapper.le("end_date", condition.get("endDate"));
            }
        }
        page.setRecords(list);
        page.setTotal(this.selectCount(countWrapper));
        return page;
        // 使用分页查询,在数据库层面进行分页,而不是查询所有记录
        Page<MonthlySettle> resultPage = this.selectPage(page, wrapper);
        return resultPage;
    }
    /**