15 小时以前 8655501ffb8dbdaf2508e575933063e6731be714
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/dal/mysql/pro/pallet/MesProPalletMapper.java
@@ -23,6 +23,14 @@
        return selectOne(MesProPalletDO::getCode, code);
    }
    default MesProPalletDO selectByTempCode(String tempCode) {
        return selectOne(MesProPalletDO::getTempCode, tempCode);
    }
    /** 生成临时托盘码用的全局序号:解析 temp_code 的数字后缀,不存在则返回 0 */
    @Select("SELECT IFNULL(MAX(CAST(SUBSTRING(temp_code, 4) AS UNSIGNED)), 0) FROM mes_pro_pallet WHERE deleted = 0")
    Integer selectMaxTempCodeSeq();
    @Select("SELECT * FROM mes_pro_pallet WHERE id = #{id} AND deleted = 0 FOR UPDATE")
    MesProPalletDO selectByIdForUpdate(@Param("id") Long id);
@@ -33,6 +41,7 @@
    default PageResult<MesProPalletDO> selectPage(MesProPalletPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<MesProPalletDO>()
                .likeIfPresent(MesProPalletDO::getCode, reqVO.getCode())
                .likeIfPresent(MesProPalletDO::getTempCode, reqVO.getTempCode())
                .eqIfPresent(MesProPalletDO::getBatchId, reqVO.getBatchId())
                .likeIfPresent(MesProPalletDO::getBatchCode, reqVO.getBatchCode())
                .eqIfPresent(MesProPalletDO::getStatus, reqVO.getStatus())
@@ -49,4 +58,13 @@
    @Select("SELECT IFNULL(MAX(pallet_no), 0) FROM mes_pro_pallet WHERE batch_id = #{batchId}")
    Integer selectMaxPalletNo(@Param("batchId") Long batchId);
    @org.apache.ibatis.annotations.Update("UPDATE mes_pro_pallet SET sales_id = #{salesId}, outbound_time = #{outboundTime}, update_time = NOW() "
            + "WHERE id = #{id} AND deleted = 0")
    void markOutbound(@Param("id") Long id, @Param("salesId") Long salesId,
                      @Param("outboundTime") java.time.LocalDateTime outboundTime);
    @org.apache.ibatis.annotations.Update("UPDATE mes_pro_pallet SET sales_id = NULL, outbound_time = NULL, update_time = NOW() "
            + "WHERE id = #{id} AND deleted = 0")
    void clearOutbound(@Param("id") Long id);
}