| | |
| | | import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.pro.bagcode.vo.MesProBagCodePageReqVO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.pro.bagcode.MesProBagCodeDO; |
| | | import cn.iocoder.yudao.module.mes.enums.pro.MesProBagCodeStatusEnum; |
| | | import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | |
| | | |
| | | default List<MesProBagCodeDO> selectListByBatchId(Long batchId) { |
| | | return selectList(MesProBagCodeDO::getBatchId, batchId); |
| | | } |
| | | |
| | | default List<MesProBagCodeDO> selectUnboundEffectiveListByBatchId(Long batchId) { |
| | | return selectList(new LambdaQueryWrapperX<MesProBagCodeDO>() |
| | | .eq(MesProBagCodeDO::getBatchId, batchId) |
| | | .isNull(MesProBagCodeDO::getPalletId) |
| | | .ne(MesProBagCodeDO::getStatus, MesProBagCodeStatusEnum.CANCELED.getStatus()) |
| | | .orderByAsc(MesProBagCodeDO::getBagNo) |
| | | .last("FOR UPDATE")); |
| | | } |
| | | |
| | | default Long selectCountByBatchId(Long batchId) { |
| | |
| | | * @param batchId 批次编号 |
| | | * @return 最大袋序号,无记录返回 0 |
| | | */ |
| | | @Select("SELECT IFNULL(MAX(bag_no), 0) FROM mes_pro_bag_code WHERE batch_id = #{batchId}") |
| | | Integer selectMaxBagNo(@Param("batchId") Long batchId); |
| | | @Select("SELECT IFNULL(MAX(bag_no), 0) FROM mes_pro_bag_code") |
| | | Integer selectMaxBagNo(); |
| | | |
| | | @Update("<script>UPDATE mes_pro_bag_code SET batch_id = #{batchId}, batch_code = #{batchCode}, update_time = NOW() " + |
| | | "WHERE deleted = 0 AND batch_id IS NULL AND status = #{status} AND id IN " + |
| | | "<foreach collection='ids' item='id' open='(' separator=',' close=')'>#{id}</foreach></script>") |
| | | int bindBatchByIds(@Param("ids") Collection<Long> ids, @Param("batchId") Long batchId, |
| | | @Param("batchCode") String batchCode, @Param("status") Integer status); |
| | | |
| | | default List<MesProBagCodeDO> selectListByIdsForUpdate(Collection<Long> ids) { |
| | | return selectList(new LambdaQueryWrapperX<MesProBagCodeDO>() |