| | |
| | | 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); |
| | | |
| | | /** 批次整批入库时批量标记其下未入库袋码(幂等),保持袋码与库存状态一致 */ |
| | | @Update("UPDATE mes_pro_bag_code SET inbound_time = NOW(), inbound_event_id = #{eventId}, inbound_line_code = #{lineCode}, update_time = NOW() " |
| | | + "WHERE deleted = 0 AND inbound_event_id IS NULL AND batch_id = #{batchId}") |
| | | int markInboundByBatchId(@Param("batchId") Long batchId, @Param("eventId") Long eventId, |
| | | @Param("lineCode") String lineCode); |
| | | |
| | | /** 整托入库时批量标记托盘下未入库袋码(幂等) */ |
| | | @Update("UPDATE mes_pro_bag_code SET inbound_time = NOW(), inbound_event_id = #{eventId}, inbound_line_code = #{lineCode}, update_time = NOW() " |
| | | + "WHERE deleted = 0 AND inbound_event_id IS NULL AND pallet_id = #{palletId}") |
| | | int markInboundByPalletId(@Param("palletId") Long palletId, @Param("eventId") Long eventId, |
| | | @Param("lineCode") String lineCode); |
| | | |
| | | /** |
| | | * 更新袋码质检状态(种子质检合格/不合格时记录该袋结果) |
| | | * |
| | | * @param id 袋码编号 |
| | | * @param qcStatus 质检状态(见 MesProBagCodeQcStatusEnum) |
| | | */ |
| | | default void updateQcStatus(Long id, Integer qcStatus) { |
| | | update(null, new LambdaUpdateWrapper<MesProBagCodeDO>() |
| | | .eq(MesProBagCodeDO::getId, id) |
| | | .set(MesProBagCodeDO::getQcStatus, qcStatus)); |
| | | } |
| | | |
| | | default List<MesProBagCodeDO> selectListByUuid(String uuid) { |
| | | return selectList(MesProBagCodeDO::getUuid, uuid); |
| | | } |
| | |
| | | .likeIfPresent(MesProBagCodeDO::getBatchCode, reqVO.getBatchCode()) |
| | | .eqIfPresent(MesProBagCodeDO::getUuid, reqVO.getUuid()) |
| | | .eqIfPresent(MesProBagCodeDO::getPalletId, reqVO.getPalletId()) |
| | | .eqIfPresent(MesProBagCodeDO::getItemId, reqVO.getItemId()) |
| | | .eqIfPresent(MesProBagCodeDO::getStatus, reqVO.getStatus()) |
| | | .betweenIfPresent(MesProBagCodeDO::getCreateTime, reqVO.getCreateTime()) |
| | | .orderByAsc(MesProBagCodeDO::getBagNo)); |
| | | .orderByDesc(MesProBagCodeDO::getCreateTime) |
| | | .orderByDesc(MesProBagCodeDO::getId)); |
| | | } |
| | | |
| | | /** |
| | |
| | | .set(MesProBagCodeDO::getPalletId, palletId) |
| | | .set(MesProBagCodeDO::getPalletCode, palletCode) |
| | | .in(MesProBagCodeDO::getId, ids)); |
| | | } |
| | | |
| | | /** |
| | | * 托盘正式码生成后,回写其下所有袋码的冗余托盘码 |
| | | * |
| | | * @param palletId 托盘编号 |
| | | * @param palletCode 正式托盘码 |
| | | */ |
| | | default void updatePalletCodeByPalletId(Long palletId, String palletCode) { |
| | | update(null, new LambdaUpdateWrapper<MesProBagCodeDO>() |
| | | .set(MesProBagCodeDO::getPalletCode, palletCode) |
| | | .eq(MesProBagCodeDO::getPalletId, palletId)); |
| | | } |
| | | |
| | | /** |
| | |
| | | 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 " + |
| | | "WHERE deleted = 0 AND batch_id IS NULL AND status IN " + |
| | | "<foreach collection='statuses' item='st' open='(' separator=',' close=')'>#{st}</foreach> 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); |
| | | @Param("batchCode") String batchCode, @Param("statuses") Collection<Integer> statuses); |
| | | |
| | | /** 查询托盘下尚未绑定批次的袋码(托盘绑定批次时级联录入用) */ |
| | | default List<MesProBagCodeDO> selectUnboundListByPalletIds(Collection<Long> palletIds) { |
| | | return selectList(new LambdaQueryWrapperX<MesProBagCodeDO>() |
| | | .in(MesProBagCodeDO::getPalletId, palletIds) |
| | | .isNull(MesProBagCodeDO::getBatchId) |
| | | .orderByAsc(MesProBagCodeDO::getId)); |
| | | } |
| | | |
| | | /** 批次内有效袋码的品种编号集合(忽略历史空品种袋码),用于录入批次时的品种一致性校验 */ |
| | | @Select("SELECT DISTINCT item_id FROM mes_pro_bag_code " + |
| | | "WHERE deleted = 0 AND status <> 30 AND batch_id = #{batchId} AND item_id IS NOT NULL") |
| | | List<Long> selectDistinctItemIdsByBatchId(@Param("batchId") Long batchId); |
| | | |
| | | default List<MesProBagCodeDO> selectListByIdsForUpdate(Collection<Long> ids) { |
| | | return selectList(new LambdaQueryWrapperX<MesProBagCodeDO>() |