- 在IWmsMaterialCoilService中新增queryCoilChain方法实现双向追溯
- 在WmsMaterialCoilController中添加/chain/all/{coilId}接口
- 在WmsMaterialCoilMapper中新增selectByParentCoilIds批量查询方法
- 在Mapper XML中实现FIND_IN_SET匹配逗号分隔的parent_coil_id查询
- 实现完整的双向追溯逻辑:向上追溯祖先向下查找后代支持合卷场景
- 创建CoilChainVo数据传输对象包含追溯结果和节点关系信息
- 实现BFS算法构建完整的加工链父子关系映射和深度计算
177 lines
6.7 KiB
Java
177 lines
6.7 KiB
Java
package com.klp.mapper;
|
||
|
||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||
import com.klp.domain.WmsMaterialCoil;
|
||
import com.klp.domain.vo.*;
|
||
import com.klp.common.core.mapper.BaseMapperPlus;
|
||
import org.apache.ibatis.annotations.Param;
|
||
import com.klp.domain.vo.dashboard.CoilTrimRawVo;
|
||
import com.klp.domain.vo.dashboard.CategoryWidthRawVo;
|
||
import java.util.List;
|
||
import java.util.Map;
|
||
|
||
public interface WmsMaterialCoilMapper extends BaseMapperPlus<WmsMaterialCoilMapper, WmsMaterialCoil, WmsMaterialCoilVo> {
|
||
|
||
/**
|
||
* 查询各个库区中不同类型的钢卷分布情况
|
||
* 按库区分组,统计每种物品类型和物品ID的钢卷数量和重量
|
||
*
|
||
* @param itemType 物品类型(可选)
|
||
* @param itemId 物品ID(可选)
|
||
* @return 分布情况列表
|
||
*/
|
||
List<Map<String, Object>> getDistributionByWarehouse(@Param("itemType") String itemType, @Param("itemId") Long itemId);
|
||
|
||
/**
|
||
* 查询不同类型的钢卷在不同库区的分布情况
|
||
* 按物品类型和物品ID分组,统计每个库区的钢卷数量和重量
|
||
*
|
||
* @param itemType 物品类型(可选)
|
||
* @param itemId 物品ID(可选)
|
||
* @return 分布情况列表
|
||
*/
|
||
List<Map<String, Object>> getDistributionByItemType(@Param("itemType") String itemType, @Param("itemId") Long itemId);
|
||
|
||
Page<WmsMaterialCoilVo> selectVoPagePlus(Page<Object> build,@Param("ew") QueryWrapper<WmsMaterialCoil> lqw);
|
||
|
||
/**
|
||
* orderBy=true 时使用:包含库位排序辅助字段(aw_sort_key/aw_layer_key/aw_id_key)以及父库位 join
|
||
*/
|
||
Page<WmsMaterialCoilVo> selectVoPagePlusOrderBy(Page<Object> build, @Param("ew") QueryWrapper<WmsMaterialCoil> lqw);
|
||
|
||
/**
|
||
* orderByPlanDesc=true 时使用:包含发货计划 join,支持按计划创建时间排序
|
||
*/
|
||
Page<WmsMaterialCoilVo> selectVoPagePlusPlanOrder(Page<Object> build, @Param("ew") QueryWrapper<WmsMaterialCoil> lqw);
|
||
|
||
List<WmsMaterialCoilVo> selectVoListWithDynamicJoin(@Param("ew")QueryWrapper<WmsMaterialCoil> lqw);
|
||
|
||
Map<String, Object> selectCountForSpecSync(@Param("ew") QueryWrapper<WmsMaterialCoil> qw);
|
||
|
||
List<Map<String, Object>> getDistributionByActualWarehouse(@Param("itemType") String itemType, @Param("itemId") Long itemId);
|
||
|
||
List<Map<String, Object>> getDistributionByActualItemType(@Param("itemType")String itemType,@Param("itemId") Long itemId);
|
||
|
||
/**
|
||
* 查询钢卷导出数据(包含所有关联字段)
|
||
*
|
||
* @param lqw 查询条件
|
||
* @return 导出数据列表
|
||
*/
|
||
List<com.klp.domain.vo.WmsMaterialCoilExportVo> selectExportList(@Param("ew")QueryWrapper<WmsMaterialCoil> lqw);
|
||
|
||
/**
|
||
* 查询重复入场卷号的钢卷信息
|
||
*
|
||
* @return 重复入场卷号的钢卷列表
|
||
*/
|
||
List<WmsMaterialCoilVo> selectDuplicateEnterCoilNoList();
|
||
|
||
/**
|
||
* 查询重复当前卷号的钢卷信息
|
||
*
|
||
* @return 重复当前卷号的钢卷列表
|
||
*/
|
||
List<WmsMaterialCoilVo> selectDuplicateCurrentCoilNoList();
|
||
|
||
/**
|
||
* 更新钢卷发货撤回:将发货时间置空,状态改为指定值
|
||
*
|
||
* @param coilId 钢卷ID
|
||
* @param status 目标状态
|
||
* @return 影响行数
|
||
*/
|
||
int updateForWithdrawExport(@Param("coilId") Long coilId, @Param("status") Integer status);
|
||
|
||
|
||
/**
|
||
* 发货报表导出:按钢卷ID列表联查(钢卷 + 发货单明细 + 发货单主表 + 发货计划)
|
||
*
|
||
* @param coilIds 钢卷ID集合
|
||
* @return 发货报表导出数据
|
||
*/
|
||
List<WmsMaterialCoilDeliveryExportVo> selectDeliveryExportListByCoilIds(@Param("coilIds") java.util.Collection<Long> coilIds);
|
||
|
||
/**
|
||
* 退火报表导出:按钢卷ID列表联查(钢卷 + 退火计划 + 退火计划钢卷关系)
|
||
*
|
||
* @param coilIds 钢卷ID集合
|
||
* @return 退火报表导出数据
|
||
*/
|
||
List<WmsMaterialCoilAnnealExportVo> selectAnnealExportListByCoilIds(@Param("coilIds") java.util.Collection<Long> coilIds);
|
||
|
||
/**
|
||
* 分页查询钢卷报表数据(轻量级,仅返回必要字段)
|
||
*
|
||
* @param lqw 查询条件
|
||
* @return 分页报表数据
|
||
*/
|
||
List<WmsMaterialCoilReportVo> selectReportList(@Param("ew") QueryWrapper<WmsMaterialCoil> lqw);
|
||
|
||
/**
|
||
* 分页查询钢卷环比报表数据(轻量级,包含实际长度、理论长度、理论厚度)
|
||
*
|
||
* @param lqw 查询条件
|
||
* @return 环比报表数据
|
||
*/
|
||
List<WmsMaterialCoilPeriodComparisonVo> selectPeriodComparisonList(@Param("ew") QueryWrapper<WmsMaterialCoil> lqw);
|
||
|
||
List<CoilTrimRawVo> selectCoilTrimStatistics();
|
||
|
||
List<CategoryWidthRawVo> selectCategoryWidthStatistics();
|
||
|
||
/**
|
||
* 查询itemId和itemType不匹配的钢卷
|
||
* @return 不匹配的钢卷列表
|
||
*/
|
||
List<WmsMaterialCoil> selectMismatchedItemCoils();
|
||
|
||
/**
|
||
* 统计筛选条件下的全量汇总数据(高性能:只查sum/count)
|
||
* @param qw 查询条件(只使用WHERE和JOIN部分)
|
||
* @return 统计结果(Map包含totalGrossWeight, totalNetWeight)
|
||
*/
|
||
Map<String, Object> selectStatistics(@Param("ew") QueryWrapper<WmsMaterialCoil> qw);
|
||
|
||
/**
|
||
* 统计已发货钢卷的平均囤积周期和平均囤积成本
|
||
* 使用JSON_EXTRACT解析二维码steps[0].create_time,一次SQL完成聚合
|
||
* @param qw 查询条件(与buildQueryWrapperPlus一致)
|
||
* @return Map包含total_count, avg_hoarding_days, avg_hoarding_cost
|
||
*/
|
||
Map<String, Object> selectHoardingStatistics(@Param("ew") QueryWrapper<WmsMaterialCoil> qw);
|
||
|
||
/**
|
||
* 统计仓库使用次数(按warehouse_id出现次数排序)
|
||
*
|
||
* @param warehouseIds 仓库ID列表
|
||
* @return 每个仓库的钢卷数量
|
||
*/
|
||
List<Map<String, Object>> selectWarehouseIdCount(@Param("list") List<Long> warehouseIds);
|
||
|
||
/**
|
||
* 分页查询材质异常的钢卷
|
||
*/
|
||
IPage<WmsMaterialCoil> selectMaterialMismatchCoilsPage(IPage<WmsMaterialCoil> page);
|
||
|
||
/**
|
||
* 根据入场钢卷号查询最早的热轧卷板材质
|
||
* @param enterCoilNo 入场钢卷号
|
||
* @return 材质信息
|
||
*/
|
||
String selectEarliestHotRolledMaterial(@Param("enterCoilNo") String enterCoilNo);
|
||
|
||
/**
|
||
* 根据父级钢卷ID列表批量查询子钢卷
|
||
* 使用FIND_IN_SET匹配逗号分隔的parent_coil_id字段
|
||
*
|
||
* @param coilIds 父级钢卷ID列表
|
||
* @return 子钢卷列表
|
||
*/
|
||
List<WmsMaterialCoil> selectByParentCoilIds(@Param("coilIds") java.util.Collection<Long> coilIds);
|
||
}
|
||
|