| | |
| | | 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; |
| | |
| | | return selectOne(MesProBagCodeDO::getCode, code); |
| | | } |
| | | |
| | | default MesProBagCodeDO selectByCodeForUpdate(String code) { |
| | | return selectOne(new LambdaQueryWrapperX<MesProBagCodeDO>() |
| | | .eq(MesProBagCodeDO::getCode, code).last("FOR UPDATE")); |
| | | } |
| | | |
| | | @org.apache.ibatis.annotations.Update("UPDATE mes_pro_bag_code SET inbound_time = NOW(), inbound_event_id = #{eventId}, inbound_device_code = #{deviceCode}, inbound_line_code = #{lineCode}, update_time = NOW() WHERE id = #{id} AND deleted = 0 AND inbound_event_id IS NULL") |
| | | int markInbound(@org.apache.ibatis.annotations.Param("id") Long id, @org.apache.ibatis.annotations.Param("eventId") Long eventId, |
| | | @org.apache.ibatis.annotations.Param("deviceCode") String deviceCode, @org.apache.ibatis.annotations.Param("lineCode") String lineCode); |
| | | |
| | | default List<MesProBagCodeDO> selectListByUuid(String uuid) { |
| | | return selectList(MesProBagCodeDO::getUuid, uuid); |
| | | } |
| | |
| | | |
| | | 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) { |
| | |
| | | @Select("SELECT IFNULL(MAX(bag_no), 0) FROM mes_pro_bag_code WHERE batch_id = #{batchId}") |
| | | Integer selectMaxBagNo(@Param("batchId") Long batchId); |
| | | |
| | | default List<MesProBagCodeDO> selectListByIdsForUpdate(Collection<Long> ids) { |
| | | return selectList(new LambdaQueryWrapperX<MesProBagCodeDO>() |
| | | .in(MesProBagCodeDO::getId, ids) |
| | | .orderByAsc(MesProBagCodeDO::getId) |
| | | .last("FOR UPDATE")); |
| | | } |
| | | |
| | | @Update("<script>UPDATE mes_pro_bag_code SET status = #{toStatus}, cancel_time = #{cancelTime}, " + |
| | | "cancel_reason = #{cancelReason}, pallet_id = NULL, pallet_code = NULL, update_time = NOW() " + |
| | | "WHERE deleted = 0 AND id = #{id} AND status = #{fromStatus}</script>") |
| | | int cancelById(@Param("id") Long id, @Param("fromStatus") Integer fromStatus, |
| | | @Param("toStatus") Integer toStatus, @Param("cancelTime") LocalDateTime cancelTime, |
| | | @Param("cancelReason") String cancelReason); |
| | | |
| | | @Select("SELECT COUNT(*) FROM mes_pro_bag_code WHERE batch_id = #{batchId} " + |
| | | "AND deleted = 0 AND status <> 30") |
| | | int selectEffectiveCountByBatchId(@Param("batchId") Long batchId); |
| | | |
| | | /** |
| | | * 批量标记为已导出印刷(仅更新处于目标原状态的记录) |
| | | * |