| | |
| | | import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; |
| | | import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.wm.batch.vo.MesWmBatchPageReqVO; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.wm.batch.vo.MesWmBatchProcessTraceRespVO; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.wm.batch.vo.MesWmBatchPurchaseSourceRespVO; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.wm.batch.vo.MesWmBatchSalesTargetRespVO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.wm.batch.MesWmBatchDO; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | |
| | | /** |
| | | * 批次管理 Mapper |
| | | * |
| | | * @author 芋道源码 |
| | | * @author 超级管理员 |
| | | */ |
| | | @Mapper |
| | | public interface MesWmBatchMapper extends BaseMapperX<MesWmBatchDO> { |
| | |
| | | .betweenIfPresent(MesWmBatchDO::getExpireDate, reqVO.getExpireDate()) |
| | | .betweenIfPresent(MesWmBatchDO::getReceiptDate, reqVO.getReceiptDate()) |
| | | .orderByDesc(MesWmBatchDO::getId); |
| | | if (permittedClientIds != null) { |
| | | if (CollUtil.isEmpty(permittedClientIds)) { |
| | | return PageResult.empty(); |
| | | } |
| | | wrapper.in(MesWmBatchDO::getClientId, permittedClientIds); |
| | | } |
| | | // if (permittedClientIds != null) { |
| | | // if (CollUtil.isEmpty(permittedClientIds)) { |
| | | // return PageResult.empty(); |
| | | // } |
| | | // wrapper.in(MesWmBatchDO::getClientId, permittedClientIds); |
| | | // } |
| | | return selectPage(reqVO, wrapper); |
| | | } |
| | | |
| | |
| | | default MesWmBatchDO selectFirst(MesWmBatchDO batch) { |
| | | LambdaQueryWrapper<MesWmBatchDO> query = new LambdaQueryWrapper<>(); |
| | | query.eq(MesWmBatchDO::getItemId, batch.getItemId()); |
| | | if (ObjUtil.isNull(batch.getReelNo())) { |
| | | query.isNull(MesWmBatchDO::getReelNo); |
| | | } else { |
| | | query.eq(MesWmBatchDO::getReelNo, batch.getReelNo()); |
| | | } |
| | | if (ObjUtil.isNull(batch.getVendorId())) { |
| | | query.isNull(MesWmBatchDO::getVendorId); |
| | | } else { |
| | |
| | | |
| | | // 返回 ID 最小的批次 |
| | | query.orderByAsc(MesWmBatchDO::getId); |
| | | if (batch.getReelNo() != null) { |
| | | // 数据库排序规则可能忽略大小写或末尾空格;盘号必须按输入值精确匹配。 |
| | | return selectList(query).stream() |
| | | .filter(candidate -> batch.getReelNo().equals(candidate.getReelNo())) |
| | | .findFirst().orElse(null); |
| | | } |
| | | query.last("LIMIT 1"); |
| | | return selectOne(query); |
| | | } |
| | |
| | | */ |
| | | List<MesWmBatchDO> selectListByBackward(String batchCode); |
| | | |
| | | /** |
| | | * 查询批次采购来源(采购入库单 + IQC) |
| | | * |
| | | * @param batchCode 批次号 |
| | | * @return 采购来源列表 |
| | | */ |
| | | List<MesWmBatchPurchaseSourceRespVO> selectPurchaseSourceList(String batchCode); |
| | | |
| | | /** |
| | | * 查询批次销售去向(销售出库单 + OQC) |
| | | * |
| | | * @param batchCode 批次号 |
| | | * @return 销售去向列表 |
| | | */ |
| | | List<MesWmBatchSalesTargetRespVO> selectSalesTargetList(String batchCode); |
| | | |
| | | /** |
| | | * 查询批次工序流转(产出/投入事件) |
| | | * |
| | | * @param batchCode 批次号 |
| | | * @return 工序流转列表 |
| | | */ |
| | | List<MesWmBatchProcessTraceRespVO> selectProcessTraceList(String batchCode); |
| | | |
| | | } |